diff --git a/.gitignore b/.gitignore index f188258..56d99d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,78 +1,78 @@ -# 基本 Qt 项目 .gitignore — 忽略中间文件和构建产物 - -# 构建目录(你的工作区包含这些目录) -arm_build/ -arm_debug_build/ -x86_build/ -build*/ -*/build/ - -# Qt Creator / qmake -*.pro.user -*.pro.user.* -.qmake.stash - -# Make / ninja / qmake 生成文件 -Makefile -Makefile.* -cmake_install.cmake -CMakeCache.txt - -# 对象文件和库 -*.o -*.obj -*.lo -*.la -*.al -*.a -*.so -*.dylib -*.dll -*.lib -*.exe - -# moc / uic / rcc 生成的源和头 -moc_* -*moc.cpp -ui_*.h -ui_*.hpp -qrc_*.cpp -qrc_*.h -*.moc - -# 临时/备份/日志 -*.log -*.tmp -*.swp -*~ -*.orig - -# IDE / 编辑器 -.idea/ -.vscode/ -*.user - -# macOS / Windows -.DS_Store -Thumbs.db - -# 覆盖率 / 测试输出 -coverage/ -*.gcda -*.gcno - -# QML/Qt 缓存(可选) -qmlcache/ - -# 其他可能的二进制产物 -dist/ -bin/ -。 -.svn/ -.cproject -.project - -printImage.* -printImageScene.bmp -printSceneView.png +# 基本 Qt 项目 .gitignore — 忽略中间文件和构建产物 + +# 构建目录(你的工作区包含这些目录) +arm_build/ +arm_debug_build/ +x86_build/ +build*/ +*/build/ + +# Qt Creator / qmake +*.pro.user +*.pro.user.* +.qmake.stash + +# Make / ninja / qmake 生成文件 +Makefile +Makefile.* +cmake_install.cmake +CMakeCache.txt + +# 对象文件和库 +*.o +*.obj +*.lo +*.la +*.al +*.a +*.so +*.dylib +*.dll +*.lib +*.exe + +# moc / uic / rcc 生成的源和头 +moc_* +*moc.cpp +ui_*.h +ui_*.hpp +qrc_*.cpp +qrc_*.h +*.moc + +# 临时/备份/日志 +*.log +*.tmp +*.swp +*~ +*.orig + +# IDE / 编辑器 +.idea/ +.vscode/ +*.user + +# macOS / Windows +.DS_Store +Thumbs.db + +# 覆盖率 / 测试输出 +coverage/ +*.gcda +*.gcno + +# QML/Qt 缓存(可选) +qmlcache/ + +# 其他可能的二进制产物 +dist/ +bin/ +。 +.svn/ +.cproject +.project + +printImage.* +printImageScene.bmp +printSceneView.png dbg.txt \ No newline at end of file diff --git a/Aes/TAesClass.cpp b/Aes/TAesClass.cpp index e2133c1..7788e35 100644 --- a/Aes/TAesClass.cpp +++ b/Aes/TAesClass.cpp @@ -1,529 +1,529 @@ -#include "TAesClass.h" -#if 1 -unsigned char AesSbox[16*16]= -{// populate the Sbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -}; - -unsigned char AesiSbox[16*16]= -{ - // populate the iSbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d -}; -unsigned char AesRcon[11*4]= -{ - 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x00 -}; -#endif -Aes::~Aes() -{ - -} -Aes::Aes() -{ - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//构造函数 -Aes::Aes(int keysize,unsigned char* keyBytes) -{ - SetNbNkNr(keysize); //设置密钥块数,轮数 - memcpy(key,keyBytes,keysize); //字符串拷贝函数,把keyBytes的keysize个字符复制到key中 - KeyExpansion(); //密钥扩展,必须提前做的初始化 -} -//////////////////////////////////////////////////////////////////////////////////////////////// -void Aes::SetNbNkNr(int keySize) -{ - Nb=4; - if(keySize==Bits128) - { - Nk=4; //4*4字节,128位密钥,10轮加密 - Nr=10; - } - else if(keySize==Bits192) - { - Nk=6; //6*4字节,192位密钥,12轮加密 - Nr=12; - } - else if(keySize==Bits256) - { - Nk=8; //8*4字节,256位密钥,14轮加密 - Nr=14; - } -} -//////////////////////////////////////////////////////////////////////////////////////////////// -void Aes::KeyExpansion() -{ - - memset(w,0,16*15); - for(int row=0;row 6 && (row % Nk == 4) ) //这个还没有搞清楚 - { - temp = SubWord(temp); - } - - // w[row] = w[row-Nk] xor temp - w[4*row+0] = (byte) ( (int) w[4*(row-Nk)+0] ^ (int)temp[0] ); - w[4*row+1] = (byte) ( (int) w[4*(row-Nk)+1] ^ (int)temp[1] ); - w[4*row+2] = (byte) ( (int) w[4*(row-Nk)+2] ^ (int)temp[2] ); - w[4*row+3] = (byte) ( (int) w[4*(row-Nk)+3] ^ (int)temp[3] ); - } // for loop - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//密钥移位函数 -unsigned char* Aes::RotWord(unsigned char* word) -{ - byte* temp = new byte[4]; - temp[0] = word[1]; - temp[1] = word[2]; - temp[2] = word[3]; - temp[3] = word[0]; - return temp; -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//密钥字代换函数 -unsigned char* Aes::SubWord(unsigned char* word) -{ - byte* temp = new byte[4]; - for(int j=0;j<4;j++) - { - temp[j] = AesSbox[16*(word[j] >> 4)+(word[j] & 0x0f)]; //实际上也可以写成AesSbox[[j]];因为两者相等 - } - return temp; - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//Aes加密函数 -void Aes::Cipher(unsigned char* input, unsigned char* output) -{ - memset(&State[0][0],0,16); - for(int i=0;i<4*Nb;i++) //这里是先写列后写行的,即输入是一列一列的进来的 - { - State[i%4][i/4]=input[i]; //换成先写行后写列也是可以的,只要在输出时也是这样就可以了 - } - AddRoundKey(0); //轮密钥加 - - for (int round = 1; round <= (Nr - 1); round++) // main round loop - { - SubBytes(); //字节代换 - ShiftRows(); //行移位 - MixColumns(); //列混淆 - AddRoundKey(round); //轮密钥加 - } // main round loop - - SubBytes(); //字节代换 - ShiftRows(); //行移位 - AddRoundKey(Nr); //轮密钥加 - - // output = state - for (int i = 0; i < (4 * Nb); i++) - { - output[i] = State[i % 4][ i / 4]; - } - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//Aes解密函数 -void Aes::InvCipher(unsigned char* input,unsigned char* output) -{ - memset(&State[0][0],0,16); - for (int i = 0; i < (4 * Nb); i++) - { - State[i % 4][ i / 4] = input[i]; - } - - AddRoundKey(Nr); - - for (int round = Nr-1; round >= 1; round--) // main round loop - { - InvShiftRows(); - InvSubBytes(); - AddRoundKey(round); - InvMixColumns(); - } // end main round loop for InvCipher - - InvShiftRows(); - InvSubBytes(); - AddRoundKey(0); - - // output = state - for (int i = 0; i < (4 * Nb); i++) - { - output[i] = State[i % 4][ i / 4]; - } -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//轮密钥加 -void Aes::AddRoundKey(int round) -{ - int i,j; //i行 j列 //因为密钥w是一列一列排列的,即 k0 k4 k8 k12 - for(j=0;j<4;j++) // k1 k5 k9 k13 - { // k2 k6 k10k14 - for(i=0;i<4;i++) // k3 k7 k11k15 - { // 所以i行j列的下标是4*((round*4)+j)+i即16*round+4*j+i - State[i][j]=(unsigned char)((int)State[i][j]^(int)w[4*((round*4)+j)+i]); - } - } -} -//////////////////////////////////////////////////////////////////////////////////////////////// -//字节代换函数 -void Aes::SubBytes() //Page 103 -{ - int i,j; - for(j=0;j<4;j++) - { - for(i=0;i<4;i++) - { - State[i][j]=AesSbox[State[i][j]]; - //因为 16*(State[i][j]>>4)+State[i][j]&0x0f=State[i][j] - - - } - } -} - -void Aes::InvSubBytes() -{ - int i,j; - for(j=0;j<4;j++) - { - for(i=0;i<4;i++) - { - State[i][j]=AesiSbox[State[i][j]]; //因为 16*(State[i][j]>>4)+State[i][j]&0x0f=State[i][j] - } - } - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -void Aes::ShiftRows() -{ - unsigned char temp[4*4]; //Page105 - int i,j; - for(j=0;j<4;j++) - { - for(i=0;i<4;i++) - { - temp[4*i+j]=State[i][j]; - } - } - for(i=1;i<4;i++) - { - for(j=0;j<4;j++) - { - if(i==1)State[i][j]=temp[4*i+(j+1)%4]; //第一行左移1位 - else if(i==2)State[i][j]=temp[4*i+(j+2)%4]; //第二行左移2位 - else if(i==3)State[i][j]=temp[4*i+(j+3)%4]; //第三行左移3位 - } - } - -} -void Aes::InvShiftRows() -{ - unsigned char temp[4*4]; - int i,j; - for(j=0;j<4;j++) - { - for(i=0;i<4;i++) - { - temp[4*i+j]=State[i][j]; - } - } - for(i=1;i<4;i++) - { - for(j=0;j<4;j++) - { - //if(i==1)State[i][j]=temp[4*i+(j-1)%4]; 在此犯了一个错误 -1%4=-1 而不是3,所以采用了下面再加一个4的做法 - if(i==1)State[i][j]=temp[4*i+(j+3)%4]; //第一行右移1位 j-1+4=j+3 - else if(i==2)State[i][j]=temp[4*i+(j+2)%4]; //第二行右移2位 j-2+4=j+2 - else if(i==3)State[i][j]=temp[4*i+(j+1)%4]; //第三行右移3位 j-3+4=j+2 - } - } - -} -//////////////////////////////////////////////////////////////////////////////////////////////// -void Aes::MixColumns() -{ - unsigned char temp[4*4]; - int i,j; - for(j=0;j<4;j++) //2 3 1 1 列混淆矩阵 Page107 - { //1 2 3 1 - for(i=0;i<4;i++) //1 1 2 3 - { //3 1 1 2 - temp[4*i+j]=State[i][j]; - } - } - for(j=0;j<4;j++) - { - State[0][j] = (unsigned char) ( (int)gfmultby02(temp[0+j]) ^ (int)gfmultby03(temp[4*1+j]) ^ - (int)gfmultby01(temp[4*2+j]) ^ (int)gfmultby01(temp[4*3+j]) ); - State[1][j] = (unsigned char) ( (int)gfmultby01(temp[0+j]) ^ (int)gfmultby02(temp[4*1+j]) ^ - (int)gfmultby03(temp[4*2+j]) ^ (int)gfmultby01(temp[4*3+j]) ); - State[2][j] = (unsigned char) ( (int)gfmultby01(temp[0+j]) ^ (int)gfmultby01(temp[4*1+j]) ^ - (int)gfmultby02(temp[4*2+j]) ^ (int)gfmultby03(temp[4*3+j]) ); - State[3][j] = (unsigned char) ( (int)gfmultby03(temp[0+j]) ^ (int)gfmultby01(temp[4*1+j]) ^ - (int)gfmultby01(temp[4*2+j]) ^ (int)gfmultby02(temp[4*3+j]) ); - } - -} -void Aes::InvMixColumns() -{ - unsigned char temp[4*4]; - int i,j; - for (i = 0; i < 4; i++) // copy State into temp[] - { - for (j = 0; j < 4; j++) //0e 0b 0d 09 逆变换矩阵 Page108 - { //09 0e 0b 0d - temp[4*i+j] = State[i][j]; //0d 09 0e 0b - } //0b 0d 09 0e - } - - for (j = 0; j < 4; j++) - { - State[0][j] = (unsigned char) ( (int)gfmultby0e(temp[j]) ^ (int)gfmultby0b(temp[4+j]) ^ - (int)gfmultby0d(temp[4*2+j]) ^ (int)gfmultby09(temp[4*3+j]) ); - State[1][j] = (unsigned char) ( (int)gfmultby09(temp[j]) ^ (int)gfmultby0e(temp[4+j]) ^ - (int)gfmultby0b(temp[4*2+j]) ^ (int)gfmultby0d(temp[4*3+j]) ); - State[2][j] = (unsigned char) ( (int)gfmultby0d(temp[j]) ^ (int)gfmultby09(temp[4+j]) ^ - (int)gfmultby0e(temp[4*2+j]) ^ (int)gfmultby0b(temp[4*3+j]) ); - State[3][j] = (unsigned char) ( (int)gfmultby0b(temp[j]) ^ (int)gfmultby0d(temp[4+j]) ^ - (int)gfmultby09(temp[4*2+j]) ^ (int)gfmultby0e(temp[4*3+j]) ); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////// -unsigned char Aes::gfmultby01(unsigned char b) -{ - return b; -} -unsigned char Aes::gfmultby02(unsigned char b) -{ - if (b < 0x80) - return (unsigned char)(int)(b <<1); - else - return (unsigned char)( (int)(b << 1) ^ (int)(0x1b) ); -} - -unsigned char Aes::gfmultby03(unsigned char b) -{ - return (unsigned char) ( (int)gfmultby02(b) ^ (int)b ); -} - -unsigned char Aes::gfmultby09(unsigned char b) -{ - return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ (int)b ); -} - -unsigned char Aes::gfmultby0b(unsigned char b) -{ - return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ - (int)gfmultby02(b) ^ (int)b ); -} - -unsigned char Aes::gfmultby0d(unsigned char b) -{ - return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ - (int)gfmultby02(gfmultby02(b)) ^ (int)(b) ); -} - -unsigned char Aes::gfmultby0e(unsigned char b) -{ - return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ - (int)gfmultby02(gfmultby02(b)) ^(int)gfmultby02(b) ); -} - -TAesClass::TAesClass() -{ - m_lpAes=NULL; - InitializePrivateKey(16,(unsigned char*)"\x49\x76\x48\x6B\x27\x66\x7E\x65\x72\x35\x73\x15\x8C\x3B\x80\x40"); -} - -TAesClass::~TAesClass() -{ - if (m_lpAes!=NULL) - { - delete m_lpAes; - } -} -//------------------------------------------------------------------------------------------------------------ -// 编写人员:wfnhddd -// -// 函数名称:InitializeAes -// -// 函数描述:初始化AES 密钥,密钥用于加密解密 -// -// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 -// -// 返回数值:无 -// -// 最近修改:2009 年 08 月 07 日 -//------------------------------------------------------------------------------------------------------------ - - -VOID TAesClass::InitializePrivateKey(DWORD KeySize,UCHAR *KeyBytes) -{ - if (m_lpAes) - { - delete m_lpAes; - m_lpAes=NULL; - } - m_lpAes=new Aes(KeySize,KeyBytes); - -} - -//------------------------------------------------------------------------------------------------------------ -// 编写人员:wfnhddd -// -// 函数名称:OnAesEncrypt -// -// 函数描述:用AES加密算法加密数据 -// -// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 -// -// 返回数值:加密后的数据大小 ,错误返回值 0 -// -// 最近修改:2009 年 08 月 07 日 -//------------------------------------------------------------------------------------------------------------ - -DWORD TAesClass::OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer) -{ - DWORD OutLength=0; - if (m_lpAes==NULL||OutBuffer==NULL) - { - return 0; - } - - UCHAR *lpCurInBuff=(UCHAR *)InBuffer; - UCHAR *lpCurOutBuff=(UCHAR *)OutBuffer; - long blocknum=InLength/16; - long leftnum=InLength%16; - for(long i=0;iCipher(lpCurInBuff,lpCurOutBuff); - lpCurInBuff+=16; - lpCurOutBuff+=16; - OutLength+=16; - } - if(leftnum) //多余出leftnum 字节 则加密时 多出16-leftnum 个字节 - { - UCHAR inbuff[16]; - memset(inbuff,0,16); - memcpy(inbuff,lpCurInBuff,leftnum); - m_lpAes->Cipher(inbuff,lpCurOutBuff); - lpCurOutBuff+=16; - OutLength+=16; - } - //新增16个字节,用以确定增加的字节数 - UCHAR extrabuff[16]; - memset(extrabuff,0,16); - *((LPDWORD)extrabuff)=16+(16-leftnum)%16; //多出16+(16-leftnum)%16个字节 - m_lpAes->Cipher(extrabuff,lpCurOutBuff); - OutLength+=16; - return OutLength; - -} - - -//------------------------------------------------------------------------------------------------------------ -// 编写人员:wfnhddd -// -// 函数名称:OnAesUncrypt -// -// 函数描述:用AES加密算法解密数据 -// -// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 -// -// 返回数值:解密后的数据大小 ,错误返回值 0 -// -// 最近修改:2009 年 08 月 07 日 -//------------------------------------------------------------------------------------------------------------ -DWORD TAesClass::OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer) -{ - DWORD OutLength=0; - if (m_lpAes==NULL||OutBuffer==NULL) - { - return 0; - } - UCHAR *lpCurInBuff=(UCHAR *)InBuffer; - UCHAR *lpCurOutBuff=(UCHAR *)OutBuffer; - long blocknum=InLength/16; - long leftnum=InLength%16; - if(leftnum) - { - return 0; - } - for(long i=0;iInvCipher(lpCurInBuff,lpCurOutBuff); - lpCurInBuff+=16; - lpCurOutBuff+=16; - OutLength+=16; - } - - UCHAR *lpExtraInBuff=lpCurOutBuff-16; - DWORD dwExtraBytes=*((LPDWORD)lpExtraInBuff); - return (OutLength-dwExtraBytes); - -} +#include "TAesClass.h" +#if 1 +unsigned char AesSbox[16*16]= +{// populate the Sbox matrix + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 +}; + +unsigned char AesiSbox[16*16]= +{ + // populate the iSbox matrix + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d +}; +unsigned char AesRcon[11*4]= +{ + 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00 +}; +#endif +Aes::~Aes() +{ + +} +Aes::Aes() +{ + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//构造函数 +Aes::Aes(int keysize,unsigned char* keyBytes) +{ + SetNbNkNr(keysize); //设置密钥块数,轮数 + memcpy(key,keyBytes,keysize); //字符串拷贝函数,把keyBytes的keysize个字符复制到key中 + KeyExpansion(); //密钥扩展,必须提前做的初始化 +} +//////////////////////////////////////////////////////////////////////////////////////////////// +void Aes::SetNbNkNr(int keySize) +{ + Nb=4; + if(keySize==Bits128) + { + Nk=4; //4*4字节,128位密钥,10轮加密 + Nr=10; + } + else if(keySize==Bits192) + { + Nk=6; //6*4字节,192位密钥,12轮加密 + Nr=12; + } + else if(keySize==Bits256) + { + Nk=8; //8*4字节,256位密钥,14轮加密 + Nr=14; + } +} +//////////////////////////////////////////////////////////////////////////////////////////////// +void Aes::KeyExpansion() +{ + + memset(w,0,16*15); + for(int row=0;row 6 && (row % Nk == 4) ) //这个还没有搞清楚 + { + temp = SubWord(temp); + } + + // w[row] = w[row-Nk] xor temp + w[4*row+0] = (byte) ( (int) w[4*(row-Nk)+0] ^ (int)temp[0] ); + w[4*row+1] = (byte) ( (int) w[4*(row-Nk)+1] ^ (int)temp[1] ); + w[4*row+2] = (byte) ( (int) w[4*(row-Nk)+2] ^ (int)temp[2] ); + w[4*row+3] = (byte) ( (int) w[4*(row-Nk)+3] ^ (int)temp[3] ); + } // for loop + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//密钥移位函数 +unsigned char* Aes::RotWord(unsigned char* word) +{ + byte* temp = new byte[4]; + temp[0] = word[1]; + temp[1] = word[2]; + temp[2] = word[3]; + temp[3] = word[0]; + return temp; +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//密钥字代换函数 +unsigned char* Aes::SubWord(unsigned char* word) +{ + byte* temp = new byte[4]; + for(int j=0;j<4;j++) + { + temp[j] = AesSbox[16*(word[j] >> 4)+(word[j] & 0x0f)]; //实际上也可以写成AesSbox[[j]];因为两者相等 + } + return temp; + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//Aes加密函数 +void Aes::Cipher(unsigned char* input, unsigned char* output) +{ + memset(&State[0][0],0,16); + for(int i=0;i<4*Nb;i++) //这里是先写列后写行的,即输入是一列一列的进来的 + { + State[i%4][i/4]=input[i]; //换成先写行后写列也是可以的,只要在输出时也是这样就可以了 + } + AddRoundKey(0); //轮密钥加 + + for (int round = 1; round <= (Nr - 1); round++) // main round loop + { + SubBytes(); //字节代换 + ShiftRows(); //行移位 + MixColumns(); //列混淆 + AddRoundKey(round); //轮密钥加 + } // main round loop + + SubBytes(); //字节代换 + ShiftRows(); //行移位 + AddRoundKey(Nr); //轮密钥加 + + // output = state + for (int i = 0; i < (4 * Nb); i++) + { + output[i] = State[i % 4][ i / 4]; + } + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//Aes解密函数 +void Aes::InvCipher(unsigned char* input,unsigned char* output) +{ + memset(&State[0][0],0,16); + for (int i = 0; i < (4 * Nb); i++) + { + State[i % 4][ i / 4] = input[i]; + } + + AddRoundKey(Nr); + + for (int round = Nr-1; round >= 1; round--) // main round loop + { + InvShiftRows(); + InvSubBytes(); + AddRoundKey(round); + InvMixColumns(); + } // end main round loop for InvCipher + + InvShiftRows(); + InvSubBytes(); + AddRoundKey(0); + + // output = state + for (int i = 0; i < (4 * Nb); i++) + { + output[i] = State[i % 4][ i / 4]; + } +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//轮密钥加 +void Aes::AddRoundKey(int round) +{ + int i,j; //i行 j列 //因为密钥w是一列一列排列的,即 k0 k4 k8 k12 + for(j=0;j<4;j++) // k1 k5 k9 k13 + { // k2 k6 k10k14 + for(i=0;i<4;i++) // k3 k7 k11k15 + { // 所以i行j列的下标是4*((round*4)+j)+i即16*round+4*j+i + State[i][j]=(unsigned char)((int)State[i][j]^(int)w[4*((round*4)+j)+i]); + } + } +} +//////////////////////////////////////////////////////////////////////////////////////////////// +//字节代换函数 +void Aes::SubBytes() //Page 103 +{ + int i,j; + for(j=0;j<4;j++) + { + for(i=0;i<4;i++) + { + State[i][j]=AesSbox[State[i][j]]; + //因为 16*(State[i][j]>>4)+State[i][j]&0x0f=State[i][j] + + + } + } +} + +void Aes::InvSubBytes() +{ + int i,j; + for(j=0;j<4;j++) + { + for(i=0;i<4;i++) + { + State[i][j]=AesiSbox[State[i][j]]; //因为 16*(State[i][j]>>4)+State[i][j]&0x0f=State[i][j] + } + } + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +void Aes::ShiftRows() +{ + unsigned char temp[4*4]; //Page105 + int i,j; + for(j=0;j<4;j++) + { + for(i=0;i<4;i++) + { + temp[4*i+j]=State[i][j]; + } + } + for(i=1;i<4;i++) + { + for(j=0;j<4;j++) + { + if(i==1)State[i][j]=temp[4*i+(j+1)%4]; //第一行左移1位 + else if(i==2)State[i][j]=temp[4*i+(j+2)%4]; //第二行左移2位 + else if(i==3)State[i][j]=temp[4*i+(j+3)%4]; //第三行左移3位 + } + } + +} +void Aes::InvShiftRows() +{ + unsigned char temp[4*4]; + int i,j; + for(j=0;j<4;j++) + { + for(i=0;i<4;i++) + { + temp[4*i+j]=State[i][j]; + } + } + for(i=1;i<4;i++) + { + for(j=0;j<4;j++) + { + //if(i==1)State[i][j]=temp[4*i+(j-1)%4]; 在此犯了一个错误 -1%4=-1 而不是3,所以采用了下面再加一个4的做法 + if(i==1)State[i][j]=temp[4*i+(j+3)%4]; //第一行右移1位 j-1+4=j+3 + else if(i==2)State[i][j]=temp[4*i+(j+2)%4]; //第二行右移2位 j-2+4=j+2 + else if(i==3)State[i][j]=temp[4*i+(j+1)%4]; //第三行右移3位 j-3+4=j+2 + } + } + +} +//////////////////////////////////////////////////////////////////////////////////////////////// +void Aes::MixColumns() +{ + unsigned char temp[4*4]; + int i,j; + for(j=0;j<4;j++) //2 3 1 1 列混淆矩阵 Page107 + { //1 2 3 1 + for(i=0;i<4;i++) //1 1 2 3 + { //3 1 1 2 + temp[4*i+j]=State[i][j]; + } + } + for(j=0;j<4;j++) + { + State[0][j] = (unsigned char) ( (int)gfmultby02(temp[0+j]) ^ (int)gfmultby03(temp[4*1+j]) ^ + (int)gfmultby01(temp[4*2+j]) ^ (int)gfmultby01(temp[4*3+j]) ); + State[1][j] = (unsigned char) ( (int)gfmultby01(temp[0+j]) ^ (int)gfmultby02(temp[4*1+j]) ^ + (int)gfmultby03(temp[4*2+j]) ^ (int)gfmultby01(temp[4*3+j]) ); + State[2][j] = (unsigned char) ( (int)gfmultby01(temp[0+j]) ^ (int)gfmultby01(temp[4*1+j]) ^ + (int)gfmultby02(temp[4*2+j]) ^ (int)gfmultby03(temp[4*3+j]) ); + State[3][j] = (unsigned char) ( (int)gfmultby03(temp[0+j]) ^ (int)gfmultby01(temp[4*1+j]) ^ + (int)gfmultby01(temp[4*2+j]) ^ (int)gfmultby02(temp[4*3+j]) ); + } + +} +void Aes::InvMixColumns() +{ + unsigned char temp[4*4]; + int i,j; + for (i = 0; i < 4; i++) // copy State into temp[] + { + for (j = 0; j < 4; j++) //0e 0b 0d 09 逆变换矩阵 Page108 + { //09 0e 0b 0d + temp[4*i+j] = State[i][j]; //0d 09 0e 0b + } //0b 0d 09 0e + } + + for (j = 0; j < 4; j++) + { + State[0][j] = (unsigned char) ( (int)gfmultby0e(temp[j]) ^ (int)gfmultby0b(temp[4+j]) ^ + (int)gfmultby0d(temp[4*2+j]) ^ (int)gfmultby09(temp[4*3+j]) ); + State[1][j] = (unsigned char) ( (int)gfmultby09(temp[j]) ^ (int)gfmultby0e(temp[4+j]) ^ + (int)gfmultby0b(temp[4*2+j]) ^ (int)gfmultby0d(temp[4*3+j]) ); + State[2][j] = (unsigned char) ( (int)gfmultby0d(temp[j]) ^ (int)gfmultby09(temp[4+j]) ^ + (int)gfmultby0e(temp[4*2+j]) ^ (int)gfmultby0b(temp[4*3+j]) ); + State[3][j] = (unsigned char) ( (int)gfmultby0b(temp[j]) ^ (int)gfmultby0d(temp[4+j]) ^ + (int)gfmultby09(temp[4*2+j]) ^ (int)gfmultby0e(temp[4*3+j]) ); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////// +unsigned char Aes::gfmultby01(unsigned char b) +{ + return b; +} +unsigned char Aes::gfmultby02(unsigned char b) +{ + if (b < 0x80) + return (unsigned char)(int)(b <<1); + else + return (unsigned char)( (int)(b << 1) ^ (int)(0x1b) ); +} + +unsigned char Aes::gfmultby03(unsigned char b) +{ + return (unsigned char) ( (int)gfmultby02(b) ^ (int)b ); +} + +unsigned char Aes::gfmultby09(unsigned char b) +{ + return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ (int)b ); +} + +unsigned char Aes::gfmultby0b(unsigned char b) +{ + return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ + (int)gfmultby02(b) ^ (int)b ); +} + +unsigned char Aes::gfmultby0d(unsigned char b) +{ + return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ + (int)gfmultby02(gfmultby02(b)) ^ (int)(b) ); +} + +unsigned char Aes::gfmultby0e(unsigned char b) +{ + return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b))) ^ + (int)gfmultby02(gfmultby02(b)) ^(int)gfmultby02(b) ); +} + +TAesClass::TAesClass() +{ + m_lpAes=NULL; + InitializePrivateKey(16,(unsigned char*)"\x49\x76\x48\x6B\x27\x66\x7E\x65\x72\x35\x73\x15\x8C\x3B\x80\x40"); +} + +TAesClass::~TAesClass() +{ + if (m_lpAes!=NULL) + { + delete m_lpAes; + } +} +//------------------------------------------------------------------------------------------------------------ +// 编写人员:wfnhddd +// +// 函数名称:InitializeAes +// +// 函数描述:初始化AES 密钥,密钥用于加密解密 +// +// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 +// +// 返回数值:无 +// +// 最近修改:2009 年 08 月 07 日 +//------------------------------------------------------------------------------------------------------------ + + +VOID TAesClass::InitializePrivateKey(DWORD KeySize,UCHAR *KeyBytes) +{ + if (m_lpAes) + { + delete m_lpAes; + m_lpAes=NULL; + } + m_lpAes=new Aes(KeySize,KeyBytes); + +} + +//------------------------------------------------------------------------------------------------------------ +// 编写人员:wfnhddd +// +// 函数名称:OnAesEncrypt +// +// 函数描述:用AES加密算法加密数据 +// +// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 +// +// 返回数值:加密后的数据大小 ,错误返回值 0 +// +// 最近修改:2009 年 08 月 07 日 +//------------------------------------------------------------------------------------------------------------ + +DWORD TAesClass::OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer) +{ + DWORD OutLength=0; + if (m_lpAes==NULL||OutBuffer==NULL) + { + return 0; + } + + UCHAR *lpCurInBuff=(UCHAR *)InBuffer; + UCHAR *lpCurOutBuff=(UCHAR *)OutBuffer; + long blocknum=InLength/16; + long leftnum=InLength%16; + for(long i=0;iCipher(lpCurInBuff,lpCurOutBuff); + lpCurInBuff+=16; + lpCurOutBuff+=16; + OutLength+=16; + } + if(leftnum) //多余出leftnum 字节 则加密时 多出16-leftnum 个字节 + { + UCHAR inbuff[16]; + memset(inbuff,0,16); + memcpy(inbuff,lpCurInBuff,leftnum); + m_lpAes->Cipher(inbuff,lpCurOutBuff); + lpCurOutBuff+=16; + OutLength+=16; + } + //新增16个字节,用以确定增加的字节数 + UCHAR extrabuff[16]; + memset(extrabuff,0,16); + *((LPDWORD)extrabuff)=16+(16-leftnum)%16; //多出16+(16-leftnum)%16个字节 + m_lpAes->Cipher(extrabuff,lpCurOutBuff); + OutLength+=16; + return OutLength; + +} + + +//------------------------------------------------------------------------------------------------------------ +// 编写人员:wfnhddd +// +// 函数名称:OnAesUncrypt +// +// 函数描述:用AES加密算法解密数据 +// +// 调用参数:详细说明参考 MSDN 中的相关描述或相关的开发文档 +// +// 返回数值:解密后的数据大小 ,错误返回值 0 +// +// 最近修改:2009 年 08 月 07 日 +//------------------------------------------------------------------------------------------------------------ +DWORD TAesClass::OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer) +{ + DWORD OutLength=0; + if (m_lpAes==NULL||OutBuffer==NULL) + { + return 0; + } + UCHAR *lpCurInBuff=(UCHAR *)InBuffer; + UCHAR *lpCurOutBuff=(UCHAR *)OutBuffer; + long blocknum=InLength/16; + long leftnum=InLength%16; + if(leftnum) + { + return 0; + } + for(long i=0;iInvCipher(lpCurInBuff,lpCurOutBuff); + lpCurInBuff+=16; + lpCurOutBuff+=16; + OutLength+=16; + } + + UCHAR *lpExtraInBuff=lpCurOutBuff-16; + DWORD dwExtraBytes=*((LPDWORD)lpExtraInBuff); + return (OutLength-dwExtraBytes); + +} diff --git a/Aes/TAesClass.h b/Aes/TAesClass.h index 8e5ae9a..f846f8f 100644 --- a/Aes/TAesClass.h +++ b/Aes/TAesClass.h @@ -1,134 +1,134 @@ -#ifndef __TAESCLASS_H__ -#define __TAESCLASS_H__ -#include -#include -#include -#include - -typedef unsigned long DWORD; -typedef unsigned char UCHAR,*PUCHAR; -typedef void *PVOID,*LPVOID; -typedef unsigned char byte; -typedef DWORD *PDWORD,*LPDWORD; - -#ifndef VOID -#define VOID void -#endif - -//#pragma once - -//enum KeySize { Bits128, Bits192, Bits256 }; // key size, in bits, for construtor -#define Bits128 16 -#define Bits192 24 -#define Bits256 32 -#if 0 -static unsigned char AesSbox[16*16]= -{// populate the Sbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -}; - -static unsigned char AesiSbox[16*16]= -{ - // populate the iSbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d -}; -static unsigned char AesRcon[11*4]= -{ - 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x00 -}; -#endif -extern unsigned char AesSbox[16*16]; -extern unsigned char AesiSbox[16*16]; -extern unsigned char AesRcon[11*4]; -class Aes // Advanced Encryption Standard -{ -public: - ~Aes(); - Aes(); - Aes(int keySize, unsigned char* keyBytes); - unsigned char State[4][4]; - void Cipher(unsigned char* input, unsigned char* output); // encipher 16-bit input - void InvCipher(unsigned char* input, unsigned char* output); // decipher 16-bit input -private: - int Nb; // block size in 32-bit words. Always 4 for AES. (128 bits). - int Nk; // key size in 32-bit words. 4, 6, 8. (128, 192, 256 bits). - int Nr; // number of rounds. 10, 12, 14. - - unsigned char key[32]; - unsigned char w[16*15]; - - void SetNbNkNr(int keySize); - void AddRoundKey(int round); //轮密钥加 - void SubBytes(); //S盒字节代换 - void InvSubBytes(); //逆S盒字节代换 - void ShiftRows(); //行移位 - void InvShiftRows(); - void MixColumns(); //列混淆 - void InvMixColumns(); - unsigned char gfmultby01(unsigned char b); - unsigned char gfmultby02(unsigned char b); - unsigned char gfmultby03(unsigned char b); - unsigned char gfmultby09(unsigned char b); - unsigned char gfmultby0b(unsigned char b); - unsigned char gfmultby0d(unsigned char b); - unsigned char gfmultby0e(unsigned char b); - void KeyExpansion(); //密钥扩展 - unsigned char* SubWord(unsigned char* word); //密钥S盒字代换 - unsigned char* RotWord(unsigned char* word); //密钥移位 - -}; - -class TAesClass -{ -public: - TAesClass(); - ~TAesClass(); - void InitializePrivateKey(DWORD KeySize,UCHAR *KeyBytes); //AES 密钥初始化 - DWORD OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 加密数据 - DWORD OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 解密数据 -private: - Aes * m_lpAes; -}; -#endif +#ifndef __TAESCLASS_H__ +#define __TAESCLASS_H__ +#include +#include +#include +#include + +typedef unsigned long DWORD; +typedef unsigned char UCHAR,*PUCHAR; +typedef void *PVOID,*LPVOID; +typedef unsigned char byte; +typedef DWORD *PDWORD,*LPDWORD; + +#ifndef VOID +#define VOID void +#endif + +//#pragma once + +//enum KeySize { Bits128, Bits192, Bits256 }; // key size, in bits, for construtor +#define Bits128 16 +#define Bits192 24 +#define Bits256 32 +#if 0 +static unsigned char AesSbox[16*16]= +{// populate the Sbox matrix + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 +}; + +static unsigned char AesiSbox[16*16]= +{ + // populate the iSbox matrix + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d +}; +static unsigned char AesRcon[11*4]= +{ + 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00 +}; +#endif +extern unsigned char AesSbox[16*16]; +extern unsigned char AesiSbox[16*16]; +extern unsigned char AesRcon[11*4]; +class Aes // Advanced Encryption Standard +{ +public: + ~Aes(); + Aes(); + Aes(int keySize, unsigned char* keyBytes); + unsigned char State[4][4]; + void Cipher(unsigned char* input, unsigned char* output); // encipher 16-bit input + void InvCipher(unsigned char* input, unsigned char* output); // decipher 16-bit input +private: + int Nb; // block size in 32-bit words. Always 4 for AES. (128 bits). + int Nk; // key size in 32-bit words. 4, 6, 8. (128, 192, 256 bits). + int Nr; // number of rounds. 10, 12, 14. + + unsigned char key[32]; + unsigned char w[16*15]; + + void SetNbNkNr(int keySize); + void AddRoundKey(int round); //轮密钥加 + void SubBytes(); //S盒字节代换 + void InvSubBytes(); //逆S盒字节代换 + void ShiftRows(); //行移位 + void InvShiftRows(); + void MixColumns(); //列混淆 + void InvMixColumns(); + unsigned char gfmultby01(unsigned char b); + unsigned char gfmultby02(unsigned char b); + unsigned char gfmultby03(unsigned char b); + unsigned char gfmultby09(unsigned char b); + unsigned char gfmultby0b(unsigned char b); + unsigned char gfmultby0d(unsigned char b); + unsigned char gfmultby0e(unsigned char b); + void KeyExpansion(); //密钥扩展 + unsigned char* SubWord(unsigned char* word); //密钥S盒字代换 + unsigned char* RotWord(unsigned char* word); //密钥移位 + +}; + +class TAesClass +{ +public: + TAesClass(); + ~TAesClass(); + void InitializePrivateKey(DWORD KeySize,UCHAR *KeyBytes); //AES 密钥初始化 + DWORD OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 加密数据 + DWORD OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 解密数据 +private: + Aes * m_lpAes; +}; +#endif diff --git a/BarCode/barcode.h b/BarCode/barcode.h index 6b9bdf4..03af899 100644 --- a/BarCode/barcode.h +++ b/BarCode/barcode.h @@ -1,119 +1,119 @@ -/* - * barcode.h -- definitions for libbarcode - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef _BARCODE_H_ -#define _BARCODE_H_ - -#include - -#define BARCODE_VERSION "0.98" -#define BARCODE_VERSION_INT 9800 - -/* - * The object - */ -struct Barcode_Item { - int flags; /* type of encoding and decoding */ - char *ascii; /* malloced */ - char *partial; /* malloced too */ - char *textinfo; /* information about text positioning */ - char *encoding; /* code name, filled by encoding engine */ - int width, height; /* output units */ - int xoff, yoff; /* output units */ - int margin; /* output units */ - double scalef; /* requested scaling for barcode */ - int error; /* an errno-like value, in case of failure */ -}; - -/* - * The flags field - */ -#define BARCODE_DEFAULT_FLAGS 0x00000000 - -#define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ -#define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ -#define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ - -#define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ -#define BARCODE_OUT_EPS 0x00001000 -#define BARCODE_OUT_PS 0x00002000 -#define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ -/* PCL_III 0x00008000 */ -#define BARCODE_OUT_PCL_III 0x0000C000 -#define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ - -enum { - BARCODE_ANY = 0, /* choose best-fit */ - BARCODE_EAN, - BARCODE_UPC, /* upc == 12-digit ean */ - BARCODE_ISBN, /* isbn numbers (still EAN13) */ - BARCODE_39, /* code 39 */ - BARCODE_128, /* code 128 (a,b,c: autoselection) */ - BARCODE_128C, /* code 128 (compact form for digits) */ - BARCODE_128B, /* code 128, full printable ascii */ - BARCODE_I25, /* interleaved 2 of 5 (only digits) */ - BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ - BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ - BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ - BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ - BARCODE_93 /* code 93 (by Nathan D. Holmes) */ -}; - -#define BARCODE_DEFAULT_MARGIN 10 - -#ifdef __cplusplus -extern "C" { -#endif -/* - * Create and destroy barcode structures - */ -extern struct Barcode_Item *Barcode_Create(char *text); -extern int Barcode_Delete(struct Barcode_Item *bc); - -/* - * Encode and print - */ -extern int Barcode_Encode(struct Barcode_Item *bc, int flags); -extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); - -/* - * Choose the position - */ -extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, - int xoff, int yoff, double scalef); - -/* - * Do it all in one step - */ -extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags); - - -/* - * Return current version (integer and string) - */ -extern int Barcode_Version(char *versionname); - -#ifdef __cplusplus -} -#endif - -#endif /* _BARCODE_H_ */ +/* + * barcode.h -- definitions for libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _BARCODE_H_ +#define _BARCODE_H_ + +#include + +#define BARCODE_VERSION "0.98" +#define BARCODE_VERSION_INT 9800 + +/* + * The object + */ +struct Barcode_Item { + int flags; /* type of encoding and decoding */ + char *ascii; /* malloced */ + char *partial; /* malloced too */ + char *textinfo; /* information about text positioning */ + char *encoding; /* code name, filled by encoding engine */ + int width, height; /* output units */ + int xoff, yoff; /* output units */ + int margin; /* output units */ + double scalef; /* requested scaling for barcode */ + int error; /* an errno-like value, in case of failure */ +}; + +/* + * The flags field + */ +#define BARCODE_DEFAULT_FLAGS 0x00000000 + +#define BARCODE_ENCODING_MASK 0x000000ff /* 256 possibilites... */ +#define BARCODE_NO_ASCII 0x00000100 /* avoid text in output */ +#define BARCODE_NO_CHECKSUM 0x00000200 /* avoid checksum in output */ + +#define BARCODE_OUTPUT_MASK 0x000ff000 /* 256 output types */ +#define BARCODE_OUT_EPS 0x00001000 +#define BARCODE_OUT_PS 0x00002000 +#define BARCODE_OUT_PCL 0x00004000 /* by Andrea Scopece */ +/* PCL_III 0x00008000 */ +#define BARCODE_OUT_PCL_III 0x0000C000 +#define BARCODE_OUT_NOHEADERS 0x00100000 /* no header nor footer */ + +enum { + BARCODE_ANY = 0, /* choose best-fit */ + BARCODE_EAN, + BARCODE_UPC, /* upc == 12-digit ean */ + BARCODE_ISBN, /* isbn numbers (still EAN13) */ + BARCODE_39, /* code 39 */ + BARCODE_128, /* code 128 (a,b,c: autoselection) */ + BARCODE_128C, /* code 128 (compact form for digits) */ + BARCODE_128B, /* code 128, full printable ascii */ + BARCODE_I25, /* interleaved 2 of 5 (only digits) */ + BARCODE_128RAW, /* Raw code 128 (by Leonid A. Broukhis) */ + BARCODE_CBR, /* Codabar (by Leonid A. Broukhis) */ + BARCODE_MSI, /* MSI (by Leonid A. Broukhis) */ + BARCODE_PLS, /* Plessey (by Leonid A. Broukhis) */ + BARCODE_93 /* code 93 (by Nathan D. Holmes) */ +}; + +#define BARCODE_DEFAULT_MARGIN 10 + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Create and destroy barcode structures + */ +extern struct Barcode_Item *Barcode_Create(char *text); +extern int Barcode_Delete(struct Barcode_Item *bc); + +/* + * Encode and print + */ +extern int Barcode_Encode(struct Barcode_Item *bc, int flags); +extern int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags); + +/* + * Choose the position + */ +extern int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef); + +/* + * Do it all in one step + */ +extern int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + + +/* + * Return current version (integer and string) + */ +extern int Barcode_Version(char *versionname); + +#ifdef __cplusplus +} +#endif + +#endif /* _BARCODE_H_ */ diff --git a/BarCode/cmdline.c b/BarCode/cmdline.c index a69a825..b76ccb7 100644 --- a/BarCode/cmdline.c +++ b/BarCode/cmdline.c @@ -1,177 +1,177 @@ -/* - * cmdline.c -- parse a command line using getopt, environment and defaults - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - * - * Changes: - * Michele Comitini (mcm@glisco.it): better handling of numeric type args. - */ - -#include -#include -#include - -#ifdef NO_GETOPT - /* use replacement */ - #include "compat/getopt.h" -#else - #include -#endif - -#include "cmdline.h" - -/* In case of error, print help string and return error (-1) */ -int commandline_errormsg(FILE *f, struct commandline *args, - char *prgname, char *messagehead) -{ - char *buffer; - char *buffer2; - int len; - struct commandline *ptr; - - if (!messagehead) { - fprintf(f,"%s: Error in cmdline\nPossible options:\n",prgname); - } else { - fprintf(f,"%s: %s",prgname,messagehead); - } - - for (ptr = args; ptr->option; ptr++) { - if (ptr->descrip) { - len = strlen(ptr->descrip); - len += ptr->default_v ? strlen(ptr->default_v) : 6; - len += ptr->env ? strlen(ptr->env) : 6; - buffer2 = malloc(len+3); /* 3 to be safe :) */ - len += 32; - if (buffer2) { - buffer = malloc(len); - if (buffer) { - sprintf(buffer2, ptr->descrip, - ptr->default_v ? ptr->default_v : "(none)", - ptr->env ? ptr->env : "(none)"); - sprintf(buffer, " -%c %s %s", ptr->option, - ptr->type ? "" : " ", buffer2); - fprintf(f, "%s\n",buffer); - free(buffer); - } - free(buffer2); - } - } - } - return -1; -} - -/* - * Associate formats to type. - */ -struct type_fmt { - enum option_type type; - char *fmt; -}; -static struct type_fmt formats[] = { - {CMDLINE_I, "%i%s"}, /* the trailing "%s" is used for error check */ - {CMDLINE_D, "%d%s"}, - {CMDLINE_X, "%x%s"}, - {CMDLINE_O, "%o%s"}, - {CMDLINE_F, "%lf%s"}, - {CMDLINE_P, "%p%s"}, - {0, NULL} /* If we get here, it's CMDLINE_S: no sscanf buf strcpy() */ -}; - - -/* Parse one argument (default or provided) */ -static int commandline_oneopt(struct commandline *ptr, char *value) -{ - struct type_fmt *tptr; - char *trash = value ? strdup(value) : NULL; - - /* convert it, if needed */ - if ((ptr->type != CMDLINE_NONE) && ptr->result) { - for (tptr = formats; tptr->type; tptr++) - if (tptr->type == ptr->type) - break; - if (!tptr->type) /* not found: it is a string */ - *(char **)(ptr->result) = value; - else - if (sscanf(value, tptr->fmt, ptr->result, trash)!=1) { - free(trash); - return -1; - } - } - if (trash) - free(trash); - - if ((ptr->type == CMDLINE_NONE) && ptr->result) /* no type, just count */ - (*(int *)(ptr->result))++; - - /* call the function, if needed */ - if (ptr->fun) { - if (ptr->type) { - if (ptr->result) return ptr->fun(ptr->result); /* converted */ - return ptr->fun(value); /* type, but not converted */ - } - return ptr->fun(NULL); /* no type: just call it */ - } - return 0; -} - -/* The main function */ -int commandline(struct commandline *args, int argc, char **argv, - char *errorhead) -{ - struct commandline *ptr; - char *getopt_desc = (char *)calloc(512, 1); - int desc_offset = 0; - int opt, retval; - char *value; - - /* Build getopt string and process defaults values */ - for (ptr = args; ptr->option; ptr++) { - getopt_desc[desc_offset++] = ptr->option; - if (ptr->type) getopt_desc[desc_offset++] = ':'; - - value = NULL; - if (ptr->env) - value = getenv(ptr->env); - if (!value) - value = ptr->default_v; - if (value && (retval = commandline_oneopt(ptr, value))) { - /* - * if the function returns a specific (not -1) value, it already - * printed its message, so avoid the generic help - */ - if (retval == -1) - commandline_errormsg(stderr, args, argv[0], errorhead); - return retval; - } - } - - /* Run getopt and process material */ - while ((opt = getopt(argc, argv, getopt_desc)) != -1) { - for (ptr = args; ptr->option; ptr++) - if (opt == ptr->option) - break; - if (!ptr->option) /* unknown option */ - return commandline_errormsg(stderr, args, argv[0], errorhead); - if ( (retval = commandline_oneopt(ptr, optarg)) ) { /* wrong arg */ - if (retval == -1) - commandline_errormsg(stderr, args, argv[0], errorhead); - return retval; - } - } - return 0; -} +/* + * cmdline.c -- parse a command line using getopt, environment and defaults + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Changes: + * Michele Comitini (mcm@glisco.it): better handling of numeric type args. + */ + +#include +#include +#include + +#ifdef NO_GETOPT + /* use replacement */ + #include "compat/getopt.h" +#else + #include +#endif + +#include "cmdline.h" + +/* In case of error, print help string and return error (-1) */ +int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead) +{ + char *buffer; + char *buffer2; + int len; + struct commandline *ptr; + + if (!messagehead) { + fprintf(f,"%s: Error in cmdline\nPossible options:\n",prgname); + } else { + fprintf(f,"%s: %s",prgname,messagehead); + } + + for (ptr = args; ptr->option; ptr++) { + if (ptr->descrip) { + len = strlen(ptr->descrip); + len += ptr->default_v ? strlen(ptr->default_v) : 6; + len += ptr->env ? strlen(ptr->env) : 6; + buffer2 = malloc(len+3); /* 3 to be safe :) */ + len += 32; + if (buffer2) { + buffer = malloc(len); + if (buffer) { + sprintf(buffer2, ptr->descrip, + ptr->default_v ? ptr->default_v : "(none)", + ptr->env ? ptr->env : "(none)"); + sprintf(buffer, " -%c %s %s", ptr->option, + ptr->type ? "" : " ", buffer2); + fprintf(f, "%s\n",buffer); + free(buffer); + } + free(buffer2); + } + } + } + return -1; +} + +/* + * Associate formats to type. + */ +struct type_fmt { + enum option_type type; + char *fmt; +}; +static struct type_fmt formats[] = { + {CMDLINE_I, "%i%s"}, /* the trailing "%s" is used for error check */ + {CMDLINE_D, "%d%s"}, + {CMDLINE_X, "%x%s"}, + {CMDLINE_O, "%o%s"}, + {CMDLINE_F, "%lf%s"}, + {CMDLINE_P, "%p%s"}, + {0, NULL} /* If we get here, it's CMDLINE_S: no sscanf buf strcpy() */ +}; + + +/* Parse one argument (default or provided) */ +static int commandline_oneopt(struct commandline *ptr, char *value) +{ + struct type_fmt *tptr; + char *trash = value ? strdup(value) : NULL; + + /* convert it, if needed */ + if ((ptr->type != CMDLINE_NONE) && ptr->result) { + for (tptr = formats; tptr->type; tptr++) + if (tptr->type == ptr->type) + break; + if (!tptr->type) /* not found: it is a string */ + *(char **)(ptr->result) = value; + else + if (sscanf(value, tptr->fmt, ptr->result, trash)!=1) { + free(trash); + return -1; + } + } + if (trash) + free(trash); + + if ((ptr->type == CMDLINE_NONE) && ptr->result) /* no type, just count */ + (*(int *)(ptr->result))++; + + /* call the function, if needed */ + if (ptr->fun) { + if (ptr->type) { + if (ptr->result) return ptr->fun(ptr->result); /* converted */ + return ptr->fun(value); /* type, but not converted */ + } + return ptr->fun(NULL); /* no type: just call it */ + } + return 0; +} + +/* The main function */ +int commandline(struct commandline *args, int argc, char **argv, + char *errorhead) +{ + struct commandline *ptr; + char *getopt_desc = (char *)calloc(512, 1); + int desc_offset = 0; + int opt, retval; + char *value; + + /* Build getopt string and process defaults values */ + for (ptr = args; ptr->option; ptr++) { + getopt_desc[desc_offset++] = ptr->option; + if (ptr->type) getopt_desc[desc_offset++] = ':'; + + value = NULL; + if (ptr->env) + value = getenv(ptr->env); + if (!value) + value = ptr->default_v; + if (value && (retval = commandline_oneopt(ptr, value))) { + /* + * if the function returns a specific (not -1) value, it already + * printed its message, so avoid the generic help + */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + + /* Run getopt and process material */ + while ((opt = getopt(argc, argv, getopt_desc)) != -1) { + for (ptr = args; ptr->option; ptr++) + if (opt == ptr->option) + break; + if (!ptr->option) /* unknown option */ + return commandline_errormsg(stderr, args, argv[0], errorhead); + if ( (retval = commandline_oneopt(ptr, optarg)) ) { /* wrong arg */ + if (retval == -1) + commandline_errormsg(stderr, args, argv[0], errorhead); + return retval; + } + } + return 0; +} diff --git a/BarCode/cmdline.h b/BarCode/cmdline.h index 6931991..75e4fcf 100644 --- a/BarCode/cmdline.h +++ b/BarCode/cmdline.h @@ -1,58 +1,58 @@ -/* - * cmdline.h -- generic commandline editing (uses getopt, only short) - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - * - */ - -/* - * The options may have different arguments of different type - */ -enum option_type { - CMDLINE_NONE=0, /* no argument after option */ - CMDLINE_I, /* integer (any base) */ - CMDLINE_D, /* decimal integer */ - CMDLINE_X, /* hex integer */ - CMDLINE_O, /* octal integer */ - CMDLINE_S, /* string */ - CMDLINE_F, /* double float */ - CMDLINE_P, /* pointer */ -}; - - -struct commandline { - int option; /* Single byte: option id */ - int type; /* Type of argument, used in sscanf */ - void *result; /* Store data here, if non null */ - int (*fun)(void *); /* Call if defined: arg is "result" or input string */ - char *env; /* Where to get runtime defaults, may be NULL */ - char *default_v; /* The compile-time default, may be NULL */ - char *descrip; /* For err msg. May have %s's for default and env */ -}; - -/* returns: 0 or -1. "optarg" is global (see getopt) */ -extern int commandline(struct commandline *args, - int argc, char **argv, char *errorhead); - -/* prints an error message based on "args" */ -extern int commandline_errormsg(FILE *f, struct commandline *args, - char *prgname, char *messagehead); - - - - +/* + * cmdline.h -- generic commandline editing (uses getopt, only short) + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/* + * The options may have different arguments of different type + */ +enum option_type { + CMDLINE_NONE=0, /* no argument after option */ + CMDLINE_I, /* integer (any base) */ + CMDLINE_D, /* decimal integer */ + CMDLINE_X, /* hex integer */ + CMDLINE_O, /* octal integer */ + CMDLINE_S, /* string */ + CMDLINE_F, /* double float */ + CMDLINE_P, /* pointer */ +}; + + +struct commandline { + int option; /* Single byte: option id */ + int type; /* Type of argument, used in sscanf */ + void *result; /* Store data here, if non null */ + int (*fun)(void *); /* Call if defined: arg is "result" or input string */ + char *env; /* Where to get runtime defaults, may be NULL */ + char *default_v; /* The compile-time default, may be NULL */ + char *descrip; /* For err msg. May have %s's for default and env */ +}; + +/* returns: 0 or -1. "optarg" is global (see getopt) */ +extern int commandline(struct commandline *args, + int argc, char **argv, char *errorhead); + +/* prints an error message based on "args" */ +extern int commandline_errormsg(FILE *f, struct commandline *args, + char *prgname, char *messagehead); + + + + diff --git a/BarCode/codabar.c b/BarCode/codabar.c index 7065b9e..18a6dbd 100644 --- a/BarCode/codabar.c +++ b/BarCode/codabar.c @@ -1,182 +1,182 @@ -/* - * codabar.c -- encoding for Codabar - * - * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - - -/* this is ordered in decades to simplify encoding */ -static char alphabet[] = - "0123456789" "-$:/.+ABCD"; - -#define CODE_A 16 -#define CODE_B 17 - -#define NARROW 12 -#define WIDE 14 - -/* Patterns */ -static char *patterns[] = { -"1111133","1111331","1113113","3311111","1131131", -"3111131","1311113","1311311","1331111","3113111", -"1113311","1133111","3111313","3131113","3131311", -"1131313","1133131","1313113","1113133","1113331" }; - -/* - * Check that the text can be encoded. Returns 0 or -1. - * If it's all lowecase convert to uppercase and accept it. - * If the first character is a letter (A to D), the last one must be too; - * no other character should be a letter. - */ -int Barcode_cbr_verify(unsigned char *text) -{ - int i, lower=0, upper=0; - int startpresent = 0; - - if (!strlen(text)) - return -1; - for (i=0; text[i]; i++) { - char * pos; - if (isupper(text[i])) upper++; - if (islower(text[i])) lower++; - pos = strchr(alphabet,toupper(text[i])); - if (!pos) - return -1; - if (i == 0 && pos - alphabet >= CODE_A) - startpresent = 1; - else if (pos - alphabet >= CODE_A && - (!startpresent || i != strlen(text) - 1)) - return -1; - } - if (lower && upper) - return -1; - return 0; -} - -static int add_one(char *ptr, int code) -{ - sprintf(ptr,"1%s", /* separator */ patterns[code]); - return 0; -} - -/* - * The encoding functions fills the "partial" and "textinfo" fields. - * Lowercase chars are converted to uppercase - */ -int Barcode_cbr_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *c, *ptr, *textptr; - int i, code, textpos, usesum, checksum = 0, startpresent; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("codabar"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* the partial code is 8 * (head + text + check + tail) + margin + term. */ - partial = malloc( (strlen(text) + 3) * 8 + 2); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * (strlen + check) +term */ - textinfo = malloc(10*(strlen(text) + 1) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - ptr = partial; - textptr = textinfo; - textpos = 0; - usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1; - /* if no start character specified, A is used as a start character */ - if (!isalpha(text[0])) { - add_one(ptr, CODE_A); - ptr += strlen(ptr); - textpos = WIDE; - checksum = CODE_A; - startpresent = 0; - } else { - startpresent = 1; - } - for (i=0; ierror = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - code = c - alphabet; - add_one(ptr, code); - sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); - textpos += code < 12 ? NARROW : WIDE; - textptr += strlen(textptr); - ptr += strlen(ptr); - checksum += code; - if (startpresent && usesum && i == strlen(text) - 2) { - /* stuff a check symbol before the stop */ - c = strchr(alphabet, toupper(text[i+1])); - if (!c) /* impossible */ - continue; - code = c - alphabet; - checksum += code; - - /* Complement to a multiple of 16 */ - checksum = (checksum + 15) / 16 * 16 - checksum; - add_one(ptr, checksum); - ptr += strlen(ptr); - } - } - if (!startpresent) { - if (usesum) { - /* if no start character specified, B is used as a stop char */ - checksum += CODE_B; - checksum = (checksum + 15) / 16 * 16 - checksum; - add_one(ptr, checksum); - ptr += strlen(ptr); - } - add_one(ptr, CODE_B); - } - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} +/* + * codabar.c -- encoding for Codabar + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "-$:/.+ABCD"; + +#define CODE_A 16 +#define CODE_B 17 + +#define NARROW 12 +#define WIDE 14 + +/* Patterns */ +static char *patterns[] = { +"1111133","1111331","1113113","3311111","1131131", +"3111131","1311113","1311311","1331111","3113111", +"1113311","1133111","3111313","3131113","3131311", +"1131313","1133131","1313113","1113133","1113331" }; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it. + * If the first character is a letter (A to D), the last one must be too; + * no other character should be a letter. + */ +int Barcode_cbr_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + int startpresent = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + char * pos; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + pos = strchr(alphabet,toupper(text[i])); + if (!pos) + return -1; + if (i == 0 && pos - alphabet >= CODE_A) + startpresent = 1; + else if (pos - alphabet >= CODE_A && + (!startpresent || i != strlen(text) - 1)) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr,"1%s", /* separator */ patterns[code]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_cbr_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0, startpresent; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("codabar"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 8 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen + check) +term */ + textinfo = malloc(10*(strlen(text) + 1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + ptr = partial; + textptr = textinfo; + textpos = 0; + usesum = bc->flags & BARCODE_NO_CHECKSUM ? 0 : 1; + /* if no start character specified, A is used as a start character */ + if (!isalpha(text[0])) { + add_one(ptr, CODE_A); + ptr += strlen(ptr); + textpos = WIDE; + checksum = CODE_A; + startpresent = 0; + } else { + startpresent = 1; + } + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + textpos += code < 12 ? NARROW : WIDE; + textptr += strlen(textptr); + ptr += strlen(ptr); + checksum += code; + if (startpresent && usesum && i == strlen(text) - 2) { + /* stuff a check symbol before the stop */ + c = strchr(alphabet, toupper(text[i+1])); + if (!c) /* impossible */ + continue; + code = c - alphabet; + checksum += code; + + /* Complement to a multiple of 16 */ + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + } + if (!startpresent) { + if (usesum) { + /* if no start character specified, B is used as a stop char */ + checksum += CODE_B; + checksum = (checksum + 15) / 16 * 16 - checksum; + add_one(ptr, checksum); + ptr += strlen(ptr); + } + add_one(ptr, CODE_B); + } + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/BarCode/code128.c b/BarCode/code128.c index 3eed959..617a5eb 100644 --- a/BarCode/code128.c +++ b/BarCode/code128.c @@ -1,618 +1,618 @@ -/* - * code128.c -- encoding for code128 (A, B, C) - * - * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" -//0 b1a2a4 123221 223211 221132 221231 213212 223112 312131 311222 314111 b3c1a1b -static char *codeset[] = { - "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ - "131222", "122213", "122312", "132212", "221213", - "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ - "113222", "123122", "123221", "223211", "221132", - "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ - "321122", "321221", "312212", "322112", "322211", - "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ - "131321", "112313", "132113", "132311", "211313", - "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ - "113123", "113321", "133121", "313121", "211331", - "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ - "311321", "331121", "312113", "312311", "332111", - "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ - "121124", "121421", "141122", "141221", "112214", - "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ - "241211", "221114", "413111", "241112", "134111", - "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ - "124211", "411212", "421112", "421211", "212141", - "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ - "114113", "114311", "411113", "411311", "113141", - "114131", "311141", "411131", "b1a4a2", "b1a2a4", /* 100 - 104 */ - "b1a2c2", "b3c1a1b" -}; -// "114131", "311141", "411131", "211412", "211214", /* 100 - 104 */ -// "211232", "2331112" -//0 b1a2a4 123221 223211 221132 221231 213212 223112 312131 311222 314111 b3c1a1b -// 211214 2331112 -/* -1,1,4,1,3,1,// CodeB FNC4 CodeB -3,1,1,1,4,1,// FNC4 CodeA CodeA -4,1,1,1,3,1,// FNC1 FNC1 FNC1 -2,1,1,4,1,2,// StartA -2,1,1,2,1,4,// StartB -2,1,1,2,3,2,// StartC -2,3,3,1,1,1,2,// Stop -*/ -#define START_A 103 -#define START_B 104 -#define START_C 105 -#define STOP 106 -#define SHIFT 98 /* only A and B */ -#define CODE_A 101 /* only B and C */ -#define CODE_B 100 /* only A and C */ -#define CODE_C 99 /* only A and B */ -#define FUNC_1 102 /* all of them */ -#define FUNC_2 97 /* only A and B */ -#define FUNC_3 96 /* only A and B */ -/* FUNC_4 is CODE_A when in A and CODE_B when in B */ - -#define SYMBOL_WID 11 /* all of them are 11-bar wide */ - -/* - * code 128-b includes all printable ascii chars - */ - -int Barcode_128b_verify(unsigned char *text) -{ - if (text[0] == '\0') - return -1; - while (*text && *text>=32 && !(*text&0x80)) - text++; - if (*text) - return -1; /* a non-ascii char */ - return 0; /* ok */ -} - -int Barcode_128b_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *textptr; - int i, code, textpos, checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("code 128-B"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* the partial code is 6* (head + text + check + tail) + final + term. */ - partial = malloc( (strlen(text) + 4) * 6 +2); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * strlen +term */ - textinfo = malloc(10*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - /* up to now, it was the same code as other encodings */ - - strcpy(partial, "0"); /* the first space */ - strcat(partial, codeset[START_B]); - checksum += START_B; /* the start char is counted in the checksum */ - textptr = textinfo; - textpos = SYMBOL_WID; - - for (i=0; ierror = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - code = text[i]-32; - strcat(partial, codeset[code]); - checksum += code * (i+1); /* first * 1 + second * 2 + third * 3... */ - sprintf(textptr, "%i:12:%c ", textpos, text[i]); - textptr += strlen(textptr); - textpos += SYMBOL_WID; /* width of each code */ - } - /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ - checksum %= 103; - strcat(partial, codeset[checksum]); - /* and the end marker */ - strcat(partial, codeset[STOP]); - - bc->partial = partial; - bc->textinfo = textinfo; - return 0; -} - -/* - * code 128-c is only digits, but two per symbol - */ - -int Barcode_128c_verify(unsigned char *text) -{ - if (text[0] == '\0') - return -1; - /* must be an even number of digits */ - if (strlen(text)%2) - return -1; - /* and must be all digits */ - for (; *text; text++) - if (!isdigit(*text)) - return -1; - return 0; -} - -int Barcode_128c_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *textptr; - int i, code, textpos, checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("code 128-C"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* the partial code is 6* (head + text + check + tail) + final + term. */ - partial = malloc( (strlen(text) + 3) * 6 +2); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn.5:fff:c " * strlen +term */ - textinfo = malloc(12*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - strcpy(partial, "0"); /* the first space */ - strcat(partial, codeset[START_C]); - checksum += START_C; /* the start char is counted in the checksum */ - textptr = textinfo; - textpos = SYMBOL_WID; - - for (i=0; text[i]; i+=2) { - if (!isdigit(text[i]) || !isdigit(text[i+1])) { - bc->error = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - code = (text[i]-'0') * 10 + text[i+1]-'0'; - strcat(partial, codeset[code]); - checksum += code * (i/2+1); /* first * 1 + second * 2 + third * 3... */ - - /* print as "%s", because we have ".5" positions */ - sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, text[i], - textpos + (double)SYMBOL_WID/2, text[i+1]); - textptr += strlen(textptr); - textpos += SYMBOL_WID; /* width of each code */ - } - /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ - checksum %= 103; - strcat(partial, codeset[checksum]); - /* and the end marker */ - strcat(partial, codeset[STOP]); - - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} - -/* - * generic (full-featured) code128 implementation: it selects between - * A, B, C according to the data being encoded. F1, F2, F3, F4 are expressed - * using ascii chars 0xc1, 0xc2, 0xc3, 0xc4 (0301, 0302, 0303, 0304). - * Char '\0' is expressed by 0x80 (0200). - */ - -int Barcode_128_verify(unsigned char *text) -{ - if (text[0] == '\0') - return -1; - while (*text && (*text<=0x80 || (*text >= 0xc1 && *text <= 0xc4))) - text++; - if (*text) - return -1; /* unencodable character */ - return 0; /* ok */ -} - - -/* - * These functions are extracted from Barcode_128_encode for clarity. - * It deals with choosing the symbols used to represent the text - * and returns a dynamic array of integers, terminated by -1. - * - * The algorithm used in choosing the codes comes from App 2 of - * "El Codigo Estandar EAN/UCC 128", courtesy of AECOC, Spain. - * Thanks to Dani Pardo for getting permission and giving me a copy - * of the document - */ - -#define NEED_CODE_A(c) ((c)<32 || (c)==0x80) -#define NEED_CODE_B(c) ((c)>=96 && (c)<128) - -static int Barcode_a_or_b(unsigned char *text) -{ - for ( ; *text; text++) { - if (NEED_CODE_A(*text)) - return 'A'; - if (NEED_CODE_B(*text)) - return 'B'; - } - return 0; /* any */ -} - -/* code is either 'A' or 'B', and value must be valid */ -static int Barcode_encode_as(int code, int value) -{ - - /* first check the special chars */ - if (value == 0xC1) return FUNC_1; - if (value == 0xC2) return FUNC_2; - if (value == 0xC3) return FUNC_3; - if (value == 0xC4) { /* F4 */ - if (code == 'A') return CODE_A; - return CODE_B; - } - - /* then check ascii values */ - if (value >= 0x20 && value <= 0x5F) - return value - 0x20; /* both codes */ - if (value == 0x80) return 64; /* code A */ - if (value < 0x20) return value+64; /* code A */ - if (value >= 0x60) return value - 0x20; /* code B */ - /* can't happen */ - return -1; -} - -static int *Barcode_128_make_array(struct Barcode_Item *bc, int *lptr) -{ - int len, *codes; - unsigned char *s; - int i=0, j, code, checksum; - - /* allocate twice the text length + 5, as this is the worst case */ - len = 2 * strlen(bc->ascii) + 5; - codes = malloc(len * sizeof(int)); - s = bc->ascii; - - /* choose the starting code */ - if (s[2]=='\0' && isdigit(s[0]) && isdigit(s[1])) { - code = 'C'; - } else if (isdigit(s[0])&&isdigit(s[1]) && isdigit(s[2])&&isdigit(s[3])) { - code = 'C'; - } else { - code = Barcode_a_or_b(s); - if (!code) code = 'B'; /* default */ - } - codes[i++] = START_A + code - 'A'; - - for (s = bc->ascii; *s; /* increments are in the loop */) { - switch(code) { - - case 'C': - if (s[0] == 0xC1) { /* F1 is valid */ - codes[i++] = FUNC_1; - s++; - } else if (isdigit(s[0]) && isdigit(s[1])) { - /* encode two digits */ - codes[i++] = (s[0]-'0') * 10 + s[1]-'0'; - s += 2; - } else { - /* change code */ - code = Barcode_a_or_b(s); - if (!code) code = 'B'; - codes[i++] = (code == 'A') ? CODE_A : CODE_B; - } - break; - - case 'B': - case 'A': - for (j=0; isdigit(s[j]); j++) - ; - if (j>=4) { /* if there are 4 or more digits, turn to C */ - if (j&1) { - /* odd number: encode one first */ - codes[i++] = *(s++) - ' '; - } - codes[i++] = CODE_C; - code = 'C'; - } else if (code == 'A' && NEED_CODE_B(*s)) { - /* check whether we should use SHIFT or change code */ - j = Barcode_a_or_b(s+1); - if (j == 'B') { - codes[i++] = CODE_B; - code = 'B'; - } else { - codes[i++] = SHIFT; - codes[i++] = Barcode_encode_as('B', *s); - s++; - } - } else if (code == 'B' && NEED_CODE_A(*s)) { - /* check whether we should use SHIFT or change code */ - j = Barcode_a_or_b(s+1); - if (j == 'A') { - codes[i++] = CODE_A; - code = 'A'; - } else { - codes[i++] = SHIFT; - codes[i++] = Barcode_encode_as('A', *s); - s++; - } - } else { - codes[i++] = Barcode_encode_as(code, *s); - s++; - } - break; - } - } - /* add the checksum */ - checksum = codes[0]; - for (j=1; j len) { - fprintf(stderr, "impossible: length is > allocated len\n"); - } - *lptr = i; - return codes; -} - -/* - * Encoding is tricky, in that we cannot print the ascii - * representation in an easy way. Therefore, just skip non-printable - * chars and try to fit the rest somehow. - */ -int Barcode_128_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *textptr; - int *codes; /* dynamic */ - int i, c, len; - double textpos, size, step; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("code 128"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - - codes = Barcode_128_make_array(bc, &len); - if (!codes) return -1; - - /* the partial code is 6*codelen + ini + term (+margin) */ - partial = malloc( 6 * len + 4); - if (!partial) { - bc->error = errno; - free(codes); - return -1; - } - - /* the text information is at most "nnn.n:ff.f:c " * strlen +term */ - textptr = textinfo = malloc(13*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - free(codes); - return -1; - } - - /* up to now, it was almost the same code as other encodings */ - - strcpy(partial, "0"); /* the first space */ - for (i=0; i 12.0) size = 12.0; - - /* align the text to the left, using its natural size */ - step = (int)(10 * (size/18.0 * SYMBOL_WID) + .5) / 10.0; - textpos = SYMBOL_WID; - - for (i=0; i 0xc0) c = ' '; /* F code */ - sprintf(textptr, "%g:%g:%c ", textpos, size, c); - textptr += strlen(textptr); - textpos += step; - } - - bc->partial = partial; - bc->textinfo = textinfo; - free(codes); - return 0; -} - -/* - * A raw 128 code is given as a sequence of space separated numbers - * from 0 to 105, starting from the start code to be (Leonid) - */ - -int Barcode_128raw_verify(unsigned char *text) -{ - int n; - unsigned val; - - if (!strlen(text)) - return -1; - while (*text) { - if (sscanf(text, "%u%n", &val, &n) < 1) - return -1; - if (val > 105) - return -1; - text += n; - } - return 0; -} - -int Barcode_128raw_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *textptr; - int i, n, count, code, textpos, checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("128raw"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* - * length of partial code is unknown in advance, but it is - * at most 6* (1+text/2 + check + tail) + final + terminator - */ - partial = malloc( (3+ strlen(text)/2) * 6 + 2); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn.5:fff:c " * 1+strlen/2 +term */ - textinfo = malloc(12 * (1+strlen(text)/2) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - strcpy(partial, "0"); /* the first space */ - textptr = textinfo; - textpos = 0; - - for (i=0, count = 0; i < strlen(text); count++) { - if (sscanf(text + i, "%u%n", &code, &n) < 1) { - bc->error = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - strcat(partial, codeset[code]); - - /* - * since the start code is part of the "raw" input, it is - * counted in the checksum by itself - */ - if (!count) checksum += code; /* the start code */ - else checksum += code * count; /* first * 1 + second * 2 ... */ - - /* - * print as "%s", because we have ".5" positions - * also, use a size of 9 like codeC above, as each symbol is - * represented by two chars - */ - sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, - code >= 100 ? 'A' : code/10 + '0', - textpos + (double)SYMBOL_WID/2, code%10 + '0'); - textptr += strlen(textptr); - textpos += SYMBOL_WID; /* width of each code */ - i += n; - } - /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ - checksum %= 103; - strcat(partial, codeset[checksum]); - /* and the end marker */ - strcat(partial, codeset[STOP]); - - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} - +/* + * code128.c -- encoding for code128 (A, B, C) + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" +//0 b1a2a4 123221 223211 221132 221231 213212 223112 312131 311222 314111 b3c1a1b +static char *codeset[] = { + "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ + "131222", "122213", "122312", "132212", "221213", + "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ + "113222", "123122", "123221", "223211", "221132", + "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ + "321122", "321221", "312212", "322112", "322211", + "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ + "131321", "112313", "132113", "132311", "211313", + "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ + "113123", "113321", "133121", "313121", "211331", + "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ + "311321", "331121", "312113", "312311", "332111", + "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ + "121124", "121421", "141122", "141221", "112214", + "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ + "241211", "221114", "413111", "241112", "134111", + "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ + "124211", "411212", "421112", "421211", "212141", + "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ + "114113", "114311", "411113", "411311", "113141", + "114131", "311141", "411131", "b1a4a2", "b1a2a4", /* 100 - 104 */ + "b1a2c2", "b3c1a1b" +}; +// "114131", "311141", "411131", "211412", "211214", /* 100 - 104 */ +// "211232", "2331112" +//0 b1a2a4 123221 223211 221132 221231 213212 223112 312131 311222 314111 b3c1a1b +// 211214 2331112 +/* +1,1,4,1,3,1,// CodeB FNC4 CodeB +3,1,1,1,4,1,// FNC4 CodeA CodeA +4,1,1,1,3,1,// FNC1 FNC1 FNC1 +2,1,1,4,1,2,// StartA +2,1,1,2,1,4,// StartB +2,1,1,2,3,2,// StartC +2,3,3,1,1,1,2,// Stop +*/ +#define START_A 103 +#define START_B 104 +#define START_C 105 +#define STOP 106 +#define SHIFT 98 /* only A and B */ +#define CODE_A 101 /* only B and C */ +#define CODE_B 100 /* only A and C */ +#define CODE_C 99 /* only A and B */ +#define FUNC_1 102 /* all of them */ +#define FUNC_2 97 /* only A and B */ +#define FUNC_3 96 /* only A and B */ +/* FUNC_4 is CODE_A when in A and CODE_B when in B */ + +#define SYMBOL_WID 11 /* all of them are 11-bar wide */ + +/* + * code 128-b includes all printable ascii chars + */ + +int Barcode_128b_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && *text>=32 && !(*text&0x80)) + text++; + if (*text) + return -1; /* a non-ascii char */ + return 0; /* ok */ +} + +int Barcode_128b_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-B"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + /* up to now, it was the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_B]); + checksum += START_B; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = text[i]-32; + strcat(partial, codeset[code]); + checksum += code * (i+1); /* first * 1 + second * 2 + third * 3... */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + return 0; +} + +/* + * code 128-c is only digits, but two per symbol + */ + +int Barcode_128c_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + /* must be an even number of digits */ + if (strlen(text)%2) + return -1; + /* and must be all digits */ + for (; *text; text++) + if (!isdigit(*text)) + return -1; + return 0; +} + +int Barcode_128c_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128-C"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 6* (head + text + check + tail) + final + term. */ + partial = malloc( (strlen(text) + 3) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * strlen +term */ + textinfo = malloc(12*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + strcat(partial, codeset[START_C]); + checksum += START_C; /* the start char is counted in the checksum */ + textptr = textinfo; + textpos = SYMBOL_WID; + + for (i=0; text[i]; i+=2) { + if (!isdigit(text[i]) || !isdigit(text[i+1])) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = (text[i]-'0') * 10 + text[i+1]-'0'; + strcat(partial, codeset[code]); + checksum += code * (i/2+1); /* first * 1 + second * 2 + third * 3... */ + + /* print as "%s", because we have ".5" positions */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, text[i], + textpos + (double)SYMBOL_WID/2, text[i+1]); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + +/* + * generic (full-featured) code128 implementation: it selects between + * A, B, C according to the data being encoded. F1, F2, F3, F4 are expressed + * using ascii chars 0xc1, 0xc2, 0xc3, 0xc4 (0301, 0302, 0303, 0304). + * Char '\0' is expressed by 0x80 (0200). + */ + +int Barcode_128_verify(unsigned char *text) +{ + if (text[0] == '\0') + return -1; + while (*text && (*text<=0x80 || (*text >= 0xc1 && *text <= 0xc4))) + text++; + if (*text) + return -1; /* unencodable character */ + return 0; /* ok */ +} + + +/* + * These functions are extracted from Barcode_128_encode for clarity. + * It deals with choosing the symbols used to represent the text + * and returns a dynamic array of integers, terminated by -1. + * + * The algorithm used in choosing the codes comes from App 2 of + * "El Codigo Estandar EAN/UCC 128", courtesy of AECOC, Spain. + * Thanks to Dani Pardo for getting permission and giving me a copy + * of the document + */ + +#define NEED_CODE_A(c) ((c)<32 || (c)==0x80) +#define NEED_CODE_B(c) ((c)>=96 && (c)<128) + +static int Barcode_a_or_b(unsigned char *text) +{ + for ( ; *text; text++) { + if (NEED_CODE_A(*text)) + return 'A'; + if (NEED_CODE_B(*text)) + return 'B'; + } + return 0; /* any */ +} + +/* code is either 'A' or 'B', and value must be valid */ +static int Barcode_encode_as(int code, int value) +{ + + /* first check the special chars */ + if (value == 0xC1) return FUNC_1; + if (value == 0xC2) return FUNC_2; + if (value == 0xC3) return FUNC_3; + if (value == 0xC4) { /* F4 */ + if (code == 'A') return CODE_A; + return CODE_B; + } + + /* then check ascii values */ + if (value >= 0x20 && value <= 0x5F) + return value - 0x20; /* both codes */ + if (value == 0x80) return 64; /* code A */ + if (value < 0x20) return value+64; /* code A */ + if (value >= 0x60) return value - 0x20; /* code B */ + /* can't happen */ + return -1; +} + +static int *Barcode_128_make_array(struct Barcode_Item *bc, int *lptr) +{ + int len, *codes; + unsigned char *s; + int i=0, j, code, checksum; + + /* allocate twice the text length + 5, as this is the worst case */ + len = 2 * strlen(bc->ascii) + 5; + codes = malloc(len * sizeof(int)); + s = bc->ascii; + + /* choose the starting code */ + if (s[2]=='\0' && isdigit(s[0]) && isdigit(s[1])) { + code = 'C'; + } else if (isdigit(s[0])&&isdigit(s[1]) && isdigit(s[2])&&isdigit(s[3])) { + code = 'C'; + } else { + code = Barcode_a_or_b(s); + if (!code) code = 'B'; /* default */ + } + codes[i++] = START_A + code - 'A'; + + for (s = bc->ascii; *s; /* increments are in the loop */) { + switch(code) { + + case 'C': + if (s[0] == 0xC1) { /* F1 is valid */ + codes[i++] = FUNC_1; + s++; + } else if (isdigit(s[0]) && isdigit(s[1])) { + /* encode two digits */ + codes[i++] = (s[0]-'0') * 10 + s[1]-'0'; + s += 2; + } else { + /* change code */ + code = Barcode_a_or_b(s); + if (!code) code = 'B'; + codes[i++] = (code == 'A') ? CODE_A : CODE_B; + } + break; + + case 'B': + case 'A': + for (j=0; isdigit(s[j]); j++) + ; + if (j>=4) { /* if there are 4 or more digits, turn to C */ + if (j&1) { + /* odd number: encode one first */ + codes[i++] = *(s++) - ' '; + } + codes[i++] = CODE_C; + code = 'C'; + } else if (code == 'A' && NEED_CODE_B(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'B') { + codes[i++] = CODE_B; + code = 'B'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('B', *s); + s++; + } + } else if (code == 'B' && NEED_CODE_A(*s)) { + /* check whether we should use SHIFT or change code */ + j = Barcode_a_or_b(s+1); + if (j == 'A') { + codes[i++] = CODE_A; + code = 'A'; + } else { + codes[i++] = SHIFT; + codes[i++] = Barcode_encode_as('A', *s); + s++; + } + } else { + codes[i++] = Barcode_encode_as(code, *s); + s++; + } + break; + } + } + /* add the checksum */ + checksum = codes[0]; + for (j=1; j len) { + fprintf(stderr, "impossible: length is > allocated len\n"); + } + *lptr = i; + return codes; +} + +/* + * Encoding is tricky, in that we cannot print the ascii + * representation in an easy way. Therefore, just skip non-printable + * chars and try to fit the rest somehow. + */ +int Barcode_128_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int *codes; /* dynamic */ + int i, c, len; + double textpos, size, step; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 128"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + codes = Barcode_128_make_array(bc, &len); + if (!codes) return -1; + + /* the partial code is 6*codelen + ini + term (+margin) */ + partial = malloc( 6 * len + 4); + if (!partial) { + bc->error = errno; + free(codes); + return -1; + } + + /* the text information is at most "nnn.n:ff.f:c " * strlen +term */ + textptr = textinfo = malloc(13*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(codes); + return -1; + } + + /* up to now, it was almost the same code as other encodings */ + + strcpy(partial, "0"); /* the first space */ + for (i=0; i 12.0) size = 12.0; + + /* align the text to the left, using its natural size */ + step = (int)(10 * (size/18.0 * SYMBOL_WID) + .5) / 10.0; + textpos = SYMBOL_WID; + + for (i=0; i 0xc0) c = ' '; /* F code */ + sprintf(textptr, "%g:%g:%c ", textpos, size, c); + textptr += strlen(textptr); + textpos += step; + } + + bc->partial = partial; + bc->textinfo = textinfo; + free(codes); + return 0; +} + +/* + * A raw 128 code is given as a sequence of space separated numbers + * from 0 to 105, starting from the start code to be (Leonid) + */ + +int Barcode_128raw_verify(unsigned char *text) +{ + int n; + unsigned val; + + if (!strlen(text)) + return -1; + while (*text) { + if (sscanf(text, "%u%n", &val, &n) < 1) + return -1; + if (val > 105) + return -1; + text += n; + } + return 0; +} + +int Barcode_128raw_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *textptr; + int i, n, count, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("128raw"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* + * length of partial code is unknown in advance, but it is + * at most 6* (1+text/2 + check + tail) + final + terminator + */ + partial = malloc( (3+ strlen(text)/2) * 6 + 2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn.5:fff:c " * 1+strlen/2 +term */ + textinfo = malloc(12 * (1+strlen(text)/2) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, "0"); /* the first space */ + textptr = textinfo; + textpos = 0; + + for (i=0, count = 0; i < strlen(text); count++) { + if (sscanf(text + i, "%u%n", &code, &n) < 1) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + strcat(partial, codeset[code]); + + /* + * since the start code is part of the "raw" input, it is + * counted in the checksum by itself + */ + if (!count) checksum += code; /* the start code */ + else checksum += code * count; /* first * 1 + second * 2 ... */ + + /* + * print as "%s", because we have ".5" positions + * also, use a size of 9 like codeC above, as each symbol is + * represented by two chars + */ + sprintf(textptr, "%g:9:%c %g:9:%c ", (double)textpos, + code >= 100 ? 'A' : code/10 + '0', + textpos + (double)SYMBOL_WID/2, code%10 + '0'); + textptr += strlen(textptr); + textpos += SYMBOL_WID; /* width of each code */ + i += n; + } + /* Add the checksum, independent of BARCODE_NO_CHECKSUM */ + checksum %= 103; + strcat(partial, codeset[checksum]); + /* and the end marker */ + strcat(partial, codeset[STOP]); + + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} + diff --git a/BarCode/code39.c b/BarCode/code39.c index 3308c95..bdaffed 100644 --- a/BarCode/code39.c +++ b/BarCode/code39.c @@ -1,173 +1,173 @@ -/* - * code39.c -- encoding for code39 - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - - -/* this is ordered in decades to simplify encoding */ -static char alphabet[] = - "1234567890" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. *" "$/+%"; - -/* the checksum alphabet has a different order */ -static char checkbet[] = - "0123456789" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. $" "/+%"; - -/* The first 40 symbols repeat this bar pattern */ -static char *bars[] = { - "31113","13113","33111","11313","31311", - "13311","11133","31131","13131","11331"}; - -/* The first 4 decades use these space patterns */ -static char *spaces[] = {"1311","1131","1113","3111"}; - -/* the last four symbols are special */ -static char *specialbars[] = { - "11111","11111","11111","11111"}; - -static char *specialspaces[] = { - "3331","3313","3133","1333"}; - -static char *fillers[]= { - "0a3a1c1c1a", - "1a3a1c1c1a" -}; - - -/* - * Check that the text can be encoded. Returns 0 or -1. - * If it's all lowecase convert to uppercase and accept it - */ -int Barcode_39_verify(unsigned char *text) -{ - int i, lower=0, upper=0; - - if (text[0] == '\0') - return -1; - for (i=0; text[i]; i++) { - if (isupper(text[i])) upper++; - if (islower(text[i])) lower++; - if (!strchr(alphabet,toupper(text[i]))) - return -1; - } - if (lower && upper) - return -1; - return 0; -} - -static int add_one(char *ptr, int code) -{ - char *b, *s; - - if (code < 40) { - b = bars[code%10]; - s = spaces[code/10]; - } else { - b = specialbars[code-40]; - s = specialspaces[code-40]; - } - sprintf(ptr,"1%c%c%c%c%c%c%c%c%c", /* separator */ - b[0], s[0], b[1], s[1], b[2], s[2], - b[3], s[3], b[4]); - return 0; -} - -/* - * The encoding functions fills the "partial" and "textinfo" fields. - * Lowercase chars are converted to uppercase - */ -int Barcode_39_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *c, *ptr, *textptr; - int i, code, textpos, checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("code 39"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* the partial code is 10* (head + text + check + tail) + margin + term. */ - partial = malloc( (strlen(text) + 3) * 10 +2); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * strlen +term */ - textinfo = malloc(10*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - strcpy(partial, fillers[0]); - ptr = partial + strlen(partial); - textptr = textinfo; - textpos = 22; - - for (i=0; text[i]; i++) { - c = strchr(alphabet, toupper(text[i])); - if (!c) { - bc->error = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - code = c - alphabet; - add_one(ptr, code); - c = strchr(checkbet,*c); - if (c) /* the '*' is not there */ - checksum += (c-checkbet); - sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); - - textpos += 16; /* width of each code */ - textptr += strlen(textptr); - ptr += strlen(ptr); - } - /* Add the checksum */ - if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) { - code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet); - add_one(ptr, code); - } - strcat(ptr, fillers[1]); /* end */ - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "1234567890" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. *" "$/+%"; + +/* the checksum alphabet has a different order */ +static char checkbet[] = + "0123456789" "ABCDEFGHIJ" "KLMNOPQRST" "UVWXYZ-. $" "/+%"; + +/* The first 40 symbols repeat this bar pattern */ +static char *bars[] = { + "31113","13113","33111","11313","31311", + "13311","11133","31131","13131","11331"}; + +/* The first 4 decades use these space patterns */ +static char *spaces[] = {"1311","1131","1113","3111"}; + +/* the last four symbols are special */ +static char *specialbars[] = { + "11111","11111","11111","11111"}; + +static char *specialspaces[] = { + "3331","3313","3133","1333"}; + +static char *fillers[]= { + "0a3a1c1c1a", + "1a3a1c1c1a" +}; + + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_39_verify(unsigned char *text) +{ + int i, lower=0, upper=0; + + if (text[0] == '\0') + return -1; + for (i=0; text[i]; i++) { + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + if (!strchr(alphabet,toupper(text[i]))) + return -1; + } + if (lower && upper) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + char *b, *s; + + if (code < 40) { + b = bars[code%10]; + s = spaces[code/10]; + } else { + b = specialbars[code-40]; + s = specialspaces[code-40]; + } + sprintf(ptr,"1%c%c%c%c%c%c%c%c%c", /* separator */ + b[0], s[0], b[1], s[1], b[2], s[2], + b[3], s[3], b[4]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_39_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + int i, code, textpos, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 39"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 10* (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 3) * 10 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = 22; + + for (i=0; text[i]; i++) { + c = strchr(alphabet, toupper(text[i])); + if (!c) { + bc->error = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + c = strchr(checkbet,*c); + if (c) /* the '*' is not there */ + checksum += (c-checkbet); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += 16; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + } + /* Add the checksum */ + if ( (bc->flags & BARCODE_NO_CHECKSUM)==0 ) { + code = (strchr(alphabet, checkbet[checksum % 43]) - alphabet); + add_one(ptr, code); + } + strcat(ptr, fillers[1]); /* end */ + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/BarCode/code93.c b/BarCode/code93.c index 73f8cee..1f810f9 100644 --- a/BarCode/code93.c +++ b/BarCode/code93.c @@ -1,213 +1,213 @@ -/* - * code39.c -- encoding for code39 - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * Copyright (c) 2001 Nathan D. Holmes / FedEx Services (ndholmes@fedex.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - - -/* this is ordered in decades to simplify encoding */ -static char alphabet[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; - -static char *codeset[] = { - "131112", "111213", "111312", "111411", "121113", /* 0 - 4 */ - "121212", "121311", "111114", "131211", "141111", /* 5 - 9 */ - "211113", "211212", "211311", "221112", "221211", /* A - E */ - "231111", "112113", "112212", "112311", "122112", /* F - J */ - "132111", "111123", "111222", "111321", "121122", /* K - O */ - "131121", "212112", "212211", "211122", "211221", /* P - T */ - "221121", "222111", "112122", "112221", "122121", /* U - Y */ - "123111", "121131", "311112", "311211", "321111", /* Z - $ */ - "112131", "113121", "211131", "121221", "312111", /* / - (%) */ - "311121", "122211", "111141" /* (/) - (terminator) */ -}; - - -/* 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111 */ -/* 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222 */ -/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 */ -static char shiftset[] = - "%$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%% /// ///// / /%%%%%% %%%%%%++++++++++++++++++++++++++%%%%%"; -static char shiftset2[] = - "UABCDEFGHIJKLMNOPQRSTUVWXYZABCDE ABC FGHIJ L ZFGHIJV KLMNOWABCDEFGHIJLKMNOPQRSTUVWXYZPQRST"; - -#define START_STOP 47 -#define EXTEND_DOLLAR 43 -#define EXTEND_PERCENT 44 -#define EXTEND_SLASH 45 -#define EXTEND_PLUS 46 - -/* - * Check that the text can be encoded. Returns 0 or -1. - * All of ASCII-7 is accepted. - */ -int Barcode_93_verify(unsigned char *text) -{ - int i; - - if (!strlen(text)) - return -1; - for (i=0; text[i]; i++) { - - /* Test if beyond the range of 7-bit ASCII */ - if ((int)text[i] > 127) - return -1; - } - return 0; -} - -/* - * The encoding functions fills the "partial" and "textinfo" fields. - * Lowercase chars are converted to uppercase - */ -int Barcode_93_encode(struct Barcode_Item *bc) -{ - static unsigned char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *c, *textptr; - int *checksum_str; - int i, code, textpos, checksum_len=0; - int c_checksum = 0; - int k_checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("code 93"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - - /* the partial code is 6 * (head + 2* text + 2* check + tail) + margin + term. */ - partial = malloc( (strlen(text) *2 + 4) * 6 +2); - if (!partial) { - bc->error = errno; - return -1; - } - - checksum_str = (int *)malloc( (strlen(text) + 3) * 2 * sizeof(int)); - if (!checksum_str) { - free(partial); - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * strlen +term */ - textinfo = malloc(10*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - free(checksum_str); - return -1; - } - - textptr = textinfo; - textpos = 22; - strcpy(partial, "0"); - strcat(partial, codeset[START_STOP]); - - for (i=0; iflags & BARCODE_NO_CHECKSUM)==0 ) - { - for(i=1; i<=checksum_len; i++) - { - c_checksum += i * (int)checksum_str[checksum_len - i]; - k_checksum += (i+1) * (int)checksum_str[checksum_len - i]; - } - - c_checksum = c_checksum % 47; - k_checksum += c_checksum; - k_checksum = k_checksum % 47; - - strcat(partial, codeset[c_checksum]); - strcat(partial, codeset[k_checksum]); - - } - strcat(partial, codeset[START_STOP]); /* end */ - - /* Encodes final 1-unit width bar to turn the start character into a stop char */ - strcat(partial, "1"); - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} +/* + * code39.c -- encoding for code39 + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Nathan D. Holmes / FedEx Services (ndholmes@fedex.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; + +static char *codeset[] = { + "131112", "111213", "111312", "111411", "121113", /* 0 - 4 */ + "121212", "121311", "111114", "131211", "141111", /* 5 - 9 */ + "211113", "211212", "211311", "221112", "221211", /* A - E */ + "231111", "112113", "112212", "112311", "122112", /* F - J */ + "132111", "111123", "111222", "111321", "121122", /* K - O */ + "131121", "212112", "212211", "211122", "211221", /* P - T */ + "221121", "222111", "112122", "112221", "122121", /* U - Y */ + "123111", "121131", "311112", "311211", "321111", /* Z - $ */ + "112131", "113121", "211131", "121221", "312111", /* / - (%) */ + "311121", "122211", "111141" /* (/) - (terminator) */ +}; + + +/* 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111 */ +/* 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222 */ +/* 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 */ +static char shiftset[] = + "%$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%% /// ///// / /%%%%%% %%%%%%++++++++++++++++++++++++++%%%%%"; +static char shiftset2[] = + "UABCDEFGHIJKLMNOPQRSTUVWXYZABCDE ABC FGHIJ L ZFGHIJV KLMNOWABCDEFGHIJLKMNOPQRSTUVWXYZPQRST"; + +#define START_STOP 47 +#define EXTEND_DOLLAR 43 +#define EXTEND_PERCENT 44 +#define EXTEND_SLASH 45 +#define EXTEND_PLUS 46 + +/* + * Check that the text can be encoded. Returns 0 or -1. + * All of ASCII-7 is accepted. + */ +int Barcode_93_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + + /* Test if beyond the range of 7-bit ASCII */ + if ((int)text[i] > 127) + return -1; + } + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_93_encode(struct Barcode_Item *bc) +{ + static unsigned char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *textptr; + int *checksum_str; + int i, code, textpos, checksum_len=0; + int c_checksum = 0; + int k_checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("code 93"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + + /* the partial code is 6 * (head + 2* text + 2* check + tail) + margin + term. */ + partial = malloc( (strlen(text) *2 + 4) * 6 +2); + if (!partial) { + bc->error = errno; + return -1; + } + + checksum_str = (int *)malloc( (strlen(text) + 3) * 2 * sizeof(int)); + if (!checksum_str) { + free(partial); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(checksum_str); + return -1; + } + + textptr = textinfo; + textpos = 22; + strcpy(partial, "0"); + strcat(partial, codeset[START_STOP]); + + for (i=0; iflags & BARCODE_NO_CHECKSUM)==0 ) + { + for(i=1; i<=checksum_len; i++) + { + c_checksum += i * (int)checksum_str[checksum_len - i]; + k_checksum += (i+1) * (int)checksum_str[checksum_len - i]; + } + + c_checksum = c_checksum % 47; + k_checksum += c_checksum; + k_checksum = k_checksum % 47; + + strcat(partial, codeset[c_checksum]); + strcat(partial, codeset[k_checksum]); + + } + strcat(partial, codeset[START_STOP]); /* end */ + + /* Encodes final 1-unit width bar to turn the start character into a stop char */ + strcat(partial, "1"); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/BarCode/ean.c b/BarCode/ean.c index 0801a0e..5554b59 100644 --- a/BarCode/ean.c +++ b/BarCode/ean.c @@ -1,774 +1,774 @@ -/* - * ean.c -- encoding for ean, upc and isbn - * - * Copyright (c) 1999 Alessandro Rubini - * Copyright (c) 1999 Prosa Srl. - * Copyright (c) 2001 Boszormenyi Zoltan - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - -/* - * IMPORTANT NOTE: if you are reading this file to learn how to add a - * new encoding type, this is the wrong place as there are too many - * special cases. Please refer to code39.c instead. If you want to - * learn how UPC, EAN, ISBN work, on the other hand, I did my best to - * commend things and hope you enjoy it. - */ - -/* - * These following static arrays are used to describe the barcode. - * - * The various forms of UPC and EAN are documented as using three - * different alphabets to encode the ten digits. However, each digit - * has exactly one encoding; only, it is sometimes mirrored. Moreover, - * if you represent the width of each symbol (bar/space) instead of - * the sequence of 1's and 0's, you find that even-parity and odd-parity - * encoding are exactly the same. So, here are the digits: */ -static char *digits[] = { - "3211","2221","2122","1411","1132", - "1231","1114","1312","1213","3112"}; - -/* - * What EAN encoding does is adding a leading digit (the 13th digit). - * Such an extra digit is encoded by mirroring three of the six digits that - * appear in the left half of the UPC code. Here how mirroring works: - */ -static char *ean_mirrortab[] = { - "------","--1-11","--11-1","--111-","-1--11", - "-11--1","-111--","-1-1-1","-1-11-","-11-1-" -}; - -/* - * UPC-E (the 6-digit one), instead, encodes the check character as - * a mirroring of the symbols. This is similar, but the encoding for "0" is - * different (EAN uses no mirroring for "0" to be compatible with UPC). - * The same rule is used for UPC-5 (the supplemental digits for ISBN) - */ -static char *upc_mirrortab[] = { - "---111","--1-11","--11-1","--111-","-1--11", - "-11--1","-111--","-1-1-1","-1-11-","-11-1-" -}; - -/* - * UPC-E mirroring for encoding "1" - */ -static char *upc_mirrortab1[] = { - "111---","11-1--","11--1-","11---1","1-11--", - "1--11-","1---11","1-1-1-","1-1--1","1--1-1" -}; - -/* UPC-2 has just two digits to mirror */ -static char *upc_mirrortab2[] = { - "11","1-","-1","--" -}; - -/* - * initial, middle, final guard bars (first symbol is a a space). - * EAN-13 overwrites the first "0" with "9" to make space for the extra digit. - */ -static char *guard[] = {"0a1a","1a1a1","a1a"}; - -/* initial, final guard bars for UPC-E*/ -static char *guardE[] = {"0a1a","1a1a1a"}; - -/* initial and inter-char guard bars for supplementals (first is space) */ -static char *guardS[] = {"9112","11"}; - -/* - * These functions are shortcuts I use in the encoding engine - */ -static int ean_make_checksum(char *text, int mode) -{ - int esum = 0, osum = 0, i; - int even=1; /* last char is even */ - - if (strchr(text, ' ')) - i = strchr(text, ' ') - text; /* end of first part */ - else - i = strlen(text); /* end of all */ - - while (i-- > 0) { - if (even) esum += text[i]-'0'; - else osum += text[i]-'0'; - even = !even; - } - if (!mode) { /* standard upc/ean checksum */ - i = (3*esum + osum) % 10; - return (10-i) % 10; /* complement to 10 */ - } else { /* add-5 checksum */ - i = (3*esum + 9*osum); - return i%10; - } -} - -/* - * Check that the text can be encoded. Returns 0 or -1. - * Accept: - * 13 or 12 digits: EAN-13 w/ or w/o checksum - * or - * 8 or 7 digits: EAN-8 w/ or w/o checksum. - * For both EAN-13 and EAN-8, accept an addon of 2 or 5 digits, - * separated by ' ' - */ -int Barcode_ean_verify(unsigned char *text) -{ - int i, len0, len, addon; - unsigned char tmp[24], *spc; - - len = strlen(text); - spc = strchr(text, ' '); - if (spc) { - len0 = spc - text; - addon = len - len0 - 1; - if (addon != 2 && addon != 5) - return -1; - for (i=len0+1; i= '5' && text[10] <= '9') { - memcpy(&result[1], text+1, 5); - result[6] = text[10]; - } else { - return NULL; - } - result[7] = chksum + '0'; - - return result; -} - -/* - * UPC-A is the same as EAN, but accept - * 12 or 11 digits (UPC-A w/ or w/o checksum) - * or accept UPC-E as: - * 6 digits (w/o number system and checksum): number system '0' assumed, - * 7 digits (either w/o number system or checksum), - * 8 digits (w/ number system and checksum) - * plus the 2 or 5-digit add-on - */ -int Barcode_upc_verify(unsigned char *text) -{ - int i, len0, len, addon; - unsigned char tmp[24], *spc; - - len = strlen(text); - spc = strchr(text, ' '); - if (spc) { - len0 = spc - text; - addon = len - len0 - 1; - if (addon != 2 && addon != 5) - return -1; - for (i=len0+1; iascii) { - bc->error = EINVAL; - return -1; - } - - /* Find out whether the barcode has addon and - * the length of the barcode w/o the addon. - */ - len = strlen(bc->ascii); - spc = strchr(bc->ascii, ' '); - if (spc) { - len0 = spc - bc->ascii; - addon = strlen(spc + 1); - if (addon != 2 && addon != 5) { - bc->error = EINVAL; /* impossible, actually */ - return -1; - } - } else { - len0 = len; - addon = 0; - } - - if (!bc->encoding) { - /* ISBN already wrote what it is; if unknown, find it out */ - - /* - * Do not decide only by barcode length, it may be ambiguous. - * Anyway, either the user specified the barcode type or - * we already found a fitting one. - */ - switch(bc->flags & BARCODE_ENCODING_MASK) { - case BARCODE_EAN: - switch (len0) { - case 7: case 8: - bc->encoding = strdup("EAN-8"); - encoding = EAN8; - break; - case 12: case 13: - bc->encoding = strdup("EAN-13"); - encoding = EAN13; - break; - default: - bc->error = -EINVAL; - return -1; - } - break; - - case BARCODE_UPC: - switch (len0) { - case 6: case 7: case 8: - bc->encoding = strdup("UPC-E"); - encoding = UPCE; - break; - case 11: case 12: - bc->encoding = strdup("UPC-A"); - encoding = UPCA; - break; - default: - bc->error = -EINVAL; - return -1; - } - break; - default: - /* else, it's wrong (impossible, as the text is checked) */ - bc->error = -EINVAL; - return -1; - } - } - - /* better safe than sorry */ - if (bc->partial) free(bc->partial); bc->partial = NULL; - if (bc->textinfo) free(bc->textinfo); bc->textinfo = NULL; - - if (encoding == UPCA) { /* add the leading 0 (not printed) */ - text[0] = '0'; - strcpy(text+1, bc->ascii); - } else if (encoding == UPCE) { - strcpy(text, upc_a_to_e(upc_e_to_a(bc->ascii))); - } else { - strcpy(text, bc->ascii); - } - - /* - * build the checksum and the bars: any encoding is slightly different - */ - if (encoding == UPCA || encoding == EAN13 || encoding == ISBN) { - if (!(encoding == UPCA && len0 == 12) && - !(encoding == EAN13 && len0 == 13)) { - checksum = ean_make_checksum(text, 0); - text[12] = '0' + checksum; /* add it to the text */ - text[13] = '\0'; - } - - strcpy(partial, guard[0]); - if (encoding == EAN13 || encoding == ISBN) { /* The first digit */ - sprintf(tptr,"0:12:%c ",text[0]); - tptr += strlen(tptr); - partial[0] = '9'; /* extra space for the digit */ - } else if (encoding == UPCA) - partial[0] = '9'; /* UPC has one digit before the symbol, too */ - xpos = width_of_partial(partial); - mirror = ean_mirrortab[text[0]-'0']; - - /* left part */ - for (i=1;i<7;i++) { - ptr1 = partial + strlen(partial); /* target */ - ptr2 = digits[text[i]-'0']; /* source */ - strcpy(ptr1, ptr2); - if (mirror[i-1] == '1') { - /* mirror this */ - ptr1[0] = ptr2[3]; - ptr1[1] = ptr2[2]; - ptr1[2] = ptr2[1]; - ptr1[3] = ptr2[0]; - } - /* - * Write the ascii digit. UPC has a special case - * for the first digit, which is out of the bars - */ - if (encoding == UPCA && i==1) { - sprintf(tptr, "0:10:%c ", text[i]); - tptr += strlen(tptr); - ptr1[1] += 'a'-'1'; /* bars are long */ - ptr1[3] += 'a'-'1'; - } else { - sprintf(tptr, "%i:12:%c ", xpos, text[i]); - tptr += strlen(tptr); - } - /* count the width of the symbol */ - xpos += 7; /* width_of_partial(ptr2) */ - } - - strcat(partial, guard[1]); /* middle */ - xpos += width_of_partial(guard[1]); - - /* right part */ - for (i=7;i<13;i++) { - ptr1 = partial + strlen(partial); /* target */ - ptr2 = digits[text[i]-'0']; /* source */ - strcpy(ptr1, ptr2); - /* - * Ascii digit. Once again, UPC has a special - * case for the last digit - */ - if (encoding == UPCA && i==12) { - sprintf(tptr, "%i:10:%c ", xpos+13, text[i]); - tptr += strlen(tptr); - ptr1[0] += 'a'-'1'; /* bars are long */ - ptr1[2] += 'a'-'1'; - } else { - sprintf(tptr, "%i:12:%c ", xpos, text[i]); - tptr += strlen(tptr); - } - xpos += 7; /* width_of_partial(ptr2) */ - } - tptr[-1] = '\0'; /* overwrite last space */ - strcat(partial, guard[2]); /* end */ - xpos += width_of_partial(guard[2]); - - } else if (encoding == UPCE) { - checksum = text[7] - '0'; - - strcpy(partial, guardE[0]); - partial[0] = '9'; /* UPC-A has one digit before the symbol, too */ - xpos = width_of_partial(partial); - - /* UPC-E has the number system written before the bars. */ - sprintf(tptr, "0:10:%c ", text[0]); - tptr += strlen(tptr); - - if (text[0] == '0') - mirror = upc_mirrortab[checksum]; - else - mirror = upc_mirrortab1[checksum]; - - for (i=0;i<6;i++) { - ptr1 = partial + strlen(partial); /* target */ - ptr2 = digits[text[i+1]-'0']; /* source */ - strcpy(ptr1, ptr2); - if (mirror[i] != '1') { /* negated wrt EAN13 */ - /* mirror this */ - ptr1[0] = ptr2[3]; - ptr1[1] = ptr2[2]; - ptr1[2] = ptr2[1]; - ptr1[3] = ptr2[0]; - } - sprintf(tptr, "%i:12:%c ", xpos, text[i+1]); - tptr += strlen(tptr); - xpos += 7; /* width_of_partial(ptr2) */ - } - - sprintf(tptr, "%i:10:%c ", xpos+10, text[7]); - tptr += strlen(tptr); - ptr1[0] += 'a'-'1'; /* bars are long */ - ptr1[2] += 'a'-'1'; - - tptr[-1] = '\0'; /* overwrite last space */ - strcat(partial, guardE[1]); /* end */ - - } else { /* EAN-8 almost identical to EAN-13 but no mirroring */ - - if (len0 != 8) { - checksum = ean_make_checksum(text, 0); - text[7] = '0' + checksum; /* add it to the text */ - text[8] = '\0'; - } - - strcpy(partial, guard[0]); - xpos = width_of_partial(partial); - - /* left part */ - for (i=0;i<4;i++) { - strcpy(partial + strlen(partial), digits[text[i]-'0']); - sprintf(tptr, "%i:12:%c ", xpos, text[i]); - tptr += strlen(tptr); - xpos += 7; /* width_of_partial(digits[text[i]-'0' */ - } - strcat(partial, guard[1]); /* middle */ - xpos += width_of_partial(guard[1]); - - /* right part */ - for (i=4;i<8;i++) { - strcpy(partial + strlen(partial), digits[text[i]-'0']); - sprintf(tptr, "%i:12:%c ", xpos, text[i]); - tptr += strlen(tptr); - xpos += 7; /* width_of_partial(digits[text[i]-'0' */ - } - tptr[-1] = '\0'; /* overwrite last space */ - strcat(partial, guard[2]); /* end */ - } - - /* - * And that's it. Now, in case some add-on is specified it - * must be encoded too. Look for it. - */ - if ( (ptr1 = spc) ) { - ptr1++; - strcpy(text, ptr1); - if (strlen(ptr1)==5) { - checksum = ean_make_checksum(text, 1 /* special way */); - mirror = upc_mirrortab[checksum]+1; /* only last 5 digits */ - } else { - checksum = atoi(text)%4; - mirror = upc_mirrortab2[checksum]; - } - strcat(textinfo, " +"); strcat(partial, "+"); - tptr = textinfo + strlen(textinfo); - for (i=0; ipartial = strdup(partial); - if (!bc->partial) { - bc->error = errno; - return -1; - } - bc->textinfo = strdup(textinfo); - if (!bc->textinfo) { - bc->error = errno; - free(bc->partial); - bc->partial = NULL; - return -1; - } - if (!bc->width) - bc->width = width_of_partial(partial); - - return 0; /* success */ -} - -int Barcode_upc_encode(struct Barcode_Item *bc) -{ - return Barcode_ean_encode(bc); /* UPC is folded into EAN */ -} - -int Barcode_isbn_encode(struct Barcode_Item *bc) -{ - /* For ISBN we must normalize the string and prefix "978" */ - unsigned char *text = malloc(24); /* 13 + ' ' + 5 plus some slack */ - unsigned char *otext; - int i, j, retval; - - if (!text) { - bc->error = ENOMEM; - return -1; - } - strcpy(text, "978"); j=3; - - otext = bc->ascii; - for (i=0; otext[i]; i++) { - if (isdigit(otext[i])) - text[j++] = otext[i]; - if (j == 12) /* checksum added later */ - break; - } - text[j]='\0'; - if (strchr(otext, ' ')) - strcat(text, strchr(otext, ' ')); - bc->ascii = text; - bc->encoding = strdup("ISBN"); - retval = Barcode_ean_encode(bc); - bc->ascii = otext; /* restore ascii for the ps comments */ - free(text); - return retval; -} - +/* + * ean.c -- encoding for ean, upc and isbn + * + * Copyright (c) 1999 Alessandro Rubini + * Copyright (c) 1999 Prosa Srl. + * Copyright (c) 2001 Boszormenyi Zoltan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +/* + * IMPORTANT NOTE: if you are reading this file to learn how to add a + * new encoding type, this is the wrong place as there are too many + * special cases. Please refer to code39.c instead. If you want to + * learn how UPC, EAN, ISBN work, on the other hand, I did my best to + * commend things and hope you enjoy it. + */ + +/* + * These following static arrays are used to describe the barcode. + * + * The various forms of UPC and EAN are documented as using three + * different alphabets to encode the ten digits. However, each digit + * has exactly one encoding; only, it is sometimes mirrored. Moreover, + * if you represent the width of each symbol (bar/space) instead of + * the sequence of 1's and 0's, you find that even-parity and odd-parity + * encoding are exactly the same. So, here are the digits: */ +static char *digits[] = { + "3211","2221","2122","1411","1132", + "1231","1114","1312","1213","3112"}; + +/* + * What EAN encoding does is adding a leading digit (the 13th digit). + * Such an extra digit is encoded by mirroring three of the six digits that + * appear in the left half of the UPC code. Here how mirroring works: + */ +static char *ean_mirrortab[] = { + "------","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E (the 6-digit one), instead, encodes the check character as + * a mirroring of the symbols. This is similar, but the encoding for "0" is + * different (EAN uses no mirroring for "0" to be compatible with UPC). + * The same rule is used for UPC-5 (the supplemental digits for ISBN) + */ +static char *upc_mirrortab[] = { + "---111","--1-11","--11-1","--111-","-1--11", + "-11--1","-111--","-1-1-1","-1-11-","-11-1-" +}; + +/* + * UPC-E mirroring for encoding "1" + */ +static char *upc_mirrortab1[] = { + "111---","11-1--","11--1-","11---1","1-11--", + "1--11-","1---11","1-1-1-","1-1--1","1--1-1" +}; + +/* UPC-2 has just two digits to mirror */ +static char *upc_mirrortab2[] = { + "11","1-","-1","--" +}; + +/* + * initial, middle, final guard bars (first symbol is a a space). + * EAN-13 overwrites the first "0" with "9" to make space for the extra digit. + */ +static char *guard[] = {"0a1a","1a1a1","a1a"}; + +/* initial, final guard bars for UPC-E*/ +static char *guardE[] = {"0a1a","1a1a1a"}; + +/* initial and inter-char guard bars for supplementals (first is space) */ +static char *guardS[] = {"9112","11"}; + +/* + * These functions are shortcuts I use in the encoding engine + */ +static int ean_make_checksum(char *text, int mode) +{ + int esum = 0, osum = 0, i; + int even=1; /* last char is even */ + + if (strchr(text, ' ')) + i = strchr(text, ' ') - text; /* end of first part */ + else + i = strlen(text); /* end of all */ + + while (i-- > 0) { + if (even) esum += text[i]-'0'; + else osum += text[i]-'0'; + even = !even; + } + if (!mode) { /* standard upc/ean checksum */ + i = (3*esum + osum) % 10; + return (10-i) % 10; /* complement to 10 */ + } else { /* add-5 checksum */ + i = (3*esum + 9*osum); + return i%10; + } +} + +/* + * Check that the text can be encoded. Returns 0 or -1. + * Accept: + * 13 or 12 digits: EAN-13 w/ or w/o checksum + * or + * 8 or 7 digits: EAN-8 w/ or w/o checksum. + * For both EAN-13 and EAN-8, accept an addon of 2 or 5 digits, + * separated by ' ' + */ +int Barcode_ean_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; i= '5' && text[10] <= '9') { + memcpy(&result[1], text+1, 5); + result[6] = text[10]; + } else { + return NULL; + } + result[7] = chksum + '0'; + + return result; +} + +/* + * UPC-A is the same as EAN, but accept + * 12 or 11 digits (UPC-A w/ or w/o checksum) + * or accept UPC-E as: + * 6 digits (w/o number system and checksum): number system '0' assumed, + * 7 digits (either w/o number system or checksum), + * 8 digits (w/ number system and checksum) + * plus the 2 or 5-digit add-on + */ +int Barcode_upc_verify(unsigned char *text) +{ + int i, len0, len, addon; + unsigned char tmp[24], *spc; + + len = strlen(text); + spc = strchr(text, ' '); + if (spc) { + len0 = spc - text; + addon = len - len0 - 1; + if (addon != 2 && addon != 5) + return -1; + for (i=len0+1; iascii) { + bc->error = EINVAL; + return -1; + } + + /* Find out whether the barcode has addon and + * the length of the barcode w/o the addon. + */ + len = strlen(bc->ascii); + spc = strchr(bc->ascii, ' '); + if (spc) { + len0 = spc - bc->ascii; + addon = strlen(spc + 1); + if (addon != 2 && addon != 5) { + bc->error = EINVAL; /* impossible, actually */ + return -1; + } + } else { + len0 = len; + addon = 0; + } + + if (!bc->encoding) { + /* ISBN already wrote what it is; if unknown, find it out */ + + /* + * Do not decide only by barcode length, it may be ambiguous. + * Anyway, either the user specified the barcode type or + * we already found a fitting one. + */ + switch(bc->flags & BARCODE_ENCODING_MASK) { + case BARCODE_EAN: + switch (len0) { + case 7: case 8: + bc->encoding = strdup("EAN-8"); + encoding = EAN8; + break; + case 12: case 13: + bc->encoding = strdup("EAN-13"); + encoding = EAN13; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + + case BARCODE_UPC: + switch (len0) { + case 6: case 7: case 8: + bc->encoding = strdup("UPC-E"); + encoding = UPCE; + break; + case 11: case 12: + bc->encoding = strdup("UPC-A"); + encoding = UPCA; + break; + default: + bc->error = -EINVAL; + return -1; + } + break; + default: + /* else, it's wrong (impossible, as the text is checked) */ + bc->error = -EINVAL; + return -1; + } + } + + /* better safe than sorry */ + if (bc->partial) free(bc->partial); bc->partial = NULL; + if (bc->textinfo) free(bc->textinfo); bc->textinfo = NULL; + + if (encoding == UPCA) { /* add the leading 0 (not printed) */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else if (encoding == UPCE) { + strcpy(text, upc_a_to_e(upc_e_to_a(bc->ascii))); + } else { + strcpy(text, bc->ascii); + } + + /* + * build the checksum and the bars: any encoding is slightly different + */ + if (encoding == UPCA || encoding == EAN13 || encoding == ISBN) { + if (!(encoding == UPCA && len0 == 12) && + !(encoding == EAN13 && len0 == 13)) { + checksum = ean_make_checksum(text, 0); + text[12] = '0' + checksum; /* add it to the text */ + text[13] = '\0'; + } + + strcpy(partial, guard[0]); + if (encoding == EAN13 || encoding == ISBN) { /* The first digit */ + sprintf(tptr,"0:12:%c ",text[0]); + tptr += strlen(tptr); + partial[0] = '9'; /* extra space for the digit */ + } else if (encoding == UPCA) + partial[0] = '9'; /* UPC has one digit before the symbol, too */ + xpos = width_of_partial(partial); + mirror = ean_mirrortab[text[0]-'0']; + + /* left part */ + for (i=1;i<7;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i-1] == '1') { + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + /* + * Write the ascii digit. UPC has a special case + * for the first digit, which is out of the bars + */ + if (encoding == UPCA && i==1) { + sprintf(tptr, "0:10:%c ", text[i]); + tptr += strlen(tptr); + ptr1[1] += 'a'-'1'; /* bars are long */ + ptr1[3] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + /* count the width of the symbol */ + xpos += 7; /* width_of_partial(ptr2) */ + } + + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=7;i<13;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i]-'0']; /* source */ + strcpy(ptr1, ptr2); + /* + * Ascii digit. Once again, UPC has a special + * case for the last digit + */ + if (encoding == UPCA && i==12) { + sprintf(tptr, "%i:10:%c ", xpos+13, text[i]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + } else { + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + } + xpos += 7; /* width_of_partial(ptr2) */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + xpos += width_of_partial(guard[2]); + + } else if (encoding == UPCE) { + checksum = text[7] - '0'; + + strcpy(partial, guardE[0]); + partial[0] = '9'; /* UPC-A has one digit before the symbol, too */ + xpos = width_of_partial(partial); + + /* UPC-E has the number system written before the bars. */ + sprintf(tptr, "0:10:%c ", text[0]); + tptr += strlen(tptr); + + if (text[0] == '0') + mirror = upc_mirrortab[checksum]; + else + mirror = upc_mirrortab1[checksum]; + + for (i=0;i<6;i++) { + ptr1 = partial + strlen(partial); /* target */ + ptr2 = digits[text[i+1]-'0']; /* source */ + strcpy(ptr1, ptr2); + if (mirror[i] != '1') { /* negated wrt EAN13 */ + /* mirror this */ + ptr1[0] = ptr2[3]; + ptr1[1] = ptr2[2]; + ptr1[2] = ptr2[1]; + ptr1[3] = ptr2[0]; + } + sprintf(tptr, "%i:12:%c ", xpos, text[i+1]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(ptr2) */ + } + + sprintf(tptr, "%i:10:%c ", xpos+10, text[7]); + tptr += strlen(tptr); + ptr1[0] += 'a'-'1'; /* bars are long */ + ptr1[2] += 'a'-'1'; + + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guardE[1]); /* end */ + + } else { /* EAN-8 almost identical to EAN-13 but no mirroring */ + + if (len0 != 8) { + checksum = ean_make_checksum(text, 0); + text[7] = '0' + checksum; /* add it to the text */ + text[8] = '\0'; + } + + strcpy(partial, guard[0]); + xpos = width_of_partial(partial); + + /* left part */ + for (i=0;i<4;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + strcat(partial, guard[1]); /* middle */ + xpos += width_of_partial(guard[1]); + + /* right part */ + for (i=4;i<8;i++) { + strcpy(partial + strlen(partial), digits[text[i]-'0']); + sprintf(tptr, "%i:12:%c ", xpos, text[i]); + tptr += strlen(tptr); + xpos += 7; /* width_of_partial(digits[text[i]-'0' */ + } + tptr[-1] = '\0'; /* overwrite last space */ + strcat(partial, guard[2]); /* end */ + } + + /* + * And that's it. Now, in case some add-on is specified it + * must be encoded too. Look for it. + */ + if ( (ptr1 = spc) ) { + ptr1++; + strcpy(text, ptr1); + if (strlen(ptr1)==5) { + checksum = ean_make_checksum(text, 1 /* special way */); + mirror = upc_mirrortab[checksum]+1; /* only last 5 digits */ + } else { + checksum = atoi(text)%4; + mirror = upc_mirrortab2[checksum]; + } + strcat(textinfo, " +"); strcat(partial, "+"); + tptr = textinfo + strlen(textinfo); + for (i=0; ipartial = strdup(partial); + if (!bc->partial) { + bc->error = errno; + return -1; + } + bc->textinfo = strdup(textinfo); + if (!bc->textinfo) { + bc->error = errno; + free(bc->partial); + bc->partial = NULL; + return -1; + } + if (!bc->width) + bc->width = width_of_partial(partial); + + return 0; /* success */ +} + +int Barcode_upc_encode(struct Barcode_Item *bc) +{ + return Barcode_ean_encode(bc); /* UPC is folded into EAN */ +} + +int Barcode_isbn_encode(struct Barcode_Item *bc) +{ + /* For ISBN we must normalize the string and prefix "978" */ + unsigned char *text = malloc(24); /* 13 + ' ' + 5 plus some slack */ + unsigned char *otext; + int i, j, retval; + + if (!text) { + bc->error = ENOMEM; + return -1; + } + strcpy(text, "978"); j=3; + + otext = bc->ascii; + for (i=0; otext[i]; i++) { + if (isdigit(otext[i])) + text[j++] = otext[i]; + if (j == 12) /* checksum added later */ + break; + } + text[j]='\0'; + if (strchr(otext, ' ')) + strcat(text, strchr(otext, ' ')); + bc->ascii = text; + bc->encoding = strdup("ISBN"); + retval = Barcode_ean_encode(bc); + bc->ascii = otext; /* restore ascii for the ps comments */ + free(text); + return retval; +} + diff --git a/BarCode/i25.c b/BarCode/i25.c index 72bd035..c7d4d0e 100644 --- a/BarCode/i25.c +++ b/BarCode/i25.c @@ -1,164 +1,164 @@ -/* - * i25.c -- "interleaved 2 of 5" - * - * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - -static char *codes[] = { - "11331", "31113", "13113", "33111", "11313", - "31311", "13311", "11133", "31131", "13131" -}; - -static char *guard[] = {"a1a1", "c1a"}; /* begin end */ - -int Barcode_i25_verify(unsigned char *text) -{ - if (!text[0]) - return -1; - while (*text && isdigit(*text)) - text++; - if (*text) - return -1; /* a non-digit char */ - return 0; /* ok */ -} - -int Barcode_i25_encode(struct Barcode_Item *bc) -{ - unsigned char *text; - unsigned char *partial; /* dynamic */ - unsigned char *textinfo; /* dynamic */ - unsigned char *textptr, *p1, *p2, *pd; - int i, len, sum[2], textpos, usesum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("interleaved 2 of 5"); - - text = bc->ascii; - if (!bc->ascii) { - bc->error = EINVAL; - return -1; - } - - if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1; - - /* create the real text string, padded to an even number of digits */ - text = malloc(strlen(bc->ascii) + 3); /* leading 0, checksum, term. */ - if (!text) { - bc->error = errno; - return -1; - } - /* add the leading 0 if needed */ - i = strlen(bc->ascii) + usesum; - if (i % 2) { - /* add a leading 0 */ - text[0] = '0'; - strcpy(text+1, bc->ascii); - } else { - strcpy(text, bc->ascii); - } - /* add the trailing checksum if needed, the leading 0 is ignored */ - if (usesum) { - sum[0] = sum[1] = 0; - for (i=0; text[i]; i++) - sum[i%2] += text[i]-'0'; - /* - * The "even" sum must be multiplied by three, and the * - * rightmost digit is defined as "even". The digits' position - * is already correct, whether or not we added a leading zero. - * (e.g., they are in pos. 0..4 or 1..4 of the string) - */ - i = sum[0] * 3 + sum[1]; - strcat(text, "0"); - text[strlen(text)-1] += (10 - (i%10)) % 10; - } - - /* the partial code is 5 * (text + check) + 4(head) + 3(tail) + term. */ - partial = malloc( (strlen(text) + 3) * 5 +2); /* be large... */ - if (!partial) { - bc->error = errno; - free(text); - return -1; - } - - /* the text information is at most "nnn:fff:c " * (strlen+1) +term */ - textinfo = malloc(10*(strlen(text)+1) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - free(text); - return -1; - } - - - strcpy(partial, "0"); /* the first space */ - strcat(partial, guard[0]); /* start */ - textpos = 4; /* width of initial guard */ - textptr = textinfo; - - len = strlen(text); - for (i=0; ierror = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - free(text); - return -1; - } - /* interleave two digits */ - p1 = codes[text[i]-'0']; - p2 = codes[text[i+1]-'0']; - pd = partial + strlen(partial); /* destination */ - while (*p1) { - *(pd++) = *(p1++); - *(pd++) = *(p2++); - } - *pd = '\0'; - /* and print the ascii text (but don't print the checksum, if any */ - if (usesum && strlen(text+i)==2) { - /* print only one digit, discard the checksum */ - sprintf(textptr, "%i:12:%c ", textpos, text[i]); - } else { - sprintf(textptr, "%i:12:%c %i:12:%c ", textpos, text[i], - textpos+9, text[i+1]); - } - textpos += 18; /* width of two codes */ - textptr += strlen(textptr); - } - strcat(partial, guard[1]); - - bc->partial = partial; - bc->textinfo = textinfo; - free(text); - - return 0; -} - +/* + * i25.c -- "interleaved 2 of 5" + * + * Copyright (c) 1999,2000 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char *codes[] = { + "11331", "31113", "13113", "33111", "11313", + "31311", "13311", "11133", "31131", "13131" +}; + +static char *guard[] = {"a1a1", "c1a"}; /* begin end */ + +int Barcode_i25_verify(unsigned char *text) +{ + if (!text[0]) + return -1; + while (*text && isdigit(*text)) + text++; + if (*text) + return -1; /* a non-digit char */ + return 0; /* ok */ +} + +int Barcode_i25_encode(struct Barcode_Item *bc) +{ + unsigned char *text; + unsigned char *partial; /* dynamic */ + unsigned char *textinfo; /* dynamic */ + unsigned char *textptr, *p1, *p2, *pd; + int i, len, sum[2], textpos, usesum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("interleaved 2 of 5"); + + text = bc->ascii; + if (!bc->ascii) { + bc->error = EINVAL; + return -1; + } + + if ((bc->flags & BARCODE_NO_CHECKSUM)) usesum = 0; else usesum = 1; + + /* create the real text string, padded to an even number of digits */ + text = malloc(strlen(bc->ascii) + 3); /* leading 0, checksum, term. */ + if (!text) { + bc->error = errno; + return -1; + } + /* add the leading 0 if needed */ + i = strlen(bc->ascii) + usesum; + if (i % 2) { + /* add a leading 0 */ + text[0] = '0'; + strcpy(text+1, bc->ascii); + } else { + strcpy(text, bc->ascii); + } + /* add the trailing checksum if needed, the leading 0 is ignored */ + if (usesum) { + sum[0] = sum[1] = 0; + for (i=0; text[i]; i++) + sum[i%2] += text[i]-'0'; + /* + * The "even" sum must be multiplied by three, and the * + * rightmost digit is defined as "even". The digits' position + * is already correct, whether or not we added a leading zero. + * (e.g., they are in pos. 0..4 or 1..4 of the string) + */ + i = sum[0] * 3 + sum[1]; + strcat(text, "0"); + text[strlen(text)-1] += (10 - (i%10)) % 10; + } + + /* the partial code is 5 * (text + check) + 4(head) + 3(tail) + term. */ + partial = malloc( (strlen(text) + 3) * 5 +2); /* be large... */ + if (!partial) { + bc->error = errno; + free(text); + return -1; + } + + /* the text information is at most "nnn:fff:c " * (strlen+1) +term */ + textinfo = malloc(10*(strlen(text)+1) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + free(text); + return -1; + } + + + strcpy(partial, "0"); /* the first space */ + strcat(partial, guard[0]); /* start */ + textpos = 4; /* width of initial guard */ + textptr = textinfo; + + len = strlen(text); + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + free(text); + return -1; + } + /* interleave two digits */ + p1 = codes[text[i]-'0']; + p2 = codes[text[i+1]-'0']; + pd = partial + strlen(partial); /* destination */ + while (*p1) { + *(pd++) = *(p1++); + *(pd++) = *(p2++); + } + *pd = '\0'; + /* and print the ascii text (but don't print the checksum, if any */ + if (usesum && strlen(text+i)==2) { + /* print only one digit, discard the checksum */ + sprintf(textptr, "%i:12:%c ", textpos, text[i]); + } else { + sprintf(textptr, "%i:12:%c %i:12:%c ", textpos, text[i], + textpos+9, text[i+1]); + } + textpos += 18; /* width of two codes */ + textptr += strlen(textptr); + } + strcat(partial, guard[1]); + + bc->partial = partial; + bc->textinfo = textinfo; + free(text); + + return 0; +} + diff --git a/BarCode/library.c b/BarCode/library.c index 08df802..268035d 100644 --- a/BarCode/library.c +++ b/BarCode/library.c @@ -1,247 +1,247 @@ -/* - * library.c -- external functions of libbarcode - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H /* sometimes (windows, for instance) it's missing */ -# include -#endif -#include - -#include "barcode.h" -//#include "QFile.h" -//#include "QString.h" - -/* - * This function allocates a barcode structure and strdup()s the - * text string. It returns NULL in case of error - */ -struct Barcode_Item *Barcode_Create(char *text) -{ - struct Barcode_Item *bc; - - bc = malloc(sizeof(*bc)); - if (!bc) return NULL; - - memset(bc, 0, sizeof(*bc)); - bc->ascii = strdup(text); - bc->margin = BARCODE_DEFAULT_MARGIN; /* default margin */ - return bc; -} - - -/* - * Free a barcode structure - */ -int Barcode_Delete(struct Barcode_Item *bc) -{ - if (bc->ascii) - free(bc->ascii); - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - if (bc->encoding) - free(bc->encoding); - free(bc); - return 0; /* always success */ -} - - -/* - * The various supported encodings. This might be extended to support - * dynamic addition of extra encodings - */ -extern int Barcode_ean_verify(unsigned char *text); -extern int Barcode_ean_encode(struct Barcode_Item *bc); -extern int Barcode_upc_verify(unsigned char *text); -extern int Barcode_upc_encode(struct Barcode_Item *bc); -extern int Barcode_isbn_verify(unsigned char *text); -extern int Barcode_isbn_encode(struct Barcode_Item *bc); -extern int Barcode_39_verify(unsigned char *text); -extern int Barcode_39_encode(struct Barcode_Item *bc); -extern int Barcode_128b_verify(unsigned char *text); -extern int Barcode_128b_encode(struct Barcode_Item *bc); -extern int Barcode_128c_verify(unsigned char *text); -extern int Barcode_128c_encode(struct Barcode_Item *bc); -extern int Barcode_128_verify(unsigned char *text); -extern int Barcode_128_encode(struct Barcode_Item *bc); -extern int Barcode_128raw_verify(unsigned char *text); -extern int Barcode_128raw_encode(struct Barcode_Item *bc); -extern int Barcode_i25_verify(unsigned char *text); -extern int Barcode_i25_encode(struct Barcode_Item *bc); -extern int Barcode_cbr_verify(unsigned char *text); -extern int Barcode_cbr_encode(struct Barcode_Item *bc); -extern int Barcode_msi_verify(unsigned char *text); -extern int Barcode_msi_encode(struct Barcode_Item *bc); -extern int Barcode_pls_verify(unsigned char *text); -extern int Barcode_pls_encode(struct Barcode_Item *bc); -extern int Barcode_93_verify(unsigned char *text); -extern int Barcode_93_encode(struct Barcode_Item *bc); - - -struct encoding { - int type; - int (*verify)(unsigned char *text); - int (*encode)(struct Barcode_Item *bc); -}; - -struct encoding encodings[] = { - {BARCODE_EAN, Barcode_ean_verify, Barcode_ean_encode}, - {BARCODE_UPC, Barcode_upc_verify, Barcode_upc_encode}, - {BARCODE_ISBN, Barcode_isbn_verify, Barcode_isbn_encode}, - {BARCODE_128B, Barcode_128b_verify, Barcode_128b_encode}, - {BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode}, - {BARCODE_128RAW, Barcode_128raw_verify, Barcode_128raw_encode}, - {BARCODE_39, Barcode_39_verify, Barcode_39_encode}, - {BARCODE_I25, Barcode_i25_verify, Barcode_i25_encode}, - {BARCODE_128, Barcode_128_verify, Barcode_128_encode}, - {BARCODE_CBR, Barcode_cbr_verify, Barcode_cbr_encode}, - {BARCODE_PLS, Barcode_pls_verify, Barcode_pls_encode}, - {BARCODE_MSI, Barcode_msi_verify, Barcode_msi_encode}, - {BARCODE_93, Barcode_93_verify, Barcode_93_encode}, - {0, NULL, NULL} -}; - -/* - * A function to encode a string into bc->partial, ready for - * postprocessing to the output file. Meaningful bits for "flags" are - * the encoding mask and the no-checksum flag. These bits - * get saved in the data structure. - */ -int Barcode_Encode(struct Barcode_Item *bc, int flags) -{ - int validbits = BARCODE_ENCODING_MASK | BARCODE_NO_CHECKSUM; - struct encoding *cptr; - - /* If any flag is cleared in "flags", inherit it from "bc->flags" */ - if (!(flags & BARCODE_ENCODING_MASK)) - flags |= bc->flags & BARCODE_ENCODING_MASK; - if (!(flags & BARCODE_NO_CHECKSUM)) - flags |= bc->flags & BARCODE_NO_CHECKSUM; - flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); - - if (!(flags & BARCODE_ENCODING_MASK)) { - /* get the first code able to handle the text */ - for (cptr = encodings; cptr->verify; cptr++) - if (cptr->verify((unsigned char *)bc->ascii)==0) - break; - if (!cptr->verify) { - bc->error = EINVAL; /* no code can handle this text */ - return -1; - } - flags |= cptr->type; /* this works */ - bc->flags |= cptr->type; - } - for (cptr = encodings; cptr->verify; cptr++) - if (cptr->type == (flags & BARCODE_ENCODING_MASK)) - break; - if (!cptr->verify) { - bc->error = EINVAL; /* invalid barcode type */ - return -1; - } - if (cptr->verify(bc->ascii) != 0) { - bc->error = EINVAL; - return -1; - } - return cptr->encode(bc); -} - - -/* - * When multiple output formats are supported, there will - * be a jumpt table like the one for the types. Now we don't need it - */ -extern int Barcode_ps_print(struct Barcode_Item *bc, FILE *f); -extern int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f); - -/* - * A function to print a partially decoded string. Meaningful bits for - * "flags" are the output mask etc. These bits get saved in the data - * structure. - */ -int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags) -{ - int validbits = BARCODE_OUTPUT_MASK | BARCODE_NO_ASCII - | BARCODE_OUT_NOHEADERS; - - /* If any flag is clear in "flags", inherit it from "bc->flags" */ - if (!(flags & BARCODE_OUTPUT_MASK)) - flags |= bc->flags & BARCODE_OUTPUT_MASK; - if (!(flags & BARCODE_NO_ASCII)) - flags |= bc->flags & BARCODE_NO_ASCII; - if (!(flags & BARCODE_OUT_NOHEADERS)) - flags |= bc->flags & BARCODE_OUT_NOHEADERS; - flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); - - if (bc->flags & BARCODE_OUT_PCL) - return Barcode_pcl_print(bc, f); - return Barcode_ps_print(bc, f); -} - -/* - * Choose the position - */ -int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, - int xoff, int yoff, double scalef) -{ - bc->width = wid; bc->height = hei; - bc->xoff = xoff; bc->yoff = yoff; - bc->scalef = scalef; - return 0; -} - -/* - * Do it all in one step - */ -int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags) -{ - struct Barcode_Item * bc; - - if (!(bc=Barcode_Create(text))) { - errno = -ENOMEM; - return -1; - } - - if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 - || Barcode_Encode(bc, flags) < 0 - || Barcode_Print(bc, f, flags) < 0) { - errno = bc->error; - Barcode_Delete(bc); - return -1; - } - Barcode_Delete(bc); - return 0; -} - -/* - * Return the version - */ - -int Barcode_Version(char *vptr) -{ - if (vptr) - strcpy(vptr, BARCODE_VERSION); - return BARCODE_VERSION_INT; -} +/* + * library.c -- external functions of libbarcode + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H /* sometimes (windows, for instance) it's missing */ +# include +#endif +#include + +#include "barcode.h" +//#include "QFile.h" +//#include "QString.h" + +/* + * This function allocates a barcode structure and strdup()s the + * text string. It returns NULL in case of error + */ +struct Barcode_Item *Barcode_Create(char *text) +{ + struct Barcode_Item *bc; + + bc = malloc(sizeof(*bc)); + if (!bc) return NULL; + + memset(bc, 0, sizeof(*bc)); + bc->ascii = strdup(text); + bc->margin = BARCODE_DEFAULT_MARGIN; /* default margin */ + return bc; +} + + +/* + * Free a barcode structure + */ +int Barcode_Delete(struct Barcode_Item *bc) +{ + if (bc->ascii) + free(bc->ascii); + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + if (bc->encoding) + free(bc->encoding); + free(bc); + return 0; /* always success */ +} + + +/* + * The various supported encodings. This might be extended to support + * dynamic addition of extra encodings + */ +extern int Barcode_ean_verify(unsigned char *text); +extern int Barcode_ean_encode(struct Barcode_Item *bc); +extern int Barcode_upc_verify(unsigned char *text); +extern int Barcode_upc_encode(struct Barcode_Item *bc); +extern int Barcode_isbn_verify(unsigned char *text); +extern int Barcode_isbn_encode(struct Barcode_Item *bc); +extern int Barcode_39_verify(unsigned char *text); +extern int Barcode_39_encode(struct Barcode_Item *bc); +extern int Barcode_128b_verify(unsigned char *text); +extern int Barcode_128b_encode(struct Barcode_Item *bc); +extern int Barcode_128c_verify(unsigned char *text); +extern int Barcode_128c_encode(struct Barcode_Item *bc); +extern int Barcode_128_verify(unsigned char *text); +extern int Barcode_128_encode(struct Barcode_Item *bc); +extern int Barcode_128raw_verify(unsigned char *text); +extern int Barcode_128raw_encode(struct Barcode_Item *bc); +extern int Barcode_i25_verify(unsigned char *text); +extern int Barcode_i25_encode(struct Barcode_Item *bc); +extern int Barcode_cbr_verify(unsigned char *text); +extern int Barcode_cbr_encode(struct Barcode_Item *bc); +extern int Barcode_msi_verify(unsigned char *text); +extern int Barcode_msi_encode(struct Barcode_Item *bc); +extern int Barcode_pls_verify(unsigned char *text); +extern int Barcode_pls_encode(struct Barcode_Item *bc); +extern int Barcode_93_verify(unsigned char *text); +extern int Barcode_93_encode(struct Barcode_Item *bc); + + +struct encoding { + int type; + int (*verify)(unsigned char *text); + int (*encode)(struct Barcode_Item *bc); +}; + +struct encoding encodings[] = { + {BARCODE_EAN, Barcode_ean_verify, Barcode_ean_encode}, + {BARCODE_UPC, Barcode_upc_verify, Barcode_upc_encode}, + {BARCODE_ISBN, Barcode_isbn_verify, Barcode_isbn_encode}, + {BARCODE_128B, Barcode_128b_verify, Barcode_128b_encode}, + {BARCODE_128C, Barcode_128c_verify, Barcode_128c_encode}, + {BARCODE_128RAW, Barcode_128raw_verify, Barcode_128raw_encode}, + {BARCODE_39, Barcode_39_verify, Barcode_39_encode}, + {BARCODE_I25, Barcode_i25_verify, Barcode_i25_encode}, + {BARCODE_128, Barcode_128_verify, Barcode_128_encode}, + {BARCODE_CBR, Barcode_cbr_verify, Barcode_cbr_encode}, + {BARCODE_PLS, Barcode_pls_verify, Barcode_pls_encode}, + {BARCODE_MSI, Barcode_msi_verify, Barcode_msi_encode}, + {BARCODE_93, Barcode_93_verify, Barcode_93_encode}, + {0, NULL, NULL} +}; + +/* + * A function to encode a string into bc->partial, ready for + * postprocessing to the output file. Meaningful bits for "flags" are + * the encoding mask and the no-checksum flag. These bits + * get saved in the data structure. + */ +int Barcode_Encode(struct Barcode_Item *bc, int flags) +{ + int validbits = BARCODE_ENCODING_MASK | BARCODE_NO_CHECKSUM; + struct encoding *cptr; + + /* If any flag is cleared in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_ENCODING_MASK)) + flags |= bc->flags & BARCODE_ENCODING_MASK; + if (!(flags & BARCODE_NO_CHECKSUM)) + flags |= bc->flags & BARCODE_NO_CHECKSUM; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (!(flags & BARCODE_ENCODING_MASK)) { + /* get the first code able to handle the text */ + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->verify((unsigned char *)bc->ascii)==0) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* no code can handle this text */ + return -1; + } + flags |= cptr->type; /* this works */ + bc->flags |= cptr->type; + } + for (cptr = encodings; cptr->verify; cptr++) + if (cptr->type == (flags & BARCODE_ENCODING_MASK)) + break; + if (!cptr->verify) { + bc->error = EINVAL; /* invalid barcode type */ + return -1; + } + if (cptr->verify(bc->ascii) != 0) { + bc->error = EINVAL; + return -1; + } + return cptr->encode(bc); +} + + +/* + * When multiple output formats are supported, there will + * be a jumpt table like the one for the types. Now we don't need it + */ +extern int Barcode_ps_print(struct Barcode_Item *bc, FILE *f); +extern int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f); + +/* + * A function to print a partially decoded string. Meaningful bits for + * "flags" are the output mask etc. These bits get saved in the data + * structure. + */ +int Barcode_Print(struct Barcode_Item *bc, FILE *f, int flags) +{ + int validbits = BARCODE_OUTPUT_MASK | BARCODE_NO_ASCII + | BARCODE_OUT_NOHEADERS; + + /* If any flag is clear in "flags", inherit it from "bc->flags" */ + if (!(flags & BARCODE_OUTPUT_MASK)) + flags |= bc->flags & BARCODE_OUTPUT_MASK; + if (!(flags & BARCODE_NO_ASCII)) + flags |= bc->flags & BARCODE_NO_ASCII; + if (!(flags & BARCODE_OUT_NOHEADERS)) + flags |= bc->flags & BARCODE_OUT_NOHEADERS; + flags = bc->flags = (flags & validbits) | (bc->flags & ~validbits); + + if (bc->flags & BARCODE_OUT_PCL) + return Barcode_pcl_print(bc, f); + return Barcode_ps_print(bc, f); +} + +/* + * Choose the position + */ +int Barcode_Position(struct Barcode_Item *bc, int wid, int hei, + int xoff, int yoff, double scalef) +{ + bc->width = wid; bc->height = hei; + bc->xoff = xoff; bc->yoff = yoff; + bc->scalef = scalef; + return 0; +} + +/* + * Do it all in one step + */ +int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + errno = -ENOMEM; + return -1; + } + + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + || Barcode_Print(bc, f, flags) < 0) { + errno = bc->error; + Barcode_Delete(bc); + return -1; + } + Barcode_Delete(bc); + return 0; +} + +/* + * Return the version + */ + +int Barcode_Version(char *vptr) +{ + if (vptr) + strcpy(vptr, BARCODE_VERSION); + return BARCODE_VERSION_INT; +} diff --git a/BarCode/msi.c b/BarCode/msi.c index 77a373b..2f24957 100644 --- a/BarCode/msi.c +++ b/BarCode/msi.c @@ -1,155 +1,155 @@ -/* - * msi.c -- encoding for MSI-Plessey - * - * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - - -/* Patterns */ -static char *patterns[] = { "13", "31" }; - -static char *fillers[] = { "031", "131" }; - -static int width = 16 /* each character uses 4 patterns */, - startpos = 6 /* length of the first filler */; - -/* - * Check that the text can be encoded. Returns 0 or -1. - */ -int Barcode_msi_verify(unsigned char *text) -{ - int i; - - if (!strlen(text)) - return -1; - for (i=0; text[i]; i++) { - if (!isdigit(text[i])) - return -1; - } - return 0; -} - -static int add_one(char *ptr, int code) -{ - sprintf(ptr, "%s%s%s%s", - patterns[(code >> 3) & 1], - patterns[(code >> 2) & 1], - patterns[(code >> 1) & 1], - patterns[code & 1]); - return 0; -} - -/* - * The encoding functions fills the "partial" and "textinfo" fields. - * Lowercase chars are converted to uppercase - */ -int Barcode_msi_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *ptr, *textptr; - int i, code, textpos, usesum, checksum = 0; - - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("msi"); - - if ((bc->flags & BARCODE_NO_CHECKSUM)) - usesum = 0; - else - usesum = 1; - - text = bc->ascii; - - /* the partial code is head + 8 * (text + check) + tail + margin + term. */ - partial = malloc( 3 + 8 * (strlen(text) + 1) + 3 + 2 ); - if (!partial) { - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * strlen +term */ - textinfo = malloc(10*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - strcpy(partial, fillers[0]); - ptr = partial + strlen(partial); - textptr = textinfo; - textpos = startpos; - - for (i=0; ipartial = partial; - bc->textinfo = textinfo; - - return 0; -} +/* + * msi.c -- encoding for MSI-Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + + +/* Patterns */ +static char *patterns[] = { "13", "31" }; + +static char *fillers[] = { "031", "131" }; + +static int width = 16 /* each character uses 4 patterns */, + startpos = 6 /* length of the first filler */; + +/* + * Check that the text can be encoded. Returns 0 or -1. + */ +int Barcode_msi_verify(unsigned char *text) +{ + int i; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!isdigit(text[i])) + return -1; + } + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[(code >> 3) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 1) & 1], + patterns[code & 1]); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_msi_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *ptr, *textptr; + int i, code, textpos, usesum, checksum = 0; + + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("msi"); + + if ((bc->flags & BARCODE_NO_CHECKSUM)) + usesum = 0; + else + usesum = 1; + + text = bc->ascii; + + /* the partial code is head + 8 * (text + check) + tail + margin + term. */ + partial = malloc( 3 + 8 * (strlen(text) + 1) + 3 + 2 ); + if (!partial) { + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ipartial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/BarCode/pcl.c b/BarCode/pcl.c index c50a828..15fb0ec 100644 --- a/BarCode/pcl.c +++ b/BarCode/pcl.c @@ -1,185 +1,185 @@ -/* - * pcl.c -- printing the "partial" bar encoding in PCL format - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * Copyright (c) 2001 Andrea Scopece (a.scopece@tin.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - -#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ - - -/* - * How do the "partial" and "textinfo" strings work? See file "ps.c" - */ - - -int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f) -{ - int i, j, k, barlen; - double f1, f2, fsav=0; - int mode = '-'; /* text below bars */ - double scalef=1, xpos, x0, y0, yr; - unsigned char *ptr; - unsigned char c; - - char font_id[6]; /* default font, should be "scalable" */ - /* 0 Line printer, use on older LJet II, isn't scalable */ - /* 4148 Univers, use on LJet III series, and Lj 4L, 5L */ - /* 16602 Arial, default LJ family 4, 5, 6, Color, Djet */ - - if (!bc->partial || !bc->textinfo) { - bc->error = EINVAL; - return -1; - } - - /* - * Maybe this first part can be made common to several printing back-ends, - * we'll see how that works when other ouput engines are added - */ - - /* First, calculate barlen */ - barlen = bc->partial[0] - '0'; - for (ptr = bc->partial+1; *ptr; ptr++) - if (isdigit(*ptr)) - barlen += (*ptr - '0'); - else if (islower(*ptr)) - barlen += (*ptr - 'a'+1); - - /* The scale factor depends on bar length */ - if (!bc->scalef) { - if (!bc->width) bc->width = barlen; /* default */ - scalef = bc->scalef = (double)bc->width / (double)barlen; - } - - /* The width defaults to "just enough" */ - if (!bc->width) bc->width = barlen * scalef +1; - - /* But it can be too small, in this case enlarge and center the area */ - if (bc->width < barlen * scalef) { - int wid = barlen * scalef + 1; - bc->xoff -= (wid - bc->width)/2 ; - bc->width = wid; - /* Can't extend too far on the left */ - if (bc->xoff < 0) { - bc->width += -bc->xoff; - bc->xoff = 0; - } - } - - /* The height defaults to 80 points (rescaled) */ - if (!bc->height) bc->height = 80 * scalef; - i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); - if (bc->height < i * scalef ) { - double scaleg = ((double)bc->height) / i; - int wid = bc->width * scaleg / scalef; - bc->xoff += (bc->width - wid)/2; - bc->width = wid; - scalef = scaleg; - } - - - /* - * deal with PCL output - */ - - xpos = bc->margin + (bc->partial[0]-'0') * scalef; - for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { - /* special cases: '+' and '-' */ - if (*ptr == '+' || *ptr == '-') { - mode = *ptr; /* don't count it */ i++; continue; - } - - /* j is the width of this bar/space */ - if (isdigit (*ptr)) j = *ptr-'0'; - else j = *ptr-'a'+1; - if (i%2) { /* bar */ - x0 = bc->xoff + xpos; - y0 = bc->yoff + bc->margin; - yr = bc->height; - if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ - if (mode == '-') { - /* text below bars: 10 points or five points */ - yr -= (isdigit(*ptr) ? 10 : 5) * scalef; - } else { /* '+' */ - /* text above bars: 10 or 0 from bottom, and 10 from top */ - y0 += (isdigit(*ptr) ? 10 : 0) * scalef; - yr -= (isdigit(*ptr) ? 20 : 10) * scalef; - } - } - - fprintf(f,"%c&a%.0fH", 27, x0 * 10.0); - fprintf(f,"%c&a%.0fV", 27, y0 * 10.0); - fprintf(f,"%c*c%.0fH", 27, ((j*scalef)-SHRINK_AMOUNT) * 10.0); - fprintf(f,"%c*c%.0fV", 27, yr * 10.0); - fprintf(f,"%c*c0P\n", 27); - } - xpos += j * scalef; - } - - /* the text */ - - mode = '-'; /* reinstantiate default */ - if (!(bc->flags & BARCODE_NO_ASCII)) { - k=0; /* k is the "previous font size" */ - for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { - while (*ptr == ' ') ptr++; - if (!*ptr) break; - if (*ptr == '+' || *ptr == '-') { - mode = *ptr; continue; - } - if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { - fprintf(stderr, "barcode: impossible data: %s\n", ptr); - continue; - } - - /* select a Scalable Font */ - - if (fsav != f2) - { - if ((bc->flags & BARCODE_OUT_PCL_III) == BARCODE_OUT_PCL_III) - { strcpy(font_id, "4148"); /* font Univers */ - } - else - { strcpy(font_id, "16602"); /* font Arial */ - } - - fprintf(f,"%c(8U%c(s1p%5.2fv0s0b%sT", 27, 27, f2 * scalef, font_id); - } - fsav = f2; - - fprintf(f,"%c&a%.0fH", 27, (bc->xoff + f1 * scalef + bc->margin) * 10.0); - fprintf(f,"%c&a%.0fV", 27, - mode != '-' - ? ((double)bc->yoff + bc->margin + 8*scalef) * 10.0 - : ((double)bc->yoff + bc->margin + bc->height ) * 10.0); - - fprintf(f, "%c", c); - } - - } - - return 0; -} +/* + * pcl.c -- printing the "partial" bar encoding in PCL format + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * Copyright (c) 2001 Andrea Scopece (a.scopece@tin.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? See file "ps.c" + */ + + +int Barcode_pcl_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + char font_id[6]; /* default font, should be "scalable" */ + /* 0 Line printer, use on older LJet II, isn't scalable */ + /* 4148 Univers, use on LJet III series, and Lj 4L, 5L */ + /* 16602 Arial, default LJ family 4, 5, 6, Color, Djet */ + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } + + + /* + * deal with PCL output + */ + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + + fprintf(f,"%c&a%.0fH", 27, x0 * 10.0); + fprintf(f,"%c&a%.0fV", 27, y0 * 10.0); + fprintf(f,"%c*c%.0fH", 27, ((j*scalef)-SHRINK_AMOUNT) * 10.0); + fprintf(f,"%c*c%.0fV", 27, yr * 10.0); + fprintf(f,"%c*c0P\n", 27); + } + xpos += j * scalef; + } + + /* the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + /* select a Scalable Font */ + + if (fsav != f2) + { + if ((bc->flags & BARCODE_OUT_PCL_III) == BARCODE_OUT_PCL_III) + { strcpy(font_id, "4148"); /* font Univers */ + } + else + { strcpy(font_id, "16602"); /* font Arial */ + } + + fprintf(f,"%c(8U%c(s1p%5.2fv0s0b%sT", 27, 27, f2 * scalef, font_id); + } + fsav = f2; + + fprintf(f,"%c&a%.0fH", 27, (bc->xoff + f1 * scalef + bc->margin) * 10.0); + fprintf(f,"%c&a%.0fV", 27, + mode != '-' + ? ((double)bc->yoff + bc->margin + 8*scalef) * 10.0 + : ((double)bc->yoff + bc->margin + bc->height ) * 10.0); + + fprintf(f, "%c", c); + } + + } + + return 0; +} diff --git a/BarCode/plessey.c b/BarCode/plessey.c index ec47100..be5c288 100644 --- a/BarCode/plessey.c +++ b/BarCode/plessey.c @@ -1,164 +1,164 @@ -/* - * plessey.c -- encoding for Plessey - * - * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - -static char * patterns[] = { "13", "31" }; - -/* this is ordered in decades to simplify encoding */ -static char alphabet[] = - "0123456789" "ABCDEF"; - -/* stop sequence may be 231311313 (barcodemill.com) */ -static char *fillers[] = { "031311331", "331311313" }; - -static int width = 16, startpos = 16; - -/* - * Check that the text can be encoded. Returns 0 or -1. - * If it's all lowecase convert to uppercase and accept it - */ -int Barcode_pls_verify(unsigned char *text) -{ - int i, upper = 0, lower = 0; - - if (!strlen(text)) - return -1; - for (i=0; text[i]; i++) { - if (!strchr(alphabet,toupper(text[i]))) - return -1; - if (isupper(text[i])) upper++; - if (islower(text[i])) lower++; - } - if (upper && lower) - return -1; - return 0; -} - -static int add_one(char *ptr, int code) -{ - sprintf(ptr, "%s%s%s%s", - patterns[code & 1], - patterns[(code >> 1) & 1], - patterns[(code >> 2) & 1], - patterns[(code >> 3) & 1] - ); - return 0; -} - -/* - * The encoding functions fills the "partial" and "textinfo" fields. - * Lowercase chars are converted to uppercase - */ -int Barcode_pls_encode(struct Barcode_Item *bc) -{ - static char *text; - static char *partial; /* dynamic */ - static char *textinfo; /* dynamic */ - char *c, *ptr, *textptr; - unsigned char *checkptr; - int i, code, textpos; - static char check[9] = {1,1,1,1,0,1,0,0,1}; - if (bc->partial) - free(bc->partial); - if (bc->textinfo) - free(bc->textinfo); - bc->partial = bc->textinfo = NULL; /* safe */ - - if (!bc->encoding) - bc->encoding = strdup("plessey"); - - text = bc->ascii; - if (!text) { - bc->error = EINVAL; - return -1; - } - /* the partial code is 8 * (head + text + check + tail) + margin + term. */ - partial = malloc( (strlen(text) + 4) * 8 + 3); - checkptr = calloc (1, strlen(text) * 4 + 8); - - if (!partial || !checkptr) { - if (partial) free(partial); - if (checkptr) free(checkptr); - bc->error = errno; - return -1; - } - - /* the text information is at most "nnn:fff:c " * strlen +term */ - textinfo = malloc(10*strlen(text) + 2); - if (!textinfo) { - bc->error = errno; - free(partial); - return -1; - } - - strcpy(partial, fillers[0]); - ptr = partial + strlen(partial); - textptr = textinfo; - textpos = startpos; - - for (i=0; ierror = EINVAL; /* impossible if text is verified */ - free(partial); - free(textinfo); - return -1; - } - code = c - alphabet; - add_one(ptr, code); - sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); - - textpos += width; /* width of each code */ - textptr += strlen(textptr); - ptr += strlen(ptr); - checkptr[4*i] = code & 1; - checkptr[4*i+1] = (code >> 1) & 1; - checkptr[4*i+2] = (code >> 2) & 1; - checkptr[4*i+3] = (code >> 3) & 1; - } - /* The CRC checksum is required */ - for (i=0; i < 4*strlen(text); i++) { - int j; - if (checkptr[i]) - for (j = 0; j < 9; j++) - checkptr[i+j] ^= check[j]; - } - for (i = 0; i < 8; i++) { - sprintf(ptr, patterns[checkptr[strlen(text) * 4 + i]]); - ptr += 2; - } - fprintf(stderr, "CRC: "); - for (i = 0; i < 8; i++) { - fputc('0' + checkptr[strlen(text) * 4 + i], stderr); - } - fputc('\n', stderr); - strcpy(ptr, fillers[1]); - bc->partial = partial; - bc->textinfo = textinfo; - - return 0; -} +/* + * plessey.c -- encoding for Plessey + * + * Copyright (c) 2000 Leonid A. Broukhis (leob@mailcom.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +static char * patterns[] = { "13", "31" }; + +/* this is ordered in decades to simplify encoding */ +static char alphabet[] = + "0123456789" "ABCDEF"; + +/* stop sequence may be 231311313 (barcodemill.com) */ +static char *fillers[] = { "031311331", "331311313" }; + +static int width = 16, startpos = 16; + +/* + * Check that the text can be encoded. Returns 0 or -1. + * If it's all lowecase convert to uppercase and accept it + */ +int Barcode_pls_verify(unsigned char *text) +{ + int i, upper = 0, lower = 0; + + if (!strlen(text)) + return -1; + for (i=0; text[i]; i++) { + if (!strchr(alphabet,toupper(text[i]))) + return -1; + if (isupper(text[i])) upper++; + if (islower(text[i])) lower++; + } + if (upper && lower) + return -1; + return 0; +} + +static int add_one(char *ptr, int code) +{ + sprintf(ptr, "%s%s%s%s", + patterns[code & 1], + patterns[(code >> 1) & 1], + patterns[(code >> 2) & 1], + patterns[(code >> 3) & 1] + ); + return 0; +} + +/* + * The encoding functions fills the "partial" and "textinfo" fields. + * Lowercase chars are converted to uppercase + */ +int Barcode_pls_encode(struct Barcode_Item *bc) +{ + static char *text; + static char *partial; /* dynamic */ + static char *textinfo; /* dynamic */ + char *c, *ptr, *textptr; + unsigned char *checkptr; + int i, code, textpos; + static char check[9] = {1,1,1,1,0,1,0,0,1}; + if (bc->partial) + free(bc->partial); + if (bc->textinfo) + free(bc->textinfo); + bc->partial = bc->textinfo = NULL; /* safe */ + + if (!bc->encoding) + bc->encoding = strdup("plessey"); + + text = bc->ascii; + if (!text) { + bc->error = EINVAL; + return -1; + } + /* the partial code is 8 * (head + text + check + tail) + margin + term. */ + partial = malloc( (strlen(text) + 4) * 8 + 3); + checkptr = calloc (1, strlen(text) * 4 + 8); + + if (!partial || !checkptr) { + if (partial) free(partial); + if (checkptr) free(checkptr); + bc->error = errno; + return -1; + } + + /* the text information is at most "nnn:fff:c " * strlen +term */ + textinfo = malloc(10*strlen(text) + 2); + if (!textinfo) { + bc->error = errno; + free(partial); + return -1; + } + + strcpy(partial, fillers[0]); + ptr = partial + strlen(partial); + textptr = textinfo; + textpos = startpos; + + for (i=0; ierror = EINVAL; /* impossible if text is verified */ + free(partial); + free(textinfo); + return -1; + } + code = c - alphabet; + add_one(ptr, code); + sprintf(textptr, "%i:12:%c ", textpos, toupper(text[i])); + + textpos += width; /* width of each code */ + textptr += strlen(textptr); + ptr += strlen(ptr); + checkptr[4*i] = code & 1; + checkptr[4*i+1] = (code >> 1) & 1; + checkptr[4*i+2] = (code >> 2) & 1; + checkptr[4*i+3] = (code >> 3) & 1; + } + /* The CRC checksum is required */ + for (i=0; i < 4*strlen(text); i++) { + int j; + if (checkptr[i]) + for (j = 0; j < 9; j++) + checkptr[i+j] ^= check[j]; + } + for (i = 0; i < 8; i++) { + sprintf(ptr, patterns[checkptr[strlen(text) * 4 + i]]); + ptr += 2; + } + fprintf(stderr, "CRC: "); + for (i = 0; i < 8; i++) { + fputc('0' + checkptr[strlen(text) * 4 + i], stderr); + } + fputc('\n', stderr); + strcpy(ptr, fillers[1]); + bc->partial = partial; + bc->textinfo = textinfo; + + return 0; +} diff --git a/BarCode/ps.c b/BarCode/ps.c index 587d69c..5725b11 100644 --- a/BarCode/ps.c +++ b/BarCode/ps.c @@ -1,259 +1,259 @@ -/* - * ps.c -- printing the "partial" bar encoding - * - * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) - * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include - -#include "barcode.h" - -#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ - - -/* - * How do the "partial" and "textinfo" strings work? - * - * The first char in "partial" tells how much extra space to add to the - * left of the bars. For EAN-13, it is used to leave space to print the - * first digit, other codes may have '0' for no-extra-space-needed. - * - * The next characters are alternating bars and spaces, as multiples - * of the base dimension which is 1 unless the code is - * rescaled. Rescaling is calculated as the ratio from the requested - * width and the calculated width. Digits represent bar/space - * dimensions. Lower-case letters represent those bars that should - * extend lower than the others: 'a' is equivalent to '1', 'b' is '2' and - * so on. - * - * The "textinfo" string is made up of fields "%lf:%lf:%c" separated by - * blank space. The first integer is the x position of the character, - * the second is the font size (before rescaling) and the char item is - * the charcter to be printed. - * - * Both the "partial" and "textinfo" strings may include "-" or "+" as - * special characters (in "textinfo" the char should be a standalone - * word). They state where the text should be printed: below the bars - * ("-", default) or above the bars. This is used, for example, to - * print the add-5 and add-2 codes to the right of UPC or EAN codes - * (the add-5 extension is mostly used in ISBN codes. - */ - - -int Barcode_ps_print(struct Barcode_Item *bc, FILE *f) -{ - int i, j, k, barlen, printable=1; - double f1, f2, fsav=0; - int mode = '-'; /* text below bars */ - double scalef=1, xpos, x0, y0, yr; - unsigned char *ptr; - unsigned char c; - - if (!bc->partial || !bc->textinfo) { - bc->error = EINVAL; - return -1; - } - - - /* - * Maybe this first part can be made common to several printing back-ends, - * we'll see how that works when other ouput engines are added - */ - - /* First, calculate barlen */ - barlen = bc->partial[0] - '0'; - for (ptr = bc->partial+1; *ptr; ptr++) - if (isdigit(*ptr)) - barlen += (*ptr - '0'); - else if (islower(*ptr)) - barlen += (*ptr - 'a'+1); - - /* The scale factor depends on bar length */ - if (!bc->scalef) { - if (!bc->width) bc->width = barlen; /* default */ - scalef = bc->scalef = (double)bc->width / (double)barlen; - } - - /* The width defaults to "just enough" */ - if (!bc->width) bc->width = barlen * scalef +1; - - /* But it can be too small, in this case enlarge and center the area */ - if (bc->width < barlen * scalef) { - int wid = barlen * scalef + 1; - bc->xoff -= (wid - bc->width)/2 ; - bc->width = wid; - /* Can't extend too far on the left */ - if (bc->xoff < 0) { - bc->width += -bc->xoff; - bc->xoff = 0; - } - } - - /* The height defaults to 80 points (rescaled) */ - if (!bc->height) bc->height = 80 * scalef; - - /* If too small (5 + text), reduce the scale factor and center */ - i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); - if (bc->height < i * scalef ) { - double scaleg = ((double)bc->height) / i; - int wid = bc->width * scaleg / scalef; - bc->xoff += (bc->width - wid)/2; - bc->width = wid; - scalef = scaleg; - } - - /* - * Ok, then deal with actual ps (eps) output - */ - - if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { /* spit a header first */ - if (bc->flags & BARCODE_OUT_EPS) - fprintf(f, "%%!PS-Adobe-2.0 EPSF-1.2\n"); - else - fprintf(f, "%%!PS-Adobe-2.0\n"); - fprintf(f, "%%%%Creator: libbarcode\n"); - if (bc->flags & BARCODE_OUT_EPS) { - fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", - bc->xoff, - bc->yoff, - bc->xoff + bc->width + 2* bc->margin, - bc->yoff + bc->height + 2* bc->margin); - } - fprintf(f, "%%%%EndComments\n"); - if (bc->flags & BARCODE_OUT_PS) { - fprintf(f, "%%%%EndProlog\n\n"); - fprintf(f, "%%%%Page: 1 1\n\n"); - } - } - - /* Print some informative comments */ - for (i=0; bc->ascii[i]; i++) - if (bc->ascii[i] < ' ') - printable = 0; - - fprintf(f,"%% Printing barcode for \"%s\", scaled %5.2f", - printable ? bc->ascii : "", scalef); - if (bc->encoding) - fprintf(f,", encoded using \"%s\"",bc->encoding); - fprintf(f, "\n"); - fprintf(f,"%% The space/bar succession is represented " - "by the following widths (space first):\n" - "%% "); - for (i=0; ipartial); i++) { - unsigned char c = bc->partial[i]; - if (isdigit(c)) putc(c, f); - if (islower(c)) putc(c-'a'+'1', f); - if (isupper(c)) putc(c-'A'+'1', f); - } - /* open array for "forall" */ - fprintf(f, "\n[\n%% height xpos ypos width" - " height xpos ypos width\n"); - - xpos = bc->margin + (bc->partial[0]-'0') * scalef; - for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { - /* special cases: '+' and '-' */ - if (*ptr == '+' || *ptr == '-') { - mode = *ptr; /* don't count it */ i++; continue; - } - /* j is the width of this bar/space */ - if (isdigit (*ptr)) j = *ptr-'0'; - else j = *ptr-'a'+1; - if (i%2) { /* bar */ - x0 = bc->xoff + xpos + (j*scalef)/2; - y0 = bc->yoff + bc->margin; - yr = bc->height; - if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ - if (mode == '-') { - /* text below bars: 10 points or five points */ - y0 += (isdigit(*ptr) ? 10 : 5) * scalef; - yr -= (isdigit(*ptr) ? 10 : 5) * scalef; - } else { /* '+' */ - /* text above bars: 10 or 0 from bottom, and 10 from top */ - y0 += (isdigit(*ptr) ? 10 : 0) * scalef; - yr -= (isdigit(*ptr) ? 20 : 10) * scalef; - } - } - /* Define an array and then use "forall" (Hans Schou) */ - fprintf(f," [%5.2f %6.2f %6.2f %5.2f]%s", - yr, x0, y0, (j * scalef) - SHRINK_AMOUNT, - i%4 == 1 ? " " : "\n"); - } - xpos += j * scalef; - } - fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} " - "bind forall\n"); - - /* Then, the text */ - - mode = '-'; /* reinstantiate default */ - if (!(bc->flags & BARCODE_NO_ASCII)) { - fprintf(f, "[\n%% char xpos ypos fontsize\n"); - k=0; /* k is the "previous font size" */ - for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { - while (*ptr == ' ') ptr++; - if (!*ptr) break; - if (*ptr == '+' || *ptr == '-') { - mode = *ptr; continue; - } - if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { - fprintf(stderr, "barcode: impossible data: %s\n", ptr); - continue; - } - - fprintf(f, " [("); - /* Both the backslash and the two parens are special */ - if (c=='\\' || c==')' || c=='(') - fprintf(f, "\\%c) ", c); - else - fprintf(f, "%c) ", c); - fprintf(f, "%6.2f %6.2f %5.2f]\n", - bc->xoff + f1 * scalef + bc->margin, - mode == '-' - ? (double)bc->yoff + bc->margin - : (double)bc->yoff + bc->margin+bc->height - 8*scalef, - fsav == f2 ? 0.0 : f2 * scalef); - fsav = f2; - } - fprintf(f,"] { {} forall dup 0.00 ne {\n\t" - "/Helvetica findfont exch scalefont setfont\n" - " } {pop} ifelse\n" - " moveto show} bind forall\n"); - - - } - - fprintf(f,"%% End barcode for \"%s\"\n\n", - printable ? bc->ascii : ""); - - if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { - if (bc->flags & BARCODE_OUT_PS) { - fprintf(f,"showpage\n"); - fprintf(f, "%%%%Trailer\n\n"); - } - - } - return 0; -} - - - - +/* + * ps.c -- printing the "partial" bar encoding + * + * Copyright (c) 1999 Alessandro Rubini (rubini@gnu.org) + * Copyright (c) 1999 Prosa Srl. (prosa@prosa.it) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include + +#include "barcode.h" + +#define SHRINK_AMOUNT 0.15 /* shrink the bars to account for ink spreading */ + + +/* + * How do the "partial" and "textinfo" strings work? + * + * The first char in "partial" tells how much extra space to add to the + * left of the bars. For EAN-13, it is used to leave space to print the + * first digit, other codes may have '0' for no-extra-space-needed. + * + * The next characters are alternating bars and spaces, as multiples + * of the base dimension which is 1 unless the code is + * rescaled. Rescaling is calculated as the ratio from the requested + * width and the calculated width. Digits represent bar/space + * dimensions. Lower-case letters represent those bars that should + * extend lower than the others: 'a' is equivalent to '1', 'b' is '2' and + * so on. + * + * The "textinfo" string is made up of fields "%lf:%lf:%c" separated by + * blank space. The first integer is the x position of the character, + * the second is the font size (before rescaling) and the char item is + * the charcter to be printed. + * + * Both the "partial" and "textinfo" strings may include "-" or "+" as + * special characters (in "textinfo" the char should be a standalone + * word). They state where the text should be printed: below the bars + * ("-", default) or above the bars. This is used, for example, to + * print the add-5 and add-2 codes to the right of UPC or EAN codes + * (the add-5 extension is mostly used in ISBN codes. + */ + + +int Barcode_ps_print(struct Barcode_Item *bc, FILE *f) +{ + int i, j, k, barlen, printable=1; + double f1, f2, fsav=0; + int mode = '-'; /* text below bars */ + double scalef=1, xpos, x0, y0, yr; + unsigned char *ptr; + unsigned char c; + + if (!bc->partial || !bc->textinfo) { + bc->error = EINVAL; + return -1; + } + + + /* + * Maybe this first part can be made common to several printing back-ends, + * we'll see how that works when other ouput engines are added + */ + + /* First, calculate barlen */ + barlen = bc->partial[0] - '0'; + for (ptr = bc->partial+1; *ptr; ptr++) + if (isdigit(*ptr)) + barlen += (*ptr - '0'); + else if (islower(*ptr)) + barlen += (*ptr - 'a'+1); + + /* The scale factor depends on bar length */ + if (!bc->scalef) { + if (!bc->width) bc->width = barlen; /* default */ + scalef = bc->scalef = (double)bc->width / (double)barlen; + } + + /* The width defaults to "just enough" */ + if (!bc->width) bc->width = barlen * scalef +1; + + /* But it can be too small, in this case enlarge and center the area */ + if (bc->width < barlen * scalef) { + int wid = barlen * scalef + 1; + bc->xoff -= (wid - bc->width)/2 ; + bc->width = wid; + /* Can't extend too far on the left */ + if (bc->xoff < 0) { + bc->width += -bc->xoff; + bc->xoff = 0; + } + } + + /* The height defaults to 80 points (rescaled) */ + if (!bc->height) bc->height = 80 * scalef; + + /* If too small (5 + text), reduce the scale factor and center */ + i = 5 + 10 * ((bc->flags & BARCODE_NO_ASCII)==0); + if (bc->height < i * scalef ) { + double scaleg = ((double)bc->height) / i; + int wid = bc->width * scaleg / scalef; + bc->xoff += (bc->width - wid)/2; + bc->width = wid; + scalef = scaleg; + } + + /* + * Ok, then deal with actual ps (eps) output + */ + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { /* spit a header first */ + if (bc->flags & BARCODE_OUT_EPS) + fprintf(f, "%%!PS-Adobe-2.0 EPSF-1.2\n"); + else + fprintf(f, "%%!PS-Adobe-2.0\n"); + fprintf(f, "%%%%Creator: libbarcode\n"); + if (bc->flags & BARCODE_OUT_EPS) { + fprintf(f, "%%%%BoundingBox: %i %i %i %i\n", + bc->xoff, + bc->yoff, + bc->xoff + bc->width + 2* bc->margin, + bc->yoff + bc->height + 2* bc->margin); + } + fprintf(f, "%%%%EndComments\n"); + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f, "%%%%EndProlog\n\n"); + fprintf(f, "%%%%Page: 1 1\n\n"); + } + } + + /* Print some informative comments */ + for (i=0; bc->ascii[i]; i++) + if (bc->ascii[i] < ' ') + printable = 0; + + fprintf(f,"%% Printing barcode for \"%s\", scaled %5.2f", + printable ? bc->ascii : "", scalef); + if (bc->encoding) + fprintf(f,", encoded using \"%s\"",bc->encoding); + fprintf(f, "\n"); + fprintf(f,"%% The space/bar succession is represented " + "by the following widths (space first):\n" + "%% "); + for (i=0; ipartial); i++) { + unsigned char c = bc->partial[i]; + if (isdigit(c)) putc(c, f); + if (islower(c)) putc(c-'a'+'1', f); + if (isupper(c)) putc(c-'A'+'1', f); + } + /* open array for "forall" */ + fprintf(f, "\n[\n%% height xpos ypos width" + " height xpos ypos width\n"); + + xpos = bc->margin + (bc->partial[0]-'0') * scalef; + for (ptr = bc->partial+1, i=1; *ptr; ptr++, i++) { + /* special cases: '+' and '-' */ + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; /* don't count it */ i++; continue; + } + /* j is the width of this bar/space */ + if (isdigit (*ptr)) j = *ptr-'0'; + else j = *ptr-'a'+1; + if (i%2) { /* bar */ + x0 = bc->xoff + xpos + (j*scalef)/2; + y0 = bc->yoff + bc->margin; + yr = bc->height; + if (!(bc->flags & BARCODE_NO_ASCII)) { /* leave space for text */ + if (mode == '-') { + /* text below bars: 10 points or five points */ + y0 += (isdigit(*ptr) ? 10 : 5) * scalef; + yr -= (isdigit(*ptr) ? 10 : 5) * scalef; + } else { /* '+' */ + /* text above bars: 10 or 0 from bottom, and 10 from top */ + y0 += (isdigit(*ptr) ? 10 : 0) * scalef; + yr -= (isdigit(*ptr) ? 20 : 10) * scalef; + } + } + /* Define an array and then use "forall" (Hans Schou) */ + fprintf(f," [%5.2f %6.2f %6.2f %5.2f]%s", + yr, x0, y0, (j * scalef) - SHRINK_AMOUNT, + i%4 == 1 ? " " : "\n"); + } + xpos += j * scalef; + } + fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} " + "bind forall\n"); + + /* Then, the text */ + + mode = '-'; /* reinstantiate default */ + if (!(bc->flags & BARCODE_NO_ASCII)) { + fprintf(f, "[\n%% char xpos ypos fontsize\n"); + k=0; /* k is the "previous font size" */ + for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) { + while (*ptr == ' ') ptr++; + if (!*ptr) break; + if (*ptr == '+' || *ptr == '-') { + mode = *ptr; continue; + } + if (sscanf(ptr, "%lf:%lf:%c", &f1, &f2, &c) != 3) { + fprintf(stderr, "barcode: impossible data: %s\n", ptr); + continue; + } + + fprintf(f, " [("); + /* Both the backslash and the two parens are special */ + if (c=='\\' || c==')' || c=='(') + fprintf(f, "\\%c) ", c); + else + fprintf(f, "%c) ", c); + fprintf(f, "%6.2f %6.2f %5.2f]\n", + bc->xoff + f1 * scalef + bc->margin, + mode == '-' + ? (double)bc->yoff + bc->margin + : (double)bc->yoff + bc->margin+bc->height - 8*scalef, + fsav == f2 ? 0.0 : f2 * scalef); + fsav = f2; + } + fprintf(f,"] { {} forall dup 0.00 ne {\n\t" + "/Helvetica findfont exch scalefont setfont\n" + " } {pop} ifelse\n" + " moveto show} bind forall\n"); + + + } + + fprintf(f,"%% End barcode for \"%s\"\n\n", + printable ? bc->ascii : ""); + + if (!(bc->flags & BARCODE_OUT_NOHEADERS)) { + if (bc->flags & BARCODE_OUT_PS) { + fprintf(f,"showpage\n"); + fprintf(f, "%%%%Trailer\n\n"); + } + + } + return 0; +} + + + + diff --git a/BarCode/rr/QBarCode.cpp b/BarCode/rr/QBarCode.cpp index 1549daf..4af7800 100644 --- a/BarCode/rr/QBarCode.cpp +++ b/BarCode/rr/QBarCode.cpp @@ -1,178 +1,178 @@ -#include "QBarCode.h" -#include "ui_myBarCode.h" -#include "QImage" -#include "QFile" -#include "QFileInfo" -#include "QDebug" -#include "stdio.h" - -QBarCode::QBarCode(QWidget *parent) : - QDialog(parent), - ui(new Ui::QBarCode) -{ - ui->setupUi(this); - - connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); - - ui->lineEdit->setText("12345678ABCDEFG"); - - //onEnCodeBar(); - -} - -QBarCode::~QBarCode() -{ - delete ui; -} - - -void QBarCode::onEnCodeBar(){ - - QFile f1; - //ui->lineEdit->setText("dfdsfdsfdsfdsf"); - int ps = 1, pcl = 0, oflags; - ps = 0; pcl = 0; - - oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; - -// char *txt = ui->lineEdit->text.toStdString().c_str(); - //sprintf(txt,"%s", (char *)ui->lineEdit->text().data()); - /* and my data as code-128B autodetected */ - QString txt =ui->lineEdit->text(); - Barcode_Encode_and_Print((char *)txt.toStdString().c_str(),stdout, 0, 60, 240, 510, - oflags); - - /* A few code-39 ones */ - // Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320, - // BARCODE_39 | oflags); - -// Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80, -// BARCODE_39 | oflags); - - /* ISBN with add-5 */ -// Barcode_Encode_and_Print("1-56592-292-1 90000",stdout, 0, 0, 40, 430, -// BARCODE_ISBN | oflags); - - -} -/* - * Do it all in one step - */ -int QBarCode::Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags) -{ - struct Barcode_Item * bc; - - if (!(bc=Barcode_Create(text))) { - qDebug()<<"mem less then:";//<< -ENOMEM ; - return -1; - } - - if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 - || Barcode_Encode(bc, flags) < 0 - //|| Barcode_Print(bc, f, flags) < 0 - ) { - qDebug()<< bc->error; - Barcode_Delete(bc); - return -1; - } - //QFile f1; - bcText = text; - bcTextinfo = bc->textinfo; - bcPartial = bc->partial; - ui->textEdit->setText(bcPartial); - - Barcode_ToImage(bc); - - Barcode_Delete(bc); - return 0; -} - -// 将条形码编码转换成点阵图形 -int QBarCode::Barcode_ToImage(Barcode_Item * bc ){ - bc->ascii; - bc->partial; - bc->textinfo; - int len =QString(bc->partial).length(); - bcWidth =6; - for(int i=0;ipartial[i]&0x0f); - // - //bcWidth = len; - bcHeight = 40; - - QImage image(bcWidth,bcHeight,QImage::Format_ARGB32); - //image.dotsPerMeterX() - //image.size().setHeight(50); - image.fill(0x00ffffff); - //QPainter painter(&image); - //ui->textEdit->document()->drawContents (&painter, image.rect()); /*将text写到pic*/ - QString txt = bc->ascii; - - ui->textEdit->setText( QString().sprintf("W:%d,H:%d,Len:%d",ui->BarCodeView->width(),ui->BarCodeView->height(),len)); - - //0b1a2a4123221223211221132221231213212223112312131311222314111b3c1a1b - //11:12:1 22:12:2 33:12:3 44:12:4 55:12:5 66:12:6 77:12:7 88:12:8 - //02112141232212232112211322212312132122231123121313112223141112331112 - - memset(pointMap,0,sizeof(pointMap)); - unsigned char *img= image.bits(); - for(int j=0;j< 20;j++){ - int i=3; - unsigned char p=0; - for(int n=0;( npartial[n]; - if(c<0x30 || c>127) continue; - c = c-0x30; - if(n%2==1){ - for(int r=0;rlabBarCode->setPixmap(QPixmap(QString::fromUtf8(".\\imgd.BMP"))); - - //ui->widgetPrintTextDisplay->dat = pointMap; - - ShowBarCode(fileName); -} - -void QBarCode::ShowBarCode(QString fileName) -{ - /****************界面初始化********************************/ - - this->pictureName =fileName ; - scene = new QGraphicsScene; - scene->setSceneRect( -200,0,bcWidth*4+200,bcHeight); - scene->setItemIndexMethod(QGraphicsScene::NoIndex); - QPixmap pixmap(this->pictureName); - pixmap = pixmap.scaledToWidth(2.5*bcWidth); - item = scene->addPixmap(pixmap); - - /***************设置view的场景*****************************/ - ui->BarCodeView->setScene(scene); - ui->BarCodeView->setRenderHint(QPainter::Antialiasing); - ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); - ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); - //ui->graphicsView->resize(400,300); - - ui->BarCodeView->setScene(scene);//设置view的场景 - -} - +#include "QBarCode.h" +#include "ui_myBarCode.h" +#include "QImage" +#include "QFile" +#include "QFileInfo" +#include "QDebug" +#include "stdio.h" + +QBarCode::QBarCode(QWidget *parent) : + QDialog(parent), + ui(new Ui::QBarCode) +{ + ui->setupUi(this); + + connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); + + ui->lineEdit->setText("12345678ABCDEFG"); + + //onEnCodeBar(); + +} + +QBarCode::~QBarCode() +{ + delete ui; +} + + +void QBarCode::onEnCodeBar(){ + + QFile f1; + //ui->lineEdit->setText("dfdsfdsfdsfdsf"); + int ps = 1, pcl = 0, oflags; + ps = 0; pcl = 0; + + oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + +// char *txt = ui->lineEdit->text.toStdString().c_str(); + //sprintf(txt,"%s", (char *)ui->lineEdit->text().data()); + /* and my data as code-128B autodetected */ + QString txt =ui->lineEdit->text(); + Barcode_Encode_and_Print((char *)txt.toStdString().c_str(),stdout, 0, 60, 240, 510, + oflags); + + /* A few code-39 ones */ + // Barcode_Encode_and_Print("silly code",stdout, 0, 0, 40, 320, + // BARCODE_39 | oflags); + +// Barcode_Encode_and_Print("SAMPLE CODES",stdout, 100, 30, 400, 80, +// BARCODE_39 | oflags); + + /* ISBN with add-5 */ +// Barcode_Encode_and_Print("1-56592-292-1 90000",stdout, 0, 0, 40, 430, +// BARCODE_ISBN | oflags); + + +} +/* + * Do it all in one step + */ +int QBarCode::Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + qDebug()<<"mem less then:";//<< -ENOMEM ; + return -1; + } + + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + //|| Barcode_Print(bc, f, flags) < 0 + ) { + qDebug()<< bc->error; + Barcode_Delete(bc); + return -1; + } + //QFile f1; + bcText = text; + bcTextinfo = bc->textinfo; + bcPartial = bc->partial; + ui->textEdit->setText(bcPartial); + + Barcode_ToImage(bc); + + Barcode_Delete(bc); + return 0; +} + +// 将条形码编码转换成点阵图形 +int QBarCode::Barcode_ToImage(Barcode_Item * bc ){ + bc->ascii; + bc->partial; + bc->textinfo; + int len =QString(bc->partial).length(); + bcWidth =6; + for(int i=0;ipartial[i]&0x0f); + // + //bcWidth = len; + bcHeight = 40; + + QImage image(bcWidth,bcHeight,QImage::Format_ARGB32); + //image.dotsPerMeterX() + //image.size().setHeight(50); + image.fill(0x00ffffff); + //QPainter painter(&image); + //ui->textEdit->document()->drawContents (&painter, image.rect()); /*将text写到pic*/ + QString txt = bc->ascii; + + ui->textEdit->setText( QString().sprintf("W:%d,H:%d,Len:%d",ui->BarCodeView->width(),ui->BarCodeView->height(),len)); + + //0b1a2a4123221223211221132221231213212223112312131311222314111b3c1a1b + //11:12:1 22:12:2 33:12:3 44:12:4 55:12:5 66:12:6 77:12:7 88:12:8 + //02112141232212232112211322212312132122231123121313112223141112331112 + + memset(pointMap,0,sizeof(pointMap)); + unsigned char *img= image.bits(); + for(int j=0;j< 20;j++){ + int i=3; + unsigned char p=0; + for(int n=0;( npartial[n]; + if(c<0x30 || c>127) continue; + c = c-0x30; + if(n%2==1){ + for(int r=0;rlabBarCode->setPixmap(QPixmap(QString::fromUtf8(".\\imgd.BMP"))); + + //ui->widgetPrintTextDisplay->dat = pointMap; + + ShowBarCode(fileName); +} + +void QBarCode::ShowBarCode(QString fileName) +{ + /****************界面初始化********************************/ + + this->pictureName =fileName ; + scene = new QGraphicsScene; + scene->setSceneRect( -200,0,bcWidth*4+200,bcHeight); + scene->setItemIndexMethod(QGraphicsScene::NoIndex); + QPixmap pixmap(this->pictureName); + pixmap = pixmap.scaledToWidth(2.5*bcWidth); + item = scene->addPixmap(pixmap); + + /***************设置view的场景*****************************/ + ui->BarCodeView->setScene(scene); + ui->BarCodeView->setRenderHint(QPainter::Antialiasing); + ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); + ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); + //ui->graphicsView->resize(400,300); + + ui->BarCodeView->setScene(scene);//设置view的场景 + +} + diff --git a/BarCode/rr/QBarCode.h b/BarCode/rr/QBarCode.h index 080b347..583d8b3 100644 --- a/BarCode/rr/QBarCode.h +++ b/BarCode/rr/QBarCode.h @@ -1,44 +1,44 @@ -#ifndef QBARCODE_H -#define QBARCODE_H - -#include -#include "barcode.h" -#include "QGraphicsScene" -#include "QGraphicsPixmapItem" - -namespace Ui { - class QBarCode; -} - -class QBarCode : public QDialog -{ - Q_OBJECT - -public: - explicit QBarCode(QWidget *parent = 0); - ~QBarCode(); - unsigned char pointMap[40*1000]; - QString pictureName;//当前显示的图片 -private slots: - void onEnCodeBar(); - -private: - void ShowBarCode(QString fileName); - int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags); - int Barcode_ToImage(Barcode_Item * bc ); - - QGraphicsScene *scene;//声明scene - QGraphicsPixmapItem *item;//声明item - - QString bcPartial; - QString bcTextinfo; - QString bcText; - int bcWidth,bcHeight; - - -private: - Ui::QBarCode *ui; -}; - -#endif // QBARCODE_H +#ifndef QBARCODE_H +#define QBARCODE_H + +#include +#include "barcode.h" +#include "QGraphicsScene" +#include "QGraphicsPixmapItem" + +namespace Ui { + class QBarCode; +} + +class QBarCode : public QDialog +{ + Q_OBJECT + +public: + explicit QBarCode(QWidget *parent = 0); + ~QBarCode(); + unsigned char pointMap[40*1000]; + QString pictureName;//当前显示的图片 +private slots: + void onEnCodeBar(); + +private: + void ShowBarCode(QString fileName); + int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + int Barcode_ToImage(Barcode_Item * bc ); + + QGraphicsScene *scene;//声明scene + QGraphicsPixmapItem *item;//声明item + + QString bcPartial; + QString bcTextinfo; + QString bcText; + int bcWidth,bcHeight; + + +private: + Ui::QBarCode *ui; +}; + +#endif // QBARCODE_H diff --git a/BarCode/rr/QBarCode.ui b/BarCode/rr/QBarCode.ui index ceeb9bf..6def621 100644 --- a/BarCode/rr/QBarCode.ui +++ b/BarCode/rr/QBarCode.ui @@ -1,147 +1,147 @@ - - - QBarCode - - - - 0 - 0 - 680 - 316 - - - - Form - - - - - - - - - - - 条形码类型 - - - - - - - 字体 - - - - - - - 条形码高度 - - - - - - - 放大等级 - - - - - - - - - - - 120 - 0 - - - - - - - - - - - 1 - - - 10 - - - 1 - - - - - - - 插入文档 - - - - - - - 文本信息 - - - - - - - - - - - 16777215 - 60 - - - - - - - - FileName - - - - - - - 打开文件 - - - - - - - 生成条形码 - - - - - - - 关闭 - - - - - - - - - TextLabel - - - - - - - - + + + QBarCode + + + + 0 + 0 + 680 + 316 + + + + Form + + + + + + + + + + + 条形码类型 + + + + + + + 字体 + + + + + + + 条形码高度 + + + + + + + 放大等级 + + + + + + + + + + + 120 + 0 + + + + + + + + + + + 1 + + + 10 + + + 1 + + + + + + + 插入文档 + + + + + + + 文本信息 + + + + + + + + + + + 16777215 + 60 + + + + + + + + FileName + + + + + + + 打开文件 + + + + + + + 生成条形码 + + + + + + + 关闭 + + + + + + + + + TextLabel + + + + + + + + diff --git a/Binarization/Binarization.cpp b/Binarization/Binarization.cpp index b506c55..0eff500 100644 --- a/Binarization/Binarization.cpp +++ b/Binarization/Binarization.cpp @@ -1,141 +1,141 @@ -#include "Binarization.h" - -CBinarization::CBinarization( QString imgPath ) - : threshold(0) -{ - // ¼ÓÔØͼƬ - _img = new QImage(); - if (NULL != _img) - { - _img->load(imgPath); - } -} - -// Éú³ɻҶÈͼÏñ -QImage* CBinarization::grayScaleImg() -{ - if (NULL == _img) - { - return NULL; - } - int nWidth = _img->width(); - int nHeight = _img->height(); - - // ÕâÀïÁôÒ⣬ÎÒʹÓÃÁËQImage::Format_Grayscale8¸ñʽµÄͼƬ£¬ÕâÖÖͼƬÿ¸öÏñËØֻÓÃÁË8bit´洢»ҶÈÑÕɫֵ - QImage* grayImg = new QImage(nWidth, nHeight, QImage::Format_RGB888); - QRgb rgbVal = 0; - int grayVal = 0; - - for (int x = 0; x < nWidth; ++x) - { - for (int y = 0; y < nHeight; ++y) - { - rgbVal = _img->pixel(x, y); - - grayVal = qGray(rgbVal); // ÕâÀïµ÷ÓÃQtµĺ¯Êý£¬ʹÓÃ(R * 11 + G * 16 + B * 5)/32µķ½·¨¼ÆËã - - grayImg->setPixel(x, y, QColor(grayVal, grayVal, grayVal).rgb()); - } - } - - return grayImg; -} - -int CBinarization::Otsu(QImage* img) -{ - if (NULL == img) - { - return -1; - } - vector histogram = Histogram(img); - int total = 0; - for (int i = 0; i != histogram.size(); ++i) - { - total += histogram[i]; - } - - double sum = 0.0; - for (unsigned int i = 1; i < histogram.size(); ++i) - sum += i * histogram[i]; - double sumB = 0.0; - double wB = 0.0; - double wF = 0.0; - double mB = 0.0; - double mF = 0.0; - double max = 0.0; - double between = 0.0; - double threshold = 0.0; - for (int i = 0; i != 256; ++i) - { - wB += histogram[i]; - if (wB == 0) - continue; - wF = total - wB; - if (wF == 0) - break; - sumB += i * histogram[i]; - mB = sumB / wB; - mF = (sum - sumB) / wF; - between = wB * wF * (mB - mF) * (mB - mF); - if ( between > max ) - { - threshold = i; - max = between; - } - } - return threshold; -} - -QImage* CBinarization::process(QImage* img) -{ - if (NULL == img) - { - return NULL; - } - int width = img->width(); - int height = img->height(); - int bytePerLine = img->bytesPerLine(); // ÿһÐеÄ×ֽÚÊý - unsigned char *data = img->bits(); - unsigned char *binarydata = new unsigned char[bytePerLine * height]; - - unsigned char g = 0; - for (int i = 0; i < height; ++i) - { - for (int j = 0; j < width; ++j) - { - g = *(data + i * bytePerLine + j * 3); // ÕâÀïj ³ËÒÔ 3 - if(int(g) >= threshold) - { - binarydata[ i * bytePerLine + j * 3] = 0xFF; // ÿ¸öɫֵÐèҪ¶Ô3¸ö×ֽڸ³ֵ - binarydata[ i * bytePerLine + j * 3 + 1] = 0xFF; - binarydata[ i * bytePerLine + j * 3 + 2] = 0xFF; - } - else - { - binarydata[ i * bytePerLine + j * 3] = 0x00; - binarydata[ i * bytePerLine + j * 3 + 1] = 0x00; - binarydata[ i * bytePerLine + j * 3 + 2] = 0x00; - } - } - } - - QImage *ret = new QImage(binarydata, width, height, bytePerLine, QImage::Format_RGB888); - return ret; -} - -std::vector CBinarization::Histogram( QImage* img ) -{ - unsigned char* graydata = img->bits(); - vector hist(256); // 256ɫ - for (int i = 0; i != img->width(); ++i) - { - for (int j = 0; j != img->height(); ++j) - { - int index = int(*graydata); - hist[index] += 1; - graydata += 1; // step - } - } - graydata = NULL; - return hist; -} +#include "Binarization.h" + +CBinarization::CBinarization( QString imgPath ) + : threshold(0) +{ + // ¼ÓÔØͼƬ + _img = new QImage(); + if (NULL != _img) + { + _img->load(imgPath); + } +} + +// Éú³ɻҶÈͼÏñ +QImage* CBinarization::grayScaleImg() +{ + if (NULL == _img) + { + return NULL; + } + int nWidth = _img->width(); + int nHeight = _img->height(); + + // ÕâÀïÁôÒ⣬ÎÒʹÓÃÁËQImage::Format_Grayscale8¸ñʽµÄͼƬ£¬ÕâÖÖͼƬÿ¸öÏñËØֻÓÃÁË8bit´洢»ҶÈÑÕɫֵ + QImage* grayImg = new QImage(nWidth, nHeight, QImage::Format_RGB888); + QRgb rgbVal = 0; + int grayVal = 0; + + for (int x = 0; x < nWidth; ++x) + { + for (int y = 0; y < nHeight; ++y) + { + rgbVal = _img->pixel(x, y); + + grayVal = qGray(rgbVal); // ÕâÀïµ÷ÓÃQtµĺ¯Êý£¬ʹÓÃ(R * 11 + G * 16 + B * 5)/32µķ½·¨¼ÆËã + + grayImg->setPixel(x, y, QColor(grayVal, grayVal, grayVal).rgb()); + } + } + + return grayImg; +} + +int CBinarization::Otsu(QImage* img) +{ + if (NULL == img) + { + return -1; + } + vector histogram = Histogram(img); + int total = 0; + for (int i = 0; i != histogram.size(); ++i) + { + total += histogram[i]; + } + + double sum = 0.0; + for (unsigned int i = 1; i < histogram.size(); ++i) + sum += i * histogram[i]; + double sumB = 0.0; + double wB = 0.0; + double wF = 0.0; + double mB = 0.0; + double mF = 0.0; + double max = 0.0; + double between = 0.0; + double threshold = 0.0; + for (int i = 0; i != 256; ++i) + { + wB += histogram[i]; + if (wB == 0) + continue; + wF = total - wB; + if (wF == 0) + break; + sumB += i * histogram[i]; + mB = sumB / wB; + mF = (sum - sumB) / wF; + between = wB * wF * (mB - mF) * (mB - mF); + if ( between > max ) + { + threshold = i; + max = between; + } + } + return threshold; +} + +QImage* CBinarization::process(QImage* img) +{ + if (NULL == img) + { + return NULL; + } + int width = img->width(); + int height = img->height(); + int bytePerLine = img->bytesPerLine(); // ÿһÐеÄ×ֽÚÊý + unsigned char *data = img->bits(); + unsigned char *binarydata = new unsigned char[bytePerLine * height]; + + unsigned char g = 0; + for (int i = 0; i < height; ++i) + { + for (int j = 0; j < width; ++j) + { + g = *(data + i * bytePerLine + j * 3); // ÕâÀïj ³ËÒÔ 3 + if(int(g) >= threshold) + { + binarydata[ i * bytePerLine + j * 3] = 0xFF; // ÿ¸öɫֵÐèҪ¶Ô3¸ö×ֽڸ³ֵ + binarydata[ i * bytePerLine + j * 3 + 1] = 0xFF; + binarydata[ i * bytePerLine + j * 3 + 2] = 0xFF; + } + else + { + binarydata[ i * bytePerLine + j * 3] = 0x00; + binarydata[ i * bytePerLine + j * 3 + 1] = 0x00; + binarydata[ i * bytePerLine + j * 3 + 2] = 0x00; + } + } + } + + QImage *ret = new QImage(binarydata, width, height, bytePerLine, QImage::Format_RGB888); + return ret; +} + +std::vector CBinarization::Histogram( QImage* img ) +{ + unsigned char* graydata = img->bits(); + vector hist(256); // 256ɫ + for (int i = 0; i != img->width(); ++i) + { + for (int j = 0; j != img->height(); ++j) + { + int index = int(*graydata); + hist[index] += 1; + graydata += 1; // step + } + } + graydata = NULL; + return hist; +} diff --git a/Binarization/Binarization.h b/Binarization/Binarization.h index e342802..32a958d 100644 --- a/Binarization/Binarization.h +++ b/Binarization/Binarization.h @@ -1,24 +1,24 @@ -#ifndef CBINARIZATION_H -#define CBINARIZATION_H - -#include -#include - -using namespace std; - -class CBinarization -{ -public: - CBinarization(QString imgPath); - - QImage* grayScaleImg(); - int Otsu(QImage* img); - QImage* process(QImage* img); - int threshold; - -private: - QImage* _img; - - vector Histogram(QImage* img); -}; -#endif +#ifndef CBINARIZATION_H +#define CBINARIZATION_H + +#include +#include + +using namespace std; + +class CBinarization +{ +public: + CBinarization(QString imgPath); + + QImage* grayScaleImg(); + int Otsu(QImage* img); + QImage* process(QImage* img); + int threshold; + +private: + QImage* _img; + + vector Histogram(QImage* img); +}; +#endif diff --git a/CN/mainwindow.ui b/CN/mainwindow.ui index 7d8be97..e5e2b2c 100644 --- a/CN/mainwindow.ui +++ b/CN/mainwindow.ui @@ -1,3813 +1,3813 @@ - - - MainWindow - - - true - - - - 0 - 0 - 640 - 460 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 5 - 5 - - - - Qt::StrongFocus - - - InkJet - - - - - 0 - 0 - 641 - 455 - - - - - 0 - - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 1 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - - - - 0 - 50 - - - - - - 0 - 0 - 686 - 47 - - - - - - - - 0 - 45 - - - - 编辑 - - - - :/icon/edit.png:/icon/edit.png - - - - - - - - 0 - 45 - - - - 打开文件 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 0 - 45 - - - - 二维码 - - - - :/icon/bypm.png:/icon/bypm.png - - - - - - - - 0 - 45 - - - - 条形码 - - - - :/icon/BarCode1.png:/icon/BarCode1.png - - - - - - - - 0 - 45 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - 0 - 45 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - 交替打印文件名 - - - - - - - - - - - - 0 - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - 最大:[40行x 2048列] - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 140 - 25 - - - - - 140 - 25 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - 同步器速度 - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - Qt::Vertical - - - - - - - - 0 - 25 - - - - - 100 - 25 - - - - 当前时间 - - - - - - - - - - - - - 640 - 107 - - - - 0 - - - - - - - - 610 - 95 - - - - - 620 - 96 - - - - BlankCursor - - - 0 - - - false - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi';"></p></body></html> - - - - - - - - - - 5 - 5 - 620 - 100 - - - - - 0 - 0 - - - - - 620 - 100 - - - - - 16777215 - 80 - - - - false - - - - - 0 - 0 - 500 - 53 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 60 - - - - - 60 - 16777215 - - - - - - - :/image/reset.png - - - - - - - - - 0 - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨线开关 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 喷头盖开 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水缸满 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水液位 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 溶剂液位 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 回收故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 粘度故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 相位故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 高压故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 故障恢复 - - - - - - - - - 0 - - - 4 - - - - - 0 - - - 0 - - - 0 - - - - - - 110 - 0 - - - - - 110 - 16777215 - - - - 立即重新计米 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - Qt::Horizontal - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品总计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - Qt::Horizontal - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - - - - - - - - - 110 - 40 - - - - - 110 - 16777215 - - - - Qt::LeftToRight - - - false - - - 关机 - - - - :/icon/poweroff.png:/icon/poweroff.png - - - - - - - - - 7 - - - 5 - - - 0 - - - - - 6 - - - 3 - - - 0 - - - 0 - - - 3 - - - - - 3 - - - - - 3 - - - - - - 300 - 0 - - - - - 300 - 16777215 - - - - - - - true - - - - - - - - 160 - 0 - - - - - 180 - 20 - - - - 2014-08-23 - - - Qt::AlignCenter - - - - - - - - - - - 0 - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 70 - 20 - - - - 晶振电压 - - - - - - - - 35 - 20 - - - - 粘度 - - - - - - - - 35 - 20 - - - - 压力 - - - - - - - - 64 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 70 - 20 - - - - 隔膜位置 - - - - - - - - 70 - 0 - - - - - 64 - 20 - - - - - - - - - - - - - - 0 - 60 - - - - - 80 - 16777215 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 147 - 146 - 146 - - - - - - - - 开 - - - - :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png - - - - - - - - 60 - 0 - - - - - 70 - 60 - - - - - - - - - - - - 0 - 60 - - - - - 80 - 16777215 - - - - 关 - - - - :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png - - - - - - - - - - - - - 3 - - - 0 - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 0 - 170 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 186 - 188 - 185 - - - - - - - 242 - 241 - 240 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/startprint2.png - :/icon/startprint1.png - :/icon/startprint1.png - :/icon/startprint.png:/icon/startprint2.png - - - - 110 - 70 - - - - false - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 199 - 189 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 227 - 97 - 75 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 227 - 97 - 75 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/stopprint2.png - :/icon/stopprint1.png - :/icon/stopprint1.png - :/icon/stopprint.png:/icon/stopprint2.png - - - - 110 - 70 - - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 255 - 170 - 0 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 206 - 203 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/pauseprint2.png - :/icon/pauseprint1.png - :/icon/pauseprint1.png - :/icon/pauseprint.png:/icon/pauseprint2.png - - - - 110 - 70 - - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - 喷嘴逆清洗 - - - - - - - - - - - - - - - - PicWidget - QWidget -
PicWidget.h
- 1 -
- - ClickLabel - QLabel -
ClickLabel.h
-
- - TextEditOption - QWidget -
TextEditOption.h
- 1 -
- - PrintTextDisplay - QWidget -
PrintTextDisplay.h
- 1 -
- - MyTextEdit - QTextEdit -
MyTextEdit.h
-
-
- - - - -
+ + + MainWindow + + + true + + + + 0 + 0 + 640 + 460 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 5 + 5 + + + + Qt::StrongFocus + + + InkJet + + + + + 0 + 0 + 641 + 455 + + + + + 0 + + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 1 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + + + + 0 + 50 + + + + + + 0 + 0 + 686 + 47 + + + + + + + + 0 + 45 + + + + 编辑 + + + + :/icon/edit.png:/icon/edit.png + + + + + + + + 0 + 45 + + + + 打开文件 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 0 + 45 + + + + 二维码 + + + + :/icon/bypm.png:/icon/bypm.png + + + + + + + + 0 + 45 + + + + 条形码 + + + + :/icon/BarCode1.png:/icon/BarCode1.png + + + + + + + + 0 + 45 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + 0 + 45 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + 交替打印文件名 + + + + + + + + + + + + 0 + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + 最大:[40行x 2048列] + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 140 + 25 + + + + + 140 + 25 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + 同步器速度 + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + Qt::Vertical + + + + + + + + 0 + 25 + + + + + 100 + 25 + + + + 当前时间 + + + + + + + + + + + + + 640 + 107 + + + + 0 + + + + + + + + 610 + 95 + + + + + 620 + 96 + + + + BlankCursor + + + 0 + + + false + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi';"></p></body></html> + + + + + + + + + + 5 + 5 + 620 + 100 + + + + + 0 + 0 + + + + + 620 + 100 + + + + + 16777215 + 80 + + + + false + + + + + 0 + 0 + 500 + 53 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 60 + + + + + 60 + 16777215 + + + + + + + :/image/reset.png + + + + + + + + + 0 + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨线开关 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 喷头盖开 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水缸满 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水液位 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 溶剂液位 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 回收故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 粘度故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 相位故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 高压故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 故障恢复 + + + + + + + + + 0 + + + 4 + + + + + 0 + + + 0 + + + 0 + + + + + + 110 + 0 + + + + + 110 + 16777215 + + + + 立即重新计米 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + Qt::Horizontal + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品总计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + Qt::Horizontal + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + + + + + + + + + 110 + 40 + + + + + 110 + 16777215 + + + + Qt::LeftToRight + + + false + + + 关机 + + + + :/icon/poweroff.png:/icon/poweroff.png + + + + + + + + + 7 + + + 5 + + + 0 + + + + + 6 + + + 3 + + + 0 + + + 0 + + + 3 + + + + + 3 + + + + + 3 + + + + + + 300 + 0 + + + + + 300 + 16777215 + + + + + + + true + + + + + + + + 160 + 0 + + + + + 180 + 20 + + + + 2014-08-23 + + + Qt::AlignCenter + + + + + + + + + + + 0 + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 70 + 20 + + + + 晶振电压 + + + + + + + + 35 + 20 + + + + 粘度 + + + + + + + + 35 + 20 + + + + 压力 + + + + + + + + 64 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 70 + 20 + + + + 隔膜位置 + + + + + + + + 70 + 0 + + + + + 64 + 20 + + + + + + + + + + + + + + 0 + 60 + + + + + 80 + 16777215 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 147 + 146 + 146 + + + + + + + + 开 + + + + :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png + + + + + + + + 60 + 0 + + + + + 70 + 60 + + + + + + + + + + + + 0 + 60 + + + + + 80 + 16777215 + + + + 关 + + + + :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png + + + + + + + + + + + + + 3 + + + 0 + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 0 + 170 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 186 + 188 + 185 + + + + + + + 242 + 241 + 240 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/startprint2.png + :/icon/startprint1.png + :/icon/startprint1.png + :/icon/startprint.png:/icon/startprint2.png + + + + 110 + 70 + + + + false + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 199 + 189 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 227 + 97 + 75 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 227 + 97 + 75 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/stopprint2.png + :/icon/stopprint1.png + :/icon/stopprint1.png + :/icon/stopprint.png:/icon/stopprint2.png + + + + 110 + 70 + + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 255 + 170 + 0 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 206 + 203 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/pauseprint2.png + :/icon/pauseprint1.png + :/icon/pauseprint1.png + :/icon/pauseprint.png:/icon/pauseprint2.png + + + + 110 + 70 + + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + 喷嘴逆清洗 + + + + + + + + + + + + + + + + PicWidget + QWidget +
PicWidget.h
+ 1 +
+ + ClickLabel + QLabel +
ClickLabel.h
+
+ + TextEditOption + QWidget +
TextEditOption.h
+ 1 +
+ + PrintTextDisplay + QWidget +
PrintTextDisplay.h
+ 1 +
+ + MyTextEdit + QTextEdit +
MyTextEdit.h
+
+
+ + + + +
diff --git a/ClickLabel.cpp b/ClickLabel.cpp index a95580f..dca9a99 100644 --- a/ClickLabel.cpp +++ b/ClickLabel.cpp @@ -1,6 +1,6 @@ -#include -#include -void ClickLabel::mousePressEvent(QMouseEvent *evt) -{ - emit pressed(); -} +#include +#include +void ClickLabel::mousePressEvent(QMouseEvent *evt) +{ + emit pressed(); +} diff --git a/ClickLabel.h b/ClickLabel.h index 80d46f4..8fc8d39 100644 --- a/ClickLabel.h +++ b/ClickLabel.h @@ -1,20 +1,20 @@ -#ifndef __CLICKLABEL__ -#define __CLICKLABEL__ - -#include - -class ClickLabel:public QLabel{ - Q_OBJECT - - signals: - void pressed(void); - public: - ClickLabel(QWidget *parent=0): QLabel(parent){ - } - - protected: - void mousePressEvent( QMouseEvent* ); - -}; - -#endif +#ifndef __CLICKLABEL__ +#define __CLICKLABEL__ + +#include + +class ClickLabel:public QLabel{ + Q_OBJECT + + signals: + void pressed(void); + public: + ClickLabel(QWidget *parent=0): QLabel(parent){ + } + + protected: + void mousePressEvent( QMouseEvent* ); + +}; + +#endif diff --git a/DacDisplayAndEdit.cpp b/DacDisplayAndEdit.cpp index b52b015..6d4d35a 100644 --- a/DacDisplayAndEdit.cpp +++ b/DacDisplayAndEdit.cpp @@ -1,96 +1,96 @@ - -#include "DacDisplayAndEdit.h" -#include "ui_dacdisplayandedit.h" -#include "QLatin1Char" -#include "qdebug.h" -#include "qmessagebox.h" - -DacDisplayAndEdit::DacDisplayAndEdit(QWidget *parent) : - QWidget(parent), - ui(new Ui::DacDisplayAndEdit) -{ - ui->setupUi(this); - for(int i = 0; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ - memLineEdit[i] = new QLineEdit(this); - memLineEdit[i]->setAccessibleName(QString::number(i)); - memLineEdit[i]->setEnabled(false); - ui->gridLayoutMem->addWidget(memLineEdit[i],(i/DAC_GRID_MAX_COL) + 1,(i%DAC_GRID_MAX_COL) + 1); - connect(memLineEdit[i],SIGNAL(editingFinished ()),this,SLOT(onLineEditEditingFinished())); - } - for(int i = 0; i < DAC_GRID_MAX_ROW; i++){ - rowLabel[i] = new QLabel(this); - ui->gridLayoutMem->addWidget(rowLabel[i],i + 1,0); - } - editFlag = false; - writeMemBaseAddr = 0; - readMemBaseAddr = 0; - setEnabled(1); -} - -DacDisplayAndEdit::~DacDisplayAndEdit() -{ - delete ui; -} -// updateSysStatusToUI -void DacDisplayAndEdit::updateSysStatusToUI(void){ - // -} -void DacDisplayAndEdit::updateAuthorization(int auth) -{ - //qDebug ()<setText(QString(" ")); - for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ - if(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]>25)sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=25; - if(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]<5) sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=5; - memLineEdit[i]->setText(QString("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10/*,QLatin1Char('0')*/)); - } - } -} - -void DacDisplayAndEdit::on_pushButtonEdit_pressed() -{//ddd - if(sysPara){ - editFlag = !editFlag; - for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ - memLineEdit[i]->setEnabled(editFlag); - if(editFlag) memLineEdit[i]->setText(QString("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10,QLatin1Char('0'))); - - } - ui->pushButtonEdit->setText(editFlag?tr("完成"):tr("编辑")); - } -} -void DacDisplayAndEdit::on_pushButtonDefault_pressed()// pushButtonDefault pushButtonDefault -{ - if(sysPara){ - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("是否将点距微调参数设置为默认值?")); - QPushButton *saveButton = msgBox.addButton(tr("是"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("否"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - msgBox.exec(); - if (msgBox.clickedButton() == saveButton) { - for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ - sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=15; - memLineEdit[i]->setText(tr("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10,QLatin1Char('0'))); - } - } - } - else qDebug()<<"sysPara not bind!"; -} - -void DacDisplayAndEdit::onLineEditEditingFinished(){ - int val,addr=0; - bool ok; - QLineEdit * edit = qobject_cast(sender()); - QString name = edit->accessibleName(); - val = edit->text().toInt(&ok,10); - if(sysPara){ - addr = name.toInt(&ok); - if(val>25)val=25; - if(val<5) val =5; - sysPara->para.adjVolDacRate[(addr)&MAX_RD_DAC_SIZE_MASK] = (unsigned char)val; - } -} + +#include "DacDisplayAndEdit.h" +#include "ui_dacdisplayandedit.h" +#include "QLatin1Char" +#include "qdebug.h" +#include "qmessagebox.h" + +DacDisplayAndEdit::DacDisplayAndEdit(QWidget *parent) : + QWidget(parent), + ui(new Ui::DacDisplayAndEdit) +{ + ui->setupUi(this); + for(int i = 0; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ + memLineEdit[i] = new QLineEdit(this); + memLineEdit[i]->setAccessibleName(QString::number(i)); + memLineEdit[i]->setEnabled(false); + ui->gridLayoutMem->addWidget(memLineEdit[i],(i/DAC_GRID_MAX_COL) + 1,(i%DAC_GRID_MAX_COL) + 1); + connect(memLineEdit[i],SIGNAL(editingFinished ()),this,SLOT(onLineEditEditingFinished())); + } + for(int i = 0; i < DAC_GRID_MAX_ROW; i++){ + rowLabel[i] = new QLabel(this); + ui->gridLayoutMem->addWidget(rowLabel[i],i + 1,0); + } + editFlag = false; + writeMemBaseAddr = 0; + readMemBaseAddr = 0; + setEnabled(1); +} + +DacDisplayAndEdit::~DacDisplayAndEdit() +{ + delete ui; +} +// updateSysStatusToUI +void DacDisplayAndEdit::updateSysStatusToUI(void){ + // +} +void DacDisplayAndEdit::updateAuthorization(int auth) +{ + //qDebug ()<setText(QString(" ")); + for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ + if(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]>25)sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=25; + if(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]<5) sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=5; + memLineEdit[i]->setText(QString("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10/*,QLatin1Char('0')*/)); + } + } +} + +void DacDisplayAndEdit::on_pushButtonEdit_pressed() +{//ddd + if(sysPara){ + editFlag = !editFlag; + for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ + memLineEdit[i]->setEnabled(editFlag); + if(editFlag) memLineEdit[i]->setText(QString("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10,QLatin1Char('0'))); + + } + ui->pushButtonEdit->setText(editFlag?tr("完成"):tr("编辑")); + } +} +void DacDisplayAndEdit::on_pushButtonDefault_pressed()// pushButtonDefault pushButtonDefault +{ + if(sysPara){ + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("是否将点距微调参数设置为默认值?")); + QPushButton *saveButton = msgBox.addButton(tr("是"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("否"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + msgBox.exec(); + if (msgBox.clickedButton() == saveButton) { + for(int i = 1; i < DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL; i++){ + sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK]=15; + memLineEdit[i]->setText(tr("%1").arg(sysPara->para.adjVolDacRate[i&MAX_RD_DAC_SIZE_MASK],2,10,QLatin1Char('0'))); + } + } + } + else qDebug()<<"sysPara not bind!"; +} + +void DacDisplayAndEdit::onLineEditEditingFinished(){ + int val,addr=0; + bool ok; + QLineEdit * edit = qobject_cast(sender()); + QString name = edit->accessibleName(); + val = edit->text().toInt(&ok,10); + if(sysPara){ + addr = name.toInt(&ok); + if(val>25)val=25; + if(val<5) val =5; + sysPara->para.adjVolDacRate[(addr)&MAX_RD_DAC_SIZE_MASK] = (unsigned char)val; + } +} diff --git a/DacDisplayAndEdit.h b/DacDisplayAndEdit.h index 8c30d84..d6bb835 100644 --- a/DacDisplayAndEdit.h +++ b/DacDisplayAndEdit.h @@ -1,45 +1,45 @@ -#ifndef DACDISPLAYANDEDIT_H -#define DACDISPLAYANDEDIT_H - -#include -#include -#include -#include -#define DAC_GRID_MAX_ROW 4 -#define DAC_GRID_MAX_COL 10 -#define MAX_RD_DAC_SIZE_MASK 0x3f -#define MAX_WR_DAC_SIZE_MASK 0x3f -namespace Ui { -class DacDisplayAndEdit; -} - -class DacDisplayAndEdit : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit DacDisplayAndEdit(QWidget *parent = 0); - ~DacDisplayAndEdit(); - - void updateSysStatusToUI(void); - void updateSysParaToUI(void); - void updateAuthorization(int auth); - -private slots: - void on_pushButtonEdit_pressed(); - void on_pushButtonDefault_pressed(); - void onLineEditEditingFinished(); - - -private: - Ui::DacDisplayAndEdit *ui; - QLineEdit *memLineEdit[DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL]; - QLabel *rowLabel[DAC_GRID_MAX_ROW]; - bool editFlag; //是否当前处于编辑模式 - int writeMemBaseAddr; - int readMemBaseAddr; -}; - -#endif -// DacDisplayANDEDIT_H - +#ifndef DACDISPLAYANDEDIT_H +#define DACDISPLAYANDEDIT_H + +#include +#include +#include +#include +#define DAC_GRID_MAX_ROW 4 +#define DAC_GRID_MAX_COL 10 +#define MAX_RD_DAC_SIZE_MASK 0x3f +#define MAX_WR_DAC_SIZE_MASK 0x3f +namespace Ui { +class DacDisplayAndEdit; +} + +class DacDisplayAndEdit : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit DacDisplayAndEdit(QWidget *parent = 0); + ~DacDisplayAndEdit(); + + void updateSysStatusToUI(void); + void updateSysParaToUI(void); + void updateAuthorization(int auth); + +private slots: + void on_pushButtonEdit_pressed(); + void on_pushButtonDefault_pressed(); + void onLineEditEditingFinished(); + + +private: + Ui::DacDisplayAndEdit *ui; + QLineEdit *memLineEdit[DAC_GRID_MAX_ROW*DAC_GRID_MAX_COL]; + QLabel *rowLabel[DAC_GRID_MAX_ROW]; + bool editFlag; //是否当前处于编辑模式 + int writeMemBaseAddr; + int readMemBaseAddr; +}; + +#endif +// DacDisplayANDEDIT_H + diff --git a/Dbredis/dbredis.cpp b/Dbredis/dbredis.cpp index 3b6ce8d..494d54e 100644 --- a/Dbredis/dbredis.cpp +++ b/Dbredis/dbredis.cpp @@ -1,158 +1,158 @@ -#include "dbredis.h" -#include - -QSqlDatabase DBRedis::m_DataBase; -QString DBRedis::m_ConnectName = "dbredis"; -bool DBRedis::m_HasInit = false; - - -DBRedis::DBRedis() -{ - -} - -DBRedis::~DBRedis() -{ - if (m_DataBase.isOpen()) - { - m_DataBase.close(); - } -} - -int DBRedis::deleteExpiredEntries() -{ - int res = init(); - if (res) - { - return res; - } - - qint64 currentTimestamp = QDateTime::currentDateTime().toSecsSinceEpoch(); - QSqlQuery query(m_DataBase); - query.prepare("DELETE FROM data_store WHERE expiry > 0 AND expiry < :currentTimestamp"); - query.bindValue(":currentTimestamp", currentTimestamp); - - if (!query.exec()) - { - qDebug() << "Error deleting expired entries:" << query.lastError().text(); - return 1; - } - return 0; -} - - - -int DBRedis::setData(const QString & key, const QString & value, uint32_t expiry) -{ - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("SELECT COUNT(*) FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error checking existing key"; - return 1; - } - int count = 0; - while (query.next()) - { - count += query.value(0).toInt(); - } - if (count > 0) - { - query.prepare("UPDATE data_store SET value = :value, expiry = :expiry WHERE key = :key"); - query.bindValue(":value", value); - query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); - query.bindValue(":key", key); - } - else - { - query.prepare("INSERT INTO data_store (key, value, expiry) VALUES (:key, :value, :expiry)"); - query.bindValue(":key", key); - query.bindValue(":value", value); - query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); - } - if (!query.exec()) - { - qDebug() << "Error setting value:" << query.lastError().text(); - return 1; - } - return 0; -} - -int DBRedis::getData(const QString & key, QString & value) -{ - value.clear(); - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("SELECT value FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error getting value:" << query.lastError().text(); - return 1; - } - if (!query.next()) - { - qDebug() << "Error getting value:" << query.lastError().text(); - return 2; - } - value = query.value(0).toString(); - return 0; -} - -int DBRedis::deleteData(const QString & key) -{ - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("DELETE FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error deleting value:" << query.lastError().text(); - return 1; - } - return 0; -} - -int DBRedis::init() -{ - if (m_HasInit) - { - return 0; - } - m_DataBase = QSqlDatabase::addDatabase("QSQLITE", m_ConnectName); - m_DataBase.setDatabaseName("dbredis.db"); - if (m_DataBase.open()) - { - QString table = "CREATE TABLE IF NOT EXISTS data_store(key TEXT, value TEXT, expiry INTEGER)"; - QSqlQuery query(QSqlDatabase::database(m_ConnectName)); - if (!query.exec(table.toUtf8())) - { - qDebug() << "Error deleting value:" << query.lastError().text(); - return 1; - } - } - else - { - qDebug() << "Error db open fail"; - return 3; - } - m_HasInit = true; - return 0; -} +#include "dbredis.h" +#include + +QSqlDatabase DBRedis::m_DataBase; +QString DBRedis::m_ConnectName = "dbredis"; +bool DBRedis::m_HasInit = false; + + +DBRedis::DBRedis() +{ + +} + +DBRedis::~DBRedis() +{ + if (m_DataBase.isOpen()) + { + m_DataBase.close(); + } +} + +int DBRedis::deleteExpiredEntries() +{ + int res = init(); + if (res) + { + return res; + } + + qint64 currentTimestamp = QDateTime::currentDateTime().toSecsSinceEpoch(); + QSqlQuery query(m_DataBase); + query.prepare("DELETE FROM data_store WHERE expiry > 0 AND expiry < :currentTimestamp"); + query.bindValue(":currentTimestamp", currentTimestamp); + + if (!query.exec()) + { + qDebug() << "Error deleting expired entries:" << query.lastError().text(); + return 1; + } + return 0; +} + + + +int DBRedis::setData(const QString & key, const QString & value, uint32_t expiry) +{ + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("SELECT COUNT(*) FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error checking existing key"; + return 1; + } + int count = 0; + while (query.next()) + { + count += query.value(0).toInt(); + } + if (count > 0) + { + query.prepare("UPDATE data_store SET value = :value, expiry = :expiry WHERE key = :key"); + query.bindValue(":value", value); + query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); + query.bindValue(":key", key); + } + else + { + query.prepare("INSERT INTO data_store (key, value, expiry) VALUES (:key, :value, :expiry)"); + query.bindValue(":key", key); + query.bindValue(":value", value); + query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); + } + if (!query.exec()) + { + qDebug() << "Error setting value:" << query.lastError().text(); + return 1; + } + return 0; +} + +int DBRedis::getData(const QString & key, QString & value) +{ + value.clear(); + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("SELECT value FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error getting value:" << query.lastError().text(); + return 1; + } + if (!query.next()) + { + qDebug() << "Error getting value:" << query.lastError().text(); + return 2; + } + value = query.value(0).toString(); + return 0; +} + +int DBRedis::deleteData(const QString & key) +{ + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("DELETE FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error deleting value:" << query.lastError().text(); + return 1; + } + return 0; +} + +int DBRedis::init() +{ + if (m_HasInit) + { + return 0; + } + m_DataBase = QSqlDatabase::addDatabase("QSQLITE", m_ConnectName); + m_DataBase.setDatabaseName("dbredis.db"); + if (m_DataBase.open()) + { + QString table = "CREATE TABLE IF NOT EXISTS data_store(key TEXT, value TEXT, expiry INTEGER)"; + QSqlQuery query(QSqlDatabase::database(m_ConnectName)); + if (!query.exec(table.toUtf8())) + { + qDebug() << "Error deleting value:" << query.lastError().text(); + return 1; + } + } + else + { + qDebug() << "Error db open fail"; + return 3; + } + m_HasInit = true; + return 0; +} diff --git a/Dbredis/dbredis.h b/Dbredis/dbredis.h index f56ad43..adf79d8 100644 --- a/Dbredis/dbredis.h +++ b/Dbredis/dbredis.h @@ -1,80 +1,80 @@ -#ifndef __DBREDIS_H -#define __DBREDIS_H - -#include - - -class DBRedis -{ -public: - DBRedis(); - ~DBRedis(); - /*** - * @描述 : 设定值 - * @入参 : key 键 - value 值 - expiry 单位为秒 默认为 0 - 0 为永不过期 - 其他值必须大于0 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int setData(const QString&key, const QString&value, uint32_t expiry = 0); - - - - /*** - * @描述 : 获取值 - * @入参 : key 键 - * @输出 : value 值 - * @返回 : 0 成功 - 1 数据库错误 - 2 不存在该数据或已过期 - 3 数据库错误 - */ - static int getData(const QString&key, QString&value); - - - /*** - * @描述 : 删除值 - * @入参 : key 键 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int deleteData(const QString&key); -private: - static QSqlDatabase m_DataBase; - static QString m_ConnectName; - static bool m_HasInit; -private: - /*** - * @描述 : 初始化 - * @入参 : 无 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int init(); - - - /*** - * @描述 : 删除过期的条目 - * @入参 : 无 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int deleteExpiredEntries(); -}; - - - -#endif // !__DBREDIS_H - - +#ifndef __DBREDIS_H +#define __DBREDIS_H + +#include + + +class DBRedis +{ +public: + DBRedis(); + ~DBRedis(); + /*** + * @描述 : 设定值 + * @入参 : key 键 + value 值 + expiry 单位为秒 默认为 0 + 0 为永不过期 + 其他值必须大于0 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int setData(const QString&key, const QString&value, uint32_t expiry = 0); + + + + /*** + * @描述 : 获取值 + * @入参 : key 键 + * @输出 : value 值 + * @返回 : 0 成功 + 1 数据库错误 + 2 不存在该数据或已过期 + 3 数据库错误 + */ + static int getData(const QString&key, QString&value); + + + /*** + * @描述 : 删除值 + * @入参 : key 键 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int deleteData(const QString&key); +private: + static QSqlDatabase m_DataBase; + static QString m_ConnectName; + static bool m_HasInit; +private: + /*** + * @描述 : 初始化 + * @入参 : 无 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int init(); + + + /*** + * @描述 : 删除过期的条目 + * @入参 : 无 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int deleteExpiredEntries(); +}; + + + +#endif // !__DBREDIS_H + + diff --git a/DialogAuthorization.cpp b/DialogAuthorization.cpp index 4a80065..aa1e560 100644 --- a/DialogAuthorization.cpp +++ b/DialogAuthorization.cpp @@ -1,28 +1,28 @@ -#include "DialogAuthorization.h" -#include "ui_dialogauthorization.h" - -DialogAuthorization::DialogAuthorization(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogAuthorization) -{ - ui->setupUi(this); - this->setWindowTitle(tr("输入密码")); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - ui->lineEditAuth->setEchoMode(QLineEdit::Password); // 密码不回显 - -} - -DialogAuthorization::~DialogAuthorization() -{ - delete ui; -} - - -QString DialogAuthorization::getAuth(){ - return ui->lineEditAuth->text(); -} - -void DialogAuthorization::clearAuth(){ - ui->lineEditAuth->setText(tr("")); - -} +#include "DialogAuthorization.h" +#include "ui_dialogauthorization.h" + +DialogAuthorization::DialogAuthorization(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogAuthorization) +{ + ui->setupUi(this); + this->setWindowTitle(tr("输入密码")); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + ui->lineEditAuth->setEchoMode(QLineEdit::Password); // 密码不回显 + +} + +DialogAuthorization::~DialogAuthorization() +{ + delete ui; +} + + +QString DialogAuthorization::getAuth(){ + return ui->lineEditAuth->text(); +} + +void DialogAuthorization::clearAuth(){ + ui->lineEditAuth->setText(tr("")); + +} diff --git a/DialogAuthorization.h b/DialogAuthorization.h index 8185651..81c61b1 100644 --- a/DialogAuthorization.h +++ b/DialogAuthorization.h @@ -1,25 +1,25 @@ -#ifndef DIALOGAUTHORIZATION_H -#define DIALOGAUTHORIZATION_H - -#include - -namespace Ui { -class DialogAuthorization; -} - -class DialogAuthorization : public QDialog -{ - Q_OBJECT - -public: - explicit DialogAuthorization(QWidget *parent = 0); - ~DialogAuthorization(); - - QString getAuth(); - void clearAuth(); -private: - Ui::DialogAuthorization *ui; - //QTimer time1; -}; - -#endif // DIALOGAUTHORIZATION_H +#ifndef DIALOGAUTHORIZATION_H +#define DIALOGAUTHORIZATION_H + +#include + +namespace Ui { +class DialogAuthorization; +} + +class DialogAuthorization : public QDialog +{ + Q_OBJECT + +public: + explicit DialogAuthorization(QWidget *parent = 0); + ~DialogAuthorization(); + + QString getAuth(); + void clearAuth(); +private: + Ui::DialogAuthorization *ui; + //QTimer time1; +}; + +#endif // DIALOGAUTHORIZATION_H diff --git a/DialogAuthorizationPrint.cpp b/DialogAuthorizationPrint.cpp index 73f79c3..fa48f65 100644 --- a/DialogAuthorizationPrint.cpp +++ b/DialogAuthorizationPrint.cpp @@ -1,28 +1,28 @@ -#include "DialogAuthorizationPrint.h" -#include "ui_dialogAuthorizationPrint.h" - -DialogAuthorizationPrint::DialogAuthorizationPrint(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogAuthorizationPrint) -{ - ui->setupUi(this); - this->setWindowTitle(tr("请输入打印密码")); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - ui->lineEditAuth->setEchoMode(QLineEdit::Password); // 密码不回显 - -} - -DialogAuthorizationPrint::~DialogAuthorizationPrint() -{ - delete ui; -} - - -QString DialogAuthorizationPrint::getAuth(){ - return ui->lineEditAuth->text(); -} - -void DialogAuthorizationPrint::clearAuth(){ - ui->lineEditAuth->setText(tr("")); - -} +#include "DialogAuthorizationPrint.h" +#include "ui_dialogAuthorizationPrint.h" + +DialogAuthorizationPrint::DialogAuthorizationPrint(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogAuthorizationPrint) +{ + ui->setupUi(this); + this->setWindowTitle(tr("请输入打印密码")); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + ui->lineEditAuth->setEchoMode(QLineEdit::Password); // 密码不回显 + +} + +DialogAuthorizationPrint::~DialogAuthorizationPrint() +{ + delete ui; +} + + +QString DialogAuthorizationPrint::getAuth(){ + return ui->lineEditAuth->text(); +} + +void DialogAuthorizationPrint::clearAuth(){ + ui->lineEditAuth->setText(tr("")); + +} diff --git a/DialogAuthorizationPrint.h b/DialogAuthorizationPrint.h index 3205746..36a2880 100644 --- a/DialogAuthorizationPrint.h +++ b/DialogAuthorizationPrint.h @@ -1,25 +1,25 @@ -#ifndef DIALOGAUTHORIZATIONPRINT_H -#define DIALOGAUTHORIZATIONPRINT_H - -#include - -namespace Ui { -class DialogAuthorizationPrint; -} - -class DialogAuthorizationPrint : public QDialog -{ - Q_OBJECT - -public: - explicit DialogAuthorizationPrint(QWidget *parent = 0); - ~DialogAuthorizationPrint(); - - QString getAuth(); - void clearAuth(); -private: - Ui::DialogAuthorizationPrint *ui; - //QTimer time1; -}; - -#endif // DIALOGAUTHORIZATIONPRINT_H +#ifndef DIALOGAUTHORIZATIONPRINT_H +#define DIALOGAUTHORIZATIONPRINT_H + +#include + +namespace Ui { +class DialogAuthorizationPrint; +} + +class DialogAuthorizationPrint : public QDialog +{ + Q_OBJECT + +public: + explicit DialogAuthorizationPrint(QWidget *parent = 0); + ~DialogAuthorizationPrint(); + + QString getAuth(); + void clearAuth(); +private: + Ui::DialogAuthorizationPrint *ui; + //QTimer time1; +}; + +#endif // DIALOGAUTHORIZATIONPRINT_H diff --git a/DialogFileOperation.cpp b/DialogFileOperation.cpp index e21fac4..27e2d0e 100644 --- a/DialogFileOperation.cpp +++ b/DialogFileOperation.cpp @@ -1,427 +1,427 @@ -#include "DialogFileOperation.h" -#include "ui_dialogfileoperation.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include"HtmlDelegate.h" -#include"myinclude.h" -#include -#include -#include "LogInfo.h" - -// 递归复制目录/文件。true 表示全部成功,false 表示有失败 -static bool copyRecursively(const QString &srcPath, const QString &dstPath) -{ - QFileInfo srcInfo(srcPath); - if (!srcInfo.exists()) return false; - if (srcInfo.isDir()) { - QDir dstDir(dstPath); - if (!dstDir.exists()) { - if (!QDir().mkpath(dstPath)) return false; - } - QDir srcDir(srcPath); - QFileInfoList entries = srcDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries); - for (const QFileInfo &fi : entries) { - QString src = fi.absoluteFilePath(); - QString dst = QDir(dstPath).filePath(fi.fileName()); - if (!copyRecursively(src, dst)) return false; - } - return true; - } else { - // 文件 - if (QFile::exists(dstPath)) { - QFile::remove(dstPath); - } - return QFile::copy(srcPath, dstPath); - } -} - -// 只复制 srcDirPath 根目录下的文件(不递归到子目录)。true 表示全部成功,false 表示有失败或源目录不存在 -static bool copyFilesOneLevel(const QString &srcDirPath, const QString &dstDirPath) -{ - QDir srcDir(srcDirPath); - if (!srcDir.exists()) return false; - QDir dstDir(dstDirPath); - if (!dstDir.exists()) { - if (!QDir().mkpath(dstDirPath)) return false; - } - QFileInfoList files = srcDir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); - bool allOk = true; - for (const QFileInfo &fi : files) { - QString src = fi.absoluteFilePath(); - QString dst = dstDir.filePath(fi.fileName()); - if (QFile::exists(dst)) QFile::remove(dst); - if (!QFile::copy(src, dst)) { - LogInfo::setRunStatusText(QString("Copy file failed: %1 -> %2").arg(src).arg(dst)); - allOk = false; - } - } - return allOk; -} - -DialogFileOperation::DialogFileOperation(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogFileOperation) -{ - ui->setupUi(this); - this->setWindowTitle(tr("文件操作")); - ui->textEditView->setReadOnly(true); - ui->textEditView->setLineWrapMode(QTextEdit::NoWrap); - ui->textEditView->document()->setDocumentMargin(0); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - EditMode=4; -} - -void DialogFileOperation::refreshListView(int mode){ - - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; - QDir dir(dirPath); - QStringList filters; - EditMode = mode; - if(mode==TXTFILE) filters << "*.html" << "*.txt" << "*.TXT" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"<< "*.bin"; // txtmode -// else if(mode==PICFILE) filters << "*.png";// <<"*.jpg" ; // picmode - else if(mode==PICFILE) filters << "*.png" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"; - else if(mode==SCENE) filters << "*.xml"; - else filters << "*.html" << "*.bmp" << "*.BMP"<<"*.jpg"<<"*.gif"; - dir.setNameFilters(filters); - dir.setFilter(QDir::Files); -#ifndef EnableArabic - QStringListModel *model = new QStringListModel(dir.entryList()); -#else - QStringList entries=dir.entryList(); - QStandardItemModel *model = new QStandardItemModel(); - for(int i=0;i%1%2").arg(subname).arg(subsuffix2); - QStandardItem *item2 = new QStandardItem(stringhtml); - model->appendRow(item2); - } - }else{ - model->appendRow(item1); - } - } - } - ui->listViewFile->setItemDelegate(new HtmlDelegate); -#endif - - ui->listViewFile->setEditTriggers(QAbstractItemView::NoEditTriggers); - ui->listViewFile->setModel(model); //useList是个QListView - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index(0 , 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } -} - - -DialogFileOperation::~DialogFileOperation() -{ - delete ui; -} - -void DialogFileOperation::on_listViewFile_entered(const QModelIndex &index) -{ -#ifdef EnableArabic - QString fileName=index.data().toString(); - if(fileName.endsWith("")){ - QTextDocument doc; - doc.setHtml(fileName); - fileName= doc.toPlainText(); - int position = fileName.lastIndexOf("."); - fileName.insert(position,".a"); - } -#endif - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; -#ifndef EnableArabic - QString filePath = dirPath + index.data().toString(); -#else - QString filePath = dirPath + fileName; -#endif - if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") || - filePath.endsWith(".png") || filePath.endsWith(".bmp")|| filePath.endsWith(".BMP")|| filePath.endsWith(".nda")){ - ui->textEditView->clear(); - ui->textEditView->setHtml(QString("").arg(filePath)); - } - else if(filePath.endsWith(".xml")) - { - emit createSceneImage(filePath); - ui->textEditView->setHtml(QString("").arg("./printSceneView.png")); - } - else { - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) - return ; - if (filePath.endsWith(".txt") || filePath.endsWith(".TXT")) - { - qint64 size = file.size(); - if(size/1024 > 10) - { - return; - } - } - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - if (Qt::mightBeRichText(str)) { - if(!ui->radioButtonLocal->isChecked()) - str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //必须替换相应的路径 - ui->textEditView->setHtml(str); - } else { - str = QString::fromLocal8Bit(data); - ui->textEditView->setPlainText(str); - } - } -} -void DialogFileOperation::on_listViewFile_clicked(const QModelIndex &index) -{ - on_listViewFile_entered(index); -} - -void DialogFileOperation::on_pushButtonNext_pressed() -{ - QModelIndex currIndex = ui->listViewFile->currentIndex(); - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index((currIndex.row() + 1)%count, 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } -} - - -void DialogFileOperation::on_pushButtonLast_pressed() -{ - QModelIndex currIndex = ui->listViewFile->currentIndex(); - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index(currIndex.row() == 0?(count - 1):(currIndex.row() - 1), 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } -} - -void DialogFileOperation::on_pushButtonExit_pressed() -{ - hide(); -} - -void DialogFileOperation::on_pushButtonDelFile_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("警告"), - tr("是否确认删除当前文件?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QModelIndex index = ui->listViewFile->currentIndex(); - int currRow = index.row(); - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; -#ifndef EnableArabic - QString filePath = dirPath + index.data().toString(); -#else - QString fileName=index.data().toString(); - if(fileName.endsWith("")){ - QTextDocument doc; - doc.setHtml(fileName); - fileName= doc.toPlainText(); - int position = fileName.lastIndexOf("."); - fileName.insert(position,".a"); - } - QString filePath=dirPath+fileName; -#endif - QFile file(filePath); - if(!QFileInfo(filePath).baseName().startsWith("UP")){ - if(file.exists())file.remove(); - file.setFileName(PARA_ROOT_DIR + QFileInfo(filePath).baseName()+".dpn" ); - //file.setFileName( PARA_ROOT_DIR + QFileInfo(filePath).baseName()+".dpn" ); - if(file.exists())file.remove(); - } - - //Public::resetPara(); // 20140923 这个BUG导致系统参数被恢复 - refreshListView(EditMode); - int count = ui->listViewFile->model()->rowCount(); - if(count){ - index = ui->listViewFile->model()->index((currRow > (count - 1))?(count - 1):currRow , 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } - } - -} - -void DialogFileOperation::on_pushButtonDelAll_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("警告"), - tr("是否确认删除所有文件?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; - // 删除所有文件的方法要改进 - - system((char *)((QString("mkdir %1").arg(TESTDIR)).toLatin1().data())); - system((char *)((QString("cp %1/UP* %2/. ").arg(DOC_ROOT_DIR).arg(TESTDIR)).toLatin1().data())); //先备份UP* - - system((char *)((QString("rm %1/*.*").arg(dirPath)).toLatin1().data()));// 删除所有打印文件 - - system((char *)((QString("rm %1*.ini").arg(PARA_ROOT_DIR)).toLatin1().data())); // 删除所有参数文件 - system((char *)((QString("rm %1*.dpn").arg(PARA_ROOT_DIR)).toLatin1().data())); - - system((char *)((QString("cp %1/UP.* %1/UP1.* %2/. ").arg(TESTDIR).arg(DOC_ROOT_DIR)).toLatin1().data())); - //system((char *)((QString("cp %1* %2/. ").arg(TESTDIR).arg(PARA_ROOT_DIR)).toLatin1().data())); - refreshListView(EditMode); - } -} - -void DialogFileOperation::on_pushButtonImport_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("提示"), - tr("是否确认从U盘导入所有文件?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - bool ok = true; - // 拷贝参数文件 - QString srcHi = QDir(UDISK_DOC_ROOT_DIR).filePath("VoltParaHi.bin"); - QString dstHi = QDir(PARA_ROOT_DIR).filePath("VoltParaHi.bin"); - if (QFile::exists(srcHi)) { - if (QFile::exists(dstHi)) QFile::remove(dstHi); - if (!QFile::copy(srcHi, dstHi)) { - LogInfo::setRunStatusText("Copy VoltParaHi.bin failed"); - ok = false; - } - } - QString srcStd = QDir(UDISK_DOC_ROOT_DIR).filePath("VoltParaStd.bin"); - QString dstStd = QDir(PARA_ROOT_DIR).filePath("VoltParaStd.bin"); - if (QFile::exists(srcStd)) { - if (QFile::exists(dstStd)) QFile::remove(dstStd); - if (!QFile::copy(srcStd, dstStd)) { - LogInfo::setRunStatusText("Copy VoltParaStd.bin failed"); - ok = false; - } - } - - // 复制 U 盘文档到本地(仅复制一级文件,不递归) - bool cpOk = copyFilesOneLevel(UDISK_DOC_ROOT_DIR, DOC_ROOT_DIR); - qDebug() << "copyRecursively import result:" << cpOk; - QProcess::execute("sync"); - refreshListView(EditMode); - if (ok && cpOk) { - QMessageBox::information(this, tr("提示"), tr("成功从U盘导入")); - } else { - QMessageBox::warning(this, tr("警告"), tr("从U盘导入时部分文件失败")); - } - } -} - -void DialogFileOperation::on_pushButtonExport_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("提示"), - tr("是否确认将所有文件导出到U盘?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; - QDir dir(UDISK_DOC_ROOT_DIR); - if(!dir.exists()){ - if (!QDir().mkpath(UDISK_DOC_ROOT_DIR)){ - QMessageBox::warning(this,tr("警告"),tr("U盘doc目录创建失败")); - return; - } - } - - // 仅复制本地文档根目录下的文件到 U 盘(不递归) - bool ok = copyFilesOneLevel(DOC_ROOT_DIR, UDISK_DOC_ROOT_DIR); - QProcess::execute("sync"); - - refreshListView(EditMode); - if (ok) { - QMessageBox::information(this, tr("提示"), tr("成功导出到U盘")); - } else { - QMessageBox::warning(this, tr("警告"), tr("导出到U盘时有文件失败")); - } - } -} - -void DialogFileOperation::on_pushButtonInsert_clicked() -{ - QModelIndex index = ui->listViewFile->currentIndex(); - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; -#ifndef EnableArabic - QString filePath = dirPath + index.data().toString(); -#else - QString fileName=index.data().toString(); - if(fileName.endsWith("")){ - QTextDocument doc; - doc.setHtml(fileName); - fileName= doc.toPlainText(); - int position = fileName.lastIndexOf("."); - fileName.insert(position,".a"); - } - QString filePath = dirPath + fileName; -#endif - emit openFile(filePath,true); - hide(); -} - -void DialogFileOperation::on_pushButtonOpen_clicked() -{ - QModelIndex index = ui->listViewFile->currentIndex(); - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; -#ifndef EnableArabic - QString filePath = dirPath + index.data().toString(); -#else - QString fileName=index.data().toString(); - if(fileName.endsWith("")){ - QTextDocument doc; - doc.setHtml(fileName); - fileName= doc.toPlainText(); - int position = fileName.lastIndexOf("."); - fileName.insert(position,".a"); - } - QString filePath = dirPath + fileName; -#endif - emit openFile(filePath,false); - hide(); -} - -void DialogFileOperation::on_radioButtonLocal_released() -{ - refreshListView(EditMode); -} - -void DialogFileOperation::on_radioButtonUdisk_released() -{ - - QDir dir(UDISK_DOC_ROOT_DIR); - if(!dir.exists()){ - dir.mkdir("/udisk/doc"); - QMessageBox::warning(0,tr("警告"),tr("U盘未插入或U盘根目录下的doc文件夹不存在!")); - } - refreshListView(EditMode); -} - -void DialogFileOperation::modbus_openfile(QString filename) -{ - emit openFile(filename,true); -} +#include "DialogFileOperation.h" +#include "ui_dialogfileoperation.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include"HtmlDelegate.h" +#include"myinclude.h" +#include +#include +#include "LogInfo.h" + +// 递归复制目录/文件。true 表示全部成功,false 表示有失败 +static bool copyRecursively(const QString &srcPath, const QString &dstPath) +{ + QFileInfo srcInfo(srcPath); + if (!srcInfo.exists()) return false; + if (srcInfo.isDir()) { + QDir dstDir(dstPath); + if (!dstDir.exists()) { + if (!QDir().mkpath(dstPath)) return false; + } + QDir srcDir(srcPath); + QFileInfoList entries = srcDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries); + for (const QFileInfo &fi : entries) { + QString src = fi.absoluteFilePath(); + QString dst = QDir(dstPath).filePath(fi.fileName()); + if (!copyRecursively(src, dst)) return false; + } + return true; + } else { + // 文件 + if (QFile::exists(dstPath)) { + QFile::remove(dstPath); + } + return QFile::copy(srcPath, dstPath); + } +} + +// 只复制 srcDirPath 根目录下的文件(不递归到子目录)。true 表示全部成功,false 表示有失败或源目录不存在 +static bool copyFilesOneLevel(const QString &srcDirPath, const QString &dstDirPath) +{ + QDir srcDir(srcDirPath); + if (!srcDir.exists()) return false; + QDir dstDir(dstDirPath); + if (!dstDir.exists()) { + if (!QDir().mkpath(dstDirPath)) return false; + } + QFileInfoList files = srcDir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot); + bool allOk = true; + for (const QFileInfo &fi : files) { + QString src = fi.absoluteFilePath(); + QString dst = dstDir.filePath(fi.fileName()); + if (QFile::exists(dst)) QFile::remove(dst); + if (!QFile::copy(src, dst)) { + LogInfo::setRunStatusText(QString("Copy file failed: %1 -> %2").arg(src).arg(dst)); + allOk = false; + } + } + return allOk; +} + +DialogFileOperation::DialogFileOperation(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogFileOperation) +{ + ui->setupUi(this); + this->setWindowTitle(tr("文件操作")); + ui->textEditView->setReadOnly(true); + ui->textEditView->setLineWrapMode(QTextEdit::NoWrap); + ui->textEditView->document()->setDocumentMargin(0); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + EditMode=4; +} + +void DialogFileOperation::refreshListView(int mode){ + + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; + QDir dir(dirPath); + QStringList filters; + EditMode = mode; + if(mode==TXTFILE) filters << "*.html" << "*.txt" << "*.TXT" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"<< "*.bin"; // txtmode +// else if(mode==PICFILE) filters << "*.png";// <<"*.jpg" ; // picmode + else if(mode==PICFILE) filters << "*.png" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"; + else if(mode==SCENE) filters << "*.xml"; + else filters << "*.html" << "*.bmp" << "*.BMP"<<"*.jpg"<<"*.gif"; + dir.setNameFilters(filters); + dir.setFilter(QDir::Files); +#ifndef EnableArabic + QStringListModel *model = new QStringListModel(dir.entryList()); +#else + QStringList entries=dir.entryList(); + QStandardItemModel *model = new QStandardItemModel(); + for(int i=0;i%1%2").arg(subname).arg(subsuffix2); + QStandardItem *item2 = new QStandardItem(stringhtml); + model->appendRow(item2); + } + }else{ + model->appendRow(item1); + } + } + } + ui->listViewFile->setItemDelegate(new HtmlDelegate); +#endif + + ui->listViewFile->setEditTriggers(QAbstractItemView::NoEditTriggers); + ui->listViewFile->setModel(model); //useList是个QListView + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index(0 , 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } +} + + +DialogFileOperation::~DialogFileOperation() +{ + delete ui; +} + +void DialogFileOperation::on_listViewFile_entered(const QModelIndex &index) +{ +#ifdef EnableArabic + QString fileName=index.data().toString(); + if(fileName.endsWith("")){ + QTextDocument doc; + doc.setHtml(fileName); + fileName= doc.toPlainText(); + int position = fileName.lastIndexOf("."); + fileName.insert(position,".a"); + } +#endif + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; +#ifndef EnableArabic + QString filePath = dirPath + index.data().toString(); +#else + QString filePath = dirPath + fileName; +#endif + if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") || + filePath.endsWith(".png") || filePath.endsWith(".bmp")|| filePath.endsWith(".BMP")|| filePath.endsWith(".nda")){ + ui->textEditView->clear(); + ui->textEditView->setHtml(QString("").arg(filePath)); + } + else if(filePath.endsWith(".xml")) + { + emit createSceneImage(filePath); + ui->textEditView->setHtml(QString("").arg("./printSceneView.png")); + } + else { + QFile file(filePath); + if (!file.open(QFile::ReadOnly)) + return ; + if (filePath.endsWith(".txt") || filePath.endsWith(".TXT")) + { + qint64 size = file.size(); + if(size/1024 > 10) + { + return; + } + } + QByteArray data = file.readAll(); + QTextCodec *codec = Qt::codecForHtml(data); + QString str = codec->toUnicode(data); + if (Qt::mightBeRichText(str)) { + if(!ui->radioButtonLocal->isChecked()) + str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //必须替换相应的路径 + ui->textEditView->setHtml(str); + } else { + str = QString::fromLocal8Bit(data); + ui->textEditView->setPlainText(str); + } + } +} +void DialogFileOperation::on_listViewFile_clicked(const QModelIndex &index) +{ + on_listViewFile_entered(index); +} + +void DialogFileOperation::on_pushButtonNext_pressed() +{ + QModelIndex currIndex = ui->listViewFile->currentIndex(); + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index((currIndex.row() + 1)%count, 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } +} + + +void DialogFileOperation::on_pushButtonLast_pressed() +{ + QModelIndex currIndex = ui->listViewFile->currentIndex(); + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index(currIndex.row() == 0?(count - 1):(currIndex.row() - 1), 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } +} + +void DialogFileOperation::on_pushButtonExit_pressed() +{ + hide(); +} + +void DialogFileOperation::on_pushButtonDelFile_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("警告"), + tr("是否确认删除当前文件?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QModelIndex index = ui->listViewFile->currentIndex(); + int currRow = index.row(); + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; +#ifndef EnableArabic + QString filePath = dirPath + index.data().toString(); +#else + QString fileName=index.data().toString(); + if(fileName.endsWith("")){ + QTextDocument doc; + doc.setHtml(fileName); + fileName= doc.toPlainText(); + int position = fileName.lastIndexOf("."); + fileName.insert(position,".a"); + } + QString filePath=dirPath+fileName; +#endif + QFile file(filePath); + if(!QFileInfo(filePath).baseName().startsWith("UP")){ + if(file.exists())file.remove(); + file.setFileName(PARA_ROOT_DIR + QFileInfo(filePath).baseName()+".dpn" ); + //file.setFileName( PARA_ROOT_DIR + QFileInfo(filePath).baseName()+".dpn" ); + if(file.exists())file.remove(); + } + + //Public::resetPara(); // 20140923 这个BUG导致系统参数被恢复 + refreshListView(EditMode); + int count = ui->listViewFile->model()->rowCount(); + if(count){ + index = ui->listViewFile->model()->index((currRow > (count - 1))?(count - 1):currRow , 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } + } + +} + +void DialogFileOperation::on_pushButtonDelAll_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("警告"), + tr("是否确认删除所有文件?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; + // 删除所有文件的方法要改进 + + system((char *)((QString("mkdir %1").arg(TESTDIR)).toLatin1().data())); + system((char *)((QString("cp %1/UP* %2/. ").arg(DOC_ROOT_DIR).arg(TESTDIR)).toLatin1().data())); //先备份UP* + + system((char *)((QString("rm %1/*.*").arg(dirPath)).toLatin1().data()));// 删除所有打印文件 + + system((char *)((QString("rm %1*.ini").arg(PARA_ROOT_DIR)).toLatin1().data())); // 删除所有参数文件 + system((char *)((QString("rm %1*.dpn").arg(PARA_ROOT_DIR)).toLatin1().data())); + + system((char *)((QString("cp %1/UP.* %1/UP1.* %2/. ").arg(TESTDIR).arg(DOC_ROOT_DIR)).toLatin1().data())); + //system((char *)((QString("cp %1* %2/. ").arg(TESTDIR).arg(PARA_ROOT_DIR)).toLatin1().data())); + refreshListView(EditMode); + } +} + +void DialogFileOperation::on_pushButtonImport_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("提示"), + tr("是否确认从U盘导入所有文件?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + bool ok = true; + // 拷贝参数文件 + QString srcHi = QDir(UDISK_DOC_ROOT_DIR).filePath("VoltParaHi.bin"); + QString dstHi = QDir(PARA_ROOT_DIR).filePath("VoltParaHi.bin"); + if (QFile::exists(srcHi)) { + if (QFile::exists(dstHi)) QFile::remove(dstHi); + if (!QFile::copy(srcHi, dstHi)) { + LogInfo::setRunStatusText("Copy VoltParaHi.bin failed"); + ok = false; + } + } + QString srcStd = QDir(UDISK_DOC_ROOT_DIR).filePath("VoltParaStd.bin"); + QString dstStd = QDir(PARA_ROOT_DIR).filePath("VoltParaStd.bin"); + if (QFile::exists(srcStd)) { + if (QFile::exists(dstStd)) QFile::remove(dstStd); + if (!QFile::copy(srcStd, dstStd)) { + LogInfo::setRunStatusText("Copy VoltParaStd.bin failed"); + ok = false; + } + } + + // 复制 U 盘文档到本地(仅复制一级文件,不递归) + bool cpOk = copyFilesOneLevel(UDISK_DOC_ROOT_DIR, DOC_ROOT_DIR); + qDebug() << "copyRecursively import result:" << cpOk; + QProcess::execute("sync"); + refreshListView(EditMode); + if (ok && cpOk) { + QMessageBox::information(this, tr("提示"), tr("成功从U盘导入")); + } else { + QMessageBox::warning(this, tr("警告"), tr("从U盘导入时部分文件失败")); + } + } +} + +void DialogFileOperation::on_pushButtonExport_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("提示"), + tr("是否确认将所有文件导出到U盘?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; + QDir dir(UDISK_DOC_ROOT_DIR); + if(!dir.exists()){ + if (!QDir().mkpath(UDISK_DOC_ROOT_DIR)){ + QMessageBox::warning(this,tr("警告"),tr("U盘doc目录创建失败")); + return; + } + } + + // 仅复制本地文档根目录下的文件到 U 盘(不递归) + bool ok = copyFilesOneLevel(DOC_ROOT_DIR, UDISK_DOC_ROOT_DIR); + QProcess::execute("sync"); + + refreshListView(EditMode); + if (ok) { + QMessageBox::information(this, tr("提示"), tr("成功导出到U盘")); + } else { + QMessageBox::warning(this, tr("警告"), tr("导出到U盘时有文件失败")); + } + } +} + +void DialogFileOperation::on_pushButtonInsert_clicked() +{ + QModelIndex index = ui->listViewFile->currentIndex(); + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; +#ifndef EnableArabic + QString filePath = dirPath + index.data().toString(); +#else + QString fileName=index.data().toString(); + if(fileName.endsWith("")){ + QTextDocument doc; + doc.setHtml(fileName); + fileName= doc.toPlainText(); + int position = fileName.lastIndexOf("."); + fileName.insert(position,".a"); + } + QString filePath = dirPath + fileName; +#endif + emit openFile(filePath,true); + hide(); +} + +void DialogFileOperation::on_pushButtonOpen_clicked() +{ + QModelIndex index = ui->listViewFile->currentIndex(); + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; +#ifndef EnableArabic + QString filePath = dirPath + index.data().toString(); +#else + QString fileName=index.data().toString(); + if(fileName.endsWith("")){ + QTextDocument doc; + doc.setHtml(fileName); + fileName= doc.toPlainText(); + int position = fileName.lastIndexOf("."); + fileName.insert(position,".a"); + } + QString filePath = dirPath + fileName; +#endif + emit openFile(filePath,false); + hide(); +} + +void DialogFileOperation::on_radioButtonLocal_released() +{ + refreshListView(EditMode); +} + +void DialogFileOperation::on_radioButtonUdisk_released() +{ + + QDir dir(UDISK_DOC_ROOT_DIR); + if(!dir.exists()){ + dir.mkdir("/udisk/doc"); + QMessageBox::warning(0,tr("警告"),tr("U盘未插入或U盘根目录下的doc文件夹不存在!")); + } + refreshListView(EditMode); +} + +void DialogFileOperation::modbus_openfile(QString filename) +{ + emit openFile(filename,true); +} diff --git a/DialogFileOperation.h b/DialogFileOperation.h index 1ab92ce..9c6f1e1 100644 --- a/DialogFileOperation.h +++ b/DialogFileOperation.h @@ -1,68 +1,68 @@ -#ifndef DIALOGFILEOPERATION_H -#define DIALOGFILEOPERATION_H - -#include -#include "DialogFileOperation.h" -#include -namespace Ui { -class DialogFileOperation; -} - -class DialogFileOperation : public QDialog -{ - Q_OBJECT - -public: - explicit DialogFileOperation(QWidget *parent = 0); - ~DialogFileOperation(); - void refreshListView(int mode); - void modbus_openfile(QString filename); - int EditMode; -private slots: - - - void on_pushButtonNext_pressed(); - - void on_pushButtonLast_pressed(); - - void on_pushButtonExit_pressed(); - - void on_pushButtonDelFile_pressed(); - - void on_pushButtonDelAll_pressed(); - - void on_pushButtonImport_pressed(); - - void on_pushButtonExport_pressed(); - - void on_pushButtonInsert_clicked(); - - void on_pushButtonOpen_clicked(); - - void on_radioButtonLocal_released(); - - void on_radioButtonUdisk_released(); - - - - void on_listViewFile_entered(const QModelIndex &index); - - void on_listViewFile_clicked(const QModelIndex &index); - -Q_SIGNALS: - void openFile(QString filePath,bool insertFlag); - void createSceneImage(QString filePath); - -private: - Ui::DialogFileOperation *ui; -}; - -#endif // DIALOGFILEOPERATION_H - - - - - - - - +#ifndef DIALOGFILEOPERATION_H +#define DIALOGFILEOPERATION_H + +#include +#include "DialogFileOperation.h" +#include +namespace Ui { +class DialogFileOperation; +} + +class DialogFileOperation : public QDialog +{ + Q_OBJECT + +public: + explicit DialogFileOperation(QWidget *parent = 0); + ~DialogFileOperation(); + void refreshListView(int mode); + void modbus_openfile(QString filename); + int EditMode; +private slots: + + + void on_pushButtonNext_pressed(); + + void on_pushButtonLast_pressed(); + + void on_pushButtonExit_pressed(); + + void on_pushButtonDelFile_pressed(); + + void on_pushButtonDelAll_pressed(); + + void on_pushButtonImport_pressed(); + + void on_pushButtonExport_pressed(); + + void on_pushButtonInsert_clicked(); + + void on_pushButtonOpen_clicked(); + + void on_radioButtonLocal_released(); + + void on_radioButtonUdisk_released(); + + + + void on_listViewFile_entered(const QModelIndex &index); + + void on_listViewFile_clicked(const QModelIndex &index); + +Q_SIGNALS: + void openFile(QString filePath,bool insertFlag); + void createSceneImage(QString filePath); + +private: + Ui::DialogFileOperation *ui; +}; + +#endif // DIALOGFILEOPERATION_H + + + + + + + + diff --git a/DialogFontSize.cpp b/DialogFontSize.cpp index 6053e60..3f9def5 100644 --- a/DialogFontSize.cpp +++ b/DialogFontSize.cpp @@ -1,477 +1,477 @@ -#include "DialogFontSize.h" -#include "ui_dialogfontsize.h" -#include -#include -#include -#include -#include -#include -#include -#include "myinclude.h" -#include "Public.h" - -DialogFontSize::DialogFontSize(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogFontSize) -{ - ui->setupUi(this); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - this->setWindowTitle(tr("选择字体大小")); - - font.setFamily("WenQuanYi12"); - QString langurageType = Public::ReadLanguageName(); - if(langurageType != "English" && langurageType != "Chinese") - font.setFamily("Yanglabeldot12"); - font.setPixelSize(12); - ui->lineEdit->setFont(font); - - connect(ui->radioButton7Bangla,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - connect(ui->radioButton7PointNum,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - - connect(ui->radioButton5Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); - connect(ui->radioButton7Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - - connect(ui->radioButton9Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); - connect(ui->radioButton12Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - - connect(ui->radioButton16Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); - connect(ui->radioButton24Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - connect(ui->radioButton21PointNum,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - connect(ui->radioButton32Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); - -#ifdef VNLGXX - ui->checkBoxBold->hide(); - ui->radioButton5Point->hide(); - ui->radioButton7Point->hide(); - ui->radioButton9Point->hide(); - ui->radioButton12Point->hide(); - ui->radioButton16Point->hide(); - ui->radioButton24Point->hide(); -#else -// ui->checkBoxBold->hide(); -// ui->labelFont->hide(); -// ui->fontComboBox->hide(); -// ui->comboBoxFontSize->hide(); -#endif - GetFileInfo(); - flagOfLeft = false; - flagOfRight = false; - -#ifdef EnableBangla - ui->radioButton7Bangla->setEnabled(1); -#else - ui->radioButton7Bangla->setEnabled(0); -#endif - //ui->checkBox_Left->setStyleSheet("QCheckBox { font-size: 24pt; }"); - -} - -DialogFontSize::~DialogFontSize() -{ - delete ui; -} - -void DialogFontSize::Button7HoriL(bool ok){ - int pixsize; - getValue(&pixsize); - - - //qDebug()<lineEdit->font().family()<lineEdit->font().pixelSize(); - qDebug() << "click L"; - -} - -void DialogFontSize::Button7HoriR(bool ok){ - int pixsize; - getValue(&pixsize); - - //qDebug()<lineEdit->font().family()<lineEdit->font().pixelSize(); - - qDebug() << "click R"; -} - -void DialogFontSize::ChangeFont(QString fontFamily){ - - font.setFamily(fontFamily); - - //font.setPixelSize(pixelSize); - ui->lineEdit->setFont(font); // 设置预览字体 - -// if(fontFamily=="wenquanyi" ){ -// ui->comboBoxFontSize->clear(); -// ui->comboBoxFontSize->addItem("12"); -// ui->comboBoxFontSize->addItem("16"); -// //ui->comboBoxFontSize->addItem("12"); - - -// } -// else if(fontFamily=="biyang"){ -// ui->comboBoxFontSize->clear(); -// ui->comboBoxFontSize->addItem("5"); -// ui->comboBoxFontSize->addItem("7"); -// ui->comboBoxFontSize->addItem("9"); -// //ui->comboBoxFontSize->addItem("10"); - -// } -// else { -// ui->comboBoxFontSize->clear(); -// ui->comboBoxFontSize->addItem("14"); -// ui->comboBoxFontSize->addItem("16"); -// ui->comboBoxFontSize->addItem("18"); -// ui->comboBoxFontSize->addItem("20"); -// ui->comboBoxFontSize->addItem("24"); -// ui->comboBoxFontSize->addItem("28"); -// ui->comboBoxFontSize->addItem("32"); -// ui->comboBoxFontSize->addItem("36"); -// } - -} - -void DialogFontSize::GetFileInfo(){ - QString fileName; - QString fileDate=""; - QString fontPath="/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"; - QDir FontsFile("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"); - if(FontsFile.exists("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"))//2451 - { - fontPath = "/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"; - } - if(FontsFile.exists("/usr/lib/fonts/"))//am335x - { - fontPath = "/usr/lib/fonts/"; - } - fileName.sprintf("_%d_50.qpf2",font.pixelSize()); - QFileInfo fileInfo; - - if(font.family()=="SerifL") - fileName = fontPath +"serifl_7_50.qpf2"; - else if(font.family()=="SerifR") - fileName = fontPath +"serifr_7_50.qpf2"; - else if(font.family()=="SerifL9") - fileName = fontPath +"serifl_9_50.qpf2"; - else if(font.family()=="SerifR9") - fileName = fontPath +"serifr_9_50.qpf2"; - else fileName = fontPath +font.family()+fileName; - fileInfo.setFile(fileName); - QDateTime dt= fileInfo.created(); - //fileInfo.lastModified(); - QString s = dt.toString("yyyy-MM-dd hh:mm:ss"); - //qDebug()<<"GetFileInfo"<labFontInfo->setText(fileInfo.fileName()+" "+s+""); - ui->labFontInfo->setText( QString("%1").arg(chsum)); -} -/* -void DialogFontSize::getValue(int *size){ - int pixelSize = 12; - bool ok; - font.setFamily("wenquanyi"); -#ifdef VNLGXX - - int n = ui->comboBoxFontSize->currentText().toInt(&ok,10); - if(ok) pixelSize = n; - -#else - if(ui->radioButton5Point->isChecked()){ - pixelSize = 5; - font.setFamily("biyang"); - } - else if(ui->radioButton7Point->isChecked()){ - pixelSize = 7; - font.setFamily("biyang"); - } - else if(ui->radioButton9Point->isChecked()){ - pixelSize = 9; - font.setFamily("biyang"); - } - else if(ui->radioButton12Point->isChecked()){ - pixelSize = 12; - - } - else if(ui->radioButton16Point->isChecked()){ - pixelSize = 16; - } - else if(ui->radioButton24Point->isChecked()){ - pixelSize = 24; - } - else if(ui->radioButton7HoriL->isChecked()){ - pixelSize = 5; - font.setFamily("SerifL"); - - } - else if(ui->radioButton7HoriR->isChecked()){ - pixelSize = 5; - font.setFamily("SerifR"); - } - else if(ui->radioButton9HoriL->isChecked()){ - pixelSize = 7; - font.setFamily("SerifL9"); - - } - else if(ui->radioButton9HoriR->isChecked()){ - pixelSize = 7; - font.setFamily("SerifR9"); - } - else if(ui->radioButton7Bangla->isChecked()){ - pixelSize = 7; - font.setFamily("bangla"); - } - else if(ui->radioButton7PointNum->isChecked()){ - pixelSize = 7; - font.setFamily("biyangF"); - } - else if(ui->radioButton21PointNum->isChecked()){ - pixelSize = 24; - font.setFamily("biyangF"); - } - else if(ui->radioButton12NewRoman->isChecked()){ - pixelSize = 12; - font.setFamily("Roman"); - } - else if(ui->radioButton32Point->isChecked()){ - pixelSize = 32; - } - -// radioButton7Hori -// else if(ui->radioButton28Point->isChecked()){ -// pixelSize = 28; -// } -// else if(ui->radioButton32Point->isChecked()){ -// pixelSize = 32; -// } - -#endif - - font.setPixelSize(pixelSize); - ui->lineEdit->setFont(font); // 设置预览字体 - - *size = pixelSize; - - -} -*/ - -void DialogFontSize::getValue(int *size){ - int pixelSize = 12; - bool ok; - font.setFamily("WenQuanYi12"); - - if(ui->radioButton5Point->isChecked()){ - pixelSize = 5; - if(flagOfLeft){ - font.setFamily("WenQuanYiL5"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR5"); - }else{ - font.setFamily("WenQuanYi5"); - } - } - else if(ui->radioButton7Point->isChecked()){ - pixelSize = 7; - if(flagOfLeft){ - font.setFamily("WenQuanYiL7"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR7"); - }else{ - font.setFamily("WenQuanYi7"); - } - } - else if(ui->radioButton9Point->isChecked()){ - pixelSize = 9; - if(flagOfLeft){ - font.setFamily("DinkieL9"); - } - else if(flagOfRight){ - font.setFamily("DinkieR9"); - }else{ - font.setFamily("Dinkie9"); - } - } - else if(ui->radioButton12Point->isChecked()){ - pixelSize = 12; - if(flagOfLeft){ - font.setFamily("WenQuanYiL12"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR12"); - } - else{ - font.setFamily("WenQuanYi12"); - } - } - else if(ui->radioButton16Point->isChecked()){ - pixelSize = 16; - if(flagOfLeft){ - font.setFamily("WenQuanYiL16"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR16"); - } - else{ - font.setFamily("WenQuanYi16"); - } - } - else if(ui->radioButton24Point->isChecked()){ - pixelSize = 24; - if(flagOfLeft){ - font.setFamily("WenQuanYiL24"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR24"); - } - else{ - font.setFamily("WenQuanYi24"); - } - } - - else if(ui->radioButton7Bangla->isChecked()){ - pixelSize = 7; - font.setFamily("bangla"); - } - else if(ui->radioButton7PointNum->isChecked()){ - pixelSize = 7; - font.setFamily("biyangF"); - } - else if(ui->radioButton21PointNum->isChecked()){ - pixelSize = 24; - font.setFamily("biyangF"); - } - else if(ui->radioButton12NewRoman->isChecked()){ - pixelSize = 12; - font.setFamily("Roman"); - } - else if(ui->radioButton32Point->isChecked()){ - pixelSize = 32; - font.setFamily("WenQuanYi32"); - - if(flagOfLeft){ - font.setFamily("WenQuanYiL32"); - } - else if(flagOfRight){ - font.setFamily("WenQuanYiR32"); - } - else{ - font.setFamily("WenQuanYi32"); - } - } - - font.setPixelSize(pixelSize); - ui->lineEdit->setFont(font); // 设置预览字体 - *size = pixelSize; -} - -void DialogFontSize::setValue(int value){ - -#ifdef VNLGXX - //QString s; - //s.sprintf("%d",value); - //ui->comboBoxFontSize->setEditText(s); - //if(value<12) ui->fontComboBox->setCurrentIndex(0); - -#else - if(value == 5 && font.family()=="biyang"){ - ui->radioButton5Point->setChecked(true); - } -// else if(value == 5 && font.family()=="SerifL"){ -// ui->radioButton7HoriL->setChecked(true); -// } -// else if(value == 5 && font.family()=="SerifR" ){ -// ui->radioButton7HoriR->setChecked(true); - -// } -// else if(value == 7 && font.family()=="SerifL9"){ -// ui->radioButton9HoriL->setChecked(true); - -// } -// else if(value == 7 && font.family()=="SerifR9"){ -// ui->radioButton9HoriR->setChecked(true); - -// } - else if(value == 7 && font.family()=="bangla"){ - ui->radioButton7Bangla->setChecked(true); - } - else if(value == 7 && font.family()=="biyangF"){ - ui->radioButton7PointNum->setChecked(true); - } - else if(value == 21 && font.family()=="biyangF"){ - ui->radioButton21PointNum->setChecked(true); - } - else if(value == 12 && font.family()=="Roman"){ - ui->radioButton12NewRoman->setChecked(true); - } - else if(value == 7){ - ui->radioButton7Point->setChecked(true); - } - else if(value == 9){ - ui->radioButton9Point->setChecked(true); - } - else if(value == 12){ - ui->radioButton12Point->setChecked(true); - } - else if(value == 16){ - ui->radioButton16Point->setChecked(true); - } - - else if(value == 24){ - ui->radioButton24Point->setChecked(true); - } - else if(value == 32){ - ui->radioButton32Point->setChecked(true); - } - /* - else if(value == 28){ - ui->radioButton28Point->setChecked(true); - } - else if(value == 32){ - ui->radioButton32Point->setChecked(true); - } - */ - -#endif - -} - -QString DialogFontSize::getFontFamily(){ - - return ui->lineEdit->font().family(); -} - -QFont DialogFontSize::getFont(){ - - return ui->lineEdit->font(); -} - -void DialogFontSize::on_pushButton_pressed() -{ - GetFileInfo();// 显示字库校验码 -} - -void DialogFontSize::on_checkBox_Left_clicked() -{ - auto b = ui->checkBox_Right->blockSignals(true); - ui->checkBox_Right->setChecked(false); - ui->checkBox_Right->blockSignals(b); - flagOfRight = false; - flagOfLeft = !flagOfLeft; - int pixsize; - getValue(&pixsize); -} - -void DialogFontSize::on_checkBox_Right_clicked() -{ - auto b = ui->checkBox_Left->blockSignals(true); - ui->checkBox_Left->setChecked(false); - ui->checkBox_Left->blockSignals(b); - flagOfLeft = false; - flagOfRight = !flagOfRight; - int pixsize; - getValue(&pixsize); -} +#include "DialogFontSize.h" +#include "ui_dialogfontsize.h" +#include +#include +#include +#include +#include +#include +#include +#include "myinclude.h" +#include "Public.h" + +DialogFontSize::DialogFontSize(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogFontSize) +{ + ui->setupUi(this); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + this->setWindowTitle(tr("选择字体大小")); + + font.setFamily("WenQuanYi12"); + QString langurageType = Public::ReadLanguageName(); + if(langurageType != "English" && langurageType != "Chinese") + font.setFamily("Yanglabeldot12"); + font.setPixelSize(12); + ui->lineEdit->setFont(font); + + connect(ui->radioButton7Bangla,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + connect(ui->radioButton7PointNum,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + + connect(ui->radioButton5Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); + connect(ui->radioButton7Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + + connect(ui->radioButton9Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); + connect(ui->radioButton12Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + + connect(ui->radioButton16Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriL(bool))); + connect(ui->radioButton24Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + connect(ui->radioButton21PointNum,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + connect(ui->radioButton32Point,SIGNAL(clicked(bool)),this,SLOT(Button7HoriR(bool))); + +#ifdef VNLGXX + ui->checkBoxBold->hide(); + ui->radioButton5Point->hide(); + ui->radioButton7Point->hide(); + ui->radioButton9Point->hide(); + ui->radioButton12Point->hide(); + ui->radioButton16Point->hide(); + ui->radioButton24Point->hide(); +#else +// ui->checkBoxBold->hide(); +// ui->labelFont->hide(); +// ui->fontComboBox->hide(); +// ui->comboBoxFontSize->hide(); +#endif + GetFileInfo(); + flagOfLeft = false; + flagOfRight = false; + +#ifdef EnableBangla + ui->radioButton7Bangla->setEnabled(1); +#else + ui->radioButton7Bangla->setEnabled(0); +#endif + //ui->checkBox_Left->setStyleSheet("QCheckBox { font-size: 24pt; }"); + +} + +DialogFontSize::~DialogFontSize() +{ + delete ui; +} + +void DialogFontSize::Button7HoriL(bool ok){ + int pixsize; + getValue(&pixsize); + + + //qDebug()<lineEdit->font().family()<lineEdit->font().pixelSize(); + qDebug() << "click L"; + +} + +void DialogFontSize::Button7HoriR(bool ok){ + int pixsize; + getValue(&pixsize); + + //qDebug()<lineEdit->font().family()<lineEdit->font().pixelSize(); + + qDebug() << "click R"; +} + +void DialogFontSize::ChangeFont(QString fontFamily){ + + font.setFamily(fontFamily); + + //font.setPixelSize(pixelSize); + ui->lineEdit->setFont(font); // 设置预览字体 + +// if(fontFamily=="wenquanyi" ){ +// ui->comboBoxFontSize->clear(); +// ui->comboBoxFontSize->addItem("12"); +// ui->comboBoxFontSize->addItem("16"); +// //ui->comboBoxFontSize->addItem("12"); + + +// } +// else if(fontFamily=="biyang"){ +// ui->comboBoxFontSize->clear(); +// ui->comboBoxFontSize->addItem("5"); +// ui->comboBoxFontSize->addItem("7"); +// ui->comboBoxFontSize->addItem("9"); +// //ui->comboBoxFontSize->addItem("10"); + +// } +// else { +// ui->comboBoxFontSize->clear(); +// ui->comboBoxFontSize->addItem("14"); +// ui->comboBoxFontSize->addItem("16"); +// ui->comboBoxFontSize->addItem("18"); +// ui->comboBoxFontSize->addItem("20"); +// ui->comboBoxFontSize->addItem("24"); +// ui->comboBoxFontSize->addItem("28"); +// ui->comboBoxFontSize->addItem("32"); +// ui->comboBoxFontSize->addItem("36"); +// } + +} + +void DialogFontSize::GetFileInfo(){ + QString fileName; + QString fileDate=""; + QString fontPath="/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"; + QDir FontsFile("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"); + if(FontsFile.exists("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"))//2451 + { + fontPath = "/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/"; + } + if(FontsFile.exists("/usr/lib/fonts/"))//am335x + { + fontPath = "/usr/lib/fonts/"; + } + fileName.sprintf("_%d_50.qpf2",font.pixelSize()); + QFileInfo fileInfo; + + if(font.family()=="SerifL") + fileName = fontPath +"serifl_7_50.qpf2"; + else if(font.family()=="SerifR") + fileName = fontPath +"serifr_7_50.qpf2"; + else if(font.family()=="SerifL9") + fileName = fontPath +"serifl_9_50.qpf2"; + else if(font.family()=="SerifR9") + fileName = fontPath +"serifr_9_50.qpf2"; + else fileName = fontPath +font.family()+fileName; + fileInfo.setFile(fileName); + QDateTime dt= fileInfo.created(); + //fileInfo.lastModified(); + QString s = dt.toString("yyyy-MM-dd hh:mm:ss"); + //qDebug()<<"GetFileInfo"<labFontInfo->setText(fileInfo.fileName()+" "+s+""); + ui->labFontInfo->setText( QString("%1").arg(chsum)); +} +/* +void DialogFontSize::getValue(int *size){ + int pixelSize = 12; + bool ok; + font.setFamily("wenquanyi"); +#ifdef VNLGXX + + int n = ui->comboBoxFontSize->currentText().toInt(&ok,10); + if(ok) pixelSize = n; + +#else + if(ui->radioButton5Point->isChecked()){ + pixelSize = 5; + font.setFamily("biyang"); + } + else if(ui->radioButton7Point->isChecked()){ + pixelSize = 7; + font.setFamily("biyang"); + } + else if(ui->radioButton9Point->isChecked()){ + pixelSize = 9; + font.setFamily("biyang"); + } + else if(ui->radioButton12Point->isChecked()){ + pixelSize = 12; + + } + else if(ui->radioButton16Point->isChecked()){ + pixelSize = 16; + } + else if(ui->radioButton24Point->isChecked()){ + pixelSize = 24; + } + else if(ui->radioButton7HoriL->isChecked()){ + pixelSize = 5; + font.setFamily("SerifL"); + + } + else if(ui->radioButton7HoriR->isChecked()){ + pixelSize = 5; + font.setFamily("SerifR"); + } + else if(ui->radioButton9HoriL->isChecked()){ + pixelSize = 7; + font.setFamily("SerifL9"); + + } + else if(ui->radioButton9HoriR->isChecked()){ + pixelSize = 7; + font.setFamily("SerifR9"); + } + else if(ui->radioButton7Bangla->isChecked()){ + pixelSize = 7; + font.setFamily("bangla"); + } + else if(ui->radioButton7PointNum->isChecked()){ + pixelSize = 7; + font.setFamily("biyangF"); + } + else if(ui->radioButton21PointNum->isChecked()){ + pixelSize = 24; + font.setFamily("biyangF"); + } + else if(ui->radioButton12NewRoman->isChecked()){ + pixelSize = 12; + font.setFamily("Roman"); + } + else if(ui->radioButton32Point->isChecked()){ + pixelSize = 32; + } + +// radioButton7Hori +// else if(ui->radioButton28Point->isChecked()){ +// pixelSize = 28; +// } +// else if(ui->radioButton32Point->isChecked()){ +// pixelSize = 32; +// } + +#endif + + font.setPixelSize(pixelSize); + ui->lineEdit->setFont(font); // 设置预览字体 + + *size = pixelSize; + + +} +*/ + +void DialogFontSize::getValue(int *size){ + int pixelSize = 12; + bool ok; + font.setFamily("WenQuanYi12"); + + if(ui->radioButton5Point->isChecked()){ + pixelSize = 5; + if(flagOfLeft){ + font.setFamily("WenQuanYiL5"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR5"); + }else{ + font.setFamily("WenQuanYi5"); + } + } + else if(ui->radioButton7Point->isChecked()){ + pixelSize = 7; + if(flagOfLeft){ + font.setFamily("WenQuanYiL7"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR7"); + }else{ + font.setFamily("WenQuanYi7"); + } + } + else if(ui->radioButton9Point->isChecked()){ + pixelSize = 9; + if(flagOfLeft){ + font.setFamily("DinkieL9"); + } + else if(flagOfRight){ + font.setFamily("DinkieR9"); + }else{ + font.setFamily("Dinkie9"); + } + } + else if(ui->radioButton12Point->isChecked()){ + pixelSize = 12; + if(flagOfLeft){ + font.setFamily("WenQuanYiL12"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR12"); + } + else{ + font.setFamily("WenQuanYi12"); + } + } + else if(ui->radioButton16Point->isChecked()){ + pixelSize = 16; + if(flagOfLeft){ + font.setFamily("WenQuanYiL16"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR16"); + } + else{ + font.setFamily("WenQuanYi16"); + } + } + else if(ui->radioButton24Point->isChecked()){ + pixelSize = 24; + if(flagOfLeft){ + font.setFamily("WenQuanYiL24"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR24"); + } + else{ + font.setFamily("WenQuanYi24"); + } + } + + else if(ui->radioButton7Bangla->isChecked()){ + pixelSize = 7; + font.setFamily("bangla"); + } + else if(ui->radioButton7PointNum->isChecked()){ + pixelSize = 7; + font.setFamily("biyangF"); + } + else if(ui->radioButton21PointNum->isChecked()){ + pixelSize = 24; + font.setFamily("biyangF"); + } + else if(ui->radioButton12NewRoman->isChecked()){ + pixelSize = 12; + font.setFamily("Roman"); + } + else if(ui->radioButton32Point->isChecked()){ + pixelSize = 32; + font.setFamily("WenQuanYi32"); + + if(flagOfLeft){ + font.setFamily("WenQuanYiL32"); + } + else if(flagOfRight){ + font.setFamily("WenQuanYiR32"); + } + else{ + font.setFamily("WenQuanYi32"); + } + } + + font.setPixelSize(pixelSize); + ui->lineEdit->setFont(font); // 设置预览字体 + *size = pixelSize; +} + +void DialogFontSize::setValue(int value){ + +#ifdef VNLGXX + //QString s; + //s.sprintf("%d",value); + //ui->comboBoxFontSize->setEditText(s); + //if(value<12) ui->fontComboBox->setCurrentIndex(0); + +#else + if(value == 5 && font.family()=="biyang"){ + ui->radioButton5Point->setChecked(true); + } +// else if(value == 5 && font.family()=="SerifL"){ +// ui->radioButton7HoriL->setChecked(true); +// } +// else if(value == 5 && font.family()=="SerifR" ){ +// ui->radioButton7HoriR->setChecked(true); + +// } +// else if(value == 7 && font.family()=="SerifL9"){ +// ui->radioButton9HoriL->setChecked(true); + +// } +// else if(value == 7 && font.family()=="SerifR9"){ +// ui->radioButton9HoriR->setChecked(true); + +// } + else if(value == 7 && font.family()=="bangla"){ + ui->radioButton7Bangla->setChecked(true); + } + else if(value == 7 && font.family()=="biyangF"){ + ui->radioButton7PointNum->setChecked(true); + } + else if(value == 21 && font.family()=="biyangF"){ + ui->radioButton21PointNum->setChecked(true); + } + else if(value == 12 && font.family()=="Roman"){ + ui->radioButton12NewRoman->setChecked(true); + } + else if(value == 7){ + ui->radioButton7Point->setChecked(true); + } + else if(value == 9){ + ui->radioButton9Point->setChecked(true); + } + else if(value == 12){ + ui->radioButton12Point->setChecked(true); + } + else if(value == 16){ + ui->radioButton16Point->setChecked(true); + } + + else if(value == 24){ + ui->radioButton24Point->setChecked(true); + } + else if(value == 32){ + ui->radioButton32Point->setChecked(true); + } + /* + else if(value == 28){ + ui->radioButton28Point->setChecked(true); + } + else if(value == 32){ + ui->radioButton32Point->setChecked(true); + } + */ + +#endif + +} + +QString DialogFontSize::getFontFamily(){ + + return ui->lineEdit->font().family(); +} + +QFont DialogFontSize::getFont(){ + + return ui->lineEdit->font(); +} + +void DialogFontSize::on_pushButton_pressed() +{ + GetFileInfo();// 显示字库校验码 +} + +void DialogFontSize::on_checkBox_Left_clicked() +{ + auto b = ui->checkBox_Right->blockSignals(true); + ui->checkBox_Right->setChecked(false); + ui->checkBox_Right->blockSignals(b); + flagOfRight = false; + flagOfLeft = !flagOfLeft; + int pixsize; + getValue(&pixsize); +} + +void DialogFontSize::on_checkBox_Right_clicked() +{ + auto b = ui->checkBox_Left->blockSignals(true); + ui->checkBox_Left->setChecked(false); + ui->checkBox_Left->blockSignals(b); + flagOfLeft = false; + flagOfRight = !flagOfRight; + int pixsize; + getValue(&pixsize); +} diff --git a/DialogFontSize.h b/DialogFontSize.h index 99c74ce..ff46f2f 100644 --- a/DialogFontSize.h +++ b/DialogFontSize.h @@ -1,43 +1,43 @@ -#ifndef DIALOGFONTSIZE_H -#define DIALOGFONTSIZE_H - -#include - -namespace Ui { -class DialogFontSize; -} - -class DialogFontSize : public QDialog -{ - Q_OBJECT - -public: - explicit DialogFontSize(QWidget *parent = 0); - ~DialogFontSize(); - void getValue(int *size); - void setValue(int value); - QFont font; - QString getFontFamily(); - QFont getFont(); - - void GetFileInfo();//String fileName, String fileDate - -public slots: - void ChangeFont(QString fontFamily); - void Button7HoriL(bool ok); - void Button7HoriR(bool ok); - -private slots: - void on_pushButton_pressed(); - - void on_checkBox_Left_clicked(); - - void on_checkBox_Right_clicked(); - -private: - Ui::DialogFontSize *ui; - bool flagOfLeft; - bool flagOfRight; -}; - -#endif // DIALOGFONTSIZE_H +#ifndef DIALOGFONTSIZE_H +#define DIALOGFONTSIZE_H + +#include + +namespace Ui { +class DialogFontSize; +} + +class DialogFontSize : public QDialog +{ + Q_OBJECT + +public: + explicit DialogFontSize(QWidget *parent = 0); + ~DialogFontSize(); + void getValue(int *size); + void setValue(int value); + QFont font; + QString getFontFamily(); + QFont getFont(); + + void GetFileInfo();//String fileName, String fileDate + +public slots: + void ChangeFont(QString fontFamily); + void Button7HoriL(bool ok); + void Button7HoriR(bool ok); + +private slots: + void on_pushButton_pressed(); + + void on_checkBox_Left_clicked(); + + void on_checkBox_Right_clicked(); + +private: + Ui::DialogFontSize *ui; + bool flagOfLeft; + bool flagOfRight; +}; + +#endif // DIALOGFONTSIZE_H diff --git a/DialogInputTxt.cpp b/DialogInputTxt.cpp index 0906cdb..18310b0 100644 --- a/DialogInputTxt.cpp +++ b/DialogInputTxt.cpp @@ -1,14 +1,14 @@ -#include "DialogInputTxt.h" -#include "ui_DialogInputTxt.h" - -DialogInputTxt::DialogInputTxt(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogInputTxt) -{ - ui->setupUi(this); -} - -DialogInputTxt::~DialogInputTxt() -{ - delete ui; -} +#include "DialogInputTxt.h" +#include "ui_DialogInputTxt.h" + +DialogInputTxt::DialogInputTxt(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogInputTxt) +{ + ui->setupUi(this); +} + +DialogInputTxt::~DialogInputTxt() +{ + delete ui; +} diff --git a/DialogInputTxt.h b/DialogInputTxt.h index bd0e63b..50168be 100644 --- a/DialogInputTxt.h +++ b/DialogInputTxt.h @@ -1,22 +1,22 @@ -#ifndef DIALOGINPUTTXT_H -#define DIALOGINPUTTXT_H - -#include - -namespace Ui { - class DialogInputTxt; -} - -class DialogInputTxt : public QDialog -{ - Q_OBJECT - -public: - explicit DialogInputTxt(QWidget *parent = 0); - ~DialogInputTxt(); - -private: - Ui::DialogInputTxt *ui; -}; - -#endif // DIALOGINPUTTXT_H +#ifndef DIALOGINPUTTXT_H +#define DIALOGINPUTTXT_H + +#include + +namespace Ui { + class DialogInputTxt; +} + +class DialogInputTxt : public QDialog +{ + Q_OBJECT + +public: + explicit DialogInputTxt(QWidget *parent = 0); + ~DialogInputTxt(); + +private: + Ui::DialogInputTxt *ui; +}; + +#endif // DIALOGINPUTTXT_H diff --git a/DialogInputTxt.ui b/DialogInputTxt.ui index 8287858..eda2d20 100644 --- a/DialogInputTxt.ui +++ b/DialogInputTxt.ui @@ -1,78 +1,78 @@ - - - DialogInputTxt - - - - 0 - 0 - 400 - 117 - - - - Dialog - - - - - 20 - 80 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 20 - 30 - 361 - 27 - - - - - - - - buttonBox - accepted() - DialogInputTxt - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogInputTxt - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogInputTxt + + + + 0 + 0 + 400 + 117 + + + + Dialog + + + + + 20 + 80 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 30 + 361 + 27 + + + + + + + + buttonBox + accepted() + DialogInputTxt + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogInputTxt + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DialogInsertVari.cpp b/DialogInsertVari.cpp index 326c6fd..0b2103d 100644 --- a/DialogInsertVari.cpp +++ b/DialogInsertVari.cpp @@ -1,227 +1,227 @@ -#include "DialogInsertVari.h" -#include "ui_dialoginsertvari.h" -#include "myinclude.h" -//#include "SysPara.h" - -DialogInsertVari::DialogInsertVari(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogInsertVari) -{ - - ui->setupUi(this); - this->setWindowTitle(tr("变量插入")); - //this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowContextHelpButtonHint | Qt::WindowMaximizeButtonHint); - //this->setWindowFlags(windowFlags()&~Qt::WindowCloseButtonHint); - //setWindowFlags(Qt::WindowTitleHint | Qt::WindowContextHelpButtonHint); - //setWindowFlags(Qt::CustomizeWindowHint); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - - - bool Flag=0; - digitWidth = 4; - ui->radioButtonDigital9->setDisabled(!Flag); - ui->radioButtonDigitalA->setDisabled(!Flag); - ui->radioButtonDigitalB->setDisabled(!Flag); - ui->radioButtonDigitalC->setDisabled(!Flag); - ui->radioButtonDigitalD->setDisabled(!Flag); - ui->radioButtonDigitalE->setDisabled(!Flag); - ui->radioButtonDigitalF->setDisabled(!Flag); - //ui->radioButtonDigitalH->setDisabled(!Flag); - - connect(ui->radioButtonVarRandom,SIGNAL(toggled(bool)),this,SLOT(onRanDomPressed(bool))); - - connect(ui->radioButtonHour,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonMinute,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonWeek,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonMonth,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonSecond,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonDay,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); -connect(ui->radioButtonXDay,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); - connect(ui->radioButtonYear,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); - connect(ui->radioButtonVar1,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); - connect(ui->radioButtonVar2,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); - connect(ui->radioButtonCNT3,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); -#ifdef _2DCODE_ - connect(ui->radioButtonBarCode,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); - connect(ui->radioButtonQRCode,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); - connect(ui->radioButtonDataMatrix,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); -#else - delete ui->radioButtonBarCode; - delete ui->radioButtonQRCode; - delete ui->radioButtonDataMatrix; -#endif -ui->radioButtonXDay->hide(); - -} - -DialogInsertVari::~DialogInsertVari() -{ - delete ui; -} -void DialogInsertVari::setValue(QString txt){ - //ui->label_2->setText(txt); -} -void DialogInsertVari::onRanDomPressed(bool Flag){ - if(Flag) ui->radioButtonDigitalD->setChecked(Flag); - else ui->radioButtonDigital4->setChecked(1); - ui->radioButtonDigital9->setDisabled(!Flag); - ui->radioButtonDigitalA->setDisabled(!Flag); - ui->radioButtonDigitalB->setDisabled(!Flag); - ui->radioButtonDigitalC->setDisabled(!Flag); - ui->radioButtonDigitalD->setDisabled(!Flag); - ui->radioButtonDigitalE->setDisabled(!Flag); - ui->radioButtonDigitalF->setDisabled(!Flag); - //ui->radioButtonDigitalH->setDisabled(!Flag); -} - -void DialogInsertVari::onDigitOtherBit(bool Flag){ - - if(digitWidth>8) - ui->radioButtonDigital4->setChecked(1); - - ui->radioButtonDigital9->setDisabled(Flag); - ui->radioButtonDigitalA->setDisabled(Flag); - ui->radioButtonDigitalB->setDisabled(Flag); - ui->radioButtonDigitalC->setDisabled(Flag); - ui->radioButtonDigitalD->setDisabled(Flag); - ui->radioButtonDigitalE->setDisabled(Flag); - ui->radioButtonDigitalF->setDisabled(Flag); - //ui->radioButtonDigitalH->setDisabled(Flag); -} - -void DialogInsertVari::onDigitTwoBit(bool Flag){ - if(ui->radioButtonXDay->isChecked())ui->radioButtonDigital3->setChecked(Flag); - else if(Flag)ui->radioButtonDigital2->setChecked(Flag); - else ui->radioButtonDigital4->setChecked(1); - - ui->radioButtonDigital9->setDisabled(Flag); - ui->radioButtonDigitalA->setDisabled(Flag); - ui->radioButtonDigitalB->setDisabled(Flag); - ui->radioButtonDigitalC->setDisabled(Flag); - ui->radioButtonDigitalD->setDisabled(Flag); - ui->radioButtonDigitalE->setDisabled(Flag); - ui->radioButtonDigitalF->setDisabled(Flag); - //ui->radioButtonDigitalH->setDisabled(Flag); -} - -void DialogInsertVari::onDigitFourBit(bool Flag){ - if(Flag)ui->radioButtonDigital4->setChecked(Flag); - else ui->radioButtonDigital2->setChecked(1); - ui->radioButtonDigital9->setDisabled(Flag); - ui->radioButtonDigitalA->setDisabled(Flag); - ui->radioButtonDigitalB->setDisabled(Flag); - ui->radioButtonDigitalC->setDisabled(Flag); - ui->radioButtonDigitalD->setDisabled(Flag); - ui->radioButtonDigitalE->setDisabled(Flag); - ui->radioButtonDigitalF->setDisabled(Flag); - //ui->radioButtonDigitalH->setDisabled(Flag); -} - - -void DialogInsertVari::getValue(int *varType,int *digitalWidth,unsigned char *splitMode){ - int type = 0,width = 0; - if(ui->radioButtonYear->isChecked()) - type = 0; - else if(ui->radioButtonMonth->isChecked()) - type = 1; - else if(ui->radioButtonDay->isChecked()) - type = 2; - else if(ui->radioButtonWeek->isChecked()) - type = 3; - else if(ui->radioButtonHour->isChecked()) - type = 4; - else if(ui->radioButtonMinute->isChecked()) - type = 5; - else if(ui->radioButtonSecond->isChecked()) - type = 6; - else if(ui->radioButtonVar1->isChecked()) - type = 7; - else if(ui->radioButtonVar2->isChecked()) - type = 8; -#ifdef _2DCODE_ - else if(ui->radioButtonDataMatrix->isChecked()) - type = 9; - else if(ui->radioButtonQRCode->isChecked()) - type = 10; - else if(ui->radioButtonBarCode->isChecked()) - type = 11; -#endif - else if(ui->radioButtonVarRandom->isChecked()) - type = 12; - else if(ui->radioButtonCNT3->isChecked()) - type = 13; - else if(ui->radioButtonXDay->isChecked()) - type = 14; - else if(ui->radioButtonCNT4->isChecked()) - type = 15; - else if(ui->radioButtonExpiry->isChecked()) - { - type = 80; - - } - else if(ui->radioButtonCurDate->isChecked()) - { - type = 81; - } -// else if(ui->radioButtonClass->isChecked()) -// { -// type = 82; -// } - - - - if(ui->radioButtonDigital1->isChecked()) - width = 1; - else if(ui->radioButtonDigital2->isChecked()) - width = 2; - else if(ui->radioButtonDigital3->isChecked()) - width = 3; - else if(ui->radioButtonDigital4->isChecked()) - width = 4; - else if(ui->radioButtonDigital5->isChecked()) - width = 5; - else if(ui->radioButtonDigital6->isChecked()) - width = 6; - else if(ui->radioButtonDigital7->isChecked()) - width = 7; - else if(ui->radioButtonDigital8->isChecked()) - width = 8; - else if(ui->radioButtonDigital9->isChecked()) - width = 9; - else if(ui->radioButtonDigitalA->isChecked()) - width = 10; - else if(ui->radioButtonDigitalB->isChecked()) - width = 11; - else if(ui->radioButtonDigitalC->isChecked()) - width = 12; - else if(ui->radioButtonDigitalD->isChecked()) - width = 13; - else if(ui->radioButtonDigitalE->isChecked()) - width = 14; - else if(ui->radioButtonDigitalF->isChecked()) - width = 15; - //else if(ui->radioButtonDigitalH->isChecked()) - // width = 16; - if(varType && digitalWidth){ - *varType = type; - *digitalWidth = width; - digitWidth = width; - } - if (type == 82) { // class - *digitalWidth = 1; - digitWidth = 1; - - } - -} - -void DialogInsertVari::on_buttonBox_accepted() -{ - -} -void DialogInsertVari::EnableHiddenValue(bool select) -{ - if(!select) - ui->radioButtonVar1->setChecked(true); - ui->radioButtonCNT4->setEnabled(select); -} +#include "DialogInsertVari.h" +#include "ui_dialoginsertvari.h" +#include "myinclude.h" +//#include "SysPara.h" + +DialogInsertVari::DialogInsertVari(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogInsertVari) +{ + + ui->setupUi(this); + this->setWindowTitle(tr("变量插入")); + //this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowContextHelpButtonHint | Qt::WindowMaximizeButtonHint); + //this->setWindowFlags(windowFlags()&~Qt::WindowCloseButtonHint); + //setWindowFlags(Qt::WindowTitleHint | Qt::WindowContextHelpButtonHint); + //setWindowFlags(Qt::CustomizeWindowHint); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + + + bool Flag=0; + digitWidth = 4; + ui->radioButtonDigital9->setDisabled(!Flag); + ui->radioButtonDigitalA->setDisabled(!Flag); + ui->radioButtonDigitalB->setDisabled(!Flag); + ui->radioButtonDigitalC->setDisabled(!Flag); + ui->radioButtonDigitalD->setDisabled(!Flag); + ui->radioButtonDigitalE->setDisabled(!Flag); + ui->radioButtonDigitalF->setDisabled(!Flag); + //ui->radioButtonDigitalH->setDisabled(!Flag); + + connect(ui->radioButtonVarRandom,SIGNAL(toggled(bool)),this,SLOT(onRanDomPressed(bool))); + + connect(ui->radioButtonHour,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonMinute,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonWeek,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonMonth,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonSecond,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonDay,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); +connect(ui->radioButtonXDay,SIGNAL(toggled(bool)),this,SLOT( onDigitTwoBit(bool))); + connect(ui->radioButtonYear,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); + connect(ui->radioButtonVar1,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); + connect(ui->radioButtonVar2,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); + connect(ui->radioButtonCNT3,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool))); +#ifdef _2DCODE_ + connect(ui->radioButtonBarCode,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); + connect(ui->radioButtonQRCode,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); + connect(ui->radioButtonDataMatrix,SIGNAL(toggled(bool)),this,SLOT( onDigitOtherBit(bool))); +#else + delete ui->radioButtonBarCode; + delete ui->radioButtonQRCode; + delete ui->radioButtonDataMatrix; +#endif +ui->radioButtonXDay->hide(); + +} + +DialogInsertVari::~DialogInsertVari() +{ + delete ui; +} +void DialogInsertVari::setValue(QString txt){ + //ui->label_2->setText(txt); +} +void DialogInsertVari::onRanDomPressed(bool Flag){ + if(Flag) ui->radioButtonDigitalD->setChecked(Flag); + else ui->radioButtonDigital4->setChecked(1); + ui->radioButtonDigital9->setDisabled(!Flag); + ui->radioButtonDigitalA->setDisabled(!Flag); + ui->radioButtonDigitalB->setDisabled(!Flag); + ui->radioButtonDigitalC->setDisabled(!Flag); + ui->radioButtonDigitalD->setDisabled(!Flag); + ui->radioButtonDigitalE->setDisabled(!Flag); + ui->radioButtonDigitalF->setDisabled(!Flag); + //ui->radioButtonDigitalH->setDisabled(!Flag); +} + +void DialogInsertVari::onDigitOtherBit(bool Flag){ + + if(digitWidth>8) + ui->radioButtonDigital4->setChecked(1); + + ui->radioButtonDigital9->setDisabled(Flag); + ui->radioButtonDigitalA->setDisabled(Flag); + ui->radioButtonDigitalB->setDisabled(Flag); + ui->radioButtonDigitalC->setDisabled(Flag); + ui->radioButtonDigitalD->setDisabled(Flag); + ui->radioButtonDigitalE->setDisabled(Flag); + ui->radioButtonDigitalF->setDisabled(Flag); + //ui->radioButtonDigitalH->setDisabled(Flag); +} + +void DialogInsertVari::onDigitTwoBit(bool Flag){ + if(ui->radioButtonXDay->isChecked())ui->radioButtonDigital3->setChecked(Flag); + else if(Flag)ui->radioButtonDigital2->setChecked(Flag); + else ui->radioButtonDigital4->setChecked(1); + + ui->radioButtonDigital9->setDisabled(Flag); + ui->radioButtonDigitalA->setDisabled(Flag); + ui->radioButtonDigitalB->setDisabled(Flag); + ui->radioButtonDigitalC->setDisabled(Flag); + ui->radioButtonDigitalD->setDisabled(Flag); + ui->radioButtonDigitalE->setDisabled(Flag); + ui->radioButtonDigitalF->setDisabled(Flag); + //ui->radioButtonDigitalH->setDisabled(Flag); +} + +void DialogInsertVari::onDigitFourBit(bool Flag){ + if(Flag)ui->radioButtonDigital4->setChecked(Flag); + else ui->radioButtonDigital2->setChecked(1); + ui->radioButtonDigital9->setDisabled(Flag); + ui->radioButtonDigitalA->setDisabled(Flag); + ui->radioButtonDigitalB->setDisabled(Flag); + ui->radioButtonDigitalC->setDisabled(Flag); + ui->radioButtonDigitalD->setDisabled(Flag); + ui->radioButtonDigitalE->setDisabled(Flag); + ui->radioButtonDigitalF->setDisabled(Flag); + //ui->radioButtonDigitalH->setDisabled(Flag); +} + + +void DialogInsertVari::getValue(int *varType,int *digitalWidth,unsigned char *splitMode){ + int type = 0,width = 0; + if(ui->radioButtonYear->isChecked()) + type = 0; + else if(ui->radioButtonMonth->isChecked()) + type = 1; + else if(ui->radioButtonDay->isChecked()) + type = 2; + else if(ui->radioButtonWeek->isChecked()) + type = 3; + else if(ui->radioButtonHour->isChecked()) + type = 4; + else if(ui->radioButtonMinute->isChecked()) + type = 5; + else if(ui->radioButtonSecond->isChecked()) + type = 6; + else if(ui->radioButtonVar1->isChecked()) + type = 7; + else if(ui->radioButtonVar2->isChecked()) + type = 8; +#ifdef _2DCODE_ + else if(ui->radioButtonDataMatrix->isChecked()) + type = 9; + else if(ui->radioButtonQRCode->isChecked()) + type = 10; + else if(ui->radioButtonBarCode->isChecked()) + type = 11; +#endif + else if(ui->radioButtonVarRandom->isChecked()) + type = 12; + else if(ui->radioButtonCNT3->isChecked()) + type = 13; + else if(ui->radioButtonXDay->isChecked()) + type = 14; + else if(ui->radioButtonCNT4->isChecked()) + type = 15; + else if(ui->radioButtonExpiry->isChecked()) + { + type = 80; + + } + else if(ui->radioButtonCurDate->isChecked()) + { + type = 81; + } +// else if(ui->radioButtonClass->isChecked()) +// { +// type = 82; +// } + + + + if(ui->radioButtonDigital1->isChecked()) + width = 1; + else if(ui->radioButtonDigital2->isChecked()) + width = 2; + else if(ui->radioButtonDigital3->isChecked()) + width = 3; + else if(ui->radioButtonDigital4->isChecked()) + width = 4; + else if(ui->radioButtonDigital5->isChecked()) + width = 5; + else if(ui->radioButtonDigital6->isChecked()) + width = 6; + else if(ui->radioButtonDigital7->isChecked()) + width = 7; + else if(ui->radioButtonDigital8->isChecked()) + width = 8; + else if(ui->radioButtonDigital9->isChecked()) + width = 9; + else if(ui->radioButtonDigitalA->isChecked()) + width = 10; + else if(ui->radioButtonDigitalB->isChecked()) + width = 11; + else if(ui->radioButtonDigitalC->isChecked()) + width = 12; + else if(ui->radioButtonDigitalD->isChecked()) + width = 13; + else if(ui->radioButtonDigitalE->isChecked()) + width = 14; + else if(ui->radioButtonDigitalF->isChecked()) + width = 15; + //else if(ui->radioButtonDigitalH->isChecked()) + // width = 16; + if(varType && digitalWidth){ + *varType = type; + *digitalWidth = width; + digitWidth = width; + } + if (type == 82) { // class + *digitalWidth = 1; + digitWidth = 1; + + } + +} + +void DialogInsertVari::on_buttonBox_accepted() +{ + +} +void DialogInsertVari::EnableHiddenValue(bool select) +{ + if(!select) + ui->radioButtonVar1->setChecked(true); + ui->radioButtonCNT4->setEnabled(select); +} diff --git a/DialogInsertVari.h b/DialogInsertVari.h index 83ccb5f..9c0ab8b 100644 --- a/DialogInsertVari.h +++ b/DialogInsertVari.h @@ -1,33 +1,33 @@ -#ifndef DIALOGINSERTVARI_H -#define DIALOGINSERTVARI_H - -#include - -namespace Ui { -class DialogInsertVari; -} - -class DialogInsertVari : public QDialog -{ - Q_OBJECT - -public: - explicit DialogInsertVari(QWidget *parent = 0); - ~DialogInsertVari(); - void getValue(int *varType,int *digitalWidth,unsigned char *splitMode); - void setValue(QString txt); - void EnableHiddenValue(bool select); -protected slots: - void onRanDomPressed(bool Flag); - void onDigitOtherBit(bool Flag); - void onDigitTwoBit(bool Flag); - void onDigitFourBit(bool Flag); -private slots: - void on_buttonBox_accepted(); - -private: - Ui::DialogInsertVari *ui; - int digitWidth; -}; - -#endif // DIALOGINSERTVARI_H +#ifndef DIALOGINSERTVARI_H +#define DIALOGINSERTVARI_H + +#include + +namespace Ui { +class DialogInsertVari; +} + +class DialogInsertVari : public QDialog +{ + Q_OBJECT + +public: + explicit DialogInsertVari(QWidget *parent = 0); + ~DialogInsertVari(); + void getValue(int *varType,int *digitalWidth,unsigned char *splitMode); + void setValue(QString txt); + void EnableHiddenValue(bool select); +protected slots: + void onRanDomPressed(bool Flag); + void onDigitOtherBit(bool Flag); + void onDigitTwoBit(bool Flag); + void onDigitFourBit(bool Flag); +private slots: + void on_buttonBox_accepted(); + +private: + Ui::DialogInsertVari *ui; + int digitWidth; +}; + +#endif // DIALOGINSERTVARI_H diff --git a/DialogLineSpace.cpp b/DialogLineSpace.cpp index c487a77..d43a10a 100644 --- a/DialogLineSpace.cpp +++ b/DialogLineSpace.cpp @@ -1,75 +1,75 @@ -#include "DialogLineSpace.h" -#include "ui_dialoglinespace.h" - -DialogLineSpace::DialogLineSpace(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogLineSpace) -{ - ui->setupUi(this); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - this->setWindowTitle(tr("选择行间距和字符间距")); -} - -DialogLineSpace::~DialogLineSpace() -{ - delete ui; -} - -void DialogLineSpace::getValue(int *lineSpace,int *charSpace){ - *lineSpace = 0; - - if(ui->radioButton0Pixel->isChecked()) - *lineSpace = 0; - else if(ui->radioButton1Pixel->isChecked()) - *lineSpace = 1; - else if(ui->radioButton2Pixel->isChecked()) - *lineSpace = 2; - else if(ui->radioButton3Pixel->isChecked()) - *lineSpace = 3; - else if(ui->radioButton4Pixel->isChecked()) - *lineSpace = 4; - else if(ui->radioButton5Pixel->isChecked()) - *lineSpace = 5; - else if(ui->radioButton6Pixel->isChecked()) - *lineSpace = 6; - else if(ui->radioButton7Pixel->isChecked()) - *lineSpace = 7; - - *charSpace = 0; - if(ui->radioButtonCharSpace0Pixel->isChecked()) - *charSpace = 0; - else if(ui->radioButtonCharSpace1Pixel->isChecked()) - *charSpace = 1; - else if(ui->radioButtonCharSpace2Pixel->isChecked()) - *charSpace = 2; - else if(ui->radioButtonCharSpace3Pixel->isChecked()) - *charSpace = 3; - else if(ui->radioButtonCharSpace4Pixel->isChecked()) - *charSpace = 4; - else if(ui->radioButtonCharSpace5Pixel->isChecked()) - *charSpace = 5; -} - -void DialogLineSpace::setValue(int lineSpace,int charSpace){ - if(lineSpace>0) - lineSpace = lineSpace-1; //新系统行间距需要加1 - if(lineSpace > 7 || lineSpace < 0) - lineSpace = 0; - ui->radioButton0Pixel->setChecked(lineSpace == 0); - ui->radioButton1Pixel->setChecked(lineSpace == 1); - ui->radioButton2Pixel->setChecked(lineSpace == 2); - ui->radioButton3Pixel->setChecked(lineSpace == 3); - ui->radioButton4Pixel->setChecked(lineSpace == 4); - ui->radioButton5Pixel->setChecked(lineSpace == 5); - ui->radioButton6Pixel->setChecked(lineSpace == 6); - ui->radioButton7Pixel->setChecked(lineSpace == 7); - - if(charSpace > 5 || charSpace < 0) - charSpace = 0; - ui->radioButtonCharSpace0Pixel->setChecked(charSpace == 0); - ui->radioButtonCharSpace1Pixel->setChecked(charSpace == 1); - ui->radioButtonCharSpace2Pixel->setChecked(charSpace == 2); - ui->radioButtonCharSpace3Pixel->setChecked(charSpace == 3); - ui->radioButtonCharSpace4Pixel->setChecked(charSpace == 4); - ui->radioButtonCharSpace5Pixel->setChecked(charSpace == 5); -} +#include "DialogLineSpace.h" +#include "ui_dialoglinespace.h" + +DialogLineSpace::DialogLineSpace(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogLineSpace) +{ + ui->setupUi(this); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + this->setWindowTitle(tr("选择行间距和字符间距")); +} + +DialogLineSpace::~DialogLineSpace() +{ + delete ui; +} + +void DialogLineSpace::getValue(int *lineSpace,int *charSpace){ + *lineSpace = 0; + + if(ui->radioButton0Pixel->isChecked()) + *lineSpace = 0; + else if(ui->radioButton1Pixel->isChecked()) + *lineSpace = 1; + else if(ui->radioButton2Pixel->isChecked()) + *lineSpace = 2; + else if(ui->radioButton3Pixel->isChecked()) + *lineSpace = 3; + else if(ui->radioButton4Pixel->isChecked()) + *lineSpace = 4; + else if(ui->radioButton5Pixel->isChecked()) + *lineSpace = 5; + else if(ui->radioButton6Pixel->isChecked()) + *lineSpace = 6; + else if(ui->radioButton7Pixel->isChecked()) + *lineSpace = 7; + + *charSpace = 0; + if(ui->radioButtonCharSpace0Pixel->isChecked()) + *charSpace = 0; + else if(ui->radioButtonCharSpace1Pixel->isChecked()) + *charSpace = 1; + else if(ui->radioButtonCharSpace2Pixel->isChecked()) + *charSpace = 2; + else if(ui->radioButtonCharSpace3Pixel->isChecked()) + *charSpace = 3; + else if(ui->radioButtonCharSpace4Pixel->isChecked()) + *charSpace = 4; + else if(ui->radioButtonCharSpace5Pixel->isChecked()) + *charSpace = 5; +} + +void DialogLineSpace::setValue(int lineSpace,int charSpace){ + if(lineSpace>0) + lineSpace = lineSpace-1; //新系统行间距需要加1 + if(lineSpace > 7 || lineSpace < 0) + lineSpace = 0; + ui->radioButton0Pixel->setChecked(lineSpace == 0); + ui->radioButton1Pixel->setChecked(lineSpace == 1); + ui->radioButton2Pixel->setChecked(lineSpace == 2); + ui->radioButton3Pixel->setChecked(lineSpace == 3); + ui->radioButton4Pixel->setChecked(lineSpace == 4); + ui->radioButton5Pixel->setChecked(lineSpace == 5); + ui->radioButton6Pixel->setChecked(lineSpace == 6); + ui->radioButton7Pixel->setChecked(lineSpace == 7); + + if(charSpace > 5 || charSpace < 0) + charSpace = 0; + ui->radioButtonCharSpace0Pixel->setChecked(charSpace == 0); + ui->radioButtonCharSpace1Pixel->setChecked(charSpace == 1); + ui->radioButtonCharSpace2Pixel->setChecked(charSpace == 2); + ui->radioButtonCharSpace3Pixel->setChecked(charSpace == 3); + ui->radioButtonCharSpace4Pixel->setChecked(charSpace == 4); + ui->radioButtonCharSpace5Pixel->setChecked(charSpace == 5); +} diff --git a/DialogLineSpace.h b/DialogLineSpace.h index 5dc72aa..8f43448 100644 --- a/DialogLineSpace.h +++ b/DialogLineSpace.h @@ -1,24 +1,24 @@ -#ifndef DIALOGLINESPACE_H -#define DIALOGLINESPACE_H - -#include - -namespace Ui { -class DialogLineSpace; -} - -class DialogLineSpace : public QDialog -{ - Q_OBJECT - -public: - explicit DialogLineSpace(QWidget *parent = 0); - ~DialogLineSpace(); - void getValue(int *lineSpace,int *charSpace); - void setValue(int lineSpace,int charSpace); - -private: - Ui::DialogLineSpace *ui; -}; - -#endif // DIALOGLINESPACE_H +#ifndef DIALOGLINESPACE_H +#define DIALOGLINESPACE_H + +#include + +namespace Ui { +class DialogLineSpace; +} + +class DialogLineSpace : public QDialog +{ + Q_OBJECT + +public: + explicit DialogLineSpace(QWidget *parent = 0); + ~DialogLineSpace(); + void getValue(int *lineSpace,int *charSpace); + void setValue(int lineSpace,int charSpace); + +private: + Ui::DialogLineSpace *ui; +}; + +#endif // DIALOGLINESPACE_H diff --git a/DialogSaveFile.cpp b/DialogSaveFile.cpp index cf94d06..7a1e2e1 100644 --- a/DialogSaveFile.cpp +++ b/DialogSaveFile.cpp @@ -1,239 +1,239 @@ -#include "DialogSaveFile.h" -#include "ui_dialogsavefile.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include"HtmlDelegate.h" -#include -#include -#include - -DialogSaveFile::DialogSaveFile(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogSaveFile) -{ - ui->setupUi(this); - this->setWindowTitle(tr("保存")); - ui->textEditView->setReadOnly(true); - ui->textEditView->setLineWrapMode(QTextEdit::NoWrap); - ui->textEditView->document()->setDocumentMargin(0); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - EditMode=4; -#ifdef EnableArabic - setFileNameFlag=false; -#endif -} - -void DialogSaveFile::refreshListView(int mode){ - - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; - QDir dir(dirPath); - QStringList filters; - EditMode = mode; - if(mode == TXTFILE) filters << "*.html" << "*.txt" << "*.TXT" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"; // txtmode - else if(mode == PICFILE) filters << "*.png";// <<"*.jpg" ; // picmode - else if(mode == SCENE) filters << "*.xml";// scene mode - else filters << "*.html" << "*.bmp" << "*.BMP" <<"*.jpg"<<"*.gif"; - dir.setNameFilters(filters); - dir.setFilter(QDir::Files); -#ifndef EnableArabic - QStringListModel *model = new QStringListModel(dir.entryList()); -#else - QStringList entries=dir.entryList(); - QStandardItemModel *model = new QStandardItemModel(); - for(int i=0;i%1%2").arg(subname).arg(subsuffix2); - QStandardItem *item2 = new QStandardItem(stringhtml); - model->appendRow(item2); - } - }else{ - model->appendRow(item1); - } - } - } - ui->listViewFile->setItemDelegate(new HtmlDelegate); -#endif - - ui->listViewFile->setEditTriggers(QAbstractItemView::NoEditTriggers); - ui->listViewFile->setModel(model); //useList是个QListView - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index(0 , 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } - -#ifdef EnableArabic - QFont font; - if(!setFileNameFlag){ - font.setFamily("biyang"); - ui->lineEdit->setFont(font); - }else { - font.setFamily("biyangarabic"); - ui->lineEdit->setFont(font); - } -#endif -} - - -DialogSaveFile::~DialogSaveFile() -{ - delete ui; -} - -void DialogSaveFile::on_listViewFile_entered(const QModelIndex &index) -{ -#ifdef EnableArabic - QFont font; - QString fileName=index.data().toString(); - if(fileName.endsWith("")){ - QTextDocument doc; - doc.setHtml(fileName); - fileName= doc.toPlainText(); - font.setFamily("biyangarabic"); - ui->lineEdit->setFont(font); - ui->lineEdit->setText(QString(QFileInfo(fileName).baseName())); - int position = fileName.lastIndexOf("."); - fileName.insert(position,".a"); - }else{ - font.setFamily("biyang"); - ui->lineEdit->setFont(font); - ui->lineEdit->setText( QFileInfo(fileName).baseName() ); - } -#endif - - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; -#ifndef EnableArabic - QString filePath = dirPath + index.data().toString(); -#else - QString filePath = dirPath + fileName; -#endif - if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") || - filePath.endsWith(".png") || filePath.endsWith(".bmp")|| filePath.endsWith(".BMP")|| filePath.endsWith(".nda")){ - ui->textEditView->clear(); - ui->textEditView->setHtml(QString("").arg(filePath)); - } - else { - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) - return ; - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - if (Qt::mightBeRichText(str)) { - if(!ui->radioButtonLocal->isChecked()) - str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //必须替换相应的路径 - ui->textEditView->setHtml(str); - } else { - str = QString::fromLocal8Bit(data); - ui->textEditView->setPlainText(str); - } - } -#ifndef EnableArabic - ui->lineEdit->setText( QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName() ); -#endif -} -void DialogSaveFile::on_listViewFile_clicked(const QModelIndex &index) -{ - on_listViewFile_entered(index); -} - -void DialogSaveFile::on_pushButtonNext_pressed() -{ - QModelIndex currIndex = ui->listViewFile->currentIndex(); - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index((currIndex.row() + 1)%count, 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } - ui->lineEdit->setText(QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName()); -} - -void DialogSaveFile::on_pushButtonLast_pressed() -{ - QModelIndex currIndex = ui->listViewFile->currentIndex(); - int count = ui->listViewFile->model()->rowCount(); - if(count){ - QModelIndex index = ui->listViewFile->model()->index(currIndex.row() == 0?(count - 1):(currIndex.row() - 1), 0); - ui->listViewFile->setCurrentIndex(index); - on_listViewFile_entered(index); - } - ui->lineEdit->setText(QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName()); -} - -void DialogSaveFile::on_pushButtonExit_pressed() -{ - hide(); -} -//void DialogSaveFile::on_lostfocuse_pressed() -//{ -// hide(); -//} -void DialogSaveFile::on_pushButtonSave_clicked() -{ - QModelIndex index = ui->listViewFile->currentIndex(); - QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; - //QString filePath = dirPath + index.data().toString(); - QString filePath = dirPath + ui->lineEdit->text();// index.data().toString(); -#ifdef EnableArabic - if(setFileNameFlag){ - filePath = dirPath + ui->lineEdit->text()+".a"; - } -#endif - emit saveFile(filePath,false); - hide(); -} - -void DialogSaveFile::on_radioButtonLocal_released() -{ - refreshListView(EditMode); -} - -void DialogSaveFile::on_radioButtonUdisk_released() -{ - - QDir dir(UDISK_DOC_ROOT_DIR); - if(!dir.exists()){ - QMessageBox::warning(0,tr("警告"),tr("U盘未插入或U盘根目录下的doc文件夹不存在!")); - } - refreshListView(EditMode); -} -void DialogSaveFile::setEnterFileName(QString strFile) -{ - ui->lineEdit->setText(strFile); - //ui->lineEdit->setFocus(); -} -void DialogSaveFile::setTitleTxt(QString str) -{ - setWindowTitle(str); -} - -#ifdef EnableArabic -void DialogSaveFile::setFileNameEnglishOrArabic(bool flag){ - QFont font; - setFileNameFlag=flag; - //qDebug()<<"setFileNameFlag :"<lineEdit->setFont(font); -} -#endif +#include "DialogSaveFile.h" +#include "ui_dialogsavefile.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include"HtmlDelegate.h" +#include +#include +#include + +DialogSaveFile::DialogSaveFile(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogSaveFile) +{ + ui->setupUi(this); + this->setWindowTitle(tr("保存")); + ui->textEditView->setReadOnly(true); + ui->textEditView->setLineWrapMode(QTextEdit::NoWrap); + ui->textEditView->document()->setDocumentMargin(0); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + EditMode=4; +#ifdef EnableArabic + setFileNameFlag=false; +#endif +} + +void DialogSaveFile::refreshListView(int mode){ + + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; + QDir dir(dirPath); + QStringList filters; + EditMode = mode; + if(mode == TXTFILE) filters << "*.html" << "*.txt" << "*.TXT" << "*.jpeg" << "*.gif" << "*.jpg" << "*.bmp"<< "*.BMP"; // txtmode + else if(mode == PICFILE) filters << "*.png";// <<"*.jpg" ; // picmode + else if(mode == SCENE) filters << "*.xml";// scene mode + else filters << "*.html" << "*.bmp" << "*.BMP" <<"*.jpg"<<"*.gif"; + dir.setNameFilters(filters); + dir.setFilter(QDir::Files); +#ifndef EnableArabic + QStringListModel *model = new QStringListModel(dir.entryList()); +#else + QStringList entries=dir.entryList(); + QStandardItemModel *model = new QStandardItemModel(); + for(int i=0;i%1%2").arg(subname).arg(subsuffix2); + QStandardItem *item2 = new QStandardItem(stringhtml); + model->appendRow(item2); + } + }else{ + model->appendRow(item1); + } + } + } + ui->listViewFile->setItemDelegate(new HtmlDelegate); +#endif + + ui->listViewFile->setEditTriggers(QAbstractItemView::NoEditTriggers); + ui->listViewFile->setModel(model); //useList是个QListView + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index(0 , 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } + +#ifdef EnableArabic + QFont font; + if(!setFileNameFlag){ + font.setFamily("biyang"); + ui->lineEdit->setFont(font); + }else { + font.setFamily("biyangarabic"); + ui->lineEdit->setFont(font); + } +#endif +} + + +DialogSaveFile::~DialogSaveFile() +{ + delete ui; +} + +void DialogSaveFile::on_listViewFile_entered(const QModelIndex &index) +{ +#ifdef EnableArabic + QFont font; + QString fileName=index.data().toString(); + if(fileName.endsWith("")){ + QTextDocument doc; + doc.setHtml(fileName); + fileName= doc.toPlainText(); + font.setFamily("biyangarabic"); + ui->lineEdit->setFont(font); + ui->lineEdit->setText(QString(QFileInfo(fileName).baseName())); + int position = fileName.lastIndexOf("."); + fileName.insert(position,".a"); + }else{ + font.setFamily("biyang"); + ui->lineEdit->setFont(font); + ui->lineEdit->setText( QFileInfo(fileName).baseName() ); + } +#endif + + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; +#ifndef EnableArabic + QString filePath = dirPath + index.data().toString(); +#else + QString filePath = dirPath + fileName; +#endif + if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") || + filePath.endsWith(".png") || filePath.endsWith(".bmp")|| filePath.endsWith(".BMP")|| filePath.endsWith(".nda")){ + ui->textEditView->clear(); + ui->textEditView->setHtml(QString("").arg(filePath)); + } + else { + QFile file(filePath); + if (!file.open(QFile::ReadOnly)) + return ; + QByteArray data = file.readAll(); + QTextCodec *codec = Qt::codecForHtml(data); + QString str = codec->toUnicode(data); + if (Qt::mightBeRichText(str)) { + if(!ui->radioButtonLocal->isChecked()) + str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //必须替换相应的路径 + ui->textEditView->setHtml(str); + } else { + str = QString::fromLocal8Bit(data); + ui->textEditView->setPlainText(str); + } + } +#ifndef EnableArabic + ui->lineEdit->setText( QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName() ); +#endif +} +void DialogSaveFile::on_listViewFile_clicked(const QModelIndex &index) +{ + on_listViewFile_entered(index); +} + +void DialogSaveFile::on_pushButtonNext_pressed() +{ + QModelIndex currIndex = ui->listViewFile->currentIndex(); + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index((currIndex.row() + 1)%count, 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } + ui->lineEdit->setText(QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName()); +} + +void DialogSaveFile::on_pushButtonLast_pressed() +{ + QModelIndex currIndex = ui->listViewFile->currentIndex(); + int count = ui->listViewFile->model()->rowCount(); + if(count){ + QModelIndex index = ui->listViewFile->model()->index(currIndex.row() == 0?(count - 1):(currIndex.row() - 1), 0); + ui->listViewFile->setCurrentIndex(index); + on_listViewFile_entered(index); + } + ui->lineEdit->setText(QFileInfo(ui->listViewFile->currentIndex().data().toString()).baseName()); +} + +void DialogSaveFile::on_pushButtonExit_pressed() +{ + hide(); +} +//void DialogSaveFile::on_lostfocuse_pressed() +//{ +// hide(); +//} +void DialogSaveFile::on_pushButtonSave_clicked() +{ + QModelIndex index = ui->listViewFile->currentIndex(); + QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR; + //QString filePath = dirPath + index.data().toString(); + QString filePath = dirPath + ui->lineEdit->text();// index.data().toString(); +#ifdef EnableArabic + if(setFileNameFlag){ + filePath = dirPath + ui->lineEdit->text()+".a"; + } +#endif + emit saveFile(filePath,false); + hide(); +} + +void DialogSaveFile::on_radioButtonLocal_released() +{ + refreshListView(EditMode); +} + +void DialogSaveFile::on_radioButtonUdisk_released() +{ + + QDir dir(UDISK_DOC_ROOT_DIR); + if(!dir.exists()){ + QMessageBox::warning(0,tr("警告"),tr("U盘未插入或U盘根目录下的doc文件夹不存在!")); + } + refreshListView(EditMode); +} +void DialogSaveFile::setEnterFileName(QString strFile) +{ + ui->lineEdit->setText(strFile); + //ui->lineEdit->setFocus(); +} +void DialogSaveFile::setTitleTxt(QString str) +{ + setWindowTitle(str); +} + +#ifdef EnableArabic +void DialogSaveFile::setFileNameEnglishOrArabic(bool flag){ + QFont font; + setFileNameFlag=flag; + //qDebug()<<"setFileNameFlag :"<lineEdit->setFont(font); +} +#endif diff --git a/DialogSaveFile.h b/DialogSaveFile.h index da2399a..7836094 100644 --- a/DialogSaveFile.h +++ b/DialogSaveFile.h @@ -1,54 +1,54 @@ -#ifndef DialogSaveFile_H -#define DialogSaveFile_H - -#include -#include "DialogSaveFile.h" -#include -#include "myinclude.h" -namespace Ui { -class DialogSaveFile; -} - -class DialogSaveFile : public QDialog -{ - Q_OBJECT - -public: - explicit DialogSaveFile(QWidget *parent = 0); - ~DialogSaveFile(); - void refreshListView(int mode); - int EditMode; - void setEnterFileName(QString strFile); - void setTitleTxt(QString str); -#ifdef EnableArabic - void setFileNameEnglishOrArabic(bool flag); -#endif -private slots: - - - void on_pushButtonNext_pressed(); - void on_pushButtonLast_pressed(); - void on_pushButtonExit_pressed(); - void on_pushButtonSave_clicked(); - void on_radioButtonLocal_released(); - void on_radioButtonUdisk_released(); - void on_listViewFile_entered(const QModelIndex &index); - void on_listViewFile_clicked(const QModelIndex &index); -Q_SIGNALS: - void saveFile(QString filePath,bool Flag); -private: - Ui::DialogSaveFile *ui; -#ifdef EnableArabic - bool setFileNameFlag; -#endif -}; - -#endif // DialogSaveFile_H - - - - - - - - +#ifndef DialogSaveFile_H +#define DialogSaveFile_H + +#include +#include "DialogSaveFile.h" +#include +#include "myinclude.h" +namespace Ui { +class DialogSaveFile; +} + +class DialogSaveFile : public QDialog +{ + Q_OBJECT + +public: + explicit DialogSaveFile(QWidget *parent = 0); + ~DialogSaveFile(); + void refreshListView(int mode); + int EditMode; + void setEnterFileName(QString strFile); + void setTitleTxt(QString str); +#ifdef EnableArabic + void setFileNameEnglishOrArabic(bool flag); +#endif +private slots: + + + void on_pushButtonNext_pressed(); + void on_pushButtonLast_pressed(); + void on_pushButtonExit_pressed(); + void on_pushButtonSave_clicked(); + void on_radioButtonLocal_released(); + void on_radioButtonUdisk_released(); + void on_listViewFile_entered(const QModelIndex &index); + void on_listViewFile_clicked(const QModelIndex &index); +Q_SIGNALS: + void saveFile(QString filePath,bool Flag); +private: + Ui::DialogSaveFile *ui; +#ifdef EnableArabic + bool setFileNameFlag; +#endif +}; + +#endif // DialogSaveFile_H + + + + + + + + diff --git a/DigitalInput.cpp b/DigitalInput.cpp index 3dfc3f2..bfbe586 100644 --- a/DigitalInput.cpp +++ b/DigitalInput.cpp @@ -1,76 +1,76 @@ -#include "DigitalInput.h" -#include "ui_digitalinput.h" -#include "MyInputMethod.h" -#include -#include -DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) : - QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)), - ui(new Ui::DigitalInput) -{ - ui->setupUi(this); - this->myInputMethod = myInputMethod; - - connect(ui->Key_0,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_1,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_2,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_3,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_4,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_5,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_6,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_7,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_8,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_9,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_pluse,SIGNAL(pressed()),this,SLOT(onCharPressed())); - connect(ui->Key_backspace,SIGNAL(pressed()),this,SLOT(onKeyBackspacePressed())); - connect(ui->Key_selectAll,SIGNAL(pressed()),this,SLOT(onKeySelectAllPressed())); - connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed())); - connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed())); -} - -DigitalInput::~DigitalInput() -{ - delete ui; -} - - -void DigitalInput::onCharPressed(){ - QPushButton * button = qobject_cast(sender()); - QString text = button->text(); - myInputMethod->sendString (text); -} - -void DigitalInput::onKeyBackspacePressed(){ -#ifndef Q_OS_WIN32 -//QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ - MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); -#endif - -} - -void DigitalInput::onKeySelectAllPressed(){ - //static int init = 0; -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ - //if(!init) - // QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ - //init = 1; - -MyInputMethod::sendEvent(Qt::Key_A, Qt::ControlModifier); -#endif - - -} -void DigitalInput::onKeyUpPressed(){ -#ifndef Q_OS_WIN32 -//QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ - MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); -#endif -} -void DigitalInput::onKeyDownPressed(){ -#ifndef Q_OS_WIN32 -//QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ - MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); -#endif -} - - +#include "DigitalInput.h" +#include "ui_digitalinput.h" +#include "MyInputMethod.h" +#include +#include +DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) : + QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)), + ui(new Ui::DigitalInput) +{ + ui->setupUi(this); + this->myInputMethod = myInputMethod; + + connect(ui->Key_0,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_1,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_2,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_3,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_4,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_5,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_6,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_7,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_8,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_9,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_pluse,SIGNAL(pressed()),this,SLOT(onCharPressed())); + connect(ui->Key_backspace,SIGNAL(pressed()),this,SLOT(onKeyBackspacePressed())); + connect(ui->Key_selectAll,SIGNAL(pressed()),this,SLOT(onKeySelectAllPressed())); + connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed())); + connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed())); +} + +DigitalInput::~DigitalInput() +{ + delete ui; +} + + +void DigitalInput::onCharPressed(){ + QPushButton * button = qobject_cast(sender()); + QString text = button->text(); + myInputMethod->sendString (text); +} + +void DigitalInput::onKeyBackspacePressed(){ +#ifndef Q_OS_WIN32 +//QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ + MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); +#endif + +} + +void DigitalInput::onKeySelectAllPressed(){ + //static int init = 0; +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ + //if(!init) + // QWSServer::sendKeyEvent(0,Qt::Key_A,Qt::ControlModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ + //init = 1; + +MyInputMethod::sendEvent(Qt::Key_A, Qt::ControlModifier); +#endif + + +} +void DigitalInput::onKeyUpPressed(){ +#ifndef Q_OS_WIN32 +//QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ + MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); +#endif +} +void DigitalInput::onKeyDownPressed(){ +#ifndef Q_OS_WIN32 +//QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //Ïòϵͳ·¢ËͼüÅÌʼþ + MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); +#endif +} + + diff --git a/DigitalInput.h b/DigitalInput.h index 12e8264..c3bd60c 100644 --- a/DigitalInput.h +++ b/DigitalInput.h @@ -1,33 +1,33 @@ -#ifndef DIGITALINPUT_H -#define DIGITALINPUT_H - -#include -class MyInputMethod; -namespace Ui { -class DigitalInput; -} - -class DigitalInput : public QWidget -{ - Q_OBJECT - -public: - explicit DigitalInput(MyInputMethod *myInputMethod,QWidget *parent = 0); - ~DigitalInput(); - - -private slots: - void onCharPressed(); - void onKeyBackspacePressed(); - void onKeySelectAllPressed(); - void onKeyUpPressed(); - void onKeyDownPressed(); - - -private: - Ui::DigitalInput *ui; - - MyInputMethod *myInputMethod; -}; - -#endif // DIGITALINPUT_H +#ifndef DIGITALINPUT_H +#define DIGITALINPUT_H + +#include +class MyInputMethod; +namespace Ui { +class DigitalInput; +} + +class DigitalInput : public QWidget +{ + Q_OBJECT + +public: + explicit DigitalInput(MyInputMethod *myInputMethod,QWidget *parent = 0); + ~DigitalInput(); + + +private slots: + void onCharPressed(); + void onKeyBackspacePressed(); + void onKeySelectAllPressed(); + void onKeyUpPressed(); + void onKeyDownPressed(); + + +private: + Ui::DigitalInput *ui; + + MyInputMethod *myInputMethod; +}; + +#endif // DIGITALINPUT_H diff --git a/DlgVoltePara25Dots.cpp b/DlgVoltePara25Dots.cpp index c9ce94f..5c0a938 100644 --- a/DlgVoltePara25Dots.cpp +++ b/DlgVoltePara25Dots.cpp @@ -1,391 +1,391 @@ -#include "DlgVoltePara25Dots.h" -#include "DevOp.h" -#include -#include - -DlgVoltePara25Dots::DlgVoltePara25Dots(DevOp *devOp, QWidget *parent) - : QDialog(parent) - , m_devOp(devOp) -{ - memset(editContinuous, 0, sizeof(editContinuous)); - memset(editRowDelay, 0, sizeof(editRowDelay)); - memset(editHead1RowDelay, 0, sizeof(editHead1RowDelay)); - memset(editSingleDot, 0, sizeof(editSingleDot)); - memset(edit1Dot, 0, sizeof(edit1Dot)); - memset(edit2Dots, 0, sizeof(edit2Dots)); - memset(edit3Dots, 0, sizeof(edit3Dots)); - memset(edit4Dots, 0, sizeof(edit4Dots)); - memset(edit5Dots, 0, sizeof(edit5Dots)); - memset(editDiff, 0, sizeof(editDiff)); - memset(editGiant, 0, sizeof(editGiant)); - memset(editAdjustPara, 0, sizeof(editAdjustPara)); - - setupUI(); -} - -DlgVoltePara25Dots::~DlgVoltePara25Dots() -{ -} - -// 创建4列×16行网格布局的tab页(竖排: v0~v15第1列, v16~v31第2列, ...) -QWidget* DlgVoltePara25Dots::createGridTab(int count, QLineEdit* edits[], int numCols) -{ - QWidget *page = new QWidget(this); - QGridLayout *grid = new QGridLayout(page); - grid->setSpacing(2); - grid->setContentsMargins(4, 4, 4, 4); - - int rowsPerCol = (count + numCols - 1) / numCols; - - for (int i = 0; i < count; i++) { - int col = i / rowsPerCol; - int row = i % rowsPerCol; - - QLabel *label = new QLabel(QString("v%1").arg(i), page); - label->setFixedWidth(28); - label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - - QLineEdit *edit = new QLineEdit("0", page); - edit->setAlignment(Qt::AlignCenter); - edits[i] = edit; - - grid->addWidget(label, row, col * 2); - grid->addWidget(edit, row, col * 2 + 1); - } - - for (int c = 0; c < numCols; c++) { - grid->setColumnStretch(c * 2, 0); - grid->setColumnStretch(c * 2 + 1, 1); - } - - return page; -} - -void DlgVoltePara25Dots::setupUI() -{ - setWindowTitle(QString("25点阵充电参数编辑")); - //setFixedSize(750, 500); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setContentsMargins(4, 4, 4, 4); - mainLayout->setSpacing(4); - - tabWidget = new QTabWidget(this); - - // 基本tab - tabWidget->addTab(createGridTab(64, editContinuous), QString("连续电压")); - tabWidget->addTab(createGridTab(64, editRowDelay), QString("点延迟")); - tabWidget->addTab(createGridTab(64, editHead1RowDelay), QString("首1点延迟")); - - // 通用参数 - tabWidget->addTab(createGridTab(8, editAdjustPara), QString("通用参数")); - - tabWidget->addTab(createGridTab(64, editSingleDot), QString("单点")); - tabWidget->addTab(createGridTab(64, edit1Dot), QString("一点")); - tabWidget->addTab(createGridTab(64, edit2Dots), QString("两点")); - tabWidget->addTab(createGridTab(64, edit3Dots), QString("三点")); - tabWidget->addTab(createGridTab(64, edit4Dots), QString("四点")); - tabWidget->addTab(createGridTab(64, edit5Dots), QString("五点")); - - - // 巨点补偿:16组,分4个tab(5,5,5,1组) - // 前3个tab:流式切分[5][64]=320值÷5=64个lineEdit - // 第4个tab:流式切分[1][64]=64值÷5=13个lineEdit(最后一个放4个值) - int giantEditCount[4] = {64, 64, 64, 13}; - for (int t = 0; t < 4; t++) { - tabWidget->addTab(createGridTab(giantEditCount[t], editGiant[t]), - QString("巨点补偿%1").arg(t + 1)); - } - - // 差分补偿:50组÷5=10个tab,每个tab 64通道,每个lineEdit放5个逗号分隔值 - static const char* diffTabNames[10] = { - "1点隔1-5点差", "1点隔6-10点差", - "2点隔1-5点差", "2点隔6-10点差", - "3点隔1-5点差", "3点隔6-10点差", - "4点隔1-5点差", "4点隔6-10点差", - "5点隔1-5点差", "5点隔6-10点差" - }; - for (int t = 0; t < 10; t++) { - tabWidget->addTab(createGridTab(64, editDiff[t], 5), - QString(diffTabNames[t])); - } - - mainLayout->addWidget(tabWidget); - - // 底部按钮栏 - QHBoxLayout *btnLayout = new QHBoxLayout(); - btnLoad = new QPushButton(QString("读取当前值"), this); - btnSave = new QPushButton(QString("保存并推送FPGA"), this); - btnLoad->setMinimumHeight(40); - btnSave->setMinimumHeight(40); - btnLayout->addWidget(btnLoad); - btnLayout->addStretch(); - btnLayout->addWidget(btnSave); - mainLayout->addLayout(btnLayout); - - connect(btnLoad, SIGNAL(clicked()), this, SLOT(onBtnLoadClicked())); - connect(btnSave, SIGNAL(clicked()), this, SLOT(onBtnSaveClicked())); -} - -// ========== 数据加载:结构体 → UI ========== - -void DlgVoltePara25Dots::loadDataToUI() -{ - if (!sysPara) return; - - voltePara_t_25Dots &data = sysPara->voltePara_25Dots; - - // 连续电压(单值) - for (int i = 0; i < 64; i++) - editContinuous[i]->setText(QString::number(data.matchContinousDACArray[i])); - - // 点延迟(单值) - for (int i = 0; i < 64; i++) - editRowDelay[i]->setText(QString::number(data.matchExtraLineDACArray[i])); - - // 首1点延迟(有符号) - for (int i = 0; i < 64; i++) - editHead1RowDelay[i]->setText(QString::number((qint8)data.matchFirstOnePointExtraLineDACArray[i])); - - // 单点(首1) - for (int i = 0; i < 64; i++) - editSingleDot[i]->setText(QString::number(data.matchTotalTableDACArrayFirst1[i])); - - // 一点 - for (int i = 0; i < 64; i++) - edit1Dot[i]->setText(QString::number(data.matchTotalTableDACArray1[i])); - - // 两点(2值逗号分隔) - for (int i = 0; i < 64; i++) { - edit2Dots[i]->setText(QString("%1,%2") - .arg(data.matchTotalTableDACArray2[i][0]) - .arg(data.matchTotalTableDACArray2[i][1])); - } - - // 三点(3值逗号分隔) - for (int i = 0; i < 64; i++) { - edit3Dots[i]->setText(QString("%1,%2,%3") - .arg(data.matchTotalTableDACArray3[i][0]) - .arg(data.matchTotalTableDACArray3[i][1]) - .arg(data.matchTotalTableDACArray3[i][2])); - } - - // 四点(4值逗号分隔) - for (int i = 0; i < 64; i++) { - edit4Dots[i]->setText(QString("%1,%2,%3,%4") - .arg(data.matchTotalTableDACArray4[i][0]) - .arg(data.matchTotalTableDACArray4[i][1]) - .arg(data.matchTotalTableDACArray4[i][2]) - .arg(data.matchTotalTableDACArray4[i][3])); - } - - // 五点(5值逗号分隔) - for (int i = 0; i < 64; i++) { - edit5Dots[i]->setText(QString("%1,%2,%3,%4,%5") - .arg(data.matchTotalTableDACArray5[i][0]) - .arg(data.matchTotalTableDACArray5[i][1]) - .arg(data.matchTotalTableDACArray5[i][2]) - .arg(data.matchTotalTableDACArray5[i][3]) - .arg(data.matchTotalTableDACArray5[i][4])); - } - - // 差分补偿:matchTotalDiffVoltageValue[50][64] - // 每5组一个tab,把[5][64]=320个值按内存顺序展平,每5个连续值放一个lineEdit,共64个lineEdit - // 与oldProject的Load_voltage_diff逻辑一致 - for (int t = 0; t < 10; t++) { - int k = 0; // 当前lineEdit内已累积的值计数(1~5) - int num = 0; // 当前lineEdit序号 - QString strTemp; - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 64; j++) { - k++; - if (k < 5) { - strTemp += QString::number((qint8)data.matchTotalDiffVoltageValue[t * 5 + i][j]); - strTemp += ","; - } else { - strTemp += QString::number((qint8)data.matchTotalDiffVoltageValue[t * 5 + i][j]); - editDiff[t][num]->setText(strTemp); - strTemp = ""; - k = 0; - num++; - } - } - } - } - - // 巨点补偿:matchGiantPointVoltageValue[16][64] - // 与oldProject一致:流式切分,前3个tab用Load_voltage_diff逻辑,第4个tab用Load_voltage_giant逻辑 - { - int giantGroupsPerTab[4] = {5, 5, 5, 1}; - int giantOffset = 0; - for (int t = 0; t < 4; t++) { - int groups = giantGroupsPerTab[t]; - int k = 0; - int num = 0; - QString strTemp; - for (int i = 0; i < groups; i++) { - for (int j = 0; j < 64; j++) { - k++; - if (k < 5) { - strTemp += QString::number((qint8)data.matchGiantPointVoltageValue[giantOffset + i][j]); - strTemp += ","; - // 第4个tab特殊处理:最后一个值时不足5个也要输出 - if (t == 3 && i == groups - 1 && j == 63) { - strTemp.chop(1); // 去掉末尾逗号 - editGiant[t][num]->setText(strTemp); - } - } else { - strTemp += QString::number((qint8)data.matchGiantPointVoltageValue[giantOffset + i][j]); - editGiant[t][num]->setText(strTemp); - strTemp = ""; - k = 0; - num++; - } - } - } - giantOffset += groups; - } - } - - // 通用参数 - for (int i = 0; i < 8; i++) - editAdjustPara[i]->setText(QString::number((qint8)data.matchAdjustParaDACArray[i])); -} - -// ========== 数据保存:UI → 结构体 ========== - -void DlgVoltePara25Dots::saveDataFromUI() -{ - if (!sysPara) return; - - voltePara_t_25Dots &data = sysPara->voltePara_25Dots; - - // 连续电压 - for (int i = 0; i < 64; i++) - data.matchContinousDACArray[i] = (quint16)editContinuous[i]->text().toUInt(); - - // 点延迟 - for (int i = 0; i < 64; i++) - data.matchExtraLineDACArray[i] = (quint8)editRowDelay[i]->text().toUInt(); - - // 首1点延迟 - for (int i = 0; i < 64; i++) - data.matchFirstOnePointExtraLineDACArray[i] = (qint8)editHead1RowDelay[i]->text().toInt(); - - // 单点(首1) - for (int i = 0; i < 64; i++) - data.matchTotalTableDACArrayFirst1[i] = (quint16)editSingleDot[i]->text().toUInt(); - - // 一点 - for (int i = 0; i < 64; i++) - data.matchTotalTableDACArray1[i] = (quint16)edit1Dot[i]->text().toUInt(); - - // 两点 - for (int i = 0; i < 64; i++) { - QStringList parts = edit2Dots[i]->text().split(","); - for (int j = 0; j < 2; j++) - data.matchTotalTableDACArray2[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; - } - - // 三点 - for (int i = 0; i < 64; i++) { - QStringList parts = edit3Dots[i]->text().split(","); - for (int j = 0; j < 3; j++) - data.matchTotalTableDACArray3[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; - } - - // 四点 - for (int i = 0; i < 64; i++) { - QStringList parts = edit4Dots[i]->text().split(","); - for (int j = 0; j < 4; j++) - data.matchTotalTableDACArray4[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; - } - - // 五点 - for (int i = 0; i < 64; i++) { - QStringList parts = edit5Dots[i]->text().split(","); - for (int j = 0; j < 5; j++) - data.matchTotalTableDACArray5[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; - } - - // 差分补偿:与oldProject的Save_voltage_diff逻辑一致 - // 每个tab的64个lineEdit各含5个逗号分隔值,展平后按内存顺序写回[5][64] - for (int t = 0; t < 10; t++) { - // 先把64个lineEdit的值全部拼成一个大列表(320个值) - QStringList allValues; - for (int num = 0; num < 64; num++) { - QStringList parts = editDiff[t][num]->text().split(","); - allValues.append(parts); - } - // 按内存顺序写回 [5][64] - int idx = 0; - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 64; j++) { - data.matchTotalDiffVoltageValue[t * 5 + i][j] = - idx < allValues.size() ? (qint8)allValues[idx].toInt() : 0; - idx++; - } - } - } - - // 巨点补偿:与oldProject一致,流式反解析 - { - int giantGroupsPerTab[4] = {5, 5, 5, 1}; - int giantEditCount[4] = {64, 64, 64, 13}; - int giantOffset = 0; - for (int t = 0; t < 4; t++) { - int groups = giantGroupsPerTab[t]; - // 把所有lineEdit的值拼成一个大列表 - QStringList allValues; - for (int num = 0; num < giantEditCount[t]; num++) { - QStringList parts = editGiant[t][num]->text().split(","); - allValues.append(parts); - } - // 按内存顺序写回 [groups][64] - int idx = 0; - for (int i = 0; i < groups; i++) { - for (int j = 0; j < 64; j++) { - data.matchGiantPointVoltageValue[giantOffset + i][j] = - idx < allValues.size() ? (qint8)allValues[idx].toInt() : 0; - idx++; - } - } - giantOffset += groups; - } - } - - // 通用参数 - for (int i = 0; i < 8; i++) - data.matchAdjustParaDACArray[i] = (qint8)editAdjustPara[i]->text().toInt(); -} - -// ========== 按钮槽函数 ========== - -void DlgVoltePara25Dots::onBtnLoadClicked() -{ - loadDataToUI(); -} - -void DlgVoltePara25Dots::onBtnSaveClicked() -{ - saveDataFromUI(); - - if (m_devOp) { - m_devOp->writeDacValue2Fpga_No72NewVoltData(); - } - - QFile file(DOC_ROOT_DIR"VoltDataStd25.bin"); - if(!file.open(QIODevice::WriteOnly)) { - QMessageBox::information(this, QString("注意"), QString("充电数据已经写入FPGA, 但是没有保存到文件。")); - return; - } - - int written = file.write((const char*)&(sysPara->voltePara_25Dots), sizeof(voltePara_t_25Dots)); - file.close(); - - if(written != sizeof(voltePara_t_25Dots)) { - LogInfo::setRunStatusText("写入文件VoltDataStd25.bin失败"); - } - - QMessageBox::information(this, QString("完成"), QString("充电参数已保存并推送至FPGA。")); -} +#include "DlgVoltePara25Dots.h" +#include "DevOp.h" +#include +#include + +DlgVoltePara25Dots::DlgVoltePara25Dots(DevOp *devOp, QWidget *parent) + : QDialog(parent) + , m_devOp(devOp) +{ + memset(editContinuous, 0, sizeof(editContinuous)); + memset(editRowDelay, 0, sizeof(editRowDelay)); + memset(editHead1RowDelay, 0, sizeof(editHead1RowDelay)); + memset(editSingleDot, 0, sizeof(editSingleDot)); + memset(edit1Dot, 0, sizeof(edit1Dot)); + memset(edit2Dots, 0, sizeof(edit2Dots)); + memset(edit3Dots, 0, sizeof(edit3Dots)); + memset(edit4Dots, 0, sizeof(edit4Dots)); + memset(edit5Dots, 0, sizeof(edit5Dots)); + memset(editDiff, 0, sizeof(editDiff)); + memset(editGiant, 0, sizeof(editGiant)); + memset(editAdjustPara, 0, sizeof(editAdjustPara)); + + setupUI(); +} + +DlgVoltePara25Dots::~DlgVoltePara25Dots() +{ +} + +// 创建4列×16行网格布局的tab页(竖排: v0~v15第1列, v16~v31第2列, ...) +QWidget* DlgVoltePara25Dots::createGridTab(int count, QLineEdit* edits[], int numCols) +{ + QWidget *page = new QWidget(this); + QGridLayout *grid = new QGridLayout(page); + grid->setSpacing(2); + grid->setContentsMargins(4, 4, 4, 4); + + int rowsPerCol = (count + numCols - 1) / numCols; + + for (int i = 0; i < count; i++) { + int col = i / rowsPerCol; + int row = i % rowsPerCol; + + QLabel *label = new QLabel(QString("v%1").arg(i), page); + label->setFixedWidth(28); + label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + + QLineEdit *edit = new QLineEdit("0", page); + edit->setAlignment(Qt::AlignCenter); + edits[i] = edit; + + grid->addWidget(label, row, col * 2); + grid->addWidget(edit, row, col * 2 + 1); + } + + for (int c = 0; c < numCols; c++) { + grid->setColumnStretch(c * 2, 0); + grid->setColumnStretch(c * 2 + 1, 1); + } + + return page; +} + +void DlgVoltePara25Dots::setupUI() +{ + setWindowTitle(QString("25点阵充电参数编辑")); + //setFixedSize(750, 500); + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setContentsMargins(4, 4, 4, 4); + mainLayout->setSpacing(4); + + tabWidget = new QTabWidget(this); + + // 基本tab + tabWidget->addTab(createGridTab(64, editContinuous), QString("连续电压")); + tabWidget->addTab(createGridTab(64, editRowDelay), QString("点延迟")); + tabWidget->addTab(createGridTab(64, editHead1RowDelay), QString("首1点延迟")); + + // 通用参数 + tabWidget->addTab(createGridTab(8, editAdjustPara), QString("通用参数")); + + tabWidget->addTab(createGridTab(64, editSingleDot), QString("单点")); + tabWidget->addTab(createGridTab(64, edit1Dot), QString("一点")); + tabWidget->addTab(createGridTab(64, edit2Dots), QString("两点")); + tabWidget->addTab(createGridTab(64, edit3Dots), QString("三点")); + tabWidget->addTab(createGridTab(64, edit4Dots), QString("四点")); + tabWidget->addTab(createGridTab(64, edit5Dots), QString("五点")); + + + // 巨点补偿:16组,分4个tab(5,5,5,1组) + // 前3个tab:流式切分[5][64]=320值÷5=64个lineEdit + // 第4个tab:流式切分[1][64]=64值÷5=13个lineEdit(最后一个放4个值) + int giantEditCount[4] = {64, 64, 64, 13}; + for (int t = 0; t < 4; t++) { + tabWidget->addTab(createGridTab(giantEditCount[t], editGiant[t]), + QString("巨点补偿%1").arg(t + 1)); + } + + // 差分补偿:50组÷5=10个tab,每个tab 64通道,每个lineEdit放5个逗号分隔值 + static const char* diffTabNames[10] = { + "1点隔1-5点差", "1点隔6-10点差", + "2点隔1-5点差", "2点隔6-10点差", + "3点隔1-5点差", "3点隔6-10点差", + "4点隔1-5点差", "4点隔6-10点差", + "5点隔1-5点差", "5点隔6-10点差" + }; + for (int t = 0; t < 10; t++) { + tabWidget->addTab(createGridTab(64, editDiff[t], 5), + QString(diffTabNames[t])); + } + + mainLayout->addWidget(tabWidget); + + // 底部按钮栏 + QHBoxLayout *btnLayout = new QHBoxLayout(); + btnLoad = new QPushButton(QString("读取当前值"), this); + btnSave = new QPushButton(QString("保存并推送FPGA"), this); + btnLoad->setMinimumHeight(40); + btnSave->setMinimumHeight(40); + btnLayout->addWidget(btnLoad); + btnLayout->addStretch(); + btnLayout->addWidget(btnSave); + mainLayout->addLayout(btnLayout); + + connect(btnLoad, SIGNAL(clicked()), this, SLOT(onBtnLoadClicked())); + connect(btnSave, SIGNAL(clicked()), this, SLOT(onBtnSaveClicked())); +} + +// ========== 数据加载:结构体 → UI ========== + +void DlgVoltePara25Dots::loadDataToUI() +{ + if (!sysPara) return; + + voltePara_t_25Dots &data = sysPara->voltePara_25Dots; + + // 连续电压(单值) + for (int i = 0; i < 64; i++) + editContinuous[i]->setText(QString::number(data.matchContinousDACArray[i])); + + // 点延迟(单值) + for (int i = 0; i < 64; i++) + editRowDelay[i]->setText(QString::number(data.matchExtraLineDACArray[i])); + + // 首1点延迟(有符号) + for (int i = 0; i < 64; i++) + editHead1RowDelay[i]->setText(QString::number((qint8)data.matchFirstOnePointExtraLineDACArray[i])); + + // 单点(首1) + for (int i = 0; i < 64; i++) + editSingleDot[i]->setText(QString::number(data.matchTotalTableDACArrayFirst1[i])); + + // 一点 + for (int i = 0; i < 64; i++) + edit1Dot[i]->setText(QString::number(data.matchTotalTableDACArray1[i])); + + // 两点(2值逗号分隔) + for (int i = 0; i < 64; i++) { + edit2Dots[i]->setText(QString("%1,%2") + .arg(data.matchTotalTableDACArray2[i][0]) + .arg(data.matchTotalTableDACArray2[i][1])); + } + + // 三点(3值逗号分隔) + for (int i = 0; i < 64; i++) { + edit3Dots[i]->setText(QString("%1,%2,%3") + .arg(data.matchTotalTableDACArray3[i][0]) + .arg(data.matchTotalTableDACArray3[i][1]) + .arg(data.matchTotalTableDACArray3[i][2])); + } + + // 四点(4值逗号分隔) + for (int i = 0; i < 64; i++) { + edit4Dots[i]->setText(QString("%1,%2,%3,%4") + .arg(data.matchTotalTableDACArray4[i][0]) + .arg(data.matchTotalTableDACArray4[i][1]) + .arg(data.matchTotalTableDACArray4[i][2]) + .arg(data.matchTotalTableDACArray4[i][3])); + } + + // 五点(5值逗号分隔) + for (int i = 0; i < 64; i++) { + edit5Dots[i]->setText(QString("%1,%2,%3,%4,%5") + .arg(data.matchTotalTableDACArray5[i][0]) + .arg(data.matchTotalTableDACArray5[i][1]) + .arg(data.matchTotalTableDACArray5[i][2]) + .arg(data.matchTotalTableDACArray5[i][3]) + .arg(data.matchTotalTableDACArray5[i][4])); + } + + // 差分补偿:matchTotalDiffVoltageValue[50][64] + // 每5组一个tab,把[5][64]=320个值按内存顺序展平,每5个连续值放一个lineEdit,共64个lineEdit + // 与oldProject的Load_voltage_diff逻辑一致 + for (int t = 0; t < 10; t++) { + int k = 0; // 当前lineEdit内已累积的值计数(1~5) + int num = 0; // 当前lineEdit序号 + QString strTemp; + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 64; j++) { + k++; + if (k < 5) { + strTemp += QString::number((qint8)data.matchTotalDiffVoltageValue[t * 5 + i][j]); + strTemp += ","; + } else { + strTemp += QString::number((qint8)data.matchTotalDiffVoltageValue[t * 5 + i][j]); + editDiff[t][num]->setText(strTemp); + strTemp = ""; + k = 0; + num++; + } + } + } + } + + // 巨点补偿:matchGiantPointVoltageValue[16][64] + // 与oldProject一致:流式切分,前3个tab用Load_voltage_diff逻辑,第4个tab用Load_voltage_giant逻辑 + { + int giantGroupsPerTab[4] = {5, 5, 5, 1}; + int giantOffset = 0; + for (int t = 0; t < 4; t++) { + int groups = giantGroupsPerTab[t]; + int k = 0; + int num = 0; + QString strTemp; + for (int i = 0; i < groups; i++) { + for (int j = 0; j < 64; j++) { + k++; + if (k < 5) { + strTemp += QString::number((qint8)data.matchGiantPointVoltageValue[giantOffset + i][j]); + strTemp += ","; + // 第4个tab特殊处理:最后一个值时不足5个也要输出 + if (t == 3 && i == groups - 1 && j == 63) { + strTemp.chop(1); // 去掉末尾逗号 + editGiant[t][num]->setText(strTemp); + } + } else { + strTemp += QString::number((qint8)data.matchGiantPointVoltageValue[giantOffset + i][j]); + editGiant[t][num]->setText(strTemp); + strTemp = ""; + k = 0; + num++; + } + } + } + giantOffset += groups; + } + } + + // 通用参数 + for (int i = 0; i < 8; i++) + editAdjustPara[i]->setText(QString::number((qint8)data.matchAdjustParaDACArray[i])); +} + +// ========== 数据保存:UI → 结构体 ========== + +void DlgVoltePara25Dots::saveDataFromUI() +{ + if (!sysPara) return; + + voltePara_t_25Dots &data = sysPara->voltePara_25Dots; + + // 连续电压 + for (int i = 0; i < 64; i++) + data.matchContinousDACArray[i] = (quint16)editContinuous[i]->text().toUInt(); + + // 点延迟 + for (int i = 0; i < 64; i++) + data.matchExtraLineDACArray[i] = (quint8)editRowDelay[i]->text().toUInt(); + + // 首1点延迟 + for (int i = 0; i < 64; i++) + data.matchFirstOnePointExtraLineDACArray[i] = (qint8)editHead1RowDelay[i]->text().toInt(); + + // 单点(首1) + for (int i = 0; i < 64; i++) + data.matchTotalTableDACArrayFirst1[i] = (quint16)editSingleDot[i]->text().toUInt(); + + // 一点 + for (int i = 0; i < 64; i++) + data.matchTotalTableDACArray1[i] = (quint16)edit1Dot[i]->text().toUInt(); + + // 两点 + for (int i = 0; i < 64; i++) { + QStringList parts = edit2Dots[i]->text().split(","); + for (int j = 0; j < 2; j++) + data.matchTotalTableDACArray2[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; + } + + // 三点 + for (int i = 0; i < 64; i++) { + QStringList parts = edit3Dots[i]->text().split(","); + for (int j = 0; j < 3; j++) + data.matchTotalTableDACArray3[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; + } + + // 四点 + for (int i = 0; i < 64; i++) { + QStringList parts = edit4Dots[i]->text().split(","); + for (int j = 0; j < 4; j++) + data.matchTotalTableDACArray4[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; + } + + // 五点 + for (int i = 0; i < 64; i++) { + QStringList parts = edit5Dots[i]->text().split(","); + for (int j = 0; j < 5; j++) + data.matchTotalTableDACArray5[i][j] = parts.size() > j ? (quint16)parts[j].toUInt() : 0; + } + + // 差分补偿:与oldProject的Save_voltage_diff逻辑一致 + // 每个tab的64个lineEdit各含5个逗号分隔值,展平后按内存顺序写回[5][64] + for (int t = 0; t < 10; t++) { + // 先把64个lineEdit的值全部拼成一个大列表(320个值) + QStringList allValues; + for (int num = 0; num < 64; num++) { + QStringList parts = editDiff[t][num]->text().split(","); + allValues.append(parts); + } + // 按内存顺序写回 [5][64] + int idx = 0; + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 64; j++) { + data.matchTotalDiffVoltageValue[t * 5 + i][j] = + idx < allValues.size() ? (qint8)allValues[idx].toInt() : 0; + idx++; + } + } + } + + // 巨点补偿:与oldProject一致,流式反解析 + { + int giantGroupsPerTab[4] = {5, 5, 5, 1}; + int giantEditCount[4] = {64, 64, 64, 13}; + int giantOffset = 0; + for (int t = 0; t < 4; t++) { + int groups = giantGroupsPerTab[t]; + // 把所有lineEdit的值拼成一个大列表 + QStringList allValues; + for (int num = 0; num < giantEditCount[t]; num++) { + QStringList parts = editGiant[t][num]->text().split(","); + allValues.append(parts); + } + // 按内存顺序写回 [groups][64] + int idx = 0; + for (int i = 0; i < groups; i++) { + for (int j = 0; j < 64; j++) { + data.matchGiantPointVoltageValue[giantOffset + i][j] = + idx < allValues.size() ? (qint8)allValues[idx].toInt() : 0; + idx++; + } + } + giantOffset += groups; + } + } + + // 通用参数 + for (int i = 0; i < 8; i++) + data.matchAdjustParaDACArray[i] = (qint8)editAdjustPara[i]->text().toInt(); +} + +// ========== 按钮槽函数 ========== + +void DlgVoltePara25Dots::onBtnLoadClicked() +{ + loadDataToUI(); +} + +void DlgVoltePara25Dots::onBtnSaveClicked() +{ + saveDataFromUI(); + + if (m_devOp) { + m_devOp->writeDacValue2Fpga_No72NewVoltData(); + } + + QFile file(DOC_ROOT_DIR"VoltDataStd25.bin"); + if(!file.open(QIODevice::WriteOnly)) { + QMessageBox::information(this, QString("注意"), QString("充电数据已经写入FPGA, 但是没有保存到文件。")); + return; + } + + int written = file.write((const char*)&(sysPara->voltePara_25Dots), sizeof(voltePara_t_25Dots)); + file.close(); + + if(written != sizeof(voltePara_t_25Dots)) { + LogInfo::setRunStatusText("写入文件VoltDataStd25.bin失败"); + } + + QMessageBox::information(this, QString("完成"), QString("充电参数已保存并推送至FPGA。")); +} diff --git a/DlgVoltePara25Dots.h b/DlgVoltePara25Dots.h index cf85810..87e7f2b 100644 --- a/DlgVoltePara25Dots.h +++ b/DlgVoltePara25Dots.h @@ -1,66 +1,66 @@ -#ifndef DLGVOLTEPARA25DOTS_H -#define DLGVOLTEPARA25DOTS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ParaSettingUI.h" - -class DevOp; - -class DlgVoltePara25Dots : public QDialog, public ParaSettingUI -{ - Q_OBJECT - -public: - explicit DlgVoltePara25Dots(DevOp *devOp, QWidget *parent = nullptr); - ~DlgVoltePara25Dots(); - -public slots: - void onBtnLoadClicked(); - void onBtnSaveClicked(); - -private: - void setupUI(); - QWidget* createGridTab(int count, QLineEdit* edits[], int numCols = 4); - void loadDataToUI(); - void saveDataFromUI(); - - // UI 控件 - QTabWidget *tabWidget; - QPushButton *btnLoad; - QPushButton *btnSave; - DevOp *m_devOp; - - // 单值64通道 tab - QLineEdit *editContinuous[64]; // 连续点电压 matchContinousDACArray[64] - QLineEdit *editRowDelay[64]; // 点延迟 matchExtraLineDACArray[64] - QLineEdit *editHead1RowDelay[64]; // 首1点延迟 matchFirstOnePointExtraLineDACArray[64] - QLineEdit *editSingleDot[64]; // 单点(首1) matchTotalTableDACArrayFirst1[64] - QLineEdit *edit1Dot[64]; // 一点 matchTotalTableDACArray1[64] - - // 多值64通道 tab(每个lineEdit放逗号分隔的多个值) - QLineEdit *edit2Dots[64]; // 两点 matchTotalTableDACArray2[64][2] - QLineEdit *edit3Dots[64]; // 三点 matchTotalTableDACArray3[64][3] - QLineEdit *edit4Dots[64]; // 四点 matchTotalTableDACArray4[64][4] - QLineEdit *edit5Dots[64]; // 五点 matchTotalTableDACArray5[64][5] - - // 差分补偿:50组×64通道,每5组一个tab,共10个tab - // 每个tab有64个lineEdit,每个lineEdit放5个逗号分隔值 - QLineEdit *editDiff[10][64]; // matchTotalDiffVoltageValue[50][64] - - // 巨点补偿:16组×64通道,分4个tab(5,5,5,1组) - // 前3个tab各64个lineEdit(流式切分320值÷5),第4个tab 13个lineEdit(流式切分64值÷5) - QLineEdit *editGiant[4][64]; // matchGiantPointVoltageValue[16][64] - - // 通用参数 - QLineEdit *editAdjustPara[8]; // matchAdjustParaDACArray[8] -}; - -#endif // DLGVOLTEPARA25DOTS_H +#ifndef DLGVOLTEPARA25DOTS_H +#define DLGVOLTEPARA25DOTS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ParaSettingUI.h" + +class DevOp; + +class DlgVoltePara25Dots : public QDialog, public ParaSettingUI +{ + Q_OBJECT + +public: + explicit DlgVoltePara25Dots(DevOp *devOp, QWidget *parent = nullptr); + ~DlgVoltePara25Dots(); + +public slots: + void onBtnLoadClicked(); + void onBtnSaveClicked(); + +private: + void setupUI(); + QWidget* createGridTab(int count, QLineEdit* edits[], int numCols = 4); + void loadDataToUI(); + void saveDataFromUI(); + + // UI 控件 + QTabWidget *tabWidget; + QPushButton *btnLoad; + QPushButton *btnSave; + DevOp *m_devOp; + + // 单值64通道 tab + QLineEdit *editContinuous[64]; // 连续点电压 matchContinousDACArray[64] + QLineEdit *editRowDelay[64]; // 点延迟 matchExtraLineDACArray[64] + QLineEdit *editHead1RowDelay[64]; // 首1点延迟 matchFirstOnePointExtraLineDACArray[64] + QLineEdit *editSingleDot[64]; // 单点(首1) matchTotalTableDACArrayFirst1[64] + QLineEdit *edit1Dot[64]; // 一点 matchTotalTableDACArray1[64] + + // 多值64通道 tab(每个lineEdit放逗号分隔的多个值) + QLineEdit *edit2Dots[64]; // 两点 matchTotalTableDACArray2[64][2] + QLineEdit *edit3Dots[64]; // 三点 matchTotalTableDACArray3[64][3] + QLineEdit *edit4Dots[64]; // 四点 matchTotalTableDACArray4[64][4] + QLineEdit *edit5Dots[64]; // 五点 matchTotalTableDACArray5[64][5] + + // 差分补偿:50组×64通道,每5组一个tab,共10个tab + // 每个tab有64个lineEdit,每个lineEdit放5个逗号分隔值 + QLineEdit *editDiff[10][64]; // matchTotalDiffVoltageValue[50][64] + + // 巨点补偿:16组×64通道,分4个tab(5,5,5,1组) + // 前3个tab各64个lineEdit(流式切分320值÷5),第4个tab 13个lineEdit(流式切分64值÷5) + QLineEdit *editGiant[4][64]; // matchGiantPointVoltageValue[16][64] + + // 通用参数 + QLineEdit *editAdjustPara[8]; // matchAdjustParaDACArray[8] +}; + +#endif // DLGVOLTEPARA25DOTS_H diff --git a/DlgVolteParaNo73.cpp b/DlgVolteParaNo73.cpp index 048332c..7d5151e 100644 --- a/DlgVolteParaNo73.cpp +++ b/DlgVolteParaNo73.cpp @@ -1,348 +1,348 @@ -#include "DlgVolteParaNo73.h" -#include "DevOp.h" -#include - -DlgVolteParaNo73::DlgVolteParaNo73(DevOp *devOp, QWidget *parent) - : QDialog(parent) - , m_devOp(devOp) -{ - memset(editContinuous, 0, sizeof(editContinuous)); - memset(editFull, 0, sizeof(editFull)); - memset(editFullRowDelay, 0, sizeof(editFullRowDelay)); - memset(editRowDelay, 0, sizeof(editRowDelay)); - memset(editHead1RowDelay, 0, sizeof(editHead1RowDelay)); - memset(edit1Dot, 0, sizeof(edit1Dot)); - memset(editOtherAdjust, 0, sizeof(editOtherAdjust)); - memset(edit2Dots, 0, sizeof(edit2Dots)); - memset(edit3Dots, 0, sizeof(edit3Dots)); - memset(edit4Dots, 0, sizeof(edit4Dots)); - memset(edit5Dots, 0, sizeof(edit5Dots)); - memset(editGap3Dot, 0, sizeof(editGap3Dot)); - memset(editGap, 0, sizeof(editGap)); - memset(editBigDot, 0, sizeof(editBigDot)); - memset(editGeneralPara, 0, sizeof(editGeneralPara)); - - setupUI(); -} - -DlgVolteParaNo73::~DlgVolteParaNo73() -{ -} - -// 创建4列网格布局的tab页(竖排) -QWidget* DlgVolteParaNo73::createGridTab(int count, QLineEdit* edits[]) -{ - QWidget *page = new QWidget(this); - QGridLayout *grid = new QGridLayout(page); - grid->setSpacing(2); - grid->setContentsMargins(4, 4, 4, 4); - - int numCols = 4; - int rowsPerCol = (count + numCols - 1) / numCols; - - for (int i = 0; i < count; i++) { - int col = i / rowsPerCol; - int row = i % rowsPerCol; - - QLabel *label = new QLabel(QString("v%1").arg(i), page); - label->setFixedWidth(28); - label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - - QLineEdit *edit = new QLineEdit("0", page); - edit->setAlignment(Qt::AlignCenter); - edits[i] = edit; - - grid->addWidget(label, row, col * 2); - grid->addWidget(edit, row, col * 2 + 1); - } - - for (int c = 0; c < numCols; c++) { - grid->setColumnStretch(c * 2, 0); - grid->setColumnStretch(c * 2 + 1, 1); - } - - return page; -} - -void DlgVolteParaNo73::setupUI() -{ - setWindowTitle(QString("No73充电参数编辑")); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setContentsMargins(4, 4, 4, 4); - mainLayout->setSpacing(4); - - tabWidget = new QTabWidget(this); - - tabWidget->addTab(createGridTab(48, editContinuous), QString("连续电压")); - tabWidget->addTab(createGridTab(48, editFullRowDelay), QString("满电延迟")); - tabWidget->addTab(createGridTab(48, editRowDelay), QString("点延迟")); - tabWidget->addTab(createGridTab(48, editHead1RowDelay), QString("首1点延迟")); - tabWidget->addTab(createGridTab(48, editOtherAdjust), QString("其他调整")); - tabWidget->addTab(createGridTab(48, editFull), QString("满电")); - tabWidget->addTab(createGridTab(48, edit1Dot), QString("单点")); - tabWidget->addTab(createGridTab(48, edit2Dots), QString("两点")); - tabWidget->addTab(createGridTab(48, edit3Dots), QString("三点")); - tabWidget->addTab(createGridTab(48, edit4Dots), QString("四点")); - tabWidget->addTab(createGridTab(48, edit5Dots), QString("五点")); - tabWidget->addTab(createGridTab(48, editGap3Dot), QString("3_空点")); - tabWidget->addTab(createGridTab(48, editGap), QString("空点")); - tabWidget->addTab(createGridTab(8, editBigDot), QString("巨点")); - tabWidget->addTab(createGridTab(80, editGeneralPara), QString("通用参数")); - - mainLayout->addWidget(tabWidget); - - // 底部按钮栏 - QHBoxLayout *btnLayout = new QHBoxLayout(); - btnLoad = new QPushButton(QString("读取当前值"), this); - btnSave = new QPushButton(QString("保存并推送FPGA"), this); - btnLoad->setMinimumHeight(40); - btnSave->setMinimumHeight(40); - btnLayout->addWidget(btnLoad); - btnLayout->addStretch(); - btnLayout->addWidget(btnSave); - mainLayout->addLayout(btnLayout); - - connect(btnLoad, SIGNAL(clicked()), this, SLOT(onBtnLoadClicked())); - connect(btnSave, SIGNAL(clicked()), this, SLOT(onBtnSaveClicked())); -} - -// ========== 数据加载:结构体 → UI ========== - -void DlgVolteParaNo73::loadDataToUI() -{ - if (!sysPara) return; - - voltePara_t_No73 &data = sysPara->voltePara_No73; - - // 连续电压 - for (int i = 0; i < 48; i++) - editContinuous[i]->setText(QString::number(data.pixel_continous_table[i])); - - // 满电延迟 - for (int i = 0; i < 48; i++) - editFullRowDelay[i]->setText(QString::number(data.full_row_delay_table[i])); - - // 点延迟 - for (int i = 0; i < 48; i++) - editRowDelay[i]->setText(QString::number(data.row_delay_table[i])); - - // 首1点延迟 - for (int i = 0; i < 48; i++) - editHead1RowDelay[i]->setText(QString::number(data.head1_row_delay_table[i])); - - // 其他调整:steal,head2,head3,tail2 四个值逗号分隔 - for (int i = 0; i < 48; i++) { - editOtherAdjust[i]->setText(QString("%1,%2,%3,%4") - .arg(data.pixel_steal_table[i]) - .arg(data.pixel_head2_table[i]) - .arg(data.pixel_head3_table[i]) - .arg(data.pixel_tail2_table[i])); - } - - // 满电 - for (int i = 0; i < 48; i++) - editFull[i]->setText(QString::number(data.pixel_full_table[i])); - - // 单点 - for (int i = 0; i < 48; i++) - edit1Dot[i]->setText(QString::number(data.pixel_1_table[i])); - - // 两点(2值逗号分隔) - for (int i = 0; i < 48; i++) { - edit2Dots[i]->setText(QString("%1,%2") - .arg(data.pixel_2_table[i][0]) - .arg(data.pixel_2_table[i][1])); - } - - // 三点(3值逗号分隔) - for (int i = 0; i < 48; i++) { - edit3Dots[i]->setText(QString("%1,%2,%3") - .arg(data.pixel_3_table[i][0]) - .arg(data.pixel_3_table[i][1]) - .arg(data.pixel_3_table[i][2])); - } - - // 四点(4值逗号分隔) - for (int i = 0; i < 48; i++) { - edit4Dots[i]->setText(QString("%1,%2,%3,%4") - .arg(data.pixel_4_table[i][0]) - .arg(data.pixel_4_table[i][1]) - .arg(data.pixel_4_table[i][2]) - .arg(data.pixel_4_table[i][3])); - } - - // 五点(5值逗号分隔) - for (int i = 0; i < 48; i++) { - edit5Dots[i]->setText(QString("%1,%2,%3,%4,%5") - .arg(data.pixel_5_table[i][0]) - .arg(data.pixel_5_table[i][1]) - .arg(data.pixel_5_table[i][2]) - .arg(data.pixel_5_table[i][3]) - .arg(data.pixel_5_table[i][4])); - } - - // 3_空点(5值逗号分隔) - for (int i = 0; i < 48; i++) { - editGap3Dot[i]->setText(QString("%1,%2,%3,%4,%5") - .arg(data.pixel_gap_post_3dot_table[i][0]) - .arg(data.pixel_gap_post_3dot_table[i][1]) - .arg(data.pixel_gap_post_3dot_table[i][2]) - .arg(data.pixel_gap_post_3dot_table[i][3]) - .arg(data.pixel_gap_post_3dot_table[i][4])); - } - - // 空点(5值逗号分隔) - for (int i = 0; i < 48; i++) { - editGap[i]->setText(QString("%1,%2,%3,%4,%5") - .arg(data.pixel_gap_table[i][0]) - .arg(data.pixel_gap_table[i][1]) - .arg(data.pixel_gap_table[i][2]) - .arg(data.pixel_gap_table[i][3]) - .arg(data.pixel_gap_table[i][4])); - } - - // 巨点 pixel_big_table[8][8],每行8个逗号分隔值 - for (int i = 0; i < 8; i++) { - QString str; - for (int j = 0; j < 8; j++) { - if (j > 0) str += ","; - str += QString::number((qint8)data.pixel_big_table[i][j]); - } - editBigDot[i]->setText(str); - } - - // 通用参数:前16项为pixel_para_table,后64项为pixel_general_dac_parameter - for (int i = 0; i < 16; i++) - editGeneralPara[i]->setText(QString::number(data.pixel_para_table[i])); - for (int i = 0; i < 64; i++) - editGeneralPara[16 + i]->setText(QString::number(data.pixel_general_dac_parameter[i])); -} - -// ========== 数据保存:UI → 结构体 ========== - -void DlgVolteParaNo73::saveDataFromUI() -{ - if (!sysPara) return; - - voltePara_t_No73 &data = sysPara->voltePara_No73; - - // 连续电压 - for (int i = 0; i < 48; i++) - data.pixel_continous_table[i] = (qint16)editContinuous[i]->text().toInt(); - - // 满电延迟 - for (int i = 0; i < 48; i++) - data.full_row_delay_table[i] = (qint16)editFullRowDelay[i]->text().toInt(); - - // 点延迟 - for (int i = 0; i < 48; i++) - data.row_delay_table[i] = (qint16)editRowDelay[i]->text().toInt(); - - // 首1点延迟 - for (int i = 0; i < 48; i++) - data.head1_row_delay_table[i] = (qint16)editHead1RowDelay[i]->text().toInt(); - - // 其他调整:steal,head2,head3,tail2 - for (int i = 0; i < 48; i++) { - QStringList parts = editOtherAdjust[i]->text().split(","); - data.pixel_steal_table[i] = parts.size() > 0 ? (qint16)parts[0].toInt() : 0; - data.pixel_head2_table[i] = parts.size() > 1 ? (qint16)parts[1].toInt() : 0; - data.pixel_head3_table[i] = parts.size() > 2 ? (qint16)parts[2].toInt() : 0; - data.pixel_tail2_table[i] = parts.size() > 3 ? (qint16)parts[3].toInt() : 0; - } - - // 满电 - for (int i = 0; i < 48; i++) - data.pixel_full_table[i] = (qint16)editFull[i]->text().toInt(); - - // 单点 - for (int i = 0; i < 48; i++) - data.pixel_1_table[i] = (qint16)edit1Dot[i]->text().toInt(); - - // 两点 - for (int i = 0; i < 48; i++) { - QStringList parts = edit2Dots[i]->text().split(","); - for (int j = 0; j < 2; j++) - data.pixel_2_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 三点 - for (int i = 0; i < 48; i++) { - QStringList parts = edit3Dots[i]->text().split(","); - for (int j = 0; j < 3; j++) - data.pixel_3_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 四点 - for (int i = 0; i < 48; i++) { - QStringList parts = edit4Dots[i]->text().split(","); - for (int j = 0; j < 4; j++) - data.pixel_4_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 五点 - for (int i = 0; i < 48; i++) { - QStringList parts = edit5Dots[i]->text().split(","); - for (int j = 0; j < 5; j++) - data.pixel_5_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 3_空点 - for (int i = 0; i < 48; i++) { - QStringList parts = editGap3Dot[i]->text().split(","); - for (int j = 0; j < 5; j++) - data.pixel_gap_post_3dot_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 空点 - for (int i = 0; i < 48; i++) { - QStringList parts = editGap[i]->text().split(","); - for (int j = 0; j < 5; j++) - data.pixel_gap_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; - } - - // 巨点 - for (int i = 0; i < 8; i++) { - QStringList parts = editBigDot[i]->text().split(","); - for (int j = 0; j < 8; j++) - data.pixel_big_table[i][j] = parts.size() > j ? (qint8)parts[j].toInt() : 0; - } - - // 通用参数 - for (int i = 0; i < 16; i++) - data.pixel_para_table[i] = (qint16)editGeneralPara[i]->text().toInt(); - for (int i = 0; i < 64; i++) - data.pixel_general_dac_parameter[i] = (qint16)editGeneralPara[16 + i]->text().toInt(); -} - -// ========== 按钮槽函数 ========== - -void DlgVolteParaNo73::onBtnLoadClicked() -{ - loadDataToUI(); -} - -void DlgVolteParaNo73::onBtnSaveClicked() -{ - saveDataFromUI(); - - QFile file(DOC_ROOT_DIR"voltePara_No73.bin"); - if(!file.open(QIODevice::WriteOnly)) { - QMessageBox::information(this, QString("注意"), QString("充电数据已经写入FPGA, 但是没有保存到文件。")); - return; - } - - int written = file.write((const char*)&(sysPara->voltePara_No73), sizeof(voltePara_t_No73)); - file.close(); - - if(written != sizeof(voltePara_t_No73)) { - QMessageBox::information(this, QString("注意"), QString("写入文件voltePara_No73.bin失败")); - } - - if (m_devOp) { - m_devOp->writeDacValue2Fpga_No73(); - } - - QMessageBox::information(this, QString("完成"), QString("充电参数已保存并推送至FPGA。")); -} +#include "DlgVolteParaNo73.h" +#include "DevOp.h" +#include + +DlgVolteParaNo73::DlgVolteParaNo73(DevOp *devOp, QWidget *parent) + : QDialog(parent) + , m_devOp(devOp) +{ + memset(editContinuous, 0, sizeof(editContinuous)); + memset(editFull, 0, sizeof(editFull)); + memset(editFullRowDelay, 0, sizeof(editFullRowDelay)); + memset(editRowDelay, 0, sizeof(editRowDelay)); + memset(editHead1RowDelay, 0, sizeof(editHead1RowDelay)); + memset(edit1Dot, 0, sizeof(edit1Dot)); + memset(editOtherAdjust, 0, sizeof(editOtherAdjust)); + memset(edit2Dots, 0, sizeof(edit2Dots)); + memset(edit3Dots, 0, sizeof(edit3Dots)); + memset(edit4Dots, 0, sizeof(edit4Dots)); + memset(edit5Dots, 0, sizeof(edit5Dots)); + memset(editGap3Dot, 0, sizeof(editGap3Dot)); + memset(editGap, 0, sizeof(editGap)); + memset(editBigDot, 0, sizeof(editBigDot)); + memset(editGeneralPara, 0, sizeof(editGeneralPara)); + + setupUI(); +} + +DlgVolteParaNo73::~DlgVolteParaNo73() +{ +} + +// 创建4列网格布局的tab页(竖排) +QWidget* DlgVolteParaNo73::createGridTab(int count, QLineEdit* edits[]) +{ + QWidget *page = new QWidget(this); + QGridLayout *grid = new QGridLayout(page); + grid->setSpacing(2); + grid->setContentsMargins(4, 4, 4, 4); + + int numCols = 4; + int rowsPerCol = (count + numCols - 1) / numCols; + + for (int i = 0; i < count; i++) { + int col = i / rowsPerCol; + int row = i % rowsPerCol; + + QLabel *label = new QLabel(QString("v%1").arg(i), page); + label->setFixedWidth(28); + label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + + QLineEdit *edit = new QLineEdit("0", page); + edit->setAlignment(Qt::AlignCenter); + edits[i] = edit; + + grid->addWidget(label, row, col * 2); + grid->addWidget(edit, row, col * 2 + 1); + } + + for (int c = 0; c < numCols; c++) { + grid->setColumnStretch(c * 2, 0); + grid->setColumnStretch(c * 2 + 1, 1); + } + + return page; +} + +void DlgVolteParaNo73::setupUI() +{ + setWindowTitle(QString("No73充电参数编辑")); + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setContentsMargins(4, 4, 4, 4); + mainLayout->setSpacing(4); + + tabWidget = new QTabWidget(this); + + tabWidget->addTab(createGridTab(48, editContinuous), QString("连续电压")); + tabWidget->addTab(createGridTab(48, editFullRowDelay), QString("满电延迟")); + tabWidget->addTab(createGridTab(48, editRowDelay), QString("点延迟")); + tabWidget->addTab(createGridTab(48, editHead1RowDelay), QString("首1点延迟")); + tabWidget->addTab(createGridTab(48, editOtherAdjust), QString("其他调整")); + tabWidget->addTab(createGridTab(48, editFull), QString("满电")); + tabWidget->addTab(createGridTab(48, edit1Dot), QString("单点")); + tabWidget->addTab(createGridTab(48, edit2Dots), QString("两点")); + tabWidget->addTab(createGridTab(48, edit3Dots), QString("三点")); + tabWidget->addTab(createGridTab(48, edit4Dots), QString("四点")); + tabWidget->addTab(createGridTab(48, edit5Dots), QString("五点")); + tabWidget->addTab(createGridTab(48, editGap3Dot), QString("3_空点")); + tabWidget->addTab(createGridTab(48, editGap), QString("空点")); + tabWidget->addTab(createGridTab(8, editBigDot), QString("巨点")); + tabWidget->addTab(createGridTab(80, editGeneralPara), QString("通用参数")); + + mainLayout->addWidget(tabWidget); + + // 底部按钮栏 + QHBoxLayout *btnLayout = new QHBoxLayout(); + btnLoad = new QPushButton(QString("读取当前值"), this); + btnSave = new QPushButton(QString("保存并推送FPGA"), this); + btnLoad->setMinimumHeight(40); + btnSave->setMinimumHeight(40); + btnLayout->addWidget(btnLoad); + btnLayout->addStretch(); + btnLayout->addWidget(btnSave); + mainLayout->addLayout(btnLayout); + + connect(btnLoad, SIGNAL(clicked()), this, SLOT(onBtnLoadClicked())); + connect(btnSave, SIGNAL(clicked()), this, SLOT(onBtnSaveClicked())); +} + +// ========== 数据加载:结构体 → UI ========== + +void DlgVolteParaNo73::loadDataToUI() +{ + if (!sysPara) return; + + voltePara_t_No73 &data = sysPara->voltePara_No73; + + // 连续电压 + for (int i = 0; i < 48; i++) + editContinuous[i]->setText(QString::number(data.pixel_continous_table[i])); + + // 满电延迟 + for (int i = 0; i < 48; i++) + editFullRowDelay[i]->setText(QString::number(data.full_row_delay_table[i])); + + // 点延迟 + for (int i = 0; i < 48; i++) + editRowDelay[i]->setText(QString::number(data.row_delay_table[i])); + + // 首1点延迟 + for (int i = 0; i < 48; i++) + editHead1RowDelay[i]->setText(QString::number(data.head1_row_delay_table[i])); + + // 其他调整:steal,head2,head3,tail2 四个值逗号分隔 + for (int i = 0; i < 48; i++) { + editOtherAdjust[i]->setText(QString("%1,%2,%3,%4") + .arg(data.pixel_steal_table[i]) + .arg(data.pixel_head2_table[i]) + .arg(data.pixel_head3_table[i]) + .arg(data.pixel_tail2_table[i])); + } + + // 满电 + for (int i = 0; i < 48; i++) + editFull[i]->setText(QString::number(data.pixel_full_table[i])); + + // 单点 + for (int i = 0; i < 48; i++) + edit1Dot[i]->setText(QString::number(data.pixel_1_table[i])); + + // 两点(2值逗号分隔) + for (int i = 0; i < 48; i++) { + edit2Dots[i]->setText(QString("%1,%2") + .arg(data.pixel_2_table[i][0]) + .arg(data.pixel_2_table[i][1])); + } + + // 三点(3值逗号分隔) + for (int i = 0; i < 48; i++) { + edit3Dots[i]->setText(QString("%1,%2,%3") + .arg(data.pixel_3_table[i][0]) + .arg(data.pixel_3_table[i][1]) + .arg(data.pixel_3_table[i][2])); + } + + // 四点(4值逗号分隔) + for (int i = 0; i < 48; i++) { + edit4Dots[i]->setText(QString("%1,%2,%3,%4") + .arg(data.pixel_4_table[i][0]) + .arg(data.pixel_4_table[i][1]) + .arg(data.pixel_4_table[i][2]) + .arg(data.pixel_4_table[i][3])); + } + + // 五点(5值逗号分隔) + for (int i = 0; i < 48; i++) { + edit5Dots[i]->setText(QString("%1,%2,%3,%4,%5") + .arg(data.pixel_5_table[i][0]) + .arg(data.pixel_5_table[i][1]) + .arg(data.pixel_5_table[i][2]) + .arg(data.pixel_5_table[i][3]) + .arg(data.pixel_5_table[i][4])); + } + + // 3_空点(5值逗号分隔) + for (int i = 0; i < 48; i++) { + editGap3Dot[i]->setText(QString("%1,%2,%3,%4,%5") + .arg(data.pixel_gap_post_3dot_table[i][0]) + .arg(data.pixel_gap_post_3dot_table[i][1]) + .arg(data.pixel_gap_post_3dot_table[i][2]) + .arg(data.pixel_gap_post_3dot_table[i][3]) + .arg(data.pixel_gap_post_3dot_table[i][4])); + } + + // 空点(5值逗号分隔) + for (int i = 0; i < 48; i++) { + editGap[i]->setText(QString("%1,%2,%3,%4,%5") + .arg(data.pixel_gap_table[i][0]) + .arg(data.pixel_gap_table[i][1]) + .arg(data.pixel_gap_table[i][2]) + .arg(data.pixel_gap_table[i][3]) + .arg(data.pixel_gap_table[i][4])); + } + + // 巨点 pixel_big_table[8][8],每行8个逗号分隔值 + for (int i = 0; i < 8; i++) { + QString str; + for (int j = 0; j < 8; j++) { + if (j > 0) str += ","; + str += QString::number((qint8)data.pixel_big_table[i][j]); + } + editBigDot[i]->setText(str); + } + + // 通用参数:前16项为pixel_para_table,后64项为pixel_general_dac_parameter + for (int i = 0; i < 16; i++) + editGeneralPara[i]->setText(QString::number(data.pixel_para_table[i])); + for (int i = 0; i < 64; i++) + editGeneralPara[16 + i]->setText(QString::number(data.pixel_general_dac_parameter[i])); +} + +// ========== 数据保存:UI → 结构体 ========== + +void DlgVolteParaNo73::saveDataFromUI() +{ + if (!sysPara) return; + + voltePara_t_No73 &data = sysPara->voltePara_No73; + + // 连续电压 + for (int i = 0; i < 48; i++) + data.pixel_continous_table[i] = (qint16)editContinuous[i]->text().toInt(); + + // 满电延迟 + for (int i = 0; i < 48; i++) + data.full_row_delay_table[i] = (qint16)editFullRowDelay[i]->text().toInt(); + + // 点延迟 + for (int i = 0; i < 48; i++) + data.row_delay_table[i] = (qint16)editRowDelay[i]->text().toInt(); + + // 首1点延迟 + for (int i = 0; i < 48; i++) + data.head1_row_delay_table[i] = (qint16)editHead1RowDelay[i]->text().toInt(); + + // 其他调整:steal,head2,head3,tail2 + for (int i = 0; i < 48; i++) { + QStringList parts = editOtherAdjust[i]->text().split(","); + data.pixel_steal_table[i] = parts.size() > 0 ? (qint16)parts[0].toInt() : 0; + data.pixel_head2_table[i] = parts.size() > 1 ? (qint16)parts[1].toInt() : 0; + data.pixel_head3_table[i] = parts.size() > 2 ? (qint16)parts[2].toInt() : 0; + data.pixel_tail2_table[i] = parts.size() > 3 ? (qint16)parts[3].toInt() : 0; + } + + // 满电 + for (int i = 0; i < 48; i++) + data.pixel_full_table[i] = (qint16)editFull[i]->text().toInt(); + + // 单点 + for (int i = 0; i < 48; i++) + data.pixel_1_table[i] = (qint16)edit1Dot[i]->text().toInt(); + + // 两点 + for (int i = 0; i < 48; i++) { + QStringList parts = edit2Dots[i]->text().split(","); + for (int j = 0; j < 2; j++) + data.pixel_2_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 三点 + for (int i = 0; i < 48; i++) { + QStringList parts = edit3Dots[i]->text().split(","); + for (int j = 0; j < 3; j++) + data.pixel_3_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 四点 + for (int i = 0; i < 48; i++) { + QStringList parts = edit4Dots[i]->text().split(","); + for (int j = 0; j < 4; j++) + data.pixel_4_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 五点 + for (int i = 0; i < 48; i++) { + QStringList parts = edit5Dots[i]->text().split(","); + for (int j = 0; j < 5; j++) + data.pixel_5_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 3_空点 + for (int i = 0; i < 48; i++) { + QStringList parts = editGap3Dot[i]->text().split(","); + for (int j = 0; j < 5; j++) + data.pixel_gap_post_3dot_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 空点 + for (int i = 0; i < 48; i++) { + QStringList parts = editGap[i]->text().split(","); + for (int j = 0; j < 5; j++) + data.pixel_gap_table[i][j] = parts.size() > j ? (qint16)parts[j].toInt() : 0; + } + + // 巨点 + for (int i = 0; i < 8; i++) { + QStringList parts = editBigDot[i]->text().split(","); + for (int j = 0; j < 8; j++) + data.pixel_big_table[i][j] = parts.size() > j ? (qint8)parts[j].toInt() : 0; + } + + // 通用参数 + for (int i = 0; i < 16; i++) + data.pixel_para_table[i] = (qint16)editGeneralPara[i]->text().toInt(); + for (int i = 0; i < 64; i++) + data.pixel_general_dac_parameter[i] = (qint16)editGeneralPara[16 + i]->text().toInt(); +} + +// ========== 按钮槽函数 ========== + +void DlgVolteParaNo73::onBtnLoadClicked() +{ + loadDataToUI(); +} + +void DlgVolteParaNo73::onBtnSaveClicked() +{ + saveDataFromUI(); + + QFile file(DOC_ROOT_DIR"voltePara_No73.bin"); + if(!file.open(QIODevice::WriteOnly)) { + QMessageBox::information(this, QString("注意"), QString("充电数据已经写入FPGA, 但是没有保存到文件。")); + return; + } + + int written = file.write((const char*)&(sysPara->voltePara_No73), sizeof(voltePara_t_No73)); + file.close(); + + if(written != sizeof(voltePara_t_No73)) { + QMessageBox::information(this, QString("注意"), QString("写入文件voltePara_No73.bin失败")); + } + + if (m_devOp) { + m_devOp->writeDacValue2Fpga_No73(); + } + + QMessageBox::information(this, QString("完成"), QString("充电参数已保存并推送至FPGA。")); +} diff --git a/DlgVolteParaNo73.h b/DlgVolteParaNo73.h index d480820..3a9bc89 100644 --- a/DlgVolteParaNo73.h +++ b/DlgVolteParaNo73.h @@ -1,68 +1,68 @@ -#ifndef DLGVOLTEPARANO73_H -#define DLGVOLTEPARANO73_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ParaSettingUI.h" - -class DevOp; - -class DlgVolteParaNo73 : public QDialog, public ParaSettingUI -{ - Q_OBJECT - -public: - explicit DlgVolteParaNo73(DevOp *devOp, QWidget *parent = nullptr); - ~DlgVolteParaNo73(); - -public slots: - void onBtnLoadClicked(); - void onBtnSaveClicked(); - -private: - void setupUI(); - QWidget* createGridTab(int count, QLineEdit* edits[]); - void loadDataToUI(); - void saveDataFromUI(); - - // UI 控件 - QTabWidget *tabWidget; - QPushButton *btnLoad; - QPushButton *btnSave; - DevOp *m_devOp; - - // 单值48通道 tab - QLineEdit *editContinuous[48]; // 连续电压 pixel_continous_table[48] - QLineEdit *editFull[48]; // 满电 pixel_full_table[48] - QLineEdit *editFullRowDelay[48]; // 满电延迟 full_row_delay_table[48] - QLineEdit *editRowDelay[48]; // 点延迟 row_delay_table[48] - QLineEdit *editHead1RowDelay[48]; // 首1点延迟 head1_row_delay_table[48] - QLineEdit *edit1Dot[48]; // 单点 pixel_1_table[48] - - // 其他调整:pixel_steal_table[48], pixel_head2_table[48], pixel_head3_table[48], pixel_tail2_table[48] - // 每个lineEdit放4个逗号分隔值(steal,head2,head3,tail2) - QLineEdit *editOtherAdjust[48]; - - // 多值48通道 tab - QLineEdit *edit2Dots[48]; // 两点 pixel_2_table[48][2] - QLineEdit *edit3Dots[48]; // 三点 pixel_3_table[48][3] - QLineEdit *edit4Dots[48]; // 四点 pixel_4_table[48][4] - QLineEdit *edit5Dots[48]; // 五点 pixel_5_table[48][5] - QLineEdit *editGap3Dot[48]; // 3_空点 pixel_gap_post_3dot_table[48][5] - QLineEdit *editGap[48]; // 空点 pixel_gap_table[48][5] - - // 巨点 pixel_big_table[8][8],8行每行8个逗号分隔值 - QLineEdit *editBigDot[8]; - - // 通用参数 pixel_para_table[16] + pixel_general_dac_parameter[64],共80项 - QLineEdit *editGeneralPara[80]; -}; - -#endif // DLGVOLTEPARANO73_H +#ifndef DLGVOLTEPARANO73_H +#define DLGVOLTEPARANO73_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ParaSettingUI.h" + +class DevOp; + +class DlgVolteParaNo73 : public QDialog, public ParaSettingUI +{ + Q_OBJECT + +public: + explicit DlgVolteParaNo73(DevOp *devOp, QWidget *parent = nullptr); + ~DlgVolteParaNo73(); + +public slots: + void onBtnLoadClicked(); + void onBtnSaveClicked(); + +private: + void setupUI(); + QWidget* createGridTab(int count, QLineEdit* edits[]); + void loadDataToUI(); + void saveDataFromUI(); + + // UI 控件 + QTabWidget *tabWidget; + QPushButton *btnLoad; + QPushButton *btnSave; + DevOp *m_devOp; + + // 单值48通道 tab + QLineEdit *editContinuous[48]; // 连续电压 pixel_continous_table[48] + QLineEdit *editFull[48]; // 满电 pixel_full_table[48] + QLineEdit *editFullRowDelay[48]; // 满电延迟 full_row_delay_table[48] + QLineEdit *editRowDelay[48]; // 点延迟 row_delay_table[48] + QLineEdit *editHead1RowDelay[48]; // 首1点延迟 head1_row_delay_table[48] + QLineEdit *edit1Dot[48]; // 单点 pixel_1_table[48] + + // 其他调整:pixel_steal_table[48], pixel_head2_table[48], pixel_head3_table[48], pixel_tail2_table[48] + // 每个lineEdit放4个逗号分隔值(steal,head2,head3,tail2) + QLineEdit *editOtherAdjust[48]; + + // 多值48通道 tab + QLineEdit *edit2Dots[48]; // 两点 pixel_2_table[48][2] + QLineEdit *edit3Dots[48]; // 三点 pixel_3_table[48][3] + QLineEdit *edit4Dots[48]; // 四点 pixel_4_table[48][4] + QLineEdit *edit5Dots[48]; // 五点 pixel_5_table[48][5] + QLineEdit *editGap3Dot[48]; // 3_空点 pixel_gap_post_3dot_table[48][5] + QLineEdit *editGap[48]; // 空点 pixel_gap_table[48][5] + + // 巨点 pixel_big_table[8][8],8行每行8个逗号分隔值 + QLineEdit *editBigDot[8]; + + // 通用参数 pixel_para_table[16] + pixel_general_dac_parameter[64],共80项 + QLineEdit *editGeneralPara[80]; +}; + +#endif // DLGVOLTEPARANO73_H diff --git a/EN/mainwindow.ui b/EN/mainwindow.ui index 0324a47..c795da6 100644 --- a/EN/mainwindow.ui +++ b/EN/mainwindow.ui @@ -1,3873 +1,3873 @@ - - - MainWindow - - - true - - - - 0 - 0 - 638 - 458 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 5 - 5 - - - - Qt::StrongFocus - - - InkJet - - - - - 9 - 9 - 620 - 440 - - - - - 0 - - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 1 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - - - - 0 - 50 - - - - - - 0 - 0 - 686 - 47 - - - - - - - - 0 - 45 - - - - 编辑 - - - - :/icon/edit.png:/icon/edit.png - - - - - - - - 0 - 45 - - - - 打开文件 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 0 - 45 - - - - 二维码 - - - - :/icon/bypm.png:/icon/bypm.png - - - - - - - - 0 - 45 - - - - 条形码 - - - - :/icon/BarCode1.png:/icon/BarCode1.png - - - - - - - - 0 - 45 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - 0 - 45 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - 交替打印文件名 - - - - - - - - - - - - 0 - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - 最大:[40行x 2048列] - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 140 - 25 - - - - - 140 - 25 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 25 - - - - - 16777215 - 25 - - - - 同步器速度 - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - Qt::Vertical - - - - - - - - 0 - 25 - - - - - 100 - 25 - - - - 当前时间 - - - - - - - - - - - - - 640 - 107 - - - - 1 - - - - - - - - 610 - 95 - - - - - 620 - 96 - - - - BlankCursor - - - 0 - - - false - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi';"></p></body></html> - - - - - - - - - - 5 - 5 - 620 - 100 - - - - - 0 - 0 - - - - - 620 - 100 - - - - - 16777215 - 80 - - - - false - - - - - 0 - 0 - 500 - 53 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 60 - - - - - 60 - 16777215 - - - - - - - :/image/reset.png - - - - - - - - - 0 - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨线开关 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 喷头盖开 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水缸满 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水液位 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 溶剂液位 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 回收故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 粘度故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 相位故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 高压故障 - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 故障恢复 - - - - - - - - - 0 - - - 0 - - - - - 0 - - - 0 - - - 0 - - - - - - 110 - 0 - - - - - 110 - 16777215 - - - - 立即重新计米 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - Qt::Horizontal - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品总计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - Qt::Horizontal - - - - - - - - 110 - 35 - - - - - 130 - 16777215 - - - - Qt::LeftToRight - - - false - - - 关机 - - - - :/icon/poweroff.png:/icon/poweroff.png - - - - - - - - - 7 - - - 5 - - - 0 - - - - - 6 - - - 3 - - - 0 - - - 0 - - - 3 - - - - - 1 - - - 0 - - - - - 3 - - - - - - 0 - 20 - - - - - 16524 - 16777215 - - - - - - - true - - - - - - - - - 2 - - - - - 4 - - - 3 - - - 0 - - - - - - 0 - 20 - - - - - 1000 - 20 - - - - 粘度 - - - - - - - - 0 - 20 - - - - - 10000 - 20 - - - - 压力 - - - - - - - - 1000 - 20 - - - - 隔膜位置 - - - - - - - - 1000 - 20 - - - - 晶振电压 - - - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 70 - 0 - - - - - 1000 - 20 - - - - - - - - - - - - 64 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 0 - 20 - - - - - 600 - 16777215 - - - - QFrame::NoFrame - - - - - - - - - - - 0 - 0 - - - - - 600 - 20 - - - - 2014-08-23 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - 0 - 50 - - - - - 80 - 16777215 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 147 - 146 - 146 - - - - - - - - 开 - - - - :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png - - - - - - - - 60 - 0 - - - - - 70 - 60 - - - - - - - - - - - - 0 - 50 - - - - - 80 - 16777215 - - - - 关 - - - - :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png - - - - - - - - - - - - - 0 - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 0 - 170 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 186 - 188 - 185 - - - - - - - 242 - 241 - 240 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/startprint2.png - :/icon/startprint1.png - :/icon/startprint1.png - :/icon/startprint.png:/icon/startprint2.png - - - - 110 - 70 - - - - false - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 199 - 189 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 227 - 97 - 75 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 227 - 97 - 75 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/stopprint2.png - :/icon/stopprint1.png - :/icon/stopprint1.png - :/icon/stopprint.png:/icon/stopprint2.png - - - - 110 - 70 - - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - - - - - - 255 - 170 - 0 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 206 - 203 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/pauseprint2.png - :/icon/pauseprint1.png - :/icon/pauseprint1.png - :/icon/pauseprint.png:/icon/pauseprint2.png - - - - 110 - 70 - - - - - - - - - 0 - 70 - - - - - 110 - 16777215 - - - - 喷嘴逆清洗 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - PicWidget - QWidget -
PicWidget.h
- 1 -
- - ClickLabel - QLabel -
ClickLabel.h
-
- - TextEditOption - QWidget -
TextEditOption.h
- 1 -
- - PrintTextDisplay - QWidget -
PrintTextDisplay.h
- 1 -
- - MyTextEdit - QTextEdit -
MyTextEdit.h
-
-
- - - - -
+ + + MainWindow + + + true + + + + 0 + 0 + 638 + 458 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 5 + 5 + + + + Qt::StrongFocus + + + InkJet + + + + + 9 + 9 + 620 + 440 + + + + + 0 + + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 1 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + + + + 0 + 50 + + + + + + 0 + 0 + 686 + 47 + + + + + + + + 0 + 45 + + + + 编辑 + + + + :/icon/edit.png:/icon/edit.png + + + + + + + + 0 + 45 + + + + 打开文件 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 0 + 45 + + + + 二维码 + + + + :/icon/bypm.png:/icon/bypm.png + + + + + + + + 0 + 45 + + + + 条形码 + + + + :/icon/BarCode1.png:/icon/BarCode1.png + + + + + + + + 0 + 45 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + 0 + 45 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + 交替打印文件名 + + + + + + + + + + + + 0 + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + 最大:[40行x 2048列] + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 140 + 25 + + + + + 140 + 25 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + 同步器速度 + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + Qt::Vertical + + + + + + + + 0 + 25 + + + + + 100 + 25 + + + + 当前时间 + + + + + + + + + + + + + 640 + 107 + + + + 1 + + + + + + + + 610 + 95 + + + + + 620 + 96 + + + + BlankCursor + + + 0 + + + false + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi';"></p></body></html> + + + + + + + + + + 5 + 5 + 620 + 100 + + + + + 0 + 0 + + + + + 620 + 100 + + + + + 16777215 + 80 + + + + false + + + + + 0 + 0 + 500 + 53 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 60 + + + + + 60 + 16777215 + + + + + + + :/image/reset.png + + + + + + + + + 0 + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨线开关 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 喷头盖开 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水缸满 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水液位 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 溶剂液位 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 回收故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 粘度故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 相位故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 高压故障 + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 故障恢复 + + + + + + + + + 0 + + + 0 + + + + + 0 + + + 0 + + + 0 + + + + + + 110 + 0 + + + + + 110 + 16777215 + + + + 立即重新计米 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + Qt::Horizontal + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品总计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + Qt::Horizontal + + + + + + + + 110 + 35 + + + + + 130 + 16777215 + + + + Qt::LeftToRight + + + false + + + 关机 + + + + :/icon/poweroff.png:/icon/poweroff.png + + + + + + + + + 7 + + + 5 + + + 0 + + + + + 6 + + + 3 + + + 0 + + + 0 + + + 3 + + + + + 1 + + + 0 + + + + + 3 + + + + + + 0 + 20 + + + + + 16524 + 16777215 + + + + + + + true + + + + + + + + + 2 + + + + + 4 + + + 3 + + + 0 + + + + + + 0 + 20 + + + + + 1000 + 20 + + + + 粘度 + + + + + + + + 0 + 20 + + + + + 10000 + 20 + + + + 压力 + + + + + + + + 1000 + 20 + + + + 隔膜位置 + + + + + + + + 1000 + 20 + + + + 晶振电压 + + + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 70 + 0 + + + + + 1000 + 20 + + + + + + + + + + + + 64 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 0 + 20 + + + + + 600 + 16777215 + + + + QFrame::NoFrame + + + + + + + + + + + 0 + 0 + + + + + 600 + 20 + + + + 2014-08-23 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + 0 + 50 + + + + + 80 + 16777215 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 147 + 146 + 146 + + + + + + + + 开 + + + + :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png + + + + + + + + 60 + 0 + + + + + 70 + 60 + + + + + + + + + + + + 0 + 50 + + + + + 80 + 16777215 + + + + 关 + + + + :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png + + + + + + + + + + + + + 0 + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 0 + 170 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 186 + 188 + 185 + + + + + + + 242 + 241 + 240 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/startprint2.png + :/icon/startprint1.png + :/icon/startprint1.png + :/icon/startprint.png:/icon/startprint2.png + + + + 110 + 70 + + + + false + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 199 + 189 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 227 + 97 + 75 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 227 + 97 + 75 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/stopprint2.png + :/icon/stopprint1.png + :/icon/stopprint1.png + :/icon/stopprint.png:/icon/stopprint2.png + + + + 110 + 70 + + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + + + + + + 255 + 170 + 0 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 206 + 203 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/pauseprint2.png + :/icon/pauseprint1.png + :/icon/pauseprint1.png + :/icon/pauseprint.png:/icon/pauseprint2.png + + + + 110 + 70 + + + + + + + + + 0 + 70 + + + + + 110 + 16777215 + + + + 喷嘴逆清洗 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + PicWidget + QWidget +
PicWidget.h
+ 1 +
+ + ClickLabel + QLabel +
ClickLabel.h
+
+ + TextEditOption + QWidget +
TextEditOption.h
+ 1 +
+ + PrintTextDisplay + QWidget +
PrintTextDisplay.h
+ 1 +
+ + MyTextEdit + QTextEdit +
MyTextEdit.h
+
+
+ + + + +
diff --git a/HEAD b/HEAD index cb089cd..cb43805 100644 --- a/HEAD +++ b/HEAD @@ -1 +1 @@ -ref: refs/heads/master +ref: refs/heads/master diff --git a/HtmlDelegate.cpp b/HtmlDelegate.cpp index 2cacbec..f8018a6 100644 --- a/HtmlDelegate.cpp +++ b/HtmlDelegate.cpp @@ -1,36 +1,36 @@ -#include "HtmlDelegate.h" - -HtmlDelegate::HtmlDelegate(QObject *parent) : QAbstractItemDelegate(parent){} - -//HtmlDelegate::HtmlDelegate(QObject *parent = nullptr) : QAbstractItemDelegate(parent) {} - - -void HtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QString html = index.model()->data(index, Qt::DisplayRole).toString(); - QTextDocument doc; - doc.setHtml(html); - doc.setTextWidth(option.rect.width()); - - painter->save(); - painter->setClipRect(option.rect); - - if (option.state & QStyle::State_Selected) { - // 绘制选中项的背景颜色 - painter->fillRect(option.rect, option.palette.color(QPalette::Highlight)); - } - - painter->translate(option.rect.topLeft()); - doc.drawContents(painter, QRectF(QPointF(0, 0), QSizeF(option.rect.size()))); - painter->restore(); - } - - QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - QString html = index.model()->data(index, Qt::DisplayRole).toString(); - QTextDocument doc; - doc.setHtml(html); - doc.setTextWidth(option.rect.width()); - return QSize(doc.idealWidth(), doc.size().height()); - } - - - +#include "HtmlDelegate.h" + +HtmlDelegate::HtmlDelegate(QObject *parent) : QAbstractItemDelegate(parent){} + +//HtmlDelegate::HtmlDelegate(QObject *parent = nullptr) : QAbstractItemDelegate(parent) {} + + +void HtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { + QString html = index.model()->data(index, Qt::DisplayRole).toString(); + QTextDocument doc; + doc.setHtml(html); + doc.setTextWidth(option.rect.width()); + + painter->save(); + painter->setClipRect(option.rect); + + if (option.state & QStyle::State_Selected) { + // 绘制选中项的背景颜色 + painter->fillRect(option.rect, option.palette.color(QPalette::Highlight)); + } + + painter->translate(option.rect.topLeft()); + doc.drawContents(painter, QRectF(QPointF(0, 0), QSizeF(option.rect.size()))); + painter->restore(); + } + + QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { + QString html = index.model()->data(index, Qt::DisplayRole).toString(); + QTextDocument doc; + doc.setHtml(html); + doc.setTextWidth(option.rect.width()); + return QSize(doc.idealWidth(), doc.size().height()); + } + + + diff --git a/HtmlDelegate.h b/HtmlDelegate.h index 35e0c7f..efd7915 100644 --- a/HtmlDelegate.h +++ b/HtmlDelegate.h @@ -1,23 +1,23 @@ -#ifndef HTMLDELEGATE_H -#define HTMLDELEGATE_H - -#include -#include -#include -#include - -class HtmlDelegate : public QAbstractItemDelegate -{ - Q_OBJECT -public: - explicit HtmlDelegate(QObject *parent = 0); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; - -signals: - -public slots: -}; - -#endif // HTMLDELEGATE_H - +#ifndef HTMLDELEGATE_H +#define HTMLDELEGATE_H + +#include +#include +#include +#include + +class HtmlDelegate : public QAbstractItemDelegate +{ + Q_OBJECT +public: + explicit HtmlDelegate(QObject *parent = 0); + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; + +signals: + +public slots: +}; + +#endif // HTMLDELEGATE_H + diff --git a/InkJetPrinter.cpp b/InkJetPrinter.cpp index 374c3c6..0151472 100644 --- a/InkJetPrinter.cpp +++ b/InkJetPrinter.cpp @@ -325,6 +325,7 @@ InkJetPrinter::InkJetPrinter(QWidget *parent) : removeTab(indexOf(ui->tabDacAdjust)); removeTab(indexOf(ui->tabFpgaDebug)); ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tab_3)); + removeTab(indexOf(ui->tab_pressure)); ui->vol0SpinBox->setMinimum(0); ui->vol1SpinBox->setMinimum(0); @@ -723,6 +724,63 @@ void InkJetPrinter::initCntGroup() SectionalManager::instance(), &SectionalManager::sig_updateCntGroupDisp); } +void InkJetPrinter::appendPressureRecord(int pressure, int targetPressure) +{ + QTextBrowser *browser = ui->textBrowser; // tab_pressure 里的控件 + if (!browser) return; + + QString line = QString("[%1] 压力:%2 / 目标:%3 %4") + .arg(QDateTime::currentDateTime().toString("hh:mm:ss.zzz")) + .arg(pressure) + .arg(targetPressure) + .arg(getValvePumpStatusString()); + + appendLineToBrowser(line); + + if (pressure > 700) { + if (!m_pressureAlarmActive) { + m_pressureAlarmActive = true; + QMessageBox::warning(this, tr("超压报警"), + tr("当前压力 %1 超过 700!").arg(pressure)); + } + } else { + m_pressureAlarmActive = false; + } +} + +void InkJetPrinter::appendLineToBrowser(const QString &line) +{ + QTextBrowser *browser = ui->textBrowser; + if (!browser) return; + + browser->append(line); + + if (browser->document()->blockCount() > 500) { + QTextCursor cursor(browser->document()); + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor, + browser->document()->blockCount() - 500); + cursor.removeSelectedText(); + } +} + +static int numLine = 0; +QString InkJetPrinter::getValvePumpStatusString() +{ + if (!sysPara || !sysPara->devOp) return QString(); + + return QString("[供墨:%1 循环:%2 混合:%3 泄压:%4 回收:%5 粘度:%6 主墨:%7 压缩:%8]-%9") + .arg(sysPara->devOp->isInkValveOpen() ? 1 : 0) + .arg(sysPara->devOp->isCycleValveOpen() ? 1 : 0) + .arg(sysPara->devOp->isMixValveOpen() ? 1 : 0) + .arg(sysPara->devOp->isReleaseValveOpen() ? 1 : 0) + .arg(sysPara->devOp->isReclaimPumpOpen() ? 1 : 0) + .arg(sysPara->devOp->isViscosityPumpOpen() ? 1 : 0) + .arg(sysPara->devOp->isMainInkPumpOpen() ? 1 : 0) + .arg(sysPara->devOp->isCompressPumpOpen() ? 1 : 0) + .arg(numLine++); +} + float PID_realize(float speed); struct _pid{ @@ -1774,6 +1832,14 @@ void InkJetPrinter::timerHandler(void){ if(widget == ui->tabMainWindow && pulse_100ms) { ui->tabMainWindow->updateSysStatusToUI(); } + +// if (pulse_100ms && +// (sysPara->status.PRESSURE > sysPara->para.pressure + 10 +// ||sysPara->status.PRESSURE < sysPara->para.pressure - 10)) { +// //压力记录 +// appendPressureRecord(sysPara->status.PRESSURE, sysPara->para.pressure); +// } + else if(widget == ui->tabTriggerMode){ ui->tabTriggerMode->updateSysStatusToUI(); if(sysPara->status.fpgaVersionNum != 0){ diff --git a/InkJetPrinter.h b/InkJetPrinter.h index 9a3d397..44aec44 100644 --- a/InkJetPrinter.h +++ b/InkJetPrinter.h @@ -203,6 +203,11 @@ private: unsigned char rWarnViscoReady; void initCntGroup(); + // 压力记录 + bool m_pressureAlarmActive = false; + void appendPressureRecord(int pressure, int targetPressure); + void appendLineToBrowser(const QString &line); + QString getValvePumpStatusString(); public: bool eventFilter(QObject *watched, QEvent *event); }; diff --git a/InputMethod.cpp b/InputMethod.cpp index 20aeb49..82fdd08 100644 --- a/InputMethod.cpp +++ b/InputMethod.cpp @@ -1,1748 +1,1748 @@ -/* -* -*2013.9.12 括号错位修复 为了节约cpu最好改用映射方式 &仍未能显示出来 中文模式下小括号还是错位 -*/ -/* - Key_Backspace1 = 0x01001003, - Key_Return1 = 0x01001004, - Key_Enter1 = 0x01001005, - Key_Insert1 = 0x01001006, - Key_Delete1 = 0x01001007, - Key_Clear1 = 0x0100100b, - Key_Home1 = 0x01001010, // cursor movement - Key_End1 = 0x01001011, - Key_Left1 = 0x01001012, - Key_Up1 = 0x01001013, - Key_Right1 = 0x01001014, - Key_Down1 = 0x01001015, - Key_PageUp1 = 0x01001016, - - */ -#include -#include -#include -#include -#include -#include -#include -#include "MyInputMethod.h" -#include "InputMethod.h" -#include "ui_InputMethod.h" -#include "Public.h" -#include -#include -#include -#include -#include -#include - -QHash *> *InputMethod::pinyinHash = NULL; -QList InputMethod::pinyinHashKeys; -QStringList InputMethod::pinyinHashQStringList; - - -InputMethod::InputMethod(MyInputMethod *myInputMethod,QWidget *parent) : - QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)),//(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)如果不设置标志,会抢焦点 - ui(new Ui::InputMethod),spaceTimer(this) -{ - - //setWindowOpacity(0.9); - - this->myInputMethod = myInputMethod; - ui->setupUi(this); - currentInputMethodType = INPUT_METHOD_TYPE_ENGLISH; - shiftFlag = false; - pinyinPage = 0; - bengalFlag = false; - CapsFlag=false; - CtrlFlag=false; -#ifdef EnableArabic - arabicFlag=false; - englishOrArabicFlag=false; -#endif - /*---------------------------------------------------*/ - labelInputTip.setParent(0,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)); - //QFont font(Public::getFontFamily(24)); - //font.setPixelSize(20); - //labelInputTip.setFont(font); - labelInputTip.setAlignment(Qt::AlignCenter); - labelInputTip.setFrameShape(QFrame::Box); - labelInputTip.setFrameShadow(QFrame::Sunken); - labelInputTip.hide(); - /*---------------------------------------------------*/ - if(Public::ReadLanguageName() != "Chinese") - ui->Key_InputMethodSelect->setEnabled(false); - - buttonConnect(ui->Key_QuoteLeft,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_one,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_two,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_three,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_four,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_five,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_six,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_seven,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_eight,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_nine,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_zero,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Minus,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Equal,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_BracketLeft,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_BracketRight,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_BackSlash,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Semicolon,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Apostrophe,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Comma,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Period,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Slash,this,SLOT(onDigitalPunctuationClicked())); - buttonConnect(ui->Key_Space,this,SLOT(onDigitalPunctuationClicked())); - connect(ui->Key_Space, SIGNAL(pressed()), this, SLOT(spaceKeyPressed())); - connect(ui->Key_Space, SIGNAL(released()), this, SLOT(spaceKeyRelease())); - connect(&spaceTimer, SIGNAL(timeout()), this, SLOT(spaceKeyLongPressed())); - connect(&backtimer, SIGNAL(timeout()), this, SLOT(backKeyLongPressed())); - connect(&insertSpaceNumDialog,SIGNAL(accepted()),this,SLOT(onInsertSpaceNumDialogAccepted())); - buttonConnect(ui->Key_A,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_B,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_C,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_D,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_E,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_F,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_G,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_H,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_I,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_J,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_K,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_L,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_M,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_N,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_O,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_P,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_Q,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_R,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_S,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_T,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_U,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_V,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_W,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_X,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_Y,this,SLOT(onCharClicked())); - buttonConnect(ui->Key_Z,this,SLOT(onCharClicked())); - - buttonConnect(ui->Key_ShiftLeft,this,SLOT(onShiftClicked())); - - //buttonConnect(ui->Key_InputMethodSelect,this,SLOT(onInputMethodClicked())); - connect(ui->Key_InputMethodSelect,SIGNAL(released()),this,SLOT(onInputMethodClicked())); - buttonConnect(ui->Key_Backspace,this,SLOT(onBackspaceClicked())); - buttonConnect(ui->Key_Last,this,SLOT(onKeyLastClicked())); - buttonConnect(ui->Key_Next,this,SLOT(onKeyNextClicked())); - buttonConnect(ui->Key_Enter,this,SLOT(onEnterClicked())); - buttonConnect(ui->Key_Left,this,SLOT(onKeyLeftpressed())); - buttonConnect(ui->Key_Down,this,SLOT(onKeyDownpressed())); - buttonConnect(ui->Key_Up,this,SLOT(onKeyUppressed())); - buttonConnect(ui->Key_Right,this,SLOT(onKeyRightpressed())); - buttonConnect(ui->Key_Home,this,SLOT(onKeyHomepressed())); - buttonConnect(ui->Key_End,this,SLOT(onKeyEndpressed())); - buttonConnect(ui->Key_delete,this,SLOT(onKeydeletepressed())); - buttonConnect(ui->Key_SpecialChar,this,SLOT(onKeySpecialCharpressed())); - //connect(ui->Key_SpecialChar,SIGNAL(pressed()),this,SLOT(onInputMethodClicked())); - buttonConnect(ui->Key_Ctrl,this,SLOT(onKeyCtrlpressed())); - buttonConnect(ui->pushButtonCaps,this,SLOT(onpushButtonCapspressed())); - /*----------------------------------------------------------------------------------------------*/ - hanziDisplayLabels[0] = ui->hanzi_1ch; - hanziDisplayLabels[1] = ui->hanzi_2ch; - hanziDisplayLabels[2] = ui->hanzi_3ch; - hanziDisplayLabels[3] = ui->hanzi_4ch; - hanziDisplayLabels[4] = ui->hanzi_5ch; - for(int i = 0; i < HANZI_SELECT_NUM; i++){ //担心用户改动HANZI_SELECT_NUM却没改动上面 - if(!hanziDisplayLabels[i]) - QMessageBox::critical((QWidget *)0,tr("错误"),tr("hanziDisplayLabels缺少初始化")); - else{ - hanziDisplayLabels[i]->setText(""); - connect(hanziDisplayLabels[i],SIGNAL(pressed()),this,SLOT(onHanziLabelClicked())); - } - } - - userPinyinInputAppending = false; - currPinyinList = 0; - hide(); - - hanZiLabelVisibleEnable = true; - ctrlAppending = false; - setHanziLabelVisible(false); - //keyMap.insert("(","("); - //keyMap.insert(")",")"); - keyMap.insert("(","("); - keyMap.insert(")",")"); - keyMap.insert("[","["); - keyMap.insert("]","]"); - keyMap.insert("{","{"); - keyMap.insert("}","}"); - keyMap.insert("【","【"); - keyMap.insert("】","】"); - keyMap.insert("『","『"); - keyMap.insert("』","』"); - //keyMap.insert("《","《"); - //keyMap.insert("》","》"); - keyMap.insert("《","《"); - keyMap.insert("》","》"); - //keyMap.insert("<","<"); - //keyMap.insert(">",">"); - keyMap.insert("<","<"); - keyMap.insert(">",">"); - keyMap.insert("&","&&"); - keyMap.insert("&&","&"); - //keyMap.insert("(","("); - //keyMap.insert(")",")"); - keyMap.insert("(","("); - keyMap.insert(")",")"); - keyMap.insert("1","1"); - keyMap.insert("2","2"); - keyMap.insert("3","3"); - keyMap.insert("4","4"); - keyMap.insert("5","5"); - keyMap.insert("6","6"); - keyMap.insert("7","7"); - keyMap.insert("8","8"); - keyMap.insert("9","9"); - keyMap.insert("0","0"); - - keyMap.insert("`","`"); - keyMap.insert("~","~"); - keyMap.insert("·","·"); - keyMap.insert("~","~");//中文 - keyMap.insert("!","!"); - keyMap.insert("!","!");//中文 - keyMap.insert("@","@"); - keyMap.insert("#","#"); - keyMap.insert("$","$"); - keyMap.insert("¥","¥"); - keyMap.insert("%","%"); - keyMap.insert("^","^"); - keyMap.insert("…","…"); - keyMap.insert("*","*"); - keyMap.insert("-","-"); - keyMap.insert("_","_"); - keyMap.insert("—","—");//中文 - keyMap.insert("+","+"); - keyMap.insert("=","="); - keyMap.insert("\\","\\"); - keyMap.insert("|","|"); - keyMap.insert("、","、");//中文 - keyMap.insert(";",";"); - keyMap.insert(":",":"); - keyMap.insert(":",":");//中文 - keyMap.insert("'","'"); - keyMap.insert("\"","\""); - keyMap.insert("‘","‘"); - keyMap.insert("“","“"); - keyMap.insert(",",","); - keyMap.insert(",",",");//中文 - keyMap.insert(".","."); - keyMap.insert("。","。");//中文 - keyMap.insert("/","/"); - keyMap.insert("?","?"); - keyMap.insert("?","?");//中文 - - keyMap.insert("1","1"); - keyMap.insert("2","2"); - keyMap.insert("3","3"); - keyMap.insert("4","4"); - keyMap.insert("5","5"); - keyMap.insert("6","6"); - keyMap.insert("7","7"); - keyMap.insert("8","8"); - keyMap.insert("9","9"); - keyMap.insert("0","0"); -#ifdef EnableArabic - keyMap.insert("11","١"); - keyMap.insert("12","٢"); - keyMap.insert("13","٣"); - keyMap.insert("14","٤"); - keyMap.insert("15","٥"); - keyMap.insert("16","٦"); - keyMap.insert("17","٧"); - keyMap.insert("18","٨"); - keyMap.insert("19","٩"); - keyMap.insert("20","٠"); -#endif - keyMap.insert("a","a"); - keyMap.insert("b","b"); - keyMap.insert("c","c"); - keyMap.insert("d","d"); - keyMap.insert("e","e"); - keyMap.insert("f","f"); - keyMap.insert("g","g"); - keyMap.insert("h","h"); - keyMap.insert("i","i"); - keyMap.insert("j","j"); - keyMap.insert("k","k"); - keyMap.insert("l","l"); - keyMap.insert("m","m"); - keyMap.insert("n","n"); - keyMap.insert("o","o"); - keyMap.insert("p","p"); - keyMap.insert("q","q"); - keyMap.insert("r","r"); - keyMap.insert("s","s"); - keyMap.insert("t","t"); - keyMap.insert("u","u"); - keyMap.insert("v","v"); - keyMap.insert("w","w"); - keyMap.insert("x","x"); - keyMap.insert("y","y"); - keyMap.insert("z","z"); - - keyMap.insert("a","A"); - keyMap.insert("b","B"); - keyMap.insert("c","C"); - keyMap.insert("d","D"); - keyMap.insert("e","E"); - keyMap.insert("f","F"); - keyMap.insert("g","G"); - keyMap.insert("h","H"); - keyMap.insert("i","I"); - keyMap.insert("j","J"); - keyMap.insert("k","K"); - keyMap.insert("l","L"); - keyMap.insert("m","M"); - keyMap.insert("n","N"); - keyMap.insert("o","O"); - keyMap.insert("p","P"); - keyMap.insert("q","Q"); - keyMap.insert("r","R"); - keyMap.insert("s","S"); - keyMap.insert("t","T"); - keyMap.insert("u","U"); - keyMap.insert("v","V"); - keyMap.insert("w","W"); - keyMap.insert("x","X"); - keyMap.insert("y","Y"); - keyMap.insert("z","Z"); - - ui->Key_Backspace->setAutoRepeat(true); -} - - - -InputMethod::~InputMethod() -{ - delete ui; - if(InputMethod::pinyinHash != NULL){ /**/ - QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); - while (i != InputMethod::pinyinHash->constEnd()) { - delete (QList *)i.value(); - } - delete InputMethod::pinyinHash; - } - -} - -void InputMethod::buttonConnect( QPushButton *sender, - const QObject *receiver, const char *member){ - sender->setObjectName(sender->text()); - connect(sender, SIGNAL(pressed()),receiver, member); - connect(sender, SIGNAL(pressed()),this, SLOT(onKeyPressed())); - connect(sender, SIGNAL(released()),this, SLOT(onKeyReleased())); - -} - -void InputMethod::spaceKeyPressed(){ - spaceTimer.start(700); -} -void InputMethod::spaceKeyRelease(){ - spaceTimer.stop(); -} - -void InputMethod::spaceKeyLongPressed(){ - spaceTimer.stop(); - insertSpaceNumDialog.show(); -} - -void InputMethod::onInsertSpaceNumDialogAccepted(){ - int spaceNum = insertSpaceNumDialog.getSpinBoxSpaceNum()->value() - 1; - for(int i = 0; i < spaceNum; i++){ - userInputed(" "); - } -} - -void InputMethod::userInputed(QString str){ - if(myInputMethod){ - if(bengalFlag){ - if(str == "上")str = "A"; - else if(str == "下")str = "B"; - else if(str == "丌")str = "C"; - else if(str == "不")str = "D"; - else if(str == "与")str = "E"; - else if(str == "义")str = "F"; - else if(str == "丐")str = "G"; - else if(str == "丑")str = "H"; - else if(str == "之")str = "I"; - else if(str == "专")str = "J"; - else if(str == "且")str = "K"; - else if(str == "丕")str = "L"; - else if(str == "世")str = "M"; - else if(str == "乌")str = "N"; - else if(str == "丘")str = "O"; - else if(str == "丙")str = "P"; - else if(str == "业")str = "Q"; - else if(str == "丛")str = "R"; - else if(str == "东")str = "S"; - else if(str == "丝")str = "T"; - else if(str == "丞")str = "U"; - else if(str == "乎")str = "V"; - else if(str == "乏")str = "W"; - else if(str == "乐")str = "X"; - else if(str == "丢")str = "Y"; - else if(str == "乒")str = "Z"; - else if(str == "两")str = "a"; - else if(str == "严")str = "b"; - else if(str == "乓")str = "c"; - else if(str == "丧")str = "d"; - else if(str == "丨")str = "e"; - else if(str == "乔")str = "f"; - else if(str == "个")str = "g"; - else if(str == "丫")str = "h"; - else if(str == "乖")str = "i"; - else if(str == "中")str = "j"; - else if(str == "乘")str = "k"; - else if(str == "乙")str = "l"; - else if(str == "丰")str = "m"; - else if(str == "九")str = "n"; - else if(str == "串")str = "o"; - else if(str == "乞")str = "p"; - else if(str == "临")str = "q"; - else if(str == "也")str = "r"; - else if(str == "习")str = "s"; - else if(str == "乡")str = "t"; - else if(str == "丸")str = "u"; - else if(str == "丹")str = "v"; - else if(str == "为")str = "w"; - else if(str == "主")str = "x"; - else if(str == "书")str = "y"; - else if(str == "丽")str = "z"; - } - myInputMethod->sendString (str); - } - else{ - QMessageBox::warning(this,tr("warning"),tr("myInputMethod is null\n")); - } -} -/* - 用来初始化拼音表 -*/ -bool InputMethod::initInputMethod(QString &filename){ - QFile file(filename); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::critical((QWidget *)0,tr("错误"),tr("找不到输入法初始化文件") + filename); - return false; - } - QTextStream in(&file); - if(InputMethod::pinyinHash != NULL){ /*先删除,在添加*/ - QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); - /* - while (i != InputMethod::pinyinHash->constEnd()) { - QList *pQList = i.value(); - if(pQList != NULL) - { - delete pQList; - } - }*/ // 是否会有问题呢? - delete InputMethod::pinyinHash; - - } - InputMethod::pinyinHash = new QHash *> (); - while (!in.atEnd()) { - QString line = in.readLine(); - QChar *ch = line.data(); - QString pinyin = ""; - QString hanzi = ""; - if(line.size()){ - for(int i = 0; i < line.size(); i++){ - if(ch[i].unicode() < 0x80) - pinyin.append(ch[i]); - else - hanzi.append(ch[i]); - } - - if(!InputMethod::pinyinHash->contains(pinyin)) - InputMethod::pinyinHash->insert(pinyin,new QList()); - } - - QList * list = (QList *)InputMethod::pinyinHash->value(pinyin); - list->append(hanzi); - - //qDebug() << pinyin << ":" << hanzi; - } - InputMethod::pinyinHashKeys = pinyinHash->keys(); - InputMethod::pinyinHashQStringList = QStringList(InputMethod::pinyinHashKeys); - InputMethod::pinyinHashQStringList.sort(); - - file.close(); - return true; -} - -/* - 用来调试时使用,打印拼音及相关汉字 -*/ -void InputMethod::showPinyinHash(void){ - if(!InputMethod::pinyinHash) - qDebug() << "拼音哈希表为空\n"; - else { - QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); - while (i != InputMethod::pinyinHash->constEnd()) { - QList *list = (QList *)i.value(); - qDebug() << i.key() << ": "; - for (int j = 0; j < list->size(); ++j) { - qDebug() << list->at(j) << " "; - } - qDebug() << endl; - ++i; - } - } -} - - -void InputMethod::onDigitalPunctuationClicked(){ - QString text; - QPushButton * button = qobject_cast(sender()); - text = keyMap[button->text()]; - if(bengalFlag){ - if(button->text() == "一") - text = keyMap["1"]; - else if(button->text() == "丁") - text = keyMap["2"]; - else if(button->text() == "举") - text = keyMap["3"]; - else if(button->text() == "七") - text = keyMap["4"]; - else if(button->text() == "乃") - text = keyMap["5"]; - else if(button->text() == "久") - text = keyMap["6"]; - else if(button->text() == "么") - text = keyMap["7"]; - else if(button->text() == "万") - text = keyMap["8"]; - else if(button->text() == "丈") - text = keyMap["9"]; - else if(button->text() == "三") - text = keyMap["0"]; -} -#ifdef EnableArabic - if(arabicFlag){ - text = button->objectName(); - if(CapsFlag){ - if(text==";"){ - text=":"; - } - else if(text=="'"){ - text="\""; - } - else if(text=="."){ - text=">"; - } - else if(text=="/"){ - text="?"; - } - } - } -#endif - //QString text = specialKeyMap(button->text()); - if(text.isNull()) - text = " "; //处理space -// if(text == "(") -// { -// text = ")"; -// }else -// if(text == ")") -// { -// text = "("; -// } - -// if(text == "<") -// { -// text = ">"; -// }else -// if(text == ">") -// { -// text = "<"; -// } - -// if(text == "{") -// { -// text = "}"; -// }else -// if(text == "}") -// { -// text = "{"; -// } - -// if(text == "[") -// { -// text = "]"; -// }else -// if(text == "]") -// { -// text = "["; -// } - - userInputed(text); - -} - -void InputMethod::fillPinyinLabel(bool bActFromCharInput){ - - currPinyins.clear(); - matchStartIndex=0; - matchEndIndex=0; - if(!currPinyinStr.isEmpty()){ - QString Fisrt=currPinyinStr.left(1); - if(Fisrt=="u"|| Fisrt=="v"|| Fisrt=="i") - { - //bNotFound=true; - ui->pinyin->setText(currPinyinStr); - return; - } - if(currPinyinStr.size() == 1)//首字母,如果只有一个字母,只需要从出现的第一个开始 - { - QRegExp exp("^" + currPinyinStr); - matchStartIndex = InputMethod::pinyinHashQStringList.indexOf(exp); - if(matchStartIndex!=-1) - { - matchEndIndex = InputMethod::pinyinHashQStringList.size()-matchStartIndex-1; - } - bNotFound=false; - ui->pinyin->setText(currPinyinStr); - return; - } - if(!(bNotFound && bActFromCharInput))//如果不是从有拼音输入或者还没确定找不到相应的key,就往下检索 - { - //if(!pinyinHash->contains(currPinyinStr)) - { - QRegExp exp("^" + currPinyinStr); - //currPinyins = InputMethod::pinyinHashQStringList.filter(exp); - matchStartIndex = InputMethod::pinyinHashQStringList.indexOf(exp); - if(matchStartIndex!=-1) - { - bNotFound=false;//此时确定找不到相应的key - matchEndIndex = InputMethod::pinyinHashQStringList.lastIndexOf(exp, matchStartIndex); - } - else - { - bNotFound=true; - } - //qDebug()<<"currPinyins size is "<pinyin->setText(currPinyinStr);/*如果没右找到匹配,也要显示出当前的拼音*/ - - } - else{ - ui->pinyin->setText(""); - } -} - -void InputMethod::onCharClicked(){ - QPushButton * button = qobject_cast(sender()); - QString text = button->text(); -#ifdef EnableArabic - if(arabicFlag && CtrlFlag){ - text= button->objectName(); - } - else if(arabicFlag && CapsFlag){ - text= button->objectName().toUpper(); - } - else if(arabicFlag){ - text= button->objectName(); - } -#endif - if(ctrlAppending){ - qDebug()<<"control append"; -#ifndef Q_OS_WIN32 - - if(button == ui->Key_A){ //似乎进入界面后,要全选两次才生效 - MyInputMethod::sendEvent(Qt::Key_A, Qt::ControlModifier); - } - else if(button == ui->Key_C){ -//QWSServer::sendKeyEvent(0,Qt::Key_C,Qt::ControlModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_C, Qt::ControlModifier); - } - else if(button == ui->Key_V){ -//QWSServer::sendKeyEvent(0,Qt::Key_V,Qt::ControlModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_V, Qt::ControlModifier); - } - else if(button == ui->Key_X){ -//QWSServer::sendKeyEvent(0,Qt::Key_X,Qt::ControlModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_X, Qt::ControlModifier); - } - else if(button == ui->Key_Z){ -//QWSServer::sendKeyEvent(0,Qt::Key_Z,Qt::ControlModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Z, Qt::ControlModifier); - } -#endif - switchKeyboardDisplay(); - if(bengalFlag){ - if(CapsFlag) - switchKeyBoardBengalCapitalLetters(); - else - switchKeyBoardBengalLowerLetters(); - } - } - else if((currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH) || (CapsFlag /* && (currentInputMethodType != INPUT_METHOD_TYPE_VIETNAM)*/)) - { - userInputed(text); - } - else { - if(!userPinyinInputAppending) - currPinyinStr = text; - else - currPinyinStr.append(text); - fillPinyinLabel(true); - currPinyinList = 0; //initial it - pinyinPage = 0; - displayHanziToLabel(); - userPinyinInputAppending = true; - } - -} - -void InputMethod::onBackspaceClicked(void){ - if(userPinyinInputAppending){ - currPinyinList = 0; - if(currPinyinStr.size()){ - currPinyinStr = currPinyinStr.remove(currPinyinStr.size() - 1, 1); - fillPinyinLabel(false); - } - userPinyinInputAppending = currPinyinStr.size(); - displayHanziToLabel(); - } - else { -#ifndef Q_OS_WIN32 -// QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //向系统发送键盘事件 -// QWSServer::sendKeyEvent(0,Qt::Key_Backspace1,Qt::NoModifier,true,false); //向系统发送键盘事件 -#endif - MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); - } - -} -/* - 调用此函数前,设置好currPinyinStr,currPinyinList,pinyinPage -*/ -void InputMethod::displayHanziToLabel(void){ - - static QList s_list; - QList *list; - bool candicate = false; - - for(int i = 0; i < HANZI_SELECT_NUM; i++){ - hanziDisplayLabels[i]->setText(""); - } - - if(!currPinyinList && pinyinHash && currPinyinStr.size()){ //currPinyinList被置为空,说明需要重新找list - if(pinyinHash->contains(currPinyinStr)) - currPinyinList = (QList *)pinyinHash->value(currPinyinStr); - else { /*如果当前拼音无法找到,找其他备份的词*/ - //qDebug()<<"display currPinyins size is "<contains(str)){ - list = (QList *)pinyinHash->value(str); - for(int k = 0; k < list->size();k++){ - s_list.append(list->value(k)); - if(s_list.size() >= HANZI_SELECT_NUM) - break; - } - if(s_list.size() >= HANZI_SELECT_NUM) - break; - } - - } - } - candicate = true; - } - pinyinPage = 0; - } - - if(currPinyinList && currPinyinList->size()){ - - int begin = MIN(currPinyinList->size() - 1,pinyinPage*HANZI_SELECT_NUM); - int end = MIN(currPinyinList->size(),(pinyinPage + 1)*HANZI_SELECT_NUM); - //qDebug() << begin << end << currPinyinList->size(); - for(int i = begin; i < end; i++){ - hanziDisplayLabels[i%HANZI_SELECT_NUM]->setText(currPinyinList->value(i)); - //qDebug() << currPinyinList->value(i); - } - - } - else if(candicate){ - for(int i = 0; i < s_list.size() && i < HANZI_SELECT_NUM; i++){ - hanziDisplayLabels[i]->setText(s_list.value(i)); - } - } - - -} - -void InputMethod::onHanziLabelClicked(){ - - ClickLabel * label = qobject_cast(sender()); - QString text = label->text(); - if(text.size()) - userInputed(label->text()); - currPinyinStr = ""; - userPinyinInputAppending = false; - for(int i = 0; i < HANZI_SELECT_NUM; i++){ - hanziDisplayLabels[i]->setText(""); - } - matchStartIndex=0; - matchEndIndex=0; - //bNotFound=false; - currPinyins.clear(); - ui->pinyin->setText(""); - - //setHanziLabelVisible(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE); - setHanziLabelVisible(currentInputMethodType != INPUT_METHOD_TYPE_ENGLISH); -} - - - -void InputMethod::switchKeyboardDisplay(void){ - ctrlAppending = false; - if(currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH) - { - if(!shiftFlag) - { - ui->Key_QuoteLeft->setText(keyMap["`"]); - ui->Key_one->setText(keyMap["1"]); - ui->Key_two->setText(keyMap["2"]); - ui->Key_three->setText(keyMap["3"]); - ui->Key_four->setText(keyMap["4"]); - ui->Key_five->setText(keyMap["5"]); - ui->Key_six->setText(keyMap["6"]); - ui->Key_seven->setText(keyMap["7"]); - ui->Key_eight->setText(keyMap["8"]); - ui->Key_nine->setText(keyMap["9"]); - ui->Key_zero->setText(keyMap["0"]); - ui->Key_Minus->setText(keyMap["-"]); - ui->Key_Equal->setText(keyMap["="]); - ui->Key_BracketLeft->setText(keyMap["["]); - ui->Key_BracketRight->setText(keyMap["]"]); - ui->Key_BackSlash->setText(keyMap["\\"]); - ui->Key_Semicolon->setText(keyMap[";"]); - ui->Key_Apostrophe->setText(keyMap["'"]); - ui->Key_Comma->setText(keyMap[","]); - ui->Key_Period->setText(keyMap["."]); - ui->Key_Slash->setText(keyMap["/"]); - if(bengalFlag){ - switchKeyBoardBengalDigit(); - return; - } - } - else - { - ui->Key_QuoteLeft->setText("~"); - ui->Key_one->setText(keyMap["!"]); - ui->Key_two->setText(keyMap["@"]); - ui->Key_three->setText(keyMap["#"]); - ui->Key_four->setText(keyMap["$"]); - ui->Key_five->setText(keyMap["%"]); - ui->Key_six->setText(keyMap["^"]); - ui->Key_seven->setText(keyMap["&"]); - ui->Key_eight->setText(keyMap["*"]); - ui->Key_nine->setText(keyMap["("]); - ui->Key_zero->setText(keyMap[")"]); - ui->Key_Minus->setText(keyMap["_"]); - ui->Key_Equal->setText(keyMap["+"]); - ui->Key_BracketLeft->setText(keyMap["{"]); - ui->Key_BracketRight->setText(keyMap["}"]); - ui->Key_BackSlash->setText(keyMap["|"]); - ui->Key_Semicolon->setText(keyMap[":"]); - ui->Key_Apostrophe->setText(keyMap["\""]); - ui->Key_Comma->setText(keyMap["<"]); - ui->Key_Period->setText(keyMap[">"]); - ui->Key_Slash->setText(keyMap["?"]); - if(bengalFlag){ - return; - } - } - - } - else - { - if(!shiftFlag) - { - ui->Key_QuoteLeft->setText(keyMap["·"]); - ui->Key_one->setText(keyMap["1"]); - ui->Key_two->setText(keyMap["2"]); - ui->Key_three->setText(keyMap["3"]); - ui->Key_four->setText(keyMap["4"]); - ui->Key_five->setText(keyMap["5"]); - ui->Key_six->setText(keyMap["6"]); - ui->Key_seven->setText(keyMap["7"]); - ui->Key_eight->setText(keyMap["8"]); - ui->Key_nine->setText(keyMap["9"]); - ui->Key_zero->setText(keyMap["0"]); - ui->Key_Minus->setText(keyMap["-"]); - ui->Key_Equal->setText(keyMap["="]); - ui->Key_BracketLeft->setText(keyMap["【"]); - ui->Key_BracketRight->setText(keyMap["】"]); - ui->Key_BackSlash->setText(keyMap["、"]); - ui->Key_Semicolon->setText(keyMap[";"]); - ui->Key_Apostrophe->setText(keyMap["‘"]); - ui->Key_Comma->setText(keyMap[","]); - ui->Key_Period->setText(keyMap["。"]); - ui->Key_Slash->setText(keyMap["/"]); - } - else - { - ui->Key_QuoteLeft->setText("~"); - ui->Key_one->setText(keyMap["!"]); - ui->Key_two->setText(keyMap["@"]); - ui->Key_three->setText(keyMap["#"]); - ui->Key_four->setText(keyMap["¥"]); - ui->Key_five->setText(keyMap["%"]); - ui->Key_six->setText(keyMap["…"]); - ui->Key_seven->setText(keyMap["&"]); - ui->Key_eight->setText(keyMap["*"]); - ui->Key_nine->setText(keyMap["("]); - ui->Key_zero->setText(keyMap[")"]); - //ui->Key_nine->setText(keyMap["("]); - //ui->Key_zero->setText(keyMap[")"]); - ui->Key_Minus->setText(keyMap["—"]); - ui->Key_Equal->setText(keyMap["+"]); - ui->Key_BracketLeft->setText(keyMap["『"]); - ui->Key_BracketRight->setText(keyMap["』"]); - ui->Key_BackSlash->setText(keyMap["|"]); - ui->Key_Semicolon->setText(keyMap[":"]); - ui->Key_Apostrophe->setText(keyMap["“"]); - ui->Key_Comma->setText(keyMap["《"]); - ui->Key_Period->setText(keyMap["》"]); - //ui->Key_Comma->setText(keyMap["》"]); - //ui->Key_Period->setText(keyMap["《"]); - ui->Key_Slash->setText(keyMap["?"]); - } - } - ui->Key_Space->setText(" "); - if(CapsFlag) - { - ui->Key_A->setText("A"); - ui->Key_B->setText("B"); - ui->Key_C->setText("C"); - ui->Key_D->setText("D"); - ui->Key_E->setText("E"); - ui->Key_F->setText("F"); - ui->Key_G->setText("G"); - ui->Key_H->setText("H"); - ui->Key_I->setText("I"); - ui->Key_J->setText("J"); - ui->Key_K->setText("K"); - ui->Key_L->setText("L"); - ui->Key_M->setText("M"); - ui->Key_N->setText("N"); - ui->Key_O->setText("O"); - ui->Key_P->setText("P"); - ui->Key_Q->setText("Q"); - ui->Key_R->setText("R"); - ui->Key_S->setText("S"); - ui->Key_T->setText("T"); - ui->Key_U->setText("U"); - ui->Key_V->setText("V"); - ui->Key_W->setText("W"); - ui->Key_X->setText("X"); - ui->Key_Y->setText("Y"); - ui->Key_Z->setText("Z"); - } - else - { - ui->Key_A->setText("a"); - ui->Key_B->setText("b"); - ui->Key_C->setText("c"); - ui->Key_D->setText("d"); - ui->Key_E->setText("e"); - ui->Key_F->setText("f"); - ui->Key_G->setText("g"); - ui->Key_H->setText("h"); - ui->Key_I->setText("i"); - ui->Key_J->setText("j"); - ui->Key_K->setText("k"); - ui->Key_L->setText("l"); - ui->Key_M->setText("m"); - ui->Key_N->setText("n"); - ui->Key_O->setText("o"); - ui->Key_P->setText("p"); - ui->Key_Q->setText("q"); - ui->Key_R->setText("r"); - ui->Key_S->setText("s"); - ui->Key_T->setText("t"); - ui->Key_U->setText("u"); - ui->Key_V->setText("v"); - ui->Key_W->setText("w"); - ui->Key_X->setText("x"); - ui->Key_Y->setText("y"); - ui->Key_Z->setText("z"); - } -} - -void InputMethod::onShiftClicked(){ -#ifdef EnableArabic - if(arabicFlag){ - CapsFlag=false; - CtrlFlag=false; - myInputMethod->getArabicPage(1); - showArabicPage1Key(); - return; - } -#endif - shiftFlag = shiftFlag?false:true; - userPinyinInputAppending = false; - switchKeyboardDisplay(); -} -void InputMethod::onpushButtonCapspressed(){ -#ifdef EnableArabic - if(arabicFlag){ - CapsFlag = true; - CtrlFlag=false; - myInputMethod->getArabicPage(1); //page1 page2 已合并到一个字体里 - showArabicPage2Key(); - return; - } -#endif - CapsFlag = CapsFlag?false:true; - if(bengalFlag){ - if(CapsFlag) - switchKeyBoardBengalCapitalLetters(); - else - switchKeyBoardBengalLowerLetters(); - return; - } - userPinyinInputAppending = false; - ui->pushButtonCaps->setText( CapsFlag?tr("小写"):tr("大写")); - switchKeyboardDisplay(); -} - -void InputMethod::setHanziLabelVisible(bool enable){ - /*---------------------------隐藏掉一些没用的东西---------------------------------------*/ - if(hanZiLabelVisibleEnable != enable){ - ui->pinyin->setVisible(enable); - for(int i = 0; i < HANZI_SELECT_NUM; i++){ - hanziDisplayLabels[i]->setVisible(enable); - } - ui->Key_Last->setVisible(enable); - ui->Key_Next->setVisible(enable); - } - hanZiLabelVisibleEnable = enable; - /*------------------------------------------------------------------*/ -} -#include "dlgselectinputlanguage.h" - -void InputMethod::onInputMethodClicked(){ -#ifdef EnableArabic - englishOrArabicFlag=!englishOrArabicFlag; - myInputMethod->getEnglishOrAarbic(englishOrArabicFlag); - CapsFlag=false; - if(englishOrArabicFlag){ - arabicFlag=true; - showArabicPage1Key(); - ui->Key_InputMethodSelect->setText("English"); - - }else{ - arabicFlag=false; - showEnglishKey(); - ui->Key_InputMethodSelect->setText("Arabic"); - } - return; -#endif - - currentInputMethodType = (currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH)?INPUT_METHOD_TYPE_CHINESE: - //(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE)?INPUT_METHOD_TYPE_VIETNAM: - INPUT_METHOD_TYPE_ENGLISH; - - - QPushButton * button = qobject_cast(sender()); - QString filename; - if(currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH){ - button->setText(tr("英文")); - filename = INPUT_FILE_ENGLISH; - } - else if(currentInputMethodType == INPUT_METHOD_TYPE_VIETNAM){ - button->setText(tr("Tiếng Việt")); - filename = INPUT_FILE_VIETNAM; - } - else if(currentInputMethodType == INPUT_METHOD_TYPE_RUSSIAN){ - button->setText(tr("Russian")); - filename = INPUT_FILE_RUSSIAN; - } - else if(currentInputMethodType == INPUT_METHOD_TYPE_JAPANESE){ - button->setText(tr("Japanese")); - filename = INPUT_FILE_JAPANESE; - } - else{ - button->setText("中文"); - filename = INPUT_FILE_CHINESE; //INPUT_FILE_ENGLISH WINPY_utf8.txt - } - //qDebug()<SetInputFile(filename); - //SetInputFile(filename); - userPinyinInputAppending = false; - switchKeyboardDisplay(); - currPinyinStr = ""; - currPinyinList = 0; - fillPinyinLabel(false); - -// chữ thường 小写字母 - - //setHanziLabelVisible(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE || currentInputMethodType == INPUT_METHOD_TYPE_VIETNAM ); - setHanziLabelVisible(currentInputMethodType != INPUT_METHOD_TYPE_ENGLISH); - -} - -void InputMethod::onEnterClicked(){ - userInputed("\n"); -} - - -void InputMethod::onKeyLastClicked(){ - if(currPinyinList){ - if(pinyinPage) - pinyinPage --; - displayHanziToLabel(); - } -} - -void InputMethod::onKeyNextClicked(){ - if(currPinyinList){ - if(pinyinPage < (currPinyinList->size()/HANZI_SELECT_NUM)){ - pinyinPage ++; - } - displayHanziToLabel(); - } -} - - - -void InputMethod::onKeyLeftpressed() -{ -#ifndef Q_OS_WIN32 - //emit PicEditKey_Press(1); - //QWSServer::sendKeyEvent(0,Qt::Key_Left1,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); -#endif -} - -void InputMethod::onKeyDownpressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Down1,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); -#endif -} - -void InputMethod::onKeyUppressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Up1,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); -#endif -} - -void InputMethod::onKeyRightpressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Right1,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); -#endif -} - - -void InputMethod::onKeyHomepressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Home,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Home1,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Home,Qt::NoModifier); -#endif -} - -void InputMethod::onKeyEndpressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_End,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_End1,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_End,Qt::NoModifier); -#endif -} - -void InputMethod::onKeydeletepressed() -{ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Delete,Qt::NoModifier,true,false); - //QWSServer::sendKeyEvent(0,Qt::Key_Delete1,Qt::NoModifier,true,false); - MyInputMethod::sendEvent(Qt::Key_Delete,Qt::NoModifier); -#endif -} -// /usr/local/Trolltech/QtEmbedded-4.6.3/lib/fonts/BAK/WenQuanYi Zen Hei.ttf -/* - 注意:生成图片文件请使用X86版本软件,生成字库文件请使用PC版本软件。 - PC版本直接运行。 - X86版本需要虚拟环境 - */ -// ℃℉㎡±ΦφΩ◆✪@☢*✿❧ -//° ¥ ℃ ℉ ㎡ ± Φ φ Ω ◆ ✪ @ ☢ * ✿ ❧ Δ δ ζ θ Ψ Σ ι ³ ® -static QList specialChars; -void InputMethod::onKeySpecialCharpressed() -{ - static bool specialCharsInit = false; - if(!specialCharsInit){ - specialChars << "²"<<"°"<<"Ω"<<"Φ"<<"¥"<<"φ"<<"㎡"<<"℃"<<"℉"<<"®"<<"±"<<"Σ"<<"Δ"<<"@"<<"Ψ"<<"³"<<"θ"<<"◆"; - specialCharsInit = true; - } - currPinyinList = &specialChars; - displayHanziToLabel(); - if(currentInputMethodType != INPUT_METHOD_TYPE_CHINESE){ - setHanziLabelVisible(!hanZiLabelVisibleEnable); - } -} - -void InputMethod::onKeyCtrlpressed(){ -#ifdef EnableArabic - if(arabicFlag){ - CtrlFlag=true; - CapsFlag = false; - showArabicPage3Key(); - return; - } -#endif - if(!ctrlAppending){ - ui->Key_A->setText(tr("全选")); - ui->Key_C->setText(tr("复制")); - ui->Key_V->setText(tr("粘贴")); - ui->Key_X->setText(tr("剪切")); - ui->Key_Z->setText(tr("后退")); - ctrlAppending = true; - } - else { - switchKeyboardDisplay(); - if(bengalFlag){ - if(CapsFlag) - switchKeyBoardBengalCapitalLetters(); - else - switchKeyBoardBengalLowerLetters(); - } - } -} - -/* - - 2013.9.12 括号错位修复 为了节约cpu最好改用映射方式 -*/ -QString InputMethod::specialKeyMap(QString ch){ - if(ch == "(") - return ")"; - else if(ch == ")") - return "("; - else if(ch == "[") - return "]"; - else if(ch == "]") - return "["; - else if(ch == "{") - return "}"; - else if(ch == "}") - return "{"; - else if(ch == "【") - return "】"; - else if(ch == "】") - return "【"; - else if(ch == "『") - return "』"; - else if(ch == "』") - return "『"; - else if(ch == "《") - return "《"; - else if(ch == "》") - return "》"; - else if(ch == "<") - return "<"; - else if(ch == ">") - return ">"; - else if(ch == "&") - return "&&"; - else if(ch == "&&") - return "&"; - else if(ch == "(") - return ")"; - else if(ch == ")") - return "("; - else - return ch; -} - -void InputMethod::onKeyPressed(){ - QPushButton * button = qobject_cast(sender()); - QPoint point = button->mapToGlobal (QPoint(0,0)); - QRect buttonGeometry = button->geometry(); - - int x = point.x() + buttonGeometry.width()/2; - int y = point.y() + buttonGeometry.height()/2; - QRect rec = QApplication::desktop()->screenGeometry(); - x = (x>30)?(x-30):0; - x = (x > rec.width() - 60)?(rec.width() - 60):x; - y = (y > 80)?(y - 80):(y + 20); - labelInputTip.setGeometry(x,y,60,60); - QString text=button->text(); - labelInputTip.setText(keyMap[button->text()]); - //labelInputTip.setText(specialKeyMap(button->text())); - //labelInputTip.show(); - -} - -void InputMethod::onKeyReleased(){ - //QPushButton * button = qobject_cast(sender()); - labelInputTip.hide(); - -} - -void InputMethod::on_pushBottonHide_released() -{ - hide(); - - QWidget *widget = QApplication::focusWidget(); - QTextEdit *qte=dynamic_cast(widget); - if(qte){ - qte->clearFocus(); - } - -} - -void InputMethod::onHiden(){ - if(!labelInputTip.isHidden()) - labelInputTip.hide(); - if(spaceTimer.isActive()) - spaceTimer.stop(); -} - - - -void InputMethod::on_Key_Backspace_pressed() -{ - backtimer.start(50); - // MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); -} - -void InputMethod::on_Key_Backspace_released() -{ - backtimer.stop(); - back_count_timeout = 0; -} - -void InputMethod::backKeyLongPressed() -{ - if(back_count_timeout > 14) - { - if(userPinyinInputAppending){ - currPinyinList = 0; - if(currPinyinStr.size()){ - currPinyinStr = currPinyinStr.remove(currPinyinStr.size() - 1, 1); - fillPinyinLabel(false); - } - userPinyinInputAppending = currPinyinStr.size(); - displayHanziToLabel(); - } - else { -#ifndef Q_OS_WIN32 -// QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //向系统发送键盘事件 -// QWSServer::sendKeyEvent(0,Qt::Key_Backspace1,Qt::NoModifier,true,false); //向系统发送键盘事件 -#endif - } - - }else - { - back_count_timeout++; - } -} - -void InputMethod::switchKeyBoardBengalDisply(bool flag){ - bengalFlag =flag; -#ifdef EnableArabic - arabicFlag = false; -#endif - if(bengalFlag){ - CapsFlag = false; - shiftFlag = false; - switchKeyBoardBengalDigit(); - switchKeyBoardBengalLowerLetters(); - }else{ - switchKeyboardDisplay(); - } -} - -void InputMethod::switchKeyBoardBengalLowerLetters(){ - ui->Key_A->setText("两"); - ui->Key_B->setText("严"); - ui->Key_C->setText("乓"); - ui->Key_D->setText("丧"); - ui->Key_E->setText("丨"); - ui->Key_F->setText("乔"); - ui->Key_G->setText("个"); - ui->Key_H->setText("丫"); - ui->Key_I->setText("乖"); - ui->Key_J->setText("中"); - ui->Key_K->setText("乘"); - ui->Key_L->setText("乙"); - ui->Key_M->setText("丰"); - ui->Key_N->setText("九"); - ui->Key_O->setText("串"); - ui->Key_P->setText("乞"); - ui->Key_Q->setText("临"); - ui->Key_R->setText("也"); - ui->Key_S->setText("习"); - ui->Key_T->setText("乡"); - ui->Key_U->setText("丸"); - ui->Key_V->setText("丹"); - ui->Key_W->setText("为"); - ui->Key_X->setText("主"); - ui->Key_Y->setText("书"); - ui->Key_Z->setText("丽"); -} - -void InputMethod::switchKeyBoardBengalCapitalLetters(){ - ui->Key_A->setText("上"); - ui->Key_B->setText("下"); - ui->Key_C->setText("丌"); - ui->Key_D->setText("不"); - ui->Key_E->setText("与"); - ui->Key_F->setText("义"); - ui->Key_G->setText("丐"); - ui->Key_H->setText("丑"); - ui->Key_I->setText("之"); - ui->Key_J->setText("专"); - ui->Key_K->setText("且"); - ui->Key_L->setText("丕"); - ui->Key_M->setText("世"); - ui->Key_N->setText("乌"); - ui->Key_O->setText("丘"); - ui->Key_P->setText("丙"); - ui->Key_Q->setText("业"); - ui->Key_R->setText("丛"); - ui->Key_S->setText("东"); - ui->Key_T->setText("丝"); - ui->Key_U->setText("丞"); - ui->Key_V->setText("乎"); - ui->Key_W->setText("乏"); - ui->Key_X->setText("乐"); - ui->Key_Y->setText("丢"); - ui->Key_Z->setText("乒"); -} - -void InputMethod::switchKeyBoardBengalDigit(){ - ui->Key_one->setText("一"); - ui->Key_two->setText("丁"); - ui->Key_three->setText("举"); - ui->Key_four->setText("七"); - ui->Key_five->setText("乃"); - ui->Key_six->setText("久"); - ui->Key_seven->setText("么"); - ui->Key_eight->setText("万"); - ui->Key_nine->setText("丈"); - ui->Key_zero->setText("三"); -} - -#ifdef EnableArabic -void InputMethod::setSwitchArabicFlag(bool flag){ - englishOrArabicFlag=false; - arabicFlag=true; - bengalFlag = false; - ui->Key_InputMethodSelect->setEnabled(flag); -} - -void InputMethod::setArabicDisplay(bool flag){ - CapsFlag=false; - if(flag){ - //ui->pushButtonCaps->setEnabled(false); - //ui->Key_ShiftLeft->setEnabled(false); - // ui->Key_Ctrl->setEnabled(false); - arabicFlag=true; - //shiftFlag=false; - //switchKeyboardDisplay(); - showArabicPage1Key(); - }else{ - arabicFlag=false; - englishOrArabicFlag=false; - // ui->pushButtonCaps->setEnabled(true); - showEnglishKey(); - } -} - -void InputMethod::showArabicPage1Key(){ - ui->Key_one->setText(keyMap["11"]); - //ui->Key_two->setText(keyMap["12"]); - ui->Key_two->setText(""); - ui->Key_two->setIconSize(QSize(20,20)); - ui->Key_two->setIcon(QIcon(":/image/arabic2.png")); - ui->Key_three->setText(keyMap["13"]); - ui->Key_four->setText(keyMap["14"]); - ui->Key_five->setText(keyMap["15"]); - ui->Key_six->setText(keyMap["16"]); - ui->Key_seven->setText(keyMap["17"]); - ui->Key_eight->setText(keyMap["18"]); - ui->Key_nine->setText(keyMap["19"]); - ui->Key_zero->setText(keyMap["20"]); - ui->Key_Equal->setText("۶"); - ui->Key_QuoteLeft->setText("۴"); - - ui->Key_A->setText("ش"); - ui->Key_B->setText("υ"); - ui->Key_C->setText(""); - ui->Key_C->setIconSize(QSize(20,20)); - ui->Key_C->setIcon(QIcon(":/image/arabicc.png")); - ui->Key_D->setText("ي"); - ui->Key_E->setText("ث"); - ui->Key_F->setText("ب"); - ui->Key_G->setText("ل"); - ui->Key_H->setText("ﺍ"); - ui->Key_I->setText("ه"); - ui->Key_J->setText("ت"); - ui->Key_K->setIcon(QIcon("")); - ui->Key_K->setIconSize(QSize(0,0)); - ui->Key_K->setText("ن"); - ui->Key_L->setText("م"); - ui->Key_M->setText("ﺓ"); - ui->Key_N->setText("ﻯ"); - ui->Key_O->setText("خ"); - ui->Key_P->setText("ح"); - ui->Key_BracketLeft->setText("ج"); - ui->Key_Minus->setText("ذ"); - ui->Key_Semicolon->setText("ك"); - ui->Key_Apostrophe->setText("ط"); - ui->Key_Period->setText("ﺯ"); - ui->Key_Slash->setText("ﻅ"); - ui->Key_Comma->setText("ﻭ"); - ui->Key_Q->setText("ض"); - ui->Key_R->setText("ق"); - ui->Key_S->setText("س"); - ui->Key_T->setText("ف"); - ui->Key_U->setText("ع"); - ui->Key_V->setText("ﺭ"); - ui->Key_W->setText("ص"); - ui->Key_X->setText("ء"); - ui->Key_Y->setText("غ"); - ui->Key_Z->setText(""); - ui->Key_Z->setIconSize(QSize(20,20)); - ui->Key_Z->setIcon(QIcon(":/image/arabicz.png")); - - ui->Key_ShiftLeft->setText(""); - ui->Key_ShiftLeft->setIconSize(QSize(30,30)); - ui->Key_ShiftLeft->setIcon(QIcon(":/image/keyboard3.png")); - - ui->pushButtonCaps->setText(""); - ui->pushButtonCaps->setIconSize(QSize(30,30)); - ui->pushButtonCaps->setIcon(QIcon(":/image/keyboard2.png")); - - ui->Key_Ctrl->setText(""); - ui->Key_Ctrl->setIconSize(QSize(30,30)); - ui->Key_Ctrl->setIcon(QIcon(":/image/keyboard3.png")); -} - -void InputMethod::showArabicPage2Key(){ - ui->Key_one->setText(keyMap["11"]); - //ui->Key_two->setText(keyMap["12"]); - ui->Key_two->setText(""); - ui->Key_two->setIconSize(QSize(20,20)); - ui->Key_two->setIcon(QIcon(":/image/arabic2.png")); - ui->Key_three->setText(keyMap["13"]); - ui->Key_four->setText(keyMap["14"]); - //ui->Key_four->setText("۴"); - ui->Key_five->setText(keyMap["15"]); - ui->Key_six->setText(keyMap["16"]); - //ui->Key_six->setText("۶"); - ui->Key_seven->setText(keyMap["17"]); - ui->Key_eight->setText(keyMap["18"]); - ui->Key_nine->setText(keyMap["19"]); - ui->Key_zero->setText(keyMap["20"]); - - ui->Key_A->setText("ش"); - ui->Key_B->setText("ذ"); - ui->Key_C->setIcon(QIcon("")); - ui->Key_C->setIconSize(QSize(0,0)); - ui->Key_C->setText("ﺯ"); - ui->Key_D->setText("ﻯ"); - ui->Key_E->setText("ث"); - ui->Key_F->setText("ب"); - ui->Key_G->setText("ل"); - ui->Key_H->setText("ﺍ"); - ui->Key_I->setText("ه"); - ui->Key_J->setText("ت"); - ui->Key_K->setIcon(QIcon("")); - ui->Key_K->setIconSize(QSize(0,0)); - ui->Key_K->setText("ن"); - ui->Key_L->setText("م"); - ui->Key_M->setText("پ"); - ui->Key_N->setText("د"); - ui->Key_O->setText("خ"); - ui->Key_P->setText("ح"); - ui->Key_BracketLeft->setText("ج"); - //ui->Key_Minus->setText("?"); - ui->Key_Minus->setText("ذ"); - ui->Key_Semicolon->setText("ک"); - ui->Key_Apostrophe->setText("گ"); - ui->Key_Period->setText("ﺁ"); - ui->Key_Slash->setText("°"); - ui->Key_Comma->setText("ﻭ"); - ui->Key_Q->setText("ض"); - ui->Key_R->setText("ق"); - ui->Key_S->setText("س"); - ui->Key_T->setText("ف"); - ui->Key_U->setText("ع"); - ui->Key_V->setText("ﺭ"); - ui->Key_W->setText("ص"); - ui->Key_X->setText("ط"); - ui->Key_Y->setText("غ"); - ui->Key_Z->setIcon(QIcon("")); - ui->Key_Z->setIconSize(QSize(0,0)); - ui->Key_Z->setText("ﻅ"); -} - -void InputMethod::showArabicPage3Key(){ - myInputMethod->getArabicPage(3); - ui->Key_one->setText("'"); - ui->Key_two->setText(""); - ui->Key_two->setIconSize(QSize(0,0)); - ui->Key_two->setText("''"); - ui->Key_three->setText("@"); - ui->Key_four->setText("#"); - ui->Key_five->setText("%"); - ui->Key_six->setText("^"); - ui->Key_seven->setText(keyMap["&"]); - ui->Key_eight->setText("*"); - ui->Key_nine->setText("-"); - ui->Key_zero->setText("+"); - ui->Key_Minus->setText("_"); - ui->Key_Equal->setText("="); - ui->Key_QuoteLeft->setText("`"); - - ui->Key_Q->setText("ض"); - ui->Key_W->setText("!"); - ui->Key_E->setText("?"); - ui->Key_R->setText(";"); - ui->Key_T->setText(":"); - ui->Key_Y->setText(","); - ui->Key_U->setText("."); - ui->Key_I->setText("~"); - ui->Key_O->setText("|"); - ui->Key_P->setText("ح"); - ui->Key_BracketLeft->setText(keyMap["["]); - ui->Key_A->setText("$"); - ui->Key_S->setText("€"); - ui->Key_D->setText("£"); - ui->Key_F->setText("½"); - ui->Key_G->setText("°"); - ui->Key_H->setText("="); - ui->Key_J->setText("μ"); - ui->Key_K->setText(" ͣ"); - ui->Key_K->setText(""); - ui->Key_K->setIconSize(QSize(30,30)); - ui->Key_K->setIcon(QIcon(":/image/arabicl.png")); - ui->Key_L->setText("¿"); - ui->Key_Semicolon->setText("¡"); - ui->Key_Apostrophe->setText(keyMap["'"]); - ui->Key_Z->setIcon(QIcon("")); - ui->Key_Z->setIconSize(QSize(0,0)); - ui->Key_Z->setText("\\"); - ui->Key_X->setText("/"); - ui->Key_C->setIcon(QIcon("")); - ui->Key_C->setIconSize(QSize(0,0)); - ui->Key_C->setText("["); - ui->Key_V->setText("]"); - ui->Key_B->setText("<"); - ui->Key_N->setText(">"); - ui->Key_M->setText("{"); - ui->Key_Comma->setText("}"); - ui->Key_Period->setText("("); - ui->Key_Slash->setText(")"); -} - -void InputMethod::showEnglishKey(){ - - ui->Key_ShiftLeft->setEnabled(true); - ui->Key_Ctrl->setEnabled(true); - ui->Key_one->setText(keyMap["1"]); - ui->Key_two->setIcon(QIcon("")); - ui->Key_two->setIconSize(QSize(0,0)); - ui->Key_two->setText(keyMap["2"]); - ui->Key_three->setText(keyMap["3"]); - ui->Key_four->setText(keyMap["4"]); - ui->Key_five->setText(keyMap["5"]); - ui->Key_six->setText(keyMap["6"]); - ui->Key_seven->setText(keyMap["7"]); - ui->Key_eight->setText(keyMap["8"]); - ui->Key_nine->setText(keyMap["9"]); - ui->Key_zero->setText(keyMap["0"]); - ui->Key_Equal->setText("="); - ui->Key_QuoteLeft->setText("`"); - - ui->Key_A->setText("a"); - ui->Key_B->setText("b"); - ui->Key_C->setIcon(QIcon("")); - ui->Key_C->setIconSize(QSize(0,0)); - ui->Key_C->setText("c"); - ui->Key_D->setText("d"); - ui->Key_E->setText("e"); - ui->Key_F->setText("f"); - ui->Key_G->setText("g"); - ui->Key_H->setText("h"); - ui->Key_I->setText("i"); - ui->Key_J->setText("j"); - ui->Key_K->setIcon(QIcon("")); - ui->Key_K->setIconSize(QSize(0,0)); - ui->Key_K->setText("k"); - ui->Key_L->setText("l"); - ui->Key_M->setText("m"); - ui->Key_N->setText("n"); - ui->Key_O->setText("o"); - ui->Key_P->setText("p"); - ui->Key_BracketLeft->setText(keyMap["["]); - ui->Key_Minus->setText("-"); - ui->Key_Semicolon->setText(keyMap[";"]); - ui->Key_Apostrophe->setText(keyMap["'"]); - ui->Key_Period->setText(keyMap["."]); - ui->Key_Slash->setText(keyMap["/"]); - ui->Key_Comma->setText(keyMap[","]); - ui->Key_Q->setText("q"); - ui->Key_R->setText("r"); - ui->Key_S->setText("s"); - ui->Key_T->setText("t"); - ui->Key_U->setText("u"); - ui->Key_V->setText("v"); - ui->Key_W->setText("w"); - ui->Key_X->setText("x"); - ui->Key_Y->setText("y"); - ui->Key_Z->setIcon(QIcon("")); - ui->Key_Z->setIconSize(QSize(0,0)); - ui->Key_Z->setText("z"); - - ui->Key_ShiftLeft->setIcon(QIcon("")); - ui->Key_ShiftLeft->setIconSize(QSize(0,0)); - ui->Key_ShiftLeft->setText("Shift"); - - ui->pushButtonCaps->setIcon(QIcon("")); - ui->pushButtonCaps->setIconSize(QSize(0,0)); - ui->pushButtonCaps->setText("Caps\nLOCK"); - - ui->Key_InputMethodSelect->setIcon(QIcon("")); - ui->Key_InputMethodSelect->setIconSize(QSize(0,0)); - ui->Key_InputMethodSelect->setText("Arabic"); - - ui->Key_Ctrl->setIcon(QIcon("")); - ui->Key_Ctrl->setIconSize(QSize(0,0)); - ui->Key_Ctrl->setText("Ctrl"); -} -#endif +/* +* +*2013.9.12 括号错位修复 为了节约cpu最好改用映射方式 &仍未能显示出来 中文模式下小括号还是错位 +*/ +/* + Key_Backspace1 = 0x01001003, + Key_Return1 = 0x01001004, + Key_Enter1 = 0x01001005, + Key_Insert1 = 0x01001006, + Key_Delete1 = 0x01001007, + Key_Clear1 = 0x0100100b, + Key_Home1 = 0x01001010, // cursor movement + Key_End1 = 0x01001011, + Key_Left1 = 0x01001012, + Key_Up1 = 0x01001013, + Key_Right1 = 0x01001014, + Key_Down1 = 0x01001015, + Key_PageUp1 = 0x01001016, + + */ +#include +#include +#include +#include +#include +#include +#include +#include "MyInputMethod.h" +#include "InputMethod.h" +#include "ui_InputMethod.h" +#include "Public.h" +#include +#include +#include +#include +#include +#include + +QHash *> *InputMethod::pinyinHash = NULL; +QList InputMethod::pinyinHashKeys; +QStringList InputMethod::pinyinHashQStringList; + + +InputMethod::InputMethod(MyInputMethod *myInputMethod,QWidget *parent) : + QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)),//(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)如果不设置标志,会抢焦点 + ui(new Ui::InputMethod),spaceTimer(this) +{ + + //setWindowOpacity(0.9); + + this->myInputMethod = myInputMethod; + ui->setupUi(this); + currentInputMethodType = INPUT_METHOD_TYPE_ENGLISH; + shiftFlag = false; + pinyinPage = 0; + bengalFlag = false; + CapsFlag=false; + CtrlFlag=false; +#ifdef EnableArabic + arabicFlag=false; + englishOrArabicFlag=false; +#endif + /*---------------------------------------------------*/ + labelInputTip.setParent(0,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)); + //QFont font(Public::getFontFamily(24)); + //font.setPixelSize(20); + //labelInputTip.setFont(font); + labelInputTip.setAlignment(Qt::AlignCenter); + labelInputTip.setFrameShape(QFrame::Box); + labelInputTip.setFrameShadow(QFrame::Sunken); + labelInputTip.hide(); + /*---------------------------------------------------*/ + if(Public::ReadLanguageName() != "Chinese") + ui->Key_InputMethodSelect->setEnabled(false); + + buttonConnect(ui->Key_QuoteLeft,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_one,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_two,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_three,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_four,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_five,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_six,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_seven,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_eight,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_nine,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_zero,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Minus,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Equal,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_BracketLeft,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_BracketRight,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_BackSlash,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Semicolon,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Apostrophe,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Comma,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Period,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Slash,this,SLOT(onDigitalPunctuationClicked())); + buttonConnect(ui->Key_Space,this,SLOT(onDigitalPunctuationClicked())); + connect(ui->Key_Space, SIGNAL(pressed()), this, SLOT(spaceKeyPressed())); + connect(ui->Key_Space, SIGNAL(released()), this, SLOT(spaceKeyRelease())); + connect(&spaceTimer, SIGNAL(timeout()), this, SLOT(spaceKeyLongPressed())); + connect(&backtimer, SIGNAL(timeout()), this, SLOT(backKeyLongPressed())); + connect(&insertSpaceNumDialog,SIGNAL(accepted()),this,SLOT(onInsertSpaceNumDialogAccepted())); + buttonConnect(ui->Key_A,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_B,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_C,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_D,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_E,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_F,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_G,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_H,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_I,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_J,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_K,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_L,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_M,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_N,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_O,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_P,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_Q,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_R,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_S,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_T,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_U,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_V,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_W,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_X,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_Y,this,SLOT(onCharClicked())); + buttonConnect(ui->Key_Z,this,SLOT(onCharClicked())); + + buttonConnect(ui->Key_ShiftLeft,this,SLOT(onShiftClicked())); + + //buttonConnect(ui->Key_InputMethodSelect,this,SLOT(onInputMethodClicked())); + connect(ui->Key_InputMethodSelect,SIGNAL(released()),this,SLOT(onInputMethodClicked())); + buttonConnect(ui->Key_Backspace,this,SLOT(onBackspaceClicked())); + buttonConnect(ui->Key_Last,this,SLOT(onKeyLastClicked())); + buttonConnect(ui->Key_Next,this,SLOT(onKeyNextClicked())); + buttonConnect(ui->Key_Enter,this,SLOT(onEnterClicked())); + buttonConnect(ui->Key_Left,this,SLOT(onKeyLeftpressed())); + buttonConnect(ui->Key_Down,this,SLOT(onKeyDownpressed())); + buttonConnect(ui->Key_Up,this,SLOT(onKeyUppressed())); + buttonConnect(ui->Key_Right,this,SLOT(onKeyRightpressed())); + buttonConnect(ui->Key_Home,this,SLOT(onKeyHomepressed())); + buttonConnect(ui->Key_End,this,SLOT(onKeyEndpressed())); + buttonConnect(ui->Key_delete,this,SLOT(onKeydeletepressed())); + buttonConnect(ui->Key_SpecialChar,this,SLOT(onKeySpecialCharpressed())); + //connect(ui->Key_SpecialChar,SIGNAL(pressed()),this,SLOT(onInputMethodClicked())); + buttonConnect(ui->Key_Ctrl,this,SLOT(onKeyCtrlpressed())); + buttonConnect(ui->pushButtonCaps,this,SLOT(onpushButtonCapspressed())); + /*----------------------------------------------------------------------------------------------*/ + hanziDisplayLabels[0] = ui->hanzi_1ch; + hanziDisplayLabels[1] = ui->hanzi_2ch; + hanziDisplayLabels[2] = ui->hanzi_3ch; + hanziDisplayLabels[3] = ui->hanzi_4ch; + hanziDisplayLabels[4] = ui->hanzi_5ch; + for(int i = 0; i < HANZI_SELECT_NUM; i++){ //担心用户改动HANZI_SELECT_NUM却没改动上面 + if(!hanziDisplayLabels[i]) + QMessageBox::critical((QWidget *)0,tr("错误"),tr("hanziDisplayLabels缺少初始化")); + else{ + hanziDisplayLabels[i]->setText(""); + connect(hanziDisplayLabels[i],SIGNAL(pressed()),this,SLOT(onHanziLabelClicked())); + } + } + + userPinyinInputAppending = false; + currPinyinList = 0; + hide(); + + hanZiLabelVisibleEnable = true; + ctrlAppending = false; + setHanziLabelVisible(false); + //keyMap.insert("(","("); + //keyMap.insert(")",")"); + keyMap.insert("(","("); + keyMap.insert(")",")"); + keyMap.insert("[","["); + keyMap.insert("]","]"); + keyMap.insert("{","{"); + keyMap.insert("}","}"); + keyMap.insert("【","【"); + keyMap.insert("】","】"); + keyMap.insert("『","『"); + keyMap.insert("』","』"); + //keyMap.insert("《","《"); + //keyMap.insert("》","》"); + keyMap.insert("《","《"); + keyMap.insert("》","》"); + //keyMap.insert("<","<"); + //keyMap.insert(">",">"); + keyMap.insert("<","<"); + keyMap.insert(">",">"); + keyMap.insert("&","&&"); + keyMap.insert("&&","&"); + //keyMap.insert("(","("); + //keyMap.insert(")",")"); + keyMap.insert("(","("); + keyMap.insert(")",")"); + keyMap.insert("1","1"); + keyMap.insert("2","2"); + keyMap.insert("3","3"); + keyMap.insert("4","4"); + keyMap.insert("5","5"); + keyMap.insert("6","6"); + keyMap.insert("7","7"); + keyMap.insert("8","8"); + keyMap.insert("9","9"); + keyMap.insert("0","0"); + + keyMap.insert("`","`"); + keyMap.insert("~","~"); + keyMap.insert("·","·"); + keyMap.insert("~","~");//中文 + keyMap.insert("!","!"); + keyMap.insert("!","!");//中文 + keyMap.insert("@","@"); + keyMap.insert("#","#"); + keyMap.insert("$","$"); + keyMap.insert("¥","¥"); + keyMap.insert("%","%"); + keyMap.insert("^","^"); + keyMap.insert("…","…"); + keyMap.insert("*","*"); + keyMap.insert("-","-"); + keyMap.insert("_","_"); + keyMap.insert("—","—");//中文 + keyMap.insert("+","+"); + keyMap.insert("=","="); + keyMap.insert("\\","\\"); + keyMap.insert("|","|"); + keyMap.insert("、","、");//中文 + keyMap.insert(";",";"); + keyMap.insert(":",":"); + keyMap.insert(":",":");//中文 + keyMap.insert("'","'"); + keyMap.insert("\"","\""); + keyMap.insert("‘","‘"); + keyMap.insert("“","“"); + keyMap.insert(",",","); + keyMap.insert(",",",");//中文 + keyMap.insert(".","."); + keyMap.insert("。","。");//中文 + keyMap.insert("/","/"); + keyMap.insert("?","?"); + keyMap.insert("?","?");//中文 + + keyMap.insert("1","1"); + keyMap.insert("2","2"); + keyMap.insert("3","3"); + keyMap.insert("4","4"); + keyMap.insert("5","5"); + keyMap.insert("6","6"); + keyMap.insert("7","7"); + keyMap.insert("8","8"); + keyMap.insert("9","9"); + keyMap.insert("0","0"); +#ifdef EnableArabic + keyMap.insert("11","١"); + keyMap.insert("12","٢"); + keyMap.insert("13","٣"); + keyMap.insert("14","٤"); + keyMap.insert("15","٥"); + keyMap.insert("16","٦"); + keyMap.insert("17","٧"); + keyMap.insert("18","٨"); + keyMap.insert("19","٩"); + keyMap.insert("20","٠"); +#endif + keyMap.insert("a","a"); + keyMap.insert("b","b"); + keyMap.insert("c","c"); + keyMap.insert("d","d"); + keyMap.insert("e","e"); + keyMap.insert("f","f"); + keyMap.insert("g","g"); + keyMap.insert("h","h"); + keyMap.insert("i","i"); + keyMap.insert("j","j"); + keyMap.insert("k","k"); + keyMap.insert("l","l"); + keyMap.insert("m","m"); + keyMap.insert("n","n"); + keyMap.insert("o","o"); + keyMap.insert("p","p"); + keyMap.insert("q","q"); + keyMap.insert("r","r"); + keyMap.insert("s","s"); + keyMap.insert("t","t"); + keyMap.insert("u","u"); + keyMap.insert("v","v"); + keyMap.insert("w","w"); + keyMap.insert("x","x"); + keyMap.insert("y","y"); + keyMap.insert("z","z"); + + keyMap.insert("a","A"); + keyMap.insert("b","B"); + keyMap.insert("c","C"); + keyMap.insert("d","D"); + keyMap.insert("e","E"); + keyMap.insert("f","F"); + keyMap.insert("g","G"); + keyMap.insert("h","H"); + keyMap.insert("i","I"); + keyMap.insert("j","J"); + keyMap.insert("k","K"); + keyMap.insert("l","L"); + keyMap.insert("m","M"); + keyMap.insert("n","N"); + keyMap.insert("o","O"); + keyMap.insert("p","P"); + keyMap.insert("q","Q"); + keyMap.insert("r","R"); + keyMap.insert("s","S"); + keyMap.insert("t","T"); + keyMap.insert("u","U"); + keyMap.insert("v","V"); + keyMap.insert("w","W"); + keyMap.insert("x","X"); + keyMap.insert("y","Y"); + keyMap.insert("z","Z"); + + ui->Key_Backspace->setAutoRepeat(true); +} + + + +InputMethod::~InputMethod() +{ + delete ui; + if(InputMethod::pinyinHash != NULL){ /**/ + QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); + while (i != InputMethod::pinyinHash->constEnd()) { + delete (QList *)i.value(); + } + delete InputMethod::pinyinHash; + } + +} + +void InputMethod::buttonConnect( QPushButton *sender, + const QObject *receiver, const char *member){ + sender->setObjectName(sender->text()); + connect(sender, SIGNAL(pressed()),receiver, member); + connect(sender, SIGNAL(pressed()),this, SLOT(onKeyPressed())); + connect(sender, SIGNAL(released()),this, SLOT(onKeyReleased())); + +} + +void InputMethod::spaceKeyPressed(){ + spaceTimer.start(700); +} +void InputMethod::spaceKeyRelease(){ + spaceTimer.stop(); +} + +void InputMethod::spaceKeyLongPressed(){ + spaceTimer.stop(); + insertSpaceNumDialog.show(); +} + +void InputMethod::onInsertSpaceNumDialogAccepted(){ + int spaceNum = insertSpaceNumDialog.getSpinBoxSpaceNum()->value() - 1; + for(int i = 0; i < spaceNum; i++){ + userInputed(" "); + } +} + +void InputMethod::userInputed(QString str){ + if(myInputMethod){ + if(bengalFlag){ + if(str == "上")str = "A"; + else if(str == "下")str = "B"; + else if(str == "丌")str = "C"; + else if(str == "不")str = "D"; + else if(str == "与")str = "E"; + else if(str == "义")str = "F"; + else if(str == "丐")str = "G"; + else if(str == "丑")str = "H"; + else if(str == "之")str = "I"; + else if(str == "专")str = "J"; + else if(str == "且")str = "K"; + else if(str == "丕")str = "L"; + else if(str == "世")str = "M"; + else if(str == "乌")str = "N"; + else if(str == "丘")str = "O"; + else if(str == "丙")str = "P"; + else if(str == "业")str = "Q"; + else if(str == "丛")str = "R"; + else if(str == "东")str = "S"; + else if(str == "丝")str = "T"; + else if(str == "丞")str = "U"; + else if(str == "乎")str = "V"; + else if(str == "乏")str = "W"; + else if(str == "乐")str = "X"; + else if(str == "丢")str = "Y"; + else if(str == "乒")str = "Z"; + else if(str == "两")str = "a"; + else if(str == "严")str = "b"; + else if(str == "乓")str = "c"; + else if(str == "丧")str = "d"; + else if(str == "丨")str = "e"; + else if(str == "乔")str = "f"; + else if(str == "个")str = "g"; + else if(str == "丫")str = "h"; + else if(str == "乖")str = "i"; + else if(str == "中")str = "j"; + else if(str == "乘")str = "k"; + else if(str == "乙")str = "l"; + else if(str == "丰")str = "m"; + else if(str == "九")str = "n"; + else if(str == "串")str = "o"; + else if(str == "乞")str = "p"; + else if(str == "临")str = "q"; + else if(str == "也")str = "r"; + else if(str == "习")str = "s"; + else if(str == "乡")str = "t"; + else if(str == "丸")str = "u"; + else if(str == "丹")str = "v"; + else if(str == "为")str = "w"; + else if(str == "主")str = "x"; + else if(str == "书")str = "y"; + else if(str == "丽")str = "z"; + } + myInputMethod->sendString (str); + } + else{ + QMessageBox::warning(this,tr("warning"),tr("myInputMethod is null\n")); + } +} +/* + 用来初始化拼音表 +*/ +bool InputMethod::initInputMethod(QString &filename){ + QFile file(filename); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::critical((QWidget *)0,tr("错误"),tr("找不到输入法初始化文件") + filename); + return false; + } + QTextStream in(&file); + if(InputMethod::pinyinHash != NULL){ /*先删除,在添加*/ + QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); + /* + while (i != InputMethod::pinyinHash->constEnd()) { + QList *pQList = i.value(); + if(pQList != NULL) + { + delete pQList; + } + }*/ // 是否会有问题呢? + delete InputMethod::pinyinHash; + + } + InputMethod::pinyinHash = new QHash *> (); + while (!in.atEnd()) { + QString line = in.readLine(); + QChar *ch = line.data(); + QString pinyin = ""; + QString hanzi = ""; + if(line.size()){ + for(int i = 0; i < line.size(); i++){ + if(ch[i].unicode() < 0x80) + pinyin.append(ch[i]); + else + hanzi.append(ch[i]); + } + + if(!InputMethod::pinyinHash->contains(pinyin)) + InputMethod::pinyinHash->insert(pinyin,new QList()); + } + + QList * list = (QList *)InputMethod::pinyinHash->value(pinyin); + list->append(hanzi); + + //qDebug() << pinyin << ":" << hanzi; + } + InputMethod::pinyinHashKeys = pinyinHash->keys(); + InputMethod::pinyinHashQStringList = QStringList(InputMethod::pinyinHashKeys); + InputMethod::pinyinHashQStringList.sort(); + + file.close(); + return true; +} + +/* + 用来调试时使用,打印拼音及相关汉字 +*/ +void InputMethod::showPinyinHash(void){ + if(!InputMethod::pinyinHash) + qDebug() << "拼音哈希表为空\n"; + else { + QHash *>::const_iterator i = InputMethod::pinyinHash->constBegin(); + while (i != InputMethod::pinyinHash->constEnd()) { + QList *list = (QList *)i.value(); + qDebug() << i.key() << ": "; + for (int j = 0; j < list->size(); ++j) { + qDebug() << list->at(j) << " "; + } + qDebug() << endl; + ++i; + } + } +} + + +void InputMethod::onDigitalPunctuationClicked(){ + QString text; + QPushButton * button = qobject_cast(sender()); + text = keyMap[button->text()]; + if(bengalFlag){ + if(button->text() == "一") + text = keyMap["1"]; + else if(button->text() == "丁") + text = keyMap["2"]; + else if(button->text() == "举") + text = keyMap["3"]; + else if(button->text() == "七") + text = keyMap["4"]; + else if(button->text() == "乃") + text = keyMap["5"]; + else if(button->text() == "久") + text = keyMap["6"]; + else if(button->text() == "么") + text = keyMap["7"]; + else if(button->text() == "万") + text = keyMap["8"]; + else if(button->text() == "丈") + text = keyMap["9"]; + else if(button->text() == "三") + text = keyMap["0"]; +} +#ifdef EnableArabic + if(arabicFlag){ + text = button->objectName(); + if(CapsFlag){ + if(text==";"){ + text=":"; + } + else if(text=="'"){ + text="\""; + } + else if(text=="."){ + text=">"; + } + else if(text=="/"){ + text="?"; + } + } + } +#endif + //QString text = specialKeyMap(button->text()); + if(text.isNull()) + text = " "; //处理space +// if(text == "(") +// { +// text = ")"; +// }else +// if(text == ")") +// { +// text = "("; +// } + +// if(text == "<") +// { +// text = ">"; +// }else +// if(text == ">") +// { +// text = "<"; +// } + +// if(text == "{") +// { +// text = "}"; +// }else +// if(text == "}") +// { +// text = "{"; +// } + +// if(text == "[") +// { +// text = "]"; +// }else +// if(text == "]") +// { +// text = "["; +// } + + userInputed(text); + +} + +void InputMethod::fillPinyinLabel(bool bActFromCharInput){ + + currPinyins.clear(); + matchStartIndex=0; + matchEndIndex=0; + if(!currPinyinStr.isEmpty()){ + QString Fisrt=currPinyinStr.left(1); + if(Fisrt=="u"|| Fisrt=="v"|| Fisrt=="i") + { + //bNotFound=true; + ui->pinyin->setText(currPinyinStr); + return; + } + if(currPinyinStr.size() == 1)//首字母,如果只有一个字母,只需要从出现的第一个开始 + { + QRegExp exp("^" + currPinyinStr); + matchStartIndex = InputMethod::pinyinHashQStringList.indexOf(exp); + if(matchStartIndex!=-1) + { + matchEndIndex = InputMethod::pinyinHashQStringList.size()-matchStartIndex-1; + } + bNotFound=false; + ui->pinyin->setText(currPinyinStr); + return; + } + if(!(bNotFound && bActFromCharInput))//如果不是从有拼音输入或者还没确定找不到相应的key,就往下检索 + { + //if(!pinyinHash->contains(currPinyinStr)) + { + QRegExp exp("^" + currPinyinStr); + //currPinyins = InputMethod::pinyinHashQStringList.filter(exp); + matchStartIndex = InputMethod::pinyinHashQStringList.indexOf(exp); + if(matchStartIndex!=-1) + { + bNotFound=false;//此时确定找不到相应的key + matchEndIndex = InputMethod::pinyinHashQStringList.lastIndexOf(exp, matchStartIndex); + } + else + { + bNotFound=true; + } + //qDebug()<<"currPinyins size is "<pinyin->setText(currPinyinStr);/*如果没右找到匹配,也要显示出当前的拼音*/ + + } + else{ + ui->pinyin->setText(""); + } +} + +void InputMethod::onCharClicked(){ + QPushButton * button = qobject_cast(sender()); + QString text = button->text(); +#ifdef EnableArabic + if(arabicFlag && CtrlFlag){ + text= button->objectName(); + } + else if(arabicFlag && CapsFlag){ + text= button->objectName().toUpper(); + } + else if(arabicFlag){ + text= button->objectName(); + } +#endif + if(ctrlAppending){ + qDebug()<<"control append"; +#ifndef Q_OS_WIN32 + + if(button == ui->Key_A){ //似乎进入界面后,要全选两次才生效 + MyInputMethod::sendEvent(Qt::Key_A, Qt::ControlModifier); + } + else if(button == ui->Key_C){ +//QWSServer::sendKeyEvent(0,Qt::Key_C,Qt::ControlModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_C, Qt::ControlModifier); + } + else if(button == ui->Key_V){ +//QWSServer::sendKeyEvent(0,Qt::Key_V,Qt::ControlModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_V, Qt::ControlModifier); + } + else if(button == ui->Key_X){ +//QWSServer::sendKeyEvent(0,Qt::Key_X,Qt::ControlModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_X, Qt::ControlModifier); + } + else if(button == ui->Key_Z){ +//QWSServer::sendKeyEvent(0,Qt::Key_Z,Qt::ControlModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Z, Qt::ControlModifier); + } +#endif + switchKeyboardDisplay(); + if(bengalFlag){ + if(CapsFlag) + switchKeyBoardBengalCapitalLetters(); + else + switchKeyBoardBengalLowerLetters(); + } + } + else if((currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH) || (CapsFlag /* && (currentInputMethodType != INPUT_METHOD_TYPE_VIETNAM)*/)) + { + userInputed(text); + } + else { + if(!userPinyinInputAppending) + currPinyinStr = text; + else + currPinyinStr.append(text); + fillPinyinLabel(true); + currPinyinList = 0; //initial it + pinyinPage = 0; + displayHanziToLabel(); + userPinyinInputAppending = true; + } + +} + +void InputMethod::onBackspaceClicked(void){ + if(userPinyinInputAppending){ + currPinyinList = 0; + if(currPinyinStr.size()){ + currPinyinStr = currPinyinStr.remove(currPinyinStr.size() - 1, 1); + fillPinyinLabel(false); + } + userPinyinInputAppending = currPinyinStr.size(); + displayHanziToLabel(); + } + else { +#ifndef Q_OS_WIN32 +// QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //向系统发送键盘事件 +// QWSServer::sendKeyEvent(0,Qt::Key_Backspace1,Qt::NoModifier,true,false); //向系统发送键盘事件 +#endif + MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); + } + +} +/* + 调用此函数前,设置好currPinyinStr,currPinyinList,pinyinPage +*/ +void InputMethod::displayHanziToLabel(void){ + + static QList s_list; + QList *list; + bool candicate = false; + + for(int i = 0; i < HANZI_SELECT_NUM; i++){ + hanziDisplayLabels[i]->setText(""); + } + + if(!currPinyinList && pinyinHash && currPinyinStr.size()){ //currPinyinList被置为空,说明需要重新找list + if(pinyinHash->contains(currPinyinStr)) + currPinyinList = (QList *)pinyinHash->value(currPinyinStr); + else { /*如果当前拼音无法找到,找其他备份的词*/ + //qDebug()<<"display currPinyins size is "<contains(str)){ + list = (QList *)pinyinHash->value(str); + for(int k = 0; k < list->size();k++){ + s_list.append(list->value(k)); + if(s_list.size() >= HANZI_SELECT_NUM) + break; + } + if(s_list.size() >= HANZI_SELECT_NUM) + break; + } + + } + } + candicate = true; + } + pinyinPage = 0; + } + + if(currPinyinList && currPinyinList->size()){ + + int begin = MIN(currPinyinList->size() - 1,pinyinPage*HANZI_SELECT_NUM); + int end = MIN(currPinyinList->size(),(pinyinPage + 1)*HANZI_SELECT_NUM); + //qDebug() << begin << end << currPinyinList->size(); + for(int i = begin; i < end; i++){ + hanziDisplayLabels[i%HANZI_SELECT_NUM]->setText(currPinyinList->value(i)); + //qDebug() << currPinyinList->value(i); + } + + } + else if(candicate){ + for(int i = 0; i < s_list.size() && i < HANZI_SELECT_NUM; i++){ + hanziDisplayLabels[i]->setText(s_list.value(i)); + } + } + + +} + +void InputMethod::onHanziLabelClicked(){ + + ClickLabel * label = qobject_cast(sender()); + QString text = label->text(); + if(text.size()) + userInputed(label->text()); + currPinyinStr = ""; + userPinyinInputAppending = false; + for(int i = 0; i < HANZI_SELECT_NUM; i++){ + hanziDisplayLabels[i]->setText(""); + } + matchStartIndex=0; + matchEndIndex=0; + //bNotFound=false; + currPinyins.clear(); + ui->pinyin->setText(""); + + //setHanziLabelVisible(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE); + setHanziLabelVisible(currentInputMethodType != INPUT_METHOD_TYPE_ENGLISH); +} + + + +void InputMethod::switchKeyboardDisplay(void){ + ctrlAppending = false; + if(currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH) + { + if(!shiftFlag) + { + ui->Key_QuoteLeft->setText(keyMap["`"]); + ui->Key_one->setText(keyMap["1"]); + ui->Key_two->setText(keyMap["2"]); + ui->Key_three->setText(keyMap["3"]); + ui->Key_four->setText(keyMap["4"]); + ui->Key_five->setText(keyMap["5"]); + ui->Key_six->setText(keyMap["6"]); + ui->Key_seven->setText(keyMap["7"]); + ui->Key_eight->setText(keyMap["8"]); + ui->Key_nine->setText(keyMap["9"]); + ui->Key_zero->setText(keyMap["0"]); + ui->Key_Minus->setText(keyMap["-"]); + ui->Key_Equal->setText(keyMap["="]); + ui->Key_BracketLeft->setText(keyMap["["]); + ui->Key_BracketRight->setText(keyMap["]"]); + ui->Key_BackSlash->setText(keyMap["\\"]); + ui->Key_Semicolon->setText(keyMap[";"]); + ui->Key_Apostrophe->setText(keyMap["'"]); + ui->Key_Comma->setText(keyMap[","]); + ui->Key_Period->setText(keyMap["."]); + ui->Key_Slash->setText(keyMap["/"]); + if(bengalFlag){ + switchKeyBoardBengalDigit(); + return; + } + } + else + { + ui->Key_QuoteLeft->setText("~"); + ui->Key_one->setText(keyMap["!"]); + ui->Key_two->setText(keyMap["@"]); + ui->Key_three->setText(keyMap["#"]); + ui->Key_four->setText(keyMap["$"]); + ui->Key_five->setText(keyMap["%"]); + ui->Key_six->setText(keyMap["^"]); + ui->Key_seven->setText(keyMap["&"]); + ui->Key_eight->setText(keyMap["*"]); + ui->Key_nine->setText(keyMap["("]); + ui->Key_zero->setText(keyMap[")"]); + ui->Key_Minus->setText(keyMap["_"]); + ui->Key_Equal->setText(keyMap["+"]); + ui->Key_BracketLeft->setText(keyMap["{"]); + ui->Key_BracketRight->setText(keyMap["}"]); + ui->Key_BackSlash->setText(keyMap["|"]); + ui->Key_Semicolon->setText(keyMap[":"]); + ui->Key_Apostrophe->setText(keyMap["\""]); + ui->Key_Comma->setText(keyMap["<"]); + ui->Key_Period->setText(keyMap[">"]); + ui->Key_Slash->setText(keyMap["?"]); + if(bengalFlag){ + return; + } + } + + } + else + { + if(!shiftFlag) + { + ui->Key_QuoteLeft->setText(keyMap["·"]); + ui->Key_one->setText(keyMap["1"]); + ui->Key_two->setText(keyMap["2"]); + ui->Key_three->setText(keyMap["3"]); + ui->Key_four->setText(keyMap["4"]); + ui->Key_five->setText(keyMap["5"]); + ui->Key_six->setText(keyMap["6"]); + ui->Key_seven->setText(keyMap["7"]); + ui->Key_eight->setText(keyMap["8"]); + ui->Key_nine->setText(keyMap["9"]); + ui->Key_zero->setText(keyMap["0"]); + ui->Key_Minus->setText(keyMap["-"]); + ui->Key_Equal->setText(keyMap["="]); + ui->Key_BracketLeft->setText(keyMap["【"]); + ui->Key_BracketRight->setText(keyMap["】"]); + ui->Key_BackSlash->setText(keyMap["、"]); + ui->Key_Semicolon->setText(keyMap[";"]); + ui->Key_Apostrophe->setText(keyMap["‘"]); + ui->Key_Comma->setText(keyMap[","]); + ui->Key_Period->setText(keyMap["。"]); + ui->Key_Slash->setText(keyMap["/"]); + } + else + { + ui->Key_QuoteLeft->setText("~"); + ui->Key_one->setText(keyMap["!"]); + ui->Key_two->setText(keyMap["@"]); + ui->Key_three->setText(keyMap["#"]); + ui->Key_four->setText(keyMap["¥"]); + ui->Key_five->setText(keyMap["%"]); + ui->Key_six->setText(keyMap["…"]); + ui->Key_seven->setText(keyMap["&"]); + ui->Key_eight->setText(keyMap["*"]); + ui->Key_nine->setText(keyMap["("]); + ui->Key_zero->setText(keyMap[")"]); + //ui->Key_nine->setText(keyMap["("]); + //ui->Key_zero->setText(keyMap[")"]); + ui->Key_Minus->setText(keyMap["—"]); + ui->Key_Equal->setText(keyMap["+"]); + ui->Key_BracketLeft->setText(keyMap["『"]); + ui->Key_BracketRight->setText(keyMap["』"]); + ui->Key_BackSlash->setText(keyMap["|"]); + ui->Key_Semicolon->setText(keyMap[":"]); + ui->Key_Apostrophe->setText(keyMap["“"]); + ui->Key_Comma->setText(keyMap["《"]); + ui->Key_Period->setText(keyMap["》"]); + //ui->Key_Comma->setText(keyMap["》"]); + //ui->Key_Period->setText(keyMap["《"]); + ui->Key_Slash->setText(keyMap["?"]); + } + } + ui->Key_Space->setText(" "); + if(CapsFlag) + { + ui->Key_A->setText("A"); + ui->Key_B->setText("B"); + ui->Key_C->setText("C"); + ui->Key_D->setText("D"); + ui->Key_E->setText("E"); + ui->Key_F->setText("F"); + ui->Key_G->setText("G"); + ui->Key_H->setText("H"); + ui->Key_I->setText("I"); + ui->Key_J->setText("J"); + ui->Key_K->setText("K"); + ui->Key_L->setText("L"); + ui->Key_M->setText("M"); + ui->Key_N->setText("N"); + ui->Key_O->setText("O"); + ui->Key_P->setText("P"); + ui->Key_Q->setText("Q"); + ui->Key_R->setText("R"); + ui->Key_S->setText("S"); + ui->Key_T->setText("T"); + ui->Key_U->setText("U"); + ui->Key_V->setText("V"); + ui->Key_W->setText("W"); + ui->Key_X->setText("X"); + ui->Key_Y->setText("Y"); + ui->Key_Z->setText("Z"); + } + else + { + ui->Key_A->setText("a"); + ui->Key_B->setText("b"); + ui->Key_C->setText("c"); + ui->Key_D->setText("d"); + ui->Key_E->setText("e"); + ui->Key_F->setText("f"); + ui->Key_G->setText("g"); + ui->Key_H->setText("h"); + ui->Key_I->setText("i"); + ui->Key_J->setText("j"); + ui->Key_K->setText("k"); + ui->Key_L->setText("l"); + ui->Key_M->setText("m"); + ui->Key_N->setText("n"); + ui->Key_O->setText("o"); + ui->Key_P->setText("p"); + ui->Key_Q->setText("q"); + ui->Key_R->setText("r"); + ui->Key_S->setText("s"); + ui->Key_T->setText("t"); + ui->Key_U->setText("u"); + ui->Key_V->setText("v"); + ui->Key_W->setText("w"); + ui->Key_X->setText("x"); + ui->Key_Y->setText("y"); + ui->Key_Z->setText("z"); + } +} + +void InputMethod::onShiftClicked(){ +#ifdef EnableArabic + if(arabicFlag){ + CapsFlag=false; + CtrlFlag=false; + myInputMethod->getArabicPage(1); + showArabicPage1Key(); + return; + } +#endif + shiftFlag = shiftFlag?false:true; + userPinyinInputAppending = false; + switchKeyboardDisplay(); +} +void InputMethod::onpushButtonCapspressed(){ +#ifdef EnableArabic + if(arabicFlag){ + CapsFlag = true; + CtrlFlag=false; + myInputMethod->getArabicPage(1); //page1 page2 已合并到一个字体里 + showArabicPage2Key(); + return; + } +#endif + CapsFlag = CapsFlag?false:true; + if(bengalFlag){ + if(CapsFlag) + switchKeyBoardBengalCapitalLetters(); + else + switchKeyBoardBengalLowerLetters(); + return; + } + userPinyinInputAppending = false; + ui->pushButtonCaps->setText( CapsFlag?tr("小写"):tr("大写")); + switchKeyboardDisplay(); +} + +void InputMethod::setHanziLabelVisible(bool enable){ + /*---------------------------隐藏掉一些没用的东西---------------------------------------*/ + if(hanZiLabelVisibleEnable != enable){ + ui->pinyin->setVisible(enable); + for(int i = 0; i < HANZI_SELECT_NUM; i++){ + hanziDisplayLabels[i]->setVisible(enable); + } + ui->Key_Last->setVisible(enable); + ui->Key_Next->setVisible(enable); + } + hanZiLabelVisibleEnable = enable; + /*------------------------------------------------------------------*/ +} +#include "dlgselectinputlanguage.h" + +void InputMethod::onInputMethodClicked(){ +#ifdef EnableArabic + englishOrArabicFlag=!englishOrArabicFlag; + myInputMethod->getEnglishOrAarbic(englishOrArabicFlag); + CapsFlag=false; + if(englishOrArabicFlag){ + arabicFlag=true; + showArabicPage1Key(); + ui->Key_InputMethodSelect->setText("English"); + + }else{ + arabicFlag=false; + showEnglishKey(); + ui->Key_InputMethodSelect->setText("Arabic"); + } + return; +#endif + + currentInputMethodType = (currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH)?INPUT_METHOD_TYPE_CHINESE: + //(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE)?INPUT_METHOD_TYPE_VIETNAM: + INPUT_METHOD_TYPE_ENGLISH; + + + QPushButton * button = qobject_cast(sender()); + QString filename; + if(currentInputMethodType == INPUT_METHOD_TYPE_ENGLISH){ + button->setText(tr("英文")); + filename = INPUT_FILE_ENGLISH; + } + else if(currentInputMethodType == INPUT_METHOD_TYPE_VIETNAM){ + button->setText(tr("Tiếng Việt")); + filename = INPUT_FILE_VIETNAM; + } + else if(currentInputMethodType == INPUT_METHOD_TYPE_RUSSIAN){ + button->setText(tr("Russian")); + filename = INPUT_FILE_RUSSIAN; + } + else if(currentInputMethodType == INPUT_METHOD_TYPE_JAPANESE){ + button->setText(tr("Japanese")); + filename = INPUT_FILE_JAPANESE; + } + else{ + button->setText("中文"); + filename = INPUT_FILE_CHINESE; //INPUT_FILE_ENGLISH WINPY_utf8.txt + } + //qDebug()<SetInputFile(filename); + //SetInputFile(filename); + userPinyinInputAppending = false; + switchKeyboardDisplay(); + currPinyinStr = ""; + currPinyinList = 0; + fillPinyinLabel(false); + +// chữ thường 小写字母 + + //setHanziLabelVisible(currentInputMethodType == INPUT_METHOD_TYPE_CHINESE || currentInputMethodType == INPUT_METHOD_TYPE_VIETNAM ); + setHanziLabelVisible(currentInputMethodType != INPUT_METHOD_TYPE_ENGLISH); + +} + +void InputMethod::onEnterClicked(){ + userInputed("\n"); +} + + +void InputMethod::onKeyLastClicked(){ + if(currPinyinList){ + if(pinyinPage) + pinyinPage --; + displayHanziToLabel(); + } +} + +void InputMethod::onKeyNextClicked(){ + if(currPinyinList){ + if(pinyinPage < (currPinyinList->size()/HANZI_SELECT_NUM)){ + pinyinPage ++; + } + displayHanziToLabel(); + } +} + + + +void InputMethod::onKeyLeftpressed() +{ +#ifndef Q_OS_WIN32 + //emit PicEditKey_Press(1); + //QWSServer::sendKeyEvent(0,Qt::Key_Left1,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); +#endif +} + +void InputMethod::onKeyDownpressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Down1,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); +#endif +} + +void InputMethod::onKeyUppressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Up1,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); +#endif +} + +void InputMethod::onKeyRightpressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Right1,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); +#endif +} + + +void InputMethod::onKeyHomepressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Home,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Home1,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Home,Qt::NoModifier); +#endif +} + +void InputMethod::onKeyEndpressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_End,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_End1,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_End,Qt::NoModifier); +#endif +} + +void InputMethod::onKeydeletepressed() +{ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Delete,Qt::NoModifier,true,false); + //QWSServer::sendKeyEvent(0,Qt::Key_Delete1,Qt::NoModifier,true,false); + MyInputMethod::sendEvent(Qt::Key_Delete,Qt::NoModifier); +#endif +} +// /usr/local/Trolltech/QtEmbedded-4.6.3/lib/fonts/BAK/WenQuanYi Zen Hei.ttf +/* + 注意:生成图片文件请使用X86版本软件,生成字库文件请使用PC版本软件。 + PC版本直接运行。 + X86版本需要虚拟环境 + */ +// ℃℉㎡±ΦφΩ◆✪@☢*✿❧ +//° ¥ ℃ ℉ ㎡ ± Φ φ Ω ◆ ✪ @ ☢ * ✿ ❧ Δ δ ζ θ Ψ Σ ι ³ ® +static QList specialChars; +void InputMethod::onKeySpecialCharpressed() +{ + static bool specialCharsInit = false; + if(!specialCharsInit){ + specialChars << "²"<<"°"<<"Ω"<<"Φ"<<"¥"<<"φ"<<"㎡"<<"℃"<<"℉"<<"®"<<"±"<<"Σ"<<"Δ"<<"@"<<"Ψ"<<"³"<<"θ"<<"◆"; + specialCharsInit = true; + } + currPinyinList = &specialChars; + displayHanziToLabel(); + if(currentInputMethodType != INPUT_METHOD_TYPE_CHINESE){ + setHanziLabelVisible(!hanZiLabelVisibleEnable); + } +} + +void InputMethod::onKeyCtrlpressed(){ +#ifdef EnableArabic + if(arabicFlag){ + CtrlFlag=true; + CapsFlag = false; + showArabicPage3Key(); + return; + } +#endif + if(!ctrlAppending){ + ui->Key_A->setText(tr("全选")); + ui->Key_C->setText(tr("复制")); + ui->Key_V->setText(tr("粘贴")); + ui->Key_X->setText(tr("剪切")); + ui->Key_Z->setText(tr("后退")); + ctrlAppending = true; + } + else { + switchKeyboardDisplay(); + if(bengalFlag){ + if(CapsFlag) + switchKeyBoardBengalCapitalLetters(); + else + switchKeyBoardBengalLowerLetters(); + } + } +} + +/* + + 2013.9.12 括号错位修复 为了节约cpu最好改用映射方式 +*/ +QString InputMethod::specialKeyMap(QString ch){ + if(ch == "(") + return ")"; + else if(ch == ")") + return "("; + else if(ch == "[") + return "]"; + else if(ch == "]") + return "["; + else if(ch == "{") + return "}"; + else if(ch == "}") + return "{"; + else if(ch == "【") + return "】"; + else if(ch == "】") + return "【"; + else if(ch == "『") + return "』"; + else if(ch == "』") + return "『"; + else if(ch == "《") + return "《"; + else if(ch == "》") + return "》"; + else if(ch == "<") + return "<"; + else if(ch == ">") + return ">"; + else if(ch == "&") + return "&&"; + else if(ch == "&&") + return "&"; + else if(ch == "(") + return ")"; + else if(ch == ")") + return "("; + else + return ch; +} + +void InputMethod::onKeyPressed(){ + QPushButton * button = qobject_cast(sender()); + QPoint point = button->mapToGlobal (QPoint(0,0)); + QRect buttonGeometry = button->geometry(); + + int x = point.x() + buttonGeometry.width()/2; + int y = point.y() + buttonGeometry.height()/2; + QRect rec = QApplication::desktop()->screenGeometry(); + x = (x>30)?(x-30):0; + x = (x > rec.width() - 60)?(rec.width() - 60):x; + y = (y > 80)?(y - 80):(y + 20); + labelInputTip.setGeometry(x,y,60,60); + QString text=button->text(); + labelInputTip.setText(keyMap[button->text()]); + //labelInputTip.setText(specialKeyMap(button->text())); + //labelInputTip.show(); + +} + +void InputMethod::onKeyReleased(){ + //QPushButton * button = qobject_cast(sender()); + labelInputTip.hide(); + +} + +void InputMethod::on_pushBottonHide_released() +{ + hide(); + + QWidget *widget = QApplication::focusWidget(); + QTextEdit *qte=dynamic_cast(widget); + if(qte){ + qte->clearFocus(); + } + +} + +void InputMethod::onHiden(){ + if(!labelInputTip.isHidden()) + labelInputTip.hide(); + if(spaceTimer.isActive()) + spaceTimer.stop(); +} + + + +void InputMethod::on_Key_Backspace_pressed() +{ + backtimer.start(50); + // MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier); +} + +void InputMethod::on_Key_Backspace_released() +{ + backtimer.stop(); + back_count_timeout = 0; +} + +void InputMethod::backKeyLongPressed() +{ + if(back_count_timeout > 14) + { + if(userPinyinInputAppending){ + currPinyinList = 0; + if(currPinyinStr.size()){ + currPinyinStr = currPinyinStr.remove(currPinyinStr.size() - 1, 1); + fillPinyinLabel(false); + } + userPinyinInputAppending = currPinyinStr.size(); + displayHanziToLabel(); + } + else { +#ifndef Q_OS_WIN32 +// QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //向系统发送键盘事件 +// QWSServer::sendKeyEvent(0,Qt::Key_Backspace1,Qt::NoModifier,true,false); //向系统发送键盘事件 +#endif + } + + }else + { + back_count_timeout++; + } +} + +void InputMethod::switchKeyBoardBengalDisply(bool flag){ + bengalFlag =flag; +#ifdef EnableArabic + arabicFlag = false; +#endif + if(bengalFlag){ + CapsFlag = false; + shiftFlag = false; + switchKeyBoardBengalDigit(); + switchKeyBoardBengalLowerLetters(); + }else{ + switchKeyboardDisplay(); + } +} + +void InputMethod::switchKeyBoardBengalLowerLetters(){ + ui->Key_A->setText("两"); + ui->Key_B->setText("严"); + ui->Key_C->setText("乓"); + ui->Key_D->setText("丧"); + ui->Key_E->setText("丨"); + ui->Key_F->setText("乔"); + ui->Key_G->setText("个"); + ui->Key_H->setText("丫"); + ui->Key_I->setText("乖"); + ui->Key_J->setText("中"); + ui->Key_K->setText("乘"); + ui->Key_L->setText("乙"); + ui->Key_M->setText("丰"); + ui->Key_N->setText("九"); + ui->Key_O->setText("串"); + ui->Key_P->setText("乞"); + ui->Key_Q->setText("临"); + ui->Key_R->setText("也"); + ui->Key_S->setText("习"); + ui->Key_T->setText("乡"); + ui->Key_U->setText("丸"); + ui->Key_V->setText("丹"); + ui->Key_W->setText("为"); + ui->Key_X->setText("主"); + ui->Key_Y->setText("书"); + ui->Key_Z->setText("丽"); +} + +void InputMethod::switchKeyBoardBengalCapitalLetters(){ + ui->Key_A->setText("上"); + ui->Key_B->setText("下"); + ui->Key_C->setText("丌"); + ui->Key_D->setText("不"); + ui->Key_E->setText("与"); + ui->Key_F->setText("义"); + ui->Key_G->setText("丐"); + ui->Key_H->setText("丑"); + ui->Key_I->setText("之"); + ui->Key_J->setText("专"); + ui->Key_K->setText("且"); + ui->Key_L->setText("丕"); + ui->Key_M->setText("世"); + ui->Key_N->setText("乌"); + ui->Key_O->setText("丘"); + ui->Key_P->setText("丙"); + ui->Key_Q->setText("业"); + ui->Key_R->setText("丛"); + ui->Key_S->setText("东"); + ui->Key_T->setText("丝"); + ui->Key_U->setText("丞"); + ui->Key_V->setText("乎"); + ui->Key_W->setText("乏"); + ui->Key_X->setText("乐"); + ui->Key_Y->setText("丢"); + ui->Key_Z->setText("乒"); +} + +void InputMethod::switchKeyBoardBengalDigit(){ + ui->Key_one->setText("一"); + ui->Key_two->setText("丁"); + ui->Key_three->setText("举"); + ui->Key_four->setText("七"); + ui->Key_five->setText("乃"); + ui->Key_six->setText("久"); + ui->Key_seven->setText("么"); + ui->Key_eight->setText("万"); + ui->Key_nine->setText("丈"); + ui->Key_zero->setText("三"); +} + +#ifdef EnableArabic +void InputMethod::setSwitchArabicFlag(bool flag){ + englishOrArabicFlag=false; + arabicFlag=true; + bengalFlag = false; + ui->Key_InputMethodSelect->setEnabled(flag); +} + +void InputMethod::setArabicDisplay(bool flag){ + CapsFlag=false; + if(flag){ + //ui->pushButtonCaps->setEnabled(false); + //ui->Key_ShiftLeft->setEnabled(false); + // ui->Key_Ctrl->setEnabled(false); + arabicFlag=true; + //shiftFlag=false; + //switchKeyboardDisplay(); + showArabicPage1Key(); + }else{ + arabicFlag=false; + englishOrArabicFlag=false; + // ui->pushButtonCaps->setEnabled(true); + showEnglishKey(); + } +} + +void InputMethod::showArabicPage1Key(){ + ui->Key_one->setText(keyMap["11"]); + //ui->Key_two->setText(keyMap["12"]); + ui->Key_two->setText(""); + ui->Key_two->setIconSize(QSize(20,20)); + ui->Key_two->setIcon(QIcon(":/image/arabic2.png")); + ui->Key_three->setText(keyMap["13"]); + ui->Key_four->setText(keyMap["14"]); + ui->Key_five->setText(keyMap["15"]); + ui->Key_six->setText(keyMap["16"]); + ui->Key_seven->setText(keyMap["17"]); + ui->Key_eight->setText(keyMap["18"]); + ui->Key_nine->setText(keyMap["19"]); + ui->Key_zero->setText(keyMap["20"]); + ui->Key_Equal->setText("۶"); + ui->Key_QuoteLeft->setText("۴"); + + ui->Key_A->setText("ش"); + ui->Key_B->setText("υ"); + ui->Key_C->setText(""); + ui->Key_C->setIconSize(QSize(20,20)); + ui->Key_C->setIcon(QIcon(":/image/arabicc.png")); + ui->Key_D->setText("ي"); + ui->Key_E->setText("ث"); + ui->Key_F->setText("ب"); + ui->Key_G->setText("ل"); + ui->Key_H->setText("ﺍ"); + ui->Key_I->setText("ه"); + ui->Key_J->setText("ت"); + ui->Key_K->setIcon(QIcon("")); + ui->Key_K->setIconSize(QSize(0,0)); + ui->Key_K->setText("ن"); + ui->Key_L->setText("م"); + ui->Key_M->setText("ﺓ"); + ui->Key_N->setText("ﻯ"); + ui->Key_O->setText("خ"); + ui->Key_P->setText("ح"); + ui->Key_BracketLeft->setText("ج"); + ui->Key_Minus->setText("ذ"); + ui->Key_Semicolon->setText("ك"); + ui->Key_Apostrophe->setText("ط"); + ui->Key_Period->setText("ﺯ"); + ui->Key_Slash->setText("ﻅ"); + ui->Key_Comma->setText("ﻭ"); + ui->Key_Q->setText("ض"); + ui->Key_R->setText("ق"); + ui->Key_S->setText("س"); + ui->Key_T->setText("ف"); + ui->Key_U->setText("ع"); + ui->Key_V->setText("ﺭ"); + ui->Key_W->setText("ص"); + ui->Key_X->setText("ء"); + ui->Key_Y->setText("غ"); + ui->Key_Z->setText(""); + ui->Key_Z->setIconSize(QSize(20,20)); + ui->Key_Z->setIcon(QIcon(":/image/arabicz.png")); + + ui->Key_ShiftLeft->setText(""); + ui->Key_ShiftLeft->setIconSize(QSize(30,30)); + ui->Key_ShiftLeft->setIcon(QIcon(":/image/keyboard3.png")); + + ui->pushButtonCaps->setText(""); + ui->pushButtonCaps->setIconSize(QSize(30,30)); + ui->pushButtonCaps->setIcon(QIcon(":/image/keyboard2.png")); + + ui->Key_Ctrl->setText(""); + ui->Key_Ctrl->setIconSize(QSize(30,30)); + ui->Key_Ctrl->setIcon(QIcon(":/image/keyboard3.png")); +} + +void InputMethod::showArabicPage2Key(){ + ui->Key_one->setText(keyMap["11"]); + //ui->Key_two->setText(keyMap["12"]); + ui->Key_two->setText(""); + ui->Key_two->setIconSize(QSize(20,20)); + ui->Key_two->setIcon(QIcon(":/image/arabic2.png")); + ui->Key_three->setText(keyMap["13"]); + ui->Key_four->setText(keyMap["14"]); + //ui->Key_four->setText("۴"); + ui->Key_five->setText(keyMap["15"]); + ui->Key_six->setText(keyMap["16"]); + //ui->Key_six->setText("۶"); + ui->Key_seven->setText(keyMap["17"]); + ui->Key_eight->setText(keyMap["18"]); + ui->Key_nine->setText(keyMap["19"]); + ui->Key_zero->setText(keyMap["20"]); + + ui->Key_A->setText("ش"); + ui->Key_B->setText("ذ"); + ui->Key_C->setIcon(QIcon("")); + ui->Key_C->setIconSize(QSize(0,0)); + ui->Key_C->setText("ﺯ"); + ui->Key_D->setText("ﻯ"); + ui->Key_E->setText("ث"); + ui->Key_F->setText("ب"); + ui->Key_G->setText("ل"); + ui->Key_H->setText("ﺍ"); + ui->Key_I->setText("ه"); + ui->Key_J->setText("ت"); + ui->Key_K->setIcon(QIcon("")); + ui->Key_K->setIconSize(QSize(0,0)); + ui->Key_K->setText("ن"); + ui->Key_L->setText("م"); + ui->Key_M->setText("پ"); + ui->Key_N->setText("د"); + ui->Key_O->setText("خ"); + ui->Key_P->setText("ح"); + ui->Key_BracketLeft->setText("ج"); + //ui->Key_Minus->setText("?"); + ui->Key_Minus->setText("ذ"); + ui->Key_Semicolon->setText("ک"); + ui->Key_Apostrophe->setText("گ"); + ui->Key_Period->setText("ﺁ"); + ui->Key_Slash->setText("°"); + ui->Key_Comma->setText("ﻭ"); + ui->Key_Q->setText("ض"); + ui->Key_R->setText("ق"); + ui->Key_S->setText("س"); + ui->Key_T->setText("ف"); + ui->Key_U->setText("ع"); + ui->Key_V->setText("ﺭ"); + ui->Key_W->setText("ص"); + ui->Key_X->setText("ط"); + ui->Key_Y->setText("غ"); + ui->Key_Z->setIcon(QIcon("")); + ui->Key_Z->setIconSize(QSize(0,0)); + ui->Key_Z->setText("ﻅ"); +} + +void InputMethod::showArabicPage3Key(){ + myInputMethod->getArabicPage(3); + ui->Key_one->setText("'"); + ui->Key_two->setText(""); + ui->Key_two->setIconSize(QSize(0,0)); + ui->Key_two->setText("''"); + ui->Key_three->setText("@"); + ui->Key_four->setText("#"); + ui->Key_five->setText("%"); + ui->Key_six->setText("^"); + ui->Key_seven->setText(keyMap["&"]); + ui->Key_eight->setText("*"); + ui->Key_nine->setText("-"); + ui->Key_zero->setText("+"); + ui->Key_Minus->setText("_"); + ui->Key_Equal->setText("="); + ui->Key_QuoteLeft->setText("`"); + + ui->Key_Q->setText("ض"); + ui->Key_W->setText("!"); + ui->Key_E->setText("?"); + ui->Key_R->setText(";"); + ui->Key_T->setText(":"); + ui->Key_Y->setText(","); + ui->Key_U->setText("."); + ui->Key_I->setText("~"); + ui->Key_O->setText("|"); + ui->Key_P->setText("ح"); + ui->Key_BracketLeft->setText(keyMap["["]); + ui->Key_A->setText("$"); + ui->Key_S->setText("€"); + ui->Key_D->setText("£"); + ui->Key_F->setText("½"); + ui->Key_G->setText("°"); + ui->Key_H->setText("="); + ui->Key_J->setText("μ"); + ui->Key_K->setText(" ͣ"); + ui->Key_K->setText(""); + ui->Key_K->setIconSize(QSize(30,30)); + ui->Key_K->setIcon(QIcon(":/image/arabicl.png")); + ui->Key_L->setText("¿"); + ui->Key_Semicolon->setText("¡"); + ui->Key_Apostrophe->setText(keyMap["'"]); + ui->Key_Z->setIcon(QIcon("")); + ui->Key_Z->setIconSize(QSize(0,0)); + ui->Key_Z->setText("\\"); + ui->Key_X->setText("/"); + ui->Key_C->setIcon(QIcon("")); + ui->Key_C->setIconSize(QSize(0,0)); + ui->Key_C->setText("["); + ui->Key_V->setText("]"); + ui->Key_B->setText("<"); + ui->Key_N->setText(">"); + ui->Key_M->setText("{"); + ui->Key_Comma->setText("}"); + ui->Key_Period->setText("("); + ui->Key_Slash->setText(")"); +} + +void InputMethod::showEnglishKey(){ + + ui->Key_ShiftLeft->setEnabled(true); + ui->Key_Ctrl->setEnabled(true); + ui->Key_one->setText(keyMap["1"]); + ui->Key_two->setIcon(QIcon("")); + ui->Key_two->setIconSize(QSize(0,0)); + ui->Key_two->setText(keyMap["2"]); + ui->Key_three->setText(keyMap["3"]); + ui->Key_four->setText(keyMap["4"]); + ui->Key_five->setText(keyMap["5"]); + ui->Key_six->setText(keyMap["6"]); + ui->Key_seven->setText(keyMap["7"]); + ui->Key_eight->setText(keyMap["8"]); + ui->Key_nine->setText(keyMap["9"]); + ui->Key_zero->setText(keyMap["0"]); + ui->Key_Equal->setText("="); + ui->Key_QuoteLeft->setText("`"); + + ui->Key_A->setText("a"); + ui->Key_B->setText("b"); + ui->Key_C->setIcon(QIcon("")); + ui->Key_C->setIconSize(QSize(0,0)); + ui->Key_C->setText("c"); + ui->Key_D->setText("d"); + ui->Key_E->setText("e"); + ui->Key_F->setText("f"); + ui->Key_G->setText("g"); + ui->Key_H->setText("h"); + ui->Key_I->setText("i"); + ui->Key_J->setText("j"); + ui->Key_K->setIcon(QIcon("")); + ui->Key_K->setIconSize(QSize(0,0)); + ui->Key_K->setText("k"); + ui->Key_L->setText("l"); + ui->Key_M->setText("m"); + ui->Key_N->setText("n"); + ui->Key_O->setText("o"); + ui->Key_P->setText("p"); + ui->Key_BracketLeft->setText(keyMap["["]); + ui->Key_Minus->setText("-"); + ui->Key_Semicolon->setText(keyMap[";"]); + ui->Key_Apostrophe->setText(keyMap["'"]); + ui->Key_Period->setText(keyMap["."]); + ui->Key_Slash->setText(keyMap["/"]); + ui->Key_Comma->setText(keyMap[","]); + ui->Key_Q->setText("q"); + ui->Key_R->setText("r"); + ui->Key_S->setText("s"); + ui->Key_T->setText("t"); + ui->Key_U->setText("u"); + ui->Key_V->setText("v"); + ui->Key_W->setText("w"); + ui->Key_X->setText("x"); + ui->Key_Y->setText("y"); + ui->Key_Z->setIcon(QIcon("")); + ui->Key_Z->setIconSize(QSize(0,0)); + ui->Key_Z->setText("z"); + + ui->Key_ShiftLeft->setIcon(QIcon("")); + ui->Key_ShiftLeft->setIconSize(QSize(0,0)); + ui->Key_ShiftLeft->setText("Shift"); + + ui->pushButtonCaps->setIcon(QIcon("")); + ui->pushButtonCaps->setIconSize(QSize(0,0)); + ui->pushButtonCaps->setText("Caps\nLOCK"); + + ui->Key_InputMethodSelect->setIcon(QIcon("")); + ui->Key_InputMethodSelect->setIconSize(QSize(0,0)); + ui->Key_InputMethodSelect->setText("Arabic"); + + ui->Key_Ctrl->setIcon(QIcon("")); + ui->Key_Ctrl->setIconSize(QSize(0,0)); + ui->Key_Ctrl->setText("Ctrl"); +} +#endif diff --git a/InputMethod.h b/InputMethod.h index 1feafeb..fa1d18d 100644 --- a/InputMethod.h +++ b/InputMethod.h @@ -1,161 +1,161 @@ -#ifndef INPUTMETHOD_H -#define INPUTMETHOD_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "InsertSpaceNumDialog.h" -#include "myinclude.h" -class MyInputMethod; - - -namespace Ui { - class InputMethod; -} - -#define HANZI_SELECT_NUM 5 //显示汉字的个数,由UI文件决定 -#define INPUT_METHOD_TYPE_ENGLISH 0 -#define INPUT_METHOD_TYPE_CHINESE 1 -#define INPUT_METHOD_TYPE_VIETNAM 2 -#define INPUT_METHOD_TYPE_RUSSIAN 3 // Russian -#define INPUT_METHOD_TYPE_JAPANESE 4 //Japanese -#define INPUT_METHOD_TYPE_KOREAN 5 // Korean -#define INPUT_METHOD_TYPE_SPANISH 6 // Korean -#define INPUT_METHOD_TYPE_THAI 7 // Thai -#define INPUT_METHOD_TYPE_Farsi 8 -#define INPUT_FILE_CHINESE "WINPY_utf8.txt" -#define INPUT_FILE_ENGLISH "WINPY_utf8.txt" -#define INPUT_FILE_VIETNAM "YN_utf8.txt" -#define INPUT_FILE_RUSSIAN "WINPY_utf8.txt" -#define INPUT_FILE_JAPANESE "WINPY_utf8.txt" -#define INPUT_FILE_KOREAN "WINPY_utf8.txt" - -#define MIN(a,b) (((a) < (b))?(a):(b)) -#define MAX(a,b) (((a) > (b))?(a):(b)) - -class InputMethod : public QWidget -{ - Q_OBJECT - -public: - explicit InputMethod(MyInputMethod *myInputMethod,QWidget *parent = 0); - static bool initInputMethod(QString &filename); /*用文件初始化输入法的字库*/ - static void showPinyinHash(void); - ~InputMethod(); - void switchKeyBoardBengalDisply(bool); - void switchKeyBoardBengalLowerLetters(); - void switchKeyBoardBengalCapitalLetters(); - void switchKeyBoardBengalDigit(); -#ifdef EnableArabic - void setArabicDisplay(bool); - void showArabicPage1Key(); - void showArabicPage2Key(); - void showEnglishKey(); - void showArabicPage3Key(); - void setSwitchArabicFlag(bool flag); -#endif -public slots: - void onpushButtonCapspressed(); - void onDigitalPunctuationClicked(); - void onCharClicked(); - void onShiftClicked(); - void onInputMethodClicked(); - void onBackspaceClicked(); - void onHanziLabelClicked(); - void onKeyLastClicked(); - void onKeyNextClicked(); - void onEnterClicked(); - - void userInputed(QString str); //用户输入一个字符 - void onHiden(); - void on_Key_Backspace_released(); -private slots: - - - void onKeyLeftpressed(); - - void onKeyDownpressed(); - - void onKeyUppressed(); - - void onKeyRightpressed(); - - void onKeyHomepressed(); - - void onKeyEndpressed(); - - void onKeydeletepressed(); - - void onKeySpecialCharpressed(); - void onKeyCtrlpressed(); - void onKeyReleased(); - void onKeyPressed(); - - void spaceKeyPressed(); - void spaceKeyRelease(); - void spaceKeyLongPressed(); - void backKeyLongPressed(); - void onInsertSpaceNumDialogAccepted(); - - void on_pushBottonHide_released(); - - void on_Key_Backspace_pressed(); - - //void on_Key_Backspace_released(); - -private: - - MyInputMethod *myInputMethod; - QMap keyMap; - - Ui::InputMethod *ui; - - static QHash *> *pinyinHash; //用来存放哈拼音的哈希表,所有都共用一份 - static QList pinyinHashKeys; - static QStringList pinyinHashQStringList; - - QList *currPinyinList; - - QStringList currPinyins; //自动侯选的拼音 - - ClickLabel *hanziDisplayLabels[HANZI_SELECT_NUM]; - int currentInputMethodType; - int matchStartIndex; - int matchEndIndex; - int bNotFound; - bool shiftFlag; //是否按过shift键 - bool CapsFlag; - bool userPinyinInputAppending; //是否用户已经在拼音输入法下完成输入 - QString currPinyinStr; //记录当前用户已经输入的字符 - int pinyinPage; /*当一个拼音有很多汉字时,分多页存放,记录当前的页数*/ - int back_count_timeout; //回退键超时处理 - bool bengalFlag; - bool CtrlFlag; -#ifdef EnableArabic - bool arabicFlag; - bool englishOrArabicFlag; -#endif - void switchKeyboardDisplay(void); //当按shift,输入法时,切换键盘显示 - void displayHanziToLabel(); //显示汉字到label - void fillPinyinLabel(bool bActFromCharInput); - void asciiTyped(int ascii); - void digitalTyped(int ascii); - void buttonConnect(QPushButton *sender, - const QObject *receiver, const char *member); - void setHanziLabelVisible(bool enable); - QLabel labelInputTip; //输入提示 - QTimer spaceTimer; - QTimer backtimer; - InsertSpaceNumDialog insertSpaceNumDialog; - bool hanZiLabelVisibleEnable; - bool ctrlAppending;//Ctrl+C ..之类的 - QString specialKeyMap(QString ch); -}; - -#endif // INPUTMETHOD_H +#ifndef INPUTMETHOD_H +#define INPUTMETHOD_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "InsertSpaceNumDialog.h" +#include "myinclude.h" +class MyInputMethod; + + +namespace Ui { + class InputMethod; +} + +#define HANZI_SELECT_NUM 5 //显示汉字的个数,由UI文件决定 +#define INPUT_METHOD_TYPE_ENGLISH 0 +#define INPUT_METHOD_TYPE_CHINESE 1 +#define INPUT_METHOD_TYPE_VIETNAM 2 +#define INPUT_METHOD_TYPE_RUSSIAN 3 // Russian +#define INPUT_METHOD_TYPE_JAPANESE 4 //Japanese +#define INPUT_METHOD_TYPE_KOREAN 5 // Korean +#define INPUT_METHOD_TYPE_SPANISH 6 // Korean +#define INPUT_METHOD_TYPE_THAI 7 // Thai +#define INPUT_METHOD_TYPE_Farsi 8 +#define INPUT_FILE_CHINESE "WINPY_utf8.txt" +#define INPUT_FILE_ENGLISH "WINPY_utf8.txt" +#define INPUT_FILE_VIETNAM "YN_utf8.txt" +#define INPUT_FILE_RUSSIAN "WINPY_utf8.txt" +#define INPUT_FILE_JAPANESE "WINPY_utf8.txt" +#define INPUT_FILE_KOREAN "WINPY_utf8.txt" + +#define MIN(a,b) (((a) < (b))?(a):(b)) +#define MAX(a,b) (((a) > (b))?(a):(b)) + +class InputMethod : public QWidget +{ + Q_OBJECT + +public: + explicit InputMethod(MyInputMethod *myInputMethod,QWidget *parent = 0); + static bool initInputMethod(QString &filename); /*用文件初始化输入法的字库*/ + static void showPinyinHash(void); + ~InputMethod(); + void switchKeyBoardBengalDisply(bool); + void switchKeyBoardBengalLowerLetters(); + void switchKeyBoardBengalCapitalLetters(); + void switchKeyBoardBengalDigit(); +#ifdef EnableArabic + void setArabicDisplay(bool); + void showArabicPage1Key(); + void showArabicPage2Key(); + void showEnglishKey(); + void showArabicPage3Key(); + void setSwitchArabicFlag(bool flag); +#endif +public slots: + void onpushButtonCapspressed(); + void onDigitalPunctuationClicked(); + void onCharClicked(); + void onShiftClicked(); + void onInputMethodClicked(); + void onBackspaceClicked(); + void onHanziLabelClicked(); + void onKeyLastClicked(); + void onKeyNextClicked(); + void onEnterClicked(); + + void userInputed(QString str); //用户输入一个字符 + void onHiden(); + void on_Key_Backspace_released(); +private slots: + + + void onKeyLeftpressed(); + + void onKeyDownpressed(); + + void onKeyUppressed(); + + void onKeyRightpressed(); + + void onKeyHomepressed(); + + void onKeyEndpressed(); + + void onKeydeletepressed(); + + void onKeySpecialCharpressed(); + void onKeyCtrlpressed(); + void onKeyReleased(); + void onKeyPressed(); + + void spaceKeyPressed(); + void spaceKeyRelease(); + void spaceKeyLongPressed(); + void backKeyLongPressed(); + void onInsertSpaceNumDialogAccepted(); + + void on_pushBottonHide_released(); + + void on_Key_Backspace_pressed(); + + //void on_Key_Backspace_released(); + +private: + + MyInputMethod *myInputMethod; + QMap keyMap; + + Ui::InputMethod *ui; + + static QHash *> *pinyinHash; //用来存放哈拼音的哈希表,所有都共用一份 + static QList pinyinHashKeys; + static QStringList pinyinHashQStringList; + + QList *currPinyinList; + + QStringList currPinyins; //自动侯选的拼音 + + ClickLabel *hanziDisplayLabels[HANZI_SELECT_NUM]; + int currentInputMethodType; + int matchStartIndex; + int matchEndIndex; + int bNotFound; + bool shiftFlag; //是否按过shift键 + bool CapsFlag; + bool userPinyinInputAppending; //是否用户已经在拼音输入法下完成输入 + QString currPinyinStr; //记录当前用户已经输入的字符 + int pinyinPage; /*当一个拼音有很多汉字时,分多页存放,记录当前的页数*/ + int back_count_timeout; //回退键超时处理 + bool bengalFlag; + bool CtrlFlag; +#ifdef EnableArabic + bool arabicFlag; + bool englishOrArabicFlag; +#endif + void switchKeyboardDisplay(void); //当按shift,输入法时,切换键盘显示 + void displayHanziToLabel(); //显示汉字到label + void fillPinyinLabel(bool bActFromCharInput); + void asciiTyped(int ascii); + void digitalTyped(int ascii); + void buttonConnect(QPushButton *sender, + const QObject *receiver, const char *member); + void setHanziLabelVisible(bool enable); + QLabel labelInputTip; //输入提示 + QTimer spaceTimer; + QTimer backtimer; + InsertSpaceNumDialog insertSpaceNumDialog; + bool hanZiLabelVisibleEnable; + bool ctrlAppending;//Ctrl+C ..之类的 + QString specialKeyMap(QString ch); +}; + +#endif // INPUTMETHOD_H diff --git a/InputMethod.ui b/InputMethod.ui index a946062..0a64592 100644 --- a/InputMethod.ui +++ b/InputMethod.ui @@ -1,2851 +1,2851 @@ - - - InputMethod - - - true - - - - 0 - 0 - 800 - 305 - - - - - 0 - 0 - - - - - 640 - 200 - - - - - - - - - 255 - 255 - 255 - - - - - - - 209 - 209 - 209 - - - - - - - - - 255 - 255 - 255 - - - - - - - 209 - 209 - 209 - - - - - - - - - 209 - 209 - 209 - - - - - - - 209 - 209 - 209 - - - - - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - - - 1 - - - 4 - - - 0 - - - 0 - - - 0 - - - - - - 75 - 30 - - - - - 75 - 16777215 - - - - QFrame::Box - - - QFrame::Sunken - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 35 - 5 - - - - - - - - - 0 - 30 - - - - - 63 - 16777215 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::Box - - - 1 书 - - - Qt::AlignCenter - - - - - - - - 0 - 30 - - - - - 63 - 16777215 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::Box - - - 2 输 - - - Qt::AlignCenter - - - - - - - - 0 - 30 - - - - - 63 - 16777215 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::Box - - - 3 数 - - - Qt::AlignCenter - - - - - - - - 0 - 30 - - - - - 63 - 16777215 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::Box - - - 4 属 - - - Qt::AlignCenter - - - - - - - - 0 - 30 - - - - - 63 - 16777215 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 0 - 0 - 52 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::Box - - - 5 熟 - - - Qt::AlignCenter - - - - - - - - 0 - 30 - - - - - 70 - 16777215 - - - - Qt::LeftToRight - - - 上一页 - - - - :/icon/lastpage.png:/icon/lastpage.png - - - - - - - - 0 - 30 - - - - - 70 - 16777215 - - - - Qt::LeftToRight - - - 下一页 - - - - :/icon/nextpage.png:/icon/nextpage.png - - - - - - - - - 1 - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - ` - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 2 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 3 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 4 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 5 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 6 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 7 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 8 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 9 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - 0 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - = - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - Qt::LeftToRight - - - false - - - 退格 - - - - :/icon/keybackspace.png:/icon/keybackspace.png - - - false - - - - - - - - - 1 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 66 - 16777215 - - - - Qt::LeftToRight - - - false - - - 英文 - - - - :/icon/keyinput.png:/icon/keyinput.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - q - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - w - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - e - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - r - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - t - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - y - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - u - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - i - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - o - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - p - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - [ - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - ] - - - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - 70 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - \ - - - - - - - - - 1 - - - - - - 0 - 0 - - - - - 65 - 0 - - - - - 66 - 16777215 - - - - 大写 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - a - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - s - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - d - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - f - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - g - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - h - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - j - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - k - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - l - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - ; - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 51 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - ' - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 85 - 16777215 - - - - Qt::LeftToRight - - - false - - - Enter - - - - :/icon/keyenter.png:/icon/keyenter.png - - - - - - - - - 1 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 70 - 16777215 - - - - Qt::LeftToRight - - - false - - - Shift - - - - :/icon/keyshift.png:/icon/keyshift.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - z - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - x - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - c - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - v - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - b - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - n - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - m - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 文泉驿正黑 - 20 - - - - Qt::RightToLeft - - - false - - - , - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - . - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 52 - 16777215 - - - - - 20 - - - - Qt::RightToLeft - - - false - - - / - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 67 - 16777215 - - - - Qt::LeftToRight - - - false - - - 上 - - - - :/icon/arrowup.png:/icon/arrowup.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - Qt::LeftToRight - - - false - - - 特殊字 - - - - :/icon/specialchar.png:/icon/specialchar.png - - - - - - - - - 1 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 65 - 16777215 - - - - Qt::LeftToRight - - - false - - - 隐藏 - - - - :/icon/keyhide.png:/icon/keyhide.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 65 - 16777215 - - - - Qt::LeftToRight - - - false - - - Ctrl - - - - :/icon/controlbyhand.png:/icon/controlbyhand.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 75 - 16777215 - - - - Qt::LeftToRight - - - false - - - 删除 - - - - :/icon/keydelete.png:/icon/keydelete.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 280 - 16777215 - - - - Qt::RightToLeft - - - false - - - - - - false - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 65 - 16777215 - - - - Qt::LeftToRight - - - false - - - 行首 - - - - :/icon/keyhome.png:/icon/keyhome.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 65 - 16777215 - - - - Qt::LeftToRight - - - false - - - 行尾 - - - - :/icon/keyend.png:/icon/keyend.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 67 - 16777215 - - - - Qt::LeftToRight - - - false - - - 左 - - - - :/icon/arrowleft.png:/icon/arrowleft.png - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 67 - 16777215 - - - - Qt::LeftToRight - - - false - - - 下 - - - - :/icon/arrowdown.png:/icon/arrowdown.png - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 75 - 16777215 - - - - Qt::LeftToRight - - - false - - - 右 - - - - :/icon/arrowright.png:/icon/arrowright.png - - - - - - - - - - - - ClickLabel - QLabel -
ClickLabel.h
-
-
- - - - -
+ + + InputMethod + + + true + + + + 0 + 0 + 800 + 305 + + + + + 0 + 0 + + + + + 640 + 200 + + + + + + + + + 255 + 255 + 255 + + + + + + + 209 + 209 + 209 + + + + + + + + + 255 + 255 + 255 + + + + + + + 209 + 209 + 209 + + + + + + + + + 209 + 209 + 209 + + + + + + + 209 + 209 + 209 + + + + + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + + + 1 + + + 4 + + + 0 + + + 0 + + + 0 + + + + + + 75 + 30 + + + + + 75 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 35 + 5 + + + + + + + + + 0 + 30 + + + + + 63 + 16777215 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::Box + + + 1 书 + + + Qt::AlignCenter + + + + + + + + 0 + 30 + + + + + 63 + 16777215 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::Box + + + 2 输 + + + Qt::AlignCenter + + + + + + + + 0 + 30 + + + + + 63 + 16777215 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::Box + + + 3 数 + + + Qt::AlignCenter + + + + + + + + 0 + 30 + + + + + 63 + 16777215 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::Box + + + 4 属 + + + Qt::AlignCenter + + + + + + + + 0 + 30 + + + + + 63 + 16777215 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 0 + 0 + 52 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::Box + + + 5 熟 + + + Qt::AlignCenter + + + + + + + + 0 + 30 + + + + + 70 + 16777215 + + + + Qt::LeftToRight + + + 上一页 + + + + :/icon/lastpage.png:/icon/lastpage.png + + + + + + + + 0 + 30 + + + + + 70 + 16777215 + + + + Qt::LeftToRight + + + 下一页 + + + + :/icon/nextpage.png:/icon/nextpage.png + + + + + + + + + 1 + + + QLayout::SetFixedSize + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + ` + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 2 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 3 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 4 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 5 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 6 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 7 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 8 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 9 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + 0 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + - + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + = + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 80 + 16777215 + + + + Qt::LeftToRight + + + false + + + 退格 + + + + :/icon/keybackspace.png:/icon/keybackspace.png + + + false + + + + + + + + + 1 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 66 + 16777215 + + + + Qt::LeftToRight + + + false + + + 英文 + + + + :/icon/keyinput.png:/icon/keyinput.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + q + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + w + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + e + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + r + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + t + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + y + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + u + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + i + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + o + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + p + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + [ + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + ] + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 70 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + \ + + + + + + + + + 1 + + + + + + 0 + 0 + + + + + 65 + 0 + + + + + 66 + 16777215 + + + + 大写 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + a + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + s + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + d + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + f + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + g + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + h + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + j + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + k + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + l + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + ; + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 51 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + ' + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 85 + 16777215 + + + + Qt::LeftToRight + + + false + + + Enter + + + + :/icon/keyenter.png:/icon/keyenter.png + + + + + + + + + 1 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 70 + 16777215 + + + + Qt::LeftToRight + + + false + + + Shift + + + + :/icon/keyshift.png:/icon/keyshift.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + z + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + x + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + c + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + v + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + b + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + n + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + m + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 文泉驿正黑 + 20 + + + + Qt::RightToLeft + + + false + + + , + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + . + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 52 + 16777215 + + + + + 20 + + + + Qt::RightToLeft + + + false + + + / + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 67 + 16777215 + + + + Qt::LeftToRight + + + false + + + 上 + + + + :/icon/arrowup.png:/icon/arrowup.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 80 + 16777215 + + + + Qt::LeftToRight + + + false + + + 特殊字 + + + + :/icon/specialchar.png:/icon/specialchar.png + + + + + + + + + 1 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 65 + 16777215 + + + + Qt::LeftToRight + + + false + + + 隐藏 + + + + :/icon/keyhide.png:/icon/keyhide.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 65 + 16777215 + + + + Qt::LeftToRight + + + false + + + Ctrl + + + + :/icon/controlbyhand.png:/icon/controlbyhand.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 75 + 16777215 + + + + Qt::LeftToRight + + + false + + + 删除 + + + + :/icon/keydelete.png:/icon/keydelete.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 280 + 16777215 + + + + Qt::RightToLeft + + + false + + + + + + false + + + false + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 65 + 16777215 + + + + Qt::LeftToRight + + + false + + + 行首 + + + + :/icon/keyhome.png:/icon/keyhome.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 65 + 16777215 + + + + Qt::LeftToRight + + + false + + + 行尾 + + + + :/icon/keyend.png:/icon/keyend.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 67 + 16777215 + + + + Qt::LeftToRight + + + false + + + 左 + + + + :/icon/arrowleft.png:/icon/arrowleft.png + + + false + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 67 + 16777215 + + + + Qt::LeftToRight + + + false + + + 下 + + + + :/icon/arrowdown.png:/icon/arrowdown.png + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 75 + 16777215 + + + + Qt::LeftToRight + + + false + + + 右 + + + + :/icon/arrowright.png:/icon/arrowright.png + + + + + + + + + + + + ClickLabel + QLabel +
ClickLabel.h
+
+
+ + + + +
diff --git a/InsertSpaceNumDialog.cpp b/InsertSpaceNumDialog.cpp index eea4a95..a741fe6 100644 --- a/InsertSpaceNumDialog.cpp +++ b/InsertSpaceNumDialog.cpp @@ -1,19 +1,19 @@ -#include "InsertSpaceNumDialog.h" -#include "ui_insertspacenumdialog.h" - -InsertSpaceNumDialog::InsertSpaceNumDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::InsertSpaceNumDialog) -{ - ui->setupUi(this); - this->setFixedSize(this->geometry().width(),this->geometry().height()); -} - -InsertSpaceNumDialog::~InsertSpaceNumDialog() -{ - delete ui; -} - -QSpinBox *InsertSpaceNumDialog::getSpinBoxSpaceNum(){ - return ui->spinBoxSpaceNum; -} +#include "InsertSpaceNumDialog.h" +#include "ui_insertspacenumdialog.h" + +InsertSpaceNumDialog::InsertSpaceNumDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::InsertSpaceNumDialog) +{ + ui->setupUi(this); + this->setFixedSize(this->geometry().width(),this->geometry().height()); +} + +InsertSpaceNumDialog::~InsertSpaceNumDialog() +{ + delete ui; +} + +QSpinBox *InsertSpaceNumDialog::getSpinBoxSpaceNum(){ + return ui->spinBoxSpaceNum; +} diff --git a/InsertSpaceNumDialog.h b/InsertSpaceNumDialog.h index 68bf00f..afd40b0 100644 --- a/InsertSpaceNumDialog.h +++ b/InsertSpaceNumDialog.h @@ -1,22 +1,22 @@ -#ifndef INSERTSPACENUMDIALOG_H -#define INSERTSPACENUMDIALOG_H - -#include -#include -namespace Ui { -class InsertSpaceNumDialog; -} - -class InsertSpaceNumDialog : public QDialog -{ - Q_OBJECT - -public: - explicit InsertSpaceNumDialog(QWidget *parent = 0); - ~InsertSpaceNumDialog(); - QSpinBox *getSpinBoxSpaceNum(); -private: - Ui::InsertSpaceNumDialog *ui; -}; - -#endif // INSERTSPACENUMDIALOG_H +#ifndef INSERTSPACENUMDIALOG_H +#define INSERTSPACENUMDIALOG_H + +#include +#include +namespace Ui { +class InsertSpaceNumDialog; +} + +class InsertSpaceNumDialog : public QDialog +{ + Q_OBJECT + +public: + explicit InsertSpaceNumDialog(QWidget *parent = 0); + ~InsertSpaceNumDialog(); + QSpinBox *getSpinBoxSpaceNum(); +private: + Ui::InsertSpaceNumDialog *ui; +}; + +#endif // INSERTSPACENUMDIALOG_H diff --git a/LicenseManger/LicenseManger.cpp b/LicenseManger/LicenseManger.cpp index b4c410e..8373e78 100644 --- a/LicenseManger/LicenseManger.cpp +++ b/LicenseManger/LicenseManger.cpp @@ -1,438 +1,438 @@ -#include "LicenseManger.h" -#include "dlginputaddr.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qnamespace.h" -#include -#include - - - -MACHINE_INFO_t machine_info; -LICENSE_DATA_t license_data; -QMutex machine_info_mutex; -QMutex license_data_mutex; - - - -void adjustDateAndTime(int year, int mon, int mday, int hour, int min, int sec); -LicenseManger::LicenseManger() -{ -#if 1 - UCHAR e_key[1024] = "dangerous IOP 0908 "; - pAes = new TAesClass; - pAes->InitializePrivateKey(16, e_key); //进行初始化 - //setMachineInfo(16); -#endif -} -//set machine info -qint32 LicenseManger::setMachineInfo(quint32 serial_num) -{ - //check serial number size - if(serial_num>999999) - { - return -1; - } - machine_info_mutex.lock(); - QString serial; - serial.sprintf("VB%06d", serial_num); - - QByteArray hash_data; - hash_data = QCryptographicHash::hash(serial.toAscii(),QCryptographicHash::Md5 ); - //MACHINE_INFO_t machine_info; - machine_info.serial_number=serial_num; - memcpy(&machine_info.md5[0],hash_data.data(),MD5_LENGTH); - //qDebug()<<"org sn info"<OnAesEncrypt((LPVOID)&machine_info, sizeof(machine_info), (LPVOID)encrypt_buff); //进行加密 - //qDebug()<<"sn jiami:"<OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 - //qDebug()<<"jiemi:"<OnAesEncrypt((LPVOID)&license_data, sizeof(license_data), (LPVOID)encrypt_buff); //进行加密 - //qDebug()<<"jiami:"<OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 - //qDebug()<<"jiemi:"< -void adjustDateAndTime(int year, int mon, int mday, int hour, int min, int sec) { - time_t t; - struct tm nowtime; - nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) - nowtime.tm_min = min; // Minutes.[0-59] - nowtime.tm_hour = hour; // Hours. [0-23] - nowtime.tm_mday = mday; // Day.[1-31] - nowtime.tm_mon = mon - 1; // Month. [0-11] - nowtime.tm_year = year - 1900; // Year- 1900. - nowtime.tm_isdst = -1; // DST.[-1/0/1] - t = mktime(&nowtime); - // qDebug()<= 6*60*18*367) - { - qDebug()<<"license file was invalid"; - return 0; - } - if(license_data.vernon_bach_version != VERNONBACH_VERSION_CODE) - { - qDebug()<<"license file was invalid"; - return 0; - } -qDebug()<<"license serial number"<= 6*60*18*367) - { - qDebug()<<"license file was invalid"; - return 0; - } - if(license_data.remainingTime) - license_data.remainingTime--; - if(license_data.remainingTime<=0) - { - license_data.workout = 1; - } - SaveLicData2File(); - //license_data.remainingTime=0; - return license_data.remainingTime; - -} - -quint32 LicenseManger::CheckUpdateFileState() -{ - QFile file(UPDATE_LIC_FILE); - LICENSE_DATA_t update_license_data; - quint32 state = UPDATE_LICENSE_FILE_OK; - if(!file.exists()) - { - state = -UPDATE_LICENSE_FILE_NOT_EXIT; - } - else - { - if(!file.open(QIODevice::ReadOnly | QIODevice::Truncate)){ - QMessageBox::warning(0,"警告",QString("无法打开license文件") ); - state = -UPDATE_LICENSE_FILE_OPEN_FAILED; - } - else - { - //license_data_mutex.lock(); - char encrypt_buff[1024]; - char decrypt_buff[1024]; - file.read((char *)encrypt_buff,(qint64)sizeof(encrypt_buff)); - pAes->OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 - //qDebug()<<"jiemi:"<= (license_data.printer_active_count+3) ) - { - state = -UPDATE_LICENSE_FILE_ACTIVE_NUMBER_ERR; - } - else if(update_license_data.vernon_bach_version != VERNONBACH_VERSION_CODE) - { - state = -UPDATE_LICENSE_FILE_SW_VERSION_ERR; - } - } - } - return state; -} -quint32 LicenseManger::UpdateLicenseFileData() -{ - QFile file(UPDATE_LIC_FILE); - LICENSE_DATA_t update_license_data; - quint32 state = UPDATE_LICENSE_FILE_OK; - if(!file.exists()) - { - state = -UPDATE_LICENSE_FILE_NOT_EXIT; - } - else - { - if(!file.open(QIODevice::ReadOnly | QIODevice::Truncate)){ - QMessageBox::warning(0,"警告",QString("无法打开更新license文件") ); - state = -UPDATE_LICENSE_FILE_OPEN_FAILED; - } - else - { - //license_data_mutex.lock(); - char encrypt_buff[1024]; - char decrypt_buff[1024]; - file.read((char *)encrypt_buff,(qint64)sizeof(encrypt_buff)); - pAes->OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 - //qDebug()<<"jiemi:"< +#include +#include +#include +#include +#include +#include +#include + +#include "qnamespace.h" +#include +#include + + + +MACHINE_INFO_t machine_info; +LICENSE_DATA_t license_data; +QMutex machine_info_mutex; +QMutex license_data_mutex; + + + +void adjustDateAndTime(int year, int mon, int mday, int hour, int min, int sec); +LicenseManger::LicenseManger() +{ +#if 1 + UCHAR e_key[1024] = "dangerous IOP 0908 "; + pAes = new TAesClass; + pAes->InitializePrivateKey(16, e_key); //进行初始化 + //setMachineInfo(16); +#endif +} +//set machine info +qint32 LicenseManger::setMachineInfo(quint32 serial_num) +{ + //check serial number size + if(serial_num>999999) + { + return -1; + } + machine_info_mutex.lock(); + QString serial; + serial.sprintf("VB%06d", serial_num); + + QByteArray hash_data; + hash_data = QCryptographicHash::hash(serial.toAscii(),QCryptographicHash::Md5 ); + //MACHINE_INFO_t machine_info; + machine_info.serial_number=serial_num; + memcpy(&machine_info.md5[0],hash_data.data(),MD5_LENGTH); + //qDebug()<<"org sn info"<OnAesEncrypt((LPVOID)&machine_info, sizeof(machine_info), (LPVOID)encrypt_buff); //进行加密 + //qDebug()<<"sn jiami:"<OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 + //qDebug()<<"jiemi:"<OnAesEncrypt((LPVOID)&license_data, sizeof(license_data), (LPVOID)encrypt_buff); //进行加密 + //qDebug()<<"jiami:"<OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 + //qDebug()<<"jiemi:"< +void adjustDateAndTime(int year, int mon, int mday, int hour, int min, int sec) { + time_t t; + struct tm nowtime; + nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) + nowtime.tm_min = min; // Minutes.[0-59] + nowtime.tm_hour = hour; // Hours. [0-23] + nowtime.tm_mday = mday; // Day.[1-31] + nowtime.tm_mon = mon - 1; // Month. [0-11] + nowtime.tm_year = year - 1900; // Year- 1900. + nowtime.tm_isdst = -1; // DST.[-1/0/1] + t = mktime(&nowtime); + // qDebug()<= 6*60*18*367) + { + qDebug()<<"license file was invalid"; + return 0; + } + if(license_data.vernon_bach_version != VERNONBACH_VERSION_CODE) + { + qDebug()<<"license file was invalid"; + return 0; + } +qDebug()<<"license serial number"<= 6*60*18*367) + { + qDebug()<<"license file was invalid"; + return 0; + } + if(license_data.remainingTime) + license_data.remainingTime--; + if(license_data.remainingTime<=0) + { + license_data.workout = 1; + } + SaveLicData2File(); + //license_data.remainingTime=0; + return license_data.remainingTime; + +} + +quint32 LicenseManger::CheckUpdateFileState() +{ + QFile file(UPDATE_LIC_FILE); + LICENSE_DATA_t update_license_data; + quint32 state = UPDATE_LICENSE_FILE_OK; + if(!file.exists()) + { + state = -UPDATE_LICENSE_FILE_NOT_EXIT; + } + else + { + if(!file.open(QIODevice::ReadOnly | QIODevice::Truncate)){ + QMessageBox::warning(0,"警告",QString("无法打开license文件") ); + state = -UPDATE_LICENSE_FILE_OPEN_FAILED; + } + else + { + //license_data_mutex.lock(); + char encrypt_buff[1024]; + char decrypt_buff[1024]; + file.read((char *)encrypt_buff,(qint64)sizeof(encrypt_buff)); + pAes->OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 + //qDebug()<<"jiemi:"<= (license_data.printer_active_count+3) ) + { + state = -UPDATE_LICENSE_FILE_ACTIVE_NUMBER_ERR; + } + else if(update_license_data.vernon_bach_version != VERNONBACH_VERSION_CODE) + { + state = -UPDATE_LICENSE_FILE_SW_VERSION_ERR; + } + } + } + return state; +} +quint32 LicenseManger::UpdateLicenseFileData() +{ + QFile file(UPDATE_LIC_FILE); + LICENSE_DATA_t update_license_data; + quint32 state = UPDATE_LICENSE_FILE_OK; + if(!file.exists()) + { + state = -UPDATE_LICENSE_FILE_NOT_EXIT; + } + else + { + if(!file.open(QIODevice::ReadOnly | QIODevice::Truncate)){ + QMessageBox::warning(0,"警告",QString("无法打开更新license文件") ); + state = -UPDATE_LICENSE_FILE_OPEN_FAILED; + } + else + { + //license_data_mutex.lock(); + char encrypt_buff[1024]; + char decrypt_buff[1024]; + file.read((char *)encrypt_buff,(qint64)sizeof(encrypt_buff)); + pAes->OnAesUncrypt((LPVOID)encrypt_buff, (DWORD)sizeof(encrypt_buff),(LPVOID)decrypt_buff); //进行解密 + //qDebug()<<"jiemi:"< -#include -#include -#include "Aes/TAesClass.h" -#include "VerBVersion.h" - -#define LIC_FILE "/etc/licenseData" -#define UPDATE_LIC_FILE "/udisk/lic_update_file" -//#define MACH_INFO_FILE "/home/student/mini2440/UP/QtUI/machine_info" -#define MACH_INFO_FILE "/etc/appdata/machine_info" - -#define LICENSE_STATE_OK 0 -#define LICENSE_STATE_MACH_INFO_DAMAGED 1 -#define LICENSE_STATE_LIC_DATA_DAMAGED 2 -#define LICENSE_STATE_REMAIN_TIME_WARNING 3 //提前提示维护码到期 -#define LICENSE_STATE_REMAIN_TIME_REARCH 4 - -#define UPDATE_LICENSE_FILE_OK 0 -#define UPDATE_LICENSE_FILE_NOT_EXIT 1 -#define UPDATE_LICENSE_FILE_OPEN_FAILED 2 -#define UPDATE_LICENSE_FILE_SERIAL_NUMBER_ERR 3 //提前提示维护码到期 -#define UPDATE_LICENSE_FILE_ACTIVE_NUMBER_ERR 4 -#define UPDATE_LICENSE_FILE_SW_VERSION_ERR 5 -#define UPDATE_LICENSE_FILE_MD5_VALUE_ERR 66 - -#define LIC_DATA_MD5_LEN 16 - -typedef struct { - unsigned int serial_number; - unsigned char md5[LIC_DATA_MD5_LEN]; -}MACHINE_INFO_t; - -typedef struct { - unsigned int serial_number; - unsigned char enable; //1Byte - unsigned char powerEn; // 1Byte - unsigned char printEn; // 1Byte - - unsigned int powerMinuteMax; - unsigned int powerMinuteCnt; - unsigned int printMax; - unsigned int printCnt; // printDot/1024 - - unsigned int start;// yyyymmdd - unsigned int end; // yyyymmdd - unsigned int nDate; - unsigned int workout; - unsigned int remainingTime;//10 second count: 1 day = 6x60x24=8640; 1 week = 7x8640 = 60480; 1 year=8640 x 365 = 3153600 - unsigned int printer_bworkout; - unsigned int printer_active_count; - unsigned int printer_auth_flag; - unsigned int vernon_bach_version; - unsigned char md5[LIC_DATA_MD5_LEN]; -}LICENSE_DATA_t; - - - -typedef enum { - LicenseState_eLicAvailable, - LicenseState_eLicTimeOut, - LicenseState_eMachineError -}LicenseState_e; - - - -class LicenseManger -{ -private: - -public: - LicenseManger(); - - qint32 setMachineInfo(quint32 serial_num); - qint32 checkMachineInfoAvailable(); - qint8 getLicState(); - void SaveLicData2File(); - void ReadLicDataFromFile(); - void ResetLicDataFile(); - int CheckLicDataValid(); - quint32 CheckRemainingTime(); - quint32 CheckUpdateFileState(); - quint32 UpdateLicenseFileData(); -private: - QDate curDate; - TAesClass *pAes; -}; - -extern MACHINE_INFO_t machine_info; -extern LICENSE_DATA_t license_data; -#endif // LICENSEMANGER_H +#ifndef LICENSEMANGER_H +#define LICENSEMANGER_H +#include +#include +#include +#include "Aes/TAesClass.h" +#include "VerBVersion.h" + +#define LIC_FILE "/etc/licenseData" +#define UPDATE_LIC_FILE "/udisk/lic_update_file" +//#define MACH_INFO_FILE "/home/student/mini2440/UP/QtUI/machine_info" +#define MACH_INFO_FILE "/etc/appdata/machine_info" + +#define LICENSE_STATE_OK 0 +#define LICENSE_STATE_MACH_INFO_DAMAGED 1 +#define LICENSE_STATE_LIC_DATA_DAMAGED 2 +#define LICENSE_STATE_REMAIN_TIME_WARNING 3 //提前提示维护码到期 +#define LICENSE_STATE_REMAIN_TIME_REARCH 4 + +#define UPDATE_LICENSE_FILE_OK 0 +#define UPDATE_LICENSE_FILE_NOT_EXIT 1 +#define UPDATE_LICENSE_FILE_OPEN_FAILED 2 +#define UPDATE_LICENSE_FILE_SERIAL_NUMBER_ERR 3 //提前提示维护码到期 +#define UPDATE_LICENSE_FILE_ACTIVE_NUMBER_ERR 4 +#define UPDATE_LICENSE_FILE_SW_VERSION_ERR 5 +#define UPDATE_LICENSE_FILE_MD5_VALUE_ERR 66 + +#define LIC_DATA_MD5_LEN 16 + +typedef struct { + unsigned int serial_number; + unsigned char md5[LIC_DATA_MD5_LEN]; +}MACHINE_INFO_t; + +typedef struct { + unsigned int serial_number; + unsigned char enable; //1Byte + unsigned char powerEn; // 1Byte + unsigned char printEn; // 1Byte + + unsigned int powerMinuteMax; + unsigned int powerMinuteCnt; + unsigned int printMax; + unsigned int printCnt; // printDot/1024 + + unsigned int start;// yyyymmdd + unsigned int end; // yyyymmdd + unsigned int nDate; + unsigned int workout; + unsigned int remainingTime;//10 second count: 1 day = 6x60x24=8640; 1 week = 7x8640 = 60480; 1 year=8640 x 365 = 3153600 + unsigned int printer_bworkout; + unsigned int printer_active_count; + unsigned int printer_auth_flag; + unsigned int vernon_bach_version; + unsigned char md5[LIC_DATA_MD5_LEN]; +}LICENSE_DATA_t; + + + +typedef enum { + LicenseState_eLicAvailable, + LicenseState_eLicTimeOut, + LicenseState_eMachineError +}LicenseState_e; + + + +class LicenseManger +{ +private: + +public: + LicenseManger(); + + qint32 setMachineInfo(quint32 serial_num); + qint32 checkMachineInfoAvailable(); + qint8 getLicState(); + void SaveLicData2File(); + void ReadLicDataFromFile(); + void ResetLicDataFile(); + int CheckLicDataValid(); + quint32 CheckRemainingTime(); + quint32 CheckUpdateFileState(); + quint32 UpdateLicenseFileData(); +private: + QDate curDate; + TAesClass *pAes; +}; + +extern MACHINE_INFO_t machine_info; +extern LICENSE_DATA_t license_data; +#endif // LICENSEMANGER_H diff --git a/Log/dualfilelogger.cpp b/Log/dualfilelogger.cpp index c03364d..7dc9c58 100644 --- a/Log/dualfilelogger.cpp +++ b/Log/dualfilelogger.cpp @@ -1,21 +1,21 @@ - -#include "dualfilelogger.h" - -DualFileLogger::DualFileLogger(QSettings *firstSettings, QSettings* secondSettings, const int refreshInterval, QObject* parent) - :Logger(parent) -{ - firstLogger=new FileLogger(firstSettings, refreshInterval, this); - secondLogger=new FileLogger(secondSettings, refreshInterval, this); -} - -void DualFileLogger::log(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line) -{ - firstLogger->log(type,message,file,function,line); - secondLogger->log(type,message,file,function,line); -} - -void DualFileLogger::clear(const bool buffer, const bool variables) -{ - firstLogger->clear(buffer,variables); - secondLogger->clear(buffer,variables); -} + +#include "dualfilelogger.h" + +DualFileLogger::DualFileLogger(QSettings *firstSettings, QSettings* secondSettings, const int refreshInterval, QObject* parent) + :Logger(parent) +{ + firstLogger=new FileLogger(firstSettings, refreshInterval, this); + secondLogger=new FileLogger(secondSettings, refreshInterval, this); +} + +void DualFileLogger::log(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line) +{ + firstLogger->log(type,message,file,function,line); + secondLogger->log(type,message,file,function,line); +} + +void DualFileLogger::clear(const bool buffer, const bool variables) +{ + firstLogger->clear(buffer,variables); + secondLogger->clear(buffer,variables); +} diff --git a/Log/dualfilelogger.h b/Log/dualfilelogger.h index e1de33e..c8db707 100644 --- a/Log/dualfilelogger.h +++ b/Log/dualfilelogger.h @@ -1,35 +1,35 @@ - -#ifndef DUALFILELOGGER_H -#define DUALFILELOGGER_H - -#include -#include -#include -#include "logglobal.h" -#include "logger.h" -#include "filelogger.h" - -class DECLSPEC DualFileLogger : public Logger { - Q_OBJECT - Q_DISABLE_COPY(DualFileLogger) -public: - - - DualFileLogger(QSettings* firstSettings, QSettings* secondSettings, - const int refreshInterval=10000, QObject *parent = nullptr); - - - virtual void log(const QtMsgType type, const QString& message, const QString &file="", - const QString &function="", const int line=0); - - virtual void clear(const bool buffer=true, const bool variables=true); - -private: - - FileLogger* firstLogger; - - FileLogger* secondLogger; - -}; - -#endif // DUALFILELOGGER_H + +#ifndef DUALFILELOGGER_H +#define DUALFILELOGGER_H + +#include +#include +#include +#include "logglobal.h" +#include "logger.h" +#include "filelogger.h" + +class DECLSPEC DualFileLogger : public Logger { + Q_OBJECT + Q_DISABLE_COPY(DualFileLogger) +public: + + + DualFileLogger(QSettings* firstSettings, QSettings* secondSettings, + const int refreshInterval=10000, QObject *parent = nullptr); + + + virtual void log(const QtMsgType type, const QString& message, const QString &file="", + const QString &function="", const int line=0); + + virtual void clear(const bool buffer=true, const bool variables=true); + +private: + + FileLogger* firstLogger; + + FileLogger* secondLogger; + +}; + +#endif // DUALFILELOGGER_H diff --git a/Log/filelogger.cpp b/Log/filelogger.cpp index e0475f9..d15bada 100644 --- a/Log/filelogger.cpp +++ b/Log/filelogger.cpp @@ -1,273 +1,273 @@ - -#include "filelogger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "LogInfo.h" -#define LOG_FILE_PATH "/home/plg/loginfo/" - -void FileLogger::refreshSettings() -{ - mutex.lock(); - QString oldFileName=fileName; - - settings->sync(); - fileName = LOG_FILE_PATH; -// fileName=settings->value("fileName").toString(); -// LogInfo::setRunStatusText(tr("fileName: %1").arg(fileName)); - QDate today = QDate::currentDate(); - QString todayString=today.toString(Qt::ISODate); - // 计算前七天的日期 - //QDate oneWeekAgo = today.addDays(-7); - fileName+=today.toString(Qt::ISODate); - fileName+="/"; - fileName+="log.txt"; - static QString lastDay = ""; - if(lastDay!=todayString) - { - TimerDel->start(30000); - lastDay=todayString; - } - - -#ifdef Q_OS_WIN32 - if (QDir::isRelativePath(fileName) && settings->format()!=QSettings::NativeFormat) -#else - if (QDir::isRelativePath(fileName)) -#endif - { - QFileInfo configFile(settings->fileName()); - fileName=QFileInfo(configFile.absolutePath(),fileName).absoluteFilePath(); - } - maxSize=settings->value("maxSize",0).toLongLong(); - maxBackups=settings->value("maxBackups",0).toInt(); - msgFormat=settings->value("msgFormat","{timestamp} {type} {msg}").toString(); - timestampFormat=settings->value("timestampFormat","yyyy-MM-dd hh:mm:ss.zzz").toString(); - bufferSize=settings->value("bufferSize",0).toInt(); - - QByteArray minLevelStr = settings->value("minLevel","ALL").toByteArray(); - if (minLevelStr=="ALL" || minLevelStr=="DEBUG" || minLevelStr=="0") - { - minLevel=QtDebugMsg; - } - else if (minLevelStr=="WARNING" || minLevelStr=="WARN" || minLevelStr=="1") - { - minLevel=QtWarningMsg; - } - else if (minLevelStr=="ERROR" || minLevelStr=="CRITICAL" || minLevelStr=="2") - { - minLevel=QtCriticalMsg; - } - else if (minLevelStr=="FATAL" || minLevelStr=="3") - { - // minLevel=QtMsgType::QtFatalMsg; - minLevel=QtFatalMsg; - } -// else if (minLevelStr=="INFO" || minLevelStr=="4") -// { -// minLevel=QtMsgType::QtInfoMsg; -// } - - if (oldFileName!=fileName) - { - fprintf(stderr,"Logging to %s\n",qPrintable(fileName)); - close(); - open(); - } - mutex.unlock(); -} - - -FileLogger::FileLogger(QSettings *settings, const int refreshInterval, QObject* parent) - : Logger(parent) -{ - TimerDel = new QTimer(this); - connect(TimerDel,SIGNAL(timeout()),this,SLOT(timeOutToDelete())); - Q_ASSERT(settings!=nullptr); - Q_ASSERT(refreshInterval>=0); - this->settings=settings; - file=nullptr; - if (refreshInterval>0) - { - refreshTimer.start(refreshInterval,this); - } - flushTimer.start(1000,this); - refreshSettings(); -} - - -FileLogger::~FileLogger() -{ - close(); -} - - -void FileLogger::write(const LogMessage* logMessage) -{ - if (file) - { -// qDebug()<<"Critical message output test\n"; -// qCritical("This is a critical message of test\n"); - file->write(qPrintable(logMessage->toString(msgFormat,timestampFormat))); - - if (logMessage->getType()>=QtCriticalMsg) - { - file->flush(); - } - - if (file->error()) - { - qWarning("Cannot write to log file %s: %s",qPrintable(fileName),qPrintable(file->errorString())); - close(); - } - - } - - if (!file) - { - Logger::write(logMessage); - } - -} - -void FileLogger::open() -{ - if (fileName.isEmpty()) - { - qWarning("Name of logFile is empty"); - } - else { - file=new QFile(fileName); - QFileInfo fileInfo(fileName); - // 检查文件路径是否有效 - if (!fileInfo.exists()) { - // 获取文件所在的目录路径 - QString dirPath = QFileInfo(fileName).absoluteDir().path(); - // 检查目录是否存在 - if (!QDir(dirPath).exists()) { - // 如果目录不存在,则创建目录 - QDir().mkpath(dirPath); - if (!QDir(dirPath).exists()) { - // 如果创建目录失败,显示错误消息 - qDebug("Cannot create directory for log file: %s", qPrintable(dirPath)); - delete file; - file = nullptr; - return; - } - } - } - if (!file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) - { - qWarning("Cannot open log file %s: %s",qPrintable(fileName),qPrintable(file->errorString())); - file=nullptr; - } - } -} - - -void FileLogger::close() -{ - if (file) - { - file->close(); - delete file; - file=nullptr; - } -} - -void FileLogger::rotate() { - int count=0; - forever - { - QFile bakFile(QString("%1.%2").arg(fileName).arg(count+1)); - if (bakFile.exists()) - { - ++count; - } - else - { - break; - } - } - - while (maxBackups>0 && count>=maxBackups) - { - QFile::remove(QString("%1.%2").arg(fileName).arg(count)); - --count; - } - - for (int i=count; i>0; --i) { - QFile::rename(QString("%1.%2").arg(fileName).arg(i),QString("%1.%2").arg(fileName).arg(i+1)); - } - - QFile::rename(fileName,fileName+".1"); - -} - - -void FileLogger::timerEvent(QTimerEvent* event) -{ - if (!event) - { - return; - } - else if (event->timerId()==refreshTimer.timerId()) - { - refreshSettings(); - } - else if (event->timerId()==flushTimer.timerId() && file) - { - mutex.lock(); - - file->flush(); - - if (maxSize>0 && file->size()>=maxSize) - { - close(); - rotate(); - open(); - } - - mutex.unlock(); - } -} - -bool FileLogger::removeDirectory(const QString &directoryPath) { - // 检查目录是否存在 - QDir dir(directoryPath); - if (dir.exists()) { - system((char *)((QString("rm -r %1").arg(directoryPath)).toLatin1().data())); - return true; - } - return false; -} - -void FileLogger::timeOutToDelete(){ - QDate today = QDate::currentDate(); - for(int daysAgo=14;daysAgo>=7;--daysAgo){ - QString needToDelFoldPath=LOG_FILE_PATH; - QDate pastDate=today.addDays(-daysAgo); - needToDelFoldPath+=pastDate.toString(Qt::ISODate); - needToDelFoldPath+="/"; - if (QDir(needToDelFoldPath).exists()) { - bool result= removeDirectory(needToDelFoldPath); - if(result){ - qDebug()<<"The directory and all its contents have been removed"; - LogInfo::setRunStatusText(tr("The directory and all its contents have been removed")); - }else{ - qDebug() << "Failed to remove the directory"; - LogInfo::setRunStatusText(tr("Failed to remove the directory")); - } - } - } - TimerDel->stop(); -} + +#include "filelogger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "LogInfo.h" +#define LOG_FILE_PATH "/home/plg/loginfo/" + +void FileLogger::refreshSettings() +{ + mutex.lock(); + QString oldFileName=fileName; + + settings->sync(); + fileName = LOG_FILE_PATH; +// fileName=settings->value("fileName").toString(); +// LogInfo::setRunStatusText(tr("fileName: %1").arg(fileName)); + QDate today = QDate::currentDate(); + QString todayString=today.toString(Qt::ISODate); + // 计算前七天的日期 + //QDate oneWeekAgo = today.addDays(-7); + fileName+=today.toString(Qt::ISODate); + fileName+="/"; + fileName+="log.txt"; + static QString lastDay = ""; + if(lastDay!=todayString) + { + TimerDel->start(30000); + lastDay=todayString; + } + + +#ifdef Q_OS_WIN32 + if (QDir::isRelativePath(fileName) && settings->format()!=QSettings::NativeFormat) +#else + if (QDir::isRelativePath(fileName)) +#endif + { + QFileInfo configFile(settings->fileName()); + fileName=QFileInfo(configFile.absolutePath(),fileName).absoluteFilePath(); + } + maxSize=settings->value("maxSize",0).toLongLong(); + maxBackups=settings->value("maxBackups",0).toInt(); + msgFormat=settings->value("msgFormat","{timestamp} {type} {msg}").toString(); + timestampFormat=settings->value("timestampFormat","yyyy-MM-dd hh:mm:ss.zzz").toString(); + bufferSize=settings->value("bufferSize",0).toInt(); + + QByteArray minLevelStr = settings->value("minLevel","ALL").toByteArray(); + if (minLevelStr=="ALL" || minLevelStr=="DEBUG" || minLevelStr=="0") + { + minLevel=QtDebugMsg; + } + else if (minLevelStr=="WARNING" || minLevelStr=="WARN" || minLevelStr=="1") + { + minLevel=QtWarningMsg; + } + else if (minLevelStr=="ERROR" || minLevelStr=="CRITICAL" || minLevelStr=="2") + { + minLevel=QtCriticalMsg; + } + else if (minLevelStr=="FATAL" || minLevelStr=="3") + { + // minLevel=QtMsgType::QtFatalMsg; + minLevel=QtFatalMsg; + } +// else if (minLevelStr=="INFO" || minLevelStr=="4") +// { +// minLevel=QtMsgType::QtInfoMsg; +// } + + if (oldFileName!=fileName) + { + fprintf(stderr,"Logging to %s\n",qPrintable(fileName)); + close(); + open(); + } + mutex.unlock(); +} + + +FileLogger::FileLogger(QSettings *settings, const int refreshInterval, QObject* parent) + : Logger(parent) +{ + TimerDel = new QTimer(this); + connect(TimerDel,SIGNAL(timeout()),this,SLOT(timeOutToDelete())); + Q_ASSERT(settings!=nullptr); + Q_ASSERT(refreshInterval>=0); + this->settings=settings; + file=nullptr; + if (refreshInterval>0) + { + refreshTimer.start(refreshInterval,this); + } + flushTimer.start(1000,this); + refreshSettings(); +} + + +FileLogger::~FileLogger() +{ + close(); +} + + +void FileLogger::write(const LogMessage* logMessage) +{ + if (file) + { +// qDebug()<<"Critical message output test\n"; +// qCritical("This is a critical message of test\n"); + file->write(qPrintable(logMessage->toString(msgFormat,timestampFormat))); + + if (logMessage->getType()>=QtCriticalMsg) + { + file->flush(); + } + + if (file->error()) + { + qWarning("Cannot write to log file %s: %s",qPrintable(fileName),qPrintable(file->errorString())); + close(); + } + + } + + if (!file) + { + Logger::write(logMessage); + } + +} + +void FileLogger::open() +{ + if (fileName.isEmpty()) + { + qWarning("Name of logFile is empty"); + } + else { + file=new QFile(fileName); + QFileInfo fileInfo(fileName); + // 检查文件路径是否有效 + if (!fileInfo.exists()) { + // 获取文件所在的目录路径 + QString dirPath = QFileInfo(fileName).absoluteDir().path(); + // 检查目录是否存在 + if (!QDir(dirPath).exists()) { + // 如果目录不存在,则创建目录 + QDir().mkpath(dirPath); + if (!QDir(dirPath).exists()) { + // 如果创建目录失败,显示错误消息 + qDebug("Cannot create directory for log file: %s", qPrintable(dirPath)); + delete file; + file = nullptr; + return; + } + } + } + if (!file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) + { + qWarning("Cannot open log file %s: %s",qPrintable(fileName),qPrintable(file->errorString())); + file=nullptr; + } + } +} + + +void FileLogger::close() +{ + if (file) + { + file->close(); + delete file; + file=nullptr; + } +} + +void FileLogger::rotate() { + int count=0; + forever + { + QFile bakFile(QString("%1.%2").arg(fileName).arg(count+1)); + if (bakFile.exists()) + { + ++count; + } + else + { + break; + } + } + + while (maxBackups>0 && count>=maxBackups) + { + QFile::remove(QString("%1.%2").arg(fileName).arg(count)); + --count; + } + + for (int i=count; i>0; --i) { + QFile::rename(QString("%1.%2").arg(fileName).arg(i),QString("%1.%2").arg(fileName).arg(i+1)); + } + + QFile::rename(fileName,fileName+".1"); + +} + + +void FileLogger::timerEvent(QTimerEvent* event) +{ + if (!event) + { + return; + } + else if (event->timerId()==refreshTimer.timerId()) + { + refreshSettings(); + } + else if (event->timerId()==flushTimer.timerId() && file) + { + mutex.lock(); + + file->flush(); + + if (maxSize>0 && file->size()>=maxSize) + { + close(); + rotate(); + open(); + } + + mutex.unlock(); + } +} + +bool FileLogger::removeDirectory(const QString &directoryPath) { + // 检查目录是否存在 + QDir dir(directoryPath); + if (dir.exists()) { + system((char *)((QString("rm -r %1").arg(directoryPath)).toLatin1().data())); + return true; + } + return false; +} + +void FileLogger::timeOutToDelete(){ + QDate today = QDate::currentDate(); + for(int daysAgo=14;daysAgo>=7;--daysAgo){ + QString needToDelFoldPath=LOG_FILE_PATH; + QDate pastDate=today.addDays(-daysAgo); + needToDelFoldPath+=pastDate.toString(Qt::ISODate); + needToDelFoldPath+="/"; + if (QDir(needToDelFoldPath).exists()) { + bool result= removeDirectory(needToDelFoldPath); + if(result){ + qDebug()<<"The directory and all its contents have been removed"; + LogInfo::setRunStatusText(tr("The directory and all its contents have been removed")); + }else{ + qDebug() << "Failed to remove the directory"; + LogInfo::setRunStatusText(tr("Failed to remove the directory")); + } + } + } + TimerDel->stop(); +} diff --git a/Log/filelogger.h b/Log/filelogger.h index 1310d8b..f4f9f49 100644 --- a/Log/filelogger.h +++ b/Log/filelogger.h @@ -1,62 +1,62 @@ - -#ifndef FILELOGGER_H -#define FILELOGGER_H - -#include -#include -#include -#include -#include -#include "logglobal.h" -#include "logger.h" -#include - -class DECLSPEC FileLogger : public Logger { - Q_OBJECT - Q_DISABLE_COPY(FileLogger) -public: - - FileLogger(QSettings* settings, const int refreshInterval=10000, QObject* parent = nullptr); - - virtual ~FileLogger(); - - virtual void write(const LogMessage* logMessage); - - public slots: - void timeOutToDelete(); - -protected: - - void timerEvent(QTimerEvent* event); - -private: - - - QString fileName; - - - long maxSize; - - int maxBackups; - - QSettings* settings; - - QFile* file; - - QBasicTimer refreshTimer; - - QBasicTimer flushTimer; - QTimer *TimerDel; - - void open(); - - void close(); - - void rotate(); - - void refreshSettings(); - - bool removeDirectory(const QString &directoryPath); -}; - -#endif // FILELOGGER_H + +#ifndef FILELOGGER_H +#define FILELOGGER_H + +#include +#include +#include +#include +#include +#include "logglobal.h" +#include "logger.h" +#include + +class DECLSPEC FileLogger : public Logger { + Q_OBJECT + Q_DISABLE_COPY(FileLogger) +public: + + FileLogger(QSettings* settings, const int refreshInterval=10000, QObject* parent = nullptr); + + virtual ~FileLogger(); + + virtual void write(const LogMessage* logMessage); + + public slots: + void timeOutToDelete(); + +protected: + + void timerEvent(QTimerEvent* event); + +private: + + + QString fileName; + + + long maxSize; + + int maxBackups; + + QSettings* settings; + + QFile* file; + + QBasicTimer refreshTimer; + + QBasicTimer flushTimer; + QTimer *TimerDel; + + void open(); + + void close(); + + void rotate(); + + void refreshSettings(); + + bool removeDirectory(const QString &directoryPath); +}; + +#endif // FILELOGGER_H diff --git a/Log/logger.cpp b/Log/logger.cpp index 783f115..14c00ca 100644 --- a/Log/logger.cpp +++ b/Log/logger.cpp @@ -1,247 +1,247 @@ - -#include "logger.h" -#include -#include -#include -#include -#include -#include - -Logger* Logger::defaultLogger=nullptr; - - -QThreadStorage*> Logger::logVars; - - -QMutex Logger::mutex; - - -Logger::Logger(QObject* parent) - : QObject(parent), - msgFormat("{timestamp} {type} {msg}"), - timestampFormat("dd.MM.yyyy hh:mm:ss.zzz"), - minLevel(QtDebugMsg), - bufferSize(0) - {} - - -Logger::Logger(const QString msgFormat, const QString timestampFormat, const QtMsgType minLevel, const int bufferSize, QObject* parent) - :QObject(parent) -{ - this->msgFormat=msgFormat; - this->timestampFormat=timestampFormat; - this->minLevel=minLevel; - this->bufferSize=bufferSize; -} - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - static QRecursiveMutex recursiveMutex; - static QMutex nonRecursiveMutex; -#else - static QMutex recursiveMutex(QMutex::Recursive); - static QMutex nonRecursiveMutex(QMutex::NonRecursive); -#endif - -void Logger::msgHandler(const QtMsgType type, const QString &message, const QString &file, const QString &function, const int line) -{ - - recursiveMutex.lock(); - - if (defaultLogger && nonRecursiveMutex.tryLock()) - { - defaultLogger->log(type, message, file, function, line); - nonRecursiveMutex.unlock(); - } - else - { - fputs(qPrintable(message),stderr); - fflush(stderr); - } - - if (type==QtFatalMsg) - { - abort(); - } - - recursiveMutex.unlock(); -} - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - void Logger::msgHandler5(const QtMsgType type, const QMessageLogContext &context, const QString &message) - { - (void)(context); - msgHandler(type,message,context.file,context.function,context.line); - } -#else - void Logger::msgHandler4(const QtMsgType type, const char* message) - { - msgHandler(type,message); - } -#endif - - -Logger::~Logger() -{ - if (defaultLogger==this) - { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - qInstallMessageHandler(nullptr); -#else - qInstallMsgHandler(nullptr); -#endif - defaultLogger=nullptr; - } -} - - -void Logger::write(const LogMessage* logMessage) -{ - fputs(qPrintable(logMessage->toString(msgFormat,timestampFormat)),stderr); - fflush(stderr); -} - - -void Logger::installMsgHandler() -{ - defaultLogger=this; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - qInstallMessageHandler(msgHandler5); -#else - qInstallMsgHandler(msgHandler4); -#endif -} - - -void Logger::set(const QString& name, const QString& value) -{ - mutex.lock(); - if (!logVars.hasLocalData()) - { - logVars.setLocalData(new QHash); - } - logVars.localData()->insert(name,value); - mutex.unlock(); -} - - -void Logger::clear(const bool buffer, const bool variables) -{ - mutex.lock(); - if (buffer && buffers.hasLocalData()) - { - QList* buffer=buffers.localData(); - while (buffer && !buffer->isEmpty()) - { - LogMessage* logMessage=buffer->takeLast(); - delete logMessage; - } - } - if (variables && logVars.hasLocalData()) - { - logVars.localData()->clear(); - } - mutex.unlock(); -} - - -void Logger::log(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line) -{ - bool toPrint=false; - switch (type) - { - case QtDebugMsg: - if (minLevel==QtDebugMsg) - { - toPrint=true; - } - break; - - #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) - case QtInfoMsg: - if (minLevel==QtDebugMsg || - minLevel==QtInfoMsg) - { - toPrint=true; - } - break; - #endif - - case QtWarningMsg: - if (minLevel==QtDebugMsg || - #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) - minLevel==QtInfoMsg || - #endif - minLevel==QtWarningMsg) - { - toPrint=true; - } - break; - - case QtCriticalMsg: - if (minLevel==QtDebugMsg || - #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) - minLevel==QtInfoMsg || - #endif - minLevel==QtWarningMsg || - minLevel==QtCriticalMsg) - { - toPrint=true; - } - break; - - case QtFatalMsg: - toPrint=true; - break; - - default: - toPrint=true; - } - - mutex.lock(); - - LogMessage echoMsg(type,message,logVars.localData(),file,function,line); - - #ifndef BNS_AARCH64_DEBUG - std::cout << qPrintable(echoMsg.toString(msgFormat,timestampFormat)) << std::flush; - #endif - - if (bufferSize>0) - { - - if (!buffers.hasLocalData()) - { - buffers.setLocalData(new QList()); - } - QList* buffer=buffers.localData(); - - LogMessage* logMessage=new LogMessage(type,message,logVars.localData(),file,function,line); - buffer->append(logMessage); - - if (buffer->size()>bufferSize) - { - delete buffer->takeFirst(); - } - - if (toPrint) - { - - while (!buffer->isEmpty()) - { - LogMessage* logMessage=buffer->takeFirst(); - write(logMessage); - delete logMessage; - } - } - } - - else - { - if (toPrint) - { - LogMessage logMessage(type,message,logVars.localData(),file,function,line); - write(&logMessage); - } - } - mutex.unlock(); -} + +#include "logger.h" +#include +#include +#include +#include +#include +#include + +Logger* Logger::defaultLogger=nullptr; + + +QThreadStorage*> Logger::logVars; + + +QMutex Logger::mutex; + + +Logger::Logger(QObject* parent) + : QObject(parent), + msgFormat("{timestamp} {type} {msg}"), + timestampFormat("dd.MM.yyyy hh:mm:ss.zzz"), + minLevel(QtDebugMsg), + bufferSize(0) + {} + + +Logger::Logger(const QString msgFormat, const QString timestampFormat, const QtMsgType minLevel, const int bufferSize, QObject* parent) + :QObject(parent) +{ + this->msgFormat=msgFormat; + this->timestampFormat=timestampFormat; + this->minLevel=minLevel; + this->bufferSize=bufferSize; +} + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + static QRecursiveMutex recursiveMutex; + static QMutex nonRecursiveMutex; +#else + static QMutex recursiveMutex(QMutex::Recursive); + static QMutex nonRecursiveMutex(QMutex::NonRecursive); +#endif + +void Logger::msgHandler(const QtMsgType type, const QString &message, const QString &file, const QString &function, const int line) +{ + + recursiveMutex.lock(); + + if (defaultLogger && nonRecursiveMutex.tryLock()) + { + defaultLogger->log(type, message, file, function, line); + nonRecursiveMutex.unlock(); + } + else + { + fputs(qPrintable(message),stderr); + fflush(stderr); + } + + if (type==QtFatalMsg) + { + abort(); + } + + recursiveMutex.unlock(); +} + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + void Logger::msgHandler5(const QtMsgType type, const QMessageLogContext &context, const QString &message) + { + (void)(context); + msgHandler(type,message,context.file,context.function,context.line); + } +#else + void Logger::msgHandler4(const QtMsgType type, const char* message) + { + msgHandler(type,message); + } +#endif + + +Logger::~Logger() +{ + if (defaultLogger==this) + { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + qInstallMessageHandler(nullptr); +#else + qInstallMsgHandler(nullptr); +#endif + defaultLogger=nullptr; + } +} + + +void Logger::write(const LogMessage* logMessage) +{ + fputs(qPrintable(logMessage->toString(msgFormat,timestampFormat)),stderr); + fflush(stderr); +} + + +void Logger::installMsgHandler() +{ + defaultLogger=this; +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + qInstallMessageHandler(msgHandler5); +#else + qInstallMsgHandler(msgHandler4); +#endif +} + + +void Logger::set(const QString& name, const QString& value) +{ + mutex.lock(); + if (!logVars.hasLocalData()) + { + logVars.setLocalData(new QHash); + } + logVars.localData()->insert(name,value); + mutex.unlock(); +} + + +void Logger::clear(const bool buffer, const bool variables) +{ + mutex.lock(); + if (buffer && buffers.hasLocalData()) + { + QList* buffer=buffers.localData(); + while (buffer && !buffer->isEmpty()) + { + LogMessage* logMessage=buffer->takeLast(); + delete logMessage; + } + } + if (variables && logVars.hasLocalData()) + { + logVars.localData()->clear(); + } + mutex.unlock(); +} + + +void Logger::log(const QtMsgType type, const QString& message, const QString &file, const QString &function, const int line) +{ + bool toPrint=false; + switch (type) + { + case QtDebugMsg: + if (minLevel==QtDebugMsg) + { + toPrint=true; + } + break; + + #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) + case QtInfoMsg: + if (minLevel==QtDebugMsg || + minLevel==QtInfoMsg) + { + toPrint=true; + } + break; + #endif + + case QtWarningMsg: + if (minLevel==QtDebugMsg || + #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) + minLevel==QtInfoMsg || + #endif + minLevel==QtWarningMsg) + { + toPrint=true; + } + break; + + case QtCriticalMsg: + if (minLevel==QtDebugMsg || + #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) + minLevel==QtInfoMsg || + #endif + minLevel==QtWarningMsg || + minLevel==QtCriticalMsg) + { + toPrint=true; + } + break; + + case QtFatalMsg: + toPrint=true; + break; + + default: + toPrint=true; + } + + mutex.lock(); + + LogMessage echoMsg(type,message,logVars.localData(),file,function,line); + + #ifndef BNS_AARCH64_DEBUG + std::cout << qPrintable(echoMsg.toString(msgFormat,timestampFormat)) << std::flush; + #endif + + if (bufferSize>0) + { + + if (!buffers.hasLocalData()) + { + buffers.setLocalData(new QList()); + } + QList* buffer=buffers.localData(); + + LogMessage* logMessage=new LogMessage(type,message,logVars.localData(),file,function,line); + buffer->append(logMessage); + + if (buffer->size()>bufferSize) + { + delete buffer->takeFirst(); + } + + if (toPrint) + { + + while (!buffer->isEmpty()) + { + LogMessage* logMessage=buffer->takeFirst(); + write(logMessage); + delete logMessage; + } + } + } + + else + { + if (toPrint) + { + LogMessage logMessage(type,message,logVars.localData(),file,function,line); + write(&logMessage); + } + } + mutex.unlock(); +} diff --git a/Log/logger.h b/Log/logger.h index cea439c..6ad0d89 100644 --- a/Log/logger.h +++ b/Log/logger.h @@ -1,76 +1,76 @@ - -#ifndef LOGGER_H -#define LOGGER_H - -#include -#include -#include -#include -#include -#include -#include "logglobal.h" -#include "logmessage.h" -#include - -class DECLSPEC Logger : public QObject { - Q_OBJECT - Q_DISABLE_COPY(Logger) -public: - - Logger(QObject* parent); - - Logger(const QString msgFormat="{timestamp} {type} {msg}", - const QString timestampFormat="dd.MM.yyyy hh:mm:ss.zzz", - const QtMsgType minLevel=QtDebugMsg, const int bufferSize=0, - QObject* parent = nullptr); - - virtual ~Logger(); - - virtual void log(const QtMsgType type, const QString& message, const QString &file="", - const QString &function="", const int line=0); - - void installMsgHandler(); - static void set(const QString& name, const QString& value); - - virtual void clear(const bool buffer=true, const bool variables=true); - -protected: - - - QString msgFormat; - - - QString timestampFormat; - - QtMsgType minLevel; - - int bufferSize; - - static QMutex mutex; - - virtual void write(const LogMessage* logMessage); - -private: - - static Logger* defaultLogger; - - static void msgHandler(const QtMsgType type, const QString &message, const QString &file="", - const QString &function="", const int line=0); - - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - - static void msgHandler5(const QtMsgType type, const QMessageLogContext& context, const QString &message); - -#else - - static void msgHandler4(const QtMsgType type, const char * message); - -#endif - - static QThreadStorage*> logVars; - - QThreadStorage*> buffers; -}; - -#endif // LOGGER_H + +#ifndef LOGGER_H +#define LOGGER_H + +#include +#include +#include +#include +#include +#include +#include "logglobal.h" +#include "logmessage.h" +#include + +class DECLSPEC Logger : public QObject { + Q_OBJECT + Q_DISABLE_COPY(Logger) +public: + + Logger(QObject* parent); + + Logger(const QString msgFormat="{timestamp} {type} {msg}", + const QString timestampFormat="dd.MM.yyyy hh:mm:ss.zzz", + const QtMsgType minLevel=QtDebugMsg, const int bufferSize=0, + QObject* parent = nullptr); + + virtual ~Logger(); + + virtual void log(const QtMsgType type, const QString& message, const QString &file="", + const QString &function="", const int line=0); + + void installMsgHandler(); + static void set(const QString& name, const QString& value); + + virtual void clear(const bool buffer=true, const bool variables=true); + +protected: + + + QString msgFormat; + + + QString timestampFormat; + + QtMsgType minLevel; + + int bufferSize; + + static QMutex mutex; + + virtual void write(const LogMessage* logMessage); + +private: + + static Logger* defaultLogger; + + static void msgHandler(const QtMsgType type, const QString &message, const QString &file="", + const QString &function="", const int line=0); + + +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + + static void msgHandler5(const QtMsgType type, const QMessageLogContext& context, const QString &message); + +#else + + static void msgHandler4(const QtMsgType type, const char * message); + +#endif + + static QThreadStorage*> logVars; + + QThreadStorage*> buffers; +}; + +#endif // LOGGER_H diff --git a/Log/logglobal.h b/Log/logglobal.h index 1e2fc58..f3b9177 100644 --- a/Log/logglobal.h +++ b/Log/logglobal.h @@ -1,23 +1,23 @@ - -#ifndef LOGGLOBAL_H -#define LOGGLOBAL_H - -#include - -#if defined(Q_OS_WIN) - #if defined(QTWEBAPPLIB_EXPORT) - #define DECLSPEC Q_DECL_EXPORT - #elif defined(QTWEBAPPLIB_IMPORT) - #define DECLSPEC Q_DECL_IMPORT - #endif -#endif -#if !defined(DECLSPEC) - #define DECLSPEC -#endif - -#if __cplusplus < 201103L - #define nullptr 0 -#endif - -#endif // LOGGLOBAL_H - + +#ifndef LOGGLOBAL_H +#define LOGGLOBAL_H + +#include + +#if defined(Q_OS_WIN) + #if defined(QTWEBAPPLIB_EXPORT) + #define DECLSPEC Q_DECL_EXPORT + #elif defined(QTWEBAPPLIB_IMPORT) + #define DECLSPEC Q_DECL_IMPORT + #endif +#endif +#if !defined(DECLSPEC) + #define DECLSPEC +#endif + +#if __cplusplus < 201103L + #define nullptr 0 +#endif + +#endif // LOGGLOBAL_H + diff --git a/Log/logmessage.cpp b/Log/logmessage.cpp index 34e95aa..a9533bc 100644 --- a/Log/logmessage.cpp +++ b/Log/logmessage.cpp @@ -1,78 +1,78 @@ - -#include "logmessage.h" -#include - -LogMessage::LogMessage(const QtMsgType type, const QString& message, const QHash *logVars, const QString &file, const QString &function, const int line) -{ - this->type=type; - this->message=message; - this->file=file; - this->function=function; - this->line=line; - timestamp=QDateTime::currentDateTime(); - threadId=QThread::currentThreadId(); - - if (logVars) - { - this->logVars=*logVars; - } -} - -QString LogMessage::toString(const QString& msgFormat, const QString& timestampFormat) const -{ - QString decorated=msgFormat+"\n"; - decorated.replace("{msg}",message); - - if (decorated.contains("{timestamp}")) - { - decorated.replace("{timestamp}",timestamp.toString(timestampFormat)); - } - - QString typeNr; - typeNr.setNum(type); - decorated.replace("{typeNr}",typeNr); - - switch (type) - { - case QtDebugMsg: - decorated.replace("{type}","DEBUG "); - break; - case QtWarningMsg: - decorated.replace("{type}","WARNING "); - break; - case QtCriticalMsg: - decorated.replace("{type}","CRITICAL"); - break; - case QtFatalMsg: - decorated.replace("{type}","FATAL "); - break; - #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) - case QtInfoMsg: - decorated.replace("{type}","INFO "); - break; - #endif - } - - decorated.replace("{file}",file); - decorated.replace("{function}",function); - decorated.replace("{line}",QString::number(line)); - - QString threadId = QString("0x%1").arg(qulonglong(QThread::currentThreadId()), 8, 16, QLatin1Char('0')); - decorated.replace("{thread}",threadId); - - if (decorated.contains("{") && !logVars.isEmpty()) - { - QList keys=logVars.keys(); - foreach (QString key, keys) - { - decorated.replace("{"+key+"}",logVars.value(key)); - } - } - - return decorated; -} - -QtMsgType LogMessage::getType() const -{ - return type; -} + +#include "logmessage.h" +#include + +LogMessage::LogMessage(const QtMsgType type, const QString& message, const QHash *logVars, const QString &file, const QString &function, const int line) +{ + this->type=type; + this->message=message; + this->file=file; + this->function=function; + this->line=line; + timestamp=QDateTime::currentDateTime(); + threadId=QThread::currentThreadId(); + + if (logVars) + { + this->logVars=*logVars; + } +} + +QString LogMessage::toString(const QString& msgFormat, const QString& timestampFormat) const +{ + QString decorated=msgFormat+"\n"; + decorated.replace("{msg}",message); + + if (decorated.contains("{timestamp}")) + { + decorated.replace("{timestamp}",timestamp.toString(timestampFormat)); + } + + QString typeNr; + typeNr.setNum(type); + decorated.replace("{typeNr}",typeNr); + + switch (type) + { + case QtDebugMsg: + decorated.replace("{type}","DEBUG "); + break; + case QtWarningMsg: + decorated.replace("{type}","WARNING "); + break; + case QtCriticalMsg: + decorated.replace("{type}","CRITICAL"); + break; + case QtFatalMsg: + decorated.replace("{type}","FATAL "); + break; + #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) + case QtInfoMsg: + decorated.replace("{type}","INFO "); + break; + #endif + } + + decorated.replace("{file}",file); + decorated.replace("{function}",function); + decorated.replace("{line}",QString::number(line)); + + QString threadId = QString("0x%1").arg(qulonglong(QThread::currentThreadId()), 8, 16, QLatin1Char('0')); + decorated.replace("{thread}",threadId); + + if (decorated.contains("{") && !logVars.isEmpty()) + { + QList keys=logVars.keys(); + foreach (QString key, keys) + { + decorated.replace("{"+key+"}",logVars.value(key)); + } + } + + return decorated; +} + +QtMsgType LogMessage::getType() const +{ + return type; +} diff --git a/Log/logmessage.h b/Log/logmessage.h index d2ee785..fde7e63 100644 --- a/Log/logmessage.h +++ b/Log/logmessage.h @@ -1,44 +1,44 @@ - -#ifndef LOGMESSAGE_H -#define LOGMESSAGE_H - -#include -#include -#include -#include "logglobal.h" - -class DECLSPEC LogMessage -{ - Q_DISABLE_COPY(LogMessage) -public: - - LogMessage(const QtMsgType type, const QString& message, const QHash* logVars, - const QString &file, const QString &function, const int line); - - QString toString(const QString& msgFormat, const QString& timestampFormat) const; - - QtMsgType getType() const; - -private: - - - QHash logVars; - - QDateTime timestamp; - - QtMsgType type; - - - Qt::HANDLE threadId; - - QString message; - - QString file; - - QString function; - - int line; - -}; - -#endif // LOGMESSAGE_H + +#ifndef LOGMESSAGE_H +#define LOGMESSAGE_H + +#include +#include +#include +#include "logglobal.h" + +class DECLSPEC LogMessage +{ + Q_DISABLE_COPY(LogMessage) +public: + + LogMessage(const QtMsgType type, const QString& message, const QHash* logVars, + const QString &file, const QString &function, const int line); + + QString toString(const QString& msgFormat, const QString& timestampFormat) const; + + QtMsgType getType() const; + +private: + + + QHash logVars; + + QDateTime timestamp; + + QtMsgType type; + + + Qt::HANDLE threadId; + + QString message; + + QString file; + + QString function; + + int line; + +}; + +#endif // LOGMESSAGE_H diff --git a/LogInfo.cpp b/LogInfo.cpp index e5fb088..6d98a64 100644 --- a/LogInfo.cpp +++ b/LogInfo.cpp @@ -1,461 +1,461 @@ -#include "LogInfo.h" -#include "ui_loginfo.h" -#include -#include -#include -#include -#include -#include -#include -#include "DevOp.h" -#include -#include "myinclude.h" -#include -#include - -#ifndef LOGINFOFILE_DIR - #define LOGINFOFILE_DIR "/home/plg/loginfo/" -#endif -#define UDISK_LOGINFO_ROOT_DIR "/udisk/log/" - -LogInfo::LogInfo(QWidget *parent) : - QWidget(parent), - ui(new Ui::LogInfo) -{ - ui->setupUi(this); - ui->textEditRunStatus->setReadOnly(true); - ui->textEditRunStatus_2->setReadOnly(true); - textEdit = ui->textEditRunStatus; - textEdit->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); - textEdit2 = ui->textEditRunStatus_2; - //textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); - textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); - - - textEditMachInfo = ui->machinInformation; - runStatusTextIndex = 0; - openFileName =""; - ui->labelPreFileName->setText(""); - //currenDate=""; - //r_CurrentDate=QDate::currentDate().toString("yyyyMMdd"); - - textEdit2->append(tr("请先打开历史状态文件!")); - if(!QDir("/home/plg").exists()) - QDir("/home/plg").mkdir("/home/plg"); - readRunStatusText(); - runStatusTextIndex = textEdit->document()->lineCount(); - fileDialog=0; // 先初始化为0 ,否则会死机 - - QFile file(SYS_ROOT_DIR"UseEn"); - if(!file.exists()){ - onReadRecorder( ); - } - timerLogdel=new QTimer(this); - connect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog())); - //延时60秒删除日志文件 - timerLogdel->start(60000); - setScrollBar(); -} - -LogInfo::~LogInfo() -{ - textEdit = 0; - textEdit2 = 0; - textEditMachInfo = 0; - if(fileDialog) - delete fileDialog; - delete ui; - - disconnect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog())); - timerLogdel->stop(); -} - -QTextEdit *LogInfo::textEdit = 0; -QTextEdit *LogInfo::textEdit2 = 0; -QTextEdit *LogInfo::textEditMachInfo = 0; - -int LogInfo::runStatusTextIndex = 0; - -void LogInfo::showMachineInformation(QString Mac,QString SerialNum, QString VernonBachVer, QString FpgaVer) -{ - QString machInfo; - machInfo = "Mac:" + Mac + "\n"; - machInfo += "VernonBach Ver:" + VernonBachVer + "\n"; - machInfo += "FPGA Ver:" + FpgaVer; - textEditMachInfo->setText(machInfo); -} - -void LogInfo::showVerionInformation(QString Mac,QString VernonBachVer, QString FpgaVer,QString STM32Ver,bool powerOnMode) -{ - static bool flag = false; - if(!flag){ - QString machInfo; - machInfo = "Mac:" + Mac + "\n"; - machInfo += "VernonBach Ver:" + VernonBachVer +"|"+STM32Ver+ "\n"; - machInfo += "FPGA Ver: NO" + FpgaVer + "\n"; - machInfo += "PowerOnMode: " + QString::number(powerOnMode) + "\n"; - textEditMachInfo->append(machInfo); - } -} - -void LogInfo::showRemoteControll(QString SuperNode, QString edgeIP) -{ - QString machInfo = textEditMachInfo->toPlainText(); - machInfo += "SuperNode:" + SuperNode + "\n"; - machInfo += "edgeIP:" + edgeIP + "\n"; - textEditMachInfo->setText(machInfo); -} - -//edit@01-11 -void LogInfo::setRunStatusText(QString str){ - if(!textEdit){ - return; - } - const int maxTextEditHeight = 2000; - if(textEdit->document()->size().height() > maxTextEditHeight) - { - textEdit->clear(); //显示今天全部信息,加载太多可能会死机 - } - str.prepend(QString("%1. %2:").arg(QString::number(runStatusTextIndex ++ )).arg(QTime::currentTime().toString("hh:mm:ss"))); - textEdit->append(str); - { - // 使用静态缓冲区批量写入,避免每次调用都 open/close 文件导致 ARM 板 I/O 繁忙 - static QStringList pendingLines; - static QString lastDate; - static int pendingTotalLen = 0; // 增量维护总字符数,避免每次扫描 - const QString dts = QDate::currentDate().toString("yyyyMMdd"); - if(dts != lastDate){ - // 日期变化时先把旧缓冲写入旧文件 - if(!pendingLines.isEmpty() && !lastDate.isEmpty()){ - QString oldFile = QString(LOGINFOFILE_DIR) + lastDate + "_1.txt"; - QFile f(oldFile); - if(f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)){ - QTextStream out(&f); - for(const QString &line : pendingLines) - out << line << endl; - f.close(); - } - pendingLines.clear(); - pendingTotalLen = 0; - } - lastDate = dts; - } - pendingLines.append(str); - pendingTotalLen += str.length(); - // 每累积 10 条或字符总量超过 2KB 时批量写入一次 - if(pendingLines.size() >= 10 || pendingTotalLen > 2048){ - QString fileNameL = QString(LOGINFOFILE_DIR) + dts + "_1.txt"; - QFile file(fileNameL); - if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)){ - QTextStream out(&file); - for(const QString &line : pendingLines) - out << line << endl; - file.close(); - } - pendingLines.clear(); - pendingTotalLen = 0; - truncatelog(); - } - } -} - -QString LogInfo::getRunStatusText(void){ - return ""; -} - -void LogInfo::readRunStatusText() -{ - QString fileName; - if(textEdit){ - QDir dir1; - dir1.setPath(LOGINFOFILE_DIR); - if(!dir1.exists()) - dir1.mkdir(QString ("/home/plg/loginfo/")); - fileName=QString("/home/plg/loginfo/")+QDate::currentDate().toString("yyyyMMdd")+"_1.txt"; - QFile file(fileName); - if(file.exists()){ - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + file.fileName()); - } - else{ - QTextStream in (&file); - textEdit->setText(in.readAll()); - } - file.close(); - ui->tabWidget->setCurrentWidget(ui->tab); - } - - QDate date1 = QDate::currentDate(); - for(int i=0;i<8;i++) - { - fileName=QString("/home/plg/loginfo/")+date1.addDays(-i-5).toString("yyyyMMdd")+".txt"; - file.setFileName(fileName); - if(file.exists()){ - file.remove(); - } - } - } -} - - -void LogInfo::on_pushButtonExportFile_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("提示"), - tr("是否确认将所有日志文件导出到U盘?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - //QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_LOGINFO_ROOT_DIR; - QDir dir(UDISK_LOGINFO_ROOT_DIR); - if(!dir.exists()){ -// system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data())); - system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data())); - } - - if(!dir.exists()){ - QMessageBox::warning(this,tr("警告"),tr("U盘目录创建失败")); - return; - } - - //插入U盘后,检测目录usb-storage是否存在 - if(!QDir("/proc/scsi/usb-storage/").exists()){ - QMessageBox::warning(this,tr("警告"),tr("U盘未插入或无法识别,请重新插拔设备!")); - return; - } - -// system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data())); - system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data())); - //refreshListView(EditMode); - system("sync"); - QMessageBox::information(this, tr("提示"), - tr("成功导出到U盘")); - } -} - -void LogInfo::on_pushButtonPreState_pressed(){ - - if(textEdit2){ - //setRunStatusText(QString("FILE COUNT:%1").arg( QDir("/home/plg/loginfo/").count())); - //if( QDir("/home/plg/loginfo/").count()<4) { - if( QDir("/home/plg/loginfo/").count()<1) { - //QMessageBox::warning(this,"警告","没有历史文件"); - textEdit2->setText( "目前历史文件数量为0个"); - return; - } - //qDebug()<<"3333"; - if(openFileName.isEmpty()) textEdit2->clear(); - if(fileDialog) { - // qDebug()<<"4444"; - disconnect(fileDialog,SIGNAL(accepted()),0,0); // 如果对话框已经定义,则删除控件关联,否则也会出错。 - - } - else {//qDebug()<<"5"; - fileDialog = new MyFileDialog(0); - //qDebug()<<"6"; - } - //qDebug()<<"7"; - QDir dir1; - dir1.setPath(QString ("/home/plg/loginfo/")); - - if(!dir1.exists()) - {dir1.mkdir(QString ("/home/plg/loginfo/"));} - if(fileDialog){ - //qDebug()<<"8"; - - if(fileDialog->directory().path()!="/home/plg/loginfo") - fileDialog->setDirectory(QDir("/home/plg/loginfo")); - - - //qDebug()<<"read File 3.2"<showFileDialog(tr("选择历史记录文件"),dir1.path(),QString("Txt files (*.txt)")); - //qDebug()<<"read File 5"; - } - //else qDebug()<<"read File:"<selectedFiles(); - if( files.size()==0) return ; - if(QString(files[0]).isNull()) return; - QString fileName = files[0]; - - if(!fileName.endsWith(".txt",Qt::CaseInsensitive)) return ; - - openFileName = fileName; - QFile file(openFileName); - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); - } - else{ - QTextStream in (&file); - textEdit2->setText(in.readAll()); - textEdit2->moveCursor(QTextCursor::End);//滚动条移到底部 - //ui->labelPreFileName->setText(file.fileName()); - QFileInfo info(file.fileName()); - ui->labelPreFileName->setText(info.fileName()); - } - file.close(); - ui->tabWidget->setCurrentWidget(ui->tab_2); - -} - -void LogInfo::on_pushButtonClear_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("提示"), - tr("是否确认将历史日志文件全部清除?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QDir dir1(QString("/home/plg/loginfo/")); - if(dir1.exists()) - { - system((char *)QString("rm /home/plg/loginfo/*.*").toLatin1().data()); - deleteDirectoryContents(dir1); - } - else system((char *)QString("mkdir /home/plg/loginfo/").toLatin1().data()); - } -} - -void LogInfo::on_pushButtonClearCurrent_pressed() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("提示"), - tr("是否确认将当前日志全部清除?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - textEdit->clear(); - runStatusTextIndex=0; - } -} -void LogInfo::onReadRecorder() -{ - QString fileName = ":/buge_record.txt"; - - if(!fileName.endsWith(".txt",Qt::CaseInsensitive)) return ; - QFile file(fileName); - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); - } - else{ - QTextStream in (&file); - textEditMachInfo->setText(in.readAll()); - } -} - - -void LogInfo::deleteDirectoryContents(const QDir &directory) { - QList entries = directory.entryInfoList( - QDir::NoDotAndDotDot | QDir::AllEntries); - QString today = QDate::currentDate().toString(Qt::ISODate); - // 使用传统的 for 循环遍历所有条目 - for (int i = 0; i < entries.size(); ++i) { - QFileInfo entryInfo = entries.at(i); - QString dirName=entryInfo.baseName(); - if(today==dirName) - continue; - QString fullPath = entryInfo.absoluteFilePath(); - - if (entryInfo.isFile() || entryInfo.isSymLink()) { - // 如果是文件或符号链接,尝试删除 - if (!QFile::remove(fullPath)) { - qDebug() << "Failed to remove file or symlink:" << fullPath; - } - } else if (entryInfo.isDir()) { - // 如果是目录,递归调用以删除其内容 - QDir subDir(fullPath); - deleteDirectoryContents(subDir); - - // 目录现在应该是空的,尝试删除它 - if (!QDir().rmdir(fullPath)) { - qDebug() << "Failed to remove directory:" << fullPath; - } - } - } -} - -// 删除指定文件夹超过七天的文件 -void LogInfo::deleteOldLog(const QString folderPath,int days){ - QDir dir(folderPath); // 创建一个QDir对象用于操作传入的文件夹路径 - if (!dir.exists()) { // 判断传入文件夹是否存在 - qDebug() << "文件夹不存在"; - return; - } - QDateTime currentDateTime = QDateTime::currentDateTime(); // 获取当前时间 - QDateTime sevenDaysAgo = currentDateTime.addDays(-days); // 计算days天前的日期时间 - // 目录下的文件和子目录的信息列表,列出所有文件和子目录并按照最后修改时间排序 - QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time); - foreach (QFileInfo fileInfo ,fileInfoList) { - if (!fileInfo.isDir()){ - QString fileExtension = fileInfo.suffix().toLower(); // 获取文件的扩展名并确保它是小写的 - // 选择删除那种图片类型 - if (fileExtension == "txt") { - if (fileInfo.lastModified() < sevenDaysAgo && fileInfo.fileName().indexOf('_')!=-1) { // 获取最后一个文件夹修改时间和days传入的时间最对比 - if (QFile::remove(fileInfo.absoluteFilePath())) { // 删除满足条件的文件的绝对路径 - qDebug() << "删除成功" << fileInfo.absoluteFilePath(); - } else { - qDebug() << "文件删除失败" << fileInfo.absoluteFilePath(); - } - } - } - } - } -} - -void LogInfo::deleteOldLog() -{ - qDebug()<<"延时60秒删除过期日志"; - deleteOldLog(LOGINFOFILE_DIR,7);//删除一周前的日志 - timerLogdel->stop(); -} - -void LogInfo::truncatelog() -{ - const QString dts=QDate::currentDate().toString("yyyyMMdd") ; - const QString fileNameL=QString(LOGINFOFILE_DIR)+dts +"_1.txt"; - QFile file(fileNameL); - - if(file.size()>204800)//文件大小 - { - QSettings settings("MySoft", "MyApp"); - int filenum=settings.value(dts,2).toInt(); - if(filenum==2) - settings.clear(); - settings.setValue(dts,filenum+1); - - qDebug()<<"rename="<textEditRunStatus->setStyleSheet(styleSheet); - ui->textEditRunStatus_2->setStyleSheet(styleSheet); -} +#include "LogInfo.h" +#include "ui_loginfo.h" +#include +#include +#include +#include +#include +#include +#include +#include "DevOp.h" +#include +#include "myinclude.h" +#include +#include + +#ifndef LOGINFOFILE_DIR + #define LOGINFOFILE_DIR "/home/plg/loginfo/" +#endif +#define UDISK_LOGINFO_ROOT_DIR "/udisk/log/" + +LogInfo::LogInfo(QWidget *parent) : + QWidget(parent), + ui(new Ui::LogInfo) +{ + ui->setupUi(this); + ui->textEditRunStatus->setReadOnly(true); + ui->textEditRunStatus_2->setReadOnly(true); + textEdit = ui->textEditRunStatus; + textEdit->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); + textEdit2 = ui->textEditRunStatus_2; + //textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); + textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }"); + + + textEditMachInfo = ui->machinInformation; + runStatusTextIndex = 0; + openFileName =""; + ui->labelPreFileName->setText(""); + //currenDate=""; + //r_CurrentDate=QDate::currentDate().toString("yyyyMMdd"); + + textEdit2->append(tr("请先打开历史状态文件!")); + if(!QDir("/home/plg").exists()) + QDir("/home/plg").mkdir("/home/plg"); + readRunStatusText(); + runStatusTextIndex = textEdit->document()->lineCount(); + fileDialog=0; // 先初始化为0 ,否则会死机 + + QFile file(SYS_ROOT_DIR"UseEn"); + if(!file.exists()){ + onReadRecorder( ); + } + timerLogdel=new QTimer(this); + connect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog())); + //延时60秒删除日志文件 + timerLogdel->start(60000); + setScrollBar(); +} + +LogInfo::~LogInfo() +{ + textEdit = 0; + textEdit2 = 0; + textEditMachInfo = 0; + if(fileDialog) + delete fileDialog; + delete ui; + + disconnect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog())); + timerLogdel->stop(); +} + +QTextEdit *LogInfo::textEdit = 0; +QTextEdit *LogInfo::textEdit2 = 0; +QTextEdit *LogInfo::textEditMachInfo = 0; + +int LogInfo::runStatusTextIndex = 0; + +void LogInfo::showMachineInformation(QString Mac,QString SerialNum, QString VernonBachVer, QString FpgaVer) +{ + QString machInfo; + machInfo = "Mac:" + Mac + "\n"; + machInfo += "VernonBach Ver:" + VernonBachVer + "\n"; + machInfo += "FPGA Ver:" + FpgaVer; + textEditMachInfo->setText(machInfo); +} + +void LogInfo::showVerionInformation(QString Mac,QString VernonBachVer, QString FpgaVer,QString STM32Ver,bool powerOnMode) +{ + static bool flag = false; + if(!flag){ + QString machInfo; + machInfo = "Mac:" + Mac + "\n"; + machInfo += "VernonBach Ver:" + VernonBachVer +"|"+STM32Ver+ "\n"; + machInfo += "FPGA Ver: NO" + FpgaVer + "\n"; + machInfo += "PowerOnMode: " + QString::number(powerOnMode) + "\n"; + textEditMachInfo->append(machInfo); + } +} + +void LogInfo::showRemoteControll(QString SuperNode, QString edgeIP) +{ + QString machInfo = textEditMachInfo->toPlainText(); + machInfo += "SuperNode:" + SuperNode + "\n"; + machInfo += "edgeIP:" + edgeIP + "\n"; + textEditMachInfo->setText(machInfo); +} + +//edit@01-11 +void LogInfo::setRunStatusText(QString str){ + if(!textEdit){ + return; + } + const int maxTextEditHeight = 2000; + if(textEdit->document()->size().height() > maxTextEditHeight) + { + textEdit->clear(); //显示今天全部信息,加载太多可能会死机 + } + str.prepend(QString("%1. %2:").arg(QString::number(runStatusTextIndex ++ )).arg(QTime::currentTime().toString("hh:mm:ss"))); + textEdit->append(str); + { + // 使用静态缓冲区批量写入,避免每次调用都 open/close 文件导致 ARM 板 I/O 繁忙 + static QStringList pendingLines; + static QString lastDate; + static int pendingTotalLen = 0; // 增量维护总字符数,避免每次扫描 + const QString dts = QDate::currentDate().toString("yyyyMMdd"); + if(dts != lastDate){ + // 日期变化时先把旧缓冲写入旧文件 + if(!pendingLines.isEmpty() && !lastDate.isEmpty()){ + QString oldFile = QString(LOGINFOFILE_DIR) + lastDate + "_1.txt"; + QFile f(oldFile); + if(f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)){ + QTextStream out(&f); + for(const QString &line : pendingLines) + out << line << endl; + f.close(); + } + pendingLines.clear(); + pendingTotalLen = 0; + } + lastDate = dts; + } + pendingLines.append(str); + pendingTotalLen += str.length(); + // 每累积 10 条或字符总量超过 2KB 时批量写入一次 + if(pendingLines.size() >= 10 || pendingTotalLen > 2048){ + QString fileNameL = QString(LOGINFOFILE_DIR) + dts + "_1.txt"; + QFile file(fileNameL); + if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)){ + QTextStream out(&file); + for(const QString &line : pendingLines) + out << line << endl; + file.close(); + } + pendingLines.clear(); + pendingTotalLen = 0; + truncatelog(); + } + } +} + +QString LogInfo::getRunStatusText(void){ + return ""; +} + +void LogInfo::readRunStatusText() +{ + QString fileName; + if(textEdit){ + QDir dir1; + dir1.setPath(LOGINFOFILE_DIR); + if(!dir1.exists()) + dir1.mkdir(QString ("/home/plg/loginfo/")); + fileName=QString("/home/plg/loginfo/")+QDate::currentDate().toString("yyyyMMdd")+"_1.txt"; + QFile file(fileName); + if(file.exists()){ + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + file.fileName()); + } + else{ + QTextStream in (&file); + textEdit->setText(in.readAll()); + } + file.close(); + ui->tabWidget->setCurrentWidget(ui->tab); + } + + QDate date1 = QDate::currentDate(); + for(int i=0;i<8;i++) + { + fileName=QString("/home/plg/loginfo/")+date1.addDays(-i-5).toString("yyyyMMdd")+".txt"; + file.setFileName(fileName); + if(file.exists()){ + file.remove(); + } + } + } +} + + +void LogInfo::on_pushButtonExportFile_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("提示"), + tr("是否确认将所有日志文件导出到U盘?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + //QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_LOGINFO_ROOT_DIR; + QDir dir(UDISK_LOGINFO_ROOT_DIR); + if(!dir.exists()){ +// system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data())); + system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data())); + } + + if(!dir.exists()){ + QMessageBox::warning(this,tr("警告"),tr("U盘目录创建失败")); + return; + } + + //插入U盘后,检测目录usb-storage是否存在 + if(!QDir("/proc/scsi/usb-storage/").exists()){ + QMessageBox::warning(this,tr("警告"),tr("U盘未插入或无法识别,请重新插拔设备!")); + return; + } + +// system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data())); + system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data())); + //refreshListView(EditMode); + system("sync"); + QMessageBox::information(this, tr("提示"), + tr("成功导出到U盘")); + } +} + +void LogInfo::on_pushButtonPreState_pressed(){ + + if(textEdit2){ + //setRunStatusText(QString("FILE COUNT:%1").arg( QDir("/home/plg/loginfo/").count())); + //if( QDir("/home/plg/loginfo/").count()<4) { + if( QDir("/home/plg/loginfo/").count()<1) { + //QMessageBox::warning(this,"警告","没有历史文件"); + textEdit2->setText( "目前历史文件数量为0个"); + return; + } + //qDebug()<<"3333"; + if(openFileName.isEmpty()) textEdit2->clear(); + if(fileDialog) { + // qDebug()<<"4444"; + disconnect(fileDialog,SIGNAL(accepted()),0,0); // 如果对话框已经定义,则删除控件关联,否则也会出错。 + + } + else {//qDebug()<<"5"; + fileDialog = new MyFileDialog(0); + //qDebug()<<"6"; + } + //qDebug()<<"7"; + QDir dir1; + dir1.setPath(QString ("/home/plg/loginfo/")); + + if(!dir1.exists()) + {dir1.mkdir(QString ("/home/plg/loginfo/"));} + if(fileDialog){ + //qDebug()<<"8"; + + if(fileDialog->directory().path()!="/home/plg/loginfo") + fileDialog->setDirectory(QDir("/home/plg/loginfo")); + + + //qDebug()<<"read File 3.2"<showFileDialog(tr("选择历史记录文件"),dir1.path(),QString("Txt files (*.txt)")); + //qDebug()<<"read File 5"; + } + //else qDebug()<<"read File:"<selectedFiles(); + if( files.size()==0) return ; + if(QString(files[0]).isNull()) return; + QString fileName = files[0]; + + if(!fileName.endsWith(".txt",Qt::CaseInsensitive)) return ; + + openFileName = fileName; + QFile file(openFileName); + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); + } + else{ + QTextStream in (&file); + textEdit2->setText(in.readAll()); + textEdit2->moveCursor(QTextCursor::End);//滚动条移到底部 + //ui->labelPreFileName->setText(file.fileName()); + QFileInfo info(file.fileName()); + ui->labelPreFileName->setText(info.fileName()); + } + file.close(); + ui->tabWidget->setCurrentWidget(ui->tab_2); + +} + +void LogInfo::on_pushButtonClear_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("提示"), + tr("是否确认将历史日志文件全部清除?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QDir dir1(QString("/home/plg/loginfo/")); + if(dir1.exists()) + { + system((char *)QString("rm /home/plg/loginfo/*.*").toLatin1().data()); + deleteDirectoryContents(dir1); + } + else system((char *)QString("mkdir /home/plg/loginfo/").toLatin1().data()); + } +} + +void LogInfo::on_pushButtonClearCurrent_pressed() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("提示"), + tr("是否确认将当前日志全部清除?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + textEdit->clear(); + runStatusTextIndex=0; + } +} +void LogInfo::onReadRecorder() +{ + QString fileName = ":/buge_record.txt"; + + if(!fileName.endsWith(".txt",Qt::CaseInsensitive)) return ; + QFile file(fileName); + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); + } + else{ + QTextStream in (&file); + textEditMachInfo->setText(in.readAll()); + } +} + + +void LogInfo::deleteDirectoryContents(const QDir &directory) { + QList entries = directory.entryInfoList( + QDir::NoDotAndDotDot | QDir::AllEntries); + QString today = QDate::currentDate().toString(Qt::ISODate); + // 使用传统的 for 循环遍历所有条目 + for (int i = 0; i < entries.size(); ++i) { + QFileInfo entryInfo = entries.at(i); + QString dirName=entryInfo.baseName(); + if(today==dirName) + continue; + QString fullPath = entryInfo.absoluteFilePath(); + + if (entryInfo.isFile() || entryInfo.isSymLink()) { + // 如果是文件或符号链接,尝试删除 + if (!QFile::remove(fullPath)) { + qDebug() << "Failed to remove file or symlink:" << fullPath; + } + } else if (entryInfo.isDir()) { + // 如果是目录,递归调用以删除其内容 + QDir subDir(fullPath); + deleteDirectoryContents(subDir); + + // 目录现在应该是空的,尝试删除它 + if (!QDir().rmdir(fullPath)) { + qDebug() << "Failed to remove directory:" << fullPath; + } + } + } +} + +// 删除指定文件夹超过七天的文件 +void LogInfo::deleteOldLog(const QString folderPath,int days){ + QDir dir(folderPath); // 创建一个QDir对象用于操作传入的文件夹路径 + if (!dir.exists()) { // 判断传入文件夹是否存在 + qDebug() << "文件夹不存在"; + return; + } + QDateTime currentDateTime = QDateTime::currentDateTime(); // 获取当前时间 + QDateTime sevenDaysAgo = currentDateTime.addDays(-days); // 计算days天前的日期时间 + // 目录下的文件和子目录的信息列表,列出所有文件和子目录并按照最后修改时间排序 + QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time); + foreach (QFileInfo fileInfo ,fileInfoList) { + if (!fileInfo.isDir()){ + QString fileExtension = fileInfo.suffix().toLower(); // 获取文件的扩展名并确保它是小写的 + // 选择删除那种图片类型 + if (fileExtension == "txt") { + if (fileInfo.lastModified() < sevenDaysAgo && fileInfo.fileName().indexOf('_')!=-1) { // 获取最后一个文件夹修改时间和days传入的时间最对比 + if (QFile::remove(fileInfo.absoluteFilePath())) { // 删除满足条件的文件的绝对路径 + qDebug() << "删除成功" << fileInfo.absoluteFilePath(); + } else { + qDebug() << "文件删除失败" << fileInfo.absoluteFilePath(); + } + } + } + } + } +} + +void LogInfo::deleteOldLog() +{ + qDebug()<<"延时60秒删除过期日志"; + deleteOldLog(LOGINFOFILE_DIR,7);//删除一周前的日志 + timerLogdel->stop(); +} + +void LogInfo::truncatelog() +{ + const QString dts=QDate::currentDate().toString("yyyyMMdd") ; + const QString fileNameL=QString(LOGINFOFILE_DIR)+dts +"_1.txt"; + QFile file(fileNameL); + + if(file.size()>204800)//文件大小 + { + QSettings settings("MySoft", "MyApp"); + int filenum=settings.value(dts,2).toInt(); + if(filenum==2) + settings.clear(); + settings.setValue(dts,filenum+1); + + qDebug()<<"rename="<textEditRunStatus->setStyleSheet(styleSheet); + ui->textEditRunStatus_2->setStyleSheet(styleSheet); +} diff --git a/LogInfo.h b/LogInfo.h index 949b5a6..cc035ff 100644 --- a/LogInfo.h +++ b/LogInfo.h @@ -1,56 +1,56 @@ -#ifndef LOGINFO_H -#define LOGINFO_H - -#include -#include -#include "MyFileDialog.h" -#include -#include -namespace Ui { -class LogInfo; -} - -class LogInfo : public QWidget -{ - Q_OBJECT - -public: - explicit LogInfo(QWidget *parent = 0); - ~LogInfo(); - static QString getRunStatusText(void); - - static void setRunStatusText(QString str); - static void showMachineInformation(QString Mac,QString SerialNum, QString VernonBachVer, QString FpgaVer); - static void showRemoteControll(QString SuperNode, QString edgeIP); - - void onReadRecorder(); - void deleteDirectoryContents(const QDir &directory); - static void truncatelog(); - static void showVerionInformation(QString,QString,QString,QString,bool); - void setScrollBar(); -protected slots: - void deleteOldLog(const QString folderPath, int days); - void deleteOldLog(); -private slots: - void on_pushButtonClear_pressed(); - void on_pushButtonPreState_pressed(); - void on_pushButtonExportFile_pressed(); - - void on_pushButtonClearCurrent_pressed(); - void onOpen_FIle_select(); - void readRunStatusText(); - -private: - Ui::LogInfo *ui; - static QTextEdit *textEdit; - static QTextEdit *textEdit2; - static QTextEdit *textEditMachInfo; - static int runStatusTextIndex; - MyFileDialog *fileDialog; - QString openFileName; - static QString currenDate; - static QString r_CurrentDate; - QTimer *timerLogdel; -}; - -#endif // LOGINFO_H +#ifndef LOGINFO_H +#define LOGINFO_H + +#include +#include +#include "MyFileDialog.h" +#include +#include +namespace Ui { +class LogInfo; +} + +class LogInfo : public QWidget +{ + Q_OBJECT + +public: + explicit LogInfo(QWidget *parent = 0); + ~LogInfo(); + static QString getRunStatusText(void); + + static void setRunStatusText(QString str); + static void showMachineInformation(QString Mac,QString SerialNum, QString VernonBachVer, QString FpgaVer); + static void showRemoteControll(QString SuperNode, QString edgeIP); + + void onReadRecorder(); + void deleteDirectoryContents(const QDir &directory); + static void truncatelog(); + static void showVerionInformation(QString,QString,QString,QString,bool); + void setScrollBar(); +protected slots: + void deleteOldLog(const QString folderPath, int days); + void deleteOldLog(); +private slots: + void on_pushButtonClear_pressed(); + void on_pushButtonPreState_pressed(); + void on_pushButtonExportFile_pressed(); + + void on_pushButtonClearCurrent_pressed(); + void onOpen_FIle_select(); + void readRunStatusText(); + +private: + Ui::LogInfo *ui; + static QTextEdit *textEdit; + static QTextEdit *textEdit2; + static QTextEdit *textEditMachInfo; + static int runStatusTextIndex; + MyFileDialog *fileDialog; + QString openFileName; + static QString currenDate; + static QString r_CurrentDate; + QTimer *timerLogdel; +}; + +#endif // LOGINFO_H diff --git a/Matrix/common.cpp b/Matrix/common.cpp index 45970f4..6a4327d 100644 --- a/Matrix/common.cpp +++ b/Matrix/common.cpp @@ -1,351 +1,351 @@ -/* common.c - Contains functions needed for a number of barcodes */ - -/* - libzint - the open source barcode library - Copyright (C) 2008 Robin Stuart - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include -#include -#include -#include "common.h" - -int ustrlen(unsigned char data[]) { - /* Local replacement for strlen() with unsigned char strings */ - int i; - for (i=0;data[i];i++); - - return i; -} - -void ustrcpy(unsigned char target[], unsigned char source[]) { - /* Local replacement for strcpy() with unsigned char strings */ - int i, len; - - len = ustrlen(source); - for(i = 0; i < len; i++) { - target[i] = source[i]; - } - target[i] = '\0'; -} - -void concat(char dest[], char source[]) -{ /* Concatinates dest[] with the contents of source[], copying /0 as well */ - unsigned int i, j, n; - - j = strlen(dest); - n = strlen(source); - for(i = 0; i <= n; i++) { - dest[i + j] = source[i]; } -} - -void uconcat(unsigned char dest[], unsigned char source[]) -{ /* Concatinates dest[] with the contents of source[], copying /0 as well */ - unsigned int i, j; - - j = ustrlen(dest); - for(i = 0; i <= ustrlen(source); i++) { - dest[i + j] = source[i]; } -} - - -int ctoi(char source) -{ /* Converts a character 0-9 to its equivalent integer value */ - if((source >= '0') && (source <= '9')) - return (source - '0'); - return(source - 'A' + 10); -} - -char itoc(int source) -{ /* Converts an integer value to its hexadecimal character */ - if ((source >= 0) && (source <= 9)) { - return ('0' + source); } - else { - return ('A' + (source - 10)); } -} - -void to_upper(unsigned char source[]) -{ /* Converts lower case characters to upper case in a string source[] */ - unsigned int i, src_len = ustrlen(source); - - for (i = 0; i < src_len; i++) { - if ((source[i] >= 'a') && (source[i] <= 'z')) { - source [i] = (source[i] - 'a') + 'A'; } - } -} - -int is_sane(char test_string[], unsigned char source[], int length) -{ /* Verifies that a string only uses valid characters */ - unsigned int i, j, latch; - unsigned int lt = strlen(test_string); - - for(i = 0; i < length; i++) { - latch = FALSE; - for(j = 0; j < lt; j++) { - if (source[i] == test_string[j]) { - latch = TRUE; - break; - } - } - if (!(latch)) { - return ERROR_INVALID_DATA; - } - } - - return 0; -} - -int posn(char set_string[], char data) -{ /* Returns the position of data in set_string */ - unsigned int i, n = strlen(set_string); - - for(i = 0; i < n; i++) { - if (data == set_string[i]) { return i; } } - return 0; -} - -void lookup(char set_string[], char *table[], char data, char dest[]) -{ /* Replaces huge switch statements for looking up in tables */ - unsigned int i, n = strlen(set_string); - - for(i = 0; i < n; i++) { - if (data == set_string[i]) { concat(dest, table[i]); } } -} - -int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord) -{ - return (symbol->encoded_data[y_coord][x_coord / 7] & (1 << (x_coord % 7))) ? 1 : 0; -} - -void set_module(struct zint_symbol *symbol, int y_coord, int x_coord) -{ - if(module_is_set(symbol, y_coord, x_coord)) { return; } - symbol->encoded_data[y_coord][x_coord / 7] += 1 << (x_coord % 7); -} - -void unset_module(struct zint_symbol *symbol, int y_coord, int x_coord) -{ - if(!(module_is_set(symbol, y_coord, x_coord))) { return; } - symbol->encoded_data[y_coord][x_coord / 7] -= 1 << (x_coord % 7); -} - -void expand(struct zint_symbol *symbol, char data[]) -{ /* Expands from a width pattern to a bit pattern */ - - unsigned int reader, n = strlen(data); - int writer, i; - char latch; - - writer = 0; - latch = '1'; - - for(reader = 0; reader < n; reader++) { - for(i = 0; i < ctoi(data[reader]); i++) { - if(latch == '1') { set_module(symbol, symbol->rows, writer); } - writer++; - } - if(latch == '1') { - latch = '0'; - } else { - latch = '1'; - } - } - - if(symbol->symbology != BARCODE_PHARMA) { - if(writer > symbol->width) { - symbol->width = writer; - } - } else { - /* Pharmacode One ends with a space - adjust for this */ - if(writer > symbol->width + 2) { - symbol->width = writer - 2; - } - } - symbol->rows = symbol->rows + 1; -} - -int is_stackable(int symbology) { - /* Indicates which symbologies can have row binding */ - if(symbology < BARCODE_PDF417) { return 1; } - if(symbology == BARCODE_CODE128B) { return 1; } - if(symbology == BARCODE_ISBNX) { return 1; } - if(symbology == BARCODE_EAN14) { return 1; } - if(symbology == BARCODE_NVE18) { return 1; } - if(symbology == BARCODE_KOREAPOST) { return 1; } - if(symbology == BARCODE_PLESSEY) { return 1; } - if(symbology == BARCODE_TELEPEN_NUM) { return 1; } - if(symbology == BARCODE_ITF14) { return 1; } - if(symbology == BARCODE_CODE32) { return 1; } - - return 0; -} - -int is_extendable(int symbology) { - /* Indicates which symbols can have addon */ - if(symbology == BARCODE_EANX) { return 1; } - if(symbology == BARCODE_UPCA) { return 1; } - if(symbology == BARCODE_UPCE) { return 1; } - if(symbology == BARCODE_ISBNX) { return 1; } - if(symbology == BARCODE_UPCA_CC) { return 1; } - if(symbology == BARCODE_UPCE_CC) { return 1; } - if(symbology == BARCODE_EANX_CC) { return 1; } - - return 0; -} - -int roundup(float input) -{ - float remainder; - int integer_part; - - integer_part = (int)input; - remainder = input - integer_part; - - if(remainder > 0.1) { - integer_part++; - } - - return integer_part; -} - -int istwodigits(unsigned char source[], int position) -{ - if((source[position] >= '0') && (source[position] <= '9')) { - if((source[position + 1] >= '0') && (source[position + 1] <= '9')) { - return 1; - } - } - - return 0; -} - -float froundup(float input) -{ - float fraction, output = 0.0; - - fraction = input - (int)input; - if(fraction > 0.01) { output = (input - fraction) + 1.0; } else { output = input; } - - return output; -} - -int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned char preprocessed[], int *length) -{ - int j, i, next; - - /* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */ - j = 0; - i = 0; - do { - next = -1; - if(source[i] < 128) { - preprocessed[j] = source[i]; - j++; - next = i + 1; - } else { - if(source[i] == 0xC2) { - preprocessed[j] = source[i + 1]; - j++; - next = i + 2; - } - if(source[i] == 0xC3) { - preprocessed[j] = source[i + 1] + 64; - j++; - next = i + 2; - } - } - if(next == -1) { - strcpy(symbol->errtxt, "error: Invalid character in input string (only Latin-1 characters supported)"); - return ERROR_INVALID_DATA; - } - i = next; - } while(i < *length); - preprocessed[j] = '\0'; - *length = j; - - return 0; -} - -int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[], int *length) -{ - int bpos, jpos, error_number, done; - int next; - - bpos = 0; - jpos = 0; - error_number = 0; - next = 0; - - do { - done = 0; - - if(source[bpos] <= 0x7f) { - /* 1 byte mode (7-bit ASCII) */ - vals[jpos] = source[bpos]; - next = bpos + 1; - jpos++; - done = 1; - } - - if(done == 0) { - if((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) { - strcpy(symbol->errtxt, "Corrupt Unicode data"); - return ERROR_INVALID_DATA; - } - } - - if(done == 0) { - if((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) { - strcpy(symbol->errtxt, "Overlong encoding not supported"); - return ERROR_INVALID_DATA; - } - } - - if(done == 0) { - if((source[bpos] >= 0xc2) && (source[bpos] <= 0xdf)) { - /* 2 byte mode */ - vals[jpos] = ((source[bpos] & 0x1f) << 6) + (source[bpos + 1] & 0x3f); - next = bpos + 2; - jpos++; - done = 1; - } - } - - if(done == 0) { - if((source[bpos] >= 0xe0) && (source[bpos] <= 0xef)) { - /* 3 byte mode */ - vals[jpos] = ((source[bpos] & 0x0f) << 12) + ((source[bpos + 1] & 0x3f) << 6) + (source[bpos + 2] & 0x3f); - next = bpos + 3; - jpos ++; - done = 1; - } - } - - if(done == 0) { - if(source[bpos] >= 0xf0) { - strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported"); - return ERROR_INVALID_DATA; - } - } - - bpos = next; - - } while(bpos < *length); - *length = jpos; - - return error_number; -} - +/* common.c - Contains functions needed for a number of barcodes */ + +/* + libzint - the open source barcode library + Copyright (C) 2008 Robin Stuart + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include +#include +#include +#include "common.h" + +int ustrlen(unsigned char data[]) { + /* Local replacement for strlen() with unsigned char strings */ + int i; + for (i=0;data[i];i++); + + return i; +} + +void ustrcpy(unsigned char target[], unsigned char source[]) { + /* Local replacement for strcpy() with unsigned char strings */ + int i, len; + + len = ustrlen(source); + for(i = 0; i < len; i++) { + target[i] = source[i]; + } + target[i] = '\0'; +} + +void concat(char dest[], char source[]) +{ /* Concatinates dest[] with the contents of source[], copying /0 as well */ + unsigned int i, j, n; + + j = strlen(dest); + n = strlen(source); + for(i = 0; i <= n; i++) { + dest[i + j] = source[i]; } +} + +void uconcat(unsigned char dest[], unsigned char source[]) +{ /* Concatinates dest[] with the contents of source[], copying /0 as well */ + unsigned int i, j; + + j = ustrlen(dest); + for(i = 0; i <= ustrlen(source); i++) { + dest[i + j] = source[i]; } +} + + +int ctoi(char source) +{ /* Converts a character 0-9 to its equivalent integer value */ + if((source >= '0') && (source <= '9')) + return (source - '0'); + return(source - 'A' + 10); +} + +char itoc(int source) +{ /* Converts an integer value to its hexadecimal character */ + if ((source >= 0) && (source <= 9)) { + return ('0' + source); } + else { + return ('A' + (source - 10)); } +} + +void to_upper(unsigned char source[]) +{ /* Converts lower case characters to upper case in a string source[] */ + unsigned int i, src_len = ustrlen(source); + + for (i = 0; i < src_len; i++) { + if ((source[i] >= 'a') && (source[i] <= 'z')) { + source [i] = (source[i] - 'a') + 'A'; } + } +} + +int is_sane(char test_string[], unsigned char source[], int length) +{ /* Verifies that a string only uses valid characters */ + unsigned int i, j, latch; + unsigned int lt = strlen(test_string); + + for(i = 0; i < length; i++) { + latch = FALSE; + for(j = 0; j < lt; j++) { + if (source[i] == test_string[j]) { + latch = TRUE; + break; + } + } + if (!(latch)) { + return ERROR_INVALID_DATA; + } + } + + return 0; +} + +int posn(char set_string[], char data) +{ /* Returns the position of data in set_string */ + unsigned int i, n = strlen(set_string); + + for(i = 0; i < n; i++) { + if (data == set_string[i]) { return i; } } + return 0; +} + +void lookup(char set_string[], char *table[], char data, char dest[]) +{ /* Replaces huge switch statements for looking up in tables */ + unsigned int i, n = strlen(set_string); + + for(i = 0; i < n; i++) { + if (data == set_string[i]) { concat(dest, table[i]); } } +} + +int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord) +{ + return (symbol->encoded_data[y_coord][x_coord / 7] & (1 << (x_coord % 7))) ? 1 : 0; +} + +void set_module(struct zint_symbol *symbol, int y_coord, int x_coord) +{ + if(module_is_set(symbol, y_coord, x_coord)) { return; } + symbol->encoded_data[y_coord][x_coord / 7] += 1 << (x_coord % 7); +} + +void unset_module(struct zint_symbol *symbol, int y_coord, int x_coord) +{ + if(!(module_is_set(symbol, y_coord, x_coord))) { return; } + symbol->encoded_data[y_coord][x_coord / 7] -= 1 << (x_coord % 7); +} + +void expand(struct zint_symbol *symbol, char data[]) +{ /* Expands from a width pattern to a bit pattern */ + + unsigned int reader, n = strlen(data); + int writer, i; + char latch; + + writer = 0; + latch = '1'; + + for(reader = 0; reader < n; reader++) { + for(i = 0; i < ctoi(data[reader]); i++) { + if(latch == '1') { set_module(symbol, symbol->rows, writer); } + writer++; + } + if(latch == '1') { + latch = '0'; + } else { + latch = '1'; + } + } + + if(symbol->symbology != BARCODE_PHARMA) { + if(writer > symbol->width) { + symbol->width = writer; + } + } else { + /* Pharmacode One ends with a space - adjust for this */ + if(writer > symbol->width + 2) { + symbol->width = writer - 2; + } + } + symbol->rows = symbol->rows + 1; +} + +int is_stackable(int symbology) { + /* Indicates which symbologies can have row binding */ + if(symbology < BARCODE_PDF417) { return 1; } + if(symbology == BARCODE_CODE128B) { return 1; } + if(symbology == BARCODE_ISBNX) { return 1; } + if(symbology == BARCODE_EAN14) { return 1; } + if(symbology == BARCODE_NVE18) { return 1; } + if(symbology == BARCODE_KOREAPOST) { return 1; } + if(symbology == BARCODE_PLESSEY) { return 1; } + if(symbology == BARCODE_TELEPEN_NUM) { return 1; } + if(symbology == BARCODE_ITF14) { return 1; } + if(symbology == BARCODE_CODE32) { return 1; } + + return 0; +} + +int is_extendable(int symbology) { + /* Indicates which symbols can have addon */ + if(symbology == BARCODE_EANX) { return 1; } + if(symbology == BARCODE_UPCA) { return 1; } + if(symbology == BARCODE_UPCE) { return 1; } + if(symbology == BARCODE_ISBNX) { return 1; } + if(symbology == BARCODE_UPCA_CC) { return 1; } + if(symbology == BARCODE_UPCE_CC) { return 1; } + if(symbology == BARCODE_EANX_CC) { return 1; } + + return 0; +} + +int roundup(float input) +{ + float remainder; + int integer_part; + + integer_part = (int)input; + remainder = input - integer_part; + + if(remainder > 0.1) { + integer_part++; + } + + return integer_part; +} + +int istwodigits(unsigned char source[], int position) +{ + if((source[position] >= '0') && (source[position] <= '9')) { + if((source[position + 1] >= '0') && (source[position + 1] <= '9')) { + return 1; + } + } + + return 0; +} + +float froundup(float input) +{ + float fraction, output = 0.0; + + fraction = input - (int)input; + if(fraction > 0.01) { output = (input - fraction) + 1.0; } else { output = input; } + + return output; +} + +int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned char preprocessed[], int *length) +{ + int j, i, next; + + /* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */ + j = 0; + i = 0; + do { + next = -1; + if(source[i] < 128) { + preprocessed[j] = source[i]; + j++; + next = i + 1; + } else { + if(source[i] == 0xC2) { + preprocessed[j] = source[i + 1]; + j++; + next = i + 2; + } + if(source[i] == 0xC3) { + preprocessed[j] = source[i + 1] + 64; + j++; + next = i + 2; + } + } + if(next == -1) { + strcpy(symbol->errtxt, "error: Invalid character in input string (only Latin-1 characters supported)"); + return ERROR_INVALID_DATA; + } + i = next; + } while(i < *length); + preprocessed[j] = '\0'; + *length = j; + + return 0; +} + +int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[], int *length) +{ + int bpos, jpos, error_number, done; + int next; + + bpos = 0; + jpos = 0; + error_number = 0; + next = 0; + + do { + done = 0; + + if(source[bpos] <= 0x7f) { + /* 1 byte mode (7-bit ASCII) */ + vals[jpos] = source[bpos]; + next = bpos + 1; + jpos++; + done = 1; + } + + if(done == 0) { + if((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) { + strcpy(symbol->errtxt, "Corrupt Unicode data"); + return ERROR_INVALID_DATA; + } + } + + if(done == 0) { + if((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) { + strcpy(symbol->errtxt, "Overlong encoding not supported"); + return ERROR_INVALID_DATA; + } + } + + if(done == 0) { + if((source[bpos] >= 0xc2) && (source[bpos] <= 0xdf)) { + /* 2 byte mode */ + vals[jpos] = ((source[bpos] & 0x1f) << 6) + (source[bpos + 1] & 0x3f); + next = bpos + 2; + jpos++; + done = 1; + } + } + + if(done == 0) { + if((source[bpos] >= 0xe0) && (source[bpos] <= 0xef)) { + /* 3 byte mode */ + vals[jpos] = ((source[bpos] & 0x0f) << 12) + ((source[bpos + 1] & 0x3f) << 6) + (source[bpos + 2] & 0x3f); + next = bpos + 3; + jpos ++; + done = 1; + } + } + + if(done == 0) { + if(source[bpos] >= 0xf0) { + strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported"); + return ERROR_INVALID_DATA; + } + } + + bpos = next; + + } while(bpos < *length); + *length = jpos; + + return error_number; +} + diff --git a/Matrix/common.h b/Matrix/common.h index dbcb017..14a5686 100644 --- a/Matrix/common.h +++ b/Matrix/common.h @@ -1,53 +1,53 @@ -/* Used in some logic */ -#ifndef __COMMON_H -#define __COMMON_H - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -/* The most commonly used set */ -#define NEON "0123456789" - -#include "zint.h" - -#define U08 unsigned char -#define U16 unsigned short -#define U32 unsigned int - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern int ustrlen(unsigned char source[]); -extern void ustrcpy(unsigned char target[], unsigned char source[]); -extern void concat(char dest[], char source[]); -extern void uconcat(unsigned char dest[], unsigned char source[]); -extern int ctoi(char source); -extern char itoc(int source); -extern void to_upper(unsigned char source[]); -extern int is_sane(char test_string[], unsigned char source[], int length); -extern void lookup(char set_string[], char *table[], char data, char dest[]); -extern int posn(char set_string[], char data); -extern void expand(struct zint_symbol *symbol, char data[]); -extern int is_stackable(int symbology); -extern int is_extendable(int symbology); -extern int roundup(float input); -extern int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord); -extern void set_module(struct zint_symbol *symbol, int y_coord, int x_coord); -extern void unset_module(struct zint_symbol *symbol, int y_coord, int x_coord); -extern int istwodigits(unsigned char source[], int position); -extern float froundup(float input); -extern int parunmodd(unsigned char llyth); -extern int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned char preprocessed[], int *length); -extern int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[], int *length); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __COMMON_H */ +/* Used in some logic */ +#ifndef __COMMON_H +#define __COMMON_H + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +/* The most commonly used set */ +#define NEON "0123456789" + +#include "zint.h" + +#define U08 unsigned char +#define U16 unsigned short +#define U32 unsigned int + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern int ustrlen(unsigned char source[]); +extern void ustrcpy(unsigned char target[], unsigned char source[]); +extern void concat(char dest[], char source[]); +extern void uconcat(unsigned char dest[], unsigned char source[]); +extern int ctoi(char source); +extern char itoc(int source); +extern void to_upper(unsigned char source[]); +extern int is_sane(char test_string[], unsigned char source[], int length); +extern void lookup(char set_string[], char *table[], char data, char dest[]); +extern int posn(char set_string[], char data); +extern void expand(struct zint_symbol *symbol, char data[]); +extern int is_stackable(int symbology); +extern int is_extendable(int symbology); +extern int roundup(float input); +extern int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord); +extern void set_module(struct zint_symbol *symbol, int y_coord, int x_coord); +extern void unset_module(struct zint_symbol *symbol, int y_coord, int x_coord); +extern int istwodigits(unsigned char source[], int position); +extern float froundup(float input); +extern int parunmodd(unsigned char llyth); +extern int latin1_process(struct zint_symbol *symbol, unsigned char source[], unsigned char preprocessed[], int *length); +extern int utf8toutf16(struct zint_symbol *symbol, unsigned char source[], int vals[], int *length); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __COMMON_H */ diff --git a/Matrix/dm200.cpp b/Matrix/dm200.cpp index 6835598..b5f807d 100644 --- a/Matrix/dm200.cpp +++ b/Matrix/dm200.cpp @@ -1,943 +1,943 @@ -#include -#include -#include -#include -#include "reedsol.h" -#include "common.h" -#include "dm200.h" -#include - -static void *safemalloc(int n) -{ - void *p = malloc(n); - return p; -} - -// Annex M placement alorithm low level -static void ecc200placementbit(int *array, int NR, int NC, int r, int c, int p, char b) -{ - if (r < 0) { - r += NR; - c += 4 - ((NR + 4) % 8); - } - if (c < 0) { - c += NC; - r += 4 - ((NC + 4) % 8); - } - array[r * NC + c] = (p << 3) + b; -} - -static void ecc200placementblock(int *array, int NR, int NC, int r, - int c, int p) -{ - ecc200placementbit(array, NR, NC, r - 2, c - 2, p, 7); - ecc200placementbit(array, NR, NC, r - 2, c - 1, p, 6); - ecc200placementbit(array, NR, NC, r - 1, c - 2, p, 5); - ecc200placementbit(array, NR, NC, r - 1, c - 1, p, 4); - ecc200placementbit(array, NR, NC, r - 1, c - 0, p, 3); - ecc200placementbit(array, NR, NC, r - 0, c - 2, p, 2); - ecc200placementbit(array, NR, NC, r - 0, c - 1, p, 1); - ecc200placementbit(array, NR, NC, r - 0, c - 0, p, 0); -} - -static void ecc200placementcornerA(int *array, int NR, int NC, int p) -{ - ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7); - ecc200placementbit(array, NR, NC, NR - 1, 1, p, 6); - ecc200placementbit(array, NR, NC, NR - 1, 2, p, 5); - ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); - ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); - ecc200placementbit(array, NR, NC, 1, NC - 1, p, 2); - ecc200placementbit(array, NR, NC, 2, NC - 1, p, 1); - ecc200placementbit(array, NR, NC, 3, NC - 1, p, 0); -} - -static void ecc200placementcornerB(int *array, int NR, int NC, int p) -{ - ecc200placementbit(array, NR, NC, NR - 3, 0, p, 7); - ecc200placementbit(array, NR, NC, NR - 2, 0, p, 6); - ecc200placementbit(array, NR, NC, NR - 1, 0, p, 5); - ecc200placementbit(array, NR, NC, 0, NC - 4, p, 4); - ecc200placementbit(array, NR, NC, 0, NC - 3, p, 3); - ecc200placementbit(array, NR, NC, 0, NC - 2, p, 2); - ecc200placementbit(array, NR, NC, 0, NC - 1, p, 1); - ecc200placementbit(array, NR, NC, 1, NC - 1, p, 0); -} - -static void ecc200placementcornerC(int *array, int NR, int NC, int p) -{ - ecc200placementbit(array, NR, NC, NR - 3, 0, p, 7); - ecc200placementbit(array, NR, NC, NR - 2, 0, p, 6); - ecc200placementbit(array, NR, NC, NR - 1, 0, p, 5); - ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); - ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); - ecc200placementbit(array, NR, NC, 1, NC - 1, p, 2); - ecc200placementbit(array, NR, NC, 2, NC - 1, p, 1); - ecc200placementbit(array, NR, NC, 3, NC - 1, p, 0); -} - -static void ecc200placementcornerD(int *array, int NR, int NC, int p) -{ - ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7); - ecc200placementbit(array, NR, NC, NR - 1, NC - 1, p, 6); - ecc200placementbit(array, NR, NC, 0, NC - 3, p, 5); - ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); - ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); - ecc200placementbit(array, NR, NC, 1, NC - 3, p, 2); - ecc200placementbit(array, NR, NC, 1, NC - 2, p, 1); - ecc200placementbit(array, NR, NC, 1, NC - 1, p, 0); -} - -// Annex M placement alorithm main function -static void ecc200placement(int *array, int NR, int NC) -{ - int r, c, p; - // invalidate - for (r = 0; r < NR; r++) - for (c = 0; c < NC; c++) - array[r * NC + c] = 0; - // start - p = 1; - r = 4; - c = 0; - do { - // check corner - if (r == NR && !c) - ecc200placementcornerA(array, NR, NC, p++); - if (r == NR - 2 && !c && NC % 4) - ecc200placementcornerB(array, NR, NC, p++); - if (r == NR - 2 && !c && (NC % 8) == 4) - ecc200placementcornerC(array, NR, NC, p++); - if (r == NR + 4 && c == 2 && !(NC % 8)) - ecc200placementcornerD(array, NR, NC, p++); - // up/right - do { - if (r < NR && c >= 0 && !array[r * NC + c]) - ecc200placementblock(array, NR, NC, r, c, p++); - r -= 2; - c += 2; - } - while (r >= 0 && c < NC); - r++; - c += 3; - // down/left - do { - if (r >= 0 && c < NC && !array[r * NC + c]) - ecc200placementblock(array, NR, NC, r, c, p++); - r += 2; - c -= 2; - } - while (r < NR && c >= 0); - r += 3; - c++; - } - while (r < NR || c < NC); - // unfilled corner - if (!array[NR * NC - 1]) - array[NR * NC - 1] = array[NR * NC - NC - 2] = 1; -} - -// calculate and append ecc code, and if necessary interleave -static void ecc200(unsigned char *binary, int bytes, int datablock, int rsblock) -{ - int blocks, b; - - blocks = (bytes + 2) / datablock; - - rs_init_gf(0x12d); - rs_init_code(rsblock, 1); - for (b = 0; b < blocks; b++) { - unsigned char buf[256], ecc[256]; - int n, p = 0; - for (n = b; n < bytes; n += blocks) - buf[p++] = binary[n]; - rs_encode(p, buf, ecc); - p = rsblock - 1; // comes back reversed - for (n = b; n < rsblock * blocks; n += blocks) - binary[bytes + n] = ecc[p--]; - } - rs_free(); -} - -float dmroundup(float input) -{ - float fraction, output = 0.0; - - fraction = input - (int)input; - if(fraction > 0.01) { output = (input - fraction) + 1.0; } else { output = input; } - - return output; -} - -/*int istwodigits(unsigned char source[], int position) -{ - if((source[position] >= '0') && (source[position] <= '9')) { - if((source[position + 1] >= '0') && (source[position + 1] <= '9')) { - return 1; - } - } - - return 0; -} */ - -int isx12(unsigned char source) -{ - if(source == 13) { return 1; } - if(source == 42) { return 1; } - if(source == 62) { return 1; } - if(source == 32) { return 1; } - if((source >= '0') && (source <= '9')) { return 1; } - if((source >= 'A') && (source <= 'Z')) { return 1; } - - return 0; -} - -void dminsert(char binary_string[], int posn, char newbit) -{ /* Insert a character into the middle of a string at position posn */ - int i, end; - - end = strlen(binary_string); - for(i = end; i > posn; i--) { - binary_string[i] = binary_string[i - 1]; - } - binary_string[posn] = newbit; -} - -void insert_value(unsigned char binary_stream[], int posn, int streamlen, char newbit) -{ - int i; - - for(i = streamlen; i > posn; i--) { - binary_stream[i] = binary_stream[i - 1]; - } - binary_stream[posn] = newbit; -} - -int look_ahead_test(unsigned char source[], int sourcelen, int position, int current_mode, int gs1) -{ - /* A custom version of the 'look ahead test' from Annex P */ - /* This version is deliberately very reluctant to end a data stream with EDIFACT encoding */ - - float ascii_count, c40_count, text_count, x12_count, edf_count, b256_count, best_count; - int sp, done, best_scheme; - char reduced_char; - - /* step (j) */ - if(current_mode == DM_ASCII) { - ascii_count = 0.0; - c40_count = 1.0; - text_count = 1.0; - x12_count = 1.0; - edf_count = 1.0; - b256_count = 1.25; - } else { - ascii_count = 1.0; - c40_count = 2.0; - text_count = 2.0; - x12_count = 2.0; - edf_count = 2.0; - b256_count = 2.25; - } - - switch(current_mode) { - case DM_C40: c40_count = 0.0; break; - case DM_TEXT: text_count = 0.0; break; - case DM_X12: x12_count = 0.0; break; - case DM_EDIFACT: edf_count = 0.0; break; - case DM_BASE256: b256_count = 0.0; break; - } - - for(sp = position; (sp < sourcelen) && (sp <= (position + 8)); sp++) { - - if(source[sp] <= 127) { reduced_char = source[sp]; } else { reduced_char = source[sp] - 127; } - - if((source[sp] >= '0') && (source[sp] <= '9')) { ascii_count += 0.5; } else { ascii_count += 1.0; } - if(source[sp] > 127) { ascii_count += 1.0; } - - done = 0; - if(reduced_char == ' ') { c40_count += (2.0 / 3.0); done = 1; } - if((reduced_char >= '0') && (reduced_char <= '9')) { c40_count += (2.0 / 3.0); done = 1; } - if((reduced_char >= 'A') && (reduced_char <= 'Z')) { c40_count += (2.0 / 3.0); done = 1; } - if(source[sp] > 127) { c40_count += (4.0 / 3.0); } - if(done == 0) { c40_count += (4.0 / 3.0); } - - done = 0; - if(reduced_char == ' ') { text_count += (2.0 / 3.0); done = 1; } - if((reduced_char >= '0') && (reduced_char <= '9')) { text_count += (2.0 / 3.0); done = 1; } - if((reduced_char >= 'a') && (reduced_char <= 'z')) { text_count += (2.0 / 3.0); done = 1; } - if(source[sp] > 127) { text_count += (4.0 / 3.0); } - if(done == 0) { text_count += (4.0 / 3.0); } - - if(isx12(source[sp])) { x12_count += (2.0 / 3.0); } else { x12_count += 4.0; } - - /* step (p) */ - done = 0; - if((source[sp] >= ' ') && (source[sp] <= '^')) { edf_count += (3.0 / 4.0); } else { edf_count += 6.0; } - if(gs1 && (source[sp] == '[')) { edf_count += 6.0; } - if(sp >= (sourcelen - 5)) { edf_count += 6.0; } /* MMmmm fudge! */ - - /* step (q) */ - if(gs1 && (source[sp] == '[')) { b256_count += 4.0; } else { b256_count += 1.0; } - - /*printf("lat a%.2f c%.2f t%.2f x%.2f e%.2f b%.2f\n", ascii_count, c40_count, text_count, x12_count, edf_count, b256_count);*/ - - } - - /* Round up all the counts to round numbers */ - - best_count = ascii_count; - best_scheme = DM_ASCII; - - if(b256_count <= best_count) { - best_count = b256_count; - best_scheme = DM_BASE256; - } - - if(edf_count <= best_count) { - best_count = edf_count; - best_scheme = DM_EDIFACT; - } - - if(text_count <= best_count) { - best_count = text_count; - best_scheme = DM_TEXT; - } - - if(x12_count <= best_count) { - best_count = x12_count; - best_scheme = DM_X12; - } - - if(c40_count <= best_count) { - best_count = c40_count; - best_scheme = DM_C40; - } - - return best_scheme; -} - -int dm200encode(unsigned char source[], unsigned char target[], int *last_mode) -{ - /* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate */ - /* Supports encoding FNC1 in supporting systems */ - - int sp, tp, i, gs1; - int current_mode, next_mode; - int c40_buffer[6], c40_p; - int text_buffer[6], text_p; - int x12_buffer[6], x12_p; - int edifact_buffer[8], edifact_p; - int inputlen; - char *binary; - - - inputlen = ustrlen(source); - - binary = (char *)malloc(2 * inputlen); -// binary = (char *)QRcode_malloc(2 * inputlen); - memset(binary, 0x00, 2*inputlen); - - sp = 0; - tp = 0; - memset(c40_buffer, 0, 6); - c40_p = 0; - memset(text_buffer, 0, 6); - text_p = 0; - memset(x12_buffer, 0, 6); - x12_p = 0; - memset(edifact_buffer, 0, 8); - edifact_p = 0; - strcpy(binary, ""); - - /* step (a) */ - current_mode = DM_ASCII; - next_mode = DM_ASCII; - - gs1 = 0; - - if(gs1) { target[tp] = 232; tp++; concat(binary, " "); } /* FNC1 */ - - while (sp < inputlen) { - - current_mode = next_mode; - - /* step (b) - ASCII encodation */ - if(current_mode == DM_ASCII) { - next_mode = DM_ASCII; - - if(istwodigits(source, sp) && ((sp + 1) != inputlen)) { - target[tp] = (10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130; - tp++; concat(binary, " "); - sp += 2; - } else { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - - if(next_mode != DM_ASCII) { - switch(next_mode) { - case DM_C40: target[tp] = 230; tp++; concat(binary, " "); break; - case DM_TEXT: target[tp] = 239; tp++; concat(binary, " "); break; - case DM_X12: target[tp] = 238; tp++; concat(binary, " "); break; - case DM_EDIFACT: target[tp] = 240; tp++; concat(binary, " "); break; - case DM_BASE256: target[tp] = 231; tp++; concat(binary, " "); break; - } - } else { - if(source[sp] > 127) { - target[tp] = 235; - tp++; - target[tp] = (source[sp] - 128) + 1; - tp++; concat(binary, " "); - } else { - if(gs1 && (source[sp] == '[')) { - target[tp] = 232; /* FNC1 */ - } else { - target[tp] = source[sp] + 1; - } - tp++; - concat(binary, " "); - } - sp++; - } - } - - } - - /* step (c) C40 encodation */ - if(current_mode == DM_C40) { - int shift_set, value; - - next_mode = DM_C40; - if(c40_p == 0) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - } - - if(next_mode != DM_C40) { - target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ - next_mode = DM_ASCII; - } else { - if(source[sp] > 127) { - c40_buffer[c40_p] = 1; c40_p++; - c40_buffer[c40_p] = 30; c40_p++; /* Upper Shift */ - shift_set = c40_shift[source[sp] - 128]; - value = c40_value[source[sp] - 128]; - } else { - shift_set = c40_shift[source[sp]]; - value = c40_value[source[sp]]; - } - - if(gs1 && (source[sp] == '[')) { - shift_set = 2; - value = 27; /* FNC1 */ - } - - if(shift_set != 0) { - c40_buffer[c40_p] = shift_set - 1; c40_p++; - } - c40_buffer[c40_p] = value; c40_p++; - - if(c40_p >= 3) { - int iv; - - iv = (1600 * c40_buffer[0]) + (40 * c40_buffer[1]) + (c40_buffer[2]) + 1; - target[tp] = iv / 256; tp++; - target[tp] = iv % 256; tp++; - concat(binary, " "); - - c40_buffer[0] = c40_buffer[3]; - c40_buffer[1] = c40_buffer[4]; - c40_buffer[2] = c40_buffer[5]; - c40_buffer[3] = 0; - c40_buffer[4] = 0; - c40_buffer[5] = 0; - c40_p -= 3; - } - sp++; - } - } - - /* step (d) Text encodation */ - if(current_mode == DM_TEXT) { - int shift_set, value; - - next_mode = DM_TEXT; - if(text_p == 0) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - } - - if(next_mode != DM_TEXT) { - target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ - next_mode = DM_ASCII; - - } else { - if(source[sp] > 127) { - text_buffer[text_p] = 1; text_p++; - text_buffer[text_p] = 30; text_p++; /* Upper Shift */ - shift_set = text_shift[source[sp] - 128]; - value = text_value[source[sp] - 128]; - } else { - shift_set = text_shift[source[sp]]; - value = text_value[source[sp]]; - } - - if(gs1 && (source[sp] == '[')) { - shift_set = 2; - value = 27; /* FNC1 */ - } - - if(shift_set != 0) { - text_buffer[text_p] = shift_set - 1; text_p++; - } - text_buffer[text_p] = value; text_p++; - - if(text_p >= 3) { - int iv; - - iv = (1600 * text_buffer[0]) + (40 * text_buffer[1]) + (text_buffer[2]) + 1; - target[tp] = iv / 256; tp++; - target[tp] = iv % 256; tp++; - concat(binary, " "); - - text_buffer[0] = text_buffer[3]; - text_buffer[1] = text_buffer[4]; - text_buffer[2] = text_buffer[5]; - text_buffer[3] = 0; - text_buffer[4] = 0; - text_buffer[5] = 0; - text_p -= 3; - } - sp++; - } - } - - /* step (e) X12 encodation */ - if(current_mode == DM_X12) { - int value = 0; - - next_mode = DM_X12; - if(text_p == 0) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - } - - if(next_mode != DM_X12) { - target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ - } else { - if(source[sp] == 13) { value = 0; } - if(source[sp] == '*') { value = 1; } - if(source[sp] == '>') { value = 2; } - if(source[sp] == ' ') { value = 3; } - if((source[sp] >= '0') && (source[sp] <= '9')) { value = (source[sp] - '0') + 4; } - if((source[sp] >= 'A') && (source[sp] <= 'Z')) { value = (source[sp] - 'A') + 14; } - - x12_buffer[x12_p] = value; x12_p++; - - if(x12_p >= 3) { - int iv; - - iv = (1600 * x12_buffer[0]) + (40 * x12_buffer[1]) + (x12_buffer[2]) + 1; - target[tp] = iv / 256; tp++; - target[tp] = iv % 256; tp++; - concat(binary, " "); - - x12_buffer[0] = x12_buffer[3]; - x12_buffer[1] = x12_buffer[4]; - x12_buffer[2] = x12_buffer[5]; - x12_buffer[3] = 0; - x12_buffer[4] = 0; - x12_buffer[5] = 0; - x12_p -= 3; - } - sp++; - } - } - - /* step (f) EDIFACT encodation */ - if(current_mode == DM_EDIFACT) { - int value = 0; - - next_mode = DM_EDIFACT; - if(edifact_p == 3) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - } - - if(next_mode != DM_EDIFACT) { - edifact_buffer[edifact_p] = 31; edifact_p++; - next_mode = DM_ASCII; - } else { - if((source[sp] >= '@') && (source[sp] <= '^')) { value = source[sp] - '@'; } - if((source[sp] >= ' ') && (source[sp] <= '?')) { value = source[sp]; } - - edifact_buffer[edifact_p] = value; edifact_p++; - sp++; - } - - if(edifact_p >= 4) { - target[tp] = (edifact_buffer[0] << 2) + ((edifact_buffer[1] & 0x30) >> 4); tp++; - target[tp] = ((edifact_buffer[1] & 0x0f) << 4) + ((edifact_buffer[2] & 0x3c) >> 2); tp++; - target[tp] = ((edifact_buffer[2] & 0x03) << 6) + edifact_buffer[3]; tp++; - concat(binary, " "); - - edifact_buffer[0] = edifact_buffer[4]; - edifact_buffer[1] = edifact_buffer[5]; - edifact_buffer[2] = edifact_buffer[6]; - edifact_buffer[3] = edifact_buffer[7]; - edifact_buffer[4] = 0; - edifact_buffer[5] = 0; - edifact_buffer[6] = 0; - edifact_buffer[7] = 0; - edifact_p -= 4; - } - } - - /* step (g) Base 256 encodation */ - if(current_mode == DM_BASE256) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); - - if(next_mode == DM_BASE256) { - target[tp] = source[sp]; - tp++; - sp++; - concat(binary, "b"); - } else { - next_mode = DM_ASCII; - } - } - - if(tp > 1558) { - free(binary); - return 0; - } - - } /* while */ - - /* Empty buffers */ - if(c40_p == 2) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 2] + 1; tp++; - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - if(c40_p == 1) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - - if(text_p == 2) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 2] + 1; tp++; - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - if(text_p == 1) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - - if(x12_p == 2) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 2] + 1; tp++; - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - if(x12_p == 1) { - target[tp] = 254; tp++; /* unlatch */ - target[tp] = source[inputlen - 1] + 1; tp++; - concat(binary, " "); - current_mode = DM_ASCII; - } - - /* Add length and randomising algorithm to b256 */ - i = 0; - while (i < tp) { - if(binary[i] == 'b') { - if((i == 0) || ((i != 0) && (binary[i - 1] != 'b'))) { - /* start of binary data */ - int binary_count; /* length of b256 data */ - - for(binary_count = 0; binary[binary_count + i] == 'b'; binary_count++); - - if(binary_count <= 249) { - dminsert(binary, i, 'b'); - insert_value(target, i, tp, binary_count); tp++; - } else { - dminsert(binary, i, 'b'); - dminsert(binary, i + 1, 'b'); - insert_value(target, i, tp, (binary_count / 250) + 249); tp++; - insert_value(target, i + 1, tp, binary_count % 250); tp++; - } - } - } - i++; - } - - for(i = 0; i < tp; i++) { - if(binary[i] == 'b') { - int prn, temp; - - prn = ((149 * (i + 1)) % 255) + 1; - temp = target[i] + prn; - if (temp <= 255) { target[i] = temp; } else { target[i] = temp - 256; } - } - } - -// QString s,s1; -// s=""; -// for(i = 0; i < tp; i++){ -// s1.sprintf("%02X ", target[i]); -// s+=s1; -// } - //qDebug()<<"bin:"< 0; i--) { - if(i == tail_length) { - target[tp] = 129; tp++; /* Pad */ - } else { - prn = ((149 * (tp + 1)) % 253) + 1; - temp = 129 + prn; - if(temp <= 254) { - target[tp] = temp; tp++; - } else { - target[tp] = temp - 254; tp++; - } - } - } -} - -unsigned char *iec16022ecc200(short *Wptr, short *Hptr, unsigned char *barcode, short* type) - -{ - int inputlen, i; - int binlen; - int symbolsize, optionsize, calcsize; - int taillength, error_number = 0; - int H, W, FH, FW, datablock, bytes, rsblock; - int last_mode; - unsigned char *grid = 0; - unsigned char *source; - -// unsigned char binary[100]; - unsigned char *binary; - binary = (unsigned char *)malloc(2000+10); -// binary = (unsigned char *)QRcode_malloc(2000+10); - -#ifdef WIN32 - printf("New Lib Routine !!! \n"); -#endif - - source = barcode; - - inputlen = ustrlen(source); - - binlen = dm200encode(barcode, binary, &last_mode); - - if(binlen == 0) { - free(binary); - return 0; - } - - calcsize = 29; - for(i = 29; i > -1; i--) { - if(matrixbytes[i] > binlen) { - calcsize = i; - } - } - short k = *type; - if(k != 0) - { - switch(k) - { - case 1: - { - if(calcsize > 2) - { - *type = -1; - } - else - { - calcsize = 2; - } - }break; - case 2: - { - if(calcsize > 4) - { - *type = -1; - } - else - { - calcsize = 4; - } - }break; - case 3: - { - if(calcsize > 6) - { - *type = -1; - } - else - { - calcsize = 6; - } - }break; - case 4: - { - if(calcsize > 9) - { - *type = -1; - } - else - { - calcsize = 9; - } - }break; - case 5: - { - if(calcsize > 11) - { - *type = -1; - } - else - { - calcsize = 11; - } - }break; - case 6: - { - if(calcsize > 14) - { - *type = -1; - } - else - { - calcsize = 14; - } - }break; - } - } - else - { - switch(calcsize) { - case 2: - case 4: - case 6: - case 9: - case 11: - case 14: - calcsize++; - } - } - - //optionsize = -1; - optionsize = 10; - - symbolsize = optionsize; - - if(calcsize <= optionsize) { - symbolsize = optionsize; - } else - { - symbolsize = calcsize; - } - - H = matrixH[symbolsize]; - W = matrixW[symbolsize]; - FH = matrixFH[symbolsize]; - FW = matrixFW[symbolsize]; - bytes = matrixbytes[symbolsize]; - datablock = matrixdatablock[symbolsize]; - rsblock = matrixrsblock[symbolsize]; - - taillength = bytes - binlen; - - - if(taillength != 0) { - add_tail(binary, binlen, taillength, last_mode); - } - - // ecc code - ecc200(binary, bytes, datablock, rsblock); - { // placement - int x, y, NC, NR, *places; - NC = W - 2 * (W / FW); - NR = H - 2 * (H / FH); - places = (int*)safemalloc(NC * NR * sizeof(int)); - // places = (int*)QRcode_malloc(NC * NR * sizeof(int)); - ecc200placement(places, NR, NC); - grid = (unsigned char*)safemalloc(W * H); - // grid = (unsigned char*)QRcode_malloc(W * H); - memset(grid, 0, W * H); - for (y = 0; y < H; y += FH) { - for (x = 0; x < W; x++) - grid[y * W + x] = 1; - for (x = 0; x < W; x += 2) - grid[(y + FH - 1) * W + x] = 1; - } - for (x = 0; x < W; x += FW) { - for (y = 0; y < H; y++) - grid[y * W + x] = 1; - for (y = 0; y < H; y += 2) - grid[y * W + x + FW - 1] = 1; - } - for (y = 0; y < NR; y++) { - for (x = 0; x < NC; x++) { - int v = places[(NR - y - 1) * NC + x]; - //fprintf (stderr, "%4d", v); - if (v == 1 || (v > 7 && (binary[(v >> 3) - 1] & (1 << (v & 7))))) - grid[(1 + y + 2 * (y / (FH - 2))) * W + 1 + x + 2 * (x / (FW - 2))] = 1; - } - //fprintf (stderr, "\n"); - } - - for(y = H - 1; y >= 0; y--) { - int x; - for(x = 0; x < W; x++) { - if(grid[W * y + x]) - { -#ifdef WIN32 - printf("X"); -#endif - } -#ifdef WIN32 - else - printf(" "); -#endif - - } -#ifdef WIN32 - printf("\n"); -#endif - } - - free(places); - } - *Wptr = (short)W; - *Hptr = (short)H; - free(binary); - return grid; -} - - - +#include +#include +#include +#include +#include "reedsol.h" +#include "common.h" +#include "dm200.h" +#include + +static void *safemalloc(int n) +{ + void *p = malloc(n); + return p; +} + +// Annex M placement alorithm low level +static void ecc200placementbit(int *array, int NR, int NC, int r, int c, int p, char b) +{ + if (r < 0) { + r += NR; + c += 4 - ((NR + 4) % 8); + } + if (c < 0) { + c += NC; + r += 4 - ((NC + 4) % 8); + } + array[r * NC + c] = (p << 3) + b; +} + +static void ecc200placementblock(int *array, int NR, int NC, int r, + int c, int p) +{ + ecc200placementbit(array, NR, NC, r - 2, c - 2, p, 7); + ecc200placementbit(array, NR, NC, r - 2, c - 1, p, 6); + ecc200placementbit(array, NR, NC, r - 1, c - 2, p, 5); + ecc200placementbit(array, NR, NC, r - 1, c - 1, p, 4); + ecc200placementbit(array, NR, NC, r - 1, c - 0, p, 3); + ecc200placementbit(array, NR, NC, r - 0, c - 2, p, 2); + ecc200placementbit(array, NR, NC, r - 0, c - 1, p, 1); + ecc200placementbit(array, NR, NC, r - 0, c - 0, p, 0); +} + +static void ecc200placementcornerA(int *array, int NR, int NC, int p) +{ + ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7); + ecc200placementbit(array, NR, NC, NR - 1, 1, p, 6); + ecc200placementbit(array, NR, NC, NR - 1, 2, p, 5); + ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); + ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); + ecc200placementbit(array, NR, NC, 1, NC - 1, p, 2); + ecc200placementbit(array, NR, NC, 2, NC - 1, p, 1); + ecc200placementbit(array, NR, NC, 3, NC - 1, p, 0); +} + +static void ecc200placementcornerB(int *array, int NR, int NC, int p) +{ + ecc200placementbit(array, NR, NC, NR - 3, 0, p, 7); + ecc200placementbit(array, NR, NC, NR - 2, 0, p, 6); + ecc200placementbit(array, NR, NC, NR - 1, 0, p, 5); + ecc200placementbit(array, NR, NC, 0, NC - 4, p, 4); + ecc200placementbit(array, NR, NC, 0, NC - 3, p, 3); + ecc200placementbit(array, NR, NC, 0, NC - 2, p, 2); + ecc200placementbit(array, NR, NC, 0, NC - 1, p, 1); + ecc200placementbit(array, NR, NC, 1, NC - 1, p, 0); +} + +static void ecc200placementcornerC(int *array, int NR, int NC, int p) +{ + ecc200placementbit(array, NR, NC, NR - 3, 0, p, 7); + ecc200placementbit(array, NR, NC, NR - 2, 0, p, 6); + ecc200placementbit(array, NR, NC, NR - 1, 0, p, 5); + ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); + ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); + ecc200placementbit(array, NR, NC, 1, NC - 1, p, 2); + ecc200placementbit(array, NR, NC, 2, NC - 1, p, 1); + ecc200placementbit(array, NR, NC, 3, NC - 1, p, 0); +} + +static void ecc200placementcornerD(int *array, int NR, int NC, int p) +{ + ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7); + ecc200placementbit(array, NR, NC, NR - 1, NC - 1, p, 6); + ecc200placementbit(array, NR, NC, 0, NC - 3, p, 5); + ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4); + ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3); + ecc200placementbit(array, NR, NC, 1, NC - 3, p, 2); + ecc200placementbit(array, NR, NC, 1, NC - 2, p, 1); + ecc200placementbit(array, NR, NC, 1, NC - 1, p, 0); +} + +// Annex M placement alorithm main function +static void ecc200placement(int *array, int NR, int NC) +{ + int r, c, p; + // invalidate + for (r = 0; r < NR; r++) + for (c = 0; c < NC; c++) + array[r * NC + c] = 0; + // start + p = 1; + r = 4; + c = 0; + do { + // check corner + if (r == NR && !c) + ecc200placementcornerA(array, NR, NC, p++); + if (r == NR - 2 && !c && NC % 4) + ecc200placementcornerB(array, NR, NC, p++); + if (r == NR - 2 && !c && (NC % 8) == 4) + ecc200placementcornerC(array, NR, NC, p++); + if (r == NR + 4 && c == 2 && !(NC % 8)) + ecc200placementcornerD(array, NR, NC, p++); + // up/right + do { + if (r < NR && c >= 0 && !array[r * NC + c]) + ecc200placementblock(array, NR, NC, r, c, p++); + r -= 2; + c += 2; + } + while (r >= 0 && c < NC); + r++; + c += 3; + // down/left + do { + if (r >= 0 && c < NC && !array[r * NC + c]) + ecc200placementblock(array, NR, NC, r, c, p++); + r += 2; + c -= 2; + } + while (r < NR && c >= 0); + r += 3; + c++; + } + while (r < NR || c < NC); + // unfilled corner + if (!array[NR * NC - 1]) + array[NR * NC - 1] = array[NR * NC - NC - 2] = 1; +} + +// calculate and append ecc code, and if necessary interleave +static void ecc200(unsigned char *binary, int bytes, int datablock, int rsblock) +{ + int blocks, b; + + blocks = (bytes + 2) / datablock; + + rs_init_gf(0x12d); + rs_init_code(rsblock, 1); + for (b = 0; b < blocks; b++) { + unsigned char buf[256], ecc[256]; + int n, p = 0; + for (n = b; n < bytes; n += blocks) + buf[p++] = binary[n]; + rs_encode(p, buf, ecc); + p = rsblock - 1; // comes back reversed + for (n = b; n < rsblock * blocks; n += blocks) + binary[bytes + n] = ecc[p--]; + } + rs_free(); +} + +float dmroundup(float input) +{ + float fraction, output = 0.0; + + fraction = input - (int)input; + if(fraction > 0.01) { output = (input - fraction) + 1.0; } else { output = input; } + + return output; +} + +/*int istwodigits(unsigned char source[], int position) +{ + if((source[position] >= '0') && (source[position] <= '9')) { + if((source[position + 1] >= '0') && (source[position + 1] <= '9')) { + return 1; + } + } + + return 0; +} */ + +int isx12(unsigned char source) +{ + if(source == 13) { return 1; } + if(source == 42) { return 1; } + if(source == 62) { return 1; } + if(source == 32) { return 1; } + if((source >= '0') && (source <= '9')) { return 1; } + if((source >= 'A') && (source <= 'Z')) { return 1; } + + return 0; +} + +void dminsert(char binary_string[], int posn, char newbit) +{ /* Insert a character into the middle of a string at position posn */ + int i, end; + + end = strlen(binary_string); + for(i = end; i > posn; i--) { + binary_string[i] = binary_string[i - 1]; + } + binary_string[posn] = newbit; +} + +void insert_value(unsigned char binary_stream[], int posn, int streamlen, char newbit) +{ + int i; + + for(i = streamlen; i > posn; i--) { + binary_stream[i] = binary_stream[i - 1]; + } + binary_stream[posn] = newbit; +} + +int look_ahead_test(unsigned char source[], int sourcelen, int position, int current_mode, int gs1) +{ + /* A custom version of the 'look ahead test' from Annex P */ + /* This version is deliberately very reluctant to end a data stream with EDIFACT encoding */ + + float ascii_count, c40_count, text_count, x12_count, edf_count, b256_count, best_count; + int sp, done, best_scheme; + char reduced_char; + + /* step (j) */ + if(current_mode == DM_ASCII) { + ascii_count = 0.0; + c40_count = 1.0; + text_count = 1.0; + x12_count = 1.0; + edf_count = 1.0; + b256_count = 1.25; + } else { + ascii_count = 1.0; + c40_count = 2.0; + text_count = 2.0; + x12_count = 2.0; + edf_count = 2.0; + b256_count = 2.25; + } + + switch(current_mode) { + case DM_C40: c40_count = 0.0; break; + case DM_TEXT: text_count = 0.0; break; + case DM_X12: x12_count = 0.0; break; + case DM_EDIFACT: edf_count = 0.0; break; + case DM_BASE256: b256_count = 0.0; break; + } + + for(sp = position; (sp < sourcelen) && (sp <= (position + 8)); sp++) { + + if(source[sp] <= 127) { reduced_char = source[sp]; } else { reduced_char = source[sp] - 127; } + + if((source[sp] >= '0') && (source[sp] <= '9')) { ascii_count += 0.5; } else { ascii_count += 1.0; } + if(source[sp] > 127) { ascii_count += 1.0; } + + done = 0; + if(reduced_char == ' ') { c40_count += (2.0 / 3.0); done = 1; } + if((reduced_char >= '0') && (reduced_char <= '9')) { c40_count += (2.0 / 3.0); done = 1; } + if((reduced_char >= 'A') && (reduced_char <= 'Z')) { c40_count += (2.0 / 3.0); done = 1; } + if(source[sp] > 127) { c40_count += (4.0 / 3.0); } + if(done == 0) { c40_count += (4.0 / 3.0); } + + done = 0; + if(reduced_char == ' ') { text_count += (2.0 / 3.0); done = 1; } + if((reduced_char >= '0') && (reduced_char <= '9')) { text_count += (2.0 / 3.0); done = 1; } + if((reduced_char >= 'a') && (reduced_char <= 'z')) { text_count += (2.0 / 3.0); done = 1; } + if(source[sp] > 127) { text_count += (4.0 / 3.0); } + if(done == 0) { text_count += (4.0 / 3.0); } + + if(isx12(source[sp])) { x12_count += (2.0 / 3.0); } else { x12_count += 4.0; } + + /* step (p) */ + done = 0; + if((source[sp] >= ' ') && (source[sp] <= '^')) { edf_count += (3.0 / 4.0); } else { edf_count += 6.0; } + if(gs1 && (source[sp] == '[')) { edf_count += 6.0; } + if(sp >= (sourcelen - 5)) { edf_count += 6.0; } /* MMmmm fudge! */ + + /* step (q) */ + if(gs1 && (source[sp] == '[')) { b256_count += 4.0; } else { b256_count += 1.0; } + + /*printf("lat a%.2f c%.2f t%.2f x%.2f e%.2f b%.2f\n", ascii_count, c40_count, text_count, x12_count, edf_count, b256_count);*/ + + } + + /* Round up all the counts to round numbers */ + + best_count = ascii_count; + best_scheme = DM_ASCII; + + if(b256_count <= best_count) { + best_count = b256_count; + best_scheme = DM_BASE256; + } + + if(edf_count <= best_count) { + best_count = edf_count; + best_scheme = DM_EDIFACT; + } + + if(text_count <= best_count) { + best_count = text_count; + best_scheme = DM_TEXT; + } + + if(x12_count <= best_count) { + best_count = x12_count; + best_scheme = DM_X12; + } + + if(c40_count <= best_count) { + best_count = c40_count; + best_scheme = DM_C40; + } + + return best_scheme; +} + +int dm200encode(unsigned char source[], unsigned char target[], int *last_mode) +{ + /* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate */ + /* Supports encoding FNC1 in supporting systems */ + + int sp, tp, i, gs1; + int current_mode, next_mode; + int c40_buffer[6], c40_p; + int text_buffer[6], text_p; + int x12_buffer[6], x12_p; + int edifact_buffer[8], edifact_p; + int inputlen; + char *binary; + + + inputlen = ustrlen(source); + + binary = (char *)malloc(2 * inputlen); +// binary = (char *)QRcode_malloc(2 * inputlen); + memset(binary, 0x00, 2*inputlen); + + sp = 0; + tp = 0; + memset(c40_buffer, 0, 6); + c40_p = 0; + memset(text_buffer, 0, 6); + text_p = 0; + memset(x12_buffer, 0, 6); + x12_p = 0; + memset(edifact_buffer, 0, 8); + edifact_p = 0; + strcpy(binary, ""); + + /* step (a) */ + current_mode = DM_ASCII; + next_mode = DM_ASCII; + + gs1 = 0; + + if(gs1) { target[tp] = 232; tp++; concat(binary, " "); } /* FNC1 */ + + while (sp < inputlen) { + + current_mode = next_mode; + + /* step (b) - ASCII encodation */ + if(current_mode == DM_ASCII) { + next_mode = DM_ASCII; + + if(istwodigits(source, sp) && ((sp + 1) != inputlen)) { + target[tp] = (10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130; + tp++; concat(binary, " "); + sp += 2; + } else { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + + if(next_mode != DM_ASCII) { + switch(next_mode) { + case DM_C40: target[tp] = 230; tp++; concat(binary, " "); break; + case DM_TEXT: target[tp] = 239; tp++; concat(binary, " "); break; + case DM_X12: target[tp] = 238; tp++; concat(binary, " "); break; + case DM_EDIFACT: target[tp] = 240; tp++; concat(binary, " "); break; + case DM_BASE256: target[tp] = 231; tp++; concat(binary, " "); break; + } + } else { + if(source[sp] > 127) { + target[tp] = 235; + tp++; + target[tp] = (source[sp] - 128) + 1; + tp++; concat(binary, " "); + } else { + if(gs1 && (source[sp] == '[')) { + target[tp] = 232; /* FNC1 */ + } else { + target[tp] = source[sp] + 1; + } + tp++; + concat(binary, " "); + } + sp++; + } + } + + } + + /* step (c) C40 encodation */ + if(current_mode == DM_C40) { + int shift_set, value; + + next_mode = DM_C40; + if(c40_p == 0) { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + } + + if(next_mode != DM_C40) { + target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ + next_mode = DM_ASCII; + } else { + if(source[sp] > 127) { + c40_buffer[c40_p] = 1; c40_p++; + c40_buffer[c40_p] = 30; c40_p++; /* Upper Shift */ + shift_set = c40_shift[source[sp] - 128]; + value = c40_value[source[sp] - 128]; + } else { + shift_set = c40_shift[source[sp]]; + value = c40_value[source[sp]]; + } + + if(gs1 && (source[sp] == '[')) { + shift_set = 2; + value = 27; /* FNC1 */ + } + + if(shift_set != 0) { + c40_buffer[c40_p] = shift_set - 1; c40_p++; + } + c40_buffer[c40_p] = value; c40_p++; + + if(c40_p >= 3) { + int iv; + + iv = (1600 * c40_buffer[0]) + (40 * c40_buffer[1]) + (c40_buffer[2]) + 1; + target[tp] = iv / 256; tp++; + target[tp] = iv % 256; tp++; + concat(binary, " "); + + c40_buffer[0] = c40_buffer[3]; + c40_buffer[1] = c40_buffer[4]; + c40_buffer[2] = c40_buffer[5]; + c40_buffer[3] = 0; + c40_buffer[4] = 0; + c40_buffer[5] = 0; + c40_p -= 3; + } + sp++; + } + } + + /* step (d) Text encodation */ + if(current_mode == DM_TEXT) { + int shift_set, value; + + next_mode = DM_TEXT; + if(text_p == 0) { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + } + + if(next_mode != DM_TEXT) { + target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ + next_mode = DM_ASCII; + + } else { + if(source[sp] > 127) { + text_buffer[text_p] = 1; text_p++; + text_buffer[text_p] = 30; text_p++; /* Upper Shift */ + shift_set = text_shift[source[sp] - 128]; + value = text_value[source[sp] - 128]; + } else { + shift_set = text_shift[source[sp]]; + value = text_value[source[sp]]; + } + + if(gs1 && (source[sp] == '[')) { + shift_set = 2; + value = 27; /* FNC1 */ + } + + if(shift_set != 0) { + text_buffer[text_p] = shift_set - 1; text_p++; + } + text_buffer[text_p] = value; text_p++; + + if(text_p >= 3) { + int iv; + + iv = (1600 * text_buffer[0]) + (40 * text_buffer[1]) + (text_buffer[2]) + 1; + target[tp] = iv / 256; tp++; + target[tp] = iv % 256; tp++; + concat(binary, " "); + + text_buffer[0] = text_buffer[3]; + text_buffer[1] = text_buffer[4]; + text_buffer[2] = text_buffer[5]; + text_buffer[3] = 0; + text_buffer[4] = 0; + text_buffer[5] = 0; + text_p -= 3; + } + sp++; + } + } + + /* step (e) X12 encodation */ + if(current_mode == DM_X12) { + int value = 0; + + next_mode = DM_X12; + if(text_p == 0) { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + } + + if(next_mode != DM_X12) { + target[tp] = 254; tp++; concat(binary, " ");/* Unlatch */ + } else { + if(source[sp] == 13) { value = 0; } + if(source[sp] == '*') { value = 1; } + if(source[sp] == '>') { value = 2; } + if(source[sp] == ' ') { value = 3; } + if((source[sp] >= '0') && (source[sp] <= '9')) { value = (source[sp] - '0') + 4; } + if((source[sp] >= 'A') && (source[sp] <= 'Z')) { value = (source[sp] - 'A') + 14; } + + x12_buffer[x12_p] = value; x12_p++; + + if(x12_p >= 3) { + int iv; + + iv = (1600 * x12_buffer[0]) + (40 * x12_buffer[1]) + (x12_buffer[2]) + 1; + target[tp] = iv / 256; tp++; + target[tp] = iv % 256; tp++; + concat(binary, " "); + + x12_buffer[0] = x12_buffer[3]; + x12_buffer[1] = x12_buffer[4]; + x12_buffer[2] = x12_buffer[5]; + x12_buffer[3] = 0; + x12_buffer[4] = 0; + x12_buffer[5] = 0; + x12_p -= 3; + } + sp++; + } + } + + /* step (f) EDIFACT encodation */ + if(current_mode == DM_EDIFACT) { + int value = 0; + + next_mode = DM_EDIFACT; + if(edifact_p == 3) { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + } + + if(next_mode != DM_EDIFACT) { + edifact_buffer[edifact_p] = 31; edifact_p++; + next_mode = DM_ASCII; + } else { + if((source[sp] >= '@') && (source[sp] <= '^')) { value = source[sp] - '@'; } + if((source[sp] >= ' ') && (source[sp] <= '?')) { value = source[sp]; } + + edifact_buffer[edifact_p] = value; edifact_p++; + sp++; + } + + if(edifact_p >= 4) { + target[tp] = (edifact_buffer[0] << 2) + ((edifact_buffer[1] & 0x30) >> 4); tp++; + target[tp] = ((edifact_buffer[1] & 0x0f) << 4) + ((edifact_buffer[2] & 0x3c) >> 2); tp++; + target[tp] = ((edifact_buffer[2] & 0x03) << 6) + edifact_buffer[3]; tp++; + concat(binary, " "); + + edifact_buffer[0] = edifact_buffer[4]; + edifact_buffer[1] = edifact_buffer[5]; + edifact_buffer[2] = edifact_buffer[6]; + edifact_buffer[3] = edifact_buffer[7]; + edifact_buffer[4] = 0; + edifact_buffer[5] = 0; + edifact_buffer[6] = 0; + edifact_buffer[7] = 0; + edifact_p -= 4; + } + } + + /* step (g) Base 256 encodation */ + if(current_mode == DM_BASE256) { + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1); + + if(next_mode == DM_BASE256) { + target[tp] = source[sp]; + tp++; + sp++; + concat(binary, "b"); + } else { + next_mode = DM_ASCII; + } + } + + if(tp > 1558) { + free(binary); + return 0; + } + + } /* while */ + + /* Empty buffers */ + if(c40_p == 2) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 2] + 1; tp++; + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + if(c40_p == 1) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + + if(text_p == 2) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 2] + 1; tp++; + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + if(text_p == 1) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + + if(x12_p == 2) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 2] + 1; tp++; + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + if(x12_p == 1) { + target[tp] = 254; tp++; /* unlatch */ + target[tp] = source[inputlen - 1] + 1; tp++; + concat(binary, " "); + current_mode = DM_ASCII; + } + + /* Add length and randomising algorithm to b256 */ + i = 0; + while (i < tp) { + if(binary[i] == 'b') { + if((i == 0) || ((i != 0) && (binary[i - 1] != 'b'))) { + /* start of binary data */ + int binary_count; /* length of b256 data */ + + for(binary_count = 0; binary[binary_count + i] == 'b'; binary_count++); + + if(binary_count <= 249) { + dminsert(binary, i, 'b'); + insert_value(target, i, tp, binary_count); tp++; + } else { + dminsert(binary, i, 'b'); + dminsert(binary, i + 1, 'b'); + insert_value(target, i, tp, (binary_count / 250) + 249); tp++; + insert_value(target, i + 1, tp, binary_count % 250); tp++; + } + } + } + i++; + } + + for(i = 0; i < tp; i++) { + if(binary[i] == 'b') { + int prn, temp; + + prn = ((149 * (i + 1)) % 255) + 1; + temp = target[i] + prn; + if (temp <= 255) { target[i] = temp; } else { target[i] = temp - 256; } + } + } + +// QString s,s1; +// s=""; +// for(i = 0; i < tp; i++){ +// s1.sprintf("%02X ", target[i]); +// s+=s1; +// } + //qDebug()<<"bin:"< 0; i--) { + if(i == tail_length) { + target[tp] = 129; tp++; /* Pad */ + } else { + prn = ((149 * (tp + 1)) % 253) + 1; + temp = 129 + prn; + if(temp <= 254) { + target[tp] = temp; tp++; + } else { + target[tp] = temp - 254; tp++; + } + } + } +} + +unsigned char *iec16022ecc200(short *Wptr, short *Hptr, unsigned char *barcode, short* type) + +{ + int inputlen, i; + int binlen; + int symbolsize, optionsize, calcsize; + int taillength, error_number = 0; + int H, W, FH, FW, datablock, bytes, rsblock; + int last_mode; + unsigned char *grid = 0; + unsigned char *source; + +// unsigned char binary[100]; + unsigned char *binary; + binary = (unsigned char *)malloc(2000+10); +// binary = (unsigned char *)QRcode_malloc(2000+10); + +#ifdef WIN32 + printf("New Lib Routine !!! \n"); +#endif + + source = barcode; + + inputlen = ustrlen(source); + + binlen = dm200encode(barcode, binary, &last_mode); + + if(binlen == 0) { + free(binary); + return 0; + } + + calcsize = 29; + for(i = 29; i > -1; i--) { + if(matrixbytes[i] > binlen) { + calcsize = i; + } + } + short k = *type; + if(k != 0) + { + switch(k) + { + case 1: + { + if(calcsize > 2) + { + *type = -1; + } + else + { + calcsize = 2; + } + }break; + case 2: + { + if(calcsize > 4) + { + *type = -1; + } + else + { + calcsize = 4; + } + }break; + case 3: + { + if(calcsize > 6) + { + *type = -1; + } + else + { + calcsize = 6; + } + }break; + case 4: + { + if(calcsize > 9) + { + *type = -1; + } + else + { + calcsize = 9; + } + }break; + case 5: + { + if(calcsize > 11) + { + *type = -1; + } + else + { + calcsize = 11; + } + }break; + case 6: + { + if(calcsize > 14) + { + *type = -1; + } + else + { + calcsize = 14; + } + }break; + } + } + else + { + switch(calcsize) { + case 2: + case 4: + case 6: + case 9: + case 11: + case 14: + calcsize++; + } + } + + //optionsize = -1; + optionsize = 10; + + symbolsize = optionsize; + + if(calcsize <= optionsize) { + symbolsize = optionsize; + } else + { + symbolsize = calcsize; + } + + H = matrixH[symbolsize]; + W = matrixW[symbolsize]; + FH = matrixFH[symbolsize]; + FW = matrixFW[symbolsize]; + bytes = matrixbytes[symbolsize]; + datablock = matrixdatablock[symbolsize]; + rsblock = matrixrsblock[symbolsize]; + + taillength = bytes - binlen; + + + if(taillength != 0) { + add_tail(binary, binlen, taillength, last_mode); + } + + // ecc code + ecc200(binary, bytes, datablock, rsblock); + { // placement + int x, y, NC, NR, *places; + NC = W - 2 * (W / FW); + NR = H - 2 * (H / FH); + places = (int*)safemalloc(NC * NR * sizeof(int)); + // places = (int*)QRcode_malloc(NC * NR * sizeof(int)); + ecc200placement(places, NR, NC); + grid = (unsigned char*)safemalloc(W * H); + // grid = (unsigned char*)QRcode_malloc(W * H); + memset(grid, 0, W * H); + for (y = 0; y < H; y += FH) { + for (x = 0; x < W; x++) + grid[y * W + x] = 1; + for (x = 0; x < W; x += 2) + grid[(y + FH - 1) * W + x] = 1; + } + for (x = 0; x < W; x += FW) { + for (y = 0; y < H; y++) + grid[y * W + x] = 1; + for (y = 0; y < H; y += 2) + grid[y * W + x + FW - 1] = 1; + } + for (y = 0; y < NR; y++) { + for (x = 0; x < NC; x++) { + int v = places[(NR - y - 1) * NC + x]; + //fprintf (stderr, "%4d", v); + if (v == 1 || (v > 7 && (binary[(v >> 3) - 1] & (1 << (v & 7))))) + grid[(1 + y + 2 * (y / (FH - 2))) * W + 1 + x + 2 * (x / (FW - 2))] = 1; + } + //fprintf (stderr, "\n"); + } + + for(y = H - 1; y >= 0; y--) { + int x; + for(x = 0; x < W; x++) { + if(grid[W * y + x]) + { +#ifdef WIN32 + printf("X"); +#endif + } +#ifdef WIN32 + else + printf(" "); +#endif + + } +#ifdef WIN32 + printf("\n"); +#endif + } + + free(places); + } + *Wptr = (short)W; + *Hptr = (short)H; + free(binary); + return grid; +} + + + diff --git a/Matrix/dm200.h b/Matrix/dm200.h index 1a7f1e2..1c2d1bf 100644 --- a/Matrix/dm200.h +++ b/Matrix/dm200.h @@ -1,162 +1,162 @@ -/* dm200.h - Handles Data Matrix ECC 200 */ - -/* - libzint - the open source barcode library - Copyright (C) 2009 Robin Stuart - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "common.h" - -#ifndef __IEC16022ECC200_H -#define __IEC16022ECC200_H -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ -//void MatrixEnCode(unsigned char *intext); -//extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[]); -extern unsigned char *iec16022ecc200(short *Wptr, short *Hptr, unsigned char *barcode, short* type); -void Draw_Matrix(unsigned char *buffer); -//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); -//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize,QImage *pImg); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#define MAXBARCODE 3116 - -#define DM_ASCII 1 -#define DM_C40 2 -#define DM_TEXT 3 -#define DM_X12 4 -#define DM_EDIFACT 5 -#define DM_BASE256 6 - - -static int c40_shift[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; - -static int c40_value[] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, - 15,16,17,18,19,20,21,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, - 22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; - -static int text_shift[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3 }; - -static int text_value[] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, - 15,16,17,18,19,20,21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, - 22,23,24,25,26,0,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,27,28,29,30,31 }; - -static int intsymbol[] = { - 0,1,3,5,7,8,10,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,2,4,6,9,11,14 }; - -static int matrixH[] = { - 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 32, 36, 40, 44, 48, - 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; - -static int matrixW[] = { - 10, 12, 18, 14, 32, 16, 26, 18, 20, 36, 22, 36, 24, 26, 48, 32, 36, 40, 44, - 48, 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; - -static int matrixFH[] = { - 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 16, 18, 20, 22, 24, - 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; - -static int matrixFW[] = { - 10, 12, 18, 14, 16, 16, 26, 18, 20, 18, 22, 18, 24, 26, 24, 16, 18, 20, 22, - 24, 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; - -static int matrixbytes[] = { - 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, - 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558 }; - -static int matrixdatablock[] = { - 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, - 174, 102, 140, 92, 114, 144, 174, 136, 175, 163, 156 }; - -static int matrixrsblock[] = { - 5, 7, 7, 10, 11, 12, 14, 14, 18, 18, 20, 24, 24, 28, 28, 36, 42, 48, 56, 68, - 42, 56, 36, 48, 56, 68, 56, 68, 62, 62 }; -/* - -static int c40_shift[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; - -static int c40_value[] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, - 15,16,17,18,19,20,21,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, - 22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; - -static int text_shift[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3 }; - -static int text_value[] = { - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, - 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, - 15,16,17,18,19,20,21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, - 22,23,24,25,26,0,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,27,28,29,30,31 }; - -static int intsymbol[] = { - 0,1,3,5,7,8,10,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,2,4,6,9,11,14 }; - -static int matrixH[] = { - 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 32, 36, 40, 44, 48, - 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; - -static int matrixW[] = { - 10, 12, 18, 14, 32, 16, 26, 18, 20, 36, 22, 36, 24, 26, 48, 32, 36, 40, 44, - 48, 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; - -static int matrixFH[] = { - 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 16, 18, 20, 22, 24, - 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; - -static int matrixFW[] = { - 10, 12, 18, 14, 16, 16, 26, 18, 20, 18, 22, 18, 24, 26, 24, 16, 18, 20, 22, - 24, 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; - -static int matrixbytes[] = { - 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, - 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558 }; - -static int matrixdatablock[] = { - 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, - 174, 102, 140, 92, 114, 144, 174, 136, 175, 163, 156 }; - -static int matrixrsblock[] = { - 5, 7, 7, 10, 11, 12, 14, 14, 18, 18, 20, 24, 24, 28, 28, 36, 42, 48, 56, 68, - 42, 56, 36, 48, 56, 68, 56, 68, 62, 62 }; - - */ -#endif /* __IEC16022ECC200_H */ +/* dm200.h - Handles Data Matrix ECC 200 */ + +/* + libzint - the open source barcode library + Copyright (C) 2009 Robin Stuart + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "common.h" + +#ifndef __IEC16022ECC200_H +#define __IEC16022ECC200_H +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ +//void MatrixEnCode(unsigned char *intext); +//extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[]); +extern unsigned char *iec16022ecc200(short *Wptr, short *Hptr, unsigned char *barcode, short* type); +void Draw_Matrix(unsigned char *buffer); +//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); +//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize,QImage *pImg); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#define MAXBARCODE 3116 + +#define DM_ASCII 1 +#define DM_C40 2 +#define DM_TEXT 3 +#define DM_X12 4 +#define DM_EDIFACT 5 +#define DM_BASE256 6 + + +static int c40_shift[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; + +static int c40_value[] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, + 15,16,17,18,19,20,21,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, + 22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; + +static int text_shift[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3 }; + +static int text_value[] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, + 15,16,17,18,19,20,21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, + 22,23,24,25,26,0,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,27,28,29,30,31 }; + +static int intsymbol[] = { + 0,1,3,5,7,8,10,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,2,4,6,9,11,14 }; + +static int matrixH[] = { + 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 32, 36, 40, 44, 48, + 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; + +static int matrixW[] = { + 10, 12, 18, 14, 32, 16, 26, 18, 20, 36, 22, 36, 24, 26, 48, 32, 36, 40, 44, + 48, 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; + +static int matrixFH[] = { + 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 16, 18, 20, 22, 24, + 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; + +static int matrixFW[] = { + 10, 12, 18, 14, 16, 16, 26, 18, 20, 18, 22, 18, 24, 26, 24, 16, 18, 20, 22, + 24, 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; + +static int matrixbytes[] = { + 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, + 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558 }; + +static int matrixdatablock[] = { + 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, + 174, 102, 140, 92, 114, 144, 174, 136, 175, 163, 156 }; + +static int matrixrsblock[] = { + 5, 7, 7, 10, 11, 12, 14, 14, 18, 18, 20, 24, 24, 28, 28, 36, 42, 48, 56, 68, + 42, 56, 36, 48, 56, 68, 56, 68, 62, 62 }; +/* + +static int c40_shift[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; + +static int c40_value[] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, + 15,16,17,18,19,20,21,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, + 22,23,24,25,26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; + +static int text_shift[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3 }; + +static int text_value[] = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,4,5,6,7,8,9,10,11,12,13, + 15,16,17,18,19,20,21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, + 22,23,24,25,26,0,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,27,28,29,30,31 }; + +static int intsymbol[] = { + 0,1,3,5,7,8,10,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,2,4,6,9,11,14 }; + +static int matrixH[] = { + 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 32, 36, 40, 44, 48, + 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; + +static int matrixW[] = { + 10, 12, 18, 14, 32, 16, 26, 18, 20, 36, 22, 36, 24, 26, 48, 32, 36, 40, 44, + 48, 52, 64, 72, 80, 88, 96, 104, 120, 132, 144 }; + +static int matrixFH[] = { + 10, 12, 8, 14, 8, 16, 12, 18, 20, 12, 22, 16, 24, 26, 16, 16, 18, 20, 22, 24, + 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; + +static int matrixFW[] = { + 10, 12, 18, 14, 16, 16, 26, 18, 20, 18, 22, 18, 24, 26, 24, 16, 18, 20, 22, + 24, 26, 16, 18, 20, 22, 24, 26, 20, 22, 24 }; + +static int matrixbytes[] = { + 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, + 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558 }; + +static int matrixdatablock[] = { + 3, 5, 5, 8, 10, 12, 16, 18, 22, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, + 174, 102, 140, 92, 114, 144, 174, 136, 175, 163, 156 }; + +static int matrixrsblock[] = { + 5, 7, 7, 10, 11, 12, 14, 14, 18, 18, 20, 24, 24, 28, 28, 36, 42, 48, 56, 68, + 42, 56, 36, 48, 56, 68, 56, 68, 62, 62 }; + + */ +#endif /* __IEC16022ECC200_H */ diff --git a/Matrix/drawmatrix.cpp b/Matrix/drawmatrix.cpp index b074d7f..86ac48b 100644 --- a/Matrix/drawmatrix.cpp +++ b/Matrix/drawmatrix.cpp @@ -1,68 +1,68 @@ -#include -#include -// -// U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize -#include "dm200.h" - -#include "QImage" -#include "QDebug" - -#define MAX_WIDTH_BYTE 48 // 384/8 - -char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); -//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize,QImage *pImg); - -void Draw_Matrix(unsigned char *buffer) -{ - U16 sColumns, sRows; - U08 *Grid; - sColumns = sRows = 0; - Grid = 0; - sColumns = sRows = 0; - short sizeType = 0; - Grid = iec16022ecc200((short*)&sRows, (short*)&sColumns, buffer, &sizeType); - DataMatrixdDraw(Grid,sRows,sColumns,2); -} - -char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize) -{ - int Size=MSize; - int w = cColumns*Size; - int h = cRows*Size; - //qDebug()<fill(0x00ffffff); - /* data */ - int margin=0; - U08 *p = OutBuff; - int ypos=0;//margin * Size; - int xpos=0; - int x,y,xx,yy,bit; - for(y=0; ysetPixel(xpos,h-1-(ypos+yy),0xff000000); - } - } - xpos++; - } - p++; - bit--; - if(bit < 0) { - //q++; - bit = 7; - } - } - ypos+=Size; - } - img->save("Myqr.bmp"); - return 0; -} - +#include +#include +// +// U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize +#include "dm200.h" + +#include "QImage" +#include "QDebug" + +#define MAX_WIDTH_BYTE 48 // 384/8 + +char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); +//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize,QImage *pImg); + +void Draw_Matrix(unsigned char *buffer) +{ + U16 sColumns, sRows; + U08 *Grid; + sColumns = sRows = 0; + Grid = 0; + sColumns = sRows = 0; + short sizeType = 0; + Grid = iec16022ecc200((short*)&sRows, (short*)&sColumns, buffer, &sizeType); + DataMatrixdDraw(Grid,sRows,sColumns,2); +} + +char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize) +{ + int Size=MSize; + int w = cColumns*Size; + int h = cRows*Size; + //qDebug()<fill(0x00ffffff); + /* data */ + int margin=0; + U08 *p = OutBuff; + int ypos=0;//margin * Size; + int xpos=0; + int x,y,xx,yy,bit; + for(y=0; ysetPixel(xpos,h-1-(ypos+yy),0xff000000); + } + } + xpos++; + } + p++; + bit--; + if(bit < 0) { + //q++; + bit = 7; + } + } + ypos+=Size; + } + img->save("Myqr.bmp"); + return 0; +} + diff --git a/Matrix/reedsol.cpp b/Matrix/reedsol.cpp index 76e37de..02663a0 100644 --- a/Matrix/reedsol.cpp +++ b/Matrix/reedsol.cpp @@ -1,173 +1,173 @@ -/** - * - * This is a simple Reed-Solomon encoder - * (C) Cliff Hones 2004 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -// It is not written with high efficiency in mind, so is probably -// not suitable for real-time encoding. The aim was to keep it -// simple, general and clear. -// -// - -// Usage: -// First call rs_init_gf(poly) to set up the Galois Field parameters. -// Then call rs_init_code(size, index) to set the encoding size -// Then call rs_encode(datasize, data, out) to encode the data. -// -// These can be called repeatedly as required - but note that -// rs_init_code must be called following any rs_init_gf call. -// -// If the parameters are fixed, some of the statics below can be -// replaced with constants in the obvious way, and additionally -// malloc/free can be avoided by using static arrays of a suitable -// size. - -#include // only needed for debug (main) -#include // only needed for malloc/free -#include "reedsol.h" - -//#pragma section data begin -//#pragma section _sdram -int gfpoly; -int symsize; // in bits -int logmod; // 2**symsize - 1 -int rlen; - -int *log = NULL, *alog = NULL, *rspoly = NULL; - -void rs_init_gf(int poly) -{ - int m, b, p, v; - - // Return storage from previous setup - if (log) { - free(log); - if (alog)free(alog); - if (rspoly)free(rspoly); - rspoly = NULL; - log =NULL; - alog = NULL; - } - - // Find the top bit, and hence the symbol size - for (b = 1, m = 0; b <= poly; b <<= 1) - m++; - b >>= 1; - m--; - gfpoly = poly; - symsize = m; - - // Calculate the log/alog tables - logmod = (1 << m) - 1; - log = (int *)malloc(sizeof(int) * (logmod + 1)); - alog = (int *)malloc(sizeof(int) * logmod); - -// log = (int *)QRcode_malloc(sizeof(int) * (logmod + 1)); -// alog = (int *)QRcode_malloc(sizeof(int) * logmod); - - for (p = 1, v = 0; v < logmod; v++) { - alog[v] = p; - log[p] = v; - p <<= 1; - if (p & b) - p ^= poly; - } -} - -// rs_init_code(nsym, index) initialises the Reed-Solomon encoder -// nsym is the number of symbols to be generated (to be appended -// to the input data). index is usually 1 - it is the index of -// the constant in the first term (i) of the RS generator polynomial: -// (x + 2**i)*(x + 2**(i+1))*... [nsym terms] -// For ECC200, index is 1. - -void rs_init_code(int nsym, int index) -{ - int i, k; - - if (rspoly) - free(rspoly); - rspoly = (int *)malloc(sizeof(int) * (nsym + 1)); - //rspoly = (int *)QRcode_malloc(sizeof(int) * (nsym + 1)); - - rlen = nsym; - - rspoly[0] = 1; - for (i = 1; i <= nsym; i++) { - rspoly[i] = 1; - for (k = i - 1; k > 0; k--) { - if (rspoly[k]) - rspoly[k] = alog[(log[rspoly[k]] + index) % logmod]; - rspoly[k] ^= rspoly[k - 1]; - } - rspoly[0] = alog[(log[rspoly[0]] + index) % logmod]; - index++; - } -} - -void rs_encode(int len, unsigned char *data, unsigned char *res) -{ - int i, k, m; - for (i = 0; i < rlen; i++) - res[i] = 0; - for (i = 0; i < len; i++) { - m = res[rlen - 1] ^ data[i]; - for (k = rlen - 1; k > 0; k--) { - if (m && rspoly[k]) - res[k] = res[k - 1] ^ alog[(log[m] + log[rspoly[k]]) % logmod]; - else - res[k] = res[k - 1]; - } - if (m && rspoly[0]) - res[0] = alog[(log[m] + log[rspoly[0]]) % logmod]; - else - res[0] = 0; - } -} - -void rs_encode_long(int len, unsigned int *data, unsigned int *res) -{ /* The same as above but for larger bitlengths - Aztec code compatible */ - int i, k, m; - for (i = 0; i < rlen; i++) - res[i] = 0; - for (i = 0; i < len; i++) { - m = res[rlen - 1] ^ data[i]; - for (k = rlen - 1; k > 0; k--) { - if (m && rspoly[k]) - res[k] = res[k - 1] ^ alog[(log[m] + log[rspoly[k]]) % logmod]; - else - res[k] = res[k - 1]; - } - - if (m && rspoly[0]) - res[0] = alog[(log[m] + log[rspoly[0]]) % logmod]; - else - res[0] = 0; - } -} - -void rs_free(void) -{ /* Free memory */ - free(log); - free(alog); - free(rspoly); - log =NULL; - alog = NULL; - rspoly = NULL; -} +/** + * + * This is a simple Reed-Solomon encoder + * (C) Cliff Hones 2004 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +// It is not written with high efficiency in mind, so is probably +// not suitable for real-time encoding. The aim was to keep it +// simple, general and clear. +// +// + +// Usage: +// First call rs_init_gf(poly) to set up the Galois Field parameters. +// Then call rs_init_code(size, index) to set the encoding size +// Then call rs_encode(datasize, data, out) to encode the data. +// +// These can be called repeatedly as required - but note that +// rs_init_code must be called following any rs_init_gf call. +// +// If the parameters are fixed, some of the statics below can be +// replaced with constants in the obvious way, and additionally +// malloc/free can be avoided by using static arrays of a suitable +// size. + +#include // only needed for debug (main) +#include // only needed for malloc/free +#include "reedsol.h" + +//#pragma section data begin +//#pragma section _sdram +int gfpoly; +int symsize; // in bits +int logmod; // 2**symsize - 1 +int rlen; + +int *log = NULL, *alog = NULL, *rspoly = NULL; + +void rs_init_gf(int poly) +{ + int m, b, p, v; + + // Return storage from previous setup + if (log) { + free(log); + if (alog)free(alog); + if (rspoly)free(rspoly); + rspoly = NULL; + log =NULL; + alog = NULL; + } + + // Find the top bit, and hence the symbol size + for (b = 1, m = 0; b <= poly; b <<= 1) + m++; + b >>= 1; + m--; + gfpoly = poly; + symsize = m; + + // Calculate the log/alog tables + logmod = (1 << m) - 1; + log = (int *)malloc(sizeof(int) * (logmod + 1)); + alog = (int *)malloc(sizeof(int) * logmod); + +// log = (int *)QRcode_malloc(sizeof(int) * (logmod + 1)); +// alog = (int *)QRcode_malloc(sizeof(int) * logmod); + + for (p = 1, v = 0; v < logmod; v++) { + alog[v] = p; + log[p] = v; + p <<= 1; + if (p & b) + p ^= poly; + } +} + +// rs_init_code(nsym, index) initialises the Reed-Solomon encoder +// nsym is the number of symbols to be generated (to be appended +// to the input data). index is usually 1 - it is the index of +// the constant in the first term (i) of the RS generator polynomial: +// (x + 2**i)*(x + 2**(i+1))*... [nsym terms] +// For ECC200, index is 1. + +void rs_init_code(int nsym, int index) +{ + int i, k; + + if (rspoly) + free(rspoly); + rspoly = (int *)malloc(sizeof(int) * (nsym + 1)); + //rspoly = (int *)QRcode_malloc(sizeof(int) * (nsym + 1)); + + rlen = nsym; + + rspoly[0] = 1; + for (i = 1; i <= nsym; i++) { + rspoly[i] = 1; + for (k = i - 1; k > 0; k--) { + if (rspoly[k]) + rspoly[k] = alog[(log[rspoly[k]] + index) % logmod]; + rspoly[k] ^= rspoly[k - 1]; + } + rspoly[0] = alog[(log[rspoly[0]] + index) % logmod]; + index++; + } +} + +void rs_encode(int len, unsigned char *data, unsigned char *res) +{ + int i, k, m; + for (i = 0; i < rlen; i++) + res[i] = 0; + for (i = 0; i < len; i++) { + m = res[rlen - 1] ^ data[i]; + for (k = rlen - 1; k > 0; k--) { + if (m && rspoly[k]) + res[k] = res[k - 1] ^ alog[(log[m] + log[rspoly[k]]) % logmod]; + else + res[k] = res[k - 1]; + } + if (m && rspoly[0]) + res[0] = alog[(log[m] + log[rspoly[0]]) % logmod]; + else + res[0] = 0; + } +} + +void rs_encode_long(int len, unsigned int *data, unsigned int *res) +{ /* The same as above but for larger bitlengths - Aztec code compatible */ + int i, k, m; + for (i = 0; i < rlen; i++) + res[i] = 0; + for (i = 0; i < len; i++) { + m = res[rlen - 1] ^ data[i]; + for (k = rlen - 1; k > 0; k--) { + if (m && rspoly[k]) + res[k] = res[k - 1] ^ alog[(log[m] + log[rspoly[k]]) % logmod]; + else + res[k] = res[k - 1]; + } + + if (m && rspoly[0]) + res[0] = alog[(log[m] + log[rspoly[0]]) % logmod]; + else + res[0] = 0; + } +} + +void rs_free(void) +{ /* Free memory */ + free(log); + free(alog); + free(rspoly); + log =NULL; + alog = NULL; + rspoly = NULL; +} diff --git a/Matrix/reedsol.h b/Matrix/reedsol.h index db4b2bc..2b1de02 100644 --- a/Matrix/reedsol.h +++ b/Matrix/reedsol.h @@ -1,40 +1,40 @@ -/** - * - * This is a simple Reed-Solomon encoder - * (C) Cliff Hones 2004 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef __REEDSOL_H -#define __REEDSOL_H - -/*#ifdef __cplusplus -extern "C" -{ -#endif */ /* __cplusplus */ - -extern void rs_init_gf(int poly); -extern void rs_init_code(int nsym, int index); -extern void rs_encode(int len, unsigned char *data, unsigned char *res); -extern void rs_encode_long(int len, unsigned int *data, unsigned int *res); -extern void rs_free(void); - -/*#ifdef __cplusplus -} -#endif */ /* __cplusplus */ - -#endif /* __REEDSOL_H */ +/** + * + * This is a simple Reed-Solomon encoder + * (C) Cliff Hones 2004 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __REEDSOL_H +#define __REEDSOL_H + +/*#ifdef __cplusplus +extern "C" +{ +#endif */ /* __cplusplus */ + +extern void rs_init_gf(int poly); +extern void rs_init_code(int nsym, int index); +extern void rs_encode(int len, unsigned char *data, unsigned char *res); +extern void rs_encode_long(int len, unsigned int *data, unsigned int *res); +extern void rs_free(void); + +/*#ifdef __cplusplus +} +#endif */ /* __cplusplus */ + +#endif /* __REEDSOL_H */ diff --git a/Matrix/zint.h b/Matrix/zint.h index 3f8e2a3..191e32f 100644 --- a/Matrix/zint.h +++ b/Matrix/zint.h @@ -1,209 +1,209 @@ -/* zint.h - definitions for libzint - - libzint - the open source barcode library - Copyright (C) 2009 Robin Stuart - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef ZINT_H -#define ZINT_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -//#pragma section data begin -struct zint_symbol { - int symbology; - int height; - int whitespace_width; - int border_width; - int output_options; - char fgcolour[10]; - char bgcolour[10]; - char outfile[256]; - float scale; - int option_1; - int option_2; - int option_3; - int show_hrt; - int input_mode; - unsigned char text[128]; - int rows; - int width; - char primary[128]; - unsigned char encoded_data[178][143]; - int row_height[178]; /* Largest symbol is 177x177 QR Code */ - char errtxt[100]; - char *bitmap; - int bitmap_width; - int bitmap_height; -}; - -//#pragma section data end - -/* Tbarcode 7 codes */ -#define BARCODE_CODE11 1 -#define BARCODE_C25MATRIX 2 -#define BARCODE_C25INTER 3 -#define BARCODE_C25IATA 4 -#define BARCODE_C25LOGIC 6 -#define BARCODE_C25IND 7 -//#define BARCODE_CODE39 8 -#define BARCODE_EXCODE39 9 -#define BARCODE_EANX 13 -//#define BARCODE_EAN128 16 -//#define BARCODE_CODABAR 18 -//#define BARCODE_CODE128 20 -#define BARCODE_DPLEIT 21 -#define BARCODE_DPIDENT 22 -#define BARCODE_CODE16K 23 -#define BARCODE_CODE49 24 -//#define BARCODE_CODE93 25 -#define BARCODE_FLAT 28 -#define BARCODE_RSS14 29 -#define BARCODE_RSS_LTD 30 -#define BARCODE_RSS_EXP 31 -#define BARCODE_TELEPEN 32 -#define BARCODE_UPCA 34 -#define BARCODE_UPCE 37 -//#define BARCODE_POSTNET 40 -#define BARCODE_MSI_PLESSEY 47 -#define BARCODE_FIM 49 -#define BARCODE_LOGMARS 50 -#define BARCODE_PHARMA 51 -#define BARCODE_PZN 52 -#define BARCODE_PHARMA_TWO 53 -#define BARCODE_PDF417 55 -#define BARCODE_PDF417TRUNC 56 -#define BARCODE_MAXICODE 57 -#define BARCODE_QRCODE 58 -#define BARCODE_CODE128B 60 -#define BARCODE_AUSPOST 63 -#define BARCODE_AUSREPLY 66 -#define BARCODE_AUSROUTE 67 -#define BARCODE_AUSREDIRECT 68 -#define BARCODE_ISBNX 69 -#define BARCODE_RM4SCC 70 -#define BARCODE_DATAMATRIX 71 -#define BARCODE_EAN14 72 -#define BARCODE_CODABLOCKF 74 -#define BARCODE_NVE18 75 -#define BARCODE_JAPANPOST 76 -#define BARCODE_KOREAPOST 77 -#define BARCODE_RSS14STACK 79 -#define BARCODE_RSS14STACK_OMNI 80 -#define BARCODE_RSS_EXPSTACK 81 -//#define BARCODE_PLANET 82 -#define BARCODE_MICROPDF417 84 -#define BARCODE_ONECODE 85 -#define BARCODE_PLESSEY 86 - -/* Tbarcode 8 codes */ -#define BARCODE_TELEPEN_NUM 87 -#define BARCODE_ITF14 89 -#define BARCODE_KIX 90 -#define BARCODE_AZTEC 92 -#define BARCODE_DAFT 93 -#define BARCODE_MICROQR 97 - -/* Tbarcode 9 codes */ -#define BARCODE_HIBC_128 98 -#define BARCODE_HIBC_39 99 -#define BARCODE_HIBC_DM 102 -#define BARCODE_HIBC_QR 104 -#define BARCODE_HIBC_PDF 106 -#define BARCODE_HIBC_MICPDF 108 -#define BARCODE_HIBC_BLOCKF 110 -#define BARCODE_HIBC_AZTEC 112 - -/* Zint specific */ -#define BARCODE_AZRUNE 128 -#define BARCODE_CODE32 129 -#define BARCODE_EANX_CC 130 -#define BARCODE_EAN128_CC 131 -#define BARCODE_RSS14_CC 132 -#define BARCODE_RSS_LTD_CC 133 -#define BARCODE_RSS_EXP_CC 134 -#define BARCODE_UPCA_CC 135 -#define BARCODE_UPCE_CC 136 -#define BARCODE_RSS14STACK_CC 137 -#define BARCODE_RSS14_OMNI_CC 138 -#define BARCODE_RSS_EXPSTACK_CC 139 -#define BARCODE_CHANNEL 140 -#define BARCODE_CODEONE 141 -#define BARCODE_GRIDMATRIX 142 - -#define BARCODE_NO_ASCII 1 -#define BARCODE_BIND 2 -#define BARCODE_BOX 4 -#define BARCODE_STDOUT 8 -#define READER_INIT 16 - -#define DATA_MODE 0 -#define UNICODE_MODE 1 -#define GS1_MODE 2 -#define KANJI_MODE 3 -#define SJIS_MODE 4 - -#define DM_SQUARE 100 - -#define WARN_INVALID_OPTION 2 -#define ERROR_TOO_LONG 5 -#define ERROR_INVALID_DATA 6 -#define ERROR_INVALID_CHECK 7 -#define ERROR_INVALID_OPTION 8 -#define ERROR_ENCODING_PROBLEM 9 -#define ERROR_FILE_ACCESS 10 -#define ERROR_MEMORY 11 - -#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(_MSC_VER) -# if defined (DLL_EXPORT) || defined(PIC) || defined(_USRDLL) -# define ZINT_EXTERN __declspec(dllexport) -# elif defined(ZINT_DLL) -# define ZINT_EXTERN __declspec(dllimport) -# else -# define ZINT_EXTERN extern -# endif -#else -# define ZINT_EXTERN extern -#endif - -ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void); -ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol); -ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol); - -ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input, int length); -ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename); -ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); -ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); -ZINT_EXTERN int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle); - -ZINT_EXTERN int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); -ZINT_EXTERN int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); -ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle); - -ZINT_EXTERN int ZBarcode_ValidID(int symbol_id); - -/* Depreciated */ -ZINT_EXTERN int ZBarcode_Print_Rotated(struct zint_symbol *symbol, int rotate_angle); -ZINT_EXTERN int ZBarcode_Encode_and_Print_Rotated(struct zint_symbol *symbol, unsigned char *input, int rotate_angle); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ZINT_H */ +/* zint.h - definitions for libzint + + libzint - the open source barcode library + Copyright (C) 2009 Robin Stuart + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef ZINT_H +#define ZINT_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +//#pragma section data begin +struct zint_symbol { + int symbology; + int height; + int whitespace_width; + int border_width; + int output_options; + char fgcolour[10]; + char bgcolour[10]; + char outfile[256]; + float scale; + int option_1; + int option_2; + int option_3; + int show_hrt; + int input_mode; + unsigned char text[128]; + int rows; + int width; + char primary[128]; + unsigned char encoded_data[178][143]; + int row_height[178]; /* Largest symbol is 177x177 QR Code */ + char errtxt[100]; + char *bitmap; + int bitmap_width; + int bitmap_height; +}; + +//#pragma section data end + +/* Tbarcode 7 codes */ +#define BARCODE_CODE11 1 +#define BARCODE_C25MATRIX 2 +#define BARCODE_C25INTER 3 +#define BARCODE_C25IATA 4 +#define BARCODE_C25LOGIC 6 +#define BARCODE_C25IND 7 +//#define BARCODE_CODE39 8 +#define BARCODE_EXCODE39 9 +#define BARCODE_EANX 13 +//#define BARCODE_EAN128 16 +//#define BARCODE_CODABAR 18 +//#define BARCODE_CODE128 20 +#define BARCODE_DPLEIT 21 +#define BARCODE_DPIDENT 22 +#define BARCODE_CODE16K 23 +#define BARCODE_CODE49 24 +//#define BARCODE_CODE93 25 +#define BARCODE_FLAT 28 +#define BARCODE_RSS14 29 +#define BARCODE_RSS_LTD 30 +#define BARCODE_RSS_EXP 31 +#define BARCODE_TELEPEN 32 +#define BARCODE_UPCA 34 +#define BARCODE_UPCE 37 +//#define BARCODE_POSTNET 40 +#define BARCODE_MSI_PLESSEY 47 +#define BARCODE_FIM 49 +#define BARCODE_LOGMARS 50 +#define BARCODE_PHARMA 51 +#define BARCODE_PZN 52 +#define BARCODE_PHARMA_TWO 53 +#define BARCODE_PDF417 55 +#define BARCODE_PDF417TRUNC 56 +#define BARCODE_MAXICODE 57 +#define BARCODE_QRCODE 58 +#define BARCODE_CODE128B 60 +#define BARCODE_AUSPOST 63 +#define BARCODE_AUSREPLY 66 +#define BARCODE_AUSROUTE 67 +#define BARCODE_AUSREDIRECT 68 +#define BARCODE_ISBNX 69 +#define BARCODE_RM4SCC 70 +#define BARCODE_DATAMATRIX 71 +#define BARCODE_EAN14 72 +#define BARCODE_CODABLOCKF 74 +#define BARCODE_NVE18 75 +#define BARCODE_JAPANPOST 76 +#define BARCODE_KOREAPOST 77 +#define BARCODE_RSS14STACK 79 +#define BARCODE_RSS14STACK_OMNI 80 +#define BARCODE_RSS_EXPSTACK 81 +//#define BARCODE_PLANET 82 +#define BARCODE_MICROPDF417 84 +#define BARCODE_ONECODE 85 +#define BARCODE_PLESSEY 86 + +/* Tbarcode 8 codes */ +#define BARCODE_TELEPEN_NUM 87 +#define BARCODE_ITF14 89 +#define BARCODE_KIX 90 +#define BARCODE_AZTEC 92 +#define BARCODE_DAFT 93 +#define BARCODE_MICROQR 97 + +/* Tbarcode 9 codes */ +#define BARCODE_HIBC_128 98 +#define BARCODE_HIBC_39 99 +#define BARCODE_HIBC_DM 102 +#define BARCODE_HIBC_QR 104 +#define BARCODE_HIBC_PDF 106 +#define BARCODE_HIBC_MICPDF 108 +#define BARCODE_HIBC_BLOCKF 110 +#define BARCODE_HIBC_AZTEC 112 + +/* Zint specific */ +#define BARCODE_AZRUNE 128 +#define BARCODE_CODE32 129 +#define BARCODE_EANX_CC 130 +#define BARCODE_EAN128_CC 131 +#define BARCODE_RSS14_CC 132 +#define BARCODE_RSS_LTD_CC 133 +#define BARCODE_RSS_EXP_CC 134 +#define BARCODE_UPCA_CC 135 +#define BARCODE_UPCE_CC 136 +#define BARCODE_RSS14STACK_CC 137 +#define BARCODE_RSS14_OMNI_CC 138 +#define BARCODE_RSS_EXPSTACK_CC 139 +#define BARCODE_CHANNEL 140 +#define BARCODE_CODEONE 141 +#define BARCODE_GRIDMATRIX 142 + +#define BARCODE_NO_ASCII 1 +#define BARCODE_BIND 2 +#define BARCODE_BOX 4 +#define BARCODE_STDOUT 8 +#define READER_INIT 16 + +#define DATA_MODE 0 +#define UNICODE_MODE 1 +#define GS1_MODE 2 +#define KANJI_MODE 3 +#define SJIS_MODE 4 + +#define DM_SQUARE 100 + +#define WARN_INVALID_OPTION 2 +#define ERROR_TOO_LONG 5 +#define ERROR_INVALID_DATA 6 +#define ERROR_INVALID_CHECK 7 +#define ERROR_INVALID_OPTION 8 +#define ERROR_ENCODING_PROBLEM 9 +#define ERROR_FILE_ACCESS 10 +#define ERROR_MEMORY 11 + +#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(_MSC_VER) +# if defined (DLL_EXPORT) || defined(PIC) || defined(_USRDLL) +# define ZINT_EXTERN __declspec(dllexport) +# elif defined(ZINT_DLL) +# define ZINT_EXTERN __declspec(dllimport) +# else +# define ZINT_EXTERN extern +# endif +#else +# define ZINT_EXTERN extern +#endif + +ZINT_EXTERN struct zint_symbol *ZBarcode_Create(void); +ZINT_EXTERN void ZBarcode_Clear(struct zint_symbol *symbol); +ZINT_EXTERN void ZBarcode_Delete(struct zint_symbol *symbol); + +ZINT_EXTERN int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *input, int length); +ZINT_EXTERN int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename); +ZINT_EXTERN int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle); +ZINT_EXTERN int ZBarcode_Encode_and_Print(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); +ZINT_EXTERN int ZBarcode_Encode_File_and_Print(struct zint_symbol *symbol, char *filename, int rotate_angle); + +ZINT_EXTERN int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle); +ZINT_EXTERN int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle); +ZINT_EXTERN int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol, char *filename, int rotate_angle); + +ZINT_EXTERN int ZBarcode_ValidID(int symbol_id); + +/* Depreciated */ +ZINT_EXTERN int ZBarcode_Print_Rotated(struct zint_symbol *symbol, int rotate_angle); +ZINT_EXTERN int ZBarcode_Encode_and_Print_Rotated(struct zint_symbol *symbol, unsigned char *input, int rotate_angle); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ZINT_H */ diff --git a/MemDisplayAndEdit.cpp b/MemDisplayAndEdit.cpp index f62f2e7..44ee685 100644 --- a/MemDisplayAndEdit.cpp +++ b/MemDisplayAndEdit.cpp @@ -1,151 +1,151 @@ -#include "MemDisplayAndEdit.h" -#include "ui_memdisplayandedit.h" -#include "QLatin1Char" -MemDisplayAndEdit::MemDisplayAndEdit(QWidget *parent) : - QWidget(parent), - ui(new Ui::MemDisplayAndEdit) -{ - ui->setupUi(this); - for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ - memLineEdit[i] = new QLineEdit(this); - //memLineEdit[i]->setAccessibleName(QString::number(i)); - memLineEdit[i]->setEnabled(false); - ui->gridLayoutMem->addWidget(memLineEdit[i],(i/MEM_GRID_MAX_COL) + 1,(i%MEM_GRID_MAX_COL) + 1); - connect(memLineEdit[i],SIGNAL(editingFinished ()),this,SLOT(onLineEditEditingFinished())); - } - for(int i = 0; i < MEM_GRID_MAX_ROW; i++){ - rowLabel[i] = new QLabel(this); - ui->gridLayoutMem->addWidget(rowLabel[i],i + 1,0); - } - editFlag = false; - writeMemMode = false; - ui->radioButtonRead->setChecked(!writeMemMode); - ui->radioButtonWrite->setChecked(writeMemMode); - writeMemBaseAddr = 0; - readMemBaseAddr = 0; -} - -MemDisplayAndEdit::~MemDisplayAndEdit() -{ - delete ui; - - -} - -void MemDisplayAndEdit::updateSysStatusToUI(void){ - if(sysPara && !editFlag){ - for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ - if(writeMemMode) - memLineEdit[i]->setText(QString("%1").arg(sysPara->devOp->memWrMap[(writeMemBaseAddr + i)&MAX_WR_MEM_SIZE_MASK],2,16,QLatin1Char('0'))); - else - memLineEdit[i]->setText(QString("%1").arg(sysPara->devOp->memRdMap[(readMemBaseAddr + i)&MAX_RD_MEM_SIZE_MASK],2,16,QLatin1Char('0'))); - } - for(int i = 0; i < MEM_GRID_MAX_ROW; i++){ - if(writeMemMode) - rowLabel[i]->setText(QString("%1").arg((writeMemBaseAddr + i*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK,4,16,QLatin1Char('0'))); - else - rowLabel[i]->setText(QString("%1").arg((readMemBaseAddr + i*MEM_GRID_MAX_COL)&MAX_RD_MEM_SIZE_MASK,4,16,QLatin1Char('0'))); - } - } -} - - -void MemDisplayAndEdit::on_comboBoxBaseAddress_activated(const QString &str) -{ - bool ok; - if(writeMemMode){ - writeMemBaseAddr = str.toInt(&ok,0); - } - else - readMemBaseAddr = str.toInt(&ok,0); -} - -void MemDisplayAndEdit::on_radioButtonRead_pressed() -{ - writeMemMode = false; - if(sysPara){ - ui->pushButtonEdit->setEnabled(sysPara->devOp->fpgaDevOpenFlag?false:true); - } - if(editFlag) - on_pushButtonEdit_pressed(); - ui->comboBoxBaseAddress->setEditText(QString("0x%1").arg(readMemBaseAddr,4,16,QLatin1Char('0'))); -} - -void MemDisplayAndEdit::on_radioButtonWrite_pressed() -{ - writeMemMode = true; - ui->pushButtonEdit->setEnabled(true); - if(editFlag) - on_pushButtonEdit_pressed(); - ui->comboBoxBaseAddress->setEditText(QString("0x%1").arg(writeMemBaseAddr,4,16,QLatin1Char('0'))); -} - -void MemDisplayAndEdit::on_pushButtonEdit_pressed() -{ - editFlag = !editFlag; - for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ - memLineEdit[i]->setEnabled(editFlag); - } - ui->pushButtonEdit->setText(editFlag?tr("完成"):tr("编辑")); -} - -void MemDisplayAndEdit::on_pushButtonLastPage_pressed() -{ - if(writeMemMode){ - writeMemBaseAddr = (writeMemBaseAddr - MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; - } - else - readMemBaseAddr = (readMemBaseAddr - MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; -} - -void MemDisplayAndEdit::on_pushButtonNextPage_pressed() -{ - if(writeMemMode){ - writeMemBaseAddr = (writeMemBaseAddr + MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; - } - else - readMemBaseAddr = (readMemBaseAddr + MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_RD_MEM_SIZE_MASK; -} - -unsigned char dataOfTempVal[1]; - -void MemDisplayAndEdit::onLineEditEditingFinished(){ - int val,addr; - bool ok; - QLineEdit * edit = qobject_cast(sender()); - QString name ="" ;// edit->accessibleName(); - val = edit->text().toInt(&ok,16); - dataOfTempVal[0]=val; - if(sysPara){ - if(writeMemMode){ - addr = writeMemBaseAddr + name.toInt(&ok); - sysPara->devOp->fpgaWr(addr,dataOfTempVal,1); - } - else { - if(!sysPara->devOp->fpgaDevOpenFlag){ - addr = readMemBaseAddr + name.toInt(&ok); - sysPara->devOp->memRdMap[(addr)&MAX_RD_MEM_SIZE_MASK] = (unsigned char)val; - } - } - } - -} - - - - -void MemDisplayAndEdit::on_lineEditDec_editingFinished() -{ - bool ok; - QLineEdit * edit = qobject_cast(sender()); - unsigned int val = edit->text().toUInt(&ok,10); - ui->lineEditHex->setText(QString("%1").arg(val,0,16)); -} - -void MemDisplayAndEdit::on_lineEditHex_editingFinished() -{ - bool ok; - QLineEdit * edit = qobject_cast(sender()); - unsigned int val = edit->text().toUInt(&ok,16); - ui->lineEditDec->setText(QString("%1").arg(val,0,10)); -} +#include "MemDisplayAndEdit.h" +#include "ui_memdisplayandedit.h" +#include "QLatin1Char" +MemDisplayAndEdit::MemDisplayAndEdit(QWidget *parent) : + QWidget(parent), + ui(new Ui::MemDisplayAndEdit) +{ + ui->setupUi(this); + for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ + memLineEdit[i] = new QLineEdit(this); + //memLineEdit[i]->setAccessibleName(QString::number(i)); + memLineEdit[i]->setEnabled(false); + ui->gridLayoutMem->addWidget(memLineEdit[i],(i/MEM_GRID_MAX_COL) + 1,(i%MEM_GRID_MAX_COL) + 1); + connect(memLineEdit[i],SIGNAL(editingFinished ()),this,SLOT(onLineEditEditingFinished())); + } + for(int i = 0; i < MEM_GRID_MAX_ROW; i++){ + rowLabel[i] = new QLabel(this); + ui->gridLayoutMem->addWidget(rowLabel[i],i + 1,0); + } + editFlag = false; + writeMemMode = false; + ui->radioButtonRead->setChecked(!writeMemMode); + ui->radioButtonWrite->setChecked(writeMemMode); + writeMemBaseAddr = 0; + readMemBaseAddr = 0; +} + +MemDisplayAndEdit::~MemDisplayAndEdit() +{ + delete ui; + + +} + +void MemDisplayAndEdit::updateSysStatusToUI(void){ + if(sysPara && !editFlag){ + for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ + if(writeMemMode) + memLineEdit[i]->setText(QString("%1").arg(sysPara->devOp->memWrMap[(writeMemBaseAddr + i)&MAX_WR_MEM_SIZE_MASK],2,16,QLatin1Char('0'))); + else + memLineEdit[i]->setText(QString("%1").arg(sysPara->devOp->memRdMap[(readMemBaseAddr + i)&MAX_RD_MEM_SIZE_MASK],2,16,QLatin1Char('0'))); + } + for(int i = 0; i < MEM_GRID_MAX_ROW; i++){ + if(writeMemMode) + rowLabel[i]->setText(QString("%1").arg((writeMemBaseAddr + i*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK,4,16,QLatin1Char('0'))); + else + rowLabel[i]->setText(QString("%1").arg((readMemBaseAddr + i*MEM_GRID_MAX_COL)&MAX_RD_MEM_SIZE_MASK,4,16,QLatin1Char('0'))); + } + } +} + + +void MemDisplayAndEdit::on_comboBoxBaseAddress_activated(const QString &str) +{ + bool ok; + if(writeMemMode){ + writeMemBaseAddr = str.toInt(&ok,0); + } + else + readMemBaseAddr = str.toInt(&ok,0); +} + +void MemDisplayAndEdit::on_radioButtonRead_pressed() +{ + writeMemMode = false; + if(sysPara){ + ui->pushButtonEdit->setEnabled(sysPara->devOp->fpgaDevOpenFlag?false:true); + } + if(editFlag) + on_pushButtonEdit_pressed(); + ui->comboBoxBaseAddress->setEditText(QString("0x%1").arg(readMemBaseAddr,4,16,QLatin1Char('0'))); +} + +void MemDisplayAndEdit::on_radioButtonWrite_pressed() +{ + writeMemMode = true; + ui->pushButtonEdit->setEnabled(true); + if(editFlag) + on_pushButtonEdit_pressed(); + ui->comboBoxBaseAddress->setEditText(QString("0x%1").arg(writeMemBaseAddr,4,16,QLatin1Char('0'))); +} + +void MemDisplayAndEdit::on_pushButtonEdit_pressed() +{ + editFlag = !editFlag; + for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ + memLineEdit[i]->setEnabled(editFlag); + } + ui->pushButtonEdit->setText(editFlag?tr("完成"):tr("编辑")); +} + +void MemDisplayAndEdit::on_pushButtonLastPage_pressed() +{ + if(writeMemMode){ + writeMemBaseAddr = (writeMemBaseAddr - MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; + } + else + readMemBaseAddr = (readMemBaseAddr - MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; +} + +void MemDisplayAndEdit::on_pushButtonNextPage_pressed() +{ + if(writeMemMode){ + writeMemBaseAddr = (writeMemBaseAddr + MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_WR_MEM_SIZE_MASK; + } + else + readMemBaseAddr = (readMemBaseAddr + MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL)&MAX_RD_MEM_SIZE_MASK; +} + +unsigned char dataOfTempVal[1]; + +void MemDisplayAndEdit::onLineEditEditingFinished(){ + int val,addr; + bool ok; + QLineEdit * edit = qobject_cast(sender()); + QString name ="" ;// edit->accessibleName(); + val = edit->text().toInt(&ok,16); + dataOfTempVal[0]=val; + if(sysPara){ + if(writeMemMode){ + addr = writeMemBaseAddr + name.toInt(&ok); + sysPara->devOp->fpgaWr(addr,dataOfTempVal,1); + } + else { + if(!sysPara->devOp->fpgaDevOpenFlag){ + addr = readMemBaseAddr + name.toInt(&ok); + sysPara->devOp->memRdMap[(addr)&MAX_RD_MEM_SIZE_MASK] = (unsigned char)val; + } + } + } + +} + + + + +void MemDisplayAndEdit::on_lineEditDec_editingFinished() +{ + bool ok; + QLineEdit * edit = qobject_cast(sender()); + unsigned int val = edit->text().toUInt(&ok,10); + ui->lineEditHex->setText(QString("%1").arg(val,0,16)); +} + +void MemDisplayAndEdit::on_lineEditHex_editingFinished() +{ + bool ok; + QLineEdit * edit = qobject_cast(sender()); + unsigned int val = edit->text().toUInt(&ok,16); + ui->lineEditDec->setText(QString("%1").arg(val,0,10)); +} diff --git a/MemDisplayAndEdit.h b/MemDisplayAndEdit.h index 20f8de2..b1c0d8c 100644 --- a/MemDisplayAndEdit.h +++ b/MemDisplayAndEdit.h @@ -1,56 +1,56 @@ -#ifndef MEMDISPLAYANDEDIT_H -#define MEMDISPLAYANDEDIT_H - -#include -#include -#include -#include -#define MEM_GRID_MAX_ROW 5 -#define MEM_GRID_MAX_COL 16 -namespace Ui { -class MemDisplayAndEdit; -} - -class MemDisplayAndEdit : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit MemDisplayAndEdit(QWidget *parent = 0); - ~MemDisplayAndEdit(); - - void updateSysStatusToUI(void); - -private slots: - void on_comboBoxBaseAddress_activated(const QString &arg1); - - void on_radioButtonRead_pressed(); - - void on_radioButtonWrite_pressed(); - - void on_pushButtonEdit_pressed(); - - void on_pushButtonLastPage_pressed(); - - void on_pushButtonNextPage_pressed(); - void onLineEditEditingFinished(); - - - void on_lineEditDec_editingFinished(); - - void on_lineEditHex_editingFinished(); - -private: - Ui::MemDisplayAndEdit *ui; - - QLineEdit *memLineEdit[MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL]; - QLabel *rowLabel[MEM_GRID_MAX_ROW]; - - bool editFlag; //是否当前处于编辑模式 - bool writeMemMode; //是否当前处于写地址模式 - int writeMemBaseAddr; - int readMemBaseAddr; - -}; - -#endif // MEMDISPLAYANDEDIT_H +#ifndef MEMDISPLAYANDEDIT_H +#define MEMDISPLAYANDEDIT_H + +#include +#include +#include +#include +#define MEM_GRID_MAX_ROW 5 +#define MEM_GRID_MAX_COL 16 +namespace Ui { +class MemDisplayAndEdit; +} + +class MemDisplayAndEdit : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit MemDisplayAndEdit(QWidget *parent = 0); + ~MemDisplayAndEdit(); + + void updateSysStatusToUI(void); + +private slots: + void on_comboBoxBaseAddress_activated(const QString &arg1); + + void on_radioButtonRead_pressed(); + + void on_radioButtonWrite_pressed(); + + void on_pushButtonEdit_pressed(); + + void on_pushButtonLastPage_pressed(); + + void on_pushButtonNextPage_pressed(); + void onLineEditEditingFinished(); + + + void on_lineEditDec_editingFinished(); + + void on_lineEditHex_editingFinished(); + +private: + Ui::MemDisplayAndEdit *ui; + + QLineEdit *memLineEdit[MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL]; + QLabel *rowLabel[MEM_GRID_MAX_ROW]; + + bool editFlag; //是否当前处于编辑模式 + bool writeMemMode; //是否当前处于写地址模式 + int writeMemBaseAddr; + int readMemBaseAddr; + +}; + +#endif // MEMDISPLAYANDEDIT_H diff --git a/MyFileDialog.cpp b/MyFileDialog.cpp index 503d52c..1e42a83 100644 --- a/MyFileDialog.cpp +++ b/MyFileDialog.cpp @@ -1,57 +1,57 @@ -/* - * MyFileDialog.cpp - * - * Created on: Jul 14, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "MyFileDialog.h" -#include "SysPara.h" -#include -#include -#include -MyFileDialog::MyFileDialog(QWidget *parent):QFileDialog(parent){ - setFileMode(QFileDialog::AnyFile); - //setLabelText(QFileDialog::LookIn,tr("文件夹")); -// setLabelText(QFileDialog::FileName,tr("文件名")); -// setLabelText(QFileDialog::FileType,tr("文件类型")); - setLabelText(QFileDialog::Accept,tr("确定")); -// setLabelText(QFileDialog::Reject,tr("取消")); - setViewMode(QFileDialog::Detail); - setOption(QFileDialog::ReadOnly,true); - //setOption(QFileDialog::DontUseNativeDialog,true); - - QList urls; - urls << QUrl::fromLocalFile(DOC_ROOT_DIR) ;//<< QUrl::fromLocalFile(UDISK_DOC_ROOT_DIR) ; - setSidebarUrls (urls ); - this->setFixedSize(this->geometry().width(),this->geometry().height()); -} - -MyFileDialog::~MyFileDialog(){ - -} - -void MyFileDialog::showFileDialog(QString title,QString dir,QString filter){ - setNameFilter(filter); - setDirectory (dir); - setWindowTitle(title); - //autoCompleteFileName("dfdfs"); - - setViewMode(QFileDialog::Detail); - //setOption(QFileDialog::ReadOnly,true); - //setOption(QFileDialog::DontUseSheet,true); - //setOption(QFileDialog::HideNameFilterDetails,true); - //setResolveSymlinks(0); - if(isMinimized()){ - setWindowState(Qt::WindowMaximized); - } - show(); - QWidget *widget = focusWidget () ; - if(widget){ - widget->clearFocus(); //默认不要弹出输入法 - } - -} +/* + * MyFileDialog.cpp + * + * Created on: Jul 14, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#include "MyFileDialog.h" +#include "SysPara.h" +#include +#include +#include +MyFileDialog::MyFileDialog(QWidget *parent):QFileDialog(parent){ + setFileMode(QFileDialog::AnyFile); + //setLabelText(QFileDialog::LookIn,tr("文件夹")); +// setLabelText(QFileDialog::FileName,tr("文件名")); +// setLabelText(QFileDialog::FileType,tr("文件类型")); + setLabelText(QFileDialog::Accept,tr("确定")); +// setLabelText(QFileDialog::Reject,tr("取消")); + setViewMode(QFileDialog::Detail); + setOption(QFileDialog::ReadOnly,true); + //setOption(QFileDialog::DontUseNativeDialog,true); + + QList urls; + urls << QUrl::fromLocalFile(DOC_ROOT_DIR) ;//<< QUrl::fromLocalFile(UDISK_DOC_ROOT_DIR) ; + setSidebarUrls (urls ); + this->setFixedSize(this->geometry().width(),this->geometry().height()); +} + +MyFileDialog::~MyFileDialog(){ + +} + +void MyFileDialog::showFileDialog(QString title,QString dir,QString filter){ + setNameFilter(filter); + setDirectory (dir); + setWindowTitle(title); + //autoCompleteFileName("dfdfs"); + + setViewMode(QFileDialog::Detail); + //setOption(QFileDialog::ReadOnly,true); + //setOption(QFileDialog::DontUseSheet,true); + //setOption(QFileDialog::HideNameFilterDetails,true); + //setResolveSymlinks(0); + if(isMinimized()){ + setWindowState(Qt::WindowMaximized); + } + show(); + QWidget *widget = focusWidget () ; + if(widget){ + widget->clearFocus(); //默认不要弹出输入法 + } + +} diff --git a/MyFileDialog.h b/MyFileDialog.h index 37f45c7..b0c5909 100644 --- a/MyFileDialog.h +++ b/MyFileDialog.h @@ -1,28 +1,28 @@ -/* - * MyFileDialog.h - * - * Created on: Jul 14, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef MYFILEDIALOG_H_ -#define MYFILEDIALOG_H_ - - -#include - -class MyFileDialog:public QFileDialog{ - - Q_OBJECT - -public: - MyFileDialog(QWidget *parent = 0); - ~MyFileDialog(); - - void showFileDialog(QString title,QString filter,QString dir); -}; - -#endif /* MYFILEDIALOG_H_ */ +/* + * MyFileDialog.h + * + * Created on: Jul 14, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef MYFILEDIALOG_H_ +#define MYFILEDIALOG_H_ + + +#include + +class MyFileDialog:public QFileDialog{ + + Q_OBJECT + +public: + MyFileDialog(QWidget *parent = 0); + ~MyFileDialog(); + + void showFileDialog(QString title,QString filter,QString dir); +}; + +#endif /* MYFILEDIALOG_H_ */ diff --git a/MyInputMethod.cpp b/MyInputMethod.cpp index 1ee6add..e0f9ef9 100644 --- a/MyInputMethod.cpp +++ b/MyInputMethod.cpp @@ -1,159 +1,159 @@ -/* - * MyInputMethod.cpp - * - * Created on: Jun 23, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - - -#include "MyInputMethod.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Public.h" -#include -#include -#include -#include "InkJetPrinter.h" -extern InkJetPrinter *pInkJectPrinter; -MyInputMethod::MyInputMethod(QWidget *parent) - :QObject(parent) -{ - InputMethod *input = new InputMethod(this,parent); - QString filename = Public::readLanguageType(); - input->initInputMethod(filename); - inputMethod = input; - digitalInput = new DigitalInput(this,parent); -} -void MyInputMethod::SetInputFile(QString filename){ - inputMethod->initInputMethod(filename); -} - -InputMethod* MyInputMethod::getInputMethod() -{ - return inputMethod; -} - - -//bool MyInputMethod::filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ){ -// qDebug() << "MyInputMethod::filter "; -// return true; -//} - - -MyInputMethod::~MyInputMethod(){ - delete inputMethod; - delete digitalInput; -} -void MyInputMethod::sendString(QString &str){ -#ifndef Q_OS_WIN32 - QWidget *watched = QApplication::focusWidget(); - QSpinBox *qsb=qobject_cast(watched); - QLineEdit *qle=qobject_cast(watched); - QTextEdit *qte=qobject_cast(watched); - if(qle)qle->insert(str); - if(qte)qte->insertPlainText(str); - - if(qsb) - { - const QObjectList objectList=qsb->children(); - foreach (QObject * const obj, objectList) { - if(QLineEdit * const qcle=qobject_cast(obj)) - { - qcle->insert(str); - break; - } - } - } -#endif -} - -void MyInputMethod::updateHandler ( int type ){ - QWidget *widget = QApplication::focusWidget(); -#ifndef Q_OS_WIN32 - switch(type){ - case 0:break; - case 1: - if (widget && dynamic_cast(widget)) { - int a = 0; - } - if(widget && dynamic_cast(widget)){ - if(digitalInput->isHidden()){ - QRect rec = QApplication::desktop()->screenGeometry(); - QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标 - QRect myRec = digitalInput->geometry(); - digitalInput->setGeometry((point.x() > rec.width()/2)?(point.x() - myRec.width() - 20):(point.x() + 20), - (point.y() > rec.height()/2)?(point.y() - myRec.height() - 20):(point.y() + 20), - myRec.width(),myRec.height()); - digitalInput->show(); - - } - } - else { - if(inputMethod->isHidden()){ - //QCursor cursor(Qt::PointingHandCursor); - //inputMethod->setCursor(cursor); - QRect rec = QApplication::desktop()->screenGeometry(); - QRect myRec = inputMethod->geometry(); - if(widget){ - QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标 - QPoint topLeft=pInkJectPrinter->pos(); - if(point.y() < rec.height()/2) /*如果组件在上,则将输入法放在上面,否则放在下面*/ - inputMethod->setGeometry(topLeft.x(),rec.height() - myRec.height(),myRec.width(),myRec.height()); - // inputMethod->setGeometry(0,rec.height() - myRec.height()-12,myRec.width(),myRec.height()); - else - // inputMethod->setGeometry(0,0,myRec.width(),myRec.height()); - inputMethod->setGeometry(topLeft.x(),30,myRec.width(),myRec.height()); - inputMethod->show(); - } - } - } - break; - case 2://QWSInputMethod::FocusOut: - inputMethod->hide(); - digitalInput->hide(); - inputMethod->onHiden(); - break; - } -#endif - -} - -void MyInputMethod::switchBangalInput(bool flag){ - inputMethod->switchKeyBoardBengalDisply(flag); -} - - #ifdef EnableArabic -void MyInputMethod::getArabicFlag(bool flag){ - inputMethod->setArabicDisplay(flag); -} - -void MyInputMethod::getArabicPage(int page){ - emit selectArabicPage(page); -} - -void MyInputMethod::getEnglishOrAarbic(bool flag){ - emit switchEnglishOrArabic(flag); - } - - void MyInputMethod::switchArabicFlag(bool flag){ - inputMethod->setSwitchArabicFlag(flag); - } -#endif - - void MyInputMethod::sendEvent(int key,Qt::KeyboardModifiers modifiers) - { - QKeyEvent pressEvent(QEvent::KeyPress, key, modifiers); - QKeyEvent releaseEvent(QEvent::KeyRelease, key, modifiers); - QCoreApplication::sendEvent(QApplication::focusWidget(), &pressEvent); - QCoreApplication::sendEvent(QApplication::focusWidget(), &releaseEvent); - } +/* + * MyInputMethod.cpp + * + * Created on: Jun 23, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + + +#include "MyInputMethod.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Public.h" +#include +#include +#include +#include "InkJetPrinter.h" +extern InkJetPrinter *pInkJectPrinter; +MyInputMethod::MyInputMethod(QWidget *parent) + :QObject(parent) +{ + InputMethod *input = new InputMethod(this,parent); + QString filename = Public::readLanguageType(); + input->initInputMethod(filename); + inputMethod = input; + digitalInput = new DigitalInput(this,parent); +} +void MyInputMethod::SetInputFile(QString filename){ + inputMethod->initInputMethod(filename); +} + +InputMethod* MyInputMethod::getInputMethod() +{ + return inputMethod; +} + + +//bool MyInputMethod::filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ){ +// qDebug() << "MyInputMethod::filter "; +// return true; +//} + + +MyInputMethod::~MyInputMethod(){ + delete inputMethod; + delete digitalInput; +} +void MyInputMethod::sendString(QString &str){ +#ifndef Q_OS_WIN32 + QWidget *watched = QApplication::focusWidget(); + QSpinBox *qsb=qobject_cast(watched); + QLineEdit *qle=qobject_cast(watched); + QTextEdit *qte=qobject_cast(watched); + if(qle)qle->insert(str); + if(qte)qte->insertPlainText(str); + + if(qsb) + { + const QObjectList objectList=qsb->children(); + foreach (QObject * const obj, objectList) { + if(QLineEdit * const qcle=qobject_cast(obj)) + { + qcle->insert(str); + break; + } + } + } +#endif +} + +void MyInputMethod::updateHandler ( int type ){ + QWidget *widget = QApplication::focusWidget(); +#ifndef Q_OS_WIN32 + switch(type){ + case 0:break; + case 1: + if (widget && dynamic_cast(widget)) { + int a = 0; + } + if(widget && dynamic_cast(widget)){ + if(digitalInput->isHidden()){ + QRect rec = QApplication::desktop()->screenGeometry(); + QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标 + QRect myRec = digitalInput->geometry(); + digitalInput->setGeometry((point.x() > rec.width()/2)?(point.x() - myRec.width() - 20):(point.x() + 20), + (point.y() > rec.height()/2)?(point.y() - myRec.height() - 20):(point.y() + 20), + myRec.width(),myRec.height()); + digitalInput->show(); + + } + } + else { + if(inputMethod->isHidden()){ + //QCursor cursor(Qt::PointingHandCursor); + //inputMethod->setCursor(cursor); + QRect rec = QApplication::desktop()->screenGeometry(); + QRect myRec = inputMethod->geometry(); + if(widget){ + QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标 + QPoint topLeft=pInkJectPrinter->pos(); + if(point.y() < rec.height()/2) /*如果组件在上,则将输入法放在上面,否则放在下面*/ + inputMethod->setGeometry(topLeft.x(),rec.height() - myRec.height(),myRec.width(),myRec.height()); + // inputMethod->setGeometry(0,rec.height() - myRec.height()-12,myRec.width(),myRec.height()); + else + // inputMethod->setGeometry(0,0,myRec.width(),myRec.height()); + inputMethod->setGeometry(topLeft.x(),30,myRec.width(),myRec.height()); + inputMethod->show(); + } + } + } + break; + case 2://QWSInputMethod::FocusOut: + inputMethod->hide(); + digitalInput->hide(); + inputMethod->onHiden(); + break; + } +#endif + +} + +void MyInputMethod::switchBangalInput(bool flag){ + inputMethod->switchKeyBoardBengalDisply(flag); +} + + #ifdef EnableArabic +void MyInputMethod::getArabicFlag(bool flag){ + inputMethod->setArabicDisplay(flag); +} + +void MyInputMethod::getArabicPage(int page){ + emit selectArabicPage(page); +} + +void MyInputMethod::getEnglishOrAarbic(bool flag){ + emit switchEnglishOrArabic(flag); + } + + void MyInputMethod::switchArabicFlag(bool flag){ + inputMethod->setSwitchArabicFlag(flag); + } +#endif + + void MyInputMethod::sendEvent(int key,Qt::KeyboardModifiers modifiers) + { + QKeyEvent pressEvent(QEvent::KeyPress, key, modifiers); + QKeyEvent releaseEvent(QEvent::KeyRelease, key, modifiers); + QCoreApplication::sendEvent(QApplication::focusWidget(), &pressEvent); + QCoreApplication::sendEvent(QApplication::focusWidget(), &releaseEvent); + } diff --git a/MyInputMethod.h b/MyInputMethod.h index db37db5..11e16d2 100644 --- a/MyInputMethod.h +++ b/MyInputMethod.h @@ -1,57 +1,57 @@ -/* - * MyInputMethod.h - * - * Created on: Jun 23, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef MYINPUTMETHOD_H_ -#define MYINPUTMETHOD_H_ - -#include "InputMethod.h" -#include "DigitalInput.h" -#ifndef Q_OS_WIN32 -//#include -//#include -//#include "myinclude.h" -class MyInputMethod:public QObject//QWSInputMethod -{ - Q_OBJECT -#else -class MyInputMethod -{ -#endif - -public: - MyInputMethod(QWidget *parent = 0); - ~MyInputMethod(); - - void updateHandler ( int type ); - void sendString(QString &str); - void SetInputFile(QString filename="WINPY_utf8.txt"); - InputMethod* getInputMethod(); -#ifdef EnableArabic - void getArabicPage(int page); - void getEnglishOrAarbic(bool flag); -#endif - static void sendEvent(int key,Qt::KeyboardModifiers modifiers); -private slots: - void switchBangalInput(bool); - -#ifdef EnableArabic -public slots: - void getArabicFlag(bool); - void switchArabicFlag(bool flag); - -signals: - void selectArabicPage(int); - void switchEnglishOrArabic(bool); -#endif -private: - InputMethod *inputMethod; - DigitalInput *digitalInput; -}; -#endif /* MYINPUTMETHOD_H_ */ +/* + * MyInputMethod.h + * + * Created on: Jun 23, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef MYINPUTMETHOD_H_ +#define MYINPUTMETHOD_H_ + +#include "InputMethod.h" +#include "DigitalInput.h" +#ifndef Q_OS_WIN32 +//#include +//#include +//#include "myinclude.h" +class MyInputMethod:public QObject//QWSInputMethod +{ + Q_OBJECT +#else +class MyInputMethod +{ +#endif + +public: + MyInputMethod(QWidget *parent = 0); + ~MyInputMethod(); + + void updateHandler ( int type ); + void sendString(QString &str); + void SetInputFile(QString filename="WINPY_utf8.txt"); + InputMethod* getInputMethod(); +#ifdef EnableArabic + void getArabicPage(int page); + void getEnglishOrAarbic(bool flag); +#endif + static void sendEvent(int key,Qt::KeyboardModifiers modifiers); +private slots: + void switchBangalInput(bool); + +#ifdef EnableArabic +public slots: + void getArabicFlag(bool); + void switchArabicFlag(bool flag); + +signals: + void selectArabicPage(int); + void switchEnglishOrArabic(bool); +#endif +private: + InputMethod *inputMethod; + DigitalInput *digitalInput; +}; +#endif /* MYINPUTMETHOD_H_ */ diff --git a/MyTextEdit.cpp b/MyTextEdit.cpp index 65ac0e4..ad9d3b0 100644 --- a/MyTextEdit.cpp +++ b/MyTextEdit.cpp @@ -1,143 +1,143 @@ -/* - * MyTextEdit.cpp - * - * Created on: Aug 7, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - - - - -#include -#include "SysPara.h" -#include -#include -#include -#include -#include -#include -//#include -#include -MyTextEdit::MyTextEdit(QWidget *parent):QTextEdit(parent){ - this->document()->setDocumentMargin(0); -// QTextDocument *doc = this->document(); //获取文档对象 - -// QTextFrame *rootFrame = doc->rootFrame(); //获取根框架 - -// QTextFrameFormat frameFormat; //创建框架格式 - -// frameFormat.setBorderBrush(Qt::red); //设置边界颜色 - -// frameFormat.setBorder(0); //设置边界宽度 - -// rootFrame->setFrameFormat(frameFormat); //给框架使用格式 - - //this->setTextInteractionFlags(Qt::TextEditable);//不能选中 - this->setLineWrapMode(QTextEdit::NoWrap); - for(QTextBlock textBlock = this->document()->begin(); - textBlock != this->document()->end(); - textBlock = textBlock.next()){ - QTextBlockFormat textBlockFormat = textBlock.blockFormat(); - textBlockFormat.setBottomMargin(0); - QTextCursor textCursor = this->textCursor(); - textCursor.setBlockFormat(textBlockFormat); - this->setTextCursor(textCursor); - } -} - - -void MyTextEdit::dragEnterEvent ( QDragEnterEvent * e ){ - e->ignore(); -} -void MyTextEdit::dragLeaveEvent ( QDragLeaveEvent * e ){ - e->ignore(); -} -void MyTextEdit::dragMoveEvent ( QDragMoveEvent * e ){ - e->ignore(); -} -void MyTextEdit::mouseDoubleClickEvent ( QMouseEvent * e ){ - e->ignore(); -} - - void MyTextEdit::mousePressEvent(QMouseEvent * e) - { - //获取点击的下标 -// qDebug() << e->x() << ":" << e->y(); - - if(this->toPlainText().length()>1 && cursorForPosition(e->pos()).atEnd()) - { - int textHeight=this->height(); - QPoint currentPt=e->pos(); - QTextCursor textCursor=cursorForPosition(currentPt); - while(textCursor.atEnd() && 0<--textHeight && 0width(); - currentPt.setX(e->pos().x()); - currentPt.setY(currentPt.y()-5); - textCursor=cursorForPosition(currentPt); - while(textCursor.atEnd() && 0<--textWidth && 0pos().x()+8); - this->setTextCursor(cursorForPosition(currentPt)); - return; - } - } - - if(e->button() == Qt::LeftButton) - { - -// QWSServer::sendKeyEvent(0,Qt::Key_Left1,Qt::NoModifier,true,false); -// QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 -// QWSServer::sendKeyEvent(0,Qt::Key_Right1,Qt::NoModifier,true,false); -// QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); - - - //setCursor(); - //QTextCursor textCursor = this->textCursor(); - //textCursor.clearSelection(); - //textCursor.setPosition(e->x()); - //textCursor.setBlockFormat(textBlockFormat); - //this->setTextCursor(textCursor); - - } -// if(e->button() == Qt::RightButton) -// { -// e->ignore(); -// } -// else - { - QTextEdit::mousePressEvent(e); - } - } - - -//bool MyTextEdit::qwsEvent ( QWSEvent * event ){ -//} -//void MyTextEdit::mouseMoveEvent ( QMouseEvent * e ){ -// //e->ignore(); -//} -// -//void MyTextEdit::changeEvent ( QEvent * event ){ -// if(event->type()==QEvent::FontChange) -// { -// } -// QTextEdit::changeEvent(event); -//} - -//void MyTextEdit::mouseReleaseEvent(QMouseEvent * e) -//{ -// QTextCursor textCursor = this->textCursor(); -// textCursor.clearSelection(); -// QTextEdit::mouseReleaseEvent(e); -//} - +/* + * MyTextEdit.cpp + * + * Created on: Aug 7, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + + + + +#include +#include "SysPara.h" +#include +#include +#include +#include +#include +#include +//#include +#include +MyTextEdit::MyTextEdit(QWidget *parent):QTextEdit(parent){ + this->document()->setDocumentMargin(0); +// QTextDocument *doc = this->document(); //获取文档对象 + +// QTextFrame *rootFrame = doc->rootFrame(); //获取根框架 + +// QTextFrameFormat frameFormat; //创建框架格式 + +// frameFormat.setBorderBrush(Qt::red); //设置边界颜色 + +// frameFormat.setBorder(0); //设置边界宽度 + +// rootFrame->setFrameFormat(frameFormat); //给框架使用格式 + + //this->setTextInteractionFlags(Qt::TextEditable);//不能选中 + this->setLineWrapMode(QTextEdit::NoWrap); + for(QTextBlock textBlock = this->document()->begin(); + textBlock != this->document()->end(); + textBlock = textBlock.next()){ + QTextBlockFormat textBlockFormat = textBlock.blockFormat(); + textBlockFormat.setBottomMargin(0); + QTextCursor textCursor = this->textCursor(); + textCursor.setBlockFormat(textBlockFormat); + this->setTextCursor(textCursor); + } +} + + +void MyTextEdit::dragEnterEvent ( QDragEnterEvent * e ){ + e->ignore(); +} +void MyTextEdit::dragLeaveEvent ( QDragLeaveEvent * e ){ + e->ignore(); +} +void MyTextEdit::dragMoveEvent ( QDragMoveEvent * e ){ + e->ignore(); +} +void MyTextEdit::mouseDoubleClickEvent ( QMouseEvent * e ){ + e->ignore(); +} + + void MyTextEdit::mousePressEvent(QMouseEvent * e) + { + //获取点击的下标 +// qDebug() << e->x() << ":" << e->y(); + + if(this->toPlainText().length()>1 && cursorForPosition(e->pos()).atEnd()) + { + int textHeight=this->height(); + QPoint currentPt=e->pos(); + QTextCursor textCursor=cursorForPosition(currentPt); + while(textCursor.atEnd() && 0<--textHeight && 0width(); + currentPt.setX(e->pos().x()); + currentPt.setY(currentPt.y()-5); + textCursor=cursorForPosition(currentPt); + while(textCursor.atEnd() && 0<--textWidth && 0pos().x()+8); + this->setTextCursor(cursorForPosition(currentPt)); + return; + } + } + + if(e->button() == Qt::LeftButton) + { + +// QWSServer::sendKeyEvent(0,Qt::Key_Left1,Qt::NoModifier,true,false); +// QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 +// QWSServer::sendKeyEvent(0,Qt::Key_Right1,Qt::NoModifier,true,false); +// QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); + + + //setCursor(); + //QTextCursor textCursor = this->textCursor(); + //textCursor.clearSelection(); + //textCursor.setPosition(e->x()); + //textCursor.setBlockFormat(textBlockFormat); + //this->setTextCursor(textCursor); + + } +// if(e->button() == Qt::RightButton) +// { +// e->ignore(); +// } +// else + { + QTextEdit::mousePressEvent(e); + } + } + + +//bool MyTextEdit::qwsEvent ( QWSEvent * event ){ +//} +//void MyTextEdit::mouseMoveEvent ( QMouseEvent * e ){ +// //e->ignore(); +//} +// +//void MyTextEdit::changeEvent ( QEvent * event ){ +// if(event->type()==QEvent::FontChange) +// { +// } +// QTextEdit::changeEvent(event); +//} + +//void MyTextEdit::mouseReleaseEvent(QMouseEvent * e) +//{ +// QTextCursor textCursor = this->textCursor(); +// textCursor.clearSelection(); +// QTextEdit::mouseReleaseEvent(e); +//} + diff --git a/MyTextEdit.h b/MyTextEdit.h index 9fccb35..403d4a0 100644 --- a/MyTextEdit.h +++ b/MyTextEdit.h @@ -1,39 +1,39 @@ -/* - * MyTextEdit.h - * - * Created on: Aug 7, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef MYTEXTEDIT_H_ -#define MYTEXTEDIT_H_ - -#include -#include -//#include -class MyTextEdit:public QTextEdit{ - - Q_OBJECT - -public: - explicit MyTextEdit(QWidget *parent = 0); - -protected: - void dragEnterEvent ( QDragEnterEvent * e ); - void dragLeaveEvent ( QDragLeaveEvent * e ); - void dragMoveEvent ( QDragMoveEvent * e ); - void mouseDoubleClickEvent ( QMouseEvent * e ); - void mousePressEvent(QMouseEvent * e); -// void mouseReleaseEvent(QMouseEvent *e); -// void changeEvent ( QEvent * event ); -// void mouseMoveEvent ( QMouseEvent * e ); -// void keyPressEvent(QKeyEvent * event); -// bool qwsEvent ( QWSEvent * event ); -}; - - - -#endif /* MYTEXTEDIT_H_ */ +/* + * MyTextEdit.h + * + * Created on: Aug 7, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef MYTEXTEDIT_H_ +#define MYTEXTEDIT_H_ + +#include +#include +//#include +class MyTextEdit:public QTextEdit{ + + Q_OBJECT + +public: + explicit MyTextEdit(QWidget *parent = 0); + +protected: + void dragEnterEvent ( QDragEnterEvent * e ); + void dragLeaveEvent ( QDragLeaveEvent * e ); + void dragMoveEvent ( QDragMoveEvent * e ); + void mouseDoubleClickEvent ( QMouseEvent * e ); + void mousePressEvent(QMouseEvent * e); +// void mouseReleaseEvent(QMouseEvent *e); +// void changeEvent ( QEvent * event ); +// void mouseMoveEvent ( QMouseEvent * e ); +// void keyPressEvent(QKeyEvent * event); +// bool qwsEvent ( QWSEvent * event ); +}; + + + +#endif /* MYTEXTEDIT_H_ */ diff --git a/Network/IPEdit/IPEdit.cpp b/Network/IPEdit/IPEdit.cpp index 9163c37..27092c3 100644 --- a/Network/IPEdit/IPEdit.cpp +++ b/Network/IPEdit/IPEdit.cpp @@ -1,160 +1,160 @@ -#include "IPEdit.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -IPEdit::IPEdit(QWidget *parent) : QWidget(parent) -{ - init(); -} - -IPEdit::~IPEdit() -{ - -} - -void IPEdit::init() -{ - m_layout = new QHBoxLayout(this); - m_layout->setSpacing(3); - m_layout->setContentsMargins(2, 0, 2, 0); - - m_edit1 = new QLineEdit(this); - m_edit2 = new QLineEdit(this); - m_edit3 = new QLineEdit(this); - m_edit4 = new QLineEdit(this); - - initForEdit(m_edit1); - initForEdit(m_edit2); - initForEdit(m_edit3); - initForEdit(m_edit4); - - m_dot1 = new QLabel(".", this); - m_dot2 = new QLabel(".", this); - m_dot3 = new QLabel(".", this); - - m_layout->addWidget(m_edit1, 1); - m_layout->addWidget(m_dot1); - m_layout->addWidget(m_edit2, 1); - m_layout->addWidget(m_dot2); - m_layout->addWidget(m_edit3, 1); - m_layout->addWidget(m_dot3); - m_layout->addWidget(m_edit4, 1); -} - -void IPEdit::initForEdit(QLineEdit* edit) -{ - edit->setFrame(false); - edit->setAlignment(Qt::AlignCenter); - edit->installEventFilter(this); - - QRegExpValidator* validator = new QRegExpValidator(QRegExp("^(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$"), this); - edit->setValidator(validator); - - connect(edit, SIGNAL(textChanged(const QString&)), this, SLOT(editTextChanged(const QString&))); -} - -QLineEdit* IPEdit::nextEdit(QLineEdit* curEdit) -{ - if (curEdit == m_edit1) - return m_edit2; - else if (curEdit == m_edit2) - return m_edit3; - else if (curEdit == m_edit3) - return m_edit4; - else - return NULL; -} - -bool IPEdit::isEdit(QObject* object) -{ - return (object == m_edit1 || - object == m_edit2 || - object == m_edit3 || - object == m_edit4); -} - -QString IPEdit::text() -{ - QString sec1 = m_edit1->text().isEmpty() ? "0" : m_edit1->text(); - QString sec2 = m_edit2->text().isEmpty() ? "0" : m_edit2->text(); - QString sec3 = m_edit3->text().isEmpty() ? "0" : m_edit3->text(); - QString sec4 = m_edit4->text().isEmpty() ? "0" : m_edit4->text(); - return QString("%1.%2.%3.%4").arg(sec1).arg(sec2).arg(sec3).arg(sec4); -} - -void IPEdit::setText(const QString& text) -{ - QRegExp reg("^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$"); - if (!reg.exactMatch(text)) - return; - - QStringList ips = text.split("."); - m_edit1->setText(ips.at(0)); - m_edit2->setText(ips.at(1)); - m_edit3->setText(ips.at(2)); - m_edit4->setText(ips.at(3)); -} - -void IPEdit::paintEvent(QPaintEvent* event) -{ - QPainter painter(this); - - QStyleOptionFrame option; - option.initFrom(this); - option.lineWidth = 1; - style()->drawPrimitive(QStyle::PE_PanelLineEdit, &option, &painter, this); - QWidget::paintEvent(event); -} - -bool IPEdit::eventFilter(QObject* object, QEvent* event) -{ - if (isEdit(object)) - { - if (event->type() == QEvent::KeyPress) - { - QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Period) - { - QLineEdit* next = nextEdit(qobject_cast(object)); - if (next) - { - next->setFocus(); - next->selectAll(); - } - } - else if (keyEvent->matches(QKeySequence::Paste)) - { - QString clip = QApplication::clipboard()->text(QClipboard::Clipboard); - if (clip.split(".").size() == 4) - { - setText(clip); - return true; - } - } - } - } - - return QWidget::eventFilter(object, event); -} - -void IPEdit::editTextChanged(const QString& text) -{ - QLineEdit* curEdit = qobject_cast(sender()); - if (text.size() == 3) - { - QLineEdit* next = nextEdit(curEdit); - if (next) - { - next->setFocus(); - next->selectAll(); - } - } -} +#include "IPEdit.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IPEdit::IPEdit(QWidget *parent) : QWidget(parent) +{ + init(); +} + +IPEdit::~IPEdit() +{ + +} + +void IPEdit::init() +{ + m_layout = new QHBoxLayout(this); + m_layout->setSpacing(3); + m_layout->setContentsMargins(2, 0, 2, 0); + + m_edit1 = new QLineEdit(this); + m_edit2 = new QLineEdit(this); + m_edit3 = new QLineEdit(this); + m_edit4 = new QLineEdit(this); + + initForEdit(m_edit1); + initForEdit(m_edit2); + initForEdit(m_edit3); + initForEdit(m_edit4); + + m_dot1 = new QLabel(".", this); + m_dot2 = new QLabel(".", this); + m_dot3 = new QLabel(".", this); + + m_layout->addWidget(m_edit1, 1); + m_layout->addWidget(m_dot1); + m_layout->addWidget(m_edit2, 1); + m_layout->addWidget(m_dot2); + m_layout->addWidget(m_edit3, 1); + m_layout->addWidget(m_dot3); + m_layout->addWidget(m_edit4, 1); +} + +void IPEdit::initForEdit(QLineEdit* edit) +{ + edit->setFrame(false); + edit->setAlignment(Qt::AlignCenter); + edit->installEventFilter(this); + + QRegExpValidator* validator = new QRegExpValidator(QRegExp("^(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$"), this); + edit->setValidator(validator); + + connect(edit, SIGNAL(textChanged(const QString&)), this, SLOT(editTextChanged(const QString&))); +} + +QLineEdit* IPEdit::nextEdit(QLineEdit* curEdit) +{ + if (curEdit == m_edit1) + return m_edit2; + else if (curEdit == m_edit2) + return m_edit3; + else if (curEdit == m_edit3) + return m_edit4; + else + return NULL; +} + +bool IPEdit::isEdit(QObject* object) +{ + return (object == m_edit1 || + object == m_edit2 || + object == m_edit3 || + object == m_edit4); +} + +QString IPEdit::text() +{ + QString sec1 = m_edit1->text().isEmpty() ? "0" : m_edit1->text(); + QString sec2 = m_edit2->text().isEmpty() ? "0" : m_edit2->text(); + QString sec3 = m_edit3->text().isEmpty() ? "0" : m_edit3->text(); + QString sec4 = m_edit4->text().isEmpty() ? "0" : m_edit4->text(); + return QString("%1.%2.%3.%4").arg(sec1).arg(sec2).arg(sec3).arg(sec4); +} + +void IPEdit::setText(const QString& text) +{ + QRegExp reg("^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$"); + if (!reg.exactMatch(text)) + return; + + QStringList ips = text.split("."); + m_edit1->setText(ips.at(0)); + m_edit2->setText(ips.at(1)); + m_edit3->setText(ips.at(2)); + m_edit4->setText(ips.at(3)); +} + +void IPEdit::paintEvent(QPaintEvent* event) +{ + QPainter painter(this); + + QStyleOptionFrame option; + option.initFrom(this); + option.lineWidth = 1; + style()->drawPrimitive(QStyle::PE_PanelLineEdit, &option, &painter, this); + QWidget::paintEvent(event); +} + +bool IPEdit::eventFilter(QObject* object, QEvent* event) +{ + if (isEdit(object)) + { + if (event->type() == QEvent::KeyPress) + { + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Period) + { + QLineEdit* next = nextEdit(qobject_cast(object)); + if (next) + { + next->setFocus(); + next->selectAll(); + } + } + else if (keyEvent->matches(QKeySequence::Paste)) + { + QString clip = QApplication::clipboard()->text(QClipboard::Clipboard); + if (clip.split(".").size() == 4) + { + setText(clip); + return true; + } + } + } + } + + return QWidget::eventFilter(object, event); +} + +void IPEdit::editTextChanged(const QString& text) +{ + QLineEdit* curEdit = qobject_cast(sender()); + if (text.size() == 3) + { + QLineEdit* next = nextEdit(curEdit); + if (next) + { + next->setFocus(); + next->selectAll(); + } + } +} diff --git a/Network/IPEdit/IPEdit.h b/Network/IPEdit/IPEdit.h index 6753ef4..017e272 100644 --- a/Network/IPEdit/IPEdit.h +++ b/Network/IPEdit/IPEdit.h @@ -1,44 +1,44 @@ -#ifndef IPEDIT_H -#define IPEDIT_H - -#include -#include -#include -#include -#include -#include - -class IPEdit : public QWidget -{ - Q_OBJECT -public: - explicit IPEdit(QWidget *parent = 0); - ~IPEdit(); - - QString text(); - void setText(const QString& text); - -protected: - void init(); - void initForEdit(QLineEdit* edit); - QLineEdit* nextEdit(QLineEdit* curEdit); - bool isEdit(QObject* object); - - virtual void paintEvent(QPaintEvent* event); - virtual bool eventFilter(QObject* object, QEvent* event); - -protected slots: - void editTextChanged(const QString& text); - -private: - QBoxLayout* m_layout; - QLineEdit* m_edit1; - QLineEdit* m_edit2; - QLineEdit* m_edit3; - QLineEdit* m_edit4; - QLabel* m_dot1; - QLabel* m_dot2; - QLabel* m_dot3; -}; - -#endif // IPEDIT_H +#ifndef IPEDIT_H +#define IPEDIT_H + +#include +#include +#include +#include +#include +#include + +class IPEdit : public QWidget +{ + Q_OBJECT +public: + explicit IPEdit(QWidget *parent = 0); + ~IPEdit(); + + QString text(); + void setText(const QString& text); + +protected: + void init(); + void initForEdit(QLineEdit* edit); + QLineEdit* nextEdit(QLineEdit* curEdit); + bool isEdit(QObject* object); + + virtual void paintEvent(QPaintEvent* event); + virtual bool eventFilter(QObject* object, QEvent* event); + +protected slots: + void editTextChanged(const QString& text); + +private: + QBoxLayout* m_layout; + QLineEdit* m_edit1; + QLineEdit* m_edit2; + QLineEdit* m_edit3; + QLineEdit* m_edit4; + QLabel* m_dot1; + QLabel* m_dot2; + QLabel* m_dot3; +}; + +#endif // IPEDIT_H diff --git a/Network/IPEdit/README.md b/Network/IPEdit/README.md index fc861c1..59b6011 100644 --- a/Network/IPEdit/README.md +++ b/Network/IPEdit/README.md @@ -1,9 +1,9 @@ -# 用法 -``` cpp - IPEdit* ipEdit = new IPEdit(this); - ipEdit->setGeometry(10, 10, 130, 25); - ipEdit->show(); - - ipEdit->setText("255.255.255.0"); - QString text = ipEdit->text(); +# 用法 +``` cpp + IPEdit* ipEdit = new IPEdit(this); + ipEdit->setGeometry(10, 10, 130, 25); + ipEdit->show(); + + ipEdit->setText("255.255.255.0"); + QString text = ipEdit->text(); ``` \ No newline at end of file diff --git a/Network/NetworkManager.cpp b/Network/NetworkManager.cpp index 99f1861..8686ae6 100644 --- a/Network/NetworkManager.cpp +++ b/Network/NetworkManager.cpp @@ -1,1819 +1,1819 @@ -#include "NetworkManager.h" -#include "ui_NetworkManager.h" -#include -#include -#include -#include -#include "myinclude.h" -#include "dirent.h" -#include "common/wpa_ctrl.h" -#define LANINTERFACE_NAME "eth0" - -#ifdef Q_OS_WIN -#include -#include -#include -#pragma comment(lib, "ws2_32.lib") -#pragma comment(lib, "Wbemuuid.lib") -#else -#define BUFSIZE 8192 -#include -#include -#include -#include -#include -#include "LogInfo.h" -#include -#include - -struct route_info { - in_addr dstAddr; - in_addr srcAddr; - in_addr gateWay; - char ifName[IF_NAMESIZE]; -}; - -int readNlSock(int sockFd, char *bufPtr, unsigned int seqNum, int pId) { - struct nlmsghdr *nlHdr; - int readLen = 0, msgLen = 0; - do { - if ((readLen = recv(sockFd, bufPtr, BUFSIZE - msgLen, 0)) < 0) { - perror("SOCK READ: "); - return -1; - } - nlHdr = (struct nlmsghdr *)bufPtr; - if ((NLMSG_OK(nlHdr, readLen) == 0) || (nlHdr->nlmsg_type == NLMSG_ERROR)) { - perror("Error in received packet"); - return -1; - } - if (nlHdr->nlmsg_type == NLMSG_DONE) - break; - - bufPtr += readLen; - msgLen += readLen; - - if ((nlHdr->nlmsg_flags & NLM_F_MULTI) == 0) - break; - - } while ((nlHdr->nlmsg_seq != seqNum) || (nlHdr->nlmsg_pid != (unsigned)pId)); - return msgLen; -} - -void parseRoutes(struct nlmsghdr *nlHdr, struct route_info *rtInfo) { - struct rtmsg *rtMsg = (struct rtmsg *)NLMSG_DATA(nlHdr); - - if ((rtMsg->rtm_family != AF_INET) || (rtMsg->rtm_table != RT_TABLE_MAIN)) - return; - - struct rtattr *rtAttr = (struct rtattr *)RTM_RTA(rtMsg); - int rtLen = RTM_PAYLOAD(nlHdr); - for (; RTA_OK(rtAttr, rtLen); rtAttr = RTA_NEXT(rtAttr, rtLen)) { - switch (rtAttr->rta_type) { - case RTA_OIF: - if_indextoname(*(int *)RTA_DATA(rtAttr), rtInfo->ifName); - break; - case RTA_GATEWAY: - rtInfo->gateWay = *(in_addr *)RTA_DATA(rtAttr); - break; - case RTA_PREFSRC: - rtInfo->srcAddr = *(in_addr *)RTA_DATA(rtAttr); - break; - case RTA_DST: - rtInfo->dstAddr = *(in_addr *)RTA_DATA(rtAttr); - break; - } - } -} -#endif - -class NetworkHelper { -public: - static QString DefaultGateway() { - QString ret; -#ifdef Q_OS_WIN - CoInitialize(NULL); - if (CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) != S_OK) - return ret; - - IWbemLocator *pLoc = NULL; - if (CoCreateInstance(CLSID_WbemAdministrativeLocator, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IUnknown, (void **)&pLoc) != S_OK) - return ret; - - IWbemServices *pSvc = NULL; - if (pLoc->ConnectServer(L"root\\cimv2", NULL, NULL, NULL, 0, NULL, NULL, &pSvc) != S_OK) - return ret; - - IEnumWbemClassObject *pEnumerator = NULL; - HRESULT hr = pSvc->ExecQuery(L"WQL", L"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'", WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); - if (FAILED(hr)) { - pSvc->Release(); - pLoc->Release(); - CoUninitialize(); - return ret; - } - - IWbemClassObject *pclsObj = NULL; - while (pEnumerator && ret.isEmpty()) { - _variant_t vaDefaultIPGateway; - ULONG uReturn; - hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); - if (!uReturn) - break; - - hr = pclsObj->Get(L"DefaultIPGateway", 0, &vaDefaultIPGateway, NULL, NULL); - if (hr == WBEM_S_NO_ERROR && vaDefaultIPGateway.vt != VT_NULL) { - LONG lLow = 0; - LONG lUp = 0; - ::SafeArrayGetLBound(vaDefaultIPGateway.parray, 1, &lLow); - ::SafeArrayGetUBound(vaDefaultIPGateway.parray, 1, &lUp); - for (LONG i = lLow; i <= lUp; i++) { - BSTR bsDefaultIPGateway; - if (::SafeArrayGetElement(vaDefaultIPGateway.parray, &i, &bsDefaultIPGateway) == S_OK) { - ret = QString::fromUtf16(reinterpret_cast(bsDefaultIPGateway)); - ::SysFreeString(bsDefaultIPGateway); - break; - } - } - } - VariantClear(&vaDefaultIPGateway); - } - - if (pclsObj) - pclsObj->Release(); - if (pEnumerator) - pEnumerator->Release(); - if (pSvc) - pSvc->Release(); - if (pLoc) - pLoc->Release(); - CoUninitialize(); -#else - int sock, msgSeq = 0; - if ((sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) { - perror("Socket Creation: "); - return ret; - } - - char msgBuf[BUFSIZE]; - memset(msgBuf, 0, BUFSIZE); - struct nlmsghdr *nlMsg = (struct nlmsghdr *)msgBuf; - - nlMsg->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); - nlMsg->nlmsg_type = RTM_GETROUTE; - - nlMsg->nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; - nlMsg->nlmsg_seq = msgSeq++; - nlMsg->nlmsg_pid = getpid(); - - if (send(sock, nlMsg, nlMsg->nlmsg_len, 0) < 0) - return ret; - - int len; - if ((len = readNlSock(sock, msgBuf, msgSeq, getpid())) < 0) - return ret; - - struct route_info *rtInfo = (struct route_info *)malloc(sizeof(struct route_info)); - - for (; NLMSG_OK(nlMsg, len); nlMsg = NLMSG_NEXT(nlMsg, len)) { - memset(rtInfo, 0, sizeof(struct route_info)); - parseRoutes(nlMsg, rtInfo); - - if (strstr((char *)inet_ntoa(rtInfo->dstAddr), "0.0.0.0") && !strstr((char *)inet_ntoa(rtInfo->gateWay), "0.0.0.0")) { - char buf[64]; - inet_ntop(AF_INET, &rtInfo->gateWay, buf, sizeof(buf)); - ret = QString(buf); - break; - } - } - - free(rtInfo); - close(sock); -#endif - return ret; - } -}; - -NetworkManager::NetworkManager(QWidget *parent) : - QWidget(parent), - ui(new Ui::NetworkManager) -{ - ui->setupUi(this); - - Json_ip_init_done =false; - net_data = new PrintNet(); - - connect(net_data,SIGNAL(json_server_error()),this,SLOT(onjson_server_error())); - connect(net_data,SIGNAL(receiveJSONDatafinish()),this,SLOT(onfinish_get_json())); - connect(net_data,SIGNAL(showMessege()),this,SLOT(ShowNet_dataMessege())); - - QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); - QRegExpValidator *pValidator = new QRegExpValidator(regExp, this); - -// ui->lineEditLanGW->setValidator(new QRegExpValidator(pValidator)); -// ui->lineEditLanGW->setInputMask("000.000.000.000;"); - - ui->spinBoxLanIP3->setDisabled(true); - ui->spinBoxLanIP2->setDisabled(true); - ui->spinBoxLanIP1->setDisabled(true); - ui->spinBoxLanIP0->setDisabled(true); - ui->spinBoxLanMask3->setDisabled(true); - ui->spinBoxLanMask2->setDisabled(true); - ui->spinBoxLanMask1->setDisabled(true); - ui->spinBoxLanMask0->setDisabled(true); -// ui->lineEditLanGW->setDisabled(true); - ui->spinBoxLanGW3->setDisabled(true); - ui->spinBoxLanGW2->setDisabled(true); - ui->spinBoxLanGW1->setDisabled(true); - ui->spinBoxLanGW0->setDisabled(true); - ui->pushButtonSetCancel->setDisabled(true); - - connect(ui->networkSelect, SIGNAL(activated(const QString&)), this, - SLOT(selectNetwork(const QString&))); - ctrl_iface = NULL; - ctrl_conn = NULL; - monitor_conn = NULL; - msgNotifier = NULL; - ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); - - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(ping())); - timer->setSingleShot(false); - timer->start(3000); - - Json_timer = new QTimer(this); - connect(Json_timer, SIGNAL(timeout()), SLOT(onjson_timer_handler())); - Json_timer->stop(); - Jsom_timer_stop =true; -// Json_timer->start(1000); - - wlanStartUpFailed = false; - if (openCtrlConnection(ctrl_iface) < 0) { - qDebug()<<"Failed to open control connection to " - "wpa_supplicant."; - wlanStartUpFailed = true; - } - - if(wlanStartUpFailed) - return; - updateStatus(); - networkMayHaveChanged = true; - updateNetworks(); - updateSysStatusToUI(); -} - -NetworkManager::~NetworkManager() -{ - delete ui; - //delete processNetwork; -} - -void NetworkManager::onfinish_get_json() -{ - - net_data->getJson_data(&sysPara->Get_JSON_DATA); - - if(Jsom_timer_stop == true){ - - Json_timer->start(1000); - Jsom_timer_stop = false; - } - - - ui->messege_info_label->setText( net_data->getMessege() ); - - emit updateJSONData(); -} - -void NetworkManager::ShowNet_dataMessege() -{ - ui->messege_info_label->setText( net_data->getMessege()); -} - -void NetworkManager::bindSysPara(SysPara *sysPara){ - this->sysPara = sysPara; - const QString cip=getCurrentNetworkIP(); - qDebug()<deviceID_lineEdit->setText(QString(sysPara->para.Json_device_code)); - QString ip_str; - ip_str = QString::number(sysPara->para.Json_IP[0]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[1]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[2]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[3]); - ui->SeverIP_lineEdit->setText(ip_str); - ui->server_port_lineEdit->setText(QString::number(sysPara->para.Json_server_port)); - - } - - ui->checkBoxRemoveCode->setCheckState(sysPara->para.isRemoveCode ? Qt::Checked : Qt::Unchecked); - ui->checkBoxRemoveDigitCode->setCheckState(sysPara->para.isRemoveDigitCode ? Qt::Checked : Qt::Unchecked); - ui->radioButtonGetDataEnable->setChecked(sysPara->para.isEnableGetDataButton); - - QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); - //获取所有网络接口的列表 - foreach(QNetworkInterface interface,list) - { - if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) - { - QList entryList = interface.addressEntries(); - //获取IP地址条目列表,每个条目中包含一个IP地址,一个子网掩码和一个广播地址 - foreach(QNetworkAddressEntry entry,entryList) - { - QStringList lanIpList = entry.ip().toString().split("."); - if (lanIpList.size() == 4) { - ui->spinBoxLanIP3->setValue(lanIpList.at(0).toInt()); - ui->spinBoxLanIP2->setValue(lanIpList.at(1).toInt()); - ui->spinBoxLanIP1->setValue(lanIpList.at(2).toInt()); - ui->spinBoxLanIP0->setValue(lanIpList.at(3).toInt()); - } - else if (lanIpList.size() == 0) { - ui->spinBoxLanIP3->setValue(0); - ui->spinBoxLanIP2->setValue(0); - ui->spinBoxLanIP1->setValue(0); - ui->spinBoxLanIP0->setValue(0); - } - QStringList lanMaskList = entry.netmask().toString().split("."); - if (lanMaskList.size() == 4) { - ui->spinBoxLanMask3->setValue(lanMaskList.at(0).toInt()); - ui->spinBoxLanMask2->setValue(lanMaskList.at(1).toInt()); - ui->spinBoxLanMask1->setValue(lanMaskList.at(2).toInt()); - ui->spinBoxLanMask0->setValue(lanMaskList.at(3).toInt()); - } - else if (lanMaskList.size() == 0) { - ui->spinBoxLanMask3->setValue(0); - ui->spinBoxLanMask2->setValue(0); - ui->spinBoxLanMask1->setValue(0); - ui->spinBoxLanMask0->setValue(0); - } - //ui->lineEditLanGW->setText(entry.netmask().toString()); - QString GatewayAddr = NetworkHelper::DefaultGateway(); - //ui->lineEditLanGW->setText(GatewayAddr); - QStringList lanGWList = GatewayAddr.split("."); - if (lanGWList.size() == 4) { - ui->spinBoxLanGW3->setValue(lanGWList.at(0).toInt()); - ui->spinBoxLanGW2->setValue(lanGWList.at(1).toInt()); - ui->spinBoxLanGW1->setValue(lanGWList.at(2).toInt()); - ui->spinBoxLanGW0->setValue(lanGWList.at(3).toInt()); - } - else if (lanGWList.size() == 0) { - ui->spinBoxLanGW3->setValue(0); - ui->spinBoxLanGW2->setValue(0); - ui->spinBoxLanGW1->setValue(0); - ui->spinBoxLanGW0->setValue(0); - } - return; - } - } - } - //ui->radioButtonGetDataEnable->setChecked(ui->radioButtonGetDataEnable ? true: false); - } - -} -#define INTERFACE_OTHERS "# The loopback interface \n\ - auto lo \n\ - iface lo inet loopback \n\ - \n \ - # Wireless interfaces \n\ - auto wlan0 \n\ - iface wlan0 inet dhcp \n\ - wireless_mode managed \n\ - wireless_essid any \n\ - wpa-driver wext \n\ - wpa-conf /etc/wpa_supplicant.conf\n" - -void NetworkManager::applyLanUIPara(void) -{ - - if(sysPara){ - QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); - //获取所有网络接口的列表 - foreach(QNetworkInterface interface,list) { - if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) - { - uint8_t ip3 = ui->spinBoxLanIP3->value(); - uint8_t ip2 = ui->spinBoxLanIP2->value(); - uint8_t ip1 = ui->spinBoxLanIP1->value(); - uint8_t ip0 = ui->spinBoxLanIP0->value(); - uint8_t lanMask3 = ui->spinBoxLanMask3->value(); - uint8_t lanMask2 = ui->spinBoxLanMask2->value(); - uint8_t lanMask1 = ui->spinBoxLanMask1->value(); - uint8_t lanMask0 = ui->spinBoxLanMask0->value(); - uint8_t lanGW0 = ui->spinBoxLanGW0->value(); - QString ipAddrStr(QString("%1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0)); - QString netMaskStr(QString("%1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0)); -// QHostAddress ipAddr(ipAddrStr); -// QHostAddress netMask(netMaskStr); - qDebug() << "set ip:"<start("ifconfig", QStringList() << LANINTERFACE_NAME << "192.168.1.100"); - //startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, - // qint64 *pid = 0) - QStringList argrList; - if (!(ip3|ip2|ip1|ip0)) { - // 动态IP - //qDebug() << "set dhcp"; - QProcess dhcpProcess; - dhcpProcess.startDetached("/bin/cp /etc/network/interfaces_dhcp /etc/network/interfaces", argrList); - argrList<< LANINTERFACE_NAME << ipAddrStr; - - } - else { - - // 静态IP - QFile netInterface("/etc/network/interfaces"); - netInterface.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Truncate); - if (netInterface.isOpen()) { - QTextStream stream(&netInterface); - stream.seek(0); - stream << INTERFACE_OTHERS; - stream << " " <<"\n"; - stream << "# eth0 interfaces" <<"\n"; - stream << "auto eth0" <<"\n"; - stream << "iface eth0 inet static" <<"\n"; - stream << QString("address %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0) <<"\n"; - stream << QString("gateway %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(lanGW0) <<"\n"; - stream << QString("netmask %1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0) <<"\n"; - stream << " \n"; - netInterface.close(); - } - argrList<< LANINTERFACE_NAME << ipAddrStr << "netmask" << netMaskStr; - system("sudo systemctl restart networking"); - } - return; - } - } - } - -} - -qint32 NetworkManager::isIpv4Address(QString ip) -{ - QRegExp regExp("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - if( !regExp.exactMatch(ip) ) - { - return false; - } - return true; -} - -void NetworkManager::on_pushButtonSetIP_clicked(bool checked) -{ - if(sysPara){ - if(sysPara->status.bLanConfigManual) - { - applyLanUIPara(); - ui->pushButtonSetIP->setText(QObject::tr("手动设定")); - ui->spinBoxLanIP3->setDisabled(true); - ui->spinBoxLanIP2->setDisabled(true); - ui->spinBoxLanIP1->setDisabled(true); - ui->spinBoxLanIP0->setDisabled(true); - ui->spinBoxLanMask3->setDisabled(true); - ui->spinBoxLanMask2->setDisabled(true); - ui->spinBoxLanMask1->setDisabled(true); - ui->spinBoxLanMask0->setDisabled(true); - ui->spinBoxLanGW0->setDisabled(true); - ui->pushButtonSetCancel->setDisabled(true); - sysPara->status.bLanConfigManual = false; - } - else - { - sysPara->status.bLanConfigManual = true; - ui->spinBoxLanIP3->setDisabled(false); - ui->spinBoxLanIP2->setDisabled(false); - ui->spinBoxLanIP1->setDisabled(false); - ui->spinBoxLanIP0->setDisabled(false); - ui->spinBoxLanMask3->setDisabled(false); - ui->spinBoxLanMask2->setDisabled(false); - ui->spinBoxLanMask1->setDisabled(false); - ui->spinBoxLanMask0->setDisabled(false); - ui->spinBoxLanGW0->setDisabled(false); - ui->pushButtonSetIP->setText(QObject::tr("应用")); - ui->pushButtonSetCancel->setDisabled(false); - } - } -} - -void NetworkManager::on_pushButtonSetCancel_clicked(bool checked) -{ - - if(sysPara){ - if(sysPara->status.bLanConfigManual) - { - sysPara->status.bLanConfigManual = false; - ui->spinBoxLanIP3->setDisabled(true); - ui->spinBoxLanIP2->setDisabled(true); - ui->spinBoxLanIP1->setDisabled(true); - ui->spinBoxLanIP0->setDisabled(true); - ui->spinBoxLanMask3->setDisabled(true); - ui->spinBoxLanMask2->setDisabled(true); - ui->spinBoxLanMask1->setDisabled(true); - ui->spinBoxLanMask0->setDisabled(true); - ui->pushButtonSetCancel->setDisabled(true); - ui->pushButtonSetIP->setText(QObject::tr("手动设定")); - } - } - -} - -int NetworkManager::openCtrlConnection(const char *ifname) -{ - char *cfile; - int flen; -// char buf[2048], *pos, *pos2; -// size_t len; - - if (ifname) { - if (ifname != ctrl_iface) { - free(ctrl_iface); - ctrl_iface = strdup(ifname); - } - } else { -#ifdef CONFIG_CTRL_IFACE_UDP - free(ctrl_iface); - ctrl_iface = strdup("udp"); -#endif /* CONFIG_CTRL_IFACE_UDP */ -#ifdef CONFIG_CTRL_IFACE_UNIX - struct dirent *dent; - DIR *dir = opendir(ctrl_iface_dir); - free(ctrl_iface); - ctrl_iface = NULL; - if (dir) { - while ((dent = readdir(dir))) { -#ifdef _DIRENT_HAVE_D_TYPE - /* Skip the file if it is not a socket. - * Also accept DT_UNKNOWN (0) in case - * the C library or underlying file - * system does not support d_type. */ - if (dent->d_type != DT_SOCK && - dent->d_type != DT_UNKNOWN) - continue; -#endif /* _DIRENT_HAVE_D_TYPE */ - - if (strcmp(dent->d_name, ".") == 0 || - strcmp(dent->d_name, "..") == 0) - continue; - printf("Selected interface '%s'\n", - dent->d_name); - ctrl_iface = strdup(dent->d_name); - break; - } - closedir(dir); - } -#endif /* CONFIG_CTRL_IFACE_UNIX */ -#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE - struct wpa_ctrl *ctrl; - int ret; - - free(ctrl_iface); - ctrl_iface = NULL; - - ctrl = wpa_ctrl_open(NULL); - if (ctrl) { - len = sizeof(buf) - 1; - ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf, - &len, NULL); - if (ret >= 0) { - connectedToService = true; - buf[len] = '\0'; - pos = strchr(buf, '\n'); - if (pos) - *pos = '\0'; - ctrl_iface = strdup(buf); - } - wpa_ctrl_close(ctrl); - } -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ - } - - if (ctrl_iface == NULL) { -#ifdef CONFIG_NATIVE_WINDOWS - static bool first = true; - if (first && !serviceRunning()) { - first = false; - if (QMessageBox::warning( - this, qAppName(), - tr("wpa_supplicant service is not " - "running.\n" - "Do you want to start it?"), - QMessageBox::Yes | QMessageBox::No) == - QMessageBox::Yes) - startService(); - } -#endif /* CONFIG_NATIVE_WINDOWS */ - return -1; - } - -#ifdef CONFIG_CTRL_IFACE_UNIX - flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2; - cfile = (char *) malloc(flen); - if (cfile == NULL) - return -1; - snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface); -#else /* CONFIG_CTRL_IFACE_UNIX */ - flen = strlen(ctrl_iface) + 1; - cfile = (char *) malloc(flen); - if (cfile == NULL) - return -1; - snprintf(cfile, flen, "%s", ctrl_iface); -#endif /* CONFIG_CTRL_IFACE_UNIX */ - - if (ctrl_conn) { - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - } - - if (monitor_conn) { - delete msgNotifier; - msgNotifier = NULL; - wpa_ctrl_detach(monitor_conn); - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - } - - printf("Trying to connect to '%s'\n", cfile); - ctrl_conn = wpa_ctrl_open(cfile); - if (ctrl_conn == NULL) { - free(cfile); - return -1; - } - monitor_conn = wpa_ctrl_open(cfile); - free(cfile); - if (monitor_conn == NULL) { - wpa_ctrl_close(ctrl_conn); - return -1; - } - if (wpa_ctrl_attach(monitor_conn)) { - printf("Failed to attach to wpa_supplicant\n"); - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - return -1; - } - -#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP) - msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn), - QSocketNotifier::Read, this); - connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs())); -#endif - printf("network out to '%s'\n", cfile); - return 0; -} - - -int NetworkManager::ctrlRequest(const char *cmd, char *buf, size_t *buflen) -{ - int ret; - - if (ctrl_conn == NULL) - return -3; - ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen, NULL); - if (ret == -2) - printf("'%s' command timed out.\n", cmd); - else if (ret < 0) - printf("'%s' command failed.\n", cmd); - - return ret; -} -QString NetworkManager::wpaStateTranslate(char *state) -{ - - if (!strcmp(state, "DISCONNECTED")) - { - //QProcess process; - //process.startDetached("killall udhcpc"); - return tr("Disconnected"); - } - else if (!strcmp(state, "INACTIVE")) - return tr("Inactive"); - else if (!strcmp(state, "SCANNING")) - return tr("Scanning"); - else if (!strcmp(state, "AUTHENTICATING")) - return tr("Authenticating"); - else if (!strcmp(state, "ASSOCIATING")) - return tr("Associating"); - else if (!strcmp(state, "ASSOCIATED")) - return tr("Associated"); - else if (!strcmp(state, "4WAY_HANDSHAKE")) - return tr("4-Way Handshake"); - else if (!strcmp(state, "GROUP_HANDSHAKE")) - return tr("Group Handshake"); - else if (!strcmp(state, "COMPLETED")) - { - QProcess process; - process.startDetached("/home/plg/checkUdhcpcRun.sh"); - return tr("Completed"); - } - else - - return tr("Unknown"); -} -void NetworkManager::updateStatus() -{ - - char buf[2048], *start, *end, *pos; - size_t len; - - pingsToStatusUpdate = 10; - - len = sizeof(buf) - 1; - if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) { - ui->textStatus->setText(tr("Could not get status from " - "wpa_supplicant")); - //ui->textAuthentication->clear(); - //ui->textEncryption->clear(); - ui->textSSID->clear(); - //ui->textBssid->clear(); - ui->textIPAdrr->clear(); - - return; - } - - buf[len] = '\0'; - - bool auth_updated = false, ssid_updated = false; - bool bssid_updated = false, ipaddr_updated = false; - bool status_updated = false; - char *pairwise_cipher = NULL, *group_cipher = NULL; - char *mode = NULL; - - start = buf; - while (*start) { - bool last = false; - end = strchr(start, '\n'); - if (end == NULL) { - last = true; - end = start; - while (end[0] && end[1]) - end++; - } - *end = '\0'; - - pos = strchr(start, '='); - if (pos) { - *pos++ = '\0'; - if (strcmp(start, "bssid") == 0) { - bssid_updated = true; - //textBssid->setText(pos); - } else if (strcmp(start, "ssid") == 0) { - ssid_updated = true; - ui->textSSID->setText(pos); - } else if (strcmp(start, "ip_address") == 0) { - ipaddr_updated = true; - ui->textIPAdrr->setText(pos); - } else if (strcmp(start, "wpa_state") == 0) { - status_updated = true; - ui->textStatus->setText(wpaStateTranslate(pos)); - } else if (strcmp(start, "key_mgmt") == 0) { - auth_updated = true; - //textAuthentication->setText(pos); - /* TODO: could add EAP status to this */ - } else if (strcmp(start, "pairwise_cipher") == 0) { - pairwise_cipher = pos; - } else if (strcmp(start, "group_cipher") == 0) { - group_cipher = pos; - } else if (strcmp(start, "mode") == 0) { - mode = pos; - } - } - - if (last) - break; - start = end + 1; - } - if (status_updated && mode) - ui->textStatus->setText(ui->textStatus->text() + " (" + mode + ")"); - - if (pairwise_cipher || group_cipher) { - QString encr; - if (pairwise_cipher && group_cipher && - strcmp(pairwise_cipher, group_cipher) != 0) { - encr.append(pairwise_cipher); - encr.append(" + "); - encr.append(group_cipher); - } else if (pairwise_cipher) { - encr.append(pairwise_cipher); - } else { - encr.append(group_cipher); - encr.append(" [group key only]"); - } - //textEncryption->setText(encr); - } else - //textEncryption->clear(); - ; - - if (!status_updated) - ui->textStatus->clear(); - //if (!auth_updated) - // textAuthentication->clear(); - if (!ssid_updated) - ui->textSSID->clear(); - //if (!bssid_updated) - // textBssid->clear(); - if (!ipaddr_updated) - ui->textIPAdrr->clear(); - -} - -void NetworkManager::updateNetworks() -{ - - char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; - size_t len; - int first_active = -1; - int was_selected = -1; - bool current = false; - if(wlanStartUpFailed) - return; - if (!networkMayHaveChanged) - return; - - //if (networkList->currentRow() >= 0) - // was_selected = networkList->currentRow(); - - ui->networkSelect->clear(); - //ui->scanSSIDSelect->clear(); - //networkList->clear(); - - if (ctrl_conn == NULL) - return; - - len = sizeof(buf) - 1; - if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0) - return; - - buf[len] = '\0'; - start = strchr(buf, '\n'); - if (start == NULL) - return; - start++; - - while (*start) { - bool last = false; - end = strchr(start, '\n'); - if (end == NULL) { - last = true; - end = start; - while (end[0] && end[1]) - end++; - } - *end = '\0'; - - id = start; - ssid = strchr(id, '\t'); - if (ssid == NULL) - break; - *ssid++ = '\0'; - bssid = strchr(ssid, '\t'); - if (bssid == NULL) - break; - *bssid++ = '\0'; - flags = strchr(bssid, '\t'); - if (flags == NULL) - break; - *flags++ = '\0'; - - if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) { - if (last) - break; - start = end + 1; - continue; - } - - QString network(id); - network.append(": "); - network.append(ssid); - ui->networkSelect->addItem(network); - //networkList->addItem(network); -//scanSSIDSelect - if (strstr(flags, "[CURRENT]")) { - ui->networkSelect->setCurrentIndex(ui->networkSelect->count() - - 1); - current = true; - } else if (first_active < 0 && - strstr(flags, "[DISABLED]") == NULL) - first_active = ui->networkSelect->count() - 1; - - if (last) - break; - start = end + 1; - } - - if (ui->networkSelect->count() > 1) - ui->networkSelect->addItem(tr("Select any network")); - - if (!current && first_active >= 0) - ui->networkSelect->setCurrentIndex(first_active); - networkMayHaveChanged = false; - -} -static int str_match(const char *a, const char *b) -{ - return strncmp(a, b, strlen(b)) == 0; -} - -void NetworkManager::processMsg(char *msg) -{ - - char *pos = msg, *pos2; - int priority = 2; - - if (*pos == '<') { - /* skip priority */ - pos++; - priority = atoi(pos); - pos = strchr(pos, '>'); - if (pos) - pos++; - else - pos = msg; - } - - WpaMsg wm(pos, priority); - //if (eh) - // eh->addEvent(wm); - //if (peers) - // peers->event_notify(wm); - msgs.append(wm); - while (msgs.count() > 100) - msgs.pop_front(); - - /* Update last message with truncated version of the event */ - if (strncmp(pos, "CTRL-", 5) == 0) { - pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' '); - if (pos2) - pos2++; - else - pos2 = pos; - } else - pos2 = pos; - QString lastmsg = pos2; - lastmsg.truncate(40); - //textLastMessage->setText(lastmsg); - - pingsToStatusUpdate = 0; - networkMayHaveChanged = true; - - if (str_match(pos, WPA_CTRL_REQ)) - //processCtrlReq(pos + strlen(WPA_CTRL_REQ)); - ; - else if (str_match(pos, WPA_EVENT_SCAN_RESULTS) && beSentScanCmd) - { - updateResults(); - beSentScanCmd = false; - } - else if (str_match(pos, WPA_EVENT_DISCONNECTED)) - //showTrayMessage(QSystemTrayIcon::Information, 3, - // tr("Disconnected from network.")); - ui->textStatus->setText("Disconnected"); - else if (str_match(pos, WPA_EVENT_CONNECTED)) { - //showTrayMessage(QSystemTrayIcon::Information, 3, - //tr("Connection to network established.")); - //QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus())); - //stopWpsRun(true); - ui->textStatus->setText("Connected"); - } -} -void NetworkManager::receiveMsgs() -{ - char buf[256]; - size_t len; - qDebug()<<"receiveMsgs"; - while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) { - len = sizeof(buf) - 1; - if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) { - buf[len] = '\0'; - processMsg(buf); - } - } -} - - -void NetworkManager::updateResults() -{ - char reply[2048]; - size_t reply_len; - int index; - char cmd[20]; - //qDebug()<<"updateResults"; - //ui->networkSelect->clear(); - ui->scanSSIDSelect->clear(); - scanResultMap.clear(); - - index = 0; - while (1) - { - snprintf(cmd, sizeof(cmd), "BSS %d", index++); - if (index > 1000) - break; - - reply_len = sizeof(reply) - 1; - if (ctrlRequest(cmd, reply, &reply_len) < 0) - break; - reply[reply_len] = '\0'; - - QString bss(reply); - if (bss.isEmpty() || bss.startsWith("FAIL")) - break; - - QString ssid, bssid, freq, signal, flags; - - QStringList lines = bss.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - int pos = (*it).indexOf('=') + 1; - if (pos < 1) - continue; - - if ((*it).startsWith("bssid=")) - bssid = (*it).mid(pos); - else if ((*it).startsWith("freq=")) - freq = (*it).mid(pos); - else if ((*it).startsWith("qual=")) - signal = (*it).mid(pos); - else if ((*it).startsWith("flags=")) - flags = (*it).mid(pos); - else if ((*it).startsWith("ssid=")) - ssid = (*it).mid(pos); - } - ui->scanSSIDSelect->addItem(ssid); - QStringList resultList; - resultList<scanSSIDSelect->addItem(ssid); - } - } - } - - -} - -void NetworkManager::selectSSID( const QString & sel ) -{ - //if (openCtrlConnection(sel.toLatin1().constData()) < 0) - // printf("Failed to open control connection to " - // "wpa_supplicant.\n"); - //updateStatus(); - //updateNetworks(); - -} -int NetworkManager::setNetworkParam(int id, const char *field, - const char *value, bool quote) -{ - char reply[10], cmd[256]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s", - id, field, quote ? "\"" : "", value, quote ? "\"" : ""); - reply_len = sizeof(reply); - ctrlRequest(cmd, reply, &reply_len); - - return strncmp(reply, "OK", 2) == 0 ? 0 : -1; -} -void NetworkManager::addNetwork() -{ - - char reply[10], cmd[256]; - size_t reply_len; - int id; - int psklen = ui->pskEdit->text().length(); - int auth = ui->authSelect->currentIndex(); - - if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) { - if (psklen < 8 || psklen > 64) { - QMessageBox::warning( - this, - tr("WPA Pre-Shared Key Error"), - tr("WPA-PSK requires a passphrase of 8 to 63 " - "characters\n" - "or 64 hex digit PSK")); - ui->pskEdit->setFocus(); - return; - } - } - memset(reply, 0, sizeof(reply)); - reply_len = sizeof(reply) - 1; - - if (1) { - ctrlRequest("ADD_NETWORK", reply, &reply_len); - if (reply[0] == 'F') { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to add " - "network to wpa_supplicant\n" - "configuration.")); - return; - } - id = atoi(reply); - } else - id = edit_network_id; - - //setNetworkParam(id, "ssid", ssidEdit->text().toLatin1().constData(), - // true); - setNetworkParam(id, "ssid", ui->scanSSIDSelect->currentText().toLatin1().constData(), - true); - const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL; - switch (auth) { - case AUTH_NONE_OPEN: - case AUTH_NONE_WEP: - case AUTH_NONE_WEP_SHARED: - key_mgmt = "NONE"; - break; - case AUTH_IEEE8021X: - key_mgmt = "IEEE8021X"; - break; - case AUTH_WPA_PSK: - key_mgmt = "WPA-PSK"; - proto = "WPA"; - break; - case AUTH_WPA_EAP: - key_mgmt = "WPA-EAP"; - proto = "WPA"; - break; - case AUTH_WPA2_PSK: - key_mgmt = "WPA-PSK"; - proto = "WPA2"; - break; - case AUTH_WPA2_EAP: - key_mgmt = "WPA-EAP"; - proto = "WPA2"; - break; - } - - if (auth == AUTH_NONE_WEP_SHARED) - setNetworkParam(id, "auth_alg", "SHARED", false); - else - setNetworkParam(id, "auth_alg", "OPEN", false); - - if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP || - auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) { - int encr = ui->EncryptionSelect->currentIndex(); - if (encr == 0) - pairwise = "TKIP"; - else - pairwise = "CCMP"; - } - - if (proto) - setNetworkParam(id, "proto", proto, false); - if (key_mgmt) - setNetworkParam(id, "key_mgmt", key_mgmt, false); - if (pairwise) { - setNetworkParam(id, "pairwise", pairwise, false); - setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false); - } - if (ui->pskEdit->isEnabled() && - strcmp(ui->pskEdit->text().toLatin1().constData(), - WPA_GUI_KEY_DATA) != 0) - setNetworkParam(id, "psk", - ui->pskEdit->text().toLatin1().constData(), - psklen != 64); - - setNetworkParam(id, "phase2", "NULL", false); - setNetworkParam(id, "identity", "NULL", false); - if (ui->passwordEdit->isEnabled() && ui->passwordEdit->text().length() > 0 && - strcmp(ui->passwordEdit->text().toLatin1().constData(), - WPA_GUI_KEY_DATA) != 0) - setNetworkParam(id, "password", - ui->passwordEdit->text().toLatin1().constData(), - true); - else if (ui->passwordEdit->text().length() == 0) - setNetworkParam(id, "password", "NULL", false); - setNetworkParam(id, "ca_cert", "NULL", false); - setNetworkParam(id, "id_str", "NULL", false); - snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id); - reply_len = sizeof(reply); - ctrlRequest(cmd, reply, &reply_len); - if (strncmp(reply, "OK", 2) != 0) { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to enable " - "network in wpa_supplicant\n" - "configuration.")); - /* Network was added, so continue anyway */ - } - triggerUpdate(); - ctrlRequest("SAVE_CONFIG", reply, &reply_len); - - //close(); -} -void NetworkManager::authChanged(int sel) -{ - - ui->EncryptionSelect->setEnabled(sel != AUTH_NONE_OPEN && sel != AUTH_NONE_WEP && - sel != AUTH_NONE_WEP_SHARED); - ui->pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK); - bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP || - sel == AUTH_WPA2_EAP; - //eapSelect->setEnabled(eap); - //identityEdit->setEnabled(eap); - ui->passwordEdit->setEnabled(eap); - //cacertEdit->setEnabled(eap); - //phase2Select->setEnabled(eap); - //if (eap) - // eapChanged(eapSelect->currentIndex()); - - while (ui->EncryptionSelect->count()) - ui->EncryptionSelect->removeItem(0); - - if (sel == AUTH_NONE_OPEN || sel == AUTH_NONE_WEP || - sel == AUTH_NONE_WEP_SHARED || sel == AUTH_IEEE8021X) { - ui->EncryptionSelect->addItem("None"); - ui->EncryptionSelect->addItem("WEP"); - ui->EncryptionSelect->setCurrentIndex(sel == AUTH_NONE_OPEN ? 0 : 1); - } else { - ui->EncryptionSelect->addItem("TKIP"); - ui->EncryptionSelect->addItem("CCMP"); - ui->EncryptionSelect->setCurrentIndex((sel == AUTH_WPA2_PSK || - sel == AUTH_WPA2_EAP) ? 1 : 0); - } - //wepEnabled(sel == AUTH_NONE_WEP || sel == AUTH_NONE_WEP_SHARED); -} -void NetworkManager::selectNetwork( const QString & sel ) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply); - - if (cmd.contains(QRegExp("^\\d+:"))) - cmd.truncate(cmd.indexOf(':')); - else - cmd = "any"; - cmd.prepend("SELECT_NETWORK "); - ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); - triggerUpdate(); -} -void NetworkManager::triggerUpdate() -{ - updateStatus(); - networkMayHaveChanged = true; - updateNetworks(); -} -void NetworkManager::ping() -{ - char buf[10]; - size_t len; - - if(wlanStartUpFailed) - return; - len = sizeof(buf) - 1; - if (ctrlRequest("PING", buf, &len) < 0) { - qDebug()<<"PING failed - trying to reconnect"; - if (openCtrlConnection(ctrl_iface) >= 0) { - qDebug()<<"Reconnected successfully"; - pingsToStatusUpdate = 0; - } - } - - pingsToStatusUpdate--; - if (pingsToStatusUpdate <= 0) { - updateStatus(); - updateNetworks(); - } - -#ifndef CONFIG_CTRL_IFACE_NAMED_PIPE - /* Use less frequent pings and status updates when the main window is - * hidden (running in taskbar). */ - int interval = isHidden() ? 20000 : 3000; - if (timer->interval() != interval) - timer->setInterval(interval); -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ -} - -void NetworkManager::on_pushButtonConnect_pressed() -{ - on_pushButtonDisconnect_pressed(); - - char reply[10]; - size_t reply_len = sizeof(reply); - ctrlRequest("REASSOCIATE", reply, &reply_len); -} - -void NetworkManager::on_pushButtonDisconnect_pressed() -{ - char reply[10]; - size_t reply_len = sizeof(reply); - ctrlRequest("DISCONNECT", reply, &reply_len); -} - -void NetworkManager::on_scanSSIDSelect_activated(const QString &arg1) -{ - //if (openCtrlConnection(sel.toLatin1().constData()) < 0) - // printf("Failed to open control connection to " - // "wpa_supplicant.\n"); - updateStatus(); - updateNetworks(); - QStringList networkString=scanResultMap[arg1]; - if(networkString.isEmpty()) - { - return; - } - // QString flags = sel->text(4); - QString flags = networkString.at(4); - int auth, encr = 0; - if (flags.indexOf("[WPA2-EAP") >= 0) - auth = AUTH_WPA2_EAP; - else if (flags.indexOf("[WPA-EAP") >= 0) - auth = AUTH_WPA_EAP; - else if (flags.indexOf("[WPA2-PSK") >= 0) - auth = AUTH_WPA2_PSK; - else if (flags.indexOf("[WPA-PSK") >= 0) - auth = AUTH_WPA_PSK; - else - auth = AUTH_NONE_OPEN; - - if (flags.indexOf("-CCMP") >= 0) - encr = 1; - else if (flags.indexOf("-TKIP") >= 0) - encr = 0; - else if (flags.indexOf("WEP") >= 0) { - encr = 1; - if (auth == AUTH_NONE_OPEN) - auth = AUTH_NONE_WEP; - } else - encr = 0; - - ui->authSelect->setCurrentIndex(auth); - authChanged(auth); - ui->EncryptionSelect->setCurrentIndex(encr); - - //wepEnabled(auth == AUTH_NONE_WEP); - - //getEapCapa(); - - //if (flags.indexOf("[WPS") >= 0) - // useWpsButton->setEnabled(true); - //bssid = sel.text(1); -} - - -void NetworkManager::on_pushButtonAddNetworkd_pressed() -{ - // addNetwork(); - - // 连接到指定的Wi-Fi网络 - QString ssid = ui->scanSSIDSelect->currentText(); //Wi-Fi网络名称 - QString password = ui->passwordEdit->text(); //Wi-Fi密码 - QProcess::execute("sudo", QStringList() << "nmcli" << "dev" << "wifi" << "connect" << ssid << "password" << password); - // QMessageBox::information(nullptr, "Wi-Fi", "正在尝试连接到 " + ssid); - - // 查询网络接口状态 - QProcess process; - process.start("ifconfig", QStringList() << "wlan0"); - process.waitForFinished(); - QString output = process.readAllStandardOutput(); - // QMessageBox::information(nullptr, "网络接口状态", output); - // 判断是否连接成功 - if (isWifiConnected(output)) { - QMessageBox::information(nullptr, "Wi-Fi", "成功连接到 " + ssid); - } else { - QMessageBox::information(nullptr, "Wi-Fi", "连接失败"); - } -} - -bool NetworkManager::isWifiConnected(const QString &output) { - // 使用正则表达式检查是否有inet地址 - QRegularExpression re("inet\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)"); - QRegularExpressionMatch match = re.match(output); - return match.hasMatch(); -} - -void NetworkManager::removeNetwork() -{ - char reply[10], cmd[256]; - size_t reply_len; - int id; - if (QMessageBox::information( - this, "wpa_gui", - tr("This will permanently remove the network\n" - "from the configuration. Do you really want\n" - "to remove this network?"), - tr("Yes"), tr("No")) != 0) - return; - id = ui->networkSelect->currentIndex(); - snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", id); - reply_len = sizeof(reply); - ctrlRequest(cmd, reply, &reply_len); - if (strncmp(reply, "OK", 2) != 0) { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to remove network from " - "wpa_supplicant\n" - "configuration.")); - } else { - triggerUpdate(); - ctrlRequest("SAVE_CONFIG", reply, &reply_len); - } -} - -void NetworkManager::on_pushButtonRemove_pressed() -{ - removeNetwork(); -} - - -void NetworkManager::on_GetJsonpushButton_clicked() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::question(this, tr("提示"),tr("是否去获取数据!"), QMessageBox::Ok | QMessageBox::Cancel); - if(ret != QMessageBox::Ok) - { - return; - } - -// qDebug()<<"on_GetJsonpushButton_clicked"; - QString str = "http://"; - //str += ui->SeverIP_lineEdit->text(); - QString ip_str; - ip_str = QString::number(sysPara->para.Json_IP[0]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[1]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[2]); - ip_str += "."; - ip_str += QString::number(sysPara->para.Json_IP[3]); - str += ip_str; - - str += ":"; - //str += ui->server_port_lineEdit->text(); - str +=QString::number(sysPara->para.Json_server_port); - - if(ui->TestradioButton->isChecked()){ -// qDebug()<<"get test value"; - // str += "/KLAPS/APSServer/ECode/GetProductUniqueCodeTest"; - str = "http://www.anhuikinglan.top:63025/KLAPS/APSServer/ECode/GetProductUniqueCodeTest"; - }else{ - str += "/KLAPS/APSServer/ECode/GetProductUniqueCode"; - } - - - //net_data->PrintNetGetData(str, ui->deviceID_lineEdit->text()); - net_data->PrintNetGetData(str, QString(sysPara->para.Json_device_code)); - ui->messege_info_label->setText(tr("获取数据中...")); -} - -void NetworkManager::onjson_timer_handler() -{ - static int count_time = 0; - - count_time++; - - ui->messege_info_label->setText( net_data->getMessege() ); - -// qDebug()<<"on_json_timer_handler"; - if(sysPara->para.totalProductCnt != 0 && sysPara->para.totalProductCnt >= sysPara->Get_JSON_DATA.ProductPlanQty){ - QString str = "http://"; - str += ui->SeverIP_lineEdit->text(); - str += ":"; - str += ui->server_port_lineEdit->text(); - - if(ui->TestradioButton->isChecked()){ - str += "/KLAPS/APSServer/ECode/UsedProductUniqueCodeTest"; - }else{ - str += "/KLAPS/APSServer/ECode/UsedProductUniqueCode"; - } - - net_data->PrintNetPostFinish(str); - sysPara->devOp->clearProductCnt(1 | 0x10 );// [3]总产品计数器清零FPGA - sysPara->para.totalProductCnt = 0; - emit net_stopPrint(); - ui->messege_info_label->setText(tr("上报数据中...")); - - if(sysPara->Get_JSON_DATA.TaskSwitchingMode == 1){ - on_GetJsonpushButton_clicked(); - } - } - - if(count_time == 20){ - - count_time = 0; - QString str = "http://"; - str += ui->SeverIP_lineEdit->text(); - str += ":"; - str += ui->server_port_lineEdit->text(); - if(ui->TestradioButton->isChecked()){ - str += "/KLAPS/APSServer/ECode/SubmitEquipmentCurrentStateTest"; - }else{ - str += "/KLAPS/APSServer/ECode/SubmitEquipmentCurrentState"; - } - net_data->PrintNetPostFinish(str); - -// qDebug()<<"upload data"; - ui->messege_info_label->setText(tr("上报数据中...")); - - } - -} - -void NetworkManager::onjson_server_error() -{ -// ui->net_state_label->setText(tr("通信失败")); -// qDebug()<<"on_json_server_error"; -} - - - - -void NetworkManager::on_applicate_pushButton_clicked() -{ - QString ip_str = ui->SeverIP_lineEdit->text(); - QStringList ip_list = ip_str.split("."); - QString ip1,ip2,ip3,ip4; - - if (ip_list.size() < 4){ - QMessageBox::information(this,tr("提示"),tr("IP设置错误!")); - return; - } - ip1 = ip_list.at(0); - ip2 = ip_list.at(1); - ip3 = ip_list.at(2); - ip4 = ip_list.at(3); - - sysPara->para.Json_IP[0] = ip1.toInt(); - sysPara->para.Json_IP[1] = ip2.toInt(); - sysPara->para.Json_IP[2] = ip3.toInt(); - sysPara->para.Json_IP[3] = ip4.toInt(); - - if(sysPara->para.Json_IP[0] > 255 || sysPara->para.Json_IP[1] > 255 - ||sysPara->para.Json_IP[2] > 255 ||sysPara->para.Json_IP[3] > 255){ - QMessageBox::information(this,tr("提示"),tr("IP设置错误!")); - return; - } - -// strcpy(sysPara->para.Json_IP, std_str); - - //sysPara->para.Json_device_code = ui->deviceID_lineEdit->text().toInt(); - strncpy(sysPara->para.Json_device_code, ui->deviceID_lineEdit->text().toStdString().data(),sizeof(sysPara->para.Json_device_code)-1); - sysPara->para.Json_server_port = ui->server_port_lineEdit->text().toInt(); - - QMessageBox::information(this,tr("提示"),tr("应用成功")); -// qDebug()<<"Json_device_code="<para.Json_device_code -// <<"Json_server_port="<para.Json_server_port -// <<"sysPara->para.Json_IP="<para.Json_IP[0] << sysPara->para.Json_IP[1] -// <para.Json_IP[2]<para.Json_IP[3]; - - sysPara->saveParaToFile(); -} - -//void NetworkManager::on_checkBoxShortNet_clicked(bool checked) -//{ -// net_data->m_bShortNet = checked; -//} - -void NetworkManager::on_checkBoxRemoveDigitCode_clicked(bool checked) -{ - sysPara->para.isRemoveDigitCode = checked; - emit OpenNewFile(); -} - -void NetworkManager::on_checkBoxRemoveCode_clicked(bool checked) -{ - //emit VariablePositionChange(checked); - sysPara->para.isRemoveCode = checked; - //emit OpenNewFile(); -} - -void NetworkManager::on_radioButtonGetDataEnable_clicked(bool checked) -{ - sysPara->para.isEnableGetDataButton = checked; -} - -void NetworkManager::updateAuthorization(int auth) -{ - if(auth & AUTH_SUPER_USER2) - { - ui->GetJsonpushButton->show(); - ui->GetJsonpushButton->show(); - ui->messege_info_label->show(); - ui->label->show(); - ui->deviceID_lineEdit->show(); - ui->label_2->show(); - ui->SeverIP_lineEdit->show(); - ui->label_4->show(); - ui->server_port_lineEdit->show(); - ui->TestradioButton->show(); -// ui->checkBoxShortNet->show(); - ui->checkBoxRemoveDigitCode->show(); - ui->applicate_pushButton->show(); - ui->checkBoxRemoveCode->show(); - ui->radioButtonGetDataEnable->show(); - } - else - { - ui->GetJsonpushButton->hide(); - ui->GetJsonpushButton->hide(); - ui->messege_info_label->hide(); - ui->label->hide(); - ui->deviceID_lineEdit->hide(); - ui->label_2->hide(); - ui->SeverIP_lineEdit->hide(); - ui->label_4->hide(); - ui->server_port_lineEdit->hide(); - ui->TestradioButton->hide(); -// ui->checkBoxShortNet->hide(); - ui->checkBoxRemoveDigitCode->hide(); - ui->applicate_pushButton->hide(); - ui->checkBoxRemoveCode->hide(); - ui->radioButtonGetDataEnable->hide(); - //sysPara->para.isEnableGetDataButton = false; - } -} - -bool NetworkManager::setEth0StaticIP() -{ - const uint8_t ip3=192,ip2=168,ip1=0,ip0=66;//100+QDateTime::currentDateTime().time().second();//IP - const uint8_t /*ip3=192,ip2=168,ip1=1,ip0=66,*/lanGW0=1;//网关 - const uint8_t lanMask3=255,lanMask2=255,lanMask1=255,lanMask0=0;//子网掩码 - - // 静态IP - QFile netInterface("/etc/network/interfaces"); - netInterface.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Truncate); - if (netInterface.isOpen()) { - QTextStream stream(&netInterface); - stream.seek(0); - stream << INTERFACE_OTHERS; - stream << " " <<"\n"; - stream << "# eth0 interfaces" <<"\n"; - stream << "auto eth0" <<"\n"; - stream << "iface eth0 inet static" <<"\n"; - stream << QString("address %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0) <<"\n"; - stream << QString("gateway %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(lanGW0) <<"\n"; - stream << QString("netmask %1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0) <<"\n"; - stream << " \n"; - netInterface.close(); - - QStringList argrList; - QString ipAddrStr(QString("%1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0)); - QString netMaskStr(QString("%1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0)); - argrList<< LANINTERFACE_NAME << ipAddrStr << "netmask" << netMaskStr; - - qDebug() << "setEth0StaticIP->set argu:" << argrList; - - QProcess process; - process.startDetached("/sbin/ifconfig", argrList); - return true; - } - else - { - const QFile::FileError eno=netInterface.error(); - qDebug()<<"打开网络设置文件失败,error="<status.bLanConfigManual && this->setEth0StaticIP()) - { - qDebug()<<"设置静态IP-完成"; - sysPara->status.bLanConfigManual=true; - updateSysStatusToUI(); - } - else - { - qDebug()<<"设置静态IP-失败"; - } -} - -/** - 只有返回全是0的地址才需要设置成192.168.0.66这个固定地址 - * @brief NetworkManager::getCurrentNetworkIP - * @return 返回当前机器的IP地址 - */ -QString NetworkManager::getCurrentNetworkIP()const -{ - QString cip("0.0.0.0"); - if(sysPara){ - QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); - //获取所有网络接口的列表 - foreach(QNetworkInterface interface,list) - { - foreach(QNetworkAddressEntry entry,interface.addressEntries()) - { - qDebug()<spinBoxLanIP3->setValue(lanIpList.at(0).toInt()); - ui->spinBoxLanIP2->setValue(lanIpList.at(1).toInt()); - ui->spinBoxLanIP1->setValue(lanIpList.at(2).toInt()); - ui->spinBoxLanIP0->setValue(lanIpList.at(3).toInt()); - } - } - - if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) - { - QList entryList = interface.addressEntries(); - //获取IP地址条目列表,每个条目中包含一个IP地址,一个子网掩码和一个广播地址 - foreach(QNetworkAddressEntry entry,entryList) - { - QStringList lanIpList = entry.ip().toString().split("."); - if (lanIpList.size() == 4) { - return QString("%1.%2.%3.%4").arg(lanIpList.at(0)).arg(lanIpList.at(1)).arg(lanIpList.at(2)).arg(lanIpList.at(3)); - } - return cip; - } - } - } - } - return cip; -} - +#include "NetworkManager.h" +#include "ui_NetworkManager.h" +#include +#include +#include +#include +#include "myinclude.h" +#include "dirent.h" +#include "common/wpa_ctrl.h" +#define LANINTERFACE_NAME "eth0" + +#ifdef Q_OS_WIN +#include +#include +#include +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "Wbemuuid.lib") +#else +#define BUFSIZE 8192 +#include +#include +#include +#include +#include +#include "LogInfo.h" +#include +#include + +struct route_info { + in_addr dstAddr; + in_addr srcAddr; + in_addr gateWay; + char ifName[IF_NAMESIZE]; +}; + +int readNlSock(int sockFd, char *bufPtr, unsigned int seqNum, int pId) { + struct nlmsghdr *nlHdr; + int readLen = 0, msgLen = 0; + do { + if ((readLen = recv(sockFd, bufPtr, BUFSIZE - msgLen, 0)) < 0) { + perror("SOCK READ: "); + return -1; + } + nlHdr = (struct nlmsghdr *)bufPtr; + if ((NLMSG_OK(nlHdr, readLen) == 0) || (nlHdr->nlmsg_type == NLMSG_ERROR)) { + perror("Error in received packet"); + return -1; + } + if (nlHdr->nlmsg_type == NLMSG_DONE) + break; + + bufPtr += readLen; + msgLen += readLen; + + if ((nlHdr->nlmsg_flags & NLM_F_MULTI) == 0) + break; + + } while ((nlHdr->nlmsg_seq != seqNum) || (nlHdr->nlmsg_pid != (unsigned)pId)); + return msgLen; +} + +void parseRoutes(struct nlmsghdr *nlHdr, struct route_info *rtInfo) { + struct rtmsg *rtMsg = (struct rtmsg *)NLMSG_DATA(nlHdr); + + if ((rtMsg->rtm_family != AF_INET) || (rtMsg->rtm_table != RT_TABLE_MAIN)) + return; + + struct rtattr *rtAttr = (struct rtattr *)RTM_RTA(rtMsg); + int rtLen = RTM_PAYLOAD(nlHdr); + for (; RTA_OK(rtAttr, rtLen); rtAttr = RTA_NEXT(rtAttr, rtLen)) { + switch (rtAttr->rta_type) { + case RTA_OIF: + if_indextoname(*(int *)RTA_DATA(rtAttr), rtInfo->ifName); + break; + case RTA_GATEWAY: + rtInfo->gateWay = *(in_addr *)RTA_DATA(rtAttr); + break; + case RTA_PREFSRC: + rtInfo->srcAddr = *(in_addr *)RTA_DATA(rtAttr); + break; + case RTA_DST: + rtInfo->dstAddr = *(in_addr *)RTA_DATA(rtAttr); + break; + } + } +} +#endif + +class NetworkHelper { +public: + static QString DefaultGateway() { + QString ret; +#ifdef Q_OS_WIN + CoInitialize(NULL); + if (CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) != S_OK) + return ret; + + IWbemLocator *pLoc = NULL; + if (CoCreateInstance(CLSID_WbemAdministrativeLocator, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IUnknown, (void **)&pLoc) != S_OK) + return ret; + + IWbemServices *pSvc = NULL; + if (pLoc->ConnectServer(L"root\\cimv2", NULL, NULL, NULL, 0, NULL, NULL, &pSvc) != S_OK) + return ret; + + IEnumWbemClassObject *pEnumerator = NULL; + HRESULT hr = pSvc->ExecQuery(L"WQL", L"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'", WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); + if (FAILED(hr)) { + pSvc->Release(); + pLoc->Release(); + CoUninitialize(); + return ret; + } + + IWbemClassObject *pclsObj = NULL; + while (pEnumerator && ret.isEmpty()) { + _variant_t vaDefaultIPGateway; + ULONG uReturn; + hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); + if (!uReturn) + break; + + hr = pclsObj->Get(L"DefaultIPGateway", 0, &vaDefaultIPGateway, NULL, NULL); + if (hr == WBEM_S_NO_ERROR && vaDefaultIPGateway.vt != VT_NULL) { + LONG lLow = 0; + LONG lUp = 0; + ::SafeArrayGetLBound(vaDefaultIPGateway.parray, 1, &lLow); + ::SafeArrayGetUBound(vaDefaultIPGateway.parray, 1, &lUp); + for (LONG i = lLow; i <= lUp; i++) { + BSTR bsDefaultIPGateway; + if (::SafeArrayGetElement(vaDefaultIPGateway.parray, &i, &bsDefaultIPGateway) == S_OK) { + ret = QString::fromUtf16(reinterpret_cast(bsDefaultIPGateway)); + ::SysFreeString(bsDefaultIPGateway); + break; + } + } + } + VariantClear(&vaDefaultIPGateway); + } + + if (pclsObj) + pclsObj->Release(); + if (pEnumerator) + pEnumerator->Release(); + if (pSvc) + pSvc->Release(); + if (pLoc) + pLoc->Release(); + CoUninitialize(); +#else + int sock, msgSeq = 0; + if ((sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) { + perror("Socket Creation: "); + return ret; + } + + char msgBuf[BUFSIZE]; + memset(msgBuf, 0, BUFSIZE); + struct nlmsghdr *nlMsg = (struct nlmsghdr *)msgBuf; + + nlMsg->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); + nlMsg->nlmsg_type = RTM_GETROUTE; + + nlMsg->nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; + nlMsg->nlmsg_seq = msgSeq++; + nlMsg->nlmsg_pid = getpid(); + + if (send(sock, nlMsg, nlMsg->nlmsg_len, 0) < 0) + return ret; + + int len; + if ((len = readNlSock(sock, msgBuf, msgSeq, getpid())) < 0) + return ret; + + struct route_info *rtInfo = (struct route_info *)malloc(sizeof(struct route_info)); + + for (; NLMSG_OK(nlMsg, len); nlMsg = NLMSG_NEXT(nlMsg, len)) { + memset(rtInfo, 0, sizeof(struct route_info)); + parseRoutes(nlMsg, rtInfo); + + if (strstr((char *)inet_ntoa(rtInfo->dstAddr), "0.0.0.0") && !strstr((char *)inet_ntoa(rtInfo->gateWay), "0.0.0.0")) { + char buf[64]; + inet_ntop(AF_INET, &rtInfo->gateWay, buf, sizeof(buf)); + ret = QString(buf); + break; + } + } + + free(rtInfo); + close(sock); +#endif + return ret; + } +}; + +NetworkManager::NetworkManager(QWidget *parent) : + QWidget(parent), + ui(new Ui::NetworkManager) +{ + ui->setupUi(this); + + Json_ip_init_done =false; + net_data = new PrintNet(); + + connect(net_data,SIGNAL(json_server_error()),this,SLOT(onjson_server_error())); + connect(net_data,SIGNAL(receiveJSONDatafinish()),this,SLOT(onfinish_get_json())); + connect(net_data,SIGNAL(showMessege()),this,SLOT(ShowNet_dataMessege())); + + QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); + QRegExpValidator *pValidator = new QRegExpValidator(regExp, this); + +// ui->lineEditLanGW->setValidator(new QRegExpValidator(pValidator)); +// ui->lineEditLanGW->setInputMask("000.000.000.000;"); + + ui->spinBoxLanIP3->setDisabled(true); + ui->spinBoxLanIP2->setDisabled(true); + ui->spinBoxLanIP1->setDisabled(true); + ui->spinBoxLanIP0->setDisabled(true); + ui->spinBoxLanMask3->setDisabled(true); + ui->spinBoxLanMask2->setDisabled(true); + ui->spinBoxLanMask1->setDisabled(true); + ui->spinBoxLanMask0->setDisabled(true); +// ui->lineEditLanGW->setDisabled(true); + ui->spinBoxLanGW3->setDisabled(true); + ui->spinBoxLanGW2->setDisabled(true); + ui->spinBoxLanGW1->setDisabled(true); + ui->spinBoxLanGW0->setDisabled(true); + ui->pushButtonSetCancel->setDisabled(true); + + connect(ui->networkSelect, SIGNAL(activated(const QString&)), this, + SLOT(selectNetwork(const QString&))); + ctrl_iface = NULL; + ctrl_conn = NULL; + monitor_conn = NULL; + msgNotifier = NULL; + ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); + + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), SLOT(ping())); + timer->setSingleShot(false); + timer->start(3000); + + Json_timer = new QTimer(this); + connect(Json_timer, SIGNAL(timeout()), SLOT(onjson_timer_handler())); + Json_timer->stop(); + Jsom_timer_stop =true; +// Json_timer->start(1000); + + wlanStartUpFailed = false; + if (openCtrlConnection(ctrl_iface) < 0) { + qDebug()<<"Failed to open control connection to " + "wpa_supplicant."; + wlanStartUpFailed = true; + } + + if(wlanStartUpFailed) + return; + updateStatus(); + networkMayHaveChanged = true; + updateNetworks(); + updateSysStatusToUI(); +} + +NetworkManager::~NetworkManager() +{ + delete ui; + //delete processNetwork; +} + +void NetworkManager::onfinish_get_json() +{ + + net_data->getJson_data(&sysPara->Get_JSON_DATA); + + if(Jsom_timer_stop == true){ + + Json_timer->start(1000); + Jsom_timer_stop = false; + } + + + ui->messege_info_label->setText( net_data->getMessege() ); + + emit updateJSONData(); +} + +void NetworkManager::ShowNet_dataMessege() +{ + ui->messege_info_label->setText( net_data->getMessege()); +} + +void NetworkManager::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; + const QString cip=getCurrentNetworkIP(); + qDebug()<deviceID_lineEdit->setText(QString(sysPara->para.Json_device_code)); + QString ip_str; + ip_str = QString::number(sysPara->para.Json_IP[0]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[1]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[2]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[3]); + ui->SeverIP_lineEdit->setText(ip_str); + ui->server_port_lineEdit->setText(QString::number(sysPara->para.Json_server_port)); + + } + + ui->checkBoxRemoveCode->setCheckState(sysPara->para.isRemoveCode ? Qt::Checked : Qt::Unchecked); + ui->checkBoxRemoveDigitCode->setCheckState(sysPara->para.isRemoveDigitCode ? Qt::Checked : Qt::Unchecked); + ui->radioButtonGetDataEnable->setChecked(sysPara->para.isEnableGetDataButton); + + QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); + //获取所有网络接口的列表 + foreach(QNetworkInterface interface,list) + { + if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) + { + QList entryList = interface.addressEntries(); + //获取IP地址条目列表,每个条目中包含一个IP地址,一个子网掩码和一个广播地址 + foreach(QNetworkAddressEntry entry,entryList) + { + QStringList lanIpList = entry.ip().toString().split("."); + if (lanIpList.size() == 4) { + ui->spinBoxLanIP3->setValue(lanIpList.at(0).toInt()); + ui->spinBoxLanIP2->setValue(lanIpList.at(1).toInt()); + ui->spinBoxLanIP1->setValue(lanIpList.at(2).toInt()); + ui->spinBoxLanIP0->setValue(lanIpList.at(3).toInt()); + } + else if (lanIpList.size() == 0) { + ui->spinBoxLanIP3->setValue(0); + ui->spinBoxLanIP2->setValue(0); + ui->spinBoxLanIP1->setValue(0); + ui->spinBoxLanIP0->setValue(0); + } + QStringList lanMaskList = entry.netmask().toString().split("."); + if (lanMaskList.size() == 4) { + ui->spinBoxLanMask3->setValue(lanMaskList.at(0).toInt()); + ui->spinBoxLanMask2->setValue(lanMaskList.at(1).toInt()); + ui->spinBoxLanMask1->setValue(lanMaskList.at(2).toInt()); + ui->spinBoxLanMask0->setValue(lanMaskList.at(3).toInt()); + } + else if (lanMaskList.size() == 0) { + ui->spinBoxLanMask3->setValue(0); + ui->spinBoxLanMask2->setValue(0); + ui->spinBoxLanMask1->setValue(0); + ui->spinBoxLanMask0->setValue(0); + } + //ui->lineEditLanGW->setText(entry.netmask().toString()); + QString GatewayAddr = NetworkHelper::DefaultGateway(); + //ui->lineEditLanGW->setText(GatewayAddr); + QStringList lanGWList = GatewayAddr.split("."); + if (lanGWList.size() == 4) { + ui->spinBoxLanGW3->setValue(lanGWList.at(0).toInt()); + ui->spinBoxLanGW2->setValue(lanGWList.at(1).toInt()); + ui->spinBoxLanGW1->setValue(lanGWList.at(2).toInt()); + ui->spinBoxLanGW0->setValue(lanGWList.at(3).toInt()); + } + else if (lanGWList.size() == 0) { + ui->spinBoxLanGW3->setValue(0); + ui->spinBoxLanGW2->setValue(0); + ui->spinBoxLanGW1->setValue(0); + ui->spinBoxLanGW0->setValue(0); + } + return; + } + } + } + //ui->radioButtonGetDataEnable->setChecked(ui->radioButtonGetDataEnable ? true: false); + } + +} +#define INTERFACE_OTHERS "# The loopback interface \n\ + auto lo \n\ + iface lo inet loopback \n\ + \n \ + # Wireless interfaces \n\ + auto wlan0 \n\ + iface wlan0 inet dhcp \n\ + wireless_mode managed \n\ + wireless_essid any \n\ + wpa-driver wext \n\ + wpa-conf /etc/wpa_supplicant.conf\n" + +void NetworkManager::applyLanUIPara(void) +{ + + if(sysPara){ + QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); + //获取所有网络接口的列表 + foreach(QNetworkInterface interface,list) { + if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) + { + uint8_t ip3 = ui->spinBoxLanIP3->value(); + uint8_t ip2 = ui->spinBoxLanIP2->value(); + uint8_t ip1 = ui->spinBoxLanIP1->value(); + uint8_t ip0 = ui->spinBoxLanIP0->value(); + uint8_t lanMask3 = ui->spinBoxLanMask3->value(); + uint8_t lanMask2 = ui->spinBoxLanMask2->value(); + uint8_t lanMask1 = ui->spinBoxLanMask1->value(); + uint8_t lanMask0 = ui->spinBoxLanMask0->value(); + uint8_t lanGW0 = ui->spinBoxLanGW0->value(); + QString ipAddrStr(QString("%1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0)); + QString netMaskStr(QString("%1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0)); +// QHostAddress ipAddr(ipAddrStr); +// QHostAddress netMask(netMaskStr); + qDebug() << "set ip:"<start("ifconfig", QStringList() << LANINTERFACE_NAME << "192.168.1.100"); + //startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, + // qint64 *pid = 0) + QStringList argrList; + if (!(ip3|ip2|ip1|ip0)) { + // 动态IP + //qDebug() << "set dhcp"; + QProcess dhcpProcess; + dhcpProcess.startDetached("/bin/cp /etc/network/interfaces_dhcp /etc/network/interfaces", argrList); + argrList<< LANINTERFACE_NAME << ipAddrStr; + + } + else { + + // 静态IP + QFile netInterface("/etc/network/interfaces"); + netInterface.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Truncate); + if (netInterface.isOpen()) { + QTextStream stream(&netInterface); + stream.seek(0); + stream << INTERFACE_OTHERS; + stream << " " <<"\n"; + stream << "# eth0 interfaces" <<"\n"; + stream << "auto eth0" <<"\n"; + stream << "iface eth0 inet static" <<"\n"; + stream << QString("address %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0) <<"\n"; + stream << QString("gateway %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(lanGW0) <<"\n"; + stream << QString("netmask %1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0) <<"\n"; + stream << " \n"; + netInterface.close(); + } + argrList<< LANINTERFACE_NAME << ipAddrStr << "netmask" << netMaskStr; + system("sudo systemctl restart networking"); + } + return; + } + } + } + +} + +qint32 NetworkManager::isIpv4Address(QString ip) +{ + QRegExp regExp("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + if( !regExp.exactMatch(ip) ) + { + return false; + } + return true; +} + +void NetworkManager::on_pushButtonSetIP_clicked(bool checked) +{ + if(sysPara){ + if(sysPara->status.bLanConfigManual) + { + applyLanUIPara(); + ui->pushButtonSetIP->setText(QObject::tr("手动设定")); + ui->spinBoxLanIP3->setDisabled(true); + ui->spinBoxLanIP2->setDisabled(true); + ui->spinBoxLanIP1->setDisabled(true); + ui->spinBoxLanIP0->setDisabled(true); + ui->spinBoxLanMask3->setDisabled(true); + ui->spinBoxLanMask2->setDisabled(true); + ui->spinBoxLanMask1->setDisabled(true); + ui->spinBoxLanMask0->setDisabled(true); + ui->spinBoxLanGW0->setDisabled(true); + ui->pushButtonSetCancel->setDisabled(true); + sysPara->status.bLanConfigManual = false; + } + else + { + sysPara->status.bLanConfigManual = true; + ui->spinBoxLanIP3->setDisabled(false); + ui->spinBoxLanIP2->setDisabled(false); + ui->spinBoxLanIP1->setDisabled(false); + ui->spinBoxLanIP0->setDisabled(false); + ui->spinBoxLanMask3->setDisabled(false); + ui->spinBoxLanMask2->setDisabled(false); + ui->spinBoxLanMask1->setDisabled(false); + ui->spinBoxLanMask0->setDisabled(false); + ui->spinBoxLanGW0->setDisabled(false); + ui->pushButtonSetIP->setText(QObject::tr("应用")); + ui->pushButtonSetCancel->setDisabled(false); + } + } +} + +void NetworkManager::on_pushButtonSetCancel_clicked(bool checked) +{ + + if(sysPara){ + if(sysPara->status.bLanConfigManual) + { + sysPara->status.bLanConfigManual = false; + ui->spinBoxLanIP3->setDisabled(true); + ui->spinBoxLanIP2->setDisabled(true); + ui->spinBoxLanIP1->setDisabled(true); + ui->spinBoxLanIP0->setDisabled(true); + ui->spinBoxLanMask3->setDisabled(true); + ui->spinBoxLanMask2->setDisabled(true); + ui->spinBoxLanMask1->setDisabled(true); + ui->spinBoxLanMask0->setDisabled(true); + ui->pushButtonSetCancel->setDisabled(true); + ui->pushButtonSetIP->setText(QObject::tr("手动设定")); + } + } + +} + +int NetworkManager::openCtrlConnection(const char *ifname) +{ + char *cfile; + int flen; +// char buf[2048], *pos, *pos2; +// size_t len; + + if (ifname) { + if (ifname != ctrl_iface) { + free(ctrl_iface); + ctrl_iface = strdup(ifname); + } + } else { +#ifdef CONFIG_CTRL_IFACE_UDP + free(ctrl_iface); + ctrl_iface = strdup("udp"); +#endif /* CONFIG_CTRL_IFACE_UDP */ +#ifdef CONFIG_CTRL_IFACE_UNIX + struct dirent *dent; + DIR *dir = opendir(ctrl_iface_dir); + free(ctrl_iface); + ctrl_iface = NULL; + if (dir) { + while ((dent = readdir(dir))) { +#ifdef _DIRENT_HAVE_D_TYPE + /* Skip the file if it is not a socket. + * Also accept DT_UNKNOWN (0) in case + * the C library or underlying file + * system does not support d_type. */ + if (dent->d_type != DT_SOCK && + dent->d_type != DT_UNKNOWN) + continue; +#endif /* _DIRENT_HAVE_D_TYPE */ + + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) + continue; + printf("Selected interface '%s'\n", + dent->d_name); + ctrl_iface = strdup(dent->d_name); + break; + } + closedir(dir); + } +#endif /* CONFIG_CTRL_IFACE_UNIX */ +#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE + struct wpa_ctrl *ctrl; + int ret; + + free(ctrl_iface); + ctrl_iface = NULL; + + ctrl = wpa_ctrl_open(NULL); + if (ctrl) { + len = sizeof(buf) - 1; + ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf, + &len, NULL); + if (ret >= 0) { + connectedToService = true; + buf[len] = '\0'; + pos = strchr(buf, '\n'); + if (pos) + *pos = '\0'; + ctrl_iface = strdup(buf); + } + wpa_ctrl_close(ctrl); + } +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ + } + + if (ctrl_iface == NULL) { +#ifdef CONFIG_NATIVE_WINDOWS + static bool first = true; + if (first && !serviceRunning()) { + first = false; + if (QMessageBox::warning( + this, qAppName(), + tr("wpa_supplicant service is not " + "running.\n" + "Do you want to start it?"), + QMessageBox::Yes | QMessageBox::No) == + QMessageBox::Yes) + startService(); + } +#endif /* CONFIG_NATIVE_WINDOWS */ + return -1; + } + +#ifdef CONFIG_CTRL_IFACE_UNIX + flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2; + cfile = (char *) malloc(flen); + if (cfile == NULL) + return -1; + snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface); +#else /* CONFIG_CTRL_IFACE_UNIX */ + flen = strlen(ctrl_iface) + 1; + cfile = (char *) malloc(flen); + if (cfile == NULL) + return -1; + snprintf(cfile, flen, "%s", ctrl_iface); +#endif /* CONFIG_CTRL_IFACE_UNIX */ + + if (ctrl_conn) { + wpa_ctrl_close(ctrl_conn); + ctrl_conn = NULL; + } + + if (monitor_conn) { + delete msgNotifier; + msgNotifier = NULL; + wpa_ctrl_detach(monitor_conn); + wpa_ctrl_close(monitor_conn); + monitor_conn = NULL; + } + + printf("Trying to connect to '%s'\n", cfile); + ctrl_conn = wpa_ctrl_open(cfile); + if (ctrl_conn == NULL) { + free(cfile); + return -1; + } + monitor_conn = wpa_ctrl_open(cfile); + free(cfile); + if (monitor_conn == NULL) { + wpa_ctrl_close(ctrl_conn); + return -1; + } + if (wpa_ctrl_attach(monitor_conn)) { + printf("Failed to attach to wpa_supplicant\n"); + wpa_ctrl_close(monitor_conn); + monitor_conn = NULL; + wpa_ctrl_close(ctrl_conn); + ctrl_conn = NULL; + return -1; + } + +#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP) + msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn), + QSocketNotifier::Read, this); + connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs())); +#endif + printf("network out to '%s'\n", cfile); + return 0; +} + + +int NetworkManager::ctrlRequest(const char *cmd, char *buf, size_t *buflen) +{ + int ret; + + if (ctrl_conn == NULL) + return -3; + ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen, NULL); + if (ret == -2) + printf("'%s' command timed out.\n", cmd); + else if (ret < 0) + printf("'%s' command failed.\n", cmd); + + return ret; +} +QString NetworkManager::wpaStateTranslate(char *state) +{ + + if (!strcmp(state, "DISCONNECTED")) + { + //QProcess process; + //process.startDetached("killall udhcpc"); + return tr("Disconnected"); + } + else if (!strcmp(state, "INACTIVE")) + return tr("Inactive"); + else if (!strcmp(state, "SCANNING")) + return tr("Scanning"); + else if (!strcmp(state, "AUTHENTICATING")) + return tr("Authenticating"); + else if (!strcmp(state, "ASSOCIATING")) + return tr("Associating"); + else if (!strcmp(state, "ASSOCIATED")) + return tr("Associated"); + else if (!strcmp(state, "4WAY_HANDSHAKE")) + return tr("4-Way Handshake"); + else if (!strcmp(state, "GROUP_HANDSHAKE")) + return tr("Group Handshake"); + else if (!strcmp(state, "COMPLETED")) + { + QProcess process; + process.startDetached("/home/plg/checkUdhcpcRun.sh"); + return tr("Completed"); + } + else + + return tr("Unknown"); +} +void NetworkManager::updateStatus() +{ + + char buf[2048], *start, *end, *pos; + size_t len; + + pingsToStatusUpdate = 10; + + len = sizeof(buf) - 1; + if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) { + ui->textStatus->setText(tr("Could not get status from " + "wpa_supplicant")); + //ui->textAuthentication->clear(); + //ui->textEncryption->clear(); + ui->textSSID->clear(); + //ui->textBssid->clear(); + ui->textIPAdrr->clear(); + + return; + } + + buf[len] = '\0'; + + bool auth_updated = false, ssid_updated = false; + bool bssid_updated = false, ipaddr_updated = false; + bool status_updated = false; + char *pairwise_cipher = NULL, *group_cipher = NULL; + char *mode = NULL; + + start = buf; + while (*start) { + bool last = false; + end = strchr(start, '\n'); + if (end == NULL) { + last = true; + end = start; + while (end[0] && end[1]) + end++; + } + *end = '\0'; + + pos = strchr(start, '='); + if (pos) { + *pos++ = '\0'; + if (strcmp(start, "bssid") == 0) { + bssid_updated = true; + //textBssid->setText(pos); + } else if (strcmp(start, "ssid") == 0) { + ssid_updated = true; + ui->textSSID->setText(pos); + } else if (strcmp(start, "ip_address") == 0) { + ipaddr_updated = true; + ui->textIPAdrr->setText(pos); + } else if (strcmp(start, "wpa_state") == 0) { + status_updated = true; + ui->textStatus->setText(wpaStateTranslate(pos)); + } else if (strcmp(start, "key_mgmt") == 0) { + auth_updated = true; + //textAuthentication->setText(pos); + /* TODO: could add EAP status to this */ + } else if (strcmp(start, "pairwise_cipher") == 0) { + pairwise_cipher = pos; + } else if (strcmp(start, "group_cipher") == 0) { + group_cipher = pos; + } else if (strcmp(start, "mode") == 0) { + mode = pos; + } + } + + if (last) + break; + start = end + 1; + } + if (status_updated && mode) + ui->textStatus->setText(ui->textStatus->text() + " (" + mode + ")"); + + if (pairwise_cipher || group_cipher) { + QString encr; + if (pairwise_cipher && group_cipher && + strcmp(pairwise_cipher, group_cipher) != 0) { + encr.append(pairwise_cipher); + encr.append(" + "); + encr.append(group_cipher); + } else if (pairwise_cipher) { + encr.append(pairwise_cipher); + } else { + encr.append(group_cipher); + encr.append(" [group key only]"); + } + //textEncryption->setText(encr); + } else + //textEncryption->clear(); + ; + + if (!status_updated) + ui->textStatus->clear(); + //if (!auth_updated) + // textAuthentication->clear(); + if (!ssid_updated) + ui->textSSID->clear(); + //if (!bssid_updated) + // textBssid->clear(); + if (!ipaddr_updated) + ui->textIPAdrr->clear(); + +} + +void NetworkManager::updateNetworks() +{ + + char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; + size_t len; + int first_active = -1; + int was_selected = -1; + bool current = false; + if(wlanStartUpFailed) + return; + if (!networkMayHaveChanged) + return; + + //if (networkList->currentRow() >= 0) + // was_selected = networkList->currentRow(); + + ui->networkSelect->clear(); + //ui->scanSSIDSelect->clear(); + //networkList->clear(); + + if (ctrl_conn == NULL) + return; + + len = sizeof(buf) - 1; + if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0) + return; + + buf[len] = '\0'; + start = strchr(buf, '\n'); + if (start == NULL) + return; + start++; + + while (*start) { + bool last = false; + end = strchr(start, '\n'); + if (end == NULL) { + last = true; + end = start; + while (end[0] && end[1]) + end++; + } + *end = '\0'; + + id = start; + ssid = strchr(id, '\t'); + if (ssid == NULL) + break; + *ssid++ = '\0'; + bssid = strchr(ssid, '\t'); + if (bssid == NULL) + break; + *bssid++ = '\0'; + flags = strchr(bssid, '\t'); + if (flags == NULL) + break; + *flags++ = '\0'; + + if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) { + if (last) + break; + start = end + 1; + continue; + } + + QString network(id); + network.append(": "); + network.append(ssid); + ui->networkSelect->addItem(network); + //networkList->addItem(network); +//scanSSIDSelect + if (strstr(flags, "[CURRENT]")) { + ui->networkSelect->setCurrentIndex(ui->networkSelect->count() - + 1); + current = true; + } else if (first_active < 0 && + strstr(flags, "[DISABLED]") == NULL) + first_active = ui->networkSelect->count() - 1; + + if (last) + break; + start = end + 1; + } + + if (ui->networkSelect->count() > 1) + ui->networkSelect->addItem(tr("Select any network")); + + if (!current && first_active >= 0) + ui->networkSelect->setCurrentIndex(first_active); + networkMayHaveChanged = false; + +} +static int str_match(const char *a, const char *b) +{ + return strncmp(a, b, strlen(b)) == 0; +} + +void NetworkManager::processMsg(char *msg) +{ + + char *pos = msg, *pos2; + int priority = 2; + + if (*pos == '<') { + /* skip priority */ + pos++; + priority = atoi(pos); + pos = strchr(pos, '>'); + if (pos) + pos++; + else + pos = msg; + } + + WpaMsg wm(pos, priority); + //if (eh) + // eh->addEvent(wm); + //if (peers) + // peers->event_notify(wm); + msgs.append(wm); + while (msgs.count() > 100) + msgs.pop_front(); + + /* Update last message with truncated version of the event */ + if (strncmp(pos, "CTRL-", 5) == 0) { + pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' '); + if (pos2) + pos2++; + else + pos2 = pos; + } else + pos2 = pos; + QString lastmsg = pos2; + lastmsg.truncate(40); + //textLastMessage->setText(lastmsg); + + pingsToStatusUpdate = 0; + networkMayHaveChanged = true; + + if (str_match(pos, WPA_CTRL_REQ)) + //processCtrlReq(pos + strlen(WPA_CTRL_REQ)); + ; + else if (str_match(pos, WPA_EVENT_SCAN_RESULTS) && beSentScanCmd) + { + updateResults(); + beSentScanCmd = false; + } + else if (str_match(pos, WPA_EVENT_DISCONNECTED)) + //showTrayMessage(QSystemTrayIcon::Information, 3, + // tr("Disconnected from network.")); + ui->textStatus->setText("Disconnected"); + else if (str_match(pos, WPA_EVENT_CONNECTED)) { + //showTrayMessage(QSystemTrayIcon::Information, 3, + //tr("Connection to network established.")); + //QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus())); + //stopWpsRun(true); + ui->textStatus->setText("Connected"); + } +} +void NetworkManager::receiveMsgs() +{ + char buf[256]; + size_t len; + qDebug()<<"receiveMsgs"; + while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) { + len = sizeof(buf) - 1; + if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) { + buf[len] = '\0'; + processMsg(buf); + } + } +} + + +void NetworkManager::updateResults() +{ + char reply[2048]; + size_t reply_len; + int index; + char cmd[20]; + //qDebug()<<"updateResults"; + //ui->networkSelect->clear(); + ui->scanSSIDSelect->clear(); + scanResultMap.clear(); + + index = 0; + while (1) + { + snprintf(cmd, sizeof(cmd), "BSS %d", index++); + if (index > 1000) + break; + + reply_len = sizeof(reply) - 1; + if (ctrlRequest(cmd, reply, &reply_len) < 0) + break; + reply[reply_len] = '\0'; + + QString bss(reply); + if (bss.isEmpty() || bss.startsWith("FAIL")) + break; + + QString ssid, bssid, freq, signal, flags; + + QStringList lines = bss.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + int pos = (*it).indexOf('=') + 1; + if (pos < 1) + continue; + + if ((*it).startsWith("bssid=")) + bssid = (*it).mid(pos); + else if ((*it).startsWith("freq=")) + freq = (*it).mid(pos); + else if ((*it).startsWith("qual=")) + signal = (*it).mid(pos); + else if ((*it).startsWith("flags=")) + flags = (*it).mid(pos); + else if ((*it).startsWith("ssid=")) + ssid = (*it).mid(pos); + } + ui->scanSSIDSelect->addItem(ssid); + QStringList resultList; + resultList<scanSSIDSelect->addItem(ssid); + } + } + } + + +} + +void NetworkManager::selectSSID( const QString & sel ) +{ + //if (openCtrlConnection(sel.toLatin1().constData()) < 0) + // printf("Failed to open control connection to " + // "wpa_supplicant.\n"); + //updateStatus(); + //updateNetworks(); + +} +int NetworkManager::setNetworkParam(int id, const char *field, + const char *value, bool quote) +{ + char reply[10], cmd[256]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s", + id, field, quote ? "\"" : "", value, quote ? "\"" : ""); + reply_len = sizeof(reply); + ctrlRequest(cmd, reply, &reply_len); + + return strncmp(reply, "OK", 2) == 0 ? 0 : -1; +} +void NetworkManager::addNetwork() +{ + + char reply[10], cmd[256]; + size_t reply_len; + int id; + int psklen = ui->pskEdit->text().length(); + int auth = ui->authSelect->currentIndex(); + + if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) { + if (psklen < 8 || psklen > 64) { + QMessageBox::warning( + this, + tr("WPA Pre-Shared Key Error"), + tr("WPA-PSK requires a passphrase of 8 to 63 " + "characters\n" + "or 64 hex digit PSK")); + ui->pskEdit->setFocus(); + return; + } + } + memset(reply, 0, sizeof(reply)); + reply_len = sizeof(reply) - 1; + + if (1) { + ctrlRequest("ADD_NETWORK", reply, &reply_len); + if (reply[0] == 'F') { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to add " + "network to wpa_supplicant\n" + "configuration.")); + return; + } + id = atoi(reply); + } else + id = edit_network_id; + + //setNetworkParam(id, "ssid", ssidEdit->text().toLatin1().constData(), + // true); + setNetworkParam(id, "ssid", ui->scanSSIDSelect->currentText().toLatin1().constData(), + true); + const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL; + switch (auth) { + case AUTH_NONE_OPEN: + case AUTH_NONE_WEP: + case AUTH_NONE_WEP_SHARED: + key_mgmt = "NONE"; + break; + case AUTH_IEEE8021X: + key_mgmt = "IEEE8021X"; + break; + case AUTH_WPA_PSK: + key_mgmt = "WPA-PSK"; + proto = "WPA"; + break; + case AUTH_WPA_EAP: + key_mgmt = "WPA-EAP"; + proto = "WPA"; + break; + case AUTH_WPA2_PSK: + key_mgmt = "WPA-PSK"; + proto = "WPA2"; + break; + case AUTH_WPA2_EAP: + key_mgmt = "WPA-EAP"; + proto = "WPA2"; + break; + } + + if (auth == AUTH_NONE_WEP_SHARED) + setNetworkParam(id, "auth_alg", "SHARED", false); + else + setNetworkParam(id, "auth_alg", "OPEN", false); + + if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP || + auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) { + int encr = ui->EncryptionSelect->currentIndex(); + if (encr == 0) + pairwise = "TKIP"; + else + pairwise = "CCMP"; + } + + if (proto) + setNetworkParam(id, "proto", proto, false); + if (key_mgmt) + setNetworkParam(id, "key_mgmt", key_mgmt, false); + if (pairwise) { + setNetworkParam(id, "pairwise", pairwise, false); + setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false); + } + if (ui->pskEdit->isEnabled() && + strcmp(ui->pskEdit->text().toLatin1().constData(), + WPA_GUI_KEY_DATA) != 0) + setNetworkParam(id, "psk", + ui->pskEdit->text().toLatin1().constData(), + psklen != 64); + + setNetworkParam(id, "phase2", "NULL", false); + setNetworkParam(id, "identity", "NULL", false); + if (ui->passwordEdit->isEnabled() && ui->passwordEdit->text().length() > 0 && + strcmp(ui->passwordEdit->text().toLatin1().constData(), + WPA_GUI_KEY_DATA) != 0) + setNetworkParam(id, "password", + ui->passwordEdit->text().toLatin1().constData(), + true); + else if (ui->passwordEdit->text().length() == 0) + setNetworkParam(id, "password", "NULL", false); + setNetworkParam(id, "ca_cert", "NULL", false); + setNetworkParam(id, "id_str", "NULL", false); + snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id); + reply_len = sizeof(reply); + ctrlRequest(cmd, reply, &reply_len); + if (strncmp(reply, "OK", 2) != 0) { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to enable " + "network in wpa_supplicant\n" + "configuration.")); + /* Network was added, so continue anyway */ + } + triggerUpdate(); + ctrlRequest("SAVE_CONFIG", reply, &reply_len); + + //close(); +} +void NetworkManager::authChanged(int sel) +{ + + ui->EncryptionSelect->setEnabled(sel != AUTH_NONE_OPEN && sel != AUTH_NONE_WEP && + sel != AUTH_NONE_WEP_SHARED); + ui->pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK); + bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP || + sel == AUTH_WPA2_EAP; + //eapSelect->setEnabled(eap); + //identityEdit->setEnabled(eap); + ui->passwordEdit->setEnabled(eap); + //cacertEdit->setEnabled(eap); + //phase2Select->setEnabled(eap); + //if (eap) + // eapChanged(eapSelect->currentIndex()); + + while (ui->EncryptionSelect->count()) + ui->EncryptionSelect->removeItem(0); + + if (sel == AUTH_NONE_OPEN || sel == AUTH_NONE_WEP || + sel == AUTH_NONE_WEP_SHARED || sel == AUTH_IEEE8021X) { + ui->EncryptionSelect->addItem("None"); + ui->EncryptionSelect->addItem("WEP"); + ui->EncryptionSelect->setCurrentIndex(sel == AUTH_NONE_OPEN ? 0 : 1); + } else { + ui->EncryptionSelect->addItem("TKIP"); + ui->EncryptionSelect->addItem("CCMP"); + ui->EncryptionSelect->setCurrentIndex((sel == AUTH_WPA2_PSK || + sel == AUTH_WPA2_EAP) ? 1 : 0); + } + //wepEnabled(sel == AUTH_NONE_WEP || sel == AUTH_NONE_WEP_SHARED); +} +void NetworkManager::selectNetwork( const QString & sel ) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply); + + if (cmd.contains(QRegExp("^\\d+:"))) + cmd.truncate(cmd.indexOf(':')); + else + cmd = "any"; + cmd.prepend("SELECT_NETWORK "); + ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); + triggerUpdate(); +} +void NetworkManager::triggerUpdate() +{ + updateStatus(); + networkMayHaveChanged = true; + updateNetworks(); +} +void NetworkManager::ping() +{ + char buf[10]; + size_t len; + + if(wlanStartUpFailed) + return; + len = sizeof(buf) - 1; + if (ctrlRequest("PING", buf, &len) < 0) { + qDebug()<<"PING failed - trying to reconnect"; + if (openCtrlConnection(ctrl_iface) >= 0) { + qDebug()<<"Reconnected successfully"; + pingsToStatusUpdate = 0; + } + } + + pingsToStatusUpdate--; + if (pingsToStatusUpdate <= 0) { + updateStatus(); + updateNetworks(); + } + +#ifndef CONFIG_CTRL_IFACE_NAMED_PIPE + /* Use less frequent pings and status updates when the main window is + * hidden (running in taskbar). */ + int interval = isHidden() ? 20000 : 3000; + if (timer->interval() != interval) + timer->setInterval(interval); +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ +} + +void NetworkManager::on_pushButtonConnect_pressed() +{ + on_pushButtonDisconnect_pressed(); + + char reply[10]; + size_t reply_len = sizeof(reply); + ctrlRequest("REASSOCIATE", reply, &reply_len); +} + +void NetworkManager::on_pushButtonDisconnect_pressed() +{ + char reply[10]; + size_t reply_len = sizeof(reply); + ctrlRequest("DISCONNECT", reply, &reply_len); +} + +void NetworkManager::on_scanSSIDSelect_activated(const QString &arg1) +{ + //if (openCtrlConnection(sel.toLatin1().constData()) < 0) + // printf("Failed to open control connection to " + // "wpa_supplicant.\n"); + updateStatus(); + updateNetworks(); + QStringList networkString=scanResultMap[arg1]; + if(networkString.isEmpty()) + { + return; + } + // QString flags = sel->text(4); + QString flags = networkString.at(4); + int auth, encr = 0; + if (flags.indexOf("[WPA2-EAP") >= 0) + auth = AUTH_WPA2_EAP; + else if (flags.indexOf("[WPA-EAP") >= 0) + auth = AUTH_WPA_EAP; + else if (flags.indexOf("[WPA2-PSK") >= 0) + auth = AUTH_WPA2_PSK; + else if (flags.indexOf("[WPA-PSK") >= 0) + auth = AUTH_WPA_PSK; + else + auth = AUTH_NONE_OPEN; + + if (flags.indexOf("-CCMP") >= 0) + encr = 1; + else if (flags.indexOf("-TKIP") >= 0) + encr = 0; + else if (flags.indexOf("WEP") >= 0) { + encr = 1; + if (auth == AUTH_NONE_OPEN) + auth = AUTH_NONE_WEP; + } else + encr = 0; + + ui->authSelect->setCurrentIndex(auth); + authChanged(auth); + ui->EncryptionSelect->setCurrentIndex(encr); + + //wepEnabled(auth == AUTH_NONE_WEP); + + //getEapCapa(); + + //if (flags.indexOf("[WPS") >= 0) + // useWpsButton->setEnabled(true); + //bssid = sel.text(1); +} + + +void NetworkManager::on_pushButtonAddNetworkd_pressed() +{ + // addNetwork(); + + // 连接到指定的Wi-Fi网络 + QString ssid = ui->scanSSIDSelect->currentText(); //Wi-Fi网络名称 + QString password = ui->passwordEdit->text(); //Wi-Fi密码 + QProcess::execute("sudo", QStringList() << "nmcli" << "dev" << "wifi" << "connect" << ssid << "password" << password); + // QMessageBox::information(nullptr, "Wi-Fi", "正在尝试连接到 " + ssid); + + // 查询网络接口状态 + QProcess process; + process.start("ifconfig", QStringList() << "wlan0"); + process.waitForFinished(); + QString output = process.readAllStandardOutput(); + // QMessageBox::information(nullptr, "网络接口状态", output); + // 判断是否连接成功 + if (isWifiConnected(output)) { + QMessageBox::information(nullptr, "Wi-Fi", "成功连接到 " + ssid); + } else { + QMessageBox::information(nullptr, "Wi-Fi", "连接失败"); + } +} + +bool NetworkManager::isWifiConnected(const QString &output) { + // 使用正则表达式检查是否有inet地址 + QRegularExpression re("inet\\s+(\\d+\\.\\d+\\.\\d+\\.\\d+)"); + QRegularExpressionMatch match = re.match(output); + return match.hasMatch(); +} + +void NetworkManager::removeNetwork() +{ + char reply[10], cmd[256]; + size_t reply_len; + int id; + if (QMessageBox::information( + this, "wpa_gui", + tr("This will permanently remove the network\n" + "from the configuration. Do you really want\n" + "to remove this network?"), + tr("Yes"), tr("No")) != 0) + return; + id = ui->networkSelect->currentIndex(); + snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", id); + reply_len = sizeof(reply); + ctrlRequest(cmd, reply, &reply_len); + if (strncmp(reply, "OK", 2) != 0) { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to remove network from " + "wpa_supplicant\n" + "configuration.")); + } else { + triggerUpdate(); + ctrlRequest("SAVE_CONFIG", reply, &reply_len); + } +} + +void NetworkManager::on_pushButtonRemove_pressed() +{ + removeNetwork(); +} + + +void NetworkManager::on_GetJsonpushButton_clicked() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::question(this, tr("提示"),tr("是否去获取数据!"), QMessageBox::Ok | QMessageBox::Cancel); + if(ret != QMessageBox::Ok) + { + return; + } + +// qDebug()<<"on_GetJsonpushButton_clicked"; + QString str = "http://"; + //str += ui->SeverIP_lineEdit->text(); + QString ip_str; + ip_str = QString::number(sysPara->para.Json_IP[0]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[1]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[2]); + ip_str += "."; + ip_str += QString::number(sysPara->para.Json_IP[3]); + str += ip_str; + + str += ":"; + //str += ui->server_port_lineEdit->text(); + str +=QString::number(sysPara->para.Json_server_port); + + if(ui->TestradioButton->isChecked()){ +// qDebug()<<"get test value"; + // str += "/KLAPS/APSServer/ECode/GetProductUniqueCodeTest"; + str = "http://www.anhuikinglan.top:63025/KLAPS/APSServer/ECode/GetProductUniqueCodeTest"; + }else{ + str += "/KLAPS/APSServer/ECode/GetProductUniqueCode"; + } + + + //net_data->PrintNetGetData(str, ui->deviceID_lineEdit->text()); + net_data->PrintNetGetData(str, QString(sysPara->para.Json_device_code)); + ui->messege_info_label->setText(tr("获取数据中...")); +} + +void NetworkManager::onjson_timer_handler() +{ + static int count_time = 0; + + count_time++; + + ui->messege_info_label->setText( net_data->getMessege() ); + +// qDebug()<<"on_json_timer_handler"; + if(sysPara->para.totalProductCnt != 0 && sysPara->para.totalProductCnt >= sysPara->Get_JSON_DATA.ProductPlanQty){ + QString str = "http://"; + str += ui->SeverIP_lineEdit->text(); + str += ":"; + str += ui->server_port_lineEdit->text(); + + if(ui->TestradioButton->isChecked()){ + str += "/KLAPS/APSServer/ECode/UsedProductUniqueCodeTest"; + }else{ + str += "/KLAPS/APSServer/ECode/UsedProductUniqueCode"; + } + + net_data->PrintNetPostFinish(str); + sysPara->devOp->clearProductCnt(1 | 0x10 );// [3]总产品计数器清零FPGA + sysPara->para.totalProductCnt = 0; + emit net_stopPrint(); + ui->messege_info_label->setText(tr("上报数据中...")); + + if(sysPara->Get_JSON_DATA.TaskSwitchingMode == 1){ + on_GetJsonpushButton_clicked(); + } + } + + if(count_time == 20){ + + count_time = 0; + QString str = "http://"; + str += ui->SeverIP_lineEdit->text(); + str += ":"; + str += ui->server_port_lineEdit->text(); + if(ui->TestradioButton->isChecked()){ + str += "/KLAPS/APSServer/ECode/SubmitEquipmentCurrentStateTest"; + }else{ + str += "/KLAPS/APSServer/ECode/SubmitEquipmentCurrentState"; + } + net_data->PrintNetPostFinish(str); + +// qDebug()<<"upload data"; + ui->messege_info_label->setText(tr("上报数据中...")); + + } + +} + +void NetworkManager::onjson_server_error() +{ +// ui->net_state_label->setText(tr("通信失败")); +// qDebug()<<"on_json_server_error"; +} + + + + +void NetworkManager::on_applicate_pushButton_clicked() +{ + QString ip_str = ui->SeverIP_lineEdit->text(); + QStringList ip_list = ip_str.split("."); + QString ip1,ip2,ip3,ip4; + + if (ip_list.size() < 4){ + QMessageBox::information(this,tr("提示"),tr("IP设置错误!")); + return; + } + ip1 = ip_list.at(0); + ip2 = ip_list.at(1); + ip3 = ip_list.at(2); + ip4 = ip_list.at(3); + + sysPara->para.Json_IP[0] = ip1.toInt(); + sysPara->para.Json_IP[1] = ip2.toInt(); + sysPara->para.Json_IP[2] = ip3.toInt(); + sysPara->para.Json_IP[3] = ip4.toInt(); + + if(sysPara->para.Json_IP[0] > 255 || sysPara->para.Json_IP[1] > 255 + ||sysPara->para.Json_IP[2] > 255 ||sysPara->para.Json_IP[3] > 255){ + QMessageBox::information(this,tr("提示"),tr("IP设置错误!")); + return; + } + +// strcpy(sysPara->para.Json_IP, std_str); + + //sysPara->para.Json_device_code = ui->deviceID_lineEdit->text().toInt(); + strncpy(sysPara->para.Json_device_code, ui->deviceID_lineEdit->text().toStdString().data(),sizeof(sysPara->para.Json_device_code)-1); + sysPara->para.Json_server_port = ui->server_port_lineEdit->text().toInt(); + + QMessageBox::information(this,tr("提示"),tr("应用成功")); +// qDebug()<<"Json_device_code="<para.Json_device_code +// <<"Json_server_port="<para.Json_server_port +// <<"sysPara->para.Json_IP="<para.Json_IP[0] << sysPara->para.Json_IP[1] +// <para.Json_IP[2]<para.Json_IP[3]; + + sysPara->saveParaToFile(); +} + +//void NetworkManager::on_checkBoxShortNet_clicked(bool checked) +//{ +// net_data->m_bShortNet = checked; +//} + +void NetworkManager::on_checkBoxRemoveDigitCode_clicked(bool checked) +{ + sysPara->para.isRemoveDigitCode = checked; + emit OpenNewFile(); +} + +void NetworkManager::on_checkBoxRemoveCode_clicked(bool checked) +{ + //emit VariablePositionChange(checked); + sysPara->para.isRemoveCode = checked; + //emit OpenNewFile(); +} + +void NetworkManager::on_radioButtonGetDataEnable_clicked(bool checked) +{ + sysPara->para.isEnableGetDataButton = checked; +} + +void NetworkManager::updateAuthorization(int auth) +{ + if(auth & AUTH_SUPER_USER2) + { + ui->GetJsonpushButton->show(); + ui->GetJsonpushButton->show(); + ui->messege_info_label->show(); + ui->label->show(); + ui->deviceID_lineEdit->show(); + ui->label_2->show(); + ui->SeverIP_lineEdit->show(); + ui->label_4->show(); + ui->server_port_lineEdit->show(); + ui->TestradioButton->show(); +// ui->checkBoxShortNet->show(); + ui->checkBoxRemoveDigitCode->show(); + ui->applicate_pushButton->show(); + ui->checkBoxRemoveCode->show(); + ui->radioButtonGetDataEnable->show(); + } + else + { + ui->GetJsonpushButton->hide(); + ui->GetJsonpushButton->hide(); + ui->messege_info_label->hide(); + ui->label->hide(); + ui->deviceID_lineEdit->hide(); + ui->label_2->hide(); + ui->SeverIP_lineEdit->hide(); + ui->label_4->hide(); + ui->server_port_lineEdit->hide(); + ui->TestradioButton->hide(); +// ui->checkBoxShortNet->hide(); + ui->checkBoxRemoveDigitCode->hide(); + ui->applicate_pushButton->hide(); + ui->checkBoxRemoveCode->hide(); + ui->radioButtonGetDataEnable->hide(); + //sysPara->para.isEnableGetDataButton = false; + } +} + +bool NetworkManager::setEth0StaticIP() +{ + const uint8_t ip3=192,ip2=168,ip1=0,ip0=66;//100+QDateTime::currentDateTime().time().second();//IP + const uint8_t /*ip3=192,ip2=168,ip1=1,ip0=66,*/lanGW0=1;//网关 + const uint8_t lanMask3=255,lanMask2=255,lanMask1=255,lanMask0=0;//子网掩码 + + // 静态IP + QFile netInterface("/etc/network/interfaces"); + netInterface.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Truncate); + if (netInterface.isOpen()) { + QTextStream stream(&netInterface); + stream.seek(0); + stream << INTERFACE_OTHERS; + stream << " " <<"\n"; + stream << "# eth0 interfaces" <<"\n"; + stream << "auto eth0" <<"\n"; + stream << "iface eth0 inet static" <<"\n"; + stream << QString("address %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0) <<"\n"; + stream << QString("gateway %1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(lanGW0) <<"\n"; + stream << QString("netmask %1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0) <<"\n"; + stream << " \n"; + netInterface.close(); + + QStringList argrList; + QString ipAddrStr(QString("%1.%2.%3.%4").arg(ip3).arg(ip2).arg(ip1).arg(ip0)); + QString netMaskStr(QString("%1.%2.%3.%4").arg(lanMask3).arg(lanMask2).arg(lanMask1).arg(lanMask0)); + argrList<< LANINTERFACE_NAME << ipAddrStr << "netmask" << netMaskStr; + + qDebug() << "setEth0StaticIP->set argu:" << argrList; + + QProcess process; + process.startDetached("/sbin/ifconfig", argrList); + return true; + } + else + { + const QFile::FileError eno=netInterface.error(); + qDebug()<<"打开网络设置文件失败,error="<status.bLanConfigManual && this->setEth0StaticIP()) + { + qDebug()<<"设置静态IP-完成"; + sysPara->status.bLanConfigManual=true; + updateSysStatusToUI(); + } + else + { + qDebug()<<"设置静态IP-失败"; + } +} + +/** + 只有返回全是0的地址才需要设置成192.168.0.66这个固定地址 + * @brief NetworkManager::getCurrentNetworkIP + * @return 返回当前机器的IP地址 + */ +QString NetworkManager::getCurrentNetworkIP()const +{ + QString cip("0.0.0.0"); + if(sysPara){ + QList list = QNetworkInterface::allInterfaces(); //QNetworkInterface::interfaceFromName(LANINTERFACE_NAME); + //获取所有网络接口的列表 + foreach(QNetworkInterface interface,list) + { + foreach(QNetworkAddressEntry entry,interface.addressEntries()) + { + qDebug()<spinBoxLanIP3->setValue(lanIpList.at(0).toInt()); + ui->spinBoxLanIP2->setValue(lanIpList.at(1).toInt()); + ui->spinBoxLanIP1->setValue(lanIpList.at(2).toInt()); + ui->spinBoxLanIP0->setValue(lanIpList.at(3).toInt()); + } + } + + if(QString::compare(interface.name(), LANINTERFACE_NAME)==0) + { + QList entryList = interface.addressEntries(); + //获取IP地址条目列表,每个条目中包含一个IP地址,一个子网掩码和一个广播地址 + foreach(QNetworkAddressEntry entry,entryList) + { + QStringList lanIpList = entry.ip().toString().split("."); + if (lanIpList.size() == 4) { + return QString("%1.%2.%3.%4").arg(lanIpList.at(0)).arg(lanIpList.at(1)).arg(lanIpList.at(2)).arg(lanIpList.at(3)); + } + return cip; + } + } + } + } + return cip; +} + diff --git a/Network/NetworkManager.h b/Network/NetworkManager.h index f5faa15..398ba21 100644 --- a/Network/NetworkManager.h +++ b/Network/NetworkManager.h @@ -1,142 +1,142 @@ -#ifndef __NETWORKMANAGER_H__ -#define __NETWORKMANAGER_H__ -#include -#include -#include -#include -#include "ParaSettingUI.h" -#include "wpamsg.h" -#include -#include "myinclude.h" -#include "print_net.h" - -namespace Ui { -class NetworkManager; -} -enum { - AUTH_NONE_OPEN, - AUTH_NONE_WEP, - AUTH_NONE_WEP_SHARED, - AUTH_IEEE8021X, - AUTH_WPA_PSK, - AUTH_WPA_EAP, - AUTH_WPA2_PSK, - AUTH_WPA2_EAP -}; -struct ScanResult{ - char ssid[50]; - char bssid[50]; - char qual[20]; - char flags[80]; -}; - -#define WPA_GUI_KEY_DATA "[key is configured]" - -class NetworkManager : public QWidget,public ParaSettingUI -{ - Q_OBJECT -public: - explicit NetworkManager(QWidget *parent = 0); - ~NetworkManager(); - void bindSysPara(SysPara *sysPara); - void applyUIPara(); - void updateSysStatusToUI(); - void applyLanUIPara(void); - qint32 isIpv4Address(QString ip); - void updateAuthorization(int auth); - QString processHandle(QString); - bool isWifiConnected(const QString &output); - -public slots: - virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); - virtual void updateStatus(); - virtual void updateResults(); - virtual void updateNetworks(); - virtual void selectSSID( const QString & sel ); - virtual void selectNetwork( const QString & sel ); - virtual void processMsg(char *msg); - virtual void receiveMsgs(); - virtual int setNetworkParam(int id, const char *field, - const char *value, bool quote); - virtual void addNetwork(); - virtual void triggerUpdate(); - virtual void authChanged(int sel); - virtual void ping(); - virtual void removeNetwork(); - -Q_SIGNALS: - void updateJSONData(); - - void net_startPrint(); - void net_pausePrint(); - void net_stopPrint(); - void OpenNewFile(); -private slots: - void on_pushButtonSetIP_clicked(bool checked); - - void on_pushButtonSetCancel_clicked(bool checked); - - void on_pushButtonScan_pressed(); - - void on_pushButtonConnect_pressed(); - - void on_pushButtonDisconnect_pressed(); - - void on_scanSSIDSelect_activated(const QString &arg1); - - void on_pushButtonAddNetworkd_pressed(); - - void on_pushButtonRemove_pressed(); - - void on_GetJsonpushButton_clicked(); - - void onfinish_get_json(); - - void onjson_timer_handler(); - - void onjson_server_error(); - - void on_applicate_pushButton_clicked(); - void ShowNet_dataMessege(); - //void on_checkBoxShortNet_clicked(bool checked); - void on_checkBoxRemoveDigitCode_clicked(bool checked); - void on_checkBoxRemoveCode_clicked(bool checked); - void on_radioButtonGetDataEnable_clicked(bool checked); - void setEth0StaticIP_Thread(); -private: - Ui::NetworkManager *ui; - QProcess *processNetwork; - bool networkMayHaveChanged; - bool beSentScanCmd; - char *ctrl_iface; - int edit_network_id; - struct wpa_ctrl *ctrl_conn; - int pingsToStatusUpdate; - //WpaMsgList msgs; - char *ctrl_iface_dir; - struct wpa_ctrl *monitor_conn; - //UserDataRequest *udr; - QSocketNotifier *msgNotifier; - WpaMsgList msgs; - //struct ScanResult scanResult[30]; - QMap scanResultMap; - - PrintNet *net_data; - - int openCtrlConnection(const char *ifname); - QString wpaStateTranslate(char *state); - QString bssid; - QTimer *timer; - - QTimer *Json_timer; - bool Jsom_timer_stop; - - bool wlanStartUpFailed; - - bool Json_ip_init_done; - - bool setEth0StaticIP(); - QString getCurrentNetworkIP()const ; - -}; -#endif // __NETWORKMANAGER_H__ +#ifndef __NETWORKMANAGER_H__ +#define __NETWORKMANAGER_H__ +#include +#include +#include +#include +#include "ParaSettingUI.h" +#include "wpamsg.h" +#include +#include "myinclude.h" +#include "print_net.h" + +namespace Ui { +class NetworkManager; +} +enum { + AUTH_NONE_OPEN, + AUTH_NONE_WEP, + AUTH_NONE_WEP_SHARED, + AUTH_IEEE8021X, + AUTH_WPA_PSK, + AUTH_WPA_EAP, + AUTH_WPA2_PSK, + AUTH_WPA2_EAP +}; +struct ScanResult{ + char ssid[50]; + char bssid[50]; + char qual[20]; + char flags[80]; +}; + +#define WPA_GUI_KEY_DATA "[key is configured]" + +class NetworkManager : public QWidget,public ParaSettingUI +{ + Q_OBJECT +public: + explicit NetworkManager(QWidget *parent = 0); + ~NetworkManager(); + void bindSysPara(SysPara *sysPara); + void applyUIPara(); + void updateSysStatusToUI(); + void applyLanUIPara(void); + qint32 isIpv4Address(QString ip); + void updateAuthorization(int auth); + QString processHandle(QString); + bool isWifiConnected(const QString &output); + +public slots: + virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); + virtual void updateStatus(); + virtual void updateResults(); + virtual void updateNetworks(); + virtual void selectSSID( const QString & sel ); + virtual void selectNetwork( const QString & sel ); + virtual void processMsg(char *msg); + virtual void receiveMsgs(); + virtual int setNetworkParam(int id, const char *field, + const char *value, bool quote); + virtual void addNetwork(); + virtual void triggerUpdate(); + virtual void authChanged(int sel); + virtual void ping(); + virtual void removeNetwork(); + +Q_SIGNALS: + void updateJSONData(); + + void net_startPrint(); + void net_pausePrint(); + void net_stopPrint(); + void OpenNewFile(); +private slots: + void on_pushButtonSetIP_clicked(bool checked); + + void on_pushButtonSetCancel_clicked(bool checked); + + void on_pushButtonScan_pressed(); + + void on_pushButtonConnect_pressed(); + + void on_pushButtonDisconnect_pressed(); + + void on_scanSSIDSelect_activated(const QString &arg1); + + void on_pushButtonAddNetworkd_pressed(); + + void on_pushButtonRemove_pressed(); + + void on_GetJsonpushButton_clicked(); + + void onfinish_get_json(); + + void onjson_timer_handler(); + + void onjson_server_error(); + + void on_applicate_pushButton_clicked(); + void ShowNet_dataMessege(); + //void on_checkBoxShortNet_clicked(bool checked); + void on_checkBoxRemoveDigitCode_clicked(bool checked); + void on_checkBoxRemoveCode_clicked(bool checked); + void on_radioButtonGetDataEnable_clicked(bool checked); + void setEth0StaticIP_Thread(); +private: + Ui::NetworkManager *ui; + QProcess *processNetwork; + bool networkMayHaveChanged; + bool beSentScanCmd; + char *ctrl_iface; + int edit_network_id; + struct wpa_ctrl *ctrl_conn; + int pingsToStatusUpdate; + //WpaMsgList msgs; + char *ctrl_iface_dir; + struct wpa_ctrl *monitor_conn; + //UserDataRequest *udr; + QSocketNotifier *msgNotifier; + WpaMsgList msgs; + //struct ScanResult scanResult[30]; + QMap scanResultMap; + + PrintNet *net_data; + + int openCtrlConnection(const char *ifname); + QString wpaStateTranslate(char *state); + QString bssid; + QTimer *timer; + + QTimer *Json_timer; + bool Jsom_timer_stop; + + bool wlanStartUpFailed; + + bool Json_ip_init_done; + + bool setEth0StaticIP(); + QString getCurrentNetworkIP()const ; + +}; +#endif // __NETWORKMANAGER_H__ diff --git a/Network/NetworkManager.ui b/Network/NetworkManager.ui index 4865210..3b9d947 100644 --- a/Network/NetworkManager.ui +++ b/Network/NetworkManager.ui @@ -1,827 +1,827 @@ - - - NetworkManager - - - true - - - - 0 - 0 - 800 - 600 - - - - Form - - - - - - QLayout::SetDefaultConstraint - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - - - 0 - 37 - - - - 255 - - - 255 - - - - - - - - 0 - 0 - - - - 255 - - - 255 - - - - - - - - 0 - 0 - - - - 0 - - - 255 - - - 255 - - - - - - - - 0 - 0 - - - - 0 - - - 255 - - - 0 - - - - - - - - - WiFi: - - - - - - - Mask: - - - - - - - GW: - - - - - - - IP: - - - - - - - - - - - - - - IP: - - - - - - - - 0 - 0 - - - - Status: - - - - - - - - 0 - 37 - - - - 取消 - - - - - - - true - - - 主获取数据按钮 - - - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 0 - - - 255 - - - 0 - - - - - - - - 0 - 0 - - - - 255 - - - 0 - - - - - - - - 0 - 0 - - - - 0 - - - 255 - - - 0 - - - - - - - - 0 - 0 - - - - 0 - - - 254 - - - 1 - - - 0 - - - - - - - - - SSID: - - - - - - - 有线LAN - - - - - - - - - - - - - - - 0 - 37 - - - - 手动设定 - - - - - - - - 0 - 37 - - - - Disconnect - - - - - - - - - - 0 - 37 - - - - 255 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 255 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 255 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 255 - - - 1 - - - - - - - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - - Plaintext (open / no authentication) - - - - - Static WEP (no authentication) - - - - - Static WEP (Shared Key authentication) - - - - - IEEE 802.1X - - - - - WPA-Personal (PSK) - - - - - WPA-Enterprise (EAP) - - - - - WPA2-Personal (PSK) - - - - - WPA2-Enterprise (EAP) - - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - QLineEdit::PasswordEchoOnEdit - - - - - - - 设备码: - - - - - - - Encryption: - - - - - - - 服务IP: - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - - None - - - - - WEP - - - - - TKIP - - - - - CCMP - - - - - - - - - 0 - 0 - - - - 8754 - - - - - - - 服务端口: - - - - - - - PSK: - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - - - - - - 0 - 37 - - - - Connect - - - - - - - Password: - - - - - - - - 0 - 37 - - - - Scan - - - - - - - - 0 - 37 - - - - Remove - - - - - - - auth: - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - QLineEdit::PasswordEchoOnEdit - - - - - - - - 0 - 37 - - - - 获取数据 - - - - - - - ScanSSID - - - - - - - Network: - - - - - - - - 0 - 0 - - - - 1 - - - - - - - - 0 - 0 - - - - 47.111.170.144 - - - - - - - - 0 - 37 - - - - - 200 - 16777215 - - - - AddNetwork - - - - - - - - - - - - - - - 0 - 0 - - - - QRadioButton::indicator -{ - width: 30px; - height: 30px; -} - - - - - - - 测试 - - - false - - - - - - - - 0 - 37 - - - - 应用配置 - - - - - - - - 0 - 0 - - - - 去掉数字码 - - - - - - - - 0 - 0 - - - - 去掉QR码 - - - - - - - - - - + + + NetworkManager + + + true + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + QLayout::SetDefaultConstraint + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + + + 0 + 37 + + + + 255 + + + 255 + + + + + + + + 0 + 0 + + + + 255 + + + 255 + + + + + + + + 0 + 0 + + + + 0 + + + 255 + + + 255 + + + + + + + + 0 + 0 + + + + 0 + + + 255 + + + 0 + + + + + + + + + WiFi: + + + + + + + Mask: + + + + + + + GW: + + + + + + + IP: + + + + + + + + + + + + + + IP: + + + + + + + + 0 + 0 + + + + Status: + + + + + + + + 0 + 37 + + + + 取消 + + + + + + + true + + + 主获取数据按钮 + + + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 0 + + + 255 + + + 0 + + + + + + + + 0 + 0 + + + + 255 + + + 0 + + + + + + + + 0 + 0 + + + + 0 + + + 255 + + + 0 + + + + + + + + 0 + 0 + + + + 0 + + + 254 + + + 1 + + + 0 + + + + + + + + + SSID: + + + + + + + 有线LAN + + + + + + + + + + + + + + + 0 + 37 + + + + 手动设定 + + + + + + + + 0 + 37 + + + + Disconnect + + + + + + + + + + 0 + 37 + + + + 255 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 255 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 255 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 255 + + + 1 + + + + + + + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + + Plaintext (open / no authentication) + + + + + Static WEP (no authentication) + + + + + Static WEP (Shared Key authentication) + + + + + IEEE 802.1X + + + + + WPA-Personal (PSK) + + + + + WPA-Enterprise (EAP) + + + + + WPA2-Personal (PSK) + + + + + WPA2-Enterprise (EAP) + + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + QLineEdit::PasswordEchoOnEdit + + + + + + + 设备码: + + + + + + + Encryption: + + + + + + + 服务IP: + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + + None + + + + + WEP + + + + + TKIP + + + + + CCMP + + + + + + + + + 0 + 0 + + + + 8754 + + + + + + + 服务端口: + + + + + + + PSK: + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + + + + + + 0 + 37 + + + + Connect + + + + + + + Password: + + + + + + + + 0 + 37 + + + + Scan + + + + + + + + 0 + 37 + + + + Remove + + + + + + + auth: + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + QLineEdit::PasswordEchoOnEdit + + + + + + + + 0 + 37 + + + + 获取数据 + + + + + + + ScanSSID + + + + + + + Network: + + + + + + + + 0 + 0 + + + + 1 + + + + + + + + 0 + 0 + + + + 47.111.170.144 + + + + + + + + 0 + 37 + + + + + 200 + 16777215 + + + + AddNetwork + + + + + + + + + + + + + + + 0 + 0 + + + + QRadioButton::indicator +{ + width: 30px; + height: 30px; +} + + + + + + + 测试 + + + false + + + + + + + + 0 + 37 + + + + 应用配置 + + + + + + + + 0 + 0 + + + + 去掉数字码 + + + + + + + + 0 + 0 + + + + 去掉QR码 + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/.gitignore b/Network/wpa_gui-qt4_/.gitignore index da818cb..8e3854a 100644 --- a/Network/wpa_gui-qt4_/.gitignore +++ b/Network/wpa_gui-qt4_/.gitignore @@ -1,4 +1,4 @@ -.moc -.obj -.ui -qrc_icons.cpp +.moc +.obj +.ui +qrc_icons.cpp diff --git a/Network/wpa_gui-qt4_/addinterface.cpp b/Network/wpa_gui-qt4_/addinterface.cpp index 88d4603..79ba9de 100644 --- a/Network/wpa_gui-qt4_/addinterface.cpp +++ b/Network/wpa_gui-qt4_/addinterface.cpp @@ -1,245 +1,245 @@ -/* - * wpa_gui - AddInterface class - * Copyright (c) 2008, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include -#include "common/wpa_ctrl.h" - -#include - -#include "wpagui.h" -#include "addinterface.h" - -#ifdef CONFIG_NATIVE_WINDOWS -#include - -#ifndef WPA_KEY_ROOT -#define WPA_KEY_ROOT HKEY_LOCAL_MACHINE -#endif -#ifndef WPA_KEY_PREFIX -#define WPA_KEY_PREFIX TEXT("SOFTWARE\\wpa_supplicant") -#endif -#endif /* CONFIG_NATIVE_WINDOWS */ - - -AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent) - : QDialog(parent), wpagui(_wpagui) -{ - setWindowTitle(tr("Select network interface to add")); - resize(400, 200); - vboxLayout = new QVBoxLayout(this); - - interfaceWidget = new QTreeWidget(this); - interfaceWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); - interfaceWidget->setUniformRowHeights(true); - interfaceWidget->setSortingEnabled(true); - interfaceWidget->setColumnCount(3); - interfaceWidget->headerItem()->setText(0, tr("driver")); - interfaceWidget->headerItem()->setText(1, tr("interface")); - interfaceWidget->headerItem()->setText(2, tr("description")); - interfaceWidget->setItemsExpandable(FALSE); - interfaceWidget->setRootIsDecorated(FALSE); - vboxLayout->addWidget(interfaceWidget); - - connect(interfaceWidget, - SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, - SLOT(interfaceSelected(QTreeWidgetItem *))); - - addInterfaces(); -} - - -void AddInterface::addInterfaces() -{ -#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE - struct wpa_ctrl *ctrl; - int ret; - char buf[2048]; - size_t len; - - ctrl = wpa_ctrl_open(NULL); - if (ctrl == NULL) - return; - - len = sizeof(buf) - 1; - ret = wpa_ctrl_request(ctrl, "INTERFACE_LIST", 14, buf, &len, NULL); - if (ret < 0) { - wpa_ctrl_close(ctrl); - return; - } - buf[len] = '\0'; - - wpa_ctrl_close(ctrl); - - QString ifaces(buf); - QStringList lines = ifaces.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - QStringList arg = (*it).split(QChar('\t')); - if (arg.size() < 3) - continue; - QTreeWidgetItem *item = new QTreeWidgetItem(interfaceWidget); - if (!item) - break; - - item->setText(0, arg[0]); - item->setText(1, arg[1]); - item->setText(2, arg[2]); - } - - interfaceWidget->resizeColumnToContents(0); - interfaceWidget->resizeColumnToContents(1); - interfaceWidget->resizeColumnToContents(2); -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ -} - - -#ifdef CONFIG_NATIVE_WINDOWS -bool AddInterface::addRegistryInterface(const QString &ifname) -{ - HKEY hk, ihk; - LONG ret; - int id, tmp; - TCHAR name[10]; - DWORD val, i; - - ret = RegOpenKeyEx(WPA_KEY_ROOT, WPA_KEY_PREFIX TEXT("\\interfaces"), - 0, KEY_ENUMERATE_SUB_KEYS | KEY_CREATE_SUB_KEY, - &hk); - if (ret != ERROR_SUCCESS) - return false; - - id = -1; - - for (i = 0; ; i++) { - TCHAR name[255]; - DWORD namelen; - - namelen = 255; - ret = RegEnumKeyEx(hk, i, name, &namelen, NULL, NULL, NULL, - NULL); - - if (ret == ERROR_NO_MORE_ITEMS) - break; - - if (ret != ERROR_SUCCESS) - break; - - if (namelen >= 255) - namelen = 255 - 1; - name[namelen] = '\0'; - -#ifdef UNICODE - QString s((QChar *) name, namelen); -#else /* UNICODE */ - QString s(name); -#endif /* UNICODE */ - tmp = s.toInt(); - if (tmp > id) - id = tmp; - } - - id += 1; - -#ifdef UNICODE - wsprintf(name, L"%04d", id); -#else /* UNICODE */ - os_snprintf(name, sizeof(name), "%04d", id); -#endif /* UNICODE */ - ret = RegCreateKeyEx(hk, name, 0, NULL, 0, KEY_WRITE, NULL, &ihk, - NULL); - RegCloseKey(hk); - if (ret != ERROR_SUCCESS) - return false; - -#ifdef UNICODE - RegSetValueEx(ihk, TEXT("adapter"), 0, REG_SZ, - (LPBYTE) ifname.unicode(), - (ifname.length() + 1) * sizeof(TCHAR)); - -#else /* UNICODE */ - RegSetValueEx(ihk, TEXT("adapter"), 0, REG_SZ, - (LPBYTE) ifname.toLocal8Bit(), ifname.length() + 1); -#endif /* UNICODE */ - RegSetValueEx(ihk, TEXT("config"), 0, REG_SZ, - (LPBYTE) TEXT("default"), 8 * sizeof(TCHAR)); - RegSetValueEx(ihk, TEXT("ctrl_interface"), 0, REG_SZ, - (LPBYTE) TEXT(""), 1 * sizeof(TCHAR)); - val = 1; - RegSetValueEx(ihk, TEXT("skip_on_error"), 0, REG_DWORD, (LPBYTE) &val, - sizeof(val)); - - RegCloseKey(ihk); - return true; -} -#endif /* CONFIG_NATIVE_WINDOWS */ - - -void AddInterface::interfaceSelected(QTreeWidgetItem *sel) -{ - if (!sel) - return; - -#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE - struct wpa_ctrl *ctrl; - int ret; - char buf[20], cmd[256]; - size_t len; - - /* - * INTERFACE_ADD TABTABTABTAB - * TAB - */ - snprintf(cmd, sizeof(cmd), - "INTERFACE_ADD %s\t%s\t%s\t%s\t%s\t%s", - sel->text(1).toAscii().constData(), - "default", - sel->text(0).toAscii().constData(), - "yes", "", ""); - cmd[sizeof(cmd) - 1] = '\0'; - - ctrl = wpa_ctrl_open(NULL); - if (ctrl == NULL) - return; - - len = sizeof(buf) - 1; - ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len, NULL); - wpa_ctrl_close(ctrl); - - if (ret < 0) { - QMessageBox::warning(this, "wpa_gui", - tr("Add interface command could not be " - "completed.")); - return; - } - - buf[len] = '\0'; - if (buf[0] != 'O' || buf[1] != 'K') { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to add the interface.")); - return; - } - -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ - -#ifdef CONFIG_NATIVE_WINDOWS - if (!addRegistryInterface(sel->text(1))) { - QMessageBox::information(this, "wpa_gui", - tr("Failed to add the interface into " - "registry.")); - } -#endif /* CONFIG_NATIVE_WINDOWS */ - - wpagui->selectAdapter(sel->text(1)); - close(); -} +/* + * wpa_gui - AddInterface class + * Copyright (c) 2008, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include +#include "common/wpa_ctrl.h" + +#include + +#include "wpagui.h" +#include "addinterface.h" + +#ifdef CONFIG_NATIVE_WINDOWS +#include + +#ifndef WPA_KEY_ROOT +#define WPA_KEY_ROOT HKEY_LOCAL_MACHINE +#endif +#ifndef WPA_KEY_PREFIX +#define WPA_KEY_PREFIX TEXT("SOFTWARE\\wpa_supplicant") +#endif +#endif /* CONFIG_NATIVE_WINDOWS */ + + +AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent) + : QDialog(parent), wpagui(_wpagui) +{ + setWindowTitle(tr("Select network interface to add")); + resize(400, 200); + vboxLayout = new QVBoxLayout(this); + + interfaceWidget = new QTreeWidget(this); + interfaceWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + interfaceWidget->setUniformRowHeights(true); + interfaceWidget->setSortingEnabled(true); + interfaceWidget->setColumnCount(3); + interfaceWidget->headerItem()->setText(0, tr("driver")); + interfaceWidget->headerItem()->setText(1, tr("interface")); + interfaceWidget->headerItem()->setText(2, tr("description")); + interfaceWidget->setItemsExpandable(FALSE); + interfaceWidget->setRootIsDecorated(FALSE); + vboxLayout->addWidget(interfaceWidget); + + connect(interfaceWidget, + SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, + SLOT(interfaceSelected(QTreeWidgetItem *))); + + addInterfaces(); +} + + +void AddInterface::addInterfaces() +{ +#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE + struct wpa_ctrl *ctrl; + int ret; + char buf[2048]; + size_t len; + + ctrl = wpa_ctrl_open(NULL); + if (ctrl == NULL) + return; + + len = sizeof(buf) - 1; + ret = wpa_ctrl_request(ctrl, "INTERFACE_LIST", 14, buf, &len, NULL); + if (ret < 0) { + wpa_ctrl_close(ctrl); + return; + } + buf[len] = '\0'; + + wpa_ctrl_close(ctrl); + + QString ifaces(buf); + QStringList lines = ifaces.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + QStringList arg = (*it).split(QChar('\t')); + if (arg.size() < 3) + continue; + QTreeWidgetItem *item = new QTreeWidgetItem(interfaceWidget); + if (!item) + break; + + item->setText(0, arg[0]); + item->setText(1, arg[1]); + item->setText(2, arg[2]); + } + + interfaceWidget->resizeColumnToContents(0); + interfaceWidget->resizeColumnToContents(1); + interfaceWidget->resizeColumnToContents(2); +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ +} + + +#ifdef CONFIG_NATIVE_WINDOWS +bool AddInterface::addRegistryInterface(const QString &ifname) +{ + HKEY hk, ihk; + LONG ret; + int id, tmp; + TCHAR name[10]; + DWORD val, i; + + ret = RegOpenKeyEx(WPA_KEY_ROOT, WPA_KEY_PREFIX TEXT("\\interfaces"), + 0, KEY_ENUMERATE_SUB_KEYS | KEY_CREATE_SUB_KEY, + &hk); + if (ret != ERROR_SUCCESS) + return false; + + id = -1; + + for (i = 0; ; i++) { + TCHAR name[255]; + DWORD namelen; + + namelen = 255; + ret = RegEnumKeyEx(hk, i, name, &namelen, NULL, NULL, NULL, + NULL); + + if (ret == ERROR_NO_MORE_ITEMS) + break; + + if (ret != ERROR_SUCCESS) + break; + + if (namelen >= 255) + namelen = 255 - 1; + name[namelen] = '\0'; + +#ifdef UNICODE + QString s((QChar *) name, namelen); +#else /* UNICODE */ + QString s(name); +#endif /* UNICODE */ + tmp = s.toInt(); + if (tmp > id) + id = tmp; + } + + id += 1; + +#ifdef UNICODE + wsprintf(name, L"%04d", id); +#else /* UNICODE */ + os_snprintf(name, sizeof(name), "%04d", id); +#endif /* UNICODE */ + ret = RegCreateKeyEx(hk, name, 0, NULL, 0, KEY_WRITE, NULL, &ihk, + NULL); + RegCloseKey(hk); + if (ret != ERROR_SUCCESS) + return false; + +#ifdef UNICODE + RegSetValueEx(ihk, TEXT("adapter"), 0, REG_SZ, + (LPBYTE) ifname.unicode(), + (ifname.length() + 1) * sizeof(TCHAR)); + +#else /* UNICODE */ + RegSetValueEx(ihk, TEXT("adapter"), 0, REG_SZ, + (LPBYTE) ifname.toLocal8Bit(), ifname.length() + 1); +#endif /* UNICODE */ + RegSetValueEx(ihk, TEXT("config"), 0, REG_SZ, + (LPBYTE) TEXT("default"), 8 * sizeof(TCHAR)); + RegSetValueEx(ihk, TEXT("ctrl_interface"), 0, REG_SZ, + (LPBYTE) TEXT(""), 1 * sizeof(TCHAR)); + val = 1; + RegSetValueEx(ihk, TEXT("skip_on_error"), 0, REG_DWORD, (LPBYTE) &val, + sizeof(val)); + + RegCloseKey(ihk); + return true; +} +#endif /* CONFIG_NATIVE_WINDOWS */ + + +void AddInterface::interfaceSelected(QTreeWidgetItem *sel) +{ + if (!sel) + return; + +#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE + struct wpa_ctrl *ctrl; + int ret; + char buf[20], cmd[256]; + size_t len; + + /* + * INTERFACE_ADD TABTABTABTAB + * TAB + */ + snprintf(cmd, sizeof(cmd), + "INTERFACE_ADD %s\t%s\t%s\t%s\t%s\t%s", + sel->text(1).toAscii().constData(), + "default", + sel->text(0).toAscii().constData(), + "yes", "", ""); + cmd[sizeof(cmd) - 1] = '\0'; + + ctrl = wpa_ctrl_open(NULL); + if (ctrl == NULL) + return; + + len = sizeof(buf) - 1; + ret = wpa_ctrl_request(ctrl, cmd, strlen(cmd), buf, &len, NULL); + wpa_ctrl_close(ctrl); + + if (ret < 0) { + QMessageBox::warning(this, "wpa_gui", + tr("Add interface command could not be " + "completed.")); + return; + } + + buf[len] = '\0'; + if (buf[0] != 'O' || buf[1] != 'K') { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to add the interface.")); + return; + } + +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ + +#ifdef CONFIG_NATIVE_WINDOWS + if (!addRegistryInterface(sel->text(1))) { + QMessageBox::information(this, "wpa_gui", + tr("Failed to add the interface into " + "registry.")); + } +#endif /* CONFIG_NATIVE_WINDOWS */ + + wpagui->selectAdapter(sel->text(1)); + close(); +} diff --git a/Network/wpa_gui-qt4_/addinterface.h b/Network/wpa_gui-qt4_/addinterface.h index 9d9476a..d7a3268 100644 --- a/Network/wpa_gui-qt4_/addinterface.h +++ b/Network/wpa_gui-qt4_/addinterface.h @@ -1,45 +1,45 @@ -/* - * wpa_gui - AddInterface class - * Copyright (c) 2008, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef ADDINTERFACE_H -#define ADDINTERFACE_H - -#include - -#include -#include -#include - -class WpaGui; - -class AddInterface : public QDialog -{ - Q_OBJECT - -public: - AddInterface(WpaGui *_wpagui, QWidget *parent = 0); - -public slots: - virtual void interfaceSelected(QTreeWidgetItem *sel); - -private: - void addInterfaces(); - bool addRegistryInterface(const QString &ifname); - - QVBoxLayout *vboxLayout; - QTreeWidget *interfaceWidget; - WpaGui *wpagui; -}; - -#endif /* ADDINTERFACE_H */ +/* + * wpa_gui - AddInterface class + * Copyright (c) 2008, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef ADDINTERFACE_H +#define ADDINTERFACE_H + +#include + +#include +#include +#include + +class WpaGui; + +class AddInterface : public QDialog +{ + Q_OBJECT + +public: + AddInterface(WpaGui *_wpagui, QWidget *parent = 0); + +public slots: + virtual void interfaceSelected(QTreeWidgetItem *sel); + +private: + void addInterfaces(); + bool addRegistryInterface(const QString &ifname); + + QVBoxLayout *vboxLayout; + QTreeWidget *interfaceWidget; + WpaGui *wpagui; +}; + +#endif /* ADDINTERFACE_H */ diff --git a/Network/wpa_gui-qt4_/eventhistory.cpp b/Network/wpa_gui-qt4_/eventhistory.cpp index 1eb0b7b..4afb852 100644 --- a/Network/wpa_gui-qt4_/eventhistory.cpp +++ b/Network/wpa_gui-qt4_/eventhistory.cpp @@ -1,130 +1,130 @@ -/* - * wpa_gui - EventHistory class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include -#include - -#include "eventhistory.h" - - -int EventListModel::rowCount(const QModelIndex &) const -{ - return msgList.count(); -} - - -int EventListModel::columnCount(const QModelIndex &) const -{ - return 2; -} - - -QVariant EventListModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (role == Qt::DisplayRole) - if (index.column() == 0) { - if (index.row() >= timeList.size()) - return QVariant(); - return timeList.at(index.row()); - } else { - if (index.row() >= msgList.size()) - return QVariant(); - return msgList.at(index.row()); - } - else - return QVariant(); -} - - -QVariant EventListModel::headerData(int section, Qt::Orientation orientation, - int role) const -{ - if (role != Qt::DisplayRole) - return QVariant(); - - if (orientation == Qt::Horizontal) { - switch (section) { - case 0: - return QString(tr("Timestamp")); - case 1: - return QString(tr("Message")); - default: - return QVariant(); - } - } else - return QString("%1").arg(section); -} - - -void EventListModel::addEvent(QString time, QString msg) -{ - beginInsertRows(QModelIndex(), msgList.size(), msgList.size() + 1); - timeList << time; - msgList << msg; - endInsertRows(); -} - - -EventHistory::EventHistory(QWidget *parent, const char *, bool, Qt::WFlags) - : QDialog(parent) -{ - setupUi(this); - - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - - eventListView->setItemsExpandable(FALSE); - eventListView->setRootIsDecorated(FALSE); - elm = new EventListModel(parent); - eventListView->setModel(elm); -} - - -EventHistory::~EventHistory() -{ - destroy(); - delete elm; -} - - -void EventHistory::languageChange() -{ - retranslateUi(this); -} - - -void EventHistory::addEvents(WpaMsgList msgs) -{ - WpaMsgList::iterator it; - for (it = msgs.begin(); it != msgs.end(); it++) - addEvent(*it); -} - - -void EventHistory::addEvent(WpaMsg msg) -{ - bool scroll = true; - - if (eventListView->verticalScrollBar()->value() < - eventListView->verticalScrollBar()->maximum()) - scroll = false; - - elm->addEvent(msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"), - msg.getMsg()); - - if (scroll) - eventListView->scrollToBottom(); -} +/* + * wpa_gui - EventHistory class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include +#include + +#include "eventhistory.h" + + +int EventListModel::rowCount(const QModelIndex &) const +{ + return msgList.count(); +} + + +int EventListModel::columnCount(const QModelIndex &) const +{ + return 2; +} + + +QVariant EventListModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (role == Qt::DisplayRole) + if (index.column() == 0) { + if (index.row() >= timeList.size()) + return QVariant(); + return timeList.at(index.row()); + } else { + if (index.row() >= msgList.size()) + return QVariant(); + return msgList.at(index.row()); + } + else + return QVariant(); +} + + +QVariant EventListModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + if (orientation == Qt::Horizontal) { + switch (section) { + case 0: + return QString(tr("Timestamp")); + case 1: + return QString(tr("Message")); + default: + return QVariant(); + } + } else + return QString("%1").arg(section); +} + + +void EventListModel::addEvent(QString time, QString msg) +{ + beginInsertRows(QModelIndex(), msgList.size(), msgList.size() + 1); + timeList << time; + msgList << msg; + endInsertRows(); +} + + +EventHistory::EventHistory(QWidget *parent, const char *, bool, Qt::WFlags) + : QDialog(parent) +{ + setupUi(this); + + connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + + eventListView->setItemsExpandable(FALSE); + eventListView->setRootIsDecorated(FALSE); + elm = new EventListModel(parent); + eventListView->setModel(elm); +} + + +EventHistory::~EventHistory() +{ + destroy(); + delete elm; +} + + +void EventHistory::languageChange() +{ + retranslateUi(this); +} + + +void EventHistory::addEvents(WpaMsgList msgs) +{ + WpaMsgList::iterator it; + for (it = msgs.begin(); it != msgs.end(); it++) + addEvent(*it); +} + + +void EventHistory::addEvent(WpaMsg msg) +{ + bool scroll = true; + + if (eventListView->verticalScrollBar()->value() < + eventListView->verticalScrollBar()->maximum()) + scroll = false; + + elm->addEvent(msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"), + msg.getMsg()); + + if (scroll) + eventListView->scrollToBottom(); +} diff --git a/Network/wpa_gui-qt4_/eventhistory.h b/Network/wpa_gui-qt4_/eventhistory.h index 40dff6d..6bee763 100644 --- a/Network/wpa_gui-qt4_/eventhistory.h +++ b/Network/wpa_gui-qt4_/eventhistory.h @@ -1,63 +1,63 @@ -/* - * wpa_gui - EventHistory class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef EVENTHISTORY_H -#define EVENTHISTORY_H - -#include -#include "ui_eventhistory.h" - - -class EventListModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - EventListModel(QObject *parent = 0) - : QAbstractTableModel(parent) {} - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - void addEvent(QString time, QString msg); - -private: - QStringList timeList; - QStringList msgList; -}; - - -class EventHistory : public QDialog, public Ui::EventHistory -{ - Q_OBJECT - -public: - EventHistory(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); - ~EventHistory(); - -public slots: - virtual void addEvents(WpaMsgList msgs); - virtual void addEvent(WpaMsg msg); - -protected slots: - virtual void languageChange(); - -private: - EventListModel *elm; -}; - -#endif /* EVENTHISTORY_H */ +/* + * wpa_gui - EventHistory class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef EVENTHISTORY_H +#define EVENTHISTORY_H + +#include +#include "ui_eventhistory.h" + + +class EventListModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + EventListModel(QObject *parent = 0) + : QAbstractTableModel(parent) {} + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + void addEvent(QString time, QString msg); + +private: + QStringList timeList; + QStringList msgList; +}; + + +class EventHistory : public QDialog, public Ui::EventHistory +{ + Q_OBJECT + +public: + EventHistory(QWidget *parent = 0, const char *name = 0, + bool modal = false, Qt::WFlags fl = 0); + ~EventHistory(); + +public slots: + virtual void addEvents(WpaMsgList msgs); + virtual void addEvent(WpaMsg msg); + +protected slots: + virtual void languageChange(); + +private: + EventListModel *elm; +}; + +#endif /* EVENTHISTORY_H */ diff --git a/Network/wpa_gui-qt4_/eventhistory.ui b/Network/wpa_gui-qt4_/eventhistory.ui index afe9149..fbe76ef 100644 --- a/Network/wpa_gui-qt4_/eventhistory.ui +++ b/Network/wpa_gui-qt4_/eventhistory.ui @@ -1,61 +1,61 @@ - - EventHistory - - - - 0 - 0 - 533 - 285 - - - - Event history - - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOn - - - QAbstractItemView::NoSelection - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Close - - - - - - - - - wpamsg.h - - - - + + EventHistory + + + + 0 + 0 + 533 + 285 + + + + Event history + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoSelection + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + wpamsg.h + + + + diff --git a/Network/wpa_gui-qt4_/icons.qrc b/Network/wpa_gui-qt4_/icons.qrc index dd72c7e..4875dfd 100644 --- a/Network/wpa_gui-qt4_/icons.qrc +++ b/Network/wpa_gui-qt4_/icons.qrc @@ -1,9 +1,9 @@ - - - icons/wpa_gui.svg - icons/ap.svg - icons/laptop.svg - icons/group.svg - icons/invitation.svg - - + + + icons/wpa_gui.svg + icons/ap.svg + icons/laptop.svg + icons/group.svg + icons/invitation.svg + + diff --git a/Network/wpa_gui-qt4_/icons/README b/Network/wpa_gui-qt4_/icons/README index 3953238..09c0e7f 100644 --- a/Network/wpa_gui-qt4_/icons/README +++ b/Network/wpa_gui-qt4_/icons/README @@ -1,74 +1,74 @@ -wpa_gui icon files - -To convert the svg icons to other formats, make sure inkscape and imagemagick -are installed and use `make' to create various sized png and xpm icons. - - -wpa_gui.svg ------------ - -Copyright (c) 2008 Bernard Gray - -The wpa_gui icon is licensed under the GPL version 2. Alternatively, the icon -may be distributed under the terms of BSD license. - - -ap.svg ------- - -mystica_Wireless_Router.svg - -http://openclipart.org/media/files/mystica/8390 -Wireless Router -by: mystica -last change: April 20, 2008 10:32 pm (File added) -date: April 20, 2008 10:31 pm -license: PD - - -laptop.svg ----------- - -metalmarious_Laptop.svg - -http://openclipart.org/media/files/metalmarious/4056 -Laptop -by: metalmarious -last change: May 18, 2008 07:04 pm (File added) -date: August 27, 2007 04:44 am -license: PD - - -group.svg ---------- - -http://www.openclipart.org/detail/25428 -http://www.openclipart.org/people/Anonymous/Anonymous_Network.svg -Uploader: - Anonymous -Drawn by: - Andrew Fitzsimon / Anonymous -Created: - 2009-04-29 04:07:37 -Description: - A network icon by Andrew Fitzsimon. Etiquette Icon set. - From 0.18 OCAL database. - -Public Domain - - - -invitation.svg --------------- - -http://www.openclipart.org/detail/974 -http://www.openclipart.org/people/jean_victor_balin/jean_victor_balin_unknown_green.svg -Uploader: - jean_victor_balin -Drawn by: - jean_victor_balin -Created: - 2006-10-27 02:12:13 -Description: - -Public Domain +wpa_gui icon files + +To convert the svg icons to other formats, make sure inkscape and imagemagick +are installed and use `make' to create various sized png and xpm icons. + + +wpa_gui.svg +----------- + +Copyright (c) 2008 Bernard Gray + +The wpa_gui icon is licensed under the GPL version 2. Alternatively, the icon +may be distributed under the terms of BSD license. + + +ap.svg +------ + +mystica_Wireless_Router.svg + +http://openclipart.org/media/files/mystica/8390 +Wireless Router +by: mystica +last change: April 20, 2008 10:32 pm (File added) +date: April 20, 2008 10:31 pm +license: PD + + +laptop.svg +---------- + +metalmarious_Laptop.svg + +http://openclipart.org/media/files/metalmarious/4056 +Laptop +by: metalmarious +last change: May 18, 2008 07:04 pm (File added) +date: August 27, 2007 04:44 am +license: PD + + +group.svg +--------- + +http://www.openclipart.org/detail/25428 +http://www.openclipart.org/people/Anonymous/Anonymous_Network.svg +Uploader: + Anonymous +Drawn by: + Andrew Fitzsimon / Anonymous +Created: + 2009-04-29 04:07:37 +Description: + A network icon by Andrew Fitzsimon. Etiquette Icon set. + From 0.18 OCAL database. + +Public Domain + + + +invitation.svg +-------------- + +http://www.openclipart.org/detail/974 +http://www.openclipart.org/people/jean_victor_balin/jean_victor_balin_unknown_green.svg +Uploader: + jean_victor_balin +Drawn by: + jean_victor_balin +Created: + 2006-10-27 02:12:13 +Description: + +Public Domain diff --git a/Network/wpa_gui-qt4_/icons/ap.svg b/Network/wpa_gui-qt4_/icons/ap.svg index 51cc8ce..e3765d1 100644 --- a/Network/wpa_gui-qt4_/icons/ap.svg +++ b/Network/wpa_gui-qt4_/icons/ap.svg @@ -1,832 +1,832 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/icons/group.svg b/Network/wpa_gui-qt4_/icons/group.svg index 4ea959b..f082792 100644 --- a/Network/wpa_gui-qt4_/icons/group.svg +++ b/Network/wpa_gui-qt4_/icons/group.svg @@ -1,616 +1,616 @@ - - - - - - - Etiquette Icons - - - - hash - - filesystem - computer - icons - - - - - Andy Fitzsimon - - - - - Andy Fitzsimon - - - - - Andy Fitzsimon - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + Etiquette Icons + + + + hash + + filesystem + computer + icons + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/icons/invitation.svg b/Network/wpa_gui-qt4_/icons/invitation.svg index 1a02d13..613984e 100644 --- a/Network/wpa_gui-qt4_/icons/invitation.svg +++ b/Network/wpa_gui-qt4_/icons/invitation.svg @@ -1,374 +1,374 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Green Unknown - 2005-11-01 - - - Jean-Victor Balin - - - jean.victor.balin@gmail.com - - - - icon - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Green Unknown + 2005-11-01 + + + Jean-Victor Balin + + + jean.victor.balin@gmail.com + + + + icon + + + + + + + + + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/icons/laptop.svg b/Network/wpa_gui-qt4_/icons/laptop.svg index 06235f0..3eb6eab 100644 --- a/Network/wpa_gui-qt4_/icons/laptop.svg +++ b/Network/wpa_gui-qt4_/icons/laptop.svg @@ -1,1568 +1,1568 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/icons/wpa_gui.svg b/Network/wpa_gui-qt4_/icons/wpa_gui.svg index b3abf0a..47149d6 100644 --- a/Network/wpa_gui-qt4_/icons/wpa_gui.svg +++ b/Network/wpa_gui-qt4_/icons/wpa_gui.svg @@ -1,256 +1,256 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/icons_png.qrc b/Network/wpa_gui-qt4_/icons_png.qrc index 9a30b7f..16bd226 100644 --- a/Network/wpa_gui-qt4_/icons_png.qrc +++ b/Network/wpa_gui-qt4_/icons_png.qrc @@ -1,9 +1,9 @@ - - - icons/hicolor/16x16/apps/wpa_gui.png - icons/hicolor/32x32/apps/ap.png - icons/hicolor/32x32/apps/laptop.png - icons/hicolor/32x32/apps/group.png - icons/hicolor/32x32/apps/invitation.png - - + + + icons/hicolor/16x16/apps/wpa_gui.png + icons/hicolor/32x32/apps/ap.png + icons/hicolor/32x32/apps/laptop.png + icons/hicolor/32x32/apps/group.png + icons/hicolor/32x32/apps/invitation.png + + diff --git a/Network/wpa_gui-qt4_/lang/.gitignore b/Network/wpa_gui-qt4_/lang/.gitignore index 8df47d5..e7b0081 100644 --- a/Network/wpa_gui-qt4_/lang/.gitignore +++ b/Network/wpa_gui-qt4_/lang/.gitignore @@ -1 +1 @@ -*.qm +*.qm diff --git a/Network/wpa_gui-qt4_/lang/wpa_gui_de.ts b/Network/wpa_gui-qt4_/lang/wpa_gui_de.ts index d7a9c89..e6aeff8 100644 --- a/Network/wpa_gui-qt4_/lang/wpa_gui_de.ts +++ b/Network/wpa_gui-qt4_/lang/wpa_gui_de.ts @@ -1,1262 +1,1262 @@ - - - - - AddInterface - - - Select network interface to add - Wähle die Netzwerkschnittstelle zum hinzufügen aus - - - - driver - Treiber - - - - interface - Schnittstelle - - - - description - Beschreibung - - - - Add interface command could not be completed. - Das Schnittstellen hinzufügen Kommando konnte nicht abgeschlossen werden. - - - - Failed to add the interface. - Fehler beim hinzufügen der Schnittstelle. - - - - Failed to add the interface into registry. - Fehler beim hinzufügen der Schnittstelle in die Registry. - - - - ErrorMsg - - - wpa_gui error - wpa_gui Fehler - - - - EventHistory - - - Event history - Ereignis Historie - - - - Close - Schließen - - - - EventListModel - - - Timestamp - Zeit - - - - Message - Meldung - - - - NetworkConfig - - - NetworkConfig - - - - - Cancel - Abbrechen - - - - SSID - SSID - - - - Network name (Service Set IDentifier) - Netzwerkname (Service Set IDentifier) - - - - Authentication - Authentifizierung - - - - Plaintext (open / no authentication) - Plaintext (offen / keine Authentifizierung) - - - - Static WEP (no authentication) - Static WEP (keine Authentifizierung) - - - - Static WEP (Shared Key authentication) - - - - - IEEE 802.1X - - - - - WPA-Personal (PSK) - - - - - WPA-Enterprise (EAP) - - - - - WPA2-Personal (PSK) - - - - - WPA2-Enterprise (EAP) - - - - - Encryption - Verschlüsselung - - - - None - Keine - - - - WEP - - - - - TKIP - - - - - CCMP - - - - - PSK - - - - - WPA/WPA2 pre-shared key or passphrase - WPA/WPA2 Pre-Shared Key oder Passphrase - - - - EAP method - EAP Verfahren - - - - Identity - Identität - - - - Username/Identity for EAP methods - Nutzername/Identitär für die EAP Verfahren - - - - Password - Passwort - - - - Password for EAP methods - Passwort für die EAP Verfahren - - - - CA certificate - CA Zertifikat - - - - WEP keys - WEP Schlüssel - - - - key 0 - Schlüssel 0 - - - - key 1 - Schlüssel 1 - - - - key 3 - Schlüssel 3 - - - - key 2 - Schlüssel 2 - - - - Optional Settings - Optionale Einstellungen - - - - Network Identification String - Netzwerk Indentifikations Zeichenfolge - - - - Network Priority - Netzwerk Priorität - - - - IDString - - - - - Priority - Priorität - - - - Inner auth - Geheime Auth - - - - Add - Hinzufügen - - - - Remove - Entfernen - - - - WPS - - - - - WPA Pre-Shared Key Error - WPA Pre Shared Key Fehler - - - - WPA-PSK requires a passphrase of 8 to 63 characters -or 64 hex digit PSK - WPA PSK benötigt ein Passphrase mit 8 bis 63 Zeichen -oder 64 hexadezimal stelligen PSK - - - - Network ID Error - Netzwerk ID Fehler - - - - Network ID String contains non-word characters. -It must be a simple string, without spaces, containing -only characters in this range: [A-Za-z0-9_-] - - Netzwerk ID Zeichnfolge beinhaltet ungültige Zeichen. -Es muss eine einfache Zeichnfolge aus [A-Za-z0-9_] ohne -Leerzeichen sein - - - - - Failed to add network to wpa_supplicant -configuration. - Hinzufügen des Netzwerks in die wpa_supplicant -Konfiguration fehlgeschlagen. - - - - Failed to enable network in wpa_supplicant -configuration. - Aktivieren des Netzwerks in der wpa_supplicant -Konfiguration fehlgeschlagen. - - - - This will permanently remove the network -from the configuration. Do you really want -to remove this network? - Dies wird das Netzwerk permanent aus -der Konfiguration entfernen. Möchtest du -das Netzwerk wirklich entfernen? - - - - Yes - Ja - - - - No - Nein - - - - Failed to remove network from wpa_supplicant -configuration. - Entfernen des Netzwerks aus der wpa_supplicant -Konfiguration fehlgeschlagen. - - - - Peers - - - Peers - - - - - Associated station - Verbundene Stationen - - - - AP - - - - - WPS AP - - - - - WPS PIN needed - WPS PIN wird benötigt - - - - ER: WPS AP - - - - - ER: WPS AP (Unconfigured) - ER: WPS AP (nicht konfiguriert) - - - - ER: WPS Enrollee - - - - - WPS Enrollee - - - - - Enter WPS PIN - WPS PIN Eingabe - - - - Connect (PBC) - Verbinden (PBC) - - - - Enroll (PBC) - Anmelden (PBC) - - - - Learn Configuration - Konfiguration lernen - - - - Properties - Eigenschaften - - - - Refresh - Aktualisieren - - - - PIN: - - - - - PIN for - Pin für - - - - Failed to set the WPS PIN. - Setzten des WPS PIN fehlgeschlagen. - - - - Peer Properties - Peer Eigenschaften - - - - Name: - - - - - Address: - - - - - UUID: - - - - - Primary Device Type: - Primärer Geräte Typ: - - - - SSID: - - - - - Configuration Methods: - Konfigurationsverfahren: - - - - [USBA] - - - - - [Ethernet] - - - - - [Label] - - - - - [Display] - - - - - [Ext. NFC Token] - - - - - [Int. NFC Token] - - - - - [NFC Interface] - - - - - [Push Button] - - - - - [Keypad] - - - - - Device Password ID: - Geräte Passwort ID: - - - - (Default PIN) - - - - - (User-specified PIN) - - - - - (Machine-specified PIN) - - - - - (Rekey) - - - - - (Push Button) - - - - - (Registrar-specified) - - - - - Failed to start WPS PBC. - Starten von WPS PBC fehlgeschlagen. - - - - AP PIN: - - - - - AP PIN for - AP PIN für - - - - Failed to start learning AP configuration. - Fehler beim erkennen der AP Konfiguration. - - - - ScanResults - - - Scan results - Scan Ergebnisse - - - - SSID - - - - - BSSID - - - - - frequency - Frequenz - - - - signal - Signal - - - - flags - Flags - - - - Scan - Scannen - - - - Close - Schließen - - - - UserDataRequest - - - Authentication credentials required - Authentifzierungs Beglaubigung nötig - - - - &OK - - - - - &Cancel - - - - - Password: - Passwort: - - - - New password: - Neues Passwort: - - - - Identity: - Identität: - - - - Private key passphrase: - Privater Key Passphrase: - - - - WpaGui - - - wpa_gui - - - - - Adapter: - - - - - Network: - Netzwerk: - - - - Current Status - Aktueller Status - - - - - Status: - - - - - Last message: - Letzte Meldung: - - - - Authentication: - Authentifizierung: - - - - Encryption: - Verschlüsselung: - - - - SSID: - - - - - BSSID: - - - - - IP address: - IP Adresse: - - - - Connect - Verbinden - - - - Disconnect - Trennen - - - - - Scan - Scannen - - - - Manage Networks - Netzwerke verwalten - - - - Enabled - Aktiviert - - - - Edit - Bearbeiten - - - - Remove - Entfernen - - - - Disabled - Deaktiviert - - - - Add - Hinzufügen - - - - WPS - - - - - PBC - push button - PBC - Taste - - - - Generate PIN - PIN erzeugen - - - - PIN: - - - - - Use AP PIN - AP PIN verwenden - - - - AP PIN: - - - - - &File - &Datei - - - - &Network - &Netzwerk - - - - &Help - &Hilfe - - - - Event &History - Ereignis &Historie - - - - &Save Configuration - Konfiguration &Speichern - - - - Ctrl+S - - - - - E&xit - &Beenden - - - - Ctrl+Q - - - - - &Add - &Hinzufügen - - - - &Edit - &Bearbeiten - - - - &Remove - &Entfernen - - - - E&nable All - Alle &aktivieren - - - - &Disable All - Alle &deaktivieren - - - - Re&move All - Alle &entfernen - - - - &Contents... - &Inhalt... - - - - &Index... - - - - - &About - &Über - - - - &Wi-Fi Protected Setup - - - - - &Peers - - - - - Stop Service - Dienst stoppen - - - - Start Service - Dienst starten - - - - Add Interface - Schnittstelle hinzufügen - - - - connecting to wpa_supplicant - Verbindungsaufbau zu wpa_supplicant - - - - wpa_supplicant service is not running. -Do you want to start it? - wpa_supplicant ist nicht gestartet. -Möchtest du ihn starten? - - - - Disconnected - Getrennt - - - - Inactive - Inaktiv - - - - Scanning - Scannen - - - - Authenticating - Authentifizieren - - - - Associating - Assoziieren - - - - Associated - Assoziiert - - - - 4-Way Handshake - 4-Wege Handshake - - - - Group Handshake - Gruppen Handshake - - - - Completed - Abgeschlossen - - - - Unknown - Unbekannt - - - - Could not get status from wpa_supplicant - Status konnte nicht von wpa_supplicant abgerufen werden - - - - No network interfaces in use. -Would you like to add one? - Es ist keine Netzwerkschnittstelle in verwendung. -Möchtest du eine hinzufügen? - - - - - - - Select any network - Wähle beliebiges Netzwerk - - - - Disconnected from network. - Getrennt vom Netzwerk. - - - - Connection to network established. - Verbindung zum Netzwerk wurde aufgebaut. - - - - - WPS AP in active PBC mode found - WPS AP im aktiven PBC Modus gefunden - - - - Press the PBC button on the screen to start registration - Drücke den PBC Knopf auf dem Bildschirm um die Registrierung zu starten - - - - WPS AP with recently selected registrar - WPS AP mit kürzlich ausgewähltem Registrator - - - - WPS AP detected - WPS AP erkannt - - - - PBC mode overlap detected - PBC Modus Overlap erkannt - - - - More than one AP is currently in active WPS PBC mode. Wait couple of minutes and try again - Mehr als ein AP ist momentan im aktiven WPS PBC Modus. Versuch es in ein paar Minuten nochmal - - - - Network configuration received - Netzwerk Konfiguration empfangen - - - - Registration started - Registrierung gestartet - - - - Registrar does not yet know PIN - Registrator kennt den PIN noch nicht - - - - Registration failed - Registrierung fehlgeschlagen - - - - Registration succeeded - Registrierung erfolgreich - - - - - No Networks - Keine Netzwerke - - - - There are no networks to edit. - - Keine Netzwerke zum bearbeiten. - - - - - - Select A Network - Wähle ein Netzwerk - - - - Select a network from the list to edit it. - - Wähle ein Netzwerk aus der Liste zum bearbeiten. - - - - - There are no networks to remove. - - Es sind keine Netzwerke zum entfernen vorhanden. - - - - - Select a network from the list to remove it. - - Wähle ein Netzwerk aus der Liste zum entfernen. - - - - - Failed to save configuration - Speichern der Konfiguration fehlgeschlagen - - - - The configuration could not be saved. - -The update_config=1 configuration option -must be used for configuration saving to -be permitted. - - Die Konfiguration konnte nicht gespeichert werden. - -Die Einstellung update_config=1 muss gesetzt sein, -damit Konfigurationen gespeichert werden können. - - - - - Saved configuration - Konfiguration gespeichert - - - - The current configuration was saved. - - Die aktuelle Konfiguration wurde gespeichert. - - - - - - wpa_supplicant user interface - - wpa_supplicant Benutzerschnittstelle - - - - &Disconnect - &Trennen - - - - Re&connect - &Wiederverbinden - - - - &Event History - &Ereignis Historie - - - - Scan &Results - Scan E&rgebnisse - - - - S&tatus - - - - - &Show Window - &Fenster anzeigen - - - - &Hide Window - &Fenster ausblenden - - - - &Quit - &Beenden - - - - will keep running in the system tray. - wird weiterhin in der System Ablage laufen. - - - - systray - System Ablage - - - - The program will keep running in the system tray. - Das Programm wird weiterhin in der System Ablage laufen. - - - - Press the push button on the AP to start the PBC mode. - Drücke die Taste am AP um den PBC Modus zu starten. - - - - If you have not yet done so, press the push button on the AP to start the PBC mode. - Wenn Sie es noch nicht getan haben, so drücken Sie die Taste am AP um den PBC Modus zu starten. - - - - - Waiting for Registrar - Warte auf Registrator - - - - Enter the generated PIN into the Registrar (either the internal one in the AP or an external one). - Geben Sie den generierten PIN in der Registrierungsstelle ein (entweder der interne oder der externe im AP). - - - - WPS AP selected from scan results - WPS AP ausgewählt aus Scan Ergebnissen - - - - If you want to use an AP device PIN, e.g., from a label in the device, enter the eight digit AP PIN and click Use AP PIN button. - Wenn Sie einen AP Geräte PIN verwenden möchten, z.B.: von einem Aufkleber am Gerät, geben Sie denn acht stelligen AP PIN ein und klicken Sie auf den AP PIN Knopf. - - - - Waiting for AP/Enrollee - Warte auf AP/Bewerber - - - - Connected to the network - Verbunden zum Netzwerk - - - - Stopped - Gestoppt - - - - - OpenSCManager failed - OpenSCManager fehlgeschlagen - - - - - OpenService failed - OpenService fehlgeschlagen - - - - Failed to start wpa_supplicant service - Starten des wpa_supplicant Dienstes fehlgeschlagen - - - - Failed to stop wpa_supplicant service - Stoppen des wpa_supplicant Dienstes fehlgeschlagen - - - OpenSCManager failed: %d - - OpenSCManager fehlgeschlagen: %d - - - - OpenService failed: %d - - - OpenService fehlgeschlagen: %d - - - - - + + + + + AddInterface + + + Select network interface to add + Wähle die Netzwerkschnittstelle zum hinzufügen aus + + + + driver + Treiber + + + + interface + Schnittstelle + + + + description + Beschreibung + + + + Add interface command could not be completed. + Das Schnittstellen hinzufügen Kommando konnte nicht abgeschlossen werden. + + + + Failed to add the interface. + Fehler beim hinzufügen der Schnittstelle. + + + + Failed to add the interface into registry. + Fehler beim hinzufügen der Schnittstelle in die Registry. + + + + ErrorMsg + + + wpa_gui error + wpa_gui Fehler + + + + EventHistory + + + Event history + Ereignis Historie + + + + Close + Schließen + + + + EventListModel + + + Timestamp + Zeit + + + + Message + Meldung + + + + NetworkConfig + + + NetworkConfig + + + + + Cancel + Abbrechen + + + + SSID + SSID + + + + Network name (Service Set IDentifier) + Netzwerkname (Service Set IDentifier) + + + + Authentication + Authentifizierung + + + + Plaintext (open / no authentication) + Plaintext (offen / keine Authentifizierung) + + + + Static WEP (no authentication) + Static WEP (keine Authentifizierung) + + + + Static WEP (Shared Key authentication) + + + + + IEEE 802.1X + + + + + WPA-Personal (PSK) + + + + + WPA-Enterprise (EAP) + + + + + WPA2-Personal (PSK) + + + + + WPA2-Enterprise (EAP) + + + + + Encryption + Verschlüsselung + + + + None + Keine + + + + WEP + + + + + TKIP + + + + + CCMP + + + + + PSK + + + + + WPA/WPA2 pre-shared key or passphrase + WPA/WPA2 Pre-Shared Key oder Passphrase + + + + EAP method + EAP Verfahren + + + + Identity + Identität + + + + Username/Identity for EAP methods + Nutzername/Identitär für die EAP Verfahren + + + + Password + Passwort + + + + Password for EAP methods + Passwort für die EAP Verfahren + + + + CA certificate + CA Zertifikat + + + + WEP keys + WEP Schlüssel + + + + key 0 + Schlüssel 0 + + + + key 1 + Schlüssel 1 + + + + key 3 + Schlüssel 3 + + + + key 2 + Schlüssel 2 + + + + Optional Settings + Optionale Einstellungen + + + + Network Identification String + Netzwerk Indentifikations Zeichenfolge + + + + Network Priority + Netzwerk Priorität + + + + IDString + + + + + Priority + Priorität + + + + Inner auth + Geheime Auth + + + + Add + Hinzufügen + + + + Remove + Entfernen + + + + WPS + + + + + WPA Pre-Shared Key Error + WPA Pre Shared Key Fehler + + + + WPA-PSK requires a passphrase of 8 to 63 characters +or 64 hex digit PSK + WPA PSK benötigt ein Passphrase mit 8 bis 63 Zeichen +oder 64 hexadezimal stelligen PSK + + + + Network ID Error + Netzwerk ID Fehler + + + + Network ID String contains non-word characters. +It must be a simple string, without spaces, containing +only characters in this range: [A-Za-z0-9_-] + + Netzwerk ID Zeichnfolge beinhaltet ungültige Zeichen. +Es muss eine einfache Zeichnfolge aus [A-Za-z0-9_] ohne +Leerzeichen sein + + + + + Failed to add network to wpa_supplicant +configuration. + Hinzufügen des Netzwerks in die wpa_supplicant +Konfiguration fehlgeschlagen. + + + + Failed to enable network in wpa_supplicant +configuration. + Aktivieren des Netzwerks in der wpa_supplicant +Konfiguration fehlgeschlagen. + + + + This will permanently remove the network +from the configuration. Do you really want +to remove this network? + Dies wird das Netzwerk permanent aus +der Konfiguration entfernen. Möchtest du +das Netzwerk wirklich entfernen? + + + + Yes + Ja + + + + No + Nein + + + + Failed to remove network from wpa_supplicant +configuration. + Entfernen des Netzwerks aus der wpa_supplicant +Konfiguration fehlgeschlagen. + + + + Peers + + + Peers + + + + + Associated station + Verbundene Stationen + + + + AP + + + + + WPS AP + + + + + WPS PIN needed + WPS PIN wird benötigt + + + + ER: WPS AP + + + + + ER: WPS AP (Unconfigured) + ER: WPS AP (nicht konfiguriert) + + + + ER: WPS Enrollee + + + + + WPS Enrollee + + + + + Enter WPS PIN + WPS PIN Eingabe + + + + Connect (PBC) + Verbinden (PBC) + + + + Enroll (PBC) + Anmelden (PBC) + + + + Learn Configuration + Konfiguration lernen + + + + Properties + Eigenschaften + + + + Refresh + Aktualisieren + + + + PIN: + + + + + PIN for + Pin für + + + + Failed to set the WPS PIN. + Setzten des WPS PIN fehlgeschlagen. + + + + Peer Properties + Peer Eigenschaften + + + + Name: + + + + + Address: + + + + + UUID: + + + + + Primary Device Type: + Primärer Geräte Typ: + + + + SSID: + + + + + Configuration Methods: + Konfigurationsverfahren: + + + + [USBA] + + + + + [Ethernet] + + + + + [Label] + + + + + [Display] + + + + + [Ext. NFC Token] + + + + + [Int. NFC Token] + + + + + [NFC Interface] + + + + + [Push Button] + + + + + [Keypad] + + + + + Device Password ID: + Geräte Passwort ID: + + + + (Default PIN) + + + + + (User-specified PIN) + + + + + (Machine-specified PIN) + + + + + (Rekey) + + + + + (Push Button) + + + + + (Registrar-specified) + + + + + Failed to start WPS PBC. + Starten von WPS PBC fehlgeschlagen. + + + + AP PIN: + + + + + AP PIN for + AP PIN für + + + + Failed to start learning AP configuration. + Fehler beim erkennen der AP Konfiguration. + + + + ScanResults + + + Scan results + Scan Ergebnisse + + + + SSID + + + + + BSSID + + + + + frequency + Frequenz + + + + signal + Signal + + + + flags + Flags + + + + Scan + Scannen + + + + Close + Schließen + + + + UserDataRequest + + + Authentication credentials required + Authentifzierungs Beglaubigung nötig + + + + &OK + + + + + &Cancel + + + + + Password: + Passwort: + + + + New password: + Neues Passwort: + + + + Identity: + Identität: + + + + Private key passphrase: + Privater Key Passphrase: + + + + WpaGui + + + wpa_gui + + + + + Adapter: + + + + + Network: + Netzwerk: + + + + Current Status + Aktueller Status + + + + + Status: + + + + + Last message: + Letzte Meldung: + + + + Authentication: + Authentifizierung: + + + + Encryption: + Verschlüsselung: + + + + SSID: + + + + + BSSID: + + + + + IP address: + IP Adresse: + + + + Connect + Verbinden + + + + Disconnect + Trennen + + + + + Scan + Scannen + + + + Manage Networks + Netzwerke verwalten + + + + Enabled + Aktiviert + + + + Edit + Bearbeiten + + + + Remove + Entfernen + + + + Disabled + Deaktiviert + + + + Add + Hinzufügen + + + + WPS + + + + + PBC - push button + PBC - Taste + + + + Generate PIN + PIN erzeugen + + + + PIN: + + + + + Use AP PIN + AP PIN verwenden + + + + AP PIN: + + + + + &File + &Datei + + + + &Network + &Netzwerk + + + + &Help + &Hilfe + + + + Event &History + Ereignis &Historie + + + + &Save Configuration + Konfiguration &Speichern + + + + Ctrl+S + + + + + E&xit + &Beenden + + + + Ctrl+Q + + + + + &Add + &Hinzufügen + + + + &Edit + &Bearbeiten + + + + &Remove + &Entfernen + + + + E&nable All + Alle &aktivieren + + + + &Disable All + Alle &deaktivieren + + + + Re&move All + Alle &entfernen + + + + &Contents... + &Inhalt... + + + + &Index... + + + + + &About + &Über + + + + &Wi-Fi Protected Setup + + + + + &Peers + + + + + Stop Service + Dienst stoppen + + + + Start Service + Dienst starten + + + + Add Interface + Schnittstelle hinzufügen + + + + connecting to wpa_supplicant + Verbindungsaufbau zu wpa_supplicant + + + + wpa_supplicant service is not running. +Do you want to start it? + wpa_supplicant ist nicht gestartet. +Möchtest du ihn starten? + + + + Disconnected + Getrennt + + + + Inactive + Inaktiv + + + + Scanning + Scannen + + + + Authenticating + Authentifizieren + + + + Associating + Assoziieren + + + + Associated + Assoziiert + + + + 4-Way Handshake + 4-Wege Handshake + + + + Group Handshake + Gruppen Handshake + + + + Completed + Abgeschlossen + + + + Unknown + Unbekannt + + + + Could not get status from wpa_supplicant + Status konnte nicht von wpa_supplicant abgerufen werden + + + + No network interfaces in use. +Would you like to add one? + Es ist keine Netzwerkschnittstelle in verwendung. +Möchtest du eine hinzufügen? + + + + + + + Select any network + Wähle beliebiges Netzwerk + + + + Disconnected from network. + Getrennt vom Netzwerk. + + + + Connection to network established. + Verbindung zum Netzwerk wurde aufgebaut. + + + + + WPS AP in active PBC mode found + WPS AP im aktiven PBC Modus gefunden + + + + Press the PBC button on the screen to start registration + Drücke den PBC Knopf auf dem Bildschirm um die Registrierung zu starten + + + + WPS AP with recently selected registrar + WPS AP mit kürzlich ausgewähltem Registrator + + + + WPS AP detected + WPS AP erkannt + + + + PBC mode overlap detected + PBC Modus Overlap erkannt + + + + More than one AP is currently in active WPS PBC mode. Wait couple of minutes and try again + Mehr als ein AP ist momentan im aktiven WPS PBC Modus. Versuch es in ein paar Minuten nochmal + + + + Network configuration received + Netzwerk Konfiguration empfangen + + + + Registration started + Registrierung gestartet + + + + Registrar does not yet know PIN + Registrator kennt den PIN noch nicht + + + + Registration failed + Registrierung fehlgeschlagen + + + + Registration succeeded + Registrierung erfolgreich + + + + + No Networks + Keine Netzwerke + + + + There are no networks to edit. + + Keine Netzwerke zum bearbeiten. + + + + + + Select A Network + Wähle ein Netzwerk + + + + Select a network from the list to edit it. + + Wähle ein Netzwerk aus der Liste zum bearbeiten. + + + + + There are no networks to remove. + + Es sind keine Netzwerke zum entfernen vorhanden. + + + + + Select a network from the list to remove it. + + Wähle ein Netzwerk aus der Liste zum entfernen. + + + + + Failed to save configuration + Speichern der Konfiguration fehlgeschlagen + + + + The configuration could not be saved. + +The update_config=1 configuration option +must be used for configuration saving to +be permitted. + + Die Konfiguration konnte nicht gespeichert werden. + +Die Einstellung update_config=1 muss gesetzt sein, +damit Konfigurationen gespeichert werden können. + + + + + Saved configuration + Konfiguration gespeichert + + + + The current configuration was saved. + + Die aktuelle Konfiguration wurde gespeichert. + + + + + - wpa_supplicant user interface + - wpa_supplicant Benutzerschnittstelle + + + + &Disconnect + &Trennen + + + + Re&connect + &Wiederverbinden + + + + &Event History + &Ereignis Historie + + + + Scan &Results + Scan E&rgebnisse + + + + S&tatus + + + + + &Show Window + &Fenster anzeigen + + + + &Hide Window + &Fenster ausblenden + + + + &Quit + &Beenden + + + + will keep running in the system tray. + wird weiterhin in der System Ablage laufen. + + + + systray + System Ablage + + + + The program will keep running in the system tray. + Das Programm wird weiterhin in der System Ablage laufen. + + + + Press the push button on the AP to start the PBC mode. + Drücke die Taste am AP um den PBC Modus zu starten. + + + + If you have not yet done so, press the push button on the AP to start the PBC mode. + Wenn Sie es noch nicht getan haben, so drücken Sie die Taste am AP um den PBC Modus zu starten. + + + + + Waiting for Registrar + Warte auf Registrator + + + + Enter the generated PIN into the Registrar (either the internal one in the AP or an external one). + Geben Sie den generierten PIN in der Registrierungsstelle ein (entweder der interne oder der externe im AP). + + + + WPS AP selected from scan results + WPS AP ausgewählt aus Scan Ergebnissen + + + + If you want to use an AP device PIN, e.g., from a label in the device, enter the eight digit AP PIN and click Use AP PIN button. + Wenn Sie einen AP Geräte PIN verwenden möchten, z.B.: von einem Aufkleber am Gerät, geben Sie denn acht stelligen AP PIN ein und klicken Sie auf den AP PIN Knopf. + + + + Waiting for AP/Enrollee + Warte auf AP/Bewerber + + + + Connected to the network + Verbunden zum Netzwerk + + + + Stopped + Gestoppt + + + + + OpenSCManager failed + OpenSCManager fehlgeschlagen + + + + + OpenService failed + OpenService fehlgeschlagen + + + + Failed to start wpa_supplicant service + Starten des wpa_supplicant Dienstes fehlgeschlagen + + + + Failed to stop wpa_supplicant service + Stoppen des wpa_supplicant Dienstes fehlgeschlagen + + + OpenSCManager failed: %d + + OpenSCManager fehlgeschlagen: %d + + + + OpenService failed: %d + + + OpenService fehlgeschlagen: %d + + + + + diff --git a/Network/wpa_gui-qt4_/main.cpp b/Network/wpa_gui-qt4_/main.cpp index 6170b15..e5270b8 100644 --- a/Network/wpa_gui-qt4_/main.cpp +++ b/Network/wpa_gui-qt4_/main.cpp @@ -1,82 +1,82 @@ -/* - * wpa_gui - Application startup - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifdef CONFIG_NATIVE_WINDOWS -#include -#endif /* CONFIG_NATIVE_WINDOWS */ -#include -#include -#include -#include "wpagui.h" - - -class WpaGuiApp : public QApplication -{ -public: - WpaGuiApp(int &argc, char **argv); - -#ifndef QT_NO_SESSIONMANAGER - virtual void saveState(QSessionManager &manager); -#endif - - WpaGui *w; -}; - -WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv) -{ -} - -#ifndef QT_NO_SESSIONMANAGER -void WpaGuiApp::saveState(QSessionManager &manager) -{ - QApplication::saveState(manager); - w->saveState(); -} -#endif - - -int main(int argc, char *argv[]) -{ - WpaGuiApp app(argc, argv); - QTranslator translator; - QString locale; - QString resourceDir; - int ret; - - locale = QLocale::system().name(); - resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - if (!translator.load("wpa_gui_" + locale, resourceDir)) - translator.load("wpa_gui_" + locale, "lang"); - app.installTranslator(&translator); - - WpaGui w(&app); - -#ifdef CONFIG_NATIVE_WINDOWS - WSADATA wsaData; - if (WSAStartup(MAKEWORD(2, 0), &wsaData)) { - /* printf("Could not find a usable WinSock.dll\n"); */ - return -1; - } -#endif /* CONFIG_NATIVE_WINDOWS */ - - app.w = &w; - - ret = app.exec(); - -#ifdef CONFIG_NATIVE_WINDOWS - WSACleanup(); -#endif /* CONFIG_NATIVE_WINDOWS */ - - return ret; -} +/* + * wpa_gui - Application startup + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifdef CONFIG_NATIVE_WINDOWS +#include +#endif /* CONFIG_NATIVE_WINDOWS */ +#include +#include +#include +#include "wpagui.h" + + +class WpaGuiApp : public QApplication +{ +public: + WpaGuiApp(int &argc, char **argv); + +#ifndef QT_NO_SESSIONMANAGER + virtual void saveState(QSessionManager &manager); +#endif + + WpaGui *w; +}; + +WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv) +{ +} + +#ifndef QT_NO_SESSIONMANAGER +void WpaGuiApp::saveState(QSessionManager &manager) +{ + QApplication::saveState(manager); + w->saveState(); +} +#endif + + +int main(int argc, char *argv[]) +{ + WpaGuiApp app(argc, argv); + QTranslator translator; + QString locale; + QString resourceDir; + int ret; + + locale = QLocale::system().name(); + resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + if (!translator.load("wpa_gui_" + locale, resourceDir)) + translator.load("wpa_gui_" + locale, "lang"); + app.installTranslator(&translator); + + WpaGui w(&app); + +#ifdef CONFIG_NATIVE_WINDOWS + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 0), &wsaData)) { + /* printf("Could not find a usable WinSock.dll\n"); */ + return -1; + } +#endif /* CONFIG_NATIVE_WINDOWS */ + + app.w = &w; + + ret = app.exec(); + +#ifdef CONFIG_NATIVE_WINDOWS + WSACleanup(); +#endif /* CONFIG_NATIVE_WINDOWS */ + + return ret; +} diff --git a/Network/wpa_gui-qt4_/networkconfig.cpp b/Network/wpa_gui-qt4_/networkconfig.cpp index fe50a8d..bdd39cd 100644 --- a/Network/wpa_gui-qt4_/networkconfig.cpp +++ b/Network/wpa_gui-qt4_/networkconfig.cpp @@ -1,858 +1,858 @@ -/* - * wpa_gui - NetworkConfig class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include -#include - -#include "networkconfig.h" -#include "wpagui.h" - -enum { - AUTH_NONE_OPEN, - AUTH_NONE_WEP, - AUTH_NONE_WEP_SHARED, - AUTH_IEEE8021X, - AUTH_WPA_PSK, - AUTH_WPA_EAP, - AUTH_WPA2_PSK, - AUTH_WPA2_EAP -}; - -#define WPA_GUI_KEY_DATA "[key is configured]" - - -NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WFlags) - : QDialog(parent) -{ - setupUi(this); - - encrSelect->setEnabled(false); - connect(authSelect, SIGNAL(activated(int)), this, - SLOT(authChanged(int))); - connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); - connect(addButton, SIGNAL(clicked()), this, SLOT(addNetwork())); - connect(encrSelect, SIGNAL(activated(const QString &)), this, - SLOT(encrChanged(const QString &))); - connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork())); - connect(eapSelect, SIGNAL(activated(int)), this, - SLOT(eapChanged(int))); - connect(useWpsButton, SIGNAL(clicked()), this, SLOT(useWps())); - - wpagui = NULL; - new_network = false; -} - - -NetworkConfig::~NetworkConfig() -{ -} - - -void NetworkConfig::languageChange() -{ - retranslateUi(this); -} - - -void NetworkConfig::paramsFromScanResults(QTreeWidgetItem *sel) -{ - new_network = true; - - /* SSID BSSID frequency signal flags */ - setWindowTitle(sel->text(0)); - ssidEdit->setText(sel->text(0)); - - QString flags = sel->text(4); - int auth, encr = 0; - if (flags.indexOf("[WPA2-EAP") >= 0) - auth = AUTH_WPA2_EAP; - else if (flags.indexOf("[WPA-EAP") >= 0) - auth = AUTH_WPA_EAP; - else if (flags.indexOf("[WPA2-PSK") >= 0) - auth = AUTH_WPA2_PSK; - else if (flags.indexOf("[WPA-PSK") >= 0) - auth = AUTH_WPA_PSK; - else - auth = AUTH_NONE_OPEN; - - if (flags.indexOf("-CCMP") >= 0) - encr = 1; - else if (flags.indexOf("-TKIP") >= 0) - encr = 0; - else if (flags.indexOf("WEP") >= 0) { - encr = 1; - if (auth == AUTH_NONE_OPEN) - auth = AUTH_NONE_WEP; - } else - encr = 0; - - authSelect->setCurrentIndex(auth); - authChanged(auth); - encrSelect->setCurrentIndex(encr); - - wepEnabled(auth == AUTH_NONE_WEP); - - getEapCapa(); - - if (flags.indexOf("[WPS") >= 0) - useWpsButton->setEnabled(true); - bssid = sel->text(1); -} - - -void NetworkConfig::authChanged(int sel) -{ - encrSelect->setEnabled(sel != AUTH_NONE_OPEN && sel != AUTH_NONE_WEP && - sel != AUTH_NONE_WEP_SHARED); - pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK); - bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP || - sel == AUTH_WPA2_EAP; - eapSelect->setEnabled(eap); - identityEdit->setEnabled(eap); - passwordEdit->setEnabled(eap); - cacertEdit->setEnabled(eap); - phase2Select->setEnabled(eap); - if (eap) - eapChanged(eapSelect->currentIndex()); - - while (encrSelect->count()) - encrSelect->removeItem(0); - - if (sel == AUTH_NONE_OPEN || sel == AUTH_NONE_WEP || - sel == AUTH_NONE_WEP_SHARED || sel == AUTH_IEEE8021X) { - encrSelect->addItem("None"); - encrSelect->addItem("WEP"); - encrSelect->setCurrentIndex(sel == AUTH_NONE_OPEN ? 0 : 1); - } else { - encrSelect->addItem("TKIP"); - encrSelect->addItem("CCMP"); - encrSelect->setCurrentIndex((sel == AUTH_WPA2_PSK || - sel == AUTH_WPA2_EAP) ? 1 : 0); - } - - wepEnabled(sel == AUTH_NONE_WEP || sel == AUTH_NONE_WEP_SHARED); -} - - -void NetworkConfig::eapChanged(int sel) -{ - QString prev_val = phase2Select->currentText(); - while (phase2Select->count()) - phase2Select->removeItem(0); - - QStringList inner; - inner << "PEAP" << "TTLS" << "FAST"; - if (!inner.contains(eapSelect->itemText(sel))) - return; - - phase2Select->addItem("[ any ]"); - - /* Add special cases based on outer method */ - if (eapSelect->currentText().compare("TTLS") == 0) { - phase2Select->addItem("PAP"); - phase2Select->addItem("CHAP"); - phase2Select->addItem("MSCHAP"); - phase2Select->addItem("MSCHAPv2"); - } else if (eapSelect->currentText().compare("FAST") == 0) - phase2Select->addItem("GTC(auth) + MSCHAPv2(prov)"); - - /* Add all enabled EAP methods that can be used in the tunnel */ - int i; - QStringList allowed; - allowed << "MSCHAPV2" << "MD5" << "GTC" << "TLS" << "OTP" << "SIM" - << "AKA"; - for (i = 0; i < eapSelect->count(); i++) { - if (allowed.contains(eapSelect->itemText(i))) { - phase2Select->addItem("EAP-" + eapSelect->itemText(i)); - } - } - - for (i = 0; i < phase2Select->count(); i++) { - if (phase2Select->itemText(i).compare(prev_val) == 0) { - phase2Select->setCurrentIndex(i); - break; - } - } -} - - -void NetworkConfig::addNetwork() -{ - char reply[10], cmd[256]; - size_t reply_len; - int id; - int psklen = pskEdit->text().length(); - int auth = authSelect->currentIndex(); - - if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) { - if (psklen < 8 || psklen > 64) { - QMessageBox::warning( - this, - tr("WPA Pre-Shared Key Error"), - tr("WPA-PSK requires a passphrase of 8 to 63 " - "characters\n" - "or 64 hex digit PSK")); - pskEdit->setFocus(); - return; - } - } - - if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) { - QRegExp rx("^(\\w|-)+$"); - if (rx.indexIn(idstrEdit->text()) < 0) { - QMessageBox::warning( - this, tr("Network ID Error"), - tr("Network ID String contains non-word " - "characters.\n" - "It must be a simple string, " - "without spaces, containing\n" - "only characters in this range: " - "[A-Za-z0-9_-]\n")); - idstrEdit->setFocus(); - return; - } - } - - if (wpagui == NULL) - return; - - memset(reply, 0, sizeof(reply)); - reply_len = sizeof(reply) - 1; - - if (new_network) { - wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len); - if (reply[0] == 'F') { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to add " - "network to wpa_supplicant\n" - "configuration.")); - return; - } - id = atoi(reply); - } else - id = edit_network_id; - - setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(), - true); - - const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL; - switch (auth) { - case AUTH_NONE_OPEN: - case AUTH_NONE_WEP: - case AUTH_NONE_WEP_SHARED: - key_mgmt = "NONE"; - break; - case AUTH_IEEE8021X: - key_mgmt = "IEEE8021X"; - break; - case AUTH_WPA_PSK: - key_mgmt = "WPA-PSK"; - proto = "WPA"; - break; - case AUTH_WPA_EAP: - key_mgmt = "WPA-EAP"; - proto = "WPA"; - break; - case AUTH_WPA2_PSK: - key_mgmt = "WPA-PSK"; - proto = "WPA2"; - break; - case AUTH_WPA2_EAP: - key_mgmt = "WPA-EAP"; - proto = "WPA2"; - break; - } - - if (auth == AUTH_NONE_WEP_SHARED) - setNetworkParam(id, "auth_alg", "SHARED", false); - else - setNetworkParam(id, "auth_alg", "OPEN", false); - - if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP || - auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) { - int encr = encrSelect->currentIndex(); - if (encr == 0) - pairwise = "TKIP"; - else - pairwise = "CCMP"; - } - - if (proto) - setNetworkParam(id, "proto", proto, false); - if (key_mgmt) - setNetworkParam(id, "key_mgmt", key_mgmt, false); - if (pairwise) { - setNetworkParam(id, "pairwise", pairwise, false); - setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false); - } - if (pskEdit->isEnabled() && - strcmp(pskEdit->text().toAscii().constData(), - WPA_GUI_KEY_DATA) != 0) - setNetworkParam(id, "psk", - pskEdit->text().toAscii().constData(), - psklen != 64); - if (eapSelect->isEnabled()) { - const char *eap = - eapSelect->currentText().toAscii().constData(); - setNetworkParam(id, "eap", eap, false); - if (strcmp(eap, "SIM") == 0 || strcmp(eap, "AKA") == 0) - setNetworkParam(id, "pcsc", "", true); - else - setNetworkParam(id, "pcsc", "NULL", false); - } - if (phase2Select->isEnabled()) { - QString eap = eapSelect->currentText(); - QString inner = phase2Select->currentText(); - char phase2[32]; - phase2[0] = '\0'; - if (eap.compare("PEAP") == 0) { - if (inner.startsWith("EAP-")) - snprintf(phase2, sizeof(phase2), "auth=%s", - inner.right(inner.size() - 4). - toAscii().constData()); - } else if (eap.compare("TTLS") == 0) { - if (inner.startsWith("EAP-")) - snprintf(phase2, sizeof(phase2), "autheap=%s", - inner.right(inner.size() - 4). - toAscii().constData()); - else - snprintf(phase2, sizeof(phase2), "auth=%s", - inner.toAscii().constData()); - } else if (eap.compare("FAST") == 0) { - const char *provisioning = NULL; - if (inner.startsWith("EAP-")) { - snprintf(phase2, sizeof(phase2), "auth=%s", - inner.right(inner.size() - 4). - toAscii().constData()); - provisioning = "fast_provisioning=2"; - } else if (inner.compare("GTC(auth) + MSCHAPv2(prov)") - == 0) { - snprintf(phase2, sizeof(phase2), - "auth=GTC auth=MSCHAPV2"); - provisioning = "fast_provisioning=1"; - } else - provisioning = "fast_provisioning=3"; - if (provisioning) { - char blob[32]; - setNetworkParam(id, "phase1", provisioning, - true); - snprintf(blob, sizeof(blob), - "blob://fast-pac-%d", id); - setNetworkParam(id, "pac_file", blob, true); - } - } - if (phase2[0]) - setNetworkParam(id, "phase2", phase2, true); - else - setNetworkParam(id, "phase2", "NULL", false); - } else - setNetworkParam(id, "phase2", "NULL", false); - if (identityEdit->isEnabled() && identityEdit->text().length() > 0) - setNetworkParam(id, "identity", - identityEdit->text().toAscii().constData(), - true); - else - setNetworkParam(id, "identity", "NULL", false); - if (passwordEdit->isEnabled() && passwordEdit->text().length() > 0 && - strcmp(passwordEdit->text().toAscii().constData(), - WPA_GUI_KEY_DATA) != 0) - setNetworkParam(id, "password", - passwordEdit->text().toAscii().constData(), - true); - else if (passwordEdit->text().length() == 0) - setNetworkParam(id, "password", "NULL", false); - if (cacertEdit->isEnabled() && cacertEdit->text().length() > 0) - setNetworkParam(id, "ca_cert", - cacertEdit->text().toAscii().constData(), - true); - else - setNetworkParam(id, "ca_cert", "NULL", false); - writeWepKey(id, wep0Edit, 0); - writeWepKey(id, wep1Edit, 1); - writeWepKey(id, wep2Edit, 2); - writeWepKey(id, wep3Edit, 3); - - if (wep0Radio->isEnabled() && wep0Radio->isChecked()) - setNetworkParam(id, "wep_tx_keyidx", "0", false); - else if (wep1Radio->isEnabled() && wep1Radio->isChecked()) - setNetworkParam(id, "wep_tx_keyidx", "1", false); - else if (wep2Radio->isEnabled() && wep2Radio->isChecked()) - setNetworkParam(id, "wep_tx_keyidx", "2", false); - else if (wep3Radio->isEnabled() && wep3Radio->isChecked()) - setNetworkParam(id, "wep_tx_keyidx", "3", false); - - if (idstrEdit->isEnabled() && idstrEdit->text().length() > 0) - setNetworkParam(id, "id_str", - idstrEdit->text().toAscii().constData(), - true); - else - setNetworkParam(id, "id_str", "NULL", false); - - if (prioritySpinBox->isEnabled()) { - QString prio; - prio = prio.setNum(prioritySpinBox->value()); - setNetworkParam(id, "priority", prio.toAscii().constData(), - false); - } - - snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id); - reply_len = sizeof(reply); - wpagui->ctrlRequest(cmd, reply, &reply_len); - if (strncmp(reply, "OK", 2) != 0) { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to enable " - "network in wpa_supplicant\n" - "configuration.")); - /* Network was added, so continue anyway */ - } - wpagui->triggerUpdate(); - wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len); - - close(); -} - - -void NetworkConfig::setWpaGui(WpaGui *_wpagui) -{ - wpagui = _wpagui; -} - - -int NetworkConfig::setNetworkParam(int id, const char *field, - const char *value, bool quote) -{ - char reply[10], cmd[256]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s", - id, field, quote ? "\"" : "", value, quote ? "\"" : ""); - reply_len = sizeof(reply); - wpagui->ctrlRequest(cmd, reply, &reply_len); - return strncmp(reply, "OK", 2) == 0 ? 0 : -1; -} - - -void NetworkConfig::encrChanged(const QString &) -{ -} - - -void NetworkConfig::wepEnabled(bool enabled) -{ - wep0Edit->setEnabled(enabled); - wep1Edit->setEnabled(enabled); - wep2Edit->setEnabled(enabled); - wep3Edit->setEnabled(enabled); - wep0Radio->setEnabled(enabled); - wep1Radio->setEnabled(enabled); - wep2Radio->setEnabled(enabled); - wep3Radio->setEnabled(enabled); -} - - -void NetworkConfig::writeWepKey(int network_id, QLineEdit *edit, int id) -{ - char buf[10]; - bool hex; - const char *txt, *pos; - size_t len; - - if (!edit->isEnabled() || edit->text().isEmpty()) - return; - - /* - * Assume hex key if only hex characters are present and length matches - * with 40, 104, or 128-bit key - */ - txt = edit->text().toAscii().constData(); - if (strcmp(txt, WPA_GUI_KEY_DATA) == 0) - return; - len = strlen(txt); - if (len == 0) - return; - pos = txt; - hex = true; - while (*pos) { - if (!((*pos >= '0' && *pos <= '9') || - (*pos >= 'a' && *pos <= 'f') || - (*pos >= 'A' && *pos <= 'F'))) { - hex = false; - break; - } - pos++; - } - if (hex && len != 10 && len != 26 && len != 32) - hex = false; - snprintf(buf, sizeof(buf), "wep_key%d", id); - setNetworkParam(network_id, buf, txt, !hex); -} - - -static int key_value_isset(const char *reply, size_t reply_len) -{ - return reply_len > 0 && (reply_len < 4 || memcmp(reply, "FAIL", 4) != 0); -} - - -void NetworkConfig::paramsFromConfig(int network_id) -{ - int i, res; - - edit_network_id = network_id; - getEapCapa(); - - char reply[1024], cmd[256], *pos; - size_t reply_len; - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - ssidEdit->setText(reply + 1); - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id); - reply_len = sizeof(reply) - 1; - int wpa = 0; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { - reply[reply_len] = '\0'; - if (strstr(reply, "RSN") || strstr(reply, "WPA2")) - wpa = 2; - else if (strstr(reply, "WPA")) - wpa = 1; - } - - int auth = AUTH_NONE_OPEN, encr = 0; - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d key_mgmt", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { - reply[reply_len] = '\0'; - if (strstr(reply, "WPA-EAP")) - auth = wpa & 2 ? AUTH_WPA2_EAP : AUTH_WPA_EAP; - else if (strstr(reply, "WPA-PSK")) - auth = wpa & 2 ? AUTH_WPA2_PSK : AUTH_WPA_PSK; - else if (strstr(reply, "IEEE8021X")) { - auth = AUTH_IEEE8021X; - encr = 1; - } - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d pairwise", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { - reply[reply_len] = '\0'; - if (strstr(reply, "CCMP") && auth != AUTH_NONE_OPEN && - auth != AUTH_NONE_WEP && auth != AUTH_NONE_WEP_SHARED) - encr = 1; - else if (strstr(reply, "TKIP")) - encr = 0; - else if (strstr(reply, "WEP")) - encr = 1; - else - encr = 0; - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d psk", network_id); - reply_len = sizeof(reply) - 1; - res = wpagui->ctrlRequest(cmd, reply, &reply_len); - if (res >= 0 && reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - pskEdit->setText(reply + 1); - } else if (res >= 0 && key_value_isset(reply, reply_len)) { - pskEdit->setText(WPA_GUI_KEY_DATA); - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d identity", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - identityEdit->setText(reply + 1); - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d password", network_id); - reply_len = sizeof(reply) - 1; - res = wpagui->ctrlRequest(cmd, reply, &reply_len); - if (res >= 0 && reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - passwordEdit->setText(reply + 1); - } else if (res >= 0 && key_value_isset(reply, reply_len)) { - passwordEdit->setText(WPA_GUI_KEY_DATA); - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ca_cert", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - cacertEdit->setText(reply + 1); - } - - enum { NO_INNER, PEAP_INNER, TTLS_INNER, FAST_INNER } eap = NO_INNER; - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d eap", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 1) { - reply[reply_len] = '\0'; - for (i = 0; i < eapSelect->count(); i++) { - if (eapSelect->itemText(i).compare(reply) == 0) { - eapSelect->setCurrentIndex(i); - if (strcmp(reply, "PEAP") == 0) - eap = PEAP_INNER; - else if (strcmp(reply, "TTLS") == 0) - eap = TTLS_INNER; - else if (strcmp(reply, "FAST") == 0) - eap = FAST_INNER; - break; - } - } - } - - if (eap != NO_INNER) { - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d phase2", - network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 1) { - reply[reply_len] = '\0'; - eapChanged(eapSelect->currentIndex()); - } else - eap = NO_INNER; - } - - char *val; - val = reply + 1; - while (*(val + 1)) - val++; - if (*val == '"') - *val = '\0'; - - switch (eap) { - case PEAP_INNER: - if (strncmp(reply, "\"auth=", 6)) - break; - val = reply + 2; - memcpy(val, "EAP-", 4); - break; - case TTLS_INNER: - if (strncmp(reply, "\"autheap=", 9) == 0) { - val = reply + 5; - memcpy(val, "EAP-", 4); - } else if (strncmp(reply, "\"auth=", 6) == 0) - val = reply + 6; - break; - case FAST_INNER: - if (strncmp(reply, "\"auth=", 6)) - break; - if (strcmp(reply + 6, "GTC auth=MSCHAPV2") == 0) { - val = (char *) "GTC(auth) + MSCHAPv2(prov)"; - break; - } - val = reply + 2; - memcpy(val, "EAP-", 4); - break; - case NO_INNER: - break; - } - - for (i = 0; i < phase2Select->count(); i++) { - if (phase2Select->itemText(i).compare(val) == 0) { - phase2Select->setCurrentIndex(i); - break; - } - } - - for (i = 0; i < 4; i++) { - QLineEdit *wepEdit; - switch (i) { - default: - case 0: - wepEdit = wep0Edit; - break; - case 1: - wepEdit = wep1Edit; - break; - case 2: - wepEdit = wep2Edit; - break; - case 3: - wepEdit = wep3Edit; - break; - } - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_key%d", - network_id, i); - reply_len = sizeof(reply) - 1; - res = wpagui->ctrlRequest(cmd, reply, &reply_len); - if (res >= 0 && reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - if (auth == AUTH_NONE_OPEN || auth == AUTH_IEEE8021X) { - if (auth == AUTH_NONE_OPEN) - auth = AUTH_NONE_WEP; - encr = 1; - } - - wepEdit->setText(reply + 1); - } else if (res >= 0 && key_value_isset(reply, reply_len)) { - if (auth == AUTH_NONE_OPEN || auth == AUTH_IEEE8021X) { - if (auth == AUTH_NONE_OPEN) - auth = AUTH_NONE_WEP; - encr = 1; - } - wepEdit->setText(WPA_GUI_KEY_DATA); - } - } - - if (auth == AUTH_NONE_WEP) { - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d auth_alg", - network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { - reply[reply_len] = '\0'; - if (strcmp(reply, "SHARED") == 0) - auth = AUTH_NONE_WEP_SHARED; - } - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_tx_keyidx", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) - { - reply[reply_len] = '\0'; - switch (atoi(reply)) { - case 0: - wep0Radio->setChecked(true); - break; - case 1: - wep1Radio->setChecked(true); - break; - case 2: - wep2Radio->setChecked(true); - break; - case 3: - wep3Radio->setChecked(true); - break; - } - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && - reply_len >= 2 && reply[0] == '"') { - reply[reply_len] = '\0'; - pos = strchr(reply + 1, '"'); - if (pos) - *pos = '\0'; - idstrEdit->setText(reply + 1); - } - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d priority", network_id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) - { - reply[reply_len] = '\0'; - prioritySpinBox->setValue(atoi(reply)); - } - - authSelect->setCurrentIndex(auth); - authChanged(auth); - encrSelect->setCurrentIndex(encr); - wepEnabled(auth == AUTH_NONE_WEP || auth == AUTH_NONE_WEP_SHARED); - - removeButton->setEnabled(true); - addButton->setText("Save"); -} - - -void NetworkConfig::removeNetwork() -{ - char reply[10], cmd[256]; - size_t reply_len; - - if (QMessageBox::information( - this, "wpa_gui", - tr("This will permanently remove the network\n" - "from the configuration. Do you really want\n" - "to remove this network?"), - tr("Yes"), tr("No")) != 0) - return; - - snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id); - reply_len = sizeof(reply); - wpagui->ctrlRequest(cmd, reply, &reply_len); - if (strncmp(reply, "OK", 2) != 0) { - QMessageBox::warning(this, "wpa_gui", - tr("Failed to remove network from " - "wpa_supplicant\n" - "configuration.")); - } else { - wpagui->triggerUpdate(); - wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len); - } - - close(); -} - - -void NetworkConfig::newNetwork() -{ - new_network = true; - getEapCapa(); -} - - -void NetworkConfig::getEapCapa() -{ - char reply[256]; - size_t reply_len; - - if (wpagui == NULL) - return; - - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("GET_CAPABILITY eap", reply, &reply_len) < 0) - return; - reply[reply_len] = '\0'; - - QString res(reply); - QStringList types = res.split(QChar(' ')); - eapSelect->insertItems(-1, types); -} - - -void NetworkConfig::useWps() -{ - if (wpagui == NULL) - return; - wpagui->setBssFromScan(bssid); - wpagui->wpsDialog(); - close(); -} +/* + * wpa_gui - NetworkConfig class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include +#include + +#include "networkconfig.h" +#include "wpagui.h" + +enum { + AUTH_NONE_OPEN, + AUTH_NONE_WEP, + AUTH_NONE_WEP_SHARED, + AUTH_IEEE8021X, + AUTH_WPA_PSK, + AUTH_WPA_EAP, + AUTH_WPA2_PSK, + AUTH_WPA2_EAP +}; + +#define WPA_GUI_KEY_DATA "[key is configured]" + + +NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WFlags) + : QDialog(parent) +{ + setupUi(this); + + encrSelect->setEnabled(false); + connect(authSelect, SIGNAL(activated(int)), this, + SLOT(authChanged(int))); + connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); + connect(addButton, SIGNAL(clicked()), this, SLOT(addNetwork())); + connect(encrSelect, SIGNAL(activated(const QString &)), this, + SLOT(encrChanged(const QString &))); + connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork())); + connect(eapSelect, SIGNAL(activated(int)), this, + SLOT(eapChanged(int))); + connect(useWpsButton, SIGNAL(clicked()), this, SLOT(useWps())); + + wpagui = NULL; + new_network = false; +} + + +NetworkConfig::~NetworkConfig() +{ +} + + +void NetworkConfig::languageChange() +{ + retranslateUi(this); +} + + +void NetworkConfig::paramsFromScanResults(QTreeWidgetItem *sel) +{ + new_network = true; + + /* SSID BSSID frequency signal flags */ + setWindowTitle(sel->text(0)); + ssidEdit->setText(sel->text(0)); + + QString flags = sel->text(4); + int auth, encr = 0; + if (flags.indexOf("[WPA2-EAP") >= 0) + auth = AUTH_WPA2_EAP; + else if (flags.indexOf("[WPA-EAP") >= 0) + auth = AUTH_WPA_EAP; + else if (flags.indexOf("[WPA2-PSK") >= 0) + auth = AUTH_WPA2_PSK; + else if (flags.indexOf("[WPA-PSK") >= 0) + auth = AUTH_WPA_PSK; + else + auth = AUTH_NONE_OPEN; + + if (flags.indexOf("-CCMP") >= 0) + encr = 1; + else if (flags.indexOf("-TKIP") >= 0) + encr = 0; + else if (flags.indexOf("WEP") >= 0) { + encr = 1; + if (auth == AUTH_NONE_OPEN) + auth = AUTH_NONE_WEP; + } else + encr = 0; + + authSelect->setCurrentIndex(auth); + authChanged(auth); + encrSelect->setCurrentIndex(encr); + + wepEnabled(auth == AUTH_NONE_WEP); + + getEapCapa(); + + if (flags.indexOf("[WPS") >= 0) + useWpsButton->setEnabled(true); + bssid = sel->text(1); +} + + +void NetworkConfig::authChanged(int sel) +{ + encrSelect->setEnabled(sel != AUTH_NONE_OPEN && sel != AUTH_NONE_WEP && + sel != AUTH_NONE_WEP_SHARED); + pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK); + bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP || + sel == AUTH_WPA2_EAP; + eapSelect->setEnabled(eap); + identityEdit->setEnabled(eap); + passwordEdit->setEnabled(eap); + cacertEdit->setEnabled(eap); + phase2Select->setEnabled(eap); + if (eap) + eapChanged(eapSelect->currentIndex()); + + while (encrSelect->count()) + encrSelect->removeItem(0); + + if (sel == AUTH_NONE_OPEN || sel == AUTH_NONE_WEP || + sel == AUTH_NONE_WEP_SHARED || sel == AUTH_IEEE8021X) { + encrSelect->addItem("None"); + encrSelect->addItem("WEP"); + encrSelect->setCurrentIndex(sel == AUTH_NONE_OPEN ? 0 : 1); + } else { + encrSelect->addItem("TKIP"); + encrSelect->addItem("CCMP"); + encrSelect->setCurrentIndex((sel == AUTH_WPA2_PSK || + sel == AUTH_WPA2_EAP) ? 1 : 0); + } + + wepEnabled(sel == AUTH_NONE_WEP || sel == AUTH_NONE_WEP_SHARED); +} + + +void NetworkConfig::eapChanged(int sel) +{ + QString prev_val = phase2Select->currentText(); + while (phase2Select->count()) + phase2Select->removeItem(0); + + QStringList inner; + inner << "PEAP" << "TTLS" << "FAST"; + if (!inner.contains(eapSelect->itemText(sel))) + return; + + phase2Select->addItem("[ any ]"); + + /* Add special cases based on outer method */ + if (eapSelect->currentText().compare("TTLS") == 0) { + phase2Select->addItem("PAP"); + phase2Select->addItem("CHAP"); + phase2Select->addItem("MSCHAP"); + phase2Select->addItem("MSCHAPv2"); + } else if (eapSelect->currentText().compare("FAST") == 0) + phase2Select->addItem("GTC(auth) + MSCHAPv2(prov)"); + + /* Add all enabled EAP methods that can be used in the tunnel */ + int i; + QStringList allowed; + allowed << "MSCHAPV2" << "MD5" << "GTC" << "TLS" << "OTP" << "SIM" + << "AKA"; + for (i = 0; i < eapSelect->count(); i++) { + if (allowed.contains(eapSelect->itemText(i))) { + phase2Select->addItem("EAP-" + eapSelect->itemText(i)); + } + } + + for (i = 0; i < phase2Select->count(); i++) { + if (phase2Select->itemText(i).compare(prev_val) == 0) { + phase2Select->setCurrentIndex(i); + break; + } + } +} + + +void NetworkConfig::addNetwork() +{ + char reply[10], cmd[256]; + size_t reply_len; + int id; + int psklen = pskEdit->text().length(); + int auth = authSelect->currentIndex(); + + if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) { + if (psklen < 8 || psklen > 64) { + QMessageBox::warning( + this, + tr("WPA Pre-Shared Key Error"), + tr("WPA-PSK requires a passphrase of 8 to 63 " + "characters\n" + "or 64 hex digit PSK")); + pskEdit->setFocus(); + return; + } + } + + if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) { + QRegExp rx("^(\\w|-)+$"); + if (rx.indexIn(idstrEdit->text()) < 0) { + QMessageBox::warning( + this, tr("Network ID Error"), + tr("Network ID String contains non-word " + "characters.\n" + "It must be a simple string, " + "without spaces, containing\n" + "only characters in this range: " + "[A-Za-z0-9_-]\n")); + idstrEdit->setFocus(); + return; + } + } + + if (wpagui == NULL) + return; + + memset(reply, 0, sizeof(reply)); + reply_len = sizeof(reply) - 1; + + if (new_network) { + wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len); + if (reply[0] == 'F') { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to add " + "network to wpa_supplicant\n" + "configuration.")); + return; + } + id = atoi(reply); + } else + id = edit_network_id; + + setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(), + true); + + const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL; + switch (auth) { + case AUTH_NONE_OPEN: + case AUTH_NONE_WEP: + case AUTH_NONE_WEP_SHARED: + key_mgmt = "NONE"; + break; + case AUTH_IEEE8021X: + key_mgmt = "IEEE8021X"; + break; + case AUTH_WPA_PSK: + key_mgmt = "WPA-PSK"; + proto = "WPA"; + break; + case AUTH_WPA_EAP: + key_mgmt = "WPA-EAP"; + proto = "WPA"; + break; + case AUTH_WPA2_PSK: + key_mgmt = "WPA-PSK"; + proto = "WPA2"; + break; + case AUTH_WPA2_EAP: + key_mgmt = "WPA-EAP"; + proto = "WPA2"; + break; + } + + if (auth == AUTH_NONE_WEP_SHARED) + setNetworkParam(id, "auth_alg", "SHARED", false); + else + setNetworkParam(id, "auth_alg", "OPEN", false); + + if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP || + auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) { + int encr = encrSelect->currentIndex(); + if (encr == 0) + pairwise = "TKIP"; + else + pairwise = "CCMP"; + } + + if (proto) + setNetworkParam(id, "proto", proto, false); + if (key_mgmt) + setNetworkParam(id, "key_mgmt", key_mgmt, false); + if (pairwise) { + setNetworkParam(id, "pairwise", pairwise, false); + setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false); + } + if (pskEdit->isEnabled() && + strcmp(pskEdit->text().toAscii().constData(), + WPA_GUI_KEY_DATA) != 0) + setNetworkParam(id, "psk", + pskEdit->text().toAscii().constData(), + psklen != 64); + if (eapSelect->isEnabled()) { + const char *eap = + eapSelect->currentText().toAscii().constData(); + setNetworkParam(id, "eap", eap, false); + if (strcmp(eap, "SIM") == 0 || strcmp(eap, "AKA") == 0) + setNetworkParam(id, "pcsc", "", true); + else + setNetworkParam(id, "pcsc", "NULL", false); + } + if (phase2Select->isEnabled()) { + QString eap = eapSelect->currentText(); + QString inner = phase2Select->currentText(); + char phase2[32]; + phase2[0] = '\0'; + if (eap.compare("PEAP") == 0) { + if (inner.startsWith("EAP-")) + snprintf(phase2, sizeof(phase2), "auth=%s", + inner.right(inner.size() - 4). + toAscii().constData()); + } else if (eap.compare("TTLS") == 0) { + if (inner.startsWith("EAP-")) + snprintf(phase2, sizeof(phase2), "autheap=%s", + inner.right(inner.size() - 4). + toAscii().constData()); + else + snprintf(phase2, sizeof(phase2), "auth=%s", + inner.toAscii().constData()); + } else if (eap.compare("FAST") == 0) { + const char *provisioning = NULL; + if (inner.startsWith("EAP-")) { + snprintf(phase2, sizeof(phase2), "auth=%s", + inner.right(inner.size() - 4). + toAscii().constData()); + provisioning = "fast_provisioning=2"; + } else if (inner.compare("GTC(auth) + MSCHAPv2(prov)") + == 0) { + snprintf(phase2, sizeof(phase2), + "auth=GTC auth=MSCHAPV2"); + provisioning = "fast_provisioning=1"; + } else + provisioning = "fast_provisioning=3"; + if (provisioning) { + char blob[32]; + setNetworkParam(id, "phase1", provisioning, + true); + snprintf(blob, sizeof(blob), + "blob://fast-pac-%d", id); + setNetworkParam(id, "pac_file", blob, true); + } + } + if (phase2[0]) + setNetworkParam(id, "phase2", phase2, true); + else + setNetworkParam(id, "phase2", "NULL", false); + } else + setNetworkParam(id, "phase2", "NULL", false); + if (identityEdit->isEnabled() && identityEdit->text().length() > 0) + setNetworkParam(id, "identity", + identityEdit->text().toAscii().constData(), + true); + else + setNetworkParam(id, "identity", "NULL", false); + if (passwordEdit->isEnabled() && passwordEdit->text().length() > 0 && + strcmp(passwordEdit->text().toAscii().constData(), + WPA_GUI_KEY_DATA) != 0) + setNetworkParam(id, "password", + passwordEdit->text().toAscii().constData(), + true); + else if (passwordEdit->text().length() == 0) + setNetworkParam(id, "password", "NULL", false); + if (cacertEdit->isEnabled() && cacertEdit->text().length() > 0) + setNetworkParam(id, "ca_cert", + cacertEdit->text().toAscii().constData(), + true); + else + setNetworkParam(id, "ca_cert", "NULL", false); + writeWepKey(id, wep0Edit, 0); + writeWepKey(id, wep1Edit, 1); + writeWepKey(id, wep2Edit, 2); + writeWepKey(id, wep3Edit, 3); + + if (wep0Radio->isEnabled() && wep0Radio->isChecked()) + setNetworkParam(id, "wep_tx_keyidx", "0", false); + else if (wep1Radio->isEnabled() && wep1Radio->isChecked()) + setNetworkParam(id, "wep_tx_keyidx", "1", false); + else if (wep2Radio->isEnabled() && wep2Radio->isChecked()) + setNetworkParam(id, "wep_tx_keyidx", "2", false); + else if (wep3Radio->isEnabled() && wep3Radio->isChecked()) + setNetworkParam(id, "wep_tx_keyidx", "3", false); + + if (idstrEdit->isEnabled() && idstrEdit->text().length() > 0) + setNetworkParam(id, "id_str", + idstrEdit->text().toAscii().constData(), + true); + else + setNetworkParam(id, "id_str", "NULL", false); + + if (prioritySpinBox->isEnabled()) { + QString prio; + prio = prio.setNum(prioritySpinBox->value()); + setNetworkParam(id, "priority", prio.toAscii().constData(), + false); + } + + snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id); + reply_len = sizeof(reply); + wpagui->ctrlRequest(cmd, reply, &reply_len); + if (strncmp(reply, "OK", 2) != 0) { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to enable " + "network in wpa_supplicant\n" + "configuration.")); + /* Network was added, so continue anyway */ + } + wpagui->triggerUpdate(); + wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len); + + close(); +} + + +void NetworkConfig::setWpaGui(WpaGui *_wpagui) +{ + wpagui = _wpagui; +} + + +int NetworkConfig::setNetworkParam(int id, const char *field, + const char *value, bool quote) +{ + char reply[10], cmd[256]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s", + id, field, quote ? "\"" : "", value, quote ? "\"" : ""); + reply_len = sizeof(reply); + wpagui->ctrlRequest(cmd, reply, &reply_len); + return strncmp(reply, "OK", 2) == 0 ? 0 : -1; +} + + +void NetworkConfig::encrChanged(const QString &) +{ +} + + +void NetworkConfig::wepEnabled(bool enabled) +{ + wep0Edit->setEnabled(enabled); + wep1Edit->setEnabled(enabled); + wep2Edit->setEnabled(enabled); + wep3Edit->setEnabled(enabled); + wep0Radio->setEnabled(enabled); + wep1Radio->setEnabled(enabled); + wep2Radio->setEnabled(enabled); + wep3Radio->setEnabled(enabled); +} + + +void NetworkConfig::writeWepKey(int network_id, QLineEdit *edit, int id) +{ + char buf[10]; + bool hex; + const char *txt, *pos; + size_t len; + + if (!edit->isEnabled() || edit->text().isEmpty()) + return; + + /* + * Assume hex key if only hex characters are present and length matches + * with 40, 104, or 128-bit key + */ + txt = edit->text().toAscii().constData(); + if (strcmp(txt, WPA_GUI_KEY_DATA) == 0) + return; + len = strlen(txt); + if (len == 0) + return; + pos = txt; + hex = true; + while (*pos) { + if (!((*pos >= '0' && *pos <= '9') || + (*pos >= 'a' && *pos <= 'f') || + (*pos >= 'A' && *pos <= 'F'))) { + hex = false; + break; + } + pos++; + } + if (hex && len != 10 && len != 26 && len != 32) + hex = false; + snprintf(buf, sizeof(buf), "wep_key%d", id); + setNetworkParam(network_id, buf, txt, !hex); +} + + +static int key_value_isset(const char *reply, size_t reply_len) +{ + return reply_len > 0 && (reply_len < 4 || memcmp(reply, "FAIL", 4) != 0); +} + + +void NetworkConfig::paramsFromConfig(int network_id) +{ + int i, res; + + edit_network_id = network_id; + getEapCapa(); + + char reply[1024], cmd[256], *pos; + size_t reply_len; + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + ssidEdit->setText(reply + 1); + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id); + reply_len = sizeof(reply) - 1; + int wpa = 0; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { + reply[reply_len] = '\0'; + if (strstr(reply, "RSN") || strstr(reply, "WPA2")) + wpa = 2; + else if (strstr(reply, "WPA")) + wpa = 1; + } + + int auth = AUTH_NONE_OPEN, encr = 0; + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d key_mgmt", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { + reply[reply_len] = '\0'; + if (strstr(reply, "WPA-EAP")) + auth = wpa & 2 ? AUTH_WPA2_EAP : AUTH_WPA_EAP; + else if (strstr(reply, "WPA-PSK")) + auth = wpa & 2 ? AUTH_WPA2_PSK : AUTH_WPA_PSK; + else if (strstr(reply, "IEEE8021X")) { + auth = AUTH_IEEE8021X; + encr = 1; + } + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d pairwise", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { + reply[reply_len] = '\0'; + if (strstr(reply, "CCMP") && auth != AUTH_NONE_OPEN && + auth != AUTH_NONE_WEP && auth != AUTH_NONE_WEP_SHARED) + encr = 1; + else if (strstr(reply, "TKIP")) + encr = 0; + else if (strstr(reply, "WEP")) + encr = 1; + else + encr = 0; + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d psk", network_id); + reply_len = sizeof(reply) - 1; + res = wpagui->ctrlRequest(cmd, reply, &reply_len); + if (res >= 0 && reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + pskEdit->setText(reply + 1); + } else if (res >= 0 && key_value_isset(reply, reply_len)) { + pskEdit->setText(WPA_GUI_KEY_DATA); + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d identity", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + identityEdit->setText(reply + 1); + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d password", network_id); + reply_len = sizeof(reply) - 1; + res = wpagui->ctrlRequest(cmd, reply, &reply_len); + if (res >= 0 && reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + passwordEdit->setText(reply + 1); + } else if (res >= 0 && key_value_isset(reply, reply_len)) { + passwordEdit->setText(WPA_GUI_KEY_DATA); + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ca_cert", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + cacertEdit->setText(reply + 1); + } + + enum { NO_INNER, PEAP_INNER, TTLS_INNER, FAST_INNER } eap = NO_INNER; + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d eap", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 1) { + reply[reply_len] = '\0'; + for (i = 0; i < eapSelect->count(); i++) { + if (eapSelect->itemText(i).compare(reply) == 0) { + eapSelect->setCurrentIndex(i); + if (strcmp(reply, "PEAP") == 0) + eap = PEAP_INNER; + else if (strcmp(reply, "TTLS") == 0) + eap = TTLS_INNER; + else if (strcmp(reply, "FAST") == 0) + eap = FAST_INNER; + break; + } + } + } + + if (eap != NO_INNER) { + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d phase2", + network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 1) { + reply[reply_len] = '\0'; + eapChanged(eapSelect->currentIndex()); + } else + eap = NO_INNER; + } + + char *val; + val = reply + 1; + while (*(val + 1)) + val++; + if (*val == '"') + *val = '\0'; + + switch (eap) { + case PEAP_INNER: + if (strncmp(reply, "\"auth=", 6)) + break; + val = reply + 2; + memcpy(val, "EAP-", 4); + break; + case TTLS_INNER: + if (strncmp(reply, "\"autheap=", 9) == 0) { + val = reply + 5; + memcpy(val, "EAP-", 4); + } else if (strncmp(reply, "\"auth=", 6) == 0) + val = reply + 6; + break; + case FAST_INNER: + if (strncmp(reply, "\"auth=", 6)) + break; + if (strcmp(reply + 6, "GTC auth=MSCHAPV2") == 0) { + val = (char *) "GTC(auth) + MSCHAPv2(prov)"; + break; + } + val = reply + 2; + memcpy(val, "EAP-", 4); + break; + case NO_INNER: + break; + } + + for (i = 0; i < phase2Select->count(); i++) { + if (phase2Select->itemText(i).compare(val) == 0) { + phase2Select->setCurrentIndex(i); + break; + } + } + + for (i = 0; i < 4; i++) { + QLineEdit *wepEdit; + switch (i) { + default: + case 0: + wepEdit = wep0Edit; + break; + case 1: + wepEdit = wep1Edit; + break; + case 2: + wepEdit = wep2Edit; + break; + case 3: + wepEdit = wep3Edit; + break; + } + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_key%d", + network_id, i); + reply_len = sizeof(reply) - 1; + res = wpagui->ctrlRequest(cmd, reply, &reply_len); + if (res >= 0 && reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + if (auth == AUTH_NONE_OPEN || auth == AUTH_IEEE8021X) { + if (auth == AUTH_NONE_OPEN) + auth = AUTH_NONE_WEP; + encr = 1; + } + + wepEdit->setText(reply + 1); + } else if (res >= 0 && key_value_isset(reply, reply_len)) { + if (auth == AUTH_NONE_OPEN || auth == AUTH_IEEE8021X) { + if (auth == AUTH_NONE_OPEN) + auth = AUTH_NONE_WEP; + encr = 1; + } + wepEdit->setText(WPA_GUI_KEY_DATA); + } + } + + if (auth == AUTH_NONE_WEP) { + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d auth_alg", + network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) { + reply[reply_len] = '\0'; + if (strcmp(reply, "SHARED") == 0) + auth = AUTH_NONE_WEP_SHARED; + } + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_tx_keyidx", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) + { + reply[reply_len] = '\0'; + switch (atoi(reply)) { + case 0: + wep0Radio->setChecked(true); + break; + case 1: + wep1Radio->setChecked(true); + break; + case 2: + wep2Radio->setChecked(true); + break; + case 3: + wep3Radio->setChecked(true); + break; + } + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && + reply_len >= 2 && reply[0] == '"') { + reply[reply_len] = '\0'; + pos = strchr(reply + 1, '"'); + if (pos) + *pos = '\0'; + idstrEdit->setText(reply + 1); + } + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d priority", network_id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) + { + reply[reply_len] = '\0'; + prioritySpinBox->setValue(atoi(reply)); + } + + authSelect->setCurrentIndex(auth); + authChanged(auth); + encrSelect->setCurrentIndex(encr); + wepEnabled(auth == AUTH_NONE_WEP || auth == AUTH_NONE_WEP_SHARED); + + removeButton->setEnabled(true); + addButton->setText("Save"); +} + + +void NetworkConfig::removeNetwork() +{ + char reply[10], cmd[256]; + size_t reply_len; + + if (QMessageBox::information( + this, "wpa_gui", + tr("This will permanently remove the network\n" + "from the configuration. Do you really want\n" + "to remove this network?"), + tr("Yes"), tr("No")) != 0) + return; + + snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id); + reply_len = sizeof(reply); + wpagui->ctrlRequest(cmd, reply, &reply_len); + if (strncmp(reply, "OK", 2) != 0) { + QMessageBox::warning(this, "wpa_gui", + tr("Failed to remove network from " + "wpa_supplicant\n" + "configuration.")); + } else { + wpagui->triggerUpdate(); + wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len); + } + + close(); +} + + +void NetworkConfig::newNetwork() +{ + new_network = true; + getEapCapa(); +} + + +void NetworkConfig::getEapCapa() +{ + char reply[256]; + size_t reply_len; + + if (wpagui == NULL) + return; + + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("GET_CAPABILITY eap", reply, &reply_len) < 0) + return; + reply[reply_len] = '\0'; + + QString res(reply); + QStringList types = res.split(QChar(' ')); + eapSelect->insertItems(-1, types); +} + + +void NetworkConfig::useWps() +{ + if (wpagui == NULL) + return; + wpagui->setBssFromScan(bssid); + wpagui->wpsDialog(); + close(); +} diff --git a/Network/wpa_gui-qt4_/networkconfig.h b/Network/wpa_gui-qt4_/networkconfig.h index 0ceeb41..1ac78f8 100644 --- a/Network/wpa_gui-qt4_/networkconfig.h +++ b/Network/wpa_gui-qt4_/networkconfig.h @@ -1,61 +1,61 @@ -/* - * wpa_gui - NetworkConfig class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef NETWORKCONFIG_H -#define NETWORKCONFIG_H - -#include -#include "ui_networkconfig.h" - -class WpaGui; - -class NetworkConfig : public QDialog, public Ui::NetworkConfig -{ - Q_OBJECT - -public: - NetworkConfig(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); - ~NetworkConfig(); - - virtual void paramsFromScanResults(QTreeWidgetItem *sel); - virtual void setWpaGui(WpaGui *_wpagui); - virtual int setNetworkParam(int id, const char *field, - const char *value, bool quote); - virtual void paramsFromConfig(int network_id); - virtual void newNetwork(); - -public slots: - virtual void authChanged(int sel); - virtual void addNetwork(); - virtual void encrChanged(const QString &sel); - virtual void writeWepKey(int network_id, QLineEdit *edit, int id); - virtual void removeNetwork(); - virtual void eapChanged(int sel); - virtual void useWps(); - -protected slots: - virtual void languageChange(); - -private: - WpaGui *wpagui; - int edit_network_id; - bool new_network; - QString bssid; - - virtual void wepEnabled(bool enabled); - virtual void getEapCapa(); -}; - -#endif /* NETWORKCONFIG_H */ +/* + * wpa_gui - NetworkConfig class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef NETWORKCONFIG_H +#define NETWORKCONFIG_H + +#include +#include "ui_networkconfig.h" + +class WpaGui; + +class NetworkConfig : public QDialog, public Ui::NetworkConfig +{ + Q_OBJECT + +public: + NetworkConfig(QWidget *parent = 0, const char *name = 0, + bool modal = false, Qt::WFlags fl = 0); + ~NetworkConfig(); + + virtual void paramsFromScanResults(QTreeWidgetItem *sel); + virtual void setWpaGui(WpaGui *_wpagui); + virtual int setNetworkParam(int id, const char *field, + const char *value, bool quote); + virtual void paramsFromConfig(int network_id); + virtual void newNetwork(); + +public slots: + virtual void authChanged(int sel); + virtual void addNetwork(); + virtual void encrChanged(const QString &sel); + virtual void writeWepKey(int network_id, QLineEdit *edit, int id); + virtual void removeNetwork(); + virtual void eapChanged(int sel); + virtual void useWps(); + +protected slots: + virtual void languageChange(); + +private: + WpaGui *wpagui; + int edit_network_id; + bool new_network; + QString bssid; + + virtual void wepEnabled(bool enabled); + virtual void getEapCapa(); +}; + +#endif /* NETWORKCONFIG_H */ diff --git a/Network/wpa_gui-qt4_/networkconfig.ui b/Network/wpa_gui-qt4_/networkconfig.ui index 217a8ff..5ad9151 100644 --- a/Network/wpa_gui-qt4_/networkconfig.ui +++ b/Network/wpa_gui-qt4_/networkconfig.ui @@ -1,435 +1,435 @@ - - NetworkConfig - - - - 0 - 0 - 410 - 534 - - - - NetworkConfig - - - - - - Cancel - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - SSID - - - - - - - Network name (Service Set IDentifier) - - - - - - - - - - Authentication - - - - - - - - Plaintext (open / no authentication) - - - - - Static WEP (no authentication) - - - - - Static WEP (Shared Key authentication) - - - - - IEEE 802.1X - - - - - WPA-Personal (PSK) - - - - - WPA-Enterprise (EAP) - - - - - WPA2-Personal (PSK) - - - - - WPA2-Enterprise (EAP) - - - - - - - - Encryption - - - - - - - - None - - - - - WEP - - - - - TKIP - - - - - CCMP - - - - - - - - PSK - - - - - - - false - - - WPA/WPA2 pre-shared key or passphrase - - - - - - QLineEdit::Password - - - - - - - EAP method - - - - - - - false - - - - - - - Identity - - - - - - - false - - - Username/Identity for EAP methods - - - - - - - Password - - - - - - - false - - - Password for EAP methods - - - QLineEdit::Password - - - - - - - CA certificate - - - - - - - false - - - - - - - true - - - WEP keys - - - - - - false - - - key 0 - - - - - - - false - - - key 1 - - - - - - - false - - - key 3 - - - - - - - false - - - key 2 - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - - - - true - - - Optional Settings - - - - - - Network Identification String - - - - - - - Network Priority - - - 10000 - - - 10 - - - - - - - IDString - - - - - - - Priority - - - - - - - Inner auth - - - - - - - false - - - - - - - - - - - - - Add - - - - - - - false - - - Remove - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - false - - - WPS - - - - - - - - - ssidEdit - authSelect - encrSelect - pskEdit - eapSelect - identityEdit - passwordEdit - cacertEdit - wep0Radio - wep0Edit - wep1Radio - wep1Edit - wep2Radio - wep2Edit - wep3Radio - wep3Edit - idstrEdit - prioritySpinBox - phase2Select - addButton - removeButton - cancelButton - - - qtreewidget.h - - - - + + NetworkConfig + + + + 0 + 0 + 410 + 534 + + + + NetworkConfig + + + + + + Cancel + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + SSID + + + + + + + Network name (Service Set IDentifier) + + + + + + + + + + Authentication + + + + + + + + Plaintext (open / no authentication) + + + + + Static WEP (no authentication) + + + + + Static WEP (Shared Key authentication) + + + + + IEEE 802.1X + + + + + WPA-Personal (PSK) + + + + + WPA-Enterprise (EAP) + + + + + WPA2-Personal (PSK) + + + + + WPA2-Enterprise (EAP) + + + + + + + + Encryption + + + + + + + + None + + + + + WEP + + + + + TKIP + + + + + CCMP + + + + + + + + PSK + + + + + + + false + + + WPA/WPA2 pre-shared key or passphrase + + + + + + QLineEdit::Password + + + + + + + EAP method + + + + + + + false + + + + + + + Identity + + + + + + + false + + + Username/Identity for EAP methods + + + + + + + Password + + + + + + + false + + + Password for EAP methods + + + QLineEdit::Password + + + + + + + CA certificate + + + + + + + false + + + + + + + true + + + WEP keys + + + + + + false + + + key 0 + + + + + + + false + + + key 1 + + + + + + + false + + + key 3 + + + + + + + false + + + key 2 + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + false + + + + + + + + + + true + + + Optional Settings + + + + + + Network Identification String + + + + + + + Network Priority + + + 10000 + + + 10 + + + + + + + IDString + + + + + + + Priority + + + + + + + Inner auth + + + + + + + false + + + + + + + + + + + + + Add + + + + + + + false + + + Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + WPS + + + + + + + + + ssidEdit + authSelect + encrSelect + pskEdit + eapSelect + identityEdit + passwordEdit + cacertEdit + wep0Radio + wep0Edit + wep1Radio + wep1Edit + wep2Radio + wep2Edit + wep3Radio + wep3Edit + idstrEdit + prioritySpinBox + phase2Select + addButton + removeButton + cancelButton + + + qtreewidget.h + + + + diff --git a/Network/wpa_gui-qt4_/peers.cpp b/Network/wpa_gui-qt4_/peers.cpp index 65bb17d..d09eaf2 100644 --- a/Network/wpa_gui-qt4_/peers.cpp +++ b/Network/wpa_gui-qt4_/peers.cpp @@ -1,1889 +1,1889 @@ -/* - * wpa_gui - Peers class - * Copyright (c) 2009-2010, Atheros Communications - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include -#include -#include - -#include "common/wpa_ctrl.h" -#include "wpagui.h" -#include "stringquery.h" -#include "peers.h" - - -enum { - peer_role_address = Qt::UserRole + 1, - peer_role_type, - peer_role_uuid, - peer_role_details, - peer_role_ifname, - peer_role_pri_dev_type, - peer_role_ssid, - peer_role_config_methods, - peer_role_dev_passwd_id, - peer_role_bss_id, - peer_role_selected_method, - peer_role_selected_pin, - peer_role_requested_method, - peer_role_network_id -}; - -enum selected_method { - SEL_METHOD_NONE, - SEL_METHOD_PIN_PEER_DISPLAY, - SEL_METHOD_PIN_LOCAL_DISPLAY -}; - -/* - * TODO: - * - add current AP info (e.g., from WPS) in station mode - */ - -enum peer_type { - PEER_TYPE_ASSOCIATED_STATION, - PEER_TYPE_AP, - PEER_TYPE_AP_WPS, - PEER_TYPE_WPS_PIN_NEEDED, - PEER_TYPE_P2P, - PEER_TYPE_P2P_CLIENT, - PEER_TYPE_P2P_GROUP, - PEER_TYPE_P2P_PERSISTENT_GROUP_GO, - PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT, - PEER_TYPE_P2P_INVITATION, - PEER_TYPE_WPS_ER_AP, - PEER_TYPE_WPS_ER_AP_UNCONFIGURED, - PEER_TYPE_WPS_ER_ENROLLEE, - PEER_TYPE_WPS_ENROLLEE -}; - - -Peers::Peers(QWidget *parent, const char *, bool, Qt::WFlags) - : QDialog(parent) -{ - setupUi(this); - - if (QImageReader::supportedImageFormats().contains(QByteArray("svg"))) - { - default_icon = new QIcon(":/icons/wpa_gui.svg"); - ap_icon = new QIcon(":/icons/ap.svg"); - laptop_icon = new QIcon(":/icons/laptop.svg"); - group_icon = new QIcon(":/icons/group.svg"); - invitation_icon = new QIcon(":/icons/invitation.svg"); - } else { - default_icon = new QIcon(":/icons/wpa_gui.png"); - ap_icon = new QIcon(":/icons/ap.png"); - laptop_icon = new QIcon(":/icons/laptop.png"); - group_icon = new QIcon(":/icons/group.png"); - invitation_icon = new QIcon(":/icons/invitation.png"); - } - - peers->setModel(&model); - peers->setResizeMode(QListView::Adjust); - peers->setDragEnabled(false); - peers->setSelectionMode(QAbstractItemView::NoSelection); - - peers->setContextMenuPolicy(Qt::CustomContextMenu); - connect(peers, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(context_menu(const QPoint &))); - - wpagui = NULL; - hide_ap = false; -} - - -void Peers::setWpaGui(WpaGui *_wpagui) -{ - wpagui = _wpagui; - update_peers(); -} - - -Peers::~Peers() -{ - delete default_icon; - delete ap_icon; - delete laptop_icon; - delete group_icon; - delete invitation_icon; -} - - -void Peers::languageChange() -{ - retranslateUi(this); -} - - -QString Peers::ItemType(int type) -{ - QString title; - switch (type) { - case PEER_TYPE_ASSOCIATED_STATION: - title = tr("Associated station"); - break; - case PEER_TYPE_AP: - title = tr("AP"); - break; - case PEER_TYPE_AP_WPS: - title = tr("WPS AP"); - break; - case PEER_TYPE_WPS_PIN_NEEDED: - title = tr("WPS PIN needed"); - break; - case PEER_TYPE_P2P: - title = tr("P2P Device"); - break; - case PEER_TYPE_P2P_CLIENT: - title = tr("P2P Device (group client)"); - break; - case PEER_TYPE_P2P_GROUP: - title = tr("P2P Group"); - break; - case PEER_TYPE_P2P_PERSISTENT_GROUP_GO: - title = tr("P2P Persistent Group (GO)"); - break; - case PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT: - title = tr("P2P Persistent Group (client)"); - break; - case PEER_TYPE_P2P_INVITATION: - title = tr("P2P Invitation"); - break; - case PEER_TYPE_WPS_ER_AP: - title = tr("ER: WPS AP"); - break; - case PEER_TYPE_WPS_ER_AP_UNCONFIGURED: - title = tr("ER: WPS AP (Unconfigured)"); - break; - case PEER_TYPE_WPS_ER_ENROLLEE: - title = tr("ER: WPS Enrollee"); - break; - case PEER_TYPE_WPS_ENROLLEE: - title = tr("WPS Enrollee"); - break; - } - return title; -} - - -void Peers::context_menu(const QPoint &pos) -{ - QMenu *menu = new QMenu; - if (menu == NULL) - return; - - QModelIndex idx = peers->indexAt(pos); - if (idx.isValid()) { - ctx_item = model.itemFromIndex(idx); - int type = ctx_item->data(peer_role_type).toInt(); - menu->addAction(Peers::ItemType(type))->setEnabled(false); - menu->addSeparator(); - - int config_methods = -1; - QVariant var = ctx_item->data(peer_role_config_methods); - if (var.isValid()) - config_methods = var.toInt(); - - enum selected_method method = SEL_METHOD_NONE; - var = ctx_item->data(peer_role_selected_method); - if (var.isValid()) - method = (enum selected_method) var.toInt(); - - if ((type == PEER_TYPE_ASSOCIATED_STATION || - type == PEER_TYPE_AP_WPS || - type == PEER_TYPE_WPS_PIN_NEEDED || - type == PEER_TYPE_WPS_ER_ENROLLEE || - type == PEER_TYPE_WPS_ENROLLEE) && - (config_methods == -1 || (config_methods & 0x010c))) { - menu->addAction(tr("Enter WPS PIN"), this, - SLOT(enter_pin())); - } - - if (type == PEER_TYPE_P2P || type == PEER_TYPE_P2P_CLIENT) { - menu->addAction(tr("P2P Connect"), this, - SLOT(ctx_p2p_connect())); - if (method == SEL_METHOD_NONE && - config_methods > -1 && - config_methods & 0x0080 /* PBC */ && - config_methods != 0x0080) - menu->addAction(tr("P2P Connect (PBC)"), this, - SLOT(connect_pbc())); - if (method == SEL_METHOD_NONE) { - menu->addAction(tr("P2P Request PIN"), this, - SLOT(ctx_p2p_req_pin())); - menu->addAction(tr("P2P Show PIN"), this, - SLOT(ctx_p2p_show_pin())); - } - - if (config_methods > -1 && (config_methods & 0x0100)) { - /* Peer has Keypad */ - menu->addAction(tr("P2P Display PIN"), this, - SLOT(ctx_p2p_display_pin())); - } - - if (config_methods > -1 && (config_methods & 0x000c)) { - /* Peer has Label or Display */ - menu->addAction(tr("P2P Enter PIN"), this, - SLOT(ctx_p2p_enter_pin())); - } - } - - if (type == PEER_TYPE_P2P_GROUP) { - menu->addAction(tr("Show passphrase"), this, - SLOT(ctx_p2p_show_passphrase())); - menu->addAction(tr("Remove P2P Group"), this, - SLOT(ctx_p2p_remove_group())); - } - - if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || - type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT || - type == PEER_TYPE_P2P_INVITATION) { - menu->addAction(tr("Start group"), this, - SLOT(ctx_p2p_start_persistent())); - } - - if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || - type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT) { - menu->addAction(tr("Invite"), this, - SLOT(ctx_p2p_invite())); - } - - if (type == PEER_TYPE_P2P_INVITATION) { - menu->addAction(tr("Ignore"), this, - SLOT(ctx_p2p_delete())); - } - - if (type == PEER_TYPE_AP_WPS) { - menu->addAction(tr("Connect (PBC)"), this, - SLOT(connect_pbc())); - } - - if ((type == PEER_TYPE_ASSOCIATED_STATION || - type == PEER_TYPE_WPS_ER_ENROLLEE || - type == PEER_TYPE_WPS_ENROLLEE) && - config_methods >= 0 && (config_methods & 0x0080)) { - menu->addAction(tr("Enroll (PBC)"), this, - SLOT(connect_pbc())); - } - - if (type == PEER_TYPE_WPS_ER_AP) { - menu->addAction(tr("Learn Configuration"), this, - SLOT(learn_ap_config())); - } - - menu->addAction(tr("Properties"), this, SLOT(properties())); - } else { - ctx_item = NULL; - menu->addAction(QString(tr("Refresh")), this, - SLOT(ctx_refresh())); - menu->addAction(tr("Start P2P discovery"), this, - SLOT(ctx_p2p_start())); - menu->addAction(tr("Stop P2P discovery"), this, - SLOT(ctx_p2p_stop())); - menu->addAction(tr("P2P listen only"), this, - SLOT(ctx_p2p_listen())); - menu->addAction(tr("Start P2P group"), this, - SLOT(ctx_p2p_start_group())); - if (hide_ap) - menu->addAction(tr("Show AP entries"), this, - SLOT(ctx_show_ap())); - else - menu->addAction(tr("Hide AP entries"), this, - SLOT(ctx_hide_ap())); - } - - menu->exec(peers->mapToGlobal(pos)); -} - - -void Peers::enter_pin() -{ - if (ctx_item == NULL) - return; - - int peer_type = ctx_item->data(peer_role_type).toInt(); - QString uuid; - QString addr; - addr = ctx_item->data(peer_role_address).toString(); - if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) - uuid = ctx_item->data(peer_role_uuid).toString(); - - StringQuery input(tr("PIN:")); - input.setWindowTitle(tr("PIN for ") + ctx_item->text()); - if (input.exec() != QDialog::Accepted) - return; - - char cmd[100]; - char reply[100]; - size_t reply_len; - - if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { - snprintf(cmd, sizeof(cmd), "WPS_ER_PIN %s %s %s", - uuid.toAscii().constData(), - input.get_string().toAscii().constData(), - addr.toAscii().constData()); - } else { - snprintf(cmd, sizeof(cmd), "WPS_PIN %s %s", - addr.toAscii().constData(), - input.get_string().toAscii().constData()); - } - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to set the WPS PIN.")); - msg.exec(); - } -} - - -void Peers::ctx_refresh() -{ - update_peers(); -} - - -void Peers::ctx_p2p_start() -{ - char reply[20]; - size_t reply_len; - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("P2P_FIND", reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to start P2P discovery."); - msg.exec(); - } -} - - -void Peers::ctx_p2p_stop() -{ - char reply[20]; - size_t reply_len; - reply_len = sizeof(reply) - 1; - wpagui->ctrlRequest("P2P_STOP_FIND", reply, &reply_len); -} - - -void Peers::ctx_p2p_listen() -{ - char reply[20]; - size_t reply_len; - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("P2P_LISTEN 3600", reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to start P2P listen."); - msg.exec(); - } -} - - -void Peers::ctx_p2p_start_group() -{ - char reply[20]; - size_t reply_len; - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("P2P_GROUP_ADD", reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to start P2P group."); - msg.exec(); - } -} - - -void Peers::add_station(QString info) -{ - QStringList lines = info.split(QRegExp("\\n")); - QString name; - - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - int pos = (*it).indexOf('=') + 1; - if (pos < 1) - continue; - - if ((*it).startsWith("wpsDeviceName=")) - name = (*it).mid(pos); - else if ((*it).startsWith("p2p_device_name=")) - name = (*it).mid(pos); - } - - if (name.isEmpty()) - name = lines[0]; - - QStandardItem *item = new QStandardItem(*laptop_icon, name); - if (item) { - /* Remove WPS enrollee entry if one is still pending */ - if (model.rowCount() > 0) { - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_address, - lines[0]); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item; - item = model.itemFromIndex(lst[i]); - if (item == NULL) - continue; - int type = item->data(peer_role_type).toInt(); - if (type == PEER_TYPE_WPS_ENROLLEE) { - model.removeRow(lst[i].row()); - break; - } - } - } - - item->setData(lines[0], peer_role_address); - item->setData(PEER_TYPE_ASSOCIATED_STATION, - peer_role_type); - item->setData(info, peer_role_details); - item->setToolTip(ItemType(PEER_TYPE_ASSOCIATED_STATION)); - model.appendRow(item); - } -} - - -void Peers::add_stations() -{ - char reply[2048]; - size_t reply_len; - char cmd[30]; - int res; - - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("STA-FIRST", reply, &reply_len) < 0) - return; - - do { - reply[reply_len] = '\0'; - QString info(reply); - char *txt = reply; - while (*txt != '\0' && *txt != '\n') - txt++; - *txt++ = '\0'; - if (strncmp(reply, "FAIL", 4) == 0 || - strncmp(reply, "UNKNOWN", 7) == 0) - break; - - add_station(info); - - reply_len = sizeof(reply) - 1; - snprintf(cmd, sizeof(cmd), "STA-NEXT %s", reply); - res = wpagui->ctrlRequest(cmd, reply, &reply_len); - } while (res >= 0); -} - - -void Peers::add_single_station(const char *addr) -{ - char reply[2048]; - size_t reply_len; - char cmd[30]; - - reply_len = sizeof(reply) - 1; - snprintf(cmd, sizeof(cmd), "STA %s", addr); - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) - return; - - reply[reply_len] = '\0'; - QString info(reply); - char *txt = reply; - while (*txt != '\0' && *txt != '\n') - txt++; - *txt++ = '\0'; - if (strncmp(reply, "FAIL", 4) == 0 || - strncmp(reply, "UNKNOWN", 7) == 0) - return; - - add_station(info); -} - - -void Peers::add_p2p_group_client(QStandardItem * /*parent*/, QString params) -{ - /* - * dev=02:b5:64:63:30:63 iface=02:b5:64:63:30:63 dev_capab=0x0 - * dev_type=1-0050f204-1 dev_name='Wireless Client' - * config_methods=0x8c - */ - - QStringList items = - params.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)")); - QString addr = ""; - QString name = ""; - int config_methods = 0; - QString dev_type; - - for (int i = 0; i < items.size(); i++) { - QString str = items.at(i); - int pos = str.indexOf('=') + 1; - if (str.startsWith("dev_name='")) - name = str.section('\'', 1, -2); - else if (str.startsWith("config_methods=")) - config_methods = - str.section('=', 1).toInt(0, 0); - else if (str.startsWith("dev=")) - addr = str.mid(pos); - else if (str.startsWith("dev_type=") && dev_type.isEmpty()) - dev_type = str.mid(pos); - } - - QStandardItem *item = find_addr(addr); - if (item) - return; - - item = new QStandardItem(*default_icon, name); - if (item) { - /* TODO: indicate somehow the relationship to the group owner - * (parent) */ - item->setData(addr, peer_role_address); - item->setData(config_methods, peer_role_config_methods); - item->setData(PEER_TYPE_P2P_CLIENT, peer_role_type); - if (!dev_type.isEmpty()) - item->setData(dev_type, peer_role_pri_dev_type); - item->setData(items.join(QString("\n")), peer_role_details); - item->setToolTip(ItemType(PEER_TYPE_P2P_CLIENT)); - model.appendRow(item); - } -} - - -void Peers::remove_bss(int id) -{ - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), peer_role_bss_id, - id); - if (lst.size() == 0) - return; - model.removeRow(lst[0].row()); -} - - -bool Peers::add_bss(const char *cmd) -{ - char reply[2048]; - size_t reply_len; - - if (hide_ap) - return false; - - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) - return false; - reply[reply_len] = '\0'; - - QString bss(reply); - if (bss.isEmpty() || bss.startsWith("FAIL")) - return false; - - QString ssid, bssid, flags, wps_name, pri_dev_type; - int id = -1; - - QStringList lines = bss.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - int pos = (*it).indexOf('=') + 1; - if (pos < 1) - continue; - - if ((*it).startsWith("bssid=")) - bssid = (*it).mid(pos); - else if ((*it).startsWith("id=")) - id = (*it).mid(pos).toInt(); - else if ((*it).startsWith("flags=")) - flags = (*it).mid(pos); - else if ((*it).startsWith("ssid=")) - ssid = (*it).mid(pos); - else if ((*it).startsWith("wps_device_name=")) - wps_name = (*it).mid(pos); - else if ((*it).startsWith("wps_primary_device_type=")) - pri_dev_type = (*it).mid(pos); - } - - QString name = wps_name; - if (name.isEmpty()) - name = ssid + "\n" + bssid; - - QStandardItem *item = new QStandardItem(*ap_icon, name); - if (item) { - item->setData(bssid, peer_role_address); - if (id >= 0) - item->setData(id, peer_role_bss_id); - int type; - if (flags.contains("[WPS")) - type = PEER_TYPE_AP_WPS; - else - type = PEER_TYPE_AP; - item->setData(type, peer_role_type); - - for (int i = 0; i < lines.size(); i++) { - if (lines[i].length() > 60) { - lines[i].remove(60, lines[i].length()); - lines[i] += ".."; - } - } - item->setToolTip(ItemType(type)); - item->setData(lines.join("\n"), peer_role_details); - if (!pri_dev_type.isEmpty()) - item->setData(pri_dev_type, - peer_role_pri_dev_type); - if (!ssid.isEmpty()) - item->setData(ssid, peer_role_ssid); - model.appendRow(item); - - lines = bss.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - if ((*it).startsWith("p2p_group_client:")) - add_p2p_group_client(item, - (*it).mid(18)); - } - } - - return true; -} - - -void Peers::add_scan_results() -{ - int index; - char cmd[20]; - - index = 0; - while (wpagui) { - snprintf(cmd, sizeof(cmd), "BSS %d", index++); - if (index > 1000) - break; - - if (!add_bss(cmd)) - break; - } -} - - -void Peers::add_persistent(int id, const char *ssid, const char *bssid) -{ - char cmd[100]; - char reply[100]; - size_t reply_len; - int mode; - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d mode", id); - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) - return; - reply[reply_len] = '\0'; - mode = atoi(reply); - - QString name = ssid; - name = '[' + name + ']'; - - QStandardItem *item = new QStandardItem(*group_icon, name); - if (!item) - return; - - int type; - if (mode == 3) - type = PEER_TYPE_P2P_PERSISTENT_GROUP_GO; - else - type = PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT; - item->setData(type, peer_role_type); - item->setToolTip(ItemType(type)); - item->setData(ssid, peer_role_ssid); - if (bssid && strcmp(bssid, "any") == 0) - bssid = NULL; - if (bssid) - item->setData(bssid, peer_role_address); - item->setData(id, peer_role_network_id); - item->setBackground(Qt::BDiagPattern); - - model.appendRow(item); -} - - -void Peers::add_persistent_groups() -{ - char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; - size_t len; - - len = sizeof(buf) - 1; - if (wpagui->ctrlRequest("LIST_NETWORKS", buf, &len) < 0) - return; - - buf[len] = '\0'; - start = strchr(buf, '\n'); - if (start == NULL) - return; - start++; - - while (*start) { - bool last = false; - end = strchr(start, '\n'); - if (end == NULL) { - last = true; - end = start; - while (end[0] && end[1]) - end++; - } - *end = '\0'; - - id = start; - ssid = strchr(id, '\t'); - if (ssid == NULL) - break; - *ssid++ = '\0'; - bssid = strchr(ssid, '\t'); - if (bssid == NULL) - break; - *bssid++ = '\0'; - flags = strchr(bssid, '\t'); - if (flags == NULL) - break; - *flags++ = '\0'; - - if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) - add_persistent(atoi(id), ssid, bssid); - - if (last) - break; - start = end + 1; - } -} - - -void Peers::update_peers() -{ - model.clear(); - if (wpagui == NULL) - return; - - char reply[20]; - size_t replylen = sizeof(reply) - 1; - wpagui->ctrlRequest("WPS_ER_START", reply, &replylen); - - add_stations(); - add_scan_results(); - add_persistent_groups(); -} - - -QStandardItem * Peers::find_addr(QString addr) -{ - if (model.rowCount() == 0) - return NULL; - - QModelIndexList lst = model.match(model.index(0, 0), peer_role_address, - addr); - if (lst.size() == 0) - return NULL; - return model.itemFromIndex(lst[0]); -} - - -QStandardItem * Peers::find_addr_type(QString addr, int type) -{ - if (model.rowCount() == 0) - return NULL; - - QModelIndexList lst = model.match(model.index(0, 0), peer_role_address, - addr); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item = model.itemFromIndex(lst[i]); - if (item->data(peer_role_type).toInt() == type) - return item; - } - return NULL; -} - - -QStandardItem * Peers::find_uuid(QString uuid) -{ - if (model.rowCount() == 0) - return NULL; - - QModelIndexList lst = model.match(model.index(0, 0), peer_role_uuid, - uuid); - if (lst.size() == 0) - return NULL; - return model.itemFromIndex(lst[0]); -} - - -void Peers::event_notify(WpaMsg msg) -{ - QString text = msg.getMsg(); - - if (text.startsWith(WPS_EVENT_PIN_NEEDED)) { - /* - * WPS-PIN-NEEDED 5a02a5fa-9199-5e7c-bc46-e183d3cb32f7 - * 02:2a:c4:18:5b:f3 - * [Wireless Client|Company|cmodel|123|12345|1-0050F204-1] - */ - QStringList items = text.split(' '); - QString uuid = items[1]; - QString addr = items[2]; - QString name = ""; - - QStandardItem *item = find_addr(addr); - if (item) - return; - - int pos = text.indexOf('['); - if (pos >= 0) { - int pos2 = text.lastIndexOf(']'); - if (pos2 >= pos) { - items = text.mid(pos + 1, pos2 - pos - 1). - split('|'); - name = items[0]; - items.append(addr); - } - } - - item = new QStandardItem(*laptop_icon, name); - if (item) { - item->setData(addr, peer_role_address); - item->setData(PEER_TYPE_WPS_PIN_NEEDED, - peer_role_type); - item->setToolTip(ItemType(PEER_TYPE_WPS_PIN_NEEDED)); - item->setData(items.join("\n"), peer_role_details); - item->setData(items[5], peer_role_pri_dev_type); - model.appendRow(item); - } - return; - } - - if (text.startsWith(AP_STA_CONNECTED)) { - /* AP-STA-CONNECTED 02:2a:c4:18:5b:f3 */ - QStringList items = text.split(' '); - QString addr = items[1]; - QStandardItem *item = find_addr(addr); - if (item == NULL || item->data(peer_role_type).toInt() != - PEER_TYPE_ASSOCIATED_STATION) - add_single_station(addr.toAscii().constData()); - return; - } - - if (text.startsWith(AP_STA_DISCONNECTED)) { - /* AP-STA-DISCONNECTED 02:2a:c4:18:5b:f3 */ - QStringList items = text.split(' '); - QString addr = items[1]; - - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_address, addr, -1); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item = model.itemFromIndex(lst[i]); - if (item && item->data(peer_role_type).toInt() == - PEER_TYPE_ASSOCIATED_STATION) { - model.removeRow(lst[i].row()); - break; - } - } - return; - } - - if (text.startsWith(P2P_EVENT_DEVICE_FOUND)) { - /* - * P2P-DEVICE-FOUND 02:b5:64:63:30:63 - * p2p_dev_addr=02:b5:64:63:30:63 pri_dev_type=1-0050f204-1 - * name='Wireless Client' config_methods=0x84 dev_capab=0x21 - * group_capab=0x0 - */ - QStringList items = - text.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)")); - QString addr = items[1]; - QString name = ""; - QString pri_dev_type; - int config_methods = 0; - for (int i = 0; i < items.size(); i++) { - QString str = items.at(i); - if (str.startsWith("name='")) - name = str.section('\'', 1, -2); - else if (str.startsWith("config_methods=")) - config_methods = - str.section('=', 1).toInt(0, 0); - else if (str.startsWith("pri_dev_type=")) - pri_dev_type = str.section('=', 1); - } - - QStandardItem *item = find_addr(addr); - if (item) { - int type = item->data(peer_role_type).toInt(); - if (type == PEER_TYPE_P2P) - return; - } - - item = new QStandardItem(*default_icon, name); - if (item) { - item->setData(addr, peer_role_address); - item->setData(config_methods, - peer_role_config_methods); - item->setData(PEER_TYPE_P2P, peer_role_type); - if (!pri_dev_type.isEmpty()) - item->setData(pri_dev_type, - peer_role_pri_dev_type); - item->setData(items.join(QString("\n")), - peer_role_details); - item->setToolTip(ItemType(PEER_TYPE_P2P)); - model.appendRow(item); - } - - item = find_addr_type(addr, - PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT); - if (item) - item->setBackground(Qt::NoBrush); - } - - if (text.startsWith(P2P_EVENT_GROUP_STARTED)) { - /* P2P-GROUP-STARTED wlan0-p2p-0 GO ssid="DIRECT-3F" - * passphrase="YOyTkxID" go_dev_addr=02:40:61:c2:f3:b7 - * [PERSISTENT] */ - QStringList items = text.split(' '); - if (items.size() < 4) - return; - - int pos = text.indexOf(" ssid=\""); - if (pos < 0) - return; - QString ssid = text.mid(pos + 7); - pos = ssid.indexOf(" passphrase=\""); - if (pos < 0) - pos = ssid.indexOf(" psk="); - if (pos >= 0) - ssid.truncate(pos); - pos = ssid.lastIndexOf('"'); - if (pos >= 0) - ssid.truncate(pos); - - QStandardItem *item = new QStandardItem(*group_icon, ssid); - if (item) { - item->setData(PEER_TYPE_P2P_GROUP, peer_role_type); - item->setData(items[1], peer_role_ifname); - QString details; - if (items[2] == "GO") { - details = tr("P2P GO for interface ") + - items[1]; - } else { - details = tr("P2P client for interface ") + - items[1]; - } - if (text.contains(" [PERSISTENT]")) - details += "\nPersistent group"; - item->setData(details, peer_role_details); - item->setToolTip(ItemType(PEER_TYPE_P2P_GROUP)); - model.appendRow(item); - } - } - - if (text.startsWith(P2P_EVENT_GROUP_REMOVED)) { - /* P2P-GROUP-REMOVED wlan0-p2p-0 GO */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_ifname, items[1]); - for (int i = 0; i < lst.size(); i++) - model.removeRow(lst[i].row()); - return; - } - - if (text.startsWith(P2P_EVENT_PROV_DISC_SHOW_PIN)) { - /* P2P-PROV-DISC-SHOW-PIN 02:40:61:c2:f3:b7 12345670 */ - QStringList items = text.split(' '); - if (items.size() < 3) - return; - QString addr = items[1]; - QString pin = items[2]; - - QStandardItem *item = find_addr_type(addr, PEER_TYPE_P2P); - if (item == NULL) - return; - item->setData(SEL_METHOD_PIN_LOCAL_DISPLAY, - peer_role_selected_method); - item->setData(pin, peer_role_selected_pin); - QVariant var = item->data(peer_role_requested_method); - if (var.isValid() && - var.toInt() == SEL_METHOD_PIN_LOCAL_DISPLAY) { - ctx_item = item; - ctx_p2p_display_pin_pd(); - } - return; - } - - if (text.startsWith(P2P_EVENT_PROV_DISC_ENTER_PIN)) { - /* P2P-PROV-DISC-ENTER-PIN 02:40:61:c2:f3:b7 */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - QString addr = items[1]; - - QStandardItem *item = find_addr_type(addr, PEER_TYPE_P2P); - if (item == NULL) - return; - item->setData(SEL_METHOD_PIN_PEER_DISPLAY, - peer_role_selected_method); - QVariant var = item->data(peer_role_requested_method); - if (var.isValid() && - var.toInt() == SEL_METHOD_PIN_PEER_DISPLAY) { - ctx_item = item; - ctx_p2p_connect(); - } - return; - } - - if (text.startsWith(P2P_EVENT_INVITATION_RECEIVED)) { - /* P2P-INVITATION-RECEIVED sa=02:f0:bc:44:87:62 persistent=4 */ - QStringList items = text.split(' '); - if (items.size() < 3) - return; - if (!items[1].startsWith("sa=") || - !items[2].startsWith("persistent=")) - return; - QString addr = items[1].mid(3); - int id = items[2].mid(11).toInt(); - - char cmd[100]; - char reply[100]; - size_t reply_len; - - snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", id); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) - return; - reply[reply_len] = '\0'; - QString name; - char *pos = strrchr(reply, '"'); - if (pos && reply[0] == '"') { - *pos = '\0'; - name = reply + 1; - } else - name = reply; - - QStandardItem *item; - item = find_addr_type(addr, PEER_TYPE_P2P_INVITATION); - if (item) - model.removeRow(item->row()); - - item = new QStandardItem(*invitation_icon, name); - if (!item) - return; - item->setData(PEER_TYPE_P2P_INVITATION, peer_role_type); - item->setToolTip(ItemType(PEER_TYPE_P2P_INVITATION)); - item->setData(addr, peer_role_address); - item->setData(id, peer_role_network_id); - - model.appendRow(item); - - enable_persistent(id); - - return; - } - - if (text.startsWith(P2P_EVENT_INVITATION_RESULT)) { - /* P2P-INVITATION-RESULT status=1 */ - /* TODO */ - return; - } - - if (text.startsWith(WPS_EVENT_ER_AP_ADD)) { - /* - * WPS-ER-AP-ADD 87654321-9abc-def0-1234-56789abc0002 - * 02:11:22:33:44:55 pri_dev_type=6-0050F204-1 wps_state=1 - * |Very friendly name|Company|Long description of the model| - * WAP|http://w1.fi/|http://w1.fi/hostapd/ - */ - QStringList items = text.split(' '); - if (items.size() < 5) - return; - QString uuid = items[1]; - QString addr = items[2]; - QString pri_dev_type = items[3].mid(13); - int wps_state = items[4].mid(10).toInt(); - - int pos = text.indexOf('|'); - if (pos < 0) - return; - items = text.mid(pos + 1).split('|'); - if (items.size() < 1) - return; - - QStandardItem *item = find_uuid(uuid); - if (item) - return; - - item = new QStandardItem(*ap_icon, items[0]); - if (item) { - item->setData(uuid, peer_role_uuid); - item->setData(addr, peer_role_address); - int type = wps_state == 2 ? PEER_TYPE_WPS_ER_AP: - PEER_TYPE_WPS_ER_AP_UNCONFIGURED; - item->setData(type, peer_role_type); - item->setToolTip(ItemType(type)); - item->setData(pri_dev_type, peer_role_pri_dev_type); - item->setData(items.join(QString("\n")), - peer_role_details); - model.appendRow(item); - } - - return; - } - - if (text.startsWith(WPS_EVENT_ER_AP_REMOVE)) { - /* WPS-ER-AP-REMOVE 87654321-9abc-def0-1234-56789abc0002 */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_uuid, items[1]); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item = model.itemFromIndex(lst[i]); - if (item && - (item->data(peer_role_type).toInt() == - PEER_TYPE_WPS_ER_AP || - item->data(peer_role_type).toInt() == - PEER_TYPE_WPS_ER_AP_UNCONFIGURED)) - model.removeRow(lst[i].row()); - } - return; - } - - if (text.startsWith(WPS_EVENT_ER_ENROLLEE_ADD)) { - /* - * WPS-ER-ENROLLEE-ADD 2b7093f1-d6fb-5108-adbb-bea66bb87333 - * 02:66:a0:ee:17:27 M1=1 config_methods=0x14d dev_passwd_id=0 - * pri_dev_type=1-0050F204-1 - * |Wireless Client|Company|cmodel|123|12345| - */ - QStringList items = text.split(' '); - if (items.size() < 3) - return; - QString uuid = items[1]; - QString addr = items[2]; - QString pri_dev_type = items[6].mid(13); - int config_methods = -1; - int dev_passwd_id = -1; - - for (int i = 3; i < items.size(); i++) { - int pos = items[i].indexOf('=') + 1; - if (pos < 1) - continue; - QString val = items[i].mid(pos); - if (items[i].startsWith("config_methods=")) { - config_methods = val.toInt(0, 0); - } else if (items[i].startsWith("dev_passwd_id=")) { - dev_passwd_id = val.toInt(); - } - } - - int pos = text.indexOf('|'); - if (pos < 0) - return; - items = text.mid(pos + 1).split('|'); - if (items.size() < 1) - return; - QString name = items[0]; - if (name.length() == 0) - name = addr; - - remove_enrollee_uuid(uuid); - - QStandardItem *item; - item = new QStandardItem(*laptop_icon, name); - if (item) { - item->setData(uuid, peer_role_uuid); - item->setData(addr, peer_role_address); - item->setData(PEER_TYPE_WPS_ER_ENROLLEE, - peer_role_type); - item->setToolTip(ItemType(PEER_TYPE_WPS_ER_ENROLLEE)); - item->setData(items.join(QString("\n")), - peer_role_details); - item->setData(pri_dev_type, peer_role_pri_dev_type); - if (config_methods >= 0) - item->setData(config_methods, - peer_role_config_methods); - if (dev_passwd_id >= 0) - item->setData(dev_passwd_id, - peer_role_dev_passwd_id); - model.appendRow(item); - } - - return; - } - - if (text.startsWith(WPS_EVENT_ER_ENROLLEE_REMOVE)) { - /* - * WPS-ER-ENROLLEE-REMOVE 2b7093f1-d6fb-5108-adbb-bea66bb87333 - * 02:66:a0:ee:17:27 - */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - remove_enrollee_uuid(items[1]); - return; - } - - if (text.startsWith(WPS_EVENT_ENROLLEE_SEEN)) { - /* TODO: need to time out this somehow or remove on successful - * WPS run, etc. */ - /* - * WPS-ENROLLEE-SEEN 02:00:00:00:01:00 - * 572cf82f-c957-5653-9b16-b5cfb298abf1 1-0050F204-1 0x80 4 1 - * [Wireless Client] - * (MAC addr, UUID-E, pri dev type, config methods, - * dev passwd id, request type, [dev name]) - */ - QStringList items = text.split(' '); - if (items.size() < 7) - return; - QString addr = items[1]; - QString uuid = items[2]; - QString pri_dev_type = items[3]; - int config_methods = items[4].toInt(0, 0); - int dev_passwd_id = items[5].toInt(); - QString name; - - QStandardItem *item = find_addr(addr); - if (item) { - int type = item->data(peer_role_type).toInt(); - if (type == PEER_TYPE_ASSOCIATED_STATION) - return; /* already associated */ - } - - int pos = text.indexOf('['); - if (pos >= 0) { - int pos2 = text.lastIndexOf(']'); - if (pos2 >= pos) { - QStringList items2 = - text.mid(pos + 1, pos2 - pos - 1). - split('|'); - name = items2[0]; - } - } - if (name.isEmpty()) - name = addr; - - item = find_uuid(uuid); - if (item) { - QVariant var = item->data(peer_role_config_methods); - QVariant var2 = item->data(peer_role_dev_passwd_id); - if ((var.isValid() && config_methods != var.toInt()) || - (var2.isValid() && dev_passwd_id != var2.toInt())) - remove_enrollee_uuid(uuid); - else - return; - } - - item = new QStandardItem(*laptop_icon, name); - if (item) { - item->setData(uuid, peer_role_uuid); - item->setData(addr, peer_role_address); - item->setData(PEER_TYPE_WPS_ENROLLEE, - peer_role_type); - item->setToolTip(ItemType(PEER_TYPE_WPS_ENROLLEE)); - item->setData(items.join(QString("\n")), - peer_role_details); - item->setData(pri_dev_type, peer_role_pri_dev_type); - item->setData(config_methods, - peer_role_config_methods); - item->setData(dev_passwd_id, peer_role_dev_passwd_id); - model.appendRow(item); - } - - return; - } - - if (text.startsWith(WPA_EVENT_BSS_ADDED)) { - /* CTRL-EVENT-BSS-ADDED 34 00:11:22:33:44:55 */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - char cmd[20]; - snprintf(cmd, sizeof(cmd), "BSS ID-%d", items[1].toInt()); - add_bss(cmd); - return; - } - - if (text.startsWith(WPA_EVENT_BSS_REMOVED)) { - /* CTRL-EVENT-BSS-REMOVED 34 00:11:22:33:44:55 */ - QStringList items = text.split(' '); - if (items.size() < 2) - return; - remove_bss(items[1].toInt()); - return; - } -} - - -void Peers::ctx_p2p_connect() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - QString arg; - int config_methods = - ctx_item->data(peer_role_config_methods).toInt(); - enum selected_method method = SEL_METHOD_NONE; - QVariant var = ctx_item->data(peer_role_selected_method); - if (var.isValid()) - method = (enum selected_method) var.toInt(); - if (method == SEL_METHOD_PIN_LOCAL_DISPLAY) { - arg = ctx_item->data(peer_role_selected_pin).toString(); - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", - addr.toAscii().constData(), - arg.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to initiate P2P connect."); - msg.exec(); - return; - } - QMessageBox::information(this, - tr("PIN for ") + ctx_item->text(), - tr("Enter the following PIN on the\n" - "peer device: ") + arg); - } else if (method == SEL_METHOD_PIN_PEER_DISPLAY) { - StringQuery input(tr("PIN from peer display:")); - input.setWindowTitle(tr("PIN for ") + ctx_item->text()); - if (input.exec() != QDialog::Accepted) - return; - arg = input.get_string(); - } else if (config_methods == 0x0080 /* PBC */) { - arg = "pbc"; - } else { - StringQuery input(tr("PIN:")); - input.setWindowTitle(tr("PIN for ") + ctx_item->text()); - if (input.exec() != QDialog::Accepted) - return; - arg = input.get_string(); - } - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s", - addr.toAscii().constData(), - arg.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to initiate P2P connect."); - msg.exec(); - } -} - - -void Peers::ctx_p2p_req_pin() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - ctx_item->setData(SEL_METHOD_PIN_PEER_DISPLAY, - peer_role_requested_method); - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s display", - addr.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to request PIN from peer.")); - msg.exec(); - } -} - - -void Peers::ctx_p2p_show_pin() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - ctx_item->setData(SEL_METHOD_PIN_LOCAL_DISPLAY, - peer_role_requested_method); - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s keypad", - addr.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to request peer to enter PIN.")); - msg.exec(); - } -} - - -void Peers::ctx_p2p_display_pin() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pin", - addr.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to initiate P2P connect."); - msg.exec(); - return; - } - reply[reply_len] = '\0'; - QMessageBox::information(this, - tr("PIN for ") + ctx_item->text(), - tr("Enter the following PIN on the\n" - "peer device: ") + reply); -} - - -void Peers::ctx_p2p_display_pin_pd() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - QString arg = ctx_item->data(peer_role_selected_pin).toString(); - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", - addr.toAscii().constData(), - arg.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to initiate P2P connect."); - msg.exec(); - return; - } - reply[reply_len] = '\0'; - QMessageBox::information(this, - tr("PIN for ") + ctx_item->text(), - tr("Enter the following PIN on the\n" - "peer device: ") + arg); -} - - -void Peers::ctx_p2p_enter_pin() -{ - if (ctx_item == NULL) - return; - QString addr = ctx_item->data(peer_role_address).toString(); - QString arg; - - StringQuery input(tr("PIN from peer:")); - input.setWindowTitle(tr("PIN for ") + ctx_item->text()); - if (input.exec() != QDialog::Accepted) - return; - arg = input.get_string(); - - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s keypad", - addr.toAscii().constData(), - arg.toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to initiate P2P connect."); - msg.exec(); - } -} - - -void Peers::ctx_p2p_remove_group() -{ - if (ctx_item == NULL) - return; - char cmd[100]; - char reply[100]; - size_t reply_len; - snprintf(cmd, sizeof(cmd), "P2P_GROUP_REMOVE %s", - ctx_item->data(peer_role_ifname).toString().toAscii(). - constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to remove P2P Group."); - msg.exec(); - } -} - - -void Peers::closeEvent(QCloseEvent *) -{ - if (wpagui) { - char reply[20]; - size_t replylen = sizeof(reply) - 1; - wpagui->ctrlRequest("WPS_ER_STOP", reply, &replylen); - } -} - - -void Peers::done(int r) -{ - QDialog::done(r); - close(); -} - - -void Peers::remove_enrollee_uuid(QString uuid) -{ - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_uuid, uuid); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item = model.itemFromIndex(lst[i]); - if (item == NULL) - continue; - int type = item->data(peer_role_type).toInt(); - if (type == PEER_TYPE_WPS_ER_ENROLLEE || - type == PEER_TYPE_WPS_ENROLLEE) - model.removeRow(lst[i].row()); - } -} - - -void Peers::properties() -{ - if (ctx_item == NULL) - return; - - QMessageBox msg(this); - msg.setStandardButtons(QMessageBox::Ok); - msg.setDefaultButton(QMessageBox::Ok); - msg.setEscapeButton(QMessageBox::Ok); - msg.setWindowTitle(tr("Peer Properties")); - - int type = ctx_item->data(peer_role_type).toInt(); - QString title = Peers::ItemType(type); - - msg.setText(title + QString("\n") + tr("Name: ") + ctx_item->text()); - - QVariant var; - QString info; - - var = ctx_item->data(peer_role_address); - if (var.isValid()) - info += tr("Address: ") + var.toString() + QString("\n"); - - var = ctx_item->data(peer_role_uuid); - if (var.isValid()) - info += tr("UUID: ") + var.toString() + QString("\n"); - - var = ctx_item->data(peer_role_pri_dev_type); - if (var.isValid()) - info += tr("Primary Device Type: ") + var.toString() + - QString("\n"); - - var = ctx_item->data(peer_role_ssid); - if (var.isValid()) - info += tr("SSID: ") + var.toString() + QString("\n"); - - var = ctx_item->data(peer_role_config_methods); - if (var.isValid()) { - int methods = var.toInt(); - info += tr("Configuration Methods: "); - if (methods & 0x0001) - info += tr("[USBA]"); - if (methods & 0x0002) - info += tr("[Ethernet]"); - if (methods & 0x0004) - info += tr("[Label]"); - if (methods & 0x0008) - info += tr("[Display]"); - if (methods & 0x0010) - info += tr("[Ext. NFC Token]"); - if (methods & 0x0020) - info += tr("[Int. NFC Token]"); - if (methods & 0x0040) - info += tr("[NFC Interface]"); - if (methods & 0x0080) - info += tr("[Push Button]"); - if (methods & 0x0100) - info += tr("[Keypad]"); - info += "\n"; - } - - var = ctx_item->data(peer_role_selected_method); - if (var.isValid()) { - enum selected_method method = - (enum selected_method) var.toInt(); - switch (method) { - case SEL_METHOD_NONE: - break; - case SEL_METHOD_PIN_PEER_DISPLAY: - info += tr("Selected Method: PIN on peer display\n"); - break; - case SEL_METHOD_PIN_LOCAL_DISPLAY: - info += tr("Selected Method: PIN on local display\n"); - break; - } - } - - var = ctx_item->data(peer_role_selected_pin); - if (var.isValid()) { - info += tr("PIN to enter on peer: ") + var.toString() + "\n"; - } - - var = ctx_item->data(peer_role_dev_passwd_id); - if (var.isValid()) { - info += tr("Device Password ID: ") + var.toString(); - switch (var.toInt()) { - case 0: - info += tr(" (Default PIN)"); - break; - case 1: - info += tr(" (User-specified PIN)"); - break; - case 2: - info += tr(" (Machine-specified PIN)"); - break; - case 3: - info += tr(" (Rekey)"); - break; - case 4: - info += tr(" (Push Button)"); - break; - case 5: - info += tr(" (Registrar-specified)"); - break; - } - info += "\n"; - } - - msg.setInformativeText(info); - - var = ctx_item->data(peer_role_details); - if (var.isValid()) - msg.setDetailedText(var.toString()); - - msg.exec(); -} - - -void Peers::connect_pbc() -{ - if (ctx_item == NULL) - return; - - char cmd[100]; - char reply[100]; - size_t reply_len; - - int peer_type = ctx_item->data(peer_role_type).toInt(); - if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { - snprintf(cmd, sizeof(cmd), "WPS_ER_PBC %s", - ctx_item->data(peer_role_uuid).toString().toAscii(). - constData()); - } else if (peer_type == PEER_TYPE_P2P || - peer_type == PEER_TYPE_P2P_CLIENT) { - snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pbc", - ctx_item->data(peer_role_address).toString(). - toAscii().constData()); - } else { - snprintf(cmd, sizeof(cmd), "WPS_PBC"); - } - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to start WPS PBC.")); - msg.exec(); - } -} - - -void Peers::learn_ap_config() -{ - if (ctx_item == NULL) - return; - - QString uuid = ctx_item->data(peer_role_uuid).toString(); - - StringQuery input(tr("AP PIN:")); - input.setWindowTitle(tr("AP PIN for ") + ctx_item->text()); - if (input.exec() != QDialog::Accepted) - return; - - char cmd[100]; - char reply[100]; - size_t reply_len; - - snprintf(cmd, sizeof(cmd), "WPS_ER_LEARN %s %s", - uuid.toAscii().constData(), - input.get_string().toAscii().constData()); - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to start learning AP configuration.")); - msg.exec(); - } -} - - -void Peers::ctx_hide_ap() -{ - hide_ap = true; - - if (model.rowCount() == 0) - return; - - do { - QModelIndexList lst; - lst = model.match(model.index(0, 0), - peer_role_type, PEER_TYPE_AP); - if (lst.size() == 0) { - lst = model.match(model.index(0, 0), - peer_role_type, PEER_TYPE_AP_WPS); - if (lst.size() == 0) - break; - } - - model.removeRow(lst[0].row()); - } while (1); -} - - -void Peers::ctx_show_ap() -{ - hide_ap = false; - add_scan_results(); -} - - -void Peers::ctx_p2p_show_passphrase() -{ - char reply[64]; - size_t reply_len; - - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest("P2P_GET_PASSPHRASE", reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText("Failed to get P2P group passphrase."); - msg.exec(); - } else { - reply[reply_len] = '\0'; - QMessageBox::information(this, tr("Passphrase"), - tr("P2P group passphrase:\n") + - reply); - } -} - - -void Peers::ctx_p2p_start_persistent() -{ - if (ctx_item == NULL) - return; - - char cmd[100]; - char reply[100]; - size_t reply_len; - - snprintf(cmd, sizeof(cmd), "P2P_GROUP_ADD persistent=%d", - ctx_item->data(peer_role_network_id).toInt()); - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to start persistent P2P Group.")); - msg.exec(); - } else if (ctx_item->data(peer_role_type).toInt() == - PEER_TYPE_P2P_INVITATION) - model.removeRow(ctx_item->row()); -} - - -void Peers::ctx_p2p_invite() -{ - if (ctx_item == NULL) - return; - - char cmd[100]; - char reply[100]; - size_t reply_len; - - snprintf(cmd, sizeof(cmd), "P2P_INVITE persistent=%d", - ctx_item->data(peer_role_network_id).toInt()); - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0 || - memcmp(reply, "FAIL", 4) == 0) { - QMessageBox msg; - msg.setIcon(QMessageBox::Warning); - msg.setText(tr("Failed to invite peer to start persistent " - "P2P Group.")); - msg.exec(); - } -} - - -void Peers::ctx_p2p_delete() -{ - if (ctx_item == NULL) - return; - model.removeRow(ctx_item->row()); -} - - -void Peers::enable_persistent(int id) -{ - if (model.rowCount() == 0) - return; - - QModelIndexList lst = model.match(model.index(0, 0), - peer_role_network_id, id); - for (int i = 0; i < lst.size(); i++) { - QStandardItem *item = model.itemFromIndex(lst[i]); - int type = item->data(peer_role_type).toInt(); - if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || - type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT) - item->setBackground(Qt::NoBrush); - } -} +/* + * wpa_gui - Peers class + * Copyright (c) 2009-2010, Atheros Communications + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include +#include +#include + +#include "common/wpa_ctrl.h" +#include "wpagui.h" +#include "stringquery.h" +#include "peers.h" + + +enum { + peer_role_address = Qt::UserRole + 1, + peer_role_type, + peer_role_uuid, + peer_role_details, + peer_role_ifname, + peer_role_pri_dev_type, + peer_role_ssid, + peer_role_config_methods, + peer_role_dev_passwd_id, + peer_role_bss_id, + peer_role_selected_method, + peer_role_selected_pin, + peer_role_requested_method, + peer_role_network_id +}; + +enum selected_method { + SEL_METHOD_NONE, + SEL_METHOD_PIN_PEER_DISPLAY, + SEL_METHOD_PIN_LOCAL_DISPLAY +}; + +/* + * TODO: + * - add current AP info (e.g., from WPS) in station mode + */ + +enum peer_type { + PEER_TYPE_ASSOCIATED_STATION, + PEER_TYPE_AP, + PEER_TYPE_AP_WPS, + PEER_TYPE_WPS_PIN_NEEDED, + PEER_TYPE_P2P, + PEER_TYPE_P2P_CLIENT, + PEER_TYPE_P2P_GROUP, + PEER_TYPE_P2P_PERSISTENT_GROUP_GO, + PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT, + PEER_TYPE_P2P_INVITATION, + PEER_TYPE_WPS_ER_AP, + PEER_TYPE_WPS_ER_AP_UNCONFIGURED, + PEER_TYPE_WPS_ER_ENROLLEE, + PEER_TYPE_WPS_ENROLLEE +}; + + +Peers::Peers(QWidget *parent, const char *, bool, Qt::WFlags) + : QDialog(parent) +{ + setupUi(this); + + if (QImageReader::supportedImageFormats().contains(QByteArray("svg"))) + { + default_icon = new QIcon(":/icons/wpa_gui.svg"); + ap_icon = new QIcon(":/icons/ap.svg"); + laptop_icon = new QIcon(":/icons/laptop.svg"); + group_icon = new QIcon(":/icons/group.svg"); + invitation_icon = new QIcon(":/icons/invitation.svg"); + } else { + default_icon = new QIcon(":/icons/wpa_gui.png"); + ap_icon = new QIcon(":/icons/ap.png"); + laptop_icon = new QIcon(":/icons/laptop.png"); + group_icon = new QIcon(":/icons/group.png"); + invitation_icon = new QIcon(":/icons/invitation.png"); + } + + peers->setModel(&model); + peers->setResizeMode(QListView::Adjust); + peers->setDragEnabled(false); + peers->setSelectionMode(QAbstractItemView::NoSelection); + + peers->setContextMenuPolicy(Qt::CustomContextMenu); + connect(peers, SIGNAL(customContextMenuRequested(const QPoint &)), + this, SLOT(context_menu(const QPoint &))); + + wpagui = NULL; + hide_ap = false; +} + + +void Peers::setWpaGui(WpaGui *_wpagui) +{ + wpagui = _wpagui; + update_peers(); +} + + +Peers::~Peers() +{ + delete default_icon; + delete ap_icon; + delete laptop_icon; + delete group_icon; + delete invitation_icon; +} + + +void Peers::languageChange() +{ + retranslateUi(this); +} + + +QString Peers::ItemType(int type) +{ + QString title; + switch (type) { + case PEER_TYPE_ASSOCIATED_STATION: + title = tr("Associated station"); + break; + case PEER_TYPE_AP: + title = tr("AP"); + break; + case PEER_TYPE_AP_WPS: + title = tr("WPS AP"); + break; + case PEER_TYPE_WPS_PIN_NEEDED: + title = tr("WPS PIN needed"); + break; + case PEER_TYPE_P2P: + title = tr("P2P Device"); + break; + case PEER_TYPE_P2P_CLIENT: + title = tr("P2P Device (group client)"); + break; + case PEER_TYPE_P2P_GROUP: + title = tr("P2P Group"); + break; + case PEER_TYPE_P2P_PERSISTENT_GROUP_GO: + title = tr("P2P Persistent Group (GO)"); + break; + case PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT: + title = tr("P2P Persistent Group (client)"); + break; + case PEER_TYPE_P2P_INVITATION: + title = tr("P2P Invitation"); + break; + case PEER_TYPE_WPS_ER_AP: + title = tr("ER: WPS AP"); + break; + case PEER_TYPE_WPS_ER_AP_UNCONFIGURED: + title = tr("ER: WPS AP (Unconfigured)"); + break; + case PEER_TYPE_WPS_ER_ENROLLEE: + title = tr("ER: WPS Enrollee"); + break; + case PEER_TYPE_WPS_ENROLLEE: + title = tr("WPS Enrollee"); + break; + } + return title; +} + + +void Peers::context_menu(const QPoint &pos) +{ + QMenu *menu = new QMenu; + if (menu == NULL) + return; + + QModelIndex idx = peers->indexAt(pos); + if (idx.isValid()) { + ctx_item = model.itemFromIndex(idx); + int type = ctx_item->data(peer_role_type).toInt(); + menu->addAction(Peers::ItemType(type))->setEnabled(false); + menu->addSeparator(); + + int config_methods = -1; + QVariant var = ctx_item->data(peer_role_config_methods); + if (var.isValid()) + config_methods = var.toInt(); + + enum selected_method method = SEL_METHOD_NONE; + var = ctx_item->data(peer_role_selected_method); + if (var.isValid()) + method = (enum selected_method) var.toInt(); + + if ((type == PEER_TYPE_ASSOCIATED_STATION || + type == PEER_TYPE_AP_WPS || + type == PEER_TYPE_WPS_PIN_NEEDED || + type == PEER_TYPE_WPS_ER_ENROLLEE || + type == PEER_TYPE_WPS_ENROLLEE) && + (config_methods == -1 || (config_methods & 0x010c))) { + menu->addAction(tr("Enter WPS PIN"), this, + SLOT(enter_pin())); + } + + if (type == PEER_TYPE_P2P || type == PEER_TYPE_P2P_CLIENT) { + menu->addAction(tr("P2P Connect"), this, + SLOT(ctx_p2p_connect())); + if (method == SEL_METHOD_NONE && + config_methods > -1 && + config_methods & 0x0080 /* PBC */ && + config_methods != 0x0080) + menu->addAction(tr("P2P Connect (PBC)"), this, + SLOT(connect_pbc())); + if (method == SEL_METHOD_NONE) { + menu->addAction(tr("P2P Request PIN"), this, + SLOT(ctx_p2p_req_pin())); + menu->addAction(tr("P2P Show PIN"), this, + SLOT(ctx_p2p_show_pin())); + } + + if (config_methods > -1 && (config_methods & 0x0100)) { + /* Peer has Keypad */ + menu->addAction(tr("P2P Display PIN"), this, + SLOT(ctx_p2p_display_pin())); + } + + if (config_methods > -1 && (config_methods & 0x000c)) { + /* Peer has Label or Display */ + menu->addAction(tr("P2P Enter PIN"), this, + SLOT(ctx_p2p_enter_pin())); + } + } + + if (type == PEER_TYPE_P2P_GROUP) { + menu->addAction(tr("Show passphrase"), this, + SLOT(ctx_p2p_show_passphrase())); + menu->addAction(tr("Remove P2P Group"), this, + SLOT(ctx_p2p_remove_group())); + } + + if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || + type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT || + type == PEER_TYPE_P2P_INVITATION) { + menu->addAction(tr("Start group"), this, + SLOT(ctx_p2p_start_persistent())); + } + + if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || + type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT) { + menu->addAction(tr("Invite"), this, + SLOT(ctx_p2p_invite())); + } + + if (type == PEER_TYPE_P2P_INVITATION) { + menu->addAction(tr("Ignore"), this, + SLOT(ctx_p2p_delete())); + } + + if (type == PEER_TYPE_AP_WPS) { + menu->addAction(tr("Connect (PBC)"), this, + SLOT(connect_pbc())); + } + + if ((type == PEER_TYPE_ASSOCIATED_STATION || + type == PEER_TYPE_WPS_ER_ENROLLEE || + type == PEER_TYPE_WPS_ENROLLEE) && + config_methods >= 0 && (config_methods & 0x0080)) { + menu->addAction(tr("Enroll (PBC)"), this, + SLOT(connect_pbc())); + } + + if (type == PEER_TYPE_WPS_ER_AP) { + menu->addAction(tr("Learn Configuration"), this, + SLOT(learn_ap_config())); + } + + menu->addAction(tr("Properties"), this, SLOT(properties())); + } else { + ctx_item = NULL; + menu->addAction(QString(tr("Refresh")), this, + SLOT(ctx_refresh())); + menu->addAction(tr("Start P2P discovery"), this, + SLOT(ctx_p2p_start())); + menu->addAction(tr("Stop P2P discovery"), this, + SLOT(ctx_p2p_stop())); + menu->addAction(tr("P2P listen only"), this, + SLOT(ctx_p2p_listen())); + menu->addAction(tr("Start P2P group"), this, + SLOT(ctx_p2p_start_group())); + if (hide_ap) + menu->addAction(tr("Show AP entries"), this, + SLOT(ctx_show_ap())); + else + menu->addAction(tr("Hide AP entries"), this, + SLOT(ctx_hide_ap())); + } + + menu->exec(peers->mapToGlobal(pos)); +} + + +void Peers::enter_pin() +{ + if (ctx_item == NULL) + return; + + int peer_type = ctx_item->data(peer_role_type).toInt(); + QString uuid; + QString addr; + addr = ctx_item->data(peer_role_address).toString(); + if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) + uuid = ctx_item->data(peer_role_uuid).toString(); + + StringQuery input(tr("PIN:")); + input.setWindowTitle(tr("PIN for ") + ctx_item->text()); + if (input.exec() != QDialog::Accepted) + return; + + char cmd[100]; + char reply[100]; + size_t reply_len; + + if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { + snprintf(cmd, sizeof(cmd), "WPS_ER_PIN %s %s %s", + uuid.toAscii().constData(), + input.get_string().toAscii().constData(), + addr.toAscii().constData()); + } else { + snprintf(cmd, sizeof(cmd), "WPS_PIN %s %s", + addr.toAscii().constData(), + input.get_string().toAscii().constData()); + } + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to set the WPS PIN.")); + msg.exec(); + } +} + + +void Peers::ctx_refresh() +{ + update_peers(); +} + + +void Peers::ctx_p2p_start() +{ + char reply[20]; + size_t reply_len; + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("P2P_FIND", reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to start P2P discovery."); + msg.exec(); + } +} + + +void Peers::ctx_p2p_stop() +{ + char reply[20]; + size_t reply_len; + reply_len = sizeof(reply) - 1; + wpagui->ctrlRequest("P2P_STOP_FIND", reply, &reply_len); +} + + +void Peers::ctx_p2p_listen() +{ + char reply[20]; + size_t reply_len; + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("P2P_LISTEN 3600", reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to start P2P listen."); + msg.exec(); + } +} + + +void Peers::ctx_p2p_start_group() +{ + char reply[20]; + size_t reply_len; + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("P2P_GROUP_ADD", reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to start P2P group."); + msg.exec(); + } +} + + +void Peers::add_station(QString info) +{ + QStringList lines = info.split(QRegExp("\\n")); + QString name; + + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + int pos = (*it).indexOf('=') + 1; + if (pos < 1) + continue; + + if ((*it).startsWith("wpsDeviceName=")) + name = (*it).mid(pos); + else if ((*it).startsWith("p2p_device_name=")) + name = (*it).mid(pos); + } + + if (name.isEmpty()) + name = lines[0]; + + QStandardItem *item = new QStandardItem(*laptop_icon, name); + if (item) { + /* Remove WPS enrollee entry if one is still pending */ + if (model.rowCount() > 0) { + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_address, + lines[0]); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item; + item = model.itemFromIndex(lst[i]); + if (item == NULL) + continue; + int type = item->data(peer_role_type).toInt(); + if (type == PEER_TYPE_WPS_ENROLLEE) { + model.removeRow(lst[i].row()); + break; + } + } + } + + item->setData(lines[0], peer_role_address); + item->setData(PEER_TYPE_ASSOCIATED_STATION, + peer_role_type); + item->setData(info, peer_role_details); + item->setToolTip(ItemType(PEER_TYPE_ASSOCIATED_STATION)); + model.appendRow(item); + } +} + + +void Peers::add_stations() +{ + char reply[2048]; + size_t reply_len; + char cmd[30]; + int res; + + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("STA-FIRST", reply, &reply_len) < 0) + return; + + do { + reply[reply_len] = '\0'; + QString info(reply); + char *txt = reply; + while (*txt != '\0' && *txt != '\n') + txt++; + *txt++ = '\0'; + if (strncmp(reply, "FAIL", 4) == 0 || + strncmp(reply, "UNKNOWN", 7) == 0) + break; + + add_station(info); + + reply_len = sizeof(reply) - 1; + snprintf(cmd, sizeof(cmd), "STA-NEXT %s", reply); + res = wpagui->ctrlRequest(cmd, reply, &reply_len); + } while (res >= 0); +} + + +void Peers::add_single_station(const char *addr) +{ + char reply[2048]; + size_t reply_len; + char cmd[30]; + + reply_len = sizeof(reply) - 1; + snprintf(cmd, sizeof(cmd), "STA %s", addr); + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) + return; + + reply[reply_len] = '\0'; + QString info(reply); + char *txt = reply; + while (*txt != '\0' && *txt != '\n') + txt++; + *txt++ = '\0'; + if (strncmp(reply, "FAIL", 4) == 0 || + strncmp(reply, "UNKNOWN", 7) == 0) + return; + + add_station(info); +} + + +void Peers::add_p2p_group_client(QStandardItem * /*parent*/, QString params) +{ + /* + * dev=02:b5:64:63:30:63 iface=02:b5:64:63:30:63 dev_capab=0x0 + * dev_type=1-0050f204-1 dev_name='Wireless Client' + * config_methods=0x8c + */ + + QStringList items = + params.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)")); + QString addr = ""; + QString name = ""; + int config_methods = 0; + QString dev_type; + + for (int i = 0; i < items.size(); i++) { + QString str = items.at(i); + int pos = str.indexOf('=') + 1; + if (str.startsWith("dev_name='")) + name = str.section('\'', 1, -2); + else if (str.startsWith("config_methods=")) + config_methods = + str.section('=', 1).toInt(0, 0); + else if (str.startsWith("dev=")) + addr = str.mid(pos); + else if (str.startsWith("dev_type=") && dev_type.isEmpty()) + dev_type = str.mid(pos); + } + + QStandardItem *item = find_addr(addr); + if (item) + return; + + item = new QStandardItem(*default_icon, name); + if (item) { + /* TODO: indicate somehow the relationship to the group owner + * (parent) */ + item->setData(addr, peer_role_address); + item->setData(config_methods, peer_role_config_methods); + item->setData(PEER_TYPE_P2P_CLIENT, peer_role_type); + if (!dev_type.isEmpty()) + item->setData(dev_type, peer_role_pri_dev_type); + item->setData(items.join(QString("\n")), peer_role_details); + item->setToolTip(ItemType(PEER_TYPE_P2P_CLIENT)); + model.appendRow(item); + } +} + + +void Peers::remove_bss(int id) +{ + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), peer_role_bss_id, + id); + if (lst.size() == 0) + return; + model.removeRow(lst[0].row()); +} + + +bool Peers::add_bss(const char *cmd) +{ + char reply[2048]; + size_t reply_len; + + if (hide_ap) + return false; + + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) + return false; + reply[reply_len] = '\0'; + + QString bss(reply); + if (bss.isEmpty() || bss.startsWith("FAIL")) + return false; + + QString ssid, bssid, flags, wps_name, pri_dev_type; + int id = -1; + + QStringList lines = bss.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + int pos = (*it).indexOf('=') + 1; + if (pos < 1) + continue; + + if ((*it).startsWith("bssid=")) + bssid = (*it).mid(pos); + else if ((*it).startsWith("id=")) + id = (*it).mid(pos).toInt(); + else if ((*it).startsWith("flags=")) + flags = (*it).mid(pos); + else if ((*it).startsWith("ssid=")) + ssid = (*it).mid(pos); + else if ((*it).startsWith("wps_device_name=")) + wps_name = (*it).mid(pos); + else if ((*it).startsWith("wps_primary_device_type=")) + pri_dev_type = (*it).mid(pos); + } + + QString name = wps_name; + if (name.isEmpty()) + name = ssid + "\n" + bssid; + + QStandardItem *item = new QStandardItem(*ap_icon, name); + if (item) { + item->setData(bssid, peer_role_address); + if (id >= 0) + item->setData(id, peer_role_bss_id); + int type; + if (flags.contains("[WPS")) + type = PEER_TYPE_AP_WPS; + else + type = PEER_TYPE_AP; + item->setData(type, peer_role_type); + + for (int i = 0; i < lines.size(); i++) { + if (lines[i].length() > 60) { + lines[i].remove(60, lines[i].length()); + lines[i] += ".."; + } + } + item->setToolTip(ItemType(type)); + item->setData(lines.join("\n"), peer_role_details); + if (!pri_dev_type.isEmpty()) + item->setData(pri_dev_type, + peer_role_pri_dev_type); + if (!ssid.isEmpty()) + item->setData(ssid, peer_role_ssid); + model.appendRow(item); + + lines = bss.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + if ((*it).startsWith("p2p_group_client:")) + add_p2p_group_client(item, + (*it).mid(18)); + } + } + + return true; +} + + +void Peers::add_scan_results() +{ + int index; + char cmd[20]; + + index = 0; + while (wpagui) { + snprintf(cmd, sizeof(cmd), "BSS %d", index++); + if (index > 1000) + break; + + if (!add_bss(cmd)) + break; + } +} + + +void Peers::add_persistent(int id, const char *ssid, const char *bssid) +{ + char cmd[100]; + char reply[100]; + size_t reply_len; + int mode; + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d mode", id); + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) + return; + reply[reply_len] = '\0'; + mode = atoi(reply); + + QString name = ssid; + name = '[' + name + ']'; + + QStandardItem *item = new QStandardItem(*group_icon, name); + if (!item) + return; + + int type; + if (mode == 3) + type = PEER_TYPE_P2P_PERSISTENT_GROUP_GO; + else + type = PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT; + item->setData(type, peer_role_type); + item->setToolTip(ItemType(type)); + item->setData(ssid, peer_role_ssid); + if (bssid && strcmp(bssid, "any") == 0) + bssid = NULL; + if (bssid) + item->setData(bssid, peer_role_address); + item->setData(id, peer_role_network_id); + item->setBackground(Qt::BDiagPattern); + + model.appendRow(item); +} + + +void Peers::add_persistent_groups() +{ + char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; + size_t len; + + len = sizeof(buf) - 1; + if (wpagui->ctrlRequest("LIST_NETWORKS", buf, &len) < 0) + return; + + buf[len] = '\0'; + start = strchr(buf, '\n'); + if (start == NULL) + return; + start++; + + while (*start) { + bool last = false; + end = strchr(start, '\n'); + if (end == NULL) { + last = true; + end = start; + while (end[0] && end[1]) + end++; + } + *end = '\0'; + + id = start; + ssid = strchr(id, '\t'); + if (ssid == NULL) + break; + *ssid++ = '\0'; + bssid = strchr(ssid, '\t'); + if (bssid == NULL) + break; + *bssid++ = '\0'; + flags = strchr(bssid, '\t'); + if (flags == NULL) + break; + *flags++ = '\0'; + + if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) + add_persistent(atoi(id), ssid, bssid); + + if (last) + break; + start = end + 1; + } +} + + +void Peers::update_peers() +{ + model.clear(); + if (wpagui == NULL) + return; + + char reply[20]; + size_t replylen = sizeof(reply) - 1; + wpagui->ctrlRequest("WPS_ER_START", reply, &replylen); + + add_stations(); + add_scan_results(); + add_persistent_groups(); +} + + +QStandardItem * Peers::find_addr(QString addr) +{ + if (model.rowCount() == 0) + return NULL; + + QModelIndexList lst = model.match(model.index(0, 0), peer_role_address, + addr); + if (lst.size() == 0) + return NULL; + return model.itemFromIndex(lst[0]); +} + + +QStandardItem * Peers::find_addr_type(QString addr, int type) +{ + if (model.rowCount() == 0) + return NULL; + + QModelIndexList lst = model.match(model.index(0, 0), peer_role_address, + addr); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item = model.itemFromIndex(lst[i]); + if (item->data(peer_role_type).toInt() == type) + return item; + } + return NULL; +} + + +QStandardItem * Peers::find_uuid(QString uuid) +{ + if (model.rowCount() == 0) + return NULL; + + QModelIndexList lst = model.match(model.index(0, 0), peer_role_uuid, + uuid); + if (lst.size() == 0) + return NULL; + return model.itemFromIndex(lst[0]); +} + + +void Peers::event_notify(WpaMsg msg) +{ + QString text = msg.getMsg(); + + if (text.startsWith(WPS_EVENT_PIN_NEEDED)) { + /* + * WPS-PIN-NEEDED 5a02a5fa-9199-5e7c-bc46-e183d3cb32f7 + * 02:2a:c4:18:5b:f3 + * [Wireless Client|Company|cmodel|123|12345|1-0050F204-1] + */ + QStringList items = text.split(' '); + QString uuid = items[1]; + QString addr = items[2]; + QString name = ""; + + QStandardItem *item = find_addr(addr); + if (item) + return; + + int pos = text.indexOf('['); + if (pos >= 0) { + int pos2 = text.lastIndexOf(']'); + if (pos2 >= pos) { + items = text.mid(pos + 1, pos2 - pos - 1). + split('|'); + name = items[0]; + items.append(addr); + } + } + + item = new QStandardItem(*laptop_icon, name); + if (item) { + item->setData(addr, peer_role_address); + item->setData(PEER_TYPE_WPS_PIN_NEEDED, + peer_role_type); + item->setToolTip(ItemType(PEER_TYPE_WPS_PIN_NEEDED)); + item->setData(items.join("\n"), peer_role_details); + item->setData(items[5], peer_role_pri_dev_type); + model.appendRow(item); + } + return; + } + + if (text.startsWith(AP_STA_CONNECTED)) { + /* AP-STA-CONNECTED 02:2a:c4:18:5b:f3 */ + QStringList items = text.split(' '); + QString addr = items[1]; + QStandardItem *item = find_addr(addr); + if (item == NULL || item->data(peer_role_type).toInt() != + PEER_TYPE_ASSOCIATED_STATION) + add_single_station(addr.toAscii().constData()); + return; + } + + if (text.startsWith(AP_STA_DISCONNECTED)) { + /* AP-STA-DISCONNECTED 02:2a:c4:18:5b:f3 */ + QStringList items = text.split(' '); + QString addr = items[1]; + + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_address, addr, -1); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item = model.itemFromIndex(lst[i]); + if (item && item->data(peer_role_type).toInt() == + PEER_TYPE_ASSOCIATED_STATION) { + model.removeRow(lst[i].row()); + break; + } + } + return; + } + + if (text.startsWith(P2P_EVENT_DEVICE_FOUND)) { + /* + * P2P-DEVICE-FOUND 02:b5:64:63:30:63 + * p2p_dev_addr=02:b5:64:63:30:63 pri_dev_type=1-0050f204-1 + * name='Wireless Client' config_methods=0x84 dev_capab=0x21 + * group_capab=0x0 + */ + QStringList items = + text.split(QRegExp(" (?=[^']*('[^']*'[^']*)*$)")); + QString addr = items[1]; + QString name = ""; + QString pri_dev_type; + int config_methods = 0; + for (int i = 0; i < items.size(); i++) { + QString str = items.at(i); + if (str.startsWith("name='")) + name = str.section('\'', 1, -2); + else if (str.startsWith("config_methods=")) + config_methods = + str.section('=', 1).toInt(0, 0); + else if (str.startsWith("pri_dev_type=")) + pri_dev_type = str.section('=', 1); + } + + QStandardItem *item = find_addr(addr); + if (item) { + int type = item->data(peer_role_type).toInt(); + if (type == PEER_TYPE_P2P) + return; + } + + item = new QStandardItem(*default_icon, name); + if (item) { + item->setData(addr, peer_role_address); + item->setData(config_methods, + peer_role_config_methods); + item->setData(PEER_TYPE_P2P, peer_role_type); + if (!pri_dev_type.isEmpty()) + item->setData(pri_dev_type, + peer_role_pri_dev_type); + item->setData(items.join(QString("\n")), + peer_role_details); + item->setToolTip(ItemType(PEER_TYPE_P2P)); + model.appendRow(item); + } + + item = find_addr_type(addr, + PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT); + if (item) + item->setBackground(Qt::NoBrush); + } + + if (text.startsWith(P2P_EVENT_GROUP_STARTED)) { + /* P2P-GROUP-STARTED wlan0-p2p-0 GO ssid="DIRECT-3F" + * passphrase="YOyTkxID" go_dev_addr=02:40:61:c2:f3:b7 + * [PERSISTENT] */ + QStringList items = text.split(' '); + if (items.size() < 4) + return; + + int pos = text.indexOf(" ssid=\""); + if (pos < 0) + return; + QString ssid = text.mid(pos + 7); + pos = ssid.indexOf(" passphrase=\""); + if (pos < 0) + pos = ssid.indexOf(" psk="); + if (pos >= 0) + ssid.truncate(pos); + pos = ssid.lastIndexOf('"'); + if (pos >= 0) + ssid.truncate(pos); + + QStandardItem *item = new QStandardItem(*group_icon, ssid); + if (item) { + item->setData(PEER_TYPE_P2P_GROUP, peer_role_type); + item->setData(items[1], peer_role_ifname); + QString details; + if (items[2] == "GO") { + details = tr("P2P GO for interface ") + + items[1]; + } else { + details = tr("P2P client for interface ") + + items[1]; + } + if (text.contains(" [PERSISTENT]")) + details += "\nPersistent group"; + item->setData(details, peer_role_details); + item->setToolTip(ItemType(PEER_TYPE_P2P_GROUP)); + model.appendRow(item); + } + } + + if (text.startsWith(P2P_EVENT_GROUP_REMOVED)) { + /* P2P-GROUP-REMOVED wlan0-p2p-0 GO */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_ifname, items[1]); + for (int i = 0; i < lst.size(); i++) + model.removeRow(lst[i].row()); + return; + } + + if (text.startsWith(P2P_EVENT_PROV_DISC_SHOW_PIN)) { + /* P2P-PROV-DISC-SHOW-PIN 02:40:61:c2:f3:b7 12345670 */ + QStringList items = text.split(' '); + if (items.size() < 3) + return; + QString addr = items[1]; + QString pin = items[2]; + + QStandardItem *item = find_addr_type(addr, PEER_TYPE_P2P); + if (item == NULL) + return; + item->setData(SEL_METHOD_PIN_LOCAL_DISPLAY, + peer_role_selected_method); + item->setData(pin, peer_role_selected_pin); + QVariant var = item->data(peer_role_requested_method); + if (var.isValid() && + var.toInt() == SEL_METHOD_PIN_LOCAL_DISPLAY) { + ctx_item = item; + ctx_p2p_display_pin_pd(); + } + return; + } + + if (text.startsWith(P2P_EVENT_PROV_DISC_ENTER_PIN)) { + /* P2P-PROV-DISC-ENTER-PIN 02:40:61:c2:f3:b7 */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + QString addr = items[1]; + + QStandardItem *item = find_addr_type(addr, PEER_TYPE_P2P); + if (item == NULL) + return; + item->setData(SEL_METHOD_PIN_PEER_DISPLAY, + peer_role_selected_method); + QVariant var = item->data(peer_role_requested_method); + if (var.isValid() && + var.toInt() == SEL_METHOD_PIN_PEER_DISPLAY) { + ctx_item = item; + ctx_p2p_connect(); + } + return; + } + + if (text.startsWith(P2P_EVENT_INVITATION_RECEIVED)) { + /* P2P-INVITATION-RECEIVED sa=02:f0:bc:44:87:62 persistent=4 */ + QStringList items = text.split(' '); + if (items.size() < 3) + return; + if (!items[1].startsWith("sa=") || + !items[2].startsWith("persistent=")) + return; + QString addr = items[1].mid(3); + int id = items[2].mid(11).toInt(); + + char cmd[100]; + char reply[100]; + size_t reply_len; + + snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", id); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) + return; + reply[reply_len] = '\0'; + QString name; + char *pos = strrchr(reply, '"'); + if (pos && reply[0] == '"') { + *pos = '\0'; + name = reply + 1; + } else + name = reply; + + QStandardItem *item; + item = find_addr_type(addr, PEER_TYPE_P2P_INVITATION); + if (item) + model.removeRow(item->row()); + + item = new QStandardItem(*invitation_icon, name); + if (!item) + return; + item->setData(PEER_TYPE_P2P_INVITATION, peer_role_type); + item->setToolTip(ItemType(PEER_TYPE_P2P_INVITATION)); + item->setData(addr, peer_role_address); + item->setData(id, peer_role_network_id); + + model.appendRow(item); + + enable_persistent(id); + + return; + } + + if (text.startsWith(P2P_EVENT_INVITATION_RESULT)) { + /* P2P-INVITATION-RESULT status=1 */ + /* TODO */ + return; + } + + if (text.startsWith(WPS_EVENT_ER_AP_ADD)) { + /* + * WPS-ER-AP-ADD 87654321-9abc-def0-1234-56789abc0002 + * 02:11:22:33:44:55 pri_dev_type=6-0050F204-1 wps_state=1 + * |Very friendly name|Company|Long description of the model| + * WAP|http://w1.fi/|http://w1.fi/hostapd/ + */ + QStringList items = text.split(' '); + if (items.size() < 5) + return; + QString uuid = items[1]; + QString addr = items[2]; + QString pri_dev_type = items[3].mid(13); + int wps_state = items[4].mid(10).toInt(); + + int pos = text.indexOf('|'); + if (pos < 0) + return; + items = text.mid(pos + 1).split('|'); + if (items.size() < 1) + return; + + QStandardItem *item = find_uuid(uuid); + if (item) + return; + + item = new QStandardItem(*ap_icon, items[0]); + if (item) { + item->setData(uuid, peer_role_uuid); + item->setData(addr, peer_role_address); + int type = wps_state == 2 ? PEER_TYPE_WPS_ER_AP: + PEER_TYPE_WPS_ER_AP_UNCONFIGURED; + item->setData(type, peer_role_type); + item->setToolTip(ItemType(type)); + item->setData(pri_dev_type, peer_role_pri_dev_type); + item->setData(items.join(QString("\n")), + peer_role_details); + model.appendRow(item); + } + + return; + } + + if (text.startsWith(WPS_EVENT_ER_AP_REMOVE)) { + /* WPS-ER-AP-REMOVE 87654321-9abc-def0-1234-56789abc0002 */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_uuid, items[1]); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item = model.itemFromIndex(lst[i]); + if (item && + (item->data(peer_role_type).toInt() == + PEER_TYPE_WPS_ER_AP || + item->data(peer_role_type).toInt() == + PEER_TYPE_WPS_ER_AP_UNCONFIGURED)) + model.removeRow(lst[i].row()); + } + return; + } + + if (text.startsWith(WPS_EVENT_ER_ENROLLEE_ADD)) { + /* + * WPS-ER-ENROLLEE-ADD 2b7093f1-d6fb-5108-adbb-bea66bb87333 + * 02:66:a0:ee:17:27 M1=1 config_methods=0x14d dev_passwd_id=0 + * pri_dev_type=1-0050F204-1 + * |Wireless Client|Company|cmodel|123|12345| + */ + QStringList items = text.split(' '); + if (items.size() < 3) + return; + QString uuid = items[1]; + QString addr = items[2]; + QString pri_dev_type = items[6].mid(13); + int config_methods = -1; + int dev_passwd_id = -1; + + for (int i = 3; i < items.size(); i++) { + int pos = items[i].indexOf('=') + 1; + if (pos < 1) + continue; + QString val = items[i].mid(pos); + if (items[i].startsWith("config_methods=")) { + config_methods = val.toInt(0, 0); + } else if (items[i].startsWith("dev_passwd_id=")) { + dev_passwd_id = val.toInt(); + } + } + + int pos = text.indexOf('|'); + if (pos < 0) + return; + items = text.mid(pos + 1).split('|'); + if (items.size() < 1) + return; + QString name = items[0]; + if (name.length() == 0) + name = addr; + + remove_enrollee_uuid(uuid); + + QStandardItem *item; + item = new QStandardItem(*laptop_icon, name); + if (item) { + item->setData(uuid, peer_role_uuid); + item->setData(addr, peer_role_address); + item->setData(PEER_TYPE_WPS_ER_ENROLLEE, + peer_role_type); + item->setToolTip(ItemType(PEER_TYPE_WPS_ER_ENROLLEE)); + item->setData(items.join(QString("\n")), + peer_role_details); + item->setData(pri_dev_type, peer_role_pri_dev_type); + if (config_methods >= 0) + item->setData(config_methods, + peer_role_config_methods); + if (dev_passwd_id >= 0) + item->setData(dev_passwd_id, + peer_role_dev_passwd_id); + model.appendRow(item); + } + + return; + } + + if (text.startsWith(WPS_EVENT_ER_ENROLLEE_REMOVE)) { + /* + * WPS-ER-ENROLLEE-REMOVE 2b7093f1-d6fb-5108-adbb-bea66bb87333 + * 02:66:a0:ee:17:27 + */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + remove_enrollee_uuid(items[1]); + return; + } + + if (text.startsWith(WPS_EVENT_ENROLLEE_SEEN)) { + /* TODO: need to time out this somehow or remove on successful + * WPS run, etc. */ + /* + * WPS-ENROLLEE-SEEN 02:00:00:00:01:00 + * 572cf82f-c957-5653-9b16-b5cfb298abf1 1-0050F204-1 0x80 4 1 + * [Wireless Client] + * (MAC addr, UUID-E, pri dev type, config methods, + * dev passwd id, request type, [dev name]) + */ + QStringList items = text.split(' '); + if (items.size() < 7) + return; + QString addr = items[1]; + QString uuid = items[2]; + QString pri_dev_type = items[3]; + int config_methods = items[4].toInt(0, 0); + int dev_passwd_id = items[5].toInt(); + QString name; + + QStandardItem *item = find_addr(addr); + if (item) { + int type = item->data(peer_role_type).toInt(); + if (type == PEER_TYPE_ASSOCIATED_STATION) + return; /* already associated */ + } + + int pos = text.indexOf('['); + if (pos >= 0) { + int pos2 = text.lastIndexOf(']'); + if (pos2 >= pos) { + QStringList items2 = + text.mid(pos + 1, pos2 - pos - 1). + split('|'); + name = items2[0]; + } + } + if (name.isEmpty()) + name = addr; + + item = find_uuid(uuid); + if (item) { + QVariant var = item->data(peer_role_config_methods); + QVariant var2 = item->data(peer_role_dev_passwd_id); + if ((var.isValid() && config_methods != var.toInt()) || + (var2.isValid() && dev_passwd_id != var2.toInt())) + remove_enrollee_uuid(uuid); + else + return; + } + + item = new QStandardItem(*laptop_icon, name); + if (item) { + item->setData(uuid, peer_role_uuid); + item->setData(addr, peer_role_address); + item->setData(PEER_TYPE_WPS_ENROLLEE, + peer_role_type); + item->setToolTip(ItemType(PEER_TYPE_WPS_ENROLLEE)); + item->setData(items.join(QString("\n")), + peer_role_details); + item->setData(pri_dev_type, peer_role_pri_dev_type); + item->setData(config_methods, + peer_role_config_methods); + item->setData(dev_passwd_id, peer_role_dev_passwd_id); + model.appendRow(item); + } + + return; + } + + if (text.startsWith(WPA_EVENT_BSS_ADDED)) { + /* CTRL-EVENT-BSS-ADDED 34 00:11:22:33:44:55 */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + char cmd[20]; + snprintf(cmd, sizeof(cmd), "BSS ID-%d", items[1].toInt()); + add_bss(cmd); + return; + } + + if (text.startsWith(WPA_EVENT_BSS_REMOVED)) { + /* CTRL-EVENT-BSS-REMOVED 34 00:11:22:33:44:55 */ + QStringList items = text.split(' '); + if (items.size() < 2) + return; + remove_bss(items[1].toInt()); + return; + } +} + + +void Peers::ctx_p2p_connect() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + QString arg; + int config_methods = + ctx_item->data(peer_role_config_methods).toInt(); + enum selected_method method = SEL_METHOD_NONE; + QVariant var = ctx_item->data(peer_role_selected_method); + if (var.isValid()) + method = (enum selected_method) var.toInt(); + if (method == SEL_METHOD_PIN_LOCAL_DISPLAY) { + arg = ctx_item->data(peer_role_selected_pin).toString(); + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", + addr.toAscii().constData(), + arg.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to initiate P2P connect."); + msg.exec(); + return; + } + QMessageBox::information(this, + tr("PIN for ") + ctx_item->text(), + tr("Enter the following PIN on the\n" + "peer device: ") + arg); + } else if (method == SEL_METHOD_PIN_PEER_DISPLAY) { + StringQuery input(tr("PIN from peer display:")); + input.setWindowTitle(tr("PIN for ") + ctx_item->text()); + if (input.exec() != QDialog::Accepted) + return; + arg = input.get_string(); + } else if (config_methods == 0x0080 /* PBC */) { + arg = "pbc"; + } else { + StringQuery input(tr("PIN:")); + input.setWindowTitle(tr("PIN for ") + ctx_item->text()); + if (input.exec() != QDialog::Accepted) + return; + arg = input.get_string(); + } + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s", + addr.toAscii().constData(), + arg.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to initiate P2P connect."); + msg.exec(); + } +} + + +void Peers::ctx_p2p_req_pin() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + ctx_item->setData(SEL_METHOD_PIN_PEER_DISPLAY, + peer_role_requested_method); + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s display", + addr.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to request PIN from peer.")); + msg.exec(); + } +} + + +void Peers::ctx_p2p_show_pin() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + ctx_item->setData(SEL_METHOD_PIN_LOCAL_DISPLAY, + peer_role_requested_method); + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s keypad", + addr.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to request peer to enter PIN.")); + msg.exec(); + } +} + + +void Peers::ctx_p2p_display_pin() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pin", + addr.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to initiate P2P connect."); + msg.exec(); + return; + } + reply[reply_len] = '\0'; + QMessageBox::information(this, + tr("PIN for ") + ctx_item->text(), + tr("Enter the following PIN on the\n" + "peer device: ") + reply); +} + + +void Peers::ctx_p2p_display_pin_pd() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + QString arg = ctx_item->data(peer_role_selected_pin).toString(); + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", + addr.toAscii().constData(), + arg.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to initiate P2P connect."); + msg.exec(); + return; + } + reply[reply_len] = '\0'; + QMessageBox::information(this, + tr("PIN for ") + ctx_item->text(), + tr("Enter the following PIN on the\n" + "peer device: ") + arg); +} + + +void Peers::ctx_p2p_enter_pin() +{ + if (ctx_item == NULL) + return; + QString addr = ctx_item->data(peer_role_address).toString(); + QString arg; + + StringQuery input(tr("PIN from peer:")); + input.setWindowTitle(tr("PIN for ") + ctx_item->text()); + if (input.exec() != QDialog::Accepted) + return; + arg = input.get_string(); + + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s keypad", + addr.toAscii().constData(), + arg.toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to initiate P2P connect."); + msg.exec(); + } +} + + +void Peers::ctx_p2p_remove_group() +{ + if (ctx_item == NULL) + return; + char cmd[100]; + char reply[100]; + size_t reply_len; + snprintf(cmd, sizeof(cmd), "P2P_GROUP_REMOVE %s", + ctx_item->data(peer_role_ifname).toString().toAscii(). + constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to remove P2P Group."); + msg.exec(); + } +} + + +void Peers::closeEvent(QCloseEvent *) +{ + if (wpagui) { + char reply[20]; + size_t replylen = sizeof(reply) - 1; + wpagui->ctrlRequest("WPS_ER_STOP", reply, &replylen); + } +} + + +void Peers::done(int r) +{ + QDialog::done(r); + close(); +} + + +void Peers::remove_enrollee_uuid(QString uuid) +{ + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_uuid, uuid); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item = model.itemFromIndex(lst[i]); + if (item == NULL) + continue; + int type = item->data(peer_role_type).toInt(); + if (type == PEER_TYPE_WPS_ER_ENROLLEE || + type == PEER_TYPE_WPS_ENROLLEE) + model.removeRow(lst[i].row()); + } +} + + +void Peers::properties() +{ + if (ctx_item == NULL) + return; + + QMessageBox msg(this); + msg.setStandardButtons(QMessageBox::Ok); + msg.setDefaultButton(QMessageBox::Ok); + msg.setEscapeButton(QMessageBox::Ok); + msg.setWindowTitle(tr("Peer Properties")); + + int type = ctx_item->data(peer_role_type).toInt(); + QString title = Peers::ItemType(type); + + msg.setText(title + QString("\n") + tr("Name: ") + ctx_item->text()); + + QVariant var; + QString info; + + var = ctx_item->data(peer_role_address); + if (var.isValid()) + info += tr("Address: ") + var.toString() + QString("\n"); + + var = ctx_item->data(peer_role_uuid); + if (var.isValid()) + info += tr("UUID: ") + var.toString() + QString("\n"); + + var = ctx_item->data(peer_role_pri_dev_type); + if (var.isValid()) + info += tr("Primary Device Type: ") + var.toString() + + QString("\n"); + + var = ctx_item->data(peer_role_ssid); + if (var.isValid()) + info += tr("SSID: ") + var.toString() + QString("\n"); + + var = ctx_item->data(peer_role_config_methods); + if (var.isValid()) { + int methods = var.toInt(); + info += tr("Configuration Methods: "); + if (methods & 0x0001) + info += tr("[USBA]"); + if (methods & 0x0002) + info += tr("[Ethernet]"); + if (methods & 0x0004) + info += tr("[Label]"); + if (methods & 0x0008) + info += tr("[Display]"); + if (methods & 0x0010) + info += tr("[Ext. NFC Token]"); + if (methods & 0x0020) + info += tr("[Int. NFC Token]"); + if (methods & 0x0040) + info += tr("[NFC Interface]"); + if (methods & 0x0080) + info += tr("[Push Button]"); + if (methods & 0x0100) + info += tr("[Keypad]"); + info += "\n"; + } + + var = ctx_item->data(peer_role_selected_method); + if (var.isValid()) { + enum selected_method method = + (enum selected_method) var.toInt(); + switch (method) { + case SEL_METHOD_NONE: + break; + case SEL_METHOD_PIN_PEER_DISPLAY: + info += tr("Selected Method: PIN on peer display\n"); + break; + case SEL_METHOD_PIN_LOCAL_DISPLAY: + info += tr("Selected Method: PIN on local display\n"); + break; + } + } + + var = ctx_item->data(peer_role_selected_pin); + if (var.isValid()) { + info += tr("PIN to enter on peer: ") + var.toString() + "\n"; + } + + var = ctx_item->data(peer_role_dev_passwd_id); + if (var.isValid()) { + info += tr("Device Password ID: ") + var.toString(); + switch (var.toInt()) { + case 0: + info += tr(" (Default PIN)"); + break; + case 1: + info += tr(" (User-specified PIN)"); + break; + case 2: + info += tr(" (Machine-specified PIN)"); + break; + case 3: + info += tr(" (Rekey)"); + break; + case 4: + info += tr(" (Push Button)"); + break; + case 5: + info += tr(" (Registrar-specified)"); + break; + } + info += "\n"; + } + + msg.setInformativeText(info); + + var = ctx_item->data(peer_role_details); + if (var.isValid()) + msg.setDetailedText(var.toString()); + + msg.exec(); +} + + +void Peers::connect_pbc() +{ + if (ctx_item == NULL) + return; + + char cmd[100]; + char reply[100]; + size_t reply_len; + + int peer_type = ctx_item->data(peer_role_type).toInt(); + if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { + snprintf(cmd, sizeof(cmd), "WPS_ER_PBC %s", + ctx_item->data(peer_role_uuid).toString().toAscii(). + constData()); + } else if (peer_type == PEER_TYPE_P2P || + peer_type == PEER_TYPE_P2P_CLIENT) { + snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pbc", + ctx_item->data(peer_role_address).toString(). + toAscii().constData()); + } else { + snprintf(cmd, sizeof(cmd), "WPS_PBC"); + } + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to start WPS PBC.")); + msg.exec(); + } +} + + +void Peers::learn_ap_config() +{ + if (ctx_item == NULL) + return; + + QString uuid = ctx_item->data(peer_role_uuid).toString(); + + StringQuery input(tr("AP PIN:")); + input.setWindowTitle(tr("AP PIN for ") + ctx_item->text()); + if (input.exec() != QDialog::Accepted) + return; + + char cmd[100]; + char reply[100]; + size_t reply_len; + + snprintf(cmd, sizeof(cmd), "WPS_ER_LEARN %s %s", + uuid.toAscii().constData(), + input.get_string().toAscii().constData()); + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to start learning AP configuration.")); + msg.exec(); + } +} + + +void Peers::ctx_hide_ap() +{ + hide_ap = true; + + if (model.rowCount() == 0) + return; + + do { + QModelIndexList lst; + lst = model.match(model.index(0, 0), + peer_role_type, PEER_TYPE_AP); + if (lst.size() == 0) { + lst = model.match(model.index(0, 0), + peer_role_type, PEER_TYPE_AP_WPS); + if (lst.size() == 0) + break; + } + + model.removeRow(lst[0].row()); + } while (1); +} + + +void Peers::ctx_show_ap() +{ + hide_ap = false; + add_scan_results(); +} + + +void Peers::ctx_p2p_show_passphrase() +{ + char reply[64]; + size_t reply_len; + + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest("P2P_GET_PASSPHRASE", reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText("Failed to get P2P group passphrase."); + msg.exec(); + } else { + reply[reply_len] = '\0'; + QMessageBox::information(this, tr("Passphrase"), + tr("P2P group passphrase:\n") + + reply); + } +} + + +void Peers::ctx_p2p_start_persistent() +{ + if (ctx_item == NULL) + return; + + char cmd[100]; + char reply[100]; + size_t reply_len; + + snprintf(cmd, sizeof(cmd), "P2P_GROUP_ADD persistent=%d", + ctx_item->data(peer_role_network_id).toInt()); + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to start persistent P2P Group.")); + msg.exec(); + } else if (ctx_item->data(peer_role_type).toInt() == + PEER_TYPE_P2P_INVITATION) + model.removeRow(ctx_item->row()); +} + + +void Peers::ctx_p2p_invite() +{ + if (ctx_item == NULL) + return; + + char cmd[100]; + char reply[100]; + size_t reply_len; + + snprintf(cmd, sizeof(cmd), "P2P_INVITE persistent=%d", + ctx_item->data(peer_role_network_id).toInt()); + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0 || + memcmp(reply, "FAIL", 4) == 0) { + QMessageBox msg; + msg.setIcon(QMessageBox::Warning); + msg.setText(tr("Failed to invite peer to start persistent " + "P2P Group.")); + msg.exec(); + } +} + + +void Peers::ctx_p2p_delete() +{ + if (ctx_item == NULL) + return; + model.removeRow(ctx_item->row()); +} + + +void Peers::enable_persistent(int id) +{ + if (model.rowCount() == 0) + return; + + QModelIndexList lst = model.match(model.index(0, 0), + peer_role_network_id, id); + for (int i = 0; i < lst.size(); i++) { + QStandardItem *item = model.itemFromIndex(lst[i]); + int type = item->data(peer_role_type).toInt(); + if (type == PEER_TYPE_P2P_PERSISTENT_GROUP_GO || + type == PEER_TYPE_P2P_PERSISTENT_GROUP_CLIENT) + item->setBackground(Qt::NoBrush); + } +} diff --git a/Network/wpa_gui-qt4_/peers.h b/Network/wpa_gui-qt4_/peers.h index a715395..fbf0cea 100644 --- a/Network/wpa_gui-qt4_/peers.h +++ b/Network/wpa_gui-qt4_/peers.h @@ -1,96 +1,96 @@ -/* - * wpa_gui - Peers class - * Copyright (c) 2009-2010, Atheros Communications - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef PEERS_H -#define PEERS_H - -#include -#include -#include "wpamsg.h" -#include "ui_peers.h" - -class WpaGui; - -class Peers : public QDialog, public Ui::Peers -{ - Q_OBJECT - -public: - Peers(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); - ~Peers(); - void setWpaGui(WpaGui *_wpagui); - void event_notify(WpaMsg msg); - -public slots: - virtual void context_menu(const QPoint &pos); - virtual void enter_pin(); - virtual void connect_pbc(); - virtual void learn_ap_config(); - virtual void ctx_refresh(); - virtual void ctx_p2p_start(); - virtual void ctx_p2p_stop(); - virtual void ctx_p2p_listen(); - virtual void ctx_p2p_start_group(); - virtual void ctx_p2p_remove_group(); - virtual void ctx_p2p_connect(); - virtual void ctx_p2p_req_pin(); - virtual void ctx_p2p_show_pin(); - virtual void ctx_p2p_display_pin(); - virtual void ctx_p2p_display_pin_pd(); - virtual void ctx_p2p_enter_pin(); - virtual void properties(); - virtual void ctx_hide_ap(); - virtual void ctx_show_ap(); - virtual void ctx_p2p_show_passphrase(); - virtual void ctx_p2p_start_persistent(); - virtual void ctx_p2p_invite(); - virtual void ctx_p2p_delete(); - -protected slots: - virtual void languageChange(); - virtual void closeEvent(QCloseEvent *event); - -private: - void add_station(QString info); - void add_stations(); - void add_single_station(const char *addr); - bool add_bss(const char *cmd); - void remove_bss(int id); - void add_scan_results(); - void add_persistent(int id, const char *ssid, const char *bssid); - void add_persistent_groups(); - void update_peers(); - QStandardItem * find_addr(QString addr); - QStandardItem * find_addr_type(QString addr, int type); - void add_p2p_group_client(QStandardItem *parent, QString params); - QStandardItem * find_uuid(QString uuid); - void done(int r); - void remove_enrollee_uuid(QString uuid); - QString ItemType(int type); - void enable_persistent(int id); - - WpaGui *wpagui; - QStandardItemModel model; - QIcon *default_icon; - QIcon *ap_icon; - QIcon *laptop_icon; - QIcon *group_icon; - QIcon *invitation_icon; - QStandardItem *ctx_item; - - bool hide_ap; -}; - -#endif /* PEERS_H */ +/* + * wpa_gui - Peers class + * Copyright (c) 2009-2010, Atheros Communications + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef PEERS_H +#define PEERS_H + +#include +#include +#include "wpamsg.h" +#include "ui_peers.h" + +class WpaGui; + +class Peers : public QDialog, public Ui::Peers +{ + Q_OBJECT + +public: + Peers(QWidget *parent = 0, const char *name = 0, + bool modal = false, Qt::WFlags fl = 0); + ~Peers(); + void setWpaGui(WpaGui *_wpagui); + void event_notify(WpaMsg msg); + +public slots: + virtual void context_menu(const QPoint &pos); + virtual void enter_pin(); + virtual void connect_pbc(); + virtual void learn_ap_config(); + virtual void ctx_refresh(); + virtual void ctx_p2p_start(); + virtual void ctx_p2p_stop(); + virtual void ctx_p2p_listen(); + virtual void ctx_p2p_start_group(); + virtual void ctx_p2p_remove_group(); + virtual void ctx_p2p_connect(); + virtual void ctx_p2p_req_pin(); + virtual void ctx_p2p_show_pin(); + virtual void ctx_p2p_display_pin(); + virtual void ctx_p2p_display_pin_pd(); + virtual void ctx_p2p_enter_pin(); + virtual void properties(); + virtual void ctx_hide_ap(); + virtual void ctx_show_ap(); + virtual void ctx_p2p_show_passphrase(); + virtual void ctx_p2p_start_persistent(); + virtual void ctx_p2p_invite(); + virtual void ctx_p2p_delete(); + +protected slots: + virtual void languageChange(); + virtual void closeEvent(QCloseEvent *event); + +private: + void add_station(QString info); + void add_stations(); + void add_single_station(const char *addr); + bool add_bss(const char *cmd); + void remove_bss(int id); + void add_scan_results(); + void add_persistent(int id, const char *ssid, const char *bssid); + void add_persistent_groups(); + void update_peers(); + QStandardItem * find_addr(QString addr); + QStandardItem * find_addr_type(QString addr, int type); + void add_p2p_group_client(QStandardItem *parent, QString params); + QStandardItem * find_uuid(QString uuid); + void done(int r); + void remove_enrollee_uuid(QString uuid); + QString ItemType(int type); + void enable_persistent(int id); + + WpaGui *wpagui; + QStandardItemModel model; + QIcon *default_icon; + QIcon *ap_icon; + QIcon *laptop_icon; + QIcon *group_icon; + QIcon *invitation_icon; + QStandardItem *ctx_item; + + bool hide_ap; +}; + +#endif /* PEERS_H */ diff --git a/Network/wpa_gui-qt4_/peers.ui b/Network/wpa_gui-qt4_/peers.ui index 9508c25..1acaa46 100644 --- a/Network/wpa_gui-qt4_/peers.ui +++ b/Network/wpa_gui-qt4_/peers.ui @@ -1,40 +1,40 @@ - - - Peers - - - - 0 - 0 - 400 - 300 - - - - Peers - - - - - - - 0 - 0 - - - - true - - - QAbstractItemView::NoEditTriggers - - - QListView::IconMode - - - - - - - - + + + Peers + + + + 0 + 0 + 400 + 300 + + + + Peers + + + + + + + 0 + 0 + + + + true + + + QAbstractItemView::NoEditTriggers + + + QListView::IconMode + + + + + + + + diff --git a/Network/wpa_gui-qt4_/scanresults.cpp b/Network/wpa_gui-qt4_/scanresults.cpp index 459aa8c..de0c9af 100644 --- a/Network/wpa_gui-qt4_/scanresults.cpp +++ b/Network/wpa_gui-qt4_/scanresults.cpp @@ -1,144 +1,144 @@ -/* - * wpa_gui - ScanResults class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include - -#include "scanresults.h" -#include "wpagui.h" -#include "networkconfig.h" - - -ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags) - : QDialog(parent) -{ - setupUi(this); - - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - connect(scanButton, SIGNAL(clicked()), this, SLOT(scanRequest())); - connect(scanResultsWidget, - SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, - SLOT(bssSelected(QTreeWidgetItem *))); - - wpagui = NULL; - scanResultsWidget->setItemsExpandable(FALSE); - scanResultsWidget->setRootIsDecorated(FALSE); -} - - -ScanResults::~ScanResults() -{ -} - - -void ScanResults::languageChange() -{ - retranslateUi(this); -} - - -void ScanResults::setWpaGui(WpaGui *_wpagui) -{ - wpagui = _wpagui; - updateResults(); -} - - -void ScanResults::updateResults() -{ - char reply[2048]; - size_t reply_len; - int index; - char cmd[20]; - - scanResultsWidget->clear(); - - index = 0; - while (wpagui) { - snprintf(cmd, sizeof(cmd), "BSS %d", index++); - if (index > 1000) - break; - - reply_len = sizeof(reply) - 1; - if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) - break; - reply[reply_len] = '\0'; - - QString bss(reply); - if (bss.isEmpty() || bss.startsWith("FAIL")) - break; - - QString ssid, bssid, freq, signal, flags; - - QStringList lines = bss.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - int pos = (*it).indexOf('=') + 1; - if (pos < 1) - continue; - - if ((*it).startsWith("bssid=")) - bssid = (*it).mid(pos); - else if ((*it).startsWith("freq=")) - freq = (*it).mid(pos); - else if ((*it).startsWith("qual=")) - signal = (*it).mid(pos); - else if ((*it).startsWith("flags=")) - flags = (*it).mid(pos); - else if ((*it).startsWith("ssid=")) - ssid = (*it).mid(pos); - } - - QTreeWidgetItem *item = new QTreeWidgetItem(scanResultsWidget); - if (item) { - item->setText(0, ssid); - item->setText(1, bssid); - item->setText(2, freq); - item->setText(3, signal); - item->setText(4, flags); - } - - if (bssid.isEmpty()) - break; - } -} - - -void ScanResults::scanRequest() -{ - char reply[10]; - size_t reply_len = sizeof(reply); - - if (wpagui == NULL) - return; - - wpagui->ctrlRequest("SCAN", reply, &reply_len); -} - - -void ScanResults::getResults() -{ - updateResults(); -} - - -void ScanResults::bssSelected(QTreeWidgetItem *sel) -{ - NetworkConfig *nc = new NetworkConfig(); - if (nc == NULL) - return; - nc->setWpaGui(wpagui); - nc->paramsFromScanResults(sel); - nc->show(); - nc->exec(); -} +/* + * wpa_gui - ScanResults class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include + +#include "scanresults.h" +#include "wpagui.h" +#include "networkconfig.h" + + +ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags) + : QDialog(parent) +{ + setupUi(this); + + connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(scanButton, SIGNAL(clicked()), this, SLOT(scanRequest())); + connect(scanResultsWidget, + SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, + SLOT(bssSelected(QTreeWidgetItem *))); + + wpagui = NULL; + scanResultsWidget->setItemsExpandable(FALSE); + scanResultsWidget->setRootIsDecorated(FALSE); +} + + +ScanResults::~ScanResults() +{ +} + + +void ScanResults::languageChange() +{ + retranslateUi(this); +} + + +void ScanResults::setWpaGui(WpaGui *_wpagui) +{ + wpagui = _wpagui; + updateResults(); +} + + +void ScanResults::updateResults() +{ + char reply[2048]; + size_t reply_len; + int index; + char cmd[20]; + + scanResultsWidget->clear(); + + index = 0; + while (wpagui) { + snprintf(cmd, sizeof(cmd), "BSS %d", index++); + if (index > 1000) + break; + + reply_len = sizeof(reply) - 1; + if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) + break; + reply[reply_len] = '\0'; + + QString bss(reply); + if (bss.isEmpty() || bss.startsWith("FAIL")) + break; + + QString ssid, bssid, freq, signal, flags; + + QStringList lines = bss.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + int pos = (*it).indexOf('=') + 1; + if (pos < 1) + continue; + + if ((*it).startsWith("bssid=")) + bssid = (*it).mid(pos); + else if ((*it).startsWith("freq=")) + freq = (*it).mid(pos); + else if ((*it).startsWith("qual=")) + signal = (*it).mid(pos); + else if ((*it).startsWith("flags=")) + flags = (*it).mid(pos); + else if ((*it).startsWith("ssid=")) + ssid = (*it).mid(pos); + } + + QTreeWidgetItem *item = new QTreeWidgetItem(scanResultsWidget); + if (item) { + item->setText(0, ssid); + item->setText(1, bssid); + item->setText(2, freq); + item->setText(3, signal); + item->setText(4, flags); + } + + if (bssid.isEmpty()) + break; + } +} + + +void ScanResults::scanRequest() +{ + char reply[10]; + size_t reply_len = sizeof(reply); + + if (wpagui == NULL) + return; + + wpagui->ctrlRequest("SCAN", reply, &reply_len); +} + + +void ScanResults::getResults() +{ + updateResults(); +} + + +void ScanResults::bssSelected(QTreeWidgetItem *sel) +{ + NetworkConfig *nc = new NetworkConfig(); + if (nc == NULL) + return; + nc->setWpaGui(wpagui); + nc->paramsFromScanResults(sel); + nc->show(); + nc->exec(); +} diff --git a/Network/wpa_gui-qt4_/scanresults.h b/Network/wpa_gui-qt4_/scanresults.h index 2c4a1b0..a6ed1bb 100644 --- a/Network/wpa_gui-qt4_/scanresults.h +++ b/Network/wpa_gui-qt4_/scanresults.h @@ -1,46 +1,46 @@ -/* - * wpa_gui - ScanResults class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef SCANRESULTS_H -#define SCANRESULTS_H - -#include -#include "ui_scanresults.h" - -class WpaGui; - -class ScanResults : public QDialog, public Ui::ScanResults -{ - Q_OBJECT - -public: - ScanResults(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); - ~ScanResults(); - -public slots: - virtual void setWpaGui(WpaGui *_wpagui); - virtual void updateResults(); - virtual void scanRequest(); - virtual void getResults(); - virtual void bssSelected(QTreeWidgetItem *sel); - -protected slots: - virtual void languageChange(); - -private: - WpaGui *wpagui; -}; - -#endif /* SCANRESULTS_H */ +/* + * wpa_gui - ScanResults class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef SCANRESULTS_H +#define SCANRESULTS_H + +#include +#include "ui_scanresults.h" + +class WpaGui; + +class ScanResults : public QDialog, public Ui::ScanResults +{ + Q_OBJECT + +public: + ScanResults(QWidget *parent = 0, const char *name = 0, + bool modal = false, Qt::WFlags fl = 0); + ~ScanResults(); + +public slots: + virtual void setWpaGui(WpaGui *_wpagui); + virtual void updateResults(); + virtual void scanRequest(); + virtual void getResults(); + virtual void bssSelected(QTreeWidgetItem *sel); + +protected slots: + virtual void languageChange(); + +private: + WpaGui *wpagui; +}; + +#endif /* SCANRESULTS_H */ diff --git a/Network/wpa_gui-qt4_/scanresults.ui b/Network/wpa_gui-qt4_/scanresults.ui index 81e405e..39d728e 100644 --- a/Network/wpa_gui-qt4_/scanresults.ui +++ b/Network/wpa_gui-qt4_/scanresults.ui @@ -1,94 +1,94 @@ - - ScanResults - - - - 0 - 0 - 452 - 244 - - - - Scan results - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - true - - - 5 - - - - SSID - - - - - BSSID - - - - - frequency - - - - - signal - - - - - flags - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Scan - - - - - - - Close - - - - - - - - - - - - + + ScanResults + + + + 0 + 0 + 452 + 244 + + + + Scan results + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + true + + + 5 + + + + SSID + + + + + BSSID + + + + + frequency + + + + + signal + + + + + flags + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Scan + + + + + + + Close + + + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/stringquery.cpp b/Network/wpa_gui-qt4_/stringquery.cpp index 1ca98d9..f774c1f 100644 --- a/Network/wpa_gui-qt4_/stringquery.cpp +++ b/Network/wpa_gui-qt4_/stringquery.cpp @@ -1,37 +1,37 @@ -/* - * wpa_gui - StringQuery class - * Copyright (c) 2009, Atheros Communications - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include -#include - -#include "stringquery.h" - - -StringQuery::StringQuery(QString label) -{ - edit = new QLineEdit; - edit->setFocus(); - QGridLayout *layout = new QGridLayout; - layout->addWidget(new QLabel(label), 0, 0); - layout->addWidget(edit, 0, 1); - setLayout(layout); - - connect(edit, SIGNAL(returnPressed()), this, SLOT(accept())); -} - - -QString StringQuery::get_string() -{ - return edit->text(); -} +/* + * wpa_gui - StringQuery class + * Copyright (c) 2009, Atheros Communications + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include +#include + +#include "stringquery.h" + + +StringQuery::StringQuery(QString label) +{ + edit = new QLineEdit; + edit->setFocus(); + QGridLayout *layout = new QGridLayout; + layout->addWidget(new QLabel(label), 0, 0); + layout->addWidget(edit, 0, 1); + setLayout(layout); + + connect(edit, SIGNAL(returnPressed()), this, SLOT(accept())); +} + + +QString StringQuery::get_string() +{ + return edit->text(); +} diff --git a/Network/wpa_gui-qt4_/stringquery.h b/Network/wpa_gui-qt4_/stringquery.h index 1b68217..88116e1 100644 --- a/Network/wpa_gui-qt4_/stringquery.h +++ b/Network/wpa_gui-qt4_/stringquery.h @@ -1,34 +1,34 @@ -/* - * wpa_gui - StringQuery class - * Copyright (c) 2009, Atheros Communications - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef STRINGQUERY_H -#define STRINGQUERY_H - -#include -#include -#include - -class StringQuery : public QDialog -{ - Q_OBJECT - -public: - StringQuery(QString label); - QString get_string(); - -private: - QLineEdit *edit; -}; - -#endif /* STRINGQUERY_H */ +/* + * wpa_gui - StringQuery class + * Copyright (c) 2009, Atheros Communications + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef STRINGQUERY_H +#define STRINGQUERY_H + +#include +#include +#include + +class StringQuery : public QDialog +{ + Q_OBJECT + +public: + StringQuery(QString label); + QString get_string(); + +private: + QLineEdit *edit; +}; + +#endif /* STRINGQUERY_H */ diff --git a/Network/wpa_gui-qt4_/userdatarequest.cpp b/Network/wpa_gui-qt4_/userdatarequest.cpp index 345f965..3a79b61 100644 --- a/Network/wpa_gui-qt4_/userdatarequest.cpp +++ b/Network/wpa_gui-qt4_/userdatarequest.cpp @@ -1,100 +1,100 @@ -/* - * wpa_gui - UserDataRequest class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#include "userdatarequest.h" -#include "wpagui.h" -#include "common/wpa_ctrl.h" - - -UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool, - Qt::WFlags) - : QDialog(parent) -{ - setupUi(this); - - connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply())); -} - - -UserDataRequest::~UserDataRequest() -{ -} - - -void UserDataRequest::languageChange() -{ - retranslateUi(this); -} - - -int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg) -{ - char *tmp, *pos, *pos2; - wpagui = _wpagui; - tmp = strdup(reqMsg); - if (tmp == NULL) - return -1; - pos = strchr(tmp, '-'); - if (pos == NULL) { - free(tmp); - return -1; - } - *pos++ = '\0'; - field = tmp; - pos2 = strchr(pos, ':'); - if (pos2 == NULL) { - free(tmp); - return -1; - } - *pos2++ = '\0'; - - networkid = atoi(pos); - queryInfo->setText(pos2); - if (strcmp(tmp, "PASSWORD") == 0) { - queryField->setText(tr("Password: ")); - queryEdit->setEchoMode(QLineEdit::Password); - } else if (strcmp(tmp, "NEW_PASSWORD") == 0) { - queryField->setText(tr("New password: ")); - queryEdit->setEchoMode(QLineEdit::Password); - } else if (strcmp(tmp, "IDENTITY") == 0) - queryField->setText(tr("Identity: ")); - else if (strcmp(tmp, "PASSPHRASE") == 0) { - queryField->setText(tr("Private key passphrase: ")); - queryEdit->setEchoMode(QLineEdit::Password); - } else - queryField->setText(field + ":"); - free(tmp); - - return 0; -} - - -void UserDataRequest::sendReply() -{ - char reply[10]; - size_t reply_len = sizeof(reply); - - if (wpagui == NULL) { - reject(); - return; - } - - QString cmd = QString(WPA_CTRL_RSP) + field + '-' + - QString::number(networkid) + ':' + - queryEdit->text(); - wpagui->ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); - accept(); -} +/* + * wpa_gui - UserDataRequest class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#include "userdatarequest.h" +#include "wpagui.h" +#include "common/wpa_ctrl.h" + + +UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool, + Qt::WFlags) + : QDialog(parent) +{ + setupUi(this); + + connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply())); +} + + +UserDataRequest::~UserDataRequest() +{ +} + + +void UserDataRequest::languageChange() +{ + retranslateUi(this); +} + + +int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg) +{ + char *tmp, *pos, *pos2; + wpagui = _wpagui; + tmp = strdup(reqMsg); + if (tmp == NULL) + return -1; + pos = strchr(tmp, '-'); + if (pos == NULL) { + free(tmp); + return -1; + } + *pos++ = '\0'; + field = tmp; + pos2 = strchr(pos, ':'); + if (pos2 == NULL) { + free(tmp); + return -1; + } + *pos2++ = '\0'; + + networkid = atoi(pos); + queryInfo->setText(pos2); + if (strcmp(tmp, "PASSWORD") == 0) { + queryField->setText(tr("Password: ")); + queryEdit->setEchoMode(QLineEdit::Password); + } else if (strcmp(tmp, "NEW_PASSWORD") == 0) { + queryField->setText(tr("New password: ")); + queryEdit->setEchoMode(QLineEdit::Password); + } else if (strcmp(tmp, "IDENTITY") == 0) + queryField->setText(tr("Identity: ")); + else if (strcmp(tmp, "PASSPHRASE") == 0) { + queryField->setText(tr("Private key passphrase: ")); + queryEdit->setEchoMode(QLineEdit::Password); + } else + queryField->setText(field + ":"); + free(tmp); + + return 0; +} + + +void UserDataRequest::sendReply() +{ + char reply[10]; + size_t reply_len = sizeof(reply); + + if (wpagui == NULL) { + reject(); + return; + } + + QString cmd = QString(WPA_CTRL_RSP) + field + '-' + + QString::number(networkid) + ':' + + queryEdit->text(); + wpagui->ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + accept(); +} diff --git a/Network/wpa_gui-qt4_/userdatarequest.h b/Network/wpa_gui-qt4_/userdatarequest.h index 2b6e837..3d01f63 100644 --- a/Network/wpa_gui-qt4_/userdatarequest.h +++ b/Network/wpa_gui-qt4_/userdatarequest.h @@ -1,46 +1,46 @@ -/* - * wpa_gui - UserDataRequest class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef USERDATAREQUEST_H -#define USERDATAREQUEST_H - -#include -#include "ui_userdatarequest.h" - -class WpaGui; - -class UserDataRequest : public QDialog, public Ui::UserDataRequest -{ - Q_OBJECT - -public: - UserDataRequest(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); - ~UserDataRequest(); - - int setParams(WpaGui *_wpagui, const char *reqMsg); - -public slots: - virtual void sendReply(); - -protected slots: - virtual void languageChange(); - -private: - WpaGui *wpagui; - int networkid; - QString field; -}; - -#endif /* USERDATAREQUEST_H */ +/* + * wpa_gui - UserDataRequest class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef USERDATAREQUEST_H +#define USERDATAREQUEST_H + +#include +#include "ui_userdatarequest.h" + +class WpaGui; + +class UserDataRequest : public QDialog, public Ui::UserDataRequest +{ + Q_OBJECT + +public: + UserDataRequest(QWidget *parent = 0, const char *name = 0, + bool modal = false, Qt::WFlags fl = 0); + ~UserDataRequest(); + + int setParams(WpaGui *_wpagui, const char *reqMsg); + +public slots: + virtual void sendReply(); + +protected slots: + virtual void languageChange(); + +private: + WpaGui *wpagui; + int networkid; + QString field; +}; + +#endif /* USERDATAREQUEST_H */ diff --git a/Network/wpa_gui-qt4_/userdatarequest.ui b/Network/wpa_gui-qt4_/userdatarequest.ui index 1de2a26..ab84547 100644 --- a/Network/wpa_gui-qt4_/userdatarequest.ui +++ b/Network/wpa_gui-qt4_/userdatarequest.ui @@ -1,109 +1,109 @@ - - - - - UserDataRequest - - - - 0 - 0 - 216 - 103 - - - - Authentication credentials required - - - true - - - - - - - - - - - - - 0 - - - - - - - - - - - - true - - - QLineEdit::Password - - - - - - - - - 0 - - - - - - 20 - 20 - - - - Expanding - - - Horizontal - - - - - - - &OK - - - - - - true - - - true - - - - - - - &Cancel - - - - - - true - - - - - - - - - - + + + + + UserDataRequest + + + + 0 + 0 + 216 + 103 + + + + Authentication credentials required + + + true + + + + + + + + + + + + + 0 + + + + + + + + + + + + true + + + QLineEdit::Password + + + + + + + + + 0 + + + + + + 20 + 20 + + + + Expanding + + + Horizontal + + + + + + + &OK + + + + + + true + + + true + + + + + + + &Cancel + + + + + + true + + + + + + + + + + diff --git a/Network/wpa_gui-qt4_/wpa_gui.desktop b/Network/wpa_gui-qt4_/wpa_gui.desktop index ccc7d87..cccb808 100644 --- a/Network/wpa_gui-qt4_/wpa_gui.desktop +++ b/Network/wpa_gui-qt4_/wpa_gui.desktop @@ -1,10 +1,10 @@ -[Desktop Entry] -Version=1.0 -Name=wpa_gui -Comment=Graphical user interface for wpa_supplicant -Exec=wpa_gui -Icon=wpa_gui -GenericName=wpa_supplicant user interface -Terminal=false -Type=Application -Categories=Qt;Network; +[Desktop Entry] +Version=1.0 +Name=wpa_gui +Comment=Graphical user interface for wpa_supplicant +Exec=wpa_gui +Icon=wpa_gui +GenericName=wpa_supplicant user interface +Terminal=false +Type=Application +Categories=Qt;Network; diff --git a/Network/wpa_gui-qt4_/wpa_gui.pro b/Network/wpa_gui-qt4_/wpa_gui.pro index 85848d7..d8486be 100644 --- a/Network/wpa_gui-qt4_/wpa_gui.pro +++ b/Network/wpa_gui-qt4_/wpa_gui.pro @@ -1,68 +1,68 @@ -TEMPLATE = app -LANGUAGE = C++ -TRANSLATIONS = lang/wpa_gui_de.ts - -CONFIG += qt warn_on release - -DEFINES += CONFIG_CTRL_IFACE - -win32 { - LIBS += -lws2_32 -static - DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE - SOURCES += ../../src/utils/os_win32.c -} else:win32-g++ { - # cross compilation to win32 - LIBS += -lws2_32 -static -mwindows - DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE - SOURCES += ../../src/utils/os_win32.c - RESOURCES += icons_png.qrc -} else:win32-x-g++ { - # cross compilation to win32 - LIBS += -lws2_32 -static -mwindows - DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE - DEFINES += _X86_ - SOURCES += ../../src/utils/os_win32.c - RESOURCES += icons_png.qrc -} else { - DEFINES += CONFIG_CTRL_IFACE_UNIX - SOURCES += ../../src/utils/os_unix.c -} - -INCLUDEPATH += . .. ../../src ../../src/utils - -HEADERS += wpamsg.h \ - wpagui.h \ - eventhistory.h \ - scanresults.h \ - userdatarequest.h \ - networkconfig.h \ - addinterface.h \ - peers.h \ - stringquery.h - -SOURCES += main.cpp \ - wpagui.cpp \ - eventhistory.cpp \ - scanresults.cpp \ - userdatarequest.cpp \ - networkconfig.cpp \ - addinterface.cpp \ - peers.cpp \ - stringquery.cpp \ - ../../src/common/wpa_ctrl.c - -RESOURCES += icons.qrc - -FORMS = wpagui.ui \ - eventhistory.ui \ - scanresults.ui \ - userdatarequest.ui \ - networkconfig.ui \ - peers.ui - - -unix { - UI_DIR = .ui - MOC_DIR = .moc - OBJECTS_DIR = .obj -} +TEMPLATE = app +LANGUAGE = C++ +TRANSLATIONS = lang/wpa_gui_de.ts + +CONFIG += qt warn_on release + +DEFINES += CONFIG_CTRL_IFACE + +win32 { + LIBS += -lws2_32 -static + DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE + SOURCES += ../../src/utils/os_win32.c +} else:win32-g++ { + # cross compilation to win32 + LIBS += -lws2_32 -static -mwindows + DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE + SOURCES += ../../src/utils/os_win32.c + RESOURCES += icons_png.qrc +} else:win32-x-g++ { + # cross compilation to win32 + LIBS += -lws2_32 -static -mwindows + DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE + DEFINES += _X86_ + SOURCES += ../../src/utils/os_win32.c + RESOURCES += icons_png.qrc +} else { + DEFINES += CONFIG_CTRL_IFACE_UNIX + SOURCES += ../../src/utils/os_unix.c +} + +INCLUDEPATH += . .. ../../src ../../src/utils + +HEADERS += wpamsg.h \ + wpagui.h \ + eventhistory.h \ + scanresults.h \ + userdatarequest.h \ + networkconfig.h \ + addinterface.h \ + peers.h \ + stringquery.h + +SOURCES += main.cpp \ + wpagui.cpp \ + eventhistory.cpp \ + scanresults.cpp \ + userdatarequest.cpp \ + networkconfig.cpp \ + addinterface.cpp \ + peers.cpp \ + stringquery.cpp \ + ../../src/common/wpa_ctrl.c + +RESOURCES += icons.qrc + +FORMS = wpagui.ui \ + eventhistory.ui \ + scanresults.ui \ + userdatarequest.ui \ + networkconfig.ui \ + peers.ui + + +unix { + UI_DIR = .ui + MOC_DIR = .moc + OBJECTS_DIR = .obj +} diff --git a/Network/wpa_gui-qt4_/wpagui.cpp b/Network/wpa_gui-qt4_/wpagui.cpp index 97bf5ac..dddf2be 100644 --- a/Network/wpa_gui-qt4_/wpagui.cpp +++ b/Network/wpa_gui-qt4_/wpagui.cpp @@ -1,1748 +1,1748 @@ -/* - * wpa_gui - WpaGui class - * Copyright (c) 2005-2011, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifdef __MINGW32__ -/* Need to get getopt() */ -#include -#endif - -#ifdef CONFIG_NATIVE_WINDOWS -#include -#endif /* CONFIG_NATIVE_WINDOWS */ - -#include -#include -#include -#include -#include - -#include "wpagui.h" -#include "dirent.h" -#include "common/wpa_ctrl.h" -#include "userdatarequest.h" -#include "networkconfig.h" - -#if 1 -/* Silence stdout */ -#define printf wpagui_printf -static int wpagui_printf(const char *, ...) -{ - return 0; -} -#endif - -WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags) - : QMainWindow(parent), app(_app) -{ - setupUi(this); - -#ifdef CONFIG_NATIVE_WINDOWS - fileStopServiceAction = new QAction(this); - fileStopServiceAction->setObjectName("Stop Service"); - fileStopServiceAction->setIconText(tr("Stop Service")); - fileMenu->insertAction(actionWPS, fileStopServiceAction); - - fileStartServiceAction = new QAction(this); - fileStartServiceAction->setObjectName("Start Service"); - fileStartServiceAction->setIconText(tr("Start Service")); - fileMenu->insertAction(fileStopServiceAction, fileStartServiceAction); - - connect(fileStartServiceAction, SIGNAL(triggered()), this, - SLOT(startService())); - connect(fileStopServiceAction, SIGNAL(triggered()), this, - SLOT(stopService())); - - addInterfaceAction = new QAction(this); - addInterfaceAction->setIconText(tr("Add Interface")); - fileMenu->insertAction(fileStartServiceAction, addInterfaceAction); - - connect(addInterfaceAction, SIGNAL(triggered()), this, - SLOT(addInterface())); -#endif /* CONFIG_NATIVE_WINDOWS */ - - (void) statusBar(); - - /* - * Disable WPS tab by default; it will be enabled if wpa_supplicant is - * built with WPS support. - */ - wpsTab->setEnabled(false); - wpaguiTab->setTabEnabled(wpaguiTab->indexOf(wpsTab), false); - - connect(fileEventHistoryAction, SIGNAL(triggered()), this, - SLOT(eventHistory())); - connect(fileSaveConfigAction, SIGNAL(triggered()), this, - SLOT(saveConfig())); - connect(actionWPS, SIGNAL(triggered()), this, SLOT(wpsDialog())); - connect(actionPeers, SIGNAL(triggered()), this, SLOT(peersDialog())); - connect(fileExitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - connect(networkAddAction, SIGNAL(triggered()), this, - SLOT(addNetwork())); - connect(networkEditAction, SIGNAL(triggered()), this, - SLOT(editSelectedNetwork())); - connect(networkRemoveAction, SIGNAL(triggered()), this, - SLOT(removeSelectedNetwork())); - connect(networkEnableAllAction, SIGNAL(triggered()), this, - SLOT(enableAllNetworks())); - connect(networkDisableAllAction, SIGNAL(triggered()), this, - SLOT(disableAllNetworks())); - connect(networkRemoveAllAction, SIGNAL(triggered()), this, - SLOT(removeAllNetworks())); - connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex())); - connect(helpContentsAction, SIGNAL(triggered()), this, - SLOT(helpContents())); - connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout())); - connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect())); - connect(scanButton, SIGNAL(clicked()), this, SLOT(scan())); - connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB())); - connect(adapterSelect, SIGNAL(activated(const QString&)), this, - SLOT(selectAdapter(const QString&))); - connect(networkSelect, SIGNAL(activated(const QString&)), this, - SLOT(selectNetwork(const QString&))); - connect(addNetworkButton, SIGNAL(clicked()), this, SLOT(addNetwork())); - connect(editNetworkButton, SIGNAL(clicked()), this, - SLOT(editListedNetwork())); - connect(removeNetworkButton, SIGNAL(clicked()), this, - SLOT(removeListedNetwork())); - connect(networkList, SIGNAL(itemSelectionChanged()), this, - SLOT(updateNetworkDisabledStatus())); - connect(enableRadioButton, SIGNAL(toggled(bool)), this, - SLOT(enableListedNetwork(bool))); - connect(disableRadioButton, SIGNAL(toggled(bool)), this, - SLOT(disableListedNetwork(bool))); - connect(scanNetworkButton, SIGNAL(clicked()), this, SLOT(scan())); - connect(networkList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), - this, SLOT(editListedNetwork())); - connect(wpaguiTab, SIGNAL(currentChanged(int)), this, - SLOT(tabChanged(int))); - connect(wpsPbcButton, SIGNAL(clicked()), this, SLOT(wpsPbc())); - connect(wpsPinButton, SIGNAL(clicked()), this, SLOT(wpsGeneratePin())); - connect(wpsApPinEdit, SIGNAL(textChanged(const QString &)), this, - SLOT(wpsApPinChanged(const QString &))); - connect(wpsApPinButton, SIGNAL(clicked()), this, SLOT(wpsApPin())); - - eh = NULL; - scanres = NULL; - peers = NULL; - add_iface = NULL; - udr = NULL; - tray_icon = NULL; - startInTray = false; - ctrl_iface = NULL; - ctrl_conn = NULL; - monitor_conn = NULL; - msgNotifier = NULL; - ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); - - parse_argv(); - -#ifndef QT_NO_SESSIONMANAGER - if (app->isSessionRestored()) { - QSettings settings("wpa_supplicant", "wpa_gui"); - settings.beginGroup("state"); - if (app->sessionId().compare(settings.value("session_id"). - toString()) == 0) - startInTray = settings.value("in_tray").toBool(); - settings.endGroup(); - } -#endif - - if (QSystemTrayIcon::isSystemTrayAvailable()) - createTrayIcon(startInTray); - else - show(); - - connectedToService = false; - textStatus->setText(tr("connecting to wpa_supplicant")); - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(ping())); - timer->setSingleShot(FALSE); - timer->start(1000); - - if (openCtrlConnection(ctrl_iface) < 0) { - printf("Failed to open control connection to " - "wpa_supplicant.\n"); - } - - updateStatus(); - networkMayHaveChanged = true; - updateNetworks(); -} - - -WpaGui::~WpaGui() -{ - delete msgNotifier; - - if (monitor_conn) { - wpa_ctrl_detach(monitor_conn); - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - } - if (ctrl_conn) { - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - } - - if (eh) { - eh->close(); - delete eh; - eh = NULL; - } - - if (scanres) { - scanres->close(); - delete scanres; - scanres = NULL; - } - - if (peers) { - peers->close(); - delete peers; - peers = NULL; - } - - if (add_iface) { - add_iface->close(); - delete add_iface; - add_iface = NULL; - } - - if (udr) { - udr->close(); - delete udr; - udr = NULL; - } - - free(ctrl_iface); - ctrl_iface = NULL; - - free(ctrl_iface_dir); - ctrl_iface_dir = NULL; -} - - -void WpaGui::languageChange() -{ - retranslateUi(this); -} - - -void WpaGui::parse_argv() -{ - int c; - for (;;) { - c = getopt(qApp->argc(), qApp->argv(), "i:p:t"); - if (c < 0) - break; - switch (c) { - case 'i': - free(ctrl_iface); - ctrl_iface = strdup(optarg); - break; - case 'p': - free(ctrl_iface_dir); - ctrl_iface_dir = strdup(optarg); - break; - case 't': - startInTray = true; - break; - } - } -} - - -int WpaGui::openCtrlConnection(const char *ifname) -{ - char *cfile; - int flen; - char buf[2048], *pos, *pos2; - size_t len; - - if (ifname) { - if (ifname != ctrl_iface) { - free(ctrl_iface); - ctrl_iface = strdup(ifname); - } - } else { -#ifdef CONFIG_CTRL_IFACE_UDP - free(ctrl_iface); - ctrl_iface = strdup("udp"); -#endif /* CONFIG_CTRL_IFACE_UDP */ -#ifdef CONFIG_CTRL_IFACE_UNIX - struct dirent *dent; - DIR *dir = opendir(ctrl_iface_dir); - free(ctrl_iface); - ctrl_iface = NULL; - if (dir) { - while ((dent = readdir(dir))) { -#ifdef _DIRENT_HAVE_D_TYPE - /* Skip the file if it is not a socket. - * Also accept DT_UNKNOWN (0) in case - * the C library or underlying file - * system does not support d_type. */ - if (dent->d_type != DT_SOCK && - dent->d_type != DT_UNKNOWN) - continue; -#endif /* _DIRENT_HAVE_D_TYPE */ - - if (strcmp(dent->d_name, ".") == 0 || - strcmp(dent->d_name, "..") == 0) - continue; - printf("Selected interface '%s'\n", - dent->d_name); - ctrl_iface = strdup(dent->d_name); - break; - } - closedir(dir); - } -#endif /* CONFIG_CTRL_IFACE_UNIX */ -#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE - struct wpa_ctrl *ctrl; - int ret; - - free(ctrl_iface); - ctrl_iface = NULL; - - ctrl = wpa_ctrl_open(NULL); - if (ctrl) { - len = sizeof(buf) - 1; - ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf, - &len, NULL); - if (ret >= 0) { - connectedToService = true; - buf[len] = '\0'; - pos = strchr(buf, '\n'); - if (pos) - *pos = '\0'; - ctrl_iface = strdup(buf); - } - wpa_ctrl_close(ctrl); - } -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ - } - - if (ctrl_iface == NULL) { -#ifdef CONFIG_NATIVE_WINDOWS - static bool first = true; - if (first && !serviceRunning()) { - first = false; - if (QMessageBox::warning( - this, qAppName(), - tr("wpa_supplicant service is not " - "running.\n" - "Do you want to start it?"), - QMessageBox::Yes | QMessageBox::No) == - QMessageBox::Yes) - startService(); - } -#endif /* CONFIG_NATIVE_WINDOWS */ - return -1; - } - -#ifdef CONFIG_CTRL_IFACE_UNIX - flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2; - cfile = (char *) malloc(flen); - if (cfile == NULL) - return -1; - snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface); -#else /* CONFIG_CTRL_IFACE_UNIX */ - flen = strlen(ctrl_iface) + 1; - cfile = (char *) malloc(flen); - if (cfile == NULL) - return -1; - snprintf(cfile, flen, "%s", ctrl_iface); -#endif /* CONFIG_CTRL_IFACE_UNIX */ - - if (ctrl_conn) { - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - } - - if (monitor_conn) { - delete msgNotifier; - msgNotifier = NULL; - wpa_ctrl_detach(monitor_conn); - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - } - - printf("Trying to connect to '%s'\n", cfile); - ctrl_conn = wpa_ctrl_open(cfile); - if (ctrl_conn == NULL) { - free(cfile); - return -1; - } - monitor_conn = wpa_ctrl_open(cfile); - free(cfile); - if (monitor_conn == NULL) { - wpa_ctrl_close(ctrl_conn); - return -1; - } - if (wpa_ctrl_attach(monitor_conn)) { - printf("Failed to attach to wpa_supplicant\n"); - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - return -1; - } - -#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP) - msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn), - QSocketNotifier::Read, this); - connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs())); -#endif - - adapterSelect->clear(); - adapterSelect->addItem(ctrl_iface); - adapterSelect->setCurrentIndex(0); - - len = sizeof(buf) - 1; - if (wpa_ctrl_request(ctrl_conn, "INTERFACES", 10, buf, &len, NULL) >= - 0) { - buf[len] = '\0'; - pos = buf; - while (*pos) { - pos2 = strchr(pos, '\n'); - if (pos2) - *pos2 = '\0'; - if (strcmp(pos, ctrl_iface) != 0) - adapterSelect->addItem(pos); - if (pos2) - pos = pos2 + 1; - else - break; - } - } - - len = sizeof(buf) - 1; - if (wpa_ctrl_request(ctrl_conn, "GET_CAPABILITY eap", 18, buf, &len, - NULL) >= 0) { - buf[len] = '\0'; - - QString res(buf); - QStringList types = res.split(QChar(' ')); - bool wps = types.contains("WSC"); - actionWPS->setEnabled(wps); - wpsTab->setEnabled(wps); - wpaguiTab->setTabEnabled(wpaguiTab->indexOf(wpsTab), wps); - } - - return 0; -} - - -int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen) -{ - int ret; - - if (ctrl_conn == NULL) - return -3; - ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen, NULL); - if (ret == -2) - printf("'%s' command timed out.\n", cmd); - else if (ret < 0) - printf("'%s' command failed.\n", cmd); - - return ret; -} - - -QString WpaGui::wpaStateTranslate(char *state) -{ - if (!strcmp(state, "DISCONNECTED")) - return tr("Disconnected"); - else if (!strcmp(state, "INACTIVE")) - return tr("Inactive"); - else if (!strcmp(state, "SCANNING")) - return tr("Scanning"); - else if (!strcmp(state, "AUTHENTICATING")) - return tr("Authenticating"); - else if (!strcmp(state, "ASSOCIATING")) - return tr("Associating"); - else if (!strcmp(state, "ASSOCIATED")) - return tr("Associated"); - else if (!strcmp(state, "4WAY_HANDSHAKE")) - return tr("4-Way Handshake"); - else if (!strcmp(state, "GROUP_HANDSHAKE")) - return tr("Group Handshake"); - else if (!strcmp(state, "COMPLETED")) - return tr("Completed"); - else - return tr("Unknown"); -} - - -void WpaGui::updateStatus() -{ - char buf[2048], *start, *end, *pos; - size_t len; - - pingsToStatusUpdate = 10; - - len = sizeof(buf) - 1; - if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) { - textStatus->setText(tr("Could not get status from " - "wpa_supplicant")); - textAuthentication->clear(); - textEncryption->clear(); - textSsid->clear(); - textBssid->clear(); - textIpAddress->clear(); - -#ifdef CONFIG_NATIVE_WINDOWS - static bool first = true; - if (first && connectedToService && - (ctrl_iface == NULL || *ctrl_iface == '\0')) { - first = false; - if (QMessageBox::information( - this, qAppName(), - tr("No network interfaces in use.\n" - "Would you like to add one?"), - QMessageBox::Yes | QMessageBox::No) == - QMessageBox::Yes) - addInterface(); - } -#endif /* CONFIG_NATIVE_WINDOWS */ - return; - } - - buf[len] = '\0'; - - bool auth_updated = false, ssid_updated = false; - bool bssid_updated = false, ipaddr_updated = false; - bool status_updated = false; - char *pairwise_cipher = NULL, *group_cipher = NULL; - char *mode = NULL; - - start = buf; - while (*start) { - bool last = false; - end = strchr(start, '\n'); - if (end == NULL) { - last = true; - end = start; - while (end[0] && end[1]) - end++; - } - *end = '\0'; - - pos = strchr(start, '='); - if (pos) { - *pos++ = '\0'; - if (strcmp(start, "bssid") == 0) { - bssid_updated = true; - textBssid->setText(pos); - } else if (strcmp(start, "ssid") == 0) { - ssid_updated = true; - textSsid->setText(pos); - } else if (strcmp(start, "ip_address") == 0) { - ipaddr_updated = true; - textIpAddress->setText(pos); - } else if (strcmp(start, "wpa_state") == 0) { - status_updated = true; - textStatus->setText(wpaStateTranslate(pos)); - } else if (strcmp(start, "key_mgmt") == 0) { - auth_updated = true; - textAuthentication->setText(pos); - /* TODO: could add EAP status to this */ - } else if (strcmp(start, "pairwise_cipher") == 0) { - pairwise_cipher = pos; - } else if (strcmp(start, "group_cipher") == 0) { - group_cipher = pos; - } else if (strcmp(start, "mode") == 0) { - mode = pos; - } - } - - if (last) - break; - start = end + 1; - } - if (status_updated && mode) - textStatus->setText(textStatus->text() + " (" + mode + ")"); - - if (pairwise_cipher || group_cipher) { - QString encr; - if (pairwise_cipher && group_cipher && - strcmp(pairwise_cipher, group_cipher) != 0) { - encr.append(pairwise_cipher); - encr.append(" + "); - encr.append(group_cipher); - } else if (pairwise_cipher) { - encr.append(pairwise_cipher); - } else { - encr.append(group_cipher); - encr.append(" [group key only]"); - } - textEncryption->setText(encr); - } else - textEncryption->clear(); - - if (!status_updated) - textStatus->clear(); - if (!auth_updated) - textAuthentication->clear(); - if (!ssid_updated) - textSsid->clear(); - if (!bssid_updated) - textBssid->clear(); - if (!ipaddr_updated) - textIpAddress->clear(); -} - - -void WpaGui::updateNetworks() -{ - char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; - size_t len; - int first_active = -1; - int was_selected = -1; - bool current = false; - - if (!networkMayHaveChanged) - return; - - if (networkList->currentRow() >= 0) - was_selected = networkList->currentRow(); - - networkSelect->clear(); - networkList->clear(); - - if (ctrl_conn == NULL) - return; - - len = sizeof(buf) - 1; - if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0) - return; - - buf[len] = '\0'; - start = strchr(buf, '\n'); - if (start == NULL) - return; - start++; - - while (*start) { - bool last = false; - end = strchr(start, '\n'); - if (end == NULL) { - last = true; - end = start; - while (end[0] && end[1]) - end++; - } - *end = '\0'; - - id = start; - ssid = strchr(id, '\t'); - if (ssid == NULL) - break; - *ssid++ = '\0'; - bssid = strchr(ssid, '\t'); - if (bssid == NULL) - break; - *bssid++ = '\0'; - flags = strchr(bssid, '\t'); - if (flags == NULL) - break; - *flags++ = '\0'; - - if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) { - if (last) - break; - start = end + 1; - continue; - } - - QString network(id); - network.append(": "); - network.append(ssid); - networkSelect->addItem(network); - networkList->addItem(network); - - if (strstr(flags, "[CURRENT]")) { - networkSelect->setCurrentIndex(networkSelect->count() - - 1); - current = true; - } else if (first_active < 0 && - strstr(flags, "[DISABLED]") == NULL) - first_active = networkSelect->count() - 1; - - if (last) - break; - start = end + 1; - } - - if (networkSelect->count() > 1) - networkSelect->addItem(tr("Select any network")); - - if (!current && first_active >= 0) - networkSelect->setCurrentIndex(first_active); - - if (was_selected >= 0 && networkList->count() > 0) { - if (was_selected < networkList->count()) - networkList->setCurrentRow(was_selected); - else - networkList->setCurrentRow(networkList->count() - 1); - } - else - networkList->setCurrentRow(networkSelect->currentIndex()); - - networkMayHaveChanged = false; -} - - -void WpaGui::helpIndex() -{ - printf("helpIndex\n"); -} - - -void WpaGui::helpContents() -{ - printf("helpContents\n"); -} - - -void WpaGui::helpAbout() -{ - QMessageBox::about(this, "wpa_gui for wpa_supplicant", - "Copyright (c) 2003-2011,\n" - "Jouni Malinen \n" - "and contributors.\n" - "\n" - "This program is free software. You can\n" - "distribute it and/or modify it under the terms " - "of\n" - "the GNU General Public License version 2.\n" - "\n" - "Alternatively, this software may be distributed\n" - "under the terms of the BSD license.\n" - "\n" - "This product includes software developed\n" - "by the OpenSSL Project for use in the\n" - "OpenSSL Toolkit (http://www.openssl.org/)\n"); -} - - -void WpaGui::disconnect() -{ - char reply[10]; - size_t reply_len = sizeof(reply); - ctrlRequest("DISCONNECT", reply, &reply_len); - stopWpsRun(false); -} - - -void WpaGui::scan() -{ - if (scanres) { - scanres->close(); - delete scanres; - } - - scanres = new ScanResults(); - if (scanres == NULL) - return; - scanres->setWpaGui(this); - scanres->show(); - scanres->exec(); -} - - -void WpaGui::eventHistory() -{ - if (eh) { - eh->close(); - delete eh; - } - - eh = new EventHistory(); - if (eh == NULL) - return; - eh->addEvents(msgs); - eh->show(); - eh->exec(); -} - - -void WpaGui::ping() -{ - char buf[10]; - size_t len; - -#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE - /* - * QSocketNotifier cannot be used with Windows named pipes, so use a - * timer to check for received messages for now. This could be - * optimized be doing something specific to named pipes or Windows - * events, but it is not clear what would be the best way of doing that - * in Qt. - */ - receiveMsgs(); -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ - - if (scanres && !scanres->isVisible()) { - delete scanres; - scanres = NULL; - } - - if (eh && !eh->isVisible()) { - delete eh; - eh = NULL; - } - - if (udr && !udr->isVisible()) { - delete udr; - udr = NULL; - } - - len = sizeof(buf) - 1; - if (ctrlRequest("PING", buf, &len) < 0) { - printf("PING failed - trying to reconnect\n"); - if (openCtrlConnection(ctrl_iface) >= 0) { - printf("Reconnected successfully\n"); - pingsToStatusUpdate = 0; - } - } - - pingsToStatusUpdate--; - if (pingsToStatusUpdate <= 0) { - updateStatus(); - updateNetworks(); - } - -#ifndef CONFIG_CTRL_IFACE_NAMED_PIPE - /* Use less frequent pings and status updates when the main window is - * hidden (running in taskbar). */ - int interval = isHidden() ? 5000 : 1000; - if (timer->interval() != interval) - timer->setInterval(interval); -#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ -} - - -static int str_match(const char *a, const char *b) -{ - return strncmp(a, b, strlen(b)) == 0; -} - - -void WpaGui::processMsg(char *msg) -{ - char *pos = msg, *pos2; - int priority = 2; - - if (*pos == '<') { - /* skip priority */ - pos++; - priority = atoi(pos); - pos = strchr(pos, '>'); - if (pos) - pos++; - else - pos = msg; - } - - WpaMsg wm(pos, priority); - if (eh) - eh->addEvent(wm); - if (peers) - peers->event_notify(wm); - msgs.append(wm); - while (msgs.count() > 100) - msgs.pop_front(); - - /* Update last message with truncated version of the event */ - if (strncmp(pos, "CTRL-", 5) == 0) { - pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' '); - if (pos2) - pos2++; - else - pos2 = pos; - } else - pos2 = pos; - QString lastmsg = pos2; - lastmsg.truncate(40); - textLastMessage->setText(lastmsg); - - pingsToStatusUpdate = 0; - networkMayHaveChanged = true; - - if (str_match(pos, WPA_CTRL_REQ)) - processCtrlReq(pos + strlen(WPA_CTRL_REQ)); - else if (str_match(pos, WPA_EVENT_SCAN_RESULTS) && scanres) - scanres->updateResults(); - else if (str_match(pos, WPA_EVENT_DISCONNECTED)) - showTrayMessage(QSystemTrayIcon::Information, 3, - tr("Disconnected from network.")); - else if (str_match(pos, WPA_EVENT_CONNECTED)) { - showTrayMessage(QSystemTrayIcon::Information, 3, - tr("Connection to network established.")); - QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus())); - stopWpsRun(true); - } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) { - wpsStatusText->setText(tr("WPS AP in active PBC mode found")); - if (textStatus->text() == "INACTIVE" || - textStatus->text() == "DISCONNECTED") - wpaguiTab->setCurrentWidget(wpsTab); - wpsInstructions->setText(tr("Press the PBC button on the " - "screen to start registration")); - } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PIN)) { - wpsStatusText->setText(tr("WPS AP with recently selected " - "registrar")); - if (textStatus->text() == "INACTIVE" || - textStatus->text() == "DISCONNECTED") - wpaguiTab->setCurrentWidget(wpsTab); - } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_AUTH)) { - showTrayMessage(QSystemTrayIcon::Information, 3, - "Wi-Fi Protected Setup (WPS) AP\n" - "indicating this client is authorized."); - wpsStatusText->setText("WPS AP indicating this client is " - "authorized"); - if (textStatus->text() == "INACTIVE" || - textStatus->text() == "DISCONNECTED") - wpaguiTab->setCurrentWidget(wpsTab); - } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE)) { - wpsStatusText->setText(tr("WPS AP detected")); - } else if (str_match(pos, WPS_EVENT_OVERLAP)) { - wpsStatusText->setText(tr("PBC mode overlap detected")); - wpsInstructions->setText(tr("More than one AP is currently in " - "active WPS PBC mode. Wait couple " - "of minutes and try again")); - wpaguiTab->setCurrentWidget(wpsTab); - } else if (str_match(pos, WPS_EVENT_CRED_RECEIVED)) { - wpsStatusText->setText(tr("Network configuration received")); - wpaguiTab->setCurrentWidget(wpsTab); - } else if (str_match(pos, WPA_EVENT_EAP_METHOD)) { - if (strstr(pos, "(WSC)")) - wpsStatusText->setText(tr("Registration started")); - } else if (str_match(pos, WPS_EVENT_M2D)) { - wpsStatusText->setText(tr("Registrar does not yet know PIN")); - } else if (str_match(pos, WPS_EVENT_FAIL)) { - wpsStatusText->setText(tr("Registration failed")); - } else if (str_match(pos, WPS_EVENT_SUCCESS)) { - wpsStatusText->setText(tr("Registration succeeded")); - } -} - - -void WpaGui::processCtrlReq(const char *req) -{ - if (udr) { - udr->close(); - delete udr; - } - udr = new UserDataRequest(); - if (udr == NULL) - return; - if (udr->setParams(this, req) < 0) { - delete udr; - udr = NULL; - return; - } - udr->show(); - udr->exec(); -} - - -void WpaGui::receiveMsgs() -{ - char buf[256]; - size_t len; - - while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) { - len = sizeof(buf) - 1; - if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) { - buf[len] = '\0'; - processMsg(buf); - } - } -} - - -void WpaGui::connectB() -{ - char reply[10]; - size_t reply_len = sizeof(reply); - ctrlRequest("REASSOCIATE", reply, &reply_len); -} - - -void WpaGui::selectNetwork( const QString &sel ) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply); - - if (cmd.contains(QRegExp("^\\d+:"))) - cmd.truncate(cmd.indexOf(':')); - else - cmd = "any"; - cmd.prepend("SELECT_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); - triggerUpdate(); - stopWpsRun(false); -} - - -void WpaGui::enableNetwork(const QString &sel) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply); - - if (cmd.contains(QRegExp("^\\d+:"))) - cmd.truncate(cmd.indexOf(':')); - else if (!cmd.startsWith("all")) { - printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); - return; - } - cmd.prepend("ENABLE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); - triggerUpdate(); -} - - -void WpaGui::disableNetwork(const QString &sel) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply); - - if (cmd.contains(QRegExp("^\\d+:"))) - cmd.truncate(cmd.indexOf(':')); - else if (!cmd.startsWith("all")) { - printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); - return; - } - cmd.prepend("DISABLE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); - triggerUpdate(); -} - - -void WpaGui::editNetwork(const QString &sel) -{ - QString cmd(sel); - int id = -1; - - if (cmd.contains(QRegExp("^\\d+:"))) { - cmd.truncate(cmd.indexOf(':')); - id = cmd.toInt(); - } - - NetworkConfig *nc = new NetworkConfig(); - if (nc == NULL) - return; - nc->setWpaGui(this); - - if (id >= 0) - nc->paramsFromConfig(id); - else - nc->newNetwork(); - - nc->show(); - nc->exec(); -} - - -void WpaGui::editSelectedNetwork() -{ - if (networkSelect->count() < 1) { - QMessageBox::information( - this, tr("No Networks"), - tr("There are no networks to edit.\n")); - return; - } - QString sel(networkSelect->currentText()); - editNetwork(sel); -} - - -void WpaGui::editListedNetwork() -{ - if (networkList->currentRow() < 0) { - QMessageBox::information(this, tr("Select A Network"), - tr("Select a network from the list to" - " edit it.\n")); - return; - } - QString sel(networkList->currentItem()->text()); - editNetwork(sel); -} - - -void WpaGui::triggerUpdate() -{ - updateStatus(); - networkMayHaveChanged = true; - updateNetworks(); -} - - -void WpaGui::addNetwork() -{ - NetworkConfig *nc = new NetworkConfig(); - if (nc == NULL) - return; - nc->setWpaGui(this); - nc->newNetwork(); - nc->show(); - nc->exec(); -} - - -void WpaGui::removeNetwork(const QString &sel) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply); - - if (cmd.contains(QRegExp("^\\d+:"))) - cmd.truncate(cmd.indexOf(':')); - else if (!cmd.startsWith("all")) { - printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); - return; - } - cmd.prepend("REMOVE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); - triggerUpdate(); -} - - -void WpaGui::removeSelectedNetwork() -{ - if (networkSelect->count() < 1) { - QMessageBox::information(this, tr("No Networks"), - tr("There are no networks to remove." - "\n")); - return; - } - QString sel(networkSelect->currentText()); - removeNetwork(sel); -} - - -void WpaGui::removeListedNetwork() -{ - if (networkList->currentRow() < 0) { - QMessageBox::information(this, tr("Select A Network"), - tr("Select a network from the list " - "to remove it.\n")); - return; - } - QString sel(networkList->currentItem()->text()); - removeNetwork(sel); -} - - -void WpaGui::enableAllNetworks() -{ - QString sel("all"); - enableNetwork(sel); -} - - -void WpaGui::disableAllNetworks() -{ - QString sel("all"); - disableNetwork(sel); -} - - -void WpaGui::removeAllNetworks() -{ - QString sel("all"); - removeNetwork(sel); -} - - -int WpaGui::getNetworkDisabled(const QString &sel) -{ - QString cmd(sel); - char reply[10]; - size_t reply_len = sizeof(reply) - 1; - int pos = cmd.indexOf(':'); - if (pos < 0) { - printf("Invalid getNetworkDisabled '%s'\n", - cmd.toAscii().constData()); - return -1; - } - cmd.truncate(pos); - cmd.prepend("GET_NETWORK "); - cmd.append(" disabled"); - - if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) >= 0 - && reply_len >= 1) { - reply[reply_len] = '\0'; - if (!str_match(reply, "FAIL")) - return atoi(reply); - } - - return -1; -} - - -void WpaGui::updateNetworkDisabledStatus() -{ - if (networkList->currentRow() < 0) - return; - - QString sel(networkList->currentItem()->text()); - - switch (getNetworkDisabled(sel)) { - case 0: - if (!enableRadioButton->isChecked()) - enableRadioButton->setChecked(true); - return; - case 1: - if (!disableRadioButton->isChecked()) - disableRadioButton->setChecked(true); - return; - } -} - - -void WpaGui::enableListedNetwork(bool enabled) -{ - if (networkList->currentRow() < 0 || !enabled) - return; - - QString sel(networkList->currentItem()->text()); - - if (getNetworkDisabled(sel) == 1) - enableNetwork(sel); -} - - -void WpaGui::disableListedNetwork(bool disabled) -{ - if (networkList->currentRow() < 0 || !disabled) - return; - - QString sel(networkList->currentItem()->text()); - - if (getNetworkDisabled(sel) == 0) - disableNetwork(sel); -} - - -void WpaGui::saveConfig() -{ - char buf[10]; - size_t len; - - len = sizeof(buf) - 1; - ctrlRequest("SAVE_CONFIG", buf, &len); - - buf[len] = '\0'; - - if (str_match(buf, "FAIL")) - QMessageBox::warning( - this, tr("Failed to save configuration"), - tr("The configuration could not be saved.\n" - "\n" - "The update_config=1 configuration option\n" - "must be used for configuration saving to\n" - "be permitted.\n")); - else - QMessageBox::information( - this, tr("Saved configuration"), - tr("The current configuration was saved." - "\n")); -} - - -void WpaGui::selectAdapter( const QString & sel ) -{ - if (openCtrlConnection(sel.toAscii().constData()) < 0) - printf("Failed to open control connection to " - "wpa_supplicant.\n"); - updateStatus(); - updateNetworks(); -} - - -void WpaGui::createTrayIcon(bool trayOnly) -{ - QApplication::setQuitOnLastWindowClosed(false); - - tray_icon = new QSystemTrayIcon(this); - tray_icon->setToolTip(qAppName() + tr(" - wpa_supplicant user interface")); - if (QImageReader::supportedImageFormats().contains(QByteArray("svg"))) - tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg")); - else - tray_icon->setIcon(QIcon(":/icons/wpa_gui.png")); - - connect(tray_icon, - SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason))); - - ackTrayIcon = false; - - tray_menu = new QMenu(this); - - disconnectAction = new QAction(tr("&Disconnect"), this); - reconnectAction = new QAction(tr("Re&connect"), this); - connect(disconnectAction, SIGNAL(triggered()), this, - SLOT(disconnect())); - connect(reconnectAction, SIGNAL(triggered()), this, - SLOT(connectB())); - tray_menu->addAction(disconnectAction); - tray_menu->addAction(reconnectAction); - tray_menu->addSeparator(); - - eventAction = new QAction(tr("&Event History"), this); - scanAction = new QAction(tr("Scan &Results"), this); - statAction = new QAction(tr("S&tatus"), this); - connect(eventAction, SIGNAL(triggered()), this, SLOT(eventHistory())); - connect(scanAction, SIGNAL(triggered()), this, SLOT(scan())); - connect(statAction, SIGNAL(triggered()), this, SLOT(showTrayStatus())); - tray_menu->addAction(eventAction); - tray_menu->addAction(scanAction); - tray_menu->addAction(statAction); - tray_menu->addSeparator(); - - showAction = new QAction(tr("&Show Window"), this); - hideAction = new QAction(tr("&Hide Window"), this); - quitAction = new QAction(tr("&Quit"), this); - connect(showAction, SIGNAL(triggered()), this, SLOT(show())); - connect(hideAction, SIGNAL(triggered()), this, SLOT(hide())); - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - tray_menu->addAction(showAction); - tray_menu->addAction(hideAction); - tray_menu->addSeparator(); - tray_menu->addAction(quitAction); - - tray_icon->setContextMenu(tray_menu); - - tray_icon->show(); - - if (!trayOnly) - show(); - inTray = trayOnly; -} - - -void WpaGui::showTrayMessage(QSystemTrayIcon::MessageIcon type, int sec, - const QString & msg) -{ - if (!QSystemTrayIcon::supportsMessages()) - return; - - if (isVisible() || !tray_icon || !tray_icon->isVisible()) - return; - - tray_icon->showMessage(qAppName(), msg, type, sec * 1000); -} - - -void WpaGui::trayActivated(QSystemTrayIcon::ActivationReason how) - { - switch (how) { - /* use close() here instead of hide() and allow the - * custom closeEvent handler take care of children */ - case QSystemTrayIcon::Trigger: - ackTrayIcon = true; - if (isVisible()) { - close(); - inTray = true; - } else { - show(); - inTray = false; - } - break; - case QSystemTrayIcon::MiddleClick: - showTrayStatus(); - break; - default: - break; - } -} - - -void WpaGui::showTrayStatus() -{ - char buf[2048]; - size_t len; - - len = sizeof(buf) - 1; - if (ctrlRequest("STATUS", buf, &len) < 0) - return; - buf[len] = '\0'; - - QString msg, status(buf); - - QStringList lines = status.split(QRegExp("\\n")); - for (QStringList::Iterator it = lines.begin(); - it != lines.end(); it++) { - int pos = (*it).indexOf('=') + 1; - if (pos < 1) - continue; - - if ((*it).startsWith("bssid=")) - msg.append("BSSID:\t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("ssid=")) - msg.append("SSID: \t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("pairwise_cipher=")) - msg.append("PAIR: \t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("group_cipher=")) - msg.append("GROUP:\t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("key_mgmt=")) - msg.append("AUTH: \t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("wpa_state=")) - msg.append("STATE:\t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("ip_address=")) - msg.append("IP: \t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("Supplicant PAE state=")) - msg.append("PAE: \t" + (*it).mid(pos) + "\n"); - else if ((*it).startsWith("EAP state=")) - msg.append("EAP: \t" + (*it).mid(pos) + "\n"); - } - - if (!msg.isEmpty()) - showTrayMessage(QSystemTrayIcon::Information, 10, msg); -} - - -void WpaGui::closeEvent(QCloseEvent *event) -{ - if (eh) { - eh->close(); - delete eh; - eh = NULL; - } - - if (scanres) { - scanres->close(); - delete scanres; - scanres = NULL; - } - - if (peers) { - peers->close(); - delete peers; - peers = NULL; - } - - if (udr) { - udr->close(); - delete udr; - udr = NULL; - } - - if (tray_icon && !ackTrayIcon) { - /* give user a visual hint that the tray icon exists */ - if (QSystemTrayIcon::supportsMessages()) { - hide(); - showTrayMessage(QSystemTrayIcon::Information, 3, - qAppName() + - tr(" will keep running in " - "the system tray.")); - } else { - QMessageBox::information(this, qAppName() + - tr(" systray"), - tr("The program will keep " - "running in the system " - "tray.")); - } - ackTrayIcon = true; - } - - event->accept(); -} - - -void WpaGui::wpsDialog() -{ - wpaguiTab->setCurrentWidget(wpsTab); -} - - -void WpaGui::peersDialog() -{ - if (peers) { - peers->close(); - delete peers; - } - - peers = new Peers(); - if (peers == NULL) - return; - peers->setWpaGui(this); - peers->show(); - peers->exec(); -} - - -void WpaGui::tabChanged(int index) -{ - if (index != 2) - return; - - if (wpsRunning) - return; - - wpsApPinEdit->setEnabled(!bssFromScan.isEmpty()); - if (bssFromScan.isEmpty()) - wpsApPinButton->setEnabled(false); -} - - -void WpaGui::wpsPbc() -{ - char reply[20]; - size_t reply_len = sizeof(reply); - - if (ctrlRequest("WPS_PBC", reply, &reply_len) < 0) - return; - - wpsPinEdit->setEnabled(false); - if (wpsStatusText->text().compare(tr("WPS AP in active PBC mode found"))) { - wpsInstructions->setText(tr("Press the push button on the AP to " - "start the PBC mode.")); - } else { - wpsInstructions->setText(tr("If you have not yet done so, press " - "the push button on the AP to start " - "the PBC mode.")); - } - wpsStatusText->setText(tr("Waiting for Registrar")); - wpsRunning = true; -} - - -void WpaGui::wpsGeneratePin() -{ - char reply[20]; - size_t reply_len = sizeof(reply) - 1; - - if (ctrlRequest("WPS_PIN any", reply, &reply_len) < 0) - return; - - reply[reply_len] = '\0'; - - wpsPinEdit->setText(reply); - wpsPinEdit->setEnabled(true); - wpsInstructions->setText(tr("Enter the generated PIN into the Registrar " - "(either the internal one in the AP or an " - "external one).")); - wpsStatusText->setText(tr("Waiting for Registrar")); - wpsRunning = true; -} - - -void WpaGui::setBssFromScan(const QString &bssid) -{ - bssFromScan = bssid; - wpsApPinEdit->setEnabled(!bssFromScan.isEmpty()); - wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8); - wpsStatusText->setText(tr("WPS AP selected from scan results")); - wpsInstructions->setText(tr("If you want to use an AP device PIN, e.g., " - "from a label in the device, enter the eight " - "digit AP PIN and click Use AP PIN button.")); -} - - -void WpaGui::wpsApPinChanged(const QString &text) -{ - wpsApPinButton->setEnabled(text.length() == 8); -} - - -void WpaGui::wpsApPin() -{ - char reply[20]; - size_t reply_len = sizeof(reply); - - QString cmd("WPS_REG " + bssFromScan + " " + wpsApPinEdit->text()); - if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0) - return; - - wpsStatusText->setText(tr("Waiting for AP/Enrollee")); - wpsRunning = true; -} - - -void WpaGui::stopWpsRun(bool success) -{ - if (wpsRunning) - wpsStatusText->setText(success ? tr("Connected to the network") : - tr("Stopped")); - else - wpsStatusText->setText(""); - wpsPinEdit->setEnabled(false); - wpsInstructions->setText(""); - wpsRunning = false; - bssFromScan = ""; - wpsApPinEdit->setEnabled(false); - wpsApPinButton->setEnabled(false); -} - - -#ifdef CONFIG_NATIVE_WINDOWS - -#ifndef WPASVC_NAME -#define WPASVC_NAME TEXT("wpasvc") -#endif - -class ErrorMsg : public QMessageBox { -public: - ErrorMsg(QWidget *parent, DWORD last_err = GetLastError()); - void showMsg(QString msg); -private: - DWORD err; -}; - -ErrorMsg::ErrorMsg(QWidget *parent, DWORD last_err) : - QMessageBox(parent), err(last_err) -{ - setWindowTitle(tr("wpa_gui error")); - setIcon(QMessageBox::Warning); -} - -void ErrorMsg::showMsg(QString msg) -{ - LPTSTR buf; - - setText(msg); - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, err, 0, (LPTSTR) (void *) &buf, - 0, NULL) > 0) { - QString msg = QString::fromWCharArray(buf); - setInformativeText(QString("[%1] %2").arg(err).arg(msg)); - LocalFree(buf); - } else { - setInformativeText(QString("[%1]").arg(err)); - } - - exec(); -} - - -void WpaGui::startService() -{ - SC_HANDLE svc, scm; - - scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); - if (!scm) { - ErrorMsg(this).showMsg(tr("OpenSCManager failed")); - return; - } - - svc = OpenService(scm, WPASVC_NAME, SERVICE_START); - if (!svc) { - ErrorMsg(this).showMsg(tr("OpenService failed")); - CloseServiceHandle(scm); - return; - } - - if (!StartService(svc, 0, NULL)) { - ErrorMsg(this).showMsg(tr("Failed to start wpa_supplicant " - "service")); - } - - CloseServiceHandle(svc); - CloseServiceHandle(scm); -} - - -void WpaGui::stopService() -{ - SC_HANDLE svc, scm; - SERVICE_STATUS status; - - scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); - if (!scm) { - ErrorMsg(this).showMsg(tr("OpenSCManager failed")); - return; - } - - svc = OpenService(scm, WPASVC_NAME, SERVICE_STOP); - if (!svc) { - ErrorMsg(this).showMsg(tr("OpenService failed")); - CloseServiceHandle(scm); - return; - } - - if (!ControlService(svc, SERVICE_CONTROL_STOP, &status)) { - ErrorMsg(this).showMsg(tr("Failed to stop wpa_supplicant " - "service")); - } - - CloseServiceHandle(svc); - CloseServiceHandle(scm); -} - - -bool WpaGui::serviceRunning() -{ - SC_HANDLE svc, scm; - SERVICE_STATUS status; - bool running = false; - - scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); - if (!scm) { - printf("OpenSCManager failed: %d\n", (int) GetLastError()); - return false; - } - - svc = OpenService(scm, WPASVC_NAME, SERVICE_QUERY_STATUS); - if (!svc) { - printf("OpenService failed: %d\n\n", (int) GetLastError()); - CloseServiceHandle(scm); - return false; - } - - if (QueryServiceStatus(svc, &status)) { - if (status.dwCurrentState != SERVICE_STOPPED) - running = true; - } - - CloseServiceHandle(svc); - CloseServiceHandle(scm); - - return running; -} - -#endif /* CONFIG_NATIVE_WINDOWS */ - - -void WpaGui::addInterface() -{ - if (add_iface) { - add_iface->close(); - delete add_iface; - } - add_iface = new AddInterface(this, this); - add_iface->show(); - add_iface->exec(); -} - - -#ifndef QT_NO_SESSIONMANAGER -void WpaGui::saveState() -{ - QSettings settings("wpa_supplicant", "wpa_gui"); - settings.beginGroup("state"); - settings.setValue("session_id", app->sessionId()); - settings.setValue("in_tray", inTray); - settings.endGroup(); -} -#endif +/* + * wpa_gui - WpaGui class + * Copyright (c) 2005-2011, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifdef __MINGW32__ +/* Need to get getopt() */ +#include +#endif + +#ifdef CONFIG_NATIVE_WINDOWS +#include +#endif /* CONFIG_NATIVE_WINDOWS */ + +#include +#include +#include +#include +#include + +#include "wpagui.h" +#include "dirent.h" +#include "common/wpa_ctrl.h" +#include "userdatarequest.h" +#include "networkconfig.h" + +#if 1 +/* Silence stdout */ +#define printf wpagui_printf +static int wpagui_printf(const char *, ...) +{ + return 0; +} +#endif + +WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags) + : QMainWindow(parent), app(_app) +{ + setupUi(this); + +#ifdef CONFIG_NATIVE_WINDOWS + fileStopServiceAction = new QAction(this); + fileStopServiceAction->setObjectName("Stop Service"); + fileStopServiceAction->setIconText(tr("Stop Service")); + fileMenu->insertAction(actionWPS, fileStopServiceAction); + + fileStartServiceAction = new QAction(this); + fileStartServiceAction->setObjectName("Start Service"); + fileStartServiceAction->setIconText(tr("Start Service")); + fileMenu->insertAction(fileStopServiceAction, fileStartServiceAction); + + connect(fileStartServiceAction, SIGNAL(triggered()), this, + SLOT(startService())); + connect(fileStopServiceAction, SIGNAL(triggered()), this, + SLOT(stopService())); + + addInterfaceAction = new QAction(this); + addInterfaceAction->setIconText(tr("Add Interface")); + fileMenu->insertAction(fileStartServiceAction, addInterfaceAction); + + connect(addInterfaceAction, SIGNAL(triggered()), this, + SLOT(addInterface())); +#endif /* CONFIG_NATIVE_WINDOWS */ + + (void) statusBar(); + + /* + * Disable WPS tab by default; it will be enabled if wpa_supplicant is + * built with WPS support. + */ + wpsTab->setEnabled(false); + wpaguiTab->setTabEnabled(wpaguiTab->indexOf(wpsTab), false); + + connect(fileEventHistoryAction, SIGNAL(triggered()), this, + SLOT(eventHistory())); + connect(fileSaveConfigAction, SIGNAL(triggered()), this, + SLOT(saveConfig())); + connect(actionWPS, SIGNAL(triggered()), this, SLOT(wpsDialog())); + connect(actionPeers, SIGNAL(triggered()), this, SLOT(peersDialog())); + connect(fileExitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(networkAddAction, SIGNAL(triggered()), this, + SLOT(addNetwork())); + connect(networkEditAction, SIGNAL(triggered()), this, + SLOT(editSelectedNetwork())); + connect(networkRemoveAction, SIGNAL(triggered()), this, + SLOT(removeSelectedNetwork())); + connect(networkEnableAllAction, SIGNAL(triggered()), this, + SLOT(enableAllNetworks())); + connect(networkDisableAllAction, SIGNAL(triggered()), this, + SLOT(disableAllNetworks())); + connect(networkRemoveAllAction, SIGNAL(triggered()), this, + SLOT(removeAllNetworks())); + connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex())); + connect(helpContentsAction, SIGNAL(triggered()), this, + SLOT(helpContents())); + connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout())); + connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect())); + connect(scanButton, SIGNAL(clicked()), this, SLOT(scan())); + connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB())); + connect(adapterSelect, SIGNAL(activated(const QString&)), this, + SLOT(selectAdapter(const QString&))); + connect(networkSelect, SIGNAL(activated(const QString&)), this, + SLOT(selectNetwork(const QString&))); + connect(addNetworkButton, SIGNAL(clicked()), this, SLOT(addNetwork())); + connect(editNetworkButton, SIGNAL(clicked()), this, + SLOT(editListedNetwork())); + connect(removeNetworkButton, SIGNAL(clicked()), this, + SLOT(removeListedNetwork())); + connect(networkList, SIGNAL(itemSelectionChanged()), this, + SLOT(updateNetworkDisabledStatus())); + connect(enableRadioButton, SIGNAL(toggled(bool)), this, + SLOT(enableListedNetwork(bool))); + connect(disableRadioButton, SIGNAL(toggled(bool)), this, + SLOT(disableListedNetwork(bool))); + connect(scanNetworkButton, SIGNAL(clicked()), this, SLOT(scan())); + connect(networkList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), + this, SLOT(editListedNetwork())); + connect(wpaguiTab, SIGNAL(currentChanged(int)), this, + SLOT(tabChanged(int))); + connect(wpsPbcButton, SIGNAL(clicked()), this, SLOT(wpsPbc())); + connect(wpsPinButton, SIGNAL(clicked()), this, SLOT(wpsGeneratePin())); + connect(wpsApPinEdit, SIGNAL(textChanged(const QString &)), this, + SLOT(wpsApPinChanged(const QString &))); + connect(wpsApPinButton, SIGNAL(clicked()), this, SLOT(wpsApPin())); + + eh = NULL; + scanres = NULL; + peers = NULL; + add_iface = NULL; + udr = NULL; + tray_icon = NULL; + startInTray = false; + ctrl_iface = NULL; + ctrl_conn = NULL; + monitor_conn = NULL; + msgNotifier = NULL; + ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); + + parse_argv(); + +#ifndef QT_NO_SESSIONMANAGER + if (app->isSessionRestored()) { + QSettings settings("wpa_supplicant", "wpa_gui"); + settings.beginGroup("state"); + if (app->sessionId().compare(settings.value("session_id"). + toString()) == 0) + startInTray = settings.value("in_tray").toBool(); + settings.endGroup(); + } +#endif + + if (QSystemTrayIcon::isSystemTrayAvailable()) + createTrayIcon(startInTray); + else + show(); + + connectedToService = false; + textStatus->setText(tr("connecting to wpa_supplicant")); + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), SLOT(ping())); + timer->setSingleShot(FALSE); + timer->start(1000); + + if (openCtrlConnection(ctrl_iface) < 0) { + printf("Failed to open control connection to " + "wpa_supplicant.\n"); + } + + updateStatus(); + networkMayHaveChanged = true; + updateNetworks(); +} + + +WpaGui::~WpaGui() +{ + delete msgNotifier; + + if (monitor_conn) { + wpa_ctrl_detach(monitor_conn); + wpa_ctrl_close(monitor_conn); + monitor_conn = NULL; + } + if (ctrl_conn) { + wpa_ctrl_close(ctrl_conn); + ctrl_conn = NULL; + } + + if (eh) { + eh->close(); + delete eh; + eh = NULL; + } + + if (scanres) { + scanres->close(); + delete scanres; + scanres = NULL; + } + + if (peers) { + peers->close(); + delete peers; + peers = NULL; + } + + if (add_iface) { + add_iface->close(); + delete add_iface; + add_iface = NULL; + } + + if (udr) { + udr->close(); + delete udr; + udr = NULL; + } + + free(ctrl_iface); + ctrl_iface = NULL; + + free(ctrl_iface_dir); + ctrl_iface_dir = NULL; +} + + +void WpaGui::languageChange() +{ + retranslateUi(this); +} + + +void WpaGui::parse_argv() +{ + int c; + for (;;) { + c = getopt(qApp->argc(), qApp->argv(), "i:p:t"); + if (c < 0) + break; + switch (c) { + case 'i': + free(ctrl_iface); + ctrl_iface = strdup(optarg); + break; + case 'p': + free(ctrl_iface_dir); + ctrl_iface_dir = strdup(optarg); + break; + case 't': + startInTray = true; + break; + } + } +} + + +int WpaGui::openCtrlConnection(const char *ifname) +{ + char *cfile; + int flen; + char buf[2048], *pos, *pos2; + size_t len; + + if (ifname) { + if (ifname != ctrl_iface) { + free(ctrl_iface); + ctrl_iface = strdup(ifname); + } + } else { +#ifdef CONFIG_CTRL_IFACE_UDP + free(ctrl_iface); + ctrl_iface = strdup("udp"); +#endif /* CONFIG_CTRL_IFACE_UDP */ +#ifdef CONFIG_CTRL_IFACE_UNIX + struct dirent *dent; + DIR *dir = opendir(ctrl_iface_dir); + free(ctrl_iface); + ctrl_iface = NULL; + if (dir) { + while ((dent = readdir(dir))) { +#ifdef _DIRENT_HAVE_D_TYPE + /* Skip the file if it is not a socket. + * Also accept DT_UNKNOWN (0) in case + * the C library or underlying file + * system does not support d_type. */ + if (dent->d_type != DT_SOCK && + dent->d_type != DT_UNKNOWN) + continue; +#endif /* _DIRENT_HAVE_D_TYPE */ + + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) + continue; + printf("Selected interface '%s'\n", + dent->d_name); + ctrl_iface = strdup(dent->d_name); + break; + } + closedir(dir); + } +#endif /* CONFIG_CTRL_IFACE_UNIX */ +#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE + struct wpa_ctrl *ctrl; + int ret; + + free(ctrl_iface); + ctrl_iface = NULL; + + ctrl = wpa_ctrl_open(NULL); + if (ctrl) { + len = sizeof(buf) - 1; + ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf, + &len, NULL); + if (ret >= 0) { + connectedToService = true; + buf[len] = '\0'; + pos = strchr(buf, '\n'); + if (pos) + *pos = '\0'; + ctrl_iface = strdup(buf); + } + wpa_ctrl_close(ctrl); + } +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ + } + + if (ctrl_iface == NULL) { +#ifdef CONFIG_NATIVE_WINDOWS + static bool first = true; + if (first && !serviceRunning()) { + first = false; + if (QMessageBox::warning( + this, qAppName(), + tr("wpa_supplicant service is not " + "running.\n" + "Do you want to start it?"), + QMessageBox::Yes | QMessageBox::No) == + QMessageBox::Yes) + startService(); + } +#endif /* CONFIG_NATIVE_WINDOWS */ + return -1; + } + +#ifdef CONFIG_CTRL_IFACE_UNIX + flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2; + cfile = (char *) malloc(flen); + if (cfile == NULL) + return -1; + snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface); +#else /* CONFIG_CTRL_IFACE_UNIX */ + flen = strlen(ctrl_iface) + 1; + cfile = (char *) malloc(flen); + if (cfile == NULL) + return -1; + snprintf(cfile, flen, "%s", ctrl_iface); +#endif /* CONFIG_CTRL_IFACE_UNIX */ + + if (ctrl_conn) { + wpa_ctrl_close(ctrl_conn); + ctrl_conn = NULL; + } + + if (monitor_conn) { + delete msgNotifier; + msgNotifier = NULL; + wpa_ctrl_detach(monitor_conn); + wpa_ctrl_close(monitor_conn); + monitor_conn = NULL; + } + + printf("Trying to connect to '%s'\n", cfile); + ctrl_conn = wpa_ctrl_open(cfile); + if (ctrl_conn == NULL) { + free(cfile); + return -1; + } + monitor_conn = wpa_ctrl_open(cfile); + free(cfile); + if (monitor_conn == NULL) { + wpa_ctrl_close(ctrl_conn); + return -1; + } + if (wpa_ctrl_attach(monitor_conn)) { + printf("Failed to attach to wpa_supplicant\n"); + wpa_ctrl_close(monitor_conn); + monitor_conn = NULL; + wpa_ctrl_close(ctrl_conn); + ctrl_conn = NULL; + return -1; + } + +#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP) + msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn), + QSocketNotifier::Read, this); + connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs())); +#endif + + adapterSelect->clear(); + adapterSelect->addItem(ctrl_iface); + adapterSelect->setCurrentIndex(0); + + len = sizeof(buf) - 1; + if (wpa_ctrl_request(ctrl_conn, "INTERFACES", 10, buf, &len, NULL) >= + 0) { + buf[len] = '\0'; + pos = buf; + while (*pos) { + pos2 = strchr(pos, '\n'); + if (pos2) + *pos2 = '\0'; + if (strcmp(pos, ctrl_iface) != 0) + adapterSelect->addItem(pos); + if (pos2) + pos = pos2 + 1; + else + break; + } + } + + len = sizeof(buf) - 1; + if (wpa_ctrl_request(ctrl_conn, "GET_CAPABILITY eap", 18, buf, &len, + NULL) >= 0) { + buf[len] = '\0'; + + QString res(buf); + QStringList types = res.split(QChar(' ')); + bool wps = types.contains("WSC"); + actionWPS->setEnabled(wps); + wpsTab->setEnabled(wps); + wpaguiTab->setTabEnabled(wpaguiTab->indexOf(wpsTab), wps); + } + + return 0; +} + + +int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen) +{ + int ret; + + if (ctrl_conn == NULL) + return -3; + ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen, NULL); + if (ret == -2) + printf("'%s' command timed out.\n", cmd); + else if (ret < 0) + printf("'%s' command failed.\n", cmd); + + return ret; +} + + +QString WpaGui::wpaStateTranslate(char *state) +{ + if (!strcmp(state, "DISCONNECTED")) + return tr("Disconnected"); + else if (!strcmp(state, "INACTIVE")) + return tr("Inactive"); + else if (!strcmp(state, "SCANNING")) + return tr("Scanning"); + else if (!strcmp(state, "AUTHENTICATING")) + return tr("Authenticating"); + else if (!strcmp(state, "ASSOCIATING")) + return tr("Associating"); + else if (!strcmp(state, "ASSOCIATED")) + return tr("Associated"); + else if (!strcmp(state, "4WAY_HANDSHAKE")) + return tr("4-Way Handshake"); + else if (!strcmp(state, "GROUP_HANDSHAKE")) + return tr("Group Handshake"); + else if (!strcmp(state, "COMPLETED")) + return tr("Completed"); + else + return tr("Unknown"); +} + + +void WpaGui::updateStatus() +{ + char buf[2048], *start, *end, *pos; + size_t len; + + pingsToStatusUpdate = 10; + + len = sizeof(buf) - 1; + if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) { + textStatus->setText(tr("Could not get status from " + "wpa_supplicant")); + textAuthentication->clear(); + textEncryption->clear(); + textSsid->clear(); + textBssid->clear(); + textIpAddress->clear(); + +#ifdef CONFIG_NATIVE_WINDOWS + static bool first = true; + if (first && connectedToService && + (ctrl_iface == NULL || *ctrl_iface == '\0')) { + first = false; + if (QMessageBox::information( + this, qAppName(), + tr("No network interfaces in use.\n" + "Would you like to add one?"), + QMessageBox::Yes | QMessageBox::No) == + QMessageBox::Yes) + addInterface(); + } +#endif /* CONFIG_NATIVE_WINDOWS */ + return; + } + + buf[len] = '\0'; + + bool auth_updated = false, ssid_updated = false; + bool bssid_updated = false, ipaddr_updated = false; + bool status_updated = false; + char *pairwise_cipher = NULL, *group_cipher = NULL; + char *mode = NULL; + + start = buf; + while (*start) { + bool last = false; + end = strchr(start, '\n'); + if (end == NULL) { + last = true; + end = start; + while (end[0] && end[1]) + end++; + } + *end = '\0'; + + pos = strchr(start, '='); + if (pos) { + *pos++ = '\0'; + if (strcmp(start, "bssid") == 0) { + bssid_updated = true; + textBssid->setText(pos); + } else if (strcmp(start, "ssid") == 0) { + ssid_updated = true; + textSsid->setText(pos); + } else if (strcmp(start, "ip_address") == 0) { + ipaddr_updated = true; + textIpAddress->setText(pos); + } else if (strcmp(start, "wpa_state") == 0) { + status_updated = true; + textStatus->setText(wpaStateTranslate(pos)); + } else if (strcmp(start, "key_mgmt") == 0) { + auth_updated = true; + textAuthentication->setText(pos); + /* TODO: could add EAP status to this */ + } else if (strcmp(start, "pairwise_cipher") == 0) { + pairwise_cipher = pos; + } else if (strcmp(start, "group_cipher") == 0) { + group_cipher = pos; + } else if (strcmp(start, "mode") == 0) { + mode = pos; + } + } + + if (last) + break; + start = end + 1; + } + if (status_updated && mode) + textStatus->setText(textStatus->text() + " (" + mode + ")"); + + if (pairwise_cipher || group_cipher) { + QString encr; + if (pairwise_cipher && group_cipher && + strcmp(pairwise_cipher, group_cipher) != 0) { + encr.append(pairwise_cipher); + encr.append(" + "); + encr.append(group_cipher); + } else if (pairwise_cipher) { + encr.append(pairwise_cipher); + } else { + encr.append(group_cipher); + encr.append(" [group key only]"); + } + textEncryption->setText(encr); + } else + textEncryption->clear(); + + if (!status_updated) + textStatus->clear(); + if (!auth_updated) + textAuthentication->clear(); + if (!ssid_updated) + textSsid->clear(); + if (!bssid_updated) + textBssid->clear(); + if (!ipaddr_updated) + textIpAddress->clear(); +} + + +void WpaGui::updateNetworks() +{ + char buf[2048], *start, *end, *id, *ssid, *bssid, *flags; + size_t len; + int first_active = -1; + int was_selected = -1; + bool current = false; + + if (!networkMayHaveChanged) + return; + + if (networkList->currentRow() >= 0) + was_selected = networkList->currentRow(); + + networkSelect->clear(); + networkList->clear(); + + if (ctrl_conn == NULL) + return; + + len = sizeof(buf) - 1; + if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0) + return; + + buf[len] = '\0'; + start = strchr(buf, '\n'); + if (start == NULL) + return; + start++; + + while (*start) { + bool last = false; + end = strchr(start, '\n'); + if (end == NULL) { + last = true; + end = start; + while (end[0] && end[1]) + end++; + } + *end = '\0'; + + id = start; + ssid = strchr(id, '\t'); + if (ssid == NULL) + break; + *ssid++ = '\0'; + bssid = strchr(ssid, '\t'); + if (bssid == NULL) + break; + *bssid++ = '\0'; + flags = strchr(bssid, '\t'); + if (flags == NULL) + break; + *flags++ = '\0'; + + if (strstr(flags, "[DISABLED][P2P-PERSISTENT]")) { + if (last) + break; + start = end + 1; + continue; + } + + QString network(id); + network.append(": "); + network.append(ssid); + networkSelect->addItem(network); + networkList->addItem(network); + + if (strstr(flags, "[CURRENT]")) { + networkSelect->setCurrentIndex(networkSelect->count() - + 1); + current = true; + } else if (first_active < 0 && + strstr(flags, "[DISABLED]") == NULL) + first_active = networkSelect->count() - 1; + + if (last) + break; + start = end + 1; + } + + if (networkSelect->count() > 1) + networkSelect->addItem(tr("Select any network")); + + if (!current && first_active >= 0) + networkSelect->setCurrentIndex(first_active); + + if (was_selected >= 0 && networkList->count() > 0) { + if (was_selected < networkList->count()) + networkList->setCurrentRow(was_selected); + else + networkList->setCurrentRow(networkList->count() - 1); + } + else + networkList->setCurrentRow(networkSelect->currentIndex()); + + networkMayHaveChanged = false; +} + + +void WpaGui::helpIndex() +{ + printf("helpIndex\n"); +} + + +void WpaGui::helpContents() +{ + printf("helpContents\n"); +} + + +void WpaGui::helpAbout() +{ + QMessageBox::about(this, "wpa_gui for wpa_supplicant", + "Copyright (c) 2003-2011,\n" + "Jouni Malinen \n" + "and contributors.\n" + "\n" + "This program is free software. You can\n" + "distribute it and/or modify it under the terms " + "of\n" + "the GNU General Public License version 2.\n" + "\n" + "Alternatively, this software may be distributed\n" + "under the terms of the BSD license.\n" + "\n" + "This product includes software developed\n" + "by the OpenSSL Project for use in the\n" + "OpenSSL Toolkit (http://www.openssl.org/)\n"); +} + + +void WpaGui::disconnect() +{ + char reply[10]; + size_t reply_len = sizeof(reply); + ctrlRequest("DISCONNECT", reply, &reply_len); + stopWpsRun(false); +} + + +void WpaGui::scan() +{ + if (scanres) { + scanres->close(); + delete scanres; + } + + scanres = new ScanResults(); + if (scanres == NULL) + return; + scanres->setWpaGui(this); + scanres->show(); + scanres->exec(); +} + + +void WpaGui::eventHistory() +{ + if (eh) { + eh->close(); + delete eh; + } + + eh = new EventHistory(); + if (eh == NULL) + return; + eh->addEvents(msgs); + eh->show(); + eh->exec(); +} + + +void WpaGui::ping() +{ + char buf[10]; + size_t len; + +#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE + /* + * QSocketNotifier cannot be used with Windows named pipes, so use a + * timer to check for received messages for now. This could be + * optimized be doing something specific to named pipes or Windows + * events, but it is not clear what would be the best way of doing that + * in Qt. + */ + receiveMsgs(); +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ + + if (scanres && !scanres->isVisible()) { + delete scanres; + scanres = NULL; + } + + if (eh && !eh->isVisible()) { + delete eh; + eh = NULL; + } + + if (udr && !udr->isVisible()) { + delete udr; + udr = NULL; + } + + len = sizeof(buf) - 1; + if (ctrlRequest("PING", buf, &len) < 0) { + printf("PING failed - trying to reconnect\n"); + if (openCtrlConnection(ctrl_iface) >= 0) { + printf("Reconnected successfully\n"); + pingsToStatusUpdate = 0; + } + } + + pingsToStatusUpdate--; + if (pingsToStatusUpdate <= 0) { + updateStatus(); + updateNetworks(); + } + +#ifndef CONFIG_CTRL_IFACE_NAMED_PIPE + /* Use less frequent pings and status updates when the main window is + * hidden (running in taskbar). */ + int interval = isHidden() ? 5000 : 1000; + if (timer->interval() != interval) + timer->setInterval(interval); +#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ +} + + +static int str_match(const char *a, const char *b) +{ + return strncmp(a, b, strlen(b)) == 0; +} + + +void WpaGui::processMsg(char *msg) +{ + char *pos = msg, *pos2; + int priority = 2; + + if (*pos == '<') { + /* skip priority */ + pos++; + priority = atoi(pos); + pos = strchr(pos, '>'); + if (pos) + pos++; + else + pos = msg; + } + + WpaMsg wm(pos, priority); + if (eh) + eh->addEvent(wm); + if (peers) + peers->event_notify(wm); + msgs.append(wm); + while (msgs.count() > 100) + msgs.pop_front(); + + /* Update last message with truncated version of the event */ + if (strncmp(pos, "CTRL-", 5) == 0) { + pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' '); + if (pos2) + pos2++; + else + pos2 = pos; + } else + pos2 = pos; + QString lastmsg = pos2; + lastmsg.truncate(40); + textLastMessage->setText(lastmsg); + + pingsToStatusUpdate = 0; + networkMayHaveChanged = true; + + if (str_match(pos, WPA_CTRL_REQ)) + processCtrlReq(pos + strlen(WPA_CTRL_REQ)); + else if (str_match(pos, WPA_EVENT_SCAN_RESULTS) && scanres) + scanres->updateResults(); + else if (str_match(pos, WPA_EVENT_DISCONNECTED)) + showTrayMessage(QSystemTrayIcon::Information, 3, + tr("Disconnected from network.")); + else if (str_match(pos, WPA_EVENT_CONNECTED)) { + showTrayMessage(QSystemTrayIcon::Information, 3, + tr("Connection to network established.")); + QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus())); + stopWpsRun(true); + } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) { + wpsStatusText->setText(tr("WPS AP in active PBC mode found")); + if (textStatus->text() == "INACTIVE" || + textStatus->text() == "DISCONNECTED") + wpaguiTab->setCurrentWidget(wpsTab); + wpsInstructions->setText(tr("Press the PBC button on the " + "screen to start registration")); + } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PIN)) { + wpsStatusText->setText(tr("WPS AP with recently selected " + "registrar")); + if (textStatus->text() == "INACTIVE" || + textStatus->text() == "DISCONNECTED") + wpaguiTab->setCurrentWidget(wpsTab); + } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_AUTH)) { + showTrayMessage(QSystemTrayIcon::Information, 3, + "Wi-Fi Protected Setup (WPS) AP\n" + "indicating this client is authorized."); + wpsStatusText->setText("WPS AP indicating this client is " + "authorized"); + if (textStatus->text() == "INACTIVE" || + textStatus->text() == "DISCONNECTED") + wpaguiTab->setCurrentWidget(wpsTab); + } else if (str_match(pos, WPS_EVENT_AP_AVAILABLE)) { + wpsStatusText->setText(tr("WPS AP detected")); + } else if (str_match(pos, WPS_EVENT_OVERLAP)) { + wpsStatusText->setText(tr("PBC mode overlap detected")); + wpsInstructions->setText(tr("More than one AP is currently in " + "active WPS PBC mode. Wait couple " + "of minutes and try again")); + wpaguiTab->setCurrentWidget(wpsTab); + } else if (str_match(pos, WPS_EVENT_CRED_RECEIVED)) { + wpsStatusText->setText(tr("Network configuration received")); + wpaguiTab->setCurrentWidget(wpsTab); + } else if (str_match(pos, WPA_EVENT_EAP_METHOD)) { + if (strstr(pos, "(WSC)")) + wpsStatusText->setText(tr("Registration started")); + } else if (str_match(pos, WPS_EVENT_M2D)) { + wpsStatusText->setText(tr("Registrar does not yet know PIN")); + } else if (str_match(pos, WPS_EVENT_FAIL)) { + wpsStatusText->setText(tr("Registration failed")); + } else if (str_match(pos, WPS_EVENT_SUCCESS)) { + wpsStatusText->setText(tr("Registration succeeded")); + } +} + + +void WpaGui::processCtrlReq(const char *req) +{ + if (udr) { + udr->close(); + delete udr; + } + udr = new UserDataRequest(); + if (udr == NULL) + return; + if (udr->setParams(this, req) < 0) { + delete udr; + udr = NULL; + return; + } + udr->show(); + udr->exec(); +} + + +void WpaGui::receiveMsgs() +{ + char buf[256]; + size_t len; + + while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) { + len = sizeof(buf) - 1; + if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) { + buf[len] = '\0'; + processMsg(buf); + } + } +} + + +void WpaGui::connectB() +{ + char reply[10]; + size_t reply_len = sizeof(reply); + ctrlRequest("REASSOCIATE", reply, &reply_len); +} + + +void WpaGui::selectNetwork( const QString &sel ) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply); + + if (cmd.contains(QRegExp("^\\d+:"))) + cmd.truncate(cmd.indexOf(':')); + else + cmd = "any"; + cmd.prepend("SELECT_NETWORK "); + ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + triggerUpdate(); + stopWpsRun(false); +} + + +void WpaGui::enableNetwork(const QString &sel) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply); + + if (cmd.contains(QRegExp("^\\d+:"))) + cmd.truncate(cmd.indexOf(':')); + else if (!cmd.startsWith("all")) { + printf("Invalid editNetwork '%s'\n", + cmd.toAscii().constData()); + return; + } + cmd.prepend("ENABLE_NETWORK "); + ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + triggerUpdate(); +} + + +void WpaGui::disableNetwork(const QString &sel) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply); + + if (cmd.contains(QRegExp("^\\d+:"))) + cmd.truncate(cmd.indexOf(':')); + else if (!cmd.startsWith("all")) { + printf("Invalid editNetwork '%s'\n", + cmd.toAscii().constData()); + return; + } + cmd.prepend("DISABLE_NETWORK "); + ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + triggerUpdate(); +} + + +void WpaGui::editNetwork(const QString &sel) +{ + QString cmd(sel); + int id = -1; + + if (cmd.contains(QRegExp("^\\d+:"))) { + cmd.truncate(cmd.indexOf(':')); + id = cmd.toInt(); + } + + NetworkConfig *nc = new NetworkConfig(); + if (nc == NULL) + return; + nc->setWpaGui(this); + + if (id >= 0) + nc->paramsFromConfig(id); + else + nc->newNetwork(); + + nc->show(); + nc->exec(); +} + + +void WpaGui::editSelectedNetwork() +{ + if (networkSelect->count() < 1) { + QMessageBox::information( + this, tr("No Networks"), + tr("There are no networks to edit.\n")); + return; + } + QString sel(networkSelect->currentText()); + editNetwork(sel); +} + + +void WpaGui::editListedNetwork() +{ + if (networkList->currentRow() < 0) { + QMessageBox::information(this, tr("Select A Network"), + tr("Select a network from the list to" + " edit it.\n")); + return; + } + QString sel(networkList->currentItem()->text()); + editNetwork(sel); +} + + +void WpaGui::triggerUpdate() +{ + updateStatus(); + networkMayHaveChanged = true; + updateNetworks(); +} + + +void WpaGui::addNetwork() +{ + NetworkConfig *nc = new NetworkConfig(); + if (nc == NULL) + return; + nc->setWpaGui(this); + nc->newNetwork(); + nc->show(); + nc->exec(); +} + + +void WpaGui::removeNetwork(const QString &sel) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply); + + if (cmd.contains(QRegExp("^\\d+:"))) + cmd.truncate(cmd.indexOf(':')); + else if (!cmd.startsWith("all")) { + printf("Invalid editNetwork '%s'\n", + cmd.toAscii().constData()); + return; + } + cmd.prepend("REMOVE_NETWORK "); + ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + triggerUpdate(); +} + + +void WpaGui::removeSelectedNetwork() +{ + if (networkSelect->count() < 1) { + QMessageBox::information(this, tr("No Networks"), + tr("There are no networks to remove." + "\n")); + return; + } + QString sel(networkSelect->currentText()); + removeNetwork(sel); +} + + +void WpaGui::removeListedNetwork() +{ + if (networkList->currentRow() < 0) { + QMessageBox::information(this, tr("Select A Network"), + tr("Select a network from the list " + "to remove it.\n")); + return; + } + QString sel(networkList->currentItem()->text()); + removeNetwork(sel); +} + + +void WpaGui::enableAllNetworks() +{ + QString sel("all"); + enableNetwork(sel); +} + + +void WpaGui::disableAllNetworks() +{ + QString sel("all"); + disableNetwork(sel); +} + + +void WpaGui::removeAllNetworks() +{ + QString sel("all"); + removeNetwork(sel); +} + + +int WpaGui::getNetworkDisabled(const QString &sel) +{ + QString cmd(sel); + char reply[10]; + size_t reply_len = sizeof(reply) - 1; + int pos = cmd.indexOf(':'); + if (pos < 0) { + printf("Invalid getNetworkDisabled '%s'\n", + cmd.toAscii().constData()); + return -1; + } + cmd.truncate(pos); + cmd.prepend("GET_NETWORK "); + cmd.append(" disabled"); + + if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) >= 0 + && reply_len >= 1) { + reply[reply_len] = '\0'; + if (!str_match(reply, "FAIL")) + return atoi(reply); + } + + return -1; +} + + +void WpaGui::updateNetworkDisabledStatus() +{ + if (networkList->currentRow() < 0) + return; + + QString sel(networkList->currentItem()->text()); + + switch (getNetworkDisabled(sel)) { + case 0: + if (!enableRadioButton->isChecked()) + enableRadioButton->setChecked(true); + return; + case 1: + if (!disableRadioButton->isChecked()) + disableRadioButton->setChecked(true); + return; + } +} + + +void WpaGui::enableListedNetwork(bool enabled) +{ + if (networkList->currentRow() < 0 || !enabled) + return; + + QString sel(networkList->currentItem()->text()); + + if (getNetworkDisabled(sel) == 1) + enableNetwork(sel); +} + + +void WpaGui::disableListedNetwork(bool disabled) +{ + if (networkList->currentRow() < 0 || !disabled) + return; + + QString sel(networkList->currentItem()->text()); + + if (getNetworkDisabled(sel) == 0) + disableNetwork(sel); +} + + +void WpaGui::saveConfig() +{ + char buf[10]; + size_t len; + + len = sizeof(buf) - 1; + ctrlRequest("SAVE_CONFIG", buf, &len); + + buf[len] = '\0'; + + if (str_match(buf, "FAIL")) + QMessageBox::warning( + this, tr("Failed to save configuration"), + tr("The configuration could not be saved.\n" + "\n" + "The update_config=1 configuration option\n" + "must be used for configuration saving to\n" + "be permitted.\n")); + else + QMessageBox::information( + this, tr("Saved configuration"), + tr("The current configuration was saved." + "\n")); +} + + +void WpaGui::selectAdapter( const QString & sel ) +{ + if (openCtrlConnection(sel.toAscii().constData()) < 0) + printf("Failed to open control connection to " + "wpa_supplicant.\n"); + updateStatus(); + updateNetworks(); +} + + +void WpaGui::createTrayIcon(bool trayOnly) +{ + QApplication::setQuitOnLastWindowClosed(false); + + tray_icon = new QSystemTrayIcon(this); + tray_icon->setToolTip(qAppName() + tr(" - wpa_supplicant user interface")); + if (QImageReader::supportedImageFormats().contains(QByteArray("svg"))) + tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg")); + else + tray_icon->setIcon(QIcon(":/icons/wpa_gui.png")); + + connect(tray_icon, + SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason))); + + ackTrayIcon = false; + + tray_menu = new QMenu(this); + + disconnectAction = new QAction(tr("&Disconnect"), this); + reconnectAction = new QAction(tr("Re&connect"), this); + connect(disconnectAction, SIGNAL(triggered()), this, + SLOT(disconnect())); + connect(reconnectAction, SIGNAL(triggered()), this, + SLOT(connectB())); + tray_menu->addAction(disconnectAction); + tray_menu->addAction(reconnectAction); + tray_menu->addSeparator(); + + eventAction = new QAction(tr("&Event History"), this); + scanAction = new QAction(tr("Scan &Results"), this); + statAction = new QAction(tr("S&tatus"), this); + connect(eventAction, SIGNAL(triggered()), this, SLOT(eventHistory())); + connect(scanAction, SIGNAL(triggered()), this, SLOT(scan())); + connect(statAction, SIGNAL(triggered()), this, SLOT(showTrayStatus())); + tray_menu->addAction(eventAction); + tray_menu->addAction(scanAction); + tray_menu->addAction(statAction); + tray_menu->addSeparator(); + + showAction = new QAction(tr("&Show Window"), this); + hideAction = new QAction(tr("&Hide Window"), this); + quitAction = new QAction(tr("&Quit"), this); + connect(showAction, SIGNAL(triggered()), this, SLOT(show())); + connect(hideAction, SIGNAL(triggered()), this, SLOT(hide())); + connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + tray_menu->addAction(showAction); + tray_menu->addAction(hideAction); + tray_menu->addSeparator(); + tray_menu->addAction(quitAction); + + tray_icon->setContextMenu(tray_menu); + + tray_icon->show(); + + if (!trayOnly) + show(); + inTray = trayOnly; +} + + +void WpaGui::showTrayMessage(QSystemTrayIcon::MessageIcon type, int sec, + const QString & msg) +{ + if (!QSystemTrayIcon::supportsMessages()) + return; + + if (isVisible() || !tray_icon || !tray_icon->isVisible()) + return; + + tray_icon->showMessage(qAppName(), msg, type, sec * 1000); +} + + +void WpaGui::trayActivated(QSystemTrayIcon::ActivationReason how) + { + switch (how) { + /* use close() here instead of hide() and allow the + * custom closeEvent handler take care of children */ + case QSystemTrayIcon::Trigger: + ackTrayIcon = true; + if (isVisible()) { + close(); + inTray = true; + } else { + show(); + inTray = false; + } + break; + case QSystemTrayIcon::MiddleClick: + showTrayStatus(); + break; + default: + break; + } +} + + +void WpaGui::showTrayStatus() +{ + char buf[2048]; + size_t len; + + len = sizeof(buf) - 1; + if (ctrlRequest("STATUS", buf, &len) < 0) + return; + buf[len] = '\0'; + + QString msg, status(buf); + + QStringList lines = status.split(QRegExp("\\n")); + for (QStringList::Iterator it = lines.begin(); + it != lines.end(); it++) { + int pos = (*it).indexOf('=') + 1; + if (pos < 1) + continue; + + if ((*it).startsWith("bssid=")) + msg.append("BSSID:\t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("ssid=")) + msg.append("SSID: \t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("pairwise_cipher=")) + msg.append("PAIR: \t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("group_cipher=")) + msg.append("GROUP:\t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("key_mgmt=")) + msg.append("AUTH: \t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("wpa_state=")) + msg.append("STATE:\t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("ip_address=")) + msg.append("IP: \t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("Supplicant PAE state=")) + msg.append("PAE: \t" + (*it).mid(pos) + "\n"); + else if ((*it).startsWith("EAP state=")) + msg.append("EAP: \t" + (*it).mid(pos) + "\n"); + } + + if (!msg.isEmpty()) + showTrayMessage(QSystemTrayIcon::Information, 10, msg); +} + + +void WpaGui::closeEvent(QCloseEvent *event) +{ + if (eh) { + eh->close(); + delete eh; + eh = NULL; + } + + if (scanres) { + scanres->close(); + delete scanres; + scanres = NULL; + } + + if (peers) { + peers->close(); + delete peers; + peers = NULL; + } + + if (udr) { + udr->close(); + delete udr; + udr = NULL; + } + + if (tray_icon && !ackTrayIcon) { + /* give user a visual hint that the tray icon exists */ + if (QSystemTrayIcon::supportsMessages()) { + hide(); + showTrayMessage(QSystemTrayIcon::Information, 3, + qAppName() + + tr(" will keep running in " + "the system tray.")); + } else { + QMessageBox::information(this, qAppName() + + tr(" systray"), + tr("The program will keep " + "running in the system " + "tray.")); + } + ackTrayIcon = true; + } + + event->accept(); +} + + +void WpaGui::wpsDialog() +{ + wpaguiTab->setCurrentWidget(wpsTab); +} + + +void WpaGui::peersDialog() +{ + if (peers) { + peers->close(); + delete peers; + } + + peers = new Peers(); + if (peers == NULL) + return; + peers->setWpaGui(this); + peers->show(); + peers->exec(); +} + + +void WpaGui::tabChanged(int index) +{ + if (index != 2) + return; + + if (wpsRunning) + return; + + wpsApPinEdit->setEnabled(!bssFromScan.isEmpty()); + if (bssFromScan.isEmpty()) + wpsApPinButton->setEnabled(false); +} + + +void WpaGui::wpsPbc() +{ + char reply[20]; + size_t reply_len = sizeof(reply); + + if (ctrlRequest("WPS_PBC", reply, &reply_len) < 0) + return; + + wpsPinEdit->setEnabled(false); + if (wpsStatusText->text().compare(tr("WPS AP in active PBC mode found"))) { + wpsInstructions->setText(tr("Press the push button on the AP to " + "start the PBC mode.")); + } else { + wpsInstructions->setText(tr("If you have not yet done so, press " + "the push button on the AP to start " + "the PBC mode.")); + } + wpsStatusText->setText(tr("Waiting for Registrar")); + wpsRunning = true; +} + + +void WpaGui::wpsGeneratePin() +{ + char reply[20]; + size_t reply_len = sizeof(reply) - 1; + + if (ctrlRequest("WPS_PIN any", reply, &reply_len) < 0) + return; + + reply[reply_len] = '\0'; + + wpsPinEdit->setText(reply); + wpsPinEdit->setEnabled(true); + wpsInstructions->setText(tr("Enter the generated PIN into the Registrar " + "(either the internal one in the AP or an " + "external one).")); + wpsStatusText->setText(tr("Waiting for Registrar")); + wpsRunning = true; +} + + +void WpaGui::setBssFromScan(const QString &bssid) +{ + bssFromScan = bssid; + wpsApPinEdit->setEnabled(!bssFromScan.isEmpty()); + wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8); + wpsStatusText->setText(tr("WPS AP selected from scan results")); + wpsInstructions->setText(tr("If you want to use an AP device PIN, e.g., " + "from a label in the device, enter the eight " + "digit AP PIN and click Use AP PIN button.")); +} + + +void WpaGui::wpsApPinChanged(const QString &text) +{ + wpsApPinButton->setEnabled(text.length() == 8); +} + + +void WpaGui::wpsApPin() +{ + char reply[20]; + size_t reply_len = sizeof(reply); + + QString cmd("WPS_REG " + bssFromScan + " " + wpsApPinEdit->text()); + if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0) + return; + + wpsStatusText->setText(tr("Waiting for AP/Enrollee")); + wpsRunning = true; +} + + +void WpaGui::stopWpsRun(bool success) +{ + if (wpsRunning) + wpsStatusText->setText(success ? tr("Connected to the network") : + tr("Stopped")); + else + wpsStatusText->setText(""); + wpsPinEdit->setEnabled(false); + wpsInstructions->setText(""); + wpsRunning = false; + bssFromScan = ""; + wpsApPinEdit->setEnabled(false); + wpsApPinButton->setEnabled(false); +} + + +#ifdef CONFIG_NATIVE_WINDOWS + +#ifndef WPASVC_NAME +#define WPASVC_NAME TEXT("wpasvc") +#endif + +class ErrorMsg : public QMessageBox { +public: + ErrorMsg(QWidget *parent, DWORD last_err = GetLastError()); + void showMsg(QString msg); +private: + DWORD err; +}; + +ErrorMsg::ErrorMsg(QWidget *parent, DWORD last_err) : + QMessageBox(parent), err(last_err) +{ + setWindowTitle(tr("wpa_gui error")); + setIcon(QMessageBox::Warning); +} + +void ErrorMsg::showMsg(QString msg) +{ + LPTSTR buf; + + setText(msg); + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, err, 0, (LPTSTR) (void *) &buf, + 0, NULL) > 0) { + QString msg = QString::fromWCharArray(buf); + setInformativeText(QString("[%1] %2").arg(err).arg(msg)); + LocalFree(buf); + } else { + setInformativeText(QString("[%1]").arg(err)); + } + + exec(); +} + + +void WpaGui::startService() +{ + SC_HANDLE svc, scm; + + scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); + if (!scm) { + ErrorMsg(this).showMsg(tr("OpenSCManager failed")); + return; + } + + svc = OpenService(scm, WPASVC_NAME, SERVICE_START); + if (!svc) { + ErrorMsg(this).showMsg(tr("OpenService failed")); + CloseServiceHandle(scm); + return; + } + + if (!StartService(svc, 0, NULL)) { + ErrorMsg(this).showMsg(tr("Failed to start wpa_supplicant " + "service")); + } + + CloseServiceHandle(svc); + CloseServiceHandle(scm); +} + + +void WpaGui::stopService() +{ + SC_HANDLE svc, scm; + SERVICE_STATUS status; + + scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); + if (!scm) { + ErrorMsg(this).showMsg(tr("OpenSCManager failed")); + return; + } + + svc = OpenService(scm, WPASVC_NAME, SERVICE_STOP); + if (!svc) { + ErrorMsg(this).showMsg(tr("OpenService failed")); + CloseServiceHandle(scm); + return; + } + + if (!ControlService(svc, SERVICE_CONTROL_STOP, &status)) { + ErrorMsg(this).showMsg(tr("Failed to stop wpa_supplicant " + "service")); + } + + CloseServiceHandle(svc); + CloseServiceHandle(scm); +} + + +bool WpaGui::serviceRunning() +{ + SC_HANDLE svc, scm; + SERVICE_STATUS status; + bool running = false; + + scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT); + if (!scm) { + printf("OpenSCManager failed: %d\n", (int) GetLastError()); + return false; + } + + svc = OpenService(scm, WPASVC_NAME, SERVICE_QUERY_STATUS); + if (!svc) { + printf("OpenService failed: %d\n\n", (int) GetLastError()); + CloseServiceHandle(scm); + return false; + } + + if (QueryServiceStatus(svc, &status)) { + if (status.dwCurrentState != SERVICE_STOPPED) + running = true; + } + + CloseServiceHandle(svc); + CloseServiceHandle(scm); + + return running; +} + +#endif /* CONFIG_NATIVE_WINDOWS */ + + +void WpaGui::addInterface() +{ + if (add_iface) { + add_iface->close(); + delete add_iface; + } + add_iface = new AddInterface(this, this); + add_iface->show(); + add_iface->exec(); +} + + +#ifndef QT_NO_SESSIONMANAGER +void WpaGui::saveState() +{ + QSettings settings("wpa_supplicant", "wpa_gui"); + settings.beginGroup("state"); + settings.setValue("session_id", app->sessionId()); + settings.setValue("in_tray", inTray); + settings.endGroup(); +} +#endif diff --git a/Network/wpa_gui-qt4_/wpagui.h b/Network/wpa_gui-qt4_/wpagui.h index 2e1af8e..8f68ecf 100644 --- a/Network/wpa_gui-qt4_/wpagui.h +++ b/Network/wpa_gui-qt4_/wpagui.h @@ -1,150 +1,150 @@ -/* - * wpa_gui - WpaGui class - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef WPAGUI_H -#define WPAGUI_H - -#include -#include -#include "ui_wpagui.h" -#include "addinterface.h" - -class UserDataRequest; - - -class WpaGui : public QMainWindow, public Ui::WpaGui -{ - Q_OBJECT - -public: - WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0, - Qt::WFlags fl = 0); - ~WpaGui(); - - virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); - virtual void triggerUpdate(); - virtual void editNetwork(const QString &sel); - virtual void removeNetwork(const QString &sel); - virtual void enableNetwork(const QString &sel); - virtual void disableNetwork(const QString &sel); - virtual int getNetworkDisabled(const QString &sel); - void setBssFromScan(const QString &bssid); -#ifndef QT_NO_SESSIONMANAGER - void saveState(); -#endif - -public slots: - virtual void parse_argv(); - virtual void updateStatus(); - virtual void updateNetworks(); - virtual void helpIndex(); - virtual void helpContents(); - virtual void helpAbout(); - virtual void disconnect(); - virtual void scan(); - virtual void eventHistory(); - virtual void ping(); - virtual void processMsg(char *msg); - virtual void processCtrlReq(const char *req); - virtual void receiveMsgs(); - virtual void connectB(); - virtual void selectNetwork(const QString &sel); - virtual void editSelectedNetwork(); - virtual void editListedNetwork(); - virtual void removeSelectedNetwork(); - virtual void removeListedNetwork(); - virtual void addNetwork(); - virtual void enableAllNetworks(); - virtual void disableAllNetworks(); - virtual void removeAllNetworks(); - virtual void saveConfig(); - virtual void selectAdapter(const QString &sel); - virtual void updateNetworkDisabledStatus(); - virtual void enableListedNetwork(bool); - virtual void disableListedNetwork(bool); - virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type, - int sec, const QString &msg); - virtual void showTrayStatus(); - virtual void wpsDialog(); - virtual void peersDialog(); - virtual void tabChanged(int index); - virtual void wpsPbc(); - virtual void wpsGeneratePin(); - virtual void wpsApPinChanged(const QString &text); - virtual void wpsApPin(); -#ifdef CONFIG_NATIVE_WINDOWS - virtual void startService(); - virtual void stopService(); -#endif /* CONFIG_NATIVE_WINDOWS */ - virtual void addInterface(); - -protected slots: - virtual void languageChange(); - virtual void trayActivated(QSystemTrayIcon::ActivationReason how); - virtual void closeEvent(QCloseEvent *event); - -private: - ScanResults *scanres; - Peers *peers; - bool networkMayHaveChanged; - char *ctrl_iface; - EventHistory *eh; - struct wpa_ctrl *ctrl_conn; - QSocketNotifier *msgNotifier; - QTimer *timer; - int pingsToStatusUpdate; - WpaMsgList msgs; - char *ctrl_iface_dir; - struct wpa_ctrl *monitor_conn; - UserDataRequest *udr; - QAction *disconnectAction; - QAction *reconnectAction; - QAction *eventAction; - QAction *scanAction; - QAction *statAction; - QAction *showAction; - QAction *hideAction; - QAction *quitAction; - QMenu *tray_menu; - QSystemTrayIcon *tray_icon; - QString wpaStateTranslate(char *state); - void createTrayIcon(bool); - bool ackTrayIcon; - bool startInTray; - - int openCtrlConnection(const char *ifname); - - bool wpsRunning; - - QString bssFromScan; - - void stopWpsRun(bool success); - -#ifdef CONFIG_NATIVE_WINDOWS - QAction *fileStartServiceAction; - QAction *fileStopServiceAction; - - bool serviceRunning(); -#endif /* CONFIG_NATIVE_WINDOWS */ - - QAction *addInterfaceAction; - AddInterface *add_iface; - - bool connectedToService; - - QApplication *app; - bool inTray; -}; - -#endif /* WPAGUI_H */ +/* + * wpa_gui - WpaGui class + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef WPAGUI_H +#define WPAGUI_H + +#include +#include +#include "ui_wpagui.h" +#include "addinterface.h" + +class UserDataRequest; + + +class WpaGui : public QMainWindow, public Ui::WpaGui +{ + Q_OBJECT + +public: + WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0, + Qt::WFlags fl = 0); + ~WpaGui(); + + virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); + virtual void triggerUpdate(); + virtual void editNetwork(const QString &sel); + virtual void removeNetwork(const QString &sel); + virtual void enableNetwork(const QString &sel); + virtual void disableNetwork(const QString &sel); + virtual int getNetworkDisabled(const QString &sel); + void setBssFromScan(const QString &bssid); +#ifndef QT_NO_SESSIONMANAGER + void saveState(); +#endif + +public slots: + virtual void parse_argv(); + virtual void updateStatus(); + virtual void updateNetworks(); + virtual void helpIndex(); + virtual void helpContents(); + virtual void helpAbout(); + virtual void disconnect(); + virtual void scan(); + virtual void eventHistory(); + virtual void ping(); + virtual void processMsg(char *msg); + virtual void processCtrlReq(const char *req); + virtual void receiveMsgs(); + virtual void connectB(); + virtual void selectNetwork(const QString &sel); + virtual void editSelectedNetwork(); + virtual void editListedNetwork(); + virtual void removeSelectedNetwork(); + virtual void removeListedNetwork(); + virtual void addNetwork(); + virtual void enableAllNetworks(); + virtual void disableAllNetworks(); + virtual void removeAllNetworks(); + virtual void saveConfig(); + virtual void selectAdapter(const QString &sel); + virtual void updateNetworkDisabledStatus(); + virtual void enableListedNetwork(bool); + virtual void disableListedNetwork(bool); + virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type, + int sec, const QString &msg); + virtual void showTrayStatus(); + virtual void wpsDialog(); + virtual void peersDialog(); + virtual void tabChanged(int index); + virtual void wpsPbc(); + virtual void wpsGeneratePin(); + virtual void wpsApPinChanged(const QString &text); + virtual void wpsApPin(); +#ifdef CONFIG_NATIVE_WINDOWS + virtual void startService(); + virtual void stopService(); +#endif /* CONFIG_NATIVE_WINDOWS */ + virtual void addInterface(); + +protected slots: + virtual void languageChange(); + virtual void trayActivated(QSystemTrayIcon::ActivationReason how); + virtual void closeEvent(QCloseEvent *event); + +private: + ScanResults *scanres; + Peers *peers; + bool networkMayHaveChanged; + char *ctrl_iface; + EventHistory *eh; + struct wpa_ctrl *ctrl_conn; + QSocketNotifier *msgNotifier; + QTimer *timer; + int pingsToStatusUpdate; + WpaMsgList msgs; + char *ctrl_iface_dir; + struct wpa_ctrl *monitor_conn; + UserDataRequest *udr; + QAction *disconnectAction; + QAction *reconnectAction; + QAction *eventAction; + QAction *scanAction; + QAction *statAction; + QAction *showAction; + QAction *hideAction; + QAction *quitAction; + QMenu *tray_menu; + QSystemTrayIcon *tray_icon; + QString wpaStateTranslate(char *state); + void createTrayIcon(bool); + bool ackTrayIcon; + bool startInTray; + + int openCtrlConnection(const char *ifname); + + bool wpsRunning; + + QString bssFromScan; + + void stopWpsRun(bool success); + +#ifdef CONFIG_NATIVE_WINDOWS + QAction *fileStartServiceAction; + QAction *fileStopServiceAction; + + bool serviceRunning(); +#endif /* CONFIG_NATIVE_WINDOWS */ + + QAction *addInterfaceAction; + AddInterface *add_iface; + + bool connectedToService; + + QApplication *app; + bool inTray; +}; + +#endif /* WPAGUI_H */ diff --git a/Network/wpa_gui-qt4_/wpagui.ui b/Network/wpa_gui-qt4_/wpagui.ui index 9f9039f..03bc51a 100644 --- a/Network/wpa_gui-qt4_/wpagui.ui +++ b/Network/wpa_gui-qt4_/wpagui.ui @@ -1,524 +1,524 @@ - - WpaGui - - - - 0 - 0 - 345 - 330 - - - - wpa_gui - - - - :/icons/wpa_gui.svg:/icons/wpa_gui.svg - - - - - - - Adapter: - - - - - - - - - - Network: - - - - - - - - - - 0 - - - - Current Status - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - Status: - - - - - - - Last message: - - - - - - - Authentication: - - - - - - - Encryption: - - - - - - - SSID: - - - - - - - BSSID: - - - - - - - IP address: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Connect - - - - - - - Disconnect - - - - - - - Scan - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Manage Networks - - - - - - true - - - - - - - Qt::Vertical - - - - 20 - 61 - - - - - - - - Enabled - - - - - - - Edit - - - - - - - Remove - - - - - - - Qt::Vertical - - - - 20 - 61 - - - - - - - - Disabled - - - - - - - Add - - - - - - - Scan - - - - - - - - WPS - - - - - - Status: - - - - - - - - - - - - - - PBC - push button - - - - - - - Generate PIN - - - - - - - PIN: - - - - - - - false - - - true - - - - - - - false - - - Use AP PIN - - - - - - - AP PIN: - - - - - - - false - - - - - - - true - - - - - - - - - - - - - 0 - 0 - 345 - 24 - - - - - &File - - - - - - - - - - - &Network - - - - - - - - - - - - &Help - - - - - - - - - - - - - Event &History - - - - - &Save Configuration - - - Ctrl+S - - - - - E&xit - - - Ctrl+Q - - - - - &Add - - - - - &Edit - - - - - &Remove - - - - - E&nable All - - - - - &Disable All - - - - - Re&move All - - - - - false - - - &Contents... - - - - - false - - - &Index... - - - - - &About - - - - - false - - - &Wi-Fi Protected Setup - - - - - &Peers - - - - - - - qtimer.h - qsocketnotifier.h - wpamsg.h - eventhistory.h - scanresults.h - peers.h - - - - - - + + WpaGui + + + + 0 + 0 + 345 + 330 + + + + wpa_gui + + + + :/icons/wpa_gui.svg:/icons/wpa_gui.svg + + + + + + + Adapter: + + + + + + + + + + Network: + + + + + + + + + + 0 + + + + Current Status + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + Status: + + + + + + + Last message: + + + + + + + Authentication: + + + + + + + Encryption: + + + + + + + SSID: + + + + + + + BSSID: + + + + + + + IP address: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Connect + + + + + + + Disconnect + + + + + + + Scan + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Manage Networks + + + + + + true + + + + + + + Qt::Vertical + + + + 20 + 61 + + + + + + + + Enabled + + + + + + + Edit + + + + + + + Remove + + + + + + + Qt::Vertical + + + + 20 + 61 + + + + + + + + Disabled + + + + + + + Add + + + + + + + Scan + + + + + + + + WPS + + + + + + Status: + + + + + + + + + + + + + + PBC - push button + + + + + + + Generate PIN + + + + + + + PIN: + + + + + + + false + + + true + + + + + + + false + + + Use AP PIN + + + + + + + AP PIN: + + + + + + + false + + + + + + + true + + + + + + + + + + + + + 0 + 0 + 345 + 24 + + + + + &File + + + + + + + + + + + &Network + + + + + + + + + + + + &Help + + + + + + + + + + + + + Event &History + + + + + &Save Configuration + + + Ctrl+S + + + + + E&xit + + + Ctrl+Q + + + + + &Add + + + + + &Edit + + + + + &Remove + + + + + E&nable All + + + + + &Disable All + + + + + Re&move All + + + + + false + + + &Contents... + + + + + false + + + &Index... + + + + + &About + + + + + false + + + &Wi-Fi Protected Setup + + + + + &Peers + + + + + + + qtimer.h + qsocketnotifier.h + wpamsg.h + eventhistory.h + scanresults.h + peers.h + + + + + + diff --git a/Network/wpa_gui-qt4_/wpamsg.h b/Network/wpa_gui-qt4_/wpamsg.h index 4950b21..62629b8 100644 --- a/Network/wpa_gui-qt4_/wpamsg.h +++ b/Network/wpa_gui-qt4_/wpamsg.h @@ -1,41 +1,41 @@ -/* - * wpa_gui - WpaMsg class for storing event messages - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef WPAMSG_H -#define WPAMSG_H - -#include -#include - -class WpaMsg { -public: - WpaMsg(const QString &_msg, int _priority = 2) - : msg(_msg), priority(_priority) - { - timestamp = QDateTime::currentDateTime(); - } - - QString getMsg() const { return msg; } - int getPriority() const { return priority; } - QDateTime getTimestamp() const { return timestamp; } - -private: - QString msg; - int priority; - QDateTime timestamp; -}; - -typedef QLinkedList WpaMsgList; - -#endif /* WPAMSG_H */ +/* + * wpa_gui - WpaMsg class for storing event messages + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef WPAMSG_H +#define WPAMSG_H + +#include +#include + +class WpaMsg { +public: + WpaMsg(const QString &_msg, int _priority = 2) + : msg(_msg), priority(_priority) + { + timestamp = QDateTime::currentDateTime(); + } + + QString getMsg() const { return msg; } + int getPriority() const { return priority; } + QDateTime getTimestamp() const { return timestamp; } + +private: + QString msg; + int priority; + QDateTime timestamp; +}; + +typedef QLinkedList WpaMsgList; + +#endif /* WPAMSG_H */ diff --git a/Network/wpamsg.h b/Network/wpamsg.h index 4950b21..62629b8 100644 --- a/Network/wpamsg.h +++ b/Network/wpamsg.h @@ -1,41 +1,41 @@ -/* - * wpa_gui - WpaMsg class for storing event messages - * Copyright (c) 2005-2006, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See README and COPYING for more details. - */ - -#ifndef WPAMSG_H -#define WPAMSG_H - -#include -#include - -class WpaMsg { -public: - WpaMsg(const QString &_msg, int _priority = 2) - : msg(_msg), priority(_priority) - { - timestamp = QDateTime::currentDateTime(); - } - - QString getMsg() const { return msg; } - int getPriority() const { return priority; } - QDateTime getTimestamp() const { return timestamp; } - -private: - QString msg; - int priority; - QDateTime timestamp; -}; - -typedef QLinkedList WpaMsgList; - -#endif /* WPAMSG_H */ +/* + * wpa_gui - WpaMsg class for storing event messages + * Copyright (c) 2005-2006, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef WPAMSG_H +#define WPAMSG_H + +#include +#include + +class WpaMsg { +public: + WpaMsg(const QString &_msg, int _priority = 2) + : msg(_msg), priority(_priority) + { + timestamp = QDateTime::currentDateTime(); + } + + QString getMsg() const { return msg; } + int getPriority() const { return priority; } + QDateTime getTimestamp() const { return timestamp; } + +private: + QString msg; + int priority; + QDateTime timestamp; +}; + +typedef QLinkedList WpaMsgList; + +#endif /* WPAMSG_H */ diff --git a/OtherInfo.cpp b/OtherInfo.cpp index 656d34b..82dd17d 100644 --- a/OtherInfo.cpp +++ b/OtherInfo.cpp @@ -1,278 +1,278 @@ -#include "OtherInfo.h" -#include "ui_otherinfo.h" -#include -#include -#include -#include -#include - -//#define FOR_ADJUST 0 -#define FOR_PHASE_ADJUST 1 -OtherInfo::OtherInfo(QWidget *parent) : - QWidget(parent), - ui(new Ui::OtherInfo) -{ - - ui->setupUi(this); - lockPhaseFlag = false; - lockedPhase = 0; - ui->memDisplayAndEdit->setHidden(1); - - ui->lab_enableChargeFullTime->setHidden(1); - ui->lab_phaseDetectDelay->setHidden(1); - ui->lab_phaseDetectVol->setHidden(1); - ui->lab_phaseHighLowRatio->setHidden(1); - ui->lab_phase_detect_pulse_num->setHidden(1); - - ui->checkBoxChargeFullTime->setHidden(1); - //ui->memDisplayAndEdit->setHidden(1); - ui->pushButtonLockPhase->setHidden(1); - //ui->spinBoxLockedPhase->setHidden(1); - //ui->spinBoxPhaseDetectVoltage->setEnabled(1); -#ifndef FOR_PHASE_ADJUST - ui->lab_phaseDetectVol->setHidden(1); - ui->spinBoxPhaseDetectVoltage->setHidden(1); - ui->spinBoxPhaseDetectVoltage->setEnabled(1); - //ui->spinBoxPhaseGroupValue->setHidden(1); - //ui->labelPhaseGroups->setHidden(1); - //ui->lab_phase_detect_pulse_num->setHidden(1); - ui->labelPhaseDetectNum->setHidden(1); - ui->spinBoxPhaseDetectDotNum->setHidden(1); - //ui->lab_phaseDetectDelay->setHidden(1); - ui->labelPhaseDetectDelay->setHidden(1); - ui->spinBoxPhaseDetectDelay->setHidden(1); -#else -#endif -} - -OtherInfo::~OtherInfo() -{ - delete ui; - -} -void OtherInfo::OtherupdateSysParaToUI(){ - updateSysParaToUI(); -} - -#define PHASE_BY_HAND_DIV 8 //相位会在逻辑里面放大 -void OtherInfo::bindSysPara(SysPara *sysPara){ - this->sysPara = sysPara; - ui->phaseGraphic->bindSysPara(sysPara); - ui->memDisplayAndEdit->bindSysPara(sysPara); - lockPhaseFlag = sysPara->para.phaseByHand != 0; - updateLockPhaseWidgets(); -} - -void OtherInfo::updateSysParaToUI(){ - if(sysPara){ - ui->spinBoxHighLowRatio->setValue(sysPara->para.phaseHighLowRatio); - ui->spinBoxPhaseDetectDotNum->setValue(sysPara->para.phase_detect_pulse_num); - ui->spinBoxPhaseDetectVoltage->setValue(sysPara->para.phaseDetectVol); - - ui->spinBoxPhaseDetectDelay->setValue(sysPara->para.phaseDetectDelay); - ui->spinBoxPhaseShift->setValue(sysPara->para.phaseShift); - ui->spinBoxBlickLightPeriod->setValue(sysPara->para.blinkLightPeriod); - ui->checkBoxChargeFullTime->setChecked(sysPara->para.enableChargeFullTime); - } -} - -void OtherInfo::onAuthChanged(int auth){ - //ui->memDisplayAndEdit->setShown(auth & AUTH_SUPER_USER2); - //ui->pushButtonLockPhase->setEnabled(auth & AUTH_SUPER_USER2); - //ui->pushButtonLockPhase->setShown(auth & AUTH_SUPER_USER2); - //ui->spinBoxLockedPhase->setShown(auth & AUTH_SUPER_USER2); - - - //ui->lab_enableChargeFullTime->setShown(auth & AUTH_SUPER_USER2); - //ui->lab_phaseDetectDelay->setShown(auth & AUTH_SUPER_USER2); - //ui->lab_phaseDetectVol->setShown(auth & AUTH_SUPER_USER2); - //ui->lab_phaseHighLowRatio->setShown(auth & AUTH_SUPER_USER2); - //ui->lab_phase_detect_pulse_num->setShown(auth & AUTH_SUPER_USER2); - - -} - -void OtherInfo::applyUIPara(){ - if(sysPara){ - sysPara->para.phaseHighLowRatio = ui->spinBoxHighLowRatio->value();//界面上是相检, 占空比 - //sysPara->para.phase_detect_pulse_num = 6;// ui->spinBoxPhaseDetectDotNum->value(); - sysPara->para.phase_detect_pulse_num = ui->spinBoxPhaseDetectDotNum->value(); -#ifndef FOR_PHASE_ADJUST - sysPara->para.phase_detect_pulse_num = 7; - sysPara->para.phaseDetectVol = 35; //ui->spinBoxPhaseDetectVoltage->value(); - sysPara->para.phaseDetectDelay = 100;// ui->spinBoxPhaseDetectDelay->value(); -#else - sysPara->para.phaseDetectVol = ui->spinBoxPhaseDetectVoltage->value(); - sysPara->para.phaseDetectDelay = ui->spinBoxPhaseDetectDelay->value(); - sysPara->para.phase_detect_pulse_num = ui->spinBoxPhaseDetectDotNum->value(); -#endif - sysPara->para.phaseShift = ui->spinBoxPhaseShift->value(); - //qDebug()<<"shift:"<para.phaseShift; - //qDebug()<<"shift:0x"<para.phaseShift, 0, 16); - sysPara->para.blinkLightPeriod = ui->spinBoxBlickLightPeriod->value(); - sysPara->para.enableChargeFullTime = 1;//ui->checkBoxChargeFullTime->isChecked()?1:0; - // 由FPGA 设置 - if(sysPara->devOp->writeFpgaPrintPara() != -1) - QMessageBox::information(this,tr("提示"),tr("应用成功")); - - } -} -void OtherInfo::phaseDetectResultRecord(void){ - if(!memcmp(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult))){ - return; - } - sysPara->devOp->readPhaseDetectHighTm(); - QFile phaseRecordFile("/home/plg/doc/phaseDetectResultRecord.txt"); - if (!phaseRecordFile.exists()) { - if (phaseRecordFile.open(QFile::WriteOnly | QFile::Truncate)) { - QTextStream out(&phaseRecordFile); - out << "time"<< "," - << "flight_tm"<< "," - << "phase"<< "," - << "curr_charge_phase"<< "," - << "ink_dot_number"<< "," - << "high_sig_cnt"<< "," - << "reg_phase_shift"<< "," - << "phase_detect_dot_num"<< "," - << "phase_charge_result_bit" - << "\n"; - phaseRecordFile.close(); - } - - } - if (phaseRecordFile.open(QFile::WriteOnly | QFile::Append)) { - QTextStream out(&phaseRecordFile); -// out << "flight_tm" -// << "phase" -// << "curr_charge_phase" -// << "ink_dot_number" -// << "high_sig_cnt" -// << "reg_phase_shift" -// << "phase_detect_dot_num" -// << "phase_charge_result_bit" -// << "\n"; - out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") << "," // "flight_tm" - << sysPara->status.flightTm << "," // "flight_tm" - << "None" << "," //"phase" - << sysPara->status.phase << "," //"curr_charge_phase" - << sysPara->status.ink_dot_num << "," //"ink_dot_number" - << sysPara->para.phase_detect_high_cnt<< "," //"high_sig_cnt" - << sysPara->para.phaseShift<< "," //"reg_phase_shift" - << sysPara->para.phase_detect_pulse_num<< "," //"phase_detect_dot_num" - ; - for (quint8 i = 0; i < sizeof(sysPara->status.phaseDetectHighTm); ++i) { - out << sysPara->status.phaseDetectHighTm[i];// << ","; // "phase_charge_result_bit" - if (i < sizeof(sysPara->status.phaseDetectHighTm) - 1) { - out << ","; - } - } - out << "\n"; - phaseRecordFile.close(); - } -} - -void OtherInfo::updateSysStatusToUI(){ - if(sysPara){ - - if(memcmp(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult))){ - sysPara->devOp->readPhaseDetectHighTm(); - ui->phaseGraphic->updateSysStatusToUI(); - } - memcpy(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult)); - ui->labelFlightTm->setText(QString::number(sysPara->status.flightTm*2) + "|" + QString::number(sysPara->status.ink_dot_num) + tr("点")); //逻辑里面已经除以2 - ui->labelPhasePosition->setText(QString::number(sysPara->status.phase)); - - //ui->lab_enableChargeFullTime->setText(sysPara->para.enableChargeFullTime?"FULL":"0"); - - ui->lab_phaseDetectDelay->setText( QString("%1").arg(sysPara->para.phaseDetectDelay)); - ui->lab_phaseDetectVol->setText(QString("%1").arg(sysPara->para.phaseDetectVol)); - - ui->lab_phaseHighLowRatio->setText(QString("%1").arg(sysPara->para.phaseHighLowRatio)); - - //ui->lab_phase_detect_pulse_num->setText(QString("%1").arg(sysPara->para.phase_detect_pulse_num)); - - ui->memDisplayAndEdit->updateSysStatusToUI(); - /* if(ui->checkBoxChargeFullTime->isChecked()){ - ui->spinBoxHighLowRatio->setEnabled(false); - } - else */ - //ui->spinBoxHighLowRatio->setEnabled(true); - - } -} - -void OtherInfo::on_pushButtonApply_pressed() -{ - applyUIPara(); - if(sysPara){ - sysPara->saveParaToFile(); - //qDebug()<<"save OtherInfo para."; - } - OtherInfoLog(); - -} - -void OtherInfo::OtherInfoLog(){ - - qDebug()<spinBoxBlickLightPeriod->value()); - qDebug()<spinBoxPhaseDetectVoltage->value()); - qDebug()<spinBoxPhaseDetectDotNum->value()); - qDebug()<spinBoxPhaseShift->value()); - qDebug()<spinBoxHighLowRatio->value()); - qDebug()<spinBoxPhaseDetectDelay->value()); - -} - -void OtherInfo::updateLockPhaseWidgets(){ - if(sysPara){ - if(lockPhaseFlag) - ui->pushButtonLockPhase->setText(tr("解锁相位")); - else - ui->pushButtonLockPhase->setText(tr("锁定相位")); - if(lockPhaseFlag){ - //ui->spinBoxLockedPhase->setMaximum(sysPara->para.divideRatio*2 - 1); - //ui->spinBoxLockedPhase->setSingleStep(sysPara->para.divideRatio/32); - sysPara->devOp->setPhaseByHand(sysPara->status.phase/PHASE_BY_HAND_DIV); - //ui->spinBoxLockedPhase->setEnabled(true); - //ui->spinBoxLockedPhase->setValue(sysPara->status.phase); - ui->phaseGraphic->setLockedPhase(true,sysPara->status.phase); - } - else{ - sysPara->devOp->setPhaseByHand(0); - //ui->spinBoxLockedPhase->setEnabled(false); - //ui->spinBoxLockedPhase->setValue(0); - ui->phaseGraphic->setLockedPhase(false,0); - } - ui->phaseGraphic->updateSysStatusToUI(); - } -} - -void OtherInfo::on_pushButtonLockPhase_pressed() -{ - lockPhaseFlag = !lockPhaseFlag; - updateLockPhaseWidgets(); -} - - -void OtherInfo::on_spinBoxHighLowRatio_valueChanged(int dutyCycle) -{ - if(sysPara){ - sysPara->devOp->setPhaseDetectVoltageDutyCycle(dutyCycle); - } -} - -void OtherInfo::on_spinBoxLockedPhase_valueChanged(int newPhase) -{ - if(sysPara){ - sysPara->devOp->setPhaseByHand(newPhase/PHASE_BY_HAND_DIV); - ui->phaseGraphic->setLockedPhase(true,newPhase); - ui->phaseGraphic->updateSysStatusToUI(); - } -} - -void OtherInfo::on_spinBoxBlickLightPeriod_editingFinished() -{ - if(sysPara){ - sysPara->devOp->setBlickLightPeriod(ui->spinBoxBlickLightPeriod->value()); - } -} +#include "OtherInfo.h" +#include "ui_otherinfo.h" +#include +#include +#include +#include +#include + +//#define FOR_ADJUST 0 +#define FOR_PHASE_ADJUST 1 +OtherInfo::OtherInfo(QWidget *parent) : + QWidget(parent), + ui(new Ui::OtherInfo) +{ + + ui->setupUi(this); + lockPhaseFlag = false; + lockedPhase = 0; + ui->memDisplayAndEdit->setHidden(1); + + ui->lab_enableChargeFullTime->setHidden(1); + ui->lab_phaseDetectDelay->setHidden(1); + ui->lab_phaseDetectVol->setHidden(1); + ui->lab_phaseHighLowRatio->setHidden(1); + ui->lab_phase_detect_pulse_num->setHidden(1); + + ui->checkBoxChargeFullTime->setHidden(1); + //ui->memDisplayAndEdit->setHidden(1); + ui->pushButtonLockPhase->setHidden(1); + //ui->spinBoxLockedPhase->setHidden(1); + //ui->spinBoxPhaseDetectVoltage->setEnabled(1); +#ifndef FOR_PHASE_ADJUST + ui->lab_phaseDetectVol->setHidden(1); + ui->spinBoxPhaseDetectVoltage->setHidden(1); + ui->spinBoxPhaseDetectVoltage->setEnabled(1); + //ui->spinBoxPhaseGroupValue->setHidden(1); + //ui->labelPhaseGroups->setHidden(1); + //ui->lab_phase_detect_pulse_num->setHidden(1); + ui->labelPhaseDetectNum->setHidden(1); + ui->spinBoxPhaseDetectDotNum->setHidden(1); + //ui->lab_phaseDetectDelay->setHidden(1); + ui->labelPhaseDetectDelay->setHidden(1); + ui->spinBoxPhaseDetectDelay->setHidden(1); +#else +#endif +} + +OtherInfo::~OtherInfo() +{ + delete ui; + +} +void OtherInfo::OtherupdateSysParaToUI(){ + updateSysParaToUI(); +} + +#define PHASE_BY_HAND_DIV 8 //相位会在逻辑里面放大 +void OtherInfo::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; + ui->phaseGraphic->bindSysPara(sysPara); + ui->memDisplayAndEdit->bindSysPara(sysPara); + lockPhaseFlag = sysPara->para.phaseByHand != 0; + updateLockPhaseWidgets(); +} + +void OtherInfo::updateSysParaToUI(){ + if(sysPara){ + ui->spinBoxHighLowRatio->setValue(sysPara->para.phaseHighLowRatio); + ui->spinBoxPhaseDetectDotNum->setValue(sysPara->para.phase_detect_pulse_num); + ui->spinBoxPhaseDetectVoltage->setValue(sysPara->para.phaseDetectVol); + + ui->spinBoxPhaseDetectDelay->setValue(sysPara->para.phaseDetectDelay); + ui->spinBoxPhaseShift->setValue(sysPara->para.phaseShift); + ui->spinBoxBlickLightPeriod->setValue(sysPara->para.blinkLightPeriod); + ui->checkBoxChargeFullTime->setChecked(sysPara->para.enableChargeFullTime); + } +} + +void OtherInfo::onAuthChanged(int auth){ + //ui->memDisplayAndEdit->setShown(auth & AUTH_SUPER_USER2); + //ui->pushButtonLockPhase->setEnabled(auth & AUTH_SUPER_USER2); + //ui->pushButtonLockPhase->setShown(auth & AUTH_SUPER_USER2); + //ui->spinBoxLockedPhase->setShown(auth & AUTH_SUPER_USER2); + + + //ui->lab_enableChargeFullTime->setShown(auth & AUTH_SUPER_USER2); + //ui->lab_phaseDetectDelay->setShown(auth & AUTH_SUPER_USER2); + //ui->lab_phaseDetectVol->setShown(auth & AUTH_SUPER_USER2); + //ui->lab_phaseHighLowRatio->setShown(auth & AUTH_SUPER_USER2); + //ui->lab_phase_detect_pulse_num->setShown(auth & AUTH_SUPER_USER2); + + +} + +void OtherInfo::applyUIPara(){ + if(sysPara){ + sysPara->para.phaseHighLowRatio = ui->spinBoxHighLowRatio->value();//界面上是相检, 占空比 + //sysPara->para.phase_detect_pulse_num = 6;// ui->spinBoxPhaseDetectDotNum->value(); + sysPara->para.phase_detect_pulse_num = ui->spinBoxPhaseDetectDotNum->value(); +#ifndef FOR_PHASE_ADJUST + sysPara->para.phase_detect_pulse_num = 7; + sysPara->para.phaseDetectVol = 35; //ui->spinBoxPhaseDetectVoltage->value(); + sysPara->para.phaseDetectDelay = 100;// ui->spinBoxPhaseDetectDelay->value(); +#else + sysPara->para.phaseDetectVol = ui->spinBoxPhaseDetectVoltage->value(); + sysPara->para.phaseDetectDelay = ui->spinBoxPhaseDetectDelay->value(); + sysPara->para.phase_detect_pulse_num = ui->spinBoxPhaseDetectDotNum->value(); +#endif + sysPara->para.phaseShift = ui->spinBoxPhaseShift->value(); + //qDebug()<<"shift:"<para.phaseShift; + //qDebug()<<"shift:0x"<para.phaseShift, 0, 16); + sysPara->para.blinkLightPeriod = ui->spinBoxBlickLightPeriod->value(); + sysPara->para.enableChargeFullTime = 1;//ui->checkBoxChargeFullTime->isChecked()?1:0; + // 由FPGA 设置 + if(sysPara->devOp->writeFpgaPrintPara() != -1) + QMessageBox::information(this,tr("提示"),tr("应用成功")); + + } +} +void OtherInfo::phaseDetectResultRecord(void){ + if(!memcmp(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult))){ + return; + } + sysPara->devOp->readPhaseDetectHighTm(); + QFile phaseRecordFile("/home/plg/doc/phaseDetectResultRecord.txt"); + if (!phaseRecordFile.exists()) { + if (phaseRecordFile.open(QFile::WriteOnly | QFile::Truncate)) { + QTextStream out(&phaseRecordFile); + out << "time"<< "," + << "flight_tm"<< "," + << "phase"<< "," + << "curr_charge_phase"<< "," + << "ink_dot_number"<< "," + << "high_sig_cnt"<< "," + << "reg_phase_shift"<< "," + << "phase_detect_dot_num"<< "," + << "phase_charge_result_bit" + << "\n"; + phaseRecordFile.close(); + } + + } + if (phaseRecordFile.open(QFile::WriteOnly | QFile::Append)) { + QTextStream out(&phaseRecordFile); +// out << "flight_tm" +// << "phase" +// << "curr_charge_phase" +// << "ink_dot_number" +// << "high_sig_cnt" +// << "reg_phase_shift" +// << "phase_detect_dot_num" +// << "phase_charge_result_bit" +// << "\n"; + out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") << "," // "flight_tm" + << sysPara->status.flightTm << "," // "flight_tm" + << "None" << "," //"phase" + << sysPara->status.phase << "," //"curr_charge_phase" + << sysPara->status.ink_dot_num << "," //"ink_dot_number" + << sysPara->para.phase_detect_high_cnt<< "," //"high_sig_cnt" + << sysPara->para.phaseShift<< "," //"reg_phase_shift" + << sysPara->para.phase_detect_pulse_num<< "," //"phase_detect_dot_num" + ; + for (quint8 i = 0; i < sizeof(sysPara->status.phaseDetectHighTm); ++i) { + out << sysPara->status.phaseDetectHighTm[i];// << ","; // "phase_charge_result_bit" + if (i < sizeof(sysPara->status.phaseDetectHighTm) - 1) { + out << ","; + } + } + out << "\n"; + phaseRecordFile.close(); + } +} + +void OtherInfo::updateSysStatusToUI(){ + if(sysPara){ + + if(memcmp(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult))){ + sysPara->devOp->readPhaseDetectHighTm(); + ui->phaseGraphic->updateSysStatusToUI(); + } + memcpy(lastPhaseChargeReulse,sysPara->status.phaseChargeResult,sizeof(sysPara->status.phaseChargeResult)); + ui->labelFlightTm->setText(QString::number(sysPara->status.flightTm*2) + "|" + QString::number(sysPara->status.ink_dot_num) + tr("点")); //逻辑里面已经除以2 + ui->labelPhasePosition->setText(QString::number(sysPara->status.phase)); + + //ui->lab_enableChargeFullTime->setText(sysPara->para.enableChargeFullTime?"FULL":"0"); + + ui->lab_phaseDetectDelay->setText( QString("%1").arg(sysPara->para.phaseDetectDelay)); + ui->lab_phaseDetectVol->setText(QString("%1").arg(sysPara->para.phaseDetectVol)); + + ui->lab_phaseHighLowRatio->setText(QString("%1").arg(sysPara->para.phaseHighLowRatio)); + + //ui->lab_phase_detect_pulse_num->setText(QString("%1").arg(sysPara->para.phase_detect_pulse_num)); + + ui->memDisplayAndEdit->updateSysStatusToUI(); + /* if(ui->checkBoxChargeFullTime->isChecked()){ + ui->spinBoxHighLowRatio->setEnabled(false); + } + else */ + //ui->spinBoxHighLowRatio->setEnabled(true); + + } +} + +void OtherInfo::on_pushButtonApply_pressed() +{ + applyUIPara(); + if(sysPara){ + sysPara->saveParaToFile(); + //qDebug()<<"save OtherInfo para."; + } + OtherInfoLog(); + +} + +void OtherInfo::OtherInfoLog(){ + + qDebug()<spinBoxBlickLightPeriod->value()); + qDebug()<spinBoxPhaseDetectVoltage->value()); + qDebug()<spinBoxPhaseDetectDotNum->value()); + qDebug()<spinBoxPhaseShift->value()); + qDebug()<spinBoxHighLowRatio->value()); + qDebug()<spinBoxPhaseDetectDelay->value()); + +} + +void OtherInfo::updateLockPhaseWidgets(){ + if(sysPara){ + if(lockPhaseFlag) + ui->pushButtonLockPhase->setText(tr("解锁相位")); + else + ui->pushButtonLockPhase->setText(tr("锁定相位")); + if(lockPhaseFlag){ + //ui->spinBoxLockedPhase->setMaximum(sysPara->para.divideRatio*2 - 1); + //ui->spinBoxLockedPhase->setSingleStep(sysPara->para.divideRatio/32); + sysPara->devOp->setPhaseByHand(sysPara->status.phase/PHASE_BY_HAND_DIV); + //ui->spinBoxLockedPhase->setEnabled(true); + //ui->spinBoxLockedPhase->setValue(sysPara->status.phase); + ui->phaseGraphic->setLockedPhase(true,sysPara->status.phase); + } + else{ + sysPara->devOp->setPhaseByHand(0); + //ui->spinBoxLockedPhase->setEnabled(false); + //ui->spinBoxLockedPhase->setValue(0); + ui->phaseGraphic->setLockedPhase(false,0); + } + ui->phaseGraphic->updateSysStatusToUI(); + } +} + +void OtherInfo::on_pushButtonLockPhase_pressed() +{ + lockPhaseFlag = !lockPhaseFlag; + updateLockPhaseWidgets(); +} + + +void OtherInfo::on_spinBoxHighLowRatio_valueChanged(int dutyCycle) +{ + if(sysPara){ + sysPara->devOp->setPhaseDetectVoltageDutyCycle(dutyCycle); + } +} + +void OtherInfo::on_spinBoxLockedPhase_valueChanged(int newPhase) +{ + if(sysPara){ + sysPara->devOp->setPhaseByHand(newPhase/PHASE_BY_HAND_DIV); + ui->phaseGraphic->setLockedPhase(true,newPhase); + ui->phaseGraphic->updateSysStatusToUI(); + } +} + +void OtherInfo::on_spinBoxBlickLightPeriod_editingFinished() +{ + if(sysPara){ + sysPara->devOp->setBlickLightPeriod(ui->spinBoxBlickLightPeriod->value()); + } +} diff --git a/OtherInfo.h b/OtherInfo.h index f8fa2e7..4affc09 100644 --- a/OtherInfo.h +++ b/OtherInfo.h @@ -1,48 +1,48 @@ -#ifndef OTHERINFO_H -#define OTHERINFO_H - -#include -#include "ParaSettingUI.h" -#include -#include - -namespace Ui { -class OtherInfo; -} - -class OtherInfo : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit OtherInfo(QWidget *parent = 0); - ~OtherInfo(); - void bindSysPara(SysPara *sysPara); - void updateSysParaToUI(); - void applyUIPara(); - void updateSysStatusToUI(); - void phaseDetectResultRecord(); - void OtherInfoLog(); - -private slots: - void on_pushButtonApply_pressed(); - void OtherupdateSysParaToUI(); - void on_pushButtonLockPhase_pressed(); - - void on_spinBoxHighLowRatio_valueChanged(int arg1); - - void on_spinBoxLockedPhase_valueChanged(int arg1); - - void on_spinBoxBlickLightPeriod_editingFinished(); - void onAuthChanged(int auth); - -private: - Ui::OtherInfo *ui; - void updateLockPhaseWidgets(); - unsigned char lastPhaseChargeReulse[8]; - bool lockPhaseFlag; - int lockedPhase; - -}; - -#endif // OTHERINFO_H +#ifndef OTHERINFO_H +#define OTHERINFO_H + +#include +#include "ParaSettingUI.h" +#include +#include + +namespace Ui { +class OtherInfo; +} + +class OtherInfo : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit OtherInfo(QWidget *parent = 0); + ~OtherInfo(); + void bindSysPara(SysPara *sysPara); + void updateSysParaToUI(); + void applyUIPara(); + void updateSysStatusToUI(); + void phaseDetectResultRecord(); + void OtherInfoLog(); + +private slots: + void on_pushButtonApply_pressed(); + void OtherupdateSysParaToUI(); + void on_pushButtonLockPhase_pressed(); + + void on_spinBoxHighLowRatio_valueChanged(int arg1); + + void on_spinBoxLockedPhase_valueChanged(int arg1); + + void on_spinBoxBlickLightPeriod_editingFinished(); + void onAuthChanged(int auth); + +private: + Ui::OtherInfo *ui; + void updateLockPhaseWidgets(); + unsigned char lastPhaseChargeReulse[8]; + bool lockPhaseFlag; + int lockedPhase; + +}; + +#endif // OTHERINFO_H diff --git a/ParaSettingUI.cpp b/ParaSettingUI.cpp index 2432c8b..7f9b08a 100644 --- a/ParaSettingUI.cpp +++ b/ParaSettingUI.cpp @@ -1,43 +1,43 @@ -/* - * ParaSettingUI.cpp - * - * Created on: Jun 25, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - - - - -#include "ParaSettingUI.h" -#include "QDebug" -ParaSettingUI::ParaSettingUI(){ - sysPara = 0; -} - -ParaSettingUI::~ParaSettingUI(){ - -} - -void ParaSettingUI::bindSysPara(SysPara *sysPara){ - this->sysPara = sysPara; -} - - -void ParaSettingUI::updateSysParaToUI(){ - qDebug() << "Warn!!ParaSettingUI::updateSysParaToUI() should be implemented by subclass"; -} - -void ParaSettingUI::applyUIPara(){ - qDebug() << "Warn!!ParaSettingUI::applyUIPara() should be implemented by subclass"; -} - -void ParaSettingUI::updateSysStatusToUI(){ - qDebug() << "Warn!!ParaSettingUI::updateSysStatusToUI() should be implemented by subclass"; -} - -void ParaSettingUI::updateAuthorization(int auth){ - // do nothing here -} +/* + * ParaSettingUI.cpp + * + * Created on: Jun 25, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + + + + +#include "ParaSettingUI.h" +#include "QDebug" +ParaSettingUI::ParaSettingUI(){ + sysPara = 0; +} + +ParaSettingUI::~ParaSettingUI(){ + +} + +void ParaSettingUI::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; +} + + +void ParaSettingUI::updateSysParaToUI(){ + qDebug() << "Warn!!ParaSettingUI::updateSysParaToUI() should be implemented by subclass"; +} + +void ParaSettingUI::applyUIPara(){ + qDebug() << "Warn!!ParaSettingUI::applyUIPara() should be implemented by subclass"; +} + +void ParaSettingUI::updateSysStatusToUI(){ + qDebug() << "Warn!!ParaSettingUI::updateSysStatusToUI() should be implemented by subclass"; +} + +void ParaSettingUI::updateAuthorization(int auth){ + // do nothing here +} diff --git a/ParaSettingUI.h b/ParaSettingUI.h index a2ec0e5..ec2c5f7 100644 --- a/ParaSettingUI.h +++ b/ParaSettingUI.h @@ -1,31 +1,31 @@ -/* - * ParaSettingUI.h - * - * Created on: Jun 25, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - * 只要是有参数需要设置的UI继承此类 - - */ - -#ifndef PARASETTINGUI_H_ -#define PARASETTINGUI_H_ - -#include "SysPara.h" -class ParaSettingUI{ -public: - ParaSettingUI(); - ~ParaSettingUI(); - - void bindSysPara(SysPara *sysPara); - void updateSysParaToUI(); /*这个方法需要被子类重写*/ - void applyUIPara(); /*这个方法需要被子类重写*/ - void updateSysStatusToUI(); /*这个方法需要被子类重写*/ - void updateAuthorization(int auth); /*这个方法需要被子类重写*/ -protected: - SysPara *sysPara; -}; - - -#endif /* PARASETTINGUI_H_ */ +/* + * ParaSettingUI.h + * + * Created on: Jun 25, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + * 只要是有参数需要设置的UI继承此类 + + */ + +#ifndef PARASETTINGUI_H_ +#define PARASETTINGUI_H_ + +#include "SysPara.h" +class ParaSettingUI{ +public: + ParaSettingUI(); + ~ParaSettingUI(); + + void bindSysPara(SysPara *sysPara); + void updateSysParaToUI(); /*这个方法需要被子类重写*/ + void applyUIPara(); /*这个方法需要被子类重写*/ + void updateSysStatusToUI(); /*这个方法需要被子类重写*/ + void updateAuthorization(int auth); /*这个方法需要被子类重写*/ +protected: + SysPara *sysPara; +}; + + +#endif /* PARASETTINGUI_H_ */ diff --git a/PhaseGraphic.cpp b/PhaseGraphic.cpp index 4dfe4ba..83a7f97 100644 --- a/PhaseGraphic.cpp +++ b/PhaseGraphic.cpp @@ -1,125 +1,125 @@ -/* - * phaseGraphic.cpp - * - * Created on: Jun 29, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "PhaseGraphic.h" -#include "QPalette" -#include -PhaseGraphic::PhaseGraphic(QWidget *parent) : - QWidget(parent){ - - pen.setStyle(Qt::SolidLine); - pen.setWidth(2); - pen.setBrush(Qt::red); - pen.setCapStyle(Qt::RoundCap); - pen.setJoinStyle(Qt::RoundJoin); - brush.setStyle(Qt::SolidPattern); - setPalette(QPalette(Qt::white)); - setAutoFillBackground(true); - setMinimumSize(626,150); - lockPhaseFlag = false; - lockedPhase = 0; - phaseCount = 32; -} -PhaseGraphic::~PhaseGraphic(){ - -} - -void PhaseGraphic::paintEvent(QPaintEvent *){ - if(sysPara){ - QString num; - QRect rec = rect(); - int w = rec.width() - 30; - int h = rec.height(); - int step = w/phaseCount; - int high = h/3; - int low = 2*h/3; - int x_shift = 10; - int current_x = x_shift; - int phaseStep = sysPara->para.divideRatio*2/phaseCount; - int currentPhase = 0; - int phasePos = sysPara->para.divideRatio?w*sysPara->status.phase/(sysPara->para.divideRatio*2):0; - int phasePosEdgePos = sysPara->status.phasePosEdge*w/phaseCount; - int phaseNegEdgePos = sysPara->status.phaseNegEdge*w/phaseCount; - int lockPhasePos = sysPara->para.divideRatio?w*lockedPhase/(sysPara->para.divideRatio*2):0; - unsigned int maxPhaseDetectHighVoltageTm = 0; - for(int i = 0;i < phaseCount; i++){ - if(sysPara->status.phaseDetectHighTm[i] > maxPhaseDetectHighVoltageTm) - maxPhaseDetectHighVoltageTm = sysPara->status.phaseDetectHighTm[i]; - } - QPainter p(this); - pen.setBrush(Qt::red); - p.setPen(pen); - p.setBrush(brush); - for(int i = 0; i < 8;i++){ - for(int j = 0;j < 8; j++){ - - if(sysPara->status.phaseChargeResult[i] & (1<status.phaseDetectHighTm[i*8+j]*h/(3*maxPhaseDetectHighVoltageTm):0; - int nextPhaseDetectHighPos = maxPhaseDetectHighVoltageTm?sysPara->status.phaseDetectHighTm[(i*8 + j + 1)%phaseCount]*h/(3*maxPhaseDetectHighVoltageTm):0; - p.drawLine ( current_x, low - currPhaseDetectHighPos, current_x + step, low - nextPhaseDetectHighPos); - current_x = (8*i + j + 1)*w/phaseCount + x_shift; - currentPhase += phaseStep; - } - } - - p.drawLine(current_x,low - 5,current_x,low + 5); - num = QString::number(currentPhase); - p.drawText(current_x - num.size()*4,low + 20,num); //做后的标尺 - num = QString::number(maxPhaseDetectHighVoltageTm); - - p.drawText(x_shift + 10,high - 10,num); //给坐标画标尺 - - p.drawLine(phasePos + x_shift,low + 10,phasePos + x_shift,high - 10); //将相位尺标记一下 - pen.setBrush(Qt::blue);p.setPen(pen); - p.drawLine(phasePosEdgePos + x_shift - 3,low + 10,phasePosEdgePos + x_shift + 3,low - 30); - p.drawLine(phaseNegEdgePos + x_shift + 3,low + 10,phaseNegEdgePos + x_shift - 3,low - 30); - if(lockPhaseFlag){ - pen.setBrush(Qt::green);p.setPen(pen); - p.drawLine(lockPhasePos + x_shift,low + 5,lockPhasePos + x_shift,high - 5); - } - } -} - - -void PhaseGraphic::updateSysStatusToUI(){ - update(); -} - - -void PhaseGraphic::setLockedPhase(bool enable,int val){ - lockPhaseFlag = enable; - lockedPhase = val; -} - -void PhaseGraphic::setPhaseCount(int count) -{ - switch(count) { - case 64: - phaseCount = 64; - break; - case 32: - phaseCount = 32; - break; - case 16: - phaseCount = 16; - break; - default: - phaseCount = 64; - break; - } -} +/* + * phaseGraphic.cpp + * + * Created on: Jun 29, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#include "PhaseGraphic.h" +#include "QPalette" +#include +PhaseGraphic::PhaseGraphic(QWidget *parent) : + QWidget(parent){ + + pen.setStyle(Qt::SolidLine); + pen.setWidth(2); + pen.setBrush(Qt::red); + pen.setCapStyle(Qt::RoundCap); + pen.setJoinStyle(Qt::RoundJoin); + brush.setStyle(Qt::SolidPattern); + setPalette(QPalette(Qt::white)); + setAutoFillBackground(true); + setMinimumSize(626,150); + lockPhaseFlag = false; + lockedPhase = 0; + phaseCount = 32; +} +PhaseGraphic::~PhaseGraphic(){ + +} + +void PhaseGraphic::paintEvent(QPaintEvent *){ + if(sysPara){ + QString num; + QRect rec = rect(); + int w = rec.width() - 30; + int h = rec.height(); + int step = w/phaseCount; + int high = h/3; + int low = 2*h/3; + int x_shift = 10; + int current_x = x_shift; + int phaseStep = sysPara->para.divideRatio*2/phaseCount; + int currentPhase = 0; + int phasePos = sysPara->para.divideRatio?w*sysPara->status.phase/(sysPara->para.divideRatio*2):0; + int phasePosEdgePos = sysPara->status.phasePosEdge*w/phaseCount; + int phaseNegEdgePos = sysPara->status.phaseNegEdge*w/phaseCount; + int lockPhasePos = sysPara->para.divideRatio?w*lockedPhase/(sysPara->para.divideRatio*2):0; + unsigned int maxPhaseDetectHighVoltageTm = 0; + for(int i = 0;i < phaseCount; i++){ + if(sysPara->status.phaseDetectHighTm[i] > maxPhaseDetectHighVoltageTm) + maxPhaseDetectHighVoltageTm = sysPara->status.phaseDetectHighTm[i]; + } + QPainter p(this); + pen.setBrush(Qt::red); + p.setPen(pen); + p.setBrush(brush); + for(int i = 0; i < 8;i++){ + for(int j = 0;j < 8; j++){ + + if(sysPara->status.phaseChargeResult[i] & (1<status.phaseDetectHighTm[i*8+j]*h/(3*maxPhaseDetectHighVoltageTm):0; + int nextPhaseDetectHighPos = maxPhaseDetectHighVoltageTm?sysPara->status.phaseDetectHighTm[(i*8 + j + 1)%phaseCount]*h/(3*maxPhaseDetectHighVoltageTm):0; + p.drawLine ( current_x, low - currPhaseDetectHighPos, current_x + step, low - nextPhaseDetectHighPos); + current_x = (8*i + j + 1)*w/phaseCount + x_shift; + currentPhase += phaseStep; + } + } + + p.drawLine(current_x,low - 5,current_x,low + 5); + num = QString::number(currentPhase); + p.drawText(current_x - num.size()*4,low + 20,num); //做后的标尺 + num = QString::number(maxPhaseDetectHighVoltageTm); + + p.drawText(x_shift + 10,high - 10,num); //给坐标画标尺 + + p.drawLine(phasePos + x_shift,low + 10,phasePos + x_shift,high - 10); //将相位尺标记一下 + pen.setBrush(Qt::blue);p.setPen(pen); + p.drawLine(phasePosEdgePos + x_shift - 3,low + 10,phasePosEdgePos + x_shift + 3,low - 30); + p.drawLine(phaseNegEdgePos + x_shift + 3,low + 10,phaseNegEdgePos + x_shift - 3,low - 30); + if(lockPhaseFlag){ + pen.setBrush(Qt::green);p.setPen(pen); + p.drawLine(lockPhasePos + x_shift,low + 5,lockPhasePos + x_shift,high - 5); + } + } +} + + +void PhaseGraphic::updateSysStatusToUI(){ + update(); +} + + +void PhaseGraphic::setLockedPhase(bool enable,int val){ + lockPhaseFlag = enable; + lockedPhase = val; +} + +void PhaseGraphic::setPhaseCount(int count) +{ + switch(count) { + case 64: + phaseCount = 64; + break; + case 32: + phaseCount = 32; + break; + case 16: + phaseCount = 16; + break; + default: + phaseCount = 64; + break; + } +} diff --git a/PhaseGraphic.h b/PhaseGraphic.h index 3b56862..d7458a0 100644 --- a/PhaseGraphic.h +++ b/PhaseGraphic.h @@ -1,40 +1,40 @@ -/* - * phaseGraphic.h - * - * Created on: Jun 29, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef PHASEGRAPHIC_H_ -#define PHASEGRAPHIC_H_ - - -#include "QWidget" -#include "ParaSettingUI.h" -#include -#include -class PhaseGraphic:public QWidget,public ParaSettingUI{ - Q_OBJECT - -public: - explicit PhaseGraphic(QWidget *parent = 0); - ~PhaseGraphic(); - - void paintEvent(QPaintEvent *); - - void updateSysStatusToUI(); - - void setLockedPhase(bool enable,int val); - void setPhaseCount(int count); -private: - - QPen pen; - QBrush brush; - int lockPhaseFlag; - int lockedPhase; - int phaseCount; // 份数 -}; -#endif /* PHASEGRAPHIC_H_ */ +/* + * phaseGraphic.h + * + * Created on: Jun 29, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef PHASEGRAPHIC_H_ +#define PHASEGRAPHIC_H_ + + +#include "QWidget" +#include "ParaSettingUI.h" +#include +#include +class PhaseGraphic:public QWidget,public ParaSettingUI{ + Q_OBJECT + +public: + explicit PhaseGraphic(QWidget *parent = 0); + ~PhaseGraphic(); + + void paintEvent(QPaintEvent *); + + void updateSysStatusToUI(); + + void setLockedPhase(bool enable,int val); + void setPhaseCount(int count); +private: + + QPen pen; + QBrush brush; + int lockPhaseFlag; + int lockedPhase; + int phaseCount; // 份数 +}; +#endif /* PHASEGRAPHIC_H_ */ diff --git a/PicEdit.cpp b/PicEdit.cpp index 88548c3..c751865 100644 --- a/PicEdit.cpp +++ b/PicEdit.cpp @@ -1,958 +1,958 @@ -#include "PicEdit.h" -#include "ui_picedit.h" -#include "SysPara.h" -#include -#include -#include "ui_InputMethod.h" -#include "InputMethod.h" -#include "Public.h" -#include "stdio.h" -#include "myinclude.h" -#include "dlgdrawinit.h" -#include -#include -#include -#include - -PicEdit::PicEdit(QWidget *parent) : - QWidget(parent), - ui(new Ui::PicEdit) -{ - ui->setupUi(this); - ui->lineEditInputTxt->setMaximumWidth(1); - fileDialog = 0; - charSpace=0; - dlgdraw =0; - lineSpace=1; - openedFileName = ""; - newFileAppending = false;//Qt::Key_Backspace - inserPicFile = false; - connect(ui->widgetPic,SIGNAL(picWidgetModify()),this,SLOT(enableSaveButton())); - connect(ui->widgetPic,SIGNAL(ShowKeybord()),this,SLOT(showKeybord())); - connect(ui->widgetPic,SIGNAL(rowColChanged(QString)),ui->label_ROWCOL,SLOT(setText(QString))); - connect(ui->widgetPic,SIGNAL(currXYChanged(QString)),ui->label_CURXY,SLOT(setText(QString))); - connect(ui->widgetPic,SIGNAL(ChangeFont(int)),this,SLOT(onChangeFont(int))); -#ifdef MYSAVEFILEDLG - dialogSaveFile =new DialogSaveFile(0); -#endif - textEdit=new QTextEdit; - zkEditEn=0; - dialogFileOperation = new DialogFileOperation(0); - dialogInsertVari = new DialogInsertVari(0); - dialogLineSpace = new DialogLineSpace(0); - timer = new QTimer(); - connect(timer, SIGNAL(timeout()), ui->widgetPic, SLOT(cursorFlash())); - connect(timer, SIGNAL(timeout()), this, SLOT(cursorFlash())); - timer->start(500); - - ui->pushButtonZKEdit->setEnabled (zkEditEn); - - VarNum=0; - isInput =0; - - ui->scrollArea->setAlignment ( Qt::AlignAbsolute ); - ui->radioButtonCharCurrent->setChecked (1); - ui->widgetPic->charPara.CharCurrent=1; - - ui->comboBoxLattice->setCurrentIndex (1); - - ui->pushButtonSave->setEnabled(false); - forcePicWidgetSize = false; - ui->widgetPic->charPara.DrawGridEn=true; - ui->checkBoxDrawGridEn->setCheckState ((Qt::CheckState)ui->widgetPic->charPara.DrawGridEn ); - ui->widgetPic->charPara.DrawEn=false; - - ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()); - setEnterKey(1); - openedFileName = ""; - ui->widgetPic->setScale (3); - ui->widgetPic->resizeWidget (150,8); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - memset(var,0,sizeof(var)); - ui->widgetPic->picSetHome(); - ui->labInserMode->setText((ui->widgetPic->charPara.insertMode)? tr("插入模式"):tr("修改模式")); - ui->label_Note->setText(tr("编辑现有的多字体文件\r\n请使用修改模式!!!")); - - ui->widgetPic->charPara.DrawEn=0; - ui->widgetPic->drawPara.width = 10; - ui->widgetPic->drawPara.height = 8; - - ui->checkBoxControlChar->hide(); - ui->checkBoxBold->hide(); - // ui->pushButtonDrawPIC->hide(); - -} - -PicEdit::~PicEdit() -{ - delete ui; - if(fileDialog) - delete fileDialog; - if(fileDialog) - delete fileDialog; - if(dialogInsertVari) - delete dialogInsertVari; - if(dialogLineSpace) - delete dialogLineSpace; - if(dlgdraw) delete dlgdraw; -#ifdef MYSAVEFILEDLG - if(dialogSaveFile) delete dialogSaveFile; - if(dialogFileOperation) delete dialogFileOperation; -#endif - -} -void PicEdit::setEnterKey(int n) -{ - // ui->pushButtonEnsure->setIcon(QIcon( n?":/icon/sure.png":":/icon/keyenter.png")); // icon().addPixmap(,0,0); - // ui->pushButtonEnsure->setText(n?"":"换行"); ///icon/sure.png -} - -void PicEdit::on_pushButtonZKEdit_pressed( ) -{ - //qDebug ()<<"start 1"<widgetPic->charPara.CharWidth<widgetPic->charPara.CharHeight; - //qDebug ()<<"11"; - if(ui->widgetPic->zkEditEn) - { - ui->widgetPic->zkEditEn=0; - ui->pushButtonNew->setEnabled (true); - ui->pushButtonInsertVari->setEnabled (true); - ui->pushButtonOpen->setEnabled (true); - ui->pushButtonSaveAs->setEnabled (true); - ui->pushButtonImport->setEnabled (true); - ui->pushButtonSave->setText (tr("保存/打印")); - ui->pushButtonSave->setText (tr("保存")); - ui->pushButtonZKEdit->setText (tr("字库编辑")); - ui->comboBoxLattice->setDisabled (0); - ui->spinBoxHeightPoint->setDisabled (0); - //ui->spinBoxWidthPoint->setDisabled (0); - ui->widgetPic->charPara.CharCurrent=1; - //ui->widgetPic->charPara.CurrentEn =1; - ui->widgetPic->charPara.DrawEn =0; - ui->widgetPic->charPara.LineSpace=1; - ui->pushButtonImport->setEnabled(true); - ui->widgetPic->initWidget (30,ui->widgetPic->charPara.LineHeight); - ui->labelNote2->setText (tr("点击光栅可打开键盘,点击空白处关闭"));// 请选择字体,打开键盘并输入要编辑的字符. - // 点击光栅可打开键盘,点击其它空白处可关闭键盘. - //qDebug ()<<"22"; - emit zkEditEnStatus(tr("信息编辑")); - - } - else { - //qDebug ()<<"33"; - ui->widgetPic->zkEditNow(); - ui->widgetPic->charPara.DrawEn =1; - ui->pushButtonNew->setDisabled(true); - ui->pushButtonInsertVari->setDisabled (true); - ui->pushButtonOpen->setDisabled (true); - ui->pushButtonSaveAs->setDisabled (true); - ui->pushButtonImport->setDisabled (true); - ui->pushButtonSave->setDisabled (true); - //ui->comboBoxLattice->setDisabled (true); - ui->spinBoxHeightPoint->setDisabled (true); - //ui->spinBoxWidthPoint->setDisabled (true); - //qDebug ()<<"441"; - ui->pushButtonSave->setText (tr("字库保存")); - //qDebug ()<<"442"; - ui->pushButtonZKEdit->setText (tr("返回信息编辑")); - //qDebug ()<<"443"; - ui->pushButtonImport->setEnabled(false); - ui->labelNote2->setText (tr("请选择字体,打开键盘并输入要编辑的字符"));// 请选择字体,打开键盘并输入要编辑的字符. - //qDebug ()<<"44"; - // 点击光栅可打开键盘,点击其它空白处可关闭键盘. - //emit zkEditEnStatus(tr("字库编辑")); - //ui->lineEditInputTxt->setFocus (); - ui->widgetPic->zkEditEn=1; - } - //qDebug ()<<"start 2"<widgetPic->charPara.CharWidth<widgetPic->charPara.CharHeight; -} - -void PicEdit::checkNewFileAppending(){ - if(newFileAppending){ - ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()); - openedFileName = ""; - } - newFileAppending = false; -} - -void PicEdit::onSave_File_reject(){ - checkNewFileAppending(); -} - -void PicEdit::bindSysPara(SysPara *sysPara){ - ui->widgetPic->bindSysPara (sysPara); - this->sysPara = sysPara; -} - -bool PicEdit::maybeSave(){ - if(!ui->widgetPic->isModified()) - return true; - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("图片已经改变,是否保存?")); - QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - - msgBox.exec(); - - if (msgBox.clickedButton() == saveButton) { - newFileAppending = true; - on_pushButtonSave_clicked(); - - - return false; - } - else if (msgBox.clickedButton() == cancleSaveButton) { - return true; - } - - else - return false; - - return true; -} - -void PicEdit::on_pushButtonNew_pressed(){ - if(maybeSave()) - { - - ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()+1); - openedFileName = ""; - ui->labelFileName->setText(""); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - VarNum=0; - ui->widgetPic->zkEditEn=false; - memset(var,0,sizeof(var)); - ui->widgetPic->charPara.DrawEn =0; - ui->widgetPic->charPara.CharCurrent=1; - ui->widgetPic->charPara.CurrentEn =1; - ui->lineEditInputTxt->setFocus (); - } -} - -void PicEdit::showKeybord( ) -{ - if(!ui->widgetPic->charPara.DrawEn || ui->widgetPic->zkEditEn ) ui->lineEditInputTxt->setFocus (); -} - -void PicEdit::enableSaveButton(){ - ui->pushButtonSave->setEnabled(true); - if(ui->widgetPic->zkEditEn) ui->comboBoxLattice->setDisabled (1); - -} - -void PicEdit::on_pushButtonEnlarge_pressed() -{ - ui->widgetPic->enlargeDisplay(); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - -} - -void PicEdit::on_pushButtonReduce_pressed() -{ - ui->widgetPic->reduceDisplay(); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); -} - - - -void PicEdit::on_pushButtonEnsure_pressed() -{ - ui->widgetPic->ensureCurrPos(); - //qDebug()<<"ENLINE2"; -} - - -void PicEdit::on_pushButtonLeft_pressed() -{ - //ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; - ui->widgetPic->currPositionMove(ui->widgetPic->charPara.CharCurrent? (-ui->widgetPic->charPara.CharWidth):(-1),0); -} -void PicEdit::on_pushButtonRight_pressed() -{ -//ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; - ui->widgetPic->currPositionMove(ui->widgetPic->charPara.CharCurrent?ui->widgetPic->charPara.CharWidth:1,0); - -} -void PicEdit::on_pushButtonUp_pressed() -{ - //ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; - ui->widgetPic->currPositionMove(0,ui->widgetPic->charPara.CharCurrent?-(ui->widgetPic->charPara.LineHeight):-1); - //qDebug()<<"TEST2014 UP"; -} -void PicEdit::on_pushButtonDown_pressed() -{ -//ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; - ui->widgetPic->currPositionMove(0,ui->widgetPic->charPara.CharCurrent?ui->widgetPic->charPara.LineHeight:1); -} -void PicEdit::on_spinBoxHeightPoint_valueChanged(int height) -{ - ui->widgetPic->resizeWidget (ui->widgetPic->getWidth (),height); - //qDebug ()<<"HeightPoint:"<widgetPic->charPara.DrawEn=true; - ui->widgetPic->drawPara.width= dlgdraw->getWidth(); - ui->widgetPic->drawPara.height=dlgdraw->getHeight(); - if(maybeSave()) - { - DrawInit(1); - - } - if(dlgdraw) delete dlgdraw; - -} -void PicEdit::on_checkBoxDrawGridEn_clicked( ) -{ - ui->widgetPic->charPara.DrawGridEn=ui->checkBoxDrawGridEn->checkState (); - ui->widgetPic->resizeWidget (ui->widgetPic->getWidth (),ui->widgetPic->getHeight ()); - ui->widgetPic->update (); - -} - -void PicEdit::on_checkBoxControlChar_clicked( ) -{ - ui->widgetPic->charPara.checkBoxControlChar=ui->checkBoxControlChar->checkState (); -} - -void PicEdit::on_pushButtonSaveAs_clicked() -{ -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->setTitleTxt(tr("文件另存为...")); - dialogSaveFile->refreshListView(1); - dialogSaveFile->setEnterFileName(""); - dialogSaveFile->show(); - -#else - - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR), - ui->widgetPic->charPara.DrawEn?QString("Picture files (*.jpg)"): - QString("Picture files (*.png)") - );// *.png )"));// - -#endif - -} -void PicEdit::onSaveASFile(QString fileName,bool Flag){// use for dialogSaveFile class - // filename= fileName ; - if( ui->widgetPic->charPara.DrawEn ){ - if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) - fileName += ".jpg"; - - ui->widgetPic->saveImage1(fileName); - - //ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - - } - else { - - if( !fileName.endsWith(".png",Qt::CaseInsensitive) ) - fileName += ".png"; - - ui->widgetPic->saveImage(fileName); - - //ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - - QString str1 =QFileInfo( fileName).baseName()+".dpn"; - if(sysPara){ - - sysPara->sysFile = QString( PARA_ROOT_DIR+str1); - sysPara->savePrintParaToFile(); - } - printThisFileNow(fileName); - -} - -checkNewFileAppending(); -} - -void PicEdit::onSaveAS_FIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++) - { - - QString fileName = files[i]; - //qDebug()<<"onSaveAS_FIle_select"<widgetPic->charPara.DrawEn ){ - if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) - fileName += ".jpg"; - - ui->widgetPic->saveImage1(fileName); - - //ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - - } - else { - - if( !fileName.endsWith(".png",Qt::CaseInsensitive) ) - fileName += ".png"; - - ui->widgetPic->saveImage(fileName); - - //ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - - QString str1 =QFileInfo( fileName).baseName()+".dpn"; - if(sysPara){ - - sysPara->sysFile = QString( PARA_ROOT_DIR+str1); - sysPara->savePrintParaToFile(); - } - } - - printThisFileNow(fileName); - - } - - checkNewFileAppending(); - -} -void PicEdit::onFileOpen(QString fileName,bool forcePicWidgetSize) -{ - - if(inserPicFile) - { - - if (fileName.endsWith(".png") )ui->widgetPic->insertImage(fileName,false); - else ui->widgetPic->insertImage1(fileName,0); - // if(openedFileName=="") openedFileName= fileName; - - } - else { - if(fileName.endsWith(".png")){ - ui->widgetPic->loadImage(fileName,false); - openedFileName = fileName; - } - else if(fileName.endsWith(".jpg")){ - ui->widgetPic->insertImage1(fileName,1); - VarNum=0; - ui->widgetPic->zkEditEn=false; - memset(var,0,sizeof(var)); - ui->widgetPic->charPara.CurrentEn =1; - ui->widgetPic->charPara.DrawEn=1; - } - ui->widgetPic->setScale (3); - ui->labelFileName->setText(tr("文件名:)")+QFileInfo( fileName).fileName()); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - VarNum=0; - } -} -void PicEdit::updateAuthorization(int auth){ - // do nothing here - zkEditEn= (auth&AUTH_DISPLAY_SYSTEM_SETTING) ||(auth&AUTH_DISPLAY_SYSTEM_MANAGE); - ui->pushButtonZKEdit->setEnabled (zkEditEn); -} - -void PicEdit::on_pushButtonOpen_clicked() -{ - - disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - dialogFileOperation->refreshListView(1); - dialogFileOperation->exec(); - inserPicFile = false; - - -} - - -void PicEdit::onOpenFIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - QString fileName = files.value(i); - ui->widgetPic->loadImage(fileName,forcePicWidgetSize); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - VarNum=0; - } -} - -void PicEdit::on_pushButtonSave_clicked() -{ - if(ui->widgetPic->zkEditEn && zkEditEn ) { - ui->widgetPic->zkEditSave(); - ui->pushButtonOpen->setDisabled (true); - ui->pushButtonSave->setDisabled (true); - //ui->pushButtonImport->setEnabled(true); - ui->pushButtonZKEdit->setText (tr("返回信息编辑")); - ui->comboBoxLattice->setDisabled (0); - emit zkEditEnStatus(tr("字库编辑")); - return ; - } - - if(!openedFileName.isEmpty()){ - //qDebug()<<"on_pushButtonSave_clicked"<widgetPic->charPara.DrawEn) { - //if(openedFileName.endsWith("html")) - openedFileName =DOC_ROOT_DIR+ QFileInfo(openedFileName).baseName()+".jpg"; - ui->widgetPic->saveImage1(openedFileName); - } - else { - //if(openedFileName.endsWith("html")) - openedFileName = DOC_ROOT_DIR+QFileInfo(openedFileName).baseName()+".png"; - - ui->widgetPic->saveImage(openedFileName); - // qDebug()<<"on_pushButtonSave_clicked"<pushButtonSave->setEnabled(true); - printThisFileNow(openedFileName); - - } - else { -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->refreshListView(1); - dialogSaveFile->setTitleTxt(tr("文件保存为...")); - dialogSaveFile->setEnterFileName(""); - dialogSaveFile->show(); -#else - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - fileDialog->showFileDialog(tr("保存"),tr(DOC_ROOT_DIR), - ui->widgetPic->charPara.DrawEn?QString("Picture files (*.jpg)"): - QString("Picture files (*.png)") - - ); -#endif - } -} - -void PicEdit::on_pushButtonImport_clicked() -{ //insert pic 插入图片 pushButtonImport - inserPicFile =true; - disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - dialogFileOperation->refreshListView(1); - dialogFileOperation->exec(); -} -void PicEdit::on_pushButtonEnd_pressed(){ - ui->widgetPic->picSetEnd (); -} -void PicEdit::on_pushButtonHome_pressed(){ - ui->widgetPic->picSetHome(); -} -void PicEdit::keyPressEvent(QKeyEvent *e) -{ - ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; - switch(e->key()) - { - case Qt::Key_Return:on_pushButtonEnsure_pressed(); - //qDebug()<<"TEST2014 ENTER"; - break; - case Qt::Key_Up: on_pushButtonUp_pressed(); - //qDebug()<<"TEST2014 UP2"; - break; - case Qt::Key_Left: on_pushButtonLeft_pressed();break; - case Qt::Key_Right:on_pushButtonRight_pressed();break; - case Qt::Key_Down:on_pushButtonDown_pressed();break; - case Qt::Key_Enter: - //qDebug()<<"ENLINE"; - break; - case Qt::Key_Home:ui->widgetPic->picSetHome(); break; - case Qt::Key_End:ui->widgetPic->picSetEnd (); break; - case Qt::Key_Clear: break; - case Qt::Key_Backspace: - ui->widgetPic->picDelOneChar (); break; - case Qt::Key_Delete: - ui->widgetPic->picDelNextChar (); - break; - } - //if(e->key())qDebug()<<"TES"<key(); -} - - -void PicEdit::on_comboBoxLattice_currentIndexChanged(int index) -{ //字体选择 - int font[]={5,7,9,12,16,16,24,24,32}; - int fontWidth[]= {5,5,6,8,8,12,24,24,24 }; - ui->widgetPic->charPara.Font=(PFONTNAME)index; - ui->widgetPic->charPara.CharHeight =font[index]; - ui->widgetPic->charPara.LineHeight = ui->widgetPic->charPara.CharHeight+ui->widgetPic->charPara.LineSpace; - ui->widgetPic->charPara.CharWidth =fontWidth[index] ; - if( ui->widgetPic->getHeight ()spinBoxHeightPoint->setValue (font[index]); - if( ui->widgetPic->currYpos+ ui->widgetPic->charPara.LineHeight > ui->widgetPic->getHeight() ){ - ui->widgetPic->resizeWidget( ui->widgetPic->getWidth(),ui->widgetPic->currYpos+ ui->widgetPic->charPara.LineHeight); - } - - ui->widgetPic->update (); - ui->lineEditInputTxt->setFocus (); -} - -void PicEdit::on_lineEditInputTxt_textEdited (QString txt) -{ - var[0]=0;var[1]=0; - ui->widgetPic->charPara.Bold=ui->comboBoxBoldMul->currentIndex(); - if(ui->widgetPic->charPara.Bold>2)ui->widgetPic->charPara.Bold=2; - emit ui->widgetPic->inputTxtDot (txt,var); - ui->lineEditInputTxt->clear (); -} -void PicEdit::on_pushButtonStartInput_clicked() -{ - ui->lineEditInputTxt->setInputMethodHints(Qt::ImhLowercaseOnly); - ui->lineEditInputTxt->setFocus(); - toggleVirtualKeyboard(); - -} -void PicEdit::on_pushButtonDeleteChar_clicked() -{ - - ui->widgetPic->picDelOneChar (); -} -void PicEdit::on_radioButtonCharCurrent_clicked() -{ - ui->widgetPic->charPara.CharCurrent=ui->radioButtonCharCurrent->isChecked (); -} - -void PicEdit::on_radioButtonDotCurrent_clicked() -{ - ui->widgetPic->charPara.CharCurrent=ui->radioButtonCharCurrent->isChecked (); -} - -void PicEdit::on_pushButtonInsertVari_pressed() -{ - - - if(dialogInsertVari->exec() == QDialog::Accepted ){ - int pixelSize =ui->widgetPic->charPara.CharHeight;// ui->comboBoxLattice->currentIndex (); - QFont font; - font.setFamily(Public::getFontFamily(pixelSize)); - font.setPixelSize(pixelSize); - font.setWeight(ui->checkBoxBold->isChecked()?QFont::Bold:QFont::Normal); - - font.setLetterSpacing(QFont::AbsoluteSpacing,ui->widgetPic->charPara.FontGap); // sysPara->para.textEditCharSpace - QFontMetrics fontMetrics(font); - ui->widgetPic->charPara.Bold = ui->checkBoxBold->isChecked(); - - - int width = (fontMetrics.width("0123456789"))/10 ; - int height = fontMetrics.ascent () + fontMetrics.descent();//pixelSize; - int digitalNum; - int varType; - unsigned char splitMode; - dialogInsertVari->getValue(&varType,&digitalNum,&splitMode); - QString txt; - -//================ - int val = 0; - QTime t = QTime::currentTime(); - QDate d = QDate::currentDate(); - switch(varType){ - case 0:val = d.year(); digitalNum=digitalNum>2?4:2; break; - case 1:val = d.month();digitalNum=2;break; - case 2:val = d.day();digitalNum=2;break; - //case 3:val = d.dayOfWeek();digitalNum=2;break; //weekNumber - case 3:val = d.weekNumber();digitalNum=2;break; - case 4:val = t.hour(); digitalNum=2;break; - case 5:val = t.minute();digitalNum=2;break; - case 6:val = t.second();digitalNum=2;break; - case 7:val = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(); break; - case 8:val = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt();break; - case 13:val = QString::number(sysPara->status.Status_Counter3.cnt3CurrValue,16).toInt();break; -case 14:val = d.dayOfYear();digitalNum=3;break; - default:val=0; - } - // qDebug()<widgetPic->charPara.FontGap;//4 - ui->widgetPic->charPara.Bold=ui->comboBoxBoldMul->currentIndex(); - if(ui->widgetPic->charPara.Bold>2)ui->widgetPic->charPara.Bold=2; - if(digitalNum) ui->widgetPic->inputTxtDot (txt,var); - } - ui->lineEditInputTxt->setFocus (); - -} - -void PicEdit::ChinaProview(QString txt) -{ - int mCol = (int)textEdit->document()->size().width(); - bool MaxCol4000; - if(sysPara->status.flagOfNo67FPGA) - MaxCol4000 = true; - else - MaxCol4000 = false; - if(mCol > (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide)) - mCol= MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide; - int maxPicHeight = MAX_PRINT_ROW_NUM + 12; - //qDebug ()<document()->drawContents (&painter, image.rect()); /*将text写到pic*/ - - //image.save("printImage.jpg"); - - unsigned char mDat[mCol*maxPicHeight]; - memset(mDat,0,sizeof(mDat)); - int firstRow = maxPicHeight; - /*--------------------------------------------------------------------------*/ - for(int j = 0; j < maxPicHeight; j++){ //计算首行位置 - for(int i = 0; i < mCol; i++){ - QRgb rgb = image.pixel(i,j); - if(rgb&0xff000000){ - firstRow = j; - break; - } - } - if(firstRow != maxPicHeight) - break; - } - /*--------------------------------------------------------------------------*/ - int lastRow = firstRow + MAX_PRINT_ROW_NUM; - lastRow = (lastRow>maxPicHeight)?maxPicHeight:lastRow; - for(int j = 0; j < lastRow - firstRow; j++){ - for(int i = 0; i < mCol; i++){ - QRgb rgb = image.pixel(i,j + firstRow); - if((rgb&0x80000000)){ //判断alpha - if((rgb & 0xffffff) == 0xff0000){ - mDat[ i* j + firstRow]=0; - } - } - } - } -} - - -void PicEdit::on_pushButtonCharSpace_pressed () -{ //QScrollBar mScrollBar; - dialogLineSpace->setValue (ui->widgetPic->charPara.LineSpace,ui->widgetPic->charPara.FontGap); - if(dialogLineSpace->exec() == QDialog::Accepted ){ - dialogLineSpace->getValue (&lineSpace,&charSpace); - if(charSpace<1)charSpace=1; - ui->widgetPic->charPara.FontGap=charSpace; - ui->widgetPic->charPara.LineSpace= lineSpace; - ui->widgetPic->charPara.LineHeight = ui->widgetPic->charPara.CharHeight +ui->widgetPic->charPara.LineSpace; - } -} -void PicEdit::DrawInit(bool mode) -{ - if( mode) - { - ui->widgetPic->initWidget(ui->widgetPic->drawPara.width,ui->widgetPic->drawPara.height); - openedFileName = ""; - ui->labelFileName->setText(""); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - VarNum=0; - ui->widgetPic->zkEditEn=false; - memset(var,0,sizeof(var)); - ui->widgetPic->charPara.CurrentEn =1; - //ui->spinBoxWidth->show(); - //ui->labWidth->show(); - //ui->pushButtonInsertVari->hide(); - ui->widgetPic->charPara.DrawEn=1; - } - else - { - - ui->pushButtonInsertVari->show(); - ui->widgetPic->charPara.DrawEn=0; - emit on_pushButtonNew_pressed(); - } -} - -void PicEdit::printThisFileNow(QString fileName) -{ - if( ui->widgetPic->charPara.DrawEn) - { - DrawInit(0); - return ; - } - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("是否立即喷印当前的文件?")); - QPushButton *saveButton = msgBox.addButton(tr("是"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("否"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - - msgBox.exec(); - - if (msgBox.clickedButton() == saveButton) { - - emit openCurrentFile(fileName,false); - emit setMainTabNow(0); - - } -} - -void PicEdit::EditCurrFile(QString fileName) -{ - ui->widgetPic->loadImage(fileName,forcePicWidgetSize); - openedFileName = fileName; - ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - ui->pushButtonSave->setEnabled(true); - VarNum=0; -} - -void PicEdit::onChangeFont(int n) -{// - //char font[]={5,7,9,12,16,24,24,32}; - int i=0; - if(n>24) i=6; - else if(n>16) i=5; - else if(n>12) i=4; - else if(n>9) i=3; - else if(n>7) i=2; - else if(n>5) i=1; - else i=0; - ui->comboBoxLattice->setCurrentIndex(i); - //qDebug()<widgetPic->charPara.insertMode =!ui->widgetPic->charPara.insertMode; - ui->labInserMode->setText((ui->widgetPic->charPara.insertMode)?tr("插入模式"):tr("修改模式")); -} - - - -void PicEdit::cursorFlash() -{ - static int n=0; - static int m=0; - // static bool r_DrawEn=0; - if(sysPara==NULL) return; - if(sysPara->para.EditMode==TXTFILE){ - ui->widgetPic->pEditMode=0; - return; - } - else if(sysPara->para.EditMode==PICFILE) - ui->widgetPic->pEditMode=1; - // r_DrawEn = char - - - if(isActiveWindow()){ - if(n<31)n++;else n=0; - if(n==10){ - ui->label_Note->setText(tr("按回车键(Enter)可增加新行. 选择字体,光栅会自动调整")); - ui->labelNote2->setText((m%2)?tr("选择[字体]可改变光标大小."):tr("选择[绘图]方式,可以绘制任意图形")); - // qDebug()<<"n:"<label_Note->setText(tr("光标不匹配时,不能输入或删除.")); - ui->labelNote2->setText((m%2)?tr("点击空白处可关闭键盘."):tr("通过[字库编辑]功能,用户可以自定义新字符")); - m++;m=m&0xff; - // qDebug()<<"n:"<label_Note->setText(tr("选择[文本模式]可切换到主界面编辑方式.")); - ui->labelNote2->setText((m%2)?tr("点击光栅可打开键盘,点击空白处关闭键盘"):tr("使用[字库编辑]功能,用户可自己修改字形")); - // q - } - //qDebug()<<"n:"<isVisible()) { - inputMethod->hide(); - } else { - inputMethod->show(); - } -} - -/* -bool PicEdit::event(QEvent *event) { - if (event->type() == QEvent::InputMethod) { - QInputMethodEvent *ime = static_cast(event); - // 处理虚拟键盘输入 - if (!ime->commitString().isEmpty()) { - // 模拟按键事件 - QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_unknown, Qt::NoModifier, ime->commitString()); - keyPressEvent(&keyEvent); - return true; - } - } - return QWidget::event(event); -} -*/ +#include "PicEdit.h" +#include "ui_picedit.h" +#include "SysPara.h" +#include +#include +#include "ui_InputMethod.h" +#include "InputMethod.h" +#include "Public.h" +#include "stdio.h" +#include "myinclude.h" +#include "dlgdrawinit.h" +#include +#include +#include +#include + +PicEdit::PicEdit(QWidget *parent) : + QWidget(parent), + ui(new Ui::PicEdit) +{ + ui->setupUi(this); + ui->lineEditInputTxt->setMaximumWidth(1); + fileDialog = 0; + charSpace=0; + dlgdraw =0; + lineSpace=1; + openedFileName = ""; + newFileAppending = false;//Qt::Key_Backspace + inserPicFile = false; + connect(ui->widgetPic,SIGNAL(picWidgetModify()),this,SLOT(enableSaveButton())); + connect(ui->widgetPic,SIGNAL(ShowKeybord()),this,SLOT(showKeybord())); + connect(ui->widgetPic,SIGNAL(rowColChanged(QString)),ui->label_ROWCOL,SLOT(setText(QString))); + connect(ui->widgetPic,SIGNAL(currXYChanged(QString)),ui->label_CURXY,SLOT(setText(QString))); + connect(ui->widgetPic,SIGNAL(ChangeFont(int)),this,SLOT(onChangeFont(int))); +#ifdef MYSAVEFILEDLG + dialogSaveFile =new DialogSaveFile(0); +#endif + textEdit=new QTextEdit; + zkEditEn=0; + dialogFileOperation = new DialogFileOperation(0); + dialogInsertVari = new DialogInsertVari(0); + dialogLineSpace = new DialogLineSpace(0); + timer = new QTimer(); + connect(timer, SIGNAL(timeout()), ui->widgetPic, SLOT(cursorFlash())); + connect(timer, SIGNAL(timeout()), this, SLOT(cursorFlash())); + timer->start(500); + + ui->pushButtonZKEdit->setEnabled (zkEditEn); + + VarNum=0; + isInput =0; + + ui->scrollArea->setAlignment ( Qt::AlignAbsolute ); + ui->radioButtonCharCurrent->setChecked (1); + ui->widgetPic->charPara.CharCurrent=1; + + ui->comboBoxLattice->setCurrentIndex (1); + + ui->pushButtonSave->setEnabled(false); + forcePicWidgetSize = false; + ui->widgetPic->charPara.DrawGridEn=true; + ui->checkBoxDrawGridEn->setCheckState ((Qt::CheckState)ui->widgetPic->charPara.DrawGridEn ); + ui->widgetPic->charPara.DrawEn=false; + + ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()); + setEnterKey(1); + openedFileName = ""; + ui->widgetPic->setScale (3); + ui->widgetPic->resizeWidget (150,8); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + memset(var,0,sizeof(var)); + ui->widgetPic->picSetHome(); + ui->labInserMode->setText((ui->widgetPic->charPara.insertMode)? tr("插入模式"):tr("修改模式")); + ui->label_Note->setText(tr("编辑现有的多字体文件\r\n请使用修改模式!!!")); + + ui->widgetPic->charPara.DrawEn=0; + ui->widgetPic->drawPara.width = 10; + ui->widgetPic->drawPara.height = 8; + + ui->checkBoxControlChar->hide(); + ui->checkBoxBold->hide(); + // ui->pushButtonDrawPIC->hide(); + +} + +PicEdit::~PicEdit() +{ + delete ui; + if(fileDialog) + delete fileDialog; + if(fileDialog) + delete fileDialog; + if(dialogInsertVari) + delete dialogInsertVari; + if(dialogLineSpace) + delete dialogLineSpace; + if(dlgdraw) delete dlgdraw; +#ifdef MYSAVEFILEDLG + if(dialogSaveFile) delete dialogSaveFile; + if(dialogFileOperation) delete dialogFileOperation; +#endif + +} +void PicEdit::setEnterKey(int n) +{ + // ui->pushButtonEnsure->setIcon(QIcon( n?":/icon/sure.png":":/icon/keyenter.png")); // icon().addPixmap(,0,0); + // ui->pushButtonEnsure->setText(n?"":"换行"); ///icon/sure.png +} + +void PicEdit::on_pushButtonZKEdit_pressed( ) +{ + //qDebug ()<<"start 1"<widgetPic->charPara.CharWidth<widgetPic->charPara.CharHeight; + //qDebug ()<<"11"; + if(ui->widgetPic->zkEditEn) + { + ui->widgetPic->zkEditEn=0; + ui->pushButtonNew->setEnabled (true); + ui->pushButtonInsertVari->setEnabled (true); + ui->pushButtonOpen->setEnabled (true); + ui->pushButtonSaveAs->setEnabled (true); + ui->pushButtonImport->setEnabled (true); + ui->pushButtonSave->setText (tr("保存/打印")); + ui->pushButtonSave->setText (tr("保存")); + ui->pushButtonZKEdit->setText (tr("字库编辑")); + ui->comboBoxLattice->setDisabled (0); + ui->spinBoxHeightPoint->setDisabled (0); + //ui->spinBoxWidthPoint->setDisabled (0); + ui->widgetPic->charPara.CharCurrent=1; + //ui->widgetPic->charPara.CurrentEn =1; + ui->widgetPic->charPara.DrawEn =0; + ui->widgetPic->charPara.LineSpace=1; + ui->pushButtonImport->setEnabled(true); + ui->widgetPic->initWidget (30,ui->widgetPic->charPara.LineHeight); + ui->labelNote2->setText (tr("点击光栅可打开键盘,点击空白处关闭"));// 请选择字体,打开键盘并输入要编辑的字符. + // 点击光栅可打开键盘,点击其它空白处可关闭键盘. + //qDebug ()<<"22"; + emit zkEditEnStatus(tr("信息编辑")); + + } + else { + //qDebug ()<<"33"; + ui->widgetPic->zkEditNow(); + ui->widgetPic->charPara.DrawEn =1; + ui->pushButtonNew->setDisabled(true); + ui->pushButtonInsertVari->setDisabled (true); + ui->pushButtonOpen->setDisabled (true); + ui->pushButtonSaveAs->setDisabled (true); + ui->pushButtonImport->setDisabled (true); + ui->pushButtonSave->setDisabled (true); + //ui->comboBoxLattice->setDisabled (true); + ui->spinBoxHeightPoint->setDisabled (true); + //ui->spinBoxWidthPoint->setDisabled (true); + //qDebug ()<<"441"; + ui->pushButtonSave->setText (tr("字库保存")); + //qDebug ()<<"442"; + ui->pushButtonZKEdit->setText (tr("返回信息编辑")); + //qDebug ()<<"443"; + ui->pushButtonImport->setEnabled(false); + ui->labelNote2->setText (tr("请选择字体,打开键盘并输入要编辑的字符"));// 请选择字体,打开键盘并输入要编辑的字符. + //qDebug ()<<"44"; + // 点击光栅可打开键盘,点击其它空白处可关闭键盘. + //emit zkEditEnStatus(tr("字库编辑")); + //ui->lineEditInputTxt->setFocus (); + ui->widgetPic->zkEditEn=1; + } + //qDebug ()<<"start 2"<widgetPic->charPara.CharWidth<widgetPic->charPara.CharHeight; +} + +void PicEdit::checkNewFileAppending(){ + if(newFileAppending){ + ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()); + openedFileName = ""; + } + newFileAppending = false; +} + +void PicEdit::onSave_File_reject(){ + checkNewFileAppending(); +} + +void PicEdit::bindSysPara(SysPara *sysPara){ + ui->widgetPic->bindSysPara (sysPara); + this->sysPara = sysPara; +} + +bool PicEdit::maybeSave(){ + if(!ui->widgetPic->isModified()) + return true; + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("图片已经改变,是否保存?")); + QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + + msgBox.exec(); + + if (msgBox.clickedButton() == saveButton) { + newFileAppending = true; + on_pushButtonSave_clicked(); + + + return false; + } + else if (msgBox.clickedButton() == cancleSaveButton) { + return true; + } + + else + return false; + + return true; +} + +void PicEdit::on_pushButtonNew_pressed(){ + if(maybeSave()) + { + + ui->widgetPic->initWidget(300,ui->spinBoxHeightPoint->value()+1); + openedFileName = ""; + ui->labelFileName->setText(""); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + VarNum=0; + ui->widgetPic->zkEditEn=false; + memset(var,0,sizeof(var)); + ui->widgetPic->charPara.DrawEn =0; + ui->widgetPic->charPara.CharCurrent=1; + ui->widgetPic->charPara.CurrentEn =1; + ui->lineEditInputTxt->setFocus (); + } +} + +void PicEdit::showKeybord( ) +{ + if(!ui->widgetPic->charPara.DrawEn || ui->widgetPic->zkEditEn ) ui->lineEditInputTxt->setFocus (); +} + +void PicEdit::enableSaveButton(){ + ui->pushButtonSave->setEnabled(true); + if(ui->widgetPic->zkEditEn) ui->comboBoxLattice->setDisabled (1); + +} + +void PicEdit::on_pushButtonEnlarge_pressed() +{ + ui->widgetPic->enlargeDisplay(); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + +} + +void PicEdit::on_pushButtonReduce_pressed() +{ + ui->widgetPic->reduceDisplay(); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); +} + + + +void PicEdit::on_pushButtonEnsure_pressed() +{ + ui->widgetPic->ensureCurrPos(); + //qDebug()<<"ENLINE2"; +} + + +void PicEdit::on_pushButtonLeft_pressed() +{ + //ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; + ui->widgetPic->currPositionMove(ui->widgetPic->charPara.CharCurrent? (-ui->widgetPic->charPara.CharWidth):(-1),0); +} +void PicEdit::on_pushButtonRight_pressed() +{ +//ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; + ui->widgetPic->currPositionMove(ui->widgetPic->charPara.CharCurrent?ui->widgetPic->charPara.CharWidth:1,0); + +} +void PicEdit::on_pushButtonUp_pressed() +{ + //ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; + ui->widgetPic->currPositionMove(0,ui->widgetPic->charPara.CharCurrent?-(ui->widgetPic->charPara.LineHeight):-1); + //qDebug()<<"TEST2014 UP"; +} +void PicEdit::on_pushButtonDown_pressed() +{ +//ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; + ui->widgetPic->currPositionMove(0,ui->widgetPic->charPara.CharCurrent?ui->widgetPic->charPara.LineHeight:1); +} +void PicEdit::on_spinBoxHeightPoint_valueChanged(int height) +{ + ui->widgetPic->resizeWidget (ui->widgetPic->getWidth (),height); + //qDebug ()<<"HeightPoint:"<widgetPic->charPara.DrawEn=true; + ui->widgetPic->drawPara.width= dlgdraw->getWidth(); + ui->widgetPic->drawPara.height=dlgdraw->getHeight(); + if(maybeSave()) + { + DrawInit(1); + + } + if(dlgdraw) delete dlgdraw; + +} +void PicEdit::on_checkBoxDrawGridEn_clicked( ) +{ + ui->widgetPic->charPara.DrawGridEn=ui->checkBoxDrawGridEn->checkState (); + ui->widgetPic->resizeWidget (ui->widgetPic->getWidth (),ui->widgetPic->getHeight ()); + ui->widgetPic->update (); + +} + +void PicEdit::on_checkBoxControlChar_clicked( ) +{ + ui->widgetPic->charPara.checkBoxControlChar=ui->checkBoxControlChar->checkState (); +} + +void PicEdit::on_pushButtonSaveAs_clicked() +{ +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->setTitleTxt(tr("文件另存为...")); + dialogSaveFile->refreshListView(1); + dialogSaveFile->setEnterFileName(""); + dialogSaveFile->show(); + +#else + + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR), + ui->widgetPic->charPara.DrawEn?QString("Picture files (*.jpg)"): + QString("Picture files (*.png)") + );// *.png )"));// + +#endif + +} +void PicEdit::onSaveASFile(QString fileName,bool Flag){// use for dialogSaveFile class + // filename= fileName ; + if( ui->widgetPic->charPara.DrawEn ){ + if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) + fileName += ".jpg"; + + ui->widgetPic->saveImage1(fileName); + + //ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + + } + else { + + if( !fileName.endsWith(".png",Qt::CaseInsensitive) ) + fileName += ".png"; + + ui->widgetPic->saveImage(fileName); + + //ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + + QString str1 =QFileInfo( fileName).baseName()+".dpn"; + if(sysPara){ + + sysPara->sysFile = QString( PARA_ROOT_DIR+str1); + sysPara->savePrintParaToFile(); + } + printThisFileNow(fileName); + +} + +checkNewFileAppending(); +} + +void PicEdit::onSaveAS_FIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++) + { + + QString fileName = files[i]; + //qDebug()<<"onSaveAS_FIle_select"<widgetPic->charPara.DrawEn ){ + if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) + fileName += ".jpg"; + + ui->widgetPic->saveImage1(fileName); + + //ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + + } + else { + + if( !fileName.endsWith(".png",Qt::CaseInsensitive) ) + fileName += ".png"; + + ui->widgetPic->saveImage(fileName); + + //ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + + QString str1 =QFileInfo( fileName).baseName()+".dpn"; + if(sysPara){ + + sysPara->sysFile = QString( PARA_ROOT_DIR+str1); + sysPara->savePrintParaToFile(); + } + } + + printThisFileNow(fileName); + + } + + checkNewFileAppending(); + +} +void PicEdit::onFileOpen(QString fileName,bool forcePicWidgetSize) +{ + + if(inserPicFile) + { + + if (fileName.endsWith(".png") )ui->widgetPic->insertImage(fileName,false); + else ui->widgetPic->insertImage1(fileName,0); + // if(openedFileName=="") openedFileName= fileName; + + } + else { + if(fileName.endsWith(".png")){ + ui->widgetPic->loadImage(fileName,false); + openedFileName = fileName; + } + else if(fileName.endsWith(".jpg")){ + ui->widgetPic->insertImage1(fileName,1); + VarNum=0; + ui->widgetPic->zkEditEn=false; + memset(var,0,sizeof(var)); + ui->widgetPic->charPara.CurrentEn =1; + ui->widgetPic->charPara.DrawEn=1; + } + ui->widgetPic->setScale (3); + ui->labelFileName->setText(tr("文件名:)")+QFileInfo( fileName).fileName()); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + VarNum=0; + } +} +void PicEdit::updateAuthorization(int auth){ + // do nothing here + zkEditEn= (auth&AUTH_DISPLAY_SYSTEM_SETTING) ||(auth&AUTH_DISPLAY_SYSTEM_MANAGE); + ui->pushButtonZKEdit->setEnabled (zkEditEn); +} + +void PicEdit::on_pushButtonOpen_clicked() +{ + + disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + dialogFileOperation->refreshListView(1); + dialogFileOperation->exec(); + inserPicFile = false; + + +} + + +void PicEdit::onOpenFIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + QString fileName = files.value(i); + ui->widgetPic->loadImage(fileName,forcePicWidgetSize); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + VarNum=0; + } +} + +void PicEdit::on_pushButtonSave_clicked() +{ + if(ui->widgetPic->zkEditEn && zkEditEn ) { + ui->widgetPic->zkEditSave(); + ui->pushButtonOpen->setDisabled (true); + ui->pushButtonSave->setDisabled (true); + //ui->pushButtonImport->setEnabled(true); + ui->pushButtonZKEdit->setText (tr("返回信息编辑")); + ui->comboBoxLattice->setDisabled (0); + emit zkEditEnStatus(tr("字库编辑")); + return ; + } + + if(!openedFileName.isEmpty()){ + //qDebug()<<"on_pushButtonSave_clicked"<widgetPic->charPara.DrawEn) { + //if(openedFileName.endsWith("html")) + openedFileName =DOC_ROOT_DIR+ QFileInfo(openedFileName).baseName()+".jpg"; + ui->widgetPic->saveImage1(openedFileName); + } + else { + //if(openedFileName.endsWith("html")) + openedFileName = DOC_ROOT_DIR+QFileInfo(openedFileName).baseName()+".png"; + + ui->widgetPic->saveImage(openedFileName); + // qDebug()<<"on_pushButtonSave_clicked"<pushButtonSave->setEnabled(true); + printThisFileNow(openedFileName); + + } + else { +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->refreshListView(1); + dialogSaveFile->setTitleTxt(tr("文件保存为...")); + dialogSaveFile->setEnterFileName(""); + dialogSaveFile->show(); +#else + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + fileDialog->showFileDialog(tr("保存"),tr(DOC_ROOT_DIR), + ui->widgetPic->charPara.DrawEn?QString("Picture files (*.jpg)"): + QString("Picture files (*.png)") + + ); +#endif + } +} + +void PicEdit::on_pushButtonImport_clicked() +{ //insert pic 插入图片 pushButtonImport + inserPicFile =true; + disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + dialogFileOperation->refreshListView(1); + dialogFileOperation->exec(); +} +void PicEdit::on_pushButtonEnd_pressed(){ + ui->widgetPic->picSetEnd (); +} +void PicEdit::on_pushButtonHome_pressed(){ + ui->widgetPic->picSetHome(); +} +void PicEdit::keyPressEvent(QKeyEvent *e) +{ + ui->widgetPic->charPara.CharHeight =ui->widgetPic->charPara.LineHeight; + switch(e->key()) + { + case Qt::Key_Return:on_pushButtonEnsure_pressed(); + //qDebug()<<"TEST2014 ENTER"; + break; + case Qt::Key_Up: on_pushButtonUp_pressed(); + //qDebug()<<"TEST2014 UP2"; + break; + case Qt::Key_Left: on_pushButtonLeft_pressed();break; + case Qt::Key_Right:on_pushButtonRight_pressed();break; + case Qt::Key_Down:on_pushButtonDown_pressed();break; + case Qt::Key_Enter: + //qDebug()<<"ENLINE"; + break; + case Qt::Key_Home:ui->widgetPic->picSetHome(); break; + case Qt::Key_End:ui->widgetPic->picSetEnd (); break; + case Qt::Key_Clear: break; + case Qt::Key_Backspace: + ui->widgetPic->picDelOneChar (); break; + case Qt::Key_Delete: + ui->widgetPic->picDelNextChar (); + break; + } + //if(e->key())qDebug()<<"TES"<key(); +} + + +void PicEdit::on_comboBoxLattice_currentIndexChanged(int index) +{ //字体选择 + int font[]={5,7,9,12,16,16,24,24,32}; + int fontWidth[]= {5,5,6,8,8,12,24,24,24 }; + ui->widgetPic->charPara.Font=(PFONTNAME)index; + ui->widgetPic->charPara.CharHeight =font[index]; + ui->widgetPic->charPara.LineHeight = ui->widgetPic->charPara.CharHeight+ui->widgetPic->charPara.LineSpace; + ui->widgetPic->charPara.CharWidth =fontWidth[index] ; + if( ui->widgetPic->getHeight ()spinBoxHeightPoint->setValue (font[index]); + if( ui->widgetPic->currYpos+ ui->widgetPic->charPara.LineHeight > ui->widgetPic->getHeight() ){ + ui->widgetPic->resizeWidget( ui->widgetPic->getWidth(),ui->widgetPic->currYpos+ ui->widgetPic->charPara.LineHeight); + } + + ui->widgetPic->update (); + ui->lineEditInputTxt->setFocus (); +} + +void PicEdit::on_lineEditInputTxt_textEdited (QString txt) +{ + var[0]=0;var[1]=0; + ui->widgetPic->charPara.Bold=ui->comboBoxBoldMul->currentIndex(); + if(ui->widgetPic->charPara.Bold>2)ui->widgetPic->charPara.Bold=2; + emit ui->widgetPic->inputTxtDot (txt,var); + ui->lineEditInputTxt->clear (); +} +void PicEdit::on_pushButtonStartInput_clicked() +{ + ui->lineEditInputTxt->setInputMethodHints(Qt::ImhLowercaseOnly); + ui->lineEditInputTxt->setFocus(); + toggleVirtualKeyboard(); + +} +void PicEdit::on_pushButtonDeleteChar_clicked() +{ + + ui->widgetPic->picDelOneChar (); +} +void PicEdit::on_radioButtonCharCurrent_clicked() +{ + ui->widgetPic->charPara.CharCurrent=ui->radioButtonCharCurrent->isChecked (); +} + +void PicEdit::on_radioButtonDotCurrent_clicked() +{ + ui->widgetPic->charPara.CharCurrent=ui->radioButtonCharCurrent->isChecked (); +} + +void PicEdit::on_pushButtonInsertVari_pressed() +{ + + + if(dialogInsertVari->exec() == QDialog::Accepted ){ + int pixelSize =ui->widgetPic->charPara.CharHeight;// ui->comboBoxLattice->currentIndex (); + QFont font; + font.setFamily(Public::getFontFamily(pixelSize)); + font.setPixelSize(pixelSize); + font.setWeight(ui->checkBoxBold->isChecked()?QFont::Bold:QFont::Normal); + + font.setLetterSpacing(QFont::AbsoluteSpacing,ui->widgetPic->charPara.FontGap); // sysPara->para.textEditCharSpace + QFontMetrics fontMetrics(font); + ui->widgetPic->charPara.Bold = ui->checkBoxBold->isChecked(); + + + int width = (fontMetrics.width("0123456789"))/10 ; + int height = fontMetrics.ascent () + fontMetrics.descent();//pixelSize; + int digitalNum; + int varType; + unsigned char splitMode; + dialogInsertVari->getValue(&varType,&digitalNum,&splitMode); + QString txt; + +//================ + int val = 0; + QTime t = QTime::currentTime(); + QDate d = QDate::currentDate(); + switch(varType){ + case 0:val = d.year(); digitalNum=digitalNum>2?4:2; break; + case 1:val = d.month();digitalNum=2;break; + case 2:val = d.day();digitalNum=2;break; + //case 3:val = d.dayOfWeek();digitalNum=2;break; //weekNumber + case 3:val = d.weekNumber();digitalNum=2;break; + case 4:val = t.hour(); digitalNum=2;break; + case 5:val = t.minute();digitalNum=2;break; + case 6:val = t.second();digitalNum=2;break; + case 7:val = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(); break; + case 8:val = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt();break; + case 13:val = QString::number(sysPara->status.Status_Counter3.cnt3CurrValue,16).toInt();break; +case 14:val = d.dayOfYear();digitalNum=3;break; + default:val=0; + } + // qDebug()<widgetPic->charPara.FontGap;//4 + ui->widgetPic->charPara.Bold=ui->comboBoxBoldMul->currentIndex(); + if(ui->widgetPic->charPara.Bold>2)ui->widgetPic->charPara.Bold=2; + if(digitalNum) ui->widgetPic->inputTxtDot (txt,var); + } + ui->lineEditInputTxt->setFocus (); + +} + +void PicEdit::ChinaProview(QString txt) +{ + int mCol = (int)textEdit->document()->size().width(); + bool MaxCol4000; + if(sysPara->status.flagOfNo67FPGA) + MaxCol4000 = true; + else + MaxCol4000 = false; + if(mCol > (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide)) + mCol= MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide; + int maxPicHeight = MAX_PRINT_ROW_NUM + 12; + //qDebug ()<document()->drawContents (&painter, image.rect()); /*将text写到pic*/ + + //image.save("printImage.jpg"); + + unsigned char mDat[mCol*maxPicHeight]; + memset(mDat,0,sizeof(mDat)); + int firstRow = maxPicHeight; + /*--------------------------------------------------------------------------*/ + for(int j = 0; j < maxPicHeight; j++){ //计算首行位置 + for(int i = 0; i < mCol; i++){ + QRgb rgb = image.pixel(i,j); + if(rgb&0xff000000){ + firstRow = j; + break; + } + } + if(firstRow != maxPicHeight) + break; + } + /*--------------------------------------------------------------------------*/ + int lastRow = firstRow + MAX_PRINT_ROW_NUM; + lastRow = (lastRow>maxPicHeight)?maxPicHeight:lastRow; + for(int j = 0; j < lastRow - firstRow; j++){ + for(int i = 0; i < mCol; i++){ + QRgb rgb = image.pixel(i,j + firstRow); + if((rgb&0x80000000)){ //判断alpha + if((rgb & 0xffffff) == 0xff0000){ + mDat[ i* j + firstRow]=0; + } + } + } + } +} + + +void PicEdit::on_pushButtonCharSpace_pressed () +{ //QScrollBar mScrollBar; + dialogLineSpace->setValue (ui->widgetPic->charPara.LineSpace,ui->widgetPic->charPara.FontGap); + if(dialogLineSpace->exec() == QDialog::Accepted ){ + dialogLineSpace->getValue (&lineSpace,&charSpace); + if(charSpace<1)charSpace=1; + ui->widgetPic->charPara.FontGap=charSpace; + ui->widgetPic->charPara.LineSpace= lineSpace; + ui->widgetPic->charPara.LineHeight = ui->widgetPic->charPara.CharHeight +ui->widgetPic->charPara.LineSpace; + } +} +void PicEdit::DrawInit(bool mode) +{ + if( mode) + { + ui->widgetPic->initWidget(ui->widgetPic->drawPara.width,ui->widgetPic->drawPara.height); + openedFileName = ""; + ui->labelFileName->setText(""); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + VarNum=0; + ui->widgetPic->zkEditEn=false; + memset(var,0,sizeof(var)); + ui->widgetPic->charPara.CurrentEn =1; + //ui->spinBoxWidth->show(); + //ui->labWidth->show(); + //ui->pushButtonInsertVari->hide(); + ui->widgetPic->charPara.DrawEn=1; + } + else + { + + ui->pushButtonInsertVari->show(); + ui->widgetPic->charPara.DrawEn=0; + emit on_pushButtonNew_pressed(); + } +} + +void PicEdit::printThisFileNow(QString fileName) +{ + if( ui->widgetPic->charPara.DrawEn) + { + DrawInit(0); + return ; + } + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("是否立即喷印当前的文件?")); + QPushButton *saveButton = msgBox.addButton(tr("是"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("否"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + + msgBox.exec(); + + if (msgBox.clickedButton() == saveButton) { + + emit openCurrentFile(fileName,false); + emit setMainTabNow(0); + + } +} + +void PicEdit::EditCurrFile(QString fileName) +{ + ui->widgetPic->loadImage(fileName,forcePicWidgetSize); + openedFileName = fileName; + ui->labelFileName->setText(tr("文件名:")+QFileInfo( fileName).fileName()); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + ui->pushButtonSave->setEnabled(true); + VarNum=0; +} + +void PicEdit::onChangeFont(int n) +{// + //char font[]={5,7,9,12,16,24,24,32}; + int i=0; + if(n>24) i=6; + else if(n>16) i=5; + else if(n>12) i=4; + else if(n>9) i=3; + else if(n>7) i=2; + else if(n>5) i=1; + else i=0; + ui->comboBoxLattice->setCurrentIndex(i); + //qDebug()<widgetPic->charPara.insertMode =!ui->widgetPic->charPara.insertMode; + ui->labInserMode->setText((ui->widgetPic->charPara.insertMode)?tr("插入模式"):tr("修改模式")); +} + + + +void PicEdit::cursorFlash() +{ + static int n=0; + static int m=0; + // static bool r_DrawEn=0; + if(sysPara==NULL) return; + if(sysPara->para.EditMode==TXTFILE){ + ui->widgetPic->pEditMode=0; + return; + } + else if(sysPara->para.EditMode==PICFILE) + ui->widgetPic->pEditMode=1; + // r_DrawEn = char + + + if(isActiveWindow()){ + if(n<31)n++;else n=0; + if(n==10){ + ui->label_Note->setText(tr("按回车键(Enter)可增加新行. 选择字体,光栅会自动调整")); + ui->labelNote2->setText((m%2)?tr("选择[字体]可改变光标大小."):tr("选择[绘图]方式,可以绘制任意图形")); + // qDebug()<<"n:"<label_Note->setText(tr("光标不匹配时,不能输入或删除.")); + ui->labelNote2->setText((m%2)?tr("点击空白处可关闭键盘."):tr("通过[字库编辑]功能,用户可以自定义新字符")); + m++;m=m&0xff; + // qDebug()<<"n:"<label_Note->setText(tr("选择[文本模式]可切换到主界面编辑方式.")); + ui->labelNote2->setText((m%2)?tr("点击光栅可打开键盘,点击空白处关闭键盘"):tr("使用[字库编辑]功能,用户可自己修改字形")); + // q + } + //qDebug()<<"n:"<isVisible()) { + inputMethod->hide(); + } else { + inputMethod->show(); + } +} + +/* +bool PicEdit::event(QEvent *event) { + if (event->type() == QEvent::InputMethod) { + QInputMethodEvent *ime = static_cast(event); + // 处理虚拟键盘输入 + if (!ime->commitString().isEmpty()) { + // 模拟按键事件 + QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_unknown, Qt::NoModifier, ime->commitString()); + keyPressEvent(&keyEvent); + return true; + } + } + return QWidget::event(event); +} +*/ diff --git a/PicEdit.h b/PicEdit.h index f813c85..f8fea16 100644 --- a/PicEdit.h +++ b/PicEdit.h @@ -1,135 +1,135 @@ -#ifndef PICEDIT_H -#define PICEDIT_H - -#include -#include -#include -#include -#include "MyFileDialog.h" -#include "DialogInsertVari.h" -#include "MyInputMethod.h" -#include "DialogFileOperation.h" -#include "DialogLineSpace.h" -#include "SysPara.h" -#include "string.h" -#include "dlgdrawinit.h" -#include "DialogSaveFile.h" -#define MYDLG - -namespace Ui { -class PicEdit; -} - -#define MAX_PIC_HEIGHT 40 -#define MAX_PIC_WIDTH 100 -class PicEdit : public QWidget -{ - Q_OBJECT - -public: - explicit PicEdit(QWidget *parent = 0); - ~PicEdit(); - - void bindSysPara(SysPara *sysPara); - - void setEnterKey(int n); - - void DrawInit(bool mode); - - void toggleVirtualKeyboard(); -private slots: - void ondlgDrawOK(); - void updateAuthorization(int auth); - void cursorFlash(); - void on_pushButtonEnd_pressed(); - void on_pushButtonHome_pressed(); - - void on_pushButtonNew_pressed(); - void EditCurrFile(QString fileName); - void on_pushButtonEnlarge_pressed(); - - void on_pushButtonReduce_pressed(); - - void on_pushButtonUp_pressed(); - - void on_pushButtonLeft_pressed(); - - void on_pushButtonEnsure_pressed(); - - void on_pushButtonRight_pressed(); - - void on_pushButtonDown_pressed(); - - - void on_checkBoxDrawGridEn_clicked(); - - void on_spinBoxHeightPoint_valueChanged (int i); - //void on_spinBoxWidthPoint_valueChanged (int i); - void on_pushButtonSaveAs_clicked(); - void onSaveAS_FIle_select(); - void onSave_File_reject(); - void on_pushButtonOpen_clicked(); - - - void onOpenFIle_select(); - void on_pushButtonSave_clicked(); - - void enableSaveButton(); - - void on_pushButtonImport_clicked(); - void on_lineEditInputTxt_textEdited(QString txt); - void on_comboBoxLattice_currentIndexChanged(int index); - void on_pushButtonStartInput_clicked(); - void on_pushButtonDeleteChar_clicked(); - void on_radioButtonCharCurrent_clicked(); - void on_radioButtonDotCurrent_clicked(); - void showKeybord( ); - void on_pushButtonInsertVari_pressed(); - void on_pushButtonCharSpace_pressed(); - void on_pushButtonZKEdit_pressed(); - //void - void ChinaProview(QString txt); - void onFileOpen(QString txt,bool m); - void printThisFileNow(QString s); - void onChangeFont(int n); - void on_pushButtonInsertMode_pressed(); - void on_checkBoxControlChar_clicked(); -Q_SIGNALS: - void openCurrentFile(QString ,bool); - void zkEditEnStatus(QString); - void setMainTabNow(int); - void setMainTabEdit(int); -protected slots: - void onSaveASFile(QString fileName, bool Flag); -private: - Ui::PicEdit *ui; - MyFileDialog *fileDialog; - dlgDrawInit * dlgdraw; - QString openedFileName; - //MyInputMethod *myInputMethod; - DialogFileOperation *dialogFileOperation; - DialogInsertVari *dialogInsertVari; - DialogLineSpace *dialogLineSpace; - SysPara *sysPara; - QTextEdit *textEdit; - QTimer *timer; - bool isInput; - bool zkEditEn; - bool newFileAppending; - bool inserPicFile; - void checkNewFileAppending(); - bool maybeSave(); - bool forcePicWidgetSize; - void keyPressEvent(QKeyEvent *e); - // bool event(QEvent *event); - int lineSpace,charSpace; - int var[41]; - vars_t *p_avr; - vars_t mVar[10]; - int VarNum; -#ifdef MYSAVEFILEDLG - DialogSaveFile *dialogSaveFile; -#endif -}; - -#endif // PICEDIT_H +#ifndef PICEDIT_H +#define PICEDIT_H + +#include +#include +#include +#include +#include "MyFileDialog.h" +#include "DialogInsertVari.h" +#include "MyInputMethod.h" +#include "DialogFileOperation.h" +#include "DialogLineSpace.h" +#include "SysPara.h" +#include "string.h" +#include "dlgdrawinit.h" +#include "DialogSaveFile.h" +#define MYDLG + +namespace Ui { +class PicEdit; +} + +#define MAX_PIC_HEIGHT 40 +#define MAX_PIC_WIDTH 100 +class PicEdit : public QWidget +{ + Q_OBJECT + +public: + explicit PicEdit(QWidget *parent = 0); + ~PicEdit(); + + void bindSysPara(SysPara *sysPara); + + void setEnterKey(int n); + + void DrawInit(bool mode); + + void toggleVirtualKeyboard(); +private slots: + void ondlgDrawOK(); + void updateAuthorization(int auth); + void cursorFlash(); + void on_pushButtonEnd_pressed(); + void on_pushButtonHome_pressed(); + + void on_pushButtonNew_pressed(); + void EditCurrFile(QString fileName); + void on_pushButtonEnlarge_pressed(); + + void on_pushButtonReduce_pressed(); + + void on_pushButtonUp_pressed(); + + void on_pushButtonLeft_pressed(); + + void on_pushButtonEnsure_pressed(); + + void on_pushButtonRight_pressed(); + + void on_pushButtonDown_pressed(); + + + void on_checkBoxDrawGridEn_clicked(); + + void on_spinBoxHeightPoint_valueChanged (int i); + //void on_spinBoxWidthPoint_valueChanged (int i); + void on_pushButtonSaveAs_clicked(); + void onSaveAS_FIle_select(); + void onSave_File_reject(); + void on_pushButtonOpen_clicked(); + + + void onOpenFIle_select(); + void on_pushButtonSave_clicked(); + + void enableSaveButton(); + + void on_pushButtonImport_clicked(); + void on_lineEditInputTxt_textEdited(QString txt); + void on_comboBoxLattice_currentIndexChanged(int index); + void on_pushButtonStartInput_clicked(); + void on_pushButtonDeleteChar_clicked(); + void on_radioButtonCharCurrent_clicked(); + void on_radioButtonDotCurrent_clicked(); + void showKeybord( ); + void on_pushButtonInsertVari_pressed(); + void on_pushButtonCharSpace_pressed(); + void on_pushButtonZKEdit_pressed(); + //void + void ChinaProview(QString txt); + void onFileOpen(QString txt,bool m); + void printThisFileNow(QString s); + void onChangeFont(int n); + void on_pushButtonInsertMode_pressed(); + void on_checkBoxControlChar_clicked(); +Q_SIGNALS: + void openCurrentFile(QString ,bool); + void zkEditEnStatus(QString); + void setMainTabNow(int); + void setMainTabEdit(int); +protected slots: + void onSaveASFile(QString fileName, bool Flag); +private: + Ui::PicEdit *ui; + MyFileDialog *fileDialog; + dlgDrawInit * dlgdraw; + QString openedFileName; + //MyInputMethod *myInputMethod; + DialogFileOperation *dialogFileOperation; + DialogInsertVari *dialogInsertVari; + DialogLineSpace *dialogLineSpace; + SysPara *sysPara; + QTextEdit *textEdit; + QTimer *timer; + bool isInput; + bool zkEditEn; + bool newFileAppending; + bool inserPicFile; + void checkNewFileAppending(); + bool maybeSave(); + bool forcePicWidgetSize; + void keyPressEvent(QKeyEvent *e); + // bool event(QEvent *event); + int lineSpace,charSpace; + int var[41]; + vars_t *p_avr; + vars_t mVar[10]; + int VarNum; +#ifdef MYSAVEFILEDLG + DialogSaveFile *dialogSaveFile; +#endif +}; + +#endif // PICEDIT_H diff --git a/PicWidget.cpp b/PicWidget.cpp index 5e2df9e..901cbc9 100644 --- a/PicWidget.cpp +++ b/PicWidget.cpp @@ -1,1871 +1,1871 @@ -/* - * PicWidget.cpp - * - * Created on: Jul 2, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "PicWidget.h" -#include -#include -#include -#include -#include -#include "LogInfo.h" -#include -//#include - -#include "myinclude.h" -#include -#include - -PicWidget::PicWidget(QWidget *parent):QWidget(parent){ - memset(pointMap,0,sizeof(pointMap)); - heightPoint = 0; - widthPoint = 0; - lineNum=0; - lineMaxNum=0; - pEditMode=0; - memset(linePara,0,sizeof(linePara)); - scale = 16; - currXpos = 0; - currYpos = 0; - altPrint=0; - zkEditEn=false; - startCol=0;startRow=0; - modified = false; - charPara.DrawGridEn=(Qt::CheckState)true; - charPara.Bold=0; - charPara.Font=ST07; - charPara.CharWidth = 6; - charPara.CharHeight = 7; - charPara.Width = 0; - charPara.CharCurrent=1; - charPara.CurrentEn =1; - charPara.LineSpace=1; - charPara.FontGap=1; - charPara.LineHeight = 8; - isInput =0; - charPara.insertMode=1; - - /*system("chmod a+x /opt/zk/unitogb"); - unitogb.setFileName ("/opt/zk/unitogb"); - zkAsc.setFileName ("/opt/zk/asc.bin"); - - zkHz07.setFileName ("/opt/zk/HZK7S"); - zkHz09.setFileName ("/opt/zk/ST1010"); - zkHz12.setFileName ("/opt/zk/HZK12S"); - zkHz16.setFileName ("/opt/zk/HZK16S"); - zkHz24.setFileName ("/opt/zk/ST2424"); - zkHz16H.setFileName ("/opt/zk/HZK16H"); - zkHz24H.setFileName ("/opt/zk/HZK24H");*/ - - //cal_currHeightEn=0; - // qDebug()<<"dfdsfasfsdaf"; -} - -PicWidget::~PicWidget(){ - if(zkAsc.isOpen ()) zkAsc.close (); - if(zkHz07.isOpen ()) zkHz07.close (); - if(zkHz09.isOpen ()) zkHz09.close (); - if(zkHz12.isOpen ()) zkHz12.close (); - if(zkHz16.isOpen ()) zkHz16.close (); - if(zkHz24.isOpen ()) zkHz24.close (); -} - -int PicWidget::getVarNum (){ - return varNum; -} -void PicWidget::zkEditNow() -{ - int var[40]={0}; - charPara.DrawEn =0; - PFONTNAME oldFont=charPara.Font; - charPara.Font = ST12; - currXpos =0; - currYpos =0; - scale =2; - zkEditEn=false; - memset(pointMap,0,40*400); - - -#ifdef ENGLISH - inputTxtDot(tr("Please input a char."),var); -#else - inputTxtDot(tr("请输入要编辑的字符"),var); -#endif - - charPara.Font = oldFont; - zkEditEn=true; - modified = false; - charPara.CharCurrent=0; - charPara.DrawEn =1; - charPara.DrawGridEn=1; - currentEditTxt=""; -} -void PicWidget::zkEditSave() -{ - saveZhDot (); -} -void PicWidget::disp(){ - -} - -void PicWidget::paintEvent(QPaintEvent *event){ - QPainter painter(this); - QRect rect = event->rect(); //重绘部分大小。 - painter.setBrushOrigin(0,40); - static bool flash=0; - flash =!flash; - int x = (int)(rect.x()/scale); - int y = (int)(rect.y()/scale); - int x_ = rect.x() + rect.width(); - int y_ = rect.y() + rect.height(); - int last_x = x_/scale; - int last_y = y_/scale; - for(int i = x; i < widthPoint && i <= last_x; i++){ - for(int j = y; j < heightPoint && j <= last_y; j++){ - QPen pen; - int width = 0; - int YM=heightPoint-1-j; - if(currXpos == i && charPara.CurrentEn && currYpos+(charPara.DrawEn?0:charPara.CharHeight-1) >= YM && currYpos <= YM ){ - width = (scale>4)?1:1;// biankuang - if(flash) - pen.setColor(QColor(Qt::red)); - else{ - width = (scale > 6 && charPara.DrawGridEn)?1:0; - pen.setColor(QColor(Qt::gray)); - } - } - else { - width = (scale > 6 && charPara.DrawGridEn)?1:0; - pen.setColor(QColor(Qt::gray)); - } - - pen.setWidth(width); - painter.setPen(width?pen:Qt::NoPen); - if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]&0x01)==1) - { - painter.setBrush(QColor(Qt::black)); - } - else { - if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FLINE0)) painter.setBrush(QColor(Qt::cyan)); - //else if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FCOL0 & charPara.checkBoxControlChar)) painter.setBrush(QColor(Qt::yellow)); // magenta, yellow, - else if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FVAR)) painter.setBrush(QColor(Qt::green)); - else painter.setBrush(QColor(Qt::white)); - } - painter.drawRect(i*scale + width,j*scale + width,scale - 2*width,scale - 2*width); // - } - } - - if(zkEditEn) - emit rowColChanged(tr("编辑字符:%1").arg (currentEditTxt)); - else - emit rowColChanged(tr("[%1行,%2列]").arg (heightPoint).arg (widthPoint)); - - emit currXYChanged(tr("光标[%1,%2]").arg (currYpos).arg (currXpos/*/charPara.CharWidth*/)); //label_CURXY - - emit disp(); -} - -void PicWidget::resizeWidget(int w,int h){ - if(w > MAX_WIDTH || h > MAX_PIC_WIDGET_HEIGHT){ - QMessageBox::warning(0,tr("警告"),tr("最大支持宽度:%1 高度:%2 当前请求:%3 x %4").arg(MAX_WIDTH).arg(MAX_PIC_WIDGET_HEIGHT).arg(w).arg(h)); - widthPoint = (w > MAX_WIDTH)?MAX_WIDTH:w; - heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; - } - else{ - widthPoint = w; - heightPoint = h; - } - resize(w*scale,h*scale); - update(); -} - -void PicWidget::cursorFlash() -{ - if(pEditMode==0 || zkEditEn )return; - - movePicView(); - //update (); - update (); - if(isInput) emit ShowKeybord (); - //qDebug()<<"cur runing."; -} - -int PicWidget::getFontHeight(int x,int y) -{ int res=0, xx=x*MAX_HEIGHT+y; - int font[]={5,7,9,12,16,16,24,24,32}; - unsigned char c=0; - if( (c=pointMap[xx]) & (FLINE0|FCOL0)) - { - res = font[(c>>1)& 0x0f] ; - if(resline.maxFont)line.maxFont=res; - //qDebug()<<( (pointMap[xx+CFONT]>>1)& 0x0f)<>1); - if(resline.maxLineHeight)line.maxFont=res; - // qDebug()<<( (pointMap[xx+CFONT]>>1)& 0x0f)< MAX_HEIGHT-1 )&& x==0) return x1; - if(f0==0 && x>0) { - x = getPrePos(x,x); - f0 = getFontHeight(x,y); - } - while(x){ - x0=x; - x = getPrePos(x,x);//32); - f1 =getFontHeight(x,y); - if(f0 < f1 ){ - x1=x0; - break; - } - - } - return x1; -} -int PicWidget::isCanDelete(int x,int y){ - int res=0; - int xx=x*MAX_HEIGHT+y; - for(int j=4;jlinePara[0]){linePara[1]=x; linePara[0]=h;} - if( linePara[n]) { - n++; - linePara[n]=h; - } - else linePara[n]=h; - } - } - x++; - } - else break; - } - //qDebug()<<"LINEH:"<=5 && y==heightPoint-1){ -// if(y>= currYpos+2*charPara.LineHeight) y=currYpos+charPara.LineHeight; -// y0=y; -// } - //qDebug()<=5){ - if((currYpos-y)>=2*charPara.LineHeight) y=currYpos-charPara.LineHeight; - } - - return y; -} - -int PicWidget::getNextPos(int x,int n) -{ int x1=x++,xx=0; - int varFlag=0; - if(( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR){ - varFlag=1; - n=widthPoint-x;//124*8; - while(n--) - { - if((( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x++; - else {x++;break;} - xx++; - if(x>widthPoint-1)break; - } - if(x>=widthPoint) x=widthPoint;//{ x=x1+charPara.CharWidth;} - if(xx==0) x=x1; - return x; - } - - while(n--) - { - if((( pointMap[x*MAX_HEIGHT+currYpos]&FCOL0) == 0x00) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x++; - else break; - xx++; - //qDebug()<<"getNextPos1:"<=widthPoint ) x=widthPoint;//{ x=x1+charPara.CharWidth;} - if(xx==0) x=x1; - //qDebug()<<"getNextPos"<MAX_WIDTH-1)return 1; - while(n) - { if(x>=MAX_WIDTH) break; - n--; - if(( pointMap[x*MAX_HEIGHT+currYpos]&(FLINE0 | FCOL0))== 0x00) x++; - else break; - // if(xx<30)xx++;else break; - } - return (n<=0); -} - -int PicWidget::isVar(int x,int y) //isVar -{ - return (( pointMap[x*MAX_HEIGHT+y]&FVAR) == FVAR) ; -} - -int PicWidget::getPrePos(int x,int n) -{ x--; - int n0=x; - n=x; - while(n--) - { - if(x){ - if(( pointMap[x*MAX_HEIGHT+currYpos]&FCOL0)) break; - x--; - } - else break; - } - if(( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR){ - n=n0; - while(n--) - { - if((( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x--; - else {x++;break;} - if(x<=0) break; - - } - if(x<=0) x=0; - } - return x; -} - -void PicWidget::mousePressEvent ( QMouseEvent * event ){ - int x = (int )(event->x()/(scale)); - int y = heightPoint -(int )(event->y()/scale)-1; - static bool r_DrawEn=!charPara.DrawEn; - - if(x < widthPoint && y < heightPoint){ - int oriX = currXpos; - int oriY = currYpos; - - if(charPara.DrawEn) - { modified = true; - - currXpos = x; - currYpos = y; - if((pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]&0x1e) ==(unsigned char)(0x00)) - { - if(pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]&0x01) - pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] &=0xfe; - else pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] |=0x01; - } - if(r_DrawEn) update(oriX*scale,oriY*scale,scale,scale); //将原来的焦点去掉 - else update(oriX*scale,oriY*scale,scale,scale*(charPara.LineHeight+1)); //将原来的焦点去掉 - update(x*scale,y*scale,scale,scale); - emit picWidgetModify(); - update(); - // - } - else - { - currXpos = x; - currYpos = y; - - currXpos = SiteStart(currXpos); - currYpos = getDownLine(currXpos); - // if(isVar(oriX,currYpos)) getNextPos(oriX,24*8); - // currXpos = getNextPos(currXpos,charPara.CharWidth); - - if(currXpos > widthPoint) currXpos=widthPoint; - if(currXpos<0) currXpos=0; - if(currYpos<0) currYpos=0; - - - if(charPara.DrawEn) - { - - if(currYpos>=heightPoint) currYpos=heightPoint; - if(isVar(currXpos,currYpos)){ - currXpos = getNextPos( currXpos,24*8); - } - } - else - { - if(isVar(currXpos,currYpos)){ - currXpos = getNextPos( currXpos,24*8); - } - } - //emit movePicView(); - emit ShowKeybord(); - update(oriX*scale,oriY*scale,scale,scale*(charPara.LineHeight)); - update(currXpos*scale,currYpos*scale,scale,scale*(charPara.LineHeight)); - } - r_DrawEn=charPara.DrawEn; - - } -} -int PicWidget::isBlankCol() -{ int cnt=0; - int x = currXpos*MAX_PIC_WIDGET_HEIGHT; - for(char i=0;i0){ // right - currXpos = getNextPos(oriX,widthPoint-currXpos); - - } - else if(shiftX<0){ - if(currXpos) - currXpos = getPrePos(oriX,currXpos); - } - else { } - - if(shiftY<0){ // UP - currYpos = getUpLine(oriX); - if(isVar(oriX,currYpos)) - currXpos = getPrePos(oriX,124*8); - else currXpos = SiteStart(oriX); - - } - else if(shiftY>0){ - if(currYpos) - currYpos = getDownLine(oriX); - if(isVar(oriX,currYpos)) - currXpos = getPrePos(oriX,124*8); - else currXpos = SiteStart(oriX); - } - else{ } - - } - else { - - if(shiftX>0) shiftX=1; - else if(shiftX<0) shiftX=-1; - else shiftX=0; - currXpos += shiftX; - if(currXpos<0)currXpos=0; - else if(currXpos>=widthPoint-1)currXpos=widthPoint-1; - - // qDebug()<<"Y0:"<0) shiftY=-1; - else if(shiftY<0) shiftY=1; - else shiftY=0; - currYpos += shiftY; - if(currYpos<0) currYpos=0; - if(currYpos>heightPoint-1) currYpos =heightPoint-1; - // qDebug()<<"Y1:"<40) h0=40; - if(altPrint){ - h0 = h0/2; - } - - return h0; -} - -int PicWidget::getWidth(){ - return widthPoint; - -} - -int PicWidget::getScaleValue(){ - return scale; -} -void PicWidget::bindSysPara(SysPara *sysPara){ - //this->sysPara1 = sysPara; -} -void PicWidget::initWidget(int w,int h){ - scale = 30; - if(parentWidget()){ - startRow=0; - startCol=0; - QWidget *widget = parentWidget(); - int width = widget->geometry().width(); - int height = widget->geometry().height(); - int scaleX = w?width/w:width; //不要除零 - int scaleY = h?height/(h):height; - scaleX = scaleX > 0?scaleX:1; //scale不能小于零 - scaleY = scaleY > 0?scaleY:1; - scale = scaleY>10?10:scaleY;// > scaleY?scaleX:scaleY; - if(charPara.DrawEn) scale=(scale<8)?8:scale; - else scale=(scale>4)?4:scale; - } - currXpos = 0; - currYpos = 0; - varNum =0; - charPara.Width = w; - //emit movePicView(1); - memset(pointMap,0,sizeof(pointMap)); - resizeWidget(w,h); - modified = false; - picSetHome(); -} - -void PicWidget::enlargeDisplay(){ - if(scale < (1<<10)){ - scale = scale + ((scale>2)?scale/2:1); - resize(widthPoint*scale,heightPoint*scale); - update(); - } -} - - -void PicWidget::reduceDisplay(){ - if(scale > 1){ - scale = scale - ((scale > 2)?scale/3:1); - resize(widthPoint*scale,heightPoint*scale); - update(); - } -} - -void PicWidget::setScale(int scale){ - if(scale > 1) - this->scale = scale; - else - scale = 1; - resize(widthPoint*scale,heightPoint*scale); - update(); -} -void PicWidget::insertImage1(QString filename,bool forceSize){ - if((widthPoint == 0 || heightPoint == 0) && forceSize){ - QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); - } - else { - QImage img(filename); - if(img.isNull()){ - QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); - } - else { - int w = img.rect().width(); - int h = img.rect().height(); - - - if(widthPoint +w 16 - else temp=6; // 24 - //int font[]={5,7,9,12,16,16,24,24,32}; - wRow[0]=( temp<<1)& 0x1e; - if(h<7) temp=h-5; //5 - else if(h<9) temp=h-7;//7 - else if(h<12) temp=h-9;//9 - else if(h<16) temp=h-12;//12 - else if(h<24) temp=h-16;//4,5 =>16 - else temp=h-24; // 24 - wRow[1]=( temp <<1)& 0x1e; - wRow[2]=(charPara.FontGap <<1)& 0x1e; - wRow[3]=(charPara.Bold <<1)& 0x1e; - wRow[4]=(charPara.CharWidth <<1)& 0x1e; - wRow[5]=(charPara.LineHeight <<1)& 0x1e; - } - - if(forceSize){ - widthPoint =w; - heightPoint=h; - currXpos=0; - currYpos=0; - } - resizeWidget(widthPoint,heightPoint); - charInsert(w,0); - - for(int i = 0; i < w;i++){ - if((currXpos+ i)>=MAX_WIDTH) break; - - for(int j = 0; j < h ; j++){ - if((currYpos + j)>=MAX_PIC_WIDGET_HEIGHT) break; // continue;// - QRgb argb = img.pixel(i,j); - - //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); - if((argb == 0xffffffff) ) //节约时钟周期 - { - pointMap[(currXpos+i)*MAX_PIC_WIDGET_HEIGHT +(currYpos+h-1-j)] = (i?0:FCOL0) |(jwidthPoint)currXpos=widthPoint; - update(); - } - } -} - -void PicWidget::insertImage(QString filename,bool forceSize){ - - if((widthPoint == 0 || heightPoint == 0) && forceSize){ - QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); - } - else { - QImage img(filename); - if(img.isNull()){ - QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); - } - else - { - int w = img.rect().width(); - int h = img.rect().height(); - bool isToWidth=0; - - charInsert(w,0); - -// widthPoint+=w; -// /* 2014-2-28 修正了插入图片造成死机问题。原因:由于数组下标溢出 */ -// if(widthPoint>MAX_WIDTH){ widthPoint=MAX_WIDTH;} -// if(heightPoint>MAX_PIC_WIDGET_HEIGHT){ heightPoint=MAX_PIC_WIDGET_HEIGHT;} -// if(w+currXpos>widthPoint) {w = widthPoint-currXpos;isToWidth=1;} -// if(h+currYpos>heightPoint){ h =heightPoint-currYpos;isToWidth=1;} - -// resizeWidget (widthPoint,heightPoint); - - for(int i = 0; i < w;i++){ - if((currXpos+ i)>=MAX_WIDTH) break; - uint c=0;uchar cc=0,c1=0; - - for(int j = 0; j < h ; j++){ - if((currYpos + j)>=MAX_PIC_WIDGET_HEIGHT) break; // continue;// - QRgb argb = img.pixel(i,j); - c1 = argb&0xff; - - //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); - if((argb == 0xffffffff) ) //节约时钟周期 - { - pointMap[(currXpos+i)*MAX_PIC_WIDGET_HEIGHT +(currYpos+h-1-j)] = (i?0:FCOL0) |(jwidthPoint)currXpos=widthPoint; - update(); - } - } -} -void PicWidget::readPng(int x,int y,int w,int h) -{ - -} - -void PicWidget::loadImage(QString filename,bool forceSize){ - - if((widthPoint == 0 || heightPoint == 0) && forceSize){ - QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); - } - else { - QImage img(filename); - if(img.isNull()){ - QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); - } - else - { - int w = img.rect().width(); - int h = img.rect().height(); - startRow=0; - startCol=0; - varNum =0; - memset(pointMap,0,sizeof(pointMap)); - if(!forceSize){ - widthPoint = (w > MAX_WIDTH)?MAX_WIDTH:w; - heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; - resize(widthPoint*scale,heightPoint*scale); - } - // readPng(0,0,w,h); - for(int i = 0; i < widthPoint;i++){ - uint c=0;uchar cc=0,c1=0; - for(int j = 0; j < heightPoint ; j++){ - bool pixelVisible = false; - int init_x = i*w/widthPoint; - int end_x = (w >= widthPoint)?(i + 1)*w/widthPoint:init_x + 1; - int init_y = j*h/heightPoint; - int end_y = (h >= heightPoint)?(j + 1)*h/heightPoint:init_y + 1; - c=0; - for(int l = init_x; l < end_x; l++){ - for(int m = init_y; m < end_y; m ++){ - QRgb argb = img.pixel(l,m); - c1 = argb&0xff; - - //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); - if((argb == 0xffffffff) ) //节约时钟周期 - { - continue; - } - if(((argb & 0xffffff00)==0xff000000 ) - ||((argb & 0xffffff00)==0xffffff00 )) //节约时钟周期 - { - c = c1; - pixelVisible = true; - break; - } - } - if(pixelVisible || c) break; - } - pointMap[i*MAX_PIC_WIDGET_HEIGHT +(heightPoint-1- j)] = c; - }// one col end - } - currXpos=0; - currYpos=0; - //currMode = cal_currHeight()>0; - line.Len=widthPoint; - charPara.LineHeight =getLineHeight(0,0); - if( getLineEnd(0)<5) { - qDebug()<<"FILE TYPE ERROR!"; - } - update(); - } - } -} - -void PicWidget::getPrintDat(unsigned char *dat,unsigned char alt2,SysPara *sysPara) -{ - if(!sysPara ) return; - int res=0; - res = resizePicRect(alt2); - - int hStart,hEnd; - int h= endRow-startRow+1;// - - hStart= (alt2>1)?h>>1:0; - hEnd = (alt2==1)?h>>1 :h; - - for(int i = 0 ; i < widthPoint; i++) - { - unsigned char c=0,c1=0; - int j=0; - for( j = hStart; j < hEnd; j++) - { - c |= (pointMap[(i)*MAX_PIC_WIDGET_HEIGHT+startRow + h-1-j]&0x01)? (1 << (j%8)):0; - if(j%8==7) { dat[i*5+(j-hStart)/8]=c; c=0; } - } - dat[i*5+(j-hStart)/8]=c; - } -} - -/* =============================================== - 040608 121416 242628 32343638 4648 52545658 646668 727476787A 848688 949698 - 02 0A 16 22 2A 3A 44 48 52 62 7A 82 8A 92 9A - 02 0A 16 2A 3A 44 48 52 62 7A 82 8A 92 9A - 02 0A 16 2A 343638 42 48 52545658 62646668 78 848688 92 9A - 02 0A 16 28 3A 42 48 5A 62 6A 78 82 8A 9496989A - 02 0A 16 26 3A 424446484A 5A 62 6A 76 82 8A 9A - 03 0B 17 25 3B 49 5B 63 6B 77 83 8B 9B - 050709 131517191B 232527292B 33353739 49 53555759 656769 77 858789 93959799 -=============================================== */ - -void PicWidget::getCharRamData(SysPara *sysPara) -{ - // 生成字模数据 - if(sysPara->status.variNum) - { - int ramAddress = 0; - if(sysPara->status.variNum>8)sysPara->status.variNum=8; - - for(int i = 0; i < sysPara->status.variNum; i++){ - - vars_t *p_var = &sysPara->status.vars[i]; - p_var->bassAddr = -1; - if(p_var->original){ //清除原来的记录 - if(p_var->dat){ - free(p_var->dat); - } - p_var->original = false; - } - for(int j = 0; j < i; j ++){ //重复检测是否有重复大小的字存在 - if((p_var->height == sysPara->status.vars[j].height) - &&(p_var->width/p_var->digitalNum == sysPara->status.vars[j].width/sysPara->status.vars[j].digitalNum )) - { - p_var->bassAddr = sysPara->status.vars[j].bassAddr; - p_var->datHeight = sysPara->status.vars[j].datHeight; - p_var->datWidth = sysPara->status.vars[j].datWidth; - p_var->rowByteNum = sysPara->status.vars[j].rowByteNum; - p_var->dat = sysPara->status.vars[j].dat; - break; - } - } - if(p_var->bassAddr == -1){ - int width = (p_var->digitalNum)?(p_var->width/p_var->digitalNum):5; - int height = p_var->height; - if(p_var->digitalNum>8 || p_var->type >9 - || p_var->digitalNum<2 || p_var->width<5 - || p_var->height<5 || p_var->height>24 - || p_var->type <0 ||p_var->letterSpace >5 - || p_var->letterSpace <0 - ) - { - return; - } - - // 先根据变量高度,选择一种字体,然后读出0~9的字模,然后进行行列转换,存储到p_var->dat - //char font[]={5,7,9,12,16,16,24,24,32}; - if(p_var->height>=18) charPara.Font=ST24; - else if(p_var->height>=13) { - charPara.Font=p_var->width/p_var->digitalNum-p_var->letterSpace==(p_var->bold?24:12)?HT16:ST16; - } - else if(p_var->height>=10) charPara.Font=ST12; - else if(p_var->height>=8) charPara.Font=ST09; - else if(p_var->height>=6) charPara.Font=ST07; - else charPara.Font=ST05; - - width = (p_var->digitalNum)?(10*p_var->width/p_var->digitalNum):12; - - int zm_width = 11* width; - int zm_height = p_var->height; - unsigned char pMap[(zm_width+10)*40]; // >720 - - charPara.LineSpace = p_var->letterSpace; - //memset(zm,0,sizeof(zm)); - memset(pMap,0,sizeof(pMap)); - inputRamDot (QString("0123456789"),pMap, p_var);// READ DOT FROM ASB.BIN - - int rowDiff = p_var->endRowPos - p_var->startRowPos; - int firstValidRow; - int lastValidRow = 0; - int firstValidRowDiff; - if(lastValidRow >= rowDiff){ - firstValidRow = lastValidRow - rowDiff; - firstValidRowDiff = firstValidRow; - } - else { - firstValidRow = 0; - firstValidRowDiff = lastValidRow > rowDiff; - } - firstValidRow = firstValidRow >= 0?firstValidRow:0; //纠正 第一行位置 - int rowByteNum = rowDiff/8 + ((rowDiff%8)?1:0); // 行数 - - unsigned char *dat = (unsigned char *)calloc(width,rowByteNum); - - for(int k = zm_height - 1; k >= 0 ; k--){ - for(int j = 0; j < zm_width; j ++){ - if(pMap[j*MAX_PIC_WIDGET_HEIGHT+k]&0x01){ - lastValidRow = k + 1; - break; - } - } - if(lastValidRow != 0) - break; - } - for(int k = firstValidRow; k < lastValidRow; k++){ - for(int j = 0; j < width; j ++){ - int currRow = k - firstValidRowDiff; - if(pMap[j*MAX_PIC_WIDGET_HEIGHT+k]&0x01){ - dat[rowByteNum*j + currRow/8] |= (1<<(currRow%8)); - } - else{ - } - } - } - p_var->bassAddr = ramAddress; - p_var->datHeight = height; - p_var->datWidth = width; - p_var->rowByteNum = rowByteNum; - p_var->dat = dat; - p_var->original = true; - p_var->currVal = -1; //相当于初始化 - ramAddress += rowByteNum * width; - } - } - } -} - -int PicWidget::readVar(SysPara *sysPara, unsigned char alt2)// alt2 =0,1,2 -{ - if(sysPara) - { - varNum=0; // _______SAMW - altPrint = alt2; - resizePicRect(alt2); - - for(int j = 0; j < heightPoint; j++) - { - line.maxFont=MAX_HEIGHT;line.minFont =0; // start - - for(int i = 0 ; i < widthPoint; i++) - { - getLineHeight(i,j); // cal min lineHeight, max lineHeight - - unsigned char c[6]; - unsigned char c1=pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]; - - if((c1 & FCOL0 ) && (c1 & FLINE0) && (c1 & FVAR)) - { // 定位变量的起点 -// // W0 ==font V1 = type V2 = diginum V3 = width - c1=(pointMap[(i+VTYPE)*MAX_PIC_WIDGET_HEIGHT + j] >>1)& 0x0f; //type - c[0]=(pointMap[(i+CFONT)*MAX_PIC_WIDGET_HEIGHT + j] >>1)& 0x0f; //font - if(c1 > 9 && c1 != 13) continue; //type,cnt3 is 13 - c[1]=c1; - // qDebug ()<<"C1"<status.vars[varNum].type=c[VTYPE]; - sysPara->status.vars[varNum].digitalNum=c[VDIGIT]; - sysPara->status.vars[varNum].width=c[VWIDTH]; - sysPara->status.vars[varNum].height =getFontHeight(i,j); - sysPara->status.vars[varNum].startColPos =i; - sysPara->status.vars[varNum].startRowPos=endRow+1-(j+sysPara->status.vars[varNum].height); - sysPara->status.vars[varNum].endRowPos=endRow+1-(j); - c1=(pointMap[(i)*MAX_PIC_WIDGET_HEIGHT + j+ CFONTGAP] >>1)& 0x0f; //font - sysPara->status.vars[varNum].letterSpace= c1>5?5:c1; - } - - varNum++; - if(varNum>8){ - varNum=8; - QMessageBox::warning(this,tr("警告"),tr("信息中的变量数超过了最大值(8)!请减小变量数.")); - break; - } - i+=c[VWIDTH]-1; - - } - - - } - j+=line.minLineHeight?line.minLineHeight-1:0; - } - //startCol =0; - sysPara->status.variNum=varNum; - //qDebug()<<"varn:"<status.variNum; - } // end of if(sysPara) - return varNum; -} - -// resizePicRect(); -int PicWidget::resizePicWidth(bool rowEn) -{ - //int w=0,Flag=0; - startCol=0; - endCol=0; - for(int j = 0; j < heightPoint; j++){ - { - for(int i = endCol ; i < widthPoint; i++) - if(((pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]&0x01))||((pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]&FLINE0))) - { - if(endCol21 ) endRow=lastLinePos+23; - else if(lastLineHeigt>16) ; - else if(lastLineHeigt>13) endRow=lastLinePos+15; - else if(lastLineHeigt>10) endRow=lastLinePos+11; - else if(lastLineHeigt>7) endRow=lastLinePos+8; - else if(lastLineHeigt>5) endRow=lastLinePos+6; - - } - return startRow; -} - -/* - 文件格式说明 - 1. 在图像文件中,存储变量信息,D0=1表示有点,D0=0表示无点 - 2.地址 信息D6~D1 - 0 0xaa - 1 varNum - 2 0x68 - 3 - 3. 变量参数 隐藏在变量占位符中D6~D1 - 列编号 变量信息(1~128) - 0 类型+1 - 1 位数+1 - 2 字符宽度(点)/2 +1 - 3 字符高度(点)+1 - 4 字符间隔+1 - */ - -void PicWidget::saveImage(QString filename){ - if(widthPoint == 0 || heightPoint == 0){ - QMessageBox::warning(0,"警告","请新创建图片"); - } - else { - update (); - resizePicWidth(0); - // resizePicRect(0); - QSize size(widthPoint,heightPoint); - QImage image(size,QImage::Format_ARGB32); - image.fill(qRgba(0,0,0,0xff)); - for(int i = 0 ; i < widthPoint; i++){ - for(int j = 0; j < heightPoint; j++){ - uint c = 0; - uchar cc= pointMap[( i)*MAX_PIC_WIDGET_HEIGHT +(heightPoint-1- j)]; - if((cc&0x01)==1) - { - c=0xff000000 | (cc) ; - } - else - { - if(cc==0) c=0xffffffff; - else c = 0xffffff00 | (cc); - } - image.setPixel(i,j,c); - } - } - image.save(filename); - } - setModified(false); -} - -void PicWidget::saveImage1(QString filename){ - if(widthPoint == 0 || heightPoint == 0){ - QMessageBox::warning(0,"警告","请新创建建图片"); - } - else { - QSize size(widthPoint,heightPoint); - QImage image(size,QImage::Format_ARGB32); - image.fill(qRgba(0,0,0,0xff)); - for(int i = 0 ; i < widthPoint; i++){ - for(int j = 0; j < heightPoint; j++){ - image.setPixel(i,j,pointMap[i*MAX_PIC_WIDGET_HEIGHT +heightPoint-1- j]?0xff000000:0xffffffff); - } - } - filename = DOC_ROOT_DIR+ QFileInfo(filename).baseName()+".jpg"; - image.save( filename ); - } - setModified(false); -} - -int PicWidget::picDelOneChar() -{ - int posx =currXpos; - emit picWidgetModify(); - if(zkEditEn) - { - memset(pointMap,0,40*40); - resizeWidget (widthPoint,heightPoint); - update (); - return 0; - } - - if(posx==0)return 0; - if(isCanDelete(currXpos,currYpos)) return -1; - currXpos = getPrePos(posx,posx);//32); - picDelNextChar( ); - - return 0; -#if 0 - int posxEnd = getLineEnd(posx); - int posx2 = getPrePos(posx,32); - //========================= -#ifdef FONTMATCH //是否需要匹配字体能操作 - if(getFontHeight(posx2,posy)!=charPara.CharHeight)return posx; -#endif - - if(posxEnd>posx && posx2posx && posx2>posx) - {//13 0 24 30 172 - //qDebug()<<"DelNext:"<=line.Len) - { - line.Len -=posx-posx2; - //line.Len; - resizeWidget(line.Len,heightPoint); - } - movePicView(); - update (); - return posx; -} - -void PicWidget::delDots(int x1,int x2,int y1,int h){ - int i,j; - for(i=x1;i0){ - int xMaxPos= linePara[1];// - for(i=x2-1;i>=x1;i--) { - - if(icurrXpos && posx2){ - - moveDots(currXpos,posx1,posy1,linePara[0],w); // - - } - else if(posx1==currXpos && posx2){ - if( pointMap[posx1*MAX_PIC_WIDGET_HEIGHT+posy1] & (FCOL0 | FVAR)) { - // qDebug()<<"INsert1:"<w){ - // qDebug()<<"INsert2:"; - } - else{ - //qDebug()<<"INsert3:"; - return -1; - } - - } - - return 0; -} -char PicWidget::getZkPic(char *dat) -{ int n=0; - QString s="S-",s1; - for(int i=0;iisOpen ()) pzkEditFile->close (); - pzkEditFile->open (QIODevice::ReadWrite); - char dot[100]; - ///for(int i=0;i<100;i++)dot[i]=0; - memset(dot,0,sizeof(dot)); - getZkPic(dot); // - //qDebug ()<<"zk-2-"<fileName ()<seek(zkOffset); - pzkEditFile->write(dot,zkReadNum); - pzkEditFile->close (); -} - -void PicWidget::readAscDot(unsigned int asc,char *dot) -{ - int offset1[]={BIN0805,BIN0808,BIN0810,BIN0812,BIN0816,BIN1616,BIN2424,BIN2424,BIN2424}; - int fontNum[]= {8,8,10,12,16,32,72,72,72 }; - int fontHeight[]={5,7,9,12,16,16,24,24,24 }; - int fontWidth[]= {5,5,7,8,8,12,24,24,24 }; - QFile *pzkFile; - pzkFile = (QFile * )&zkAsc; - if(!pzkFile->isOpen ()) pzkFile->open (QIODevice::ReadWrite); - pzkEditFile = (QFile * )pzkFile; - charPara.CharHeight = fontHeight[charPara.Font]; - charPara.CharWidth = fontWidth [charPara.Font]+charPara.FontGap; - charPara.LineHeight = charPara.CharHeight +charPara.LineSpace; - zkReadNum = fontNum[charPara.Font]; - zkOffset = asc*fontNum[charPara.Font]+offset1[charPara.Font]; - pzkFile->seek(zkOffset); - pzkFile->read(dot,zkReadNum); - //qDebug ()<<"EN"<close (); -} - -void PicWidget::readZhDot(unsigned int ingb,char *dot ) -{ - unsigned int gbCode=0; - unsigned char gbcode[4]; - if(!unitogb.isOpen ()) unitogb.open (QIODevice::ReadWrite); - unitogb.seek (ingb); - unitogb.read ((char*)gbcode,2); - unitogb.close (); - gbCode = (gbcode[0]<<8)+gbcode[1]; - - QFile *pzkFile1[]={&zkHz05,&zkHz07,&zkHz09,&zkHz12,&zkHz16,&zkHz16H,&zkHz24,&zkHz24H,&zkHz24H}; - int fontNum[]= {8,16,20,24,32,32,72,72,72 }; - int fontHeight[]={5,8,10,12,16,16,24,24,24 }; - int fontWidth[]= {8,8,9,12,16,16,24,24,24 }; - // qDebug()<=0xa1)&&(gbcode[0]<=0xff)) - { - //qDebug()<isOpen ()) - pzkEditFile->open (QIODevice::ReadWrite); - zkReadNum = fontNum[charPara.Font]; - zkOffset =(gbcode[0]-0xa1)*zkReadNum*94+(gbcode[1]-0xa1)*zkReadNum; //区位码=区字节+位字节 16*2 - pzkEditFile->seek(zkOffset); - pzkEditFile->read(dot,zkReadNum); // write to stderr - //qDebug ()<<"CH:"<fileName ()<0 && var[0]<10) { - if(currYpos){ - if( pointMap[(currXpos)*MAX_PIC_WIDGET_HEIGHT +currYpos-1]&0x1e){ - QMessageBox::warning(this,tr("警告"),tr("两个变量之间至少要空出一个墨点!")); - return 0; - } - - } - if(varNum<7) varNum++; - - if(currXpos>5){ - if( pointMap[(currXpos-1)*MAX_PIC_WIDGET_HEIGHT +currYpos]&0x1e) // have cnt? - { - QMessageBox::warning(this,tr("警告"),tr("两个变量之间至少要空出一个墨点!")); - return 0; - } - } - } - code_index=0; - currentEditTxt =txt; - int r_heightPoint =heightPoint; - int r_widthPoint =widthPoint; - if( widthPoint>MAX_WIDTH) - { - widthPoint=MAX_WIDTH; - return 0; - } - if( currXpos >=MAX_WIDTH ) - { - currXpos=MAX_WIDTH; - return 0; - } - - while(k=0x20 && incode<0x80) - { // ascii - zkIncode = (incode & 0x7f)-0x20; - readAscDot(zkIncode,dot); - if(getInserEnable(currXpos,currYpos,charPara.CharWidth,charPara.CharHeight)) { - return -1; - } - if(charInsert(charPara.CharWidth,1)<0){ - return -1; - } - - if(var[0]) currXpos +=varDotMap(dot,var); - else currXpos +=charDotMap(dot,1); - } - // 先处理特殊功能键 - else if(incode<0x20 )// if(txt.at (0).toLatin1 ()<0x20) - { - if( txt.at (0).toLatin1 () =='\n') // enter key key - { - zkIncode = (0x30)-0x20; - readAscDot(zkIncode,dot); - if( charPara.CharCurrent){ - int h0=getLineHeight(currXpos,currYpos); - if(h0=lineMaxNum){ if(lineMaxNum=4000) - { - zkIncode = (incode-0x0020)*2; - readZhDot(zkIncode,dot); - if(getInserEnable(currXpos,currYpos,charPara.CharWidth,charPara.CharHeight)) return -1; - if(charInsert(charPara.CharWidth,1)<0)return -1; - currXpos +=charDotMap(dot,0); - } - - } - modified = true; - emit picWidgetModify(); - if(zkEditEn) return k; - - } // end of while(k) - - - if(var[0]){ - var[0]=0; - VarGapSet(currXpos-1,charPara.CharHeight); - } - modified = true; - - if(charPara.WidthheightPoint)charPara.LineHeight+currYpos>heightPoint; - - if(widthPoint < currXpos+300) widthPoint = currXpos+300; - if(widthPoint>MAX_WIDTH) widthPoint=MAX_WIDTH; - if(heightPointMAX_HEIGHT) heightPoint=MAX_HEIGHT; - - - if( r_heightPoint < heightPoint || r_widthPoint width/p_var->digitalNum; - int char_bold; - // int num_w ; - int xx=0;// QString str="----\n"; - while(k=0x20 && incode<0x80) - { // ascii - zkIncode = (incode & 0x7f)-0x20; - readAscDot(zkIncode,dot); - char_bold = char_width/(charPara.CharWidth-charPara.FontGap); - - int w = char_bold; - - for(int i=0,n=0;i 580 ?currXpos*scale-580 :0),0)); - r_currXpos=currXpos; - } -} - -int PicWidget::charDotMap(char *dot,bool english ) -{ - int mx=0,mxx=0; - unsigned char wRow[32]; - memset(&wRow,0,sizeof(wRow)); - - if(zkEditEn==0){ - wRow[0]=(charPara.Font <<1)& 0x1e; - wRow[1]=(charPara.LineSpace <<1)& 0x1e; - wRow[2]=(charPara.FontGap <<1)& 0x1e; - wRow[3]=(charPara.Bold <<1)& 0x1e; - wRow[4]=(charPara.CharWidth <<1)& 0x1e; - wRow[5]=(charPara.LineHeight <<1)& 0x1e; - } - // qDebug()<<"wR:"<>1)& 0x0f; // 0 font 1 type 2 digit - while( (c2= pointMap[(x)*MAX_PIC_WIDGET_HEIGHT + y]) & FVAR ){ - if(c2 & FCOL0) n++; - x++;w++; - if(x>widthPoint || w>30*8 || n>8 ) {w=0;n=0;break;} - } - if(w && c1 ==n){// - - c[2]=n;c[3]=w; - } - return n; -} - -void PicWidget::VarGapSet(int x,int h) -{ - for(int i=0;i +#include +#include +#include +#include +#include "LogInfo.h" +#include +//#include + +#include "myinclude.h" +#include +#include + +PicWidget::PicWidget(QWidget *parent):QWidget(parent){ + memset(pointMap,0,sizeof(pointMap)); + heightPoint = 0; + widthPoint = 0; + lineNum=0; + lineMaxNum=0; + pEditMode=0; + memset(linePara,0,sizeof(linePara)); + scale = 16; + currXpos = 0; + currYpos = 0; + altPrint=0; + zkEditEn=false; + startCol=0;startRow=0; + modified = false; + charPara.DrawGridEn=(Qt::CheckState)true; + charPara.Bold=0; + charPara.Font=ST07; + charPara.CharWidth = 6; + charPara.CharHeight = 7; + charPara.Width = 0; + charPara.CharCurrent=1; + charPara.CurrentEn =1; + charPara.LineSpace=1; + charPara.FontGap=1; + charPara.LineHeight = 8; + isInput =0; + charPara.insertMode=1; + + /*system("chmod a+x /opt/zk/unitogb"); + unitogb.setFileName ("/opt/zk/unitogb"); + zkAsc.setFileName ("/opt/zk/asc.bin"); + + zkHz07.setFileName ("/opt/zk/HZK7S"); + zkHz09.setFileName ("/opt/zk/ST1010"); + zkHz12.setFileName ("/opt/zk/HZK12S"); + zkHz16.setFileName ("/opt/zk/HZK16S"); + zkHz24.setFileName ("/opt/zk/ST2424"); + zkHz16H.setFileName ("/opt/zk/HZK16H"); + zkHz24H.setFileName ("/opt/zk/HZK24H");*/ + + //cal_currHeightEn=0; + // qDebug()<<"dfdsfasfsdaf"; +} + +PicWidget::~PicWidget(){ + if(zkAsc.isOpen ()) zkAsc.close (); + if(zkHz07.isOpen ()) zkHz07.close (); + if(zkHz09.isOpen ()) zkHz09.close (); + if(zkHz12.isOpen ()) zkHz12.close (); + if(zkHz16.isOpen ()) zkHz16.close (); + if(zkHz24.isOpen ()) zkHz24.close (); +} + +int PicWidget::getVarNum (){ + return varNum; +} +void PicWidget::zkEditNow() +{ + int var[40]={0}; + charPara.DrawEn =0; + PFONTNAME oldFont=charPara.Font; + charPara.Font = ST12; + currXpos =0; + currYpos =0; + scale =2; + zkEditEn=false; + memset(pointMap,0,40*400); + + +#ifdef ENGLISH + inputTxtDot(tr("Please input a char."),var); +#else + inputTxtDot(tr("请输入要编辑的字符"),var); +#endif + + charPara.Font = oldFont; + zkEditEn=true; + modified = false; + charPara.CharCurrent=0; + charPara.DrawEn =1; + charPara.DrawGridEn=1; + currentEditTxt=""; +} +void PicWidget::zkEditSave() +{ + saveZhDot (); +} +void PicWidget::disp(){ + +} + +void PicWidget::paintEvent(QPaintEvent *event){ + QPainter painter(this); + QRect rect = event->rect(); //重绘部分大小。 + painter.setBrushOrigin(0,40); + static bool flash=0; + flash =!flash; + int x = (int)(rect.x()/scale); + int y = (int)(rect.y()/scale); + int x_ = rect.x() + rect.width(); + int y_ = rect.y() + rect.height(); + int last_x = x_/scale; + int last_y = y_/scale; + for(int i = x; i < widthPoint && i <= last_x; i++){ + for(int j = y; j < heightPoint && j <= last_y; j++){ + QPen pen; + int width = 0; + int YM=heightPoint-1-j; + if(currXpos == i && charPara.CurrentEn && currYpos+(charPara.DrawEn?0:charPara.CharHeight-1) >= YM && currYpos <= YM ){ + width = (scale>4)?1:1;// biankuang + if(flash) + pen.setColor(QColor(Qt::red)); + else{ + width = (scale > 6 && charPara.DrawGridEn)?1:0; + pen.setColor(QColor(Qt::gray)); + } + } + else { + width = (scale > 6 && charPara.DrawGridEn)?1:0; + pen.setColor(QColor(Qt::gray)); + } + + pen.setWidth(width); + painter.setPen(width?pen:Qt::NoPen); + if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]&0x01)==1) + { + painter.setBrush(QColor(Qt::black)); + } + else { + if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FLINE0)) painter.setBrush(QColor(Qt::cyan)); + //else if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FCOL0 & charPara.checkBoxControlChar)) painter.setBrush(QColor(Qt::yellow)); // magenta, yellow, + else if((pointMap[i*MAX_PIC_WIDGET_HEIGHT + YM]& FVAR)) painter.setBrush(QColor(Qt::green)); + else painter.setBrush(QColor(Qt::white)); + } + painter.drawRect(i*scale + width,j*scale + width,scale - 2*width,scale - 2*width); // + } + } + + if(zkEditEn) + emit rowColChanged(tr("编辑字符:%1").arg (currentEditTxt)); + else + emit rowColChanged(tr("[%1行,%2列]").arg (heightPoint).arg (widthPoint)); + + emit currXYChanged(tr("光标[%1,%2]").arg (currYpos).arg (currXpos/*/charPara.CharWidth*/)); //label_CURXY + + emit disp(); +} + +void PicWidget::resizeWidget(int w,int h){ + if(w > MAX_WIDTH || h > MAX_PIC_WIDGET_HEIGHT){ + QMessageBox::warning(0,tr("警告"),tr("最大支持宽度:%1 高度:%2 当前请求:%3 x %4").arg(MAX_WIDTH).arg(MAX_PIC_WIDGET_HEIGHT).arg(w).arg(h)); + widthPoint = (w > MAX_WIDTH)?MAX_WIDTH:w; + heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; + } + else{ + widthPoint = w; + heightPoint = h; + } + resize(w*scale,h*scale); + update(); +} + +void PicWidget::cursorFlash() +{ + if(pEditMode==0 || zkEditEn )return; + + movePicView(); + //update (); + update (); + if(isInput) emit ShowKeybord (); + //qDebug()<<"cur runing."; +} + +int PicWidget::getFontHeight(int x,int y) +{ int res=0, xx=x*MAX_HEIGHT+y; + int font[]={5,7,9,12,16,16,24,24,32}; + unsigned char c=0; + if( (c=pointMap[xx]) & (FLINE0|FCOL0)) + { + res = font[(c>>1)& 0x0f] ; + if(resline.maxFont)line.maxFont=res; + //qDebug()<<( (pointMap[xx+CFONT]>>1)& 0x0f)<>1); + if(resline.maxLineHeight)line.maxFont=res; + // qDebug()<<( (pointMap[xx+CFONT]>>1)& 0x0f)< MAX_HEIGHT-1 )&& x==0) return x1; + if(f0==0 && x>0) { + x = getPrePos(x,x); + f0 = getFontHeight(x,y); + } + while(x){ + x0=x; + x = getPrePos(x,x);//32); + f1 =getFontHeight(x,y); + if(f0 < f1 ){ + x1=x0; + break; + } + + } + return x1; +} +int PicWidget::isCanDelete(int x,int y){ + int res=0; + int xx=x*MAX_HEIGHT+y; + for(int j=4;jlinePara[0]){linePara[1]=x; linePara[0]=h;} + if( linePara[n]) { + n++; + linePara[n]=h; + } + else linePara[n]=h; + } + } + x++; + } + else break; + } + //qDebug()<<"LINEH:"<=5 && y==heightPoint-1){ +// if(y>= currYpos+2*charPara.LineHeight) y=currYpos+charPara.LineHeight; +// y0=y; +// } + //qDebug()<=5){ + if((currYpos-y)>=2*charPara.LineHeight) y=currYpos-charPara.LineHeight; + } + + return y; +} + +int PicWidget::getNextPos(int x,int n) +{ int x1=x++,xx=0; + int varFlag=0; + if(( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR){ + varFlag=1; + n=widthPoint-x;//124*8; + while(n--) + { + if((( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x++; + else {x++;break;} + xx++; + if(x>widthPoint-1)break; + } + if(x>=widthPoint) x=widthPoint;//{ x=x1+charPara.CharWidth;} + if(xx==0) x=x1; + return x; + } + + while(n--) + { + if((( pointMap[x*MAX_HEIGHT+currYpos]&FCOL0) == 0x00) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x++; + else break; + xx++; + //qDebug()<<"getNextPos1:"<=widthPoint ) x=widthPoint;//{ x=x1+charPara.CharWidth;} + if(xx==0) x=x1; + //qDebug()<<"getNextPos"<MAX_WIDTH-1)return 1; + while(n) + { if(x>=MAX_WIDTH) break; + n--; + if(( pointMap[x*MAX_HEIGHT+currYpos]&(FLINE0 | FCOL0))== 0x00) x++; + else break; + // if(xx<30)xx++;else break; + } + return (n<=0); +} + +int PicWidget::isVar(int x,int y) //isVar +{ + return (( pointMap[x*MAX_HEIGHT+y]&FVAR) == FVAR) ; +} + +int PicWidget::getPrePos(int x,int n) +{ x--; + int n0=x; + n=x; + while(n--) + { + if(x){ + if(( pointMap[x*MAX_HEIGHT+currYpos]&FCOL0)) break; + x--; + } + else break; + } + if(( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR){ + n=n0; + while(n--) + { + if((( pointMap[x*MAX_HEIGHT+currYpos]&FVAR) == FVAR) &&( pointMap[x*MAX_HEIGHT+currYpos]&FLINE0)) x--; + else {x++;break;} + if(x<=0) break; + + } + if(x<=0) x=0; + } + return x; +} + +void PicWidget::mousePressEvent ( QMouseEvent * event ){ + int x = (int )(event->x()/(scale)); + int y = heightPoint -(int )(event->y()/scale)-1; + static bool r_DrawEn=!charPara.DrawEn; + + if(x < widthPoint && y < heightPoint){ + int oriX = currXpos; + int oriY = currYpos; + + if(charPara.DrawEn) + { modified = true; + + currXpos = x; + currYpos = y; + if((pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]&0x1e) ==(unsigned char)(0x00)) + { + if(pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]&0x01) + pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] &=0xfe; + else pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] |=0x01; + } + if(r_DrawEn) update(oriX*scale,oriY*scale,scale,scale); //将原来的焦点去掉 + else update(oriX*scale,oriY*scale,scale,scale*(charPara.LineHeight+1)); //将原来的焦点去掉 + update(x*scale,y*scale,scale,scale); + emit picWidgetModify(); + update(); + // + } + else + { + currXpos = x; + currYpos = y; + + currXpos = SiteStart(currXpos); + currYpos = getDownLine(currXpos); + // if(isVar(oriX,currYpos)) getNextPos(oriX,24*8); + // currXpos = getNextPos(currXpos,charPara.CharWidth); + + if(currXpos > widthPoint) currXpos=widthPoint; + if(currXpos<0) currXpos=0; + if(currYpos<0) currYpos=0; + + + if(charPara.DrawEn) + { + + if(currYpos>=heightPoint) currYpos=heightPoint; + if(isVar(currXpos,currYpos)){ + currXpos = getNextPos( currXpos,24*8); + } + } + else + { + if(isVar(currXpos,currYpos)){ + currXpos = getNextPos( currXpos,24*8); + } + } + //emit movePicView(); + emit ShowKeybord(); + update(oriX*scale,oriY*scale,scale,scale*(charPara.LineHeight)); + update(currXpos*scale,currYpos*scale,scale,scale*(charPara.LineHeight)); + } + r_DrawEn=charPara.DrawEn; + + } +} +int PicWidget::isBlankCol() +{ int cnt=0; + int x = currXpos*MAX_PIC_WIDGET_HEIGHT; + for(char i=0;i0){ // right + currXpos = getNextPos(oriX,widthPoint-currXpos); + + } + else if(shiftX<0){ + if(currXpos) + currXpos = getPrePos(oriX,currXpos); + } + else { } + + if(shiftY<0){ // UP + currYpos = getUpLine(oriX); + if(isVar(oriX,currYpos)) + currXpos = getPrePos(oriX,124*8); + else currXpos = SiteStart(oriX); + + } + else if(shiftY>0){ + if(currYpos) + currYpos = getDownLine(oriX); + if(isVar(oriX,currYpos)) + currXpos = getPrePos(oriX,124*8); + else currXpos = SiteStart(oriX); + } + else{ } + + } + else { + + if(shiftX>0) shiftX=1; + else if(shiftX<0) shiftX=-1; + else shiftX=0; + currXpos += shiftX; + if(currXpos<0)currXpos=0; + else if(currXpos>=widthPoint-1)currXpos=widthPoint-1; + + // qDebug()<<"Y0:"<0) shiftY=-1; + else if(shiftY<0) shiftY=1; + else shiftY=0; + currYpos += shiftY; + if(currYpos<0) currYpos=0; + if(currYpos>heightPoint-1) currYpos =heightPoint-1; + // qDebug()<<"Y1:"<40) h0=40; + if(altPrint){ + h0 = h0/2; + } + + return h0; +} + +int PicWidget::getWidth(){ + return widthPoint; + +} + +int PicWidget::getScaleValue(){ + return scale; +} +void PicWidget::bindSysPara(SysPara *sysPara){ + //this->sysPara1 = sysPara; +} +void PicWidget::initWidget(int w,int h){ + scale = 30; + if(parentWidget()){ + startRow=0; + startCol=0; + QWidget *widget = parentWidget(); + int width = widget->geometry().width(); + int height = widget->geometry().height(); + int scaleX = w?width/w:width; //不要除零 + int scaleY = h?height/(h):height; + scaleX = scaleX > 0?scaleX:1; //scale不能小于零 + scaleY = scaleY > 0?scaleY:1; + scale = scaleY>10?10:scaleY;// > scaleY?scaleX:scaleY; + if(charPara.DrawEn) scale=(scale<8)?8:scale; + else scale=(scale>4)?4:scale; + } + currXpos = 0; + currYpos = 0; + varNum =0; + charPara.Width = w; + //emit movePicView(1); + memset(pointMap,0,sizeof(pointMap)); + resizeWidget(w,h); + modified = false; + picSetHome(); +} + +void PicWidget::enlargeDisplay(){ + if(scale < (1<<10)){ + scale = scale + ((scale>2)?scale/2:1); + resize(widthPoint*scale,heightPoint*scale); + update(); + } +} + + +void PicWidget::reduceDisplay(){ + if(scale > 1){ + scale = scale - ((scale > 2)?scale/3:1); + resize(widthPoint*scale,heightPoint*scale); + update(); + } +} + +void PicWidget::setScale(int scale){ + if(scale > 1) + this->scale = scale; + else + scale = 1; + resize(widthPoint*scale,heightPoint*scale); + update(); +} +void PicWidget::insertImage1(QString filename,bool forceSize){ + if((widthPoint == 0 || heightPoint == 0) && forceSize){ + QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); + } + else { + QImage img(filename); + if(img.isNull()){ + QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); + } + else { + int w = img.rect().width(); + int h = img.rect().height(); + + + if(widthPoint +w 16 + else temp=6; // 24 + //int font[]={5,7,9,12,16,16,24,24,32}; + wRow[0]=( temp<<1)& 0x1e; + if(h<7) temp=h-5; //5 + else if(h<9) temp=h-7;//7 + else if(h<12) temp=h-9;//9 + else if(h<16) temp=h-12;//12 + else if(h<24) temp=h-16;//4,5 =>16 + else temp=h-24; // 24 + wRow[1]=( temp <<1)& 0x1e; + wRow[2]=(charPara.FontGap <<1)& 0x1e; + wRow[3]=(charPara.Bold <<1)& 0x1e; + wRow[4]=(charPara.CharWidth <<1)& 0x1e; + wRow[5]=(charPara.LineHeight <<1)& 0x1e; + } + + if(forceSize){ + widthPoint =w; + heightPoint=h; + currXpos=0; + currYpos=0; + } + resizeWidget(widthPoint,heightPoint); + charInsert(w,0); + + for(int i = 0; i < w;i++){ + if((currXpos+ i)>=MAX_WIDTH) break; + + for(int j = 0; j < h ; j++){ + if((currYpos + j)>=MAX_PIC_WIDGET_HEIGHT) break; // continue;// + QRgb argb = img.pixel(i,j); + + //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); + if((argb == 0xffffffff) ) //节约时钟周期 + { + pointMap[(currXpos+i)*MAX_PIC_WIDGET_HEIGHT +(currYpos+h-1-j)] = (i?0:FCOL0) |(jwidthPoint)currXpos=widthPoint; + update(); + } + } +} + +void PicWidget::insertImage(QString filename,bool forceSize){ + + if((widthPoint == 0 || heightPoint == 0) && forceSize){ + QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); + } + else { + QImage img(filename); + if(img.isNull()){ + QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); + } + else + { + int w = img.rect().width(); + int h = img.rect().height(); + bool isToWidth=0; + + charInsert(w,0); + +// widthPoint+=w; +// /* 2014-2-28 修正了插入图片造成死机问题。原因:由于数组下标溢出 */ +// if(widthPoint>MAX_WIDTH){ widthPoint=MAX_WIDTH;} +// if(heightPoint>MAX_PIC_WIDGET_HEIGHT){ heightPoint=MAX_PIC_WIDGET_HEIGHT;} +// if(w+currXpos>widthPoint) {w = widthPoint-currXpos;isToWidth=1;} +// if(h+currYpos>heightPoint){ h =heightPoint-currYpos;isToWidth=1;} + +// resizeWidget (widthPoint,heightPoint); + + for(int i = 0; i < w;i++){ + if((currXpos+ i)>=MAX_WIDTH) break; + uint c=0;uchar cc=0,c1=0; + + for(int j = 0; j < h ; j++){ + if((currYpos + j)>=MAX_PIC_WIDGET_HEIGHT) break; // continue;// + QRgb argb = img.pixel(i,j); + c1 = argb&0xff; + + //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); + if((argb == 0xffffffff) ) //节约时钟周期 + { + pointMap[(currXpos+i)*MAX_PIC_WIDGET_HEIGHT +(currYpos+h-1-j)] = (i?0:FCOL0) |(jwidthPoint)currXpos=widthPoint; + update(); + } + } +} +void PicWidget::readPng(int x,int y,int w,int h) +{ + +} + +void PicWidget::loadImage(QString filename,bool forceSize){ + + if((widthPoint == 0 || heightPoint == 0) && forceSize){ + QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); + } + else { + QImage img(filename); + if(img.isNull()){ + QMessageBox::warning(0,tr("警告"),tr("文件:%1 无法打开").arg(filename)); + } + else + { + int w = img.rect().width(); + int h = img.rect().height(); + startRow=0; + startCol=0; + varNum =0; + memset(pointMap,0,sizeof(pointMap)); + if(!forceSize){ + widthPoint = (w > MAX_WIDTH)?MAX_WIDTH:w; + heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; + resize(widthPoint*scale,heightPoint*scale); + } + // readPng(0,0,w,h); + for(int i = 0; i < widthPoint;i++){ + uint c=0;uchar cc=0,c1=0; + for(int j = 0; j < heightPoint ; j++){ + bool pixelVisible = false; + int init_x = i*w/widthPoint; + int end_x = (w >= widthPoint)?(i + 1)*w/widthPoint:init_x + 1; + int init_y = j*h/heightPoint; + int end_y = (h >= heightPoint)?(j + 1)*h/heightPoint:init_y + 1; + c=0; + for(int l = init_x; l < end_x; l++){ + for(int m = init_y; m < end_y; m ++){ + QRgb argb = img.pixel(l,m); + c1 = argb&0xff; + + //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); + if((argb == 0xffffffff) ) //节约时钟周期 + { + continue; + } + if(((argb & 0xffffff00)==0xff000000 ) + ||((argb & 0xffffff00)==0xffffff00 )) //节约时钟周期 + { + c = c1; + pixelVisible = true; + break; + } + } + if(pixelVisible || c) break; + } + pointMap[i*MAX_PIC_WIDGET_HEIGHT +(heightPoint-1- j)] = c; + }// one col end + } + currXpos=0; + currYpos=0; + //currMode = cal_currHeight()>0; + line.Len=widthPoint; + charPara.LineHeight =getLineHeight(0,0); + if( getLineEnd(0)<5) { + qDebug()<<"FILE TYPE ERROR!"; + } + update(); + } + } +} + +void PicWidget::getPrintDat(unsigned char *dat,unsigned char alt2,SysPara *sysPara) +{ + if(!sysPara ) return; + int res=0; + res = resizePicRect(alt2); + + int hStart,hEnd; + int h= endRow-startRow+1;// + + hStart= (alt2>1)?h>>1:0; + hEnd = (alt2==1)?h>>1 :h; + + for(int i = 0 ; i < widthPoint; i++) + { + unsigned char c=0,c1=0; + int j=0; + for( j = hStart; j < hEnd; j++) + { + c |= (pointMap[(i)*MAX_PIC_WIDGET_HEIGHT+startRow + h-1-j]&0x01)? (1 << (j%8)):0; + if(j%8==7) { dat[i*5+(j-hStart)/8]=c; c=0; } + } + dat[i*5+(j-hStart)/8]=c; + } +} + +/* =============================================== + 040608 121416 242628 32343638 4648 52545658 646668 727476787A 848688 949698 + 02 0A 16 22 2A 3A 44 48 52 62 7A 82 8A 92 9A + 02 0A 16 2A 3A 44 48 52 62 7A 82 8A 92 9A + 02 0A 16 2A 343638 42 48 52545658 62646668 78 848688 92 9A + 02 0A 16 28 3A 42 48 5A 62 6A 78 82 8A 9496989A + 02 0A 16 26 3A 424446484A 5A 62 6A 76 82 8A 9A + 03 0B 17 25 3B 49 5B 63 6B 77 83 8B 9B + 050709 131517191B 232527292B 33353739 49 53555759 656769 77 858789 93959799 +=============================================== */ + +void PicWidget::getCharRamData(SysPara *sysPara) +{ + // 生成字模数据 + if(sysPara->status.variNum) + { + int ramAddress = 0; + if(sysPara->status.variNum>8)sysPara->status.variNum=8; + + for(int i = 0; i < sysPara->status.variNum; i++){ + + vars_t *p_var = &sysPara->status.vars[i]; + p_var->bassAddr = -1; + if(p_var->original){ //清除原来的记录 + if(p_var->dat){ + free(p_var->dat); + } + p_var->original = false; + } + for(int j = 0; j < i; j ++){ //重复检测是否有重复大小的字存在 + if((p_var->height == sysPara->status.vars[j].height) + &&(p_var->width/p_var->digitalNum == sysPara->status.vars[j].width/sysPara->status.vars[j].digitalNum )) + { + p_var->bassAddr = sysPara->status.vars[j].bassAddr; + p_var->datHeight = sysPara->status.vars[j].datHeight; + p_var->datWidth = sysPara->status.vars[j].datWidth; + p_var->rowByteNum = sysPara->status.vars[j].rowByteNum; + p_var->dat = sysPara->status.vars[j].dat; + break; + } + } + if(p_var->bassAddr == -1){ + int width = (p_var->digitalNum)?(p_var->width/p_var->digitalNum):5; + int height = p_var->height; + if(p_var->digitalNum>8 || p_var->type >9 + || p_var->digitalNum<2 || p_var->width<5 + || p_var->height<5 || p_var->height>24 + || p_var->type <0 ||p_var->letterSpace >5 + || p_var->letterSpace <0 + ) + { + return; + } + + // 先根据变量高度,选择一种字体,然后读出0~9的字模,然后进行行列转换,存储到p_var->dat + //char font[]={5,7,9,12,16,16,24,24,32}; + if(p_var->height>=18) charPara.Font=ST24; + else if(p_var->height>=13) { + charPara.Font=p_var->width/p_var->digitalNum-p_var->letterSpace==(p_var->bold?24:12)?HT16:ST16; + } + else if(p_var->height>=10) charPara.Font=ST12; + else if(p_var->height>=8) charPara.Font=ST09; + else if(p_var->height>=6) charPara.Font=ST07; + else charPara.Font=ST05; + + width = (p_var->digitalNum)?(10*p_var->width/p_var->digitalNum):12; + + int zm_width = 11* width; + int zm_height = p_var->height; + unsigned char pMap[(zm_width+10)*40]; // >720 + + charPara.LineSpace = p_var->letterSpace; + //memset(zm,0,sizeof(zm)); + memset(pMap,0,sizeof(pMap)); + inputRamDot (QString("0123456789"),pMap, p_var);// READ DOT FROM ASB.BIN + + int rowDiff = p_var->endRowPos - p_var->startRowPos; + int firstValidRow; + int lastValidRow = 0; + int firstValidRowDiff; + if(lastValidRow >= rowDiff){ + firstValidRow = lastValidRow - rowDiff; + firstValidRowDiff = firstValidRow; + } + else { + firstValidRow = 0; + firstValidRowDiff = lastValidRow > rowDiff; + } + firstValidRow = firstValidRow >= 0?firstValidRow:0; //纠正 第一行位置 + int rowByteNum = rowDiff/8 + ((rowDiff%8)?1:0); // 行数 + + unsigned char *dat = (unsigned char *)calloc(width,rowByteNum); + + for(int k = zm_height - 1; k >= 0 ; k--){ + for(int j = 0; j < zm_width; j ++){ + if(pMap[j*MAX_PIC_WIDGET_HEIGHT+k]&0x01){ + lastValidRow = k + 1; + break; + } + } + if(lastValidRow != 0) + break; + } + for(int k = firstValidRow; k < lastValidRow; k++){ + for(int j = 0; j < width; j ++){ + int currRow = k - firstValidRowDiff; + if(pMap[j*MAX_PIC_WIDGET_HEIGHT+k]&0x01){ + dat[rowByteNum*j + currRow/8] |= (1<<(currRow%8)); + } + else{ + } + } + } + p_var->bassAddr = ramAddress; + p_var->datHeight = height; + p_var->datWidth = width; + p_var->rowByteNum = rowByteNum; + p_var->dat = dat; + p_var->original = true; + p_var->currVal = -1; //相当于初始化 + ramAddress += rowByteNum * width; + } + } + } +} + +int PicWidget::readVar(SysPara *sysPara, unsigned char alt2)// alt2 =0,1,2 +{ + if(sysPara) + { + varNum=0; // _______SAMW + altPrint = alt2; + resizePicRect(alt2); + + for(int j = 0; j < heightPoint; j++) + { + line.maxFont=MAX_HEIGHT;line.minFont =0; // start + + for(int i = 0 ; i < widthPoint; i++) + { + getLineHeight(i,j); // cal min lineHeight, max lineHeight + + unsigned char c[6]; + unsigned char c1=pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]; + + if((c1 & FCOL0 ) && (c1 & FLINE0) && (c1 & FVAR)) + { // 定位变量的起点 +// // W0 ==font V1 = type V2 = diginum V3 = width + c1=(pointMap[(i+VTYPE)*MAX_PIC_WIDGET_HEIGHT + j] >>1)& 0x0f; //type + c[0]=(pointMap[(i+CFONT)*MAX_PIC_WIDGET_HEIGHT + j] >>1)& 0x0f; //font + if(c1 > 9 && c1 != 13) continue; //type,cnt3 is 13 + c[1]=c1; + // qDebug ()<<"C1"<status.vars[varNum].type=c[VTYPE]; + sysPara->status.vars[varNum].digitalNum=c[VDIGIT]; + sysPara->status.vars[varNum].width=c[VWIDTH]; + sysPara->status.vars[varNum].height =getFontHeight(i,j); + sysPara->status.vars[varNum].startColPos =i; + sysPara->status.vars[varNum].startRowPos=endRow+1-(j+sysPara->status.vars[varNum].height); + sysPara->status.vars[varNum].endRowPos=endRow+1-(j); + c1=(pointMap[(i)*MAX_PIC_WIDGET_HEIGHT + j+ CFONTGAP] >>1)& 0x0f; //font + sysPara->status.vars[varNum].letterSpace= c1>5?5:c1; + } + + varNum++; + if(varNum>8){ + varNum=8; + QMessageBox::warning(this,tr("警告"),tr("信息中的变量数超过了最大值(8)!请减小变量数.")); + break; + } + i+=c[VWIDTH]-1; + + } + + + } + j+=line.minLineHeight?line.minLineHeight-1:0; + } + //startCol =0; + sysPara->status.variNum=varNum; + //qDebug()<<"varn:"<status.variNum; + } // end of if(sysPara) + return varNum; +} + +// resizePicRect(); +int PicWidget::resizePicWidth(bool rowEn) +{ + //int w=0,Flag=0; + startCol=0; + endCol=0; + for(int j = 0; j < heightPoint; j++){ + { + for(int i = endCol ; i < widthPoint; i++) + if(((pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]&0x01))||((pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]&FLINE0))) + { + if(endCol21 ) endRow=lastLinePos+23; + else if(lastLineHeigt>16) ; + else if(lastLineHeigt>13) endRow=lastLinePos+15; + else if(lastLineHeigt>10) endRow=lastLinePos+11; + else if(lastLineHeigt>7) endRow=lastLinePos+8; + else if(lastLineHeigt>5) endRow=lastLinePos+6; + + } + return startRow; +} + +/* + 文件格式说明 + 1. 在图像文件中,存储变量信息,D0=1表示有点,D0=0表示无点 + 2.地址 信息D6~D1 + 0 0xaa + 1 varNum + 2 0x68 + 3 + 3. 变量参数 隐藏在变量占位符中D6~D1 + 列编号 变量信息(1~128) + 0 类型+1 + 1 位数+1 + 2 字符宽度(点)/2 +1 + 3 字符高度(点)+1 + 4 字符间隔+1 + */ + +void PicWidget::saveImage(QString filename){ + if(widthPoint == 0 || heightPoint == 0){ + QMessageBox::warning(0,"警告","请新创建图片"); + } + else { + update (); + resizePicWidth(0); + // resizePicRect(0); + QSize size(widthPoint,heightPoint); + QImage image(size,QImage::Format_ARGB32); + image.fill(qRgba(0,0,0,0xff)); + for(int i = 0 ; i < widthPoint; i++){ + for(int j = 0; j < heightPoint; j++){ + uint c = 0; + uchar cc= pointMap[( i)*MAX_PIC_WIDGET_HEIGHT +(heightPoint-1- j)]; + if((cc&0x01)==1) + { + c=0xff000000 | (cc) ; + } + else + { + if(cc==0) c=0xffffffff; + else c = 0xffffff00 | (cc); + } + image.setPixel(i,j,c); + } + } + image.save(filename); + } + setModified(false); +} + +void PicWidget::saveImage1(QString filename){ + if(widthPoint == 0 || heightPoint == 0){ + QMessageBox::warning(0,"警告","请新创建建图片"); + } + else { + QSize size(widthPoint,heightPoint); + QImage image(size,QImage::Format_ARGB32); + image.fill(qRgba(0,0,0,0xff)); + for(int i = 0 ; i < widthPoint; i++){ + for(int j = 0; j < heightPoint; j++){ + image.setPixel(i,j,pointMap[i*MAX_PIC_WIDGET_HEIGHT +heightPoint-1- j]?0xff000000:0xffffffff); + } + } + filename = DOC_ROOT_DIR+ QFileInfo(filename).baseName()+".jpg"; + image.save( filename ); + } + setModified(false); +} + +int PicWidget::picDelOneChar() +{ + int posx =currXpos; + emit picWidgetModify(); + if(zkEditEn) + { + memset(pointMap,0,40*40); + resizeWidget (widthPoint,heightPoint); + update (); + return 0; + } + + if(posx==0)return 0; + if(isCanDelete(currXpos,currYpos)) return -1; + currXpos = getPrePos(posx,posx);//32); + picDelNextChar( ); + + return 0; +#if 0 + int posxEnd = getLineEnd(posx); + int posx2 = getPrePos(posx,32); + //========================= +#ifdef FONTMATCH //是否需要匹配字体能操作 + if(getFontHeight(posx2,posy)!=charPara.CharHeight)return posx; +#endif + + if(posxEnd>posx && posx2posx && posx2>posx) + {//13 0 24 30 172 + //qDebug()<<"DelNext:"<=line.Len) + { + line.Len -=posx-posx2; + //line.Len; + resizeWidget(line.Len,heightPoint); + } + movePicView(); + update (); + return posx; +} + +void PicWidget::delDots(int x1,int x2,int y1,int h){ + int i,j; + for(i=x1;i0){ + int xMaxPos= linePara[1];// + for(i=x2-1;i>=x1;i--) { + + if(icurrXpos && posx2){ + + moveDots(currXpos,posx1,posy1,linePara[0],w); // + + } + else if(posx1==currXpos && posx2){ + if( pointMap[posx1*MAX_PIC_WIDGET_HEIGHT+posy1] & (FCOL0 | FVAR)) { + // qDebug()<<"INsert1:"<w){ + // qDebug()<<"INsert2:"; + } + else{ + //qDebug()<<"INsert3:"; + return -1; + } + + } + + return 0; +} +char PicWidget::getZkPic(char *dat) +{ int n=0; + QString s="S-",s1; + for(int i=0;iisOpen ()) pzkEditFile->close (); + pzkEditFile->open (QIODevice::ReadWrite); + char dot[100]; + ///for(int i=0;i<100;i++)dot[i]=0; + memset(dot,0,sizeof(dot)); + getZkPic(dot); // + //qDebug ()<<"zk-2-"<fileName ()<seek(zkOffset); + pzkEditFile->write(dot,zkReadNum); + pzkEditFile->close (); +} + +void PicWidget::readAscDot(unsigned int asc,char *dot) +{ + int offset1[]={BIN0805,BIN0808,BIN0810,BIN0812,BIN0816,BIN1616,BIN2424,BIN2424,BIN2424}; + int fontNum[]= {8,8,10,12,16,32,72,72,72 }; + int fontHeight[]={5,7,9,12,16,16,24,24,24 }; + int fontWidth[]= {5,5,7,8,8,12,24,24,24 }; + QFile *pzkFile; + pzkFile = (QFile * )&zkAsc; + if(!pzkFile->isOpen ()) pzkFile->open (QIODevice::ReadWrite); + pzkEditFile = (QFile * )pzkFile; + charPara.CharHeight = fontHeight[charPara.Font]; + charPara.CharWidth = fontWidth [charPara.Font]+charPara.FontGap; + charPara.LineHeight = charPara.CharHeight +charPara.LineSpace; + zkReadNum = fontNum[charPara.Font]; + zkOffset = asc*fontNum[charPara.Font]+offset1[charPara.Font]; + pzkFile->seek(zkOffset); + pzkFile->read(dot,zkReadNum); + //qDebug ()<<"EN"<close (); +} + +void PicWidget::readZhDot(unsigned int ingb,char *dot ) +{ + unsigned int gbCode=0; + unsigned char gbcode[4]; + if(!unitogb.isOpen ()) unitogb.open (QIODevice::ReadWrite); + unitogb.seek (ingb); + unitogb.read ((char*)gbcode,2); + unitogb.close (); + gbCode = (gbcode[0]<<8)+gbcode[1]; + + QFile *pzkFile1[]={&zkHz05,&zkHz07,&zkHz09,&zkHz12,&zkHz16,&zkHz16H,&zkHz24,&zkHz24H,&zkHz24H}; + int fontNum[]= {8,16,20,24,32,32,72,72,72 }; + int fontHeight[]={5,8,10,12,16,16,24,24,24 }; + int fontWidth[]= {8,8,9,12,16,16,24,24,24 }; + // qDebug()<=0xa1)&&(gbcode[0]<=0xff)) + { + //qDebug()<isOpen ()) + pzkEditFile->open (QIODevice::ReadWrite); + zkReadNum = fontNum[charPara.Font]; + zkOffset =(gbcode[0]-0xa1)*zkReadNum*94+(gbcode[1]-0xa1)*zkReadNum; //区位码=区字节+位字节 16*2 + pzkEditFile->seek(zkOffset); + pzkEditFile->read(dot,zkReadNum); // write to stderr + //qDebug ()<<"CH:"<fileName ()<0 && var[0]<10) { + if(currYpos){ + if( pointMap[(currXpos)*MAX_PIC_WIDGET_HEIGHT +currYpos-1]&0x1e){ + QMessageBox::warning(this,tr("警告"),tr("两个变量之间至少要空出一个墨点!")); + return 0; + } + + } + if(varNum<7) varNum++; + + if(currXpos>5){ + if( pointMap[(currXpos-1)*MAX_PIC_WIDGET_HEIGHT +currYpos]&0x1e) // have cnt? + { + QMessageBox::warning(this,tr("警告"),tr("两个变量之间至少要空出一个墨点!")); + return 0; + } + } + } + code_index=0; + currentEditTxt =txt; + int r_heightPoint =heightPoint; + int r_widthPoint =widthPoint; + if( widthPoint>MAX_WIDTH) + { + widthPoint=MAX_WIDTH; + return 0; + } + if( currXpos >=MAX_WIDTH ) + { + currXpos=MAX_WIDTH; + return 0; + } + + while(k=0x20 && incode<0x80) + { // ascii + zkIncode = (incode & 0x7f)-0x20; + readAscDot(zkIncode,dot); + if(getInserEnable(currXpos,currYpos,charPara.CharWidth,charPara.CharHeight)) { + return -1; + } + if(charInsert(charPara.CharWidth,1)<0){ + return -1; + } + + if(var[0]) currXpos +=varDotMap(dot,var); + else currXpos +=charDotMap(dot,1); + } + // 先处理特殊功能键 + else if(incode<0x20 )// if(txt.at (0).toLatin1 ()<0x20) + { + if( txt.at (0).toLatin1 () =='\n') // enter key key + { + zkIncode = (0x30)-0x20; + readAscDot(zkIncode,dot); + if( charPara.CharCurrent){ + int h0=getLineHeight(currXpos,currYpos); + if(h0=lineMaxNum){ if(lineMaxNum=4000) + { + zkIncode = (incode-0x0020)*2; + readZhDot(zkIncode,dot); + if(getInserEnable(currXpos,currYpos,charPara.CharWidth,charPara.CharHeight)) return -1; + if(charInsert(charPara.CharWidth,1)<0)return -1; + currXpos +=charDotMap(dot,0); + } + + } + modified = true; + emit picWidgetModify(); + if(zkEditEn) return k; + + } // end of while(k) + + + if(var[0]){ + var[0]=0; + VarGapSet(currXpos-1,charPara.CharHeight); + } + modified = true; + + if(charPara.WidthheightPoint)charPara.LineHeight+currYpos>heightPoint; + + if(widthPoint < currXpos+300) widthPoint = currXpos+300; + if(widthPoint>MAX_WIDTH) widthPoint=MAX_WIDTH; + if(heightPointMAX_HEIGHT) heightPoint=MAX_HEIGHT; + + + if( r_heightPoint < heightPoint || r_widthPoint width/p_var->digitalNum; + int char_bold; + // int num_w ; + int xx=0;// QString str="----\n"; + while(k=0x20 && incode<0x80) + { // ascii + zkIncode = (incode & 0x7f)-0x20; + readAscDot(zkIncode,dot); + char_bold = char_width/(charPara.CharWidth-charPara.FontGap); + + int w = char_bold; + + for(int i=0,n=0;i 580 ?currXpos*scale-580 :0),0)); + r_currXpos=currXpos; + } +} + +int PicWidget::charDotMap(char *dot,bool english ) +{ + int mx=0,mxx=0; + unsigned char wRow[32]; + memset(&wRow,0,sizeof(wRow)); + + if(zkEditEn==0){ + wRow[0]=(charPara.Font <<1)& 0x1e; + wRow[1]=(charPara.LineSpace <<1)& 0x1e; + wRow[2]=(charPara.FontGap <<1)& 0x1e; + wRow[3]=(charPara.Bold <<1)& 0x1e; + wRow[4]=(charPara.CharWidth <<1)& 0x1e; + wRow[5]=(charPara.LineHeight <<1)& 0x1e; + } + // qDebug()<<"wR:"<>1)& 0x0f; // 0 font 1 type 2 digit + while( (c2= pointMap[(x)*MAX_PIC_WIDGET_HEIGHT + y]) & FVAR ){ + if(c2 & FCOL0) n++; + x++;w++; + if(x>widthPoint || w>30*8 || n>8 ) {w=0;n=0;break;} + } + if(w && c1 ==n){// + + c[2]=n;c[3]=w; + } + return n; +} + +void PicWidget::VarGapSet(int x,int h) +{ + for(int i=0;i -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include "SysPara.h" -#include "ParaSettingUI.h" - -#define MAX_PIC_WIDGET_HEIGHT 60 -#define MAX_PIC_WIDGET_WIDTH 600*8 -#define MAX_WIDTH MAX_PIC_WIDGET_WIDTH-100 -#define MAX_HEIGHT MAX_PIC_WIDGET_HEIGHT -#define MAXLINE 40 - -#define FVAR (1<<5) -#define FCOL0 (1<<6) -#define FLINE0 (1<<7) - -#define CFONT 0 -#define CLINESPACE 1 -#define CFONTGAP 2 -#define CBOLD 3 -#define CHEIGHT 4 - -#define VTYPE 1 -#define VDIGIT 2 -#define VWIDTH 3 -#define VTYPE0 4 -#define VTYPE1 5 -//#define C 5 - -#define BIN0808 100 -#define BIN0809 1000 -#define BIN0810 2000 -#define BIN0812 3000 -#define BIN0816 5000 -#define BIN1616 7000 -#define BIN2424 11000 -//#define BIN1224 15000 -#define BIN0805 20000 - -//是否需要匹配字体能操作 -//#define FONTMATCH - -typedef enum{ - ST05=0, - ST07=1, - ST09=2, - ST12=3, - ST16=4, - HT16=5, - ST24=6, - HT24=7, - ST32=8 -}PFONTNAME; - -typedef struct -{ - bool DrawEn;// 绘图 - bool DrawGridEn; // 网格 checkBoxDrawGridEn - int Width;// 字串长度 - unsigned char CharHeight; //字符高度 - unsigned char CharWidth; //字符宽度 - unsigned char FontGap; // 字符间隔 - PFONTNAME Font;// 字体 - bool CharCurrent; //光标类型,字符还是像素 - bool CurrentEn; - unsigned char LineSpace; - unsigned char Bold; // 字体加粗 - unsigned char LineHeight; - bool insertMode; - bool checkBoxControlChar;//控制符显示 -} t_charPara; - -typedef struct{ - int width; - int height; - bool enable; -} t_draw; - -typedef struct{ - int Len; - int yPos; - int xPos; - int minFont; - int maxFont; - int minLineHeight; - int maxLineHeight; -}t_line; - -class PicWidget:public QWidget{ - Q_OBJECT - -public: - explicit PicWidget(QWidget *parent = 0); - ~PicWidget(); - - void resizeWidget(int w,int h); - void initWidget(int w,int h); - void loadImage(QString filename,bool forceSize = true); - void insertImage(QString filename,bool forceSize = false); - - void saveImage(QString filename); - void enlargeDisplay(); - void reduceDisplay(); - void setScale(int scale); - - void paintEvent(QPaintEvent *); - - void mousePressEvent ( QMouseEvent * event ); - - void currPositionMove(int shiftX,int shiftY); - void ensureCurrPos(); - int getScaleValue(); - bool isModified(); - int getHeight(); - int getWidth(); - void readAscDot(unsigned int asc, char *dot); - void readZhDot(unsigned int ingb, char *dot); - int inputTxtDot(QString txt,int *var); - int inputRamDot(QString txt,unsigned char *pMap, vars_t *p_var); - int charDotMap( char *dot,bool english ); - int varDotMap(char *dot,int *var); - int picDelOneChar(); - int picDelNextChar(); - t_charPara charPara; - t_draw drawPara; - int picSetHome(); - int picSetEnd(); - int getVarNum(); - int readVar(SysPara *sysPara, unsigned char alt2); - void getPrintDat(unsigned char *dat,unsigned char alt2,SysPara *sysPara); - void getCharRamData(SysPara *sysPara); - - int resizePicRect(bool alt2); - void movePicView(); - void bindSysPara(SysPara *sysPara); - int altPrint; - int startRow; - int startCol; - int heightPoint; - int widthPoint; - int scale; - int currXpos; - int currYpos; - int endRow; - int endCol; - bool zkEditEn; - bool isInput ; - bool pEditMode; - void zkEditNow(); - void zkEditSave(); - void disp(); - QString currentEditTxt; - int resizePicWidth(bool rowEn); - int getNextPos(int x, int n); - int getLineEnd(int x); - int getUpLine(int x); - int getDownLine(int x); - int getPrePos(int x, int n); - int getBlandPos(int x, int n); - int SiteStart(int x); - void moveDots(int x1, int x2, int y1, int h, int w); - int getFontHeight(int x, int y); - - void VarGapSet(int x, int h); - int VarGetWidth(int x,int y,unsigned char *c); - int getLineHeight(int x, int y); - int getInserEnable(int x, int y, int w, int h); - void delDots(int x1, int x2, int y1, int h); - int isVar(int x, int y); - int getPicRealHeight(); - int getUpLineStart(int x, int y); - int isCanDelete(int x, int y); - void readPng(int x, int y, int w, int h); - void insertImage1(QString filename, bool forceSize); - void saveImage1(QString filename); -public slots: - void cursorFlash(); // 光标闪烁 - - -Q_SIGNALS: - void picWidgetModify(); - void ShowKeybord( ); - void rowColChanged(QString); - void currXYChanged(QString); - void ChangeFont(int cc); -private: - unsigned char pointMap[MAX_PIC_WIDGET_HEIGHT * (MAX_PIC_WIDGET_WIDTH)]; - - bool modified; - int varNum; - t_line line; - int linePara[MAXLINE]; - int lineNum; - int lineMaxNum; - //SysPara *sysPara1; - void setModified(bool m); - void saveZhDot(); - char getZkPic(char *dat); - int charInsert(int w,bool txtMode); - int isBlankCol(); - unsigned long zkOffset; - unsigned char zkReadNum; - unsigned int zkIncode; - QFile *pzkEditFile; - QString txt; - /* 字库文件*/ - QFile zkAsc; - char cal_currHeightEn; - // char currMode; // ddddd - QFile zkHz05; - QFile zkHz07; - QFile zkHz09; - QFile zkHz12; - QFile zkHz16; - QFile zkHz24; - QFile zkHz16H; - QFile zkHz24H; - //QFile zkHz32; - QFile unitogb; -}; - -#endif /* PICWIDGET_H_ */ +/* + * PicWidget.h + * + * Created on: Jul 2, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef PICWIDGET_H_ +#define PICWIDGET_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include "SysPara.h" +#include "ParaSettingUI.h" + +#define MAX_PIC_WIDGET_HEIGHT 60 +#define MAX_PIC_WIDGET_WIDTH 600*8 +#define MAX_WIDTH MAX_PIC_WIDGET_WIDTH-100 +#define MAX_HEIGHT MAX_PIC_WIDGET_HEIGHT +#define MAXLINE 40 + +#define FVAR (1<<5) +#define FCOL0 (1<<6) +#define FLINE0 (1<<7) + +#define CFONT 0 +#define CLINESPACE 1 +#define CFONTGAP 2 +#define CBOLD 3 +#define CHEIGHT 4 + +#define VTYPE 1 +#define VDIGIT 2 +#define VWIDTH 3 +#define VTYPE0 4 +#define VTYPE1 5 +//#define C 5 + +#define BIN0808 100 +#define BIN0809 1000 +#define BIN0810 2000 +#define BIN0812 3000 +#define BIN0816 5000 +#define BIN1616 7000 +#define BIN2424 11000 +//#define BIN1224 15000 +#define BIN0805 20000 + +//是否需要匹配字体能操作 +//#define FONTMATCH + +typedef enum{ + ST05=0, + ST07=1, + ST09=2, + ST12=3, + ST16=4, + HT16=5, + ST24=6, + HT24=7, + ST32=8 +}PFONTNAME; + +typedef struct +{ + bool DrawEn;// 绘图 + bool DrawGridEn; // 网格 checkBoxDrawGridEn + int Width;// 字串长度 + unsigned char CharHeight; //字符高度 + unsigned char CharWidth; //字符宽度 + unsigned char FontGap; // 字符间隔 + PFONTNAME Font;// 字体 + bool CharCurrent; //光标类型,字符还是像素 + bool CurrentEn; + unsigned char LineSpace; + unsigned char Bold; // 字体加粗 + unsigned char LineHeight; + bool insertMode; + bool checkBoxControlChar;//控制符显示 +} t_charPara; + +typedef struct{ + int width; + int height; + bool enable; +} t_draw; + +typedef struct{ + int Len; + int yPos; + int xPos; + int minFont; + int maxFont; + int minLineHeight; + int maxLineHeight; +}t_line; + +class PicWidget:public QWidget{ + Q_OBJECT + +public: + explicit PicWidget(QWidget *parent = 0); + ~PicWidget(); + + void resizeWidget(int w,int h); + void initWidget(int w,int h); + void loadImage(QString filename,bool forceSize = true); + void insertImage(QString filename,bool forceSize = false); + + void saveImage(QString filename); + void enlargeDisplay(); + void reduceDisplay(); + void setScale(int scale); + + void paintEvent(QPaintEvent *); + + void mousePressEvent ( QMouseEvent * event ); + + void currPositionMove(int shiftX,int shiftY); + void ensureCurrPos(); + int getScaleValue(); + bool isModified(); + int getHeight(); + int getWidth(); + void readAscDot(unsigned int asc, char *dot); + void readZhDot(unsigned int ingb, char *dot); + int inputTxtDot(QString txt,int *var); + int inputRamDot(QString txt,unsigned char *pMap, vars_t *p_var); + int charDotMap( char *dot,bool english ); + int varDotMap(char *dot,int *var); + int picDelOneChar(); + int picDelNextChar(); + t_charPara charPara; + t_draw drawPara; + int picSetHome(); + int picSetEnd(); + int getVarNum(); + int readVar(SysPara *sysPara, unsigned char alt2); + void getPrintDat(unsigned char *dat,unsigned char alt2,SysPara *sysPara); + void getCharRamData(SysPara *sysPara); + + int resizePicRect(bool alt2); + void movePicView(); + void bindSysPara(SysPara *sysPara); + int altPrint; + int startRow; + int startCol; + int heightPoint; + int widthPoint; + int scale; + int currXpos; + int currYpos; + int endRow; + int endCol; + bool zkEditEn; + bool isInput ; + bool pEditMode; + void zkEditNow(); + void zkEditSave(); + void disp(); + QString currentEditTxt; + int resizePicWidth(bool rowEn); + int getNextPos(int x, int n); + int getLineEnd(int x); + int getUpLine(int x); + int getDownLine(int x); + int getPrePos(int x, int n); + int getBlandPos(int x, int n); + int SiteStart(int x); + void moveDots(int x1, int x2, int y1, int h, int w); + int getFontHeight(int x, int y); + + void VarGapSet(int x, int h); + int VarGetWidth(int x,int y,unsigned char *c); + int getLineHeight(int x, int y); + int getInserEnable(int x, int y, int w, int h); + void delDots(int x1, int x2, int y1, int h); + int isVar(int x, int y); + int getPicRealHeight(); + int getUpLineStart(int x, int y); + int isCanDelete(int x, int y); + void readPng(int x, int y, int w, int h); + void insertImage1(QString filename, bool forceSize); + void saveImage1(QString filename); +public slots: + void cursorFlash(); // 光标闪烁 + + +Q_SIGNALS: + void picWidgetModify(); + void ShowKeybord( ); + void rowColChanged(QString); + void currXYChanged(QString); + void ChangeFont(int cc); +private: + unsigned char pointMap[MAX_PIC_WIDGET_HEIGHT * (MAX_PIC_WIDGET_WIDTH)]; + + bool modified; + int varNum; + t_line line; + int linePara[MAXLINE]; + int lineNum; + int lineMaxNum; + //SysPara *sysPara1; + void setModified(bool m); + void saveZhDot(); + char getZkPic(char *dat); + int charInsert(int w,bool txtMode); + int isBlankCol(); + unsigned long zkOffset; + unsigned char zkReadNum; + unsigned int zkIncode; + QFile *pzkEditFile; + QString txt; + /* 字库文件*/ + QFile zkAsc; + char cal_currHeightEn; + // char currMode; // ddddd + QFile zkHz05; + QFile zkHz07; + QFile zkHz09; + QFile zkHz12; + QFile zkHz16; + QFile zkHz24; + QFile zkHz16H; + QFile zkHz24H; + //QFile zkHz32; + QFile unitogb; +}; + +#endif /* PICWIDGET_H_ */ diff --git a/PrintTextDisplay.cpp b/PrintTextDisplay.cpp index 4f4492c..d59f84c 100644 --- a/PrintTextDisplay.cpp +++ b/PrintTextDisplay.cpp @@ -1,375 +1,375 @@ -/* - * PrintTextDisplay.cpp - * - * Created on: Jul 9, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "PrintTextDisplay.h" -#include -#include -#include -#include -#include -#include -#include -#include "Public.h" -#include -#include -#include - -PrintTextDisplay::PrintTextDisplay(QWidget *parent): - QWidget(parent){ - setPalette(QPalette(Qt::white)); - setAutoFillBackground(true); - scaleRatio = 2; - origWidth = 0; - origHeight = 0; - setAttribute(Qt::WA_OpaquePaintEvent,true); //背景不自动重画 - updateDigitalOnly = false; -} - -PrintTextDisplay::~PrintTextDisplay(){ - -} - -void PrintTextDisplay::updateSysParaToUI(){ - -} - -void PrintTextDisplay::updateSysStatusToUI(){ - updateDigitalOnly = true; - update(); //表示只更新变量而已,该区域一定要包含实际的打印区域,否则显示不出来 -} - -void PrintTextDisplay::enlargeDisplay(){ - if(scaleRatio < 10){ - scaleRatio ++; - resize(scaleRatio*origWidth,scaleRatio*origHeight); - update(); - - } -} -void PrintTextDisplay::scroll_update() -{ - update(); -} - -void PrintTextDisplay::reduceDisplay(){ - if(scaleRatio > 1){ - scaleRatio --; - resize(scaleRatio*origWidth,scaleRatio*origHeight); - update(); - } -} - -//#define H02 2 -//#define H04 4 - -void PrintTextDisplay::setDisplaySize(int w,int h){ - origHeight = h; - - origWidth = w; - - resize(scaleRatio*origWidth,scaleRatio*(origHeight)); -} -void PrintTextDisplay::setScaleRatio(int ratio) -{ - if(ratio > 1) - { - if(ratio > 10) ratio =10; - scaleRatio =ratio; - resize(scaleRatio*origWidth,scaleRatio*origHeight); - update(); - } -} -void PrintTextDisplay::paintEvent(QPaintEvent *event){ - QRect updateRect = event->rect(); - updateRect.setY(0); - static int r_altermode=-1; - if(sysPara) - { - QPainter p(this); - p.scale(scaleRatio,scaleRatio); - p.setPen(Qt::NoPen); - if(sysPara->para.AlterMode!=r_altermode) updateDigitalOnly=false; - r_altermode=sysPara->para.AlterMode; - {//尽量减少不必要的刷屏动作 - int x = updateRect.x()/scaleRatio; - int end_x = (( sysPara->status.addSpace?2:1)*(updateRect.x() + updateRect.width())/scaleRatio) + 1; - int w= end_x - x; - int y = updateRect.y()/scaleRatio; - int end_y = (updateRect.y() + updateRect.height())/scaleRatio + 1; - int h = end_y - y; - p.setBrush(QColor(Qt::white)); - int y0=0; - if(sysPara->para.AlterMode<2) y0=0; - else if(sysPara->para.AlterMode==2) y0=y; - - if(sysPara->status.addSpace) - p.drawRect(x>>1,y0,w/2,h); - else - p.drawRect(x,y0,w,h); - - p.setBrush(QColor(Qt::green)); - - if(sysPara->para.AlterMode<2) - { - - } - else if(sysPara->para.AlterMode==2) - { - y = end_y; - end_y = end_y+h; - } - unsigned char *dat; - bool MaxCol4000; - if(sysPara->status.flagOfNo67FPGA) - MaxCol4000 = true; - else - MaxCol4000 = false; - if(MaxCol4000){ - dat =sysPara->status.printDat_Normal; - }else{ - dat =sysPara->status.printDat; - } - for(int i = 0; i < h && (i +y)< MAX_PRINT_ROW_NUM; i ++){ - for(int j = x; j < end_x && j < (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide); j++){ - if(dat[j*MAX_PRINT_ROW_BYTE_NUM + (i+y)/8] & (1<<((i+y)%8))){ - if(sysPara->status.addSpace){ - p.drawRect(j/2,i+y0,1,1);j++; - } - else - p.drawRect(j,i+y0,1,1); - } - } - } - - } - // 二维码显示 - if(sysPara->para.qrOption.DisplayUpdate==1 && sysPara->print.QRvars[0].type != BAR) //lich fix - { - sysPara->para.qrOption.DisplayUpdate=0; - int varNum=0; - for( varNum=0;varNumstatus.QRvariNum;varNum++){ - int x = sysPara->print.QRvars[varNum].startColPos; - int w = sysPara->print.QRvars[varNum].width; - int end_x = x+w; - int h = sysPara->print.QRvars[varNum].height; - int end_y=sysPara->print.QRvars[varNum].endRowPos; - int y = sysPara->print.QRvars[varNum].startRowPos; - p.setBrush(QColor(Qt::white)); - - //p.drawRect(x,y,w,h); - if(sysPara->status.addSpace) - p.drawRect(x/2,y,w,h); - else - p.drawRect(x,y,w,h); - - p.setBrush(QColor(Qt::black)); - unsigned char *dat; - bool MaxCol4000; - if(sysPara->status.flagOfNo67FPGA) - MaxCol4000 = true; - else - MaxCol4000 = false; - if(MaxCol4000){ - dat =sysPara->status.printDat_Normal; - }else{ - dat =sysPara->status.printDat; - } - for(int i = y; i < end_y && (i +y)< MAX_PRINT_ROW_NUM; i ++){ - for(int j = x; j < end_x && j < (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide); j++){ - if(dat[j*MAX_PRINT_ROW_BYTE_NUM + (i)/8] & (1<<((i)%8))){ - //p.drawRect(j,i,1,1); - if(sysPara->status.addSpace){ - p.drawRect(j>>1,i,1,1);//j++; - } - else - p.drawRect(j,i,1,1); - } - } - } - } - } - // 变量显示 - static int curVarValue[8]={0,0,0,0,0,0,0,0}; - for(int i = 0; i < sysPara->status.variNum; i++){ - vars_t *p_var = &sysPara->status.vars[i]; - int val = p_var->currVal; - - // 在调试模式下,设置变量为固定值,方便调试 - #ifdef ARCH_X86 - switch (sysPara->status.vars[i].type) { - case 0: - val = 2026; - break; - - case 1: - val = 5; - break; - - case 2: - val = 25; - break; - - case 4: - val = 16; - break; - - case 5: - val = 47; - break; - - case 6: - val = 59; - break; - - case 7: - case 8: - val = 83510947; - break; - default: - break; - } - #endif - - int x = p_var->startColPos; - int y = p_var->startRowPos; - int rowDiff = p_var->endRowPos - p_var->startRowPos; - int digitalNum = p_var->digitalNum; - - if(sysPara->para.AlterMode==2){ - if(ystatus.currAlterPrintRow) continue; - y = p_var->startRowPos-sysPara->status.currAlterPrintRow-1; - } - - else if(sysPara->para.AlterMode==1){ - - if(y>=sysPara->status.currAlterPrintRow) continue; - - } - int base = 1; int j=0,jmin=0; - QString str=""; - int Num=0; - - if(digitalNum<=8 || Public::getType(p_var->type) < 9 || p_var->type == 37 || p_var->type == 38 \ - || Public::getType(p_var->type) == 13 || Public::getType(p_var->type) == 14 || Public::getType(p_var->type) == 15) // 0-8 变量 显示刷新 - { - for(int j = 0; j < digitalNum;j ++){ - if(val>base-1)jmin=digitalNum-j-1; - base *= 10; - } - str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); - - //20240626: 以下3个判断条件为处理计米显示小数点位数,最多可显示3位 - if(!sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7) - { - val /= 1000; - str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); - str.insert(str.length()-1,"."); - str.remove(0,1); - - } - else if(sysPara->para.rrr_nc && !sysPara->para.printNumPoint && p_var->type == 7) - { - val /= 100; - str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); - str.insert(str.length()-2,"."); - str.remove(0,1); - } - else if(sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7) - { - val /= 10; - str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); - str.insert(str.length()-3,"."); - str.remove(0,1); - } - else if(sysPara->status.specialVarPrint.MeterEnable && p_var->type == 15) - { - str.remove(0,1); - str += "m"; - } - } - - else { // 大于 9 是什么变量呢? 随机数 显示刷新 - base = 1; j=0,jmin=0; - for(int j = 0; j < 8;j ++){ - if(val>base-1)jmin=8-j-1; - base *= 10; - } - str= QString("%1").arg(val%base,8,10,QLatin1Char('0')); - val = QString::number( sysPara->status.calandar_and_dat.RandomValue2 ,16).toInt(); - Num = digitalNum-8; - base = 1; - jmin=0; - for(int j = 0; j < Num;j ++){ - if(val>base-1)jmin=Num-j-1; - base *= 10; - } - str= QString("%1").arg(val%base,Num,10,QLatin1Char('0'))+str; - } - - - if(!sysPara->para.Cnt1NatureValue) jmin=0; - - p.setBrush(QColor(Qt::white)); - if(sysPara->status.addSpace) - p.drawRect(x/2,y,p_var->width/2,p_var->height); - else p.drawRect(x,y,p_var->width,p_var->height); - if(p_var->type==7 || p_var->type==37 || p_var->type==57|| p_var->type==67) p.setBrush(QColor(Qt::black));//变量1 - else if(p_var->type==8 || p_var->type==38 || p_var->type==58 || p_var->type==68) p.setBrush(QColor(Qt::blue));//变量2 - else if(p_var->type==13) p.setBrush(QColor(Qt::red));//变量3 - else p.setBrush(QColor(Qt::red)); //其他 - - QChar *qchar = str.data(); - int charWidth; - if(sysPara->para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide) - charWidth = p_var->datWidth/13; - else - charWidth = p_var->datWidth/10; - - for( j = jmin; j < digitalNum; j++){ - int digitalIndex; - if(!sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-2)) - { - digitalIndex = 10; - } - else if(sysPara->para.rrr_nc && !sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-3)) - { - digitalIndex = 10; - } - else if(sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-4)) - { - digitalIndex = 10; - } - else if(sysPara->status.specialVarPrint.MeterEnable && p_var->type == 15 && j == (digitalNum-1)) - { - digitalIndex = 11; - } - else - { - digitalIndex = qchar[j].toLatin1() - '0'; - } - unsigned char *pAaddr = p_var->dat + (digitalIndex*charWidth)*p_var->rowByteNum; - - for(int k = 0; k < rowDiff; k++){ - for(int l = 0; l < charWidth; l++){ - if(pAaddr[l*p_var->rowByteNum + k/8] & (1<<(k%8))){ - if(sysPara->status.addSpace){ - p.drawRect((x + j*charWidth + l)/2,y + k,1,1);l++; - } - else - p.drawRect(x + j*charWidth + l,y + k,1,1); - } - } - } - } - } - updateDigitalOnly = false; - } -} - +/* + * PrintTextDisplay.cpp + * + * Created on: Jul 9, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#include "PrintTextDisplay.h" +#include +#include +#include +#include +#include +#include +#include +#include "Public.h" +#include +#include +#include + +PrintTextDisplay::PrintTextDisplay(QWidget *parent): + QWidget(parent){ + setPalette(QPalette(Qt::white)); + setAutoFillBackground(true); + scaleRatio = 2; + origWidth = 0; + origHeight = 0; + setAttribute(Qt::WA_OpaquePaintEvent,true); //背景不自动重画 + updateDigitalOnly = false; +} + +PrintTextDisplay::~PrintTextDisplay(){ + +} + +void PrintTextDisplay::updateSysParaToUI(){ + +} + +void PrintTextDisplay::updateSysStatusToUI(){ + updateDigitalOnly = true; + update(); //表示只更新变量而已,该区域一定要包含实际的打印区域,否则显示不出来 +} + +void PrintTextDisplay::enlargeDisplay(){ + if(scaleRatio < 10){ + scaleRatio ++; + resize(scaleRatio*origWidth,scaleRatio*origHeight); + update(); + + } +} +void PrintTextDisplay::scroll_update() +{ + update(); +} + +void PrintTextDisplay::reduceDisplay(){ + if(scaleRatio > 1){ + scaleRatio --; + resize(scaleRatio*origWidth,scaleRatio*origHeight); + update(); + } +} + +//#define H02 2 +//#define H04 4 + +void PrintTextDisplay::setDisplaySize(int w,int h){ + origHeight = h; + + origWidth = w; + + resize(scaleRatio*origWidth,scaleRatio*(origHeight)); +} +void PrintTextDisplay::setScaleRatio(int ratio) +{ + if(ratio > 1) + { + if(ratio > 10) ratio =10; + scaleRatio =ratio; + resize(scaleRatio*origWidth,scaleRatio*origHeight); + update(); + } +} +void PrintTextDisplay::paintEvent(QPaintEvent *event){ + QRect updateRect = event->rect(); + updateRect.setY(0); + static int r_altermode=-1; + if(sysPara) + { + QPainter p(this); + p.scale(scaleRatio,scaleRatio); + p.setPen(Qt::NoPen); + if(sysPara->para.AlterMode!=r_altermode) updateDigitalOnly=false; + r_altermode=sysPara->para.AlterMode; + {//尽量减少不必要的刷屏动作 + int x = updateRect.x()/scaleRatio; + int end_x = (( sysPara->status.addSpace?2:1)*(updateRect.x() + updateRect.width())/scaleRatio) + 1; + int w= end_x - x; + int y = updateRect.y()/scaleRatio; + int end_y = (updateRect.y() + updateRect.height())/scaleRatio + 1; + int h = end_y - y; + p.setBrush(QColor(Qt::white)); + int y0=0; + if(sysPara->para.AlterMode<2) y0=0; + else if(sysPara->para.AlterMode==2) y0=y; + + if(sysPara->status.addSpace) + p.drawRect(x>>1,y0,w/2,h); + else + p.drawRect(x,y0,w,h); + + p.setBrush(QColor(Qt::green)); + + if(sysPara->para.AlterMode<2) + { + + } + else if(sysPara->para.AlterMode==2) + { + y = end_y; + end_y = end_y+h; + } + unsigned char *dat; + bool MaxCol4000; + if(sysPara->status.flagOfNo67FPGA) + MaxCol4000 = true; + else + MaxCol4000 = false; + if(MaxCol4000){ + dat =sysPara->status.printDat_Normal; + }else{ + dat =sysPara->status.printDat; + } + for(int i = 0; i < h && (i +y)< MAX_PRINT_ROW_NUM; i ++){ + for(int j = x; j < end_x && j < (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide); j++){ + if(dat[j*MAX_PRINT_ROW_BYTE_NUM + (i+y)/8] & (1<<((i+y)%8))){ + if(sysPara->status.addSpace){ + p.drawRect(j/2,i+y0,1,1);j++; + } + else + p.drawRect(j,i+y0,1,1); + } + } + } + + } + // 二维码显示 + if(sysPara->para.qrOption.DisplayUpdate==1 && sysPara->print.QRvars[0].type != BAR) //lich fix + { + sysPara->para.qrOption.DisplayUpdate=0; + int varNum=0; + for( varNum=0;varNumstatus.QRvariNum;varNum++){ + int x = sysPara->print.QRvars[varNum].startColPos; + int w = sysPara->print.QRvars[varNum].width; + int end_x = x+w; + int h = sysPara->print.QRvars[varNum].height; + int end_y=sysPara->print.QRvars[varNum].endRowPos; + int y = sysPara->print.QRvars[varNum].startRowPos; + p.setBrush(QColor(Qt::white)); + + //p.drawRect(x,y,w,h); + if(sysPara->status.addSpace) + p.drawRect(x/2,y,w,h); + else + p.drawRect(x,y,w,h); + + p.setBrush(QColor(Qt::black)); + unsigned char *dat; + bool MaxCol4000; + if(sysPara->status.flagOfNo67FPGA) + MaxCol4000 = true; + else + MaxCol4000 = false; + if(MaxCol4000){ + dat =sysPara->status.printDat_Normal; + }else{ + dat =sysPara->status.printDat; + } + for(int i = y; i < end_y && (i +y)< MAX_PRINT_ROW_NUM; i ++){ + for(int j = x; j < end_x && j < (MaxCol4000?MAX_PRINT_COL_NUM_Normal:MAX_PRINT_COL_NUM_Wide); j++){ + if(dat[j*MAX_PRINT_ROW_BYTE_NUM + (i)/8] & (1<<((i)%8))){ + //p.drawRect(j,i,1,1); + if(sysPara->status.addSpace){ + p.drawRect(j>>1,i,1,1);//j++; + } + else + p.drawRect(j,i,1,1); + } + } + } + } + } + // 变量显示 + static int curVarValue[8]={0,0,0,0,0,0,0,0}; + for(int i = 0; i < sysPara->status.variNum; i++){ + vars_t *p_var = &sysPara->status.vars[i]; + int val = p_var->currVal; + + // 在调试模式下,设置变量为固定值,方便调试 + #ifdef ARCH_X86 + switch (sysPara->status.vars[i].type) { + case 0: + val = 2026; + break; + + case 1: + val = 5; + break; + + case 2: + val = 25; + break; + + case 4: + val = 16; + break; + + case 5: + val = 47; + break; + + case 6: + val = 59; + break; + + case 7: + case 8: + val = 83510947; + break; + default: + break; + } + #endif + + int x = p_var->startColPos; + int y = p_var->startRowPos; + int rowDiff = p_var->endRowPos - p_var->startRowPos; + int digitalNum = p_var->digitalNum; + + if(sysPara->para.AlterMode==2){ + if(ystatus.currAlterPrintRow) continue; + y = p_var->startRowPos-sysPara->status.currAlterPrintRow-1; + } + + else if(sysPara->para.AlterMode==1){ + + if(y>=sysPara->status.currAlterPrintRow) continue; + + } + int base = 1; int j=0,jmin=0; + QString str=""; + int Num=0; + + if(digitalNum<=8 || Public::getType(p_var->type) < 9 || p_var->type == 37 || p_var->type == 38 \ + || Public::getType(p_var->type) == 13 || Public::getType(p_var->type) == 14 || Public::getType(p_var->type) == 15) // 0-8 变量 显示刷新 + { + for(int j = 0; j < digitalNum;j ++){ + if(val>base-1)jmin=digitalNum-j-1; + base *= 10; + } + str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); + + //20240626: 以下3个判断条件为处理计米显示小数点位数,最多可显示3位 + if(!sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7) + { + val /= 1000; + str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); + str.insert(str.length()-1,"."); + str.remove(0,1); + + } + else if(sysPara->para.rrr_nc && !sysPara->para.printNumPoint && p_var->type == 7) + { + val /= 100; + str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); + str.insert(str.length()-2,"."); + str.remove(0,1); + } + else if(sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7) + { + val /= 10; + str= QString("%1").arg(val%base,digitalNum,10,QLatin1Char('0')); + str.insert(str.length()-3,"."); + str.remove(0,1); + } + else if(sysPara->status.specialVarPrint.MeterEnable && p_var->type == 15) + { + str.remove(0,1); + str += "m"; + } + } + + else { // 大于 9 是什么变量呢? 随机数 显示刷新 + base = 1; j=0,jmin=0; + for(int j = 0; j < 8;j ++){ + if(val>base-1)jmin=8-j-1; + base *= 10; + } + str= QString("%1").arg(val%base,8,10,QLatin1Char('0')); + val = QString::number( sysPara->status.calandar_and_dat.RandomValue2 ,16).toInt(); + Num = digitalNum-8; + base = 1; + jmin=0; + for(int j = 0; j < Num;j ++){ + if(val>base-1)jmin=Num-j-1; + base *= 10; + } + str= QString("%1").arg(val%base,Num,10,QLatin1Char('0'))+str; + } + + + if(!sysPara->para.Cnt1NatureValue) jmin=0; + + p.setBrush(QColor(Qt::white)); + if(sysPara->status.addSpace) + p.drawRect(x/2,y,p_var->width/2,p_var->height); + else p.drawRect(x,y,p_var->width,p_var->height); + if(p_var->type==7 || p_var->type==37 || p_var->type==57|| p_var->type==67) p.setBrush(QColor(Qt::black));//变量1 + else if(p_var->type==8 || p_var->type==38 || p_var->type==58 || p_var->type==68) p.setBrush(QColor(Qt::blue));//变量2 + else if(p_var->type==13) p.setBrush(QColor(Qt::red));//变量3 + else p.setBrush(QColor(Qt::red)); //其他 + + QChar *qchar = str.data(); + int charWidth; + if(sysPara->para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide) + charWidth = p_var->datWidth/13; + else + charWidth = p_var->datWidth/10; + + for( j = jmin; j < digitalNum; j++){ + int digitalIndex; + if(!sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-2)) + { + digitalIndex = 10; + } + else if(sysPara->para.rrr_nc && !sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-3)) + { + digitalIndex = 10; + } + else if(sysPara->para.rrr_nc && sysPara->para.printNumPoint && p_var->type == 7 && j == (digitalNum-4)) + { + digitalIndex = 10; + } + else if(sysPara->status.specialVarPrint.MeterEnable && p_var->type == 15 && j == (digitalNum-1)) + { + digitalIndex = 11; + } + else + { + digitalIndex = qchar[j].toLatin1() - '0'; + } + unsigned char *pAaddr = p_var->dat + (digitalIndex*charWidth)*p_var->rowByteNum; + + for(int k = 0; k < rowDiff; k++){ + for(int l = 0; l < charWidth; l++){ + if(pAaddr[l*p_var->rowByteNum + k/8] & (1<<(k%8))){ + if(sysPara->status.addSpace){ + p.drawRect((x + j*charWidth + l)/2,y + k,1,1);l++; + } + else + p.drawRect(x + j*charWidth + l,y + k,1,1); + } + } + } + } + } + updateDigitalOnly = false; + } +} + diff --git a/PrintTextDisplay.h b/PrintTextDisplay.h index f8555b1..b8fa2d7 100644 --- a/PrintTextDisplay.h +++ b/PrintTextDisplay.h @@ -1,47 +1,47 @@ -/* - * PrintTextDisplay.h - * - * Created on: Jul 9, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef PRINTTEXTDISPLAY_H_ -#define PRINTTEXTDISPLAY_H_ - -#include -#include "ParaSettingUI.h" -class PrintTextDisplay:public QWidget,public ParaSettingUI{ - -public: - explicit PrintTextDisplay(QWidget *parent = 0); - ~PrintTextDisplay(); - - void updateSysParaToUI(); //重载 - - void updateSysStatusToUI(); //重载 - - void paintEvent(QPaintEvent *); - - void resizeWidget(int w,int h); - - - - void enlargeDisplay(); - void reduceDisplay(); - - void setDisplaySize(int w,int h); - - void setScaleRatio(int ratio); - void scroll_update(); -private: - int scaleRatio; - int origHeight; - int origWidth; - bool updateDigitalOnly; -}; - - -#endif /* PRINTTEXTDISPLAY_H_ */ +/* + * PrintTextDisplay.h + * + * Created on: Jul 9, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef PRINTTEXTDISPLAY_H_ +#define PRINTTEXTDISPLAY_H_ + +#include +#include "ParaSettingUI.h" +class PrintTextDisplay:public QWidget,public ParaSettingUI{ + +public: + explicit PrintTextDisplay(QWidget *parent = 0); + ~PrintTextDisplay(); + + void updateSysParaToUI(); //重载 + + void updateSysStatusToUI(); //重载 + + void paintEvent(QPaintEvent *); + + void resizeWidget(int w,int h); + + + + void enlargeDisplay(); + void reduceDisplay(); + + void setDisplaySize(int w,int h); + + void setScaleRatio(int ratio); + void scroll_update(); +private: + int scaleRatio; + int origHeight; + int origWidth; + bool updateDigitalOnly; +}; + + +#endif /* PRINTTEXTDISPLAY_H_ */ diff --git a/Public (2).h b/Public (2).h deleted file mode 100644 index d6ab64d..0000000 --- a/Public (2).h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Public.h - * - * Created on: Jul 16, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef PUBLIC_H_ -#define PUBLIC_H_ - -#include -#include -#include -#include - -extern void MySleep(unsigned int msec); - -class Public{ -public: - Public(); - ~Public(); - static int getMinFontPixelSize(); - static QString getFontFamily(int pixelSize); - static QString getFontFamily(int pixelSize, int vartype);// 20160812 - static int derivePixelSizeFromHeight(int value); - static int derivePixelSizeFromHeightNx(int value); - static int getAdjustedPixelSize(int value); - static void resetPara(); - static void backupPara(); - static QString readLanguageType(); - static QString ReadLanguageName(); - static int getNumberHeight(QFont font); - static time_t getDateFromMacro(const char *time); - static QString DateToString(const char *time); - - static int getType(int vartype); // 将变量类型进行转换,以处理横向字体 - -}; - - -#endif /* PUBLIC_H_ */ diff --git a/Public.cpp b/Public.cpp index c85d698..6380c6b 100644 --- a/Public.cpp +++ b/Public.cpp @@ -1,415 +1,414 @@ -/* - * Public.cpp - * - * Created on: Jul 16, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "Public.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static QString FontName; - -Public::Public(){ - -} -// "Zfull-GB";break;/ -Public::~Public(){ - FontName=""; -} -// 20160303 : #define FONTV "WenQuanYiCN" ; FONTV1 FONTV2 "WenQuanYiNX" -//#define FONTV "DejaVuSansnx"//"DejaVu Sans" -#define FONTV "WenQuanYiCN" -//#define FONTV "WenQuanYiNX" -#define FONTV1 "WenQuanYiNX" -//#define FONTV1 "DejaVu Sans" -//#define FONTV2 "DejaVu Sans" -#define FONTV2 "WenQuanYiNX"//"WenQuanYi Micro Hei" -//"Zfull-GB" -#define FONTC "wenquanyi" - -//#define FONTC "WenQuanYi" -int Public::getMinFontPixelSize(){ - return 5; -} -QString Public::getFontFamily(int pixelSize){ - switch(pixelSize){ - - case 5://return "SerifL";break; - case 6: - case 7: - case 9:return "biyang";break; - case 12:return "FZXS12";break; - case 16:return "FZXS16";break; - case 24:return "FZXS24";break; - default:return - FONTC; - break;//return "WenQuanYi Zen Hei"; break; - } - return FONTV2; -} - -QString Public::getFontFamily(int pixelSize, int vartype){ - if(pixelSize >= 32) return "WenQuanYi32"; - else if(pixelSize >= 22) return "WenQuanYi24"; - else if(pixelSize >= 16) return "WenQuanYi16"; - else if(pixelSize >= 12) return "WenQuanYi12"; - else if(pixelSize >= 9) return "Dinkie9"; - else if(pixelSize >= 7) return "WenQuanYi7"; - else if(pixelSize >= 5) return "WenQuanYi5"; - - - switch(pixelSize){ - case 5:return "WenQuanYi5"; - case 6:return "WenQuanYi5"; - case 7:return "WenQuanYi7"; - case 8:return "WenQuanYi7"; - case 9: - { - if(vartype>19&& vartype<30) - { - return "SerifL"; - } - else if(vartype>39&& vartype<50) - { - return "SerifR"; - } - else if((vartype>29&& vartype<40) || vartype == 90 || vartype==91) - { - return "bangla"; - } - else if((vartype>49&& vartype<60) || vartype == 100 || vartype==101) - { - return "biyangF"; - } - else if((vartype>59&& vartype<70) || vartype == 110 || vartype==111) - { - return "Roman"; - } - else - { - return "Dinkie9"; - } - - } - break; - case 12:return "WenQuanYi12";break; - case 13:return "WenQuanYi12";break; - case 16:return "WenQuanYi16";break; - case 17:return "WenQuanYi16";break; - case 24:return "WenQuanYi24";break; - default:return - FONTC; - break;//return "WenQuanYi Zen Hei"; break; - } - - return FONTV2; -} - -static int pixel_size[] = {5,7,9,12,16,21,24,32};//,28,32}; -#define NUM 6 -int Public::derivePixelSizeFromHeight(int value){ - if(value >= 22) return 24; - else if(value >= 15) return 16; - else if(value >= 11) return 12; - else if(value >= 9) return 9; - else if(value >= 7) return 7; - else if(value >= 5) return 5; - - static int init_done; - static int height[NUM*2]; - - if(!init_done){ - for(int i = 0; i < NUM; i++){ - QFont font; - font.setFamily(Public::getFontFamily(pixel_size[i])); - font.setPixelSize(pixel_size[i]); - font.setBold(0); - height[2*i] = getNumberHeight(font); - font.setBold(1); - height[2*i+1] = getNumberHeight(font); - } - init_done = 1; - } -/* -HEIL 0 5 -HEIL 1 7 -HEIL 2 9 -HEIL 3 12 -HEIL 4 16 -HEIL 5 21 -HEIL 6 24 - * */ - for(int i = 0; i < (NUM) ; i ++){ - if(value <= height[2*i]){ - //qDebug()<<"pixel_size"<2) { - len=file1.readLine((char*)buf,256); - if(len){ - buf[len]='\0'; - QString s1 = buf; - int n=s1.indexOf("\r\n"); - if(n) - s1 = s1.mid(0,n); - if(s1.endsWith("utf8.txt")) InputTxtFileName = s1; - else InputTxtFileName = "WINPY_utf8.txt"; - } - } - if(file1.isOpen()) file1.close(); - } - return InputTxtFileName; -} - -QString Public::ReadLanguageName() -{ - QFile file1("/home/plg/UseEn"); - QString language="Chinese"; - char buf[256]; - - if(file1.exists()) - { - file1.open(QFile::ReadWrite); - int len=file1.readLine((char*)buf,256); - buf[len]='\0'; - //qDebug()<<"language:"<2) { - language = buf; - int n=language.indexOf("\r\n"); - if(n>0) - language = language.mid(0,n); - } - if(file1.isOpen())file1.close(); - } - - FontName = language; - return language; -} - -QString Public::ReadKeyBoardUse() -{ - QFile file1("/home/plg/UseKBD"); - QString language="Chinese"; - - char buf[256]; - - if(file1.exists()) - { - file1.open(QFile::ReadWrite); - int len=file1.readLine((char*)buf,256); - buf[len]='\0'; - if(len>2) { - language = buf; - int n=language.indexOf("\r\n"); - if(n>0) - language = language.mid(0,n); - } - if(file1.isOpen())file1.close(); - } - return language; -} - -int Public::getNumberHeight(QFont font){ - QFontMetrics fontMetrics(font); - int height = fontMetrics.ascent()+ fontMetrics.descent(); - int width1 = (fontMetrics.width("ABH89")); - QTextEdit text1; - text1.setFont(font); - text1.setText("F08H"); - text1.show(); - QImage image(width1,height+16,QImage::Format_ARGB32); - image.fill(0x00ffffff); - QPainter painter(&image); - text1.document()->drawContents (&painter, image.rect()); /*将text写到pic*/ - text1.hide(); - - int imgHeight = image.height(); - int imgWidth = image.width(); - int FirstValidRow = 0; - bool lastFlag=0; - int k,j; - for(k = 0; k 0 ; k--){ - for( j = 0; j < imgWidth; j ++){ - QRgb rgb = image.pixel(j,k); - //qDebug()<= 60) tmp = vartype-60; - else if(tmp >= 50) tmp = vartype-50; - else if(tmp >= 40) tmp = vartype-40; - else if(tmp >= 30) tmp = vartype-30; - else if(tmp >= 20) tmp = vartype-20; - return tmp; - - -} - -/* - * -#ifdef MMVAR11 - // 同一行先排序: ,不同行分开排序,如何实现。 - int i,j; - for(i=0;istatus.variNum-1;i++){ - bool ch_flag=0; - for(j=i+1;jstatus.variNum;j++){ - if(sysPara->status.vars[j].startColPos < sysPara->status.vars[j-1].startColPos ){ - int n=sysPara->status.vars[j].startRowPos; - sysPara->status.vars[j].startRowPos = sysPara->status.vars[j-1].startRowPos; - sysPara->status.vars[j-1].startRowPos = n; - n=sysPara->status.vars[j].startColPos; - sysPara->status.vars[j].startColPos = sysPara->status.vars[j-1].startColPos; - sysPara->status.vars[j-1].startColPos = n; - ch_flag =1; - } - } - if(ch_flag==0) break; - } -#endif -*/ +/* + * Public.cpp + * + * Created on: Jul 16, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#include "Public.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static QString FontName; + +Public::Public(){ + +} +// "Zfull-GB";break;/ +Public::~Public(){ + FontName=""; +} +// 20160303 : #define FONTV "WenQuanYiCN" ; FONTV1 FONTV2 "WenQuanYiNX" +//#define FONTV "DejaVuSansnx"//"DejaVu Sans" +#define FONTV "WenQuanYiCN" +//#define FONTV "WenQuanYiNX" +#define FONTV1 "WenQuanYiNX" +//#define FONTV1 "DejaVu Sans" +//#define FONTV2 "DejaVu Sans" +#define FONTV2 "WenQuanYiNX"//"WenQuanYi Micro Hei" +//"Zfull-GB" +#define FONTC "wenquanyi" + +//#define FONTC "WenQuanYi" +int Public::getMinFontPixelSize(){ + return 5; +} +QString Public::getFontFamily(int pixelSize){ + switch(pixelSize){ + + case 5://return "SerifL";break; + case 6: + case 7: + case 9:return "biyang";break; + case 12:return "FZXS12";break; + case 16:return "FZXS16";break; + case 24:return "FZXS24";break; + default:return + FONTC; + break;//return "WenQuanYi Zen Hei"; break; + } + return FONTV2; +} + +QString Public::getFontFamily(int pixelSize, int vartype){ + if(pixelSize >= 32) return "WenQuanYi32"; + else if(pixelSize >= 22) return "WenQuanYi24"; + else if(pixelSize >= 16) return "WenQuanYi16"; + else if(pixelSize >= 12) return "WenQuanYi12"; + else if(pixelSize >= 9) return "Dinkie9"; + else if(pixelSize >= 7) return "WenQuanYi7"; + else if(pixelSize >= 5) return "WenQuanYi5"; + + + switch(pixelSize){ + case 5:return "WenQuanYi5"; + case 6:return "WenQuanYi5"; + case 7:return "WenQuanYi7"; + case 8:return "WenQuanYi7"; + case 9: + { + if(vartype>19&& vartype<30) + { + return "SerifL"; + } + else if(vartype>39&& vartype<50) + { + return "SerifR"; + } + else if((vartype>29&& vartype<40) || vartype == 90 || vartype==91) + { + return "bangla"; + } + else if((vartype>49&& vartype<60) || vartype == 100 || vartype==101) + { + return "biyangF"; + } + else if((vartype>59&& vartype<70) || vartype == 110 || vartype==111) + { + return "Roman"; + } + else + { + return "Dinkie9"; + } + + } + break; + case 12:return "WenQuanYi12";break; + case 13:return "WenQuanYi12";break; + case 16:return "WenQuanYi16";break; + case 17:return "WenQuanYi16";break; + case 24:return "WenQuanYi24";break; + default:return + FONTC; + break;//return "WenQuanYi Zen Hei"; break; + } + + return FONTV2; +} + +static int pixel_size[] = {5,7,9,12,16,21,24,32};//,28,32}; +#define NUM 6 +int Public::derivePixelSizeFromHeight(int value){ + if(value >= 22) return 24; + else if(value >= 15) return 16; + else if(value >= 11) return 12; + else if(value >= 9) return 9; + else if(value >= 7) return 7; + else if(value >= 5) return 5; + + static int init_done; + static int height[NUM*2]; + + if(!init_done){ + for(int i = 0; i < NUM; i++){ + QFont font; + font.setFamily(Public::getFontFamily(pixel_size[i])); + font.setPixelSize(pixel_size[i]); + font.setBold(0); + height[2*i] = getNumberHeight(font); + font.setBold(1); + height[2*i+1] = getNumberHeight(font); + } + init_done = 1; + } +/* +HEIL 0 5 +HEIL 1 7 +HEIL 2 9 +HEIL 3 12 +HEIL 4 16 +HEIL 5 21 +HEIL 6 24 + * */ + for(int i = 0; i < (NUM) ; i ++){ + if(value <= height[2*i]){ + //qDebug()<<"pixel_size"<2) { + len=file1.readLine((char*)buf,256); + if(len){ + buf[len]='\0'; + QString s1 = buf; + int n=s1.indexOf("\r\n"); + if(n) + s1 = s1.mid(0,n); + if(s1.endsWith("utf8.txt")) InputTxtFileName = s1; + else InputTxtFileName = "WINPY_utf8.txt"; + } + } + if(file1.isOpen()) file1.close(); + } + return InputTxtFileName; +} + +QString Public::ReadLanguageName() +{ + QFile file1("/home/plg/UseEn"); + QString language="Chinese"; + char buf[256]; + + if(file1.exists()) + { + file1.open(QFile::ReadWrite); + int len=file1.readLine((char*)buf,256); + buf[len]='\0'; + //qDebug()<<"language:"<2) { + language = buf; + int n=language.indexOf("\r\n"); + if(n>0) + language = language.mid(0,n); + } + if(file1.isOpen())file1.close(); + } + + FontName = language; + return language; +} + +QString Public::ReadKeyBoardUse() +{ + QFile file1("/home/plg/UseKBD"); + QString language="Chinese"; + + char buf[256]; + + if(file1.exists()) + { + file1.open(QFile::ReadWrite); + int len=file1.readLine((char*)buf,256); + buf[len]='\0'; + if(len>2) { + language = buf; + int n=language.indexOf("\r\n"); + if(n>0) + language = language.mid(0,n); + } + if(file1.isOpen())file1.close(); + } + return language; +} + +int Public::getNumberHeight(QFont font){ + QFontMetrics fontMetrics(font); + int height = fontMetrics.ascent()+ fontMetrics.descent(); + int width1 = (fontMetrics.width("ABH89")); + QTextEdit text1; + text1.setFont(font); + text1.setText("F08H"); + text1.show(); + QImage image(width1,height+16,QImage::Format_ARGB32); + image.fill(0x00ffffff); + QPainter painter(&image); + text1.document()->drawContents (&painter, image.rect()); /*将text写到pic*/ + text1.hide(); + + int imgHeight = image.height(); + int imgWidth = image.width(); + int FirstValidRow = 0; + bool lastFlag=0; + int k,j; + for(k = 0; k 0 ; k--){ + for( j = 0; j < imgWidth; j ++){ + QRgb rgb = image.pixel(j,k); + //qDebug()<= 60) tmp = vartype-60; + else if(tmp >= 50) tmp = vartype-50; + else if(tmp >= 40) tmp = vartype-40; + else if(tmp >= 30) tmp = vartype-30; + else if(tmp >= 20) tmp = vartype-20; + return tmp; + + +} + +/* + * +#ifdef MMVAR11 + // 同一行先排序: ,不同行分开排序,如何实现。 + int i,j; + for(i=0;istatus.variNum-1;i++){ + bool ch_flag=0; + for(j=i+1;jstatus.variNum;j++){ + if(sysPara->status.vars[j].startColPos < sysPara->status.vars[j-1].startColPos ){ + int n=sysPara->status.vars[j].startRowPos; + sysPara->status.vars[j].startRowPos = sysPara->status.vars[j-1].startRowPos; + sysPara->status.vars[j-1].startRowPos = n; + n=sysPara->status.vars[j].startColPos; + sysPara->status.vars[j].startColPos = sysPara->status.vars[j-1].startColPos; + sysPara->status.vars[j-1].startColPos = n; + ch_flag =1; + } + } + if(ch_flag==0) break; + } +#endif +*/ diff --git a/Public.h b/Public.h index 699a2a1..ba308f9 100644 --- a/Public.h +++ b/Public.h @@ -1,46 +1,46 @@ -/* - * Public.h - * - * Created on: Jul 16, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef PUBLIC_H_ -#define PUBLIC_H_ - -#include -#include -#include -#include - -extern void MySleep(unsigned int msec); - -class Public{ -public: - Public(); - ~Public(); - static int getMinFontPixelSize(); - static QString getFontFamily(int pixelSize); - static QString getFontFamily(int pixelSize, int vartype);// 20160812 - static int derivePixelSizeFromHeight(int value); - static int derivePixelSizeFromHeightNx(int value); - static int getAdjustedPixelSize(int value); - static void resetPara(); - static void backupPara(); - static QString readLanguageType(); - static QString ReadLanguageName(); - static int getNumberHeight(QFont font); - static time_t getDateFromMacro(const char *time); - static QString DateToString(const char *time); - - static QString ReadKeyBoardUse(); - - static int getType(int vartype); // 将变量类型进行转换,以处理横向字体 - -}; - - -#endif /* PUBLIC_H_ */ +/* + * Public.h + * + * Created on: Jul 16, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef PUBLIC_H_ +#define PUBLIC_H_ + +#include +#include +#include +#include + +extern void MySleep(unsigned int msec); + +class Public{ +public: + Public(); + ~Public(); + static int getMinFontPixelSize(); + static QString getFontFamily(int pixelSize); + static QString getFontFamily(int pixelSize, int vartype);// 20160812 + static int derivePixelSizeFromHeight(int value); + static int derivePixelSizeFromHeightNx(int value); + static int getAdjustedPixelSize(int value); + static void resetPara(); + static void backupPara(); + static QString readLanguageType(); + static QString ReadLanguageName(); + static int getNumberHeight(QFont font); + static time_t getDateFromMacro(const char *time); + static QString DateToString(const char *time); + + static QString ReadKeyBoardUse(); + + static int getType(int vartype); // 将变量类型进行转换,以处理横向字体 + +}; + + +#endif /* PUBLIC_H_ */ diff --git a/Public_back.cpp b/Public_back.cpp deleted file mode 100644 index 541b308..0000000 --- a/Public_back.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Public.cpp - * - * Created on: Jul 16, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "Public.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static QString FontName; - -Public::Public(){ - -} -// "Zfull-GB";break;/ -Public::~Public(){ - FontName=""; -} -// 20160303 : #define FONTV "WenQuanYiCN" ; FONTV1 FONTV2 "WenQuanYiNX" -//#define FONTV "DejaVuSansnx"//"DejaVu Sans" -#define FONTV "WenQuanYiCN" -//#define FONTV "WenQuanYiNX" -#define FONTV1 "WenQuanYiNX" -//#define FONTV1 "DejaVu Sans" -//#define FONTV2 "DejaVu Sans" -#define FONTV2 "WenQuanYiNX"//"WenQuanYi Micro Hei" -//"Zfull-GB" -#define FONTC "wenquanyi" - -//#define FONTC "WenQuanYi" -int Public::getMinFontPixelSize(){ - return 5; -} -QString Public::getFontFamily(int pixelSize){ - switch(pixelSize){ - -#ifdef VNLG - case 5: - case 6: - case 7: - case 9: - return "biyang";break; - case 10: - case 11: - case 12: - return (FontName=="Chinese" || FontName=="English")?FONTC:FONTV;break;//return "UnDotum";break;// - //return "UnDotum";break;//Zfull-GB - case 14:case 13:case 15: - case 16: - case 24: - case 32: - return (FontName=="Chinese" || FontName=="English")?FONTC:FONTV;break;//return "UnDotum";break;//return (FontName=="Chinese")?FONTC:"Zfull-GB";break; - case 28: - //case 32: - case 36: - return //(FontName=="Chinese")?FONTC: - //FONTV1;// - (FontName=="Chinese" || FontName=="English")?FONTV2:FONTV1;break; - - // "Zfull-GB";break;//return "UnDotum";break;//return (FontName=="Chinese")?FONTC:"Zfull-GB";break; - // 16点阵以上直接使用方正字体 - default: - return - (FontName=="Chinese" || FontName=="English")?FONTV2:FONTV1;break; - //FONTC; // - //"WenQuanYi Micro Hei"; - //"WenQuanYiMH"; -#else - case 5://return "SerifL";break; - case 6: - case 7: - case 9:return "biyang";break; - default:return - FONTC; -#endif - - break;//return "WenQuanYi Zen Hei"; break; - } - return FONTV2; -} - -QString Public::getFontFamily(int pixelSize, int vartype){ - switch(pixelSize){ - case 5: - case 6: - case 7: - case 9: - { - if(vartype>19&& vartype<30) - { - return "SerifL"; - } - else if(vartype>39&& vartype<50) - { - return "SerifR"; - } - else if((vartype>29&& vartype<40) || vartype == 90 || vartype==91) - { - return "bangla"; - } - else if((vartype>49&& vartype<60) || vartype == 100 || vartype==101) - { - return "biyangF"; - } - else if((vartype>59&& vartype<70) || vartype == 110 || vartype==111) - { - return "Roman"; - } - else - { - return "biyang"; - } -// (vartype>19&& vartype<30)?"SerifL": -// (vartype>39&& vartype<50)?"SerifR": -// "biyang"; - } - break; - default:return - FONTC; - break;//return "WenQuanYi Zen Hei"; break; - } - - return FONTV2; -} - -static int pixel_size[] = {5,7,9,12,16,21,24};//,28,32}; -#define NUM 6 -int Public::derivePixelSizeFromHeight(int value){ - if(value > 9) return value+1; - return value; - static int init_done; - static int height[NUM*2]; - //static int heightB[NUM]; - -// 12 -12 16--15 24 --19 28 -22 32 --25 -/* -HEIL 0 6 -HEIL 1 8 -HEIL 2 10 -HEIL 3 13 -HEIL 4 17 -HEIL 5 32 -HEIL 6 37 -HEIL 7 42 - */ - if(!init_done){ - for(int i = 0; i < NUM; i++){ - QFont font; - font.setFamily(Public::getFontFamily(pixel_size[i])); - font.setPixelSize(pixel_size[i]); - font.setBold(0); - height[2*i] = getNumberHeight(font); - font.setBold(1); - height[2*i+1] = getNumberHeight(font); - //qDebug()<<"HEIL"<2) { - len=file1.readLine((char*)buf,256); - if(len){ - buf[len]='\0'; - QString s1 = buf; - int n=s1.indexOf("\r\n"); - if(n) - s1 = s1.mid(0,n); - if(s1.endsWith("utf8.txt")) InputTxtFileName = s1; - else InputTxtFileName = "WINPY_utf8.txt"; - } - } - if(file1.isOpen()) file1.close(); - } - return InputTxtFileName; -} - -QString Public::ReadLanguageName() -{ - QFile file1("/home/plg/UseEn"); - QString language="Chinese"; - char buf[256]; - - if(file1.exists()) - { - file1.open(QFile::ReadWrite); - int len=file1.readLine((char*)buf,256); - buf[len]='\0'; - //qDebug()<<"language:"<2) { - language = buf; - int n=language.indexOf("\r\n"); - if(n>0) - language = language.mid(0,n); - } - if(file1.isOpen())file1.close(); - } - //qDebug()<<"language2:"<drawContents (&painter, image.rect()); /*将text写到pic*/ - text1.hide(); -#if 0 - QString s; - s.sprintf("/home/ss%d-%d.jpg",font.pixelSize(),font.bold()?75:50); - image.save(s); -#endif - - int imgHeight = image.height(); - int imgWidth = image.width(); - int FirstValidRow = 0; - bool lastFlag=0; - int k,j; - for(k = 0; k 0 ; k--){ - for( j = 0; j < imgWidth; j ++){ - QRgb rgb = image.pixel(j,k); - //qDebug()<= 60) tmp = vartype-60; - else if(tmp >= 50) tmp = vartype-50; - else if(tmp >= 40) tmp = vartype-40; - else if(tmp >= 30) tmp = vartype-30; - else if(tmp >= 20) tmp = vartype-20; - return tmp; - - -} - -/* - * -#ifdef MMVAR11 - // 同一行先排序: ,不同行分开排序,如何实现。 - int i,j; - for(i=0;istatus.variNum-1;i++){ - bool ch_flag=0; - for(j=i+1;jstatus.variNum;j++){ - if(sysPara->status.vars[j].startColPos < sysPara->status.vars[j-1].startColPos ){ - int n=sysPara->status.vars[j].startRowPos; - sysPara->status.vars[j].startRowPos = sysPara->status.vars[j-1].startRowPos; - sysPara->status.vars[j-1].startRowPos = n; - n=sysPara->status.vars[j].startColPos; - sysPara->status.vars[j].startColPos = sysPara->status.vars[j-1].startColPos; - sysPara->status.vars[j-1].startColPos = n; - ch_flag =1; - } - } - if(ch_flag==0) break; - } -#endif -*/ diff --git a/PulseNumFix.cpp b/PulseNumFix.cpp index afe9389..a2b35c9 100644 --- a/PulseNumFix.cpp +++ b/PulseNumFix.cpp @@ -1,111 +1,111 @@ -#include "PulseNumFix.h" -#include "ui_pulsenumfix.h" -#include -#include -#include -PulseNumFix::PulseNumFix(QWidget *parent) : - QDialog(parent), - ui(new Ui::PulseNumFix) -{ - ui->setupUi(this); - this->setWindowTitle(tr("脉冲数修正")); - setUIEnableStatus(); - connect(this,SIGNAL(accepted()),this,SLOT(onButtonBoxAccepted())); - ui->lineEditRate->setValidator(new QDoubleValidator(0)); - ui->lineEditActualSynLength->setValidator(new QDoubleValidator(0)); - ui->lineEditLength->setValidator(new QDoubleValidator(0)); - ui->lineEditPulseNum->setValidator(new QDoubleValidator(0)); - ui->lineEditDiameter->setValidator(new QDoubleValidator(0)); - ui->lineEditPulsePerCycle->setValidator(new QDoubleValidator(0)); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - ui->radioButtonAccordingRate->hide(); - ui->radioButtonAccordingPulseNum->hide(); -} - -PulseNumFix::~PulseNumFix() -{ - delete ui; -} - -void PulseNumFix::setUIEnableStatus(){ - ui->lineEditRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); - ui->labelRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); - ui->lineEditActualSynLength->setEnabled(ui->radioButtonAccordingLength->isChecked()); - ui->labelActualSynLength->setEnabled(ui->radioButtonAccordingLength->isChecked()); - ui->lineEditLength->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); - ui->labelLength->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); - ui->lineEditPulseNum->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); - ui->labelPulseNum->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); - ui->lineEditDiameter->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); - ui->labelDiameter->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); - ui->lineEditPulsePerCycle->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); - ui->labelPulsePerCycle->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); -} - -void PulseNumFix::onButtonBoxAccepted() -{ - float pulseNumPerMM = 0; - if(sysPara){ - if(ui->radioButtonAccordingRate->isChecked()){ - float rate = ui->lineEditRate->text().toFloat(); - if(rate != 0){ - pulseNumPerMM = sysPara->status.synPulseCntPer1s/rate; - } - else { - QMessageBox::critical(0,tr("错误"),tr("速度不应该为0")); - } - } - else if(ui->radioButtonAccordingLength->isChecked()){ - float length = ui->lineEditActualSynLength->text().toFloat(); - if(length != 0){ - pulseNumPerMM = sysPara->para.synPulseNumPerMm * sysPara->para.synTriggerPrintLenMm / length; - } - else { - QMessageBox::critical(0,tr("错误"),tr("实际同步长度不应该为0")); - } - } - else if(ui->radioButtonAccordingPulseNum->isChecked()){ - float length = ui->lineEditLength->text().toFloat(); - float pulse = ui->lineEditPulseNum->text().toFloat(); - if(length != 0){ - pulseNumPerMM = pulse/length; - } - else { - QMessageBox::critical(0,tr("错误"),tr("长度不应该为0")); - } - } - else if(ui->radioButtonSynchonizerPara->isChecked()){ - float circle = ui->lineEditDiameter->text().toFloat() * 3.1415926; - float pulseNum = ui->lineEditPulsePerCycle->text().toFloat(); - if(circle != 0){ - pulseNumPerMM = 4*pulseNum/circle; //电路和Fpga做了4倍频处理,这里乘以4是为了匹配4倍频的处理进行正确的显示 - }else { - QMessageBox::critical(0,tr("错误"),tr("直径不应该为0")); - } - } - if(pulseNumPerMM != 0){ - emit pulseNuxFixDone(pulseNumPerMM); - } - - } -} - -void PulseNumFix::on_radioButtonAccordingRate_released() -{ - setUIEnableStatus(); -} - -void PulseNumFix::on_radioButtonAccordingLength_released() -{ - setUIEnableStatus(); -} - -void PulseNumFix::on_radioButtonAccordingPulseNum_released() -{ - setUIEnableStatus(); -} - -void PulseNumFix::on_radioButtonSynchonizerPara_released() -{ - setUIEnableStatus(); -} +#include "PulseNumFix.h" +#include "ui_pulsenumfix.h" +#include +#include +#include +PulseNumFix::PulseNumFix(QWidget *parent) : + QDialog(parent), + ui(new Ui::PulseNumFix) +{ + ui->setupUi(this); + this->setWindowTitle(tr("脉冲数修正")); + setUIEnableStatus(); + connect(this,SIGNAL(accepted()),this,SLOT(onButtonBoxAccepted())); + ui->lineEditRate->setValidator(new QDoubleValidator(0)); + ui->lineEditActualSynLength->setValidator(new QDoubleValidator(0)); + ui->lineEditLength->setValidator(new QDoubleValidator(0)); + ui->lineEditPulseNum->setValidator(new QDoubleValidator(0)); + ui->lineEditDiameter->setValidator(new QDoubleValidator(0)); + ui->lineEditPulsePerCycle->setValidator(new QDoubleValidator(0)); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + ui->radioButtonAccordingRate->hide(); + ui->radioButtonAccordingPulseNum->hide(); +} + +PulseNumFix::~PulseNumFix() +{ + delete ui; +} + +void PulseNumFix::setUIEnableStatus(){ + ui->lineEditRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); + ui->labelRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); + ui->lineEditActualSynLength->setEnabled(ui->radioButtonAccordingLength->isChecked()); + ui->labelActualSynLength->setEnabled(ui->radioButtonAccordingLength->isChecked()); + ui->lineEditLength->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); + ui->labelLength->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); + ui->lineEditPulseNum->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); + ui->labelPulseNum->setEnabled(ui->radioButtonAccordingPulseNum->isChecked()); + ui->lineEditDiameter->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); + ui->labelDiameter->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); + ui->lineEditPulsePerCycle->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); + ui->labelPulsePerCycle->setEnabled(ui->radioButtonSynchonizerPara->isChecked()); +} + +void PulseNumFix::onButtonBoxAccepted() +{ + float pulseNumPerMM = 0; + if(sysPara){ + if(ui->radioButtonAccordingRate->isChecked()){ + float rate = ui->lineEditRate->text().toFloat(); + if(rate != 0){ + pulseNumPerMM = sysPara->status.synPulseCntPer1s/rate; + } + else { + QMessageBox::critical(0,tr("错误"),tr("速度不应该为0")); + } + } + else if(ui->radioButtonAccordingLength->isChecked()){ + float length = ui->lineEditActualSynLength->text().toFloat(); + if(length != 0){ + pulseNumPerMM = sysPara->para.synPulseNumPerMm * sysPara->para.synTriggerPrintLenMm / length; + } + else { + QMessageBox::critical(0,tr("错误"),tr("实际同步长度不应该为0")); + } + } + else if(ui->radioButtonAccordingPulseNum->isChecked()){ + float length = ui->lineEditLength->text().toFloat(); + float pulse = ui->lineEditPulseNum->text().toFloat(); + if(length != 0){ + pulseNumPerMM = pulse/length; + } + else { + QMessageBox::critical(0,tr("错误"),tr("长度不应该为0")); + } + } + else if(ui->radioButtonSynchonizerPara->isChecked()){ + float circle = ui->lineEditDiameter->text().toFloat() * 3.1415926; + float pulseNum = ui->lineEditPulsePerCycle->text().toFloat(); + if(circle != 0){ + pulseNumPerMM = 4*pulseNum/circle; //电路和Fpga做了4倍频处理,这里乘以4是为了匹配4倍频的处理进行正确的显示 + }else { + QMessageBox::critical(0,tr("错误"),tr("直径不应该为0")); + } + } + if(pulseNumPerMM != 0){ + emit pulseNuxFixDone(pulseNumPerMM); + } + + } +} + +void PulseNumFix::on_radioButtonAccordingRate_released() +{ + setUIEnableStatus(); +} + +void PulseNumFix::on_radioButtonAccordingLength_released() +{ + setUIEnableStatus(); +} + +void PulseNumFix::on_radioButtonAccordingPulseNum_released() +{ + setUIEnableStatus(); +} + +void PulseNumFix::on_radioButtonSynchonizerPara_released() +{ + setUIEnableStatus(); +} diff --git a/PulseNumFix.h b/PulseNumFix.h index 53a91d3..34b0344 100644 --- a/PulseNumFix.h +++ b/PulseNumFix.h @@ -1,39 +1,39 @@ -#ifndef PULSENUMFIX_H -#define PULSENUMFIX_H - -#include -#include -#include -namespace Ui { -class PulseNumFix; -} - -class PulseNumFix : public QDialog,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit PulseNumFix(QWidget *parent = 0); - ~PulseNumFix(); - -Q_SIGNALS: - void pulseNuxFixDone(float); - -private slots: - void setUIEnableStatus(); - - void onButtonBoxAccepted(); - - void on_radioButtonAccordingRate_released(); - - void on_radioButtonAccordingLength_released(); - - void on_radioButtonAccordingPulseNum_released(); - - void on_radioButtonSynchonizerPara_released(); - -private: - Ui::PulseNumFix *ui; -}; - -#endif // PULSENUMFIX_H +#ifndef PULSENUMFIX_H +#define PULSENUMFIX_H + +#include +#include +#include +namespace Ui { +class PulseNumFix; +} + +class PulseNumFix : public QDialog,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit PulseNumFix(QWidget *parent = 0); + ~PulseNumFix(); + +Q_SIGNALS: + void pulseNuxFixDone(float); + +private slots: + void setUIEnableStatus(); + + void onButtonBoxAccepted(); + + void on_radioButtonAccordingRate_released(); + + void on_radioButtonAccordingLength_released(); + + void on_radioButtonAccordingPulseNum_released(); + + void on_radioButtonSynchonizerPara_released(); + +private: + Ui::PulseNumFix *ui; +}; + +#endif // PULSENUMFIX_H diff --git a/QBarCode.cpp b/QBarCode.cpp index dd963ff..b0dbdcd 100644 --- a/QBarCode.cpp +++ b/QBarCode.cpp @@ -1,867 +1,867 @@ - -#include "QBarCode.h" -#include "ui_QBarCode.h" -#include "QImage" -#include "QFile" -#include "QFileInfo" -#include "QDebug" -#include "stdio.h" -#include "Public.h" -#include "QTextEdit" -//#include "SysPara.h" -#include "InkJetPrinter.h" - -static int dotn[]={5,7,9,12,16,24,32,40}; -#define AUTOREF false - -int AutoCount1=0; -#define MDTFLAG 0xff00FF10 -#define QRFLAG 0xff00FF20 -#define BARFLAG 0xff00FF30 - -extern InkJetPrinter *pInkJectPrinter; - -QBarCode::QBarCode(QWidget *parent) : - QDialog(parent), - ui(new Ui::QBarCode) -{ - ui->setupUi(this); - bcOK=false; - connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(ImgSave())); - connect(ui->pushBarPreview,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); - connect(ui->BarCodeScale,SIGNAL(valueChanged(int)),this,SLOT(onScaleChange(int))); - //connect(ui->spinBoxXPos,SIGNAL(valueChanged(int)),this,SLOT(onXposChange(int))); - connect(ui->lineEditModule,SIGNAL(textChanged(QString)),this,SLOT(onBarCodeRefresh(QString))); - //connect(ui->pushBtnOpenFile,SIGNAL(pressed()),this,SLOT(generateCharRamData())); - AutoRefresh = false; - ui->labFileName->setText(tr("文件未保存")); - ui->lineEditModule->setText("BEC301B030"); - fontSize = 9; - scene = new QGraphicsScene; - - //ui->BarCodeType->addItem("BARCODE_128B"); - //ui->BarCodeType->addItem("BARCODE_128C"); - //ui->BarCodeType->addItem("BARCODE_128RAW"); - ui->BarCodeType->addItem(tr("BARCODE_128")); - ui->BarCodeType->addItem(tr("BARCODE_93")); - //ui->BarCodeType->addItem(tr("自适应编码")); - ui->BarCodeType->addItem("BARCODE_ISBN"); - ui->BarCodeType->addItem("BARCODE_EAN"); - ui->BarCodeType->addItem("BARCODE_UPC"); - ui->BarCodeType->addItem("BARCODE_39"); - //ui->BarCodeType->addItem("BARCODE_CBR"); - //ui->BarCodeType->addItem("BARCODE_CBR"); - //ui->BarCodeType->addItem("BARCODE_PLS"); - //ui->BarCodeType->addItem("BARCODE_MSI"); - ui->BarCodeHeigh->addItem(tr("5点")); - ui->BarCodeHeigh->addItem(tr("7点")); - ui->BarCodeHeigh->addItem(tr("9点")); - ui->BarCodeHeigh->addItem(tr("12点")); - ui->BarCodeHeigh->addItem(tr("16点")); - ui->BarCodeHeigh->addItem(tr("24点")); - //ui->BarCodeHeigh->addItem(tr("24点")); - //onEnCodeBar(); - //ui->BarCodeFont->setCurrentIndex(1); - ui->BarCodeHeigh->setCurrentIndex(3); - ui->BarCodeType->setCurrentIndex(0); - //ui->BarCodeScale->setValue(2); - //ui->spinBoxXPos->setValue(1); -} - -QBarCode::~QBarCode() -{ - delete ui; -} -void QBarCode::TextBarCode(QString txt,int index) -{ - int ps = 1, pcl = 0, oflags; - ps = 0; pcl = 0; - oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; - /* and my data as code-128B autodetected */ - - //qDebug()<<"TextBarCode, txtLen:"<sysPara =sysPara; -} - -void QBarCode::onEnCodeBar(){ - QString txt2 =ui->lineEditModule->text().trimmed(); - QString txt3 =ui->lineEditLine->text().trimmed(); - QString txt4 =ui->lineEditLine1->text().trimmed(); - QString txtVar1,txtVar2; - QString txtVar5,txtVar6; - inkColor = ui->comboBoxInkColor->currentIndex()?1:0; - QString txt; - if(sysPara) - { - sysPara->para.bcOption.var1Type =1; - sysPara->para.bcOption.var2Type =2; - txtVar1=getVarTxt(ui->BarCodeVarEN1->isChecked(),sysPara->para.bcOption.var1Type); - txtVar2=getVarTxt(ui->BarCodeVarEN2->isChecked(),sysPara->para.bcOption.var2Type); - txtVar5=getVarTxt(ui->checkBoxBarDate->isChecked(),3); - txtVar6=getVarTxt(ui->checkBoxBarTime->isChecked(),4); - if(ui->BarCodeVarEN1->isChecked()) ui->lineEditVar1->setText(txtVar1); - if(ui->BarCodeVarEN2->isChecked()) ui->lineEditVar2->setText(txtVar2); - } - else qDebug()<<"no para init."; - -// %06d%04d TextBarCode, txtLen: 30 "BCD030000025000000020000340000" 1 - if(sysPara->para.isCheckInsertTime) - { - txt = txt2 + " " + txtVar5 + " " + txtVar6 + " " + txtVar1; - } - else - { - txt = txt2 + txtVar1+txt3+txtVar2+ txt4; - } - ui->label_Txt->setText(txt); - TextBarCode(txt, ui->BarCodeType->currentIndex()); - ShowBarCode(&imgBar); - //imgBar.save(QString().sprintf("BARV%d.bmp",imgBar.height()+ ui->BarCodeType->currentIndex()*100 )); -} - -QString QBarCode::getLabe_TxtString() -{ - return ui->label_Txt->text(); -} - -QString QBarCode::getVarTxt(bool varEn,unsigned varType) -{ - int tmp=1; - int varNum= (varType==1)? sysPara->para.bcOption.var1Num: - (varType==2)? sysPara->para.bcOption.var2Num: - 4; - QString txtVar=""; - char fmt[]="%04d"; - sprintf(fmt,"%%%02dd",varNum); - while(varNum-->0) tmp*=10; - //qDebug()<<"fmt"<status.calandar_and_dat.cnt1CurrValue,16).toInt(); - txtVar.sprintf(fmt,var1%tmp); //变量1 - } - else if(varType==2){ - int var2 = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt(); - txtVar.sprintf(fmt,var2%tmp); //变量2 - } - else if(varType==3) - { //日期 -// txtVar.sprintf("%04d%02d%02d",sysPara->status.calandar_and_dat.year, -// sysPara->status.calandar_and_dat.month, -// sysPara->status.calandar_and_dat.day); - QHash dateFormat; - dateFormat.insert(0,"yyyy-MM-dd"); - dateFormat.insert(1,"yyyy/MM/dd"); - dateFormat.insert(2,"yyyyMMdd"); - dateFormat.insert(3,"yyyy年MM月dd日"); - dateFormat.insert(4,"yyyy-MM-dd hh:mm"); - dateFormat.insert(5,"yyyy/MM/dd hh:mm"); - dateFormat.insert(6,"yyyyMMddhhmm"); - dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); - dateFormat.insert(8,"hh:mm"); - dateFormat.insert(9,"dd MM yy"); - dateFormat.insert(10,"dd/MM/yy"); - dateFormat.insert(11,"dd/MM/yyyy"); - dateFormat.insert(12,"dd-MM-yy"); - dateFormat.insert(13,"dd-MM-yyyy"); - - txtVar = QDateTime::currentDateTime().toString(dateFormat.value(sysPara->para.ExpirySplitMode)); - } - else if(varType==4) - { //时间 -// txtVar.sprintf("%02d%02d",sysPara->status.calandar_and_dat.hour, -// sysPara->status.calandar_and_dat.minute); - //sysPara->status.calandar_and_dat.second); - txtVar = QDateTime::currentDateTime().toString("hh:mm"); - } - else {} - - } - return txtVar; -} - -/* - * Do it all in one step - */ -int QBarCode::Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags) -{ - struct Barcode_Item * bc; - - if (!(bc=Barcode_Create(text))) { - qDebug()<<"mem less then:";//<< -ENOMEM ; - return -1; - } - - if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 - || Barcode_Encode(bc, flags) < 0 - //|| Barcode_Print(bc, f, flags) < 0 - ) { - qDebug()<<"EnCode Error:"<< bc->error; - Barcode_Delete(bc); - return -1; - } - //QFile f1; - bcText = text; - bcTextinfo = bc->textinfo; - bcPartial = bc->partial; - Barcode_ToImage(bc);// KEY - Barcode_Delete(bc); - return 0; -} -// 将条形码编码转换成点阵图形 -int QBarCode::Barcode_ToImage(Barcode_Item * bc ){ - - bc->ascii; - bc->partial; - bc->textinfo; - int len =QString(bc->partial).length(); - int BarTypeNumber = ui->BarCodeType->currentIndex(); - - QString txt = bc->ascii; - txt = txt.trimmed(); - inkColor = ui->comboBoxInkColor->currentIndex()?1:0; - int xoffset = inkColor?16:8;if((BarTypeNumber == 3) && (inkColor == 0))xoffset+=8; - int bcWidth1 =0; - for(int i=0;ipartial[i]&0x0f); - - bcHeight = dotn[ui->BarCodeHeigh->currentIndex()] ;//+(inkColor?xoffset/2:0); - bcWidth = xoffset + bcWidth1*(1+ui->BarCodeDot->currentIndex()); - if((BarTypeNumber == 3) && (inkColor == 0)) - bcWidth += 4; - QImage image(bcWidth,bcHeight,QImage::Format_ARGB32); - // inkColor --白墨 - //if(inkColor) - { - for(int j=0;j<=bcHeight-1;j++){ - for(int n=0;( nBarCodeDot->currentIndex()); - int xx = xoffset >> 1; - if((BarTypeNumber == 3) && (inkColor == 0)) - xx = (xoffset >>1 ) + 2; - int yoffset =0;//(inkColor?xx-1:0); - unsigned char py= inkColor?bcHeight-1:bcHeight-1; - - for(int j=yoffset;j<=py ;j++){ - i=xx; - for(int n=0;( npartial[n])&0x07; - c = c*DotNum; - if(n&0x01) { - for(int r=0;rcheckBoxAddText->isChecked()) - { - OnCharRamData(&image); // add text - } - //OnCharRamData2(&image,txtWidth,height); // add text - //ShowBarCode(&image); - imgBar = image.copy(image.rect()); - - if(AutoCount1 && pInkJectPrinter->modbus->modbus_up_QRCODE == 0) - { - imgBar.setPixel(0,imgBar.height()-1,BARFLAG); // 设置定位标志 - //qDebug()<<"Barcode_ToImage:x,y"<15) fileName= fileName.left(15); - fileName.remove(QRegExp("/")); - fileName.remove(QRegExp("\\")); - ui->labFileName->setText(fileName+".bmp" ); - this->pictureName = "/home/plg/doc/"+ fileName + ".bmp" ; - - QString s2=""; - imgBar.rgbSwapped(); - if(pInkJectPrinter->modbus->modbus_up_QRCODE == 1) - { -// qDebug()<<"save modbusQR"; - s2 = "modbusQR.bmp"; - this->pictureName=DOC_ROOT_DIR+s2; - imgBar.save(pictureName); - pInkJectPrinter->modbus->modbus_up_QRCODE = 0; - } - else - { - imgBar.save(this->pictureName); - } - //qDebug()<<"svae imag"<BarCodeType->currentIndex()*100 )); - - sysPara->saveParaToFile(); -} - - -void QBarCode::onScaleChange(int n){ - //ShowBarCode("tmp.bmp"); - if(bcOK==0) - onEnCodeBar(); - ShowBarCode(&imgBar); -} - -void QBarCode::onXposChange(int n){ - //ShowBarCode(this->pictureName); - //emit onEnCodeBar(); - if(AutoRefresh) { - onEnCodeBar(); - // ui->lineEdit->setFocus(); - } -} - -void QBarCode::SetOption(bcOption_t *bcOption){ - - AutoCount1=bcOption->var1En | bcOption->var2En; - - //ui->checkBoxInsertFlag->setChecked(1);//bcOption->AutoCount - //ui->BarCodeFont->setCurrentIndex(bcOption->font); - if(bcOption->height<7) ui->BarCodeHeigh->setCurrentIndex(bcOption->height); - else qDebug()<<"SetOption height"<height; - ui->BarCodeType->setCurrentIndex(bcOption->type); - ui->BarCodeScale->setValue(bcOption->scale); - ui->comboBoxInkColor->setCurrentIndex(bcOption->InkColor?1:0); - QString s1=bcOption->text; - ui->lineEditModule->setText(bcOption->TxtModule); - ui->lineEditLine->setText(bcOption->TxtLine); - ui->lineEditLine1->setText(bcOption->TxtLine1); - if(sysPara) - { - sysPara->para.bcOption.var1Type =1; - sysPara->para.bcOption.var2Type =2; - - txtVar1=getVarTxt(bcOption->var1En,bcOption->var1Type); - ui->lineEditVar1->setText(txtVar1); - txtVar2=getVarTxt(bcOption->var2En,bcOption->var2Type); - ui->lineEditVar2->setText(txtVar2); - - ui->BarCodeVarEN1->setChecked(bcOption->var1En); - ui->BarCodeVarEN2->setChecked(bcOption->var2En); - } - else qDebug()<<"no para init."; - - if(s1.length()>15) s1 = s1.left(15); - s1 +=".bmp"; - this->pictureName=DOC_ROOT_DIR+s1; - //onEnCodeBar(); - AutoRefresh = AUTOREF; - - sysPara->para.isCheckBarCodeAddText ? ui->checkBoxAddText->setChecked(true) : ui->checkBoxAddText->setChecked(false); - ui->checkBoxBarDate->setChecked(sysPara->para.isCheckBarDate); - ui->checkBoxBarTime->setChecked(sysPara->para.isCheckBarTime); -} - -void QBarCode::GetOption(bcOption_t *bcOption){ - bcOption->height = ui->BarCodeHeigh->currentIndex(); - bcOption->type = ui->BarCodeType->currentIndex(); - bcOption->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; - bcOption->AutoCount = 1; - - bcOption->var1En = ui->BarCodeVarEN1->isChecked(); - bcOption->var2En = ui->BarCodeVarEN2->isChecked(); - - snprintf(bcOption->text,sizeof(bcOption->text),"%s",bcText.toLatin1().constData()); - if(sysPara){ - snprintf(bcOption->TxtModule,sizeof(bcOption->TxtModule),"%s",ui->lineEditModule->text().toLatin1().constData()); - snprintf(bcOption->TxtLine,sizeof(bcOption->TxtLine),"%s",ui->lineEditLine->text().toLatin1().constData()); - snprintf(bcOption->TxtLine1,sizeof(bcOption->TxtLine1),"%s",ui->lineEditLine1->text().toLatin1().constData()); - } - - sysPara->para.isCheckBarCodeAddText = ui->checkBoxAddText->isChecked() ? true : false; - sysPara->para.isCheckBarDate = ui->checkBoxBarDate->isChecked(); - sysPara->para.isCheckBarTime = ui->checkBoxBarTime->isChecked(); -} - -void QBarCode::GetOption2(bcPara_t *bcOption){ - bcOption->height = imgBar.height(); - bcOption->type = ui->BarCodeType->currentIndex(); - //bcOption->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; - bcOption->width = imgBar.width(); - //snprintf(bcOption->text,sizeof(bcOption->text),"%s",bcText.toLatin1().constData()); -} -void QBarCode::on_pushBtnColse_pressed() -{ - flagInsert = ui->checkBoxInsertFlag->checkState()?1:0; - - //ui->checkBoxInsertFlag->setChecked(0); - //qDebug()<<"flagInsert"<checkBoxInsertFlag->checkState();图片方面 - //flagCount = ui - emit onBarCodeClose(); - this->close(); - AutoRefresh = false; - bcOK = false; -} -void QBarCode::onBarCodeRefresh(QString s){ - if(AutoRefresh) - { - //onEnCodeBar(); - //ui->lineEdit->setFocus(); - } - //ui->label_Txt->setText(bcText); -} - -void QBarCode::extSetText(QString text) -{ - //ui->comboBoxType->setCurrentIndex(1); - //ui->lineEditIn->setText(text); - //ui->lineEditIn2->setText(""); - //ui->lineEditCNT->setText(""); -// QString strTxt=ui->lineEditModule->text(); - - if(sysPara->para.isCheckInsertTime) - { - //ui->lineEditLine->setText(text); - } - else - { - ui->lineEditModule->setText(text); - ui->lineEditLine->setText(""); - ui->BarCodeVarEN1->setChecked(false); - } - ui->lineEditLine1->setText(""); - ui->BarCodeVarEN2->setChecked(false); - - pInkJectPrinter->modbus->modbus_up_QRCODE =1; - - emit onEnCodeBar(); - emit ImgSave(); -} - -void QBarCode::setFontSize(int PixelSize) -{ - fontSize = PixelSize; -} -int QBarCode::ImgLeftPos(QImage *img){ - int firstValidCol=0; - bool found =0; - int w = img->width(); - int h = img->height(); - unsigned char *dat = img->bits(); //if( *(dat+ j*4 + k*w*4 ) ==0x00 ) - for(int j = 0; j pixel(j,k); if((rgb&0x00ffffff)==0){ - if( *(dat+ j*4 + k*w*4 ) ==0x00 ) { - if(j>firstValidCol) firstValidCol = j ; - found=1; - break; - } - } - if(found) break; - } - return firstValidCol; -} - -int QBarCode::ImgRightPos(QImage *img){ - int lastValidCol=0; - bool found=0; - int scnt=0; - int w = img->width(); - int h = img->height(); - lastValidCol = w-1; - unsigned char *dat = img->bits(); //if( *(dat+ j*4 + k*w*4 ) ==0x00 ) - for(int j = w-1; j>0; j --){ - for(int k =0; k < h ; k++){ - scnt++; - //QRgb rgb = img->pixel(j,k); - //if((rgb&0x00ffffff)==0){ - if( *(dat+ j*4 + k*w*4 ) ==0x00 ) - { - if(jdrawContents (&painter,image.rect() ); //将text写到picimage.rect() - textEdit.hide(); - int xoff=0; - int lastValidRow = (bcHeight>height)? height + (bcHeight-height)/2: height; - // height - int startValidRow = (bcHeight>height)? (bcHeight-height)/2: 0; - ui->labStatus->setText(tr("标签宽度:%1,标签高度:%2,文本宽度:%3").arg(bcWidth).arg(height+bcHeight).arg(Txtwidth));// 文本宽度 标签宽度 条码宽度 - xoff =bcWidth+inkColor*4 ; - for(int k = 0; k < height; k++){ - for(int j = 0; j < Txtwidth; j ++){ - QRgb rgb = image.pixel(j,k); - img1->setPixel( xoff+j,startValidRow+k,rgb); - } - } - -} - -// Test -void QBarCode::OnCharRamData(QImage *img1){/* 生成字模数据 */ - textEdit.document()->setDocumentMargin(0); - int Txtwidth ; - //int height = bcHeight<16?bcHeight:16; - int height = fontSize; - int letterSpace=1 ; - textEdit.clear(); - int DPI = textEdit.logicalDpiX(); - DPI = DPI?DPI:1; //Pixel = DPI * Point / 72 - QFont font = textEdit.font(); - textEdit.insertHtml(QString("%4") - .arg(Public::getFontFamily(height)).arg(height*72/DPI).arg(400).arg(bcText)); //600表示加粗,400表示普通 - - font = textEdit.font(); - font.setLetterSpacing(QFont::AbsoluteSpacing,letterSpace); - font.setFamily(Public::getFontFamily(height)); - font.setPixelSize(height); - font.setWeight(QFont::Normal); - textEdit.setFont(font); - QFontMetrics fontMetrics(font); - Txtwidth = (fontMetrics.width(bcText)); - QSize size(Txtwidth+(Txtwidth>>2),height+bcHeight); - QImage image(size,QImage::Format_ARGB32); - image.fill(0x00ffffff); - QPainter painter(&image); - textEdit.setGeometry(0,0,1000,50); - textEdit.show(); //如果不显示,似乎不会绘制 - textEdit.setFixedWidth(image.rect().width()); - textEdit.document()->drawContents (&painter,image.rect() ); //将text写到picimage.rect() - textEdit.hide(); - Txtwidth = ImgRightPos(&image); - image.save("./QbarCodemage.bmp"); - int xoff=0; - int lastValidRow = height +bcHeight; - //img1->rect() - ui->labStatus->setText(tr("标签宽度:%1,标签高度:%2,文本宽度:%3").arg(bcWidth).arg(height+bcHeight).arg(Txtwidth));// 文本宽度 标签宽度 条码宽度 - if( bcWidth >= Txtwidth ) - { - xoff = (bcWidth-Txtwidth)/2; -// for(int k = 0; k < height; k++){ -// for(int j = 0; j < Txtwidth; j ++){ -// QRgb rgb = image.pixel(j,k); -// if((j+xoff)setPixel( xoff+j,k+bcHeight,rgb); -// } - -// } - - QImage qimg3 = QImage(bcWidth, height+bcHeight + 1, QImage::Format_RGB32); - qimg3.fill(0xffffff); -//LogInfo::setRunStatusText(tr("F=%1,S=%2,T=%3").arg(firstPart).arg(secondPart).arg(thirdPart)); - QPainter p(&qimg3); - - p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); - if((ui->BarCodeType->currentIndex() != 3) || (ui->BarCodeDot->currentIndex() > 0) || (font.pixelSize() > 7) || (ui->comboBoxInkColor->currentIndex() == 1)) - p.drawPixmap(xoff, bcHeight + 1, image.width(), image.height(), QPixmap::fromImage(image)); - else{//LogInfo::setRunStatusText(tr("length=%1").arg(bcText.length())); -// p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); -// p.drawPixmap(xoff - 12, bcHeight + 1 - 2, image.width(), image.height(), QPixmap::fromImage(image)); - QString firstPart = bcText.mid(0,1); // 第一个字符 - QString secondPart = bcText.mid(1, 6); // 第二个到第六个字符 - QString thirdPart = bcText.mid(7); // 第七个到第十四个字符,注意根据实际情况调整 - if (!firstPart.isEmpty()) { - QImage partImage = image.copy(0, 0, fontMetrics.width(firstPart), image.height()); // 裁剪出第一部分的图像 - //p.drawPixmap(xoff - 18, bcHeight - 1 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage));//77 - //p.drawPixmap(xoff - 12, bcHeight - 1 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage));//89 - if(Txtwidth < 70) - p.drawPixmap(xoff - 24, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); - else if(Txtwidth < 80) - p.drawPixmap(xoff - 18, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); - else - p.drawPixmap(xoff - 12, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); - } - if (!secondPart.isEmpty()) { - int startXSecondPart = xoff - 12 + fontMetrics.width(firstPart); // 增量包括第一部分的宽度和额外间距,77 - QImage partImage = image.copy(0+6, 0, fontMetrics.width(secondPart), image.height()); // 裁剪出第二部分的图像 - if(Txtwidth > 85){ - startXSecondPart = xoff - 10 + fontMetrics.width(firstPart);//89 - partImage = image.copy(0+6, 0, fontMetrics.width(secondPart), image.height()); // 裁剪出第二部分的图像 - } - else if(Txtwidth < 70){ - startXSecondPart = xoff - 15 + fontMetrics.width(firstPart); - partImage = image.copy(0+4, 0, fontMetrics.width(secondPart), image.height()); - } - p.drawPixmap(startXSecondPart, bcHeight - 2, partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); - } - if (!thirdPart.isEmpty()) { - int startXThirdPart = xoff - 8 + fontMetrics.width(secondPart)+12; // 类似地,增加第二部分的宽度和间距,77 - QImage partImage = image.copy(0+6+36, 0, fontMetrics.width(thirdPart), image.height()); - if(Txtwidth > 85){ - startXThirdPart = xoff - 10 + fontMetrics.width(secondPart)+12;//89 - partImage = image.copy(0+6+36, 0, fontMetrics.width(thirdPart), image.height()); // 裁剪出第三部分的图像 - } - else if(Txtwidth < 70){ - startXThirdPart = xoff - 5 + fontMetrics.width(secondPart)+12; - partImage = image.copy(0+4+30, 0, fontMetrics.width(thirdPart), image.height()); - } - p.drawPixmap(startXThirdPart, bcHeight - 2, partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); - } -// p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); - -// p.drawPixmap(xoff, bcHeight + 1, image.width(), image.height(), QPixmap::fromImage(image)); - - // 绘制第二部分字符 -// QImage tempImg = drawTextToImage(secondPart, font, image.colorSpace()); // 使用相同函数绘制第二部分文字到临时图像 -// p.drawPixmap(xoff + 40, bcHeight + 1 - 2, tempImg.width(), tempImg.height(), QPixmap::fromImage(tempImg)); - -// // 绘制第三部分字符 -// QImage tempImg2 = drawTextToImage(thirdPart, font, image.colorSpace()); // 同理,绘制第三部分 -// p.drawPixmap(xoff + 120, bcHeight + 1 - 2, tempImg2.width(), tempImg2.height(), QPixmap::fromImage(tempImg2)); - - //QPixmap pix3 = QPixmap::fromImage(qimg3); - //ui->label_dislocation->setPixmap(pix3.scaled(ui->label_dislocation->width(), ui->label_dislocation->height(), Qt::KeepAspectRatio)); - } - *img1 = qimg3.copy(0,0,qimg3.width(),qimg3.height()); - - img1->save("./QbarCodemage1.bmp"); - } - else { - int h1 = lastValidRow-1; //24 9 - for(int k = h1; k >= bcHeight; k--){ - for(int j = 0; j < Txtwidth; j ++){ - QRgb rgb = image.pixel(j,k-bcHeight); - image.setPixel( j,k,rgb); - image.setPixel(j,k-bcHeight,0x00ffffff); - } - } // dd djfdkf djfdkf二维码 - xoff = (Txtwidth-bcWidth)/2; - for(int k = 0; k < bcHeight; k++){ - -// if(inkColor){ -// if(kpixel(j,k); - if((xoff+j)save("./QbarCodemage2.bmp"); - } -} - -void QBarCode::ShowBarCode(QString fileName) -{ - //scene = new QGraphicsScene; - scene->clear(); - int scale = ui->BarCodeScale->value(); - scene->setSceneRect( 0,0,bcWidth*(scale),bcHeight*(scale+1)+10); - scene->setItemIndexMethod(QGraphicsScene::NoIndex); - //QPixmap pixmap(QPixmap::fromImage(*img)); - QPixmap pixmap(fileName); - pixmap = pixmap.scaledToHeight(bcHeight*(scale+1)); - /***************设置view的场景*****************************/ - ui->BarCodeView->setScene(scene); - ui->BarCodeView->setRenderHint(QPainter::Antialiasing); - ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); - ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); - //ui->graphicsView->resize(400,300); - ui->BarCodeView->setScene(scene);//设置view的场景 - -} -void QBarCode::ShowBarCode(QImage *img) -{ - //scene = new QGraphicsScene; - scene->clear(); - int scale = ui->BarCodeScale->value(); - scene->setSceneRect( 0,0,bcWidth*(scale+1)+10,bcHeight*(scale)); - scene->setItemIndexMethod(QGraphicsScene::NoIndex); - QPixmap pixmap(QPixmap::fromImage(*img)); - //pixmap = pixmap.scaledToHeight(bcHeight*(scale+1)); - pixmap = pixmap.scaledToWidth((scale+1)*bcWidth); - item = scene->addPixmap(pixmap); - /***************设置view的场景*****************************/ - ui->BarCodeView->setScene(scene); - ui->BarCodeView->setRenderHint(QPainter::Antialiasing); - ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); - ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); - //ui->graphicsView->resize(400,300); - ui->BarCodeView->setScene(scene);//设置view的场景 -} - - -QString QBarCode::TextToBCImg(bcOption_t *bcVar,QString txt) -{ - - if(txt.isEmpty()){txt = "";return txt;} - // 转换条形码 - // ---- - int index = bcVar->barType; - - TextBarCode(txt, index); - //bcVar->width = imgBar.width(); - //bcVar->height = imgBar.height(); - bcWidth = imgBar.width(); - bcHeight = imgBar.height(); - //qDebug()<<"TextToBCImg"<status.flagOfNo67FPGA) - MaxCol4000 = true; - else - MaxCol4000 = false; - if(MaxCol4000){ - dat =sysPara->status.printDat_Normal; - }else{ - dat =sysPara->status.printDat; - } - int w= imgBar.width(); - int h= imgBar.height(); - int n=0; - int hStart=0; - int wStart=0; - //qDebug()<setupUi(this); + bcOK=false; + connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(ImgSave())); + connect(ui->pushBarPreview,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); + connect(ui->BarCodeScale,SIGNAL(valueChanged(int)),this,SLOT(onScaleChange(int))); + //connect(ui->spinBoxXPos,SIGNAL(valueChanged(int)),this,SLOT(onXposChange(int))); + connect(ui->lineEditModule,SIGNAL(textChanged(QString)),this,SLOT(onBarCodeRefresh(QString))); + //connect(ui->pushBtnOpenFile,SIGNAL(pressed()),this,SLOT(generateCharRamData())); + AutoRefresh = false; + ui->labFileName->setText(tr("文件未保存")); + ui->lineEditModule->setText("BEC301B030"); + fontSize = 9; + scene = new QGraphicsScene; + + //ui->BarCodeType->addItem("BARCODE_128B"); + //ui->BarCodeType->addItem("BARCODE_128C"); + //ui->BarCodeType->addItem("BARCODE_128RAW"); + ui->BarCodeType->addItem(tr("BARCODE_128")); + ui->BarCodeType->addItem(tr("BARCODE_93")); + //ui->BarCodeType->addItem(tr("自适应编码")); + ui->BarCodeType->addItem("BARCODE_ISBN"); + ui->BarCodeType->addItem("BARCODE_EAN"); + ui->BarCodeType->addItem("BARCODE_UPC"); + ui->BarCodeType->addItem("BARCODE_39"); + //ui->BarCodeType->addItem("BARCODE_CBR"); + //ui->BarCodeType->addItem("BARCODE_CBR"); + //ui->BarCodeType->addItem("BARCODE_PLS"); + //ui->BarCodeType->addItem("BARCODE_MSI"); + ui->BarCodeHeigh->addItem(tr("5点")); + ui->BarCodeHeigh->addItem(tr("7点")); + ui->BarCodeHeigh->addItem(tr("9点")); + ui->BarCodeHeigh->addItem(tr("12点")); + ui->BarCodeHeigh->addItem(tr("16点")); + ui->BarCodeHeigh->addItem(tr("24点")); + //ui->BarCodeHeigh->addItem(tr("24点")); + //onEnCodeBar(); + //ui->BarCodeFont->setCurrentIndex(1); + ui->BarCodeHeigh->setCurrentIndex(3); + ui->BarCodeType->setCurrentIndex(0); + //ui->BarCodeScale->setValue(2); + //ui->spinBoxXPos->setValue(1); +} + +QBarCode::~QBarCode() +{ + delete ui; +} +void QBarCode::TextBarCode(QString txt,int index) +{ + int ps = 1, pcl = 0, oflags; + ps = 0; pcl = 0; + oflags = BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS; + /* and my data as code-128B autodetected */ + + //qDebug()<<"TextBarCode, txtLen:"<sysPara =sysPara; +} + +void QBarCode::onEnCodeBar(){ + QString txt2 =ui->lineEditModule->text().trimmed(); + QString txt3 =ui->lineEditLine->text().trimmed(); + QString txt4 =ui->lineEditLine1->text().trimmed(); + QString txtVar1,txtVar2; + QString txtVar5,txtVar6; + inkColor = ui->comboBoxInkColor->currentIndex()?1:0; + QString txt; + if(sysPara) + { + sysPara->para.bcOption.var1Type =1; + sysPara->para.bcOption.var2Type =2; + txtVar1=getVarTxt(ui->BarCodeVarEN1->isChecked(),sysPara->para.bcOption.var1Type); + txtVar2=getVarTxt(ui->BarCodeVarEN2->isChecked(),sysPara->para.bcOption.var2Type); + txtVar5=getVarTxt(ui->checkBoxBarDate->isChecked(),3); + txtVar6=getVarTxt(ui->checkBoxBarTime->isChecked(),4); + if(ui->BarCodeVarEN1->isChecked()) ui->lineEditVar1->setText(txtVar1); + if(ui->BarCodeVarEN2->isChecked()) ui->lineEditVar2->setText(txtVar2); + } + else qDebug()<<"no para init."; + +// %06d%04d TextBarCode, txtLen: 30 "BCD030000025000000020000340000" 1 + if(sysPara->para.isCheckInsertTime) + { + txt = txt2 + " " + txtVar5 + " " + txtVar6 + " " + txtVar1; + } + else + { + txt = txt2 + txtVar1+txt3+txtVar2+ txt4; + } + ui->label_Txt->setText(txt); + TextBarCode(txt, ui->BarCodeType->currentIndex()); + ShowBarCode(&imgBar); + //imgBar.save(QString().sprintf("BARV%d.bmp",imgBar.height()+ ui->BarCodeType->currentIndex()*100 )); +} + +QString QBarCode::getLabe_TxtString() +{ + return ui->label_Txt->text(); +} + +QString QBarCode::getVarTxt(bool varEn,unsigned varType) +{ + int tmp=1; + int varNum= (varType==1)? sysPara->para.bcOption.var1Num: + (varType==2)? sysPara->para.bcOption.var2Num: + 4; + QString txtVar=""; + char fmt[]="%04d"; + sprintf(fmt,"%%%02dd",varNum); + while(varNum-->0) tmp*=10; + //qDebug()<<"fmt"<status.calandar_and_dat.cnt1CurrValue,16).toInt(); + txtVar.sprintf(fmt,var1%tmp); //变量1 + } + else if(varType==2){ + int var2 = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt(); + txtVar.sprintf(fmt,var2%tmp); //变量2 + } + else if(varType==3) + { //日期 +// txtVar.sprintf("%04d%02d%02d",sysPara->status.calandar_and_dat.year, +// sysPara->status.calandar_and_dat.month, +// sysPara->status.calandar_and_dat.day); + QHash dateFormat; + dateFormat.insert(0,"yyyy-MM-dd"); + dateFormat.insert(1,"yyyy/MM/dd"); + dateFormat.insert(2,"yyyyMMdd"); + dateFormat.insert(3,"yyyy年MM月dd日"); + dateFormat.insert(4,"yyyy-MM-dd hh:mm"); + dateFormat.insert(5,"yyyy/MM/dd hh:mm"); + dateFormat.insert(6,"yyyyMMddhhmm"); + dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); + dateFormat.insert(8,"hh:mm"); + dateFormat.insert(9,"dd MM yy"); + dateFormat.insert(10,"dd/MM/yy"); + dateFormat.insert(11,"dd/MM/yyyy"); + dateFormat.insert(12,"dd-MM-yy"); + dateFormat.insert(13,"dd-MM-yyyy"); + + txtVar = QDateTime::currentDateTime().toString(dateFormat.value(sysPara->para.ExpirySplitMode)); + } + else if(varType==4) + { //时间 +// txtVar.sprintf("%02d%02d",sysPara->status.calandar_and_dat.hour, +// sysPara->status.calandar_and_dat.minute); + //sysPara->status.calandar_and_dat.second); + txtVar = QDateTime::currentDateTime().toString("hh:mm"); + } + else {} + + } + return txtVar; +} + +/* + * Do it all in one step + */ +int QBarCode::Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags) +{ + struct Barcode_Item * bc; + + if (!(bc=Barcode_Create(text))) { + qDebug()<<"mem less then:";//<< -ENOMEM ; + return -1; + } + + if ( Barcode_Position(bc, wid, hei, xoff, yoff, 0.0) < 0 + || Barcode_Encode(bc, flags) < 0 + //|| Barcode_Print(bc, f, flags) < 0 + ) { + qDebug()<<"EnCode Error:"<< bc->error; + Barcode_Delete(bc); + return -1; + } + //QFile f1; + bcText = text; + bcTextinfo = bc->textinfo; + bcPartial = bc->partial; + Barcode_ToImage(bc);// KEY + Barcode_Delete(bc); + return 0; +} +// 将条形码编码转换成点阵图形 +int QBarCode::Barcode_ToImage(Barcode_Item * bc ){ + + bc->ascii; + bc->partial; + bc->textinfo; + int len =QString(bc->partial).length(); + int BarTypeNumber = ui->BarCodeType->currentIndex(); + + QString txt = bc->ascii; + txt = txt.trimmed(); + inkColor = ui->comboBoxInkColor->currentIndex()?1:0; + int xoffset = inkColor?16:8;if((BarTypeNumber == 3) && (inkColor == 0))xoffset+=8; + int bcWidth1 =0; + for(int i=0;ipartial[i]&0x0f); + + bcHeight = dotn[ui->BarCodeHeigh->currentIndex()] ;//+(inkColor?xoffset/2:0); + bcWidth = xoffset + bcWidth1*(1+ui->BarCodeDot->currentIndex()); + if((BarTypeNumber == 3) && (inkColor == 0)) + bcWidth += 4; + QImage image(bcWidth,bcHeight,QImage::Format_ARGB32); + // inkColor --白墨 + //if(inkColor) + { + for(int j=0;j<=bcHeight-1;j++){ + for(int n=0;( nBarCodeDot->currentIndex()); + int xx = xoffset >> 1; + if((BarTypeNumber == 3) && (inkColor == 0)) + xx = (xoffset >>1 ) + 2; + int yoffset =0;//(inkColor?xx-1:0); + unsigned char py= inkColor?bcHeight-1:bcHeight-1; + + for(int j=yoffset;j<=py ;j++){ + i=xx; + for(int n=0;( npartial[n])&0x07; + c = c*DotNum; + if(n&0x01) { + for(int r=0;rcheckBoxAddText->isChecked()) + { + OnCharRamData(&image); // add text + } + //OnCharRamData2(&image,txtWidth,height); // add text + //ShowBarCode(&image); + imgBar = image.copy(image.rect()); + + if(AutoCount1 && pInkJectPrinter->modbus->modbus_up_QRCODE == 0) + { + imgBar.setPixel(0,imgBar.height()-1,BARFLAG); // 设置定位标志 + //qDebug()<<"Barcode_ToImage:x,y"<15) fileName= fileName.left(15); + fileName.remove(QRegExp("/")); + fileName.remove(QRegExp("\\")); + ui->labFileName->setText(fileName+".bmp" ); + this->pictureName = "/home/plg/doc/"+ fileName + ".bmp" ; + + QString s2=""; + imgBar.rgbSwapped(); + if(pInkJectPrinter->modbus->modbus_up_QRCODE == 1) + { +// qDebug()<<"save modbusQR"; + s2 = "modbusQR.bmp"; + this->pictureName=DOC_ROOT_DIR+s2; + imgBar.save(pictureName); + pInkJectPrinter->modbus->modbus_up_QRCODE = 0; + } + else + { + imgBar.save(this->pictureName); + } + //qDebug()<<"svae imag"<BarCodeType->currentIndex()*100 )); + + sysPara->saveParaToFile(); +} + + +void QBarCode::onScaleChange(int n){ + //ShowBarCode("tmp.bmp"); + if(bcOK==0) + onEnCodeBar(); + ShowBarCode(&imgBar); +} + +void QBarCode::onXposChange(int n){ + //ShowBarCode(this->pictureName); + //emit onEnCodeBar(); + if(AutoRefresh) { + onEnCodeBar(); + // ui->lineEdit->setFocus(); + } +} + +void QBarCode::SetOption(bcOption_t *bcOption){ + + AutoCount1=bcOption->var1En | bcOption->var2En; + + //ui->checkBoxInsertFlag->setChecked(1);//bcOption->AutoCount + //ui->BarCodeFont->setCurrentIndex(bcOption->font); + if(bcOption->height<7) ui->BarCodeHeigh->setCurrentIndex(bcOption->height); + else qDebug()<<"SetOption height"<height; + ui->BarCodeType->setCurrentIndex(bcOption->type); + ui->BarCodeScale->setValue(bcOption->scale); + ui->comboBoxInkColor->setCurrentIndex(bcOption->InkColor?1:0); + QString s1=bcOption->text; + ui->lineEditModule->setText(bcOption->TxtModule); + ui->lineEditLine->setText(bcOption->TxtLine); + ui->lineEditLine1->setText(bcOption->TxtLine1); + if(sysPara) + { + sysPara->para.bcOption.var1Type =1; + sysPara->para.bcOption.var2Type =2; + + txtVar1=getVarTxt(bcOption->var1En,bcOption->var1Type); + ui->lineEditVar1->setText(txtVar1); + txtVar2=getVarTxt(bcOption->var2En,bcOption->var2Type); + ui->lineEditVar2->setText(txtVar2); + + ui->BarCodeVarEN1->setChecked(bcOption->var1En); + ui->BarCodeVarEN2->setChecked(bcOption->var2En); + } + else qDebug()<<"no para init."; + + if(s1.length()>15) s1 = s1.left(15); + s1 +=".bmp"; + this->pictureName=DOC_ROOT_DIR+s1; + //onEnCodeBar(); + AutoRefresh = AUTOREF; + + sysPara->para.isCheckBarCodeAddText ? ui->checkBoxAddText->setChecked(true) : ui->checkBoxAddText->setChecked(false); + ui->checkBoxBarDate->setChecked(sysPara->para.isCheckBarDate); + ui->checkBoxBarTime->setChecked(sysPara->para.isCheckBarTime); +} + +void QBarCode::GetOption(bcOption_t *bcOption){ + bcOption->height = ui->BarCodeHeigh->currentIndex(); + bcOption->type = ui->BarCodeType->currentIndex(); + bcOption->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; + bcOption->AutoCount = 1; + + bcOption->var1En = ui->BarCodeVarEN1->isChecked(); + bcOption->var2En = ui->BarCodeVarEN2->isChecked(); + + snprintf(bcOption->text,sizeof(bcOption->text),"%s",bcText.toLatin1().constData()); + if(sysPara){ + snprintf(bcOption->TxtModule,sizeof(bcOption->TxtModule),"%s",ui->lineEditModule->text().toLatin1().constData()); + snprintf(bcOption->TxtLine,sizeof(bcOption->TxtLine),"%s",ui->lineEditLine->text().toLatin1().constData()); + snprintf(bcOption->TxtLine1,sizeof(bcOption->TxtLine1),"%s",ui->lineEditLine1->text().toLatin1().constData()); + } + + sysPara->para.isCheckBarCodeAddText = ui->checkBoxAddText->isChecked() ? true : false; + sysPara->para.isCheckBarDate = ui->checkBoxBarDate->isChecked(); + sysPara->para.isCheckBarTime = ui->checkBoxBarTime->isChecked(); +} + +void QBarCode::GetOption2(bcPara_t *bcOption){ + bcOption->height = imgBar.height(); + bcOption->type = ui->BarCodeType->currentIndex(); + //bcOption->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; + bcOption->width = imgBar.width(); + //snprintf(bcOption->text,sizeof(bcOption->text),"%s",bcText.toLatin1().constData()); +} +void QBarCode::on_pushBtnColse_pressed() +{ + flagInsert = ui->checkBoxInsertFlag->checkState()?1:0; + + //ui->checkBoxInsertFlag->setChecked(0); + //qDebug()<<"flagInsert"<checkBoxInsertFlag->checkState();图片方面 + //flagCount = ui + emit onBarCodeClose(); + this->close(); + AutoRefresh = false; + bcOK = false; +} +void QBarCode::onBarCodeRefresh(QString s){ + if(AutoRefresh) + { + //onEnCodeBar(); + //ui->lineEdit->setFocus(); + } + //ui->label_Txt->setText(bcText); +} + +void QBarCode::extSetText(QString text) +{ + //ui->comboBoxType->setCurrentIndex(1); + //ui->lineEditIn->setText(text); + //ui->lineEditIn2->setText(""); + //ui->lineEditCNT->setText(""); +// QString strTxt=ui->lineEditModule->text(); + + if(sysPara->para.isCheckInsertTime) + { + //ui->lineEditLine->setText(text); + } + else + { + ui->lineEditModule->setText(text); + ui->lineEditLine->setText(""); + ui->BarCodeVarEN1->setChecked(false); + } + ui->lineEditLine1->setText(""); + ui->BarCodeVarEN2->setChecked(false); + + pInkJectPrinter->modbus->modbus_up_QRCODE =1; + + emit onEnCodeBar(); + emit ImgSave(); +} + +void QBarCode::setFontSize(int PixelSize) +{ + fontSize = PixelSize; +} +int QBarCode::ImgLeftPos(QImage *img){ + int firstValidCol=0; + bool found =0; + int w = img->width(); + int h = img->height(); + unsigned char *dat = img->bits(); //if( *(dat+ j*4 + k*w*4 ) ==0x00 ) + for(int j = 0; j pixel(j,k); if((rgb&0x00ffffff)==0){ + if( *(dat+ j*4 + k*w*4 ) ==0x00 ) { + if(j>firstValidCol) firstValidCol = j ; + found=1; + break; + } + } + if(found) break; + } + return firstValidCol; +} + +int QBarCode::ImgRightPos(QImage *img){ + int lastValidCol=0; + bool found=0; + int scnt=0; + int w = img->width(); + int h = img->height(); + lastValidCol = w-1; + unsigned char *dat = img->bits(); //if( *(dat+ j*4 + k*w*4 ) ==0x00 ) + for(int j = w-1; j>0; j --){ + for(int k =0; k < h ; k++){ + scnt++; + //QRgb rgb = img->pixel(j,k); + //if((rgb&0x00ffffff)==0){ + if( *(dat+ j*4 + k*w*4 ) ==0x00 ) + { + if(jdrawContents (&painter,image.rect() ); //将text写到picimage.rect() + textEdit.hide(); + int xoff=0; + int lastValidRow = (bcHeight>height)? height + (bcHeight-height)/2: height; + // height + int startValidRow = (bcHeight>height)? (bcHeight-height)/2: 0; + ui->labStatus->setText(tr("标签宽度:%1,标签高度:%2,文本宽度:%3").arg(bcWidth).arg(height+bcHeight).arg(Txtwidth));// 文本宽度 标签宽度 条码宽度 + xoff =bcWidth+inkColor*4 ; + for(int k = 0; k < height; k++){ + for(int j = 0; j < Txtwidth; j ++){ + QRgb rgb = image.pixel(j,k); + img1->setPixel( xoff+j,startValidRow+k,rgb); + } + } + +} + +// Test +void QBarCode::OnCharRamData(QImage *img1){/* 生成字模数据 */ + textEdit.document()->setDocumentMargin(0); + int Txtwidth ; + //int height = bcHeight<16?bcHeight:16; + int height = fontSize; + int letterSpace=1 ; + textEdit.clear(); + int DPI = textEdit.logicalDpiX(); + DPI = DPI?DPI:1; //Pixel = DPI * Point / 72 + QFont font = textEdit.font(); + textEdit.insertHtml(QString("%4") + .arg(Public::getFontFamily(height)).arg(height*72/DPI).arg(400).arg(bcText)); //600表示加粗,400表示普通 + + font = textEdit.font(); + font.setLetterSpacing(QFont::AbsoluteSpacing,letterSpace); + font.setFamily(Public::getFontFamily(height)); + font.setPixelSize(height); + font.setWeight(QFont::Normal); + textEdit.setFont(font); + QFontMetrics fontMetrics(font); + Txtwidth = (fontMetrics.width(bcText)); + QSize size(Txtwidth+(Txtwidth>>2),height+bcHeight); + QImage image(size,QImage::Format_ARGB32); + image.fill(0x00ffffff); + QPainter painter(&image); + textEdit.setGeometry(0,0,1000,50); + textEdit.show(); //如果不显示,似乎不会绘制 + textEdit.setFixedWidth(image.rect().width()); + textEdit.document()->drawContents (&painter,image.rect() ); //将text写到picimage.rect() + textEdit.hide(); + Txtwidth = ImgRightPos(&image); + image.save("./QbarCodemage.bmp"); + int xoff=0; + int lastValidRow = height +bcHeight; + //img1->rect() + ui->labStatus->setText(tr("标签宽度:%1,标签高度:%2,文本宽度:%3").arg(bcWidth).arg(height+bcHeight).arg(Txtwidth));// 文本宽度 标签宽度 条码宽度 + if( bcWidth >= Txtwidth ) + { + xoff = (bcWidth-Txtwidth)/2; +// for(int k = 0; k < height; k++){ +// for(int j = 0; j < Txtwidth; j ++){ +// QRgb rgb = image.pixel(j,k); +// if((j+xoff)setPixel( xoff+j,k+bcHeight,rgb); +// } + +// } + + QImage qimg3 = QImage(bcWidth, height+bcHeight + 1, QImage::Format_RGB32); + qimg3.fill(0xffffff); +//LogInfo::setRunStatusText(tr("F=%1,S=%2,T=%3").arg(firstPart).arg(secondPart).arg(thirdPart)); + QPainter p(&qimg3); + + p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); + if((ui->BarCodeType->currentIndex() != 3) || (ui->BarCodeDot->currentIndex() > 0) || (font.pixelSize() > 7) || (ui->comboBoxInkColor->currentIndex() == 1)) + p.drawPixmap(xoff, bcHeight + 1, image.width(), image.height(), QPixmap::fromImage(image)); + else{//LogInfo::setRunStatusText(tr("length=%1").arg(bcText.length())); +// p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); +// p.drawPixmap(xoff - 12, bcHeight + 1 - 2, image.width(), image.height(), QPixmap::fromImage(image)); + QString firstPart = bcText.mid(0,1); // 第一个字符 + QString secondPart = bcText.mid(1, 6); // 第二个到第六个字符 + QString thirdPart = bcText.mid(7); // 第七个到第十四个字符,注意根据实际情况调整 + if (!firstPart.isEmpty()) { + QImage partImage = image.copy(0, 0, fontMetrics.width(firstPart), image.height()); // 裁剪出第一部分的图像 + //p.drawPixmap(xoff - 18, bcHeight - 1 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage));//77 + //p.drawPixmap(xoff - 12, bcHeight - 1 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage));//89 + if(Txtwidth < 70) + p.drawPixmap(xoff - 24, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); + else if(Txtwidth < 80) + p.drawPixmap(xoff - 18, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); + else + p.drawPixmap(xoff - 12, bcHeight - 2 , partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); + } + if (!secondPart.isEmpty()) { + int startXSecondPart = xoff - 12 + fontMetrics.width(firstPart); // 增量包括第一部分的宽度和额外间距,77 + QImage partImage = image.copy(0+6, 0, fontMetrics.width(secondPart), image.height()); // 裁剪出第二部分的图像 + if(Txtwidth > 85){ + startXSecondPart = xoff - 10 + fontMetrics.width(firstPart);//89 + partImage = image.copy(0+6, 0, fontMetrics.width(secondPart), image.height()); // 裁剪出第二部分的图像 + } + else if(Txtwidth < 70){ + startXSecondPart = xoff - 15 + fontMetrics.width(firstPart); + partImage = image.copy(0+4, 0, fontMetrics.width(secondPart), image.height()); + } + p.drawPixmap(startXSecondPart, bcHeight - 2, partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); + } + if (!thirdPart.isEmpty()) { + int startXThirdPart = xoff - 8 + fontMetrics.width(secondPart)+12; // 类似地,增加第二部分的宽度和间距,77 + QImage partImage = image.copy(0+6+36, 0, fontMetrics.width(thirdPart), image.height()); + if(Txtwidth > 85){ + startXThirdPart = xoff - 10 + fontMetrics.width(secondPart)+12;//89 + partImage = image.copy(0+6+36, 0, fontMetrics.width(thirdPart), image.height()); // 裁剪出第三部分的图像 + } + else if(Txtwidth < 70){ + startXThirdPart = xoff - 5 + fontMetrics.width(secondPart)+12; + partImage = image.copy(0+4+30, 0, fontMetrics.width(thirdPart), image.height()); + } + p.drawPixmap(startXThirdPart, bcHeight - 2, partImage.width(), partImage.height(), QPixmap::fromImage(partImage)); + } +// p.drawPixmap(0, 0, img1->width(), img1->height(), QPixmap::fromImage(*img1)); + +// p.drawPixmap(xoff, bcHeight + 1, image.width(), image.height(), QPixmap::fromImage(image)); + + // 绘制第二部分字符 +// QImage tempImg = drawTextToImage(secondPart, font, image.colorSpace()); // 使用相同函数绘制第二部分文字到临时图像 +// p.drawPixmap(xoff + 40, bcHeight + 1 - 2, tempImg.width(), tempImg.height(), QPixmap::fromImage(tempImg)); + +// // 绘制第三部分字符 +// QImage tempImg2 = drawTextToImage(thirdPart, font, image.colorSpace()); // 同理,绘制第三部分 +// p.drawPixmap(xoff + 120, bcHeight + 1 - 2, tempImg2.width(), tempImg2.height(), QPixmap::fromImage(tempImg2)); + + //QPixmap pix3 = QPixmap::fromImage(qimg3); + //ui->label_dislocation->setPixmap(pix3.scaled(ui->label_dislocation->width(), ui->label_dislocation->height(), Qt::KeepAspectRatio)); + } + *img1 = qimg3.copy(0,0,qimg3.width(),qimg3.height()); + + img1->save("./QbarCodemage1.bmp"); + } + else { + int h1 = lastValidRow-1; //24 9 + for(int k = h1; k >= bcHeight; k--){ + for(int j = 0; j < Txtwidth; j ++){ + QRgb rgb = image.pixel(j,k-bcHeight); + image.setPixel( j,k,rgb); + image.setPixel(j,k-bcHeight,0x00ffffff); + } + } // dd djfdkf djfdkf二维码 + xoff = (Txtwidth-bcWidth)/2; + for(int k = 0; k < bcHeight; k++){ + +// if(inkColor){ +// if(kpixel(j,k); + if((xoff+j)save("./QbarCodemage2.bmp"); + } +} + +void QBarCode::ShowBarCode(QString fileName) +{ + //scene = new QGraphicsScene; + scene->clear(); + int scale = ui->BarCodeScale->value(); + scene->setSceneRect( 0,0,bcWidth*(scale),bcHeight*(scale+1)+10); + scene->setItemIndexMethod(QGraphicsScene::NoIndex); + //QPixmap pixmap(QPixmap::fromImage(*img)); + QPixmap pixmap(fileName); + pixmap = pixmap.scaledToHeight(bcHeight*(scale+1)); + /***************设置view的场景*****************************/ + ui->BarCodeView->setScene(scene); + ui->BarCodeView->setRenderHint(QPainter::Antialiasing); + ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); + ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); + //ui->graphicsView->resize(400,300); + ui->BarCodeView->setScene(scene);//设置view的场景 + +} +void QBarCode::ShowBarCode(QImage *img) +{ + //scene = new QGraphicsScene; + scene->clear(); + int scale = ui->BarCodeScale->value(); + scene->setSceneRect( 0,0,bcWidth*(scale+1)+10,bcHeight*(scale)); + scene->setItemIndexMethod(QGraphicsScene::NoIndex); + QPixmap pixmap(QPixmap::fromImage(*img)); + //pixmap = pixmap.scaledToHeight(bcHeight*(scale+1)); + pixmap = pixmap.scaledToWidth((scale+1)*bcWidth); + item = scene->addPixmap(pixmap); + /***************设置view的场景*****************************/ + ui->BarCodeView->setScene(scene); + ui->BarCodeView->setRenderHint(QPainter::Antialiasing); + ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); + ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); + //ui->graphicsView->resize(400,300); + ui->BarCodeView->setScene(scene);//设置view的场景 +} + + +QString QBarCode::TextToBCImg(bcOption_t *bcVar,QString txt) +{ + + if(txt.isEmpty()){txt = "";return txt;} + // 转换条形码 + // ---- + int index = bcVar->barType; + + TextBarCode(txt, index); + //bcVar->width = imgBar.width(); + //bcVar->height = imgBar.height(); + bcWidth = imgBar.width(); + bcHeight = imgBar.height(); + //qDebug()<<"TextToBCImg"<status.flagOfNo67FPGA) + MaxCol4000 = true; + else + MaxCol4000 = false; + if(MaxCol4000){ + dat =sysPara->status.printDat_Normal; + }else{ + dat =sysPara->status.printDat; + } + int w= imgBar.width(); + int h= imgBar.height(); + int n=0; + int hStart=0; + int wStart=0; + //qDebug()< - -#include "BarCode/barcode.h" -#include "QGraphicsScene" -#include "QGraphicsPixmapItem" -#include "SysPara.h" -#include "QTextEdit" -#include "ParaSettingUI.h" - -//typedef struct // BarCodeOption -//{ -// unsigned char xpos; -// unsigned char font; -// unsigned char height; -// unsigned char scale; -// unsigned char text[200]; -//}bcOption_t; -typedef struct { - unsigned int width; - unsigned char height; - unsigned char type; - unsigned char nc; -}bcPara_t; - -namespace Ui { - class QBarCode; -} - -class QBarCode : public QDialog, public ParaSettingUI -{ - Q_OBJECT - -public: - explicit QBarCode(QWidget *parent = 0); - ~QBarCode(); - void bindSysPara(SysPara *sysPara); - //unsigned char pointMap[40*1000]; - QString pictureName;//当前显示的图片 - void SetOption(bcOption_t *bcOption); - void GetOption(bcOption_t *bcOption); - QString bcText; - int bcWidth,bcHeight; - unsigned char flagInsert:1; - unsigned char flagCount:1; - unsigned char inkColor:1; - unsigned char flagNC:5; - - int ImgRightPos(QImage *img); - int ImgLeftPos(QImage *img); - int getDat(unsigned char *dat,int varNum); - int getDat2(SysPara* sysPara,int varNum); -public: - QImage imgBar; - - QString TextToBCImg(bcOption_t *bcVar,QString txt); - void TextBarCode(QString txt, int index); - void GetOption2(bcPara_t *bcOption); - QString getLabe_TxtString(); - QString getVarTxt(bool varEn, unsigned varType);// 0,1,2,3,4 - void extSetText(QString text); - public slots: - void setFontSize(int PixelSize); -private slots: - void onEnCodeBar(); - void onScaleChange(int n); - void onXposChange(int n); - void on_pushBtnColse_pressed(); - void ImgSave(); - void onBarCodeRefresh(QString s); -signals: - void onBarCodeClose(); -private: - - void OnCharRamData(QImage *img); - void OnCharRamData1(QImage *img); - void OnCharRamData2(QImage *img1,int Txtwidth,int height); - void ShowBarCode(QString fileName); - void ShowBarCode(QImage *img); - int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, - int xoff, int yoff, int flags); - int Barcode_ToImage(Barcode_Item * bc ); - int fontSize; - - QGraphicsScene *scene;//声明scene - QGraphicsPixmapItem *item;//声明item - bool bcOK; - QString bcPartial; - QString bcTextinfo; - bool AutoRefresh; - QTextEdit textEdit; - QString txtVar1,txtVar2; - -private: - Ui::QBarCode *ui; -}; - -#endif // QBARCODE_H +#ifndef QBARCODE_H +#define QBARCODE_H + +#include + +#include "BarCode/barcode.h" +#include "QGraphicsScene" +#include "QGraphicsPixmapItem" +#include "SysPara.h" +#include "QTextEdit" +#include "ParaSettingUI.h" + +//typedef struct // BarCodeOption +//{ +// unsigned char xpos; +// unsigned char font; +// unsigned char height; +// unsigned char scale; +// unsigned char text[200]; +//}bcOption_t; +typedef struct { + unsigned int width; + unsigned char height; + unsigned char type; + unsigned char nc; +}bcPara_t; + +namespace Ui { + class QBarCode; +} + +class QBarCode : public QDialog, public ParaSettingUI +{ + Q_OBJECT + +public: + explicit QBarCode(QWidget *parent = 0); + ~QBarCode(); + void bindSysPara(SysPara *sysPara); + //unsigned char pointMap[40*1000]; + QString pictureName;//当前显示的图片 + void SetOption(bcOption_t *bcOption); + void GetOption(bcOption_t *bcOption); + QString bcText; + int bcWidth,bcHeight; + unsigned char flagInsert:1; + unsigned char flagCount:1; + unsigned char inkColor:1; + unsigned char flagNC:5; + + int ImgRightPos(QImage *img); + int ImgLeftPos(QImage *img); + int getDat(unsigned char *dat,int varNum); + int getDat2(SysPara* sysPara,int varNum); +public: + QImage imgBar; + + QString TextToBCImg(bcOption_t *bcVar,QString txt); + void TextBarCode(QString txt, int index); + void GetOption2(bcPara_t *bcOption); + QString getLabe_TxtString(); + QString getVarTxt(bool varEn, unsigned varType);// 0,1,2,3,4 + void extSetText(QString text); + public slots: + void setFontSize(int PixelSize); +private slots: + void onEnCodeBar(); + void onScaleChange(int n); + void onXposChange(int n); + void on_pushBtnColse_pressed(); + void ImgSave(); + void onBarCodeRefresh(QString s); +signals: + void onBarCodeClose(); +private: + + void OnCharRamData(QImage *img); + void OnCharRamData1(QImage *img); + void OnCharRamData2(QImage *img1,int Txtwidth,int height); + void ShowBarCode(QString fileName); + void ShowBarCode(QImage *img); + int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei, + int xoff, int yoff, int flags); + int Barcode_ToImage(Barcode_Item * bc ); + int fontSize; + + QGraphicsScene *scene;//声明scene + QGraphicsPixmapItem *item;//声明item + bool bcOK; + QString bcPartial; + QString bcTextinfo; + bool AutoRefresh; + QTextEdit textEdit; + QString txtVar1,txtVar2; + +private: + Ui::QBarCode *ui; +}; + +#endif // QBARCODE_H diff --git a/QBarCode.ui b/QBarCode.ui index e5d7fb4..7453c52 100644 --- a/QBarCode.ui +++ b/QBarCode.ui @@ -1,382 +1,382 @@ - - - QBarCode - - - Qt::NonModal - - - - 0 - 0 - 710 - 350 - - - - - 16777215 - 400 - - - - Qt::StrongFocus - - - Dialog - - - - :/image/BarCode1.png:/image/BarCode1.png - - - false - - - - - - - - 条形码类型 - - - - - - - 条形码高度 - - - - - - - 条码宽度 - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - - - - - - - - - 1点 - - - - - 2点 - - - - - 3点 - - - - - 4点 - - - - - 5点 - - - - - 6点 - - - - - - - - 文本1 - - - Qt::AlignCenter - - - - - - - - 16777215 - 172 - - - - - - - - 20 - - - - - - - - 60 - 16777215 - - - - false - - - false - - - 1 - - - 10 - - - 1 - - - - - - - 显示缩放 - - - - - - - 墨水类型 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - 1 - - - - 黑墨 - - - - - 白墨 - - - - - - - - - - - 文本3 - - - Qt::AlignCenter - - - - - - - false - - - - 80 - 16777215 - - - - - - - - Qt::LeftToRight - - - 计数器2 - - - - - - - - - - 文本2 - - - Qt::AlignCenter - - - - - - - false - - - - 80 - 16777215 - - - - - - - - Qt::LeftToRight - - - 计数器1 - - - - - - - Qt::LeftToRight - - - 插入文档 - - - - - - - 预览 - - - true - - - true - - - - - - - 返回 - - - - - - - 条码保存 - - - - - - - - 16777215 - 16 - - - - - - - - - - - - 16777215 - 16 - - - - FileName - - - Qt::AlignCenter - - - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - 增加数字行 - - - - - - - 日期 - - - - - - - 时间 - - - - - - - - - - + + + QBarCode + + + Qt::NonModal + + + + 0 + 0 + 710 + 350 + + + + + 16777215 + 400 + + + + Qt::StrongFocus + + + Dialog + + + + :/image/BarCode1.png:/image/BarCode1.png + + + false + + + + + + + + 条形码类型 + + + + + + + 条形码高度 + + + + + + + 条码宽度 + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + + + + + + + + + 1点 + + + + + 2点 + + + + + 3点 + + + + + 4点 + + + + + 5点 + + + + + 6点 + + + + + + + + 文本1 + + + Qt::AlignCenter + + + + + + + + 16777215 + 172 + + + + + + + + 20 + + + + + + + + 60 + 16777215 + + + + false + + + false + + + 1 + + + 10 + + + 1 + + + + + + + 显示缩放 + + + + + + + 墨水类型 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 1 + + + + 黑墨 + + + + + 白墨 + + + + + + + + + + + 文本3 + + + Qt::AlignCenter + + + + + + + false + + + + 80 + 16777215 + + + + + + + + Qt::LeftToRight + + + 计数器2 + + + + + + + + + + 文本2 + + + Qt::AlignCenter + + + + + + + false + + + + 80 + 16777215 + + + + + + + + Qt::LeftToRight + + + 计数器1 + + + + + + + Qt::LeftToRight + + + 插入文档 + + + + + + + 预览 + + + true + + + true + + + + + + + 返回 + + + + + + + 条码保存 + + + + + + + + 16777215 + 16 + + + + + + + + + + + + 16777215 + 16 + + + + FileName + + + Qt::AlignCenter + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + 增加数字行 + + + + + + + 日期 + + + + + + + 时间 + + + + + + + + + + diff --git a/QbarCodemage1.bmp b/QbarCodemage1.bmp deleted file mode 100644 index 3c86c83..0000000 Binary files a/QbarCodemage1.bmp and /dev/null differ diff --git a/QbarCodemage2.bmp b/QbarCodemage2.bmp deleted file mode 100644 index 2fe35ef..0000000 Binary files a/QbarCodemage2.bmp and /dev/null differ diff --git a/QtQREnCode/121.pro b/QtQREnCode/121.pro index 758982d..47df5ea 100644 --- a/QtQREnCode/121.pro +++ b/QtQREnCode/121.pro @@ -1,49 +1,49 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2013-04-25T18:27:50 -# -#------------------------------------------------- - -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = 121 -TEMPLATE = app - - -SOURCES +=\ - bitstream.cpp \ - mask.cpp \ - qrenc.cpp \ - qrencode.cpp \ - qrinput.cpp \ - qrspec.cpp \ - rscode.cpp \ - split.cpp \ - mainwindow.cpp - -HEADERS += \ - bistream.h \ - mask.h \ - qrencode_inner.h \ - qrinput.h \ - qrspec.h \ - rscode.h \ - split.h \ - mainwindow.h - - - - - - -unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lqrencode - -INCLUDEPATH += $$PWD/../../../../../../../usr/local/include -DEPENDPATH += $$PWD/../../../../../../../usr/local/include - -unix:!macx: LIBS += -lpng12 - -FORMS += \ - mainwindow.ui +#------------------------------------------------- +# +# Project created by QtCreator 2013-04-25T18:27:50 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = 121 +TEMPLATE = app + + +SOURCES +=\ + bitstream.cpp \ + mask.cpp \ + qrenc.cpp \ + qrencode.cpp \ + qrinput.cpp \ + qrspec.cpp \ + rscode.cpp \ + split.cpp \ + mainwindow.cpp + +HEADERS += \ + bistream.h \ + mask.h \ + qrencode_inner.h \ + qrinput.h \ + qrspec.h \ + rscode.h \ + split.h \ + mainwindow.h + + + + + + +unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lqrencode + +INCLUDEPATH += $$PWD/../../../../../../../usr/local/include +DEPENDPATH += $$PWD/../../../../../../../usr/local/include + +unix:!macx: LIBS += -lpng12 + +FORMS += \ + mainwindow.ui diff --git a/QtQREnCode/bistream.h b/QtQREnCode/bistream.h index e8362c8..bb395d2 100644 --- a/QtQREnCode/bistream.h +++ b/QtQREnCode/bistream.h @@ -1,43 +1,43 @@ -#ifndef BISTREAM_H -#define BISTREAM_H - -/* - * qrencode - QR Code encoder - * - * Binary sequence class. - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __BITSTREAM_H__ -#define __BITSTREAM_H__ - -typedef struct { - char *data; -} BitStream; - -extern BitStream *BitStream_new(void); -extern void BitStream_append(BitStream *bstream, BitStream *arg); -extern void BitStream_appendNum(BitStream *bstream, int bits, unsigned int num); -extern void BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data); -extern unsigned int BitStream_size(BitStream *bstream); -extern unsigned char *BitStream_toByte(BitStream *bstream); -extern void BitStream_free(BitStream *bstream); - -#endif /* __BITSTREAM_H__ */ - - -#endif // BISTREAM_H +#ifndef BISTREAM_H +#define BISTREAM_H + +/* + * qrencode - QR Code encoder + * + * Binary sequence class. + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __BITSTREAM_H__ +#define __BITSTREAM_H__ + +typedef struct { + char *data; +} BitStream; + +extern BitStream *BitStream_new(void); +extern void BitStream_append(BitStream *bstream, BitStream *arg); +extern void BitStream_appendNum(BitStream *bstream, int bits, unsigned int num); +extern void BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data); +extern unsigned int BitStream_size(BitStream *bstream); +extern unsigned char *BitStream_toByte(BitStream *bstream); +extern void BitStream_free(BitStream *bstream); + +#endif /* __BITSTREAM_H__ */ + + +#endif // BISTREAM_H diff --git a/QtQREnCode/bitstream.c b/QtQREnCode/bitstream.c index f620050..3793dd1 100644 --- a/QtQREnCode/bitstream.c +++ b/QtQREnCode/bitstream.c @@ -1,231 +1,231 @@ -/* - * qrencode - QR Code encoder - * - * Binary sequence class. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include - -#include "bitstream.h" - -#define DEFAULT_BUFSIZE (128) - -BitStream *BitStream_new(void) -{ - BitStream *bstream; - - bstream = (BitStream *)malloc(sizeof(BitStream)); - if(bstream == NULL) return NULL; - - bstream->length = 0; - bstream->data = (unsigned char *)malloc(DEFAULT_BUFSIZE); - if(bstream->data == NULL) { - free(bstream); - return NULL; - } - bstream->datasize = DEFAULT_BUFSIZE; - - return bstream; -} - -#ifdef WITH_TESTS -BitStream *BitStream_newWithBits(size_t size, unsigned char *bits) -{ - BitStream *bstream; - - if(size == 0) return BitStream_new(); - - bstream = (BitStream *)malloc(sizeof(BitStream)); - if(bstream == NULL) return NULL; - - bstream->data = (unsigned char *)malloc(size); - if(bstream->data == NULL) { - free(bstream); - return NULL; - } - - bstream->length = size; - bstream->datasize = size; - memcpy(bstream->data, bits, size); - - return bstream; -} -#endif - -static int BitStream_expand(BitStream *bstream) -{ - unsigned char *data; - - data = (unsigned char *)realloc(bstream->data, bstream->datasize * 2); - if(data == NULL) { - return -1; - } - - bstream->data = data; - bstream->datasize *= 2; - - return 0; -} - -static void BitStream_writeNum(unsigned char *dest, size_t bits, unsigned int num) -{ - unsigned int mask; - size_t i; - unsigned char *p; - - p = dest; - mask = 1U << (bits - 1); - for(i = 0; i < bits; i++) { - if(num & mask) { - *p = 1; - } else { - *p = 0; - } - p++; - mask = mask >> 1; - } -} - -static void BitStream_writeBytes(unsigned char *dest, size_t size, unsigned char *data) -{ - unsigned char mask; - size_t i, j; - unsigned char *p; - - p = dest; - for(i = 0; i < size; i++) { - mask = 0x80; - for(j = 0; j < 8; j++) { - if(data[i] & mask) { - *p = 1; - } else { - *p = 0; - } - p++; - mask = mask >> 1; - } - } -} - -int BitStream_append(BitStream *bstream, BitStream *arg) -{ - int ret; - - if(arg == NULL) { - return -1; - } - if(arg->length == 0) { - return 0; - } - - while(bstream->length + arg->length > bstream->datasize) { - ret = BitStream_expand(bstream); - if(ret < 0) return ret; - } - - memcpy(bstream->data + bstream->length, arg->data, arg->length); - bstream->length += arg->length; - - return 0; -} - -int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num) -{ - int ret; - - if(bits == 0) return 0; - - while(bstream->datasize - bstream->length < bits) { - ret = BitStream_expand(bstream); - if(ret < 0) return ret; - } - BitStream_writeNum(bstream->data + bstream->length, bits, num); - bstream->length += bits; - - return 0; -} - -int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data) -{ - int ret; - - if(size == 0) return 0; - - while(bstream->datasize - bstream->length < size * 8) { - ret = BitStream_expand(bstream); - if(ret < 0) return ret; - } - BitStream_writeBytes(bstream->data + bstream->length, size, data); - bstream->length += size * 8; - - return 0; -} - -unsigned char *BitStream_toByte(BitStream *bstream) -{ - size_t i, j, size, bytes, oddbits; - unsigned char *data, v; - unsigned char *p; - - size = BitStream_size(bstream); - if(size == 0) { - return NULL; - } - data = (unsigned char *)malloc((size + 7) / 8); - if(data == NULL) { - return NULL; - } - - bytes = size / 8; - - p = bstream->data; - for(i = 0; i < bytes; i++) { - v = 0; - for(j = 0; j < 8; j++) { - v = (unsigned char)(v << 1); - v |= *p; - p++; - } - data[i] = v; - } - oddbits = size & 7; - if(oddbits > 0) { - v = 0; - for(j = 0; j < oddbits; j++) { - v = (unsigned char)(v << 1); - v |= *p; - p++; - } - data[bytes] = (unsigned char)(v << (8 - oddbits)); - } - - return data; -} - -void BitStream_free(BitStream *bstream) -{ - if(bstream != NULL) { - free(bstream->data); - free(bstream); - } -} +/* + * qrencode - QR Code encoder + * + * Binary sequence class. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include + +#include "bitstream.h" + +#define DEFAULT_BUFSIZE (128) + +BitStream *BitStream_new(void) +{ + BitStream *bstream; + + bstream = (BitStream *)malloc(sizeof(BitStream)); + if(bstream == NULL) return NULL; + + bstream->length = 0; + bstream->data = (unsigned char *)malloc(DEFAULT_BUFSIZE); + if(bstream->data == NULL) { + free(bstream); + return NULL; + } + bstream->datasize = DEFAULT_BUFSIZE; + + return bstream; +} + +#ifdef WITH_TESTS +BitStream *BitStream_newWithBits(size_t size, unsigned char *bits) +{ + BitStream *bstream; + + if(size == 0) return BitStream_new(); + + bstream = (BitStream *)malloc(sizeof(BitStream)); + if(bstream == NULL) return NULL; + + bstream->data = (unsigned char *)malloc(size); + if(bstream->data == NULL) { + free(bstream); + return NULL; + } + + bstream->length = size; + bstream->datasize = size; + memcpy(bstream->data, bits, size); + + return bstream; +} +#endif + +static int BitStream_expand(BitStream *bstream) +{ + unsigned char *data; + + data = (unsigned char *)realloc(bstream->data, bstream->datasize * 2); + if(data == NULL) { + return -1; + } + + bstream->data = data; + bstream->datasize *= 2; + + return 0; +} + +static void BitStream_writeNum(unsigned char *dest, size_t bits, unsigned int num) +{ + unsigned int mask; + size_t i; + unsigned char *p; + + p = dest; + mask = 1U << (bits - 1); + for(i = 0; i < bits; i++) { + if(num & mask) { + *p = 1; + } else { + *p = 0; + } + p++; + mask = mask >> 1; + } +} + +static void BitStream_writeBytes(unsigned char *dest, size_t size, unsigned char *data) +{ + unsigned char mask; + size_t i, j; + unsigned char *p; + + p = dest; + for(i = 0; i < size; i++) { + mask = 0x80; + for(j = 0; j < 8; j++) { + if(data[i] & mask) { + *p = 1; + } else { + *p = 0; + } + p++; + mask = mask >> 1; + } + } +} + +int BitStream_append(BitStream *bstream, BitStream *arg) +{ + int ret; + + if(arg == NULL) { + return -1; + } + if(arg->length == 0) { + return 0; + } + + while(bstream->length + arg->length > bstream->datasize) { + ret = BitStream_expand(bstream); + if(ret < 0) return ret; + } + + memcpy(bstream->data + bstream->length, arg->data, arg->length); + bstream->length += arg->length; + + return 0; +} + +int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num) +{ + int ret; + + if(bits == 0) return 0; + + while(bstream->datasize - bstream->length < bits) { + ret = BitStream_expand(bstream); + if(ret < 0) return ret; + } + BitStream_writeNum(bstream->data + bstream->length, bits, num); + bstream->length += bits; + + return 0; +} + +int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data) +{ + int ret; + + if(size == 0) return 0; + + while(bstream->datasize - bstream->length < size * 8) { + ret = BitStream_expand(bstream); + if(ret < 0) return ret; + } + BitStream_writeBytes(bstream->data + bstream->length, size, data); + bstream->length += size * 8; + + return 0; +} + +unsigned char *BitStream_toByte(BitStream *bstream) +{ + size_t i, j, size, bytes, oddbits; + unsigned char *data, v; + unsigned char *p; + + size = BitStream_size(bstream); + if(size == 0) { + return NULL; + } + data = (unsigned char *)malloc((size + 7) / 8); + if(data == NULL) { + return NULL; + } + + bytes = size / 8; + + p = bstream->data; + for(i = 0; i < bytes; i++) { + v = 0; + for(j = 0; j < 8; j++) { + v = (unsigned char)(v << 1); + v |= *p; + p++; + } + data[i] = v; + } + oddbits = size & 7; + if(oddbits > 0) { + v = 0; + for(j = 0; j < oddbits; j++) { + v = (unsigned char)(v << 1); + v |= *p; + p++; + } + data[bytes] = (unsigned char)(v << (8 - oddbits)); + } + + return data; +} + +void BitStream_free(BitStream *bstream) +{ + if(bstream != NULL) { + free(bstream->data); + free(bstream); + } +} diff --git a/QtQREnCode/bitstream.cpp b/QtQREnCode/bitstream.cpp index d2feac9..dd5d024 100644 --- a/QtQREnCode/bitstream.cpp +++ b/QtQREnCode/bitstream.cpp @@ -1,180 +1,180 @@ -/* - * qrencode - QR Code encoder - * - * Binary sequence class. - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "bistream.h" - -BitStream *BitStream_new(void) -{ - BitStream *bstream; - - bstream = (BitStream *)malloc(sizeof(BitStream)); - bstream->data = NULL; - - return bstream; -} - -static BitStream *BitStream_newFromNum(int bits, unsigned int num) -{ - unsigned int mask; - int i; - char *p; - BitStream *bstream; - - bstream = BitStream_new(); - bstream->data = (char *)malloc(bits + 1); - - p = bstream->data; - mask = 1 << (bits - 1); - for(i=0; i> 1; - } - *p = '\0'; - - return bstream; -} - -static BitStream *BitStream_newFromBytes(int size, unsigned char *data) -{ - unsigned char mask; - int i, j; - char *p; - BitStream *bstream; - - bstream = BitStream_new(); - bstream->data = (char *)malloc(size * 8 + 1); - - p = bstream->data; - for(i=0; i> 1; - } - } - *p = '\0'; - - return bstream; -} - -void BitStream_append(BitStream *bstream, BitStream *arg) -{ - int l1, l2; - char *_new; - - if(arg == NULL || arg->data == NULL) { - return; - } - if(bstream->data == NULL) { - bstream->data = strdup(arg->data); - return; - } - - l1 = strlen(bstream->data); - l2 = strlen(arg->data); - _new = (char *)malloc(l1 + l2 + 1); - strcpy(_new, bstream->data); - strcat(_new, arg->data); - - free(bstream->data); - bstream->data = _new; -} - -void BitStream_appendNum(BitStream *bstream, int bits, unsigned int num) -{ - BitStream *b; - - b = BitStream_newFromNum(bits, num); - BitStream_append(bstream, b); - BitStream_free(b); -} - -void BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data) -{ - BitStream *b; - - b = BitStream_newFromBytes(size, data); - BitStream_append(bstream, b); - BitStream_free(b); -} - -unsigned int BitStream_size(BitStream *bstream) -{ - if(bstream->data == NULL) return 0; - - return strlen(bstream->data); -} - -unsigned char *BitStream_toByte(BitStream *bstream) -{ - int i, j, size, bytes; - unsigned char *data, v; - char *p; - - size = BitStream_size(bstream); - data = (unsigned char *)malloc((size + 7) / 8); - bytes = size / 8; - - p = bstream->data; - for(i=0; idata != NULL) { - free(bstream->data); - } - free(bstream); -} - +/* + * qrencode - QR Code encoder + * + * Binary sequence class. + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include "bistream.h" + +BitStream *BitStream_new(void) +{ + BitStream *bstream; + + bstream = (BitStream *)malloc(sizeof(BitStream)); + bstream->data = NULL; + + return bstream; +} + +static BitStream *BitStream_newFromNum(int bits, unsigned int num) +{ + unsigned int mask; + int i; + char *p; + BitStream *bstream; + + bstream = BitStream_new(); + bstream->data = (char *)malloc(bits + 1); + + p = bstream->data; + mask = 1 << (bits - 1); + for(i=0; i> 1; + } + *p = '\0'; + + return bstream; +} + +static BitStream *BitStream_newFromBytes(int size, unsigned char *data) +{ + unsigned char mask; + int i, j; + char *p; + BitStream *bstream; + + bstream = BitStream_new(); + bstream->data = (char *)malloc(size * 8 + 1); + + p = bstream->data; + for(i=0; i> 1; + } + } + *p = '\0'; + + return bstream; +} + +void BitStream_append(BitStream *bstream, BitStream *arg) +{ + int l1, l2; + char *_new; + + if(arg == NULL || arg->data == NULL) { + return; + } + if(bstream->data == NULL) { + bstream->data = strdup(arg->data); + return; + } + + l1 = strlen(bstream->data); + l2 = strlen(arg->data); + _new = (char *)malloc(l1 + l2 + 1); + strcpy(_new, bstream->data); + strcat(_new, arg->data); + + free(bstream->data); + bstream->data = _new; +} + +void BitStream_appendNum(BitStream *bstream, int bits, unsigned int num) +{ + BitStream *b; + + b = BitStream_newFromNum(bits, num); + BitStream_append(bstream, b); + BitStream_free(b); +} + +void BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data) +{ + BitStream *b; + + b = BitStream_newFromBytes(size, data); + BitStream_append(bstream, b); + BitStream_free(b); +} + +unsigned int BitStream_size(BitStream *bstream) +{ + if(bstream->data == NULL) return 0; + + return strlen(bstream->data); +} + +unsigned char *BitStream_toByte(BitStream *bstream) +{ + int i, j, size, bytes; + unsigned char *data, v; + char *p; + + size = BitStream_size(bstream); + data = (unsigned char *)malloc((size + 7) / 8); + bytes = size / 8; + + p = bstream->data; + for(i=0; idata != NULL) { + free(bstream->data); + } + free(bstream); +} + diff --git a/QtQREnCode/bitstream.h b/QtQREnCode/bitstream.h index 70f3e1d..d0895bf 100644 --- a/QtQREnCode/bitstream.h +++ b/QtQREnCode/bitstream.h @@ -1,43 +1,43 @@ -/* - * qrencode - QR Code encoder - * - * Binary sequence class. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BITSTREAM_H -#define BITSTREAM_H - -typedef struct { - size_t length; - size_t datasize; - unsigned char *data; -} BitStream; - -extern BitStream *BitStream_new(void); -#ifdef WITH_TESTS -extern BitStream *BitStream_newWithBits(size_t size, unsigned char *bits); -#endif -extern int BitStream_append(BitStream *bstream, BitStream *arg); -extern int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num); -extern int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data); -#define BitStream_size(__bstream__) (__bstream__->length) -#define BitStream_reset(__bstream__) (__bstream__->length = 0) -extern unsigned char *BitStream_toByte(BitStream *bstream); -extern void BitStream_free(BitStream *bstream); - -#endif /* BITSTREAM_H */ +/* + * qrencode - QR Code encoder + * + * Binary sequence class. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef BITSTREAM_H +#define BITSTREAM_H + +typedef struct { + size_t length; + size_t datasize; + unsigned char *data; +} BitStream; + +extern BitStream *BitStream_new(void); +#ifdef WITH_TESTS +extern BitStream *BitStream_newWithBits(size_t size, unsigned char *bits); +#endif +extern int BitStream_append(BitStream *bstream, BitStream *arg); +extern int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num); +extern int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data); +#define BitStream_size(__bstream__) (__bstream__->length) +#define BitStream_reset(__bstream__) (__bstream__->length = 0) +extern unsigned char *BitStream_toByte(BitStream *bstream); +extern void BitStream_free(BitStream *bstream); + +#endif /* BITSTREAM_H */ diff --git a/QtQREnCode/form.ui b/QtQREnCode/form.ui index f7d2e81..81c53e7 100644 --- a/QtQREnCode/form.ui +++ b/QtQREnCode/form.ui @@ -1,19 +1,19 @@ - - - Form - - - - 0 - 0 - 662 - 388 - - - - Form - - - - - + + + Form + + + + 0 + 0 + 662 + 388 + + + + Form + + + + + diff --git a/QtQREnCode/main.cpp b/QtQREnCode/main.cpp index b48f94e..aab39bb 100644 --- a/QtQREnCode/main.cpp +++ b/QtQREnCode/main.cpp @@ -1,11 +1,11 @@ -#include "mainwindow.h" -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); -} +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/QtQREnCode/mainwindow.cpp b/QtQREnCode/mainwindow.cpp index 8b13789..d3f5a12 100644 --- a/QtQREnCode/mainwindow.cpp +++ b/QtQREnCode/mainwindow.cpp @@ -1 +1 @@ - + diff --git a/QtQREnCode/mainwindow.h b/QtQREnCode/mainwindow.h index ed42168..e232fb0 100644 --- a/QtQREnCode/mainwindow.h +++ b/QtQREnCode/mainwindow.h @@ -1,25 +1,25 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private slots: - void on_pushButton_clicked(); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private slots: + void on_pushButton_clicked(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/QtQREnCode/mainwindow.ui b/QtQREnCode/mainwindow.ui index 2adb789..52f352b 100644 --- a/QtQREnCode/mainwindow.ui +++ b/QtQREnCode/mainwindow.ui @@ -1,173 +1,173 @@ - - - MainWindow - - - - 0 - 0 - 565 - 435 - - - - MainWindow - - - - - - 330 - 350 - 99 - 27 - - - - encode - - - - - - 10 - 290 - 541 - 51 - - - - - - - 20 - 270 - 67 - 17 - - - - Message - - - - - - 450 - 240 - 85 - 27 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 6 - - - - - - - 310 - 240 - 85 - 27 - - - - - L - - - - - M - - - - - H - - - - - Q - - - - - - - 370 - 240 - 67 - 17 - - - - size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 230 - 250 - 67 - 17 - - - - level: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 40 - 10 - 431 - 211 - - - - TextLabel - - - - - - - 0 - 0 - 565 - 23 - - - - - - - - + + + MainWindow + + + + 0 + 0 + 565 + 435 + + + + MainWindow + + + + + + 330 + 350 + 99 + 27 + + + + encode + + + + + + 10 + 290 + 541 + 51 + + + + + + + 20 + 270 + 67 + 17 + + + + Message + + + + + + 450 + 240 + 85 + 27 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + + + 310 + 240 + 85 + 27 + + + + + L + + + + + M + + + + + H + + + + + Q + + + + + + + 370 + 240 + 67 + 17 + + + + size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 230 + 250 + 67 + 17 + + + + level: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 40 + 10 + 431 + 211 + + + + TextLabel + + + + + + + 0 + 0 + 565 + 23 + + + + + + + + diff --git a/QtQREnCode/mask.c b/QtQREnCode/mask.c index 4bf2371..d61bcbb 100644 --- a/QtQREnCode/mask.c +++ b/QtQREnCode/mask.c @@ -1,357 +1,357 @@ -/* - * qrencode - QR Code encoder - * - * Masking. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "qrencode.h" -#include "qrspec.h" -#include "mask.h" - -STATIC_IN_RELEASE int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level) -{ - unsigned int format; - unsigned char v; - int i; - int blacks = 0; - - format = QRspec_getFormatInfo(mask, level); - - for(i = 0; i < 8; i++) { - if(format & 1) { - blacks += 2; - v = 0x85; - } else { - v = 0x84; - } - frame[width * 8 + width - 1 - i] = v; - if(i < 6) { - frame[width * i + 8] = v; - } else { - frame[width * (i + 1) + 8] = v; - } - format= format >> 1; - } - for(i = 0; i < 7; i++) { - if(format & 1) { - blacks += 2; - v = 0x85; - } else { - v = 0x84; - } - frame[width * (width - 7 + i) + 8] = v; - if(i == 0) { - frame[width * 8 + 7] = v; - } else { - frame[width * 8 + 6 - i] = v; - } - format= format >> 1; - } - - return blacks; -} - -/** - * Demerit coefficients. - * See Section 8.8.2, pp.45, JIS X0510:2004. - */ -#define N1 (3) -#define N2 (3) -#define N3 (40) -#define N4 (10) - -#define MASKMAKER(__exp__) \ - int x, y;\ - int b = 0;\ -\ - for(y = 0; y < width; y++) {\ - for(x = 0; x < width; x++) {\ - if(*s & 0x80) {\ - *d = *s;\ - } else {\ - *d = *s ^ ((__exp__) == 0);\ - }\ - b += (int)(*d & 1);\ - s++; d++;\ - }\ - }\ - return b; - -static int Mask_mask0(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((x+y)&1) -} - -static int Mask_mask1(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(y&1) -} - -static int Mask_mask2(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(x%3) -} - -static int Mask_mask3(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((x+y)%3) -} - -static int Mask_mask4(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(((y/2)+(x/3))&1) -} - -static int Mask_mask5(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(((x*y)&1)+(x*y)%3) -} - -static int Mask_mask6(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((((x*y)&1)+(x*y)%3)&1) -} - -static int Mask_mask7(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((((x*y)%3)+((x+y)&1))&1) -} - -#define maskNum (8) -typedef int MaskMaker(int, const unsigned char *, unsigned char *); -static MaskMaker *maskMakers[maskNum] = { - Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3, - Mask_mask4, Mask_mask5, Mask_mask6, Mask_mask7 -}; - -#ifdef WITH_TESTS -unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask) -{ - unsigned char *masked; - - masked = (unsigned char *)malloc((size_t)(width * width)); - if(masked == NULL) return NULL; - - maskMakers[mask](width, frame, masked); - - return masked; -} -#endif - -unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level) -{ - unsigned char *masked; - - if(mask < 0 || mask >= maskNum) { - errno = EINVAL; - return NULL; - } - - masked = (unsigned char *)malloc((size_t)(width * width)); - if(masked == NULL) return NULL; - - maskMakers[mask](width, frame, masked); - Mask_writeFormatInformation(width, masked, mask, level); - - return masked; -} - - -//static int n1; -//static int n2; -//static int n3; -//static int n4; - -STATIC_IN_RELEASE int Mask_calcN1N3(int length, int *runLength) -{ - int i; - int demerit = 0; - int fact; - - for(i = 0; i < length; i++) { - if(runLength[i] >= 5) { - demerit += N1 + (runLength[i] - 5); - //n1 += N1 + (runLength[i] - 5); - } - if((i & 1)) { - if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) { - fact = runLength[i] / 3; - if(runLength[i-2] == fact && - runLength[i-1] == fact && - runLength[i+1] == fact && - runLength[i+2] == fact) { - if(i == 3 || runLength[i-3] >= 4 * fact) { - demerit += N3; - //n3 += N3; - } else if(i+4 >= length || runLength[i+3] >= 4 * fact) { - demerit += N3; - //n3 += N3; - } - } - } - } - } - - return demerit; -} - -STATIC_IN_RELEASE int Mask_calcN2(int width, unsigned char *frame) -{ - int x, y; - unsigned char *p; - unsigned char b22, w22; - int demerit = 0; - - p = frame + width + 1; - for(y = 1; y < width; y++) { - for(x = 1; x < width; x++) { - b22 = p[0] & p[-1] & p[-width] & p [-width-1]; - w22 = p[0] | p[-1] | p[-width] | p [-width-1]; - if((b22 | (w22 ^ 1))&1) { - demerit += N2; - } - p++; - } - p++; - } - - return demerit; -} - -STATIC_IN_RELEASE int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength) -{ - int head; - int i; - unsigned char prev; - - if(frame[0] & 1) { - runLength[0] = -1; - head = 1; - } else { - head = 0; - } - runLength[head] = 1; - prev = frame[0]; - - for(i = 1; i < width; i++) { - if((frame[i] ^ prev) & 1) { - head++; - runLength[head] = 1; - prev = frame[i]; - } else { - runLength[head]++; - } - } - - return head + 1; -} - -STATIC_IN_RELEASE int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength) -{ - int head; - int i; - unsigned char prev; - - if(frame[0] & 1) { - runLength[0] = -1; - head = 1; - } else { - head = 0; - } - runLength[head] = 1; - prev = frame[0]; - - for(i = 1; i < width; i++) { - if((frame[i * width] ^ prev) & 1) { - head++; - runLength[head] = 1; - prev = frame[i * width]; - } else { - runLength[head]++; - } - } - - return head + 1; -} - -STATIC_IN_RELEASE int Mask_evaluateSymbol(int width, unsigned char *frame) -{ - int x, y; - int demerit = 0; - int runLength[QRSPEC_WIDTH_MAX + 1]; - int length; - - demerit += Mask_calcN2(width, frame); - - for(y = 0; y < width; y++) { - length = Mask_calcRunLengthH(width, frame + y * width, runLength); - demerit += Mask_calcN1N3(length, runLength); - } - - for(x = 0; x < width; x++) { - length = Mask_calcRunLengthV(width, frame + x, runLength); - demerit += Mask_calcN1N3(length, runLength); - } - - return demerit; -} - -unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level) -{ - int i; - unsigned char *mask, *bestMask; - int minDemerit = INT_MAX; - int blacks; - int bratio; - int demerit; - int w2 = width * width; - - mask = (unsigned char *)malloc((size_t)w2); - if(mask == NULL) return NULL; - bestMask = (unsigned char *)malloc((size_t)w2); - if(bestMask == NULL) { - free(mask); - return NULL; - } - - for(i = 0; i < maskNum; i++) { -// n1 = n2 = n3 = n4 = 0; - demerit = 0; - blacks = maskMakers[i](width, frame, mask); - blacks += Mask_writeFormatInformation(width, mask, i, level); - bratio = (200 * blacks + w2) / w2 / 2; /* (int)(100*blacks/w2+0.5) */ - demerit = (abs(bratio - 50) / 5) * N4; -// n4 = demerit; - demerit += Mask_evaluateSymbol(width, mask); -// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit); - if(demerit < minDemerit) { - minDemerit = demerit; - memcpy(bestMask, mask, (size_t)w2); - } - } - free(mask); - return bestMask; -} +/* + * qrencode - QR Code encoder + * + * Masking. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "qrencode.h" +#include "qrspec.h" +#include "mask.h" + +STATIC_IN_RELEASE int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level) +{ + unsigned int format; + unsigned char v; + int i; + int blacks = 0; + + format = QRspec_getFormatInfo(mask, level); + + for(i = 0; i < 8; i++) { + if(format & 1) { + blacks += 2; + v = 0x85; + } else { + v = 0x84; + } + frame[width * 8 + width - 1 - i] = v; + if(i < 6) { + frame[width * i + 8] = v; + } else { + frame[width * (i + 1) + 8] = v; + } + format= format >> 1; + } + for(i = 0; i < 7; i++) { + if(format & 1) { + blacks += 2; + v = 0x85; + } else { + v = 0x84; + } + frame[width * (width - 7 + i) + 8] = v; + if(i == 0) { + frame[width * 8 + 7] = v; + } else { + frame[width * 8 + 6 - i] = v; + } + format= format >> 1; + } + + return blacks; +} + +/** + * Demerit coefficients. + * See Section 8.8.2, pp.45, JIS X0510:2004. + */ +#define N1 (3) +#define N2 (3) +#define N3 (40) +#define N4 (10) + +#define MASKMAKER(__exp__) \ + int x, y;\ + int b = 0;\ +\ + for(y = 0; y < width; y++) {\ + for(x = 0; x < width; x++) {\ + if(*s & 0x80) {\ + *d = *s;\ + } else {\ + *d = *s ^ ((__exp__) == 0);\ + }\ + b += (int)(*d & 1);\ + s++; d++;\ + }\ + }\ + return b; + +static int Mask_mask0(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((x+y)&1) +} + +static int Mask_mask1(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(y&1) +} + +static int Mask_mask2(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(x%3) +} + +static int Mask_mask3(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((x+y)%3) +} + +static int Mask_mask4(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(((y/2)+(x/3))&1) +} + +static int Mask_mask5(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(((x*y)&1)+(x*y)%3) +} + +static int Mask_mask6(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((((x*y)&1)+(x*y)%3)&1) +} + +static int Mask_mask7(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((((x*y)%3)+((x+y)&1))&1) +} + +#define maskNum (8) +typedef int MaskMaker(int, const unsigned char *, unsigned char *); +static MaskMaker *maskMakers[maskNum] = { + Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3, + Mask_mask4, Mask_mask5, Mask_mask6, Mask_mask7 +}; + +#ifdef WITH_TESTS +unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask) +{ + unsigned char *masked; + + masked = (unsigned char *)malloc((size_t)(width * width)); + if(masked == NULL) return NULL; + + maskMakers[mask](width, frame, masked); + + return masked; +} +#endif + +unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level) +{ + unsigned char *masked; + + if(mask < 0 || mask >= maskNum) { + errno = EINVAL; + return NULL; + } + + masked = (unsigned char *)malloc((size_t)(width * width)); + if(masked == NULL) return NULL; + + maskMakers[mask](width, frame, masked); + Mask_writeFormatInformation(width, masked, mask, level); + + return masked; +} + + +//static int n1; +//static int n2; +//static int n3; +//static int n4; + +STATIC_IN_RELEASE int Mask_calcN1N3(int length, int *runLength) +{ + int i; + int demerit = 0; + int fact; + + for(i = 0; i < length; i++) { + if(runLength[i] >= 5) { + demerit += N1 + (runLength[i] - 5); + //n1 += N1 + (runLength[i] - 5); + } + if((i & 1)) { + if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) { + fact = runLength[i] / 3; + if(runLength[i-2] == fact && + runLength[i-1] == fact && + runLength[i+1] == fact && + runLength[i+2] == fact) { + if(i == 3 || runLength[i-3] >= 4 * fact) { + demerit += N3; + //n3 += N3; + } else if(i+4 >= length || runLength[i+3] >= 4 * fact) { + demerit += N3; + //n3 += N3; + } + } + } + } + } + + return demerit; +} + +STATIC_IN_RELEASE int Mask_calcN2(int width, unsigned char *frame) +{ + int x, y; + unsigned char *p; + unsigned char b22, w22; + int demerit = 0; + + p = frame + width + 1; + for(y = 1; y < width; y++) { + for(x = 1; x < width; x++) { + b22 = p[0] & p[-1] & p[-width] & p [-width-1]; + w22 = p[0] | p[-1] | p[-width] | p [-width-1]; + if((b22 | (w22 ^ 1))&1) { + demerit += N2; + } + p++; + } + p++; + } + + return demerit; +} + +STATIC_IN_RELEASE int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength) +{ + int head; + int i; + unsigned char prev; + + if(frame[0] & 1) { + runLength[0] = -1; + head = 1; + } else { + head = 0; + } + runLength[head] = 1; + prev = frame[0]; + + for(i = 1; i < width; i++) { + if((frame[i] ^ prev) & 1) { + head++; + runLength[head] = 1; + prev = frame[i]; + } else { + runLength[head]++; + } + } + + return head + 1; +} + +STATIC_IN_RELEASE int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength) +{ + int head; + int i; + unsigned char prev; + + if(frame[0] & 1) { + runLength[0] = -1; + head = 1; + } else { + head = 0; + } + runLength[head] = 1; + prev = frame[0]; + + for(i = 1; i < width; i++) { + if((frame[i * width] ^ prev) & 1) { + head++; + runLength[head] = 1; + prev = frame[i * width]; + } else { + runLength[head]++; + } + } + + return head + 1; +} + +STATIC_IN_RELEASE int Mask_evaluateSymbol(int width, unsigned char *frame) +{ + int x, y; + int demerit = 0; + int runLength[QRSPEC_WIDTH_MAX + 1]; + int length; + + demerit += Mask_calcN2(width, frame); + + for(y = 0; y < width; y++) { + length = Mask_calcRunLengthH(width, frame + y * width, runLength); + demerit += Mask_calcN1N3(length, runLength); + } + + for(x = 0; x < width; x++) { + length = Mask_calcRunLengthV(width, frame + x, runLength); + demerit += Mask_calcN1N3(length, runLength); + } + + return demerit; +} + +unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level) +{ + int i; + unsigned char *mask, *bestMask; + int minDemerit = INT_MAX; + int blacks; + int bratio; + int demerit; + int w2 = width * width; + + mask = (unsigned char *)malloc((size_t)w2); + if(mask == NULL) return NULL; + bestMask = (unsigned char *)malloc((size_t)w2); + if(bestMask == NULL) { + free(mask); + return NULL; + } + + for(i = 0; i < maskNum; i++) { +// n1 = n2 = n3 = n4 = 0; + demerit = 0; + blacks = maskMakers[i](width, frame, mask); + blacks += Mask_writeFormatInformation(width, mask, i, level); + bratio = (200 * blacks + w2) / w2 / 2; /* (int)(100*blacks/w2+0.5) */ + demerit = (abs(bratio - 50) / 5) * N4; +// n4 = demerit; + demerit += Mask_evaluateSymbol(width, mask); +// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit); + if(demerit < minDemerit) { + minDemerit = demerit; + memcpy(bestMask, mask, (size_t)w2); + } + } + free(mask); + return bestMask; +} diff --git a/QtQREnCode/mask.cpp b/QtQREnCode/mask.cpp index 56a07d9..b07c137 100644 --- a/QtQREnCode/mask.cpp +++ b/QtQREnCode/mask.cpp @@ -1,257 +1,257 @@ -/* - * qrencode - QR Code encoder - * - * Masking. - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "qrencode.h" -#include "qrencode_inner.h" -#include "qrspec.h" -#include "mask.h" - -/** - * Demerit coefficients. - * See Section 8.8.2, pp.45, JIS X0510:2004. - */ -#define N1 (3) -#define N2 (3) -#define N3 (40) -#define N4 (10) - -#define MASKMAKER(__exp__) \ - int x, y;\ - unsigned int b = 0;\ -\ - for(y=0; y= 5) { - demerit += N1 + (runLength[i] - 5); - //n1 += N1 + (runLength[i] - 5); - } - if((i & 1)) { - if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) { - fact = runLength[i] / 3; - if(runLength[i-2] == fact && - runLength[i-1] == fact && - runLength[i+1] == fact && - runLength[i+2] == fact) { - if(runLength[i-3] < 0 || runLength[i-3] >= 4 * fact) { - demerit += N3; - //n3 += N3; - } else if(i+3 >= length || runLength[i+3] >= 4 * fact) { - demerit += N3; - //n3 += N3; - } - } - } - } - } - - return demerit; -} - -int Mask_evaluateSymbol(int width, unsigned char *frame) -{ - int x, y; - unsigned char *p; - unsigned char b22, w22; - unsigned int i; - int head; - int demerit = 0; - - p = frame; - i = 0; - for(y=0; y 0 && y > 0) { - b22 = p[0] & p[-1] & p[-width] & p [-width-1]; - w22 = p[0] | p[-1] | p[-width] | p [-width-1]; - if((b22 | (w22 ^ 1))&1) { - demerit += N2; - } - } - if(x == 0 && (p[0] & 1)) { - runLength[0] = -1; - head = 1; - runLength[head] = 1; - } else if(x > 0) { - if((p[0] ^ p[-1]) & 1) { - head++; - runLength[head] = 1; - } else { - runLength[head]++; - } - } - p++; - } - demerit += Mask_calcN1N3(head+1, runLength); - } - - i = 0; - for(x=0; x 0) { - if((p[0] ^ p[-width]) & 1) { - head++; - runLength[head] = 1; - } else { - runLength[head]++; - } - } - p+=width; - } - demerit += Mask_calcN1N3(head+1, runLength); - } - - return demerit; -} - -unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level) -{ - int i; - unsigned char *mask, *bestMask; - int minDemerit = INT_MAX; - int bestMaskNum = 0; - int blacks; - int demerit; - - bestMask = NULL; - - for(i=0; i<8; i++) { -// n1 = n2 = n3 = n4 = 0; - demerit = 0; - mask = (unsigned char *)malloc(width * width); - blacks = maskMakers[i](width, frame, mask); - blacks += QRcode_writeFormatInformation(width, mask, i, level); - blacks = 100 * blacks / (width * width); - demerit = (abs(blacks - 50) / 5) * N4; -// n4 = demerit; - if(demerit > minDemerit) { - free(mask); - continue; - } - demerit += Mask_evaluateSymbol(width, mask); -// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit); - if(demerit < minDemerit) { - minDemerit = demerit; - bestMaskNum = i; - if(bestMask != NULL) { - free(bestMask); - } - bestMask = mask; - } else { - free(mask); - } - } - - return bestMask; -} - +/* + * qrencode - QR Code encoder + * + * Masking. + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "qrencode.h" +#include "qrencode_inner.h" +#include "qrspec.h" +#include "mask.h" + +/** + * Demerit coefficients. + * See Section 8.8.2, pp.45, JIS X0510:2004. + */ +#define N1 (3) +#define N2 (3) +#define N3 (40) +#define N4 (10) + +#define MASKMAKER(__exp__) \ + int x, y;\ + unsigned int b = 0;\ +\ + for(y=0; y= 5) { + demerit += N1 + (runLength[i] - 5); + //n1 += N1 + (runLength[i] - 5); + } + if((i & 1)) { + if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) { + fact = runLength[i] / 3; + if(runLength[i-2] == fact && + runLength[i-1] == fact && + runLength[i+1] == fact && + runLength[i+2] == fact) { + if(runLength[i-3] < 0 || runLength[i-3] >= 4 * fact) { + demerit += N3; + //n3 += N3; + } else if(i+3 >= length || runLength[i+3] >= 4 * fact) { + demerit += N3; + //n3 += N3; + } + } + } + } + } + + return demerit; +} + +int Mask_evaluateSymbol(int width, unsigned char *frame) +{ + int x, y; + unsigned char *p; + unsigned char b22, w22; + unsigned int i; + int head; + int demerit = 0; + + p = frame; + i = 0; + for(y=0; y 0 && y > 0) { + b22 = p[0] & p[-1] & p[-width] & p [-width-1]; + w22 = p[0] | p[-1] | p[-width] | p [-width-1]; + if((b22 | (w22 ^ 1))&1) { + demerit += N2; + } + } + if(x == 0 && (p[0] & 1)) { + runLength[0] = -1; + head = 1; + runLength[head] = 1; + } else if(x > 0) { + if((p[0] ^ p[-1]) & 1) { + head++; + runLength[head] = 1; + } else { + runLength[head]++; + } + } + p++; + } + demerit += Mask_calcN1N3(head+1, runLength); + } + + i = 0; + for(x=0; x 0) { + if((p[0] ^ p[-width]) & 1) { + head++; + runLength[head] = 1; + } else { + runLength[head]++; + } + } + p+=width; + } + demerit += Mask_calcN1N3(head+1, runLength); + } + + return demerit; +} + +unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level) +{ + int i; + unsigned char *mask, *bestMask; + int minDemerit = INT_MAX; + int bestMaskNum = 0; + int blacks; + int demerit; + + bestMask = NULL; + + for(i=0; i<8; i++) { +// n1 = n2 = n3 = n4 = 0; + demerit = 0; + mask = (unsigned char *)malloc(width * width); + blacks = maskMakers[i](width, frame, mask); + blacks += QRcode_writeFormatInformation(width, mask, i, level); + blacks = 100 * blacks / (width * width); + demerit = (abs(blacks - 50) / 5) * N4; +// n4 = demerit; + if(demerit > minDemerit) { + free(mask); + continue; + } + demerit += Mask_evaluateSymbol(width, mask); +// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit); + if(demerit < minDemerit) { + minDemerit = demerit; + bestMaskNum = i; + if(bestMask != NULL) { + free(bestMask); + } + bestMask = mask; + } else { + free(mask); + } + } + + return bestMask; +} + diff --git a/QtQREnCode/mask.h b/QtQREnCode/mask.h index 169e64b..9a1275f 100644 --- a/QtQREnCode/mask.h +++ b/QtQREnCode/mask.h @@ -1,38 +1,38 @@ -/* - * qrencode - QR Code encoder - * - * Masking. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MASK_H -#define MASK_H - -extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level); -extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level); - -#ifdef WITH_TESTS -extern int Mask_calcN2(int width, unsigned char *frame); -extern int Mask_calcN1N3(int length, int *runLength); -extern int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength); -extern int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength); -extern int Mask_evaluateSymbol(int width, unsigned char *frame); -extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level); -extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask); -#endif - -#endif /* MASK_H */ +/* + * qrencode - QR Code encoder + * + * Masking. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MASK_H +#define MASK_H + +extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level); +extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level); + +#ifdef WITH_TESTS +extern int Mask_calcN2(int width, unsigned char *frame); +extern int Mask_calcN1N3(int length, int *runLength); +extern int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength); +extern int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength); +extern int Mask_evaluateSymbol(int width, unsigned char *frame); +extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level); +extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask); +#endif + +#endif /* MASK_H */ diff --git a/QtQREnCode/mmask.c b/QtQREnCode/mmask.c index 5f09a1e..8f8adb4 100644 --- a/QtQREnCode/mmask.c +++ b/QtQREnCode/mmask.c @@ -1,177 +1,177 @@ -/* - * qrencode - QR Code encoder - * - * Masking for Micro QR Code. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "qrencode.h" -#include "mqrspec.h" -#include "mmask.h" - -STATIC_IN_RELEASE void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level) -{ - unsigned int format; - unsigned char v; - int i; - - format = MQRspec_getFormatInfo(mask, version, level); - - for(i = 0; i < 8; i++) { - v = 0x84 | (format & 1); - frame[width * (i + 1) + 8] = v; - format = format >> 1; - } - for(i = 0; i < 7; i++) { - v = 0x84 | (format & 1); - frame[width * 8 + 7 - i] = v; - format = format >> 1; - } -} - -#define MASKMAKER(__exp__) \ - int x, y;\ -\ - for(y = 0; y < width; y++) {\ - for(x = 0; x < width; x++) {\ - if(*s & 0x80) {\ - *d = *s;\ - } else {\ - *d = *s ^ ((__exp__) == 0);\ - }\ - s++; d++;\ - }\ - } - -static void Mask_mask0(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(y&1) -} - -static void Mask_mask1(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER(((y/2)+(x/3))&1) -} - -static void Mask_mask2(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((((x*y)&1)+(x*y)%3)&1) -} - -static void Mask_mask3(int width, const unsigned char *s, unsigned char *d) -{ - MASKMAKER((((x+y)&1)+((x*y)%3))&1) -} - -#define maskNum (4) -typedef void MaskMaker(int, const unsigned char *, unsigned char *); -static MaskMaker *maskMakers[maskNum] = { - Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3 -}; - -#ifdef WITH_TESTS -unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask) -{ - unsigned char *masked; - - masked = (unsigned char *)malloc((size_t)(width * width)); - if(masked == NULL) return NULL; - - maskMakers[mask](width, frame, masked); - - return masked; -} -#endif - -unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level) -{ - unsigned char *masked; - int width; - - if(mask < 0 || mask >= maskNum) { - errno = EINVAL; - return NULL; - } - - width = MQRspec_getWidth(version); - masked = (unsigned char *)malloc((size_t)(width * width)); - if(masked == NULL) return NULL; - - maskMakers[mask](width, frame, masked); - MMask_writeFormatInformation(version, width, masked, mask, level); - - return masked; -} - -STATIC_IN_RELEASE int MMask_evaluateSymbol(int width, unsigned char *frame) -{ - int x, y; - unsigned char *p; - int sum1 = 0, sum2 = 0; - - p = frame + width * (width - 1); - for(x = 1; x < width; x++) { - sum1 += (p[x] & 1); - } - - p = frame + width * 2 - 1; - for(y = 1; y < width; y++) { - sum2 += (*p & 1); - p += width; - } - - return (sum1 <= sum2)?(sum1 * 16 + sum2):(sum2 * 16 + sum1); -} - -unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level) -{ - int i; - unsigned char *mask, *bestMask; - int maxScore = 0; - int score; - int width; - - width = MQRspec_getWidth(version); - - mask = (unsigned char *)malloc((size_t)(width * width)); - if(mask == NULL) return NULL; - bestMask = NULL; - - for(i = 0; i < maskNum; i++) { - score = 0; - maskMakers[i](width, frame, mask); - MMask_writeFormatInformation(version, width, mask, i, level); - score = MMask_evaluateSymbol(width, mask); - if(score > maxScore) { - maxScore = score; - free(bestMask); - bestMask = mask; - mask = (unsigned char *)malloc((size_t)(width * width)); - if(mask == NULL) break; - } - } - free(mask); - return bestMask; -} +/* + * qrencode - QR Code encoder + * + * Masking for Micro QR Code. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "qrencode.h" +#include "mqrspec.h" +#include "mmask.h" + +STATIC_IN_RELEASE void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level) +{ + unsigned int format; + unsigned char v; + int i; + + format = MQRspec_getFormatInfo(mask, version, level); + + for(i = 0; i < 8; i++) { + v = 0x84 | (format & 1); + frame[width * (i + 1) + 8] = v; + format = format >> 1; + } + for(i = 0; i < 7; i++) { + v = 0x84 | (format & 1); + frame[width * 8 + 7 - i] = v; + format = format >> 1; + } +} + +#define MASKMAKER(__exp__) \ + int x, y;\ +\ + for(y = 0; y < width; y++) {\ + for(x = 0; x < width; x++) {\ + if(*s & 0x80) {\ + *d = *s;\ + } else {\ + *d = *s ^ ((__exp__) == 0);\ + }\ + s++; d++;\ + }\ + } + +static void Mask_mask0(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(y&1) +} + +static void Mask_mask1(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER(((y/2)+(x/3))&1) +} + +static void Mask_mask2(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((((x*y)&1)+(x*y)%3)&1) +} + +static void Mask_mask3(int width, const unsigned char *s, unsigned char *d) +{ + MASKMAKER((((x+y)&1)+((x*y)%3))&1) +} + +#define maskNum (4) +typedef void MaskMaker(int, const unsigned char *, unsigned char *); +static MaskMaker *maskMakers[maskNum] = { + Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3 +}; + +#ifdef WITH_TESTS +unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask) +{ + unsigned char *masked; + + masked = (unsigned char *)malloc((size_t)(width * width)); + if(masked == NULL) return NULL; + + maskMakers[mask](width, frame, masked); + + return masked; +} +#endif + +unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level) +{ + unsigned char *masked; + int width; + + if(mask < 0 || mask >= maskNum) { + errno = EINVAL; + return NULL; + } + + width = MQRspec_getWidth(version); + masked = (unsigned char *)malloc((size_t)(width * width)); + if(masked == NULL) return NULL; + + maskMakers[mask](width, frame, masked); + MMask_writeFormatInformation(version, width, masked, mask, level); + + return masked; +} + +STATIC_IN_RELEASE int MMask_evaluateSymbol(int width, unsigned char *frame) +{ + int x, y; + unsigned char *p; + int sum1 = 0, sum2 = 0; + + p = frame + width * (width - 1); + for(x = 1; x < width; x++) { + sum1 += (p[x] & 1); + } + + p = frame + width * 2 - 1; + for(y = 1; y < width; y++) { + sum2 += (*p & 1); + p += width; + } + + return (sum1 <= sum2)?(sum1 * 16 + sum2):(sum2 * 16 + sum1); +} + +unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level) +{ + int i; + unsigned char *mask, *bestMask; + int maxScore = 0; + int score; + int width; + + width = MQRspec_getWidth(version); + + mask = (unsigned char *)malloc((size_t)(width * width)); + if(mask == NULL) return NULL; + bestMask = NULL; + + for(i = 0; i < maskNum; i++) { + score = 0; + maskMakers[i](width, frame, mask); + MMask_writeFormatInformation(version, width, mask, i, level); + score = MMask_evaluateSymbol(width, mask); + if(score > maxScore) { + maxScore = score; + free(bestMask); + bestMask = mask; + mask = (unsigned char *)malloc((size_t)(width * width)); + if(mask == NULL) break; + } + } + free(mask); + return bestMask; +} diff --git a/QtQREnCode/mmask.h b/QtQREnCode/mmask.h index 56a58cd..28ab7ee 100644 --- a/QtQREnCode/mmask.h +++ b/QtQREnCode/mmask.h @@ -1,34 +1,34 @@ -/* - * qrencode - QR Code encoder - * - * Masking for Micro QR Code. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MMASK_H -#define MMASK_H - -extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level); -extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level); - -#ifdef WITH_TESTS -extern int MMask_evaluateSymbol(int width, unsigned char *frame); -extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level); -extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask); -#endif - -#endif /* MMASK_H */ +/* + * qrencode - QR Code encoder + * + * Masking for Micro QR Code. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MMASK_H +#define MMASK_H + +extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level); +extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level); + +#ifdef WITH_TESTS +extern int MMask_evaluateSymbol(int width, unsigned char *frame); +extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level); +extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask); +#endif + +#endif /* MMASK_H */ diff --git a/QtQREnCode/mqrspec.c b/QtQREnCode/mqrspec.c index 87205fe..c2b17fc 100644 --- a/QtQREnCode/mqrspec.c +++ b/QtQREnCode/mqrspec.c @@ -1,232 +1,232 @@ -/* - * qrencode - QR Code encoder - * - * Micro QR Code specification in convenient format. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "mqrspec.h" - -/****************************************************************************** - * Version and capacity - *****************************************************************************/ - -typedef struct { - int width; ///< Edge length of the symbol - int ec[4]; ///< Number of ECC code (bytes) -} MQRspec_Capacity; - -/** - * Table of the capacity of symbols - * See Table 1 (pp.106) and Table 8 (pp.113) of Appendix 1, JIS X0510:2004. - */ -static const MQRspec_Capacity mqrspecCapacity[MQRSPEC_VERSION_MAX + 1] = { - { 0, {0, 0, 0, 0}}, - { 11, {2, 0, 0, 0}}, - { 13, {5, 6, 0, 0}}, - { 15, {6, 8, 0, 0}}, - { 17, {8, 10, 14, 0}} -}; - -int MQRspec_getDataLengthBit(int version, QRecLevel level) -{ - int w; - int ecc; - - w = mqrspecCapacity[version].width - 1; - ecc = mqrspecCapacity[version].ec[level]; - if(ecc == 0) return 0; - return w * w - 64 - ecc * 8; -} - -int MQRspec_getDataLength(int version, QRecLevel level) -{ - return (MQRspec_getDataLengthBit(version, level) + 4) / 8; -} - -int MQRspec_getECCLength(int version, QRecLevel level) -{ - return mqrspecCapacity[version].ec[level]; -} - -int MQRspec_getWidth(int version) -{ - return mqrspecCapacity[version].width; -} - -/****************************************************************************** - * Length indicator - *****************************************************************************/ - -/** - * See Table 3 (pp.107) of Appendix 1, JIS X0510:2004. - */ -static const int lengthTableBits[4][4] = { - { 3, 4, 5, 6}, - { 0, 3, 4, 5}, - { 0, 0, 4, 5}, - { 0, 0, 3, 4} -}; - -int MQRspec_lengthIndicator(QRencodeMode mode, int version) -{ - return lengthTableBits[mode][version - 1]; -} - -int MQRspec_maximumWords(QRencodeMode mode, int version) -{ - int bits; - int words; - - bits = lengthTableBits[mode][version - 1]; - words = (1 << bits) - 1; - if(mode == QR_MODE_KANJI) { - words *= 2; // the number of bytes is required - } - - return words; -} - -/****************************************************************************** - * Format information - *****************************************************************************/ - -/* See calcFormatInfo in tests/test_mqrspec.c */ -static const unsigned int formatInfo[4][8] = { - {0x4445, 0x55ae, 0x6793, 0x7678, 0x06de, 0x1735, 0x2508, 0x34e3}, - {0x4172, 0x5099, 0x62a4, 0x734f, 0x03e9, 0x1202, 0x203f, 0x31d4}, - {0x4e2b, 0x5fc0, 0x6dfd, 0x7c16, 0x0cb0, 0x1d5b, 0x2f66, 0x3e8d}, - {0x4b1c, 0x5af7, 0x68ca, 0x7921, 0x0987, 0x186c, 0x2a51, 0x3bba} -}; - -/* See Table 10 of Appendix 1. (pp.115) */ -static const int typeTable[MQRSPEC_VERSION_MAX + 1][3] = { - {-1, -1, -1}, - { 0, -1, -1}, - { 1, 2, -1}, - { 3, 4, -1}, - { 5, 6, 7} -}; - -unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level) -{ - int type; - - if(mask < 0 || mask > 3) return 0; - if(version <= 0 || version > MQRSPEC_VERSION_MAX) return 0; - if(level == QR_ECLEVEL_H) return 0; - type = typeTable[version][level]; - if(type < 0) return 0; - - return formatInfo[mask][type]; -} - -/****************************************************************************** - * Frame - *****************************************************************************/ - -/** - * Put a finder pattern. - * @param frame - * @param width - * @param ox,oy upper-left coordinate of the pattern - */ -static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) -{ - static const unsigned char finder[] = { - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - }; - int x, y; - const unsigned char *s; - - frame += oy * width + ox; - s = finder; - for(y = 0; y < 7; y++) { - for(x = 0; x < 7; x++) { - frame[x] = s[x]; - } - frame += width; - s += 7; - } -} - -static unsigned char *MQRspec_createFrame(int version) -{ - unsigned char *frame, *p, *q; - int width; - int x, y; - - width = mqrspecCapacity[version].width; - frame = (unsigned char *)malloc((size_t)(width * width)); - if(frame == NULL) return NULL; - - memset(frame, 0, (size_t)(width * width)); - /* Finder pattern */ - putFinderPattern(frame, width, 0, 0); - /* Separator */ - p = frame; - for(y = 0; y < 7; y++) { - p[7] = 0xc0; - p += width; - } - memset(frame + width * 7, 0xc0, 8); - /* Mask format information area */ - memset(frame + width * 8 + 1, 0x84, 8); - p = frame + width + 8; - for(y = 0; y < 7; y++) { - *p = 0x84; - p += width; - } - /* Timing pattern */ - p = frame + 8; - q = frame + width * 8; - for(x = 1; x < width-7; x++) { - *p = 0x90 | (x & 1); - *q = 0x90 | (x & 1); - p++; - q += width; - } - - return frame; -} - -unsigned char *MQRspec_newFrame(int version) -{ - if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL; - - return MQRspec_createFrame(version); -} +/* + * qrencode - QR Code encoder + * + * Micro QR Code specification in convenient format. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "mqrspec.h" + +/****************************************************************************** + * Version and capacity + *****************************************************************************/ + +typedef struct { + int width; ///< Edge length of the symbol + int ec[4]; ///< Number of ECC code (bytes) +} MQRspec_Capacity; + +/** + * Table of the capacity of symbols + * See Table 1 (pp.106) and Table 8 (pp.113) of Appendix 1, JIS X0510:2004. + */ +static const MQRspec_Capacity mqrspecCapacity[MQRSPEC_VERSION_MAX + 1] = { + { 0, {0, 0, 0, 0}}, + { 11, {2, 0, 0, 0}}, + { 13, {5, 6, 0, 0}}, + { 15, {6, 8, 0, 0}}, + { 17, {8, 10, 14, 0}} +}; + +int MQRspec_getDataLengthBit(int version, QRecLevel level) +{ + int w; + int ecc; + + w = mqrspecCapacity[version].width - 1; + ecc = mqrspecCapacity[version].ec[level]; + if(ecc == 0) return 0; + return w * w - 64 - ecc * 8; +} + +int MQRspec_getDataLength(int version, QRecLevel level) +{ + return (MQRspec_getDataLengthBit(version, level) + 4) / 8; +} + +int MQRspec_getECCLength(int version, QRecLevel level) +{ + return mqrspecCapacity[version].ec[level]; +} + +int MQRspec_getWidth(int version) +{ + return mqrspecCapacity[version].width; +} + +/****************************************************************************** + * Length indicator + *****************************************************************************/ + +/** + * See Table 3 (pp.107) of Appendix 1, JIS X0510:2004. + */ +static const int lengthTableBits[4][4] = { + { 3, 4, 5, 6}, + { 0, 3, 4, 5}, + { 0, 0, 4, 5}, + { 0, 0, 3, 4} +}; + +int MQRspec_lengthIndicator(QRencodeMode mode, int version) +{ + return lengthTableBits[mode][version - 1]; +} + +int MQRspec_maximumWords(QRencodeMode mode, int version) +{ + int bits; + int words; + + bits = lengthTableBits[mode][version - 1]; + words = (1 << bits) - 1; + if(mode == QR_MODE_KANJI) { + words *= 2; // the number of bytes is required + } + + return words; +} + +/****************************************************************************** + * Format information + *****************************************************************************/ + +/* See calcFormatInfo in tests/test_mqrspec.c */ +static const unsigned int formatInfo[4][8] = { + {0x4445, 0x55ae, 0x6793, 0x7678, 0x06de, 0x1735, 0x2508, 0x34e3}, + {0x4172, 0x5099, 0x62a4, 0x734f, 0x03e9, 0x1202, 0x203f, 0x31d4}, + {0x4e2b, 0x5fc0, 0x6dfd, 0x7c16, 0x0cb0, 0x1d5b, 0x2f66, 0x3e8d}, + {0x4b1c, 0x5af7, 0x68ca, 0x7921, 0x0987, 0x186c, 0x2a51, 0x3bba} +}; + +/* See Table 10 of Appendix 1. (pp.115) */ +static const int typeTable[MQRSPEC_VERSION_MAX + 1][3] = { + {-1, -1, -1}, + { 0, -1, -1}, + { 1, 2, -1}, + { 3, 4, -1}, + { 5, 6, 7} +}; + +unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level) +{ + int type; + + if(mask < 0 || mask > 3) return 0; + if(version <= 0 || version > MQRSPEC_VERSION_MAX) return 0; + if(level == QR_ECLEVEL_H) return 0; + type = typeTable[version][level]; + if(type < 0) return 0; + + return formatInfo[mask][type]; +} + +/****************************************************************************** + * Frame + *****************************************************************************/ + +/** + * Put a finder pattern. + * @param frame + * @param width + * @param ox,oy upper-left coordinate of the pattern + */ +static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) +{ + static const unsigned char finder[] = { + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + }; + int x, y; + const unsigned char *s; + + frame += oy * width + ox; + s = finder; + for(y = 0; y < 7; y++) { + for(x = 0; x < 7; x++) { + frame[x] = s[x]; + } + frame += width; + s += 7; + } +} + +static unsigned char *MQRspec_createFrame(int version) +{ + unsigned char *frame, *p, *q; + int width; + int x, y; + + width = mqrspecCapacity[version].width; + frame = (unsigned char *)malloc((size_t)(width * width)); + if(frame == NULL) return NULL; + + memset(frame, 0, (size_t)(width * width)); + /* Finder pattern */ + putFinderPattern(frame, width, 0, 0); + /* Separator */ + p = frame; + for(y = 0; y < 7; y++) { + p[7] = 0xc0; + p += width; + } + memset(frame + width * 7, 0xc0, 8); + /* Mask format information area */ + memset(frame + width * 8 + 1, 0x84, 8); + p = frame + width + 8; + for(y = 0; y < 7; y++) { + *p = 0x84; + p += width; + } + /* Timing pattern */ + p = frame + 8; + q = frame + width * 8; + for(x = 1; x < width-7; x++) { + *p = 0x90 | (x & 1); + *q = 0x90 | (x & 1); + p++; + q += width; + } + + return frame; +} + +unsigned char *MQRspec_newFrame(int version) +{ + if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL; + + return MQRspec_createFrame(version); +} diff --git a/QtQREnCode/mqrspec.h b/QtQREnCode/mqrspec.h index 0eaa490..aa42cd2 100644 --- a/QtQREnCode/mqrspec.h +++ b/QtQREnCode/mqrspec.h @@ -1,150 +1,150 @@ -/* - * qrencode - QR Code encoder - * - * Micro QR Code specification in convenient format. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MQRSPEC_H -#define MQRSPEC_H - -#include "qrencode.h" - -/****************************************************************************** - * Version and capacity - *****************************************************************************/ - -/** - * Maximum width of a symbol - */ -#define MQRSPEC_WIDTH_MAX 17 - -/** - * Return maximum data code length (bits) for the version. - * @param version version of the symbol - * @param level error correction level - * @return maximum size (bits) - */ -extern int MQRspec_getDataLengthBit(int version, QRecLevel level); - -/** - * Return maximum data code length (bytes) for the version. - * @param version version of the symbol - * @param level error correction level - * @return maximum size (bytes) - */ -extern int MQRspec_getDataLength(int version, QRecLevel level); - -/** - * Return maximum error correction code length (bytes) for the version. - * @param version version of the symbol - * @param level error correction level - * @return ECC size (bytes) - */ -extern int MQRspec_getECCLength(int version, QRecLevel level); - -/** - * Return a version number that satisfies the input code length. - * @param size input code length (byte) - * @param level error correction level - * @return version number - */ -extern int MQRspec_getMinimumVersion(int size, QRecLevel level); - -/** - * Return the width of the symbol for the version. - * @param version version of the symbol - * @return width - */ -extern int MQRspec_getWidth(int version); - -/** - * Return the numer of remainder bits. - * @param version version of the symbol - * @return number of remainder bits - */ -extern int MQRspec_getRemainder(int version); - -/****************************************************************************** - * Length indicator - *****************************************************************************/ - -/** - * Return the size of length indicator for the mode and version. - * @param mode encode mode - * @param version vesion of the symbol - * @return the size of the appropriate length indicator (bits). - */ -extern int MQRspec_lengthIndicator(QRencodeMode mode, int version); - -/** - * Return the maximum length for the mode and version. - * @param mode encode mode - * @param version vesion of the symbol - * @return the maximum length (bytes) - */ -extern int MQRspec_maximumWords(QRencodeMode mode, int version); - -/****************************************************************************** - * Version information pattern - *****************************************************************************/ - -/** - * Return BCH encoded version information pattern that is used for the symbol - * of version 7 or greater. Use lower 18 bits. - * @param version vesion of the symbol - * @return BCH encoded version information pattern - */ -extern unsigned int MQRspec_getVersionPattern(int version); - -/****************************************************************************** - * Format information - *****************************************************************************/ - -/** - * Return BCH encoded format information pattern. - * @param mask mask number - * @param version version of the symbol - * @param level error correction level - * @return BCH encoded format information pattern - */ -extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level); - -/****************************************************************************** - * Frame - *****************************************************************************/ - -/** - * Return a copy of initialized frame. - * @param version version of the symbol - * @return Array of unsigned char. You can free it by free(). - */ -extern unsigned char *MQRspec_newFrame(int version); - -/****************************************************************************** - * Mode indicator - *****************************************************************************/ - -/** - * Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107. - */ -#define MQRSPEC_MODEID_NUM 0 -#define MQRSPEC_MODEID_AN 1 -#define MQRSPEC_MODEID_8 2 -#define MQRSPEC_MODEID_KANJI 3 - -#endif /* MQRSPEC_H */ +/* + * qrencode - QR Code encoder + * + * Micro QR Code specification in convenient format. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MQRSPEC_H +#define MQRSPEC_H + +#include "qrencode.h" + +/****************************************************************************** + * Version and capacity + *****************************************************************************/ + +/** + * Maximum width of a symbol + */ +#define MQRSPEC_WIDTH_MAX 17 + +/** + * Return maximum data code length (bits) for the version. + * @param version version of the symbol + * @param level error correction level + * @return maximum size (bits) + */ +extern int MQRspec_getDataLengthBit(int version, QRecLevel level); + +/** + * Return maximum data code length (bytes) for the version. + * @param version version of the symbol + * @param level error correction level + * @return maximum size (bytes) + */ +extern int MQRspec_getDataLength(int version, QRecLevel level); + +/** + * Return maximum error correction code length (bytes) for the version. + * @param version version of the symbol + * @param level error correction level + * @return ECC size (bytes) + */ +extern int MQRspec_getECCLength(int version, QRecLevel level); + +/** + * Return a version number that satisfies the input code length. + * @param size input code length (byte) + * @param level error correction level + * @return version number + */ +extern int MQRspec_getMinimumVersion(int size, QRecLevel level); + +/** + * Return the width of the symbol for the version. + * @param version version of the symbol + * @return width + */ +extern int MQRspec_getWidth(int version); + +/** + * Return the numer of remainder bits. + * @param version version of the symbol + * @return number of remainder bits + */ +extern int MQRspec_getRemainder(int version); + +/****************************************************************************** + * Length indicator + *****************************************************************************/ + +/** + * Return the size of length indicator for the mode and version. + * @param mode encode mode + * @param version vesion of the symbol + * @return the size of the appropriate length indicator (bits). + */ +extern int MQRspec_lengthIndicator(QRencodeMode mode, int version); + +/** + * Return the maximum length for the mode and version. + * @param mode encode mode + * @param version vesion of the symbol + * @return the maximum length (bytes) + */ +extern int MQRspec_maximumWords(QRencodeMode mode, int version); + +/****************************************************************************** + * Version information pattern + *****************************************************************************/ + +/** + * Return BCH encoded version information pattern that is used for the symbol + * of version 7 or greater. Use lower 18 bits. + * @param version vesion of the symbol + * @return BCH encoded version information pattern + */ +extern unsigned int MQRspec_getVersionPattern(int version); + +/****************************************************************************** + * Format information + *****************************************************************************/ + +/** + * Return BCH encoded format information pattern. + * @param mask mask number + * @param version version of the symbol + * @param level error correction level + * @return BCH encoded format information pattern + */ +extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level); + +/****************************************************************************** + * Frame + *****************************************************************************/ + +/** + * Return a copy of initialized frame. + * @param version version of the symbol + * @return Array of unsigned char. You can free it by free(). + */ +extern unsigned char *MQRspec_newFrame(int version); + +/****************************************************************************** + * Mode indicator + *****************************************************************************/ + +/** + * Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107. + */ +#define MQRSPEC_MODEID_NUM 0 +#define MQRSPEC_MODEID_AN 1 +#define MQRSPEC_MODEID_8 2 +#define MQRSPEC_MODEID_KANJI 3 + +#endif /* MQRSPEC_H */ diff --git a/QtQREnCode/qrenc.cpp b/QtQREnCode/qrenc.cpp index 6e17d2b..a0105a1 100644 --- a/QtQREnCode/qrenc.cpp +++ b/QtQREnCode/qrenc.cpp @@ -1,216 +1,216 @@ - -#include -#include - -#include -#include -#include -#include -#include "mainwindow.h" -#include -#include "ui_mainwindow.h" - -char *intext = " "; -static int casesensitive = 0; -static int eightbit = 0; -static int kanji = 0; -static int version = 0; -static int Size = 3; -static int margin = 4; -static QRecLevel level = QR_ECLEVEL_L; - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); - ui->textEdit->setText(tr("1234567893233695")); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -enum { - O_HELP, - O_OUTPUT, - O_SIZE, - O_VERSION, - O_LEVEL, - O_MARGIN, - O_KANJI, - O_CASE, - O_8BIT, -}; - -static const struct option options[] = { - {"h", no_argument , NULL, O_HELP}, - {"o", required_argument, NULL, O_OUTPUT}, - {"l", required_argument, NULL, O_LEVEL}, - {"s", required_argument, NULL, O_SIZE}, - {"v", required_argument, NULL, O_VERSION}, - {"m", required_argument, NULL, O_MARGIN}, - {"k", no_argument , NULL, O_KANJI}, - {"c", no_argument , NULL, O_CASE}, - {"8", no_argument , NULL, O_8BIT}, - {NULL, 0, NULL, 0} -}; - -static void usage(void) -{ - qDebug()<<( -"qrencode version %s\n\n" -"Usage: qrencode [OPTION]... [STRING]\n" -"Encode input data in a QR Code and save as a PNG image.\n\n" -" -h display this message.\n" -" -o FILENAME write PNG image to FILENAME. If '-' is specified, the result\n" -" will be output to standard output.\n" -" -s NUMBER specify the size of dot (pixel). (default=3)\n" -" -l {LMQH} specify error collectin level from L (lowest) to H (highest).\n" -" (default=L)\n" -" -v NUMBER specify the version of the symbol. (default=auto)\n" -" -m NUMBER specify the width of margin. (default=4)\n" -" -k assume that the input text contains kanji (shift-jis).\n" -" -c encode alphabet characters in 8-bit mode. If your application\n" -" is case-sensitive, choose this.\n" -" -8 encode entire data in 8-bit mode. -c and -k will be ignored.\n" -" [STRING] input data. If it is not specified, data will be taken from\n" -" standard input.\n" - ); -} - -#define MAX_DATA_SIZE 7090 /* from the specification */ -static char *readStdin(void) -{ - char *buffer; - int ret; - - buffer = (char *)malloc(MAX_DATA_SIZE); - ret = fread(buffer, 1, MAX_DATA_SIZE, stdin); - if(ret == 0) { - fprintf(stderr, "No input data.\n"); - exit(1); - } - if(!feof(stdin)) { - fprintf(stderr, "Input data is too large.\n"); - exit(1); - } - - buffer[ret] = '\0'; - - return buffer; -} - -static QRcode *encode(const char *intext) -{ - QRencodeMode hint; - QRcode *code; - - if(kanji) { - hint = QR_MODE_KANJI; - } else { - hint = QR_MODE_8; - } - - if(eightbit) { - code = QRcode_encodeString8bit(intext, version, level); - } else { - code = QRcode_encodeString(intext, version, level, hint, casesensitive); - } - - return code; -} - - static void qrencode(const char *intext, const char *outfile) -{ - FILE *fp; - QRcode *qrcode; - //png_structp png_ptr; - //png_infop info_ptr; - unsigned char *row, *p, *q; - int x, y, xx, yy, bit; - int realwidth; - - qrcode = encode(intext); - if(qrcode == NULL) { - fprintf(stderr, "Failed to encode the input data.\n"); - exit(1); - } - - realwidth = (qrcode->width + margin * 2) * Size; - - row = (unsigned char *)malloc(realwidth); - - // top margin - memset(row, 0x0, realwidth ); - - qDebug()<<"1: "<< qrcode->width<width + margin * 2) * Size; - QImage QRImage(realwidth,qrcode->width*Size,QImage::Format_ARGB32 ); - QImage *img; - img = &QRImage; - img->fill(0x00ffffff); - - /* data */ - p = qrcode->data; - int ypos=0;//margin * Size; - int xpos=0; - for(y=0; ywidth; y++) { - bit = 7; - bit = 7 - (margin * Size % 8); - xpos=margin * Size; - for(x=0; xwidth; x++) { - for(xx=0; xxsetPixel(xpos,ypos+yy,0xff000000); - } - } - xpos++; - - } - p++; - bit--; - if(bit < 0) { - //q++; - bit = 7; - } - } - ypos+=Size; - } - img->save("Myqr.bmp"); - - free(row); - QRcode_free(qrcode); -} - - - void MainWindow::on_pushButton_clicked() - { - QString in; - //usage(); - in = ui->textEdit->toPlainText(); - //intext = in.toLatin1().data(); - intext = (char *)malloc(in.length()*2); - memset(intext,0,sizeof(intext)); - //intext =in.unicode(); - //memcpy(&intext[0], in.unicode (),2*in.length()); - memcpy(intext,in.toLocal8Bit().data(),2*in.length()); - - qDebug()<comboBox_size->currentIndex()+3; - qrencode(intext,outfile); - QImage img("Myqr.bmp",0); - ui->labQRImage->setPixmap( QPixmap::fromImage(img,Qt::AutoColor)); - } - -int main(int argc, char **argv) -{ - - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} + +#include +#include + +#include +#include +#include +#include +#include "mainwindow.h" +#include +#include "ui_mainwindow.h" + +char *intext = " "; +static int casesensitive = 0; +static int eightbit = 0; +static int kanji = 0; +static int version = 0; +static int Size = 3; +static int margin = 4; +static QRecLevel level = QR_ECLEVEL_L; + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + ui->textEdit->setText(tr("1234567893233695")); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +enum { + O_HELP, + O_OUTPUT, + O_SIZE, + O_VERSION, + O_LEVEL, + O_MARGIN, + O_KANJI, + O_CASE, + O_8BIT, +}; + +static const struct option options[] = { + {"h", no_argument , NULL, O_HELP}, + {"o", required_argument, NULL, O_OUTPUT}, + {"l", required_argument, NULL, O_LEVEL}, + {"s", required_argument, NULL, O_SIZE}, + {"v", required_argument, NULL, O_VERSION}, + {"m", required_argument, NULL, O_MARGIN}, + {"k", no_argument , NULL, O_KANJI}, + {"c", no_argument , NULL, O_CASE}, + {"8", no_argument , NULL, O_8BIT}, + {NULL, 0, NULL, 0} +}; + +static void usage(void) +{ + qDebug()<<( +"qrencode version %s\n\n" +"Usage: qrencode [OPTION]... [STRING]\n" +"Encode input data in a QR Code and save as a PNG image.\n\n" +" -h display this message.\n" +" -o FILENAME write PNG image to FILENAME. If '-' is specified, the result\n" +" will be output to standard output.\n" +" -s NUMBER specify the size of dot (pixel). (default=3)\n" +" -l {LMQH} specify error collectin level from L (lowest) to H (highest).\n" +" (default=L)\n" +" -v NUMBER specify the version of the symbol. (default=auto)\n" +" -m NUMBER specify the width of margin. (default=4)\n" +" -k assume that the input text contains kanji (shift-jis).\n" +" -c encode alphabet characters in 8-bit mode. If your application\n" +" is case-sensitive, choose this.\n" +" -8 encode entire data in 8-bit mode. -c and -k will be ignored.\n" +" [STRING] input data. If it is not specified, data will be taken from\n" +" standard input.\n" + ); +} + +#define MAX_DATA_SIZE 7090 /* from the specification */ +static char *readStdin(void) +{ + char *buffer; + int ret; + + buffer = (char *)malloc(MAX_DATA_SIZE); + ret = fread(buffer, 1, MAX_DATA_SIZE, stdin); + if(ret == 0) { + fprintf(stderr, "No input data.\n"); + exit(1); + } + if(!feof(stdin)) { + fprintf(stderr, "Input data is too large.\n"); + exit(1); + } + + buffer[ret] = '\0'; + + return buffer; +} + +static QRcode *encode(const char *intext) +{ + QRencodeMode hint; + QRcode *code; + + if(kanji) { + hint = QR_MODE_KANJI; + } else { + hint = QR_MODE_8; + } + + if(eightbit) { + code = QRcode_encodeString8bit(intext, version, level); + } else { + code = QRcode_encodeString(intext, version, level, hint, casesensitive); + } + + return code; +} + + static void qrencode(const char *intext, const char *outfile) +{ + FILE *fp; + QRcode *qrcode; + //png_structp png_ptr; + //png_infop info_ptr; + unsigned char *row, *p, *q; + int x, y, xx, yy, bit; + int realwidth; + + qrcode = encode(intext); + if(qrcode == NULL) { + fprintf(stderr, "Failed to encode the input data.\n"); + exit(1); + } + + realwidth = (qrcode->width + margin * 2) * Size; + + row = (unsigned char *)malloc(realwidth); + + // top margin + memset(row, 0x0, realwidth ); + + qDebug()<<"1: "<< qrcode->width<width + margin * 2) * Size; + QImage QRImage(realwidth,qrcode->width*Size,QImage::Format_ARGB32 ); + QImage *img; + img = &QRImage; + img->fill(0x00ffffff); + + /* data */ + p = qrcode->data; + int ypos=0;//margin * Size; + int xpos=0; + for(y=0; ywidth; y++) { + bit = 7; + bit = 7 - (margin * Size % 8); + xpos=margin * Size; + for(x=0; xwidth; x++) { + for(xx=0; xxsetPixel(xpos,ypos+yy,0xff000000); + } + } + xpos++; + + } + p++; + bit--; + if(bit < 0) { + //q++; + bit = 7; + } + } + ypos+=Size; + } + img->save("Myqr.bmp"); + + free(row); + QRcode_free(qrcode); +} + + + void MainWindow::on_pushButton_clicked() + { + QString in; + //usage(); + in = ui->textEdit->toPlainText(); + //intext = in.toLatin1().data(); + intext = (char *)malloc(in.length()*2); + memset(intext,0,sizeof(intext)); + //intext =in.unicode(); + //memcpy(&intext[0], in.unicode (),2*in.length()); + memcpy(intext,in.toLocal8Bit().data(),2*in.length()); + + qDebug()<comboBox_size->currentIndex()+3; + qrencode(intext,outfile); + QImage img("Myqr.bmp",0); + ui->labQRImage->setPixmap( QPixmap::fromImage(img,Qt::AutoColor)); + } + +int main(int argc, char **argv) +{ + + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/QtQREnCode/qrencode.c b/QtQREnCode/qrencode.c index 06e03c3..947c389 100644 --- a/QtQREnCode/qrencode.c +++ b/QtQREnCode/qrencode.c @@ -1,924 +1,924 @@ -/* - * qrencode - QR Code encoder - * - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "qrencode.h" -#include "qrspec.h" -#include "mqrspec.h" -#include "bitstream.h" -#include "qrinput.h" -#include "rsecc.h" -#include "split.h" -#include "mask.h" -#include "mmask.h" - -/****************************************************************************** - * Raw code - *****************************************************************************/ - -typedef struct { - int dataLength; - int eccLength; - unsigned char *data; - unsigned char *ecc; -} RSblock; - -typedef struct { - int version; - int dataLength; - int eccLength; - unsigned char *datacode; - unsigned char *ecccode; - int b1; - int blocks; - RSblock *rsblock; - int count; -} QRRawCode; - -static void RSblock_initBlock(RSblock *block, int dl, unsigned char *data, int el, unsigned char *ecc) -{ - block->dataLength = dl; - block->data = data; - block->eccLength = el; - block->ecc = ecc; - - RSECC_encode((size_t)dl, (size_t)el, data, ecc); -} - -static int RSblock_init(RSblock *blocks, int spec[5], unsigned char *data, unsigned char *ecc) -{ - int i; - RSblock *block; - unsigned char *dp, *ep; - int el, dl; - - dl = QRspec_rsDataCodes1(spec); - el = QRspec_rsEccCodes1(spec); - - block = blocks; - dp = data; - ep = ecc; - for(i = 0; i < QRspec_rsBlockNum1(spec); i++) { - RSblock_initBlock(block, dl, dp, el, ep); - dp += dl; - ep += el; - block++; - } - - if(QRspec_rsBlockNum2(spec) == 0) return 0; - - dl = QRspec_rsDataCodes2(spec); - el = QRspec_rsEccCodes2(spec); - for(i = 0; i < QRspec_rsBlockNum2(spec); i++) { - RSblock_initBlock(block, dl, dp, el, ep); - dp += dl; - ep += el; - block++; - } - - return 0; -} - -STATIC_IN_RELEASE void QRraw_free(QRRawCode *raw); -STATIC_IN_RELEASE QRRawCode *QRraw_new(QRinput *input) -{ - QRRawCode *raw; - int spec[5], ret; - - raw = (QRRawCode *)malloc(sizeof(QRRawCode)); - if(raw == NULL) return NULL; - - raw->datacode = QRinput_getByteStream(input); - if(raw->datacode == NULL) { - free(raw); - return NULL; - } - - QRspec_getEccSpec(input->version, input->level, spec); - - raw->version = input->version; - raw->b1 = QRspec_rsBlockNum1(spec); - raw->dataLength = QRspec_rsDataLength(spec); - raw->eccLength = QRspec_rsEccLength(spec); - raw->ecccode = (unsigned char *)malloc((size_t)raw->eccLength); - if(raw->ecccode == NULL) { - free(raw->datacode); - free(raw); - return NULL; - } - - raw->blocks = QRspec_rsBlockNum(spec); - raw->rsblock = (RSblock *)calloc((size_t)(raw->blocks), sizeof(RSblock)); - if(raw->rsblock == NULL) { - QRraw_free(raw); - return NULL; - } - ret = RSblock_init(raw->rsblock, spec, raw->datacode, raw->ecccode); - if(ret < 0) { - QRraw_free(raw); - return NULL; - } - - raw->count = 0; - - return raw; -} - -/** - * Return a code (byte). - * This function can be called iteratively. - * @param raw raw code. - * @return code - */ -STATIC_IN_RELEASE unsigned char QRraw_getCode(QRRawCode *raw) -{ - int col, row; - unsigned char ret; - - if(raw->count < raw->dataLength) { - row = raw->count % raw->blocks; - col = raw->count / raw->blocks; - if(col >= raw->rsblock[0].dataLength) { - row += raw->b1; - } - ret = raw->rsblock[row].data[col]; - } else if(raw->count < raw->dataLength + raw->eccLength) { - row = (raw->count - raw->dataLength) % raw->blocks; - col = (raw->count - raw->dataLength) / raw->blocks; - ret = raw->rsblock[row].ecc[col]; - } else { - return 0; - } - raw->count++; - return ret; -} - -STATIC_IN_RELEASE void QRraw_free(QRRawCode *raw) -{ - if(raw != NULL) { - free(raw->datacode); - free(raw->ecccode); - free(raw->rsblock); - free(raw); - } -} - -/****************************************************************************** - * Raw code for Micro QR Code - *****************************************************************************/ - -typedef struct { - int version; - int dataLength; - int eccLength; - unsigned char *datacode; - unsigned char *ecccode; - RSblock *rsblock; - int oddbits; - int count; -} MQRRawCode; - -STATIC_IN_RELEASE void MQRraw_free(MQRRawCode *raw); -STATIC_IN_RELEASE MQRRawCode *MQRraw_new(QRinput *input) -{ - MQRRawCode *raw; - - raw = (MQRRawCode *)malloc(sizeof(MQRRawCode)); - if(raw == NULL) return NULL; - - raw->version = input->version; - raw->dataLength = MQRspec_getDataLength(input->version, input->level); - raw->eccLength = MQRspec_getECCLength(input->version, input->level); - raw->oddbits = raw->dataLength * 8 - MQRspec_getDataLengthBit(input->version, input->level); - raw->datacode = QRinput_getByteStream(input); - if(raw->datacode == NULL) { - free(raw); - return NULL; - } - raw->ecccode = (unsigned char *)malloc((size_t)raw->eccLength); - if(raw->ecccode == NULL) { - free(raw->datacode); - free(raw); - return NULL; - } - - raw->rsblock = (RSblock *)calloc(1, sizeof(RSblock)); - if(raw->rsblock == NULL) { - MQRraw_free(raw); - return NULL; - } - - RSblock_initBlock(raw->rsblock, raw->dataLength, raw->datacode, raw->eccLength, raw->ecccode); - - raw->count = 0; - - return raw; -} - -/** - * Return a code (byte). - * This function can be called iteratively. - * @param raw raw code. - * @return code - */ -STATIC_IN_RELEASE unsigned char MQRraw_getCode(MQRRawCode *raw) -{ - unsigned char ret; - - if(raw->count < raw->dataLength) { - ret = raw->datacode[raw->count]; - } else if(raw->count < raw->dataLength + raw->eccLength) { - ret = raw->ecccode[raw->count - raw->dataLength]; - } else { - return 0; - } - raw->count++; - return ret; -} - -STATIC_IN_RELEASE void MQRraw_free(MQRRawCode *raw) -{ - if(raw != NULL) { - free(raw->datacode); - free(raw->ecccode); - free(raw->rsblock); - free(raw); - } -} - - -/****************************************************************************** - * Frame filling - *****************************************************************************/ - -typedef struct { - int width; - unsigned char *frame; - int x, y; - int dir; - int bit; - int mqr; -} FrameFiller; - -static void FrameFiller_set(FrameFiller *filler, int width, unsigned char *frame, int mqr) -{ - filler->width = width; - filler->frame = frame; - filler->x = width - 1; - filler->y = width - 1; - filler->dir = -1; - filler->bit = -1; - filler->mqr = mqr; -} - -static unsigned char *FrameFiller_next(FrameFiller *filler) -{ - unsigned char *p; - int x, y, w; - - if(filler->bit == -1) { - filler->bit = 0; - return filler->frame + filler->y * filler->width + filler->x; - } - - x = filler->x; - y = filler->y; - p = filler->frame; - w = filler->width; - - if(filler->bit == 0) { - x--; - filler->bit++; - } else { - x++; - y += filler->dir; - filler->bit--; - } - - if(filler->dir < 0) { - if(y < 0) { - y = 0; - x -= 2; - filler->dir = 1; - if(!filler->mqr && x == 6) { - x--; - y = 9; - } - } - } else if(y == w) { - y = w - 1; - x -= 2; - filler->dir = -1; - if(!filler->mqr && x == 6) { - x--; - y -= 8; - } - } - if(x < 0 || y < 0) return NULL; - - filler->x = x; - filler->y = y; - - if(p[y * w + x] & 0x80) { - // This tail recursion could be optimized. - return FrameFiller_next(filler); - } - return &p[y * w + x]; -} - -#ifdef WITH_TESTS -unsigned char *FrameFiller_test(int version) -{ - int width; - unsigned char *frame, *p; - int i, length; - FrameFiller filler; - - width = QRspec_getWidth(version); - frame = QRspec_newFrame(version); - if(frame == NULL) return NULL; - FrameFiller_set(&filler, width, frame, 0); - length = QRspec_getDataLength(version, QR_ECLEVEL_L) * 8 - + QRspec_getECCLength(version, QR_ECLEVEL_L) * 8 - + QRspec_getRemainder(version); - for(i = 0; i < length; i++) { - p = FrameFiller_next(&filler); - if(p == NULL) { - free(frame); - return NULL; - } - *p = (unsigned char)(i & 0x7f) | 0x80; - } - return frame; -} - -unsigned char *FrameFiller_testMQR(int version) -{ - int width; - unsigned char *frame, *p; - int i, length; - FrameFiller filler; - - width = MQRspec_getWidth(version); - frame = MQRspec_newFrame(version); - if(frame == NULL) return NULL; - FrameFiller_set(&filler, width, frame, 1); - length = MQRspec_getDataLengthBit(version, QR_ECLEVEL_L) - + MQRspec_getECCLength(version, QR_ECLEVEL_L) * 8; - for(i = 0; i < length; i++) { - p = FrameFiller_next(&filler); - if(p == NULL) { - fprintf(stderr, "Frame filler run over the frame!\n"); - return frame; - } - *p = (unsigned char)(i & 0x7f) | 0x80; - } - return frame; -} -#endif - - -/****************************************************************************** - * QR-code encoding - *****************************************************************************/ - -STATIC_IN_RELEASE QRcode *QRcode_new(int version, int width, unsigned char *data) -{ - QRcode *qrcode; - - qrcode = (QRcode *)malloc(sizeof(QRcode)); - if(qrcode == NULL) return NULL; - - qrcode->version = version; - qrcode->width = width; - qrcode->data = data; - - return qrcode; -} - -void QRcode_free(QRcode *qrcode) -{ - if(qrcode != NULL) { - free(qrcode->data); - free(qrcode); - } -} - -STATIC_IN_RELEASE QRcode *QRcode_encodeMask(QRinput *input, int mask) -{ - int width, version; - QRRawCode *raw; - unsigned char *frame, *masked, *p, code, bit; - int i, j; - QRcode *qrcode = NULL; - FrameFiller filler; - - if(input->mqr) { - errno = EINVAL; - return NULL; - } - if(input->version < 0 || input->version > QRSPEC_VERSION_MAX) { - errno = EINVAL; - return NULL; - } - if(!(input->level >= QR_ECLEVEL_L && input->level <= QR_ECLEVEL_H)) { - errno = EINVAL; - return NULL; - } - - raw = QRraw_new(input); - if(raw == NULL) return NULL; - - version = raw->version; - width = QRspec_getWidth(version); - frame = QRspec_newFrame(version); - if(frame == NULL) { - QRraw_free(raw); - return NULL; - } - FrameFiller_set(&filler, width, frame, 0); - - /* interleaved data and ecc codes */ - for(i = 0; i < raw->dataLength; i++) { - code = QRraw_getCode(raw); - bit = 0x80; - for(j = 0; j < 8; j++) { - p = FrameFiller_next(&filler); - if(p == NULL) goto EXIT; - *p = ((bit & code) != 0); - bit = bit >> 1; - } - } - for(i = 0; i < raw->eccLength; i++) { - code = QRraw_getCode(raw); - bit = 0x80; - for(j = 0; j < 8; j++) { - p = FrameFiller_next(&filler); - if(p == NULL) goto EXIT; - *p = 0x02 | ((bit & code) != 0); - bit = bit >> 1; - } - } - QRraw_free(raw); - raw = NULL; - /* remainder bits */ - j = QRspec_getRemainder(version); - for(i = 0; i < j; i++) { - p = FrameFiller_next(&filler); - if(p == NULL) goto EXIT; - *p = 0x02; - } - - /* masking */ - if(mask == -2) { // just for debug purpose - masked = (unsigned char *)malloc((size_t)(width * width)); - memcpy(masked, frame, (size_t)(width * width)); - } else if(mask < 0) { - masked = Mask_mask(width, frame, input->level); - } else { - masked = Mask_makeMask(width, frame, mask, input->level); - } - if(masked == NULL) { - goto EXIT; - } - qrcode = QRcode_new(version, width, masked); - if(qrcode == NULL) { - free(masked); - } - -EXIT: - QRraw_free(raw); - free(frame); - return qrcode; -} - -STATIC_IN_RELEASE QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask) -{ - int width, version; - MQRRawCode *raw; - unsigned char *frame, *masked, *p, code, bit; - int i, j, length; - QRcode *qrcode = NULL; - FrameFiller filler; - - if(!input->mqr) { - errno = EINVAL; - return NULL; - } - if(input->version <= 0 || input->version > MQRSPEC_VERSION_MAX) { - errno = EINVAL; - return NULL; - } - if(!(input->level >= QR_ECLEVEL_L && input->level <= QR_ECLEVEL_Q)) { - errno = EINVAL; - return NULL; - } - - raw = MQRraw_new(input); - if(raw == NULL) return NULL; - - version = raw->version; - width = MQRspec_getWidth(version); - frame = MQRspec_newFrame(version); - if(frame == NULL) { - MQRraw_free(raw); - return NULL; - } - FrameFiller_set(&filler, width, frame, 1); - - /* interleaved data and ecc codes */ - for(i = 0; i < raw->dataLength; i++) { - code = MQRraw_getCode(raw); - bit = 0x80; - if(raw->oddbits && i == raw->dataLength - 1) { - length = raw->oddbits; - } else { - length = 8; - } - for(j = 0; j < length; j++) { - p = FrameFiller_next(&filler); - if(p == NULL) goto EXIT; - *p = ((bit & code) != 0); - bit = bit >> 1; - } - } - for(i = 0; i < raw->eccLength; i++) { - code = MQRraw_getCode(raw); - bit = 0x80; - length = 8; - for(j = 0; j < length; j++) { - p = FrameFiller_next(&filler); - if(p == NULL) goto EXIT; - *p = 0x02 | ((bit & code) != 0); - bit = bit >> 1; - } - } - MQRraw_free(raw); - raw = NULL; - - /* masking */ - if(mask == -2) { // just for debug purpose - masked = (unsigned char *)malloc((size_t)(width * width)); - memcpy(masked, frame, (size_t)(width * width)); - } else if(mask < 0) { - masked = MMask_mask(version, frame, input->level); - } else { - masked = MMask_makeMask(version, frame, mask, input->level); - } - if(masked == NULL) { - goto EXIT; - } - - qrcode = QRcode_new(version, width, masked); - if(qrcode == NULL) { - free(masked); - } - -EXIT: - MQRraw_free(raw); - free(frame); - return qrcode; -} - -QRcode *QRcode_encodeInput(QRinput *input) -{ - if(input->mqr) { - return QRcode_encodeMaskMQR(input, -1); - } else { - return QRcode_encodeMask(input, -1); - } -} - -static QRcode *QRcode_encodeStringReal(const char *string, int version, QRecLevel level, int mqr, QRencodeMode hint, int casesensitive) -{ - QRinput *input; - QRcode *code; - int ret; - - if(string == NULL) { - errno = EINVAL; - return NULL; - } - if(hint != QR_MODE_8 && hint != QR_MODE_KANJI) { - errno = EINVAL; - return NULL; - } - - if(mqr) { - input = QRinput_newMQR(version, level); - } else { - input = QRinput_new2(version, level); - } - if(input == NULL) return NULL; - - ret = Split_splitStringToQRinput(string, input, hint, casesensitive); - if(ret < 0) { - QRinput_free(input); - return NULL; - } - code = QRcode_encodeInput(input); - QRinput_free(input); - - return code; -} - -QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) -{ - return QRcode_encodeStringReal(string, version, level, 0, hint, casesensitive); -} - -QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) -{ - int i; - - if(version == 0) { - version = 1; - } - for(i = version; i <= MQRSPEC_VERSION_MAX ; i++) { - QRcode *code = QRcode_encodeStringReal(string, i, level, 1, hint, casesensitive); - if(code != NULL) return code; - } - - return NULL; -} - -static QRcode *QRcode_encodeDataReal(const unsigned char *data, int length, int version, QRecLevel level, int mqr) -{ - QRinput *input; - QRcode *code; - int ret; - - if(data == NULL || length == 0) { - errno = EINVAL; - return NULL; - } - - if(mqr) { - input = QRinput_newMQR(version, level); - } else { - input = QRinput_new2(version, level); - } - if(input == NULL) return NULL; - - ret = QRinput_append(input, QR_MODE_8, length, data); - if(ret < 0) { - QRinput_free(input); - return NULL; - } - code = QRcode_encodeInput(input); - QRinput_free(input); - - return code; -} - -QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level) -{ - return QRcode_encodeDataReal(data, size, version, level, 0); -} - -QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level) -{ - if(string == NULL) { - errno = EINVAL; - return NULL; - } - return QRcode_encodeDataReal((unsigned char *)string, (int)strlen(string), version, level, 0); -} - -QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level) -{ - int i; - - if(version == 0) { - version = 1; - } - for(i = version; i <= MQRSPEC_VERSION_MAX; i++) { - QRcode *code = QRcode_encodeDataReal(data, size, i, level, 1); - if(code != NULL) return code; - } - - return NULL; -} - -QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level) -{ - int i; - - if(string == NULL) { - errno = EINVAL; - return NULL; - } - if(version == 0) { - version = 1; - } - for(i = version; i <= MQRSPEC_VERSION_MAX; i++) { - QRcode *code = QRcode_encodeDataReal((unsigned char *)string, (int)strlen(string), i, level, 1); - if(code != NULL) return code; - } - - return NULL; -} - - -/****************************************************************************** - * Structured QR-code encoding - *****************************************************************************/ - -static QRcode_List *QRcode_List_newEntry(void) -{ - QRcode_List *entry; - - entry = (QRcode_List *)malloc(sizeof(QRcode_List)); - if(entry == NULL) return NULL; - - entry->next = NULL; - entry->code = NULL; - - return entry; -} - -static void QRcode_List_freeEntry(QRcode_List *entry) -{ - if(entry != NULL) { - QRcode_free(entry->code); - free(entry); - } -} - -void QRcode_List_free(QRcode_List *qrlist) -{ - QRcode_List *list = qrlist, *next; - - while(list != NULL) { - next = list->next; - QRcode_List_freeEntry(list); - list = next; - } -} - -int QRcode_List_size(QRcode_List *qrlist) -{ - QRcode_List *list = qrlist; - int size = 0; - - while(list != NULL) { - size++; - list = list->next; - } - - return size; -} - -QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s) -{ - QRcode_List *head = NULL; - QRcode_List *tail = NULL; - QRcode_List *entry; - QRinput_InputList *list = s->head; - - while(list != NULL) { - if(head == NULL) { - entry = QRcode_List_newEntry(); - if(entry == NULL) goto ABORT; - head = entry; - tail = head; - } else { - entry = QRcode_List_newEntry(); - if(entry == NULL) goto ABORT; - tail->next = entry; - tail = tail->next; - } - tail->code = QRcode_encodeInput(list->input); - if(tail->code == NULL) { - goto ABORT; - } - list = list->next; - } - - return head; -ABORT: - QRcode_List_free(head); - return NULL; -} - -static QRcode_List *QRcode_encodeInputToStructured(QRinput *input) -{ - QRinput_Struct *s; - QRcode_List *codes; - - s = QRinput_splitQRinputToStruct(input); - if(s == NULL) return NULL; - - codes = QRcode_encodeInputStructured(s); - QRinput_Struct_free(s); - - return codes; -} - -static QRcode_List *QRcode_encodeDataStructuredReal( - int size, const unsigned char *data, - int version, QRecLevel level, - int eightbit, QRencodeMode hint, int casesensitive) -{ - QRinput *input; - QRcode_List *codes; - int ret; - - if(version <= 0) { - errno = EINVAL; - return NULL; - } - if(!eightbit && (hint != QR_MODE_8 && hint != QR_MODE_KANJI)) { - errno = EINVAL; - return NULL; - } - - input = QRinput_new2(version, level); - if(input == NULL) return NULL; - - if(eightbit) { - ret = QRinput_append(input, QR_MODE_8, size, data); - } else { - ret = Split_splitStringToQRinput((char *)data, input, hint, casesensitive); - } - if(ret < 0) { - QRinput_free(input); - return NULL; - } - codes = QRcode_encodeInputToStructured(input); - QRinput_free(input); - - return codes; -} - -QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level) { - return QRcode_encodeDataStructuredReal(size, data, version, level, 1, QR_MODE_NUL, 0); -} - -QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level) { - if(string == NULL) { - errno = EINVAL; - return NULL; - } - return QRcode_encodeDataStructured((int)strlen(string), (unsigned char *)string, version, level); -} - -QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) -{ - if(string == NULL) { - errno = EINVAL; - return NULL; - } - return QRcode_encodeDataStructuredReal((int)strlen(string), (unsigned char *)string, version, level, 0, hint, casesensitive); -} - -/****************************************************************************** - * System utilities - *****************************************************************************/ - -void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version) -{ - if(major_version != NULL) { - *major_version = MAJOR_VERSION; - } - if(minor_version != NULL) { - *minor_version = MINOR_VERSION; - } - if(micro_version != NULL) { - *micro_version = MICRO_VERSION; - } -} - -char *QRcode_APIVersionString(void) -{ - return VERSION; -} - -void QRcode_clearCache(void) -{ - return; -} +/* + * qrencode - QR Code encoder + * + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "qrencode.h" +#include "qrspec.h" +#include "mqrspec.h" +#include "bitstream.h" +#include "qrinput.h" +#include "rsecc.h" +#include "split.h" +#include "mask.h" +#include "mmask.h" + +/****************************************************************************** + * Raw code + *****************************************************************************/ + +typedef struct { + int dataLength; + int eccLength; + unsigned char *data; + unsigned char *ecc; +} RSblock; + +typedef struct { + int version; + int dataLength; + int eccLength; + unsigned char *datacode; + unsigned char *ecccode; + int b1; + int blocks; + RSblock *rsblock; + int count; +} QRRawCode; + +static void RSblock_initBlock(RSblock *block, int dl, unsigned char *data, int el, unsigned char *ecc) +{ + block->dataLength = dl; + block->data = data; + block->eccLength = el; + block->ecc = ecc; + + RSECC_encode((size_t)dl, (size_t)el, data, ecc); +} + +static int RSblock_init(RSblock *blocks, int spec[5], unsigned char *data, unsigned char *ecc) +{ + int i; + RSblock *block; + unsigned char *dp, *ep; + int el, dl; + + dl = QRspec_rsDataCodes1(spec); + el = QRspec_rsEccCodes1(spec); + + block = blocks; + dp = data; + ep = ecc; + for(i = 0; i < QRspec_rsBlockNum1(spec); i++) { + RSblock_initBlock(block, dl, dp, el, ep); + dp += dl; + ep += el; + block++; + } + + if(QRspec_rsBlockNum2(spec) == 0) return 0; + + dl = QRspec_rsDataCodes2(spec); + el = QRspec_rsEccCodes2(spec); + for(i = 0; i < QRspec_rsBlockNum2(spec); i++) { + RSblock_initBlock(block, dl, dp, el, ep); + dp += dl; + ep += el; + block++; + } + + return 0; +} + +STATIC_IN_RELEASE void QRraw_free(QRRawCode *raw); +STATIC_IN_RELEASE QRRawCode *QRraw_new(QRinput *input) +{ + QRRawCode *raw; + int spec[5], ret; + + raw = (QRRawCode *)malloc(sizeof(QRRawCode)); + if(raw == NULL) return NULL; + + raw->datacode = QRinput_getByteStream(input); + if(raw->datacode == NULL) { + free(raw); + return NULL; + } + + QRspec_getEccSpec(input->version, input->level, spec); + + raw->version = input->version; + raw->b1 = QRspec_rsBlockNum1(spec); + raw->dataLength = QRspec_rsDataLength(spec); + raw->eccLength = QRspec_rsEccLength(spec); + raw->ecccode = (unsigned char *)malloc((size_t)raw->eccLength); + if(raw->ecccode == NULL) { + free(raw->datacode); + free(raw); + return NULL; + } + + raw->blocks = QRspec_rsBlockNum(spec); + raw->rsblock = (RSblock *)calloc((size_t)(raw->blocks), sizeof(RSblock)); + if(raw->rsblock == NULL) { + QRraw_free(raw); + return NULL; + } + ret = RSblock_init(raw->rsblock, spec, raw->datacode, raw->ecccode); + if(ret < 0) { + QRraw_free(raw); + return NULL; + } + + raw->count = 0; + + return raw; +} + +/** + * Return a code (byte). + * This function can be called iteratively. + * @param raw raw code. + * @return code + */ +STATIC_IN_RELEASE unsigned char QRraw_getCode(QRRawCode *raw) +{ + int col, row; + unsigned char ret; + + if(raw->count < raw->dataLength) { + row = raw->count % raw->blocks; + col = raw->count / raw->blocks; + if(col >= raw->rsblock[0].dataLength) { + row += raw->b1; + } + ret = raw->rsblock[row].data[col]; + } else if(raw->count < raw->dataLength + raw->eccLength) { + row = (raw->count - raw->dataLength) % raw->blocks; + col = (raw->count - raw->dataLength) / raw->blocks; + ret = raw->rsblock[row].ecc[col]; + } else { + return 0; + } + raw->count++; + return ret; +} + +STATIC_IN_RELEASE void QRraw_free(QRRawCode *raw) +{ + if(raw != NULL) { + free(raw->datacode); + free(raw->ecccode); + free(raw->rsblock); + free(raw); + } +} + +/****************************************************************************** + * Raw code for Micro QR Code + *****************************************************************************/ + +typedef struct { + int version; + int dataLength; + int eccLength; + unsigned char *datacode; + unsigned char *ecccode; + RSblock *rsblock; + int oddbits; + int count; +} MQRRawCode; + +STATIC_IN_RELEASE void MQRraw_free(MQRRawCode *raw); +STATIC_IN_RELEASE MQRRawCode *MQRraw_new(QRinput *input) +{ + MQRRawCode *raw; + + raw = (MQRRawCode *)malloc(sizeof(MQRRawCode)); + if(raw == NULL) return NULL; + + raw->version = input->version; + raw->dataLength = MQRspec_getDataLength(input->version, input->level); + raw->eccLength = MQRspec_getECCLength(input->version, input->level); + raw->oddbits = raw->dataLength * 8 - MQRspec_getDataLengthBit(input->version, input->level); + raw->datacode = QRinput_getByteStream(input); + if(raw->datacode == NULL) { + free(raw); + return NULL; + } + raw->ecccode = (unsigned char *)malloc((size_t)raw->eccLength); + if(raw->ecccode == NULL) { + free(raw->datacode); + free(raw); + return NULL; + } + + raw->rsblock = (RSblock *)calloc(1, sizeof(RSblock)); + if(raw->rsblock == NULL) { + MQRraw_free(raw); + return NULL; + } + + RSblock_initBlock(raw->rsblock, raw->dataLength, raw->datacode, raw->eccLength, raw->ecccode); + + raw->count = 0; + + return raw; +} + +/** + * Return a code (byte). + * This function can be called iteratively. + * @param raw raw code. + * @return code + */ +STATIC_IN_RELEASE unsigned char MQRraw_getCode(MQRRawCode *raw) +{ + unsigned char ret; + + if(raw->count < raw->dataLength) { + ret = raw->datacode[raw->count]; + } else if(raw->count < raw->dataLength + raw->eccLength) { + ret = raw->ecccode[raw->count - raw->dataLength]; + } else { + return 0; + } + raw->count++; + return ret; +} + +STATIC_IN_RELEASE void MQRraw_free(MQRRawCode *raw) +{ + if(raw != NULL) { + free(raw->datacode); + free(raw->ecccode); + free(raw->rsblock); + free(raw); + } +} + + +/****************************************************************************** + * Frame filling + *****************************************************************************/ + +typedef struct { + int width; + unsigned char *frame; + int x, y; + int dir; + int bit; + int mqr; +} FrameFiller; + +static void FrameFiller_set(FrameFiller *filler, int width, unsigned char *frame, int mqr) +{ + filler->width = width; + filler->frame = frame; + filler->x = width - 1; + filler->y = width - 1; + filler->dir = -1; + filler->bit = -1; + filler->mqr = mqr; +} + +static unsigned char *FrameFiller_next(FrameFiller *filler) +{ + unsigned char *p; + int x, y, w; + + if(filler->bit == -1) { + filler->bit = 0; + return filler->frame + filler->y * filler->width + filler->x; + } + + x = filler->x; + y = filler->y; + p = filler->frame; + w = filler->width; + + if(filler->bit == 0) { + x--; + filler->bit++; + } else { + x++; + y += filler->dir; + filler->bit--; + } + + if(filler->dir < 0) { + if(y < 0) { + y = 0; + x -= 2; + filler->dir = 1; + if(!filler->mqr && x == 6) { + x--; + y = 9; + } + } + } else if(y == w) { + y = w - 1; + x -= 2; + filler->dir = -1; + if(!filler->mqr && x == 6) { + x--; + y -= 8; + } + } + if(x < 0 || y < 0) return NULL; + + filler->x = x; + filler->y = y; + + if(p[y * w + x] & 0x80) { + // This tail recursion could be optimized. + return FrameFiller_next(filler); + } + return &p[y * w + x]; +} + +#ifdef WITH_TESTS +unsigned char *FrameFiller_test(int version) +{ + int width; + unsigned char *frame, *p; + int i, length; + FrameFiller filler; + + width = QRspec_getWidth(version); + frame = QRspec_newFrame(version); + if(frame == NULL) return NULL; + FrameFiller_set(&filler, width, frame, 0); + length = QRspec_getDataLength(version, QR_ECLEVEL_L) * 8 + + QRspec_getECCLength(version, QR_ECLEVEL_L) * 8 + + QRspec_getRemainder(version); + for(i = 0; i < length; i++) { + p = FrameFiller_next(&filler); + if(p == NULL) { + free(frame); + return NULL; + } + *p = (unsigned char)(i & 0x7f) | 0x80; + } + return frame; +} + +unsigned char *FrameFiller_testMQR(int version) +{ + int width; + unsigned char *frame, *p; + int i, length; + FrameFiller filler; + + width = MQRspec_getWidth(version); + frame = MQRspec_newFrame(version); + if(frame == NULL) return NULL; + FrameFiller_set(&filler, width, frame, 1); + length = MQRspec_getDataLengthBit(version, QR_ECLEVEL_L) + + MQRspec_getECCLength(version, QR_ECLEVEL_L) * 8; + for(i = 0; i < length; i++) { + p = FrameFiller_next(&filler); + if(p == NULL) { + fprintf(stderr, "Frame filler run over the frame!\n"); + return frame; + } + *p = (unsigned char)(i & 0x7f) | 0x80; + } + return frame; +} +#endif + + +/****************************************************************************** + * QR-code encoding + *****************************************************************************/ + +STATIC_IN_RELEASE QRcode *QRcode_new(int version, int width, unsigned char *data) +{ + QRcode *qrcode; + + qrcode = (QRcode *)malloc(sizeof(QRcode)); + if(qrcode == NULL) return NULL; + + qrcode->version = version; + qrcode->width = width; + qrcode->data = data; + + return qrcode; +} + +void QRcode_free(QRcode *qrcode) +{ + if(qrcode != NULL) { + free(qrcode->data); + free(qrcode); + } +} + +STATIC_IN_RELEASE QRcode *QRcode_encodeMask(QRinput *input, int mask) +{ + int width, version; + QRRawCode *raw; + unsigned char *frame, *masked, *p, code, bit; + int i, j; + QRcode *qrcode = NULL; + FrameFiller filler; + + if(input->mqr) { + errno = EINVAL; + return NULL; + } + if(input->version < 0 || input->version > QRSPEC_VERSION_MAX) { + errno = EINVAL; + return NULL; + } + if(!(input->level >= QR_ECLEVEL_L && input->level <= QR_ECLEVEL_H)) { + errno = EINVAL; + return NULL; + } + + raw = QRraw_new(input); + if(raw == NULL) return NULL; + + version = raw->version; + width = QRspec_getWidth(version); + frame = QRspec_newFrame(version); + if(frame == NULL) { + QRraw_free(raw); + return NULL; + } + FrameFiller_set(&filler, width, frame, 0); + + /* interleaved data and ecc codes */ + for(i = 0; i < raw->dataLength; i++) { + code = QRraw_getCode(raw); + bit = 0x80; + for(j = 0; j < 8; j++) { + p = FrameFiller_next(&filler); + if(p == NULL) goto EXIT; + *p = ((bit & code) != 0); + bit = bit >> 1; + } + } + for(i = 0; i < raw->eccLength; i++) { + code = QRraw_getCode(raw); + bit = 0x80; + for(j = 0; j < 8; j++) { + p = FrameFiller_next(&filler); + if(p == NULL) goto EXIT; + *p = 0x02 | ((bit & code) != 0); + bit = bit >> 1; + } + } + QRraw_free(raw); + raw = NULL; + /* remainder bits */ + j = QRspec_getRemainder(version); + for(i = 0; i < j; i++) { + p = FrameFiller_next(&filler); + if(p == NULL) goto EXIT; + *p = 0x02; + } + + /* masking */ + if(mask == -2) { // just for debug purpose + masked = (unsigned char *)malloc((size_t)(width * width)); + memcpy(masked, frame, (size_t)(width * width)); + } else if(mask < 0) { + masked = Mask_mask(width, frame, input->level); + } else { + masked = Mask_makeMask(width, frame, mask, input->level); + } + if(masked == NULL) { + goto EXIT; + } + qrcode = QRcode_new(version, width, masked); + if(qrcode == NULL) { + free(masked); + } + +EXIT: + QRraw_free(raw); + free(frame); + return qrcode; +} + +STATIC_IN_RELEASE QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask) +{ + int width, version; + MQRRawCode *raw; + unsigned char *frame, *masked, *p, code, bit; + int i, j, length; + QRcode *qrcode = NULL; + FrameFiller filler; + + if(!input->mqr) { + errno = EINVAL; + return NULL; + } + if(input->version <= 0 || input->version > MQRSPEC_VERSION_MAX) { + errno = EINVAL; + return NULL; + } + if(!(input->level >= QR_ECLEVEL_L && input->level <= QR_ECLEVEL_Q)) { + errno = EINVAL; + return NULL; + } + + raw = MQRraw_new(input); + if(raw == NULL) return NULL; + + version = raw->version; + width = MQRspec_getWidth(version); + frame = MQRspec_newFrame(version); + if(frame == NULL) { + MQRraw_free(raw); + return NULL; + } + FrameFiller_set(&filler, width, frame, 1); + + /* interleaved data and ecc codes */ + for(i = 0; i < raw->dataLength; i++) { + code = MQRraw_getCode(raw); + bit = 0x80; + if(raw->oddbits && i == raw->dataLength - 1) { + length = raw->oddbits; + } else { + length = 8; + } + for(j = 0; j < length; j++) { + p = FrameFiller_next(&filler); + if(p == NULL) goto EXIT; + *p = ((bit & code) != 0); + bit = bit >> 1; + } + } + for(i = 0; i < raw->eccLength; i++) { + code = MQRraw_getCode(raw); + bit = 0x80; + length = 8; + for(j = 0; j < length; j++) { + p = FrameFiller_next(&filler); + if(p == NULL) goto EXIT; + *p = 0x02 | ((bit & code) != 0); + bit = bit >> 1; + } + } + MQRraw_free(raw); + raw = NULL; + + /* masking */ + if(mask == -2) { // just for debug purpose + masked = (unsigned char *)malloc((size_t)(width * width)); + memcpy(masked, frame, (size_t)(width * width)); + } else if(mask < 0) { + masked = MMask_mask(version, frame, input->level); + } else { + masked = MMask_makeMask(version, frame, mask, input->level); + } + if(masked == NULL) { + goto EXIT; + } + + qrcode = QRcode_new(version, width, masked); + if(qrcode == NULL) { + free(masked); + } + +EXIT: + MQRraw_free(raw); + free(frame); + return qrcode; +} + +QRcode *QRcode_encodeInput(QRinput *input) +{ + if(input->mqr) { + return QRcode_encodeMaskMQR(input, -1); + } else { + return QRcode_encodeMask(input, -1); + } +} + +static QRcode *QRcode_encodeStringReal(const char *string, int version, QRecLevel level, int mqr, QRencodeMode hint, int casesensitive) +{ + QRinput *input; + QRcode *code; + int ret; + + if(string == NULL) { + errno = EINVAL; + return NULL; + } + if(hint != QR_MODE_8 && hint != QR_MODE_KANJI) { + errno = EINVAL; + return NULL; + } + + if(mqr) { + input = QRinput_newMQR(version, level); + } else { + input = QRinput_new2(version, level); + } + if(input == NULL) return NULL; + + ret = Split_splitStringToQRinput(string, input, hint, casesensitive); + if(ret < 0) { + QRinput_free(input); + return NULL; + } + code = QRcode_encodeInput(input); + QRinput_free(input); + + return code; +} + +QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) +{ + return QRcode_encodeStringReal(string, version, level, 0, hint, casesensitive); +} + +QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) +{ + int i; + + if(version == 0) { + version = 1; + } + for(i = version; i <= MQRSPEC_VERSION_MAX ; i++) { + QRcode *code = QRcode_encodeStringReal(string, i, level, 1, hint, casesensitive); + if(code != NULL) return code; + } + + return NULL; +} + +static QRcode *QRcode_encodeDataReal(const unsigned char *data, int length, int version, QRecLevel level, int mqr) +{ + QRinput *input; + QRcode *code; + int ret; + + if(data == NULL || length == 0) { + errno = EINVAL; + return NULL; + } + + if(mqr) { + input = QRinput_newMQR(version, level); + } else { + input = QRinput_new2(version, level); + } + if(input == NULL) return NULL; + + ret = QRinput_append(input, QR_MODE_8, length, data); + if(ret < 0) { + QRinput_free(input); + return NULL; + } + code = QRcode_encodeInput(input); + QRinput_free(input); + + return code; +} + +QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level) +{ + return QRcode_encodeDataReal(data, size, version, level, 0); +} + +QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level) +{ + if(string == NULL) { + errno = EINVAL; + return NULL; + } + return QRcode_encodeDataReal((unsigned char *)string, (int)strlen(string), version, level, 0); +} + +QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level) +{ + int i; + + if(version == 0) { + version = 1; + } + for(i = version; i <= MQRSPEC_VERSION_MAX; i++) { + QRcode *code = QRcode_encodeDataReal(data, size, i, level, 1); + if(code != NULL) return code; + } + + return NULL; +} + +QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level) +{ + int i; + + if(string == NULL) { + errno = EINVAL; + return NULL; + } + if(version == 0) { + version = 1; + } + for(i = version; i <= MQRSPEC_VERSION_MAX; i++) { + QRcode *code = QRcode_encodeDataReal((unsigned char *)string, (int)strlen(string), i, level, 1); + if(code != NULL) return code; + } + + return NULL; +} + + +/****************************************************************************** + * Structured QR-code encoding + *****************************************************************************/ + +static QRcode_List *QRcode_List_newEntry(void) +{ + QRcode_List *entry; + + entry = (QRcode_List *)malloc(sizeof(QRcode_List)); + if(entry == NULL) return NULL; + + entry->next = NULL; + entry->code = NULL; + + return entry; +} + +static void QRcode_List_freeEntry(QRcode_List *entry) +{ + if(entry != NULL) { + QRcode_free(entry->code); + free(entry); + } +} + +void QRcode_List_free(QRcode_List *qrlist) +{ + QRcode_List *list = qrlist, *next; + + while(list != NULL) { + next = list->next; + QRcode_List_freeEntry(list); + list = next; + } +} + +int QRcode_List_size(QRcode_List *qrlist) +{ + QRcode_List *list = qrlist; + int size = 0; + + while(list != NULL) { + size++; + list = list->next; + } + + return size; +} + +QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s) +{ + QRcode_List *head = NULL; + QRcode_List *tail = NULL; + QRcode_List *entry; + QRinput_InputList *list = s->head; + + while(list != NULL) { + if(head == NULL) { + entry = QRcode_List_newEntry(); + if(entry == NULL) goto ABORT; + head = entry; + tail = head; + } else { + entry = QRcode_List_newEntry(); + if(entry == NULL) goto ABORT; + tail->next = entry; + tail = tail->next; + } + tail->code = QRcode_encodeInput(list->input); + if(tail->code == NULL) { + goto ABORT; + } + list = list->next; + } + + return head; +ABORT: + QRcode_List_free(head); + return NULL; +} + +static QRcode_List *QRcode_encodeInputToStructured(QRinput *input) +{ + QRinput_Struct *s; + QRcode_List *codes; + + s = QRinput_splitQRinputToStruct(input); + if(s == NULL) return NULL; + + codes = QRcode_encodeInputStructured(s); + QRinput_Struct_free(s); + + return codes; +} + +static QRcode_List *QRcode_encodeDataStructuredReal( + int size, const unsigned char *data, + int version, QRecLevel level, + int eightbit, QRencodeMode hint, int casesensitive) +{ + QRinput *input; + QRcode_List *codes; + int ret; + + if(version <= 0) { + errno = EINVAL; + return NULL; + } + if(!eightbit && (hint != QR_MODE_8 && hint != QR_MODE_KANJI)) { + errno = EINVAL; + return NULL; + } + + input = QRinput_new2(version, level); + if(input == NULL) return NULL; + + if(eightbit) { + ret = QRinput_append(input, QR_MODE_8, size, data); + } else { + ret = Split_splitStringToQRinput((char *)data, input, hint, casesensitive); + } + if(ret < 0) { + QRinput_free(input); + return NULL; + } + codes = QRcode_encodeInputToStructured(input); + QRinput_free(input); + + return codes; +} + +QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level) { + return QRcode_encodeDataStructuredReal(size, data, version, level, 1, QR_MODE_NUL, 0); +} + +QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level) { + if(string == NULL) { + errno = EINVAL; + return NULL; + } + return QRcode_encodeDataStructured((int)strlen(string), (unsigned char *)string, version, level); +} + +QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) +{ + if(string == NULL) { + errno = EINVAL; + return NULL; + } + return QRcode_encodeDataStructuredReal((int)strlen(string), (unsigned char *)string, version, level, 0, hint, casesensitive); +} + +/****************************************************************************** + * System utilities + *****************************************************************************/ + +void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version) +{ + if(major_version != NULL) { + *major_version = MAJOR_VERSION; + } + if(minor_version != NULL) { + *minor_version = MINOR_VERSION; + } + if(micro_version != NULL) { + *micro_version = MICRO_VERSION; + } +} + +char *QRcode_APIVersionString(void) +{ + return VERSION; +} + +void QRcode_clearCache(void) +{ + return; +} diff --git a/QtQREnCode/qrencode.cpp b/QtQREnCode/qrencode.cpp index 21c7ef6..78051ee 100644 --- a/QtQREnCode/qrencode.cpp +++ b/QtQREnCode/qrencode.cpp @@ -1,419 +1,419 @@ - -/* - * qrencode - QR Code encoder - * - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "qrencode.h" -#include "qrencode_inner.h" -#include "qrspec.h" -#include "bistream.h" -#include "qrinput.h" -#include "rscode.h" -#include "split.h" -#include "mask.h" - -/****************************************************************************** - * Raw code - *****************************************************************************/ - -static void RSblock_init(RSblock *block, int dl, unsigned char *data, int el) -{ - RS *rs; - - block->dataLength = dl; - block->data = data; - block->eccLength = el; - block->ecc = (unsigned char *)malloc(el); - - rs = init_rs(8, 0x11d, 0, 1, el, 255 - dl - el); - encode_rs_char(rs, data, block->ecc); -} - -QRRawCode *QRraw_new(QRinput *input) -{ - QRRawCode *raw; - int *spec; - int i; - RSblock *rsblock; - unsigned char *p; - - p = QRinput_getByteStream(input); - if(p == NULL) { - return NULL; - } - - raw = (QRRawCode *)malloc(sizeof(QRRawCode)); - raw->datacode = p; - spec = QRspec_getEccSpec(input->version, input->level); - raw->version = input->version; - raw->blocks = QRspec_rsBlockNum(spec); - raw->rsblock = (RSblock *)malloc(sizeof(RSblock) * raw->blocks); - - rsblock = raw->rsblock; - p = raw->datacode; - for(i=0; ib1 = QRspec_rsBlockNum1(spec); - raw->dataLength = QRspec_rsBlockNum1(spec) * QRspec_rsDataCodes1(spec) - + QRspec_rsBlockNum2(spec) * QRspec_rsDataCodes2(spec); - raw->eccLength = QRspec_rsBlockNum(spec) * QRspec_rsEccCodes1(spec); - raw->count = 0; - free(spec); - return raw; -} - -/** - * Return a code (byte). - * This function can be called iteratively. - * @param raw raw code. - * @return code - */ -unsigned char QRraw_getCode(QRRawCode *raw) -{ - int col, row; - unsigned char ret; - - if(raw->count < raw->dataLength) { - row = raw->count % raw->blocks; - col = raw->count / raw->blocks; - if(col >= raw->rsblock[row].dataLength) { - row += raw->b1; - } - ret = raw->rsblock[row].data[col]; - } else if(raw->count < raw->dataLength + raw->eccLength) { - row = (raw->count - raw->dataLength) % raw->blocks; - col = (raw->count - raw->dataLength) / raw->blocks; - ret = raw->rsblock[row].ecc[col]; - } else { - return 0; - } - raw->count++; - return ret; -} - -void QRraw_free(QRRawCode *raw) -{ - int i; - - free(raw->datacode); - for(i=0; iblocks; i++) { - free(raw->rsblock[i].ecc); - } - free(raw->rsblock); - free(raw); -} - -/****************************************************************************** - * Frame filling - *****************************************************************************/ - -typedef struct { - int width; - unsigned char *frame; - int x, y; - int dir; - int bit; -} FrameFiller; - -static FrameFiller *FrameFiller_new(int width, unsigned char *frame) -{ - FrameFiller *filler; - - filler = (FrameFiller *)malloc(sizeof(FrameFiller)); - filler->width = width; - filler->frame = frame; - filler->x = width - 1; - filler->y = width - 1; - filler->dir = -1; - filler->bit = -1; - - return filler; -} - -static unsigned char *FrameFiller_next(FrameFiller *filler) -{ - unsigned char *p; - int x, y, w; - - if(filler->bit == -1) { - filler->bit = 0; - return filler->frame + filler->y * filler->width + filler->x; - } - - x = filler->x; - y = filler->y; - p = filler->frame; - w = filler->width; - - if(filler->bit == 0) { - x--; - filler->bit++; - } else { - x++; - y += filler->dir; - filler->bit--; - } - - if(filler->dir < 0) { - if(y < 0) { - y = 0; - x -= 2; - filler->dir = 1; - if(x == 6) { - x--; - y = 9; - } - } - } else { - if(y == w) { - y = w - 1; - x -= 2; - filler->dir = -1; - if(x == 6) { - x--; - y -= 8; - } - } - } - if(x < 0 || y < 0) return NULL; - - filler->x = x; - filler->y = y; - - if(p[y * w + x] & 0x80) { - // This tail recursion could be optimized. - return FrameFiller_next(filler); - } - return &p[y * w + x]; -} - -unsigned char *FrameFiller_fillerTest(int version) -{ - int width, length; - unsigned char *frame, *p; - FrameFiller *filler; - int i, j; - unsigned char cl = 1; - unsigned char ch = 0; - - width = QRspec_getWidth(version); - frame = QRspec_newFrame(version); - filler = FrameFiller_new(width, frame); - length = QRspec_getDataLength(version, QR_ECLEVEL_L) - + QRspec_getECCLength(version, QR_ECLEVEL_L); - - for(i=0; i> 1; - } - for(i=0; i<7; i++) { - if(format & 1) { - blacks += 2; - v = 0x85; - } else { - v = 0x84; - } - frame[width * (width - 7 + i) + 8] = v; - if(i == 0) { - frame[width * 8 + 7] = v; - } else { - frame[width * 8 + 6 - i] = v; - } - format= format >> 1; - } - - return blacks; -} - -/****************************************************************************** - * QR-code encoding - *****************************************************************************/ - -static QRcode *QRcode_new(int version, int width, unsigned char *data) -{ - QRcode *qrcode; - - qrcode = (QRcode *)malloc(sizeof(QRcode)); - qrcode->version = version; - qrcode->width = width; - qrcode->data = data; - - return qrcode; -} - -void QRcode_free(QRcode *qrcode) -{ - if(qrcode == NULL) return; - - if(qrcode->data != NULL) { - free(qrcode->data); - } - free(qrcode); -} - -QRcode *QRcode_encodeMask(QRinput *input, int version, QRecLevel level, int mask) -{ - int width; - QRRawCode *raw; - unsigned char *frame, *masked, *p, code, bit; - FrameFiller *filler; - int i, j; - QRcode *qrcode; - - QRinput_setVersion(input, version); - QRinput_setErrorCorrectionLevel(input, level); - - raw = QRraw_new(input); - if(raw == NULL) { - return NULL; - } - version = raw->version; - width = QRspec_getWidth(version); - frame = QRspec_newFrame(version); - filler = FrameFiller_new(width, frame); - - /* inteleaved data and ecc codes */ - for(i=0; idataLength + raw->eccLength; i++) { - code = QRraw_getCode(raw); - bit = 0x80; - for(j=0; j<8; j++) { - p = FrameFiller_next(filler); - *p = 0x02 | ((bit & code) != 0); - bit = bit >> 1; - } - } - QRraw_free(raw); - /* remainder bits */ - j = QRspec_getRemainder(version); - for(i=0; i + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include "qrencode.h" +#include "qrencode_inner.h" +#include "qrspec.h" +#include "bistream.h" +#include "qrinput.h" +#include "rscode.h" +#include "split.h" +#include "mask.h" + +/****************************************************************************** + * Raw code + *****************************************************************************/ + +static void RSblock_init(RSblock *block, int dl, unsigned char *data, int el) +{ + RS *rs; + + block->dataLength = dl; + block->data = data; + block->eccLength = el; + block->ecc = (unsigned char *)malloc(el); + + rs = init_rs(8, 0x11d, 0, 1, el, 255 - dl - el); + encode_rs_char(rs, data, block->ecc); +} + +QRRawCode *QRraw_new(QRinput *input) +{ + QRRawCode *raw; + int *spec; + int i; + RSblock *rsblock; + unsigned char *p; + + p = QRinput_getByteStream(input); + if(p == NULL) { + return NULL; + } + + raw = (QRRawCode *)malloc(sizeof(QRRawCode)); + raw->datacode = p; + spec = QRspec_getEccSpec(input->version, input->level); + raw->version = input->version; + raw->blocks = QRspec_rsBlockNum(spec); + raw->rsblock = (RSblock *)malloc(sizeof(RSblock) * raw->blocks); + + rsblock = raw->rsblock; + p = raw->datacode; + for(i=0; ib1 = QRspec_rsBlockNum1(spec); + raw->dataLength = QRspec_rsBlockNum1(spec) * QRspec_rsDataCodes1(spec) + + QRspec_rsBlockNum2(spec) * QRspec_rsDataCodes2(spec); + raw->eccLength = QRspec_rsBlockNum(spec) * QRspec_rsEccCodes1(spec); + raw->count = 0; + free(spec); + return raw; +} + +/** + * Return a code (byte). + * This function can be called iteratively. + * @param raw raw code. + * @return code + */ +unsigned char QRraw_getCode(QRRawCode *raw) +{ + int col, row; + unsigned char ret; + + if(raw->count < raw->dataLength) { + row = raw->count % raw->blocks; + col = raw->count / raw->blocks; + if(col >= raw->rsblock[row].dataLength) { + row += raw->b1; + } + ret = raw->rsblock[row].data[col]; + } else if(raw->count < raw->dataLength + raw->eccLength) { + row = (raw->count - raw->dataLength) % raw->blocks; + col = (raw->count - raw->dataLength) / raw->blocks; + ret = raw->rsblock[row].ecc[col]; + } else { + return 0; + } + raw->count++; + return ret; +} + +void QRraw_free(QRRawCode *raw) +{ + int i; + + free(raw->datacode); + for(i=0; iblocks; i++) { + free(raw->rsblock[i].ecc); + } + free(raw->rsblock); + free(raw); +} + +/****************************************************************************** + * Frame filling + *****************************************************************************/ + +typedef struct { + int width; + unsigned char *frame; + int x, y; + int dir; + int bit; +} FrameFiller; + +static FrameFiller *FrameFiller_new(int width, unsigned char *frame) +{ + FrameFiller *filler; + + filler = (FrameFiller *)malloc(sizeof(FrameFiller)); + filler->width = width; + filler->frame = frame; + filler->x = width - 1; + filler->y = width - 1; + filler->dir = -1; + filler->bit = -1; + + return filler; +} + +static unsigned char *FrameFiller_next(FrameFiller *filler) +{ + unsigned char *p; + int x, y, w; + + if(filler->bit == -1) { + filler->bit = 0; + return filler->frame + filler->y * filler->width + filler->x; + } + + x = filler->x; + y = filler->y; + p = filler->frame; + w = filler->width; + + if(filler->bit == 0) { + x--; + filler->bit++; + } else { + x++; + y += filler->dir; + filler->bit--; + } + + if(filler->dir < 0) { + if(y < 0) { + y = 0; + x -= 2; + filler->dir = 1; + if(x == 6) { + x--; + y = 9; + } + } + } else { + if(y == w) { + y = w - 1; + x -= 2; + filler->dir = -1; + if(x == 6) { + x--; + y -= 8; + } + } + } + if(x < 0 || y < 0) return NULL; + + filler->x = x; + filler->y = y; + + if(p[y * w + x] & 0x80) { + // This tail recursion could be optimized. + return FrameFiller_next(filler); + } + return &p[y * w + x]; +} + +unsigned char *FrameFiller_fillerTest(int version) +{ + int width, length; + unsigned char *frame, *p; + FrameFiller *filler; + int i, j; + unsigned char cl = 1; + unsigned char ch = 0; + + width = QRspec_getWidth(version); + frame = QRspec_newFrame(version); + filler = FrameFiller_new(width, frame); + length = QRspec_getDataLength(version, QR_ECLEVEL_L) + + QRspec_getECCLength(version, QR_ECLEVEL_L); + + for(i=0; i> 1; + } + for(i=0; i<7; i++) { + if(format & 1) { + blacks += 2; + v = 0x85; + } else { + v = 0x84; + } + frame[width * (width - 7 + i) + 8] = v; + if(i == 0) { + frame[width * 8 + 7] = v; + } else { + frame[width * 8 + 6 - i] = v; + } + format= format >> 1; + } + + return blacks; +} + +/****************************************************************************** + * QR-code encoding + *****************************************************************************/ + +static QRcode *QRcode_new(int version, int width, unsigned char *data) +{ + QRcode *qrcode; + + qrcode = (QRcode *)malloc(sizeof(QRcode)); + qrcode->version = version; + qrcode->width = width; + qrcode->data = data; + + return qrcode; +} + +void QRcode_free(QRcode *qrcode) +{ + if(qrcode == NULL) return; + + if(qrcode->data != NULL) { + free(qrcode->data); + } + free(qrcode); +} + +QRcode *QRcode_encodeMask(QRinput *input, int version, QRecLevel level, int mask) +{ + int width; + QRRawCode *raw; + unsigned char *frame, *masked, *p, code, bit; + FrameFiller *filler; + int i, j; + QRcode *qrcode; + + QRinput_setVersion(input, version); + QRinput_setErrorCorrectionLevel(input, level); + + raw = QRraw_new(input); + if(raw == NULL) { + return NULL; + } + version = raw->version; + width = QRspec_getWidth(version); + frame = QRspec_newFrame(version); + filler = FrameFiller_new(width, frame); + + /* inteleaved data and ecc codes */ + for(i=0; idataLength + raw->eccLength; i++) { + code = QRraw_getCode(raw); + bit = 0x80; + for(j=0; j<8; j++) { + p = FrameFiller_next(filler); + *p = 0x02 | ((bit & code) != 0); + bit = bit >> 1; + } + } + QRraw_free(raw); + /* remainder bits */ + j = QRspec_getRemainder(version); + for(i=0; i - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** \mainpage - * Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D - * symbology. - * - * \section encoding Encoding - * - * There are two methods to encode data: encoding a string/data or - * encoding a structured data. - * - * \subsection encoding-string Encoding a string/data - * You can encode a string by calling QRcode_encodeString(). - * The given string is parsed automatically and encoded. If you want to encode - * data that can be represented as a C string style (NUL terminated), you can - * simply use this way. - * - * If the input data contains Kanji (Shift-JIS) characters and you want to - * encode them as Kanji in QR Code, you should give QR_MODE_KANJI as a hint. - * Otherwise, all of non-alphanumeric characters are encoded as 8-bit data. - * If you want to encode a whole string in 8-bit mode, you can use - * QRcode_encodeString8bit() instead. - * - * Please note that a C string can not contain NUL characters. If your data - * contains NUL, you must use QRcode_encodeData(). - * - * \subsection encoding-input Encoding a structured data - * You can construct a structured input data manually. If the structure of the - * input data is known, you can use this method. - * At first, create a ::QRinput object by QRinput_new(). Then add input data - * to the QRinput object by QRinput_append(). Finally call QRcode_encodeInput() - * to encode the QRinput data. - * You can reuse the QRinput object again to encode it in other symbols with - * different parameters. - * - * \section result Result - * The encoded symbol is generated as a ::QRcode object. It will contain its - * version number, the width of the symbol, and an array represents the symbol. - * See ::QRcode for the details. You can free the object by QRcode_free(). - * - * Please note that the version of the result may be larger than specified. - * In such cases, the input data would be too large to be encoded in a - * symbol of the specified version. - * - * \section structured Structured append - * Libqrencode can generate "Structured-appended" symbols that enables to split - * a large data set into mulitple QR codes. A QR code reader concatenates - * multiple QR code symbols into a string. - * Just like QRcode_encodeString(), you can use QRcode_encodeStringStructured() - * to generate structured-appended symbols. This functions returns an instance - * of ::QRcode_List. The returned list is a singly-linked list of QRcode: you - * can retrieve each QR code in this way: - * - * \code - * QRcode_List *qrcodes; - * QRcode_List *entry; - * QRcode *qrcode; - * - * qrcodes = QRcode_encodeStringStructured(...); - * entry = qrcodes; - * while(entry != NULL) { - * qrcode = entry->code; - * // do something - * entry = entry->next; - * } - * QRcode_List_free(entry); - * \endcode - * - * Instead of using auto-parsing functions, you can construct your own - * structured input. At first, instantiate an object of ::QRinput_Struct - * by calling QRinput_Struct_new(). This object can hold multiple ::QRinput, - * and one QR code is generated for a ::QRinput. - * QRinput_Struct_appendInput() appends a ::QRinput to a ::QRinput_Struct - * object. In order to generate structured-appended symbols, it is required to - * embed headers to each symbol. You can use - * QRinput_Struct_insertStructuredAppendHeaders() to insert appropriate - * headers to each symbol. You should call this function just once before - * encoding symbols. - */ - -#ifndef QRENCODE_H -#define QRENCODE_H - -#if defined(__cplusplus) -extern "C" { -#endif - -/** - * Encoding mode. - */ -typedef enum { - QR_MODE_NUL = -1, ///< Terminator (NUL character). Internal use only - QR_MODE_NUM = 0, ///< Numeric mode - QR_MODE_AN, ///< Alphabet-numeric mode - QR_MODE_8, ///< 8-bit data mode - QR_MODE_KANJI, ///< Kanji (shift-jis) mode - QR_MODE_STRUCTURE, ///< Internal use only - QR_MODE_ECI, ///< ECI mode - QR_MODE_FNC1FIRST, ///< FNC1, first position - QR_MODE_FNC1SECOND, ///< FNC1, second position -} QRencodeMode; - -/** - * Level of error correction. - */ -typedef enum { - QR_ECLEVEL_L = 0, ///< lowest - QR_ECLEVEL_M, - QR_ECLEVEL_Q, - QR_ECLEVEL_H ///< highest -} QRecLevel; - -/** - * Maximum version (size) of QR-code symbol. - */ -#define QRSPEC_VERSION_MAX 40 - -/** - * Maximum version (size) of QR-code symbol. - */ -#define MQRSPEC_VERSION_MAX 4 - - -#define STATIC_IN_RELEASE static -#define MAJOR_VERSION 4 -#define MINOR_VERSION 1 -#define MICRO_VERSION 1 -#define VERSION "4.1.1" - - - -/****************************************************************************** - * Input data (qrinput.c) - *****************************************************************************/ - -/** - * Singly linked list to contain input strings. An instance of this class - * contains its version and error correction level too. It is required to - * set them by QRinput_setVersion() and QRinput_setErrorCorrectionLevel(), - * or use QRinput_new2() to instantiate an object. - */ -typedef struct _QRinput QRinput; - -/** - * Instantiate an input data object. The version is set to 0 (auto-select) - * and the error correction level is set to QR_ECLEVEL_L. - * @return an input object (initialized). On error, NULL is returned and errno - * is set to indicate the error. - * @throw ENOMEM unable to allocate memory. - */ -extern QRinput *QRinput_new(void); - -/** - * Instantiate an input data object. - * @param version version number. - * @param level Error correction level. - * @return an input object (initialized). On error, NULL is returned and errno - * is set to indicate the error. - * @throw ENOMEM unable to allocate memory for input objects. - * @throw EINVAL invalid arguments. - */ -extern QRinput *QRinput_new2(int version, QRecLevel level); - -/** - * Instantiate an input data object. Object's Micro QR Code flag is set. - * Unlike with full-sized QR Code, version number must be specified (>0). - * @param version version number (1--4). - * @param level Error correction level. - * @return an input object (initialized). On error, NULL is returned and errno - * is set to indicate the error. - * @throw ENOMEM unable to allocate memory for input objects. - * @throw EINVAL invalid arguments. - */ -extern QRinput *QRinput_newMQR(int version, QRecLevel level); - -/** - * Append data to an input object. - * The data is copied and appended to the input object. - * @param input input object. - * @param mode encoding mode. - * @param size size of data (byte). - * @param data a pointer to the memory area of the input data. - * @retval 0 success. - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL input data is invalid. - * - */ -extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data); - -/** - * Append ECI header. - * @param input input object. - * @param ecinum ECI indicator number (0 - 999999) - * @retval 0 success. - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL input data is invalid. - * - */ -extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum); - -/** - * Get current version. - * @param input input object. - * @return current version. - */ -extern int QRinput_getVersion(QRinput *input); - -/** - * Set version of the QR code that is to be encoded. - * This function cannot be applied to Micro QR Code. - * @param input input object. - * @param version version number (0 = auto) - * @retval 0 success. - * @retval -1 invalid argument. - */ -extern int QRinput_setVersion(QRinput *input, int version); - -/** - * Get current error correction level. - * @param input input object. - * @return Current error correcntion level. - */ -extern QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input); - -/** - * Set error correction level of the QR code that is to be encoded. - * This function cannot be applied to Micro QR Code. - * @param input input object. - * @param level Error correction level. - * @retval 0 success. - * @retval -1 invalid argument. - */ -extern int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level); - -/** - * Set version and error correction level of the QR code at once. - * This function is recommened for Micro QR Code. - * @param input input object. - * @param version version number (0 = auto) - * @param level Error correction level. - * @retval 0 success. - * @retval -1 invalid argument. - */ -extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level); - -/** - * Free the input object. - * All of data chunks in the input object are freed too. - * @param input input object. - */ -extern void QRinput_free(QRinput *input); - -/** - * Validate the input data. - * @param mode encoding mode. - * @param size size of data (byte). - * @param data a pointer to the memory area of the input data. - * @retval 0 success. - * @retval -1 invalid arguments. - */ -extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data); - -/** - * Set of QRinput for structured symbols. - */ -typedef struct _QRinput_Struct QRinput_Struct; - -/** - * Instantiate a set of input data object. - * @return an instance of QRinput_Struct. On error, NULL is returned and errno - * is set to indicate the error. - * @throw ENOMEM unable to allocate memory. - */ -extern QRinput_Struct *QRinput_Struct_new(void); - -/** - * Set parity of structured symbols. - * @param s structured input object. - * @param parity parity of s. - */ -extern void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity); - -/** - * Append a QRinput object to the set. QRinput created by QRinput_newMQR() - * will be rejected. - * @warning never append the same QRinput object twice or more. - * @param s structured input object. - * @param input an input object. - * @retval >0 number of input objects in the structure. - * @retval -1 an error occurred. See Exceptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL invalid arguments. - */ -extern int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input); - -/** - * Free all of QRinput in the set. - * @param s a structured input object. - */ -extern void QRinput_Struct_free(QRinput_Struct *s); - -/** - * Split a QRinput to QRinput_Struct. It calculates a parity, set it, then - * insert structured-append headers. QRinput created by QRinput_newMQR() will - * be rejected. - * @param input input object. Version number and error correction level must be - * set. - * @return a set of input data. On error, NULL is returned, and errno is set - * to indicate the error. See Exceptions for the details. - * @throw ERANGE input data is too large. - * @throw EINVAL invalid input data. - * @throw ENOMEM unable to allocate memory. - */ -extern QRinput_Struct *QRinput_splitQRinputToStruct(QRinput *input); - -/** - * Insert structured-append headers to the input structure. It calculates - * a parity and set it if the parity is not set yet. - * @param s input structure - * @retval 0 success. - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory. - */ -extern int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s); - -/** - * Set FNC1-1st position flag. - */ -extern int QRinput_setFNC1First(QRinput *input); - -/** - * Set FNC1-2nd position flag and application identifier. - */ -extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid); - -/****************************************************************************** - * QRcode output (qrencode.c) - *****************************************************************************/ - -/** - * QRcode class. - * Symbol data is represented as an array contains width*width uchars. - * Each uchar represents a module (dot). If the less significant bit of - * the uchar is 1, the corresponding module is black. The other bits are - * meaningless for usual applications, but here its specification is described. - * - * @verbatim - MSB 76543210 LSB - |||||||`- 1=black/0=white - ||||||`-- 1=ecc/0=data code area - |||||`--- format information - ||||`---- version information - |||`----- timing pattern - ||`------ alignment pattern - |`------- finder pattern and separator - `-------- non-data modules (format, timing, etc.) - @endverbatim - */ -typedef struct { - int version; ///< version of the symbol - int width; ///< width of the symbol - unsigned char *data; ///< symbol data -} QRcode; - -/** - * Singly-linked list of QRcode. Used to represent a structured symbols. - * A list is terminated with NULL. - */ -typedef struct _QRcode_List { - QRcode *code; - struct _QRcode_List *next; -} QRcode_List; - -/** - * Create a symbol from the input data. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param input input data. - * @return an instance of QRcode class. The version of the result QRcode may - * be larger than the designated version. On error, NULL is returned, - * and errno is set to indicate the error. See Exceptions for the - * details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - */ -extern QRcode *QRcode_encodeInput(QRinput *input); - -/** - * Create a symbol from the string. The library automatically parses the input - * string and encodes in a QR Code symbol. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param string input string. It must be NUL terminated. - * @param version version of the symbol. If 0, the library chooses the minimum - * version for the given input data. - * @param level error correction level. - * @param hint tell the library how Japanese Kanji characters should be - * encoded. If QR_MODE_KANJI is given, the library assumes that the - * given string contains Shift-JIS characters and encodes them in - * Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical - * characters will be encoded as is. If you want to embed UTF-8 - * string, choose this. Other mode will cause EINVAL error. - * @param casesensitive case-sensitive(1) or not(0). - * @return an instance of QRcode class. The version of the result QRcode may - * be larger than the designated version. On error, NULL is returned, - * and errno is set to indicate the error. See Exceptions for the - * details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - * @throw ERANGE input data is too large. - */ -extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); - -/** - * Same to QRcode_encodeString(), but encode whole data in 8-bit mode. - * @warning This function is THREAD UNSAFE when pthread is disabled. - */ -extern QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level); - -/** - * Micro QR Code version of QRcode_encodeString(). - * @warning This function is THREAD UNSAFE when pthread is disabled. - */ -extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); - -/** - * Micro QR Code version of QRcode_encodeString8bit(). - * @warning This function is THREAD UNSAFE when pthread is disabled. - */ -extern QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level); - -/** - * Encode byte stream (may include '\0') in 8-bit mode. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param size size of the input data. - * @param data input data. - * @param version version of the symbol. If 0, the library chooses the minimum - * version for the given input data. - * @param level error correction level. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - * @throw ERANGE input data is too large. - */ -extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level); - -/** - * Micro QR Code version of QRcode_encodeData(). - * @warning This function is THREAD UNSAFE when pthread is disabled. - */ -extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level); - -/** - * Free the instance of QRcode class. - * @param qrcode an instance of QRcode class. - */ -extern void QRcode_free(QRcode *qrcode); - -/** - * Create structured symbols from the input data. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param s input data, structured. - * @return a singly-linked list of QRcode. - */ -extern QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s); - -/** - * Create structured symbols from the string. The library automatically parses - * the input string and encodes in a QR Code symbol. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param string input string. It must be NUL terminated. - * @param version version of the symbol. - * @param level error correction level. - * @param hint tell the library how Japanese Kanji characters should be - * encoded. If QR_MODE_KANJI is given, the library assumes that the - * given string contains Shift-JIS characters and encodes them in - * Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical - * characters will be encoded as is. If you want to embed UTF-8 - * string, choose this. Other mode will cause EINVAL error. - * @param casesensitive case-sensitive(1) or not(0). - * @return a singly-linked list of QRcode. On error, NULL is returned, and - * errno is set to indicate the error. See Exceptions for the details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - */ -extern QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); - -/** - * Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode. - * @warning This function is THREAD UNSAFE when pthread is disabled. - */ -extern QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level); - -/** - * Create structured symbols from byte stream (may include '\0'). Wholde data - * are encoded in 8-bit mode. - * @warning This function is THREAD UNSAFE when pthread is disabled. - * @param size size of the input data. - * @param data input dat. - * @param version version of the symbol. - * @param level error correction level. - * @return a singly-linked list of QRcode. On error, NULL is returned, and - * errno is set to indicate the error. See Exceptions for the details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - */ -extern QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level); - -/** - * Return the number of symbols included in a QRcode_List. - * @param qrlist a head entry of a QRcode_List. - * @return number of symbols in the list. - */ -extern int QRcode_List_size(QRcode_List *qrlist); - -/** - * Free the QRcode_List. - * @param qrlist a head entry of a QRcode_List. - */ -extern void QRcode_List_free(QRcode_List *qrlist); - - -/****************************************************************************** - * System utilities - *****************************************************************************/ - -/** - * Return a string that identifies the library version. - * @param major_version major version number - * @param minor_version minor version number - * @param micro_version micro version number - */ -extern void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version); - -/** - * Return a string that identifies the library version. - * @return a string identifies the library version. The string is held by the - * library. Do NOT free it. - */ -extern char *QRcode_APIVersionString(void); - -/** - * @deprecated - */ -#ifndef _MSC_VER -extern void QRcode_clearCache(void) __attribute__ ((deprecated)); -#else -extern void QRcode_clearCache(void); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* QRENCODE_H */ +/** + * qrencode - QR Code encoder + * + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** \mainpage + * Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D + * symbology. + * + * \section encoding Encoding + * + * There are two methods to encode data: encoding a string/data or + * encoding a structured data. + * + * \subsection encoding-string Encoding a string/data + * You can encode a string by calling QRcode_encodeString(). + * The given string is parsed automatically and encoded. If you want to encode + * data that can be represented as a C string style (NUL terminated), you can + * simply use this way. + * + * If the input data contains Kanji (Shift-JIS) characters and you want to + * encode them as Kanji in QR Code, you should give QR_MODE_KANJI as a hint. + * Otherwise, all of non-alphanumeric characters are encoded as 8-bit data. + * If you want to encode a whole string in 8-bit mode, you can use + * QRcode_encodeString8bit() instead. + * + * Please note that a C string can not contain NUL characters. If your data + * contains NUL, you must use QRcode_encodeData(). + * + * \subsection encoding-input Encoding a structured data + * You can construct a structured input data manually. If the structure of the + * input data is known, you can use this method. + * At first, create a ::QRinput object by QRinput_new(). Then add input data + * to the QRinput object by QRinput_append(). Finally call QRcode_encodeInput() + * to encode the QRinput data. + * You can reuse the QRinput object again to encode it in other symbols with + * different parameters. + * + * \section result Result + * The encoded symbol is generated as a ::QRcode object. It will contain its + * version number, the width of the symbol, and an array represents the symbol. + * See ::QRcode for the details. You can free the object by QRcode_free(). + * + * Please note that the version of the result may be larger than specified. + * In such cases, the input data would be too large to be encoded in a + * symbol of the specified version. + * + * \section structured Structured append + * Libqrencode can generate "Structured-appended" symbols that enables to split + * a large data set into mulitple QR codes. A QR code reader concatenates + * multiple QR code symbols into a string. + * Just like QRcode_encodeString(), you can use QRcode_encodeStringStructured() + * to generate structured-appended symbols. This functions returns an instance + * of ::QRcode_List. The returned list is a singly-linked list of QRcode: you + * can retrieve each QR code in this way: + * + * \code + * QRcode_List *qrcodes; + * QRcode_List *entry; + * QRcode *qrcode; + * + * qrcodes = QRcode_encodeStringStructured(...); + * entry = qrcodes; + * while(entry != NULL) { + * qrcode = entry->code; + * // do something + * entry = entry->next; + * } + * QRcode_List_free(entry); + * \endcode + * + * Instead of using auto-parsing functions, you can construct your own + * structured input. At first, instantiate an object of ::QRinput_Struct + * by calling QRinput_Struct_new(). This object can hold multiple ::QRinput, + * and one QR code is generated for a ::QRinput. + * QRinput_Struct_appendInput() appends a ::QRinput to a ::QRinput_Struct + * object. In order to generate structured-appended symbols, it is required to + * embed headers to each symbol. You can use + * QRinput_Struct_insertStructuredAppendHeaders() to insert appropriate + * headers to each symbol. You should call this function just once before + * encoding symbols. + */ + +#ifndef QRENCODE_H +#define QRENCODE_H + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * Encoding mode. + */ +typedef enum { + QR_MODE_NUL = -1, ///< Terminator (NUL character). Internal use only + QR_MODE_NUM = 0, ///< Numeric mode + QR_MODE_AN, ///< Alphabet-numeric mode + QR_MODE_8, ///< 8-bit data mode + QR_MODE_KANJI, ///< Kanji (shift-jis) mode + QR_MODE_STRUCTURE, ///< Internal use only + QR_MODE_ECI, ///< ECI mode + QR_MODE_FNC1FIRST, ///< FNC1, first position + QR_MODE_FNC1SECOND, ///< FNC1, second position +} QRencodeMode; + +/** + * Level of error correction. + */ +typedef enum { + QR_ECLEVEL_L = 0, ///< lowest + QR_ECLEVEL_M, + QR_ECLEVEL_Q, + QR_ECLEVEL_H ///< highest +} QRecLevel; + +/** + * Maximum version (size) of QR-code symbol. + */ +#define QRSPEC_VERSION_MAX 40 + +/** + * Maximum version (size) of QR-code symbol. + */ +#define MQRSPEC_VERSION_MAX 4 + + +#define STATIC_IN_RELEASE static +#define MAJOR_VERSION 4 +#define MINOR_VERSION 1 +#define MICRO_VERSION 1 +#define VERSION "4.1.1" + + + +/****************************************************************************** + * Input data (qrinput.c) + *****************************************************************************/ + +/** + * Singly linked list to contain input strings. An instance of this class + * contains its version and error correction level too. It is required to + * set them by QRinput_setVersion() and QRinput_setErrorCorrectionLevel(), + * or use QRinput_new2() to instantiate an object. + */ +typedef struct _QRinput QRinput; + +/** + * Instantiate an input data object. The version is set to 0 (auto-select) + * and the error correction level is set to QR_ECLEVEL_L. + * @return an input object (initialized). On error, NULL is returned and errno + * is set to indicate the error. + * @throw ENOMEM unable to allocate memory. + */ +extern QRinput *QRinput_new(void); + +/** + * Instantiate an input data object. + * @param version version number. + * @param level Error correction level. + * @return an input object (initialized). On error, NULL is returned and errno + * is set to indicate the error. + * @throw ENOMEM unable to allocate memory for input objects. + * @throw EINVAL invalid arguments. + */ +extern QRinput *QRinput_new2(int version, QRecLevel level); + +/** + * Instantiate an input data object. Object's Micro QR Code flag is set. + * Unlike with full-sized QR Code, version number must be specified (>0). + * @param version version number (1--4). + * @param level Error correction level. + * @return an input object (initialized). On error, NULL is returned and errno + * is set to indicate the error. + * @throw ENOMEM unable to allocate memory for input objects. + * @throw EINVAL invalid arguments. + */ +extern QRinput *QRinput_newMQR(int version, QRecLevel level); + +/** + * Append data to an input object. + * The data is copied and appended to the input object. + * @param input input object. + * @param mode encoding mode. + * @param size size of data (byte). + * @param data a pointer to the memory area of the input data. + * @retval 0 success. + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL input data is invalid. + * + */ +extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data); + +/** + * Append ECI header. + * @param input input object. + * @param ecinum ECI indicator number (0 - 999999) + * @retval 0 success. + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL input data is invalid. + * + */ +extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum); + +/** + * Get current version. + * @param input input object. + * @return current version. + */ +extern int QRinput_getVersion(QRinput *input); + +/** + * Set version of the QR code that is to be encoded. + * This function cannot be applied to Micro QR Code. + * @param input input object. + * @param version version number (0 = auto) + * @retval 0 success. + * @retval -1 invalid argument. + */ +extern int QRinput_setVersion(QRinput *input, int version); + +/** + * Get current error correction level. + * @param input input object. + * @return Current error correcntion level. + */ +extern QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input); + +/** + * Set error correction level of the QR code that is to be encoded. + * This function cannot be applied to Micro QR Code. + * @param input input object. + * @param level Error correction level. + * @retval 0 success. + * @retval -1 invalid argument. + */ +extern int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level); + +/** + * Set version and error correction level of the QR code at once. + * This function is recommened for Micro QR Code. + * @param input input object. + * @param version version number (0 = auto) + * @param level Error correction level. + * @retval 0 success. + * @retval -1 invalid argument. + */ +extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level); + +/** + * Free the input object. + * All of data chunks in the input object are freed too. + * @param input input object. + */ +extern void QRinput_free(QRinput *input); + +/** + * Validate the input data. + * @param mode encoding mode. + * @param size size of data (byte). + * @param data a pointer to the memory area of the input data. + * @retval 0 success. + * @retval -1 invalid arguments. + */ +extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data); + +/** + * Set of QRinput for structured symbols. + */ +typedef struct _QRinput_Struct QRinput_Struct; + +/** + * Instantiate a set of input data object. + * @return an instance of QRinput_Struct. On error, NULL is returned and errno + * is set to indicate the error. + * @throw ENOMEM unable to allocate memory. + */ +extern QRinput_Struct *QRinput_Struct_new(void); + +/** + * Set parity of structured symbols. + * @param s structured input object. + * @param parity parity of s. + */ +extern void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity); + +/** + * Append a QRinput object to the set. QRinput created by QRinput_newMQR() + * will be rejected. + * @warning never append the same QRinput object twice or more. + * @param s structured input object. + * @param input an input object. + * @retval >0 number of input objects in the structure. + * @retval -1 an error occurred. See Exceptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL invalid arguments. + */ +extern int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input); + +/** + * Free all of QRinput in the set. + * @param s a structured input object. + */ +extern void QRinput_Struct_free(QRinput_Struct *s); + +/** + * Split a QRinput to QRinput_Struct. It calculates a parity, set it, then + * insert structured-append headers. QRinput created by QRinput_newMQR() will + * be rejected. + * @param input input object. Version number and error correction level must be + * set. + * @return a set of input data. On error, NULL is returned, and errno is set + * to indicate the error. See Exceptions for the details. + * @throw ERANGE input data is too large. + * @throw EINVAL invalid input data. + * @throw ENOMEM unable to allocate memory. + */ +extern QRinput_Struct *QRinput_splitQRinputToStruct(QRinput *input); + +/** + * Insert structured-append headers to the input structure. It calculates + * a parity and set it if the parity is not set yet. + * @param s input structure + * @retval 0 success. + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory. + */ +extern int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s); + +/** + * Set FNC1-1st position flag. + */ +extern int QRinput_setFNC1First(QRinput *input); + +/** + * Set FNC1-2nd position flag and application identifier. + */ +extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid); + +/****************************************************************************** + * QRcode output (qrencode.c) + *****************************************************************************/ + +/** + * QRcode class. + * Symbol data is represented as an array contains width*width uchars. + * Each uchar represents a module (dot). If the less significant bit of + * the uchar is 1, the corresponding module is black. The other bits are + * meaningless for usual applications, but here its specification is described. + * + * @verbatim + MSB 76543210 LSB + |||||||`- 1=black/0=white + ||||||`-- 1=ecc/0=data code area + |||||`--- format information + ||||`---- version information + |||`----- timing pattern + ||`------ alignment pattern + |`------- finder pattern and separator + `-------- non-data modules (format, timing, etc.) + @endverbatim + */ +typedef struct { + int version; ///< version of the symbol + int width; ///< width of the symbol + unsigned char *data; ///< symbol data +} QRcode; + +/** + * Singly-linked list of QRcode. Used to represent a structured symbols. + * A list is terminated with NULL. + */ +typedef struct _QRcode_List { + QRcode *code; + struct _QRcode_List *next; +} QRcode_List; + +/** + * Create a symbol from the input data. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param input input data. + * @return an instance of QRcode class. The version of the result QRcode may + * be larger than the designated version. On error, NULL is returned, + * and errno is set to indicate the error. See Exceptions for the + * details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + */ +extern QRcode *QRcode_encodeInput(QRinput *input); + +/** + * Create a symbol from the string. The library automatically parses the input + * string and encodes in a QR Code symbol. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param string input string. It must be NUL terminated. + * @param version version of the symbol. If 0, the library chooses the minimum + * version for the given input data. + * @param level error correction level. + * @param hint tell the library how Japanese Kanji characters should be + * encoded. If QR_MODE_KANJI is given, the library assumes that the + * given string contains Shift-JIS characters and encodes them in + * Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical + * characters will be encoded as is. If you want to embed UTF-8 + * string, choose this. Other mode will cause EINVAL error. + * @param casesensitive case-sensitive(1) or not(0). + * @return an instance of QRcode class. The version of the result QRcode may + * be larger than the designated version. On error, NULL is returned, + * and errno is set to indicate the error. See Exceptions for the + * details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + * @throw ERANGE input data is too large. + */ +extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); + +/** + * Same to QRcode_encodeString(), but encode whole data in 8-bit mode. + * @warning This function is THREAD UNSAFE when pthread is disabled. + */ +extern QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level); + +/** + * Micro QR Code version of QRcode_encodeString(). + * @warning This function is THREAD UNSAFE when pthread is disabled. + */ +extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); + +/** + * Micro QR Code version of QRcode_encodeString8bit(). + * @warning This function is THREAD UNSAFE when pthread is disabled. + */ +extern QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level); + +/** + * Encode byte stream (may include '\0') in 8-bit mode. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param size size of the input data. + * @param data input data. + * @param version version of the symbol. If 0, the library chooses the minimum + * version for the given input data. + * @param level error correction level. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + * @throw ERANGE input data is too large. + */ +extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level); + +/** + * Micro QR Code version of QRcode_encodeData(). + * @warning This function is THREAD UNSAFE when pthread is disabled. + */ +extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level); + +/** + * Free the instance of QRcode class. + * @param qrcode an instance of QRcode class. + */ +extern void QRcode_free(QRcode *qrcode); + +/** + * Create structured symbols from the input data. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param s input data, structured. + * @return a singly-linked list of QRcode. + */ +extern QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s); + +/** + * Create structured symbols from the string. The library automatically parses + * the input string and encodes in a QR Code symbol. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param string input string. It must be NUL terminated. + * @param version version of the symbol. + * @param level error correction level. + * @param hint tell the library how Japanese Kanji characters should be + * encoded. If QR_MODE_KANJI is given, the library assumes that the + * given string contains Shift-JIS characters and encodes them in + * Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical + * characters will be encoded as is. If you want to embed UTF-8 + * string, choose this. Other mode will cause EINVAL error. + * @param casesensitive case-sensitive(1) or not(0). + * @return a singly-linked list of QRcode. On error, NULL is returned, and + * errno is set to indicate the error. See Exceptions for the details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + */ +extern QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive); + +/** + * Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode. + * @warning This function is THREAD UNSAFE when pthread is disabled. + */ +extern QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level); + +/** + * Create structured symbols from byte stream (may include '\0'). Wholde data + * are encoded in 8-bit mode. + * @warning This function is THREAD UNSAFE when pthread is disabled. + * @param size size of the input data. + * @param data input dat. + * @param version version of the symbol. + * @param level error correction level. + * @return a singly-linked list of QRcode. On error, NULL is returned, and + * errno is set to indicate the error. See Exceptions for the details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + */ +extern QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level); + +/** + * Return the number of symbols included in a QRcode_List. + * @param qrlist a head entry of a QRcode_List. + * @return number of symbols in the list. + */ +extern int QRcode_List_size(QRcode_List *qrlist); + +/** + * Free the QRcode_List. + * @param qrlist a head entry of a QRcode_List. + */ +extern void QRcode_List_free(QRcode_List *qrlist); + + +/****************************************************************************** + * System utilities + *****************************************************************************/ + +/** + * Return a string that identifies the library version. + * @param major_version major version number + * @param minor_version minor version number + * @param micro_version micro version number + */ +extern void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version); + +/** + * Return a string that identifies the library version. + * @return a string identifies the library version. The string is held by the + * library. Do NOT free it. + */ +extern char *QRcode_APIVersionString(void); + +/** + * @deprecated + */ +#ifndef _MSC_VER +extern void QRcode_clearCache(void) __attribute__ ((deprecated)); +#else +extern void QRcode_clearCache(void); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* QRENCODE_H */ diff --git a/QtQREnCode/qrencode_inner.cpp b/QtQREnCode/qrencode_inner.cpp index 8b13789..d3f5a12 100644 --- a/QtQREnCode/qrencode_inner.cpp +++ b/QtQREnCode/qrencode_inner.cpp @@ -1 +1 @@ - + diff --git a/QtQREnCode/qrencode_inner.h b/QtQREnCode/qrencode_inner.h index 2ea54f5..edac755 100644 --- a/QtQREnCode/qrencode_inner.h +++ b/QtQREnCode/qrencode_inner.h @@ -1,88 +1,88 @@ -/** - * qrencode - QR Code encoder - * - * Header for test use - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QRENCODE_INNER_H -#define QRENCODE_INNER_H - -/** - * This header file includes definitions for test use. - */ - -/****************************************************************************** - * Raw code - *****************************************************************************/ - -typedef struct { - int dataLength; - int eccLength; - unsigned char *data; - unsigned char *ecc; -} RSblock; - -typedef struct { - int version; - int dataLength; - int eccLength; - unsigned char *datacode; - unsigned char *ecccode; - int b1; - int blocks; - RSblock *rsblock; - int count; -} QRRawCode; - -extern QRRawCode *QRraw_new(QRinput *input); -extern unsigned char QRraw_getCode(QRRawCode *raw); -extern void QRraw_free(QRRawCode *raw); - -/****************************************************************************** - * Raw code for Micro QR Code - *****************************************************************************/ - -typedef struct { - int version; - int dataLength; - int eccLength; - unsigned char *datacode; - unsigned char *ecccode; - RSblock *rsblock; - int oddbits; - int count; -} MQRRawCode; - -extern MQRRawCode *MQRraw_new(QRinput *input); -extern unsigned char MQRraw_getCode(MQRRawCode *raw); -extern void MQRraw_free(MQRRawCode *raw); - -/****************************************************************************** - * Frame filling - *****************************************************************************/ -extern unsigned char *FrameFiller_test(int version); -extern unsigned char *FrameFiller_testMQR(int version); - -/****************************************************************************** - * QR-code encoding - *****************************************************************************/ -extern QRcode *QRcode_encodeMask(QRinput *input, int mask); -extern QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask); -extern QRcode *QRcode_new(int version, int width, unsigned char *data); - -#endif /* QRENCODE_INNER_H */ +/** + * qrencode - QR Code encoder + * + * Header for test use + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QRENCODE_INNER_H +#define QRENCODE_INNER_H + +/** + * This header file includes definitions for test use. + */ + +/****************************************************************************** + * Raw code + *****************************************************************************/ + +typedef struct { + int dataLength; + int eccLength; + unsigned char *data; + unsigned char *ecc; +} RSblock; + +typedef struct { + int version; + int dataLength; + int eccLength; + unsigned char *datacode; + unsigned char *ecccode; + int b1; + int blocks; + RSblock *rsblock; + int count; +} QRRawCode; + +extern QRRawCode *QRraw_new(QRinput *input); +extern unsigned char QRraw_getCode(QRRawCode *raw); +extern void QRraw_free(QRRawCode *raw); + +/****************************************************************************** + * Raw code for Micro QR Code + *****************************************************************************/ + +typedef struct { + int version; + int dataLength; + int eccLength; + unsigned char *datacode; + unsigned char *ecccode; + RSblock *rsblock; + int oddbits; + int count; +} MQRRawCode; + +extern MQRRawCode *MQRraw_new(QRinput *input); +extern unsigned char MQRraw_getCode(MQRRawCode *raw); +extern void MQRraw_free(MQRRawCode *raw); + +/****************************************************************************** + * Frame filling + *****************************************************************************/ +extern unsigned char *FrameFiller_test(int version); +extern unsigned char *FrameFiller_testMQR(int version); + +/****************************************************************************** + * QR-code encoding + *****************************************************************************/ +extern QRcode *QRcode_encodeMask(QRinput *input, int mask); +extern QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask); +extern QRcode *QRcode_new(int version, int width, unsigned char *data); + +#endif /* QRENCODE_INNER_H */ diff --git a/QtQREnCode/qrinput.c b/QtQREnCode/qrinput.c index 34bedc2..dcf11ab 100644 --- a/QtQREnCode/qrinput.c +++ b/QtQREnCode/qrinput.c @@ -1,1639 +1,1639 @@ -/* - * qrencode - QR Code encoder - * - * Input data chunk class - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "qrencode.h" -#include "qrspec.h" -#include "mqrspec.h" -#include "bitstream.h" -#include "qrinput.h" - -/****************************************************************************** - * Utilities - *****************************************************************************/ -int QRinput_isSplittableMode(QRencodeMode mode) -{ - return (mode >= QR_MODE_NUM && mode <= QR_MODE_KANJI); -} - -/****************************************************************************** - * Entry of input data - *****************************************************************************/ - -static QRinput_List *QRinput_List_newEntry(QRencodeMode mode, int size, const unsigned char *data) -{ - QRinput_List *entry; - - if(QRinput_check(mode, size, data)) { - errno = EINVAL; - return NULL; - } - - entry = (QRinput_List *)malloc(sizeof(QRinput_List)); - if(entry == NULL) return NULL; - - entry->mode = mode; - entry->size = size; - entry->data = NULL; - if(size > 0) { - entry->data = (unsigned char *)malloc((size_t)size); - if(entry->data == NULL) { - free(entry); - return NULL; - } - memcpy(entry->data, data, (size_t)size); - } - entry->bstream = NULL; - entry->next = NULL; - - return entry; -} - -static void QRinput_List_freeEntry(QRinput_List *entry) -{ - if(entry != NULL) { - free(entry->data); - BitStream_free(entry->bstream); - free(entry); - } -} - -static QRinput_List *QRinput_List_dup(QRinput_List *entry) -{ - QRinput_List *n; - - n = (QRinput_List *)malloc(sizeof(QRinput_List)); - if(n == NULL) return NULL; - - n->mode = entry->mode; - n->size = entry->size; - n->data = (unsigned char *)malloc((size_t)n->size); - if(n->data == NULL) { - free(n); - return NULL; - } - memcpy(n->data, entry->data, (size_t)entry->size); - n->bstream = NULL; - n->next = NULL; - - return n; -} - -/****************************************************************************** - * Input Data - *****************************************************************************/ - -QRinput *QRinput_new(void) -{ - return QRinput_new2(0, QR_ECLEVEL_L); -} - -QRinput *QRinput_new2(int version, QRecLevel level) -{ - QRinput *input; - - if(version < 0 || version > QRSPEC_VERSION_MAX || level < 0 || level > QR_ECLEVEL_H) { - errno = EINVAL; - return NULL; - } - - input = (QRinput *)malloc(sizeof(QRinput)); - if(input == NULL) return NULL; - - input->head = NULL; - input->tail = NULL; - input->version = version; - input->level = level; - input->mqr = 0; - input->fnc1 = 0; - - return input; -} - -QRinput *QRinput_newMQR(int version, QRecLevel level) -{ - QRinput *input; - - if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID; - if((MQRspec_getECCLength(version, level) == 0)) goto INVALID; - - input = QRinput_new2(version, level); - if(input == NULL) return NULL; - - input->mqr = 1; - - return input; - -INVALID: - errno = EINVAL; - return NULL; -} - -int QRinput_getVersion(QRinput *input) -{ - return input->version; -} - -int QRinput_setVersion(QRinput *input, int version) -{ - if(input->mqr || version < 0 || version > QRSPEC_VERSION_MAX) { - errno = EINVAL; - return -1; - } - - input->version = version; - - return 0; -} - -QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input) -{ - return input->level; -} - -int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level) -{ - if(input->mqr || level > QR_ECLEVEL_H) { - errno = EINVAL; - return -1; - } - - input->level = level; - - return 0; -} - -int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level) -{ - if(input->mqr) { - if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID; - if((MQRspec_getECCLength(version, level) == 0)) goto INVALID; - } else { - if(version < 0 || version > QRSPEC_VERSION_MAX) goto INVALID; - if(level > QR_ECLEVEL_H) goto INVALID; - } - - input->version = version; - input->level = level; - - return 0; - -INVALID: - errno = EINVAL; - return -1; -} - -static void QRinput_appendEntry(QRinput *input, QRinput_List *entry) -{ - if(input->tail == NULL) { - input->head = entry; - input->tail = entry; - } else { - input->tail->next = entry; - input->tail = entry; - } - entry->next = NULL; -} - -int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data) -{ - QRinput_List *entry; - - entry = QRinput_List_newEntry(mode, size, data); - if(entry == NULL) { - return -1; - } - - QRinput_appendEntry(input, entry); - - return 0; -} - -/** - * Insert a structured-append header to the head of the input data. - * @param input input data. - * @param size number of structured symbols. - * @param number index number of the symbol. (1 <= number <= size) - * @param parity parity among input data. (NOTE: each symbol of a set of structured symbols has the same parity data) - * @retval 0 success. - * @retval -1 error occurred and errno is set to indeicate the error. See Execptions for the details. - * @throw EINVAL invalid parameter. - * @throw ENOMEM unable to allocate memory. - */ -STATIC_IN_RELEASE int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int number, unsigned char parity) -{ - QRinput_List *entry; - unsigned char buf[3]; - - if(size > MAX_STRUCTURED_SYMBOLS) { - errno = EINVAL; - return -1; - } - if(number <= 0 || number > size) { - errno = EINVAL; - return -1; - } - - buf[0] = (unsigned char)size; - buf[1] = (unsigned char)number; - buf[2] = parity; - entry = QRinput_List_newEntry(QR_MODE_STRUCTURE, 3, buf); - if(entry == NULL) { - return -1; - } - - entry->next = input->head; - input->head = entry; - - return 0; -} - -int QRinput_appendECIheader(QRinput *input, unsigned int ecinum) -{ - unsigned char data[4]; - - if(ecinum > 999999) { - errno = EINVAL; - return -1; - } - - /* We manually create byte array of ecinum because - (unsigned char *)&ecinum may cause bus error on some architectures, */ - data[0] = ecinum & 0xff; - data[1] = (ecinum >> 8) & 0xff; - data[2] = (ecinum >> 16) & 0xff; - data[3] = (ecinum >> 24) & 0xff; - return QRinput_append(input, QR_MODE_ECI, 4, data); -} - -void QRinput_free(QRinput *input) -{ - QRinput_List *list, *next; - - if(input != NULL) { - list = input->head; - while(list != NULL) { - next = list->next; - QRinput_List_freeEntry(list); - list = next; - } - free(input); - } -} - -static unsigned char QRinput_calcParity(QRinput *input) -{ - unsigned char parity = 0; - QRinput_List *list; - int i; - - list = input->head; - while(list != NULL) { - if(list->mode != QR_MODE_STRUCTURE) { - for(i = list->size-1; i >= 0; i--) { - parity ^= list->data[i]; - } - } - list = list->next; - } - - return parity; -} - -QRinput *QRinput_dup(QRinput *input) -{ - QRinput *n; - QRinput_List *list, *e; - - if(input->mqr) { - n = QRinput_newMQR(input->version, input->level); - } else { - n = QRinput_new2(input->version, input->level); - } - if(n == NULL) return NULL; - - list = input->head; - while(list != NULL) { - e = QRinput_List_dup(list); - if(e == NULL) { - QRinput_free(n); - return NULL; - } - QRinput_appendEntry(n, e); - list = list->next; - } - - return n; -} - -/****************************************************************************** - * Numeric data - *****************************************************************************/ - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeNum(int size, const char *data) -{ - int i; - - for(i = 0; i < size; i++) { - if(data[i] < '0' || data[i] > '9') - return -1; - } - - return 0; -} - -/** - * Estimate the length of the encoded bit stream of numeric data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsModeNum(int size) -{ - int w; - int bits; - - w = size / 3; - bits = w * 10; - switch(size - w * 3) { - case 1: - bits += 4; - break; - case 2: - bits += 7; - break; - default: - break; - } - - return bits; -} - -/** - * Convert the number data and append to a bit stream. - * @param entry - * @param mqr - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - */ -static int QRinput_encodeModeNum(QRinput_List *entry, BitStream *bstream, int version, int mqr) -{ - int words, i, ret; - unsigned int val; - - if(mqr) { - if(version > 1) { - ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_NUM); - if(ret < 0) return -1; - } - ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_NUM, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } else { - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_NUM); - if(ret < 0) return -1; - - ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_NUM, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } - - words = entry->size / 3; - for(i = 0; i < words; i++) { - val = (unsigned int)(entry->data[i*3 ] - '0') * 100; - val += (unsigned int)(entry->data[i*3+1] - '0') * 10; - val += (unsigned int)(entry->data[i*3+2] - '0'); - - ret = BitStream_appendNum(bstream, 10, val); - if(ret < 0) return -1; - } - - if(entry->size - words * 3 == 1) { - val = (unsigned int)(entry->data[words*3] - '0'); - ret = BitStream_appendNum(bstream, 4, val); - if(ret < 0) return -1; - } else if(entry->size - words * 3 == 2) { - val = (unsigned int)(entry->data[words*3 ] - '0') * 10; - val += (unsigned int)(entry->data[words*3+1] - '0'); - ret = BitStream_appendNum(bstream, 7, val); - if(ret < 0) return -1; - } - - return 0; -} - -/****************************************************************************** - * Alphabet-numeric data - *****************************************************************************/ - -const signed char QRinput_anTable[128] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeAn(int size, const char *data) -{ - int i; - - for(i = 0; i < size; i++) { - if(QRinput_lookAnTable(data[i]) < 0) - return -1; - } - - return 0; -} - -/** - * Estimate the length of the encoded bit stream of alphabet-numeric data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsModeAn(int size) -{ - int w; - int bits; - - w = size / 2; - bits = w * 11; - if(size & 1) { - bits += 6; - } - - return bits; -} - -/** - * Convert the alphabet-numeric data and append to a bit stream. - * @param entry - * @param mqr - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL invalid version. - */ -static int QRinput_encodeModeAn(QRinput_List *entry, BitStream *bstream, int version, int mqr) -{ - int words, i, ret; - unsigned int val; - - if(mqr) { - if(version < 2) { - errno = ERANGE; - return -1; - } - ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_AN); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_AN, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } else { - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_AN); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_AN, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } - - words = entry->size / 2; - for(i = 0; i < words; i++) { - val = (unsigned int)QRinput_lookAnTable(entry->data[i*2 ]) * 45; - val += (unsigned int)QRinput_lookAnTable(entry->data[i*2+1]); - - ret = BitStream_appendNum(bstream, 11, val); - if(ret < 0) return -1; - } - - if(entry->size & 1) { - val = (unsigned int)QRinput_lookAnTable(entry->data[words * 2]); - - ret = BitStream_appendNum(bstream, 6, val); - if(ret < 0) return -1; - } - - return 0; -} - -/****************************************************************************** - * 8 bit data - *****************************************************************************/ - -/** - * Estimate the length of the encoded bit stream of 8 bit data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsMode8(int size) -{ - return size * 8; -} - -/** - * Convert the 8bits data and append to a bit stream. - * @param entry - * @param mqr - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - */ -static int QRinput_encodeMode8(QRinput_List *entry, BitStream *bstream, int version, int mqr) -{ - int ret; - - if(mqr) { - if(version < 3) { - errno = ERANGE; - return -1; - } - ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_8); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_8, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } else { - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_8); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_8, version), (unsigned int)entry->size); - if(ret < 0) return -1; - } - - ret = BitStream_appendBytes(bstream, (size_t)entry->size, entry->data); - if(ret < 0) return -1; - - return 0; -} - - -/****************************************************************************** - * Kanji data - *****************************************************************************/ - -/** - * Estimate the length of the encoded bit stream of kanji data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsModeKanji(int size) -{ - return (size / 2) * 13; -} - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeKanji(int size, const unsigned char *data) -{ - int i; - unsigned int val; - - if(size & 1) - return -1; - - for(i = 0; i < size; i+=2) { - val = ((unsigned int)data[i] << 8) | data[i+1]; - if(val < 0x8140 || (val > 0x9ffc && val < 0xe040) || val > 0xebbf) { - return -1; - } - } - - return 0; -} - -/** - * Convert the kanji data and append to a bit stream. - * @param entry - * @param mqr - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL invalid version. - */ -static int QRinput_encodeModeKanji(QRinput_List *entry, BitStream *bstream, int version, int mqr) -{ - int ret, i; - unsigned int val, h; - - if(mqr) { - if(version < 2) { - errno = ERANGE; - return -1; - } - ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_KANJI); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_KANJI, version), (unsigned int)entry->size/2); - if(ret < 0) return -1; - } else { - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_KANJI); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_KANJI, version), (unsigned int)entry->size/2); - if(ret < 0) return -1; - } - - for(i = 0; i < entry->size; i+=2) { - val = ((unsigned int)entry->data[i] << 8) | entry->data[i+1]; - if(val <= 0x9ffc) { - val -= 0x8140; - } else { - val -= 0xc140; - } - h = (val >> 8) * 0xc0; - val = (val & 0xff) + h; - - ret = BitStream_appendNum(bstream, 13, val); - if(ret < 0) return -1; - } - - return 0; -} - -/****************************************************************************** - * Structured Symbol - *****************************************************************************/ - -/** - * Convert a structure symbol code and append to a bit stream. - * @param entry - * @param mqr - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw EINVAL invalid entry. - */ -static int QRinput_encodeModeStructure(QRinput_List *entry, BitStream *bstream, int mqr) -{ - int ret; - - if(mqr) { - errno = EINVAL; - return -1; - } - - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_STRUCTURE); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, 4, entry->data[1] - 1U); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, 4, entry->data[0] - 1U); - if(ret < 0) return -1; - ret = BitStream_appendNum(bstream, 8, entry->data[2]); - if(ret < 0) return -1; - - return 0; -} - -/****************************************************************************** - * FNC1 - *****************************************************************************/ - -static int QRinput_checkModeFNC1Second(int size) -{ - if(size != 1) return -1; - - /* No data check required. */ - - return 0; -} - -static int QRinput_encodeModeFNC1Second(QRinput_List *entry, BitStream *bstream) -{ - int ret; - - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_FNC1SECOND); - if(ret < 0) return -1; - - ret = BitStream_appendBytes(bstream, 1, entry->data); - if(ret < 0) return -1; - - return 0; -} - -/****************************************************************************** - * ECI header - *****************************************************************************/ -static unsigned int QRinput_decodeECIfromByteArray(unsigned char *data) -{ - int i; - unsigned int ecinum; - - ecinum = 0; - for(i = 0; i < 4; i++) { - ecinum = ecinum << 8; - ecinum |= data[3-i]; - } - - return ecinum; -} - -static int QRinput_estimateBitsModeECI(unsigned char *data) -{ - unsigned int ecinum; - - ecinum = QRinput_decodeECIfromByteArray(data); - - /* See Table 4 of JISX 0510:2004 pp.17. */ - if(ecinum < 128) { - return MODE_INDICATOR_SIZE + 8; - } else if(ecinum < 16384) { - return MODE_INDICATOR_SIZE + 16; - } else { - return MODE_INDICATOR_SIZE + 24; - } -} - -static int QRinput_encodeModeECI(QRinput_List *entry, BitStream *bstream) -{ - int ret, words; - unsigned int ecinum, code; - - ecinum = QRinput_decodeECIfromByteArray(entry->data); - - /* See Table 4 of JISX 0510:2004 pp.17. */ - if(ecinum < 128) { - words = 1; - code = ecinum; - } else if(ecinum < 16384) { - words = 2; - code = 0x8000 + ecinum; - } else { - words = 3; - code = 0xc0000 + ecinum; - } - - ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_ECI); - if(ret < 0) return -1; - - ret = BitStream_appendNum(bstream, (size_t)words * 8, code); - if(ret < 0) return -1; - - return 0; -} - -/****************************************************************************** - * Validation - *****************************************************************************/ - -int QRinput_check(QRencodeMode mode, int size, const unsigned char *data) -{ - if((mode == QR_MODE_FNC1FIRST && size < 0) || size <= 0) return -1; - - switch(mode) { - case QR_MODE_NUM: - return QRinput_checkModeNum(size, (const char *)data); - case QR_MODE_AN: - return QRinput_checkModeAn(size, (const char *)data); - case QR_MODE_KANJI: - return QRinput_checkModeKanji(size, data); - case QR_MODE_8: - return 0; - case QR_MODE_STRUCTURE: - return 0; - case QR_MODE_ECI: - return 0; - case QR_MODE_FNC1FIRST: - return 0; - case QR_MODE_FNC1SECOND: - return QRinput_checkModeFNC1Second(size); - case QR_MODE_NUL: - break; - } - - return -1; -} - -/****************************************************************************** - * Estimation of the bit length - *****************************************************************************/ - -/** - * Estimate the length of the encoded bit stream on the current version. - * @param entry - * @param version version of the symbol - * @param mqr - * @return number of bits - */ -static int QRinput_estimateBitStreamSizeOfEntry(QRinput_List *entry, int version, int mqr) -{ - int bits = 0; - int l, m; - int num; - - if(version == 0) version = 1; - - switch(entry->mode) { - case QR_MODE_NUM: - bits = QRinput_estimateBitsModeNum(entry->size); - break; - case QR_MODE_AN: - bits = QRinput_estimateBitsModeAn(entry->size); - break; - case QR_MODE_8: - bits = QRinput_estimateBitsMode8(entry->size); - break; - case QR_MODE_KANJI: - bits = QRinput_estimateBitsModeKanji(entry->size); - break; - case QR_MODE_STRUCTURE: - return STRUCTURE_HEADER_SIZE; - case QR_MODE_ECI: - bits = QRinput_estimateBitsModeECI(entry->data); - break; - case QR_MODE_FNC1FIRST: - return MODE_INDICATOR_SIZE; - case QR_MODE_FNC1SECOND: - return MODE_INDICATOR_SIZE + 8; - default: - return 0; - } - - if(mqr) { - l = MQRspec_lengthIndicator(entry->mode, version); - m = version - 1; - bits += l + m; - } else { - l = QRspec_lengthIndicator(entry->mode, version); - m = 1 << l; - if(entry->mode == QR_MODE_KANJI) { - num = (entry->size/2 + m - 1) / m; - } else { - num = (entry->size + m - 1) / m; - } - - bits += num * (MODE_INDICATOR_SIZE + l); - } - - return bits; -} - -/** - * Estimate the length of the encoded bit stream of the data. - * @param input input data - * @param version version of the symbol - * @return number of bits - */ -STATIC_IN_RELEASE int QRinput_estimateBitStreamSize(QRinput *input, int version) -{ - QRinput_List *list; - int bits = 0; - - list = input->head; - while(list != NULL) { - bits += QRinput_estimateBitStreamSizeOfEntry(list, version, input->mqr); - list = list->next; - } - - return bits; -} - -/** - * Estimate the required version number of the symbol. - * @param input input data - * @return required version number or -1 for failure. - */ -STATIC_IN_RELEASE int QRinput_estimateVersion(QRinput *input) -{ - int bits; - int version, prev; - - version = 0; - do { - prev = version; - bits = QRinput_estimateBitStreamSize(input, prev); - version = QRspec_getMinimumVersion((bits + 7) / 8, input->level); - if(prev == 0 && version > 1) { - version--; - } - } while (version > prev); - - return version; -} - -/** - * Return required length in bytes for specified mode, version and bits. - * @param mode - * @param version - * @param bits - * @return required length of code words in bytes. - */ -STATIC_IN_RELEASE int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits) -{ - int payload, size, chunks, remain, maxsize; - - payload = bits - 4 - QRspec_lengthIndicator(mode, version); - switch(mode) { - case QR_MODE_NUM: - chunks = payload / 10; - remain = payload - chunks * 10; - size = chunks * 3; - if(remain >= 7) { - size += 2; - } else if(remain >= 4) { - size += 1; - } - break; - case QR_MODE_AN: - chunks = payload / 11; - remain = payload - chunks * 11; - size = chunks * 2; - if(remain >= 6) size++; - break; - case QR_MODE_8: - size = payload / 8; - break; - case QR_MODE_KANJI: - size = (payload / 13) * 2; - break; - case QR_MODE_STRUCTURE: - size = payload / 8; - break; - default: - size = 0; - break; - } - maxsize = QRspec_maximumWords(mode, version); - if(size < 0) size = 0; - if(maxsize > 0 && size > maxsize) size = maxsize; - - return size; -} - -/****************************************************************************** - * Data conversion - *****************************************************************************/ - -/** - * Convert the input data in the data chunk and append to a bit stream. - * @param entry - * @param bstream - * @return number of bits (>0) or -1 for failure. - */ -static int QRinput_encodeBitStream(QRinput_List *entry, BitStream *bstream, int version, int mqr) -{ - int words, ret; - QRinput_List *st1 = NULL, *st2 = NULL; - int prevsize; - - prevsize = (int)BitStream_size(bstream); - - if(mqr) { - words = MQRspec_maximumWords(entry->mode, version); - } else { - words = QRspec_maximumWords(entry->mode, version); - } - if(words != 0 && entry->size > words) { - st1 = QRinput_List_newEntry(entry->mode, words, entry->data); - if(st1 == NULL) goto ABORT; - st2 = QRinput_List_newEntry(entry->mode, entry->size - words, &entry->data[words]); - if(st2 == NULL) goto ABORT; - - ret = QRinput_encodeBitStream(st1, bstream, version, mqr); - if(ret < 0) goto ABORT; - ret = QRinput_encodeBitStream(st2, bstream, version, mqr); - if(ret < 0) goto ABORT; - - QRinput_List_freeEntry(st1); - QRinput_List_freeEntry(st2); - } else { - ret = 0; - switch(entry->mode) { - case QR_MODE_NUM: - ret = QRinput_encodeModeNum(entry, bstream, version, mqr); - break; - case QR_MODE_AN: - ret = QRinput_encodeModeAn(entry, bstream, version, mqr); - break; - case QR_MODE_8: - ret = QRinput_encodeMode8(entry, bstream, version, mqr); - break; - case QR_MODE_KANJI: - ret = QRinput_encodeModeKanji(entry, bstream, version, mqr); - break; - case QR_MODE_STRUCTURE: - ret = QRinput_encodeModeStructure(entry, bstream, mqr); - break; - case QR_MODE_ECI: - ret = QRinput_encodeModeECI(entry, bstream); - break; - case QR_MODE_FNC1SECOND: - ret = QRinput_encodeModeFNC1Second(entry, bstream); - break; - default: - break; - } - if(ret < 0) return -1; - } - - return (int)BitStream_size(bstream) - prevsize; -ABORT: - QRinput_List_freeEntry(st1); - QRinput_List_freeEntry(st2); - return -1; -} - -/** - * Convert the input data to a bit stream. - * @param input input data. - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - */ -static int QRinput_createBitStream(QRinput *input, BitStream *bstream) -{ - QRinput_List *list; - int bits, total = 0; - - list = input->head; - while(list != NULL) { - bits = QRinput_encodeBitStream(list, bstream, input->version, input->mqr); - if(bits < 0) return -1; - total += bits; - list = list->next; - } - - return total; -} - -/** - * Convert the input data to a bit stream. - * When the version number is given and that is not sufficient, it is increased - * automatically. - * @param input input data. - * @param bstream where the converted data is stored. - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ENOMEM unable to allocate memory. - * @throw ERANGE input data is too large. - */ -static int QRinput_convertData(QRinput *input, BitStream *bstream) -{ - int bits; - int ver; - - ver = QRinput_estimateVersion(input); - if(ver > QRinput_getVersion(input)) { - QRinput_setVersion(input, ver); - } - - for(;;) { - BitStream_reset(bstream); - bits = QRinput_createBitStream(input, bstream); - if(bits < 0) return -1; - ver = QRspec_getMinimumVersion((bits + 7) / 8, input->level); - if(ver > QRinput_getVersion(input)) { - QRinput_setVersion(input, ver); - } else { - break; - } - } - - return 0; -} - -/** - * Append padding bits for the input data. - * @param bstream Bitstream to be appended. - * @param input input data. - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ERANGE input data is too large. - * @throw ENOMEM unable to allocate memory. - */ -static int QRinput_appendPaddingBit(BitStream *bstream, QRinput *input) -{ - int bits, maxbits, words, maxwords, i, ret; - int padlen; - - bits = (int)BitStream_size(bstream); - maxwords = QRspec_getDataLength(input->version, input->level); - maxbits = maxwords * 8; - - if(maxbits < bits) { - errno = ERANGE; - return -1; - } - if(maxbits == bits) { - return 0; - } - - if(maxbits - bits <= 4) { - return (int)BitStream_appendNum(bstream, (size_t)(maxbits - bits), 0); - } - - words = (bits + 4 + 7) / 8; - - ret = (int)BitStream_appendNum(bstream, (size_t)(words * 8 - bits), 0); - if(ret < 0) return ret; - - padlen = maxwords - words; - if(padlen > 0) { - for(i = 0; i < padlen; i++) { - ret = (int)BitStream_appendNum(bstream, 8, (i&1)?0x11:0xec); - if(ret < 0) { - return ret; - } - } - } - - return 0; -} - -/** - * Append padding bits for the input data - Micro QR Code version. - * @param bstream Bitstream to be appended. - * @param input input data. - * @retval 0 success - * @retval -1 an error occurred and errno is set to indeicate the error. - * See Execptions for the details. - * @throw ERANGE input data is too large. - * @throw ENOMEM unable to allocate memory. - */ -static int QRinput_appendPaddingBitMQR(BitStream *bstream, QRinput *input) -{ - int bits, maxbits, words, maxwords, i, ret, termbits; - int padlen; - - bits = (int)BitStream_size(bstream); - maxbits = MQRspec_getDataLengthBit(input->version, input->level); - maxwords = maxbits / 8; - - if(maxbits < bits) { - errno = ERANGE; - return -1; - } - if(maxbits == bits) { - return 0; - } - - termbits = input->version * 2 + 1; - - if(maxbits - bits <= termbits) { - return (int)BitStream_appendNum(bstream, (size_t)(maxbits - bits), 0); - } - - bits += termbits; - - words = (bits + 7) / 8; - if(maxbits - words * 8 > 0) { - termbits += words * 8 - bits; - if(words == maxwords) termbits += maxbits - words * 8; - } else { - termbits += words * 8 - bits; - } - ret = (int)BitStream_appendNum(bstream, (size_t)termbits, 0); - if(ret < 0) return ret; - - padlen = maxwords - words; - if(padlen > 0) { - for(i = 0; i < padlen; i++) { - ret = (int)BitStream_appendNum(bstream, 8, (i&1)?0x11:0xec); - if(ret < 0) return ret; - } - termbits = maxbits - maxwords * 8; - if(termbits > 0) { - ret = (int)BitStream_appendNum(bstream, (size_t)termbits, 0); - if(ret < 0) return ret; - } - } - - return 0; -} - -static int QRinput_insertFNC1Header(QRinput *input) -{ - QRinput_List *entry = NULL; - - if(input->fnc1 == 1) { - entry = QRinput_List_newEntry(QR_MODE_FNC1FIRST, 0, NULL); - } else if(input->fnc1 == 2) { - entry = QRinput_List_newEntry(QR_MODE_FNC1SECOND, 1, &(input->appid)); - } - if(entry == NULL) { - return -1; - } - - if(input->head->mode != QR_MODE_STRUCTURE && input->head->mode != QR_MODE_ECI) { - entry->next = input->head; - input->head = entry; - } else { - entry->next = input->head->next; - input->head->next = entry; - } - - return 0; -} - -/** - * Merge all bit streams in the input data. - * @param input input data. - * @return merged bit stream - */ - -STATIC_IN_RELEASE int QRinput_mergeBitStream(QRinput *input, BitStream *bstream) -{ - if(input->mqr) { - if(QRinput_createBitStream(input, bstream) < 0) { - return -1; - } - } else { - if(input->fnc1) { - if(QRinput_insertFNC1Header(input) < 0) { - return -1; - } - } - if(QRinput_convertData(input, bstream) < 0) { - return -1; - } - } - - return 0; -} - -/** - * Merge all bit streams in the input data and append padding bits - * @param input input data. - * @return padded merged bit stream - */ - -STATIC_IN_RELEASE int QRinput_getBitStream(QRinput *input, BitStream *bstream) -{ - int ret; - - ret = QRinput_mergeBitStream(input, bstream); - if(ret < 0) return -1; - - if(input->mqr) { - ret = QRinput_appendPaddingBitMQR(bstream, input); - } else { - ret = QRinput_appendPaddingBit(bstream, input); - } - if(ret < 0) return -1; - - return 0; -} - -/** - * Pack all bit streams padding bits into a byte array. - * @param input input data. - * @return padded merged byte stream - */ - -unsigned char *QRinput_getByteStream(QRinput *input) -{ - BitStream *bstream; - unsigned char *array; - int ret; - - bstream = BitStream_new(); - if(bstream == NULL) { - return NULL; - } - - ret = QRinput_getBitStream(input, bstream); - if(ret < 0) { - BitStream_free(bstream); - return NULL; - } - array = BitStream_toByte(bstream); - BitStream_free(bstream); - - return array; -} - -/****************************************************************************** - * Structured input data - *****************************************************************************/ - -static QRinput_InputList *QRinput_InputList_newEntry(QRinput *input) -{ - QRinput_InputList *entry; - - entry = (QRinput_InputList *)malloc(sizeof(QRinput_InputList)); - if(entry == NULL) return NULL; - - entry->input = input; - entry->next = NULL; - - return entry; -} - -static void QRinput_InputList_freeEntry(QRinput_InputList *entry) -{ - if(entry != NULL) { - QRinput_free(entry->input); - free(entry); - } -} - -QRinput_Struct *QRinput_Struct_new(void) -{ - QRinput_Struct *s; - - s = (QRinput_Struct *)malloc(sizeof(QRinput_Struct)); - if(s == NULL) return NULL; - - s->size = 0; - s->parity = -1; - s->head = NULL; - s->tail = NULL; - - return s; -} - -void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity) -{ - s->parity = (int)parity; -} - -int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input) -{ - QRinput_InputList *e; - - if(input->mqr) { - errno = EINVAL; - return -1; - } - - e = QRinput_InputList_newEntry(input); - if(e == NULL) return -1; - - s->size++; - if(s->tail == NULL) { - s->head = e; - s->tail = e; - } else { - s->tail->next = e; - s->tail = e; - } - - return s->size; -} - -void QRinput_Struct_free(QRinput_Struct *s) -{ - QRinput_InputList *list, *next; - - if(s != NULL) { - list = s->head; - while(list != NULL) { - next = list->next; - QRinput_InputList_freeEntry(list); - list = next; - } - free(s); - } -} - -static unsigned char QRinput_Struct_calcParity(QRinput_Struct *s) -{ - QRinput_InputList *list; - unsigned char parity = 0; - - list = s->head; - while(list != NULL) { - parity ^= QRinput_calcParity(list->input); - list = list->next; - } - - QRinput_Struct_setParity(s, parity); - - return parity; -} - -static int QRinput_List_shrinkEntry(QRinput_List *entry, int bytes) -{ - unsigned char *data; - - data = (unsigned char *)malloc((size_t)bytes); - if(data == NULL) return -1; - - memcpy(data, entry->data, (size_t)bytes); - free(entry->data); - entry->data = data; - entry->size = bytes; - - return 0; -} - -STATIC_IN_RELEASE int QRinput_splitEntry(QRinput_List *entry, int bytes) -{ - QRinput_List *e; - int ret; - - e = QRinput_List_newEntry(entry->mode, entry->size - bytes, entry->data + bytes); - if(e == NULL) { - return -1; - } - - ret = QRinput_List_shrinkEntry(entry, bytes); - if(ret < 0) { - QRinput_List_freeEntry(e); - return -1; - } - - e->next = entry->next; - entry->next = e; - - return 0; -} - -QRinput_Struct *QRinput_splitQRinputToStruct(QRinput *input) -{ - QRinput *p = NULL; - QRinput_Struct *s = NULL; - int bits, maxbits, nextbits, bytes, ret; - QRinput_List *list, *next, *prev; - BitStream *bstream = NULL; - - if(input->mqr) { - errno = EINVAL; - return NULL; - } - - s = QRinput_Struct_new(); - if(s == NULL) return NULL; - - input = QRinput_dup(input); - if(input == NULL) { - QRinput_Struct_free(s); - return NULL; - } - - QRinput_Struct_setParity(s, QRinput_calcParity(input)); - maxbits = QRspec_getDataLength(input->version, input->level) * 8 - STRUCTURE_HEADER_SIZE; - - if(maxbits <= 0) goto ABORT; - - bstream = BitStream_new(); - if(bstream == NULL) goto ABORT; - - bits = 0; - list = input->head; - prev = NULL; - while(list != NULL) { - nextbits = QRinput_estimateBitStreamSizeOfEntry(list, input->version, input->mqr); - if(bits + nextbits <= maxbits) { - BitStream_reset(bstream); - ret = QRinput_encodeBitStream(list, bstream, input->version, input->mqr); - if(ret < 0) goto ABORT; - bits += ret; - prev = list; - list = list->next; - } else { - bytes = QRinput_lengthOfCode(list->mode, input->version, maxbits - bits); - p = QRinput_new2(input->version, input->level); - if(p == NULL) goto ABORT; - if(bytes > 0) { - /* Splits this entry into 2 entries. */ - ret = QRinput_splitEntry(list, bytes); - if(ret < 0) { - QRinput_free(p); - goto ABORT; - } - /* First half is the tail of the current input. */ - next = list->next; - list->next = NULL; - /* Second half is the head of the next input, p.*/ - p->head = next; - /* Renew QRinput.tail. */ - p->tail = input->tail; - input->tail = list; - /* Point to the next entry. */ - prev = list; - list = next; - } else { - /* Current entry will go to the next input. */ - prev->next = NULL; - p->head = list; - p->tail = input->tail; - input->tail = prev; - } - ret = QRinput_Struct_appendInput(s, input); - if(ret < 0) { - QRinput_free(p); - goto ABORT; - } - input = p; - bits = 0; - } - } - ret = QRinput_Struct_appendInput(s, input); - if(ret < 0) goto ABORT; - if(s->size > MAX_STRUCTURED_SYMBOLS) { - errno = ERANGE; - QRinput_Struct_free(s); - BitStream_free(bstream); - return NULL; - } - ret = QRinput_Struct_insertStructuredAppendHeaders(s); - if(ret < 0) { - QRinput_Struct_free(s); - BitStream_free(bstream); - return NULL; - } - - BitStream_free(bstream); - return s; - -ABORT: - BitStream_free(bstream); - QRinput_free(input); - QRinput_Struct_free(s); - return NULL; -} - -int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s) -{ - int i; - QRinput_InputList *list; - - if(s->size == 1) { - return 0; - } - - if(s->parity < 0) { - QRinput_Struct_calcParity(s); - } - i = 1; - list = s->head; - while(list != NULL) { - if(QRinput_insertStructuredAppendHeader(list->input, s->size, i, s->parity)) - return -1; - i++; - list = list->next; - } - - return 0; -} - -/****************************************************************************** - * Extended encoding mode (FNC1 and ECI) - *****************************************************************************/ - -int QRinput_setFNC1First(QRinput *input) -{ - if(input->mqr) { - errno = EINVAL; - return -1; - } - input->fnc1 = 1; - - return 0; -} - -int QRinput_setFNC1Second(QRinput *input, unsigned char appid) -{ - if(input->mqr) { - errno = EINVAL; - return -1; - } - input->fnc1 = 2; - input->appid = appid; - - return 0; -} +/* + * qrencode - QR Code encoder + * + * Input data chunk class + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "qrencode.h" +#include "qrspec.h" +#include "mqrspec.h" +#include "bitstream.h" +#include "qrinput.h" + +/****************************************************************************** + * Utilities + *****************************************************************************/ +int QRinput_isSplittableMode(QRencodeMode mode) +{ + return (mode >= QR_MODE_NUM && mode <= QR_MODE_KANJI); +} + +/****************************************************************************** + * Entry of input data + *****************************************************************************/ + +static QRinput_List *QRinput_List_newEntry(QRencodeMode mode, int size, const unsigned char *data) +{ + QRinput_List *entry; + + if(QRinput_check(mode, size, data)) { + errno = EINVAL; + return NULL; + } + + entry = (QRinput_List *)malloc(sizeof(QRinput_List)); + if(entry == NULL) return NULL; + + entry->mode = mode; + entry->size = size; + entry->data = NULL; + if(size > 0) { + entry->data = (unsigned char *)malloc((size_t)size); + if(entry->data == NULL) { + free(entry); + return NULL; + } + memcpy(entry->data, data, (size_t)size); + } + entry->bstream = NULL; + entry->next = NULL; + + return entry; +} + +static void QRinput_List_freeEntry(QRinput_List *entry) +{ + if(entry != NULL) { + free(entry->data); + BitStream_free(entry->bstream); + free(entry); + } +} + +static QRinput_List *QRinput_List_dup(QRinput_List *entry) +{ + QRinput_List *n; + + n = (QRinput_List *)malloc(sizeof(QRinput_List)); + if(n == NULL) return NULL; + + n->mode = entry->mode; + n->size = entry->size; + n->data = (unsigned char *)malloc((size_t)n->size); + if(n->data == NULL) { + free(n); + return NULL; + } + memcpy(n->data, entry->data, (size_t)entry->size); + n->bstream = NULL; + n->next = NULL; + + return n; +} + +/****************************************************************************** + * Input Data + *****************************************************************************/ + +QRinput *QRinput_new(void) +{ + return QRinput_new2(0, QR_ECLEVEL_L); +} + +QRinput *QRinput_new2(int version, QRecLevel level) +{ + QRinput *input; + + if(version < 0 || version > QRSPEC_VERSION_MAX || level < 0 || level > QR_ECLEVEL_H) { + errno = EINVAL; + return NULL; + } + + input = (QRinput *)malloc(sizeof(QRinput)); + if(input == NULL) return NULL; + + input->head = NULL; + input->tail = NULL; + input->version = version; + input->level = level; + input->mqr = 0; + input->fnc1 = 0; + + return input; +} + +QRinput *QRinput_newMQR(int version, QRecLevel level) +{ + QRinput *input; + + if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID; + if((MQRspec_getECCLength(version, level) == 0)) goto INVALID; + + input = QRinput_new2(version, level); + if(input == NULL) return NULL; + + input->mqr = 1; + + return input; + +INVALID: + errno = EINVAL; + return NULL; +} + +int QRinput_getVersion(QRinput *input) +{ + return input->version; +} + +int QRinput_setVersion(QRinput *input, int version) +{ + if(input->mqr || version < 0 || version > QRSPEC_VERSION_MAX) { + errno = EINVAL; + return -1; + } + + input->version = version; + + return 0; +} + +QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input) +{ + return input->level; +} + +int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level) +{ + if(input->mqr || level > QR_ECLEVEL_H) { + errno = EINVAL; + return -1; + } + + input->level = level; + + return 0; +} + +int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level) +{ + if(input->mqr) { + if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID; + if((MQRspec_getECCLength(version, level) == 0)) goto INVALID; + } else { + if(version < 0 || version > QRSPEC_VERSION_MAX) goto INVALID; + if(level > QR_ECLEVEL_H) goto INVALID; + } + + input->version = version; + input->level = level; + + return 0; + +INVALID: + errno = EINVAL; + return -1; +} + +static void QRinput_appendEntry(QRinput *input, QRinput_List *entry) +{ + if(input->tail == NULL) { + input->head = entry; + input->tail = entry; + } else { + input->tail->next = entry; + input->tail = entry; + } + entry->next = NULL; +} + +int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data) +{ + QRinput_List *entry; + + entry = QRinput_List_newEntry(mode, size, data); + if(entry == NULL) { + return -1; + } + + QRinput_appendEntry(input, entry); + + return 0; +} + +/** + * Insert a structured-append header to the head of the input data. + * @param input input data. + * @param size number of structured symbols. + * @param number index number of the symbol. (1 <= number <= size) + * @param parity parity among input data. (NOTE: each symbol of a set of structured symbols has the same parity data) + * @retval 0 success. + * @retval -1 error occurred and errno is set to indeicate the error. See Execptions for the details. + * @throw EINVAL invalid parameter. + * @throw ENOMEM unable to allocate memory. + */ +STATIC_IN_RELEASE int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int number, unsigned char parity) +{ + QRinput_List *entry; + unsigned char buf[3]; + + if(size > MAX_STRUCTURED_SYMBOLS) { + errno = EINVAL; + return -1; + } + if(number <= 0 || number > size) { + errno = EINVAL; + return -1; + } + + buf[0] = (unsigned char)size; + buf[1] = (unsigned char)number; + buf[2] = parity; + entry = QRinput_List_newEntry(QR_MODE_STRUCTURE, 3, buf); + if(entry == NULL) { + return -1; + } + + entry->next = input->head; + input->head = entry; + + return 0; +} + +int QRinput_appendECIheader(QRinput *input, unsigned int ecinum) +{ + unsigned char data[4]; + + if(ecinum > 999999) { + errno = EINVAL; + return -1; + } + + /* We manually create byte array of ecinum because + (unsigned char *)&ecinum may cause bus error on some architectures, */ + data[0] = ecinum & 0xff; + data[1] = (ecinum >> 8) & 0xff; + data[2] = (ecinum >> 16) & 0xff; + data[3] = (ecinum >> 24) & 0xff; + return QRinput_append(input, QR_MODE_ECI, 4, data); +} + +void QRinput_free(QRinput *input) +{ + QRinput_List *list, *next; + + if(input != NULL) { + list = input->head; + while(list != NULL) { + next = list->next; + QRinput_List_freeEntry(list); + list = next; + } + free(input); + } +} + +static unsigned char QRinput_calcParity(QRinput *input) +{ + unsigned char parity = 0; + QRinput_List *list; + int i; + + list = input->head; + while(list != NULL) { + if(list->mode != QR_MODE_STRUCTURE) { + for(i = list->size-1; i >= 0; i--) { + parity ^= list->data[i]; + } + } + list = list->next; + } + + return parity; +} + +QRinput *QRinput_dup(QRinput *input) +{ + QRinput *n; + QRinput_List *list, *e; + + if(input->mqr) { + n = QRinput_newMQR(input->version, input->level); + } else { + n = QRinput_new2(input->version, input->level); + } + if(n == NULL) return NULL; + + list = input->head; + while(list != NULL) { + e = QRinput_List_dup(list); + if(e == NULL) { + QRinput_free(n); + return NULL; + } + QRinput_appendEntry(n, e); + list = list->next; + } + + return n; +} + +/****************************************************************************** + * Numeric data + *****************************************************************************/ + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeNum(int size, const char *data) +{ + int i; + + for(i = 0; i < size; i++) { + if(data[i] < '0' || data[i] > '9') + return -1; + } + + return 0; +} + +/** + * Estimate the length of the encoded bit stream of numeric data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsModeNum(int size) +{ + int w; + int bits; + + w = size / 3; + bits = w * 10; + switch(size - w * 3) { + case 1: + bits += 4; + break; + case 2: + bits += 7; + break; + default: + break; + } + + return bits; +} + +/** + * Convert the number data and append to a bit stream. + * @param entry + * @param mqr + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + */ +static int QRinput_encodeModeNum(QRinput_List *entry, BitStream *bstream, int version, int mqr) +{ + int words, i, ret; + unsigned int val; + + if(mqr) { + if(version > 1) { + ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_NUM); + if(ret < 0) return -1; + } + ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_NUM, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } else { + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_NUM); + if(ret < 0) return -1; + + ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_NUM, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } + + words = entry->size / 3; + for(i = 0; i < words; i++) { + val = (unsigned int)(entry->data[i*3 ] - '0') * 100; + val += (unsigned int)(entry->data[i*3+1] - '0') * 10; + val += (unsigned int)(entry->data[i*3+2] - '0'); + + ret = BitStream_appendNum(bstream, 10, val); + if(ret < 0) return -1; + } + + if(entry->size - words * 3 == 1) { + val = (unsigned int)(entry->data[words*3] - '0'); + ret = BitStream_appendNum(bstream, 4, val); + if(ret < 0) return -1; + } else if(entry->size - words * 3 == 2) { + val = (unsigned int)(entry->data[words*3 ] - '0') * 10; + val += (unsigned int)(entry->data[words*3+1] - '0'); + ret = BitStream_appendNum(bstream, 7, val); + if(ret < 0) return -1; + } + + return 0; +} + +/****************************************************************************** + * Alphabet-numeric data + *****************************************************************************/ + +const signed char QRinput_anTable[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeAn(int size, const char *data) +{ + int i; + + for(i = 0; i < size; i++) { + if(QRinput_lookAnTable(data[i]) < 0) + return -1; + } + + return 0; +} + +/** + * Estimate the length of the encoded bit stream of alphabet-numeric data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsModeAn(int size) +{ + int w; + int bits; + + w = size / 2; + bits = w * 11; + if(size & 1) { + bits += 6; + } + + return bits; +} + +/** + * Convert the alphabet-numeric data and append to a bit stream. + * @param entry + * @param mqr + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL invalid version. + */ +static int QRinput_encodeModeAn(QRinput_List *entry, BitStream *bstream, int version, int mqr) +{ + int words, i, ret; + unsigned int val; + + if(mqr) { + if(version < 2) { + errno = ERANGE; + return -1; + } + ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_AN); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_AN, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } else { + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_AN); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_AN, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } + + words = entry->size / 2; + for(i = 0; i < words; i++) { + val = (unsigned int)QRinput_lookAnTable(entry->data[i*2 ]) * 45; + val += (unsigned int)QRinput_lookAnTable(entry->data[i*2+1]); + + ret = BitStream_appendNum(bstream, 11, val); + if(ret < 0) return -1; + } + + if(entry->size & 1) { + val = (unsigned int)QRinput_lookAnTable(entry->data[words * 2]); + + ret = BitStream_appendNum(bstream, 6, val); + if(ret < 0) return -1; + } + + return 0; +} + +/****************************************************************************** + * 8 bit data + *****************************************************************************/ + +/** + * Estimate the length of the encoded bit stream of 8 bit data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsMode8(int size) +{ + return size * 8; +} + +/** + * Convert the 8bits data and append to a bit stream. + * @param entry + * @param mqr + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + */ +static int QRinput_encodeMode8(QRinput_List *entry, BitStream *bstream, int version, int mqr) +{ + int ret; + + if(mqr) { + if(version < 3) { + errno = ERANGE; + return -1; + } + ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_8); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_8, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } else { + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_8); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_8, version), (unsigned int)entry->size); + if(ret < 0) return -1; + } + + ret = BitStream_appendBytes(bstream, (size_t)entry->size, entry->data); + if(ret < 0) return -1; + + return 0; +} + + +/****************************************************************************** + * Kanji data + *****************************************************************************/ + +/** + * Estimate the length of the encoded bit stream of kanji data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsModeKanji(int size) +{ + return (size / 2) * 13; +} + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeKanji(int size, const unsigned char *data) +{ + int i; + unsigned int val; + + if(size & 1) + return -1; + + for(i = 0; i < size; i+=2) { + val = ((unsigned int)data[i] << 8) | data[i+1]; + if(val < 0x8140 || (val > 0x9ffc && val < 0xe040) || val > 0xebbf) { + return -1; + } + } + + return 0; +} + +/** + * Convert the kanji data and append to a bit stream. + * @param entry + * @param mqr + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL invalid version. + */ +static int QRinput_encodeModeKanji(QRinput_List *entry, BitStream *bstream, int version, int mqr) +{ + int ret, i; + unsigned int val, h; + + if(mqr) { + if(version < 2) { + errno = ERANGE; + return -1; + } + ret = BitStream_appendNum(bstream, (size_t)(version - 1), MQRSPEC_MODEID_KANJI); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)MQRspec_lengthIndicator(QR_MODE_KANJI, version), (unsigned int)entry->size/2); + if(ret < 0) return -1; + } else { + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_KANJI); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, (size_t)QRspec_lengthIndicator(QR_MODE_KANJI, version), (unsigned int)entry->size/2); + if(ret < 0) return -1; + } + + for(i = 0; i < entry->size; i+=2) { + val = ((unsigned int)entry->data[i] << 8) | entry->data[i+1]; + if(val <= 0x9ffc) { + val -= 0x8140; + } else { + val -= 0xc140; + } + h = (val >> 8) * 0xc0; + val = (val & 0xff) + h; + + ret = BitStream_appendNum(bstream, 13, val); + if(ret < 0) return -1; + } + + return 0; +} + +/****************************************************************************** + * Structured Symbol + *****************************************************************************/ + +/** + * Convert a structure symbol code and append to a bit stream. + * @param entry + * @param mqr + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw EINVAL invalid entry. + */ +static int QRinput_encodeModeStructure(QRinput_List *entry, BitStream *bstream, int mqr) +{ + int ret; + + if(mqr) { + errno = EINVAL; + return -1; + } + + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_STRUCTURE); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, 4, entry->data[1] - 1U); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, 4, entry->data[0] - 1U); + if(ret < 0) return -1; + ret = BitStream_appendNum(bstream, 8, entry->data[2]); + if(ret < 0) return -1; + + return 0; +} + +/****************************************************************************** + * FNC1 + *****************************************************************************/ + +static int QRinput_checkModeFNC1Second(int size) +{ + if(size != 1) return -1; + + /* No data check required. */ + + return 0; +} + +static int QRinput_encodeModeFNC1Second(QRinput_List *entry, BitStream *bstream) +{ + int ret; + + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_FNC1SECOND); + if(ret < 0) return -1; + + ret = BitStream_appendBytes(bstream, 1, entry->data); + if(ret < 0) return -1; + + return 0; +} + +/****************************************************************************** + * ECI header + *****************************************************************************/ +static unsigned int QRinput_decodeECIfromByteArray(unsigned char *data) +{ + int i; + unsigned int ecinum; + + ecinum = 0; + for(i = 0; i < 4; i++) { + ecinum = ecinum << 8; + ecinum |= data[3-i]; + } + + return ecinum; +} + +static int QRinput_estimateBitsModeECI(unsigned char *data) +{ + unsigned int ecinum; + + ecinum = QRinput_decodeECIfromByteArray(data); + + /* See Table 4 of JISX 0510:2004 pp.17. */ + if(ecinum < 128) { + return MODE_INDICATOR_SIZE + 8; + } else if(ecinum < 16384) { + return MODE_INDICATOR_SIZE + 16; + } else { + return MODE_INDICATOR_SIZE + 24; + } +} + +static int QRinput_encodeModeECI(QRinput_List *entry, BitStream *bstream) +{ + int ret, words; + unsigned int ecinum, code; + + ecinum = QRinput_decodeECIfromByteArray(entry->data); + + /* See Table 4 of JISX 0510:2004 pp.17. */ + if(ecinum < 128) { + words = 1; + code = ecinum; + } else if(ecinum < 16384) { + words = 2; + code = 0x8000 + ecinum; + } else { + words = 3; + code = 0xc0000 + ecinum; + } + + ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_ECI); + if(ret < 0) return -1; + + ret = BitStream_appendNum(bstream, (size_t)words * 8, code); + if(ret < 0) return -1; + + return 0; +} + +/****************************************************************************** + * Validation + *****************************************************************************/ + +int QRinput_check(QRencodeMode mode, int size, const unsigned char *data) +{ + if((mode == QR_MODE_FNC1FIRST && size < 0) || size <= 0) return -1; + + switch(mode) { + case QR_MODE_NUM: + return QRinput_checkModeNum(size, (const char *)data); + case QR_MODE_AN: + return QRinput_checkModeAn(size, (const char *)data); + case QR_MODE_KANJI: + return QRinput_checkModeKanji(size, data); + case QR_MODE_8: + return 0; + case QR_MODE_STRUCTURE: + return 0; + case QR_MODE_ECI: + return 0; + case QR_MODE_FNC1FIRST: + return 0; + case QR_MODE_FNC1SECOND: + return QRinput_checkModeFNC1Second(size); + case QR_MODE_NUL: + break; + } + + return -1; +} + +/****************************************************************************** + * Estimation of the bit length + *****************************************************************************/ + +/** + * Estimate the length of the encoded bit stream on the current version. + * @param entry + * @param version version of the symbol + * @param mqr + * @return number of bits + */ +static int QRinput_estimateBitStreamSizeOfEntry(QRinput_List *entry, int version, int mqr) +{ + int bits = 0; + int l, m; + int num; + + if(version == 0) version = 1; + + switch(entry->mode) { + case QR_MODE_NUM: + bits = QRinput_estimateBitsModeNum(entry->size); + break; + case QR_MODE_AN: + bits = QRinput_estimateBitsModeAn(entry->size); + break; + case QR_MODE_8: + bits = QRinput_estimateBitsMode8(entry->size); + break; + case QR_MODE_KANJI: + bits = QRinput_estimateBitsModeKanji(entry->size); + break; + case QR_MODE_STRUCTURE: + return STRUCTURE_HEADER_SIZE; + case QR_MODE_ECI: + bits = QRinput_estimateBitsModeECI(entry->data); + break; + case QR_MODE_FNC1FIRST: + return MODE_INDICATOR_SIZE; + case QR_MODE_FNC1SECOND: + return MODE_INDICATOR_SIZE + 8; + default: + return 0; + } + + if(mqr) { + l = MQRspec_lengthIndicator(entry->mode, version); + m = version - 1; + bits += l + m; + } else { + l = QRspec_lengthIndicator(entry->mode, version); + m = 1 << l; + if(entry->mode == QR_MODE_KANJI) { + num = (entry->size/2 + m - 1) / m; + } else { + num = (entry->size + m - 1) / m; + } + + bits += num * (MODE_INDICATOR_SIZE + l); + } + + return bits; +} + +/** + * Estimate the length of the encoded bit stream of the data. + * @param input input data + * @param version version of the symbol + * @return number of bits + */ +STATIC_IN_RELEASE int QRinput_estimateBitStreamSize(QRinput *input, int version) +{ + QRinput_List *list; + int bits = 0; + + list = input->head; + while(list != NULL) { + bits += QRinput_estimateBitStreamSizeOfEntry(list, version, input->mqr); + list = list->next; + } + + return bits; +} + +/** + * Estimate the required version number of the symbol. + * @param input input data + * @return required version number or -1 for failure. + */ +STATIC_IN_RELEASE int QRinput_estimateVersion(QRinput *input) +{ + int bits; + int version, prev; + + version = 0; + do { + prev = version; + bits = QRinput_estimateBitStreamSize(input, prev); + version = QRspec_getMinimumVersion((bits + 7) / 8, input->level); + if(prev == 0 && version > 1) { + version--; + } + } while (version > prev); + + return version; +} + +/** + * Return required length in bytes for specified mode, version and bits. + * @param mode + * @param version + * @param bits + * @return required length of code words in bytes. + */ +STATIC_IN_RELEASE int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits) +{ + int payload, size, chunks, remain, maxsize; + + payload = bits - 4 - QRspec_lengthIndicator(mode, version); + switch(mode) { + case QR_MODE_NUM: + chunks = payload / 10; + remain = payload - chunks * 10; + size = chunks * 3; + if(remain >= 7) { + size += 2; + } else if(remain >= 4) { + size += 1; + } + break; + case QR_MODE_AN: + chunks = payload / 11; + remain = payload - chunks * 11; + size = chunks * 2; + if(remain >= 6) size++; + break; + case QR_MODE_8: + size = payload / 8; + break; + case QR_MODE_KANJI: + size = (payload / 13) * 2; + break; + case QR_MODE_STRUCTURE: + size = payload / 8; + break; + default: + size = 0; + break; + } + maxsize = QRspec_maximumWords(mode, version); + if(size < 0) size = 0; + if(maxsize > 0 && size > maxsize) size = maxsize; + + return size; +} + +/****************************************************************************** + * Data conversion + *****************************************************************************/ + +/** + * Convert the input data in the data chunk and append to a bit stream. + * @param entry + * @param bstream + * @return number of bits (>0) or -1 for failure. + */ +static int QRinput_encodeBitStream(QRinput_List *entry, BitStream *bstream, int version, int mqr) +{ + int words, ret; + QRinput_List *st1 = NULL, *st2 = NULL; + int prevsize; + + prevsize = (int)BitStream_size(bstream); + + if(mqr) { + words = MQRspec_maximumWords(entry->mode, version); + } else { + words = QRspec_maximumWords(entry->mode, version); + } + if(words != 0 && entry->size > words) { + st1 = QRinput_List_newEntry(entry->mode, words, entry->data); + if(st1 == NULL) goto ABORT; + st2 = QRinput_List_newEntry(entry->mode, entry->size - words, &entry->data[words]); + if(st2 == NULL) goto ABORT; + + ret = QRinput_encodeBitStream(st1, bstream, version, mqr); + if(ret < 0) goto ABORT; + ret = QRinput_encodeBitStream(st2, bstream, version, mqr); + if(ret < 0) goto ABORT; + + QRinput_List_freeEntry(st1); + QRinput_List_freeEntry(st2); + } else { + ret = 0; + switch(entry->mode) { + case QR_MODE_NUM: + ret = QRinput_encodeModeNum(entry, bstream, version, mqr); + break; + case QR_MODE_AN: + ret = QRinput_encodeModeAn(entry, bstream, version, mqr); + break; + case QR_MODE_8: + ret = QRinput_encodeMode8(entry, bstream, version, mqr); + break; + case QR_MODE_KANJI: + ret = QRinput_encodeModeKanji(entry, bstream, version, mqr); + break; + case QR_MODE_STRUCTURE: + ret = QRinput_encodeModeStructure(entry, bstream, mqr); + break; + case QR_MODE_ECI: + ret = QRinput_encodeModeECI(entry, bstream); + break; + case QR_MODE_FNC1SECOND: + ret = QRinput_encodeModeFNC1Second(entry, bstream); + break; + default: + break; + } + if(ret < 0) return -1; + } + + return (int)BitStream_size(bstream) - prevsize; +ABORT: + QRinput_List_freeEntry(st1); + QRinput_List_freeEntry(st2); + return -1; +} + +/** + * Convert the input data to a bit stream. + * @param input input data. + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + */ +static int QRinput_createBitStream(QRinput *input, BitStream *bstream) +{ + QRinput_List *list; + int bits, total = 0; + + list = input->head; + while(list != NULL) { + bits = QRinput_encodeBitStream(list, bstream, input->version, input->mqr); + if(bits < 0) return -1; + total += bits; + list = list->next; + } + + return total; +} + +/** + * Convert the input data to a bit stream. + * When the version number is given and that is not sufficient, it is increased + * automatically. + * @param input input data. + * @param bstream where the converted data is stored. + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ENOMEM unable to allocate memory. + * @throw ERANGE input data is too large. + */ +static int QRinput_convertData(QRinput *input, BitStream *bstream) +{ + int bits; + int ver; + + ver = QRinput_estimateVersion(input); + if(ver > QRinput_getVersion(input)) { + QRinput_setVersion(input, ver); + } + + for(;;) { + BitStream_reset(bstream); + bits = QRinput_createBitStream(input, bstream); + if(bits < 0) return -1; + ver = QRspec_getMinimumVersion((bits + 7) / 8, input->level); + if(ver > QRinput_getVersion(input)) { + QRinput_setVersion(input, ver); + } else { + break; + } + } + + return 0; +} + +/** + * Append padding bits for the input data. + * @param bstream Bitstream to be appended. + * @param input input data. + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ERANGE input data is too large. + * @throw ENOMEM unable to allocate memory. + */ +static int QRinput_appendPaddingBit(BitStream *bstream, QRinput *input) +{ + int bits, maxbits, words, maxwords, i, ret; + int padlen; + + bits = (int)BitStream_size(bstream); + maxwords = QRspec_getDataLength(input->version, input->level); + maxbits = maxwords * 8; + + if(maxbits < bits) { + errno = ERANGE; + return -1; + } + if(maxbits == bits) { + return 0; + } + + if(maxbits - bits <= 4) { + return (int)BitStream_appendNum(bstream, (size_t)(maxbits - bits), 0); + } + + words = (bits + 4 + 7) / 8; + + ret = (int)BitStream_appendNum(bstream, (size_t)(words * 8 - bits), 0); + if(ret < 0) return ret; + + padlen = maxwords - words; + if(padlen > 0) { + for(i = 0; i < padlen; i++) { + ret = (int)BitStream_appendNum(bstream, 8, (i&1)?0x11:0xec); + if(ret < 0) { + return ret; + } + } + } + + return 0; +} + +/** + * Append padding bits for the input data - Micro QR Code version. + * @param bstream Bitstream to be appended. + * @param input input data. + * @retval 0 success + * @retval -1 an error occurred and errno is set to indeicate the error. + * See Execptions for the details. + * @throw ERANGE input data is too large. + * @throw ENOMEM unable to allocate memory. + */ +static int QRinput_appendPaddingBitMQR(BitStream *bstream, QRinput *input) +{ + int bits, maxbits, words, maxwords, i, ret, termbits; + int padlen; + + bits = (int)BitStream_size(bstream); + maxbits = MQRspec_getDataLengthBit(input->version, input->level); + maxwords = maxbits / 8; + + if(maxbits < bits) { + errno = ERANGE; + return -1; + } + if(maxbits == bits) { + return 0; + } + + termbits = input->version * 2 + 1; + + if(maxbits - bits <= termbits) { + return (int)BitStream_appendNum(bstream, (size_t)(maxbits - bits), 0); + } + + bits += termbits; + + words = (bits + 7) / 8; + if(maxbits - words * 8 > 0) { + termbits += words * 8 - bits; + if(words == maxwords) termbits += maxbits - words * 8; + } else { + termbits += words * 8 - bits; + } + ret = (int)BitStream_appendNum(bstream, (size_t)termbits, 0); + if(ret < 0) return ret; + + padlen = maxwords - words; + if(padlen > 0) { + for(i = 0; i < padlen; i++) { + ret = (int)BitStream_appendNum(bstream, 8, (i&1)?0x11:0xec); + if(ret < 0) return ret; + } + termbits = maxbits - maxwords * 8; + if(termbits > 0) { + ret = (int)BitStream_appendNum(bstream, (size_t)termbits, 0); + if(ret < 0) return ret; + } + } + + return 0; +} + +static int QRinput_insertFNC1Header(QRinput *input) +{ + QRinput_List *entry = NULL; + + if(input->fnc1 == 1) { + entry = QRinput_List_newEntry(QR_MODE_FNC1FIRST, 0, NULL); + } else if(input->fnc1 == 2) { + entry = QRinput_List_newEntry(QR_MODE_FNC1SECOND, 1, &(input->appid)); + } + if(entry == NULL) { + return -1; + } + + if(input->head->mode != QR_MODE_STRUCTURE && input->head->mode != QR_MODE_ECI) { + entry->next = input->head; + input->head = entry; + } else { + entry->next = input->head->next; + input->head->next = entry; + } + + return 0; +} + +/** + * Merge all bit streams in the input data. + * @param input input data. + * @return merged bit stream + */ + +STATIC_IN_RELEASE int QRinput_mergeBitStream(QRinput *input, BitStream *bstream) +{ + if(input->mqr) { + if(QRinput_createBitStream(input, bstream) < 0) { + return -1; + } + } else { + if(input->fnc1) { + if(QRinput_insertFNC1Header(input) < 0) { + return -1; + } + } + if(QRinput_convertData(input, bstream) < 0) { + return -1; + } + } + + return 0; +} + +/** + * Merge all bit streams in the input data and append padding bits + * @param input input data. + * @return padded merged bit stream + */ + +STATIC_IN_RELEASE int QRinput_getBitStream(QRinput *input, BitStream *bstream) +{ + int ret; + + ret = QRinput_mergeBitStream(input, bstream); + if(ret < 0) return -1; + + if(input->mqr) { + ret = QRinput_appendPaddingBitMQR(bstream, input); + } else { + ret = QRinput_appendPaddingBit(bstream, input); + } + if(ret < 0) return -1; + + return 0; +} + +/** + * Pack all bit streams padding bits into a byte array. + * @param input input data. + * @return padded merged byte stream + */ + +unsigned char *QRinput_getByteStream(QRinput *input) +{ + BitStream *bstream; + unsigned char *array; + int ret; + + bstream = BitStream_new(); + if(bstream == NULL) { + return NULL; + } + + ret = QRinput_getBitStream(input, bstream); + if(ret < 0) { + BitStream_free(bstream); + return NULL; + } + array = BitStream_toByte(bstream); + BitStream_free(bstream); + + return array; +} + +/****************************************************************************** + * Structured input data + *****************************************************************************/ + +static QRinput_InputList *QRinput_InputList_newEntry(QRinput *input) +{ + QRinput_InputList *entry; + + entry = (QRinput_InputList *)malloc(sizeof(QRinput_InputList)); + if(entry == NULL) return NULL; + + entry->input = input; + entry->next = NULL; + + return entry; +} + +static void QRinput_InputList_freeEntry(QRinput_InputList *entry) +{ + if(entry != NULL) { + QRinput_free(entry->input); + free(entry); + } +} + +QRinput_Struct *QRinput_Struct_new(void) +{ + QRinput_Struct *s; + + s = (QRinput_Struct *)malloc(sizeof(QRinput_Struct)); + if(s == NULL) return NULL; + + s->size = 0; + s->parity = -1; + s->head = NULL; + s->tail = NULL; + + return s; +} + +void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity) +{ + s->parity = (int)parity; +} + +int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input) +{ + QRinput_InputList *e; + + if(input->mqr) { + errno = EINVAL; + return -1; + } + + e = QRinput_InputList_newEntry(input); + if(e == NULL) return -1; + + s->size++; + if(s->tail == NULL) { + s->head = e; + s->tail = e; + } else { + s->tail->next = e; + s->tail = e; + } + + return s->size; +} + +void QRinput_Struct_free(QRinput_Struct *s) +{ + QRinput_InputList *list, *next; + + if(s != NULL) { + list = s->head; + while(list != NULL) { + next = list->next; + QRinput_InputList_freeEntry(list); + list = next; + } + free(s); + } +} + +static unsigned char QRinput_Struct_calcParity(QRinput_Struct *s) +{ + QRinput_InputList *list; + unsigned char parity = 0; + + list = s->head; + while(list != NULL) { + parity ^= QRinput_calcParity(list->input); + list = list->next; + } + + QRinput_Struct_setParity(s, parity); + + return parity; +} + +static int QRinput_List_shrinkEntry(QRinput_List *entry, int bytes) +{ + unsigned char *data; + + data = (unsigned char *)malloc((size_t)bytes); + if(data == NULL) return -1; + + memcpy(data, entry->data, (size_t)bytes); + free(entry->data); + entry->data = data; + entry->size = bytes; + + return 0; +} + +STATIC_IN_RELEASE int QRinput_splitEntry(QRinput_List *entry, int bytes) +{ + QRinput_List *e; + int ret; + + e = QRinput_List_newEntry(entry->mode, entry->size - bytes, entry->data + bytes); + if(e == NULL) { + return -1; + } + + ret = QRinput_List_shrinkEntry(entry, bytes); + if(ret < 0) { + QRinput_List_freeEntry(e); + return -1; + } + + e->next = entry->next; + entry->next = e; + + return 0; +} + +QRinput_Struct *QRinput_splitQRinputToStruct(QRinput *input) +{ + QRinput *p = NULL; + QRinput_Struct *s = NULL; + int bits, maxbits, nextbits, bytes, ret; + QRinput_List *list, *next, *prev; + BitStream *bstream = NULL; + + if(input->mqr) { + errno = EINVAL; + return NULL; + } + + s = QRinput_Struct_new(); + if(s == NULL) return NULL; + + input = QRinput_dup(input); + if(input == NULL) { + QRinput_Struct_free(s); + return NULL; + } + + QRinput_Struct_setParity(s, QRinput_calcParity(input)); + maxbits = QRspec_getDataLength(input->version, input->level) * 8 - STRUCTURE_HEADER_SIZE; + + if(maxbits <= 0) goto ABORT; + + bstream = BitStream_new(); + if(bstream == NULL) goto ABORT; + + bits = 0; + list = input->head; + prev = NULL; + while(list != NULL) { + nextbits = QRinput_estimateBitStreamSizeOfEntry(list, input->version, input->mqr); + if(bits + nextbits <= maxbits) { + BitStream_reset(bstream); + ret = QRinput_encodeBitStream(list, bstream, input->version, input->mqr); + if(ret < 0) goto ABORT; + bits += ret; + prev = list; + list = list->next; + } else { + bytes = QRinput_lengthOfCode(list->mode, input->version, maxbits - bits); + p = QRinput_new2(input->version, input->level); + if(p == NULL) goto ABORT; + if(bytes > 0) { + /* Splits this entry into 2 entries. */ + ret = QRinput_splitEntry(list, bytes); + if(ret < 0) { + QRinput_free(p); + goto ABORT; + } + /* First half is the tail of the current input. */ + next = list->next; + list->next = NULL; + /* Second half is the head of the next input, p.*/ + p->head = next; + /* Renew QRinput.tail. */ + p->tail = input->tail; + input->tail = list; + /* Point to the next entry. */ + prev = list; + list = next; + } else { + /* Current entry will go to the next input. */ + prev->next = NULL; + p->head = list; + p->tail = input->tail; + input->tail = prev; + } + ret = QRinput_Struct_appendInput(s, input); + if(ret < 0) { + QRinput_free(p); + goto ABORT; + } + input = p; + bits = 0; + } + } + ret = QRinput_Struct_appendInput(s, input); + if(ret < 0) goto ABORT; + if(s->size > MAX_STRUCTURED_SYMBOLS) { + errno = ERANGE; + QRinput_Struct_free(s); + BitStream_free(bstream); + return NULL; + } + ret = QRinput_Struct_insertStructuredAppendHeaders(s); + if(ret < 0) { + QRinput_Struct_free(s); + BitStream_free(bstream); + return NULL; + } + + BitStream_free(bstream); + return s; + +ABORT: + BitStream_free(bstream); + QRinput_free(input); + QRinput_Struct_free(s); + return NULL; +} + +int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s) +{ + int i; + QRinput_InputList *list; + + if(s->size == 1) { + return 0; + } + + if(s->parity < 0) { + QRinput_Struct_calcParity(s); + } + i = 1; + list = s->head; + while(list != NULL) { + if(QRinput_insertStructuredAppendHeader(list->input, s->size, i, s->parity)) + return -1; + i++; + list = list->next; + } + + return 0; +} + +/****************************************************************************** + * Extended encoding mode (FNC1 and ECI) + *****************************************************************************/ + +int QRinput_setFNC1First(QRinput *input) +{ + if(input->mqr) { + errno = EINVAL; + return -1; + } + input->fnc1 = 1; + + return 0; +} + +int QRinput_setFNC1Second(QRinput *input, unsigned char appid) +{ + if(input->mqr) { + errno = EINVAL; + return -1; + } + input->fnc1 = 2; + input->appid = appid; + + return 0; +} diff --git a/QtQREnCode/qrinput.cpp b/QtQREnCode/qrinput.cpp index dc2cd06..faee24b 100644 --- a/QtQREnCode/qrinput.cpp +++ b/QtQREnCode/qrinput.cpp @@ -1,776 +1,776 @@ - -/* - * qrencode - QR Code encoder - * - * Input data chunk class - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "qrencode.h" -#include "qrspec.h" -#include "bistream.h" -#include "qrinput.h" - -/****************************************************************************** - * Entry of input data - *****************************************************************************/ - -static QRinput_List *QRinput_newEntry(QRencodeMode mode, int size, const unsigned char *data) -{ - QRinput_List *entry; - - if(QRinput_check(mode, size, data)) { - return NULL; - } - - entry = (QRinput_List *)malloc(sizeof(QRinput_List)); - entry->mode = mode; - entry->size = size; - entry->data = (unsigned char *)malloc(size); - memcpy(entry->data, data, size); - entry->bstream = NULL; - entry->next = NULL; - - return entry; -} - -static QRinput_List *QRinput_freeEntry(QRinput_List *entry) -{ - QRinput_List *next; - - next = entry->next; - free(entry->data); - if(entry->bstream) { - BitStream_free(entry->bstream); - } - free(entry); - - return next; -} - -/****************************************************************************** - * Input Data - *****************************************************************************/ - -QRinput *QRinput_new(void) -{ - QRinput *input; - - input = (QRinput *)malloc(sizeof(QRinput)); - input->head = NULL; - input->tail = NULL; - input->version = 0; - input->level = QR_ECLEVEL_L; - - return input; -} - -int QRinput_getVersion(QRinput *input) -{ - return input->version; -} - -void QRinput_setVersion(QRinput *input, int v) -{ - input->version = v; -} - -void QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level) -{ - input->level = level; -} - -QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input) -{ - return input->level; -} - -int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data) -{ - QRinput_List *entry; - - entry = QRinput_newEntry(mode, size, data); - if(entry == NULL) { - return -1; - } - - if(input->tail == NULL) { - input->head = entry; - input->tail = entry; - } else { - input->tail->next = entry; - input->tail = entry; - } - - return 0; -} - -void QRinput_free(QRinput *input) -{ - QRinput_List *list; - - list = input->head; - while(list != NULL) { - list = QRinput_freeEntry(list); - } - - free(input); -} - -/****************************************************************************** - * Numeric data - *****************************************************************************/ - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeNum(int size, const char *data) -{ - int i; - - for(i=0; i '9') - return -1; - } - - return 0; -} - -/** - * Estimates the length of the encoded bit stream of numeric data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsModeNum(int size) -{ - int w; - int bits; - - w = size / 3; - bits = w * 10; - switch(size - w * 3) { - case 1: - bits += 4; - break; - case 2: - bits += 7; - break; - default: - break; - } - - return bits; -} - -/** - * Convert the number data to a bit stream. - * @param entry - */ -static void QRinput_encodeModeNum(QRinput_List *entry, int version) -{ - int words; - int i; - unsigned int val; - - words = entry->size / 3; - entry->bstream = BitStream_new(); - - val = 0x1; - BitStream_appendNum(entry->bstream, 4, val); - - val = entry->size; - BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_NUM, version), val); - - for(i=0; idata[i*3 ] - '0') * 100; - val += (entry->data[i*3+1] - '0') * 10; - val += (entry->data[i*3+2] - '0'); - - BitStream_appendNum(entry->bstream, 10, val); - } - - if(entry->size - words * 3 == 1) { - val = entry->data[words*3] - '0'; - BitStream_appendNum(entry->bstream, 4, val); - } else if(entry->size - words * 3 == 2) { - val = (entry->data[words*3 ] - '0') * 10; - val += (entry->data[words*3+1] - '0'); - BitStream_appendNum(entry->bstream, 7, val); - } -} - -/****************************************************************************** - * Alphabet-numeric data - *****************************************************************************/ - -const signed char QRinput_anTable[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1 -}; - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeAn(int size, const char *data) -{ - int i; - - for(i=0; isize / 2; - entry->bstream = BitStream_new(); - - val = 0x2; - BitStream_appendNum(entry->bstream, 4, val); - - val = entry->size; - BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_AN, version), val); - - for(i=0; idata[i*2 ]) * 45; - val += (unsigned int)QRinput_lookAnTable(entry->data[i*2+1]); - - BitStream_appendNum(entry->bstream, 11, val); - } - - if(entry->size & 1) { - val = (unsigned int)QRinput_lookAnTable(entry->data[words * 2]); - - BitStream_appendNum(entry->bstream, 6, val); - } -} - -/****************************************************************************** - * 8 bit data - *****************************************************************************/ - -/** - * Estimates the length of the encoded bit stream of 8 bit data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsMode8(int size) -{ - return size * 8; -} - -/** - * Convert the 8bits data to a bit stream. - * @param entry - */ -static void QRinput_encodeMode8(QRinput_List *entry, int version) -{ - int i; - unsigned int val; - - entry->bstream = BitStream_new(); - - val = 0x4; - BitStream_appendNum(entry->bstream, 4, val); - - val = entry->size; - BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_8, version), val); - - for(i=0; isize; i++) { - BitStream_appendNum(entry->bstream, 8, entry->data[i]); - } -} - - -/****************************************************************************** - * Kanji data - *****************************************************************************/ - -/** - * Estimates the length of the encoded bit stream of kanji data. - * @param size - * @return number of bits - */ -int QRinput_estimateBitsModeKanji(int size) -{ - return (size / 2) * 13; -} - -/** - * Check the input data. - * @param size - * @param data - * @return result - */ -static int QRinput_checkModeKanji(int size, const unsigned char *data) -{ - int i; - unsigned int val; - - if(size & 1) - return -1; - - for(i=0; i 0x9ffc && val < 0xe040) || val > 0xebbf) { - return -1; - } - } - - return 0; -} - -/** - * Convert the kanji data to a bit stream. - * @param entry - */ -static void QRinput_encodeModeKanji(QRinput_List *entry, int version) -{ - int i; - unsigned int val, h; - - entry->bstream = BitStream_new(); - - val = 0x8; - BitStream_appendNum(entry->bstream, 4, val); - - val = entry->size / 2; - BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_KANJI, version), val); - - for(i=0; isize; i+=2) { - val = ((unsigned int)entry->data[i] << 8) | entry->data[i+1]; - if(val <= 0x9ffc) { - val -= 0x8140; - } else { - val -= 0xc140; - } - h = (val >> 8) * 0xc0; - val = (val & 0xff) + h; - - BitStream_appendNum(entry->bstream, 13, val); - } -} - -/****************************************************************************** - * Validation - *****************************************************************************/ - -/** - * Validate the input data - * @param mode - * @param size - * @param data - * @return result - */ -int QRinput_check(QRencodeMode mode, int size, const unsigned char *data) -{ - switch(mode) { - case QR_MODE_NUM: - return QRinput_checkModeNum(size, (const char *)data); - break; - case QR_MODE_AN: - return QRinput_checkModeAn(size, (const char *)data); - break; - case QR_MODE_KANJI: - return QRinput_checkModeKanji(size, data); - break; - default: - break; - } - - return 0; -} - -QRencodeMode QRinput_identifyMode(const char *string) -{ - unsigned char c, d; - unsigned int word; - - c = string[0]; - - if((unsigned char)((signed char)c - '0') < 10) { - return QR_MODE_NUM; - } else if((QRinput_lookAnTable(c)) >= 0) { - return QR_MODE_AN; - } else { - d = string[1]; - if(d != '\0') { - word = ((unsigned int)c << 8) | d; - if((word >= 0x8140 && word <= 0x9ffc) || (word >= 0xe040 && word <= 0xebbf)) { - return QR_MODE_KANJI; - } - } - } - - return QR_MODE_8; -} - -/****************************************************************************** - * Estimation of the bit length - *****************************************************************************/ - -/** - * Estimates the length of the encoded bit stream on the current version. - * @param entry - * @param version version of the symbol - * @return number of bits - */ -static int QRinput_estimateBitStreamSizeOfEntry(QRinput_List *entry, int version) -{ - int bits = 0; - int l, m; - int num; - - switch(entry->mode) { - case QR_MODE_NUM: - bits = QRinput_estimateBitsModeNum(entry->size); - break; - case QR_MODE_AN: - bits = QRinput_estimateBitsModeAn(entry->size); - break; - case QR_MODE_8: - bits = QRinput_estimateBitsMode8(entry->size); - break; - case QR_MODE_KANJI: - bits = QRinput_estimateBitsModeKanji(entry->size); - break; - } - - l = QRspec_lengthIndicator(entry->mode, version); - m = 1 << l; - num = (bits + m - 1) / m; - - bits += num * (4 + l); // mode indicator (4bits) + length indicator - - return bits; -} - -/** - * Estimates the length of the encoded bit stream of the data. - * @param input input data - * @param version version of the symbol - * @return number of bits - */ -int QRinput_estimateBitStreamSize(QRinput *input, int version) -{ - QRinput_List *list; - int bits = 0; - - list = input->head; - while(list != NULL) { - bits += QRinput_estimateBitStreamSizeOfEntry(list, version); - list = list->next; - } - - return bits; -} - -/** - * Estimates the required version number of the symbol. - * @param input input data - * @return required version number - */ -static int QRinput_estimateVersion(QRinput *input) -{ - int bits; - int _new, prev; - - _new = 0; - do { - prev = _new; - bits = QRinput_estimateBitStreamSize(input, prev); - _new = QRspec_getMinimumVersion((bits + 7) / 8, input->level); - if (_new == -1) { - return -1; - } - } while (_new > prev); - - return _new; -} - -/****************************************************************************** - * Data conversion - *****************************************************************************/ - -/** - * Convert the input data in the data chunk to a bit stream. - * @param entry - * @return number of bits - */ -static int QRinput_encodeBitStream(QRinput_List *entry, int version) -{ - int words; - QRinput_List *st1, *st2; - - if(entry->bstream != NULL) { - BitStream_free(entry->bstream); - entry->bstream = NULL; - } - - words = QRspec_maximumWords(entry->mode, version); - if(entry->size > words) { - st1 = QRinput_newEntry(entry->mode, words, entry->data); - st2 = QRinput_newEntry(entry->mode, entry->size - words, &entry->data[words]); - QRinput_encodeBitStream(st1, version); - QRinput_encodeBitStream(st2, version); - entry->bstream = BitStream_new(); - BitStream_append(entry->bstream, st1->bstream); - BitStream_append(entry->bstream, st2->bstream); - QRinput_freeEntry(st1); - QRinput_freeEntry(st2); - } else { - switch(entry->mode) { - case QR_MODE_NUM: - QRinput_encodeModeNum(entry, version); - break; - case QR_MODE_AN: - QRinput_encodeModeAn(entry, version); - break; - case QR_MODE_8: - QRinput_encodeMode8(entry, version); - break; - case QR_MODE_KANJI: - QRinput_encodeModeKanji(entry, version); - break; - default: - break; - } - } - - return BitStream_size(entry->bstream); -} - -/** - * Convert the input data to a bit stream. - * @param input input data. - * @return length of the bit stream. - */ -static int QRinput_createBitStream(QRinput *input) -{ - QRinput_List *list; - int bits = 0; - - list = input->head; - while(list != NULL) { - bits += QRinput_encodeBitStream(list, input->version); - list = list->next; - } - - return bits; -} - -/** - * Convert the input data to a bit stream. - * When the version number is given and that is not sufficient, it is increased - * automatically. - * @param input input data. - * @return -1 if the input data was too large. Otherwise 0. - */ -static int QRinput_convertData(QRinput *input) -{ - int bits; - int ver; - - ver = QRinput_estimateVersion(input); - if(ver > QRinput_getVersion(input)) { - QRinput_setVersion(input, ver); - } - - for(;;) { - bits = QRinput_createBitStream(input); - ver = QRspec_getMinimumVersion((bits + 7) / 8, input->level); - if(ver < 0) { - return -1; - } else if(ver > QRinput_getVersion(input)) { - QRinput_setVersion(input, ver); - } else { - break; - } - } - - return 0; -} - -/** - * Create padding bits for the input data. - * @param input input data. - * @return padding bit stream. - */ -static BitStream *QRinput_createPaddingBit(QRinput *input) -{ - int bits, maxbits, words, maxwords, i; - QRinput_List *list; - BitStream *bstream; - - if(input->version <= 0) - return NULL; - - maxwords = QRspec_getDataLength(input->version, input->level); - maxbits = maxwords * 8; - - list = input->head; - bits = 0; - while(list != NULL) { - bits += BitStream_size(list->bstream); - list = list->next; - } - - words = (bits + 7) / 8; - - if(maxbits - bits < 5) { - if(maxbits == bits) { - return NULL; - } else { - bstream = BitStream_new(); - BitStream_appendNum(bstream, maxbits - bits, 0); - return bstream; - } - } - - bits += 4; - words = (bits + 7) / 8; - - bstream = BitStream_new(); - BitStream_appendNum(bstream, words * 8 - bits + 4, 0); - - /* FIXME: It would be able to add padding bits by more efficient way. */ - for(i=0; ihead; - while(list != NULL) { - BitStream_append(bstream, list->bstream); - list = list->next; - } - - return bstream; -} - -/** - * Merge all bit streams in the input data and append padding bits - * @param input input data. - * @return padded merged bit stream - */ - -BitStream *QRinput_getBitStream(QRinput *input) -{ - BitStream *bstream; - BitStream *padding; - - bstream = QRinput_mergeBitStream(input); - if(bstream == NULL) { - return NULL; - } - padding = QRinput_createPaddingBit(input); - if(padding != NULL) { - BitStream_append(bstream, padding); - BitStream_free(padding); - } - - return bstream; -} - -/** - * Pack all bit streams padding bits into a byte array. - * @param input input data. - * @return padded merged byte stream - */ - -unsigned char *QRinput_getByteStream(QRinput *input) -{ - BitStream *bstream; - unsigned char *array; - - bstream = QRinput_getBitStream(input); - if(bstream == NULL) { - return NULL; - } - array = BitStream_toByte(bstream); - BitStream_free(bstream); - - return array; -} + +/* + * qrencode - QR Code encoder + * + * Input data chunk class + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include "qrencode.h" +#include "qrspec.h" +#include "bistream.h" +#include "qrinput.h" + +/****************************************************************************** + * Entry of input data + *****************************************************************************/ + +static QRinput_List *QRinput_newEntry(QRencodeMode mode, int size, const unsigned char *data) +{ + QRinput_List *entry; + + if(QRinput_check(mode, size, data)) { + return NULL; + } + + entry = (QRinput_List *)malloc(sizeof(QRinput_List)); + entry->mode = mode; + entry->size = size; + entry->data = (unsigned char *)malloc(size); + memcpy(entry->data, data, size); + entry->bstream = NULL; + entry->next = NULL; + + return entry; +} + +static QRinput_List *QRinput_freeEntry(QRinput_List *entry) +{ + QRinput_List *next; + + next = entry->next; + free(entry->data); + if(entry->bstream) { + BitStream_free(entry->bstream); + } + free(entry); + + return next; +} + +/****************************************************************************** + * Input Data + *****************************************************************************/ + +QRinput *QRinput_new(void) +{ + QRinput *input; + + input = (QRinput *)malloc(sizeof(QRinput)); + input->head = NULL; + input->tail = NULL; + input->version = 0; + input->level = QR_ECLEVEL_L; + + return input; +} + +int QRinput_getVersion(QRinput *input) +{ + return input->version; +} + +void QRinput_setVersion(QRinput *input, int v) +{ + input->version = v; +} + +void QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level) +{ + input->level = level; +} + +QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input) +{ + return input->level; +} + +int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data) +{ + QRinput_List *entry; + + entry = QRinput_newEntry(mode, size, data); + if(entry == NULL) { + return -1; + } + + if(input->tail == NULL) { + input->head = entry; + input->tail = entry; + } else { + input->tail->next = entry; + input->tail = entry; + } + + return 0; +} + +void QRinput_free(QRinput *input) +{ + QRinput_List *list; + + list = input->head; + while(list != NULL) { + list = QRinput_freeEntry(list); + } + + free(input); +} + +/****************************************************************************** + * Numeric data + *****************************************************************************/ + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeNum(int size, const char *data) +{ + int i; + + for(i=0; i '9') + return -1; + } + + return 0; +} + +/** + * Estimates the length of the encoded bit stream of numeric data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsModeNum(int size) +{ + int w; + int bits; + + w = size / 3; + bits = w * 10; + switch(size - w * 3) { + case 1: + bits += 4; + break; + case 2: + bits += 7; + break; + default: + break; + } + + return bits; +} + +/** + * Convert the number data to a bit stream. + * @param entry + */ +static void QRinput_encodeModeNum(QRinput_List *entry, int version) +{ + int words; + int i; + unsigned int val; + + words = entry->size / 3; + entry->bstream = BitStream_new(); + + val = 0x1; + BitStream_appendNum(entry->bstream, 4, val); + + val = entry->size; + BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_NUM, version), val); + + for(i=0; idata[i*3 ] - '0') * 100; + val += (entry->data[i*3+1] - '0') * 10; + val += (entry->data[i*3+2] - '0'); + + BitStream_appendNum(entry->bstream, 10, val); + } + + if(entry->size - words * 3 == 1) { + val = entry->data[words*3] - '0'; + BitStream_appendNum(entry->bstream, 4, val); + } else if(entry->size - words * 3 == 2) { + val = (entry->data[words*3 ] - '0') * 10; + val += (entry->data[words*3+1] - '0'); + BitStream_appendNum(entry->bstream, 7, val); + } +} + +/****************************************************************************** + * Alphabet-numeric data + *****************************************************************************/ + +const signed char QRinput_anTable[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1 +}; + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeAn(int size, const char *data) +{ + int i; + + for(i=0; isize / 2; + entry->bstream = BitStream_new(); + + val = 0x2; + BitStream_appendNum(entry->bstream, 4, val); + + val = entry->size; + BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_AN, version), val); + + for(i=0; idata[i*2 ]) * 45; + val += (unsigned int)QRinput_lookAnTable(entry->data[i*2+1]); + + BitStream_appendNum(entry->bstream, 11, val); + } + + if(entry->size & 1) { + val = (unsigned int)QRinput_lookAnTable(entry->data[words * 2]); + + BitStream_appendNum(entry->bstream, 6, val); + } +} + +/****************************************************************************** + * 8 bit data + *****************************************************************************/ + +/** + * Estimates the length of the encoded bit stream of 8 bit data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsMode8(int size) +{ + return size * 8; +} + +/** + * Convert the 8bits data to a bit stream. + * @param entry + */ +static void QRinput_encodeMode8(QRinput_List *entry, int version) +{ + int i; + unsigned int val; + + entry->bstream = BitStream_new(); + + val = 0x4; + BitStream_appendNum(entry->bstream, 4, val); + + val = entry->size; + BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_8, version), val); + + for(i=0; isize; i++) { + BitStream_appendNum(entry->bstream, 8, entry->data[i]); + } +} + + +/****************************************************************************** + * Kanji data + *****************************************************************************/ + +/** + * Estimates the length of the encoded bit stream of kanji data. + * @param size + * @return number of bits + */ +int QRinput_estimateBitsModeKanji(int size) +{ + return (size / 2) * 13; +} + +/** + * Check the input data. + * @param size + * @param data + * @return result + */ +static int QRinput_checkModeKanji(int size, const unsigned char *data) +{ + int i; + unsigned int val; + + if(size & 1) + return -1; + + for(i=0; i 0x9ffc && val < 0xe040) || val > 0xebbf) { + return -1; + } + } + + return 0; +} + +/** + * Convert the kanji data to a bit stream. + * @param entry + */ +static void QRinput_encodeModeKanji(QRinput_List *entry, int version) +{ + int i; + unsigned int val, h; + + entry->bstream = BitStream_new(); + + val = 0x8; + BitStream_appendNum(entry->bstream, 4, val); + + val = entry->size / 2; + BitStream_appendNum(entry->bstream, QRspec_lengthIndicator(QR_MODE_KANJI, version), val); + + for(i=0; isize; i+=2) { + val = ((unsigned int)entry->data[i] << 8) | entry->data[i+1]; + if(val <= 0x9ffc) { + val -= 0x8140; + } else { + val -= 0xc140; + } + h = (val >> 8) * 0xc0; + val = (val & 0xff) + h; + + BitStream_appendNum(entry->bstream, 13, val); + } +} + +/****************************************************************************** + * Validation + *****************************************************************************/ + +/** + * Validate the input data + * @param mode + * @param size + * @param data + * @return result + */ +int QRinput_check(QRencodeMode mode, int size, const unsigned char *data) +{ + switch(mode) { + case QR_MODE_NUM: + return QRinput_checkModeNum(size, (const char *)data); + break; + case QR_MODE_AN: + return QRinput_checkModeAn(size, (const char *)data); + break; + case QR_MODE_KANJI: + return QRinput_checkModeKanji(size, data); + break; + default: + break; + } + + return 0; +} + +QRencodeMode QRinput_identifyMode(const char *string) +{ + unsigned char c, d; + unsigned int word; + + c = string[0]; + + if((unsigned char)((signed char)c - '0') < 10) { + return QR_MODE_NUM; + } else if((QRinput_lookAnTable(c)) >= 0) { + return QR_MODE_AN; + } else { + d = string[1]; + if(d != '\0') { + word = ((unsigned int)c << 8) | d; + if((word >= 0x8140 && word <= 0x9ffc) || (word >= 0xe040 && word <= 0xebbf)) { + return QR_MODE_KANJI; + } + } + } + + return QR_MODE_8; +} + +/****************************************************************************** + * Estimation of the bit length + *****************************************************************************/ + +/** + * Estimates the length of the encoded bit stream on the current version. + * @param entry + * @param version version of the symbol + * @return number of bits + */ +static int QRinput_estimateBitStreamSizeOfEntry(QRinput_List *entry, int version) +{ + int bits = 0; + int l, m; + int num; + + switch(entry->mode) { + case QR_MODE_NUM: + bits = QRinput_estimateBitsModeNum(entry->size); + break; + case QR_MODE_AN: + bits = QRinput_estimateBitsModeAn(entry->size); + break; + case QR_MODE_8: + bits = QRinput_estimateBitsMode8(entry->size); + break; + case QR_MODE_KANJI: + bits = QRinput_estimateBitsModeKanji(entry->size); + break; + } + + l = QRspec_lengthIndicator(entry->mode, version); + m = 1 << l; + num = (bits + m - 1) / m; + + bits += num * (4 + l); // mode indicator (4bits) + length indicator + + return bits; +} + +/** + * Estimates the length of the encoded bit stream of the data. + * @param input input data + * @param version version of the symbol + * @return number of bits + */ +int QRinput_estimateBitStreamSize(QRinput *input, int version) +{ + QRinput_List *list; + int bits = 0; + + list = input->head; + while(list != NULL) { + bits += QRinput_estimateBitStreamSizeOfEntry(list, version); + list = list->next; + } + + return bits; +} + +/** + * Estimates the required version number of the symbol. + * @param input input data + * @return required version number + */ +static int QRinput_estimateVersion(QRinput *input) +{ + int bits; + int _new, prev; + + _new = 0; + do { + prev = _new; + bits = QRinput_estimateBitStreamSize(input, prev); + _new = QRspec_getMinimumVersion((bits + 7) / 8, input->level); + if (_new == -1) { + return -1; + } + } while (_new > prev); + + return _new; +} + +/****************************************************************************** + * Data conversion + *****************************************************************************/ + +/** + * Convert the input data in the data chunk to a bit stream. + * @param entry + * @return number of bits + */ +static int QRinput_encodeBitStream(QRinput_List *entry, int version) +{ + int words; + QRinput_List *st1, *st2; + + if(entry->bstream != NULL) { + BitStream_free(entry->bstream); + entry->bstream = NULL; + } + + words = QRspec_maximumWords(entry->mode, version); + if(entry->size > words) { + st1 = QRinput_newEntry(entry->mode, words, entry->data); + st2 = QRinput_newEntry(entry->mode, entry->size - words, &entry->data[words]); + QRinput_encodeBitStream(st1, version); + QRinput_encodeBitStream(st2, version); + entry->bstream = BitStream_new(); + BitStream_append(entry->bstream, st1->bstream); + BitStream_append(entry->bstream, st2->bstream); + QRinput_freeEntry(st1); + QRinput_freeEntry(st2); + } else { + switch(entry->mode) { + case QR_MODE_NUM: + QRinput_encodeModeNum(entry, version); + break; + case QR_MODE_AN: + QRinput_encodeModeAn(entry, version); + break; + case QR_MODE_8: + QRinput_encodeMode8(entry, version); + break; + case QR_MODE_KANJI: + QRinput_encodeModeKanji(entry, version); + break; + default: + break; + } + } + + return BitStream_size(entry->bstream); +} + +/** + * Convert the input data to a bit stream. + * @param input input data. + * @return length of the bit stream. + */ +static int QRinput_createBitStream(QRinput *input) +{ + QRinput_List *list; + int bits = 0; + + list = input->head; + while(list != NULL) { + bits += QRinput_encodeBitStream(list, input->version); + list = list->next; + } + + return bits; +} + +/** + * Convert the input data to a bit stream. + * When the version number is given and that is not sufficient, it is increased + * automatically. + * @param input input data. + * @return -1 if the input data was too large. Otherwise 0. + */ +static int QRinput_convertData(QRinput *input) +{ + int bits; + int ver; + + ver = QRinput_estimateVersion(input); + if(ver > QRinput_getVersion(input)) { + QRinput_setVersion(input, ver); + } + + for(;;) { + bits = QRinput_createBitStream(input); + ver = QRspec_getMinimumVersion((bits + 7) / 8, input->level); + if(ver < 0) { + return -1; + } else if(ver > QRinput_getVersion(input)) { + QRinput_setVersion(input, ver); + } else { + break; + } + } + + return 0; +} + +/** + * Create padding bits for the input data. + * @param input input data. + * @return padding bit stream. + */ +static BitStream *QRinput_createPaddingBit(QRinput *input) +{ + int bits, maxbits, words, maxwords, i; + QRinput_List *list; + BitStream *bstream; + + if(input->version <= 0) + return NULL; + + maxwords = QRspec_getDataLength(input->version, input->level); + maxbits = maxwords * 8; + + list = input->head; + bits = 0; + while(list != NULL) { + bits += BitStream_size(list->bstream); + list = list->next; + } + + words = (bits + 7) / 8; + + if(maxbits - bits < 5) { + if(maxbits == bits) { + return NULL; + } else { + bstream = BitStream_new(); + BitStream_appendNum(bstream, maxbits - bits, 0); + return bstream; + } + } + + bits += 4; + words = (bits + 7) / 8; + + bstream = BitStream_new(); + BitStream_appendNum(bstream, words * 8 - bits + 4, 0); + + /* FIXME: It would be able to add padding bits by more efficient way. */ + for(i=0; ihead; + while(list != NULL) { + BitStream_append(bstream, list->bstream); + list = list->next; + } + + return bstream; +} + +/** + * Merge all bit streams in the input data and append padding bits + * @param input input data. + * @return padded merged bit stream + */ + +BitStream *QRinput_getBitStream(QRinput *input) +{ + BitStream *bstream; + BitStream *padding; + + bstream = QRinput_mergeBitStream(input); + if(bstream == NULL) { + return NULL; + } + padding = QRinput_createPaddingBit(input); + if(padding != NULL) { + BitStream_append(bstream, padding); + BitStream_free(padding); + } + + return bstream; +} + +/** + * Pack all bit streams padding bits into a byte array. + * @param input input data. + * @return padded merged byte stream + */ + +unsigned char *QRinput_getByteStream(QRinput *input) +{ + BitStream *bstream; + unsigned char *array; + + bstream = QRinput_getBitStream(input); + if(bstream == NULL) { + return NULL; + } + array = BitStream_toByte(bstream); + BitStream_free(bstream); + + return array; +} diff --git a/QtQREnCode/qrinput.h b/QtQREnCode/qrinput.h index 5892c48..e2f2d84 100644 --- a/QtQREnCode/qrinput.h +++ b/QtQREnCode/qrinput.h @@ -1,124 +1,124 @@ -/* - * qrencode - QR Code encoder - * - * Input data chunk class - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QRINPUT_H -#define QRINPUT_H - -#include "qrencode.h" -#include "bitstream.h" - -int QRinput_isSplittableMode(QRencodeMode mode); - -/****************************************************************************** - * Entry of input data - *****************************************************************************/ -typedef struct _QRinput_List QRinput_List; - -struct _QRinput_List { - QRencodeMode mode; - int size; ///< Size of data chunk (byte). - unsigned char *data; ///< Data chunk. - BitStream *bstream; - QRinput_List *next; -}; - -/****************************************************************************** - * Input Data - *****************************************************************************/ -struct _QRinput { - int version; - QRecLevel level; - QRinput_List *head; - QRinput_List *tail; - int mqr; - int fnc1; - unsigned char appid; -}; - -/****************************************************************************** - * Structured append input data - *****************************************************************************/ -typedef struct _QRinput_InputList QRinput_InputList; - -struct _QRinput_InputList { - QRinput *input; - QRinput_InputList *next; -}; - -struct _QRinput_Struct { - int size; ///< number of structured symbols - int parity; - QRinput_InputList *head; - QRinput_InputList *tail; -}; - -/** - * Pack all bit streams padding bits into a byte array. - * @param input input data. - * @return padded merged byte stream - */ -extern unsigned char *QRinput_getByteStream(QRinput *input); - - -extern int QRinput_estimateBitsModeNum(int size); -extern int QRinput_estimateBitsModeAn(int size); -extern int QRinput_estimateBitsMode8(int size); -extern int QRinput_estimateBitsModeKanji(int size); - -extern QRinput *QRinput_dup(QRinput *input); - -extern const signed char QRinput_anTable[128]; - -/** - * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19). - * @param __c__ character - * @return value - */ -#define QRinput_lookAnTable(__c__) \ - ((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__]) - -/** - * Length of a standard mode indicator in bits. - */ - -#define MODE_INDICATOR_SIZE 4 - -/** - * Length of a segment of structured-append header. - */ -#define STRUCTURE_HEADER_SIZE 20 - -/** - * Maximum number of symbols in a set of structured-appended symbols. - */ -#define MAX_STRUCTURED_SYMBOLS 16 - -#ifdef WITH_TESTS -extern int QRinput_mergeBitStream(QRinput *input, BitStream *bstream); -extern int QRinput_getBitStream(QRinput *input, BitStream *bstream); -extern int QRinput_estimateBitStreamSize(QRinput *input, int version); -extern int QRinput_splitEntry(QRinput_List *entry, int bytes); -extern int QRinput_estimateVersion(QRinput *input); -extern int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits); -extern int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int index, unsigned char parity); -#endif - -#endif /* QRINPUT_H */ +/* + * qrencode - QR Code encoder + * + * Input data chunk class + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QRINPUT_H +#define QRINPUT_H + +#include "qrencode.h" +#include "bitstream.h" + +int QRinput_isSplittableMode(QRencodeMode mode); + +/****************************************************************************** + * Entry of input data + *****************************************************************************/ +typedef struct _QRinput_List QRinput_List; + +struct _QRinput_List { + QRencodeMode mode; + int size; ///< Size of data chunk (byte). + unsigned char *data; ///< Data chunk. + BitStream *bstream; + QRinput_List *next; +}; + +/****************************************************************************** + * Input Data + *****************************************************************************/ +struct _QRinput { + int version; + QRecLevel level; + QRinput_List *head; + QRinput_List *tail; + int mqr; + int fnc1; + unsigned char appid; +}; + +/****************************************************************************** + * Structured append input data + *****************************************************************************/ +typedef struct _QRinput_InputList QRinput_InputList; + +struct _QRinput_InputList { + QRinput *input; + QRinput_InputList *next; +}; + +struct _QRinput_Struct { + int size; ///< number of structured symbols + int parity; + QRinput_InputList *head; + QRinput_InputList *tail; +}; + +/** + * Pack all bit streams padding bits into a byte array. + * @param input input data. + * @return padded merged byte stream + */ +extern unsigned char *QRinput_getByteStream(QRinput *input); + + +extern int QRinput_estimateBitsModeNum(int size); +extern int QRinput_estimateBitsModeAn(int size); +extern int QRinput_estimateBitsMode8(int size); +extern int QRinput_estimateBitsModeKanji(int size); + +extern QRinput *QRinput_dup(QRinput *input); + +extern const signed char QRinput_anTable[128]; + +/** + * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19). + * @param __c__ character + * @return value + */ +#define QRinput_lookAnTable(__c__) \ + ((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__]) + +/** + * Length of a standard mode indicator in bits. + */ + +#define MODE_INDICATOR_SIZE 4 + +/** + * Length of a segment of structured-append header. + */ +#define STRUCTURE_HEADER_SIZE 20 + +/** + * Maximum number of symbols in a set of structured-appended symbols. + */ +#define MAX_STRUCTURED_SYMBOLS 16 + +#ifdef WITH_TESTS +extern int QRinput_mergeBitStream(QRinput *input, BitStream *bstream); +extern int QRinput_getBitStream(QRinput *input, BitStream *bstream); +extern int QRinput_estimateBitStreamSize(QRinput *input, int version); +extern int QRinput_splitEntry(QRinput_List *entry, int bytes); +extern int QRinput_estimateVersion(QRinput *input); +extern int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits); +extern int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int index, unsigned char parity); +#endif + +#endif /* QRINPUT_H */ diff --git a/QtQREnCode/qrspec.c b/QtQREnCode/qrspec.c index f3d3b2c..5bb4b6f 100644 --- a/QtQREnCode/qrspec.c +++ b/QtQREnCode/qrspec.c @@ -1,514 +1,514 @@ -/* - * qrencode - QR Code encoder - * - * QR Code specification in convenient format. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include - -#include "qrspec.h" -#include "qrinput.h" - -/****************************************************************************** - * Version and capacity - *****************************************************************************/ - -typedef struct { - int width; //< Edge length of the symbol - int words; //< Data capacity (bytes) - int remainder; //< Remainder bit (bits) - int ec[4]; //< Number of ECC code (bytes) -} QRspec_Capacity; - -/** - * Table of the capacity of symbols - * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004. - */ -static const QRspec_Capacity qrspecCapacity[QRSPEC_VERSION_MAX + 1] = { - { 0, 0, 0, { 0, 0, 0, 0}}, - { 21, 26, 0, { 7, 10, 13, 17}}, // 1 - { 25, 44, 7, { 10, 16, 22, 28}}, - { 29, 70, 7, { 15, 26, 36, 44}}, - { 33, 100, 7, { 20, 36, 52, 64}}, - { 37, 134, 7, { 26, 48, 72, 88}}, // 5 - { 41, 172, 7, { 36, 64, 96, 112}}, - { 45, 196, 0, { 40, 72, 108, 130}}, - { 49, 242, 0, { 48, 88, 132, 156}}, - { 53, 292, 0, { 60, 110, 160, 192}}, - { 57, 346, 0, { 72, 130, 192, 224}}, //10 - { 61, 404, 0, { 80, 150, 224, 264}}, - { 65, 466, 0, { 96, 176, 260, 308}}, - { 69, 532, 0, { 104, 198, 288, 352}}, - { 73, 581, 3, { 120, 216, 320, 384}}, - { 77, 655, 3, { 132, 240, 360, 432}}, //15 - { 81, 733, 3, { 144, 280, 408, 480}}, - { 85, 815, 3, { 168, 308, 448, 532}}, - { 89, 901, 3, { 180, 338, 504, 588}}, - { 93, 991, 3, { 196, 364, 546, 650}}, - { 97, 1085, 3, { 224, 416, 600, 700}}, //20 - {101, 1156, 4, { 224, 442, 644, 750}}, - {105, 1258, 4, { 252, 476, 690, 816}}, - {109, 1364, 4, { 270, 504, 750, 900}}, - {113, 1474, 4, { 300, 560, 810, 960}}, - {117, 1588, 4, { 312, 588, 870, 1050}}, //25 - {121, 1706, 4, { 336, 644, 952, 1110}}, - {125, 1828, 4, { 360, 700, 1020, 1200}}, - {129, 1921, 3, { 390, 728, 1050, 1260}}, - {133, 2051, 3, { 420, 784, 1140, 1350}}, - {137, 2185, 3, { 450, 812, 1200, 1440}}, //30 - {141, 2323, 3, { 480, 868, 1290, 1530}}, - {145, 2465, 3, { 510, 924, 1350, 1620}}, - {149, 2611, 3, { 540, 980, 1440, 1710}}, - {153, 2761, 3, { 570, 1036, 1530, 1800}}, - {157, 2876, 0, { 570, 1064, 1590, 1890}}, //35 - {161, 3034, 0, { 600, 1120, 1680, 1980}}, - {165, 3196, 0, { 630, 1204, 1770, 2100}}, - {169, 3362, 0, { 660, 1260, 1860, 2220}}, - {173, 3532, 0, { 720, 1316, 1950, 2310}}, - {177, 3706, 0, { 750, 1372, 2040, 2430}} //40 -}; - -int QRspec_getDataLength(int version, QRecLevel level) -{ - return qrspecCapacity[version].words - qrspecCapacity[version].ec[level]; -} - -int QRspec_getECCLength(int version, QRecLevel level) -{ - return qrspecCapacity[version].ec[level]; -} - -int QRspec_getMinimumVersion(int size, QRecLevel level) -{ - int i; - int words; - - for(i = 1; i <= QRSPEC_VERSION_MAX; i++) { - words = qrspecCapacity[i].words - qrspecCapacity[i].ec[level]; - if(words >= size) return i; - } - - return QRSPEC_VERSION_MAX; -} - -int QRspec_getWidth(int version) -{ - return qrspecCapacity[version].width; -} - -int QRspec_getRemainder(int version) -{ - return qrspecCapacity[version].remainder; -} - -/****************************************************************************** - * Length indicator - *****************************************************************************/ - -static const int lengthTableBits[4][3] = { - {10, 12, 14}, - { 9, 11, 13}, - { 8, 16, 16}, - { 8, 10, 12} -}; - -int QRspec_lengthIndicator(QRencodeMode mode, int version) -{ - int l; - - if(!QRinput_isSplittableMode(mode)) return 0; - if(version <= 9) { - l = 0; - } else if(version <= 26) { - l = 1; - } else { - l = 2; - } - - return lengthTableBits[mode][l]; -} - -int QRspec_maximumWords(QRencodeMode mode, int version) -{ - int l; - int bits; - int words; - - if(!QRinput_isSplittableMode(mode)) return 0; - if(version <= 9) { - l = 0; - } else if(version <= 26) { - l = 1; - } else { - l = 2; - } - - bits = lengthTableBits[mode][l]; - words = (1 << bits) - 1; - if(mode == QR_MODE_KANJI) { - words *= 2; // the number of bytes is required - } - - return words; -} - -/****************************************************************************** - * Error correction code - *****************************************************************************/ - -/** - * Table of the error correction code (Reed-Solomon block) - * See Table 12-16 (pp.30-36), JIS X0510:2004. - */ -static const int eccTable[QRSPEC_VERSION_MAX+1][4][2] = { - {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}}, - {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, // 1 - {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, - {{ 1, 0}, { 1, 0}, { 2, 0}, { 2, 0}}, - {{ 1, 0}, { 2, 0}, { 2, 0}, { 4, 0}}, - {{ 1, 0}, { 2, 0}, { 2, 2}, { 2, 2}}, // 5 - {{ 2, 0}, { 4, 0}, { 4, 0}, { 4, 0}}, - {{ 2, 0}, { 4, 0}, { 2, 4}, { 4, 1}}, - {{ 2, 0}, { 2, 2}, { 4, 2}, { 4, 2}}, - {{ 2, 0}, { 3, 2}, { 4, 4}, { 4, 4}}, - {{ 2, 2}, { 4, 1}, { 6, 2}, { 6, 2}}, //10 - {{ 4, 0}, { 1, 4}, { 4, 4}, { 3, 8}}, - {{ 2, 2}, { 6, 2}, { 4, 6}, { 7, 4}}, - {{ 4, 0}, { 8, 1}, { 8, 4}, {12, 4}}, - {{ 3, 1}, { 4, 5}, {11, 5}, {11, 5}}, - {{ 5, 1}, { 5, 5}, { 5, 7}, {11, 7}}, //15 - {{ 5, 1}, { 7, 3}, {15, 2}, { 3, 13}}, - {{ 1, 5}, {10, 1}, { 1, 15}, { 2, 17}}, - {{ 5, 1}, { 9, 4}, {17, 1}, { 2, 19}}, - {{ 3, 4}, { 3, 11}, {17, 4}, { 9, 16}}, - {{ 3, 5}, { 3, 13}, {15, 5}, {15, 10}}, //20 - {{ 4, 4}, {17, 0}, {17, 6}, {19, 6}}, - {{ 2, 7}, {17, 0}, { 7, 16}, {34, 0}}, - {{ 4, 5}, { 4, 14}, {11, 14}, {16, 14}}, - {{ 6, 4}, { 6, 14}, {11, 16}, {30, 2}}, - {{ 8, 4}, { 8, 13}, { 7, 22}, {22, 13}}, //25 - {{10, 2}, {19, 4}, {28, 6}, {33, 4}}, - {{ 8, 4}, {22, 3}, { 8, 26}, {12, 28}}, - {{ 3, 10}, { 3, 23}, { 4, 31}, {11, 31}}, - {{ 7, 7}, {21, 7}, { 1, 37}, {19, 26}}, - {{ 5, 10}, {19, 10}, {15, 25}, {23, 25}}, //30 - {{13, 3}, { 2, 29}, {42, 1}, {23, 28}}, - {{17, 0}, {10, 23}, {10, 35}, {19, 35}}, - {{17, 1}, {14, 21}, {29, 19}, {11, 46}}, - {{13, 6}, {14, 23}, {44, 7}, {59, 1}}, - {{12, 7}, {12, 26}, {39, 14}, {22, 41}}, //35 - {{ 6, 14}, { 6, 34}, {46, 10}, { 2, 64}}, - {{17, 4}, {29, 14}, {49, 10}, {24, 46}}, - {{ 4, 18}, {13, 32}, {48, 14}, {42, 32}}, - {{20, 4}, {40, 7}, {43, 22}, {10, 67}}, - {{19, 6}, {18, 31}, {34, 34}, {20, 61}},//40 -}; - -void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]) -{ - int b1, b2; - int data, ecc; - - b1 = eccTable[version][level][0]; - b2 = eccTable[version][level][1]; - data = QRspec_getDataLength(version, level); - ecc = QRspec_getECCLength(version, level); - - if(b2 == 0) { - spec[0] = b1; - spec[1] = data / b1; - spec[2] = ecc / b1; - spec[3] = spec[4] = 0; - } else { - spec[0] = b1; - spec[1] = data / (b1 + b2); - spec[2] = ecc / (b1 + b2); - spec[3] = b2; - spec[4] = spec[1] + 1; - } -} - -/****************************************************************************** - * Alignment pattern - *****************************************************************************/ - -/** - * Positions of alignment patterns. - * This array includes only the second and the third position of the alignment - * patterns. Rest of them can be calculated from the distance between them. - * - * See Table 1 in Appendix E (pp.71) of JIS X0510:2004. - */ -static const int alignmentPattern[QRSPEC_VERSION_MAX+1][2] = { - { 0, 0}, - { 0, 0}, {18, 0}, {22, 0}, {26, 0}, {30, 0}, // 1- 5 - {34, 0}, {22, 38}, {24, 42}, {26, 46}, {28, 50}, // 6-10 - {30, 54}, {32, 58}, {34, 62}, {26, 46}, {26, 48}, //11-15 - {26, 50}, {30, 54}, {30, 56}, {30, 58}, {34, 62}, //16-20 - {28, 50}, {26, 50}, {30, 54}, {28, 54}, {32, 58}, //21-25 - {30, 58}, {34, 62}, {26, 50}, {30, 54}, {26, 52}, //26-30 - {30, 56}, {34, 60}, {30, 58}, {34, 62}, {30, 54}, //31-35 - {24, 50}, {28, 54}, {32, 58}, {26, 54}, {30, 58}, //35-40 -}; - -/** - * Put an alignment marker. - * @param frame - * @param width - * @param ox,oy center coordinate of the pattern - */ -static void QRspec_putAlignmentMarker(unsigned char *frame, int width, int ox, int oy) -{ - static const unsigned char finder[] = { - 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, - 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, - 0xa1, 0xa0, 0xa1, 0xa0, 0xa1, - 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, - 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, - }; - int x, y; - const unsigned char *s; - - frame += (oy - 2) * width + ox - 2; - s = finder; - for(y = 0; y < 5; y++) { - for(x = 0; x < 5; x++) { - frame[x] = s[x]; - } - frame += width; - s += 5; - } -} - -static void QRspec_putAlignmentPattern(int version, unsigned char *frame, int width) -{ - int d, w, x, y, cx, cy; - - if(version < 2) return; - - d = alignmentPattern[version][1] - alignmentPattern[version][0]; - if(d < 0) { - w = 2; - } else { - w = (width - alignmentPattern[version][0]) / d + 2; - } - - if(w * w - 3 == 1) { - x = alignmentPattern[version][0]; - y = alignmentPattern[version][0]; - QRspec_putAlignmentMarker(frame, width, x, y); - return; - } - - cx = alignmentPattern[version][0]; - for(x = 1; x < w - 1; x++) { - QRspec_putAlignmentMarker(frame, width, 6, cx); - QRspec_putAlignmentMarker(frame, width, cx, 6); - cx += d; - } - - cy = alignmentPattern[version][0]; - for(y = 0; y < w-1; y++) { - cx = alignmentPattern[version][0]; - for(x = 0; x < w-1; x++) { - QRspec_putAlignmentMarker(frame, width, cx, cy); - cx += d; - } - cy += d; - } -} - -/****************************************************************************** - * Version information pattern - *****************************************************************************/ - -/** - * Version information pattern (BCH coded). - * See Table 1 in Appendix D (pp.68) of JIS X0510:2004. - */ -static const unsigned int versionPattern[QRSPEC_VERSION_MAX - 6] = { - 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, - 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, - 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, - 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, - 0x27541, 0x28c69 -}; - -unsigned int QRspec_getVersionPattern(int version) -{ - if(version < 7 || version > QRSPEC_VERSION_MAX) return 0; - - return versionPattern[version - 7]; -} - -/****************************************************************************** - * Format information - *****************************************************************************/ - -/* See calcFormatInfo in tests/test_qrspec.c */ -static const unsigned int formatInfo[4][8] = { - {0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976}, - {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0}, - {0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed}, - {0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b} -}; - -unsigned int QRspec_getFormatInfo(int mask, QRecLevel level) -{ - if(mask < 0 || mask > 7) return 0; - - return formatInfo[level][mask]; -} - -/****************************************************************************** - * Frame - *****************************************************************************/ - -/** - * Put a finder pattern. - * @param frame - * @param width - * @param ox,oy upper-left coordinate of the pattern - */ -static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) -{ - static const unsigned char finder[] = { - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - }; - int x, y; - const unsigned char *s; - - frame += oy * width + ox; - s = finder; - for(y = 0; y < 7; y++) { - for(x = 0; x < 7; x++) { - frame[x] = s[x]; - } - frame += width; - s += 7; - } -} - - -static unsigned char *QRspec_createFrame(int version) -{ - unsigned char *frame, *p, *q; - int width; - int x, y; - unsigned int verinfo, v; - - width = qrspecCapacity[version].width; - frame = (unsigned char *)malloc((size_t)(width * width)); - if(frame == NULL) return NULL; - - memset(frame, 0, (size_t)(width * width)); - /* Finder pattern */ - putFinderPattern(frame, width, 0, 0); - putFinderPattern(frame, width, width - 7, 0); - putFinderPattern(frame, width, 0, width - 7); - /* Separator */ - p = frame; - q = frame + width * (width - 7); - for(y = 0; y < 7; y++) { - p[7] = 0xc0; - p[width - 8] = 0xc0; - q[7] = 0xc0; - p += width; - q += width; - } - memset(frame + width * 7, 0xc0, 8); - memset(frame + width * 8 - 8, 0xc0, 8); - memset(frame + width * (width - 8), 0xc0, 8); - /* Mask format information area */ - memset(frame + width * 8, 0x84, 9); - memset(frame + width * 9 - 8, 0x84, 8); - p = frame + 8; - for(y = 0; y < 8; y++) { - *p = 0x84; - p += width; - } - p = frame + width * (width - 7) + 8; - for(y = 0; y < 7; y++) { - *p = 0x84; - p += width; - } - /* Timing pattern */ - p = frame + width * 6 + 8; - q = frame + width * 8 + 6; - for(x = 1; x < width-15; x++) { - *p = 0x90 | (x & 1); - *q = 0x90 | (x & 1); - p++; - q += width; - } - /* Alignment pattern */ - QRspec_putAlignmentPattern(version, frame, width); - - /* Version information */ - if(version >= 7) { - verinfo = QRspec_getVersionPattern(version); - - p = frame + width * (width - 11); - v = verinfo; - for(x = 0; x < 6; x++) { - for(y = 0; y < 3; y++) { - p[width * y + x] = 0x88 | (v & 1); - v = v >> 1; - } - } - - p = frame + width - 11; - v = verinfo; - for(y = 0; y < 6; y++) { - for(x = 0; x < 3; x++) { - p[x] = 0x88 | (v & 1); - v = v >> 1; - } - p += width; - } - } - /* and a little bit... */ - frame[width * (width - 8) + 8] = 0x81; - - return frame; -} - -unsigned char *QRspec_newFrame(int version) -{ - if(version < 1 || version > QRSPEC_VERSION_MAX) return NULL; - - return QRspec_createFrame(version); -} +/* + * qrencode - QR Code encoder + * + * QR Code specification in convenient format. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "qrspec.h" +#include "qrinput.h" + +/****************************************************************************** + * Version and capacity + *****************************************************************************/ + +typedef struct { + int width; //< Edge length of the symbol + int words; //< Data capacity (bytes) + int remainder; //< Remainder bit (bits) + int ec[4]; //< Number of ECC code (bytes) +} QRspec_Capacity; + +/** + * Table of the capacity of symbols + * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004. + */ +static const QRspec_Capacity qrspecCapacity[QRSPEC_VERSION_MAX + 1] = { + { 0, 0, 0, { 0, 0, 0, 0}}, + { 21, 26, 0, { 7, 10, 13, 17}}, // 1 + { 25, 44, 7, { 10, 16, 22, 28}}, + { 29, 70, 7, { 15, 26, 36, 44}}, + { 33, 100, 7, { 20, 36, 52, 64}}, + { 37, 134, 7, { 26, 48, 72, 88}}, // 5 + { 41, 172, 7, { 36, 64, 96, 112}}, + { 45, 196, 0, { 40, 72, 108, 130}}, + { 49, 242, 0, { 48, 88, 132, 156}}, + { 53, 292, 0, { 60, 110, 160, 192}}, + { 57, 346, 0, { 72, 130, 192, 224}}, //10 + { 61, 404, 0, { 80, 150, 224, 264}}, + { 65, 466, 0, { 96, 176, 260, 308}}, + { 69, 532, 0, { 104, 198, 288, 352}}, + { 73, 581, 3, { 120, 216, 320, 384}}, + { 77, 655, 3, { 132, 240, 360, 432}}, //15 + { 81, 733, 3, { 144, 280, 408, 480}}, + { 85, 815, 3, { 168, 308, 448, 532}}, + { 89, 901, 3, { 180, 338, 504, 588}}, + { 93, 991, 3, { 196, 364, 546, 650}}, + { 97, 1085, 3, { 224, 416, 600, 700}}, //20 + {101, 1156, 4, { 224, 442, 644, 750}}, + {105, 1258, 4, { 252, 476, 690, 816}}, + {109, 1364, 4, { 270, 504, 750, 900}}, + {113, 1474, 4, { 300, 560, 810, 960}}, + {117, 1588, 4, { 312, 588, 870, 1050}}, //25 + {121, 1706, 4, { 336, 644, 952, 1110}}, + {125, 1828, 4, { 360, 700, 1020, 1200}}, + {129, 1921, 3, { 390, 728, 1050, 1260}}, + {133, 2051, 3, { 420, 784, 1140, 1350}}, + {137, 2185, 3, { 450, 812, 1200, 1440}}, //30 + {141, 2323, 3, { 480, 868, 1290, 1530}}, + {145, 2465, 3, { 510, 924, 1350, 1620}}, + {149, 2611, 3, { 540, 980, 1440, 1710}}, + {153, 2761, 3, { 570, 1036, 1530, 1800}}, + {157, 2876, 0, { 570, 1064, 1590, 1890}}, //35 + {161, 3034, 0, { 600, 1120, 1680, 1980}}, + {165, 3196, 0, { 630, 1204, 1770, 2100}}, + {169, 3362, 0, { 660, 1260, 1860, 2220}}, + {173, 3532, 0, { 720, 1316, 1950, 2310}}, + {177, 3706, 0, { 750, 1372, 2040, 2430}} //40 +}; + +int QRspec_getDataLength(int version, QRecLevel level) +{ + return qrspecCapacity[version].words - qrspecCapacity[version].ec[level]; +} + +int QRspec_getECCLength(int version, QRecLevel level) +{ + return qrspecCapacity[version].ec[level]; +} + +int QRspec_getMinimumVersion(int size, QRecLevel level) +{ + int i; + int words; + + for(i = 1; i <= QRSPEC_VERSION_MAX; i++) { + words = qrspecCapacity[i].words - qrspecCapacity[i].ec[level]; + if(words >= size) return i; + } + + return QRSPEC_VERSION_MAX; +} + +int QRspec_getWidth(int version) +{ + return qrspecCapacity[version].width; +} + +int QRspec_getRemainder(int version) +{ + return qrspecCapacity[version].remainder; +} + +/****************************************************************************** + * Length indicator + *****************************************************************************/ + +static const int lengthTableBits[4][3] = { + {10, 12, 14}, + { 9, 11, 13}, + { 8, 16, 16}, + { 8, 10, 12} +}; + +int QRspec_lengthIndicator(QRencodeMode mode, int version) +{ + int l; + + if(!QRinput_isSplittableMode(mode)) return 0; + if(version <= 9) { + l = 0; + } else if(version <= 26) { + l = 1; + } else { + l = 2; + } + + return lengthTableBits[mode][l]; +} + +int QRspec_maximumWords(QRencodeMode mode, int version) +{ + int l; + int bits; + int words; + + if(!QRinput_isSplittableMode(mode)) return 0; + if(version <= 9) { + l = 0; + } else if(version <= 26) { + l = 1; + } else { + l = 2; + } + + bits = lengthTableBits[mode][l]; + words = (1 << bits) - 1; + if(mode == QR_MODE_KANJI) { + words *= 2; // the number of bytes is required + } + + return words; +} + +/****************************************************************************** + * Error correction code + *****************************************************************************/ + +/** + * Table of the error correction code (Reed-Solomon block) + * See Table 12-16 (pp.30-36), JIS X0510:2004. + */ +static const int eccTable[QRSPEC_VERSION_MAX+1][4][2] = { + {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}}, + {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, // 1 + {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, + {{ 1, 0}, { 1, 0}, { 2, 0}, { 2, 0}}, + {{ 1, 0}, { 2, 0}, { 2, 0}, { 4, 0}}, + {{ 1, 0}, { 2, 0}, { 2, 2}, { 2, 2}}, // 5 + {{ 2, 0}, { 4, 0}, { 4, 0}, { 4, 0}}, + {{ 2, 0}, { 4, 0}, { 2, 4}, { 4, 1}}, + {{ 2, 0}, { 2, 2}, { 4, 2}, { 4, 2}}, + {{ 2, 0}, { 3, 2}, { 4, 4}, { 4, 4}}, + {{ 2, 2}, { 4, 1}, { 6, 2}, { 6, 2}}, //10 + {{ 4, 0}, { 1, 4}, { 4, 4}, { 3, 8}}, + {{ 2, 2}, { 6, 2}, { 4, 6}, { 7, 4}}, + {{ 4, 0}, { 8, 1}, { 8, 4}, {12, 4}}, + {{ 3, 1}, { 4, 5}, {11, 5}, {11, 5}}, + {{ 5, 1}, { 5, 5}, { 5, 7}, {11, 7}}, //15 + {{ 5, 1}, { 7, 3}, {15, 2}, { 3, 13}}, + {{ 1, 5}, {10, 1}, { 1, 15}, { 2, 17}}, + {{ 5, 1}, { 9, 4}, {17, 1}, { 2, 19}}, + {{ 3, 4}, { 3, 11}, {17, 4}, { 9, 16}}, + {{ 3, 5}, { 3, 13}, {15, 5}, {15, 10}}, //20 + {{ 4, 4}, {17, 0}, {17, 6}, {19, 6}}, + {{ 2, 7}, {17, 0}, { 7, 16}, {34, 0}}, + {{ 4, 5}, { 4, 14}, {11, 14}, {16, 14}}, + {{ 6, 4}, { 6, 14}, {11, 16}, {30, 2}}, + {{ 8, 4}, { 8, 13}, { 7, 22}, {22, 13}}, //25 + {{10, 2}, {19, 4}, {28, 6}, {33, 4}}, + {{ 8, 4}, {22, 3}, { 8, 26}, {12, 28}}, + {{ 3, 10}, { 3, 23}, { 4, 31}, {11, 31}}, + {{ 7, 7}, {21, 7}, { 1, 37}, {19, 26}}, + {{ 5, 10}, {19, 10}, {15, 25}, {23, 25}}, //30 + {{13, 3}, { 2, 29}, {42, 1}, {23, 28}}, + {{17, 0}, {10, 23}, {10, 35}, {19, 35}}, + {{17, 1}, {14, 21}, {29, 19}, {11, 46}}, + {{13, 6}, {14, 23}, {44, 7}, {59, 1}}, + {{12, 7}, {12, 26}, {39, 14}, {22, 41}}, //35 + {{ 6, 14}, { 6, 34}, {46, 10}, { 2, 64}}, + {{17, 4}, {29, 14}, {49, 10}, {24, 46}}, + {{ 4, 18}, {13, 32}, {48, 14}, {42, 32}}, + {{20, 4}, {40, 7}, {43, 22}, {10, 67}}, + {{19, 6}, {18, 31}, {34, 34}, {20, 61}},//40 +}; + +void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]) +{ + int b1, b2; + int data, ecc; + + b1 = eccTable[version][level][0]; + b2 = eccTable[version][level][1]; + data = QRspec_getDataLength(version, level); + ecc = QRspec_getECCLength(version, level); + + if(b2 == 0) { + spec[0] = b1; + spec[1] = data / b1; + spec[2] = ecc / b1; + spec[3] = spec[4] = 0; + } else { + spec[0] = b1; + spec[1] = data / (b1 + b2); + spec[2] = ecc / (b1 + b2); + spec[3] = b2; + spec[4] = spec[1] + 1; + } +} + +/****************************************************************************** + * Alignment pattern + *****************************************************************************/ + +/** + * Positions of alignment patterns. + * This array includes only the second and the third position of the alignment + * patterns. Rest of them can be calculated from the distance between them. + * + * See Table 1 in Appendix E (pp.71) of JIS X0510:2004. + */ +static const int alignmentPattern[QRSPEC_VERSION_MAX+1][2] = { + { 0, 0}, + { 0, 0}, {18, 0}, {22, 0}, {26, 0}, {30, 0}, // 1- 5 + {34, 0}, {22, 38}, {24, 42}, {26, 46}, {28, 50}, // 6-10 + {30, 54}, {32, 58}, {34, 62}, {26, 46}, {26, 48}, //11-15 + {26, 50}, {30, 54}, {30, 56}, {30, 58}, {34, 62}, //16-20 + {28, 50}, {26, 50}, {30, 54}, {28, 54}, {32, 58}, //21-25 + {30, 58}, {34, 62}, {26, 50}, {30, 54}, {26, 52}, //26-30 + {30, 56}, {34, 60}, {30, 58}, {34, 62}, {30, 54}, //31-35 + {24, 50}, {28, 54}, {32, 58}, {26, 54}, {30, 58}, //35-40 +}; + +/** + * Put an alignment marker. + * @param frame + * @param width + * @param ox,oy center coordinate of the pattern + */ +static void QRspec_putAlignmentMarker(unsigned char *frame, int width, int ox, int oy) +{ + static const unsigned char finder[] = { + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, + 0xa1, 0xa0, 0xa1, 0xa0, 0xa1, + 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + }; + int x, y; + const unsigned char *s; + + frame += (oy - 2) * width + ox - 2; + s = finder; + for(y = 0; y < 5; y++) { + for(x = 0; x < 5; x++) { + frame[x] = s[x]; + } + frame += width; + s += 5; + } +} + +static void QRspec_putAlignmentPattern(int version, unsigned char *frame, int width) +{ + int d, w, x, y, cx, cy; + + if(version < 2) return; + + d = alignmentPattern[version][1] - alignmentPattern[version][0]; + if(d < 0) { + w = 2; + } else { + w = (width - alignmentPattern[version][0]) / d + 2; + } + + if(w * w - 3 == 1) { + x = alignmentPattern[version][0]; + y = alignmentPattern[version][0]; + QRspec_putAlignmentMarker(frame, width, x, y); + return; + } + + cx = alignmentPattern[version][0]; + for(x = 1; x < w - 1; x++) { + QRspec_putAlignmentMarker(frame, width, 6, cx); + QRspec_putAlignmentMarker(frame, width, cx, 6); + cx += d; + } + + cy = alignmentPattern[version][0]; + for(y = 0; y < w-1; y++) { + cx = alignmentPattern[version][0]; + for(x = 0; x < w-1; x++) { + QRspec_putAlignmentMarker(frame, width, cx, cy); + cx += d; + } + cy += d; + } +} + +/****************************************************************************** + * Version information pattern + *****************************************************************************/ + +/** + * Version information pattern (BCH coded). + * See Table 1 in Appendix D (pp.68) of JIS X0510:2004. + */ +static const unsigned int versionPattern[QRSPEC_VERSION_MAX - 6] = { + 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, + 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, + 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, + 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, + 0x27541, 0x28c69 +}; + +unsigned int QRspec_getVersionPattern(int version) +{ + if(version < 7 || version > QRSPEC_VERSION_MAX) return 0; + + return versionPattern[version - 7]; +} + +/****************************************************************************** + * Format information + *****************************************************************************/ + +/* See calcFormatInfo in tests/test_qrspec.c */ +static const unsigned int formatInfo[4][8] = { + {0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976}, + {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0}, + {0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed}, + {0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b} +}; + +unsigned int QRspec_getFormatInfo(int mask, QRecLevel level) +{ + if(mask < 0 || mask > 7) return 0; + + return formatInfo[level][mask]; +} + +/****************************************************************************** + * Frame + *****************************************************************************/ + +/** + * Put a finder pattern. + * @param frame + * @param width + * @param ox,oy upper-left coordinate of the pattern + */ +static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) +{ + static const unsigned char finder[] = { + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + }; + int x, y; + const unsigned char *s; + + frame += oy * width + ox; + s = finder; + for(y = 0; y < 7; y++) { + for(x = 0; x < 7; x++) { + frame[x] = s[x]; + } + frame += width; + s += 7; + } +} + + +static unsigned char *QRspec_createFrame(int version) +{ + unsigned char *frame, *p, *q; + int width; + int x, y; + unsigned int verinfo, v; + + width = qrspecCapacity[version].width; + frame = (unsigned char *)malloc((size_t)(width * width)); + if(frame == NULL) return NULL; + + memset(frame, 0, (size_t)(width * width)); + /* Finder pattern */ + putFinderPattern(frame, width, 0, 0); + putFinderPattern(frame, width, width - 7, 0); + putFinderPattern(frame, width, 0, width - 7); + /* Separator */ + p = frame; + q = frame + width * (width - 7); + for(y = 0; y < 7; y++) { + p[7] = 0xc0; + p[width - 8] = 0xc0; + q[7] = 0xc0; + p += width; + q += width; + } + memset(frame + width * 7, 0xc0, 8); + memset(frame + width * 8 - 8, 0xc0, 8); + memset(frame + width * (width - 8), 0xc0, 8); + /* Mask format information area */ + memset(frame + width * 8, 0x84, 9); + memset(frame + width * 9 - 8, 0x84, 8); + p = frame + 8; + for(y = 0; y < 8; y++) { + *p = 0x84; + p += width; + } + p = frame + width * (width - 7) + 8; + for(y = 0; y < 7; y++) { + *p = 0x84; + p += width; + } + /* Timing pattern */ + p = frame + width * 6 + 8; + q = frame + width * 8 + 6; + for(x = 1; x < width-15; x++) { + *p = 0x90 | (x & 1); + *q = 0x90 | (x & 1); + p++; + q += width; + } + /* Alignment pattern */ + QRspec_putAlignmentPattern(version, frame, width); + + /* Version information */ + if(version >= 7) { + verinfo = QRspec_getVersionPattern(version); + + p = frame + width * (width - 11); + v = verinfo; + for(x = 0; x < 6; x++) { + for(y = 0; y < 3; y++) { + p[width * y + x] = 0x88 | (v & 1); + v = v >> 1; + } + } + + p = frame + width - 11; + v = verinfo; + for(y = 0; y < 6; y++) { + for(x = 0; x < 3; x++) { + p[x] = 0x88 | (v & 1); + v = v >> 1; + } + p += width; + } + } + /* and a little bit... */ + frame[width * (width - 8) + 8] = 0x81; + + return frame; +} + +unsigned char *QRspec_newFrame(int version) +{ + if(version < 1 || version > QRSPEC_VERSION_MAX) return NULL; + + return QRspec_createFrame(version); +} diff --git a/QtQREnCode/qrspec.cpp b/QtQREnCode/qrspec.cpp index 0203bda..04da1dd 100644 --- a/QtQREnCode/qrspec.cpp +++ b/QtQREnCode/qrspec.cpp @@ -1,574 +1,574 @@ - -/* - * qrencode - QR Code encoder - * - * QR Code specification in convenient format. - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "qrspec.h" - -/****************************************************************************** - * Version and capacity - *****************************************************************************/ - -typedef struct { - int width; //< Edge length of the symbol - int words; //< Data capacity (bytes) - int remainder; //< Remainder bit (bits) - int ec[4]; //< Number of ECC code (bytes) -} QRspec_Capacity; - -/** - * Table of the capacity of symbols - * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004. - */ -static const QRspec_Capacity qrspecCapacity[QRSPEC_VERSION_MAX + 1] = { - { 0, 0, 0, { 0, 0, 0, 0}}, - { 21, 26, 0, { 7, 10, 13, 17}}, // 1 - { 25, 44, 7, { 10, 16, 22, 28}}, - { 29, 70, 7, { 15, 26, 36, 44}}, - { 33, 100, 7, { 20, 36, 52, 64}}, - { 37, 134, 7, { 26, 48, 72, 88}}, // 5 - { 41, 172, 7, { 36, 64, 96, 112}}, - { 45, 196, 0, { 40, 72, 108, 130}}, - { 49, 242, 0, { 48, 88, 132, 156}}, - { 53, 292, 0, { 60, 110, 160, 192}}, - { 57, 346, 0, { 72, 130, 192, 224}}, //10 - { 61, 404, 0, { 80, 150, 224, 264}}, - { 65, 466, 0, { 96, 176, 260, 308}}, - { 69, 532, 0, { 104, 198, 288, 352}}, - { 73, 581, 3, { 120, 216, 320, 384}}, - { 77, 655, 3, { 132, 240, 360, 432}}, //15 - { 81, 733, 3, { 144, 280, 408, 480}}, - { 85, 815, 3, { 168, 308, 448, 532}}, - { 89, 901, 3, { 180, 338, 504, 588}}, - { 93, 991, 3, { 196, 364, 546, 650}}, - { 97, 1085, 3, { 224, 416, 600, 700}}, //20 - {101, 1156, 4, { 224, 442, 644, 750}}, - {105, 1258, 4, { 252, 476, 690, 816}}, - {109, 1364, 4, { 270, 504, 750, 900}}, - {113, 1474, 4, { 300, 560, 810, 960}}, - {117, 1588, 4, { 312, 588, 870, 1050}}, //25 - {121, 1706, 4, { 336, 644, 952, 1110}}, - {125, 1828, 4, { 360, 700, 1020, 1200}}, - {129, 1921, 3, { 390, 728, 1050, 1260}}, - {133, 2051, 3, { 420, 784, 1140, 1350}}, - {137, 2185, 3, { 450, 812, 1200, 1440}}, //30 - {141, 2323, 3, { 480, 868, 1290, 1530}}, - {145, 2465, 3, { 510, 924, 1350, 1620}}, - {149, 2611, 3, { 540, 980, 1440, 1710}}, - {153, 2761, 3, { 570, 1036, 1530, 1800}}, - {157, 2876, 0, { 570, 1064, 1590, 1890}}, //35 - {161, 3034, 0, { 600, 1120, 1680, 1980}}, - {165, 3196, 0, { 630, 1204, 1770, 2100}}, - {169, 3362, 0, { 660, 1260, 1860, 2220}}, - {173, 3532, 0, { 720, 1316, 1950, 2310}}, - {177, 3706, 0, { 750, 1372, 2040, 2430}} //40 -}; - -int QRspec_getDataLength(int version, QRecLevel level) -{ - return qrspecCapacity[version].words - qrspecCapacity[version].ec[level]; -} - -int QRspec_getECCLength(int version, QRecLevel level) -{ - return qrspecCapacity[version].ec[level]; -} - -int QRspec_getMinimumVersion(int size, QRecLevel level) -{ - int i; - int words; - - for(i=1; i<= QRSPEC_VERSION_MAX; i++) { - words = qrspecCapacity[i].words - qrspecCapacity[i].ec[level]; - if(words >= size) return i; - } - - return -1; -} - -int QRspec_getWidth(int version) -{ - return qrspecCapacity[version].width; -} - -int QRspec_getRemainder(int version) -{ - return qrspecCapacity[version].remainder; -} - -/****************************************************************************** - * Length indicator - *****************************************************************************/ - -static const int lengthTableBits[4][3] = { - {10, 12, 14}, - { 9, 11, 13}, - { 8, 16, 16}, - { 8, 10, 12} -}; - -int QRspec_lengthIndicator(QRencodeMode mode, int version) -{ - int l; - - if(version <= 9) { - l = 0; - } else if(version <= 26) { - l = 1; - } else { - l = 2; - } - - return lengthTableBits[mode][l]; -} - -int QRspec_maximumWords(QRencodeMode mode, int version) -{ - int l; - int bits; - int words; - - if(version <= 9) { - l = 0; - } else if(version <= 26) { - l = 1; - } else { - l = 2; - } - - bits = lengthTableBits[mode][l]; - words = (1 << bits) - 1; - if(mode == QR_MODE_KANJI) { - words *= 2; // the number of bytes is required - } - - return words; -} - -/****************************************************************************** - * Error correction code - *****************************************************************************/ - -/** - * Table of the error correction code (Reed-Solomon block) - * See Table 12-16 (pp.30-36), JIS X0510:2004. - */ -static const int eccTable[QRSPEC_VERSION_MAX+1][4][2] = { - {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}}, - {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, // 1 - {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, - {{ 1, 0}, { 1, 0}, { 2, 0}, { 2, 0}}, - {{ 1, 0}, { 2, 0}, { 2, 0}, { 4, 0}}, - {{ 1, 0}, { 2, 0}, { 2, 2}, { 2, 2}}, // 5 - {{ 2, 0}, { 4, 0}, { 4, 0}, { 4, 0}}, - {{ 2, 0}, { 4, 0}, { 2, 4}, { 4, 1}}, - {{ 2, 0}, { 2, 2}, { 4, 2}, { 4, 2}}, - {{ 2, 0}, { 3, 2}, { 4, 4}, { 4, 4}}, - {{ 2, 2}, { 4, 1}, { 6, 2}, { 6, 2}}, //10 - {{ 4, 0}, { 1, 4}, { 4, 4}, { 3, 8}}, - {{ 2, 2}, { 6, 2}, { 4, 6}, { 7, 4}}, - {{ 4, 0}, { 8, 1}, { 8, 4}, {12, 4}}, - {{ 3, 1}, { 4, 5}, {11, 5}, {11, 5}}, - {{ 5, 1}, { 5, 5}, { 5, 7}, {11, 7}}, //15 - {{ 5, 1}, { 7, 3}, {15, 2}, { 3, 13}}, - {{ 1, 5}, {10, 1}, { 1, 15}, { 2, 17}}, - {{ 5, 1}, { 9, 4}, {17, 1}, { 2, 19}}, - {{ 3, 4}, { 3, 11}, {17, 4}, { 9, 16}}, - {{ 3, 5}, { 3, 13}, {15, 5}, {15, 10}}, //20 - {{ 4, 4}, {17, 0}, {17, 6}, {19, 6}}, - {{ 2, 7}, {17, 0}, { 7, 16}, {34, 0}}, - {{ 4, 5}, { 4, 14}, {11, 14}, {16, 14}}, - {{ 6, 4}, { 6, 14}, {11, 16}, {30, 2}}, - {{ 8, 4}, { 8, 13}, { 7, 22}, {22, 13}}, //25 - {{10, 2}, {19, 4}, {28, 6}, {33, 4}}, - {{ 8, 4}, {22, 3}, { 8, 26}, {12, 28}}, - {{ 3, 10}, { 3, 23}, { 4, 31}, {11, 31}}, - {{ 7, 7}, {21, 7}, { 1, 37}, {19, 26}}, - {{ 5, 10}, {19, 10}, {15, 25}, {23, 25}}, //30 - {{13, 3}, { 2, 29}, {42, 1}, {23, 28}}, - {{17, 0}, {10, 23}, {10, 35}, {19, 35}}, - {{17, 1}, {14, 21}, {29, 19}, {11, 46}}, - {{13, 6}, {14, 23}, {44, 7}, {59, 1}}, - {{12, 7}, {12, 26}, {39, 14}, {22, 41}}, //35 - {{ 6, 14}, { 6, 34}, {46, 10}, { 2, 64}}, - {{17, 4}, {29, 14}, {49, 10}, {24, 46}}, - {{ 4, 18}, {13, 32}, {48, 14}, {42, 32}}, - {{20, 4}, {40, 7}, {43, 22}, {10, 67}}, - {{19, 6}, {18, 31}, {34, 34}, {20, 61}},//40 -}; - -int *QRspec_getEccSpec(int version, QRecLevel level) -{ - int b1, b2; - int data, ecc; - int *array; - - b1 = eccTable[version][level][0]; - b2 = eccTable[version][level][1]; - - data = QRspec_getDataLength(version, level); - ecc = QRspec_getECCLength(version, level); - - array = (int *)malloc(sizeof(int) * 6); - - if(b2 == 0) { - array[0] = b1; - array[1] = data / b1; - array[2] = ecc / b1; - array[3] = array[4] = array[5] = 0; - } else { - array[0] = b1; - array[1] = data / (b1 + b2); - array[2] = ecc / (b1 + b2); - array[3] = b2; - array[4] = array[1] + 1; - array[5] = (ecc - (array[2] * b1)) / b2; - } - - return array; -} - -/****************************************************************************** - * Alignment pattern - *****************************************************************************/ - -/** - * Positions of alignment patterns. - * This array includes only the second and the third position of the alignment - * patterns. Rest of them can be calculated from the distance between them. - * - * See Table 1 in Appendix E (pp.71) of JIS X0510:2004. - */ -static const int alignmentPattern[QRSPEC_VERSION_MAX+1][2] = { - { 0, 0}, - { 0, 0}, {18, 0}, {22, 0}, {26, 0}, {30, 0}, // 1- 5 - {34, 0}, {22, 38}, {24, 42}, {26, 46}, {28, 50}, // 6-10 - {30, 54}, {32, 58}, {34, 62}, {26, 46}, {26, 48}, //11-15 - {26, 50}, {30, 54}, {30, 56}, {30, 58}, {34, 62}, //16-20 - {28, 50}, {26, 50}, {30, 54}, {28, 54}, {32, 58}, //21-25 - {30, 58}, {34, 62}, {26, 50}, {30, 54}, {26, 52}, //26-30 - {30, 56}, {34, 60}, {30, 58}, {34, 62}, {30, 54}, //31-35 - {24, 50}, {28, 54}, {32, 58}, {26, 54}, {30, 58}, //35-40 -}; - -QRspec_Alignment *QRspec_getAlignmentPattern(int version) -{ - int width; - int d, w, x, y, cx, cy; - QRspec_Alignment *al; - int *p; - - if(version < 2) return NULL; - - al = (QRspec_Alignment *)malloc(sizeof(QRspec_Alignment)); - - width = qrspecCapacity[version].width; - d = alignmentPattern[version][1] - alignmentPattern[version][0]; - if(d < 0) { - w = 2; - } else { - w = (width - alignmentPattern[version][0]) / d + 2; - } - - al->n = w * w - 3; - al->pos = (int *)malloc(sizeof(int) * al->n * 2); - - if(al->n == 1) { - al->pos[0] = alignmentPattern[version][0]; - al->pos[1] = alignmentPattern[version][0]; - - return al; - } -#if 0 - /* Just for debug purpose */ - printf("%d ", version); - cx = alignmentPattern[version][0]; - for(x=0; xpos; - - cx = alignmentPattern[version][0]; - for(x=1; xpos != NULL) { - free(al->pos); - } - free(al); - } -} - -/****************************************************************************** - * Version information pattern - *****************************************************************************/ - -/** - * Version information pattern (BCH coded). - * See Table 1 in Appendix D (pp.68) of JIS X0510:2004. - */ -static const unsigned int versionPattern[QRSPEC_VERSION_MAX - 6] = { - 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, - 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, - 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, - 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, - 0x27541, 0x28c69 -}; - -unsigned int QRspec_getVersionPattern(int version) -{ - if(version < 7 || version > QRSPEC_VERSION_MAX) return 0; - - return versionPattern[version -7]; -} - -/****************************************************************************** - * Format information - *****************************************************************************/ - -/* See calcFormatInfo in tests/test_qrspec.c */ -static const unsigned int formatInfo[4][8] = { - {0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976}, - {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0}, - {0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed}, - {0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b} -}; - -unsigned int QRspec_getFormatInfo(int mask, QRecLevel level) -{ - if(mask < 0 || mask > 7) return 0; - - return formatInfo[level][mask]; -} - -/****************************************************************************** - * Frame - *****************************************************************************/ - -/** - * Cache of initial frames. - */ -/* C99 says that static storage shall be initialized to a null pointer - * by compiler. */ -static unsigned char *frames[QRSPEC_VERSION_MAX + 1]; - -/** - * Put a finder pattern. - * @param frame - * @param width - * @param ox,oy upper-left coordinate of the pattern - */ -static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) -{ - static const unsigned char finder[] = { - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, - 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, - 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, - }; - int x, y; - const unsigned char *s; - - frame += oy * width + ox; - s = finder; - for(y=0; y<7; y++) { - for(x=0; x<7; x++) { - frame[x] = s[x]; - } - frame += width; - s += 7; - } -} - -/** - * Put an alignment pattern. - * @param frame - * @param width - * @param ox,oy center coordinate of the pattern - */ -static void putAlignmentPattern(unsigned char *frame, int width, int ox, int oy) -{ - static const unsigned char finder[] = { - 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, - 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, - 0xa1, 0xa0, 0xa1, 0xa0, 0xa1, - 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, - 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, - }; - int x, y; - const unsigned char *s; - - frame += (oy - 2) * width + ox - 2; - s = finder; - for(y=0; y<5; y++) { - for(x=0; x<5; x++) { - frame[x] = s[x]; - } - frame += width; - s += 5; - } -} - -static unsigned char *QRspec_createFrame(int version) -{ - unsigned char *frame, *p, *q; - int width; - int x, y; - unsigned int verinfo, mask; - QRspec_Alignment *alignment; - - width = qrspecCapacity[version].width; - frame = (unsigned char *)malloc(width * width); - memset(frame, 0, width * width); - /* Finder pattern */ - putFinderPattern(frame, width, 0, 0); - putFinderPattern(frame, width, width - 7, 0); - putFinderPattern(frame, width, 0, width - 7); - /* Separator */ - p = frame; - q = frame + width * (width - 7); - for(y=0; y<7; y++) { - p[7] = 0xc0; - p[width - 8] = 0xc0; - q[7] = 0xc0; - p += width; - q += width; - } - memset(frame + width * 7, 0xc0, 8); - memset(frame + width * 8 - 8, 0xc0, 8); - memset(frame + width * (width - 8), 0xc0, 8); - /* Mask format information area */ - memset(frame + width * 8, 0x84, 9); - memset(frame + width * 9 - 8, 0x84, 8); - p = frame + 8; - for(y=0; y<8; y++) { - *p = 0x84; - p += width; - } - p = frame + width * (width - 7) + 8; - for(y=0; y<7; y++) { - *p = 0x84; - p += width; - } - /* Timing pattern */ - p = frame + width * 6 + 8; - q = frame + width * 8 + 6; - for(x=1; xn; x++) { - putAlignmentPattern(frame, width, - alignment->pos[x*2], alignment->pos[x*2+1]); - } - QRspec_freeAlignment(alignment); - } - /* Version information */ - if(version >= 7) { - verinfo = QRspec_getVersionPattern(version); - - p = frame + width * (width - 11); - mask = 0x20000; - for(x=0; x<6; x++) { - for(y=0; y<3; y++) { - p[width * y + x] = 0x88 | ((mask & verinfo) != 0); - mask = mask >> 1; - } - } - - p = frame + width - 11; - mask = 0x20000; - for(y=0; y<6; y++) { - for(x=0; x<3; x++) { - p[x] = 0x88 | ((mask & verinfo) != 0); - mask = mask >> 1; - } - p += width; - } - } - /* and a little bit... */ - frame[width * (width - 8) + 8] = 0x81; - - return frame; -} - -unsigned char *QRspec_newFrame(int version) -{ - unsigned char *frame; - int width; - - if(version < 1 || version > QRSPEC_VERSION_MAX) return NULL; - - if(frames[version] == NULL) { - frames[version] = QRspec_createFrame(version); - } - width = qrspecCapacity[version].width; - frame = (unsigned char *)malloc(width * width); - memcpy(frame, frames[version], width * width); - - return frame; -} + +/* + * qrencode - QR Code encoder + * + * QR Code specification in convenient format. + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include "qrspec.h" + +/****************************************************************************** + * Version and capacity + *****************************************************************************/ + +typedef struct { + int width; //< Edge length of the symbol + int words; //< Data capacity (bytes) + int remainder; //< Remainder bit (bits) + int ec[4]; //< Number of ECC code (bytes) +} QRspec_Capacity; + +/** + * Table of the capacity of symbols + * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004. + */ +static const QRspec_Capacity qrspecCapacity[QRSPEC_VERSION_MAX + 1] = { + { 0, 0, 0, { 0, 0, 0, 0}}, + { 21, 26, 0, { 7, 10, 13, 17}}, // 1 + { 25, 44, 7, { 10, 16, 22, 28}}, + { 29, 70, 7, { 15, 26, 36, 44}}, + { 33, 100, 7, { 20, 36, 52, 64}}, + { 37, 134, 7, { 26, 48, 72, 88}}, // 5 + { 41, 172, 7, { 36, 64, 96, 112}}, + { 45, 196, 0, { 40, 72, 108, 130}}, + { 49, 242, 0, { 48, 88, 132, 156}}, + { 53, 292, 0, { 60, 110, 160, 192}}, + { 57, 346, 0, { 72, 130, 192, 224}}, //10 + { 61, 404, 0, { 80, 150, 224, 264}}, + { 65, 466, 0, { 96, 176, 260, 308}}, + { 69, 532, 0, { 104, 198, 288, 352}}, + { 73, 581, 3, { 120, 216, 320, 384}}, + { 77, 655, 3, { 132, 240, 360, 432}}, //15 + { 81, 733, 3, { 144, 280, 408, 480}}, + { 85, 815, 3, { 168, 308, 448, 532}}, + { 89, 901, 3, { 180, 338, 504, 588}}, + { 93, 991, 3, { 196, 364, 546, 650}}, + { 97, 1085, 3, { 224, 416, 600, 700}}, //20 + {101, 1156, 4, { 224, 442, 644, 750}}, + {105, 1258, 4, { 252, 476, 690, 816}}, + {109, 1364, 4, { 270, 504, 750, 900}}, + {113, 1474, 4, { 300, 560, 810, 960}}, + {117, 1588, 4, { 312, 588, 870, 1050}}, //25 + {121, 1706, 4, { 336, 644, 952, 1110}}, + {125, 1828, 4, { 360, 700, 1020, 1200}}, + {129, 1921, 3, { 390, 728, 1050, 1260}}, + {133, 2051, 3, { 420, 784, 1140, 1350}}, + {137, 2185, 3, { 450, 812, 1200, 1440}}, //30 + {141, 2323, 3, { 480, 868, 1290, 1530}}, + {145, 2465, 3, { 510, 924, 1350, 1620}}, + {149, 2611, 3, { 540, 980, 1440, 1710}}, + {153, 2761, 3, { 570, 1036, 1530, 1800}}, + {157, 2876, 0, { 570, 1064, 1590, 1890}}, //35 + {161, 3034, 0, { 600, 1120, 1680, 1980}}, + {165, 3196, 0, { 630, 1204, 1770, 2100}}, + {169, 3362, 0, { 660, 1260, 1860, 2220}}, + {173, 3532, 0, { 720, 1316, 1950, 2310}}, + {177, 3706, 0, { 750, 1372, 2040, 2430}} //40 +}; + +int QRspec_getDataLength(int version, QRecLevel level) +{ + return qrspecCapacity[version].words - qrspecCapacity[version].ec[level]; +} + +int QRspec_getECCLength(int version, QRecLevel level) +{ + return qrspecCapacity[version].ec[level]; +} + +int QRspec_getMinimumVersion(int size, QRecLevel level) +{ + int i; + int words; + + for(i=1; i<= QRSPEC_VERSION_MAX; i++) { + words = qrspecCapacity[i].words - qrspecCapacity[i].ec[level]; + if(words >= size) return i; + } + + return -1; +} + +int QRspec_getWidth(int version) +{ + return qrspecCapacity[version].width; +} + +int QRspec_getRemainder(int version) +{ + return qrspecCapacity[version].remainder; +} + +/****************************************************************************** + * Length indicator + *****************************************************************************/ + +static const int lengthTableBits[4][3] = { + {10, 12, 14}, + { 9, 11, 13}, + { 8, 16, 16}, + { 8, 10, 12} +}; + +int QRspec_lengthIndicator(QRencodeMode mode, int version) +{ + int l; + + if(version <= 9) { + l = 0; + } else if(version <= 26) { + l = 1; + } else { + l = 2; + } + + return lengthTableBits[mode][l]; +} + +int QRspec_maximumWords(QRencodeMode mode, int version) +{ + int l; + int bits; + int words; + + if(version <= 9) { + l = 0; + } else if(version <= 26) { + l = 1; + } else { + l = 2; + } + + bits = lengthTableBits[mode][l]; + words = (1 << bits) - 1; + if(mode == QR_MODE_KANJI) { + words *= 2; // the number of bytes is required + } + + return words; +} + +/****************************************************************************** + * Error correction code + *****************************************************************************/ + +/** + * Table of the error correction code (Reed-Solomon block) + * See Table 12-16 (pp.30-36), JIS X0510:2004. + */ +static const int eccTable[QRSPEC_VERSION_MAX+1][4][2] = { + {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}}, + {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, // 1 + {{ 1, 0}, { 1, 0}, { 1, 0}, { 1, 0}}, + {{ 1, 0}, { 1, 0}, { 2, 0}, { 2, 0}}, + {{ 1, 0}, { 2, 0}, { 2, 0}, { 4, 0}}, + {{ 1, 0}, { 2, 0}, { 2, 2}, { 2, 2}}, // 5 + {{ 2, 0}, { 4, 0}, { 4, 0}, { 4, 0}}, + {{ 2, 0}, { 4, 0}, { 2, 4}, { 4, 1}}, + {{ 2, 0}, { 2, 2}, { 4, 2}, { 4, 2}}, + {{ 2, 0}, { 3, 2}, { 4, 4}, { 4, 4}}, + {{ 2, 2}, { 4, 1}, { 6, 2}, { 6, 2}}, //10 + {{ 4, 0}, { 1, 4}, { 4, 4}, { 3, 8}}, + {{ 2, 2}, { 6, 2}, { 4, 6}, { 7, 4}}, + {{ 4, 0}, { 8, 1}, { 8, 4}, {12, 4}}, + {{ 3, 1}, { 4, 5}, {11, 5}, {11, 5}}, + {{ 5, 1}, { 5, 5}, { 5, 7}, {11, 7}}, //15 + {{ 5, 1}, { 7, 3}, {15, 2}, { 3, 13}}, + {{ 1, 5}, {10, 1}, { 1, 15}, { 2, 17}}, + {{ 5, 1}, { 9, 4}, {17, 1}, { 2, 19}}, + {{ 3, 4}, { 3, 11}, {17, 4}, { 9, 16}}, + {{ 3, 5}, { 3, 13}, {15, 5}, {15, 10}}, //20 + {{ 4, 4}, {17, 0}, {17, 6}, {19, 6}}, + {{ 2, 7}, {17, 0}, { 7, 16}, {34, 0}}, + {{ 4, 5}, { 4, 14}, {11, 14}, {16, 14}}, + {{ 6, 4}, { 6, 14}, {11, 16}, {30, 2}}, + {{ 8, 4}, { 8, 13}, { 7, 22}, {22, 13}}, //25 + {{10, 2}, {19, 4}, {28, 6}, {33, 4}}, + {{ 8, 4}, {22, 3}, { 8, 26}, {12, 28}}, + {{ 3, 10}, { 3, 23}, { 4, 31}, {11, 31}}, + {{ 7, 7}, {21, 7}, { 1, 37}, {19, 26}}, + {{ 5, 10}, {19, 10}, {15, 25}, {23, 25}}, //30 + {{13, 3}, { 2, 29}, {42, 1}, {23, 28}}, + {{17, 0}, {10, 23}, {10, 35}, {19, 35}}, + {{17, 1}, {14, 21}, {29, 19}, {11, 46}}, + {{13, 6}, {14, 23}, {44, 7}, {59, 1}}, + {{12, 7}, {12, 26}, {39, 14}, {22, 41}}, //35 + {{ 6, 14}, { 6, 34}, {46, 10}, { 2, 64}}, + {{17, 4}, {29, 14}, {49, 10}, {24, 46}}, + {{ 4, 18}, {13, 32}, {48, 14}, {42, 32}}, + {{20, 4}, {40, 7}, {43, 22}, {10, 67}}, + {{19, 6}, {18, 31}, {34, 34}, {20, 61}},//40 +}; + +int *QRspec_getEccSpec(int version, QRecLevel level) +{ + int b1, b2; + int data, ecc; + int *array; + + b1 = eccTable[version][level][0]; + b2 = eccTable[version][level][1]; + + data = QRspec_getDataLength(version, level); + ecc = QRspec_getECCLength(version, level); + + array = (int *)malloc(sizeof(int) * 6); + + if(b2 == 0) { + array[0] = b1; + array[1] = data / b1; + array[2] = ecc / b1; + array[3] = array[4] = array[5] = 0; + } else { + array[0] = b1; + array[1] = data / (b1 + b2); + array[2] = ecc / (b1 + b2); + array[3] = b2; + array[4] = array[1] + 1; + array[5] = (ecc - (array[2] * b1)) / b2; + } + + return array; +} + +/****************************************************************************** + * Alignment pattern + *****************************************************************************/ + +/** + * Positions of alignment patterns. + * This array includes only the second and the third position of the alignment + * patterns. Rest of them can be calculated from the distance between them. + * + * See Table 1 in Appendix E (pp.71) of JIS X0510:2004. + */ +static const int alignmentPattern[QRSPEC_VERSION_MAX+1][2] = { + { 0, 0}, + { 0, 0}, {18, 0}, {22, 0}, {26, 0}, {30, 0}, // 1- 5 + {34, 0}, {22, 38}, {24, 42}, {26, 46}, {28, 50}, // 6-10 + {30, 54}, {32, 58}, {34, 62}, {26, 46}, {26, 48}, //11-15 + {26, 50}, {30, 54}, {30, 56}, {30, 58}, {34, 62}, //16-20 + {28, 50}, {26, 50}, {30, 54}, {28, 54}, {32, 58}, //21-25 + {30, 58}, {34, 62}, {26, 50}, {30, 54}, {26, 52}, //26-30 + {30, 56}, {34, 60}, {30, 58}, {34, 62}, {30, 54}, //31-35 + {24, 50}, {28, 54}, {32, 58}, {26, 54}, {30, 58}, //35-40 +}; + +QRspec_Alignment *QRspec_getAlignmentPattern(int version) +{ + int width; + int d, w, x, y, cx, cy; + QRspec_Alignment *al; + int *p; + + if(version < 2) return NULL; + + al = (QRspec_Alignment *)malloc(sizeof(QRspec_Alignment)); + + width = qrspecCapacity[version].width; + d = alignmentPattern[version][1] - alignmentPattern[version][0]; + if(d < 0) { + w = 2; + } else { + w = (width - alignmentPattern[version][0]) / d + 2; + } + + al->n = w * w - 3; + al->pos = (int *)malloc(sizeof(int) * al->n * 2); + + if(al->n == 1) { + al->pos[0] = alignmentPattern[version][0]; + al->pos[1] = alignmentPattern[version][0]; + + return al; + } +#if 0 + /* Just for debug purpose */ + printf("%d ", version); + cx = alignmentPattern[version][0]; + for(x=0; xpos; + + cx = alignmentPattern[version][0]; + for(x=1; xpos != NULL) { + free(al->pos); + } + free(al); + } +} + +/****************************************************************************** + * Version information pattern + *****************************************************************************/ + +/** + * Version information pattern (BCH coded). + * See Table 1 in Appendix D (pp.68) of JIS X0510:2004. + */ +static const unsigned int versionPattern[QRSPEC_VERSION_MAX - 6] = { + 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, + 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, + 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, + 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, + 0x27541, 0x28c69 +}; + +unsigned int QRspec_getVersionPattern(int version) +{ + if(version < 7 || version > QRSPEC_VERSION_MAX) return 0; + + return versionPattern[version -7]; +} + +/****************************************************************************** + * Format information + *****************************************************************************/ + +/* See calcFormatInfo in tests/test_qrspec.c */ +static const unsigned int formatInfo[4][8] = { + {0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976}, + {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0}, + {0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed}, + {0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b} +}; + +unsigned int QRspec_getFormatInfo(int mask, QRecLevel level) +{ + if(mask < 0 || mask > 7) return 0; + + return formatInfo[level][mask]; +} + +/****************************************************************************** + * Frame + *****************************************************************************/ + +/** + * Cache of initial frames. + */ +/* C99 says that static storage shall be initialized to a null pointer + * by compiler. */ +static unsigned char *frames[QRSPEC_VERSION_MAX + 1]; + +/** + * Put a finder pattern. + * @param frame + * @param width + * @param ox,oy upper-left coordinate of the pattern + */ +static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) +{ + static const unsigned char finder[] = { + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, + 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + }; + int x, y; + const unsigned char *s; + + frame += oy * width + ox; + s = finder; + for(y=0; y<7; y++) { + for(x=0; x<7; x++) { + frame[x] = s[x]; + } + frame += width; + s += 7; + } +} + +/** + * Put an alignment pattern. + * @param frame + * @param width + * @param ox,oy center coordinate of the pattern + */ +static void putAlignmentPattern(unsigned char *frame, int width, int ox, int oy) +{ + static const unsigned char finder[] = { + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, + 0xa1, 0xa0, 0xa1, 0xa0, 0xa1, + 0xa1, 0xa0, 0xa0, 0xa0, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + }; + int x, y; + const unsigned char *s; + + frame += (oy - 2) * width + ox - 2; + s = finder; + for(y=0; y<5; y++) { + for(x=0; x<5; x++) { + frame[x] = s[x]; + } + frame += width; + s += 5; + } +} + +static unsigned char *QRspec_createFrame(int version) +{ + unsigned char *frame, *p, *q; + int width; + int x, y; + unsigned int verinfo, mask; + QRspec_Alignment *alignment; + + width = qrspecCapacity[version].width; + frame = (unsigned char *)malloc(width * width); + memset(frame, 0, width * width); + /* Finder pattern */ + putFinderPattern(frame, width, 0, 0); + putFinderPattern(frame, width, width - 7, 0); + putFinderPattern(frame, width, 0, width - 7); + /* Separator */ + p = frame; + q = frame + width * (width - 7); + for(y=0; y<7; y++) { + p[7] = 0xc0; + p[width - 8] = 0xc0; + q[7] = 0xc0; + p += width; + q += width; + } + memset(frame + width * 7, 0xc0, 8); + memset(frame + width * 8 - 8, 0xc0, 8); + memset(frame + width * (width - 8), 0xc0, 8); + /* Mask format information area */ + memset(frame + width * 8, 0x84, 9); + memset(frame + width * 9 - 8, 0x84, 8); + p = frame + 8; + for(y=0; y<8; y++) { + *p = 0x84; + p += width; + } + p = frame + width * (width - 7) + 8; + for(y=0; y<7; y++) { + *p = 0x84; + p += width; + } + /* Timing pattern */ + p = frame + width * 6 + 8; + q = frame + width * 8 + 6; + for(x=1; xn; x++) { + putAlignmentPattern(frame, width, + alignment->pos[x*2], alignment->pos[x*2+1]); + } + QRspec_freeAlignment(alignment); + } + /* Version information */ + if(version >= 7) { + verinfo = QRspec_getVersionPattern(version); + + p = frame + width * (width - 11); + mask = 0x20000; + for(x=0; x<6; x++) { + for(y=0; y<3; y++) { + p[width * y + x] = 0x88 | ((mask & verinfo) != 0); + mask = mask >> 1; + } + } + + p = frame + width - 11; + mask = 0x20000; + for(y=0; y<6; y++) { + for(x=0; x<3; x++) { + p[x] = 0x88 | ((mask & verinfo) != 0); + mask = mask >> 1; + } + p += width; + } + } + /* and a little bit... */ + frame[width * (width - 8) + 8] = 0x81; + + return frame; +} + +unsigned char *QRspec_newFrame(int version) +{ + unsigned char *frame; + int width; + + if(version < 1 || version > QRSPEC_VERSION_MAX) return NULL; + + if(frames[version] == NULL) { + frames[version] = QRspec_createFrame(version); + } + width = qrspecCapacity[version].width; + frame = (unsigned char *)malloc(width * width); + memcpy(frame, frames[version], width * width); + + return frame; +} diff --git a/QtQREnCode/qrspec.h b/QtQREnCode/qrspec.h index 4d01879..3d543d3 100644 --- a/QtQREnCode/qrspec.h +++ b/QtQREnCode/qrspec.h @@ -1,174 +1,174 @@ -/* - * qrencode - QR Code encoder - * - * QR Code specification in convenient format. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QRSPEC_H -#define QRSPEC_H - -#include "qrencode.h" - -/****************************************************************************** - * Version and capacity - *****************************************************************************/ - -/** - * Maximum width of a symbol - */ -#define QRSPEC_WIDTH_MAX 177 - -/** - * Return maximum data code length (bytes) for the version. - * @param version version of the symbol - * @param level error correction level - * @return maximum size (bytes) - */ -extern int QRspec_getDataLength(int version, QRecLevel level); - -/** - * Return maximum error correction code length (bytes) for the version. - * @param version version of the symbol - * @param level error correction level - * @return ECC size (bytes) - */ -extern int QRspec_getECCLength(int version, QRecLevel level); - -/** - * Return a version number that satisfies the input code length. - * @param size input code length (byte) - * @param level error correction level - * @return version number - */ -extern int QRspec_getMinimumVersion(int size, QRecLevel level); - -/** - * Return the width of the symbol for the version. - * @param version vesion of the symbol - * @return width of the symbol - */ -extern int QRspec_getWidth(int version); - -/** - * Return the numer of remainder bits. - * @param version vesion of the symbol - * @return number of remainder bits - */ -extern int QRspec_getRemainder(int version); - -/****************************************************************************** - * Length indicator - *****************************************************************************/ - -/** - * Return the size of length indicator for the mode and version. - * @param mode encode mode - * @param version vesion of the symbol - * @return the size of the appropriate length indicator (bits). - */ -extern int QRspec_lengthIndicator(QRencodeMode mode, int version); - -/** - * Return the maximum length for the mode and version. - * @param mode encode mode - * @param version vesion of the symbol - * @return the maximum length (bytes) - */ -extern int QRspec_maximumWords(QRencodeMode mode, int version); - -/****************************************************************************** - * Error correction code - *****************************************************************************/ - -/** - * Return an array of ECC specification. - * @param version version of the symbol - * @param level error correction level - * @param spec an array of ECC specification contains as following: - * {# of type1 blocks, # of data code, # of ecc code, - * # of type2 blocks, # of data code} - */ -void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]); - -#define QRspec_rsBlockNum(__spec__) (__spec__[0] + __spec__[3]) -#define QRspec_rsBlockNum1(__spec__) (__spec__[0]) -#define QRspec_rsDataCodes1(__spec__) (__spec__[1]) -#define QRspec_rsEccCodes1(__spec__) (__spec__[2]) -#define QRspec_rsBlockNum2(__spec__) (__spec__[3]) -#define QRspec_rsDataCodes2(__spec__) (__spec__[4]) -#define QRspec_rsEccCodes2(__spec__) (__spec__[2]) - -#define QRspec_rsDataLength(__spec__) \ - ((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \ - (QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__))) -#define QRspec_rsEccLength(__spec__) \ - (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__)) - -/****************************************************************************** - * Version information pattern - *****************************************************************************/ - -/** - * Return BCH encoded version information pattern that is used for the symbol - * of version 7 or greater. Use lower 18 bits. - * @param version version of the symbol - * @return BCH encoded version information pattern - */ -extern unsigned int QRspec_getVersionPattern(int version); - -/****************************************************************************** - * Format information - *****************************************************************************/ - -/** - * Return BCH encoded format information pattern. - * @param mask mask number - * @param level error correction level - * @return BCH encoded format information pattern - */ -extern unsigned int QRspec_getFormatInfo(int mask, QRecLevel level); - -/****************************************************************************** - * Frame - *****************************************************************************/ - -/** - * Return a copy of initialized frame. - * @param version version of the symbol - * @return Array of unsigned char. You can free it by free(). - */ -extern unsigned char *QRspec_newFrame(int version); - -/****************************************************************************** - * Mode indicator - *****************************************************************************/ - -/** - * Mode indicator. See Table 2 of JIS X0510:2004, pp.16. - */ -#define QRSPEC_MODEID_ECI 7 -#define QRSPEC_MODEID_NUM 1 -#define QRSPEC_MODEID_AN 2 -#define QRSPEC_MODEID_8 4 -#define QRSPEC_MODEID_KANJI 8 -#define QRSPEC_MODEID_FNC1FIRST 5 -#define QRSPEC_MODEID_FNC1SECOND 9 -#define QRSPEC_MODEID_STRUCTURE 3 -#define QRSPEC_MODEID_TERMINATOR 0 - -#endif /* QRSPEC_H */ +/* + * qrencode - QR Code encoder + * + * QR Code specification in convenient format. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QRSPEC_H +#define QRSPEC_H + +#include "qrencode.h" + +/****************************************************************************** + * Version and capacity + *****************************************************************************/ + +/** + * Maximum width of a symbol + */ +#define QRSPEC_WIDTH_MAX 177 + +/** + * Return maximum data code length (bytes) for the version. + * @param version version of the symbol + * @param level error correction level + * @return maximum size (bytes) + */ +extern int QRspec_getDataLength(int version, QRecLevel level); + +/** + * Return maximum error correction code length (bytes) for the version. + * @param version version of the symbol + * @param level error correction level + * @return ECC size (bytes) + */ +extern int QRspec_getECCLength(int version, QRecLevel level); + +/** + * Return a version number that satisfies the input code length. + * @param size input code length (byte) + * @param level error correction level + * @return version number + */ +extern int QRspec_getMinimumVersion(int size, QRecLevel level); + +/** + * Return the width of the symbol for the version. + * @param version vesion of the symbol + * @return width of the symbol + */ +extern int QRspec_getWidth(int version); + +/** + * Return the numer of remainder bits. + * @param version vesion of the symbol + * @return number of remainder bits + */ +extern int QRspec_getRemainder(int version); + +/****************************************************************************** + * Length indicator + *****************************************************************************/ + +/** + * Return the size of length indicator for the mode and version. + * @param mode encode mode + * @param version vesion of the symbol + * @return the size of the appropriate length indicator (bits). + */ +extern int QRspec_lengthIndicator(QRencodeMode mode, int version); + +/** + * Return the maximum length for the mode and version. + * @param mode encode mode + * @param version vesion of the symbol + * @return the maximum length (bytes) + */ +extern int QRspec_maximumWords(QRencodeMode mode, int version); + +/****************************************************************************** + * Error correction code + *****************************************************************************/ + +/** + * Return an array of ECC specification. + * @param version version of the symbol + * @param level error correction level + * @param spec an array of ECC specification contains as following: + * {# of type1 blocks, # of data code, # of ecc code, + * # of type2 blocks, # of data code} + */ +void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]); + +#define QRspec_rsBlockNum(__spec__) (__spec__[0] + __spec__[3]) +#define QRspec_rsBlockNum1(__spec__) (__spec__[0]) +#define QRspec_rsDataCodes1(__spec__) (__spec__[1]) +#define QRspec_rsEccCodes1(__spec__) (__spec__[2]) +#define QRspec_rsBlockNum2(__spec__) (__spec__[3]) +#define QRspec_rsDataCodes2(__spec__) (__spec__[4]) +#define QRspec_rsEccCodes2(__spec__) (__spec__[2]) + +#define QRspec_rsDataLength(__spec__) \ + ((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \ + (QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__))) +#define QRspec_rsEccLength(__spec__) \ + (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__)) + +/****************************************************************************** + * Version information pattern + *****************************************************************************/ + +/** + * Return BCH encoded version information pattern that is used for the symbol + * of version 7 or greater. Use lower 18 bits. + * @param version version of the symbol + * @return BCH encoded version information pattern + */ +extern unsigned int QRspec_getVersionPattern(int version); + +/****************************************************************************** + * Format information + *****************************************************************************/ + +/** + * Return BCH encoded format information pattern. + * @param mask mask number + * @param level error correction level + * @return BCH encoded format information pattern + */ +extern unsigned int QRspec_getFormatInfo(int mask, QRecLevel level); + +/****************************************************************************** + * Frame + *****************************************************************************/ + +/** + * Return a copy of initialized frame. + * @param version version of the symbol + * @return Array of unsigned char. You can free it by free(). + */ +extern unsigned char *QRspec_newFrame(int version); + +/****************************************************************************** + * Mode indicator + *****************************************************************************/ + +/** + * Mode indicator. See Table 2 of JIS X0510:2004, pp.16. + */ +#define QRSPEC_MODEID_ECI 7 +#define QRSPEC_MODEID_NUM 1 +#define QRSPEC_MODEID_AN 2 +#define QRSPEC_MODEID_8 4 +#define QRSPEC_MODEID_KANJI 8 +#define QRSPEC_MODEID_FNC1FIRST 5 +#define QRSPEC_MODEID_FNC1SECOND 9 +#define QRSPEC_MODEID_STRUCTURE 3 +#define QRSPEC_MODEID_TERMINATOR 0 + +#endif /* QRSPEC_H */ diff --git a/QtQREnCode/rscode.cpp b/QtQREnCode/rscode.cpp index 0c5754d..242d50a 100644 --- a/QtQREnCode/rscode.cpp +++ b/QtQREnCode/rscode.cpp @@ -1,291 +1,291 @@ - -/* - * qrencode - QR Code encoder - * - * Reed solomon encoder. This code is taken from Phil Karn's libfec then - * editted and packed into a pair of .c and .h files. - * - * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q - * (libfec is released under the GNU Lesser General Public License.) - * - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "rscode.h" - -/* Stuff specific to the 8-bit symbol version of the general purpose RS codecs - * - */ -typedef unsigned char data_t; - - -/** - * Reed-Solomon codec control block - */ -struct _RS { - int mm; /* Bits per symbol */ - int nn; /* Symbols per block (= (1<= rs->nn) { - x -= rs->nn; - x = (x >> rs->mm) + (x & rs->nn); - } - return x; -} - - -#define MODNN(x) modnn(rs,x) - -#define MM (rs->mm) -#define NN (rs->nn) -#define ALPHA_TO (rs->alpha_to) -#define INDEX_OF (rs->index_of) -#define GENPOLY (rs->genpoly) -#define NROOTS (rs->nroots) -#define FCR (rs->fcr) -#define PRIM (rs->prim) -#define IPRIM (rs->iprim) -#define PAD (rs->pad) -#define A0 (NN) - - -/* Initialize a Reed-Solomon codec - * symsize = symbol size, bits - * gfpoly = Field generator polynomial coefficients - * fcr = first root of RS code generator polynomial, index form - * prim = primitive element to generate polynomial roots - * nroots = RS code generator polynomial degree (number of roots) - * pad = padding bytes at front of shortened block - */ -static RS *init_rs_char(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad) -{ - RS *rs; - - -/* Common code for intializing a Reed-Solomon control block (char or int symbols) - * Copyright 2004 Phil Karn, KA9Q - * May be used under the terms of the GNU Lesser General Public License (LGPL) - */ -//#undef NULL -//#define NULL ((RS *)0) - - int i, j, sr,root,iprim; - - rs = NULL; - /* Check parameter ranges */ - if(symsize < 0 || symsize > 8*sizeof(data_t)){ - goto done; - } - - if(fcr < 0 || fcr >= (1<= (1<= (1<= ((1<mm = symsize; - rs->nn = (1<pad = pad; - - rs->alpha_to = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); - if(rs->alpha_to == NULL){ - free(rs); - rs = NULL; - goto done; - } - rs->index_of = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); - if(rs->index_of == NULL){ - free(rs->alpha_to); - free(rs); - rs = NULL; - goto done; - } - - /* Generate Galois field lookup tables */ - rs->index_of[0] = A0; /* log(zero) = -inf */ - rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ - sr = 1; - for(i=0;inn;i++){ - rs->index_of[sr] = i; - rs->alpha_to[i] = sr; - sr <<= 1; - if(sr & (1<nn; - } - if(sr != 1){ - /* field generator polynomial is not primitive! */ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - rs = NULL; - goto done; - } - - /* Form RS code generator polynomial from its roots */ - rs->genpoly = (data_t *)malloc(sizeof(data_t)*(nroots+1)); - if(rs->genpoly == NULL){ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - rs = NULL; - goto done; - } - rs->fcr = fcr; - rs->prim = prim; - rs->nroots = nroots; - rs->gfpoly = gfpoly; - - /* Find prim-th root of 1, used in decoding */ - for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) - ; - rs->iprim = iprim / prim; - - rs->genpoly[0] = 1; - for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { - rs->genpoly[i+1] = 1; - - /* Multiply rs->genpoly[] by @**(root + x) */ - for (j = i; j > 0; j--){ - if (rs->genpoly[j] != 0) - rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; - else - rs->genpoly[j] = rs->genpoly[j-1]; - } - /* rs->genpoly[0] can never be zero */ - rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; - } - /* convert rs->genpoly[] to index form for quicker encoding */ - for (i = 0; i <= nroots; i++) - rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; - done:; - - return rs; -} - -RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad) -{ - RS *rs; - - for(rs = rslist; rs != NULL; rs = rs->next) { - if(rs->mm != symsize) continue; - if(rs->gfpoly != gfpoly) continue; - if(rs->fcr != fcr) continue; - if(rs->prim != prim) continue; - if(rs->nroots != nroots) continue; - if(rs->pad != pad) continue; - - return rs; - } - - rs = init_rs_char(symsize, gfpoly, fcr, prim, nroots, pad); - rs->next = rslist; - rslist = rs; - - return rs; -} - - -void free_rs_char(RS *rs) -{ - free(rs->alpha_to); - free(rs->index_of); - free(rs->genpoly); - free(rs); -} - -/* The guts of the Reed-Solomon encoder, meant to be #included - * into a function body with the following typedefs, macros and variables supplied - * according to the code parameters: - - * data_t - a typedef for the data symbol - * data_t data[] - array of NN-NROOTS-PAD and type data_t to be encoded - * data_t parity[] - an array of NROOTS and type data_t to be written with parity symbols - * NROOTS - the number of roots in the RS code generator polynomial, - * which is the same as the number of parity symbols in a block. - Integer variable or literal. - * - * NN - the total number of symbols in a RS block. Integer variable or literal. - * PAD - the number of pad symbols in a block. Integer variable or literal. - * ALPHA_TO - The address of an array of NN elements to convert Galois field - * elements in index (log) form to polynomial form. Read only. - * INDEX_OF - The address of an array of NN elements to convert Galois field - * elements in polynomial form to index (log) form. Read only. - * MODNN - a function to reduce its argument modulo NN. May be inline or a macro. - * GENPOLY - an array of NROOTS+1 elements containing the generator polynomial in index form - - * The memset() and memmove() functions are used. The appropriate header - * file declaring these functions (usually ) must be included by the calling - * program. - - * Copyright 2004, Phil Karn, KA9Q - * May be used under the terms of the GNU Lesser General Public License (LGPL) - */ - -#undef A0 -#define A0 (NN) /* Special reserved value encoding zero in index form */ - -void encode_rs_char(RS *rs, const data_t *data, data_t *parity) -{ - int i, j; - data_t feedback; - - memset(parity,0,NROOTS*sizeof(data_t)); - - for(i=0;i + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "rscode.h" + +/* Stuff specific to the 8-bit symbol version of the general purpose RS codecs + * + */ +typedef unsigned char data_t; + + +/** + * Reed-Solomon codec control block + */ +struct _RS { + int mm; /* Bits per symbol */ + int nn; /* Symbols per block (= (1<= rs->nn) { + x -= rs->nn; + x = (x >> rs->mm) + (x & rs->nn); + } + return x; +} + + +#define MODNN(x) modnn(rs,x) + +#define MM (rs->mm) +#define NN (rs->nn) +#define ALPHA_TO (rs->alpha_to) +#define INDEX_OF (rs->index_of) +#define GENPOLY (rs->genpoly) +#define NROOTS (rs->nroots) +#define FCR (rs->fcr) +#define PRIM (rs->prim) +#define IPRIM (rs->iprim) +#define PAD (rs->pad) +#define A0 (NN) + + +/* Initialize a Reed-Solomon codec + * symsize = symbol size, bits + * gfpoly = Field generator polynomial coefficients + * fcr = first root of RS code generator polynomial, index form + * prim = primitive element to generate polynomial roots + * nroots = RS code generator polynomial degree (number of roots) + * pad = padding bytes at front of shortened block + */ +static RS *init_rs_char(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad) +{ + RS *rs; + + +/* Common code for intializing a Reed-Solomon control block (char or int symbols) + * Copyright 2004 Phil Karn, KA9Q + * May be used under the terms of the GNU Lesser General Public License (LGPL) + */ +//#undef NULL +//#define NULL ((RS *)0) + + int i, j, sr,root,iprim; + + rs = NULL; + /* Check parameter ranges */ + if(symsize < 0 || symsize > 8*sizeof(data_t)){ + goto done; + } + + if(fcr < 0 || fcr >= (1<= (1<= (1<= ((1<mm = symsize; + rs->nn = (1<pad = pad; + + rs->alpha_to = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); + if(rs->alpha_to == NULL){ + free(rs); + rs = NULL; + goto done; + } + rs->index_of = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); + if(rs->index_of == NULL){ + free(rs->alpha_to); + free(rs); + rs = NULL; + goto done; + } + + /* Generate Galois field lookup tables */ + rs->index_of[0] = A0; /* log(zero) = -inf */ + rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ + sr = 1; + for(i=0;inn;i++){ + rs->index_of[sr] = i; + rs->alpha_to[i] = sr; + sr <<= 1; + if(sr & (1<nn; + } + if(sr != 1){ + /* field generator polynomial is not primitive! */ + free(rs->alpha_to); + free(rs->index_of); + free(rs); + rs = NULL; + goto done; + } + + /* Form RS code generator polynomial from its roots */ + rs->genpoly = (data_t *)malloc(sizeof(data_t)*(nroots+1)); + if(rs->genpoly == NULL){ + free(rs->alpha_to); + free(rs->index_of); + free(rs); + rs = NULL; + goto done; + } + rs->fcr = fcr; + rs->prim = prim; + rs->nroots = nroots; + rs->gfpoly = gfpoly; + + /* Find prim-th root of 1, used in decoding */ + for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) + ; + rs->iprim = iprim / prim; + + rs->genpoly[0] = 1; + for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { + rs->genpoly[i+1] = 1; + + /* Multiply rs->genpoly[] by @**(root + x) */ + for (j = i; j > 0; j--){ + if (rs->genpoly[j] != 0) + rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; + else + rs->genpoly[j] = rs->genpoly[j-1]; + } + /* rs->genpoly[0] can never be zero */ + rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; + } + /* convert rs->genpoly[] to index form for quicker encoding */ + for (i = 0; i <= nroots; i++) + rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; + done:; + + return rs; +} + +RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad) +{ + RS *rs; + + for(rs = rslist; rs != NULL; rs = rs->next) { + if(rs->mm != symsize) continue; + if(rs->gfpoly != gfpoly) continue; + if(rs->fcr != fcr) continue; + if(rs->prim != prim) continue; + if(rs->nroots != nroots) continue; + if(rs->pad != pad) continue; + + return rs; + } + + rs = init_rs_char(symsize, gfpoly, fcr, prim, nroots, pad); + rs->next = rslist; + rslist = rs; + + return rs; +} + + +void free_rs_char(RS *rs) +{ + free(rs->alpha_to); + free(rs->index_of); + free(rs->genpoly); + free(rs); +} + +/* The guts of the Reed-Solomon encoder, meant to be #included + * into a function body with the following typedefs, macros and variables supplied + * according to the code parameters: + + * data_t - a typedef for the data symbol + * data_t data[] - array of NN-NROOTS-PAD and type data_t to be encoded + * data_t parity[] - an array of NROOTS and type data_t to be written with parity symbols + * NROOTS - the number of roots in the RS code generator polynomial, + * which is the same as the number of parity symbols in a block. + Integer variable or literal. + * + * NN - the total number of symbols in a RS block. Integer variable or literal. + * PAD - the number of pad symbols in a block. Integer variable or literal. + * ALPHA_TO - The address of an array of NN elements to convert Galois field + * elements in index (log) form to polynomial form. Read only. + * INDEX_OF - The address of an array of NN elements to convert Galois field + * elements in polynomial form to index (log) form. Read only. + * MODNN - a function to reduce its argument modulo NN. May be inline or a macro. + * GENPOLY - an array of NROOTS+1 elements containing the generator polynomial in index form + + * The memset() and memmove() functions are used. The appropriate header + * file declaring these functions (usually ) must be included by the calling + * program. + + * Copyright 2004, Phil Karn, KA9Q + * May be used under the terms of the GNU Lesser General Public License (LGPL) + */ + +#undef A0 +#define A0 (NN) /* Special reserved value encoding zero in index form */ + +void encode_rs_char(RS *rs, const data_t *data, data_t *parity) +{ + int i, j; + data_t feedback; + + memset(parity,0,NROOTS*sizeof(data_t)); + + for(i=0;i - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __RSCODE_H__ -#define __RSCODE_H__ - -/* - * General purpose RS codec, 8-bit symbols. - */ - -typedef struct _RS RS; - -/* WARNING: Thread unsafe!!! */ -extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad); -extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity); -extern void free_rs_char(RS *rs); - -#endif /* __RSCODE_H__ */ - - -#endif // RSCODE_H +#ifndef RSCODE_H +#define RSCODE_H + +/* + * qrencode - QR Code encoder + * + * Reed solomon encoder. This code is taken from Phil Karn's libfec then + * editted and packed into a pair of .c and .h files. + * + * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q + * (libfec is released under the GNU Lesser General Public License.) + * + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __RSCODE_H__ +#define __RSCODE_H__ + +/* + * General purpose RS codec, 8-bit symbols. + */ + +typedef struct _RS RS; + +/* WARNING: Thread unsafe!!! */ +extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad); +extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity); +extern void free_rs_char(RS *rs); + +#endif /* __RSCODE_H__ */ + + +#endif // RSCODE_H diff --git a/QtQREnCode/rsecc.c b/QtQREnCode/rsecc.c index b88cae3..2be82af 100644 --- a/QtQREnCode/rsecc.c +++ b/QtQREnCode/rsecc.c @@ -1,149 +1,149 @@ -/* - * qrencode - QR Code encoder - * - * Reed solomon error correction code encoder specialized for QR code. - * This code is rewritten by Kentaro Fukuchi, referring to the FEC library - * developed by Phil Karn (KA9Q). - * - * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q - * Copyright (C) 2014-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#if HAVE_LIBPTHREAD -#include -#endif - -#include "rsecc.h" - -#if HAVE_LIBPTHREAD -static pthread_mutex_t RSECC_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif - -static int initialized = 0; - -#define SYMBOL_SIZE (8) -#define symbols ((1U << SYMBOL_SIZE) - 1) -static const unsigned int proot = 0x11d; /* stands for x^8+x^4+x^3+x^2+1 (see pp.37 of JIS X0510:2004) */ - -/* min/max codeword length of ECC, calculated from the specification. */ -#define min_length (2) -#define max_length (30) -#define max_generatorSize (max_length) - -static unsigned char alpha[symbols + 1]; -static unsigned char aindex[symbols + 1]; -static unsigned char generator[max_length - min_length + 1][max_generatorSize + 1]; -static unsigned char generatorInitialized[max_length - min_length + 1]; - -static void RSECC_initLookupTable(void) -{ - unsigned int i, b; - - alpha[symbols] = 0; - aindex[0] = symbols; - - b = 1; - for(i = 0; i < symbols; i++) { - alpha[i] = b; - aindex[b] = i; - b <<= 1; - if(b & (symbols + 1)) { - b ^= proot; - } - b &= symbols; - } -} - -static void RSECC_init(void) -{ - RSECC_initLookupTable(); - memset(generatorInitialized, 0, (max_length - min_length + 1)); - initialized = 1; -} - -static void generator_init(size_t length) -{ - size_t i, j; - int g[max_generatorSize + 1]; - - g[0] = 1; - for(i = 0; i < length; i++) { - g[i + 1] = 1; - /* Because g[0] never be zero, skipped some conditional checks. */ - for(j = i; j > 0; j--) { - g[j] = g[j - 1] ^ alpha[(aindex[g[j]] + i) % symbols]; - } - g[0] = alpha[(aindex[g[0]] + i) % symbols]; - } - - for(i = 0; i <= length; i++) { - generator[length - min_length][i] = aindex[g[i]]; - } - - generatorInitialized[length - min_length] = 1; -} - -int RSECC_encode(size_t data_length, size_t ecc_length, const unsigned char *data, unsigned char *ecc) -{ - size_t i, j; - unsigned char feedback; - unsigned char *gen; - -#if HAVE_LIBPTHREAD - pthread_mutex_lock(&RSECC_mutex); -#endif - if(!initialized) { - RSECC_init(); - } -#if HAVE_LIBPTHREAD - pthread_mutex_unlock(&RSECC_mutex); -#endif - - if(ecc_length > max_length) return -1; - - memset(ecc, 0, ecc_length); -#if HAVE_LIBPTHREAD - pthread_mutex_lock(&RSECC_mutex); -#endif - if(!generatorInitialized[ecc_length - min_length]) generator_init(ecc_length); -#if HAVE_LIBPTHREAD - pthread_mutex_unlock(&RSECC_mutex); -#endif - gen = generator[ecc_length - min_length]; - - for(i = 0; i < data_length; i++) { - feedback = aindex[data[i] ^ ecc[0]]; - if(feedback != symbols) { - for(j = 1; j < ecc_length; j++) { - ecc[j] ^= alpha[(unsigned int)(feedback + gen[ecc_length - j]) % symbols]; - } - } - memmove(&ecc[0], &ecc[1], ecc_length - 1); - if(feedback != symbols) { - ecc[ecc_length - 1] = alpha[(unsigned int)(feedback + gen[0]) % symbols]; - } else { - ecc[ecc_length - 1] = 0; - } - } - - return 0; -} +/* + * qrencode - QR Code encoder + * + * Reed solomon error correction code encoder specialized for QR code. + * This code is rewritten by Kentaro Fukuchi, referring to the FEC library + * developed by Phil Karn (KA9Q). + * + * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q + * Copyright (C) 2014-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#if HAVE_LIBPTHREAD +#include +#endif + +#include "rsecc.h" + +#if HAVE_LIBPTHREAD +static pthread_mutex_t RSECC_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif + +static int initialized = 0; + +#define SYMBOL_SIZE (8) +#define symbols ((1U << SYMBOL_SIZE) - 1) +static const unsigned int proot = 0x11d; /* stands for x^8+x^4+x^3+x^2+1 (see pp.37 of JIS X0510:2004) */ + +/* min/max codeword length of ECC, calculated from the specification. */ +#define min_length (2) +#define max_length (30) +#define max_generatorSize (max_length) + +static unsigned char alpha[symbols + 1]; +static unsigned char aindex[symbols + 1]; +static unsigned char generator[max_length - min_length + 1][max_generatorSize + 1]; +static unsigned char generatorInitialized[max_length - min_length + 1]; + +static void RSECC_initLookupTable(void) +{ + unsigned int i, b; + + alpha[symbols] = 0; + aindex[0] = symbols; + + b = 1; + for(i = 0; i < symbols; i++) { + alpha[i] = b; + aindex[b] = i; + b <<= 1; + if(b & (symbols + 1)) { + b ^= proot; + } + b &= symbols; + } +} + +static void RSECC_init(void) +{ + RSECC_initLookupTable(); + memset(generatorInitialized, 0, (max_length - min_length + 1)); + initialized = 1; +} + +static void generator_init(size_t length) +{ + size_t i, j; + int g[max_generatorSize + 1]; + + g[0] = 1; + for(i = 0; i < length; i++) { + g[i + 1] = 1; + /* Because g[0] never be zero, skipped some conditional checks. */ + for(j = i; j > 0; j--) { + g[j] = g[j - 1] ^ alpha[(aindex[g[j]] + i) % symbols]; + } + g[0] = alpha[(aindex[g[0]] + i) % symbols]; + } + + for(i = 0; i <= length; i++) { + generator[length - min_length][i] = aindex[g[i]]; + } + + generatorInitialized[length - min_length] = 1; +} + +int RSECC_encode(size_t data_length, size_t ecc_length, const unsigned char *data, unsigned char *ecc) +{ + size_t i, j; + unsigned char feedback; + unsigned char *gen; + +#if HAVE_LIBPTHREAD + pthread_mutex_lock(&RSECC_mutex); +#endif + if(!initialized) { + RSECC_init(); + } +#if HAVE_LIBPTHREAD + pthread_mutex_unlock(&RSECC_mutex); +#endif + + if(ecc_length > max_length) return -1; + + memset(ecc, 0, ecc_length); +#if HAVE_LIBPTHREAD + pthread_mutex_lock(&RSECC_mutex); +#endif + if(!generatorInitialized[ecc_length - min_length]) generator_init(ecc_length); +#if HAVE_LIBPTHREAD + pthread_mutex_unlock(&RSECC_mutex); +#endif + gen = generator[ecc_length - min_length]; + + for(i = 0; i < data_length; i++) { + feedback = aindex[data[i] ^ ecc[0]]; + if(feedback != symbols) { + for(j = 1; j < ecc_length; j++) { + ecc[j] ^= alpha[(unsigned int)(feedback + gen[ecc_length - j]) % symbols]; + } + } + memmove(&ecc[0], &ecc[1], ecc_length - 1); + if(feedback != symbols) { + ecc[ecc_length - 1] = alpha[(unsigned int)(feedback + gen[0]) % symbols]; + } else { + ecc[ecc_length - 1] = 0; + } + } + + return 0; +} diff --git a/QtQREnCode/rsecc.h b/QtQREnCode/rsecc.h index 2c17ded..6e854f2 100644 --- a/QtQREnCode/rsecc.h +++ b/QtQREnCode/rsecc.h @@ -1,31 +1,31 @@ -/* - * qrencode - QR Code encoder - * - * Reed solomon error correction code encoder specialized for QR code. - * This code is rewritten by Kentaro Fukuchi, referring to the FEC library - * developed by Phil Karn (KA9Q). - * - * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q - * Copyright (C) 2014-2017 Kentaro Fukuchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RSECC_H -#define RSECC_H - -extern int RSECC_encode(size_t data_length, size_t ecc_length, const unsigned char *data, unsigned char *ecc); - -#endif /* RSECC_H */ +/* + * qrencode - QR Code encoder + * + * Reed solomon error correction code encoder specialized for QR code. + * This code is rewritten by Kentaro Fukuchi, referring to the FEC library + * developed by Phil Karn (KA9Q). + * + * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q + * Copyright (C) 2014-2017 Kentaro Fukuchi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RSECC_H +#define RSECC_H + +extern int RSECC_encode(size_t data_length, size_t ecc_length, const unsigned char *data, unsigned char *ecc); + +#endif /* RSECC_H */ diff --git a/QtQREnCode/split.c b/QtQREnCode/split.c index a79bf03..c5c9610 100644 --- a/QtQREnCode/split.c +++ b/QtQREnCode/split.c @@ -1,323 +1,323 @@ -/* - * qrencode - QR Code encoder - * - * Input data splitter. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif -#include -#include -#include -#include "qrencode.h" -#include "qrinput.h" -#include "qrspec.h" -#include "split.h" - -#define isdigit(__c__) ((unsigned char)((signed char)(__c__) - '0') < 10) -#define isalnum(__c__) (QRinput_lookAnTable(__c__) >= 0) - -#if !HAVE_STRDUP -#undef strdup -char *strdup(const char *s) -{ - size_t len = strlen(s) + 1; - void *newstring = malloc(len); - if(newstring == NULL) return NULL; - return (char *)memcpy(newstring, s, len); -} -#endif - -static QRencodeMode Split_identifyMode(const char *string, QRencodeMode hint) -{ - unsigned char c, d; - unsigned int word; - - c = (unsigned char)string[0]; - - if(c == '\0') return QR_MODE_NUL; - if(isdigit(c)) { - return QR_MODE_NUM; - } else if(isalnum(c)) { - return QR_MODE_AN; - } else if(hint == QR_MODE_KANJI) { - d = (unsigned char)string[1]; - if(d != '\0') { - word = ((unsigned int)c << 8) | d; - if((word >= 0x8140 && word <= 0x9ffc) || (word >= 0xe040 && word <= 0xebbf)) { - return QR_MODE_KANJI; - } - } - } - - return QR_MODE_8; -} - -static int Split_eatAn(const char *string, QRinput *input, QRencodeMode hint); -static int Split_eat8(const char *string, QRinput *input, QRencodeMode hint); - -static int Split_eatNum(const char *string, QRinput *input,QRencodeMode hint) -{ - const char *p; - int ret; - int run; - int dif; - int ln; - QRencodeMode mode; - - ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); - - p = string; - while(isdigit(*p)) { - p++; - } - run = (int)(p - string); - mode = Split_identifyMode(p, hint); - if(mode == QR_MODE_8) { - dif = QRinput_estimateBitsModeNum(run) + 4 + ln - + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ - - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; - if(dif > 0) { - return Split_eat8(string, input, hint); - } - } - if(mode == QR_MODE_AN) { - dif = QRinput_estimateBitsModeNum(run) + 4 + ln - + QRinput_estimateBitsModeAn(1) /* + 4 + la */ - - QRinput_estimateBitsModeAn(run + 1) /* - 4 - la */; - if(dif > 0) { - return Split_eatAn(string, input, hint); - } - } - - ret = QRinput_append(input, QR_MODE_NUM, run, (unsigned char *)string); - if(ret < 0) return -1; - - return run; -} - -static int Split_eatAn(const char *string, QRinput *input, QRencodeMode hint) -{ - const char *p, *q; - int ret; - int run; - int dif; - int la, ln; - - la = QRspec_lengthIndicator(QR_MODE_AN, input->version); - ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); - - p = string; - while(isalnum(*p)) { - if(isdigit(*p)) { - q = p; - while(isdigit(*q)) { - q++; - } - dif = QRinput_estimateBitsModeAn((int)(p - string)) /* + 4 + la */ - + QRinput_estimateBitsModeNum((int)(q - p)) + 4 + ln - + (isalnum(*q)?(4 + ln):0) - - QRinput_estimateBitsModeAn((int)(q - string)) /* - 4 - la */; - if(dif < 0) { - break; - } - p = q; - } else { - p++; - } - } - - run = (int)(p - string); - - if(*p && !isalnum(*p)) { - dif = QRinput_estimateBitsModeAn(run) + 4 + la - + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ - - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; - if(dif > 0) { - return Split_eat8(string, input, hint); - } - } - - ret = QRinput_append(input, QR_MODE_AN, run, (unsigned char *)string); - if(ret < 0) return -1; - - return run; -} - -static int Split_eatKanji(const char *string, QRinput *input, QRencodeMode hint) -{ - const char *p; - int ret; - int run; - - p = string; - while(Split_identifyMode(p, hint) == QR_MODE_KANJI) { - p += 2; - } - run = (int)(p - string); - ret = QRinput_append(input, QR_MODE_KANJI, run, (unsigned char *)string); - if(ret < 0) return -1; - - return run; -} - -static int Split_eat8(const char *string, QRinput *input, QRencodeMode hint) -{ - const char *p, *q; - QRencodeMode mode; - int ret; - int run; - int dif; - int la, ln, l8; - int swcost; - - la = QRspec_lengthIndicator(QR_MODE_AN, input->version); - ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); - l8 = QRspec_lengthIndicator(QR_MODE_8, input->version); - - p = string + 1; - while(*p != '\0') { - mode = Split_identifyMode(p, hint); - if(mode == QR_MODE_KANJI) { - break; - } - if(mode == QR_MODE_NUM) { - q = p; - while(isdigit(*q)) { - q++; - } - if(Split_identifyMode(q, hint) == QR_MODE_8) { - swcost = 4 + l8; - } else { - swcost = 0; - } - dif = QRinput_estimateBitsMode8((int)(p - string)) /* + 4 + l8 */ - + QRinput_estimateBitsModeNum((int)(q - p)) + 4 + ln - + swcost - - QRinput_estimateBitsMode8((int)(q - string)) /* - 4 - l8 */; - if(dif < 0) { - break; - } - p = q; - } else if(mode == QR_MODE_AN) { - q = p; - while(isalnum(*q)) { - q++; - } - if(Split_identifyMode(q, hint) == QR_MODE_8) { - swcost = 4 + l8; - } else { - swcost = 0; - } - dif = QRinput_estimateBitsMode8((int)(p - string)) /* + 4 + l8 */ - + QRinput_estimateBitsModeAn((int)(q - p)) + 4 + la - + swcost - - QRinput_estimateBitsMode8((int)(q - string)) /* - 4 - l8 */; - if(dif < 0) { - break; - } - p = q; - } else { - p++; - } - } - - run = (int)(p - string); - ret = QRinput_append(input, QR_MODE_8, run, (unsigned char *)string); - if(ret < 0) return -1; - - return run; -} - -static int Split_splitString(const char *string, QRinput *input, - QRencodeMode hint) -{ - int length; - QRencodeMode mode; - - while(*string != '\0') { - mode = Split_identifyMode(string, hint); - if(mode == QR_MODE_NUM) { - length = Split_eatNum(string, input, hint); - } else if(mode == QR_MODE_AN) { - length = Split_eatAn(string, input, hint); - } else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) { - length = Split_eatKanji(string, input, hint); - } else { - length = Split_eat8(string, input, hint); - } - if(length == 0) break; - if(length < 0) return -1; - string += length; - } - - return 0; -} - -static char *dupAndToUpper(const char *str, QRencodeMode hint) -{ - char *newstr, *p; - QRencodeMode mode; - - newstr = strdup(str); - if(newstr == NULL) return NULL; - - p = newstr; - while(*p != '\0') { - mode = Split_identifyMode(p, hint); - if(mode == QR_MODE_KANJI) { - p += 2; - } else { - if (*p >= 'a' && *p <= 'z') { - *p = (char)((int)*p - 32); - } - p++; - } - } - - return newstr; -} - -int Split_splitStringToQRinput(const char *string, QRinput *input, - QRencodeMode hint, int casesensitive) -{ - char *newstr; - int ret; - - if(string == NULL || *string == '\0') { - errno = EINVAL; - return -1; - } - if(!casesensitive) { - newstr = dupAndToUpper(string, hint); - if(newstr == NULL) return -1; - ret = Split_splitString(newstr, input, hint); - free(newstr); - } else { - ret = Split_splitString(string, input, hint); - } - - return ret; -} +/* + * qrencode - QR Code encoder + * + * Input data splitter. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include "qrencode.h" +#include "qrinput.h" +#include "qrspec.h" +#include "split.h" + +#define isdigit(__c__) ((unsigned char)((signed char)(__c__) - '0') < 10) +#define isalnum(__c__) (QRinput_lookAnTable(__c__) >= 0) + +#if !HAVE_STRDUP +#undef strdup +char *strdup(const char *s) +{ + size_t len = strlen(s) + 1; + void *newstring = malloc(len); + if(newstring == NULL) return NULL; + return (char *)memcpy(newstring, s, len); +} +#endif + +static QRencodeMode Split_identifyMode(const char *string, QRencodeMode hint) +{ + unsigned char c, d; + unsigned int word; + + c = (unsigned char)string[0]; + + if(c == '\0') return QR_MODE_NUL; + if(isdigit(c)) { + return QR_MODE_NUM; + } else if(isalnum(c)) { + return QR_MODE_AN; + } else if(hint == QR_MODE_KANJI) { + d = (unsigned char)string[1]; + if(d != '\0') { + word = ((unsigned int)c << 8) | d; + if((word >= 0x8140 && word <= 0x9ffc) || (word >= 0xe040 && word <= 0xebbf)) { + return QR_MODE_KANJI; + } + } + } + + return QR_MODE_8; +} + +static int Split_eatAn(const char *string, QRinput *input, QRencodeMode hint); +static int Split_eat8(const char *string, QRinput *input, QRencodeMode hint); + +static int Split_eatNum(const char *string, QRinput *input,QRencodeMode hint) +{ + const char *p; + int ret; + int run; + int dif; + int ln; + QRencodeMode mode; + + ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); + + p = string; + while(isdigit(*p)) { + p++; + } + run = (int)(p - string); + mode = Split_identifyMode(p, hint); + if(mode == QR_MODE_8) { + dif = QRinput_estimateBitsModeNum(run) + 4 + ln + + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ + - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; + if(dif > 0) { + return Split_eat8(string, input, hint); + } + } + if(mode == QR_MODE_AN) { + dif = QRinput_estimateBitsModeNum(run) + 4 + ln + + QRinput_estimateBitsModeAn(1) /* + 4 + la */ + - QRinput_estimateBitsModeAn(run + 1) /* - 4 - la */; + if(dif > 0) { + return Split_eatAn(string, input, hint); + } + } + + ret = QRinput_append(input, QR_MODE_NUM, run, (unsigned char *)string); + if(ret < 0) return -1; + + return run; +} + +static int Split_eatAn(const char *string, QRinput *input, QRencodeMode hint) +{ + const char *p, *q; + int ret; + int run; + int dif; + int la, ln; + + la = QRspec_lengthIndicator(QR_MODE_AN, input->version); + ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); + + p = string; + while(isalnum(*p)) { + if(isdigit(*p)) { + q = p; + while(isdigit(*q)) { + q++; + } + dif = QRinput_estimateBitsModeAn((int)(p - string)) /* + 4 + la */ + + QRinput_estimateBitsModeNum((int)(q - p)) + 4 + ln + + (isalnum(*q)?(4 + ln):0) + - QRinput_estimateBitsModeAn((int)(q - string)) /* - 4 - la */; + if(dif < 0) { + break; + } + p = q; + } else { + p++; + } + } + + run = (int)(p - string); + + if(*p && !isalnum(*p)) { + dif = QRinput_estimateBitsModeAn(run) + 4 + la + + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ + - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; + if(dif > 0) { + return Split_eat8(string, input, hint); + } + } + + ret = QRinput_append(input, QR_MODE_AN, run, (unsigned char *)string); + if(ret < 0) return -1; + + return run; +} + +static int Split_eatKanji(const char *string, QRinput *input, QRencodeMode hint) +{ + const char *p; + int ret; + int run; + + p = string; + while(Split_identifyMode(p, hint) == QR_MODE_KANJI) { + p += 2; + } + run = (int)(p - string); + ret = QRinput_append(input, QR_MODE_KANJI, run, (unsigned char *)string); + if(ret < 0) return -1; + + return run; +} + +static int Split_eat8(const char *string, QRinput *input, QRencodeMode hint) +{ + const char *p, *q; + QRencodeMode mode; + int ret; + int run; + int dif; + int la, ln, l8; + int swcost; + + la = QRspec_lengthIndicator(QR_MODE_AN, input->version); + ln = QRspec_lengthIndicator(QR_MODE_NUM, input->version); + l8 = QRspec_lengthIndicator(QR_MODE_8, input->version); + + p = string + 1; + while(*p != '\0') { + mode = Split_identifyMode(p, hint); + if(mode == QR_MODE_KANJI) { + break; + } + if(mode == QR_MODE_NUM) { + q = p; + while(isdigit(*q)) { + q++; + } + if(Split_identifyMode(q, hint) == QR_MODE_8) { + swcost = 4 + l8; + } else { + swcost = 0; + } + dif = QRinput_estimateBitsMode8((int)(p - string)) /* + 4 + l8 */ + + QRinput_estimateBitsModeNum((int)(q - p)) + 4 + ln + + swcost + - QRinput_estimateBitsMode8((int)(q - string)) /* - 4 - l8 */; + if(dif < 0) { + break; + } + p = q; + } else if(mode == QR_MODE_AN) { + q = p; + while(isalnum(*q)) { + q++; + } + if(Split_identifyMode(q, hint) == QR_MODE_8) { + swcost = 4 + l8; + } else { + swcost = 0; + } + dif = QRinput_estimateBitsMode8((int)(p - string)) /* + 4 + l8 */ + + QRinput_estimateBitsModeAn((int)(q - p)) + 4 + la + + swcost + - QRinput_estimateBitsMode8((int)(q - string)) /* - 4 - l8 */; + if(dif < 0) { + break; + } + p = q; + } else { + p++; + } + } + + run = (int)(p - string); + ret = QRinput_append(input, QR_MODE_8, run, (unsigned char *)string); + if(ret < 0) return -1; + + return run; +} + +static int Split_splitString(const char *string, QRinput *input, + QRencodeMode hint) +{ + int length; + QRencodeMode mode; + + while(*string != '\0') { + mode = Split_identifyMode(string, hint); + if(mode == QR_MODE_NUM) { + length = Split_eatNum(string, input, hint); + } else if(mode == QR_MODE_AN) { + length = Split_eatAn(string, input, hint); + } else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) { + length = Split_eatKanji(string, input, hint); + } else { + length = Split_eat8(string, input, hint); + } + if(length == 0) break; + if(length < 0) return -1; + string += length; + } + + return 0; +} + +static char *dupAndToUpper(const char *str, QRencodeMode hint) +{ + char *newstr, *p; + QRencodeMode mode; + + newstr = strdup(str); + if(newstr == NULL) return NULL; + + p = newstr; + while(*p != '\0') { + mode = Split_identifyMode(p, hint); + if(mode == QR_MODE_KANJI) { + p += 2; + } else { + if (*p >= 'a' && *p <= 'z') { + *p = (char)((int)*p - 32); + } + p++; + } + } + + return newstr; +} + +int Split_splitStringToQRinput(const char *string, QRinput *input, + QRencodeMode hint, int casesensitive) +{ + char *newstr; + int ret; + + if(string == NULL || *string == '\0') { + errno = EINVAL; + return -1; + } + if(!casesensitive) { + newstr = dupAndToUpper(string, hint); + if(newstr == NULL) return -1; + ret = Split_splitString(newstr, input, hint); + free(newstr); + } else { + ret = Split_splitString(string, input, hint); + } + + return ret; +} diff --git a/QtQREnCode/split.cpp b/QtQREnCode/split.cpp index 6574de8..09213b1 100644 --- a/QtQREnCode/split.cpp +++ b/QtQREnCode/split.cpp @@ -1,213 +1,213 @@ - -/* - * qrencode - QR Code encoder - * - * Input data splitter. - * Copyright (C) 2006,2007 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "qrencode.h" -#include "qrinput.h" -#include "qrspec.h" -#include "split.h" - -#define isdigit(__c__) ((unsigned char)((signed char)(__c__) - '0') < 10) -#define isalnum(__c__) (QRinput_lookAnTable(__c__) >= 0) - -static int Split_eatNum(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); -static int Split_eatAn(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); -static int Split_eat8(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); -static int Split_eatKanji(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); - -static int Split_eatNum(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) -{ - const char *p; - int run; - int dif; - int ln; - - ln = QRspec_lengthIndicator(QR_MODE_NUM, version); - - p = string; - while(isdigit(*p)) { - p++; - } - run = p - string; - if(*p & 0x80) { - dif = QRinput_estimateBitsModeNum(run) + 4 + ln - + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ - - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; - if(dif > 0) { - return Split_eat8(string, input, version, hint, casesensitive); - } - } - if(isalnum(*p) && !casesensitive) { - dif = QRinput_estimateBitsModeNum(run) + 4 + ln - + QRinput_estimateBitsModeAn(1) /* + 4 + la */ - - QRinput_estimateBitsModeAn(run + 1) /* - 4 - la */; - if(dif > 0) { - return Split_eatAn(string, input, version, hint, casesensitive); - } - } - - QRinput_append(input, QR_MODE_NUM, run, (unsigned char *)string); - return run; -} - -static int Split_eatAn(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) -{ - const char *p, *q; - int run; - int dif; - int la, ln; - - if(casesensitive) { - return Split_eat8(string, input, version, hint, casesensitive); - } - - la = QRspec_lengthIndicator(QR_MODE_AN, version); - ln = QRspec_lengthIndicator(QR_MODE_NUM, version); - - p = string; - while(isalnum(*p)) { - if(isdigit(*p)) { - q = p; - while(isdigit(*q)) { - q++; - } - dif = QRinput_estimateBitsModeAn(p - string) /* + 4 + la */ - + QRinput_estimateBitsModeNum(q - p) + 4 + ln - - QRinput_estimateBitsModeAn(q - string) /* - 4 - la */; - if(dif < 0) { - break; - } else { - p = q; - } - } else { - p++; - } - } - - run = p - string; - - if(*p & 0x80) { - dif = QRinput_estimateBitsModeAn(run) + 4 + la - + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ - - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; - if(dif > 0) { - return Split_eat8(string, input, version, hint, casesensitive); - } - } - - QRinput_append(input, QR_MODE_AN, run, (unsigned char *)string); - return run; -} - -static int Split_eatKanji(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) -{ - const char *p; - - p = string; - while(QRinput_identifyMode(p) == QR_MODE_KANJI) { - p += 2; - } - QRinput_append(input, QR_MODE_KANJI, p - string, (unsigned char *)string); - return p - string; -} - -static int Split_eat8(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) -{ - const char *p, *q; - QRencodeMode mode; - int dif; - int la, ln; - - la = QRspec_lengthIndicator(QR_MODE_AN, version); - ln = QRspec_lengthIndicator(QR_MODE_NUM, version); - - p = string; - while(*p != '\0') { - mode = QRinput_identifyMode(p); - if(hint == QR_MODE_KANJI && mode == QR_MODE_KANJI) { - break; - } - if(mode != QR_MODE_8 && mode != QR_MODE_KANJI) { - if(mode == QR_MODE_NUM) { - q = p; - while(isdigit(*q)) { - q++; - } - dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 */ - + QRinput_estimateBitsModeNum(q - p) + 4 + ln - - QRinput_estimateBitsMode8(q - string) /* - 4 - l8 */; - if(dif < 0) { - break; - } else { - p = q; - } - } else if(!casesensitive) { - q = p; - while(isalnum(*q)) { - q++; - } - dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 */ - + QRinput_estimateBitsModeAn(q - p) + 4 + la - - QRinput_estimateBitsMode8(q - string) /* - 4 - l8 */; - if(dif < 0) { - break; - } else { - p = q; - } - } else { - p++; - } - } else { - p++; - } - } - - QRinput_append(input, QR_MODE_8, p - string, (unsigned char *)string); - return p - string; -} - -void Split_splitStringToQRinput(const char *string, QRinput *input, - int version, QRencodeMode hint, int casesensitive) -{ - int length; - QRencodeMode mode; - - if(*string == '\0') return; - - mode = QRinput_identifyMode(string); - if(mode == QR_MODE_NUM) { - length = Split_eatNum(string, input, version, hint, casesensitive); - } else if(mode == QR_MODE_AN && !casesensitive) { - length = Split_eatAn(string, input, version, hint, casesensitive); - } else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) { - length = Split_eatKanji(string, input, version, hint, casesensitive); - } else { - length = Split_eat8(string, input, version, hint, casesensitive); - } - if(length == 0) return; - Split_splitStringToQRinput(&string[length], input, hint, mode, casesensitive); -} + +/* + * qrencode - QR Code encoder + * + * Input data splitter. + * Copyright (C) 2006,2007 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "qrencode.h" +#include "qrinput.h" +#include "qrspec.h" +#include "split.h" + +#define isdigit(__c__) ((unsigned char)((signed char)(__c__) - '0') < 10) +#define isalnum(__c__) (QRinput_lookAnTable(__c__) >= 0) + +static int Split_eatNum(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); +static int Split_eatAn(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); +static int Split_eat8(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); +static int Split_eatKanji(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive); + +static int Split_eatNum(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) +{ + const char *p; + int run; + int dif; + int ln; + + ln = QRspec_lengthIndicator(QR_MODE_NUM, version); + + p = string; + while(isdigit(*p)) { + p++; + } + run = p - string; + if(*p & 0x80) { + dif = QRinput_estimateBitsModeNum(run) + 4 + ln + + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ + - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; + if(dif > 0) { + return Split_eat8(string, input, version, hint, casesensitive); + } + } + if(isalnum(*p) && !casesensitive) { + dif = QRinput_estimateBitsModeNum(run) + 4 + ln + + QRinput_estimateBitsModeAn(1) /* + 4 + la */ + - QRinput_estimateBitsModeAn(run + 1) /* - 4 - la */; + if(dif > 0) { + return Split_eatAn(string, input, version, hint, casesensitive); + } + } + + QRinput_append(input, QR_MODE_NUM, run, (unsigned char *)string); + return run; +} + +static int Split_eatAn(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) +{ + const char *p, *q; + int run; + int dif; + int la, ln; + + if(casesensitive) { + return Split_eat8(string, input, version, hint, casesensitive); + } + + la = QRspec_lengthIndicator(QR_MODE_AN, version); + ln = QRspec_lengthIndicator(QR_MODE_NUM, version); + + p = string; + while(isalnum(*p)) { + if(isdigit(*p)) { + q = p; + while(isdigit(*q)) { + q++; + } + dif = QRinput_estimateBitsModeAn(p - string) /* + 4 + la */ + + QRinput_estimateBitsModeNum(q - p) + 4 + ln + - QRinput_estimateBitsModeAn(q - string) /* - 4 - la */; + if(dif < 0) { + break; + } else { + p = q; + } + } else { + p++; + } + } + + run = p - string; + + if(*p & 0x80) { + dif = QRinput_estimateBitsModeAn(run) + 4 + la + + QRinput_estimateBitsMode8(1) /* + 4 + l8 */ + - QRinput_estimateBitsMode8(run + 1) /* - 4 - l8 */; + if(dif > 0) { + return Split_eat8(string, input, version, hint, casesensitive); + } + } + + QRinput_append(input, QR_MODE_AN, run, (unsigned char *)string); + return run; +} + +static int Split_eatKanji(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) +{ + const char *p; + + p = string; + while(QRinput_identifyMode(p) == QR_MODE_KANJI) { + p += 2; + } + QRinput_append(input, QR_MODE_KANJI, p - string, (unsigned char *)string); + return p - string; +} + +static int Split_eat8(const char *string, QRinput *input, int version, QRencodeMode hint, int casesensitive) +{ + const char *p, *q; + QRencodeMode mode; + int dif; + int la, ln; + + la = QRspec_lengthIndicator(QR_MODE_AN, version); + ln = QRspec_lengthIndicator(QR_MODE_NUM, version); + + p = string; + while(*p != '\0') { + mode = QRinput_identifyMode(p); + if(hint == QR_MODE_KANJI && mode == QR_MODE_KANJI) { + break; + } + if(mode != QR_MODE_8 && mode != QR_MODE_KANJI) { + if(mode == QR_MODE_NUM) { + q = p; + while(isdigit(*q)) { + q++; + } + dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 */ + + QRinput_estimateBitsModeNum(q - p) + 4 + ln + - QRinput_estimateBitsMode8(q - string) /* - 4 - l8 */; + if(dif < 0) { + break; + } else { + p = q; + } + } else if(!casesensitive) { + q = p; + while(isalnum(*q)) { + q++; + } + dif = QRinput_estimateBitsMode8(p - string) /* + 4 + l8 */ + + QRinput_estimateBitsModeAn(q - p) + 4 + la + - QRinput_estimateBitsMode8(q - string) /* - 4 - l8 */; + if(dif < 0) { + break; + } else { + p = q; + } + } else { + p++; + } + } else { + p++; + } + } + + QRinput_append(input, QR_MODE_8, p - string, (unsigned char *)string); + return p - string; +} + +void Split_splitStringToQRinput(const char *string, QRinput *input, + int version, QRencodeMode hint, int casesensitive) +{ + int length; + QRencodeMode mode; + + if(*string == '\0') return; + + mode = QRinput_identifyMode(string); + if(mode == QR_MODE_NUM) { + length = Split_eatNum(string, input, version, hint, casesensitive); + } else if(mode == QR_MODE_AN && !casesensitive) { + length = Split_eatAn(string, input, version, hint, casesensitive); + } else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) { + length = Split_eatKanji(string, input, version, hint, casesensitive); + } else { + length = Split_eat8(string, input, version, hint, casesensitive); + } + if(length == 0) return; + Split_splitStringToQRinput(&string[length], input, hint, mode, casesensitive); +} diff --git a/QtQREnCode/split.h b/QtQREnCode/split.h index 81829e0..69c372f 100644 --- a/QtQREnCode/split.h +++ b/QtQREnCode/split.h @@ -1,47 +1,47 @@ -/* - * qrencode - QR Code encoder - * - * Input data splitter. - * Copyright (C) 2006-2017 Kentaro Fukuchi - * - * The following data / specifications are taken from - * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) - * or - * "Automatic identification and data capture techniques -- - * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SPLIT_H -#define SPLIT_H - -#include "qrencode.h" - -/** - * Split the input string (null terminated) into QRinput. - * @param string input string - * @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8. - * @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS. - * @retval 0 success. - * @retval -1 an error occurred. errno is set to indicate the error. See - * Exceptions for the details. - * @throw EINVAL invalid input object. - * @throw ENOMEM unable to allocate memory for input objects. - */ -extern int Split_splitStringToQRinput(const char *string, QRinput *input, - QRencodeMode hint, int casesensitive); - -#endif /* SPLIT_H */ +/* + * qrencode - QR Code encoder + * + * Input data splitter. + * Copyright (C) 2006-2017 Kentaro Fukuchi + * + * The following data / specifications are taken from + * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) + * or + * "Automatic identification and data capture techniques -- + * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SPLIT_H +#define SPLIT_H + +#include "qrencode.h" + +/** + * Split the input string (null terminated) into QRinput. + * @param string input string + * @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8. + * @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS. + * @retval 0 success. + * @retval -1 an error occurred. errno is set to indicate the error. See + * Exceptions for the details. + * @throw EINVAL invalid input object. + * @throw ENOMEM unable to allocate memory for input objects. + */ +extern int Split_splitStringToQRinput(const char *string, QRinput *input, + QRencodeMode hint, int casesensitive); + +#endif /* SPLIT_H */ diff --git a/QtUI.pro b/QtUI.pro index 881cc4f..7394d95 100644 --- a/QtUI.pro +++ b/QtUI.pro @@ -1,419 +1,419 @@ -###################################################################### -# Automatically generated by qmake (2.01a) ?? 11? 8 22:48:42 2013 -###################################################################### -# -spec /usr/local/Trolltech/QtEmbedded-4.6.3-arm/mkspecs/qws/linux-arm-g++ DEFINES+=ARM DEFINES+=QTV3 DEFINES+=VNLG -# DEFINES+=VNLG -# DEFINES+=X86TEST DEFINES+=VNLG DEFINES+=UART1 -# GIT -#$ git config --global user.name "niexiong" -#$ git config --global user.email "nx@runoob.com" -# git clone git@119.23.201.56:/home/git/QtUI.git -# git pull -# git commit -am "提交说明" -# git push -# git add -# git add -f xxx.cpp #强制提交文件 -# git rm -# -# - -QT += core gui network serialport virtualkeyboard sql -QT += xml - -#//edit@02-07 -#LIBS += -L/usr/local/openssl-1.0.2 -lssl -lcrypto - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -QT_VERSION = $$[QT_VERSION] -QT_VERSION = $$split(QT_VERSION, ".") -QT_VER_MAJ = $$member(QT_VERSION, 0) -QT_VER_MIN = $$member(QT_VERSION, 1) -greaterThan(QT_VER_MAJ, 5) | greaterThan(QT_VER_MIN, 9) QT += serialbus -greaterThan(QT_MAJOR_VERSION, 4):QMAKE_CXXFLAGS += -fpermissive -greaterThan(QT_MAJOR_VERSION, 4):CONFIG += c++11 - -# 启用release下带调试信息,详见`VX5 Release编译发行.md`,如果不需要,可以注释掉,但请在软件绝对稳定时注释 -CONFIG += qt warn_on debug_and_release -QMAKE_CXXFLAGS += -g - -#QMAKE_POST_LINK += ulimit -c unlimited -LIBS += -ldl - -include(qjson/upQJson.pri) - -TEMPLATE = app -#ifdef SPV210 - TARGET = qtUIV6 -#else - TARGET = QtUI -#endif -OBJECTS_DIR +=tmp -MOC_DIR +=tmp -DEPENDPATH += . -INCLUDEPATH += . -CODECFORTR = UTF-8 -#DEFINES+=ENGLISH -DEFINES+=WARNING - -DEFINES+=TEMPMIMA -DEFINES+=COUNTER1_BY_GROUP #分段计米 -#DEFINES+=COUNTER2_BY_GROUP #分段计米2 -DEFINES+=_2DCODE_ #QR二维码 -DEFINES+=PICSCENE -#DEFINES+=__2451WIFI__ -DEFINES+=__CONVERTERWIFI__ -DEFINES+=MODBUS - - -greaterThan(QT_MAJOR_VERSION, 4):DEFINES+=QT_MAJOR_VERSION5 - -linux-g++ { - DEFINES += ARCH_X86 -} - -linux-aarch64-gnu-g++ { - DEFINES += ARCH_AARCH64_GNU - DEFINES += ARCH_AARCH64 -} - -bns-linux-aarch64-gnu-g++ { - DEFINES += ARCH_AARCH64_GNU - DEFINES += ARCH_AARCH64 - DEFINES += BNS_AARCH64_DEBUG -} - -HEADERS += ClickLabel.h \ - DevOp.h \ - DialogAuthorization.h \ - DialogFileOperation.h \ - DialogFontSize.h \ - DialogInsertVari.h \ - DialogLineSpace.h \ - DigitalInput.h \ - InkJetPrinter.h \ - InputMethod.h \ - InsertSpaceNumDialog.h \ - LogInfo.h \ - mainwindow.h \ - MemDisplayAndEdit.h \ - MyFileDialog.h \ - MyInputMethod.h \ - MyTextEdit.h \ - OtherInfo.h \ - ParaSettingUI.h \ - DlgVolteParaNo73.h \ - DlgVoltePara25Dots.h \ - PhaseGraphic.h \ - PicEdit.h \ - PicWidget.h \ - PrintSetting.h \ - PrintTextDisplay.h \ - Public.h \ - PulseNumFix.h \ - SysPara.h \ - SystemManage.h \ - SystemSetting.h \ - TextEditOption.h \ - TimeSettingDialog.h \ - TriggerCtrl.h \ - ZkEdit.h \ - myinclude.h \ - dlgdrawinit.h \ - zkWidget.h \ - qextserialbase.h \ - posix_qextserialport.h \ - dlginputaddr.h \ - dlgshowmsg.h \ - QBarCode.h \ - dlgQrCode.h \ - BarCode/cmdline.h \ - BarCode/barcode.h \ - QtQREnCode/split.h \ - QtQREnCode/rsecc.h \ - QtQREnCode/qrspec.h \ - QtQREnCode/qrinput.h \ - QtQREnCode/qrencode_inner.h \ - QtQREnCode/qrencode.h \ - QtQREnCode/mqrspec.h \ - QtQREnCode/mmask.h \ - QtQREnCode/mask.h \ - QtQREnCode/bitstream.h \ - Matrix/reedsol.h \ - Matrix/zint.h \ - Matrix/common.h \ - Matrix/dm200.h \ - DialogInputTxt.h \ - dlgmutilanguage.h \ - dlgmywarring.h \ - dlgselectinputlanguage.h \ - DialogSaveFile.h \ - dlgvarlength.h \ - VerBVersion.h \ - scene/picscene.h \ - scene/pictextitem.h \ - scene/SceneEditOption.h \ - scene/sceneviewwidget.h \ - Network/NetworkManager.h \ - modbus/modbus/include/mbconfig.h \ - modbus/modbus/include/mbframe.h \ - modbus/modbus/include/mbfunc.h \ - modbus/modbus/include/mbport.h \ - modbus/modbus/include/mbproto.h \ - modbus/modbus/include/mbutils.h \ - modbus/port/port.h \ - Tftp/filetranseceiver.h \ - modbus/modbus/include/mb.h \ - modbus/modbus/rtu/mbcrc.h \ - modbus/modbus/rtu/mbrtu.h \ - dialogmodifypasswd.h \ - logo_form.h \ - modbus/demo.h \ - dialogshowcounter.h \ - dialogcycleprint.h \ - print_net.h \ - scene/myview.h \ - modbus/modbus/tcp/mbtcp.h \ - modbus/modbustcp.h \ - moveinput.h \ - Log/dualfilelogger.h \ - Log/filelogger.h \ - Log/logger.h \ - Log/logglobal.h \ - Log/logmessage.h \ - modbus/modbustcp.h \ - modbus/modbus/tcp/mbtcp.h \ - modbus/demo.h \ - scene/formscenedlg.h \ - HtmlDelegate.h \ - Serial/serial.h \ - Dbredis/dbredis.h \ - UpdateFPGA.h \ - rfid/rfidfunction.h \ - rfid/sm3.h \ - rfid/sm4.h \ - dialogmoduleseletion.h \ - rfid/rfidmanager.h \ - protocol/message.h \ - protocol/tcpserver.h \ - protocol/serverthread.h \ - SectionalCounting/sectionalmanager.h \ - SectionalCounting/sectionalwid.h \ - dump.h - - - -FORMS += dialogauthorization.ui \ - dialogfileoperation.ui \ - dialogfontsize.ui \ - dialoginsertvari.ui \ - dialoglinespace.ui \ - dialogpointdistanceadjust.ui \ - inkjetprinter.ui \ - InputMethod.ui \ - insertspacenumdialog.ui \ - loginfo.ui \ - mainwindow.ui \ - memdisplayandedit.ui \ - otherinfo.ui \ - printsetting.ui \ - pulsenumfix.ui \ - systemmanage.ui \ - systemsetting.ui \ - texteditoption.ui \ - timesettingdialog.ui \ - triggerctrl.ui \ - zkedit.ui \ - picedit.ui \ - dlgdrawinit.ui \ - digitalinput.ui \ - dlginputaddr.ui \ - dlgshowmsg.ui \ - QBarCode.ui \ - dlgQrCode.ui \ - DialogInputTxt.ui \ - dlgmutilanguage.ui \ - dlgmywarring.ui \ - dlgselectinputlanguage.ui \ - dialogsavefile.ui \ - dlgvarlength.ui \ - scene/sceneEditOption.ui \ - Network/NetworkManager.ui \ - dialoginputpasswd.ui \ - dialogmodifypasswd.ui \ - logo_form.ui \ - dialogshowcounter.ui \ - dialogcycleprint.ui \ - moveinput.ui \ - scene/formscenedlg.ui \ - dialogmoduleseletion.ui \ - SectionalCounting/sectionalwid.ui -SOURCES += ClickLabel.cpp \ - DevOp.cpp \ - DialogAuthorization.cpp \ - DialogFileOperation.cpp \ - DialogFontSize.cpp \ - DialogInsertVari.cpp \ - DialogLineSpace.cpp \ - DigitalInput.cpp \ - InkJetPrinter.cpp \ - InputMethod.cpp \ - InsertSpaceNumDialog.cpp \ - LogInfo.cpp \ - main.cpp \ - dump.cpp \ - mainwindow.cpp \ - MemDisplayAndEdit.cpp \ - MyFileDialog.cpp \ - MyInputMethod.cpp \ - MyTextEdit.cpp \ - OtherInfo.cpp \ - ParaSettingUI.cpp \ - DlgVolteParaNo73.cpp \ - DlgVoltePara25Dots.cpp \ - PhaseGraphic.cpp \ - PicEdit.cpp \ - PicWidget.cpp \ - PrintSetting.cpp \ - PrintTextDisplay.cpp \ - Public.cpp \ - PulseNumFix.cpp \ - SysPara.cpp \ - SystemManage.cpp \ - SystemSetting.cpp \ - TextEditOption.cpp \ - TimeSettingDialog.cpp \ - TriggerCtrl.cpp \ - ZkEdit.cpp \ - dlgdrawinit.cpp \ - zkWidget.cpp \ - qextserialbase.cpp \ - posix_qextserialport.cpp \ - dlginputaddr.cpp \ - dlgshowmsg.cpp \ - QBarCode.cpp \ - dlgQrCode.cpp \ - BarCode/ps.c \ - BarCode/plessey.c \ - BarCode/pcl.c \ - BarCode/msi.c \ - BarCode/library.c \ - BarCode/i25.c \ - BarCode/ean.c \ - BarCode/code128.c \ - BarCode/code93.c \ - BarCode/code39.c \ - BarCode/codabar.c \ - BarCode/cmdline.c \ - QtQREnCode/split.c \ - QtQREnCode/rsecc.c \ - QtQREnCode/qrspec.c \ - QtQREnCode/qrinput.c \ - QtQREnCode/qrencode.c \ - QtQREnCode/mqrspec.c \ - QtQREnCode/mmask.c \ - QtQREnCode/mask.c \ - QtQREnCode/bitstream.c \ - Matrix/common.cpp \ - Matrix/reedsol.cpp \ - Matrix/dm200.cpp \ - Matrix/drawmatrix.cpp \ - DialogInputTxt.cpp \ - dlgmutilanguage.cpp \ - dlgmywarring.cpp \ - dlgselectinputlanguage.cpp \ - DialogSaveFile.cpp \ - dlgvarlength.cpp \ - scene/picscene.cpp \ - scene/pictextitem.cpp \ - scene/SceneEditOption.cpp \ - scene/sceneviewwidget.cpp \ - Network/NetworkManager.cpp \ - modbus/modbus/mb.c \ - modbus/modbus/functions/mbfunccoils.c \ - modbus/modbus/functions/mbfuncdiag.c \ - modbus/modbus/functions/mbfuncdisc.c \ - modbus/modbus/functions/mbfuncholding.c \ - modbus/modbus/functions/mbfuncinput.c \ - modbus/modbus/functions/mbfuncother.c \ - modbus/modbus/functions/mbutils.c \ - modbus/port/portevent.c \ - modbus/port/portother.c \ - Tftp/filetranseceiver.cpp \ - modbus/port/portserial.c \ - modbus/port/porttimer.c \ - modbus/modbus/rtu/mbcrc.c \ - modbus/modbus/rtu/mbrtu.c \ - dialogmodifypasswd.cpp \ - logo_form.cpp \ - dialogshowcounter.cpp \ - dialogcycleprint.cpp \ - print_net.cpp \ - scene/myview.cpp \ - moveinput.cpp \ - Log/dualfilelogger.cpp \ - Log/filelogger.cpp \ - Log/logger.cpp \ - Log/logmessage.cpp \ - modbus/modbustcp.cpp \ - modbus/modbus/tcp/mbtcp.c \ - modbus/port/porttcp.c \ - scene/formscenedlg.cpp \ - HtmlDelegate.cpp \ - Serial/serial.cpp \ - Dbredis/dbredis.cpp \ - UpdateFPGA.cpp \ - rfid/rfidfunction.cpp \ - rfid/sm3.cpp \ - rfid/sm4.cpp \ - dialogmoduleseletion.cpp \ - rfid/rfidmanager.cpp \ - protocol/message.cpp \ - protocol/tcpserver.cpp \ - protocol/serverthread.cpp \ - SectionalCounting/sectionalmanager.cpp \ - SectionalCounting/sectionalwid.cpp - -#RESOURCES +=image.qrc EN/image.qrc -RESOURCES += \ - image.qrc -##ifdef VNLG -#TRANSLATIONS +=./../V0211X86QRVN/chinese.ts ./../V0211X86QRVN/vena.ts ./../V0211X86QRVN/english.ts -TRANSLATIONS += ./vena.ts ./chinese.ts ./turkey.ts ./spanish.ts ./thai.ts ./english.ts ./korean.ts ./farsi.ts -#./../V0211X86QRVN/english.ts -##else -#TRANSLATIONS +=./../V0211X86QR/chinese.ts ./../V0211X86QR/english.ts -##endif - -OTHER_FILES += \ - buge_record.txt - -if(contains(DEFINES,__CONVERTERWIFI__)) -{ - DEFINES += CONFIG_CTRL_IFACE - DEFINES += CONFIG_CTRL_IFACE_UNIX - #SOURCES += ../../src/utils/os_unix.c - SOURCES += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils/os_unix.c - SOURCES += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/common/wpa_ctrl.c - INCLUDEPATH += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src - INCLUDEPATH += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils -} -if(contains(DEFINES,MODBUS)) -{ - INCLUDEPATH += $$PWD/modbus/port - INCLUDEPATH += $$PWD/modbus/modbus/include - INCLUDEPATH += $$PWD/modbus/modbus/rtu - INCLUDEPATH += $$PWD/modbus/modbus/tcp - #HEADERS += modbus/modbustcp.h - #SOURCES += modbus/modbustcp.cpp -} - -if(contains(DEFINES,__2451WIFI__)) -{ - #DEFINES += CONFIG_CTRL_IFACE - #DEFINES += CONFIG_CTRL_IFACE_UNIX - ##SOURCES += ../../src/utils/os_unix.c - #SOURCES += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils/os_unix.c - #SOURCES += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/common/wpa_ctrl.c - #INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src - #INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils -} +###################################################################### +# Automatically generated by qmake (2.01a) ?? 11? 8 22:48:42 2013 +###################################################################### +# -spec /usr/local/Trolltech/QtEmbedded-4.6.3-arm/mkspecs/qws/linux-arm-g++ DEFINES+=ARM DEFINES+=QTV3 DEFINES+=VNLG +# DEFINES+=VNLG +# DEFINES+=X86TEST DEFINES+=VNLG DEFINES+=UART1 +# GIT +#$ git config --global user.name "niexiong" +#$ git config --global user.email "nx@runoob.com" +# git clone git@119.23.201.56:/home/git/QtUI.git +# git pull +# git commit -am "提交说明" +# git push +# git add +# git add -f xxx.cpp #强制提交文件 +# git rm +# +# + +QT += core gui network serialport virtualkeyboard sql +QT += xml + +#//edit@02-07 +#LIBS += -L/usr/local/openssl-1.0.2 -lssl -lcrypto + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT_VERSION = $$[QT_VERSION] +QT_VERSION = $$split(QT_VERSION, ".") +QT_VER_MAJ = $$member(QT_VERSION, 0) +QT_VER_MIN = $$member(QT_VERSION, 1) +greaterThan(QT_VER_MAJ, 5) | greaterThan(QT_VER_MIN, 9) QT += serialbus +greaterThan(QT_MAJOR_VERSION, 4):QMAKE_CXXFLAGS += -fpermissive +greaterThan(QT_MAJOR_VERSION, 4):CONFIG += c++11 + +# 启用release下带调试信息,详见`VX5 Release编译发行.md`,如果不需要,可以注释掉,但请在软件绝对稳定时注释 +CONFIG += qt warn_on debug_and_release +QMAKE_CXXFLAGS += -g + +#QMAKE_POST_LINK += ulimit -c unlimited +LIBS += -ldl + +include(qjson/upQJson.pri) + +TEMPLATE = app +#ifdef SPV210 + TARGET = qtUIV6 +#else + TARGET = QtUI +#endif +OBJECTS_DIR +=tmp +MOC_DIR +=tmp +DEPENDPATH += . +INCLUDEPATH += . +CODECFORTR = UTF-8 +#DEFINES+=ENGLISH +DEFINES+=WARNING + +DEFINES+=TEMPMIMA +DEFINES+=COUNTER1_BY_GROUP #分段计米 +#DEFINES+=COUNTER2_BY_GROUP #分段计米2 +DEFINES+=_2DCODE_ #QR二维码 +DEFINES+=PICSCENE +#DEFINES+=__2451WIFI__ +DEFINES+=__CONVERTERWIFI__ +DEFINES+=MODBUS + + +greaterThan(QT_MAJOR_VERSION, 4):DEFINES+=QT_MAJOR_VERSION5 + +linux-g++ { + DEFINES += ARCH_X86 +} + +linux-aarch64-gnu-g++ { + DEFINES += ARCH_AARCH64_GNU + DEFINES += ARCH_AARCH64 +} + +bns-linux-aarch64-gnu-g++ { + DEFINES += ARCH_AARCH64_GNU + DEFINES += ARCH_AARCH64 + DEFINES += BNS_AARCH64_DEBUG +} + +HEADERS += ClickLabel.h \ + DevOp.h \ + DialogAuthorization.h \ + DialogFileOperation.h \ + DialogFontSize.h \ + DialogInsertVari.h \ + DialogLineSpace.h \ + DigitalInput.h \ + InkJetPrinter.h \ + InputMethod.h \ + InsertSpaceNumDialog.h \ + LogInfo.h \ + mainwindow.h \ + MemDisplayAndEdit.h \ + MyFileDialog.h \ + MyInputMethod.h \ + MyTextEdit.h \ + OtherInfo.h \ + ParaSettingUI.h \ + DlgVolteParaNo73.h \ + DlgVoltePara25Dots.h \ + PhaseGraphic.h \ + PicEdit.h \ + PicWidget.h \ + PrintSetting.h \ + PrintTextDisplay.h \ + Public.h \ + PulseNumFix.h \ + SysPara.h \ + SystemManage.h \ + SystemSetting.h \ + TextEditOption.h \ + TimeSettingDialog.h \ + TriggerCtrl.h \ + ZkEdit.h \ + myinclude.h \ + dlgdrawinit.h \ + zkWidget.h \ + qextserialbase.h \ + posix_qextserialport.h \ + dlginputaddr.h \ + dlgshowmsg.h \ + QBarCode.h \ + dlgQrCode.h \ + BarCode/cmdline.h \ + BarCode/barcode.h \ + QtQREnCode/split.h \ + QtQREnCode/rsecc.h \ + QtQREnCode/qrspec.h \ + QtQREnCode/qrinput.h \ + QtQREnCode/qrencode_inner.h \ + QtQREnCode/qrencode.h \ + QtQREnCode/mqrspec.h \ + QtQREnCode/mmask.h \ + QtQREnCode/mask.h \ + QtQREnCode/bitstream.h \ + Matrix/reedsol.h \ + Matrix/zint.h \ + Matrix/common.h \ + Matrix/dm200.h \ + DialogInputTxt.h \ + dlgmutilanguage.h \ + dlgmywarring.h \ + dlgselectinputlanguage.h \ + DialogSaveFile.h \ + dlgvarlength.h \ + VerBVersion.h \ + scene/picscene.h \ + scene/pictextitem.h \ + scene/SceneEditOption.h \ + scene/sceneviewwidget.h \ + Network/NetworkManager.h \ + modbus/modbus/include/mbconfig.h \ + modbus/modbus/include/mbframe.h \ + modbus/modbus/include/mbfunc.h \ + modbus/modbus/include/mbport.h \ + modbus/modbus/include/mbproto.h \ + modbus/modbus/include/mbutils.h \ + modbus/port/port.h \ + Tftp/filetranseceiver.h \ + modbus/modbus/include/mb.h \ + modbus/modbus/rtu/mbcrc.h \ + modbus/modbus/rtu/mbrtu.h \ + dialogmodifypasswd.h \ + logo_form.h \ + modbus/demo.h \ + dialogshowcounter.h \ + dialogcycleprint.h \ + print_net.h \ + scene/myview.h \ + modbus/modbus/tcp/mbtcp.h \ + modbus/modbustcp.h \ + moveinput.h \ + Log/dualfilelogger.h \ + Log/filelogger.h \ + Log/logger.h \ + Log/logglobal.h \ + Log/logmessage.h \ + modbus/modbustcp.h \ + modbus/modbus/tcp/mbtcp.h \ + modbus/demo.h \ + scene/formscenedlg.h \ + HtmlDelegate.h \ + Serial/serial.h \ + Dbredis/dbredis.h \ + UpdateFPGA.h \ + rfid/rfidfunction.h \ + rfid/sm3.h \ + rfid/sm4.h \ + dialogmoduleseletion.h \ + rfid/rfidmanager.h \ + protocol/message.h \ + protocol/tcpserver.h \ + protocol/serverthread.h \ + SectionalCounting/sectionalmanager.h \ + SectionalCounting/sectionalwid.h \ + dump.h + + + +FORMS += dialogauthorization.ui \ + dialogfileoperation.ui \ + dialogfontsize.ui \ + dialoginsertvari.ui \ + dialoglinespace.ui \ + dialogpointdistanceadjust.ui \ + inkjetprinter.ui \ + InputMethod.ui \ + insertspacenumdialog.ui \ + loginfo.ui \ + mainwindow.ui \ + memdisplayandedit.ui \ + otherinfo.ui \ + printsetting.ui \ + pulsenumfix.ui \ + systemmanage.ui \ + systemsetting.ui \ + texteditoption.ui \ + timesettingdialog.ui \ + triggerctrl.ui \ + zkedit.ui \ + picedit.ui \ + dlgdrawinit.ui \ + digitalinput.ui \ + dlginputaddr.ui \ + dlgshowmsg.ui \ + QBarCode.ui \ + dlgQrCode.ui \ + DialogInputTxt.ui \ + dlgmutilanguage.ui \ + dlgmywarring.ui \ + dlgselectinputlanguage.ui \ + dialogsavefile.ui \ + dlgvarlength.ui \ + scene/sceneEditOption.ui \ + Network/NetworkManager.ui \ + dialoginputpasswd.ui \ + dialogmodifypasswd.ui \ + logo_form.ui \ + dialogshowcounter.ui \ + dialogcycleprint.ui \ + moveinput.ui \ + scene/formscenedlg.ui \ + dialogmoduleseletion.ui \ + SectionalCounting/sectionalwid.ui +SOURCES += ClickLabel.cpp \ + DevOp.cpp \ + DialogAuthorization.cpp \ + DialogFileOperation.cpp \ + DialogFontSize.cpp \ + DialogInsertVari.cpp \ + DialogLineSpace.cpp \ + DigitalInput.cpp \ + InkJetPrinter.cpp \ + InputMethod.cpp \ + InsertSpaceNumDialog.cpp \ + LogInfo.cpp \ + main.cpp \ + dump.cpp \ + mainwindow.cpp \ + MemDisplayAndEdit.cpp \ + MyFileDialog.cpp \ + MyInputMethod.cpp \ + MyTextEdit.cpp \ + OtherInfo.cpp \ + ParaSettingUI.cpp \ + DlgVolteParaNo73.cpp \ + DlgVoltePara25Dots.cpp \ + PhaseGraphic.cpp \ + PicEdit.cpp \ + PicWidget.cpp \ + PrintSetting.cpp \ + PrintTextDisplay.cpp \ + Public.cpp \ + PulseNumFix.cpp \ + SysPara.cpp \ + SystemManage.cpp \ + SystemSetting.cpp \ + TextEditOption.cpp \ + TimeSettingDialog.cpp \ + TriggerCtrl.cpp \ + ZkEdit.cpp \ + dlgdrawinit.cpp \ + zkWidget.cpp \ + qextserialbase.cpp \ + posix_qextserialport.cpp \ + dlginputaddr.cpp \ + dlgshowmsg.cpp \ + QBarCode.cpp \ + dlgQrCode.cpp \ + BarCode/ps.c \ + BarCode/plessey.c \ + BarCode/pcl.c \ + BarCode/msi.c \ + BarCode/library.c \ + BarCode/i25.c \ + BarCode/ean.c \ + BarCode/code128.c \ + BarCode/code93.c \ + BarCode/code39.c \ + BarCode/codabar.c \ + BarCode/cmdline.c \ + QtQREnCode/split.c \ + QtQREnCode/rsecc.c \ + QtQREnCode/qrspec.c \ + QtQREnCode/qrinput.c \ + QtQREnCode/qrencode.c \ + QtQREnCode/mqrspec.c \ + QtQREnCode/mmask.c \ + QtQREnCode/mask.c \ + QtQREnCode/bitstream.c \ + Matrix/common.cpp \ + Matrix/reedsol.cpp \ + Matrix/dm200.cpp \ + Matrix/drawmatrix.cpp \ + DialogInputTxt.cpp \ + dlgmutilanguage.cpp \ + dlgmywarring.cpp \ + dlgselectinputlanguage.cpp \ + DialogSaveFile.cpp \ + dlgvarlength.cpp \ + scene/picscene.cpp \ + scene/pictextitem.cpp \ + scene/SceneEditOption.cpp \ + scene/sceneviewwidget.cpp \ + Network/NetworkManager.cpp \ + modbus/modbus/mb.c \ + modbus/modbus/functions/mbfunccoils.c \ + modbus/modbus/functions/mbfuncdiag.c \ + modbus/modbus/functions/mbfuncdisc.c \ + modbus/modbus/functions/mbfuncholding.c \ + modbus/modbus/functions/mbfuncinput.c \ + modbus/modbus/functions/mbfuncother.c \ + modbus/modbus/functions/mbutils.c \ + modbus/port/portevent.c \ + modbus/port/portother.c \ + Tftp/filetranseceiver.cpp \ + modbus/port/portserial.c \ + modbus/port/porttimer.c \ + modbus/modbus/rtu/mbcrc.c \ + modbus/modbus/rtu/mbrtu.c \ + dialogmodifypasswd.cpp \ + logo_form.cpp \ + dialogshowcounter.cpp \ + dialogcycleprint.cpp \ + print_net.cpp \ + scene/myview.cpp \ + moveinput.cpp \ + Log/dualfilelogger.cpp \ + Log/filelogger.cpp \ + Log/logger.cpp \ + Log/logmessage.cpp \ + modbus/modbustcp.cpp \ + modbus/modbus/tcp/mbtcp.c \ + modbus/port/porttcp.c \ + scene/formscenedlg.cpp \ + HtmlDelegate.cpp \ + Serial/serial.cpp \ + Dbredis/dbredis.cpp \ + UpdateFPGA.cpp \ + rfid/rfidfunction.cpp \ + rfid/sm3.cpp \ + rfid/sm4.cpp \ + dialogmoduleseletion.cpp \ + rfid/rfidmanager.cpp \ + protocol/message.cpp \ + protocol/tcpserver.cpp \ + protocol/serverthread.cpp \ + SectionalCounting/sectionalmanager.cpp \ + SectionalCounting/sectionalwid.cpp + +#RESOURCES +=image.qrc EN/image.qrc +RESOURCES += \ + image.qrc +##ifdef VNLG +#TRANSLATIONS +=./../V0211X86QRVN/chinese.ts ./../V0211X86QRVN/vena.ts ./../V0211X86QRVN/english.ts +TRANSLATIONS += ./vena.ts ./chinese.ts ./turkey.ts ./spanish.ts ./thai.ts ./english.ts ./korean.ts ./farsi.ts +#./../V0211X86QRVN/english.ts +##else +#TRANSLATIONS +=./../V0211X86QR/chinese.ts ./../V0211X86QR/english.ts +##endif + +OTHER_FILES += \ + buge_record.txt + +if(contains(DEFINES,__CONVERTERWIFI__)) +{ + DEFINES += CONFIG_CTRL_IFACE + DEFINES += CONFIG_CTRL_IFACE_UNIX + #SOURCES += ../../src/utils/os_unix.c + SOURCES += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils/os_unix.c + SOURCES += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/common/wpa_ctrl.c + INCLUDEPATH += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src + INCLUDEPATH += /third_part/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils +} +if(contains(DEFINES,MODBUS)) +{ + INCLUDEPATH += $$PWD/modbus/port + INCLUDEPATH += $$PWD/modbus/modbus/include + INCLUDEPATH += $$PWD/modbus/modbus/rtu + INCLUDEPATH += $$PWD/modbus/modbus/tcp + #HEADERS += modbus/modbustcp.h + #SOURCES += modbus/modbustcp.cpp +} + +if(contains(DEFINES,__2451WIFI__)) +{ + #DEFINES += CONFIG_CTRL_IFACE + #DEFINES += CONFIG_CTRL_IFACE_UNIX + ##SOURCES += ../../src/utils/os_unix.c + #SOURCES += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils/os_unix.c + #SOURCES += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/common/wpa_ctrl.c + #INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src + #INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils +} diff --git a/README.md b/README.md index 66caef0..8715514 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# VX5-DiaphragmPump - -vx5隔膜泵版本 - -基于最新的vx5齿轮泵代码,仅修改为隔膜泵算法,并在产线测试后提交 +# VX5-DiaphragmPump + +vx5隔膜泵版本 + +基于最新的vx5齿轮泵代码,仅修改为隔膜泵算法,并在产线测试后提交 20260826 hlp \ No newline at end of file diff --git a/SecondThread/SecondThread.cpp b/SecondThread/SecondThread.cpp index 9b2b594..4b12a23 100644 --- a/SecondThread/SecondThread.cpp +++ b/SecondThread/SecondThread.cpp @@ -1,107 +1,107 @@ -#include -#include -#include "SecondThread.h" -#include "VerBVersion.h" - -SecondThread::SecondThread(QObject* par) : QThread(par) -,m_runCount(20) -{ - pDdlgShowMsg = new DlgShowMsg; - pDdlgShowMsg->hide(); - pTimer10s = new QTimer(); - pTimer10s->setInterval(10000); - //connect(pTimer10s, SIGNAL(timeout()), this, &SecondThread::timeoutSlot); - connect(pTimer10s, SIGNAL(timeout()), this, SLOT(timeoutSlot()),Qt::QueuedConnection); - pUpLicManager = new LicenseManger(); - licState = pUpLicManager->getLicState(); - if(licState) - { - //pDdlgShowMsg->showMsg(tr("license file was invalid,error code:%1").arg(licState)); - emit printerLicErr(licState); - qDebug()<<"asdfsdf"; - } - bLicFileUpdating = false; -} - -SecondThread::~SecondThread() -{ - qDebug() << "SecondThread::~SecondThread()"; -} - -void SecondThread::setSomething() -{ - msleep(500); - QString str = QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId()); - emit message(str); -} - -void SecondThread::getSomething() -{ - msleep(500); - emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); -} - -void SecondThread::setRunCount(int count) -{ - m_runCount = count; - emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); -} - -void SecondThread::timeoutSlot() -{ - QTime curTime=QTime::currentTime(); - qDebug()<CheckRemainingTime(); - if(remaining_time <= 3) - { - licState = -LICENSE_STATE_REMAIN_TIME_REARCH; - emit printerLicErr(licState); - } - } - emit printerLicErr(licState); - } -} -void SecondThread::update_license_file() -{ - pUpLicManager->UpdateLicenseFileData(); - licState = pUpLicManager->getLicState(); -} -void SecondThread::update_license_process() -{ - qint8 updateFileState = pUpLicManager->CheckUpdateFileState(); - if(updateFileState != UPDATE_LICENSE_FILE_OK) - { - //QMessageBox::critical(this,tr("错误"),tr("升级软件错误,错误码:%1").arg(updateState)); - emit update_license_complete(updateFileState); - } - else - { - bLicFileUpdating = true; - update_license_file(); - emit update_license_complete(UPDATE_LICENSE_FILE_OK); - bLicFileUpdating = false; - } -} - -void SecondThread::set_serial_number_process(quint32 serial_number) -{ - qDebug()<<"set_serial_number_process"<setMachineInfo(serial_number); -} -void SecondThread::run() -{ - qDebug()<<"second thread run"; - pTimer10s->start(); - this->exec(); -} - -void SecondThread::doSomething() -{ - msleep(500); - emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); -} +#include +#include +#include "SecondThread.h" +#include "VerBVersion.h" + +SecondThread::SecondThread(QObject* par) : QThread(par) +,m_runCount(20) +{ + pDdlgShowMsg = new DlgShowMsg; + pDdlgShowMsg->hide(); + pTimer10s = new QTimer(); + pTimer10s->setInterval(10000); + //connect(pTimer10s, SIGNAL(timeout()), this, &SecondThread::timeoutSlot); + connect(pTimer10s, SIGNAL(timeout()), this, SLOT(timeoutSlot()),Qt::QueuedConnection); + pUpLicManager = new LicenseManger(); + licState = pUpLicManager->getLicState(); + if(licState) + { + //pDdlgShowMsg->showMsg(tr("license file was invalid,error code:%1").arg(licState)); + emit printerLicErr(licState); + qDebug()<<"asdfsdf"; + } + bLicFileUpdating = false; +} + +SecondThread::~SecondThread() +{ + qDebug() << "SecondThread::~SecondThread()"; +} + +void SecondThread::setSomething() +{ + msleep(500); + QString str = QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId()); + emit message(str); +} + +void SecondThread::getSomething() +{ + msleep(500); + emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); +} + +void SecondThread::setRunCount(int count) +{ + m_runCount = count; + emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); +} + +void SecondThread::timeoutSlot() +{ + QTime curTime=QTime::currentTime(); + qDebug()<CheckRemainingTime(); + if(remaining_time <= 3) + { + licState = -LICENSE_STATE_REMAIN_TIME_REARCH; + emit printerLicErr(licState); + } + } + emit printerLicErr(licState); + } +} +void SecondThread::update_license_file() +{ + pUpLicManager->UpdateLicenseFileData(); + licState = pUpLicManager->getLicState(); +} +void SecondThread::update_license_process() +{ + qint8 updateFileState = pUpLicManager->CheckUpdateFileState(); + if(updateFileState != UPDATE_LICENSE_FILE_OK) + { + //QMessageBox::critical(this,tr("错误"),tr("升级软件错误,错误码:%1").arg(updateState)); + emit update_license_complete(updateFileState); + } + else + { + bLicFileUpdating = true; + update_license_file(); + emit update_license_complete(UPDATE_LICENSE_FILE_OK); + bLicFileUpdating = false; + } +} + +void SecondThread::set_serial_number_process(quint32 serial_number) +{ + qDebug()<<"set_serial_number_process"<setMachineInfo(serial_number); +} +void SecondThread::run() +{ + qDebug()<<"second thread run"; + pTimer10s->start(); + this->exec(); +} + +void SecondThread::doSomething() +{ + msleep(500); + emit message(QString("%1->%2,thread id:%3").arg(__FUNCTION__).arg(__FILE__).arg((int)QThread::currentThreadId())); +} diff --git a/SecondThread/SecondThread.h b/SecondThread/SecondThread.h index 3660230..347d8c0 100644 --- a/SecondThread/SecondThread.h +++ b/SecondThread/SecondThread.h @@ -1,44 +1,44 @@ -#ifndef SECONDTHREADFROMQTHREAD_H -#define SECONDTHREADFROMQTHREAD_H -#include -#include -#include "LicenseManger/LicenseManger.h" -#include "dlgshowmsg.h" - -#include - -class SecondThread : public QThread -{ - Q_OBJECT -signals: - void message(const QString& info); - void progress(int present); - void printerLicErr(qint8); - void update_license_complete(qint8); - -public: - SecondThread(QObject* par); - ~SecondThread(); - void setSomething(); - void getSomething(); - void setRunCount(int count); - void run(); - void doSomething(); - void update_license_file(); -private: - int m_runCount; - QTimer *pTimer10s; - LicenseManger *pUpLicManager; - QDate curDate; - TAesClass *pAes; - qint8 licState; - DlgShowMsg *pDdlgShowMsg; - bool bLicFileUpdating; - -private slots: - void timeoutSlot(); - void update_license_process(); - void set_serial_number_process(quint32); -}; - -#endif // THREADFROMQTHREAD_H +#ifndef SECONDTHREADFROMQTHREAD_H +#define SECONDTHREADFROMQTHREAD_H +#include +#include +#include "LicenseManger/LicenseManger.h" +#include "dlgshowmsg.h" + +#include + +class SecondThread : public QThread +{ + Q_OBJECT +signals: + void message(const QString& info); + void progress(int present); + void printerLicErr(qint8); + void update_license_complete(qint8); + +public: + SecondThread(QObject* par); + ~SecondThread(); + void setSomething(); + void getSomething(); + void setRunCount(int count); + void run(); + void doSomething(); + void update_license_file(); +private: + int m_runCount; + QTimer *pTimer10s; + LicenseManger *pUpLicManager; + QDate curDate; + TAesClass *pAes; + qint8 licState; + DlgShowMsg *pDdlgShowMsg; + bool bLicFileUpdating; + +private slots: + void timeoutSlot(); + void update_license_process(); + void set_serial_number_process(quint32); +}; + +#endif // THREADFROMQTHREAD_H diff --git a/SectionalCounting/sectionalmanager.cpp b/SectionalCounting/sectionalmanager.cpp index 71a0963..11d5340 100644 --- a/SectionalCounting/sectionalmanager.cpp +++ b/SectionalCounting/sectionalmanager.cpp @@ -1,36 +1,36 @@ -#include "sectionalmanager.h" - -SectionalManager *SectionalManager::instance() -{ - static SectionalManager *instance = nullptr; - if(!instance) { - instance = new SectionalManager(); - } - - return instance; -} - -void SectionalManager::emitUpdateCntShow(bool checked) -{ - emit sig_updateCntShow(checked); -} - -void SectionalManager::emitApplySetting() -{ - emit sig_applySetting(); -} - -void SectionalManager::emitLoadUI() -{ - emit sig_loadSettings2UI(); -} - -void SectionalManager::emitCancelSection() -{ - emit sig_cancelSection(); -} - -SectionalManager::SectionalManager() -{ - -} +#include "sectionalmanager.h" + +SectionalManager *SectionalManager::instance() +{ + static SectionalManager *instance = nullptr; + if(!instance) { + instance = new SectionalManager(); + } + + return instance; +} + +void SectionalManager::emitUpdateCntShow(bool checked) +{ + emit sig_updateCntShow(checked); +} + +void SectionalManager::emitApplySetting() +{ + emit sig_applySetting(); +} + +void SectionalManager::emitLoadUI() +{ + emit sig_loadSettings2UI(); +} + +void SectionalManager::emitCancelSection() +{ + emit sig_cancelSection(); +} + +SectionalManager::SectionalManager() +{ + +} diff --git a/SectionalCounting/sectionalmanager.h b/SectionalCounting/sectionalmanager.h index 82c8606..5508d99 100644 --- a/SectionalCounting/sectionalmanager.h +++ b/SectionalCounting/sectionalmanager.h @@ -1,41 +1,41 @@ -#ifndef SECTIONALMANAGER_H -#define SECTIONALMANAGER_H - -#include -#include - -/** - 迁移vx4桂林国际分段计米功能 -**/ - -class SectionalManager : public QObject -{ - Q_OBJECT - -public: - static SectionalManager* instance(); - virtual ~SectionalManager() = default; - - // 更新计数器的可用 - void emitUpdateCntShow(bool); - - //应用配置1 - void emitApplySetting(); - - //应用配置 - void emitLoadUI(); - - // 取消分段计米 - void emitCancelSection(); -private: - SectionalManager(); - -signals: - void sig_updateCntShow(bool); - void sig_applySetting(); - void sig_loadSettings2UI(); - void sig_updateCntGroupDisp(bool); - void sig_cancelSection(); -}; - -#endif // SECTIONALMANAGER_H +#ifndef SECTIONALMANAGER_H +#define SECTIONALMANAGER_H + +#include +#include + +/** + 迁移vx4桂林国际分段计米功能 +**/ + +class SectionalManager : public QObject +{ + Q_OBJECT + +public: + static SectionalManager* instance(); + virtual ~SectionalManager() = default; + + // 更新计数器的可用 + void emitUpdateCntShow(bool); + + //应用配置1 + void emitApplySetting(); + + //应用配置 + void emitLoadUI(); + + // 取消分段计米 + void emitCancelSection(); +private: + SectionalManager(); + +signals: + void sig_updateCntShow(bool); + void sig_applySetting(); + void sig_loadSettings2UI(); + void sig_updateCntGroupDisp(bool); + void sig_cancelSection(); +}; + +#endif // SECTIONALMANAGER_H diff --git a/SectionalCounting/sectionalwid.h b/SectionalCounting/sectionalwid.h index 2d6c602..1c89046 100644 --- a/SectionalCounting/sectionalwid.h +++ b/SectionalCounting/sectionalwid.h @@ -1,94 +1,94 @@ -#ifndef SECTIONALWID_H -#define SECTIONALWID_H - -#include -#include -#include "SysPara.h" -#include "sectionalmanager.h" - -/** - 迁移vx4桂林国际分段计米功能 -**/ - -#define MAX_CNT1_GROUPS_NUM 50 - -namespace Ui { -class SectionalWid; -} - -class SectionalWid : public QWidget -{ - Q_OBJECT - -public: - explicit SectionalWid(QWidget *parent = 0); - ~SectionalWid(); - - void bindSysPara(SysPara* sysPara); - -private slots: -#ifdef COUNTER1_BY_GROUP /* 分段计米 */ - void on_Cnt3AddRowBtn_clicked(); - - void on_Cnt3InsertRowBtn_clicked(); - - void on_cnt3RemoveAllRowsBtn_clicked(); - - void on_Cnt3RemoveRowBtn_clicked(); - - void on_cnt3RemoveAllRowsBtn_3_clicked(); - - void on_checkBoxGroupCnt1_clicked(bool checked); -#endif - void on_pushButtonUpRow_clicked(); - - void on_pushButtonDownRow_clicked(); - -#ifdef COUNTER2_BY_GROUP /* 分段计米 */ - void on_Cnt3AddRowBtn_2_clicked(); - - void on_Cnt3InsertRowBtn_2_clicked(); - - void on_cnt3RemoveAllRowsBtn_2_clicked(); - - void on_Cnt3RemoveRowBtn_2_clicked(); - - void on_cnt3RemoveAllRowsBtn_4_clicked(); - - void on_checkBoxGroupCnt_2_clicked(bool checked); -#endif - void on_pushButtonUpRow_2_clicked(); - - void on_pushButtonDownRow_2_clicked(); - - void slt_applySetting(); - void slt_loadSettings2UI(); - void slt_updateCntGroupDisp(bool bChangeToNext); - void slt_cancelSection(); -private: - Ui::SectionalWid *ui; - SysPara* sysPara = nullptr; - void initUI(); - -#ifdef COUNTER1_BY_GROUP /* 分段计米 */ - void rowWidgetCreate(int rowIndex); - void LoadCnt1GroupSettingsToUI(); - void updateCnt1GroupsTblWgt(); - void ApplyCnt1GroupSetting(); -#endif - -#ifdef COUNTER2_BY_GROUP /* 分段计米 */ - void rowWidgetCreate2(int rowIndex); - void LoadCnt2GroupSettingsToUI(); - void updateCnt2GroupsTblWgt(); - void ApplyCnt2GroupSetting(); -#endif - - /** - type:选表格 - **/ - void moveRow(int currentRow, int toRow, QTableWidget* table); - -}; - -#endif // SECTIONALWID_H +#ifndef SECTIONALWID_H +#define SECTIONALWID_H + +#include +#include +#include "SysPara.h" +#include "sectionalmanager.h" + +/** + 迁移vx4桂林国际分段计米功能 +**/ + +#define MAX_CNT1_GROUPS_NUM 50 + +namespace Ui { +class SectionalWid; +} + +class SectionalWid : public QWidget +{ + Q_OBJECT + +public: + explicit SectionalWid(QWidget *parent = 0); + ~SectionalWid(); + + void bindSysPara(SysPara* sysPara); + +private slots: +#ifdef COUNTER1_BY_GROUP /* 分段计米 */ + void on_Cnt3AddRowBtn_clicked(); + + void on_Cnt3InsertRowBtn_clicked(); + + void on_cnt3RemoveAllRowsBtn_clicked(); + + void on_Cnt3RemoveRowBtn_clicked(); + + void on_cnt3RemoveAllRowsBtn_3_clicked(); + + void on_checkBoxGroupCnt1_clicked(bool checked); +#endif + void on_pushButtonUpRow_clicked(); + + void on_pushButtonDownRow_clicked(); + +#ifdef COUNTER2_BY_GROUP /* 分段计米 */ + void on_Cnt3AddRowBtn_2_clicked(); + + void on_Cnt3InsertRowBtn_2_clicked(); + + void on_cnt3RemoveAllRowsBtn_2_clicked(); + + void on_Cnt3RemoveRowBtn_2_clicked(); + + void on_cnt3RemoveAllRowsBtn_4_clicked(); + + void on_checkBoxGroupCnt_2_clicked(bool checked); +#endif + void on_pushButtonUpRow_2_clicked(); + + void on_pushButtonDownRow_2_clicked(); + + void slt_applySetting(); + void slt_loadSettings2UI(); + void slt_updateCntGroupDisp(bool bChangeToNext); + void slt_cancelSection(); +private: + Ui::SectionalWid *ui; + SysPara* sysPara = nullptr; + void initUI(); + +#ifdef COUNTER1_BY_GROUP /* 分段计米 */ + void rowWidgetCreate(int rowIndex); + void LoadCnt1GroupSettingsToUI(); + void updateCnt1GroupsTblWgt(); + void ApplyCnt1GroupSetting(); +#endif + +#ifdef COUNTER2_BY_GROUP /* 分段计米 */ + void rowWidgetCreate2(int rowIndex); + void LoadCnt2GroupSettingsToUI(); + void updateCnt2GroupsTblWgt(); + void ApplyCnt2GroupSetting(); +#endif + + /** + type:选表格 + **/ + void moveRow(int currentRow, int toRow, QTableWidget* table); + +}; + +#endif // SECTIONALWID_H diff --git a/SectionalCounting/sectionalwid.ui b/SectionalCounting/sectionalwid.ui index 2937ccf..1273959 100644 --- a/SectionalCounting/sectionalwid.ui +++ b/SectionalCounting/sectionalwid.ui @@ -1,245 +1,245 @@ - - - SectionalWid - - - - 0 - 0 - 778 - 428 - - - - Form - - - - - 0 - 0 - 771 - 211 - - - - - - - - - 分段计米1 - - - - - - - 删 除 - - - - - - - 上移 - - - - - - - 下移 - - - - - - - - 0 - 0 - - - - 添 加 - - - - - - - 全部删除 - - - - - - - 插 入 - - - - - - - true - - - 0 - - - 4 - - - false - - - 80 - - - true - - - 18 - - - true - - - 30 - - - - - - - - - - - - 0 - 28 - - - - 清零循环 - - - - - - - - - - - 分段计米2 - - - - - - - 删 除 - - - - - - - 上移 - - - - - - - 下移 - - - - - - - - 0 - 0 - - - - 添 加 - - - - - - - 全部删除 - - - - - - - 插 入 - - - - - - - true - - - 0 - - - 4 - - - false - - - 80 - - - true - - - 18 - - - true - - - 30 - - - - - - - - - - - - 0 - 28 - - - - 清零循环 - - - - - - - - - - - + + + SectionalWid + + + + 0 + 0 + 778 + 428 + + + + Form + + + + + 0 + 0 + 771 + 211 + + + + + + + + + 分段计米1 + + + + + + + 删 除 + + + + + + + 上移 + + + + + + + 下移 + + + + + + + + 0 + 0 + + + + 添 加 + + + + + + + 全部删除 + + + + + + + 插 入 + + + + + + + true + + + 0 + + + 4 + + + false + + + 80 + + + true + + + 18 + + + true + + + 30 + + + + + + + + + + + + 0 + 28 + + + + 清零循环 + + + + + + + + + + + 分段计米2 + + + + + + + 删 除 + + + + + + + 上移 + + + + + + + 下移 + + + + + + + + 0 + 0 + + + + 添 加 + + + + + + + 全部删除 + + + + + + + 插 入 + + + + + + + true + + + 0 + + + 4 + + + false + + + 80 + + + true + + + 18 + + + true + + + 30 + + + + + + + + + + + + 0 + 28 + + + + 清零循环 + + + + + + + + + + + diff --git a/Serial/serial.cpp b/Serial/serial.cpp index bd1c3c9..b475dc2 100644 --- a/Serial/serial.cpp +++ b/Serial/serial.cpp @@ -1,1017 +1,1017 @@ -#include "serial.h" -#include -#include -#include -#include -#include -#include "DevOp.h" -#include -#include -#include - -#define MAX_LEN1 1024 -#define MAX_LEN2 224 - -Serial::Serial(const QString comport) -{ - com = comport; - queue.clear(); - flagOfReadFinished = true; - timerRead = new QTimer(this); - connect(timerRead,SIGNAL(timeout()),this,SLOT(readTimeOut())); - - STM32ReadCnt = 0; - STM32WriteCnt = 0; - FPGAReadCnt = 0; - FPGAWriteCnt = 0; - RecFlag=true; - isCommunication = true; - STM32CRCErrorCNt = 0; - FPGACRCErrorCNt = 0; - flagOfUpgradeSTM32 = 0; -} - -Serial::~Serial(){ - if (serial) serial->close(); - -} - -int baudRateValue = 0; -void Serial::initSerialPort(const QString comport){ - // 设置串口名称 - if(com == "/dev/ttyAS5") - updateSet(); - - qDebug()<<"init comport: "<setPortName(comport); // Windows 下的串口名称 - baudRateValue = 115200; - switch(baudRateValue){ - case 115200:waitTime = 10;break; - case 256000:waitTime = 3;break; - case 1500000:waitTime = 2;break; - } - serial->setBaudRate(baudRateValue); - if(comport == "/dev/ttyAS5") - serial->setBaudRate(1500000); - serial->setDataBits(QSerialPort::Data8); - serial->setParity(QSerialPort::NoParity); - if(comport == "/dev/ttyAS2") //硬件上VX5的第二版(FPGA芯片BGA封装),STM32使用UART1跟ARM通信,STM32的串口参数使用奇校验 - serial->setParity(QSerialPort::EvenParity); - serial->setStopBits(QSerialPort::OneStop); - serial->setFlowControl(QSerialPort::NoFlowControl); - if (serial->open(QIODevice::ReadWrite)) { - if(comport == "/dev/ttyAS5"){ - qDebug() << "FPGA串口打开成功"; - } - else{ - qDebug() << "STM32串口打开成功"; - emit STM32Connected(true, ""); - } - } else { - if(comport == "/dev/ttyAS5"){ - qDebug() << "FPGA串口打开失败:" << serial->errorString(); - } - else{ - qDebug() << "STM32串口打开失败:" << serial->errorString(); - emit STM32Connected(false, serial->errorString()); - } - } - this->FPGARecDataSavePtr=NULL; - this->FPGARecDataLen=0; - } - else{ - qDebug() << "无效的串口号"; - return; - } -} - - -void Serial::startInitSlot() -{ - if(!serial) - { - serial = new QSerialPort(this); - initSerialPort(com); - connect(serial,&QSerialPort::readyRead,this,&Serial::readData); - qDebug()<<"startInitSlot thread id:"<< QString("0x%1").arg(reinterpret_cast(QThread::currentThreadId()), 0, 16); - } -} - -void Serial::updateSet(){ - int addr,size; - int len=0; - int num=0; - QFile file(":/conf/addrset.txt"); - QString str = ""; - if(file.open(QIODevice::ReadOnly)){ - while(!file.atEnd()){ - QByteArray line = file.readLine(); - - qDebug()< lineList = QString(line).split(','); - addr = lineList.at(0).toInt(0,16); - len =MAX_LEN1; - if(lineList.size() > 1) - size = lineList.at(1).toInt(); - num = size/len; - if(num == 0 || size == len){ - set.insert(addr); - QString hexStr1 = QString::number(addr, 16).toUpper(); - str = str + hexStr1 + ","; - } - else - for(int i=0;i<=num;i++){ - set.insert(addr + i*len); - QString hexStr1 = QString::number(addr + i*len, 16).toUpper(); - str = str + hexStr1 + ","; - } - len=MAX_LEN2; - if(lineList.size() > 1) - size = lineList.at(1).toInt(); - num = size/len; - if(num == 0 || size == len){ - set.insert(addr); - QString hexStr1 = QString::number(addr, 16).toUpper(); - str = str + hexStr1 + ","; - } - else - for(int i=0;i<=num;i++){ - set.insert(addr + i*len); - QString hexStr1 = QString::number(addr + i*len, 16).toUpper(); - str = str + hexStr1 + ","; - } - } - } - if(file.isOpen()) - file.close(); - - qDebug()<<"set size = "<isActive() && !flagOfUpgradeSTM32) - timerRead->start(50); - QByteArray recDat = serial->readAll(); - if(com == "/dev/ttyAS5") - readFPGAData(recDat); - else if(com == "/dev/ttyAS2") - readSTM32Data(recDat); -} - -unsigned char dataFPGA_FE[12] = {0}; -unsigned char dataFPGA_00[78] = {0}; -unsigned char dataFPGA_100[74] = {0}; -unsigned char dataFPGA_180[26] = {0}; -unsigned char dataFPGA_1B4[14] = {0}; -unsigned char dataFPGA_1B8[12] = {0}; - -void Serial::readFPGAData(QByteArray data) { - recData.append(data); - if(recData.length() < curLen+10){ - return; - } - - if(timerRead->isActive()) - timerRead->stop(); - flagOfReadFinished = true; - - QByteArray hexData = recData.mid(2, 3).toHex(' ').toUpper(); - quint16 CRCRec = recData.at(recData.size()-3)<<8 + recData.at(recData.size()-2); - int addr=0; - addr |= static_cast(recData[2]) << 16; - addr |= static_cast(recData[3]) << 8; - addr |= static_cast(recData[4]); - - /***************出队列***************/ - { - QMutexLocker locker(&Mutex); - if(recData[1]==0x01 || !set.contains(addr)){ - if(queue.size() > 0) - queue.dequeue(); - } - } - - if(queue.size() > 0){ - qDebug()<<"send FPGA queue data 0"; - emit sendQueueData(0,0,NULL,0,0); - } - int headCode=recData[0]; - if(headCode != 0xAA){ - qDebug()<<"FPGA接收数据帧头错误:Frameheader"< 0) - queue.dequeue(); - } - return; - } - - if(recData[1] == 0x02 && set.contains(addr) && recData[7] != 0x00){ - qDebug()<<"FPGA写错误"; - recData.clear(); - emit resendFPGAData(2,addr,NULL,1,0); - return; - } - - if(set.contains(addr)){ - if(queueFPGA.size() > 0) - queueFPGA.dequeue(); - } - - if(recData[1]==0x01){ - switch(addr){ - case 0x0000FE: - memcpy(dataFPGA_FE,recData.constData(),12); - handleFPGAVersion(dataFPGA_FE);//FPGA version - break; - case 0x000000: - memcpy(dataFPGA_00,recData.constData(),78); - emit getFPGAStatus(dataFPGA_00); - break; - case 0x100: - memcpy(dataFPGA_100,recData.constData(),74); - emit getFPGAPhaseDetectHighTm(dataFPGA_100); - break; - case 0x180:{ - //dataofFPGACalandarAndDat=reinterpret_cast(recData.data()); - memcpy(dataFPGA_180,recData.constData(),26); - emit getFPGACalandarAndDat(dataFPGA_180); - unsigned int testData=0; - testData = dataFPGA_180[18]; - testData <<=8; - testData += dataFPGA_180[17]; - testData <<=8; - testData += dataFPGA_180[16]; - testData <<=8; - testData += dataFPGA_180[15]; - break; - } - case 0x1B4: - memcpy(dataFPGA_1B4,recData.constData(),14); - emit getFPGACnt3CurrValue(dataFPGA_1B4); - break; - case 0x1B8: - memcpy(dataFPGA_1B8,recData.constData(),12); - emit getFPGAXXXDay(dataFPGA_1B8); - break; - - case READ_BUILD_DAT: { - int fpgaBuildDat = 0; - fpgaBuildDat = recData[7]; - emit FPGABuildDat(fpgaBuildDat); - break; - } - } - } - recData.clear(); // 正常处理完毕,清空缓冲区 -} - - - - - -unsigned char dataSTM32_FF[30]; -unsigned char dataSTM32_07[9]; -unsigned char dataSTM32_FA[10]; -unsigned char dataSTM32_A1[15]; - -void Serial::readSTM32Data(QByteArray data) { - if(flagOfUpgradeSTM32){ - showData(data,12); - if(data.size()>0 && (unsigned char)data[0] == 0x79){ - UpgradeACK = true; - qDebug()<<"UpgradeACK ="<readAll(); - return; - } - - recData.append(data); - if(recData.length() < curLen+7){ - return; - } - if(timerRead->isActive()) - timerRead->stop(); - flagOfReadFinished = true; - - { - QMutexLocker locker(&Mutex); - if(queue.size() > 0){ - queue.dequeue(); - } - } - if(queue.size() > 0){ - qDebug()<<"send STM32 queue data 0"; - emit sendQueueData(0,0,NULL,0,0); - } - - - int addr = recData[2]; - int headCode = recData[0]; - if(headCode != 0xBB){ - recData.clear(); - qDebug()<<"STM32接收数据帧头错误."<= recData.size()) { - qDebug() << "STM32 帧尾索引越界,数据不完整"; - recData.clear(); // 数据不完整,清空缓冲区 - return; - } - if(recData[recData[3]+6] != 0x55){ - qDebug()<<"STM32接收数据帧尾错误."<<"addr:"<stop(); - serial->clear(QSerialPort::Input); - recData.clear(); // 超时时清空接收缓冲区,防止残留数据污染下次接收 - if(com == "/dev/ttyAS5") - qDebug()<<"Read FPGA Serial data Timeout"; - else if(com == "/dev/ttyAS2") - qDebug()<<"Read STM32 Serial data Timeout"; - sendSerialData(0,0,NULL,0,0); -} - -// 每个逻辑写操作以一条记录入队;sendDataToFPGA 内部负责分包,队列只记录逻辑单元 -static constexpr int QUEUE_FPGA_MAX = 50; // queueFPGA 积压上限 -static constexpr int QUEUE_STM32_MAX = 100; // queue 积压上限 - -void Serial::enQueue(int cmd, int addr, unsigned char *data, int len, int type, bool flag){ - const send_Data sendData = {cmd, addr, data, len, type}; - if(flag){ - // 积压保护:FPGA 响应跟不上时丢弃旧条目,防止内存无限增长 - if(queueFPGA.size() > QUEUE_FPGA_MAX){ - qDebug()<<"queueFPGA 积压过多,清空旧数据,当前大小:"< QUEUE_STM32_MAX){ - qDebug()<<"queue 积压过多,清空旧数据,当前大小:"< 0) { - qDebug() << "data 指针为空但 len>0"; - return; - } - QByteArray sendData(30,0x00); - qint64 bytesWritten=0; - quint16 CRCCode=0; - sendData[0]=0xBB; - - if(cmd == 1) - curLen = len; - else - curLen = 1; - - if(cmd == 1){ - sendData[0] = 0xBB; - sendData[1] = 0x01; - sendData[2] = addr; - sendData[3] = len; - CRCCode=calCRC16CodeOut(sendData,4); - sendData[4]=CRCCode>>8; - sendData[5]=CRCCode; - sendData[6]=0x55; - sendData.resize(7); - serial->clear(QSerialPort::Input); - bytesWritten=serial->write(sendData,7); - - serial->flush(); - serial->waitForBytesWritten(waitTime); - if (bytesWritten == -1) { - qDebug() << "STM32写入数据失败。read"; - } else { -// qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据。read"; - flagOfReadFinished = false; - recData.clear(); - STM32WriteCnt++; - } - } - - else if(cmd==2){ - sendData[0] = 0xBB; - sendData[1] = 0x02; - sendData[2] = addr; - sendData[3] = len; - for(int i=0;i>8; - sendData[4+len+1]=CRCCode; - sendData[4+len+2]=0x55; - sendData.resize(len+7); - serial->clear(QSerialPort::Input); - bytesWritten=serial->write(sendData,len+7); - - serial->flush(); - serial->waitForBytesWritten(waitTime); - if (bytesWritten == -1) { - qDebug() << "STM32写入数据失败。"; - } else { - flagOfReadFinished = false; - recData.clear(); - STM32WriteCnt++; - } - } - -} - -void Serial::sendDataToFPGA(int cmd,int addr, unsigned char* data, int len){ - if(!data) return; - - QByteArray sendData(MAX_LEN1+10,0x00); - qint64 bytesWritten=0; - quint16 CRCCode=0; - int num = 0; - - if(cmd == 1) - curLen = len; - else - curLen = 1; - if(cmd == 1){ - sendData[0]= 0xAA; - sendData[1]= 0x01; - sendData[2] = addr>>16; - sendData[3] = addr>>8&0xFF; - sendData[4] = addr&0xFF; - sendData[5] = 0x00; - sendData[6] = len; - CRCCode=calCRC16CodeOut(sendData,7); - sendData[7]=CRCCode>>8; - sendData[8]=CRCCode; - sendData[9]=0x55; - sendData.resize(10); - serial->clear(QSerialPort::Input); - - bytesWritten=serial->write(sendData,len+10); - - serial->flush(); - serial->waitForBytesWritten(2); - if (bytesWritten == -1) { - qDebug() << "fpga写入数据失败。read"; - } else { - flagOfReadFinished = false; - recData.clear(); - FPGAWriteCnt++; - } - } - else{ - int max = 0; - if(cmd == 0xD2) - max = MAX_LEN1; - else - max = MAX_LEN2; - if(len > max){ - num = len/max; - for(int i = 0;i < num; i++){ - sendData.fill(0x00); - sendData[0] = 0xAA; - sendData[1] = cmd; - - sendData[2] = addr>>16; - sendData[3] = addr>>8&0xFF; - sendData[4] = addr&0xFF; - sendData[5] = max>>8; - sendData[6] = max; - for(int j=0;j>8; - sendData[max+7+1]=CRCCode; - sendData[max+7+2]=0x55; - serial->clear(QSerialPort::Input); - - bytesWritten=serial->write(sendData,max+10); - - serial->flush(); - if(cmd == 0xD2) - serial->waitForBytesWritten(12); - else - serial->waitForBytesWritten(2); - - if (bytesWritten == -1) { -// qDebug() << "fpga写入数据失败。"; - } else { - flagOfReadFinished = false; - recData.clear(); - FPGAWriteCnt++; -// qDebug() << "fpga成功发送 " << bytesWritten << " 个字节的数据。"; - } - addr += max; - } - len = len%max; - if(len == 0) return; - } - - bytesWritten=0; - CRCCode = 0; - sendData.fill(0x00); - sendData[0]=0xAA; - sendData[1] = cmd; - - for(int i=0;i>16; - sendData[3] = addr>>8&0xFF; - sendData[4] = addr&0xFF; - sendData[5] = len>>8; - sendData[6] = len; - CRCCode=calCRC16CodeOut(sendData,7+len); - sendData[7+len]=CRCCode>>8; - sendData[7+len+1]=CRCCode; - sendData[7+len+2]=0x55; - sendData.resize(len+10); - serial->clear(QSerialPort::Input); - bytesWritten=serial->write(sendData,len+10); - - if(addr == 0xB170) - qDebug() << "Counter2 sectional group: " << sendData.toHex(' '); - - serial->flush(); - if(cmd == 0xD2) - serial->waitForBytesWritten(12); - else - serial->waitForBytesWritten(2); - if (bytesWritten == -1) { -// qDebug() << "fpga写入数据失败。"; - } else { - flagOfReadFinished = false; - recData.clear(); - FPGAWriteCnt++; -// qDebug() << "fpga成功发送 " << bytesWritten << " 个字节的数据。"; - } - } - -} - -quint16 Serial::calCRC16CodeOut(QByteArray data, int length) -{ - if(length > data.size()) return; - quint16 crc = 0xFFFF; - for (int i = 1; i < length; ++i) { - crc ^= (quint16)data[i] << 8; - for (int j = 0; j < 8; ++j) { - if (crc & 0x8000) { - crc = (crc << 1) ^ 0x1021; - } else { - crc <<= 1; - } - } - } - return crc; -} - -bool Serial::calCRC16CodeIn(QByteArray data){ - if(!data.size()) return; - quint16 crc = 0xFFFF; - quint16 CRC = 0; - int length; - length = data.size() - 3; - if(length > 0){ - for (int i = 1; i < length; ++i) { - crc ^= (quint16)data[i] << 8; - for (int j = 0; j < 8; ++j) { - if (crc & 0x8000) { - crc = (crc << 1) ^ 0x1021; - } else { - crc <<= 1; - } - } - } - } - else{ - qDebug()<<"串口接收数据长度有误"; - return false; - } - CRC = data[data.size() - 3]; - CRC = CRC<<8; - CRC = CRC + data[data.size() - 2]; - if(CRC != crc){ - qDebug()<<"crc Error"; - showData(data,1); - } - return(CRC == crc); -} - -void Serial::showData( QByteArray dat,int type) -{ - int i,len; - QString s=""; - len = dat.length(); - for(i=0;iisOpen(); - else - return 0; -} - - - -void Serial::getReceivedFromFPGAData(QByteArray fromFPGADataArr) -{ - unsigned char* target =NULL; - unsigned char* source=NULL; - int length = 0; - if(fromFPGADataArr[4]==0xfe){ - length = 2; - } - else{ - target = this->FPGARecDataSavePtr; - } - target = this->FPGARecDataSavePtr; - if(fromFPGADataArr.isEmpty()) qDebug()<<"recDataFromFPGA error"; - else source = reinterpret_cast(fromFPGADataArr.data()); - length = this->FPGARecDataLen; - source=source+7; - for(int i=0;iclose(); -} - -void Serial::upgradeSTM32File(QString fileName){ - flagOfUpgradeSTM32 = 1; - system("echo 231 > /sys/class/gpio/export"); - system("echo 232 > /sys/class/gpio/export"); - system("echo out > /sys/class/gpio/gpio231/direction"); - system("echo out > /sys/class/gpio/gpio232/direction"); - system("echo 1 > /sys/class/gpio/gpio231/value"); - system("echo 1 > /sys/class/gpio/gpio232/value"); - QThread::msleep(100); - system("echo 0 > /sys/class/gpio/gpio232/value"); - emit progress(0,1); - UpgradeSTM32(fileName); -} - -void Serial::UpgradeSTM32(QString fileName){ - QString f = "/udisk/" + fileName; - QFile file(f); - if (!file.open(QIODevice::ReadOnly)) return; - QByteArray bin = file.readAll(); - file.close(); - if (!sync()) { emit progress(0,2); qDebug()<<"[ERR] sync failed"; return; } - QThread::msleep(500); - if(!getCMD()) { emit progress(0,2); qDebug()<<"[ERR] get cmd failed"; return; } - QThread::msleep(500); - if (!eraseChip()) { emit progress(0,2); qDebug()<<"[ERR] Erase failed"; return; } - QThread::msleep(500); - if (!writeBin(bin,0x08000000)) { emit progress(0,2); qDebug()<<"[ERR] Write failed"; return; } - QThread::msleep(500); - if (!go()) { emit progress(0,2); qDebug()<<"[ERR] Go fail"; return; } - emit progress(100,0); - qDebug()<<"[INFO] Upgrade success!"; - system("echo 0 > /sys/class/gpio/gpio231/value"); - system("echo 1 > /sys/class/gpio/gpio232/value"); - QThread::msleep(100); - system("echo 0 > /sys/class/gpio/gpio232/value"); -} - -bool Serial::waitForAck(int timeoutMs) { - QElapsedTimer timer; - timer.start(); - - while (timer.elapsed() < timeoutMs) { - if (UpgradeACK) { - UpgradeACK = false; - qDebug() << "ACK succeed"; - return true; - } - - // 处理事件,让 readyRead 有机会被触发 - QCoreApplication::processEvents(QEventLoop::AllEvents, 50); - QThread::msleep(10); - } - - qDebug() << "ACK timeout after" << timeoutMs << "ms"; - return false; -} - -bool Serial::sync(){ - // 1. 发送同步字节 0x7F - QByteArray syncByte; - syncByte.append(0x7F); - sendDataToUART2(syncByte, 1); - return waitForAck(500); -} - -bool Serial::getCMD(){ - return sendCmd(0x00); -} - -bool Serial::sendCmd(uint8_t cmd) { - serial->clear(QSerialPort::AllDirections); - recData.clear(); // 清空类的接收缓冲区 - UpgradeACK = false; - - // 1. 发送命令和补码 - QByteArray sendData; - sendData.append((char)cmd); - sendData.append((char)~cmd); - - qDebug() << "Sending command:" << QString::number(cmd, 16).toUpper() - << "Complement:" << QString::number(~cmd & 0xFF, 16).toUpper(); - - sendDataToUART2(sendData, 2); - - // 2. 等待 ACK - return waitForAck(500); -} - -bool Serial::eraseChip() { - if (!sendCmd(0x43)) { - qDebug() << "Erase command failed"; - return false; - } - QThread::msleep(500); - return sendCmd(0xFF); -} - -bool Serial::writeBin(QByteArray bin, uint32_t addr){ - QByteArray chunk; - - for (int i = 0; i < bin.size(); i += 256) { - // 1. 发送写命令 0x31 - if (!sendCmd(0x31)) { - qDebug() << "Write command failed at offset"; - return false; - } - chunk = bin.mid(i, 256); - // 2. 发送地址和长度 - char header[5]; - header[0] = (addr + i) >> 24; // 地址高位 - header[1] = (addr + i) >> 16; - header[2] = (addr + i) >> 8; - header[3] = (addr + i); - header[4] = checkSumForUpgrade(header,4); - qDebug() << "Writing to address:" << QString::number(addr + i, 16) - << "length:" << chunk.size(); - - serial->write(header, 5); - if (!waitForAck(500)) { - qDebug() << "Address ACK failed"; - return false; - } - QThread::msleep(50); - - // 4. 发送数据 + 校验和 - QByteArray dataWithChecksum = chunk; - dataWithChecksum.prepend((char)(dataWithChecksum.size()-1)); - const unsigned char* constDataPtr = reinterpret_cast(dataWithChecksum.constData()); - dataWithChecksum.append(checkSumForUpgrade(constDataPtr,dataWithChecksum.size()+1)); - - - serial->write(dataWithChecksum); - if (!waitForAck(500)) { - qDebug() << "Data write failed"; - return false; - } - QThread::msleep(50); - emit progress(100 * i / bin.size(), 1); - } - emit progress(100,1); - return true; -} - -unsigned char Serial::checkSumForUpgrade(unsigned char *data,int len){ - int i; - unsigned char cs; - cs = 0; - for ( i=0; i> 24), (char)(addr >> 16), - (char)(addr >> 8), (char)(addr), 0x00}; - uint8_t sum = 0; - for (int i = 0; i < 4; ++i) sum ^= a[i]; - a[4] = sum; - serial->write(a, 5); - return waitForAck(200); -} - -bool Serial::sendDataToUART2(QByteArray data,int len){ - qint64 bytesWritten=0; - serial->clear(QSerialPort::Input); - bytesWritten=serial->write(data,len); - - serial->flush(); - serial->waitForBytesWritten(waitTime); - if (bytesWritten == -1) { - qDebug() << "STM32写入数据失败"; - } else { - qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据"; - showData(data,13); - } - QThread::msleep(100); -} +#include "serial.h" +#include +#include +#include +#include +#include +#include "DevOp.h" +#include +#include +#include + +#define MAX_LEN1 1024 +#define MAX_LEN2 224 + +Serial::Serial(const QString comport) +{ + com = comport; + queue.clear(); + flagOfReadFinished = true; + timerRead = new QTimer(this); + connect(timerRead,SIGNAL(timeout()),this,SLOT(readTimeOut())); + + STM32ReadCnt = 0; + STM32WriteCnt = 0; + FPGAReadCnt = 0; + FPGAWriteCnt = 0; + RecFlag=true; + isCommunication = true; + STM32CRCErrorCNt = 0; + FPGACRCErrorCNt = 0; + flagOfUpgradeSTM32 = 0; +} + +Serial::~Serial(){ + if (serial) serial->close(); + +} + +int baudRateValue = 0; +void Serial::initSerialPort(const QString comport){ + // 设置串口名称 + if(com == "/dev/ttyAS5") + updateSet(); + + qDebug()<<"init comport: "<setPortName(comport); // Windows 下的串口名称 + baudRateValue = 115200; + switch(baudRateValue){ + case 115200:waitTime = 10;break; + case 256000:waitTime = 3;break; + case 1500000:waitTime = 2;break; + } + serial->setBaudRate(baudRateValue); + if(comport == "/dev/ttyAS5") + serial->setBaudRate(1500000); + serial->setDataBits(QSerialPort::Data8); + serial->setParity(QSerialPort::NoParity); + if(comport == "/dev/ttyAS2") //硬件上VX5的第二版(FPGA芯片BGA封装),STM32使用UART1跟ARM通信,STM32的串口参数使用奇校验 + serial->setParity(QSerialPort::EvenParity); + serial->setStopBits(QSerialPort::OneStop); + serial->setFlowControl(QSerialPort::NoFlowControl); + if (serial->open(QIODevice::ReadWrite)) { + if(comport == "/dev/ttyAS5"){ + qDebug() << "FPGA串口打开成功"; + } + else{ + qDebug() << "STM32串口打开成功"; + emit STM32Connected(true, ""); + } + } else { + if(comport == "/dev/ttyAS5"){ + qDebug() << "FPGA串口打开失败:" << serial->errorString(); + } + else{ + qDebug() << "STM32串口打开失败:" << serial->errorString(); + emit STM32Connected(false, serial->errorString()); + } + } + this->FPGARecDataSavePtr=NULL; + this->FPGARecDataLen=0; + } + else{ + qDebug() << "无效的串口号"; + return; + } +} + + +void Serial::startInitSlot() +{ + if(!serial) + { + serial = new QSerialPort(this); + initSerialPort(com); + connect(serial,&QSerialPort::readyRead,this,&Serial::readData); + qDebug()<<"startInitSlot thread id:"<< QString("0x%1").arg(reinterpret_cast(QThread::currentThreadId()), 0, 16); + } +} + +void Serial::updateSet(){ + int addr,size; + int len=0; + int num=0; + QFile file(":/conf/addrset.txt"); + QString str = ""; + if(file.open(QIODevice::ReadOnly)){ + while(!file.atEnd()){ + QByteArray line = file.readLine(); + + qDebug()< lineList = QString(line).split(','); + addr = lineList.at(0).toInt(0,16); + len =MAX_LEN1; + if(lineList.size() > 1) + size = lineList.at(1).toInt(); + num = size/len; + if(num == 0 || size == len){ + set.insert(addr); + QString hexStr1 = QString::number(addr, 16).toUpper(); + str = str + hexStr1 + ","; + } + else + for(int i=0;i<=num;i++){ + set.insert(addr + i*len); + QString hexStr1 = QString::number(addr + i*len, 16).toUpper(); + str = str + hexStr1 + ","; + } + len=MAX_LEN2; + if(lineList.size() > 1) + size = lineList.at(1).toInt(); + num = size/len; + if(num == 0 || size == len){ + set.insert(addr); + QString hexStr1 = QString::number(addr, 16).toUpper(); + str = str + hexStr1 + ","; + } + else + for(int i=0;i<=num;i++){ + set.insert(addr + i*len); + QString hexStr1 = QString::number(addr + i*len, 16).toUpper(); + str = str + hexStr1 + ","; + } + } + } + if(file.isOpen()) + file.close(); + + qDebug()<<"set size = "<isActive() && !flagOfUpgradeSTM32) + timerRead->start(50); + QByteArray recDat = serial->readAll(); + if(com == "/dev/ttyAS5") + readFPGAData(recDat); + else if(com == "/dev/ttyAS2") + readSTM32Data(recDat); +} + +unsigned char dataFPGA_FE[12] = {0}; +unsigned char dataFPGA_00[78] = {0}; +unsigned char dataFPGA_100[74] = {0}; +unsigned char dataFPGA_180[26] = {0}; +unsigned char dataFPGA_1B4[14] = {0}; +unsigned char dataFPGA_1B8[12] = {0}; + +void Serial::readFPGAData(QByteArray data) { + recData.append(data); + if(recData.length() < curLen+10){ + return; + } + + if(timerRead->isActive()) + timerRead->stop(); + flagOfReadFinished = true; + + QByteArray hexData = recData.mid(2, 3).toHex(' ').toUpper(); + quint16 CRCRec = recData.at(recData.size()-3)<<8 + recData.at(recData.size()-2); + int addr=0; + addr |= static_cast(recData[2]) << 16; + addr |= static_cast(recData[3]) << 8; + addr |= static_cast(recData[4]); + + /***************出队列***************/ + { + QMutexLocker locker(&Mutex); + if(recData[1]==0x01 || !set.contains(addr)){ + if(queue.size() > 0) + queue.dequeue(); + } + } + + if(queue.size() > 0){ + qDebug()<<"send FPGA queue data 0"; + emit sendQueueData(0,0,NULL,0,0); + } + int headCode=recData[0]; + if(headCode != 0xAA){ + qDebug()<<"FPGA接收数据帧头错误:Frameheader"< 0) + queue.dequeue(); + } + return; + } + + if(recData[1] == 0x02 && set.contains(addr) && recData[7] != 0x00){ + qDebug()<<"FPGA写错误"; + recData.clear(); + emit resendFPGAData(2,addr,NULL,1,0); + return; + } + + if(set.contains(addr)){ + if(queueFPGA.size() > 0) + queueFPGA.dequeue(); + } + + if(recData[1]==0x01){ + switch(addr){ + case 0x0000FE: + memcpy(dataFPGA_FE,recData.constData(),12); + handleFPGAVersion(dataFPGA_FE);//FPGA version + break; + case 0x000000: + memcpy(dataFPGA_00,recData.constData(),78); + emit getFPGAStatus(dataFPGA_00); + break; + case 0x100: + memcpy(dataFPGA_100,recData.constData(),74); + emit getFPGAPhaseDetectHighTm(dataFPGA_100); + break; + case 0x180:{ + //dataofFPGACalandarAndDat=reinterpret_cast(recData.data()); + memcpy(dataFPGA_180,recData.constData(),26); + emit getFPGACalandarAndDat(dataFPGA_180); + unsigned int testData=0; + testData = dataFPGA_180[18]; + testData <<=8; + testData += dataFPGA_180[17]; + testData <<=8; + testData += dataFPGA_180[16]; + testData <<=8; + testData += dataFPGA_180[15]; + break; + } + case 0x1B4: + memcpy(dataFPGA_1B4,recData.constData(),14); + emit getFPGACnt3CurrValue(dataFPGA_1B4); + break; + case 0x1B8: + memcpy(dataFPGA_1B8,recData.constData(),12); + emit getFPGAXXXDay(dataFPGA_1B8); + break; + + case READ_BUILD_DAT: { + int fpgaBuildDat = 0; + fpgaBuildDat = recData[7]; + emit FPGABuildDat(fpgaBuildDat); + break; + } + } + } + recData.clear(); // 正常处理完毕,清空缓冲区 +} + + + + + +unsigned char dataSTM32_FF[30]; +unsigned char dataSTM32_07[9]; +unsigned char dataSTM32_FA[10]; +unsigned char dataSTM32_A1[15]; + +void Serial::readSTM32Data(QByteArray data) { + if(flagOfUpgradeSTM32){ + showData(data,12); + if(data.size()>0 && (unsigned char)data[0] == 0x79){ + UpgradeACK = true; + qDebug()<<"UpgradeACK ="<readAll(); + return; + } + + recData.append(data); + if(recData.length() < curLen+7){ + return; + } + if(timerRead->isActive()) + timerRead->stop(); + flagOfReadFinished = true; + + { + QMutexLocker locker(&Mutex); + if(queue.size() > 0){ + queue.dequeue(); + } + } + if(queue.size() > 0){ + qDebug()<<"send STM32 queue data 0"; + emit sendQueueData(0,0,NULL,0,0); + } + + + int addr = recData[2]; + int headCode = recData[0]; + if(headCode != 0xBB){ + recData.clear(); + qDebug()<<"STM32接收数据帧头错误."<= recData.size()) { + qDebug() << "STM32 帧尾索引越界,数据不完整"; + recData.clear(); // 数据不完整,清空缓冲区 + return; + } + if(recData[recData[3]+6] != 0x55){ + qDebug()<<"STM32接收数据帧尾错误."<<"addr:"<stop(); + serial->clear(QSerialPort::Input); + recData.clear(); // 超时时清空接收缓冲区,防止残留数据污染下次接收 + if(com == "/dev/ttyAS5") + qDebug()<<"Read FPGA Serial data Timeout"; + else if(com == "/dev/ttyAS2") + qDebug()<<"Read STM32 Serial data Timeout"; + sendSerialData(0,0,NULL,0,0); +} + +// 每个逻辑写操作以一条记录入队;sendDataToFPGA 内部负责分包,队列只记录逻辑单元 +static constexpr int QUEUE_FPGA_MAX = 50; // queueFPGA 积压上限 +static constexpr int QUEUE_STM32_MAX = 100; // queue 积压上限 + +void Serial::enQueue(int cmd, int addr, unsigned char *data, int len, int type, bool flag){ + const send_Data sendData = {cmd, addr, data, len, type}; + if(flag){ + // 积压保护:FPGA 响应跟不上时丢弃旧条目,防止内存无限增长 + if(queueFPGA.size() > QUEUE_FPGA_MAX){ + qDebug()<<"queueFPGA 积压过多,清空旧数据,当前大小:"< QUEUE_STM32_MAX){ + qDebug()<<"queue 积压过多,清空旧数据,当前大小:"< 0) { + qDebug() << "data 指针为空但 len>0"; + return; + } + QByteArray sendData(30,0x00); + qint64 bytesWritten=0; + quint16 CRCCode=0; + sendData[0]=0xBB; + + if(cmd == 1) + curLen = len; + else + curLen = 1; + + if(cmd == 1){ + sendData[0] = 0xBB; + sendData[1] = 0x01; + sendData[2] = addr; + sendData[3] = len; + CRCCode=calCRC16CodeOut(sendData,4); + sendData[4]=CRCCode>>8; + sendData[5]=CRCCode; + sendData[6]=0x55; + sendData.resize(7); + serial->clear(QSerialPort::Input); + bytesWritten=serial->write(sendData,7); + + serial->flush(); + serial->waitForBytesWritten(waitTime); + if (bytesWritten == -1) { + qDebug() << "STM32写入数据失败。read"; + } else { +// qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据。read"; + flagOfReadFinished = false; + recData.clear(); + STM32WriteCnt++; + } + } + + else if(cmd==2){ + sendData[0] = 0xBB; + sendData[1] = 0x02; + sendData[2] = addr; + sendData[3] = len; + for(int i=0;i>8; + sendData[4+len+1]=CRCCode; + sendData[4+len+2]=0x55; + sendData.resize(len+7); + serial->clear(QSerialPort::Input); + bytesWritten=serial->write(sendData,len+7); + + serial->flush(); + serial->waitForBytesWritten(waitTime); + if (bytesWritten == -1) { + qDebug() << "STM32写入数据失败。"; + } else { + flagOfReadFinished = false; + recData.clear(); + STM32WriteCnt++; + } + } + +} + +void Serial::sendDataToFPGA(int cmd,int addr, unsigned char* data, int len){ + if(!data) return; + + QByteArray sendData(MAX_LEN1+10,0x00); + qint64 bytesWritten=0; + quint16 CRCCode=0; + int num = 0; + + if(cmd == 1) + curLen = len; + else + curLen = 1; + if(cmd == 1){ + sendData[0]= 0xAA; + sendData[1]= 0x01; + sendData[2] = addr>>16; + sendData[3] = addr>>8&0xFF; + sendData[4] = addr&0xFF; + sendData[5] = 0x00; + sendData[6] = len; + CRCCode=calCRC16CodeOut(sendData,7); + sendData[7]=CRCCode>>8; + sendData[8]=CRCCode; + sendData[9]=0x55; + sendData.resize(10); + serial->clear(QSerialPort::Input); + + bytesWritten=serial->write(sendData,len+10); + + serial->flush(); + serial->waitForBytesWritten(2); + if (bytesWritten == -1) { + qDebug() << "fpga写入数据失败。read"; + } else { + flagOfReadFinished = false; + recData.clear(); + FPGAWriteCnt++; + } + } + else{ + int max = 0; + if(cmd == 0xD2) + max = MAX_LEN1; + else + max = MAX_LEN2; + if(len > max){ + num = len/max; + for(int i = 0;i < num; i++){ + sendData.fill(0x00); + sendData[0] = 0xAA; + sendData[1] = cmd; + + sendData[2] = addr>>16; + sendData[3] = addr>>8&0xFF; + sendData[4] = addr&0xFF; + sendData[5] = max>>8; + sendData[6] = max; + for(int j=0;j>8; + sendData[max+7+1]=CRCCode; + sendData[max+7+2]=0x55; + serial->clear(QSerialPort::Input); + + bytesWritten=serial->write(sendData,max+10); + + serial->flush(); + if(cmd == 0xD2) + serial->waitForBytesWritten(12); + else + serial->waitForBytesWritten(2); + + if (bytesWritten == -1) { +// qDebug() << "fpga写入数据失败。"; + } else { + flagOfReadFinished = false; + recData.clear(); + FPGAWriteCnt++; +// qDebug() << "fpga成功发送 " << bytesWritten << " 个字节的数据。"; + } + addr += max; + } + len = len%max; + if(len == 0) return; + } + + bytesWritten=0; + CRCCode = 0; + sendData.fill(0x00); + sendData[0]=0xAA; + sendData[1] = cmd; + + for(int i=0;i>16; + sendData[3] = addr>>8&0xFF; + sendData[4] = addr&0xFF; + sendData[5] = len>>8; + sendData[6] = len; + CRCCode=calCRC16CodeOut(sendData,7+len); + sendData[7+len]=CRCCode>>8; + sendData[7+len+1]=CRCCode; + sendData[7+len+2]=0x55; + sendData.resize(len+10); + serial->clear(QSerialPort::Input); + bytesWritten=serial->write(sendData,len+10); + + if(addr == 0xB170) + qDebug() << "Counter2 sectional group: " << sendData.toHex(' '); + + serial->flush(); + if(cmd == 0xD2) + serial->waitForBytesWritten(12); + else + serial->waitForBytesWritten(2); + if (bytesWritten == -1) { +// qDebug() << "fpga写入数据失败。"; + } else { + flagOfReadFinished = false; + recData.clear(); + FPGAWriteCnt++; +// qDebug() << "fpga成功发送 " << bytesWritten << " 个字节的数据。"; + } + } + +} + +quint16 Serial::calCRC16CodeOut(QByteArray data, int length) +{ + if(length > data.size()) return; + quint16 crc = 0xFFFF; + for (int i = 1; i < length; ++i) { + crc ^= (quint16)data[i] << 8; + for (int j = 0; j < 8; ++j) { + if (crc & 0x8000) { + crc = (crc << 1) ^ 0x1021; + } else { + crc <<= 1; + } + } + } + return crc; +} + +bool Serial::calCRC16CodeIn(QByteArray data){ + if(!data.size()) return; + quint16 crc = 0xFFFF; + quint16 CRC = 0; + int length; + length = data.size() - 3; + if(length > 0){ + for (int i = 1; i < length; ++i) { + crc ^= (quint16)data[i] << 8; + for (int j = 0; j < 8; ++j) { + if (crc & 0x8000) { + crc = (crc << 1) ^ 0x1021; + } else { + crc <<= 1; + } + } + } + } + else{ + qDebug()<<"串口接收数据长度有误"; + return false; + } + CRC = data[data.size() - 3]; + CRC = CRC<<8; + CRC = CRC + data[data.size() - 2]; + if(CRC != crc){ + qDebug()<<"crc Error"; + showData(data,1); + } + return(CRC == crc); +} + +void Serial::showData( QByteArray dat,int type) +{ + int i,len; + QString s=""; + len = dat.length(); + for(i=0;iisOpen(); + else + return 0; +} + + + +void Serial::getReceivedFromFPGAData(QByteArray fromFPGADataArr) +{ + unsigned char* target =NULL; + unsigned char* source=NULL; + int length = 0; + if(fromFPGADataArr[4]==0xfe){ + length = 2; + } + else{ + target = this->FPGARecDataSavePtr; + } + target = this->FPGARecDataSavePtr; + if(fromFPGADataArr.isEmpty()) qDebug()<<"recDataFromFPGA error"; + else source = reinterpret_cast(fromFPGADataArr.data()); + length = this->FPGARecDataLen; + source=source+7; + for(int i=0;iclose(); +} + +void Serial::upgradeSTM32File(QString fileName){ + flagOfUpgradeSTM32 = 1; + system("echo 231 > /sys/class/gpio/export"); + system("echo 232 > /sys/class/gpio/export"); + system("echo out > /sys/class/gpio/gpio231/direction"); + system("echo out > /sys/class/gpio/gpio232/direction"); + system("echo 1 > /sys/class/gpio/gpio231/value"); + system("echo 1 > /sys/class/gpio/gpio232/value"); + QThread::msleep(100); + system("echo 0 > /sys/class/gpio/gpio232/value"); + emit progress(0,1); + UpgradeSTM32(fileName); +} + +void Serial::UpgradeSTM32(QString fileName){ + QString f = "/udisk/" + fileName; + QFile file(f); + if (!file.open(QIODevice::ReadOnly)) return; + QByteArray bin = file.readAll(); + file.close(); + if (!sync()) { emit progress(0,2); qDebug()<<"[ERR] sync failed"; return; } + QThread::msleep(500); + if(!getCMD()) { emit progress(0,2); qDebug()<<"[ERR] get cmd failed"; return; } + QThread::msleep(500); + if (!eraseChip()) { emit progress(0,2); qDebug()<<"[ERR] Erase failed"; return; } + QThread::msleep(500); + if (!writeBin(bin,0x08000000)) { emit progress(0,2); qDebug()<<"[ERR] Write failed"; return; } + QThread::msleep(500); + if (!go()) { emit progress(0,2); qDebug()<<"[ERR] Go fail"; return; } + emit progress(100,0); + qDebug()<<"[INFO] Upgrade success!"; + system("echo 0 > /sys/class/gpio/gpio231/value"); + system("echo 1 > /sys/class/gpio/gpio232/value"); + QThread::msleep(100); + system("echo 0 > /sys/class/gpio/gpio232/value"); +} + +bool Serial::waitForAck(int timeoutMs) { + QElapsedTimer timer; + timer.start(); + + while (timer.elapsed() < timeoutMs) { + if (UpgradeACK) { + UpgradeACK = false; + qDebug() << "ACK succeed"; + return true; + } + + // 处理事件,让 readyRead 有机会被触发 + QCoreApplication::processEvents(QEventLoop::AllEvents, 50); + QThread::msleep(10); + } + + qDebug() << "ACK timeout after" << timeoutMs << "ms"; + return false; +} + +bool Serial::sync(){ + // 1. 发送同步字节 0x7F + QByteArray syncByte; + syncByte.append(0x7F); + sendDataToUART2(syncByte, 1); + return waitForAck(500); +} + +bool Serial::getCMD(){ + return sendCmd(0x00); +} + +bool Serial::sendCmd(uint8_t cmd) { + serial->clear(QSerialPort::AllDirections); + recData.clear(); // 清空类的接收缓冲区 + UpgradeACK = false; + + // 1. 发送命令和补码 + QByteArray sendData; + sendData.append((char)cmd); + sendData.append((char)~cmd); + + qDebug() << "Sending command:" << QString::number(cmd, 16).toUpper() + << "Complement:" << QString::number(~cmd & 0xFF, 16).toUpper(); + + sendDataToUART2(sendData, 2); + + // 2. 等待 ACK + return waitForAck(500); +} + +bool Serial::eraseChip() { + if (!sendCmd(0x43)) { + qDebug() << "Erase command failed"; + return false; + } + QThread::msleep(500); + return sendCmd(0xFF); +} + +bool Serial::writeBin(QByteArray bin, uint32_t addr){ + QByteArray chunk; + + for (int i = 0; i < bin.size(); i += 256) { + // 1. 发送写命令 0x31 + if (!sendCmd(0x31)) { + qDebug() << "Write command failed at offset"; + return false; + } + chunk = bin.mid(i, 256); + // 2. 发送地址和长度 + char header[5]; + header[0] = (addr + i) >> 24; // 地址高位 + header[1] = (addr + i) >> 16; + header[2] = (addr + i) >> 8; + header[3] = (addr + i); + header[4] = checkSumForUpgrade(header,4); + qDebug() << "Writing to address:" << QString::number(addr + i, 16) + << "length:" << chunk.size(); + + serial->write(header, 5); + if (!waitForAck(500)) { + qDebug() << "Address ACK failed"; + return false; + } + QThread::msleep(50); + + // 4. 发送数据 + 校验和 + QByteArray dataWithChecksum = chunk; + dataWithChecksum.prepend((char)(dataWithChecksum.size()-1)); + const unsigned char* constDataPtr = reinterpret_cast(dataWithChecksum.constData()); + dataWithChecksum.append(checkSumForUpgrade(constDataPtr,dataWithChecksum.size()+1)); + + + serial->write(dataWithChecksum); + if (!waitForAck(500)) { + qDebug() << "Data write failed"; + return false; + } + QThread::msleep(50); + emit progress(100 * i / bin.size(), 1); + } + emit progress(100,1); + return true; +} + +unsigned char Serial::checkSumForUpgrade(unsigned char *data,int len){ + int i; + unsigned char cs; + cs = 0; + for ( i=0; i> 24), (char)(addr >> 16), + (char)(addr >> 8), (char)(addr), 0x00}; + uint8_t sum = 0; + for (int i = 0; i < 4; ++i) sum ^= a[i]; + a[4] = sum; + serial->write(a, 5); + return waitForAck(200); +} + +bool Serial::sendDataToUART2(QByteArray data,int len){ + qint64 bytesWritten=0; + serial->clear(QSerialPort::Input); + bytesWritten=serial->write(data,len); + + serial->flush(); + serial->waitForBytesWritten(waitTime); + if (bytesWritten == -1) { + qDebug() << "STM32写入数据失败"; + } else { + qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据"; + showData(data,13); + } + QThread::msleep(100); +} diff --git a/Serial/serial.h b/Serial/serial.h index 37345ed..dcabf41 100644 --- a/Serial/serial.h +++ b/Serial/serial.h @@ -1,136 +1,136 @@ -#ifndef SERIAL_H -#define SERIAL_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef struct{ - int cmd; - int addr; - unsigned char* data; - int len; - int type; -}send_Data; - -class Serial : public QObject -{ - Q_OBJECT -public: - explicit Serial(QObject *parent = nullptr); - Serial(const QString); - ~Serial(); - - QString com; - QSerialPort *serial = nullptr; - QByteArray recDataFromFPGA; - QByteArray recDataFromSTM32; - unsigned char *STM32RecDataSavePtr; - int STM32RecDataLen; - unsigned char *FPGARecDataSavePtr; - int FPGARecDataLen; - QSet set; - - QQueue queue; - QQueue queueFPGA; - int curLen; - bool flagOfReadFinished; - bool isCommunication; - int STM32ReadCnt; - int STM32WriteCnt; - int FPGAReadCnt; - int FPGAWriteCnt; - bool RecFlag; - int waitTime; - bool flagOfUpgradeSTM32; - bool UpgradeACK; - - QByteArray recData; - QTimer *timerSend; - QTimer *timerRead; - bool flagOfsendEmit; - void enQueue(int cmd,int addr, unsigned char* data, int len,int type,bool flag); - void getDataFromQueue(int &cmd,int &addr,unsigned char*& data,int &len,int &type,bool flag); - - - void initSerialPort(const QString); - quint16 calCRC16CodeOut(QByteArray data, int length); - bool calCRC16CodeIn(QByteArray data); - void showData( QByteArray dat,int type); - bool getSerialStatus(int); - - void getReceivedFromFPGAData(QByteArray); - - void readFPGAData(QByteArray); - void readSTM32Data(QByteArray); - void updateSet(); - void close(); - -public slots: - void readData(); - - void startInitSlot(); - - void sendSerialData(int cmd,int addr, unsigned char* data, int len,int type); - void sendSerialDataFromTimer(); - void readTimeOut(); - void upgradeSTM32File(QString); - -signals: - void receivedFromFPGA(QByteArray); - void receivedFromSTM32(QByteArray); - void getFPGAStatus(unsigned char *); - void getFPGAPhaseDetectHighTm(unsigned char *); - void getFPGAVersion(unsigned int); - void getSTM32Status(unsigned char *); - void getGearPumpVal(unsigned char *); - void getPulseCnt(unsigned char *); - void getFPGACalandarAndDat(unsigned char *); - void getFPGACnt3CurrValue(unsigned char *); - void getFPGAXXXDay(unsigned char *); - void getSTM32Version(unsigned char *); - void getSTM32Time(unsigned char *); - void powerOffReady(); - - void stopSendData(bool); - void queueSizeFPGA(int); - void queueSizeSTM32(int); - void queueFPGASizeSIG(int); - void resendFPGAData(int,int,unsigned char *,int,int); - void sendQueueData(int,int,unsigned char *,int,int); - void progress(int,int); - void FPGABuildDat(int buildTime); - - void STM32Connected(bool ok, QString errorMsg); - -private: - void sendDataToFPGA(int,int,unsigned char*,int); - void sendDataToSTM32(int,int,unsigned char*,int); - void handleFPGAVersion(unsigned char *); -// void handleFPGAStatus(unsigned char *data); - void handleSTM32Status(unsigned char *dataPtr); - void handleGearPumpVal(unsigned char *dataPtr); - void handlePulseCnt(unsigned char *dataPtr); - int STM32CRCErrorCNt; - int FPGACRCErrorCNt; - QMutex Mutex; - - void UpgradeSTM32(QString); - bool sync(); // 发送 0x7F 等待 0x79 - bool getCMD(); - bool eraseChip(); // Extended Erase 全片 - bool writeBin(QByteArray bin, uint32_t addr = 0x08000000); - bool go(uint32_t addr = 0x08000000); - bool sendCmd(uint8_t cmd); - bool waitForAck(int); - unsigned char checkSumForUpgrade(unsigned char *data,int len); - bool sendDataToUART2(QByteArray,int); - -}; - -#endif // SERIAL_H +#ifndef SERIAL_H +#define SERIAL_H +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct{ + int cmd; + int addr; + unsigned char* data; + int len; + int type; +}send_Data; + +class Serial : public QObject +{ + Q_OBJECT +public: + explicit Serial(QObject *parent = nullptr); + Serial(const QString); + ~Serial(); + + QString com; + QSerialPort *serial = nullptr; + QByteArray recDataFromFPGA; + QByteArray recDataFromSTM32; + unsigned char *STM32RecDataSavePtr; + int STM32RecDataLen; + unsigned char *FPGARecDataSavePtr; + int FPGARecDataLen; + QSet set; + + QQueue queue; + QQueue queueFPGA; + int curLen; + bool flagOfReadFinished; + bool isCommunication; + int STM32ReadCnt; + int STM32WriteCnt; + int FPGAReadCnt; + int FPGAWriteCnt; + bool RecFlag; + int waitTime; + bool flagOfUpgradeSTM32; + bool UpgradeACK; + + QByteArray recData; + QTimer *timerSend; + QTimer *timerRead; + bool flagOfsendEmit; + void enQueue(int cmd,int addr, unsigned char* data, int len,int type,bool flag); + void getDataFromQueue(int &cmd,int &addr,unsigned char*& data,int &len,int &type,bool flag); + + + void initSerialPort(const QString); + quint16 calCRC16CodeOut(QByteArray data, int length); + bool calCRC16CodeIn(QByteArray data); + void showData( QByteArray dat,int type); + bool getSerialStatus(int); + + void getReceivedFromFPGAData(QByteArray); + + void readFPGAData(QByteArray); + void readSTM32Data(QByteArray); + void updateSet(); + void close(); + +public slots: + void readData(); + + void startInitSlot(); + + void sendSerialData(int cmd,int addr, unsigned char* data, int len,int type); + void sendSerialDataFromTimer(); + void readTimeOut(); + void upgradeSTM32File(QString); + +signals: + void receivedFromFPGA(QByteArray); + void receivedFromSTM32(QByteArray); + void getFPGAStatus(unsigned char *); + void getFPGAPhaseDetectHighTm(unsigned char *); + void getFPGAVersion(unsigned int); + void getSTM32Status(unsigned char *); + void getGearPumpVal(unsigned char *); + void getPulseCnt(unsigned char *); + void getFPGACalandarAndDat(unsigned char *); + void getFPGACnt3CurrValue(unsigned char *); + void getFPGAXXXDay(unsigned char *); + void getSTM32Version(unsigned char *); + void getSTM32Time(unsigned char *); + void powerOffReady(); + + void stopSendData(bool); + void queueSizeFPGA(int); + void queueSizeSTM32(int); + void queueFPGASizeSIG(int); + void resendFPGAData(int,int,unsigned char *,int,int); + void sendQueueData(int,int,unsigned char *,int,int); + void progress(int,int); + void FPGABuildDat(int buildTime); + + void STM32Connected(bool ok, QString errorMsg); + +private: + void sendDataToFPGA(int,int,unsigned char*,int); + void sendDataToSTM32(int,int,unsigned char*,int); + void handleFPGAVersion(unsigned char *); +// void handleFPGAStatus(unsigned char *data); + void handleSTM32Status(unsigned char *dataPtr); + void handleGearPumpVal(unsigned char *dataPtr); + void handlePulseCnt(unsigned char *dataPtr); + int STM32CRCErrorCNt; + int FPGACRCErrorCNt; + QMutex Mutex; + + void UpgradeSTM32(QString); + bool sync(); // 发送 0x7F 等待 0x79 + bool getCMD(); + bool eraseChip(); // Extended Erase 全片 + bool writeBin(QByteArray bin, uint32_t addr = 0x08000000); + bool go(uint32_t addr = 0x08000000); + bool sendCmd(uint8_t cmd); + bool waitForAck(int); + unsigned char checkSumForUpgrade(unsigned char *data,int len); + bool sendDataToUART2(QByteArray,int); + +}; + +#endif // SERIAL_H diff --git a/SysPara.cpp b/SysPara.cpp index 9133b64..a76a6a7 100644 --- a/SysPara.cpp +++ b/SysPara.cpp @@ -1,1257 +1,1257 @@ -/* - * SysPara.cpp - * - * Created on: Jun 25, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - * - * 2013-9-29 高压 - */ - - -#include "SysPara.h" -#include -#include -#include -#include -#include -#include -//#include -#include "LogInfo.h" -//#include "DevOp.h" -#include -#include -#include -#include "VerBVersion.h" - -#define VNLG -SysPara::SysPara(void): - devOp(new DevOp(this)){ - - memset(¶,0,sizeof(para)); - memset(&status,0,sizeof(status)); - - para.airPushDurationSec = 4; - - //qDebug("start to loadParaFromFile."); - loadParaFromFile(); - //qDebug("loadParaFromFile ok."); - loadParaToPrintInit(); - //para.HVFaultCloseEn= 0; - - // 邓总指示粘度泵动作间隔固定60秒 byons@2026年5月5日 - para.viscosityPumpInterval = 60; - - if(para.ReadFileErrorCnt<10) para.ReadFileErrorCnt++; - if(para.PowerOnErrorCnt<10) para.PowerOnErrorCnt++; - // PowerOnErrorCnt - //qDebug()<<"cnt ++:"<3 || para.PowerOnErrorCnt>4) { - //loadDefaultPara(); - memset( para.lastOpenedFileName,0,sizeof(para.lastOpenedFileName)); - if(para.ReadFileErrorCnt>=4 ) - para.ReadFileErrorCnt=0; - if(para.PowerOnErrorCnt>=4) - para.PowerOnErrorCnt=0; - //qDebug()<<"sys Star Error, cnt :"<writeFpgaPrintPara(true)会调用这个,所以忽略 - - //para.HVFaultCloseEn= 1; //开机默认为1,允许高压故障自动关闭回收功能 - - // 隔膜泵版本强制开启回收泵模式 - if(PUMP_VER == QString("D")) - para.flagOfReclaimPumEnable = true; - - devOp->writeFpgaPrintPara(true); //系统起来的时候,将上次记录的配置写入fpga,比如晶振分频等信息 - devOp->writeFpgaVariCtrl(); - devOp->resumeFault(); - - status.lastProductCnt = status.productCnt ; //这会让产品计数显示出来 - status.gearPumpRunStopFlag = false; - status.detectBestOscillatorFreqAppending = false; - status.isPumpValveControledByHand = false; //初始化为自动模式 - status.forTemplateUse = false; - status.lastHighVoltageFault = false; - status.needPowerOffTimerout = 0; - status.circleProductCnt = false; - memset(para.reserved2,0,sizeof(para.reserved2)); - status.lastVoltageVersion = -1; - status.flagOfAbnormalStatus = false; -#ifdef __RFID_CARD - if(!loadRFIDPara()){ - memset(&RFIDPara,0,sizeof(RFIDPara)); - saveRFIDPara(); - } -#endif -} - -void SysPara::loadParaFromFile(){ - QFile file(PARA_FILE_PATH); - QFile DeviceCodefile(DeviceCode_FILE_PATH); - QDir dir; - char buf[200]; - //qDebug()<<"loadParaFromFile"; - if(!dir.exists(DOC_ROOT_DIR)){ - snprintf(buf,sizeof(buf),"mkdir -p %s",DOC_ROOT_DIR); - system(buf); - } - if(!dir.exists(PARA_ROOT_DIR)){ - snprintf(buf,sizeof(buf),"mkdir -p %s",PARA_ROOT_DIR); - system(buf); - } - if(!dir.exists(PARA_ROOT_DIR)){ - QMessageBox::warning(0,QString("warnning"),QString("Path") + PARA_ROOT_DIR + QString("not Found.")); - return ; - } - if(file.exists(PARA_FILE_PATH)){ - //qDebug("PARA_FILE_PATH"); - if(!file.open(QIODevice::ReadOnly)){ - //QMessageBox::warning(0,("警告"),QString("无法打开配置文件 ") + PARA_FILE_PATH); - loadDefaultPara(); - } - else { - file.seek(0); - file.read((char *)¶,(long long int)sizeof(para)); - file.close(); - if (DeviceCodefile.isOpen()) { - DeviceCodefile.close(); - } - //jdDataRwLock.lockForRead(); - if(!DeviceCodefile.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - //QMessageBox::warning(0,"警告",QString("无法打开文件") ); - } - else { - DeviceCodefile.seek(0); - //file.read((char *)&jd.addr,(long long int)sizeof(jd)); - DeviceCodefile.read((char *)¶.Json_device_code,(qint64)sizeof(para.Json_device_code)); - DeviceCodefile.close(); - } - } - } - else { -#ifdef VNLG - ; -#else - QMessageBox::information(0,QString("提示"),QString("这可能是你设备第一次上电,或是进行了出厂设置,我们将使用系统默认配置")); -#endif - - loadDefaultPara(); - //loadDefaultPara();//qDebug("loadDefaultPara2"); - } - //qDebug()<<"SYSPrar:"<sizeof(print)) - copy_len = sizeof(print); - else - copy_len = file.size(); - file.seek(0); - file.read((char *)&print,copy_len); - file.close(); - } - else { - file.seek(0); - file.read((char *)&print,(long long int)sizeof(print)); - file.close(); - memcpy( (char *)¶.alterPrint,(char *)&print.alterPrint,sizeof(alterPrint_t)) ; - para.charBold = print.charBold ; - - para.SynCntEn = print.SynCntEn ; - para.autoSynSpeedEn = print.autoSynSpeedEn ; - para.newAmplifyPlate = print.newAmplifyPlate; - para.cnt1CurrValue = print.cnt1CurrValue; // 20170313 cnt1StartValue;20191226 cnt1CurrValue - para.cnt1EndValue = print.cnt1EndValue ; - para.Cnt1NatureValue = print.Cnt1NatureValue ; - - - para.mixValveisNewVersion = 1; - para.cnt1RepeateValue = print.cnt1RepeateValue ; - para.cnt1StartValue = print.cnt1StartValue ; - para.cnt1StepValue = print.cnt1StepValue ; - para.cnt2CurrValue = print.cnt2CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue - para.cnt2EndValue = print.cnt2EndValue ; - para.cnt2RepeateValue = print.cnt2RepeateValue ; - para.cnt2StartValue = print.cnt2StartValue ; - para.cnt2StepValue = print.cnt2StepValue ; - -// para.cnt3CurrValue = print.cnt3CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue -// para.cnt3EndValue = print.cnt3EndValue ; -// para.cnt3RepeateValue = print.cnt3RepeateValue ; -// para.cnt3StartValue = print.cnt3StartValue ; -// para.cnt3StepValue = print.cnt3StepValue ; - - para.cnt4CurrValue = print.cnt4CurrValue; - para.HiddenConditionValue = print.HiddenConditionValue; - para.HiddenFuncEnable = print.HiddenFuncEnable; - para.HiddenMeterEnable = print.HiddenMeterEnable; - - para.currPrintMode = print.currPrintMode ; - para.elecEyeTriggerInterval = print.elecEyeTriggerInterval ; - para.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode ; - para.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay ; - para.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn ; - para.endVoltage = print.endVoltage ; - para.extClearAllCntEnable = print.extClearAllCntEnable ; - para.HighVoltageAmplitude = print.HighVoltageAmplitude ; - para.lastLineEndPointFixedDACValue = print.lastLineEndPointFixedDACValue ; - para.lastLineEndPointFixedValue = print.lastLineEndPointFixedValue ; - para.FullColFixVal = print.FullColFixVal ; - - para.leftRightInverse = print.leftRightInverse ; - para.lineEndAdjustPointCnt = print.lineEndAdjustPointCnt ; - para.lineEndAdjustPointDelay = print.lineEndAdjustPointDelay ; - para.outputPulseDelayMs = print.outputPulseDelayMs ; - para.photoElectricityRepeateNum = print.photoElectricityRepeateNum ; - para.pixNumPerCol = print.pixNumPerCol ; - para.pointVoltageAdjustPos = print.pointVoltageAdjustPos ; - para.PointVoltageAdjustValue = print.PointVoltageAdjustValue ; - para.printColDelay = print.printColDelay ; - para.printDelayMs = print.printDelayMs ; - para.printDirection = print.printDirection ; - para.printRowDelay = print.printRowDelay ; - para.printTotalColNum = print.printTotalColNum ; - para.printTriggerMode = print.printTriggerMode ; //打印触发模式 - para.productCntPerOutputPulse = print.productCntPerOutputPulse ; - para.productNumToGenerateOutputPulse = print.productNumToGenerateOutputPulse ; - para.pulseOutputEnable = print.pulseOutputEnable ; - para.reducedPixelMode = print.reducedPixelMode ; - para.reducedPixelNum = print.reducedPixelNum ; - para.reducedPixelNumRatio = print.reducedPixelNumRatio ; - para.scanInverse = print.scanInverse ; - para.startVoltage = print.startVoltage ; - //print.stepPrint = print.stepPrint ; - memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; - memcpy( (char *)¶.adjVolDacRate,(char *)&print.adjVolDacRate,sizeof(print.adjVolDacRate)) ; -//edit-12.2 - //para.synCharWidthRatio = print.synCharWidthRatio ; - para.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode ; -#if 0 //不需要每个文件都存相位的参数 - para.synPulseNumPerMm = print.synPulseNumPerMm ; - para.synPulsePerMmX8 = print.synPulsePerMmX8 ; -#endif - para.synTriggerPrintLenMm = print.synTriggerPrintLenMm ; //喷印间隔 - //para.synTriggerPrintLenRatio = print.synTriggerPrintLenRatio ; - para.sysTriggerPrintMode = print.sysTriggerPrintMode ; - para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ; - para.timeTriggerPrintMode = print.timeTriggerPrintMode ; - //para.totalSynPulseNum = print.totalSynPulseNum ; - para.upDownInverse = print.upDownInverse ; - - para.varLen = print.varLen; - print.varLen1 = para.varLen1; - para.varLenEn = print.varLenEn?1:0; - para.headLen = print.headLen; - para.endLen = print.endLen; - - para.set_HVData_Flag = 0; - - para.eleMaskTime = print.eleMaskTime; - para.AltMirrorGap = print.AltMirrorGap; - para.textEditLineSpace = print.textEditLineSpace; - //para.weihu = print.wehu; - //qDebug()<<"sysFile3:"<spinBoxHighLowRatio->value(); - para.phaseHighLowRatio = print.phaseHighLowRatio; - para.phaseShift = print.phaseShift; - para.OuputPulseCol = print.OuputPulseCol; -#ifndef FOR_PHASE_ADJUST - print.phase_detect_pulse_num = 7; - para.phaseDetectVol = 40; - print.phaseDetectDelay = 100; -#else - para.phase_detect_pulse_num = print.phase_detect_pulse_num; - if (print.phase_detect_pulse_num<3 || print.phase_detect_pulse_num>10) { - print.phase_detect_pulse_num = 7; - } - - para.phaseDetectVol = print.phaseDetectVol; - if (print.phaseDetectVol < 28 || print.phaseDetectVol > 70) - print.phaseDetectVol = 35; - - para.phaseDetectDelay = print.phaseDetectDelay;//120;// ui->spinBoxPhaseDetectDelay->value(); - if (print.phaseDetectDelay < 70 || print.phaseDetectDelay > 150) - print.phaseDetectDelay = 100; -#endif - para.enableChargeFullTime = 1; -#endif - } - } -} -*/ - - -void SysPara::loadPrintParaFromFile(QString fileName){ - if(fileName=="") return; - fileName = QString( PARA_ROOT_DIR+QFileInfo( fileName).baseName()+".dpn"); - QFile file(fileName); - if(!file.exists(fileName)){ - //file.setFileName(TESTFILECD ); - return; - } - if(!file.open(QIODevice::ReadOnly)){ - //loadDefaultPrintPara(); - } - else { - QMessageBox::StandardButton ret; - qint32 copy_len; - if(file.size() != sizeof(print)){ - - if(file.size()>sizeof(print)) - copy_len = sizeof(print); - else - copy_len = file.size(); - file.seek(0); - file.read((char *)&print,copy_len); - file.close(); - } - else { - file.seek(0); - file.read((char *)&print,(long long int)sizeof(print)); - -// file.seek(0); -// file.read((char *)&printPre,(long long int)sizeof(printPre)); - memcpy( (char *)&printPre,(char *)&print,sizeof(print)) ; - loadParaToPrintInit(); - - file.close(); - memcpy( (char *)¶.alterPrint,(char *)&print.alterPrint,sizeof(alterPrint_t)) ; - para.charBold = print.charBold ; - - para.SynCntEn = print.SynCntEn ; -// para.autoSynSpeedEn = print.autoSynSpeedEn ; -// para.newAmplifyPlate = print.newAmplifyPlate; - para.cnt1CurrValue = print.cnt1CurrValue; // 20170313 cnt1StartValue;20191226 cnt1CurrValue - para.cnt1EndValue = print.cnt1EndValue ; - para.Cnt1NatureValue = print.Cnt1NatureValue ; - - para.mixValveisNewVersion = 1; - para.cnt1RepeateValue = print.cnt1RepeateValue ; - para.cnt1StartValue = print.cnt1StartValue ; - para.cnt1StepValue = print.cnt1StepValue ; - para.cnt2CurrValue = print.cnt2CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue - para.cnt2EndValue = print.cnt2EndValue ; - para.cnt2RepeateValue = print.cnt2RepeateValue ; - para.cnt2StartValue = print.cnt2StartValue ; - para.cnt2StepValue = print.cnt2StepValue ; - - para.cnt4CurrValue = print.cnt4CurrValue; - para.HiddenConditionValue = print.HiddenConditionValue; - para.HiddenFuncEnable = print.HiddenFuncEnable; - para.HiddenMeterEnable = print.HiddenMeterEnable; - - if(print.decimalBits == 0){ - para.printNumPoint == 0 ; - para.rrr_nc == 0; - }else if(print.decimalBits == 1){ - para.printNumPoint == 1; - para.rrr_nc == 0; - }else if(print.decimalBits == 2){ - para.printNumPoint == 0; - para.rrr_nc == 1; - }else if(print.decimalBits == 3){ - para.printNumPoint == 1; - para.rrr_nc == 1; - } - para.currPrintMode = print.currPrintMode ; - para.elecEyeTriggerInterval = print.elecEyeTriggerInterval ; - para.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode ; - para.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay ; - para.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn ; - para.HighVoltageAmplitude = print.HighVoltageAmplitude ; - - para.leftRightInverse = print.leftRightInverse ; - para.outputPulseDelayMs = print.outputPulseDelayMs ; - para.photoElectricityRepeateNum = print.photoElectricityRepeateNum ; - para.printColDelay = print.printColDelay ; - para.printDelayMs = print.printDelayMs ; - para.printTriggerMode = print.printTriggerMode ; //打印触发模式 - para.productCntPerOutputPulse = print.productCntPerOutputPulse ; - para.pulseOutputEnable = print.pulseOutputEnable ; - para.reducedPixelNumRatio = print.reducedPixelNumRatio ; -// para.scanInverse = print.scanInverse ; -// memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; - // 迁移,分段计米-------start - para.scanInverse = print.scanInverse ;para.cnt1ByGroupEnalbe = print.cnt1ByGroupEnalbe; - para.startVoltage = print.startVoltage ;para.cnt2ByGroupEnalbe = print.cnt2ByGroupEnalbe; - //print.stepPrint = print.stepPrint ; - memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; - memcpy( (char *)¶.adjVolDacRate,(char *)&print.adjVolDacRate,sizeof(print.adjVolDacRate)) ; - if(para.cnt1ByGroupEnalbe) - memcpy( (char *)¶.Cnt1ByGroup,(char *)&print.Cnt1ByGroup,sizeof(print.Cnt1ByGroup)) ; - else - memset(¶.Cnt1ByGroup,0,sizeof(para.Cnt1ByGroup)); -#ifdef COUNTER2_BY_GROUP - if(para.cnt2ByGroupEnalbe) - memcpy( (char *)¶.Cnt2ByGroup,(char *)&print.Cnt2ByGroup,sizeof(print.Cnt2ByGroup)) ; - else - memset(¶.Cnt2ByGroup,0,sizeof(para.Cnt2ByGroup)); -#endif - //-------end - para.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode ; - para.synTriggerPrintLenMm = print.synTriggerPrintLenMm ; //喷印间隔 - para.sysTriggerPrintMode = print.sysTriggerPrintMode ; - para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ; - para.timeTriggerPrintMode = print.timeTriggerPrintMode ; - para.upDownInverse = print.upDownInverse ; - - para.varLen = print.varLen; - print.varLen1 = para.varLen1; - para.varLenEn = print.varLenEn?1:0; - para.headLen = print.headLen; - para.endLen = print.endLen; - para.set_HVData_Flag = 0; - para.eleMaskTime = print.eleMaskTime; -// para.AltMirrorGap = print.AltMirrorGap; - para.textEditLineSpace = print.textEditLineSpace; - para.textEditCharSpace = print.textEditCharSpace; - } - } -} - - -void SysPara::loadDefaultPrintPara(){ - loadDefaultPara(); -} -/* -void SysPara::savePrintParaToFile(){ -//qDebug()<<"savePrintParaToFile"; - if(sysFile=="") return; - QString fileName = QString( PARA_ROOT_DIR+QFileInfo( sysFile).baseName()+".dpn"); - //qDebug()<<"savePrintParaToFile1:"<> 12; - if(mode == FAST_PRINT ) - { - volParaFilePath = ":/conf/VoltParaHi.bin"; - } - else if(mode == STANDARD_PRINT) - { - volParaFilePath = PARA_ROOT_DIR"VoltParaStd.bin"; - } - - if(status.build_dat.builTime == 73){ - volParaFilePath = ":/conf/VoltePara_No73.bin"; - status.currVoltageVersion = VersionOf73; - } - else if(type == 6 || type == 8){ - - LogInfo::setRunStatusText("loadVolteParaFromFile: currPrintRow: " + QString::number(status.currPrintRow)); - - if(status.currPrintRow <=21){ - volParaFilePath = ":/conf/VoltDataStd21.bin"; - status.currVoltageVersion = VersionOf72And21R; - } - else if(status.currPrintRow <=25){ - volParaFilePath = ":/conf/VoltDataStd25.bin"; - status.currVoltageVersion = VersionOf72And25R; - qDebug() << "loadVolteParaFromFile: " << volParaFilePath; - } - else if(para.currSelectVolPara == FiveLineFiveDot){ - volParaFilePath = ":/conf/VoltDataStd5Row5Dot.bin"; - status.currVoltageVersion = VersionOf72And5Row5Dot; - if(status.currPrintRow > 32){ - volParaFilePath = ":/conf/VoltDataStd5R5DOf34Dot.bin"; //34dot - status.currVoltageVersion = VersionOf72And5Row5Dot34; - } - } - else if(para.currSelectVolPara == FourLineSevenDot){ - volParaFilePath = ":/conf/VoltDataStd4Row7Dot.bin"; - status.currVoltageVersion = VersionOf72And4Row7Dot; - if(status.currPrintRow > 32){ - volParaFilePath = ":/conf/VoltDataStd4R7DOf34Dot.bin"; //34dot - status.currVoltageVersion = VersionOf72And4Row7Dot34; - } - } - else - { - volParaFilePath = ":/conf/VoltDataStd32.bin"; - status.currVoltageVersion = VersionOf72And32R; - } - - #ifdef ENB_VOLTAGE_ADJUST_NO72 - volParaFilePath = "/home/plg/doc/VoltDataStd25.bin"; - #endif - } - LogInfo::setRunStatusText(QString("volParaFilePath:%1").arg(volParaFilePath)); - QFile file(volParaFilePath); - - QDir dir; - char buf[200]; - if (!dir.exists(DOC_ROOT_DIR)){ - snprintf(buf, sizeof(buf), "mkdir -p %s", DOC_ROOT_DIR); - system(buf); - } - if (!dir.exists(PARA_ROOT_DIR)){ - snprintf(buf, sizeof(buf), "mkdir -p %s", PARA_ROOT_DIR); - system(buf); - } - if (!dir.exists(PARA_ROOT_DIR)){ - QMessageBox::warning(0, QString("warnning"), QString("Path") + PARA_ROOT_DIR + QString("not Found.")); - return; - } - - qDebug() << "loadVolteParaFromFile: " << volParaFilePath; - - if (file.exists(volParaFilePath)){ - if (!file.open(QIODevice::ReadOnly)){ - } - else { - QMessageBox::StandardButton ret = QMessageBox::Ok; - qint32 copy_len; - char *volteStruct = (char *)&voltePara; - size_t sizeofVolteParaStruct = sizeof(voltePara); - if(status.build_dat.builTime == 73){ - volteStruct = (char *)&voltePara_No73; - sizeofVolteParaStruct = sizeof(voltePara_No73); - } - else if(type == 6 || type ==8){ - memset(&voltePara_25Dots,0,sizeof(voltePara_25Dots)); - volteStruct = (char *)&voltePara_25Dots; - sizeofVolteParaStruct = sizeof(voltePara_25Dots); - - LogInfo::setRunStatusText("voltage path: " + volParaFilePath); - - // qDebug() << "loadVolteParaFromFile: " << QVector(std::begin(voltePara_25Dots.matchTotalTableDACArray1), std::end(voltePara_25Dots.matchTotalTableDACArray1)); - - } - if (file.size() != sizeofVolteParaStruct){ -// qDebug()<<"注意,电压文件大小不对!"; -// LogInfo::setRunStatusText(QString("注意,电压文件大小不对!")); -#ifdef VNLG - ; -#else - ret = QMessageBox::warning(NULL, QString("警告"), QString("配置文件大小不一致,按 确定 将采取兼容方式读取配置文件"), - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); - -#endif - if (ret == QMessageBox::Ok){ - copy_len = file.size() < sizeofVolteParaStruct?file.size():sizeofVolteParaStruct; - file.seek(0); - file.read(volteStruct, copy_len); - file.close(); - } - else if (ret == QMessageBox::Cancel){ - file.close(); - } - } - else { - file.seek(0); - file.read(volteStruct, (long long int)sizeofVolteParaStruct); - file.close(); - } - } - } - else{ - qDebug()<<"There is no Volte Para File."; - LogInfo::setRunStatusText(QString("There is no Volte Para File.")); - } -} - -void SysPara::saveRFIDPara() -{ - QFile file(RFID_FILE_PATH); - if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qDebug() << "Error: Could not open file for writing"; - return; - } - QDataStream out(&file); - out.setVersion(QDataStream::Qt_4_6); // Set the version compatible with Qt 4.8.5 - out << RFIDPara.PrintInkDots; - out << RFIDPara.InkEmptyCnt; - out << RFIDPara.SOLVEmptyCnt; - out << RFIDPara.InkRFIDCnt; - out << RFIDPara.SOLVRFIDCnt; - out << RFIDPara.solventNumber; - - file.close(); -} -bool SysPara::loadRFIDPara() -{ - QFile file(RFID_FILE_PATH); - if (!file.open(QIODevice::ReadOnly)) { - qDebug() << "Error: Could not open file for reading"; - return false; - } - - QDataStream in(&file); - in.setVersion(QDataStream::Qt_4_6); // Set the version compatible with Qt 4.8.5 - - in >> RFIDPara.PrintInkDots; - in >> RFIDPara.InkEmptyCnt; - in >> RFIDPara.SOLVEmptyCnt; - in >> RFIDPara.InkRFIDCnt; - in >> RFIDPara.SOLVRFIDCnt; - in >> RFIDPara.solventNumber; - - file.close(); - return true; -} - -void SysPara::comparePrintStruct(){ - - if(print.charBold != printPre.charBold){ - printInit.charBold = print.charBold; - } - if(print.SynCntEn != printPre.SynCntEn){ - printInit.SynCntEn = print.SynCntEn; - } - if(print.cnt1CurrValue != printPre.cnt1CurrValue){ - printInit.cnt1CurrValue = print.cnt1CurrValue; - - } - if(print.cnt1EndValue != printPre.cnt1EndValue){ - printInit.cnt1EndValue = print.cnt1EndValue; - - } - if(print.Cnt1NatureValue != printPre.Cnt1NatureValue){ - printInit.Cnt1NatureValue = print.Cnt1NatureValue; - - } - if(print.charBold != printPre.charBold){ - printInit.charBold = print.charBold; - } - if(print.cnt1RepeateValue != printPre.cnt1RepeateValue){ - printInit.cnt1RepeateValue = printPre.cnt1RepeateValue; - - } - if(print.cnt1StartValue != printPre.cnt1StartValue){ - printInit.cnt1StartValue = print.cnt1StartValue; - - } - if(print.cnt1StepValue != printPre.cnt1StepValue ){ - printInit.cnt1StepValue = print.cnt1StepValue; - - } - if(print.cnt2CurrValue != printPre.cnt2CurrValue){ - printInit.cnt2CurrValue = print.cnt2CurrValue; - } - if(print.cnt2EndValue != printPre.cnt2EndValue){ - printInit.cnt2EndValue = print.cnt2EndValue; - - } - if(print.cnt2RepeateValue != printPre.cnt2RepeateValue){ - printInit.cnt2RepeateValue = print.cnt2RepeateValue; - - } - if(print.cnt2StartValue != printPre.cnt2StartValue){ - printInit.cnt2StartValue = print.cnt2StartValue; - - } - if(print.cnt2StepValue != printPre.cnt2StepValue ){ - printInit.cnt2StepValue = print.cnt2StepValue; - } - - if(print.cnt4CurrValue != printPre.cnt4CurrValue){ - printInit.cnt4CurrValue = print.cnt4CurrValue; - - } - if(print.HiddenConditionValue != printPre.HiddenConditionValue){ - printInit.HiddenConditionValue = print.HiddenConditionValue; - } - if(print.HiddenFuncEnable != printPre.HiddenFuncEnable){ - printInit.HiddenFuncEnable = print.HiddenFuncEnable; - } - if(print.HiddenMeterEnable != printPre.HiddenMeterEnable){ - printInit.HiddenMeterEnable = print.HiddenMeterEnable; - } - - if(print.currPrintMode != printPre.currPrintMode ){ - printInit.currPrintMode = print.currPrintMode; - } - if(print.elecEyeTriggerInterval != printPre.elecEyeTriggerInterval){ - printInit.elecEyeTriggerInterval = print.elecEyeTriggerInterval; - } - if(print.eleEyeClearCntInSynMode != printPre.eleEyeClearCntInSynMode){ - printInit.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode; - } - if(print.eleEyeTriggerPrintDelay != printPre.eleEyeTriggerPrintDelay){ - printInit.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay; - } - if(print.eleEyeTriggerSynPrintEn != printPre.eleEyeTriggerSynPrintEn){ - printInit.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn; - } - - if(print.HighVoltageAmplitude != printPre.HighVoltageAmplitude){ - printInit.HighVoltageAmplitude = print.HighVoltageAmplitude; - } - - if(print.leftRightInverse != printPre.leftRightInverse){ - printInit.leftRightInverse = print.leftRightInverse; - } - - if(print.outputPulseDelayMs != printPre.outputPulseDelayMs){ - printInit.outputPulseDelayMs = print.outputPulseDelayMs; - - } - if(print.photoElectricityRepeateNum != printPre.photoElectricityRepeateNum){ - printInit.photoElectricityRepeateNum = print.photoElectricityRepeateNum; - } - - if(print.printColDelay != printPre.printColDelay){ - printInit.printColDelay = print.printColDelay; - } - if(print.printDelayMs != printPre.printDelayMs){ - printInit.printDelayMs = print.printDelayMs; - } - - if(print.printTriggerMode != printPre.printTriggerMode){ - printInit.printTriggerMode = print.printTriggerMode; - } - if(print.productCntPerOutputPulse != printPre.productCntPerOutputPulse){ - printInit.productCntPerOutputPulse = print.productCntPerOutputPulse; - } - if(print.pulseOutputEnable != printPre.pulseOutputEnable){ - printInit.pulseOutputEnable = print.pulseOutputEnable; - } - - if(print.reducedPixelNumRatio != printPre.reducedPixelNumRatio){ - printInit.reducedPixelNumRatio = print.reducedPixelNumRatio; - } - - if(print.synClearCntInEleEyeMode != printPre.synClearCntInEleEyeMode){ - printInit.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode; - - } - - if(print.synTriggerPrintLenMm != printPre.synTriggerPrintLenMm){ - printInit.synTriggerPrintLenMm = print.synTriggerPrintLenMm; - } - - if(print.sysTriggerPrintMode != printPre.sysTriggerPrintMode){ - printInit.sysTriggerPrintMode = print.sysTriggerPrintMode; - } - if(print.timeTriggerPrintDelayMs != printPre.timeTriggerPrintDelayMs){ - printInit.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs; - } - if(print.timeTriggerPrintMode != printPre.timeTriggerPrintMode){ - printInit.timeTriggerPrintMode = print.timeTriggerPrintMode; - } - - if(print.upDownInverse != printPre.upDownInverse){ - printInit.upDownInverse = print.upDownInverse; - } - if(print.eleMaskTime != printPre.eleMaskTime){ - printInit.eleMaskTime = print.eleMaskTime; - } - if(print.varLen != printPre.varLen){ - printInit.varLen = print.varLen; - } - if(print.varLen1 != printPre.varLen1){ - printInit.varLen1 = print.varLen1; - } - if(print.varLenEn != printPre.varLenEn){ - printInit.varLenEn = print.varLenEn; - } - if(print.headLen != printPre.headLen){ - printInit.headLen = print.headLen; - } - if(print.endLen != printPre.endLen){ - printInit.endLen = print.endLen; - } - if(print.textEditLineSpace != printPre.textEditLineSpace){ - printInit.textEditLineSpace = print.textEditLineSpace; - } - if(print.textEditCharSpace != printPre.textEditCharSpace){ - printInit.textEditCharSpace = print.textEditCharSpace; - - } -} - - +/* + * SysPara.cpp + * + * Created on: Jun 25, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + * + * 2013-9-29 高压 + */ + + +#include "SysPara.h" +#include +#include +#include +#include +#include +#include +//#include +#include "LogInfo.h" +//#include "DevOp.h" +#include +#include +#include +#include "VerBVersion.h" + +#define VNLG +SysPara::SysPara(void): + devOp(new DevOp(this)){ + + memset(¶,0,sizeof(para)); + memset(&status,0,sizeof(status)); + + para.airPushDurationSec = 4; + + //qDebug("start to loadParaFromFile."); + loadParaFromFile(); + //qDebug("loadParaFromFile ok."); + loadParaToPrintInit(); + //para.HVFaultCloseEn= 0; + + // 邓总指示粘度泵动作间隔固定60秒 byons@2026年5月5日 + para.viscosityPumpInterval = 60; + + if(para.ReadFileErrorCnt<10) para.ReadFileErrorCnt++; + if(para.PowerOnErrorCnt<10) para.PowerOnErrorCnt++; + // PowerOnErrorCnt + //qDebug()<<"cnt ++:"<3 || para.PowerOnErrorCnt>4) { + //loadDefaultPara(); + memset( para.lastOpenedFileName,0,sizeof(para.lastOpenedFileName)); + if(para.ReadFileErrorCnt>=4 ) + para.ReadFileErrorCnt=0; + if(para.PowerOnErrorCnt>=4) + para.PowerOnErrorCnt=0; + //qDebug()<<"sys Star Error, cnt :"<writeFpgaPrintPara(true)会调用这个,所以忽略 + + //para.HVFaultCloseEn= 1; //开机默认为1,允许高压故障自动关闭回收功能 + + // 隔膜泵版本强制开启回收泵模式 + if(PUMP_VER == QString("D")) + para.flagOfReclaimPumEnable = true; + + devOp->writeFpgaPrintPara(true); //系统起来的时候,将上次记录的配置写入fpga,比如晶振分频等信息 + devOp->writeFpgaVariCtrl(); + devOp->resumeFault(); + + status.lastProductCnt = status.productCnt ; //这会让产品计数显示出来 + status.gearPumpRunStopFlag = false; + status.detectBestOscillatorFreqAppending = false; + status.isPumpValveControledByHand = false; //初始化为自动模式 + status.forTemplateUse = false; + status.lastHighVoltageFault = false; + status.needPowerOffTimerout = 0; + status.circleProductCnt = false; + memset(para.reserved2,0,sizeof(para.reserved2)); + status.lastVoltageVersion = -1; + status.flagOfAbnormalStatus = false; +#ifdef __RFID_CARD + if(!loadRFIDPara()){ + memset(&RFIDPara,0,sizeof(RFIDPara)); + saveRFIDPara(); + } +#endif +} + +void SysPara::loadParaFromFile(){ + QFile file(PARA_FILE_PATH); + QFile DeviceCodefile(DeviceCode_FILE_PATH); + QDir dir; + char buf[200]; + //qDebug()<<"loadParaFromFile"; + if(!dir.exists(DOC_ROOT_DIR)){ + snprintf(buf,sizeof(buf),"mkdir -p %s",DOC_ROOT_DIR); + system(buf); + } + if(!dir.exists(PARA_ROOT_DIR)){ + snprintf(buf,sizeof(buf),"mkdir -p %s",PARA_ROOT_DIR); + system(buf); + } + if(!dir.exists(PARA_ROOT_DIR)){ + QMessageBox::warning(0,QString("warnning"),QString("Path") + PARA_ROOT_DIR + QString("not Found.")); + return ; + } + if(file.exists(PARA_FILE_PATH)){ + //qDebug("PARA_FILE_PATH"); + if(!file.open(QIODevice::ReadOnly)){ + //QMessageBox::warning(0,("警告"),QString("无法打开配置文件 ") + PARA_FILE_PATH); + loadDefaultPara(); + } + else { + file.seek(0); + file.read((char *)¶,(long long int)sizeof(para)); + file.close(); + if (DeviceCodefile.isOpen()) { + DeviceCodefile.close(); + } + //jdDataRwLock.lockForRead(); + if(!DeviceCodefile.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + //QMessageBox::warning(0,"警告",QString("无法打开文件") ); + } + else { + DeviceCodefile.seek(0); + //file.read((char *)&jd.addr,(long long int)sizeof(jd)); + DeviceCodefile.read((char *)¶.Json_device_code,(qint64)sizeof(para.Json_device_code)); + DeviceCodefile.close(); + } + } + } + else { +#ifdef VNLG + ; +#else + QMessageBox::information(0,QString("提示"),QString("这可能是你设备第一次上电,或是进行了出厂设置,我们将使用系统默认配置")); +#endif + + loadDefaultPara(); + //loadDefaultPara();//qDebug("loadDefaultPara2"); + } + //qDebug()<<"SYSPrar:"<sizeof(print)) + copy_len = sizeof(print); + else + copy_len = file.size(); + file.seek(0); + file.read((char *)&print,copy_len); + file.close(); + } + else { + file.seek(0); + file.read((char *)&print,(long long int)sizeof(print)); + file.close(); + memcpy( (char *)¶.alterPrint,(char *)&print.alterPrint,sizeof(alterPrint_t)) ; + para.charBold = print.charBold ; + + para.SynCntEn = print.SynCntEn ; + para.autoSynSpeedEn = print.autoSynSpeedEn ; + para.newAmplifyPlate = print.newAmplifyPlate; + para.cnt1CurrValue = print.cnt1CurrValue; // 20170313 cnt1StartValue;20191226 cnt1CurrValue + para.cnt1EndValue = print.cnt1EndValue ; + para.Cnt1NatureValue = print.Cnt1NatureValue ; + + + para.mixValveisNewVersion = 1; + para.cnt1RepeateValue = print.cnt1RepeateValue ; + para.cnt1StartValue = print.cnt1StartValue ; + para.cnt1StepValue = print.cnt1StepValue ; + para.cnt2CurrValue = print.cnt2CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue + para.cnt2EndValue = print.cnt2EndValue ; + para.cnt2RepeateValue = print.cnt2RepeateValue ; + para.cnt2StartValue = print.cnt2StartValue ; + para.cnt2StepValue = print.cnt2StepValue ; + +// para.cnt3CurrValue = print.cnt3CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue +// para.cnt3EndValue = print.cnt3EndValue ; +// para.cnt3RepeateValue = print.cnt3RepeateValue ; +// para.cnt3StartValue = print.cnt3StartValue ; +// para.cnt3StepValue = print.cnt3StepValue ; + + para.cnt4CurrValue = print.cnt4CurrValue; + para.HiddenConditionValue = print.HiddenConditionValue; + para.HiddenFuncEnable = print.HiddenFuncEnable; + para.HiddenMeterEnable = print.HiddenMeterEnable; + + para.currPrintMode = print.currPrintMode ; + para.elecEyeTriggerInterval = print.elecEyeTriggerInterval ; + para.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode ; + para.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay ; + para.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn ; + para.endVoltage = print.endVoltage ; + para.extClearAllCntEnable = print.extClearAllCntEnable ; + para.HighVoltageAmplitude = print.HighVoltageAmplitude ; + para.lastLineEndPointFixedDACValue = print.lastLineEndPointFixedDACValue ; + para.lastLineEndPointFixedValue = print.lastLineEndPointFixedValue ; + para.FullColFixVal = print.FullColFixVal ; + + para.leftRightInverse = print.leftRightInverse ; + para.lineEndAdjustPointCnt = print.lineEndAdjustPointCnt ; + para.lineEndAdjustPointDelay = print.lineEndAdjustPointDelay ; + para.outputPulseDelayMs = print.outputPulseDelayMs ; + para.photoElectricityRepeateNum = print.photoElectricityRepeateNum ; + para.pixNumPerCol = print.pixNumPerCol ; + para.pointVoltageAdjustPos = print.pointVoltageAdjustPos ; + para.PointVoltageAdjustValue = print.PointVoltageAdjustValue ; + para.printColDelay = print.printColDelay ; + para.printDelayMs = print.printDelayMs ; + para.printDirection = print.printDirection ; + para.printRowDelay = print.printRowDelay ; + para.printTotalColNum = print.printTotalColNum ; + para.printTriggerMode = print.printTriggerMode ; //打印触发模式 + para.productCntPerOutputPulse = print.productCntPerOutputPulse ; + para.productNumToGenerateOutputPulse = print.productNumToGenerateOutputPulse ; + para.pulseOutputEnable = print.pulseOutputEnable ; + para.reducedPixelMode = print.reducedPixelMode ; + para.reducedPixelNum = print.reducedPixelNum ; + para.reducedPixelNumRatio = print.reducedPixelNumRatio ; + para.scanInverse = print.scanInverse ; + para.startVoltage = print.startVoltage ; + //print.stepPrint = print.stepPrint ; + memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; + memcpy( (char *)¶.adjVolDacRate,(char *)&print.adjVolDacRate,sizeof(print.adjVolDacRate)) ; +//edit-12.2 + //para.synCharWidthRatio = print.synCharWidthRatio ; + para.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode ; +#if 0 //不需要每个文件都存相位的参数 + para.synPulseNumPerMm = print.synPulseNumPerMm ; + para.synPulsePerMmX8 = print.synPulsePerMmX8 ; +#endif + para.synTriggerPrintLenMm = print.synTriggerPrintLenMm ; //喷印间隔 + //para.synTriggerPrintLenRatio = print.synTriggerPrintLenRatio ; + para.sysTriggerPrintMode = print.sysTriggerPrintMode ; + para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ; + para.timeTriggerPrintMode = print.timeTriggerPrintMode ; + //para.totalSynPulseNum = print.totalSynPulseNum ; + para.upDownInverse = print.upDownInverse ; + + para.varLen = print.varLen; + print.varLen1 = para.varLen1; + para.varLenEn = print.varLenEn?1:0; + para.headLen = print.headLen; + para.endLen = print.endLen; + + para.set_HVData_Flag = 0; + + para.eleMaskTime = print.eleMaskTime; + para.AltMirrorGap = print.AltMirrorGap; + para.textEditLineSpace = print.textEditLineSpace; + //para.weihu = print.wehu; + //qDebug()<<"sysFile3:"<spinBoxHighLowRatio->value(); + para.phaseHighLowRatio = print.phaseHighLowRatio; + para.phaseShift = print.phaseShift; + para.OuputPulseCol = print.OuputPulseCol; +#ifndef FOR_PHASE_ADJUST + print.phase_detect_pulse_num = 7; + para.phaseDetectVol = 40; + print.phaseDetectDelay = 100; +#else + para.phase_detect_pulse_num = print.phase_detect_pulse_num; + if (print.phase_detect_pulse_num<3 || print.phase_detect_pulse_num>10) { + print.phase_detect_pulse_num = 7; + } + + para.phaseDetectVol = print.phaseDetectVol; + if (print.phaseDetectVol < 28 || print.phaseDetectVol > 70) + print.phaseDetectVol = 35; + + para.phaseDetectDelay = print.phaseDetectDelay;//120;// ui->spinBoxPhaseDetectDelay->value(); + if (print.phaseDetectDelay < 70 || print.phaseDetectDelay > 150) + print.phaseDetectDelay = 100; +#endif + para.enableChargeFullTime = 1; +#endif + } + } +} +*/ + + +void SysPara::loadPrintParaFromFile(QString fileName){ + if(fileName=="") return; + fileName = QString( PARA_ROOT_DIR+QFileInfo( fileName).baseName()+".dpn"); + QFile file(fileName); + if(!file.exists(fileName)){ + //file.setFileName(TESTFILECD ); + return; + } + if(!file.open(QIODevice::ReadOnly)){ + //loadDefaultPrintPara(); + } + else { + QMessageBox::StandardButton ret; + qint32 copy_len; + if(file.size() != sizeof(print)){ + + if(file.size()>sizeof(print)) + copy_len = sizeof(print); + else + copy_len = file.size(); + file.seek(0); + file.read((char *)&print,copy_len); + file.close(); + } + else { + file.seek(0); + file.read((char *)&print,(long long int)sizeof(print)); + +// file.seek(0); +// file.read((char *)&printPre,(long long int)sizeof(printPre)); + memcpy( (char *)&printPre,(char *)&print,sizeof(print)) ; + loadParaToPrintInit(); + + file.close(); + memcpy( (char *)¶.alterPrint,(char *)&print.alterPrint,sizeof(alterPrint_t)) ; + para.charBold = print.charBold ; + + para.SynCntEn = print.SynCntEn ; +// para.autoSynSpeedEn = print.autoSynSpeedEn ; +// para.newAmplifyPlate = print.newAmplifyPlate; + para.cnt1CurrValue = print.cnt1CurrValue; // 20170313 cnt1StartValue;20191226 cnt1CurrValue + para.cnt1EndValue = print.cnt1EndValue ; + para.Cnt1NatureValue = print.Cnt1NatureValue ; + + para.mixValveisNewVersion = 1; + para.cnt1RepeateValue = print.cnt1RepeateValue ; + para.cnt1StartValue = print.cnt1StartValue ; + para.cnt1StepValue = print.cnt1StepValue ; + para.cnt2CurrValue = print.cnt2CurrValue;//20170313 cnt2StartValue ; /// 20191226cnt2CurrValue + para.cnt2EndValue = print.cnt2EndValue ; + para.cnt2RepeateValue = print.cnt2RepeateValue ; + para.cnt2StartValue = print.cnt2StartValue ; + para.cnt2StepValue = print.cnt2StepValue ; + + para.cnt4CurrValue = print.cnt4CurrValue; + para.HiddenConditionValue = print.HiddenConditionValue; + para.HiddenFuncEnable = print.HiddenFuncEnable; + para.HiddenMeterEnable = print.HiddenMeterEnable; + + if(print.decimalBits == 0){ + para.printNumPoint == 0 ; + para.rrr_nc == 0; + }else if(print.decimalBits == 1){ + para.printNumPoint == 1; + para.rrr_nc == 0; + }else if(print.decimalBits == 2){ + para.printNumPoint == 0; + para.rrr_nc == 1; + }else if(print.decimalBits == 3){ + para.printNumPoint == 1; + para.rrr_nc == 1; + } + para.currPrintMode = print.currPrintMode ; + para.elecEyeTriggerInterval = print.elecEyeTriggerInterval ; + para.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode ; + para.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay ; + para.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn ; + para.HighVoltageAmplitude = print.HighVoltageAmplitude ; + + para.leftRightInverse = print.leftRightInverse ; + para.outputPulseDelayMs = print.outputPulseDelayMs ; + para.photoElectricityRepeateNum = print.photoElectricityRepeateNum ; + para.printColDelay = print.printColDelay ; + para.printDelayMs = print.printDelayMs ; + para.printTriggerMode = print.printTriggerMode ; //打印触发模式 + para.productCntPerOutputPulse = print.productCntPerOutputPulse ; + para.pulseOutputEnable = print.pulseOutputEnable ; + para.reducedPixelNumRatio = print.reducedPixelNumRatio ; +// para.scanInverse = print.scanInverse ; +// memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; + // 迁移,分段计米-------start + para.scanInverse = print.scanInverse ;para.cnt1ByGroupEnalbe = print.cnt1ByGroupEnalbe; + para.startVoltage = print.startVoltage ;para.cnt2ByGroupEnalbe = print.cnt2ByGroupEnalbe; + //print.stepPrint = print.stepPrint ; + memcpy( (char *)¶.stepPrint,(char *)&print.stepPrint,sizeof(stepPrint_t)) ; + memcpy( (char *)¶.adjVolDacRate,(char *)&print.adjVolDacRate,sizeof(print.adjVolDacRate)) ; + if(para.cnt1ByGroupEnalbe) + memcpy( (char *)¶.Cnt1ByGroup,(char *)&print.Cnt1ByGroup,sizeof(print.Cnt1ByGroup)) ; + else + memset(¶.Cnt1ByGroup,0,sizeof(para.Cnt1ByGroup)); +#ifdef COUNTER2_BY_GROUP + if(para.cnt2ByGroupEnalbe) + memcpy( (char *)¶.Cnt2ByGroup,(char *)&print.Cnt2ByGroup,sizeof(print.Cnt2ByGroup)) ; + else + memset(¶.Cnt2ByGroup,0,sizeof(para.Cnt2ByGroup)); +#endif + //-------end + para.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode ; + para.synTriggerPrintLenMm = print.synTriggerPrintLenMm ; //喷印间隔 + para.sysTriggerPrintMode = print.sysTriggerPrintMode ; + para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ; + para.timeTriggerPrintMode = print.timeTriggerPrintMode ; + para.upDownInverse = print.upDownInverse ; + + para.varLen = print.varLen; + print.varLen1 = para.varLen1; + para.varLenEn = print.varLenEn?1:0; + para.headLen = print.headLen; + para.endLen = print.endLen; + para.set_HVData_Flag = 0; + para.eleMaskTime = print.eleMaskTime; +// para.AltMirrorGap = print.AltMirrorGap; + para.textEditLineSpace = print.textEditLineSpace; + para.textEditCharSpace = print.textEditCharSpace; + } + } +} + + +void SysPara::loadDefaultPrintPara(){ + loadDefaultPara(); +} +/* +void SysPara::savePrintParaToFile(){ +//qDebug()<<"savePrintParaToFile"; + if(sysFile=="") return; + QString fileName = QString( PARA_ROOT_DIR+QFileInfo( sysFile).baseName()+".dpn"); + //qDebug()<<"savePrintParaToFile1:"<> 12; + if(mode == FAST_PRINT ) + { + volParaFilePath = ":/conf/VoltParaHi.bin"; + } + else if(mode == STANDARD_PRINT) + { + volParaFilePath = PARA_ROOT_DIR"VoltParaStd.bin"; + } + + if(status.build_dat.builTime == 73){ + volParaFilePath = ":/conf/VoltePara_No73.bin"; + status.currVoltageVersion = VersionOf73; + } + else if(type == 6 || type == 8){ + + LogInfo::setRunStatusText("loadVolteParaFromFile: currPrintRow: " + QString::number(status.currPrintRow)); + + if(status.currPrintRow <=21){ + volParaFilePath = ":/conf/VoltDataStd21.bin"; + status.currVoltageVersion = VersionOf72And21R; + } + else if(status.currPrintRow <=25){ + volParaFilePath = ":/conf/VoltDataStd25.bin"; + status.currVoltageVersion = VersionOf72And25R; + qDebug() << "loadVolteParaFromFile: " << volParaFilePath; + } + else if(para.currSelectVolPara == FiveLineFiveDot){ + volParaFilePath = ":/conf/VoltDataStd5Row5Dot.bin"; + status.currVoltageVersion = VersionOf72And5Row5Dot; + if(status.currPrintRow > 32){ + volParaFilePath = ":/conf/VoltDataStd5R5DOf34Dot.bin"; //34dot + status.currVoltageVersion = VersionOf72And5Row5Dot34; + } + } + else if(para.currSelectVolPara == FourLineSevenDot){ + volParaFilePath = ":/conf/VoltDataStd4Row7Dot.bin"; + status.currVoltageVersion = VersionOf72And4Row7Dot; + if(status.currPrintRow > 32){ + volParaFilePath = ":/conf/VoltDataStd4R7DOf34Dot.bin"; //34dot + status.currVoltageVersion = VersionOf72And4Row7Dot34; + } + } + else + { + volParaFilePath = ":/conf/VoltDataStd32.bin"; + status.currVoltageVersion = VersionOf72And32R; + } + + #ifdef ENB_VOLTAGE_ADJUST_NO72 + volParaFilePath = "/home/plg/doc/VoltDataStd25.bin"; + #endif + } + LogInfo::setRunStatusText(QString("volParaFilePath:%1").arg(volParaFilePath)); + QFile file(volParaFilePath); + + QDir dir; + char buf[200]; + if (!dir.exists(DOC_ROOT_DIR)){ + snprintf(buf, sizeof(buf), "mkdir -p %s", DOC_ROOT_DIR); + system(buf); + } + if (!dir.exists(PARA_ROOT_DIR)){ + snprintf(buf, sizeof(buf), "mkdir -p %s", PARA_ROOT_DIR); + system(buf); + } + if (!dir.exists(PARA_ROOT_DIR)){ + QMessageBox::warning(0, QString("warnning"), QString("Path") + PARA_ROOT_DIR + QString("not Found.")); + return; + } + + qDebug() << "loadVolteParaFromFile: " << volParaFilePath; + + if (file.exists(volParaFilePath)){ + if (!file.open(QIODevice::ReadOnly)){ + } + else { + QMessageBox::StandardButton ret = QMessageBox::Ok; + qint32 copy_len; + char *volteStruct = (char *)&voltePara; + size_t sizeofVolteParaStruct = sizeof(voltePara); + if(status.build_dat.builTime == 73){ + volteStruct = (char *)&voltePara_No73; + sizeofVolteParaStruct = sizeof(voltePara_No73); + } + else if(type == 6 || type ==8){ + memset(&voltePara_25Dots,0,sizeof(voltePara_25Dots)); + volteStruct = (char *)&voltePara_25Dots; + sizeofVolteParaStruct = sizeof(voltePara_25Dots); + + LogInfo::setRunStatusText("voltage path: " + volParaFilePath); + + // qDebug() << "loadVolteParaFromFile: " << QVector(std::begin(voltePara_25Dots.matchTotalTableDACArray1), std::end(voltePara_25Dots.matchTotalTableDACArray1)); + + } + if (file.size() != sizeofVolteParaStruct){ +// qDebug()<<"注意,电压文件大小不对!"; +// LogInfo::setRunStatusText(QString("注意,电压文件大小不对!")); +#ifdef VNLG + ; +#else + ret = QMessageBox::warning(NULL, QString("警告"), QString("配置文件大小不一致,按 确定 将采取兼容方式读取配置文件"), + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); + +#endif + if (ret == QMessageBox::Ok){ + copy_len = file.size() < sizeofVolteParaStruct?file.size():sizeofVolteParaStruct; + file.seek(0); + file.read(volteStruct, copy_len); + file.close(); + } + else if (ret == QMessageBox::Cancel){ + file.close(); + } + } + else { + file.seek(0); + file.read(volteStruct, (long long int)sizeofVolteParaStruct); + file.close(); + } + } + } + else{ + qDebug()<<"There is no Volte Para File."; + LogInfo::setRunStatusText(QString("There is no Volte Para File.")); + } +} + +void SysPara::saveRFIDPara() +{ + QFile file(RFID_FILE_PATH); + if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + qDebug() << "Error: Could not open file for writing"; + return; + } + QDataStream out(&file); + out.setVersion(QDataStream::Qt_4_6); // Set the version compatible with Qt 4.8.5 + out << RFIDPara.PrintInkDots; + out << RFIDPara.InkEmptyCnt; + out << RFIDPara.SOLVEmptyCnt; + out << RFIDPara.InkRFIDCnt; + out << RFIDPara.SOLVRFIDCnt; + out << RFIDPara.solventNumber; + + file.close(); +} +bool SysPara::loadRFIDPara() +{ + QFile file(RFID_FILE_PATH); + if (!file.open(QIODevice::ReadOnly)) { + qDebug() << "Error: Could not open file for reading"; + return false; + } + + QDataStream in(&file); + in.setVersion(QDataStream::Qt_4_6); // Set the version compatible with Qt 4.8.5 + + in >> RFIDPara.PrintInkDots; + in >> RFIDPara.InkEmptyCnt; + in >> RFIDPara.SOLVEmptyCnt; + in >> RFIDPara.InkRFIDCnt; + in >> RFIDPara.SOLVRFIDCnt; + in >> RFIDPara.solventNumber; + + file.close(); + return true; +} + +void SysPara::comparePrintStruct(){ + + if(print.charBold != printPre.charBold){ + printInit.charBold = print.charBold; + } + if(print.SynCntEn != printPre.SynCntEn){ + printInit.SynCntEn = print.SynCntEn; + } + if(print.cnt1CurrValue != printPre.cnt1CurrValue){ + printInit.cnt1CurrValue = print.cnt1CurrValue; + + } + if(print.cnt1EndValue != printPre.cnt1EndValue){ + printInit.cnt1EndValue = print.cnt1EndValue; + + } + if(print.Cnt1NatureValue != printPre.Cnt1NatureValue){ + printInit.Cnt1NatureValue = print.Cnt1NatureValue; + + } + if(print.charBold != printPre.charBold){ + printInit.charBold = print.charBold; + } + if(print.cnt1RepeateValue != printPre.cnt1RepeateValue){ + printInit.cnt1RepeateValue = printPre.cnt1RepeateValue; + + } + if(print.cnt1StartValue != printPre.cnt1StartValue){ + printInit.cnt1StartValue = print.cnt1StartValue; + + } + if(print.cnt1StepValue != printPre.cnt1StepValue ){ + printInit.cnt1StepValue = print.cnt1StepValue; + + } + if(print.cnt2CurrValue != printPre.cnt2CurrValue){ + printInit.cnt2CurrValue = print.cnt2CurrValue; + } + if(print.cnt2EndValue != printPre.cnt2EndValue){ + printInit.cnt2EndValue = print.cnt2EndValue; + + } + if(print.cnt2RepeateValue != printPre.cnt2RepeateValue){ + printInit.cnt2RepeateValue = print.cnt2RepeateValue; + + } + if(print.cnt2StartValue != printPre.cnt2StartValue){ + printInit.cnt2StartValue = print.cnt2StartValue; + + } + if(print.cnt2StepValue != printPre.cnt2StepValue ){ + printInit.cnt2StepValue = print.cnt2StepValue; + } + + if(print.cnt4CurrValue != printPre.cnt4CurrValue){ + printInit.cnt4CurrValue = print.cnt4CurrValue; + + } + if(print.HiddenConditionValue != printPre.HiddenConditionValue){ + printInit.HiddenConditionValue = print.HiddenConditionValue; + } + if(print.HiddenFuncEnable != printPre.HiddenFuncEnable){ + printInit.HiddenFuncEnable = print.HiddenFuncEnable; + } + if(print.HiddenMeterEnable != printPre.HiddenMeterEnable){ + printInit.HiddenMeterEnable = print.HiddenMeterEnable; + } + + if(print.currPrintMode != printPre.currPrintMode ){ + printInit.currPrintMode = print.currPrintMode; + } + if(print.elecEyeTriggerInterval != printPre.elecEyeTriggerInterval){ + printInit.elecEyeTriggerInterval = print.elecEyeTriggerInterval; + } + if(print.eleEyeClearCntInSynMode != printPre.eleEyeClearCntInSynMode){ + printInit.eleEyeClearCntInSynMode = print.eleEyeClearCntInSynMode; + } + if(print.eleEyeTriggerPrintDelay != printPre.eleEyeTriggerPrintDelay){ + printInit.eleEyeTriggerPrintDelay = print.eleEyeTriggerPrintDelay; + } + if(print.eleEyeTriggerSynPrintEn != printPre.eleEyeTriggerSynPrintEn){ + printInit.eleEyeTriggerSynPrintEn = print.eleEyeTriggerSynPrintEn; + } + + if(print.HighVoltageAmplitude != printPre.HighVoltageAmplitude){ + printInit.HighVoltageAmplitude = print.HighVoltageAmplitude; + } + + if(print.leftRightInverse != printPre.leftRightInverse){ + printInit.leftRightInverse = print.leftRightInverse; + } + + if(print.outputPulseDelayMs != printPre.outputPulseDelayMs){ + printInit.outputPulseDelayMs = print.outputPulseDelayMs; + + } + if(print.photoElectricityRepeateNum != printPre.photoElectricityRepeateNum){ + printInit.photoElectricityRepeateNum = print.photoElectricityRepeateNum; + } + + if(print.printColDelay != printPre.printColDelay){ + printInit.printColDelay = print.printColDelay; + } + if(print.printDelayMs != printPre.printDelayMs){ + printInit.printDelayMs = print.printDelayMs; + } + + if(print.printTriggerMode != printPre.printTriggerMode){ + printInit.printTriggerMode = print.printTriggerMode; + } + if(print.productCntPerOutputPulse != printPre.productCntPerOutputPulse){ + printInit.productCntPerOutputPulse = print.productCntPerOutputPulse; + } + if(print.pulseOutputEnable != printPre.pulseOutputEnable){ + printInit.pulseOutputEnable = print.pulseOutputEnable; + } + + if(print.reducedPixelNumRatio != printPre.reducedPixelNumRatio){ + printInit.reducedPixelNumRatio = print.reducedPixelNumRatio; + } + + if(print.synClearCntInEleEyeMode != printPre.synClearCntInEleEyeMode){ + printInit.synClearCntInEleEyeMode = print.synClearCntInEleEyeMode; + + } + + if(print.synTriggerPrintLenMm != printPre.synTriggerPrintLenMm){ + printInit.synTriggerPrintLenMm = print.synTriggerPrintLenMm; + } + + if(print.sysTriggerPrintMode != printPre.sysTriggerPrintMode){ + printInit.sysTriggerPrintMode = print.sysTriggerPrintMode; + } + if(print.timeTriggerPrintDelayMs != printPre.timeTriggerPrintDelayMs){ + printInit.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs; + } + if(print.timeTriggerPrintMode != printPre.timeTriggerPrintMode){ + printInit.timeTriggerPrintMode = print.timeTriggerPrintMode; + } + + if(print.upDownInverse != printPre.upDownInverse){ + printInit.upDownInverse = print.upDownInverse; + } + if(print.eleMaskTime != printPre.eleMaskTime){ + printInit.eleMaskTime = print.eleMaskTime; + } + if(print.varLen != printPre.varLen){ + printInit.varLen = print.varLen; + } + if(print.varLen1 != printPre.varLen1){ + printInit.varLen1 = print.varLen1; + } + if(print.varLenEn != printPre.varLenEn){ + printInit.varLenEn = print.varLenEn; + } + if(print.headLen != printPre.headLen){ + printInit.headLen = print.headLen; + } + if(print.endLen != printPre.endLen){ + printInit.endLen = print.endLen; + } + if(print.textEditLineSpace != printPre.textEditLineSpace){ + printInit.textEditLineSpace = print.textEditLineSpace; + } + if(print.textEditCharSpace != printPre.textEditCharSpace){ + printInit.textEditCharSpace = print.textEditCharSpace; + + } +} + + diff --git a/SystemManage.cpp b/SystemManage.cpp index db740e4..259c95a 100644 --- a/SystemManage.cpp +++ b/SystemManage.cpp @@ -1,1713 +1,1713 @@ -#include "SystemManage.h" -#include "ui_systemmanage.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "SysPara.h" -#include "DevOp.h" -#include "myinclude.h" -#include "Public.h" -#include "dlginputaddr.h" -#include "qprogressdialog.h" -#include "LogInfo.h" -#include -#include -#include - -#define RECLAIN_TANK_TEST_MAX_COUNT 10 -enum ReclainTankTestEnum{ - ReclainTankTest_eNotStart, - ReclainTankTest_eOpenning, - ReclainTankTest_eOpened, - ReclainTankTest_eClosing, - ReclainTankTest_Closed -}; -SystemManage::SystemManage(QWidget *parent) : - QWidget(parent), - ui(new Ui::SystemManage),timeDia(0) -{ - ui->setupUi(this); - timeDia.hide(); - setPumpValveBottonEnable(false); - ui->pushButtonCompressPump->setEnabled(false); - ui->pushButtonMainInkPump->setEnabled(false); - ui->pushButtonReleaseValve->setEnabled(false); - ui->pushButtonReclaimPump->setEnabled(false); - ui->pushButtonGearPump->setEnabled(true); - ui->pushButtonGearPumpOff->setEnabled(true); - ui->labelControlByHand->setText("手动"); - - ui->pushButtonPushAir->setEnabled(true); //2019-10-23 排气按钮始终使能 by kun - timer = new QTimer(); - connect(timer, SIGNAL(timeout()), this, SLOT(timerHandler())); - timer2 = new QTimer(); - connect(timer2, SIGNAL(timeout()), this, SLOT(timerHandler2())); - autoCleanTimer = new QTimer(); - connect(autoCleanTimer, SIGNAL(timeout()), this, SLOT(autoCleanTimerHandler())); - connect(this,SIGNAL(autoCleanStart(void)),this,SLOT(onAutoCleanStart(void))); - - reclaimTankTestTimer = new QTimer(); - connect(reclaimTankTestTimer, SIGNAL(timeout()), this, SLOT(reclainTankTestHandler())); - - - //烧录FPGA所写 - programFPGATimer = new QTimer(); - connect(programFPGATimer, SIGNAL(timeout()), this, SLOT(programFPGAProcess())); - programFPGADialog = new UpdateFPGA("/home/plg/upgrade_file_new.py"); - connect(programFPGADialog,SIGNAL(upgradeFPGAFinished(bool)),this,SIGNAL(restartSerial(bool))); - connect(programFPGADialog,SIGNAL(upgradeFPGAFinished(bool)),this,SIGNAL(enableClick(bool))); - //---------------------------------------------------------------------------------- - - -/***2019/10/22 start*****/ - inkcloseCountTimer = new QTimer(); - connect(inkcloseCountTimer, SIGNAL(timeout()), this, SLOT(inkcloseCountHandler())); - inkcloseCountTimer->start(1000); -/****2019/10/22 end****/ - -/***2019/10/23 start*****/ - MainnkCmpSepetalTimer = new QTimer(); - connect(MainnkCmpSepetalTimer, SIGNAL(timeout()), this, SLOT(MainInkCmpSepetalHandler())); -/***2019/10/23 *****/ - - dialogUpateMm =new DialogAuthorization; - connect(dialogUpateMm,SIGNAL(accepted()),this,SLOT(ondialogAuthorizationAccepted())); - - dialogTimeSetAuthorization = new DialogAuthorization; - connect(dialogTimeSetAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogTimeSetAuthorizationAccepted())); - - dialogSysUpdateAuthorization = new DialogAuthorization; - connect(dialogSysUpdateAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogSysUpdateAuthorizationAccepted())); - dialogFactorySetAuthorization = new DialogAuthorization; - connect(dialogFactorySetAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogFactorySetAuthorizationAccepted())); - dlgInputAddr_TimeSet = new DlgInputAddr(parent); - dlgInputAddr_TimeSet->GetAddr(); - dlgInputAddr_TimeSet->vpnConnect(); - dlgInputAddr_TimeSet->hide(); - - connect(ui->spinBoxGearPumpValue,SIGNAL(valueChanged(int)),this,SLOT(updateGearPumpValue(int))); - ui->pushButtonExportConfToUDisk->setDisabled(true); - ui->pushButtonImportConfFromUdisk->setDisabled(true); -// ui->pushButtonFactorySetting->setDisabled(true); - ui->labelControlByHand->setText(tr("自动")); -// ui->pushButtonMotorTest->hide(); - getCurrentScrennType(); - - ui->pushButton_EnvConf->setVisible(false); -} - -void SystemManage::bindDlgInputAddr(DlgInputAddr *dlgInputAddr) -{ - dlgInputAddr_TimeSet = dlgInputAddr; - dlgInputAddr_TimeSet->GetAddr(); - dlgInputAddr_TimeSet->vpnConnect(); - dlgInputAddr_TimeSet->hide(); -} - -SystemManage::~SystemManage() -{ - delete ui; - delete timer2; - delete timer; - delete autoCleanTimer; - /***2019/10/22 start*****/ - delete inkcloseCountTimer; - /****2019/10/22 end****/ - - /***2019/10/23 start*****/ - delete MainnkCmpSepetalTimer; - - if(programFPGADialog) { - delete programFPGADialog; - programFPGADialog = nullptr; - } - -} - -void SystemManage::on_pushButtonReleaseValve_pressed() -{ - if(sysPara){ - sysPara->devOp->controlReleaseValve(!sysPara->devOp->isReleaseValveOpen()); - ui->labelCompressPump->setText(sysPara->devOp->isReleaseValveOpen()?tr("开"):tr("关")); - sysPara->devOp->pumpValveCtrl(); - } -} -void SystemManage::on_pushButtonCompressPump_pressed() -{ - if(sysPara){ - sysPara->devOp->controlCompressPump(!sysPara->devOp->isCompressPumpOpen()); - ui->labelCompressPump->setText(sysPara->devOp->isCompressPumpOpen()?tr("开"):tr("关")); - } -} - -void SystemManage::on_pushButtonCycleValve_pressed() -{ - if(sysPara){ - sysPara->devOp->controlCycleValve(!sysPara->devOp->isCycleValveOpen()); - ui->labelCycleValve->setText(sysPara->devOp->isCycleValveOpen()?tr("开"):tr("关")); - } -} - -void SystemManage::updateGearPumpValue(int) -{ - if(sysPara->status.isPumpValveControledByHand) - { - if(sysPara->para.gearPumpEnable) - { - ui->pushButtonGearPump->setEnabled(true); - } - } -} - -void SystemManage::on_pushButtonGearPump_pressed() -{ - ui->pushButtonGearPump->setEnabled(false); - sysPara->para.gearPumpValue = ui->spinBoxGearPumpValue->value(); - sysPara->devOp->WriteMoterPump(); - ui->pushButtonGearPumpOff->setEnabled(true); -} - -void SystemManage::on_pushButtonInkValve_pressed() -{ - if(sysPara){ - //2019/10/22 - //2019/11/20 - //开供墨阀之前要判断回收泵有没有开,没开就提前打开;手动模式下,不需要提前开回收泵 - if((!sysPara->devOp->isInkValveOpen()) && (!sysPara->devOp->isReclaimPumpOpen()) && (!sysPara->status.isPumpValveControledByHand)) - { - sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 - } - sysPara->devOp->controlInkValve(!sysPara->devOp->isInkValveOpen()); - sysPara->devOp->controlInkValvePWM(!sysPara->devOp->isInkValveOpen1()); - ui->labelInkValve->setText(sysPara->devOp->isInkValveOpen1()?tr("开"):tr("关")); - } -} - -void SystemManage::on_pushButtonMainInkPump_pressed() -{ - if(sysPara){ - sysPara->devOp->controlMainInkPump(!sysPara->devOp->isMainInkPumpOpen()); - ui->labelMainInkPump->setText(sysPara->devOp->isMainInkPumpOpen()?tr("开"):tr("关")); - sysPara->devOp->mainInkCtrl(); - } -} - -void SystemManage::on_pushButtonMixValve_pressed() -{ - if(sysPara){ - sysPara->devOp->controlMixValve(!sysPara->devOp->isMixValveOpen()); - ui->labelMixValve->setText(sysPara->devOp->isMixValveOpen()?tr("开"):tr("关")); - } -} - -void SystemManage::on_pushButtonReclaimPump_pressed() -{ - if(sysPara){ - sysPara->devOp->controlReclaimPump(!sysPara->devOp->isReclaimPumpOpen(),false); - ui->labelReclaimPump->setText(sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")); - } -} - -void SystemManage::on_pushButtonViscosityPump_pressed() -{ - if(sysPara){ - sysPara->devOp->controlViscosityPump(!sysPara->devOp->isViscosityPumpOpen()); - ui->labelViscosityPump->setText(sysPara->devOp->isViscosityPumpOpen()?tr("开"):tr("关")); - } -} - - -void SystemManage::setPumpValveBottonEnable(bool enable){ - if(sysPara) - { - if(sysPara->para.gearPumpEnable) - { - ui->pushButtonCompressPump->setEnabled(false); - ui->pushButtonMainInkPump->setEnabled(false); - ui->pushButtonReleaseValve->setEnabled(false); - ui->pushButtonReclaimPump->setEnabled(enable); - } - else - { - ui->pushButtonCompressPump->setEnabled(enable); - ui->pushButtonMainInkPump->setEnabled(enable); - ui->pushButtonReleaseValve->setEnabled(enable); - ui->pushButtonReclaimPump->setEnabled(enable); - } - } - ui->pushButtonCycleValve->setEnabled(enable); - ui->pushButtonInkValve->setEnabled(enable); - - ui->pushButtonMixValve->setEnabled(enable); - - //ui->pushButtonReclaimTankClose->setEnabled(enable); - //ui->pushButtonReclaimTankOpen->setEnabled(enable); - - ui->pushButtonViscosityPump->setEnabled(enable); - //ui->pushButtonCleanUP->setEnabled(enable); - ui->pushButtonAutoClean->setEnabled(enable); -// ui->pushButtonMotorTest->setEnabled(enable); - ui->pushButtonPushAir->setEnabled(enable); - if(sysPara) - { - if(sysPara->para.gearPumpEnable) - { - ui->pushButtonGearPump->setEnabled(enable); - ui->pushButtonGearPumpOff->setEnabled(enable); - } - else - { - ui->pushButtonGearPump->setEnabled(false); - ui->pushButtonGearPumpOff->setEnabled(false); - } - if(enable) - { - sysPara->para.gearPumpValue = 0; - sysPara->devOp->WriteMoterPump(); - } - else - { - sysPara->para.gearPumpValue = 300; - sysPara->devOp->WriteMoterPump(); - } - } - - if(enable){ - if(sysPara){ - sysPara->devOp->controlCompressPump(false); - sysPara->devOp->controlCycleValve(true); - sysPara->devOp->controlInkValve(false); - sysPara->devOp->controlInkValvePWM(false); - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->controlMixValve(false); - sysPara->devOp->controlReclaimPump(true,true); - sysPara->devOp->controlViscosityPump(false); - sysPara->devOp->controlReleaseValve(false); - timer->start(2000); - } - } - -} - - -void SystemManage::on_pushButtonControlByHand_pressed() -{ - if(sysPara){ - if(!sysPara->status.isPumpValveControledByHand){ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("警告"), - tr("是否确认进入手动模式?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret != QMessageBox::Ok){ - return; - }else - { - qDebug()<<"进入手动模式"; - //qDebug()<<"disable inkcloseCountTimer"; - if(inkcloseCountTimer->isActive()) inkcloseCountTimer->stop(); - } - } - else { - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("警告"), - tr("请先确认已经关闭回收槽,确认进入自动模式?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret != QMessageBox::Ok){ - - return; - }else - { - qDebug()<<"进入自动模式"; - // qDebug()<<"active inkcloseCountTimer"; - inkcloseCountTimer->start(1000); - } - } - if(timer2->isActive()) - timer2->stop(); - sysPara->status.isPumpValveControledByHand = !sysPara->status.isPumpValveControledByHand; - setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); - ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun - ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); - sysPara->devOp->mainInkCtrl(); - emit enableReclaimButton(!sysPara->status.isPumpValveControledByHand); - qDebug()<<"isPumpValveControledByHand:"<status.isPumpValveControledByHand; - qDebug()<<"手动控制泵阀"; - } -} - -void SystemManage::on_pushButtonReclaimTankOpen_pressed() -{ - if(sysPara){ - if(!sysPara->para.isCheckMagnet) - { - if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::warning(this, tr("警告"), - tr("请先移开喷头盖!")); - return ; - } - } - sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); - ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); - sysPara->devOp->highVoltageCtrl(0); - sysPara->status.reclainOpenAppending = true; - sysPara->status.reclainCloseAppending = false; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - } -} - -void SystemManage::on_pushButtonReclaimTankClose_pressed() -{ - if(sysPara){ - if(!sysPara->para.isCheckMagnet) - { - if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::warning(this, tr("警告"), - tr("请先移开喷头盖!")); - return ; - } - } - sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); - ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); - sysPara->devOp->highVoltageCtrl(0); - sysPara->status.reclainOpenAppending = false; - sysPara->status.reclainCloseAppending = true; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - } -} -#include -void adjustdate(int year, int mon, int mday, int hour, int min, int sec) { - time_t t; - struct tm nowtime; - nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) - nowtime.tm_min = min; // Minutes.[0-59] - nowtime.tm_hour = hour; // Hours. [0-23] - nowtime.tm_mday = mday; // Day.[1-31] - nowtime.tm_mon = mon - 1; // Month. [0-11] - nowtime.tm_year = year - 1900; // Year- 1900. - nowtime.tm_isdst = -1; // DST.[-1/0/1] - t = mktime(&nowtime); - -#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 31)) - struct timespec ts; - ts.tv_sec = t; - ts.tv_nsec = 0; - auto ret = clock_settime(CLOCK_REALTIME, &ts); - if(ret != 0){ - qWarning() <<"clock_settime error : " << ret; - qWarning() << "Reason: " << QString(strerror(errno)); - } - else { - qInfo() << "Successed to set system time"; - } -#else - stime(&t); // 仅用于 glibc < 2.31 -#endif - -} - -void SystemManage::on_dialogTimeSetAuthorizationAccepted() -{ - QString authString= dialogTimeSetAuthorization->getAuth(); - qDebug()<<"authString"<checWhJmDate(authString)) // 0xa001 - { - QTime tm = QTime::currentTime(); - QDate date = QDate::currentDate(); - timeDia.setYear(date.year()); - timeDia.setMonth(date.month()); - timeDia.setDay(date.day()); - timeDia.setHour(tm.hour()); - timeDia.setMinute(tm.minute()); - timeDia.setSecond(tm.second()); - timeDia.hide(); - timeDia.show(); - connect(&timeDia,SIGNAL(accepted()),this,SLOT(onTimeSettingDone())); - }else - { - QMessageBox::about(this, tr("提示"), tr("密码不正确!")); - return; - } - -} - -void SystemManage::on_pushButtonTimeSetting_clicked() -{ -// dialogTimeSetAuthorization->clearAuth(); -// dialogTimeSetAuthorization->show(); - - QTime tm = QTime::currentTime(); - QDate date = QDate::currentDate(); - timeDia.setYear(date.year()); - timeDia.setMonth(date.month()); - timeDia.setDay(date.day()); - timeDia.setHour(tm.hour()); - timeDia.setMinute(tm.minute()); - timeDia.setSecond(tm.second()); - timeDia.hide(); - timeDia.show(); - connect(&timeDia,SIGNAL(accepted()),this,SLOT(onTimeSettingDone())); - -} - -uint8_t datatime[8] = {}; -void SystemManage::onTimeSettingDone(){ - adjustdate(timeDia.getYear(), timeDia.getMonth(), timeDia.getDay(), timeDia.getHour(), timeDia.getMinute(), timeDia.getSecond()); - qDebug()<<"onTimeSettingDone"; - - QDate date(timeDia.getYear(), timeDia.getMonth(), timeDia.getDay()); - int dayOfWeek = date.dayOfWeek(); - QString YearStr = QString::number(timeDia.getYear()); - int Year1 = YearStr.mid(0,2).toInt(); - int Year2 = YearStr.mid(2,2).toInt(); - uint8_t year1 = Year1; - datatime[0] = year1; - uint8_t year2 = Year2; - datatime[1] = year2; - uint8_t month = timeDia.getMonth(); - datatime[2] = month; - uint8_t day = timeDia.getDay(); - datatime[3] = day; - uint8_t week= dayOfWeek; - datatime[4] = week; - uint8_t hour = timeDia.getHour(); - datatime[5] = hour; - uint8_t minute= timeDia.getMinute(); - datatime[6] = minute; - uint8_t second= timeDia.getSecond(); - datatime[7] = second; - - for(int i=0;i<8;i++){ - qDebug()<<"datatime "<devOp->stm32Wr(0xA1,(unsigned char *)datatime,8); - -// qDebug() << "time setting done!"; -// QString authString= dialogTimeSetAuthorization->getAuth(); -// dlgInputAddr_TimeSet->checWhJmDate(authString); //再执行一次,不然时间改不过来 -} - - -void SystemManage::on_pushButtonUpdateCharLib_pressed() -{ - char cmd[500]; - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("Application"), - tr("是否确认更新字库?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ -// QDir dirFont("/usr/lib/fonts/"); -// if(!dirFont.exists()) -// { -// system("mkdir -p /usr/lib/fonts/"); -// } - - snprintf(cmd,sizeof(cmd),"cp /udisk/*.bdf /udisk/*.ttf /usr/lib/fonts/"); - system(cmd); - - snprintf(cmd,sizeof(cmd),"chmod a+r /usr/lib/fonts/*.bdf"); - system(cmd); - - system("sync"); - - QDir dir("/udisk/"); - QStringList filter; - filter<<"*.bdf"<<"*.ttf"; - QFileInfoList infolist = dir.entryInfoList(filter); - if(infolist.isEmpty()) - { - infolist.clear(); - QMessageBox::information(this, tr("提示"), tr("没找到对应字库,更新失败!")); - } - else - { - QMessageBox::information(this, tr("提示"), - tr("更新字库成功,重启后生效!")); - } - } -} - -void SystemManage::on_pushButtonFactorySetting_pressed() -{ - dialogFactorySetAuthorization->clearAuth(); - dialogFactorySetAuthorization->show(); -} - -void SystemManage::on_dialogFactorySetAuthorizationAccepted() -{ - QString authString= dialogFactorySetAuthorization->getAuth(); - qDebug()<<"authString"<checWhJmDate(authString)) - { - sysPara->loadDefaultPara(); - sysPara->saveParaToFile(); - QMessageBox::information(this,"提示",tr("恢复出厂设置成功,请重新关机上电")); - } - else - { - QMessageBox::about(this, tr("提示"), tr("密码不正确!")); - return; - } -} - -void SystemManage::on_pushButtonScreenAdjust_pressed() -{ - QMessageBox::StandardButton ret; -ret = QMessageBox::information(NULL,tr("校准触摸屏"), tr("是否确认开始校准程序?请小心进行校准!"), - QMessageBox::Ok | QMessageBox::Cancel); -char buf [] = -"#!/bin/sh\n\ -TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent \n\ -TS_INFO_FILE1=/sys/class/input/input0/uevent \n\ -if [ -e $TS_INFO_FILE -a \"/bin/grep -q TouchScreen < $TS_INFO_FILE\" ]; then \n\ -export TSLIB_TSDEVICE=/dev/input/event0 \n\ -export TSLIB_CONFFILE=/usr/local/etc/ts.conf \n\ -export TSLIB_PLUGINDIR=/usr/local/lib/ts \n\ -export TSLIB_CALIBFILE=/etc/pointercal \n\ -export LD_LIBRARY_PATH=/usr/local/lib \n\ -export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin \n\ -export QWS_DISPLAY=:1 \n\ -export QWS_MOUSE_PROTO=\"Tslib:/dev/input/event0 MouseMan:/dev/input/mice\" \n\ -\#rm -f /etc/pointercal \n\ -\#if [ ! -s /etc/pointercal ] ; then \n\ - /usr/local/bin/ts_calibrate \n\ -\#fi \n\ -else \n\ -TS_INFO_FILE1=/sys/class/input/input0/uevent \n\ -if [ -e $TS_INFO_FILE1 -a \"/bin/grep -q tsc < $TS_INFO_FILE1\" ]; then \n\ - export QWS_MOUSE_PROTO=\"Tslib:/dev/input/event0 MouseMan:/dev/input/mice\" \n\ - /usr/local/bin/ts_calibrate \n\ -else \n\ - export QWS_MOUSE_PROTO=\"MouseMan:/dev/input/mice\" \n\ -fi \n\ -fi\n" ; - // QFile file("./calibrate"); -// ui->pushButtonFactorySetting->setEnabled(0); -// ui->pushButtonGhost->setEnabled(0); - ui->pushButtonImportConfFromUdisk->setEnabled(0); - ui->pushButtonExportConfToUDisk->setEnabled(0); - ui->pushButtonTimeSetting->setEnabled(0); -// ui->pushButtonScreenAdjust->setEnabled(0); - ui->pushButtonUpdateCharLib->setEnabled(0); - ui->pushButtonUpdateSoftware->setEnabled(0); - ui->pushButtonReclaimTankOpen->setEnabled(0); - ui->pushButtonReclaimTankClose->setEnabled(0); - ui->pushButtonControlByHand->setEnabled(0); - - - if (ret == QMessageBox::Ok){ - system("chmod a+x ./calibrate"); - system("./calibrate &"); - } - -// ui->pushButtonFactorySetting->setEnabled(1); -// ui->pushButtonGhost->setEnabled(1); - ui->pushButtonImportConfFromUdisk->setEnabled(1); - ui->pushButtonExportConfToUDisk->setEnabled(1); - ui->pushButtonTimeSetting->setEnabled(1); -// ui->pushButtonScreenAdjust->setEnabled(1); - ui->pushButtonUpdateCharLib->setEnabled(1); - ui->pushButtonUpdateSoftware->setEnabled(1); - ui->pushButtonReclaimTankOpen->setEnabled(1); - ui->pushButtonReclaimTankClose->setEnabled(1); - ui->pushButtonControlByHand->setEnabled(1); -} - -void SystemManage::on_pushButtonUpdateSoftware_pressed() -{ - if(sysPara->status.updateSoftEN==0){ - dialogUpateMm->clearAuth(); - dialogUpateMm->show(); - } - else ondialogAuthorizationAccepted(); -} -void SystemManage::ondialogAuthorizationAccepted() - { - QString authString= dialogUpateMm->getAuth(); - QString strDay; - strDay.sprintf("%02d", QDate::currentDate().day()); - if(sysPara->status.updateSoftEN==0 && !TEST_MODE)// - { - if(authString.left(5) != "39305" || authString.right(2)!=strDay.left(2) || authString.length()<7) - { - //QMessageBox::warning(this,tr("提示"),tr(+"密码不正确!"),QMessageBox::Ok); - QMessageBox::about(this, tr("提示"), tr("密码不正确!")); - return; - } - sysPara->status.updateSoftEN=1; - } - - char cmd[200]; - int res=0; - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("警告"), - tr("是否确认更新软件?"), - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); - if (ret == QMessageBox::Ok){ - QFile file("/udisk/QtUI"); - if(file.exists()) - { - - //snprintf(cmd,sizeof(cmd),"cp -f /udisk/QtUI /udisk/*.qm /home/plg/"); - system("cp -f /udisk/*.qm /home/plg/"); - -// res = system("cp -f /udisk/QtUI /home/plg/"); - - file.remove("/home/plg/QtUI"); - - if(!QFile::copy("/udisk/QtUI", "/home/plg/QtUI")) - { - QMessageBox::about(this, tr("错误"), tr("更新失败!")); - return; - } - - QString filePath = "/home/plg/logo.png"; //开机Logo - if(QFile::exists("/udisk/logo.png")){ - if(QFile::exists(filePath)) - QFile::remove(filePath); - if(QFile::copy("/udisk/logo.png", filePath)){ - QString cmd = QString("chmod 777 %1").arg(filePath); - system(cmd.toLocal8Bit().constData()); - } - } - - if(file.exists("/udisk/rcS")){ - file.remove("/etc/init.d/rcS"); - QFile::copy("/udisk/rcS", "/etc/init.d/rcS"); - } - - if(file.exists("/udisk/qt4")){ - snprintf(cmd,sizeof(cmd),"cp /udisk/qt4 /home/plg/"); - system(cmd); - snprintf(cmd,sizeof(cmd),"chmod a+x /home/plg/qt4"); - res = system(cmd); - } - - if(file.exists("/udisk/psplash")) { - system("cp /udisk/psplash /usr/bin"); - system("chmod 777 /usr/bin/psplash"); - system("sync"); - } - - snprintf(cmd,sizeof(cmd),"cp /udisk/emergency /home/plg/"); - res = system(cmd); - snprintf(cmd,sizeof(cmd),"chmod a+x /udisk/ss"); - res = system(cmd); - snprintf(cmd,sizeof(cmd),"/udisk/ss"); - res = system(cmd); - QMessageBox::information(this, tr("提示"), tr("软件更新成功,重启后生效!")); - } - else - { - QFile file("/udisk/ss"); - if(file.exists()){ - if(file.exists("/udisk/rcS")){ - snprintf(cmd,sizeof(cmd),"cp /udisk/rcS /ect/init.d/"); - system(cmd); - } - if(file.exists("/udisk/qt4")){ - snprintf(cmd,sizeof(cmd),"cp /udisk/qt4 /home/plg/"); - system(cmd); - snprintf(cmd,sizeof(cmd),"chmod a+x /home/plg/qt4"); - system(cmd); - } - snprintf(cmd,sizeof(cmd),"cp /udisk/emergency /home/plg/"); - system(cmd); - snprintf(cmd,sizeof(cmd),"chmod a+x /udisk/ss"); - system(cmd); - snprintf(cmd,sizeof(cmd),"/udisk/ss"); - system(cmd); - } - snprintf(cmd,sizeof(cmd),"sync"); //防止拷贝不成功 - system(cmd); - QMessageBox::about(this, tr("错误"), tr("找不到更新软件!")); - } - snprintf(cmd,sizeof(cmd),"sync"); //防止拷贝不成功 - system(cmd); - } -} - -void SystemManage::on_pushButtonGhost_pressed(){ - - dialogSysUpdateAuthorization->clearAuth(); - dialogSysUpdateAuthorization->show(); -} - -void SystemManage::on_dialogSysUpdateAuthorizationAccepted() -{ - QString authString= dialogSysUpdateAuthorization->getAuth(); - QString strDay; - strDay.sprintf("%02d", QDate::currentDate().day()); - - if(authString.left(5) != "39305" || authString.right(2)!=strDay.left(2) || authString.length()<7) - { - //QMessageBox::warning(this,tr("提示"),tr(+"密码不正确!"),QMessageBox::Ok); - QMessageBox::about(this, tr("提示"), tr("密码不正确!")); - return; - } - - char cmd[200]; - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("警告"), - tr("是否确认更新系统?"), - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); - if (ret == QMessageBox::Ok) - { - QFile file("/udisk/uImage_am335x"); - if(file.exists()) - { - qDebug()<<"start update..."; - snprintf(cmd,sizeof(cmd),"flash_erase /dev/mtd6 0x0 40;nandwrite -n -p -s 0 /dev/mtd6 /udisk/uImage_am335x"); - system(cmd); - QMessageBox::information(this, tr("提示"), tr("系统更新成功,重启后生效!")); - }else - { - QMessageBox::about(this, tr("提示"), tr("文件不存在!")); - } - } -} - -void SystemManage::on_pushButtonCleanUP_pressed() -{ - if(sysPara){ - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("如果开始清洗,务必确认回收槽已经打开10毫米以上,并且在一分钟后将停止清洗")); - QPushButton *cleanButton = msgBox.addButton(tr("开始清洗"), QMessageBox::ActionRole); - QPushButton *cancleCleanButton = msgBox.addButton(tr("停止清洗"), QMessageBox::ActionRole); - msgBox.addButton(QMessageBox::Cancel); - msgBox.exec(); - if (msgBox.clickedButton() == cleanButton) { - sysPara->devOp->controlCycleValve(true); - sysPara->devOp->controlViscosityPump(true); - sysPara->devOp->controlReclaimPump(false,false); - timer2->start(60000); - } else if (msgBox.clickedButton() == cancleCleanButton) { - timerHandler2(); - } - } -} - - -void SystemManage::updateSysStatusToUI(){ - ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); - - if(sysPara){ - ui->labelCompressPump->setText((sysPara->devOp->isCompressPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.PRESSURE)); - ui->labelCycleValve->setText(sysPara->devOp->isCycleValveOpen()?tr("开"):tr("关")); - ui->labelInkValve->setText(sysPara->devOp->isInkValveOpen()?tr("开"):tr("关")); - ui->pushButtonProgamFPGA->setEnabled(sysPara->status.flagOfRebootEnable || TEST_MODE); - if(!sysPara->status.isPumpValveControledByHand){ - if(sysPara->para.gearPumpEnable) - { - ui->labelMainInkPump->setText(tr("关")); - } - else - { - if(sysPara->status.ink_Ctrl == 1){ - ui->labelMainInkPump->setText(tr("关") + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); - - } - if(sysPara->status.ink_Ctrl == 0){ - ui->labelMainInkPump->setText(tr("开") + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); - - } - } - } - else{ - ui->labelMainInkPump->setText((sysPara->devOp->isMainInkPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); - - } - ui->labelMixValve->setText(sysPara->devOp->isMixValveOpen()?tr("开"):tr("关")); - ui->labelReclaimPump->setText(sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")); - ui->labelReleaseValve->setText(sysPara->devOp->isReleaseValveOpen()?tr("开"):tr("关")); - ui->labelViscosityPump->setText(sysPara->devOp->isViscosityPumpOpen()?tr("开"):tr("关")); - ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); - ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); - - ui->labViscoCnt->setText( QString::number(sysPara->status.viscosityDelayCnt/100,10) );//labViscoCnt - //ui->labViscoFaultCnt->setText( QString::number(sysPara->status.viscosityFaultCnt,10) );//labViscoCnt - - if(sysPara->para.gearPumpEnable) - { - ui->pushButtonCompressPump->setText(tr("压力")); - } - else - { - ui->pushButtonCompressPump->setText(tr("压缩机")); - } - } -} - - -void SystemManage::timerHandler(){ - if(sysPara){ - if(sysPara->status.isPumpValveControledByHand){ //进入手动模式后,延时一点再关闭相关的泵阀 - sysPara->devOp->controlCycleValve(false); - sysPara->devOp->controlReclaimPump(false,false); - timer->stop(); - } - } -} - - -void SystemManage::timerHandler2(){ - if(sysPara){ - sysPara->devOp->controlCycleValve(false); - sysPara->devOp->controlViscosityPump(false); - timer2->stop(); - } -} -static int mainInkPumpCtrlStatus = 0; -static int mainInkPumpCtrlCnt = 0; -static int cycleValveOnCountInAirPush = 0; -void SystemManage::autoCleanTimerHandler(){ - static bool cleanDone = false; - static int lastCycleValveOpen = 0; - static int mainValve = 5; - if(sysPara){ - if (sysPara->status.airPushing) { - -// if (sysPara->status.SEPTAL_POSITION > sysPara->para.septalPostion + 50) { -// sysPara->devOp->controlCycleValve(true); -// } -// else if (sysPara->status.SEPTAL_POSITION < sysPara->para.septalPostion - 50) { -// sysPara->devOp->controlCycleValve(false); -// } - ++sysPara->status.airPushingOnTime; - // 以500ms 间隔开关循环阀 - if (sysPara->status.airPushingOnTime%10 >= 5) { - sysPara->devOp->controlCycleValve(true); - } - else { - sysPara->devOp->controlCycleValve(false); - } - - - if (mainInkPumpCtrlStatus == 0) { - if(++mainInkPumpCtrlCnt>16) { //90ms 为单位, 时间到关闭 - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->mainInkCtrl(); - mainInkPumpCtrlStatus = 1; - mainInkPumpCtrlCnt = 0; - } - } - else if (mainInkPumpCtrlStatus == 1) { //90ms 为单位, 时间到开启 - sysPara->devOp->controlMainInkPump(true); - sysPara->devOp->mainInkCtrl(); - mainInkPumpCtrlStatus = 2; - } - else if (mainInkPumpCtrlStatus == 2) { - if(++mainInkPumpCtrlCnt>8) { - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->mainInkCtrl(); - mainInkPumpCtrlStatus = 3; - mainInkPumpCtrlCnt = 0; - } - } - else if (mainInkPumpCtrlStatus == 3) { - if(++mainInkPumpCtrlCnt>8) { - sysPara->devOp->controlMainInkPump(true); - sysPara->devOp->mainInkCtrl(); - mainInkPumpCtrlStatus = 4; - mainInkPumpCtrlCnt = 0; - } - } - else if (mainInkPumpCtrlStatus == 4) { - if(++mainInkPumpCtrlCnt>8) { - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->mainInkCtrl(); - mainInkPumpCtrlStatus = 3; - mainInkPumpCtrlCnt = 0; - } - } - return; - } - if(dialogAutoClean->wasCanceled()||sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_NONE) - { - if(autoCleanTimer->isActive()) - autoCleanTimer->stop(); - sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; - sysPara->status.autoCleanTime=0; - dialogAutoClean->hide(); - delete dialogAutoClean; - //sysPara->devOp->controlReclaimTankOpen(false); // 停止回收槽 - // step2 完成后进入自动模式,参考了on_pushButtonControlByHand_pressed - if(cleanDone) - { - if(timer2->isActive()) - timer2->stop(); - sysPara->status.isPumpValveControledByHand = !sysPara->status.isPumpValveControledByHand; - sysPara->status.isPumpValveControledByHand = false; - setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); - ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun - ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); - sysPara->devOp->mainInkCtrl(); - cleanDone = false; - } - qDebug()<status.autoCleanStatus; - return; - } - - //qDebug()<status.autoCleanTime; - //qDebug()<status.autoCleanStatus; - - if(sysPara->status.autoCleanStatus != AUTOCLEAN_STATUS_NONE) - { - dialogAutoClean->setValue(sysPara->status.autoCleanTime); - QCoreApplication::processEvents(); - - ++sysPara->status.autoCleanTime; - if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP1) - { - if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP1_TIME) - { - sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP2; - sysPara->status.autoCleanTime=0; - dialogAutoClean->setRange(0, AUTOCLEAN_STATUS_STEP2_TIME); - dialogAutoClean->setWindowTitle(tr("(2/3) Cleaning")); - //打开粘度泵,循环阀,墨水阀,主墨泵 - if(!sysPara->devOp->isReclaimPumpOpen()) //开供墨阀之前要判断回收泵有没有开,没开就提前打开 - { - sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 - } - sysPara->devOp->controlCycleValve(true); - sysPara->devOp->controlInkValve(true); - sysPara->devOp->controlInkValvePWM(true); - sysPara->devOp->controlMainInkPump(true); - sysPara->devOp->controlViscosityPump(true); - sysPara->devOp->mainInkCtrl(); - } - } - else if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP2) - { - if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP2_TIME) - { - sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP3; - sysPara->status.autoCleanTime=0; - - dialogAutoClean->setRange(0, (AUTOCLEAN_STATUS_STEP3_TIME-1)); - dialogAutoClean->setWindowTitle(tr("(3/3) Cleaning")); - //打开粘度泵,混合阀 - { - sysPara->devOp->controlCycleValve(false); //关循环阀,墨水阀,主墨泵 - sysPara->devOp->controlInkValve(false); - sysPara->devOp->controlInkValvePWM(false); - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->controlMixValve(true); //开混合阀 - sysPara->devOp->controlViscosityPump(true);//开粘度泵 - sysPara->devOp->mainInkCtrl(); - } - } - } - else if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP3) - { - if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP3_TIME) - { - sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_NONE; - sysPara->status.autoCleanTime=0; - cleanDone = true; - } - } - } - } -} - -void SystemManage::reclainTankTestHandler() -{ - static unsigned int waitTime = 0; - if(!sysPara) - { - return; - } - if(reclainTankTestProcess->wasCanceled()||reclainTankTestState == ReclainTankTest_eNotStart) - { - if(reclaimTankTestTimer->isActive()) - reclaimTankTestTimer->stop(); - //sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; - reclainTankTestState = ReclainTankTest_eNotStart; - reclainTankTestCount = 0; - reclainTankTestProcess->hide(); - reclainTankTestProcess->deleteLater(); - return; - } - if(reclainTankTestState == ReclainTankTest_eOpenning) { - if(sysPara->status.reclaimTankstatus == 0x05||sysPara->status.reclainTankReachEnd) { //open complete - reclainTankTestState = ReclainTankTest_eOpened; - waitTime = 4; - //qDebug()<<"ReclainTankTest_eOpened"; - } - } - else if(reclainTankTestState == ReclainTankTest_eOpened) { - if(waitTime > 0) - { - --waitTime; - return; - } - sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); - ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); - sysPara->status.reclainOpenAppending = false; - sysPara->status.reclainCloseAppending = true; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - reclainTankTestState = ReclainTankTest_eClosing; - } - else if(reclainTankTestState == ReclainTankTest_eClosing) { - if(sysPara->status.reclaimTankstatus == 0x06||sysPara->status.reclainCloseAppending==false) { //close complete - reclainTankTestState = ReclainTankTest_Closed; - } - } - else if(reclainTankTestState == ReclainTankTest_Closed) { - reclainTankTestCount++; - if(reclainTankTestCount>=RECLAIN_TANK_TEST_MAX_COUNT) { - reclainTankTestState = ReclainTankTest_eNotStart; - reclaimTankTestTimer->stop(); - reclainTankTestProcess->hide(); - reclainTankTestProcess->deleteLater(); - } - else { - reclainTankTestProcess->setWindowTitle(QString("(%1/%2) reclain tank test").arg(reclainTankTestCount).arg(RECLAIN_TANK_TEST_MAX_COUNT)); - reclainTankTestProcess->setValue(reclainTankTestCount); - sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); - ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); - sysPara->status.reclainOpenAppending = true; - sysPara->status.reclainCloseAppending = false; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - reclainTankTestState = ReclainTankTest_eOpenning; - } - } - else { - reclaimTankTestTimer->stop(); - } - -} - -void SystemManage::inkcloseCountHandler() -{ -// static uint8_t flag = true; - -// if(flag <50) -// { -// flag++; -// } - -// if(flag==10) -// { - -// sysPara->devOp->controlInkValve(true); -// }else -// if(flag == 15) -// { -// sysPara->devOp->controlInkValve(false); -// } - -// qDebug()<<"sysMana reclaimOpenCntAfterSWintOf" << sysPara->status.reclaimOpenCntAfterSWintOff; -// ui->labelReclaimPump->setText((sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.reclaimOpenCntAfterSWintOff)); - if(false == sysPara->devOp->isInkValveOpen()) - { -// qDebug()<<"Ink pump is off"; - //qDebug()<<"sysMana reclaimOpenCntAfterSWintOf" << sysPara->status.reclaimOpenCntAfterSWintOff; - if(sysPara->devOp->isReclaimPumpOpen()) - { - - sysPara->status.reclaimOpenCntAfterSWintOff++; - if(sysPara->status.reclaimOpenCntAfterSWintOff >= 60) //等待60s - { - sysPara->devOp->controlReclaimPump(false,false); // 墨线关闭一分钟后,回收阀再关闭 - sysPara->status.autoCtlReclaimAfterSWintOff = true; - } - } - }else - { -// qDebug()<<"Ink pump is open"; - sysPara->status.reclaimOpenCntAfterSWintOff = 0; - sysPara->status.autoCtlReclaimAfterSWintOff = false; - } -} -void SystemManage::MainInkCmpSepetalHandler() -{ - -// static unsigned int waitTime -// qDebug()<<"sysPara->status.SEPTAL_POSITION" << sysPara->status.SEPTAL_POSITION; - //2019/10/24 主泵由隔膜位置联动 - if(!sysPara->status.isPumpValveControledByHand) - { - if(sysPara->status.SEPTAL_POSITION >= 200) - { - if(true == sysPara->devOp->isMainInkPumpOpen()) - { - sysPara->devOp->controlMainInkPump(false); - } - }else - { - if(false == sysPara->devOp->isMainInkPumpOpen()) - { - sysPara->devOp->controlMainInkPump(true); - } - } - } -} - - -void SystemManage::on_pushButtonExportConfToUDisk_clicked() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("警告"), - tr("是否确认导出配置到U盘?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QDir dir("/udisk"); - if(!dir.exists()){ - QMessageBox::warning(this, tr("错误"), - tr("检测不到U盘")); - return; - } - system((char *)((QString("cp /home/plg/conf/sysPara.bin /udisk/")).toLatin1().data())); - QMessageBox::information(this, tr("提示"), - tr("成功导出配置到U盘")); - } -} - - -void SystemManage::on_pushButtonImportConfFromUdisk_clicked() -{ - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("警告"), - tr("是否确认从U盘导入配置?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - QFile file("/udisk/sysPara.bin"); - if(!file.exists()){ - QMessageBox::warning(this, tr("错误"), - tr("配置文件/udisk/sysPara.bin不存在!")); - return; - } - system((char *)((QString("cp /udisk/sysPara.bin /home/plg/conf/ ")).toLatin1().data())); - QMessageBox::information(this, tr("提示"), - tr("从U盘成功导入配置,重启后生效!")); - emit configChanged(); - } -} - -void SystemManage::onAutoCleanStart(void) -{ - if(sysPara){ - /* into manual control mode */ - // step 1:只开粘度泵; step 2:开粘度泵,循环阀,墨水阀,住墨泵 - //r_PumpValveControledByHand = sysPara->status.isPumpValveControledByHand; - //ui->label_status->setText(tr("正在进入手动模式......")); - //sysPara->status.isPumpValveControledByHand=true; - sysPara->devOp->highVoltageCtrl(0); //关闭高压 - sysPara->devOp->controlCompressPump(false); - sysPara->devOp->controlCycleValve(false); - sysPara->devOp->controlInkValve(false); - sysPara->devOp->controlInkValvePWM(false); - sysPara->devOp->controlMainInkPump(false); - sysPara->devOp->controlMixValve(false); - sysPara->devOp->controlReclaimPump(false,false); - sysPara->devOp->controlViscosityPump(true);//只开粘度泵 - sysPara->devOp->controlReleaseValve(false); - sysPara->devOp->mainInkCtrl(); - // 关闭回收槽 - { - sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); - ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); - sysPara->status.reclainOpenAppending = false; - sysPara->status.reclainCloseAppending = true; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - } - - sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP1; - sysPara->status.autoCleanTime = 0; - qDebug()<setWindowModality(Qt::WindowModal); - dialogAutoClean->setMinimumDuration(2); - dialogAutoClean->setCancelButtonText(tr("Cancel")); - dialogAutoClean->setWindowTitle(tr("(1/3) Cleaning")); - dialogAutoClean->setRange(0, AUTOCLEAN_STATUS_STEP1_TIME); - dialogAutoClean->setAutoClose(true); - dialogAutoClean->setAutoReset(true); - emit autoCleanStart(); - autoCleanTimer->start(1000); // 1000 ms - - dialogAutoClean->show(); - /* - if(dialogAutoClean->wasCanceled()) - { - if(autoCleanTimer->isActive()) - autoCleanTimer->stop(); - dialogAutoClean->hide(); - sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; - sysPara->status.autoCleanTime=0; - qDebug()<status.autoCleanStatus; - return; - } - */ - } - } -} - - -void SystemManage::on_pushButtonFontToUdisk_pressed() -{ - // - QMessageBox::StandardButton ret; - ret = QMessageBox::information(this, tr("警告"), - tr("是否确认导出字库到U盘?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok) - { - QFile file("/udisk"); - if(!file.exists()){ - QMessageBox::warning(this, tr("错误"), - tr("U盘不可识别!")); - return; - } - - system((char *)((QString("cp /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/* /udisk/.")).toLatin1().data())); - system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));//am335x - system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data())); - system((char *)((QString("mkdir /udisk/zk")).toLatin1().data())); -// system((char *)((QString("cp /opt/zk/* /udisk/zk/ ")).toLatin1().data())); - QMessageBox::information(this, tr("提示"), - tr("字库导出完成!")); - //emit configChanged(); - } - -} - -void SystemManage::on_pushButtonMotorTest_pressed() -{ - QMessageBox::StandardButton ret; - if(!sysPara->para.isCheckMagnet) - { - if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::warning(this, tr("警告"), - tr("请先移开喷头盖!")); - return ; - } - } - ret = QMessageBox::information(this, tr("警告"), - tr("是否开始电机测试?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - if(sysPara){ - reclainTankTestCount = 0; - reclainTankTestProcess = new QProgressDialog(this); - reclainTankTestProcess->setWindowModality(Qt::WindowModal); - reclainTankTestProcess->setMinimumDuration(2); - reclainTankTestProcess->setCancelButtonText(tr("Cancel")); - reclainTankTestProcess->setWindowTitle(QString("(%1/%2) reclain tank test").arg(reclainTankTestCount).arg(RECLAIN_TANK_TEST_MAX_COUNT)); - reclainTankTestProcess->setRange(0, RECLAIN_TANK_TEST_MAX_COUNT); - reclainTankTestProcess->setValue(reclainTankTestCount); - reclainTankTestProcess->setAutoClose(true); - reclainTankTestProcess->setAutoReset(true); - reclainTankTestProcess->show(); - - sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); - ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); - sysPara->status.reclainOpenAppending = true; - sysPara->status.reclainCloseAppending = false; - sysPara->status.currReclaimOperationCnt = 0; - sysPara->status.reclainTankReachEnd = false; - reclainTankTestState = ReclainTankTest_eOpenning; - reclaimTankTestTimer->start(1000); - } - } -} - -void SystemManage::on_pushButtonPushAir_pressed() -{ - sysPara->status.byHandStore = sysPara->status.isPumpValveControledByHand; - sysPara->status.isPumpValveControledByHand = true; - sysPara->devOp->mainInkCtrl(); - //ui->label_status->setText(tr("正在进入手动模式......")); - - sysPara->status.airPushing = 1; - sysPara->status.airPushingOnTime = 0; - cycleValveOnCountInAirPush = 0; - sysPara->devOp->controlCycleValve(true); - sysPara->devOp->controlViscosityPump(true);//关闭粘度泵 - sysPara->devOp->controlMixValve(false); - - sysPara->devOp->controlMainInkPump(true);//主墨泵敞开 - sysPara->devOp->mainInkCtrl(); - sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 - sysPara->devOp->controlInkValve(true); //墨水阀 - sysPara->devOp->controlInkValvePWM(true); //墨水阀 - mainInkPumpCtrlStatus = 0; - mainInkPumpCtrlCnt = 0; - autoCleanTimer->start(90); // 90 ms - QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), - tr("正在排气,是否停止?"), - QMessageBox::Ok); - if (ret == QMessageBox::Ok) { - autoCleanTimer->stop(); - sysPara->status.airPushing = 0; - cycleValveOnCountInAirPush = 0; - // 还原当前模式 - sysPara->devOp->controlCompressPump(false); - sysPara->devOp->controlCycleValve(false); - sysPara->devOp->controlInkValve(false); - sysPara->devOp->controlInkValvePWM(false); - if(sysPara->status.SEPTAL_POSITION >= (sysPara->para.septalPostion - 10)) - { - sysPara->devOp->controlMainInkPump(false); - } - if(sysPara->status.isPumpValveControledByHand == true) - { - sysPara->devOp->controlMainInkPump(false); //Controled by hand mode, mainInkPump need to stop - } - - sysPara->devOp->controlMixValve(false); - sysPara->devOp->controlReclaimPump(false,false); - sysPara->devOp->controlViscosityPump(false); - sysPara->devOp->controlReleaseValve(false); - sysPara->status.isPumpValveControledByHand = sysPara->status.byHandStore;// 还原到之前的模式 - sysPara->devOp->mainInkCtrl(); - - - } - -} - -void SystemManage::on_pushButtonGearPumpOff_pressed() -{ - ui->pushButtonGearPumpOff->setEnabled(false); - sysPara->para.gearPumpValue = 0; - sysPara->devOp->WriteMoterPump(); - ui->pushButtonGearPump->setEnabled(true); -} - -void SystemManage::getCurrentScrennType(){ - QFile file("/etc/init.d/qtui.sh"); - if(!file.open(QIODevice::ReadOnly)){ - qDebug()<<"open /etc/init.d/qtui.sh failed"; - LogInfo::setRunStatusText(tr("open /etc/init.d/qtui.sh failed")); -// ui->pushButtonChangeScreen->setEnabled(false); - return; - } - QTextStream in(&file); - QString str = in.readAll(); - int index = str.indexOf("event0"); - if(index != -1){ - // 电阻屏 - flagOfTouchScreenType = 0; -// ui->pushButtonChangeScreen->setText(tr("切换电容屏")); - } - else{ - //电容屏 - flagOfTouchScreenType = 1; -// ui->pushButtonChangeScreen->setText(tr("切换电阻屏")); - } - file.close(); - -} - - - -void SystemManage::on_spinBoxGearPumpValue_valueChanged(int arg1) -{ - sysPara->para.gearPumpValue = arg1; - -} - -void SystemManage::on_pushButtonProgamFPGA_clicked() -{ - emit enableClick(false); - //开一个定时器去判断回收槽回收完毕,然后进入手动模式,再关闭FPGA的通信。 - programFPGATimer->start(1000); -} - -void SystemManage::programFPGAProcess(){ - QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), - tr("确定要升级FPGA软件吗?"), - QMessageBox::Ok,QMessageBox::Cancel); - if(ret == QMessageBox::Cancel){ - programFPGATimer->stop(); - emit enableClick(true); - return; - } - if (ret == QMessageBox::Ok) { - QFile FpgaFile("/home/plg/FPGAFile.rbf"); - if(FpgaFile.exists()) - QFile::remove("/home/plg/FPGAFile.rbf"); - - QFile file("/udisk/FPGAFile.rbf"); - if(!file.exists()) - { - QMessageBox::warning(this,"提示","没有FPGA升级文件"); - programFPGATimer->stop(); - emit enableClick(true); - return; - } - QFile filepy("/udisk/upgrade_file_new.py"); - QFile::copy("/udisk/FPGAFile.rbf","/home/plg/FPGAFile.rbf"); - if(filepy.exists()){ - QFile::remove("/home/plg/upgrade_file_new.py"); - QFile::copy("/udisk/upgrade_file_new.py","/home/plg/upgrade_file_new.py"); - } - - //进入手动模式 - sysPara->status.isPumpValveControledByHand = true; - setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); - ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun - ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); - sysPara->devOp->mainInkCtrl(); - emit enableReclaimButton(!sysPara->status.isPumpValveControledByHand); - //关闭FPGA通信 - emit sigToCloseSerialFPGA(); - emit sigToCloseSerialSTM32(); - //关闭定时器 - programFPGATimer->stop(); - programFPGADialog->init(); - programFPGADialog->show(); - } -} - -void SystemManage::PowerOnSetTime(QString date){ - qDebug()<<"PowerOnTime:"<pushButton_EnvConf->setVisible(flag); -} - -void SystemManage::on_pushButton_SwitchKBD_clicked() -{ - QFile file("/home/plg/UseKBD"); - QByteArray buf; - buf.clear(); - QString keyBoardType = Public::ReadKeyBoardUse(); - if(file.open(QIODevice::WriteOnly)) { - if(keyBoardType == "Chinese") - buf.append("MultiLanguage\r\n"); - else - buf.append("Chinese\r\n"); - file.write(buf); - fsync(file.handle()); - file.close(); - }else{ - QMessageBox::warning(this,tr("提示"),tr("切换失败!")); - return; - } - - QMessageBox::information(this,tr("提示"),tr("切换成功,重启后生效!")); -} - -void SystemManage::loadKeyBoardType(){ - QString keyBoardType = Public::ReadKeyBoardUse(); - if(keyBoardType == "MultiLanguage") - sysPara->status.flagOfKeyBoardType = true; - else - sysPara->status.flagOfKeyBoardType = false; - -} - -void SystemManage::on_pushButton_UpgradeSTM32_clicked() -{ - int cnt = hasSingleStm32Bin("/udisk"); - if(cnt == 0){ - QMessageBox::warning(this,tr("提示"),tr("找不到软件!")); - return; - } - else if(cnt > 1){ - QMessageBox::warning(this,tr("提示"),tr("找到多个软件,请删除多余的文件,只保留一个!")); - return; - } - - QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), - tr("确定要升级单片机软件吗?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok) { - emit enableClick(false); - sysPara->status.isPumpValveControledByHand = true; - emit upgradeSTM32(fileName); - } -} - -void SystemManage::progressBarControl(int value,int show){ - if(show == 1){ - progressBar.setWindowFlags(Qt::WindowStaysOnTopHint); - progressBar.show(); - progressBar.setValue(value); - } - else if(show == 0){ - emit enableClick(true); - progressBar.hide(); - QMessageBox::warning(this,tr("提示"),tr("升级成功,请重启QtUI!")); - } - else{ - emit enableClick(true); - progressBar.hide(); - QMessageBox::warning(this,tr("提示"),tr("升级失败!")); - } -} - - -/** - * 判断 /udisk 目录下是否存在并且只有一个以 VET6_ 开头、.bin 结尾的文件 - * 返回 true 表示满足"存在且仅有一个",否则返回 false - * 如果还需要拿到这个文件名,可把 fileName 通过最后一个参数带回 - */ -int SystemManage::hasSingleStm32Bin(const QString &dirPath) -{ - QDirIterator it(dirPath, - QStringList() << "VET6_*.bin", // 通配符过滤 - QDir::Files, - QDirIterator::NoIteratorFlags); - - int cnt = 0; - QString found; - while (it.hasNext()) { - it.next(); // 迭代到下一个匹配文件 - ++cnt; - found = it.fileName(); // 只保留文件名,不含路径 - if (cnt > 1) // 已经发现第二个,提前结束 - break; - } - - if (cnt == 1) - fileName = found; - - return cnt; // 仅当数量为 1 时返回 true -} +#include "SystemManage.h" +#include "ui_systemmanage.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SysPara.h" +#include "DevOp.h" +#include "myinclude.h" +#include "Public.h" +#include "dlginputaddr.h" +#include "qprogressdialog.h" +#include "LogInfo.h" +#include +#include +#include + +#define RECLAIN_TANK_TEST_MAX_COUNT 10 +enum ReclainTankTestEnum{ + ReclainTankTest_eNotStart, + ReclainTankTest_eOpenning, + ReclainTankTest_eOpened, + ReclainTankTest_eClosing, + ReclainTankTest_Closed +}; +SystemManage::SystemManage(QWidget *parent) : + QWidget(parent), + ui(new Ui::SystemManage),timeDia(0) +{ + ui->setupUi(this); + timeDia.hide(); + setPumpValveBottonEnable(false); + ui->pushButtonCompressPump->setEnabled(false); + ui->pushButtonMainInkPump->setEnabled(false); + ui->pushButtonReleaseValve->setEnabled(false); + ui->pushButtonReclaimPump->setEnabled(false); + ui->pushButtonGearPump->setEnabled(true); + ui->pushButtonGearPumpOff->setEnabled(true); + ui->labelControlByHand->setText("手动"); + + ui->pushButtonPushAir->setEnabled(true); //2019-10-23 排气按钮始终使能 by kun + timer = new QTimer(); + connect(timer, SIGNAL(timeout()), this, SLOT(timerHandler())); + timer2 = new QTimer(); + connect(timer2, SIGNAL(timeout()), this, SLOT(timerHandler2())); + autoCleanTimer = new QTimer(); + connect(autoCleanTimer, SIGNAL(timeout()), this, SLOT(autoCleanTimerHandler())); + connect(this,SIGNAL(autoCleanStart(void)),this,SLOT(onAutoCleanStart(void))); + + reclaimTankTestTimer = new QTimer(); + connect(reclaimTankTestTimer, SIGNAL(timeout()), this, SLOT(reclainTankTestHandler())); + + + //烧录FPGA所写 + programFPGATimer = new QTimer(); + connect(programFPGATimer, SIGNAL(timeout()), this, SLOT(programFPGAProcess())); + programFPGADialog = new UpdateFPGA("/home/plg/upgrade_file_new.py"); + connect(programFPGADialog,SIGNAL(upgradeFPGAFinished(bool)),this,SIGNAL(restartSerial(bool))); + connect(programFPGADialog,SIGNAL(upgradeFPGAFinished(bool)),this,SIGNAL(enableClick(bool))); + //---------------------------------------------------------------------------------- + + +/***2019/10/22 start*****/ + inkcloseCountTimer = new QTimer(); + connect(inkcloseCountTimer, SIGNAL(timeout()), this, SLOT(inkcloseCountHandler())); + inkcloseCountTimer->start(1000); +/****2019/10/22 end****/ + +/***2019/10/23 start*****/ + MainnkCmpSepetalTimer = new QTimer(); + connect(MainnkCmpSepetalTimer, SIGNAL(timeout()), this, SLOT(MainInkCmpSepetalHandler())); +/***2019/10/23 *****/ + + dialogUpateMm =new DialogAuthorization; + connect(dialogUpateMm,SIGNAL(accepted()),this,SLOT(ondialogAuthorizationAccepted())); + + dialogTimeSetAuthorization = new DialogAuthorization; + connect(dialogTimeSetAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogTimeSetAuthorizationAccepted())); + + dialogSysUpdateAuthorization = new DialogAuthorization; + connect(dialogSysUpdateAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogSysUpdateAuthorizationAccepted())); + dialogFactorySetAuthorization = new DialogAuthorization; + connect(dialogFactorySetAuthorization,SIGNAL(accepted()),this,SLOT(on_dialogFactorySetAuthorizationAccepted())); + dlgInputAddr_TimeSet = new DlgInputAddr(parent); + dlgInputAddr_TimeSet->GetAddr(); + dlgInputAddr_TimeSet->vpnConnect(); + dlgInputAddr_TimeSet->hide(); + + connect(ui->spinBoxGearPumpValue,SIGNAL(valueChanged(int)),this,SLOT(updateGearPumpValue(int))); + ui->pushButtonExportConfToUDisk->setDisabled(true); + ui->pushButtonImportConfFromUdisk->setDisabled(true); +// ui->pushButtonFactorySetting->setDisabled(true); + ui->labelControlByHand->setText(tr("自动")); +// ui->pushButtonMotorTest->hide(); + getCurrentScrennType(); + + ui->pushButton_EnvConf->setVisible(false); +} + +void SystemManage::bindDlgInputAddr(DlgInputAddr *dlgInputAddr) +{ + dlgInputAddr_TimeSet = dlgInputAddr; + dlgInputAddr_TimeSet->GetAddr(); + dlgInputAddr_TimeSet->vpnConnect(); + dlgInputAddr_TimeSet->hide(); +} + +SystemManage::~SystemManage() +{ + delete ui; + delete timer2; + delete timer; + delete autoCleanTimer; + /***2019/10/22 start*****/ + delete inkcloseCountTimer; + /****2019/10/22 end****/ + + /***2019/10/23 start*****/ + delete MainnkCmpSepetalTimer; + + if(programFPGADialog) { + delete programFPGADialog; + programFPGADialog = nullptr; + } + +} + +void SystemManage::on_pushButtonReleaseValve_pressed() +{ + if(sysPara){ + sysPara->devOp->controlReleaseValve(!sysPara->devOp->isReleaseValveOpen()); + ui->labelCompressPump->setText(sysPara->devOp->isReleaseValveOpen()?tr("开"):tr("关")); + sysPara->devOp->pumpValveCtrl(); + } +} +void SystemManage::on_pushButtonCompressPump_pressed() +{ + if(sysPara){ + sysPara->devOp->controlCompressPump(!sysPara->devOp->isCompressPumpOpen()); + ui->labelCompressPump->setText(sysPara->devOp->isCompressPumpOpen()?tr("开"):tr("关")); + } +} + +void SystemManage::on_pushButtonCycleValve_pressed() +{ + if(sysPara){ + sysPara->devOp->controlCycleValve(!sysPara->devOp->isCycleValveOpen()); + ui->labelCycleValve->setText(sysPara->devOp->isCycleValveOpen()?tr("开"):tr("关")); + } +} + +void SystemManage::updateGearPumpValue(int) +{ + if(sysPara->status.isPumpValveControledByHand) + { + if(sysPara->para.gearPumpEnable) + { + ui->pushButtonGearPump->setEnabled(true); + } + } +} + +void SystemManage::on_pushButtonGearPump_pressed() +{ + ui->pushButtonGearPump->setEnabled(false); + sysPara->para.gearPumpValue = ui->spinBoxGearPumpValue->value(); + sysPara->devOp->WriteMoterPump(); + ui->pushButtonGearPumpOff->setEnabled(true); +} + +void SystemManage::on_pushButtonInkValve_pressed() +{ + if(sysPara){ + //2019/10/22 + //2019/11/20 + //开供墨阀之前要判断回收泵有没有开,没开就提前打开;手动模式下,不需要提前开回收泵 + if((!sysPara->devOp->isInkValveOpen()) && (!sysPara->devOp->isReclaimPumpOpen()) && (!sysPara->status.isPumpValveControledByHand)) + { + sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 + } + sysPara->devOp->controlInkValve(!sysPara->devOp->isInkValveOpen()); + sysPara->devOp->controlInkValvePWM(!sysPara->devOp->isInkValveOpen1()); + ui->labelInkValve->setText(sysPara->devOp->isInkValveOpen1()?tr("开"):tr("关")); + } +} + +void SystemManage::on_pushButtonMainInkPump_pressed() +{ + if(sysPara){ + sysPara->devOp->controlMainInkPump(!sysPara->devOp->isMainInkPumpOpen()); + ui->labelMainInkPump->setText(sysPara->devOp->isMainInkPumpOpen()?tr("开"):tr("关")); + sysPara->devOp->mainInkCtrl(); + } +} + +void SystemManage::on_pushButtonMixValve_pressed() +{ + if(sysPara){ + sysPara->devOp->controlMixValve(!sysPara->devOp->isMixValveOpen()); + ui->labelMixValve->setText(sysPara->devOp->isMixValveOpen()?tr("开"):tr("关")); + } +} + +void SystemManage::on_pushButtonReclaimPump_pressed() +{ + if(sysPara){ + sysPara->devOp->controlReclaimPump(!sysPara->devOp->isReclaimPumpOpen(),false); + ui->labelReclaimPump->setText(sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")); + } +} + +void SystemManage::on_pushButtonViscosityPump_pressed() +{ + if(sysPara){ + sysPara->devOp->controlViscosityPump(!sysPara->devOp->isViscosityPumpOpen()); + ui->labelViscosityPump->setText(sysPara->devOp->isViscosityPumpOpen()?tr("开"):tr("关")); + } +} + + +void SystemManage::setPumpValveBottonEnable(bool enable){ + if(sysPara) + { + if(sysPara->para.gearPumpEnable) + { + ui->pushButtonCompressPump->setEnabled(false); + ui->pushButtonMainInkPump->setEnabled(false); + ui->pushButtonReleaseValve->setEnabled(false); + ui->pushButtonReclaimPump->setEnabled(enable); + } + else + { + ui->pushButtonCompressPump->setEnabled(enable); + ui->pushButtonMainInkPump->setEnabled(enable); + ui->pushButtonReleaseValve->setEnabled(enable); + ui->pushButtonReclaimPump->setEnabled(enable); + } + } + ui->pushButtonCycleValve->setEnabled(enable); + ui->pushButtonInkValve->setEnabled(enable); + + ui->pushButtonMixValve->setEnabled(enable); + + //ui->pushButtonReclaimTankClose->setEnabled(enable); + //ui->pushButtonReclaimTankOpen->setEnabled(enable); + + ui->pushButtonViscosityPump->setEnabled(enable); + //ui->pushButtonCleanUP->setEnabled(enable); + ui->pushButtonAutoClean->setEnabled(enable); +// ui->pushButtonMotorTest->setEnabled(enable); + ui->pushButtonPushAir->setEnabled(enable); + if(sysPara) + { + if(sysPara->para.gearPumpEnable) + { + ui->pushButtonGearPump->setEnabled(enable); + ui->pushButtonGearPumpOff->setEnabled(enable); + } + else + { + ui->pushButtonGearPump->setEnabled(false); + ui->pushButtonGearPumpOff->setEnabled(false); + } + if(enable) + { + sysPara->para.gearPumpValue = 0; + sysPara->devOp->WriteMoterPump(); + } + else + { + sysPara->para.gearPumpValue = 300; + sysPara->devOp->WriteMoterPump(); + } + } + + if(enable){ + if(sysPara){ + sysPara->devOp->controlCompressPump(false); + sysPara->devOp->controlCycleValve(true); + sysPara->devOp->controlInkValve(false); + sysPara->devOp->controlInkValvePWM(false); + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->controlMixValve(false); + sysPara->devOp->controlReclaimPump(true,true); + sysPara->devOp->controlViscosityPump(false); + sysPara->devOp->controlReleaseValve(false); + timer->start(2000); + } + } + +} + + +void SystemManage::on_pushButtonControlByHand_pressed() +{ + if(sysPara){ + if(!sysPara->status.isPumpValveControledByHand){ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("警告"), + tr("是否确认进入手动模式?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret != QMessageBox::Ok){ + return; + }else + { + qDebug()<<"进入手动模式"; + //qDebug()<<"disable inkcloseCountTimer"; + if(inkcloseCountTimer->isActive()) inkcloseCountTimer->stop(); + } + } + else { + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("警告"), + tr("请先确认已经关闭回收槽,确认进入自动模式?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret != QMessageBox::Ok){ + + return; + }else + { + qDebug()<<"进入自动模式"; + // qDebug()<<"active inkcloseCountTimer"; + inkcloseCountTimer->start(1000); + } + } + if(timer2->isActive()) + timer2->stop(); + sysPara->status.isPumpValveControledByHand = !sysPara->status.isPumpValveControledByHand; + setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); + ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun + ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); + sysPara->devOp->mainInkCtrl(); + emit enableReclaimButton(!sysPara->status.isPumpValveControledByHand); + qDebug()<<"isPumpValveControledByHand:"<status.isPumpValveControledByHand; + qDebug()<<"手动控制泵阀"; + } +} + +void SystemManage::on_pushButtonReclaimTankOpen_pressed() +{ + if(sysPara){ + if(!sysPara->para.isCheckMagnet) + { + if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ + QMessageBox::warning(this, tr("警告"), + tr("请先移开喷头盖!")); + return ; + } + } + sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); + ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); + sysPara->devOp->highVoltageCtrl(0); + sysPara->status.reclainOpenAppending = true; + sysPara->status.reclainCloseAppending = false; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + } +} + +void SystemManage::on_pushButtonReclaimTankClose_pressed() +{ + if(sysPara){ + if(!sysPara->para.isCheckMagnet) + { + if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ + QMessageBox::warning(this, tr("警告"), + tr("请先移开喷头盖!")); + return ; + } + } + sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); + ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); + sysPara->devOp->highVoltageCtrl(0); + sysPara->status.reclainOpenAppending = false; + sysPara->status.reclainCloseAppending = true; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + } +} +#include +void adjustdate(int year, int mon, int mday, int hour, int min, int sec) { + time_t t; + struct tm nowtime; + nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) + nowtime.tm_min = min; // Minutes.[0-59] + nowtime.tm_hour = hour; // Hours. [0-23] + nowtime.tm_mday = mday; // Day.[1-31] + nowtime.tm_mon = mon - 1; // Month. [0-11] + nowtime.tm_year = year - 1900; // Year- 1900. + nowtime.tm_isdst = -1; // DST.[-1/0/1] + t = mktime(&nowtime); + +#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 31)) + struct timespec ts; + ts.tv_sec = t; + ts.tv_nsec = 0; + auto ret = clock_settime(CLOCK_REALTIME, &ts); + if(ret != 0){ + qWarning() <<"clock_settime error : " << ret; + qWarning() << "Reason: " << QString(strerror(errno)); + } + else { + qInfo() << "Successed to set system time"; + } +#else + stime(&t); // 仅用于 glibc < 2.31 +#endif + +} + +void SystemManage::on_dialogTimeSetAuthorizationAccepted() +{ + QString authString= dialogTimeSetAuthorization->getAuth(); + qDebug()<<"authString"<checWhJmDate(authString)) // 0xa001 + { + QTime tm = QTime::currentTime(); + QDate date = QDate::currentDate(); + timeDia.setYear(date.year()); + timeDia.setMonth(date.month()); + timeDia.setDay(date.day()); + timeDia.setHour(tm.hour()); + timeDia.setMinute(tm.minute()); + timeDia.setSecond(tm.second()); + timeDia.hide(); + timeDia.show(); + connect(&timeDia,SIGNAL(accepted()),this,SLOT(onTimeSettingDone())); + }else + { + QMessageBox::about(this, tr("提示"), tr("密码不正确!")); + return; + } + +} + +void SystemManage::on_pushButtonTimeSetting_clicked() +{ +// dialogTimeSetAuthorization->clearAuth(); +// dialogTimeSetAuthorization->show(); + + QTime tm = QTime::currentTime(); + QDate date = QDate::currentDate(); + timeDia.setYear(date.year()); + timeDia.setMonth(date.month()); + timeDia.setDay(date.day()); + timeDia.setHour(tm.hour()); + timeDia.setMinute(tm.minute()); + timeDia.setSecond(tm.second()); + timeDia.hide(); + timeDia.show(); + connect(&timeDia,SIGNAL(accepted()),this,SLOT(onTimeSettingDone())); + +} + +uint8_t datatime[8] = {}; +void SystemManage::onTimeSettingDone(){ + adjustdate(timeDia.getYear(), timeDia.getMonth(), timeDia.getDay(), timeDia.getHour(), timeDia.getMinute(), timeDia.getSecond()); + qDebug()<<"onTimeSettingDone"; + + QDate date(timeDia.getYear(), timeDia.getMonth(), timeDia.getDay()); + int dayOfWeek = date.dayOfWeek(); + QString YearStr = QString::number(timeDia.getYear()); + int Year1 = YearStr.mid(0,2).toInt(); + int Year2 = YearStr.mid(2,2).toInt(); + uint8_t year1 = Year1; + datatime[0] = year1; + uint8_t year2 = Year2; + datatime[1] = year2; + uint8_t month = timeDia.getMonth(); + datatime[2] = month; + uint8_t day = timeDia.getDay(); + datatime[3] = day; + uint8_t week= dayOfWeek; + datatime[4] = week; + uint8_t hour = timeDia.getHour(); + datatime[5] = hour; + uint8_t minute= timeDia.getMinute(); + datatime[6] = minute; + uint8_t second= timeDia.getSecond(); + datatime[7] = second; + + for(int i=0;i<8;i++){ + qDebug()<<"datatime "<devOp->stm32Wr(0xA1,(unsigned char *)datatime,8); + +// qDebug() << "time setting done!"; +// QString authString= dialogTimeSetAuthorization->getAuth(); +// dlgInputAddr_TimeSet->checWhJmDate(authString); //再执行一次,不然时间改不过来 +} + + +void SystemManage::on_pushButtonUpdateCharLib_pressed() +{ + char cmd[500]; + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("Application"), + tr("是否确认更新字库?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ +// QDir dirFont("/usr/lib/fonts/"); +// if(!dirFont.exists()) +// { +// system("mkdir -p /usr/lib/fonts/"); +// } + + snprintf(cmd,sizeof(cmd),"cp /udisk/*.bdf /udisk/*.ttf /usr/lib/fonts/"); + system(cmd); + + snprintf(cmd,sizeof(cmd),"chmod a+r /usr/lib/fonts/*.bdf"); + system(cmd); + + system("sync"); + + QDir dir("/udisk/"); + QStringList filter; + filter<<"*.bdf"<<"*.ttf"; + QFileInfoList infolist = dir.entryInfoList(filter); + if(infolist.isEmpty()) + { + infolist.clear(); + QMessageBox::information(this, tr("提示"), tr("没找到对应字库,更新失败!")); + } + else + { + QMessageBox::information(this, tr("提示"), + tr("更新字库成功,重启后生效!")); + } + } +} + +void SystemManage::on_pushButtonFactorySetting_pressed() +{ + dialogFactorySetAuthorization->clearAuth(); + dialogFactorySetAuthorization->show(); +} + +void SystemManage::on_dialogFactorySetAuthorizationAccepted() +{ + QString authString= dialogFactorySetAuthorization->getAuth(); + qDebug()<<"authString"<checWhJmDate(authString)) + { + sysPara->loadDefaultPara(); + sysPara->saveParaToFile(); + QMessageBox::information(this,"提示",tr("恢复出厂设置成功,请重新关机上电")); + } + else + { + QMessageBox::about(this, tr("提示"), tr("密码不正确!")); + return; + } +} + +void SystemManage::on_pushButtonScreenAdjust_pressed() +{ + QMessageBox::StandardButton ret; +ret = QMessageBox::information(NULL,tr("校准触摸屏"), tr("是否确认开始校准程序?请小心进行校准!"), + QMessageBox::Ok | QMessageBox::Cancel); +char buf [] = +"#!/bin/sh\n\ +TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent \n\ +TS_INFO_FILE1=/sys/class/input/input0/uevent \n\ +if [ -e $TS_INFO_FILE -a \"/bin/grep -q TouchScreen < $TS_INFO_FILE\" ]; then \n\ +export TSLIB_TSDEVICE=/dev/input/event0 \n\ +export TSLIB_CONFFILE=/usr/local/etc/ts.conf \n\ +export TSLIB_PLUGINDIR=/usr/local/lib/ts \n\ +export TSLIB_CALIBFILE=/etc/pointercal \n\ +export LD_LIBRARY_PATH=/usr/local/lib \n\ +export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin \n\ +export QWS_DISPLAY=:1 \n\ +export QWS_MOUSE_PROTO=\"Tslib:/dev/input/event0 MouseMan:/dev/input/mice\" \n\ +\#rm -f /etc/pointercal \n\ +\#if [ ! -s /etc/pointercal ] ; then \n\ + /usr/local/bin/ts_calibrate \n\ +\#fi \n\ +else \n\ +TS_INFO_FILE1=/sys/class/input/input0/uevent \n\ +if [ -e $TS_INFO_FILE1 -a \"/bin/grep -q tsc < $TS_INFO_FILE1\" ]; then \n\ + export QWS_MOUSE_PROTO=\"Tslib:/dev/input/event0 MouseMan:/dev/input/mice\" \n\ + /usr/local/bin/ts_calibrate \n\ +else \n\ + export QWS_MOUSE_PROTO=\"MouseMan:/dev/input/mice\" \n\ +fi \n\ +fi\n" ; + // QFile file("./calibrate"); +// ui->pushButtonFactorySetting->setEnabled(0); +// ui->pushButtonGhost->setEnabled(0); + ui->pushButtonImportConfFromUdisk->setEnabled(0); + ui->pushButtonExportConfToUDisk->setEnabled(0); + ui->pushButtonTimeSetting->setEnabled(0); +// ui->pushButtonScreenAdjust->setEnabled(0); + ui->pushButtonUpdateCharLib->setEnabled(0); + ui->pushButtonUpdateSoftware->setEnabled(0); + ui->pushButtonReclaimTankOpen->setEnabled(0); + ui->pushButtonReclaimTankClose->setEnabled(0); + ui->pushButtonControlByHand->setEnabled(0); + + + if (ret == QMessageBox::Ok){ + system("chmod a+x ./calibrate"); + system("./calibrate &"); + } + +// ui->pushButtonFactorySetting->setEnabled(1); +// ui->pushButtonGhost->setEnabled(1); + ui->pushButtonImportConfFromUdisk->setEnabled(1); + ui->pushButtonExportConfToUDisk->setEnabled(1); + ui->pushButtonTimeSetting->setEnabled(1); +// ui->pushButtonScreenAdjust->setEnabled(1); + ui->pushButtonUpdateCharLib->setEnabled(1); + ui->pushButtonUpdateSoftware->setEnabled(1); + ui->pushButtonReclaimTankOpen->setEnabled(1); + ui->pushButtonReclaimTankClose->setEnabled(1); + ui->pushButtonControlByHand->setEnabled(1); +} + +void SystemManage::on_pushButtonUpdateSoftware_pressed() +{ + if(sysPara->status.updateSoftEN==0){ + dialogUpateMm->clearAuth(); + dialogUpateMm->show(); + } + else ondialogAuthorizationAccepted(); +} +void SystemManage::ondialogAuthorizationAccepted() + { + QString authString= dialogUpateMm->getAuth(); + QString strDay; + strDay.sprintf("%02d", QDate::currentDate().day()); + if(sysPara->status.updateSoftEN==0 && !TEST_MODE)// + { + if(authString.left(5) != "39305" || authString.right(2)!=strDay.left(2) || authString.length()<7) + { + //QMessageBox::warning(this,tr("提示"),tr(+"密码不正确!"),QMessageBox::Ok); + QMessageBox::about(this, tr("提示"), tr("密码不正确!")); + return; + } + sysPara->status.updateSoftEN=1; + } + + char cmd[200]; + int res=0; + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("警告"), + tr("是否确认更新软件?"), + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); + if (ret == QMessageBox::Ok){ + QFile file("/udisk/QtUI"); + if(file.exists()) + { + + //snprintf(cmd,sizeof(cmd),"cp -f /udisk/QtUI /udisk/*.qm /home/plg/"); + system("cp -f /udisk/*.qm /home/plg/"); + +// res = system("cp -f /udisk/QtUI /home/plg/"); + + file.remove("/home/plg/QtUI"); + + if(!QFile::copy("/udisk/QtUI", "/home/plg/QtUI")) + { + QMessageBox::about(this, tr("错误"), tr("更新失败!")); + return; + } + + QString filePath = "/home/plg/logo.png"; //开机Logo + if(QFile::exists("/udisk/logo.png")){ + if(QFile::exists(filePath)) + QFile::remove(filePath); + if(QFile::copy("/udisk/logo.png", filePath)){ + QString cmd = QString("chmod 777 %1").arg(filePath); + system(cmd.toLocal8Bit().constData()); + } + } + + if(file.exists("/udisk/rcS")){ + file.remove("/etc/init.d/rcS"); + QFile::copy("/udisk/rcS", "/etc/init.d/rcS"); + } + + if(file.exists("/udisk/qt4")){ + snprintf(cmd,sizeof(cmd),"cp /udisk/qt4 /home/plg/"); + system(cmd); + snprintf(cmd,sizeof(cmd),"chmod a+x /home/plg/qt4"); + res = system(cmd); + } + + if(file.exists("/udisk/psplash")) { + system("cp /udisk/psplash /usr/bin"); + system("chmod 777 /usr/bin/psplash"); + system("sync"); + } + + snprintf(cmd,sizeof(cmd),"cp /udisk/emergency /home/plg/"); + res = system(cmd); + snprintf(cmd,sizeof(cmd),"chmod a+x /udisk/ss"); + res = system(cmd); + snprintf(cmd,sizeof(cmd),"/udisk/ss"); + res = system(cmd); + QMessageBox::information(this, tr("提示"), tr("软件更新成功,重启后生效!")); + } + else + { + QFile file("/udisk/ss"); + if(file.exists()){ + if(file.exists("/udisk/rcS")){ + snprintf(cmd,sizeof(cmd),"cp /udisk/rcS /ect/init.d/"); + system(cmd); + } + if(file.exists("/udisk/qt4")){ + snprintf(cmd,sizeof(cmd),"cp /udisk/qt4 /home/plg/"); + system(cmd); + snprintf(cmd,sizeof(cmd),"chmod a+x /home/plg/qt4"); + system(cmd); + } + snprintf(cmd,sizeof(cmd),"cp /udisk/emergency /home/plg/"); + system(cmd); + snprintf(cmd,sizeof(cmd),"chmod a+x /udisk/ss"); + system(cmd); + snprintf(cmd,sizeof(cmd),"/udisk/ss"); + system(cmd); + } + snprintf(cmd,sizeof(cmd),"sync"); //防止拷贝不成功 + system(cmd); + QMessageBox::about(this, tr("错误"), tr("找不到更新软件!")); + } + snprintf(cmd,sizeof(cmd),"sync"); //防止拷贝不成功 + system(cmd); + } +} + +void SystemManage::on_pushButtonGhost_pressed(){ + + dialogSysUpdateAuthorization->clearAuth(); + dialogSysUpdateAuthorization->show(); +} + +void SystemManage::on_dialogSysUpdateAuthorizationAccepted() +{ + QString authString= dialogSysUpdateAuthorization->getAuth(); + QString strDay; + strDay.sprintf("%02d", QDate::currentDate().day()); + + if(authString.left(5) != "39305" || authString.right(2)!=strDay.left(2) || authString.length()<7) + { + //QMessageBox::warning(this,tr("提示"),tr(+"密码不正确!"),QMessageBox::Ok); + QMessageBox::about(this, tr("提示"), tr("密码不正确!")); + return; + } + + char cmd[200]; + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("警告"), + tr("是否确认更新系统?"), + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); + if (ret == QMessageBox::Ok) + { + QFile file("/udisk/uImage_am335x"); + if(file.exists()) + { + qDebug()<<"start update..."; + snprintf(cmd,sizeof(cmd),"flash_erase /dev/mtd6 0x0 40;nandwrite -n -p -s 0 /dev/mtd6 /udisk/uImage_am335x"); + system(cmd); + QMessageBox::information(this, tr("提示"), tr("系统更新成功,重启后生效!")); + }else + { + QMessageBox::about(this, tr("提示"), tr("文件不存在!")); + } + } +} + +void SystemManage::on_pushButtonCleanUP_pressed() +{ + if(sysPara){ + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("如果开始清洗,务必确认回收槽已经打开10毫米以上,并且在一分钟后将停止清洗")); + QPushButton *cleanButton = msgBox.addButton(tr("开始清洗"), QMessageBox::ActionRole); + QPushButton *cancleCleanButton = msgBox.addButton(tr("停止清洗"), QMessageBox::ActionRole); + msgBox.addButton(QMessageBox::Cancel); + msgBox.exec(); + if (msgBox.clickedButton() == cleanButton) { + sysPara->devOp->controlCycleValve(true); + sysPara->devOp->controlViscosityPump(true); + sysPara->devOp->controlReclaimPump(false,false); + timer2->start(60000); + } else if (msgBox.clickedButton() == cancleCleanButton) { + timerHandler2(); + } + } +} + + +void SystemManage::updateSysStatusToUI(){ + ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); + + if(sysPara){ + ui->labelCompressPump->setText((sysPara->devOp->isCompressPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.PRESSURE)); + ui->labelCycleValve->setText(sysPara->devOp->isCycleValveOpen()?tr("开"):tr("关")); + ui->labelInkValve->setText(sysPara->devOp->isInkValveOpen()?tr("开"):tr("关")); + ui->pushButtonProgamFPGA->setEnabled(sysPara->status.flagOfRebootEnable || TEST_MODE); + if(!sysPara->status.isPumpValveControledByHand){ + if(sysPara->para.gearPumpEnable) + { + ui->labelMainInkPump->setText(tr("关")); + } + else + { + if(sysPara->status.ink_Ctrl == 1){ + ui->labelMainInkPump->setText(tr("关") + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); + + } + if(sysPara->status.ink_Ctrl == 0){ + ui->labelMainInkPump->setText(tr("开") + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); + + } + } + } + else{ + ui->labelMainInkPump->setText((sysPara->devOp->isMainInkPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.SEPTAL_POSITION)); + + } + ui->labelMixValve->setText(sysPara->devOp->isMixValveOpen()?tr("开"):tr("关")); + ui->labelReclaimPump->setText(sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")); + ui->labelReleaseValve->setText(sysPara->devOp->isReleaseValveOpen()?tr("开"):tr("关")); + ui->labelViscosityPump->setText(sysPara->devOp->isViscosityPumpOpen()?tr("开"):tr("关")); + ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); + ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); + + ui->labViscoCnt->setText( QString::number(sysPara->status.viscosityDelayCnt/100,10) );//labViscoCnt + //ui->labViscoFaultCnt->setText( QString::number(sysPara->status.viscosityFaultCnt,10) );//labViscoCnt + + if(sysPara->para.gearPumpEnable) + { + ui->pushButtonCompressPump->setText(tr("压力")); + } + else + { + ui->pushButtonCompressPump->setText(tr("压缩机")); + } + } +} + + +void SystemManage::timerHandler(){ + if(sysPara){ + if(sysPara->status.isPumpValveControledByHand){ //进入手动模式后,延时一点再关闭相关的泵阀 + sysPara->devOp->controlCycleValve(false); + sysPara->devOp->controlReclaimPump(false,false); + timer->stop(); + } + } +} + + +void SystemManage::timerHandler2(){ + if(sysPara){ + sysPara->devOp->controlCycleValve(false); + sysPara->devOp->controlViscosityPump(false); + timer2->stop(); + } +} +static int mainInkPumpCtrlStatus = 0; +static int mainInkPumpCtrlCnt = 0; +static int cycleValveOnCountInAirPush = 0; +void SystemManage::autoCleanTimerHandler(){ + static bool cleanDone = false; + static int lastCycleValveOpen = 0; + static int mainValve = 5; + if(sysPara){ + if (sysPara->status.airPushing) { + +// if (sysPara->status.SEPTAL_POSITION > sysPara->para.septalPostion + 50) { +// sysPara->devOp->controlCycleValve(true); +// } +// else if (sysPara->status.SEPTAL_POSITION < sysPara->para.septalPostion - 50) { +// sysPara->devOp->controlCycleValve(false); +// } + ++sysPara->status.airPushingOnTime; + // 以500ms 间隔开关循环阀 + if (sysPara->status.airPushingOnTime%10 >= 5) { + sysPara->devOp->controlCycleValve(true); + } + else { + sysPara->devOp->controlCycleValve(false); + } + + + if (mainInkPumpCtrlStatus == 0) { + if(++mainInkPumpCtrlCnt>16) { //90ms 为单位, 时间到关闭 + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->mainInkCtrl(); + mainInkPumpCtrlStatus = 1; + mainInkPumpCtrlCnt = 0; + } + } + else if (mainInkPumpCtrlStatus == 1) { //90ms 为单位, 时间到开启 + sysPara->devOp->controlMainInkPump(true); + sysPara->devOp->mainInkCtrl(); + mainInkPumpCtrlStatus = 2; + } + else if (mainInkPumpCtrlStatus == 2) { + if(++mainInkPumpCtrlCnt>8) { + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->mainInkCtrl(); + mainInkPumpCtrlStatus = 3; + mainInkPumpCtrlCnt = 0; + } + } + else if (mainInkPumpCtrlStatus == 3) { + if(++mainInkPumpCtrlCnt>8) { + sysPara->devOp->controlMainInkPump(true); + sysPara->devOp->mainInkCtrl(); + mainInkPumpCtrlStatus = 4; + mainInkPumpCtrlCnt = 0; + } + } + else if (mainInkPumpCtrlStatus == 4) { + if(++mainInkPumpCtrlCnt>8) { + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->mainInkCtrl(); + mainInkPumpCtrlStatus = 3; + mainInkPumpCtrlCnt = 0; + } + } + return; + } + if(dialogAutoClean->wasCanceled()||sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_NONE) + { + if(autoCleanTimer->isActive()) + autoCleanTimer->stop(); + sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; + sysPara->status.autoCleanTime=0; + dialogAutoClean->hide(); + delete dialogAutoClean; + //sysPara->devOp->controlReclaimTankOpen(false); // 停止回收槽 + // step2 完成后进入自动模式,参考了on_pushButtonControlByHand_pressed + if(cleanDone) + { + if(timer2->isActive()) + timer2->stop(); + sysPara->status.isPumpValveControledByHand = !sysPara->status.isPumpValveControledByHand; + sysPara->status.isPumpValveControledByHand = false; + setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); + ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun + ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); + sysPara->devOp->mainInkCtrl(); + cleanDone = false; + } + qDebug()<status.autoCleanStatus; + return; + } + + //qDebug()<status.autoCleanTime; + //qDebug()<status.autoCleanStatus; + + if(sysPara->status.autoCleanStatus != AUTOCLEAN_STATUS_NONE) + { + dialogAutoClean->setValue(sysPara->status.autoCleanTime); + QCoreApplication::processEvents(); + + ++sysPara->status.autoCleanTime; + if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP1) + { + if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP1_TIME) + { + sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP2; + sysPara->status.autoCleanTime=0; + dialogAutoClean->setRange(0, AUTOCLEAN_STATUS_STEP2_TIME); + dialogAutoClean->setWindowTitle(tr("(2/3) Cleaning")); + //打开粘度泵,循环阀,墨水阀,主墨泵 + if(!sysPara->devOp->isReclaimPumpOpen()) //开供墨阀之前要判断回收泵有没有开,没开就提前打开 + { + sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 + } + sysPara->devOp->controlCycleValve(true); + sysPara->devOp->controlInkValve(true); + sysPara->devOp->controlInkValvePWM(true); + sysPara->devOp->controlMainInkPump(true); + sysPara->devOp->controlViscosityPump(true); + sysPara->devOp->mainInkCtrl(); + } + } + else if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP2) + { + if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP2_TIME) + { + sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP3; + sysPara->status.autoCleanTime=0; + + dialogAutoClean->setRange(0, (AUTOCLEAN_STATUS_STEP3_TIME-1)); + dialogAutoClean->setWindowTitle(tr("(3/3) Cleaning")); + //打开粘度泵,混合阀 + { + sysPara->devOp->controlCycleValve(false); //关循环阀,墨水阀,主墨泵 + sysPara->devOp->controlInkValve(false); + sysPara->devOp->controlInkValvePWM(false); + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->controlMixValve(true); //开混合阀 + sysPara->devOp->controlViscosityPump(true);//开粘度泵 + sysPara->devOp->mainInkCtrl(); + } + } + } + else if(sysPara->status.autoCleanStatus == AUTOCLEAN_STATUS_STEP3) + { + if(sysPara->status.autoCleanTime >= AUTOCLEAN_STATUS_STEP3_TIME) + { + sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_NONE; + sysPara->status.autoCleanTime=0; + cleanDone = true; + } + } + } + } +} + +void SystemManage::reclainTankTestHandler() +{ + static unsigned int waitTime = 0; + if(!sysPara) + { + return; + } + if(reclainTankTestProcess->wasCanceled()||reclainTankTestState == ReclainTankTest_eNotStart) + { + if(reclaimTankTestTimer->isActive()) + reclaimTankTestTimer->stop(); + //sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; + reclainTankTestState = ReclainTankTest_eNotStart; + reclainTankTestCount = 0; + reclainTankTestProcess->hide(); + reclainTankTestProcess->deleteLater(); + return; + } + if(reclainTankTestState == ReclainTankTest_eOpenning) { + if(sysPara->status.reclaimTankstatus == 0x05||sysPara->status.reclainTankReachEnd) { //open complete + reclainTankTestState = ReclainTankTest_eOpened; + waitTime = 4; + //qDebug()<<"ReclainTankTest_eOpened"; + } + } + else if(reclainTankTestState == ReclainTankTest_eOpened) { + if(waitTime > 0) + { + --waitTime; + return; + } + sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); + ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); + sysPara->status.reclainOpenAppending = false; + sysPara->status.reclainCloseAppending = true; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + reclainTankTestState = ReclainTankTest_eClosing; + } + else if(reclainTankTestState == ReclainTankTest_eClosing) { + if(sysPara->status.reclaimTankstatus == 0x06||sysPara->status.reclainCloseAppending==false) { //close complete + reclainTankTestState = ReclainTankTest_Closed; + } + } + else if(reclainTankTestState == ReclainTankTest_Closed) { + reclainTankTestCount++; + if(reclainTankTestCount>=RECLAIN_TANK_TEST_MAX_COUNT) { + reclainTankTestState = ReclainTankTest_eNotStart; + reclaimTankTestTimer->stop(); + reclainTankTestProcess->hide(); + reclainTankTestProcess->deleteLater(); + } + else { + reclainTankTestProcess->setWindowTitle(QString("(%1/%2) reclain tank test").arg(reclainTankTestCount).arg(RECLAIN_TANK_TEST_MAX_COUNT)); + reclainTankTestProcess->setValue(reclainTankTestCount); + sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); + ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); + sysPara->status.reclainOpenAppending = true; + sysPara->status.reclainCloseAppending = false; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + reclainTankTestState = ReclainTankTest_eOpenning; + } + } + else { + reclaimTankTestTimer->stop(); + } + +} + +void SystemManage::inkcloseCountHandler() +{ +// static uint8_t flag = true; + +// if(flag <50) +// { +// flag++; +// } + +// if(flag==10) +// { + +// sysPara->devOp->controlInkValve(true); +// }else +// if(flag == 15) +// { +// sysPara->devOp->controlInkValve(false); +// } + +// qDebug()<<"sysMana reclaimOpenCntAfterSWintOf" << sysPara->status.reclaimOpenCntAfterSWintOff; +// ui->labelReclaimPump->setText((sysPara->devOp->isReclaimPumpOpen()?tr("开"):tr("关")) + QString("\n%1").arg(sysPara->status.reclaimOpenCntAfterSWintOff)); + if(false == sysPara->devOp->isInkValveOpen()) + { +// qDebug()<<"Ink pump is off"; + //qDebug()<<"sysMana reclaimOpenCntAfterSWintOf" << sysPara->status.reclaimOpenCntAfterSWintOff; + if(sysPara->devOp->isReclaimPumpOpen()) + { + + sysPara->status.reclaimOpenCntAfterSWintOff++; + if(sysPara->status.reclaimOpenCntAfterSWintOff >= 60) //等待60s + { + sysPara->devOp->controlReclaimPump(false,false); // 墨线关闭一分钟后,回收阀再关闭 + sysPara->status.autoCtlReclaimAfterSWintOff = true; + } + } + }else + { +// qDebug()<<"Ink pump is open"; + sysPara->status.reclaimOpenCntAfterSWintOff = 0; + sysPara->status.autoCtlReclaimAfterSWintOff = false; + } +} +void SystemManage::MainInkCmpSepetalHandler() +{ + +// static unsigned int waitTime +// qDebug()<<"sysPara->status.SEPTAL_POSITION" << sysPara->status.SEPTAL_POSITION; + //2019/10/24 主泵由隔膜位置联动 + if(!sysPara->status.isPumpValveControledByHand) + { + if(sysPara->status.SEPTAL_POSITION >= 200) + { + if(true == sysPara->devOp->isMainInkPumpOpen()) + { + sysPara->devOp->controlMainInkPump(false); + } + }else + { + if(false == sysPara->devOp->isMainInkPumpOpen()) + { + sysPara->devOp->controlMainInkPump(true); + } + } + } +} + + +void SystemManage::on_pushButtonExportConfToUDisk_clicked() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("警告"), + tr("是否确认导出配置到U盘?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QDir dir("/udisk"); + if(!dir.exists()){ + QMessageBox::warning(this, tr("错误"), + tr("检测不到U盘")); + return; + } + system((char *)((QString("cp /home/plg/conf/sysPara.bin /udisk/")).toLatin1().data())); + QMessageBox::information(this, tr("提示"), + tr("成功导出配置到U盘")); + } +} + + +void SystemManage::on_pushButtonImportConfFromUdisk_clicked() +{ + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("警告"), + tr("是否确认从U盘导入配置?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + QFile file("/udisk/sysPara.bin"); + if(!file.exists()){ + QMessageBox::warning(this, tr("错误"), + tr("配置文件/udisk/sysPara.bin不存在!")); + return; + } + system((char *)((QString("cp /udisk/sysPara.bin /home/plg/conf/ ")).toLatin1().data())); + QMessageBox::information(this, tr("提示"), + tr("从U盘成功导入配置,重启后生效!")); + emit configChanged(); + } +} + +void SystemManage::onAutoCleanStart(void) +{ + if(sysPara){ + /* into manual control mode */ + // step 1:只开粘度泵; step 2:开粘度泵,循环阀,墨水阀,住墨泵 + //r_PumpValveControledByHand = sysPara->status.isPumpValveControledByHand; + //ui->label_status->setText(tr("正在进入手动模式......")); + //sysPara->status.isPumpValveControledByHand=true; + sysPara->devOp->highVoltageCtrl(0); //关闭高压 + sysPara->devOp->controlCompressPump(false); + sysPara->devOp->controlCycleValve(false); + sysPara->devOp->controlInkValve(false); + sysPara->devOp->controlInkValvePWM(false); + sysPara->devOp->controlMainInkPump(false); + sysPara->devOp->controlMixValve(false); + sysPara->devOp->controlReclaimPump(false,false); + sysPara->devOp->controlViscosityPump(true);//只开粘度泵 + sysPara->devOp->controlReleaseValve(false); + sysPara->devOp->mainInkCtrl(); + // 关闭回收槽 + { + sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); + ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); + sysPara->status.reclainOpenAppending = false; + sysPara->status.reclainCloseAppending = true; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + } + + sysPara->status.autoCleanStatus = AUTOCLEAN_STATUS_STEP1; + sysPara->status.autoCleanTime = 0; + qDebug()<setWindowModality(Qt::WindowModal); + dialogAutoClean->setMinimumDuration(2); + dialogAutoClean->setCancelButtonText(tr("Cancel")); + dialogAutoClean->setWindowTitle(tr("(1/3) Cleaning")); + dialogAutoClean->setRange(0, AUTOCLEAN_STATUS_STEP1_TIME); + dialogAutoClean->setAutoClose(true); + dialogAutoClean->setAutoReset(true); + emit autoCleanStart(); + autoCleanTimer->start(1000); // 1000 ms + + dialogAutoClean->show(); + /* + if(dialogAutoClean->wasCanceled()) + { + if(autoCleanTimer->isActive()) + autoCleanTimer->stop(); + dialogAutoClean->hide(); + sysPara->status.autoCleanStatus=AUTOCLEAN_STATUS_NONE; + sysPara->status.autoCleanTime=0; + qDebug()<status.autoCleanStatus; + return; + } + */ + } + } +} + + +void SystemManage::on_pushButtonFontToUdisk_pressed() +{ + // + QMessageBox::StandardButton ret; + ret = QMessageBox::information(this, tr("警告"), + tr("是否确认导出字库到U盘?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok) + { + QFile file("/udisk"); + if(!file.exists()){ + QMessageBox::warning(this, tr("错误"), + tr("U盘不可识别!")); + return; + } + + system((char *)((QString("cp /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/* /udisk/.")).toLatin1().data())); + system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));//am335x + system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data())); + system((char *)((QString("mkdir /udisk/zk")).toLatin1().data())); +// system((char *)((QString("cp /opt/zk/* /udisk/zk/ ")).toLatin1().data())); + QMessageBox::information(this, tr("提示"), + tr("字库导出完成!")); + //emit configChanged(); + } + +} + +void SystemManage::on_pushButtonMotorTest_pressed() +{ + QMessageBox::StandardButton ret; + if(!sysPara->para.isCheckMagnet) + { + if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ + QMessageBox::warning(this, tr("警告"), + tr("请先移开喷头盖!")); + return ; + } + } + ret = QMessageBox::information(this, tr("警告"), + tr("是否开始电机测试?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + if(sysPara){ + reclainTankTestCount = 0; + reclainTankTestProcess = new QProgressDialog(this); + reclainTankTestProcess->setWindowModality(Qt::WindowModal); + reclainTankTestProcess->setMinimumDuration(2); + reclainTankTestProcess->setCancelButtonText(tr("Cancel")); + reclainTankTestProcess->setWindowTitle(QString("(%1/%2) reclain tank test").arg(reclainTankTestCount).arg(RECLAIN_TANK_TEST_MAX_COUNT)); + reclainTankTestProcess->setRange(0, RECLAIN_TANK_TEST_MAX_COUNT); + reclainTankTestProcess->setValue(reclainTankTestCount); + reclainTankTestProcess->setAutoClose(true); + reclainTankTestProcess->setAutoReset(true); + reclainTankTestProcess->show(); + + sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); + ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); + sysPara->status.reclainOpenAppending = true; + sysPara->status.reclainCloseAppending = false; + sysPara->status.currReclaimOperationCnt = 0; + sysPara->status.reclainTankReachEnd = false; + reclainTankTestState = ReclainTankTest_eOpenning; + reclaimTankTestTimer->start(1000); + } + } +} + +void SystemManage::on_pushButtonPushAir_pressed() +{ + sysPara->status.byHandStore = sysPara->status.isPumpValveControledByHand; + sysPara->status.isPumpValveControledByHand = true; + sysPara->devOp->mainInkCtrl(); + //ui->label_status->setText(tr("正在进入手动模式......")); + + sysPara->status.airPushing = 1; + sysPara->status.airPushingOnTime = 0; + cycleValveOnCountInAirPush = 0; + sysPara->devOp->controlCycleValve(true); + sysPara->devOp->controlViscosityPump(true);//关闭粘度泵 + sysPara->devOp->controlMixValve(false); + + sysPara->devOp->controlMainInkPump(true);//主墨泵敞开 + sysPara->devOp->mainInkCtrl(); + sysPara->devOp->controlReclaimPump(true, false); // 回收泵开 + sysPara->devOp->controlInkValve(true); //墨水阀 + sysPara->devOp->controlInkValvePWM(true); //墨水阀 + mainInkPumpCtrlStatus = 0; + mainInkPumpCtrlCnt = 0; + autoCleanTimer->start(90); // 90 ms + QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), + tr("正在排气,是否停止?"), + QMessageBox::Ok); + if (ret == QMessageBox::Ok) { + autoCleanTimer->stop(); + sysPara->status.airPushing = 0; + cycleValveOnCountInAirPush = 0; + // 还原当前模式 + sysPara->devOp->controlCompressPump(false); + sysPara->devOp->controlCycleValve(false); + sysPara->devOp->controlInkValve(false); + sysPara->devOp->controlInkValvePWM(false); + if(sysPara->status.SEPTAL_POSITION >= (sysPara->para.septalPostion - 10)) + { + sysPara->devOp->controlMainInkPump(false); + } + if(sysPara->status.isPumpValveControledByHand == true) + { + sysPara->devOp->controlMainInkPump(false); //Controled by hand mode, mainInkPump need to stop + } + + sysPara->devOp->controlMixValve(false); + sysPara->devOp->controlReclaimPump(false,false); + sysPara->devOp->controlViscosityPump(false); + sysPara->devOp->controlReleaseValve(false); + sysPara->status.isPumpValveControledByHand = sysPara->status.byHandStore;// 还原到之前的模式 + sysPara->devOp->mainInkCtrl(); + + + } + +} + +void SystemManage::on_pushButtonGearPumpOff_pressed() +{ + ui->pushButtonGearPumpOff->setEnabled(false); + sysPara->para.gearPumpValue = 0; + sysPara->devOp->WriteMoterPump(); + ui->pushButtonGearPump->setEnabled(true); +} + +void SystemManage::getCurrentScrennType(){ + QFile file("/etc/init.d/qtui.sh"); + if(!file.open(QIODevice::ReadOnly)){ + qDebug()<<"open /etc/init.d/qtui.sh failed"; + LogInfo::setRunStatusText(tr("open /etc/init.d/qtui.sh failed")); +// ui->pushButtonChangeScreen->setEnabled(false); + return; + } + QTextStream in(&file); + QString str = in.readAll(); + int index = str.indexOf("event0"); + if(index != -1){ + // 电阻屏 + flagOfTouchScreenType = 0; +// ui->pushButtonChangeScreen->setText(tr("切换电容屏")); + } + else{ + //电容屏 + flagOfTouchScreenType = 1; +// ui->pushButtonChangeScreen->setText(tr("切换电阻屏")); + } + file.close(); + +} + + + +void SystemManage::on_spinBoxGearPumpValue_valueChanged(int arg1) +{ + sysPara->para.gearPumpValue = arg1; + +} + +void SystemManage::on_pushButtonProgamFPGA_clicked() +{ + emit enableClick(false); + //开一个定时器去判断回收槽回收完毕,然后进入手动模式,再关闭FPGA的通信。 + programFPGATimer->start(1000); +} + +void SystemManage::programFPGAProcess(){ + QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), + tr("确定要升级FPGA软件吗?"), + QMessageBox::Ok,QMessageBox::Cancel); + if(ret == QMessageBox::Cancel){ + programFPGATimer->stop(); + emit enableClick(true); + return; + } + if (ret == QMessageBox::Ok) { + QFile FpgaFile("/home/plg/FPGAFile.rbf"); + if(FpgaFile.exists()) + QFile::remove("/home/plg/FPGAFile.rbf"); + + QFile file("/udisk/FPGAFile.rbf"); + if(!file.exists()) + { + QMessageBox::warning(this,"提示","没有FPGA升级文件"); + programFPGATimer->stop(); + emit enableClick(true); + return; + } + QFile filepy("/udisk/upgrade_file_new.py"); + QFile::copy("/udisk/FPGAFile.rbf","/home/plg/FPGAFile.rbf"); + if(filepy.exists()){ + QFile::remove("/home/plg/upgrade_file_new.py"); + QFile::copy("/udisk/upgrade_file_new.py","/home/plg/upgrade_file_new.py"); + } + + //进入手动模式 + sysPara->status.isPumpValveControledByHand = true; + setPumpValveBottonEnable(sysPara->status.isPumpValveControledByHand); + ui->pushButtonPushAir->setEnabled(true); //2019-10-20 自动还是手动模式,排气按钮都要使能 by kun + ui->labelControlByHand->setText(sysPara->status.isPumpValveControledByHand?tr("手动"):tr("自动")); + sysPara->devOp->mainInkCtrl(); + emit enableReclaimButton(!sysPara->status.isPumpValveControledByHand); + //关闭FPGA通信 + emit sigToCloseSerialFPGA(); + emit sigToCloseSerialSTM32(); + //关闭定时器 + programFPGATimer->stop(); + programFPGADialog->init(); + programFPGADialog->show(); + } +} + +void SystemManage::PowerOnSetTime(QString date){ + qDebug()<<"PowerOnTime:"<pushButton_EnvConf->setVisible(flag); +} + +void SystemManage::on_pushButton_SwitchKBD_clicked() +{ + QFile file("/home/plg/UseKBD"); + QByteArray buf; + buf.clear(); + QString keyBoardType = Public::ReadKeyBoardUse(); + if(file.open(QIODevice::WriteOnly)) { + if(keyBoardType == "Chinese") + buf.append("MultiLanguage\r\n"); + else + buf.append("Chinese\r\n"); + file.write(buf); + fsync(file.handle()); + file.close(); + }else{ + QMessageBox::warning(this,tr("提示"),tr("切换失败!")); + return; + } + + QMessageBox::information(this,tr("提示"),tr("切换成功,重启后生效!")); +} + +void SystemManage::loadKeyBoardType(){ + QString keyBoardType = Public::ReadKeyBoardUse(); + if(keyBoardType == "MultiLanguage") + sysPara->status.flagOfKeyBoardType = true; + else + sysPara->status.flagOfKeyBoardType = false; + +} + +void SystemManage::on_pushButton_UpgradeSTM32_clicked() +{ + int cnt = hasSingleStm32Bin("/udisk"); + if(cnt == 0){ + QMessageBox::warning(this,tr("提示"),tr("找不到软件!")); + return; + } + else if(cnt > 1){ + QMessageBox::warning(this,tr("提示"),tr("找到多个软件,请删除多余的文件,只保留一个!")); + return; + } + + QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"), + tr("确定要升级单片机软件吗?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok) { + emit enableClick(false); + sysPara->status.isPumpValveControledByHand = true; + emit upgradeSTM32(fileName); + } +} + +void SystemManage::progressBarControl(int value,int show){ + if(show == 1){ + progressBar.setWindowFlags(Qt::WindowStaysOnTopHint); + progressBar.show(); + progressBar.setValue(value); + } + else if(show == 0){ + emit enableClick(true); + progressBar.hide(); + QMessageBox::warning(this,tr("提示"),tr("升级成功,请重启QtUI!")); + } + else{ + emit enableClick(true); + progressBar.hide(); + QMessageBox::warning(this,tr("提示"),tr("升级失败!")); + } +} + + +/** + * 判断 /udisk 目录下是否存在并且只有一个以 VET6_ 开头、.bin 结尾的文件 + * 返回 true 表示满足"存在且仅有一个",否则返回 false + * 如果还需要拿到这个文件名,可把 fileName 通过最后一个参数带回 + */ +int SystemManage::hasSingleStm32Bin(const QString &dirPath) +{ + QDirIterator it(dirPath, + QStringList() << "VET6_*.bin", // 通配符过滤 + QDir::Files, + QDirIterator::NoIteratorFlags); + + int cnt = 0; + QString found; + while (it.hasNext()) { + it.next(); // 迭代到下一个匹配文件 + ++cnt; + found = it.fileName(); // 只保留文件名,不含路径 + if (cnt > 1) // 已经发现第二个,提前结束 + break; + } + + if (cnt == 1) + fileName = found; + + return cnt; // 仅当数量为 1 时返回 true +} diff --git a/SystemManage.h b/SystemManage.h index febbcc1..87c3974 100644 --- a/SystemManage.h +++ b/SystemManage.h @@ -1,160 +1,160 @@ -#ifndef SYSTEMMANAGE_H -#define SYSTEMMANAGE_H - -#include -#include "ParaSettingUI.h" -#include "TimeSettingDialog.h" -#include -#include "DialogAuthorization.h" -#include "qprogressdialog.h" -#include "PrintSetting.h" -#include "dlginputaddr.h" -#include "UpdateFPGA.h" -#include "InkJetPrinter.h" -#include - -namespace Ui { -class SystemManage; -} - -class SystemManage : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit SystemManage(QWidget *parent = 0); - ~SystemManage(); - void updateSysStatusToUI(); //重载 - void bindDlgInputAddr(DlgInputAddr *dlgInputAddr);//绑定时间权限管理对象 - void getCurrentScrennType(); - bool flagOfTouchScreenType; - void setPumpValveBottonEnable(bool enable); - void PowerOnSetTime(QString); - - void loadKeyBoardType(); - QProgressBar progressBar; - int hasSingleStm32Bin(const QString &dirPath = "/udisk"); - QString fileName; - -private slots: - void on_pushButtonCompressPump_pressed(); - void on_pushButtonGhost_pressed(); - void on_pushButtonCycleValve_pressed(); - - void updateGearPumpValue(int); - void on_pushButtonGearPump_pressed(); - - void on_pushButtonInkValve_pressed(); - - void on_pushButtonMainInkPump_pressed(); - - void on_pushButtonMixValve_pressed(); - - void on_pushButtonReclaimPump_pressed(); - - void on_pushButtonViscosityPump_pressed(); - - void on_pushButtonControlByHand_pressed(); - - void on_pushButtonReclaimTankOpen_pressed(); - - void on_pushButtonReclaimTankClose_pressed(); - - void on_pushButtonTimeSetting_clicked(); - - void onTimeSettingDone(); //时间设置完成 - - void on_pushButtonUpdateCharLib_pressed(); - - void on_pushButtonFactorySetting_pressed(); - - void on_pushButtonScreenAdjust_pressed(); - - void on_pushButtonUpdateSoftware_pressed(); - - void on_pushButtonCleanUP_pressed(); - - void on_pushButtonReleaseValve_pressed(); - - - void timerHandler(); - void timerHandler2(); - void autoCleanTimerHandler(); - - void on_pushButtonExportConfToUDisk_clicked(); - - void on_pushButtonImportConfFromUdisk_clicked(); - void ondialogAuthorizationAccepted(); - - void on_pushButtonAutoClean_pressed(); - void onAutoCleanStart(); - void reclainTankTestHandler(); - void programFPGAProcess(); - - /***2019/10/22 start*****/ - void inkcloseCountHandler(); - /***2019/10/22 end*****/ - /***2019/10/23 start*****/ - void MainInkCmpSepetalHandler(); - /***2019/10/23 */ - //void on_pushButtonAutoClean_clicked(); - - void on_pushButtonFontToUdisk_pressed(); - - void on_pushButtonMotorTest_pressed(); - - void on_pushButtonPushAir_pressed(); - - void on_dialogTimeSetAuthorizationAccepted();//2020/1/6 - void on_dialogFactorySetAuthorizationAccepted(); - void on_dialogSysUpdateAuthorizationAccepted(); - - void on_pushButtonGearPumpOff_pressed(); - -// void on_pushButtonChangeScreen_clicked(); - - - void on_spinBoxGearPumpValue_valueChanged(int arg1); - - void on_pushButtonProgamFPGA_clicked(); - - void on_pushButton_EnvConf_clicked(); - - void on_pushButton_SwitchKBD_clicked(); - - void on_pushButton_UpgradeSTM32_clicked(); - -public slots: - void engieerModeAcceptSystemManage(bool); - void progressBarControl(int,int); - -Q_SIGNALS: - void configChanged(); - void autoCleanStart(); - void enableReclaimButton(bool flag); - void sigToCloseSerialFPGA(); - void sigToCloseSerialSTM32(); - void restartSerial(); - void upgradeSTM32(QString); - void enableClick(bool); - -private: - Ui::SystemManage *ui; - -// void setPumpValveBottonEnable(bool enable); - TimeSettingDialog timeDia; - QTimer *timer,*timer2,*autoCleanTimer,*reclaimTankTestTimer,*inkcloseCountTimer,*MainnkCmpSepetalTimer,*programFPGATimer; - int reclainTankTestState; - int reclainTankTestCount;//测试次数 - DialogAuthorization *dialogUpateMm; - DialogAuthorization *dialogTimeSetAuthorization; //2020/1/6 - DialogAuthorization *dialogSysUpdateAuthorization; - DlgInputAddr *dlgInputAddr_TimeSet;//2020/1/6 - QProgressDialog *dialogAutoClean; - QProgressDialog *reclainTankTestProcess; - int pushAir;// 正在排气 - DialogAuthorization *dialogFactorySetAuthorization; - UpdateFPGA *programFPGADialog; -}; - -#endif // SYSTEMMANAGE_H +#ifndef SYSTEMMANAGE_H +#define SYSTEMMANAGE_H + +#include +#include "ParaSettingUI.h" +#include "TimeSettingDialog.h" +#include +#include "DialogAuthorization.h" +#include "qprogressdialog.h" +#include "PrintSetting.h" +#include "dlginputaddr.h" +#include "UpdateFPGA.h" +#include "InkJetPrinter.h" +#include + +namespace Ui { +class SystemManage; +} + +class SystemManage : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit SystemManage(QWidget *parent = 0); + ~SystemManage(); + void updateSysStatusToUI(); //重载 + void bindDlgInputAddr(DlgInputAddr *dlgInputAddr);//绑定时间权限管理对象 + void getCurrentScrennType(); + bool flagOfTouchScreenType; + void setPumpValveBottonEnable(bool enable); + void PowerOnSetTime(QString); + + void loadKeyBoardType(); + QProgressBar progressBar; + int hasSingleStm32Bin(const QString &dirPath = "/udisk"); + QString fileName; + +private slots: + void on_pushButtonCompressPump_pressed(); + void on_pushButtonGhost_pressed(); + void on_pushButtonCycleValve_pressed(); + + void updateGearPumpValue(int); + void on_pushButtonGearPump_pressed(); + + void on_pushButtonInkValve_pressed(); + + void on_pushButtonMainInkPump_pressed(); + + void on_pushButtonMixValve_pressed(); + + void on_pushButtonReclaimPump_pressed(); + + void on_pushButtonViscosityPump_pressed(); + + void on_pushButtonControlByHand_pressed(); + + void on_pushButtonReclaimTankOpen_pressed(); + + void on_pushButtonReclaimTankClose_pressed(); + + void on_pushButtonTimeSetting_clicked(); + + void onTimeSettingDone(); //时间设置完成 + + void on_pushButtonUpdateCharLib_pressed(); + + void on_pushButtonFactorySetting_pressed(); + + void on_pushButtonScreenAdjust_pressed(); + + void on_pushButtonUpdateSoftware_pressed(); + + void on_pushButtonCleanUP_pressed(); + + void on_pushButtonReleaseValve_pressed(); + + + void timerHandler(); + void timerHandler2(); + void autoCleanTimerHandler(); + + void on_pushButtonExportConfToUDisk_clicked(); + + void on_pushButtonImportConfFromUdisk_clicked(); + void ondialogAuthorizationAccepted(); + + void on_pushButtonAutoClean_pressed(); + void onAutoCleanStart(); + void reclainTankTestHandler(); + void programFPGAProcess(); + + /***2019/10/22 start*****/ + void inkcloseCountHandler(); + /***2019/10/22 end*****/ + /***2019/10/23 start*****/ + void MainInkCmpSepetalHandler(); + /***2019/10/23 */ + //void on_pushButtonAutoClean_clicked(); + + void on_pushButtonFontToUdisk_pressed(); + + void on_pushButtonMotorTest_pressed(); + + void on_pushButtonPushAir_pressed(); + + void on_dialogTimeSetAuthorizationAccepted();//2020/1/6 + void on_dialogFactorySetAuthorizationAccepted(); + void on_dialogSysUpdateAuthorizationAccepted(); + + void on_pushButtonGearPumpOff_pressed(); + +// void on_pushButtonChangeScreen_clicked(); + + + void on_spinBoxGearPumpValue_valueChanged(int arg1); + + void on_pushButtonProgamFPGA_clicked(); + + void on_pushButton_EnvConf_clicked(); + + void on_pushButton_SwitchKBD_clicked(); + + void on_pushButton_UpgradeSTM32_clicked(); + +public slots: + void engieerModeAcceptSystemManage(bool); + void progressBarControl(int,int); + +Q_SIGNALS: + void configChanged(); + void autoCleanStart(); + void enableReclaimButton(bool flag); + void sigToCloseSerialFPGA(); + void sigToCloseSerialSTM32(); + void restartSerial(); + void upgradeSTM32(QString); + void enableClick(bool); + +private: + Ui::SystemManage *ui; + +// void setPumpValveBottonEnable(bool enable); + TimeSettingDialog timeDia; + QTimer *timer,*timer2,*autoCleanTimer,*reclaimTankTestTimer,*inkcloseCountTimer,*MainnkCmpSepetalTimer,*programFPGATimer; + int reclainTankTestState; + int reclainTankTestCount;//测试次数 + DialogAuthorization *dialogUpateMm; + DialogAuthorization *dialogTimeSetAuthorization; //2020/1/6 + DialogAuthorization *dialogSysUpdateAuthorization; + DlgInputAddr *dlgInputAddr_TimeSet;//2020/1/6 + QProgressDialog *dialogAutoClean; + QProgressDialog *reclainTankTestProcess; + int pushAir;// 正在排气 + DialogAuthorization *dialogFactorySetAuthorization; + UpdateFPGA *programFPGADialog; +}; + +#endif // SYSTEMMANAGE_H diff --git a/TextEditOption.h b/TextEditOption.h index 5294937..7b416a8 100644 --- a/TextEditOption.h +++ b/TextEditOption.h @@ -1,173 +1,173 @@ -#ifndef TEXTEDITOPTION_H -#define TEXTEDITOPTION_H - -#include -#include -#include -#include -#include -#include "ParaSettingUI.h" -#include "MyFileDialog.h" -#include -#include -#include -#include "DialogFileOperation.h" -#include "DialogInsertVari.h" -#include "DialogFontSize.h" -#include "DialogLineSpace.h" -#include "PicWidget.h" -#include -#include "dlgQrCode.h" -#include "QBarCode.h" -#include "DialogSaveFile.h" -namespace Ui { -class TextEditOption; -} - -class TextEditOption : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - - explicit TextEditOption(QWidget *parent = 0); - ~TextEditOption(); - void updateSysParaToUI(); - void bindText(QTextEdit *textEdit); - - QLabel *getLabelFontSize(); - QPushButton *getPushButtonPreview(); - QCheckBox *getCheckBoxBold(); - void setFontFormat(); - void onbuttonOpenclicked(); - void bindPicWidget(PicWidget *picwidget); - void editItemModeDone(); - - void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText); - int editMode; - bool sceneEditItem; - QString fileName; - void InsertBarCodeToEdit(QString barCodeName,int width,int height); - void InsertBarCodeToEdit(QString barCodeName,int width,int height,int EnSave); - void InsertQRCodeToEdit(QString barCodeName,int width,int height ); - void InsertQRCodeToEdit(QString barCodeName,int width,int height ,int EnSave); - void modbus_insert_pic(QString filename); - dlgQrCode *qrcode; - QBarCode *barcode; - QLabel * getLabelFontFamily(); - int barVarHeight,barVarWidth; - QFont barVarFont; - QTextCharFormat fmt; - QTextEdit *textEdit; - - void bindSysPara(SysPara *sysPara); - DialogFontSize *dialogFontSize; - void updateFileVariWidth(QString &str); - int getSingleDigitWidth(int); - int getVariableHight(int); - void updateNormalVarWidth(QString&,const QString&); - void updateProduceDateVarWidth(QString &,const QString,int); - int getDateVarWidth(int height,int); - void checkFonts(); - void loadApplicationFonts(); - void toggleVirtualKeyboard(); - QString getFamilyName(int); - - void updateFontFamily(QString&); - void updateImageStyle(QString&); - QString getNewFontSize(int); - QString getNewFontFamily(int); - QString getVariableFontFamily(int height); - -protected: - void showEvent(QShowEvent* e) override; - -public slots: - void on_bottonSave_clicked(); - void currentCharFormatChanged(const QTextCharFormat &format); - void onMbSetLineAndChar(int line_space, int char_space); - void onOpenNewFile(); - void updateSysParaToZero(); - void SetHiddenValue(bool); - void onFileOpen(QString filePath,bool insertFlag); -private slots: - void onQRCodeClose(); - void onBarCodeClose(); // barDlgClose - void showDlg(); - - // 网络二维码 - void slt_updateNetworkQR(); - - void enableButtonSave(); - /*--------------因为按钮被取消,功能消失-------------------------*/ - void onbottonInsertImgclicked(); - void onInsertImgFIle_select(); //选则文件后 - void onbottonInsertTextclicked(); - void onInsertTextFIle_select(); //选则文件后 - - void onOpenFIle_select(); //选则文件后 - /*-----------------------------------------------------------*/ - void on_buttonSaveAS_clicked(); - void onSaveAS_FIle_select(); //选则文件后 - - void onSave_File_reject(); - void on_bottonNew_pressed(); - - void on_buttonInsertVari_pressed(); - - void on_pushButtonFile_pressed(); - - void on_buttonSelectFont_pressed(); - - void on_checkBoxBold_released(); - void on_buttonLineSpace_clicked(); -#ifdef EnableArabic - void changeArabicPage(int); - void swithchEnglisOrArabic(bool); -#endif -Q_SIGNALS: - void fileNameChanged(QString); - void PicfileNameOpen(QString,bool); - void scenefileOpen(QString,bool); - void editItemDone(); - void fontSizeChange(int); - void switchBengalLanguage(bool); - -signals: -#ifdef EnableArabic - void fontSizeArabicSelect(bool); - void EnableSwitchArabicFlag(bool); -#endif -protected slots: - void onSaveASFile(QString filename, bool Flag); - void onEditItemMode(); -private: - Ui::TextEditOption *ui; - QStackedWidget *stackedWidgetOption; - QStackedWidget *stackedWidgetText; - -// QTextEdit *textEdit; - PicWidget *picwidget; - - void saveFile(); - MyFileDialog *fileDialog; - bool maybeSave(); - void openFIle(QString fileName); - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - - - bool newFileAppending; - void checkNewFileAppending(); - void onDialogLineSpaceAccepted(); - - DialogFileOperation *dialogFileOperation; - DialogInsertVari *dialogInsertVari; - DialogLineSpace *dialogLineSpace; -#ifdef MYSAVEFILEDLG - DialogSaveFile *dialogSaveFile; -#endif - - void updateNetQRToEdit(); -}; - -#endif // TEXTEDITOPTION_H +#ifndef TEXTEDITOPTION_H +#define TEXTEDITOPTION_H + +#include +#include +#include +#include +#include +#include "ParaSettingUI.h" +#include "MyFileDialog.h" +#include +#include +#include +#include "DialogFileOperation.h" +#include "DialogInsertVari.h" +#include "DialogFontSize.h" +#include "DialogLineSpace.h" +#include "PicWidget.h" +#include +#include "dlgQrCode.h" +#include "QBarCode.h" +#include "DialogSaveFile.h" +namespace Ui { +class TextEditOption; +} + +class TextEditOption : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + + explicit TextEditOption(QWidget *parent = 0); + ~TextEditOption(); + void updateSysParaToUI(); + void bindText(QTextEdit *textEdit); + + QLabel *getLabelFontSize(); + QPushButton *getPushButtonPreview(); + QCheckBox *getCheckBoxBold(); + void setFontFormat(); + void onbuttonOpenclicked(); + void bindPicWidget(PicWidget *picwidget); + void editItemModeDone(); + + void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText); + int editMode; + bool sceneEditItem; + QString fileName; + void InsertBarCodeToEdit(QString barCodeName,int width,int height); + void InsertBarCodeToEdit(QString barCodeName,int width,int height,int EnSave); + void InsertQRCodeToEdit(QString barCodeName,int width,int height ); + void InsertQRCodeToEdit(QString barCodeName,int width,int height ,int EnSave); + void modbus_insert_pic(QString filename); + dlgQrCode *qrcode; + QBarCode *barcode; + QLabel * getLabelFontFamily(); + int barVarHeight,barVarWidth; + QFont barVarFont; + QTextCharFormat fmt; + QTextEdit *textEdit; + + void bindSysPara(SysPara *sysPara); + DialogFontSize *dialogFontSize; + void updateFileVariWidth(QString &str); + int getSingleDigitWidth(int); + int getVariableHight(int); + void updateNormalVarWidth(QString&,const QString&); + void updateProduceDateVarWidth(QString &,const QString,int); + int getDateVarWidth(int height,int); + void checkFonts(); + void loadApplicationFonts(); + void toggleVirtualKeyboard(); + QString getFamilyName(int); + + void updateFontFamily(QString&); + void updateImageStyle(QString&); + QString getNewFontSize(int); + QString getNewFontFamily(int); + QString getVariableFontFamily(int height); + +protected: + void showEvent(QShowEvent* e) override; + +public slots: + void on_bottonSave_clicked(); + void currentCharFormatChanged(const QTextCharFormat &format); + void onMbSetLineAndChar(int line_space, int char_space); + void onOpenNewFile(); + void updateSysParaToZero(); + void SetHiddenValue(bool); + void onFileOpen(QString filePath,bool insertFlag); +private slots: + void onQRCodeClose(); + void onBarCodeClose(); // barDlgClose + void showDlg(); + + // 网络二维码 + void slt_updateNetworkQR(); + + void enableButtonSave(); + /*--------------因为按钮被取消,功能消失-------------------------*/ + void onbottonInsertImgclicked(); + void onInsertImgFIle_select(); //选则文件后 + void onbottonInsertTextclicked(); + void onInsertTextFIle_select(); //选则文件后 + + void onOpenFIle_select(); //选则文件后 + /*-----------------------------------------------------------*/ + void on_buttonSaveAS_clicked(); + void onSaveAS_FIle_select(); //选则文件后 + + void onSave_File_reject(); + void on_bottonNew_pressed(); + + void on_buttonInsertVari_pressed(); + + void on_pushButtonFile_pressed(); + + void on_buttonSelectFont_pressed(); + + void on_checkBoxBold_released(); + void on_buttonLineSpace_clicked(); +#ifdef EnableArabic + void changeArabicPage(int); + void swithchEnglisOrArabic(bool); +#endif +Q_SIGNALS: + void fileNameChanged(QString); + void PicfileNameOpen(QString,bool); + void scenefileOpen(QString,bool); + void editItemDone(); + void fontSizeChange(int); + void switchBengalLanguage(bool); + +signals: +#ifdef EnableArabic + void fontSizeArabicSelect(bool); + void EnableSwitchArabicFlag(bool); +#endif +protected slots: + void onSaveASFile(QString filename, bool Flag); + void onEditItemMode(); +private: + Ui::TextEditOption *ui; + QStackedWidget *stackedWidgetOption; + QStackedWidget *stackedWidgetText; + +// QTextEdit *textEdit; + PicWidget *picwidget; + + void saveFile(); + MyFileDialog *fileDialog; + bool maybeSave(); + void openFIle(QString fileName); + void mergeFormatOnWordOrSelection(const QTextCharFormat &format); + + + bool newFileAppending; + void checkNewFileAppending(); + void onDialogLineSpaceAccepted(); + + DialogFileOperation *dialogFileOperation; + DialogInsertVari *dialogInsertVari; + DialogLineSpace *dialogLineSpace; +#ifdef MYSAVEFILEDLG + DialogSaveFile *dialogSaveFile; +#endif + + void updateNetQRToEdit(); +}; + +#endif // TEXTEDITOPTION_H diff --git a/TextEditOption_backup.cpp b/TextEditOption_backup.cpp index 8d66d70..d2ad329 100644 --- a/TextEditOption_backup.cpp +++ b/TextEditOption_backup.cpp @@ -1,1366 +1,1366 @@ -#include "TextEditOption.h" -#include "ui_texteditoption.h" -#include "PicWidget.h" -#include "scene/picscene.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include "Public.h" -#include "myinclude.h" - -#include "QBarCode.h" -#include "dlgQrCode.h" -#include -#include - -TextEditOption::TextEditOption(QWidget *parent) : - QWidget(parent), - ui(new Ui::TextEditOption) -{ - ui->setupUi(this); - fileDialog = 0; - fileName = ""; - textEdit = 0; - newFileAppending = false; - dialogFileOperation = new DialogFileOperation(0); - dialogInsertVari = new DialogInsertVari(0); - dialogFontSize = new DialogFontSize(0); - dialogLineSpace = new DialogLineSpace(0); - editMode=0; -#ifdef _2DCODE_ - dlgQrcode = new dlgQrCode(); - barcode= new QBarCode(); - connect(barcode,SIGNAL(onBarCodeClose()),this,SLOT(onBarCodeClose())); - connect(dlgQrcode,SIGNAL(onQRCodeCloseNow()),this,SLOT(onQRCodeClose())); -#endif - //textEdit->setFontFamily(Public::getFontFamily(12)); - //textEdit->clear(); -#ifdef MYSAVEFILEDLG - dialogSaveFile =new DialogSaveFile(0); -#endif - - sceneEditItem = false; -} - -TextEditOption::~TextEditOption() -{ - delete ui; - if(fileDialog) - delete fileDialog; - if(dialogInsertVari) - delete dialogInsertVari; - if(dialogFontSize) - delete dialogFontSize; - if(dialogLineSpace) - delete dialogLineSpace; -#if _2DCODE_ - if(dlgQrcode) - delete dlgQrcode; -#endif - //free(dlgQrCode); -#ifdef MYSAVEFILEDLG - if(dialogSaveFile) delete dialogSaveFile; - if(dialogFileOperation) delete dialogFileOperation; -#endif -} - -void TextEditOption::enableButtonSave(){ - if(!ui->bottonSave->isEnabled()) - ui->bottonSave->setEnabled(true); -} - -void TextEditOption::bindText(QTextEdit *textEdit){ - this->textEdit = textEdit; - - connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); - - ui->bottonSave->setEnabled(false); - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); -#ifdef MYSAVEFILEDLG - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); -#endif - - - -} -void TextEditOption::bindSysPara(SysPara *sysPara){ - this->sysPara = sysPara; -#ifdef _2DCODE_ - if(sysPara) - { - barcode->bindSysPara(sysPara); - //qDebug()<<"TextEditOption bind by TextEdit."; - } -#endif - //else qDebug()<<"TextEditOption bind by TextEdit failure"; -} - -void TextEditOption::bindPicWidget(PicWidget *picwidget){ - this->picwidget = picwidget;// stackedWidgetOption - -// connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); -// ui->bottonSave->setEnabled(false); -// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - - -} -void TextEditOption::bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText){ - this->stackedWidgetOption = stackedWidgetOption;// stackedWidgetOption - this->stackedWidgetText = stackedWidgetText; -// connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); -// ui->bottonSave->setEnabled(false); -// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - - -} -void TextEditOption::showDlg(){ - -if(editMode==PICFILE){ - - disconnect(textEdit,SIGNAL(textChanged()),0,0); - - connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); - ui->bottonSave->setEnabled(false); - disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - on_pushButtonFile_pressed(); - - // dialogFileOperation->show(); -} -} - -/* - * 和DialogFileOperation对接 - * */ -void TextEditOption::onFileOpen(QString filePath,bool insertFlag) -{ - if(editMode==PICFILE){ - if(filePath.endsWith(".png") )//||filePath.endsWith(".bmp") ) - { - if(insertFlag){ - emit PicfileNameOpen(filePath,insertFlag); - } - else { - // - emit PicfileNameOpen(filePath,0); - } - return ; - } - else{ - if(stackedWidgetOption) { - stackedWidgetOption->setCurrentIndex(1); - stackedWidgetText->setCurrentIndex(1); - } - } - } - else if(editMode==TXTFILE) { - if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") - || filePath.endsWith(".bmp") || filePath.endsWith(".BMP") || filePath.endsWith(".png")) - { - QString html = ""; - QTextCharFormat fmt = textEdit->currentCharFormat (); - if(insertFlag){ - textEdit->insertHtml (html); - } - else { - textEdit->setHtml (html); - textEdit->moveCursor(QTextCursor::EndOfLine); //在插入图片的情况下,将图片至于末会导致格式还原 - } - textEdit->mergeCurrentCharFormat(fmt); - } - else if(filePath.endsWith(".xml")) - { - memset(sysPara->para.lastOpenedFileName,0,sizeof(sysPara->para.lastOpenedFileName)); - return; - } - else { - QFile file(filePath); - if(!file.open(QIODevice::ReadOnly)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + filePath); - } - else { - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - // if (Qt::mightBeRichText(str)) { - // textEdit->setHtml(str); - // } else { - // str = QString::fromLocal8Bit(data); - // textEdit->setPlainText(str); - // } - // QTextStream in (&file);in.readAll() - if(filePath.startsWith(UDISK_DOC_ROOT_DIR)){ - str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //做相应处理 - } - - if(insertFlag){ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("Application"), tr("是否确认将文件内容追加到打开的文件?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - textEdit->insertHtml(str); - } - } - else - { - //updateFileVariWidth(str); - textEdit->setHtml(str); - fileName = filePath; - - if(sysPara){ - sysPara->sysFile =fileName; - sysPara->loadParaFromFile(); - //qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); - } - emit fileNameChanged(QFileInfo(fileName).fileName()); - textEdit->moveCursor(QTextCursor::EndOfLine); - onDialogLineSpaceAccepted(); - } - } -//#if defined(__CONVERTERBOARD__)|| defined(__VX__) -#if 1 - fsync(file.handle()); -#endif - file.close(); - } - if(insertFlag) //在打开文件的时候不设置焦点 - textEdit->setFocus(); - if(stackedWidgetOption) { - stackedWidgetOption->setCurrentIndex(0); - stackedWidgetText->setCurrentIndex(0); - // textEdit->setFocus(); - } - } - else if(editMode==SCENE) { - //开机会调用到此,然后打开文件 - if(filePath.endsWith(".xml")) - { - memset(sysPara->para.lastOpenedFileName,0,sizeof(sysPara->para.lastOpenedFileName)); - emit scenefileOpen(filePath,false);//sceneeditoption 接收这个信号然后打开文件 - emit fileNameChanged(QFileInfo(filePath).fileName()); - } - else - { - if(sceneEditItem == true) - { - if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") - || filePath.endsWith(".bmp") || filePath.endsWith(".BMP") || filePath.endsWith(".png")) - { - QString html = ""; - QTextCharFormat fmt = textEdit->currentCharFormat (); - if(insertFlag){ - textEdit->insertHtml (html); - } - else { - textEdit->setHtml(html); - textEdit->moveCursor(QTextCursor::EndOfLine); //在插入图片的情况下,将图片至于末会导致格式还原 - } - textEdit->mergeCurrentCharFormat(fmt); - } - else { - QFile file(filePath); - if(!file.open(QIODevice::ReadOnly)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + filePath); - } - else { - QByteArray data = file.readAll(); - QTextCodec *codec = Qt::codecForHtml(data); - QString str = codec->toUnicode(data); - if(filePath.startsWith(UDISK_DOC_ROOT_DIR)){ - str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //做相应处理 - } - - if(insertFlag){ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("Application"), tr("是否确认将文件内容追加到打开的文件?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - textEdit->insertHtml(str); - } - } - else - { - textEdit->setHtml(str); - fileName = filePath; - - if(sysPara){ - sysPara->sysFile =fileName; - sysPara->loadParaFromFile(); - //qDebug()<<"onFileOpen"<sysFile; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); - } - emit fileNameChanged(QFileInfo(fileName).fileName()); - textEdit->moveCursor(QTextCursor::EndOfLine); - } - } -//#if defined(__CONVERTERBOARD__)|| defined(__VX__) -#if 1 - fsync(file.handle()); -#endif - file.close(); - } - } - /* - if(stackedWidgetOption) { - stackedWidgetOption->setCurrentIndex(0); - stackedWidgetText->setCurrentIndex(0); - } - */ - } - } -} - - -void TextEditOption::onbottonInsertImgclicked() -{ - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onInsertImgFIle_select())); - fileDialog->showFileDialog(tr("插入图片"),QString("/"),QString("img (*.bmp *.jpg *.png *.gif)")); -} - -void TextEditOption::onInsertImgFIle_select(){ - QStringList files = fileDialog->selectedFiles(); - - for(int i = 0;i < files.size(); i++){ - QString html = ""; - textEdit->insertHtml (html); - - } -} - - -void TextEditOption::onbottonInsertTextclicked() -{ - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onInsertTextFIle_select())); - fileDialog->showFileDialog(tr("插入文本"),QString(DOC_ROOT_DIR),QString("text (*.html *.txt)")); -} - -void TextEditOption::onInsertTextFIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - QFile file(files.value(i)); - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + files.value(i)); - } - else{ - QTextStream in (&file); - textEdit->insertHtml(in.readAll()); - } -//#if defined(__CONVERTERBOARD__)|| defined(__VX__) -#if 1 - fsync(file.handle()); -#endif - file.close(); - } -} - - - -void TextEditOption::onbuttonOpenclicked() -{ - if(!textEdit){ - QMessageBox::critical(this,tr("错误"),tr("TextEditOption 构造函数参数textEdit 不应当为空")); // - } - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); - fileDialog->DontUseNativeDialog; - - fileDialog->showFileDialog(tr("打开文件"),QString(DOC_ROOT_DIR),QString("Text files (*.txt *.html)")); -} - - -void TextEditOption::openFIle(QString openFileName){ - QFile file(openFileName); - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); - } - else{ - QTextStream in (&file); - textEdit->setText(in.readAll()); - fileName = openFileName; - if(sysPara){ - sysPara->sysFile =fileName; - sysPara->loadParaFromFile(); - //qDebug()<<"openFIle"<sysFile; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); - } - emit fileNameChanged(QFileInfo(fileName).fileName()); - } - file.close(); -} - - -void TextEditOption::onOpenFIle_select(){ - - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - openFIle(files.value(i)); - } -} - - - -void TextEditOption::on_buttonSaveAS_clicked() -{ -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->refreshListView(editMode); - dialogSaveFile->show(); - dialogSaveFile->setEnterFileName(""); -#else - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR),QString("files (*.html *.txt)")); -#endif - -} - - -void TextEditOption::saveFile(){ - if(fileName.endsWith(".txt")){ - QMessageBox::StandardButton ret; - ret = QMessageBox::warning(this, tr("警告"), - tr("以.txt保存将丢失所有格式,你是否愿意保存为.html格式?"), - QMessageBox::Ok | QMessageBox::Cancel); - if (ret == QMessageBox::Ok){ - fileName += ".html"; - } - } - QString html = textEdit->toHtml(); - QString pattern = "setHtml(html.replace(UDISK_DOC_ROOT_DIR,DOC_ROOT_DIR)); - } - QTextDocumentWriter writer(fileName); - - //writer.setFormat("html"); - bool success = writer.write(textEdit->document()); - if (success){ - textEdit->document()->setModified(false); - ui->bottonSave->setEnabled(false); - if(sysPara){ - sysPara->sysFile =fileName; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); - } - } - else { - QMessageBox::warning(this,tr("警告"),tr("无法保存文件") + fileName); - } - emit fileNameChanged(QFileInfo(fileName).fileName()); - checkNewFileAppending(); -} - - -void TextEditOption::onSaveAS_FIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - fileName = files[i]; - - if(!fileName.endsWith(".html",Qt::CaseInsensitive) && !fileName.endsWith(".txt",Qt::CaseInsensitive)) - fileName += ".html"; - saveFile(); - } -} - - -void TextEditOption::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class - fileName = filename; - if(!fileName.endsWith(".html",Qt::CaseInsensitive) && !fileName.endsWith(".txt",Qt::CaseInsensitive)) - fileName += ".html"; - - saveFile(); - //emit fileNameChanged(QFileInfo(fileName).fileName()); - //qDebug()<clear(); - fileName = ""; - emit fileNameChanged(QFileInfo(fileName).fileName()); - setFontFormat(); - onDialogLineSpaceAccepted(); - } - newFileAppending = false; -} - -void TextEditOption::onSave_File_reject(){ - checkNewFileAppending(); -} - -void TextEditOption::on_bottonSave_clicked() -{ - if(sysPara->para.EditMode==SCENE){ - //在场景模式下,这个是确定按钮,切换到场景模式 - if(sceneEditItem) - { - editItemModeDone(); - emit editItemDone(); - } - - } - else - { - if(fileName.isEmpty()){ - #ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->refreshListView(editMode); - dialogSaveFile->show(); - dialogSaveFile->setEnterFileName(""); - #else - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); - fileDialog->showFileDialog(tr("保存..."),QString(DOC_ROOT_DIR),QString("HTML files (*.html)")); - #endif - } - else { - saveFile(); - newFileAppending = false; - } - } -} - - - -bool TextEditOption::maybeSave(){ - if (!textEdit->document()->isModified()) - return true; - if (fileName.startsWith(QLatin1String(":/"))) - return true; - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("文档已经改变,是否保存?")); - QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - - msgBox.exec(); - - if (msgBox.clickedButton() == saveButton) { - newFileAppending = true; - on_bottonSave_clicked(); - return false; - } else if (msgBox.clickedButton() == cancleSaveButton) { - return true; - } - else - return false; - - return true; -} -void TextEditOption::on_bottonNew_pressed() -{ - if (maybeSave()) { - //setFontFormat(); - textEdit->clear(); - fileName = ""; - QFile file(fileName); - emit fileNameChanged(QFileInfo(fileName).fileName()); - } -#ifdef VARCOLOR - textEdit->insertHtml(QString("  ")); -#endif - -} - -void TextEditOption::onOpenNewFile() -{ - //if (maybeSave()) - { - //setFontFormat(); - textEdit->clear(); - fileName = ""; - QFile file(fileName); - emit fileNameChanged(QFileInfo(fileName).fileName()); - } -#ifdef VARCOLOR - textEdit->insertHtml(QString("  ")); -#endif - -} - -void TextEditOption::on_buttonInsertVari_pressed() -{ QString s,fontname=""; - if(sysPara) - { - - //s.sprintf("%s(%02dX%02d)",sysPara->para.qrOption.text,sysPara->para.qrOption.width,sysPara->para.qrOption.height); - s= sysPara->para.qrOption.text; - if(s.length()>120)s="string to long."; - dialogInsertVari->setValue(""); - } - - if(dialogInsertVari->exec() == QDialog::Accepted && sysPara){ -// qDebug()<< "dialogInsertVari::Accepted"; - int pixelSize = ui->labelFontSize->text().toInt(); - QFont font; - fontname=ui->labFontFamily->text(); - //qDebug()<< "fontname:"<checkBoxBold->isChecked() && (pixelSize<=16) ?QFont::Bold:QFont::Normal); - - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - - //qDebug()<para.textEditCharSpace<para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide){ - width = (fontMetrics.width("0123456789.m "))/13; - } -// if(sysPara->para.printNumPoint) -// { -// width = (fontMetrics.width("0123456789."))/11 ; -// } -// else -// { -// width = (fontMetrics.width("0123456789"))/10 ; -// } - - - int height = fontMetrics.ascent()+ fontMetrics.descent(); - int digitalNum; - int varType; - - // 调整变量占位区的大小 - //qDebug()<<"leading:"<para.ExpirySplitMode; - dialogInsertVari->getValue(&varType,&digitalNum,&splitMode); - - fmt = textEdit->currentCharFormat (); - - if((varType<9 || varType==13 || varType==14 || varType == 15) // 普通变量;varType=13 is CNT3 var - // ||(varType>=20 && varType<29) // 横左变量 - // ||(varType>=40 && varType<49) // 右横变量 - ) - { - int varType1= varType; - - if(fontname.contains("SerifL") ||fontname.contains("serifl") ) - varType1= 20+varType; - else if(fontname.contains("SerifR") ||fontname.contains("serifr") ) - varType1= 20+varType; - else if(fontname.contains("bangla") ) - varType1= 30+varType; - else if(fontname.contains("biyangF") ) - varType1= 50+varType; - else if(fontname.contains("Roman") ) - varType1= 60+varType; - // varType1= 40+varType; // 变量右横时取 40,左横时取 20 - // qDebug()<<"pixelSize:"<insertHtml(QString("") - .arg(varType).arg(ui->checkBoxBold->isChecked() && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum) - .arg(height+1).arg(width*digitalNum).arg(varType1)); //插入索引后 - -// qDebug()<<"vari heigh:"<mergeCurrentCharFormat(fmt); - } // 普通变量 VarType<=8 - else if(varType >=9 && varType <=11) - { // -#ifdef _2DCODE_ - s= sysPara->para.qrOption.text; - dlgQrcode->move( (this->width() - dlgQrcode->width())/2 ,10); - if(varType==9){ - dlgQrcode->flagInsert=1; - sysPara->para.qrOption.AutoCount=1; - sysPara->para.qrOption.AutoRefresh=1; - sysPara->para.qrOption.type=0; - sysPara->para.qrOption.cntNum=digitalNum; //digitalNum - dlgQrcode->setWindowTitle(tr("二维码变量设置")); - dlgQrcode->SetOption(&sysPara->para.qrOption); - dlgQrcode->setCntCheckBoxHide(0); - dlgQrcode->show(); - } - - else if(varType==10){ - dlgQrcode->flagInsert=1; - sysPara->para.qrOption.AutoCount=1; - sysPara->para.qrOption.AutoRefresh=1; - sysPara->para.qrOption.type=1; - sysPara->para.qrOption.cntNum=digitalNum; - dlgQrcode->setCntCheckBoxHide(0); - dlgQrcode->setWindowTitle("二维码变量设置"); - dlgQrcode->SetOption(&sysPara->para.qrOption); - dlgQrcode->show(); - } - - else if(varType==11){ - barcode->move(0,0); - barcode->flagInsert=1; - sysPara->para.qrOption.AutoCount=1; - sysPara->para.qrOption.AutoRefresh=1; - sysPara->para.qrOption.type=1; - sysPara->para.qrOption.cntNum=digitalNum; - barVarFont = font; - barVarHeight=height; - barVarWidth =width; - //barcode->setCntCheckBoxHide(0); - barcode->setWindowTitle("条形码变量设置"); - barcode->SetOption(&sysPara->para.bcOption); - barcode->show(); - - } - textEdit->mergeCurrentCharFormat(fmt); -#endif - } - else if(varType ==RANDOMNUM){ //12 - //digitalNum=13; - //qDebug()<<"digitalNum"<insertHtml(QString("") - .arg(varType).arg(ui->checkBoxBold->isChecked() && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum) - .arg(height+1).arg(width*digitalNum)); //插入索引后 - - textEdit->mergeCurrentCharFormat(fmt); - } - else if(varType ==EXPIRYDATE){ //80 :/80/image/expiryDate8.bmp qrc:/80/image/expiryDate875.bmp -// QImage img; -// img.load("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/digitalWidth8.bmp"); -// img.setPixel(0,4,0xffff0Cfc); -// img.setPixel(0,5,0xffff0Cfc); -// img.save("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/curDate8.bmp"); - // 0xff00fc - int varType1 = varType; - if(fontname.contains("bangla") ) - { - varType1= 10+varType; - } - else if(fontname.contains("biyangF") ) - { - varType1= 20+varType; - } - else if(fontname.contains("Roman") ) - { - varType1= 30+varType; - } - - sysPara->print.ExpiryVar.splitMode=splitMode; - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - QFontMetrics fontMetrics(font); - QHash dateFormat; - dateFormat.insert(0,"yyyy-MM-dd"); - dateFormat.insert(1,"yyyy/MM/dd"); - dateFormat.insert(2,"yyyyMMdd"); - dateFormat.insert(3,"yyyy年MM月dd日"); - dateFormat.insert(4,"yyyy-MM-dd hh:mm"); - dateFormat.insert(5,"yyyy/MM/dd hh:mm"); - dateFormat.insert(6,"yyyyMMddhhmm"); - dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); - dateFormat.insert(8,"hh:mm"); - dateFormat.insert(9,"ddhhmm"); - dateFormat.insert(10,"dd MM yy"); - dateFormat.insert(11,"dd/MM/yy"); - dateFormat.insert(12,"dd/MM/yyyy"); - dateFormat.insert(13,"dd-MM-yy"); - dateFormat.insert(14,"dd-MM-yyyy"); - //dateFormat.insert(10,"x"); - QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode)); - //qDebug()<<"DateTime "<insertHtml(QString("") - .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(175):1) - .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 - sysPara->print.ExpiryVar.bold = ui->checkBoxBold->checkState(); - textEdit->mergeCurrentCharFormat(fmt); - }else - { - if(splitMode == 3 || splitMode ==7 ) - { - height = fontMetrics.ascent(); - } - // textEdit->insertHtml(QString("") - // .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) - // .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 - //sysPara->print.ExpiryVar.bold = ui->checkBoxBold->isChecked(); - textEdit->insertHtml(QString("") - .arg(varType1).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) - .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 - sysPara->print.ExpiryVar.bold = ui->checkBoxBold->checkState(); - textEdit->mergeCurrentCharFormat(fmt); - } - } - else if(varType ==CURDATE ){ //81 :/80/image/expiryDate8.bmp qrc:/80/image/curDate8.bmp -#if 0 - QImage img; - img.load("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/digitalWidth8.bmp"); - img.setPixel(0,4,0xffff0Cfc); - img.setPixel(0,5,0xffff0Cfc); - img.save("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/81/image/curDate8.bmp"); -#endif - int varType1 = varType; - if(fontname.contains("bangla") ) - { - varType1= 10+varType; - } - else if(fontname.contains("biyangF") ) - { - varType1= 20+varType; - } - else if(fontname.contains("biyangF") ) - { - varType1= 30+varType; - } - - // 0xff00fc - //qDebug()<<"CurDateVar height"<print.CurDateVar.splitMode = splitMode; - font.setLetterSpacing(QFont::AbsoluteSpacing, sysPara->para.textEditCharSpace); - QFontMetrics fontMetrics(font); - QHash dateFormat; - dateFormat.insert(0,"yyyy-MM-dd"); - dateFormat.insert(1,"yyyy/MM/dd"); - dateFormat.insert(2,"yyyyMMdd"); - dateFormat.insert(3,"yyyy年MM月dd日"); - dateFormat.insert(4,"yyyy-MM-dd hh:mm"); - dateFormat.insert(5,"yyyy/MM/dd hh:mm"); - dateFormat.insert(6,"yyyyMMddhhmm"); - dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); - dateFormat.insert(8,"hh:mm"); - dateFormat.insert(9,"ddhhmm"); - dateFormat.insert(10,"dd MM yy"); - dateFormat.insert(11,"dd/MM/yy"); - dateFormat.insert(12,"dd/MM/yyyy"); - dateFormat.insert(13,"dd-MM-yy"); - dateFormat.insert(14,"dd-MM-yyyy"); - //dateFormat.insert(10,"x"); -// dateFormat.insert(10,"A dd MM yy"); - QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode)); - int dateTimeWidth = fontMetrics.width(DateTime) ; - qDebug()<<"insert splitMode="<insertHtml(QString("") -// .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) -// .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 -// sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); - textEdit->insertHtml(QString("") - .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) - .arg(height+1).arg(dateTimeWidth+2)); //插入索引后 - sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); - //qDebug()<<"sysPara->print.CurDateVar.bold:"<print.CurDateVar.bold; - textEdit->mergeCurrentCharFormat(fmt); - } -#endif - if(DateTime == "x") - { - qDebug()<<" x handle"; - textEdit->insertHtml(QString("") - .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):1) - .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 - textEdit->mergeCurrentCharFormat(fmt); - }else - { - if(splitMode == 3 || splitMode ==7 ) - { - height = fontMetrics.ascent();//fontMetrics.ascent()+ fontMetrics.descent(); - } -// textEdit->insertHtml(QString("") -// .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) -// .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 -// sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); - qDebug()<<"height:"<insertHtml(QString("") - .arg(varType1).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) - .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 - //sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); - //qDebug()<<"sysPara->print.CurDateVar.bold:"<print.CurDateVar.bold; - textEdit->mergeCurrentCharFormat(fmt); - } - } - else if(varType == CURCLASS) { //82 :/82/image/curDate1.bmp - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - QFontMetrics fontMetrics(font); - int dateTimeWidth = fontMetrics.width("A") ; - int pixBmpSize = 1; - if (ui->checkBoxBold->checkState() && (pixelSize<=16)) { - pixBmpSize = 875; - } - else { - if(pixelSize >= 9) { - pixBmpSize = 91; - } - else { - pixBmpSize = 1; - } - } - qDebug()<<"height:"<insertHtml(QString("") - .arg(varType).arg(pixBmpSize) - .arg(height+1).arg(dateTimeWidth+2)); //插入索引后 - textEdit->mergeCurrentCharFormat(fmt); - } - textEdit->setFocus(); - } -} - - -void TextEditOption::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - - QTextCursor cursor = textEdit->textCursor(); - //if (!cursor.hasSelection()) - // cursor.select(QTextCursor::WordUnderCursor); - //cursor.mergeCharFormat(format); - //textEdit->setTextCursor(cursor); - //qDebug()<<"mergeFormatOnWordOrSelection"<mergeCurrentCharFormat(format); -} - -void TextEditOption::updateSysParaToUI() //重载 -{ - if(sysPara){ - /*务必先设置行距*/ - dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); - onDialogLineSpaceAccepted(); - /*将文件打开*/ - QString file = QString(sysPara->para.lastOpenedFileName); - if(QFile::exists(file)){ - sysPara->sysFile =file; - onFileOpen(file,false); - } - dialogFontSize->setValue(sysPara->para.fontPixelSize); - } -} - -void TextEditOption::onMbSetLineAndChar(int line_space, int char_space) -{ - sysPara->para.textEditLineSpace = line_space; - sysPara->para.textEditCharSpace = char_space; - dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); - onDialogLineSpaceAccepted(); -} - -QLabel *TextEditOption::getLabelFontSize(){ - return ui->labelFontSize; -} - -QLabel *TextEditOption::getLabelFontFamily(){ - return ui->labFontFamily; -} - -void TextEditOption::setFontFormat(){ - if(sysPara){ - - qreal pixelSize = ui->labelFontSize->text().toFloat(); - if(pixelSize < Public::getMinFontPixelSize()) - pixelSize = sysPara->para.fontPixelSize; - - if(pixelSize < Public::getMinFontPixelSize()){ - pixelSize = Public::getMinFontPixelSize(); - } - - if (pixelSize >= 0) { - QTextCharFormat fmt; - int DPI = textEdit->logicalDpiX(); - DPI = DPI?DPI:1; - qreal pointSize = pixelSize*72/DPI; //Pixel = DPI * Point / 72 - fmt.setFontPointSize(pointSize); -#ifdef VNLGXX - QString fontFamily = dialogFontSize->getFontFamily(); - -#else - QString fontFamily = // Public::getFontFamily((int)pixelSize); - ui->labFontFamily->text(); - ui->labFontFamily->setText(fontFamily); -#endif - fmt.setFontFamily(fontFamily); - fmt.setFontWeight(ui->checkBoxBold->isChecked() && (pixelSize<=16)? QFont::Bold:QFont::Normal); - //fmt.setUnderlineStyle(); - //fmt.setVerticalAlignment(QTextCharFormat::AlignBottom); - //QfontMetrics.bottom - //fmt.setUnderlineStyle(QTextCharFormat::NoUnderline); - //qDebug() << "logicalDpiX:" << textEdit->logicalDpiX() << "logicalDpiY:" << textEdit->logicalDpiY(); - //qDebug() << "physicalDpiX:" << textEdit->physicalDpiX() << "physicalDpiX:" << textEdit->physicalDpiX(); - mergeFormatOnWordOrSelection(fmt); -// QFont font = textEdit->document()->defaultFont(); -// font.setPointSizeF(pointSize); -// textEdit->document()->setDefaultFont(font); - - //qDebug()<<"Font:"<para.fontPixelSize = font.pointSize(); - dialogFontSize->setValue(sysPara->para.fontPixelSize); - ui->checkBoxBold->setChecked(font.bold()); -} - -QPushButton * TextEditOption::getPushButtonPreview(){ - return ui->pushButtonPreview; -} -QCheckBox *TextEditOption::getCheckBoxBold(){ - return ui->checkBoxBold; -} - -void TextEditOption::on_pushButtonFile_pressed() -{ - if(sceneEditItem) - { - dialogFileOperation->refreshListView(TXTFILE); - dialogFileOperation->exec(); - } - else - { - dialogFileOperation->refreshListView(editMode); - dialogFileOperation->exec(); - } -} - - -void TextEditOption::on_buttonSelectFont_pressed() -{ - if(dialogFontSize->exec() == QDialog::Accepted){ - int fontSize; - dialogFontSize->getValue(&fontSize); - ui->labFontFamily->setText(dialogFontSize->getFontFamily()); - if(sysPara){ - sysPara->para.fontPixelSize = fontSize; - } - ui->labelFontSize->setText(QString::number(fontSize)); - setFontFormat(); - textEdit->setFocus(); - emit fontSizeChange(fontSize); - bool flagBangal=false; - if(dialogFontSize->getFontFamily() == "bangla") - flagBangal = true; - emit switchBengalLanguage(flagBangal); - } - -} - -void TextEditOption::on_checkBoxBold_released() -{ - setFontFormat(); - textEdit->setFocus(); -} - - -void TextEditOption::onDialogLineSpaceAccepted(){ - dialogLineSpace->getValue(&sysPara->para.textEditLineSpace,&sysPara->para.textEditCharSpace); -// QString str = textEdit->toHtml(); -// updateFileVariWidth(str); -// textEdit->setHtml(str); - for(QTextBlock textBlock = textEdit->document()->begin();textBlock != textEdit->document()->end(); textBlock = textBlock.next()){ - QTextBlockFormat textBlockFormat = textBlock.blockFormat(); - textBlockFormat.setAlignment(Qt::AlignBottom); - textBlockFormat.setTopMargin(-1); - textBlockFormat.setBottomMargin(sysPara->para.textEditLineSpace-1); - QTextCursor textCursor = textEdit->textCursor(); - textCursor.setPosition(textBlock.position()); - textCursor.setBlockFormat(textBlockFormat); - textEdit->setTextCursor(textCursor); - } - -// QString str = textEdit->toHtml(); -// updateFileVariWidth(str); -// textEdit->setHtml(str); - - QFont font = textEdit->font(); - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - textEdit->setFont(font); -} -void TextEditOption::on_buttonLineSpace_clicked() -{ - if(dialogLineSpace->exec() == QDialog::Accepted){ - onDialogLineSpaceAccepted(); - sysPara->saveParaToFile(); - textEdit->setFocus(); - sysPara->para.alterPrint.lineSpace = sysPara->para.textEditLineSpace; - } -} - -void TextEditOption::InsertQRCodeToEdit(QString barCodeName,int width,int height ,int enSave){ -#ifdef _2DCODE_ - textEdit->setText(""); - InsertQRCodeToEdit(barCodeName, width, height); - fileName = DOC_ROOT_DIR +QFileInfo(barCodeName).baseName() +".html"; - if(enSave) saveFile(); -#endif -} -void TextEditOption::InsertBarCodeToEdit(QString barCodeName,int width,int height ,int enSave){ -#ifdef _2DCODE_ - textEdit->setText(""); - InsertBarCodeToEdit(barCodeName, width, height); - fileName = DOC_ROOT_DIR +QFileInfo(barCodeName).baseName() +".html"; - if(enSave) saveFile(); -#endif -} -void TextEditOption::InsertBarCodeToEdit(QString barCodeName,int width,int height ) -{ -#ifdef _2DCODE_ - //dialogInsertVari->getValue(&varType,&digitalNum); - QTextCharFormat fmt = textEdit->currentCharFormat (); - textEdit->insertHtml(QString("") - .arg(barCodeName) - .arg(height).arg(width)); //插入索引后 - textEdit->mergeCurrentCharFormat(fmt); - //textEdit->setFocus(); - //qDebug()<<"TEOption:"<getValue(&varType,&digitalNum); - QTextCharFormat fmt = textEdit->currentCharFormat (); - textEdit->insertHtml(QString("") - .arg(barCodeName)//QFileInfo(barCodeName). - .arg(width).arg(height)); //插入索引后 - textEdit->mergeCurrentCharFormat(fmt); - //textEdit->setFocus(); - //qDebug()<<"TEOption:"<flagInsert ) { - dlgQrcode->GetOption((qrOption_t*)&sysPara->para.qrOption); - dlgQrcode->flagInsert=0; - if(sysPara->para.EditMode==PICFILE){ - - } - else { - - if(sysPara->para.qrOption.type==0){ - textEdit->insertHtml(QString("") - .arg(9).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 - } - else if(sysPara->para.qrOption.type==1){ - textEdit->insertHtml(QString("") - .arg(10).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 - } - else if(sysPara->para.qrOption.type==2){ - textEdit->insertHtml(QString("") - .arg(11).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 - } - } - } - sysPara->saveParaToFile(); -#endif -} -void TextEditOption::onBarCodeClose(){ -#ifdef _2DCODE_ - bcPara_t bcoption; - if(barcode->flagInsert ) { - barcode->GetOption((bcOption_t*)&sysPara->para.bcOption); - //qDebug()<<"onBarCodeClose"<para.bcOption.barType<para.bcOption.height; - barcode->GetOption2((bcPara_t*)&bcoption); - //qDebug()<<"onBarCodeClose"<para.bcOption.barType = bcoption.type; - barcode->flagInsert=0; - if(sysPara->para.EditMode==PICFILE){ - - } - else - { - fmt = textEdit->currentCharFormat (); - textEdit->insertHtml(QString("") - .arg(11).arg(bcoption.height).arg(bcoption.width).arg(bcoption.type*100+bcoption.height)); - - //插入索引后 - //qDebug()<") - // .arg(11).arg(bcoption.height).arg(bcoption.width).arg(bcoption.type*100+bcoption.height); - - int varType1= 7;//CNT1:7, CNT2:8 - int digitalNum; - if(sysPara->para.bcOption.var1En){ - digitalNum=sysPara->para.bcOption.var1Num; - textEdit->insertHtml(QString("%1%2").arg(sysPara->para.bcOption.TxtModule).arg(sysPara->para.bcOption.TxtLine)); - textEdit->insertHtml(QString("") - .arg(varType1).arg(ui->checkBoxBold->isChecked() && (barVarHeight<=16)?(digitalNum*100 + 75):digitalNum) - .arg(barVarHeight+1).arg( barVarWidth*digitalNum)); //插入索引后 - } - if(sysPara->para.bcOption.var2En) - { - digitalNum=sysPara->para.bcOption.var2Num; - textEdit->insertHtml(QString("") - .arg(varType1+1).arg(ui->checkBoxBold->isChecked() && (barVarHeight<=16)?(digitalNum*100 + 75):digitalNum) - .arg(barVarHeight+1).arg( barVarWidth*digitalNum)); //插入索引后 - } - - textEdit->mergeCurrentCharFormat(fmt); - } - } - sysPara->saveParaToFile(); -#endif -} - -void TextEditOption::onEditItemMode() -{ - ui->bottonNew->setDisabled(true); - ui->buttonSaveAS->setDisabled(true); - ui->pushButtonPreview->setDisabled(true); - ui->bottonSave->setText(tr("完成")); - sceneEditItem = true; -} -void TextEditOption::editItemModeDone() -{ - sceneEditItem = false; - ui->bottonNew->setDisabled(false); - ui->buttonSaveAS->setDisabled(false); - ui->pushButtonPreview->setDisabled(false); - ui->bottonSave->setText(tr("保存")); -} - -void TextEditOption::modbus_insert_pic(QString filename) -{ -// on_pushButtonFile_pressed(); - dialogFileOperation->modbus_openfile(filename); - -} - -void TextEditOption::updateSysParaToZero() //重载 -{ - if(sysPara){ - dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); - onDialogLineSpaceAccepted(); - } -} - -void TextEditOption::SetHiddenValue(bool select) -{ - dialogInsertVari->EnableHiddenValue(select); -} - -void TextEditOption::updateFileVariWidth(QString &str) - { - QString pattern = ""; - QRegExp rx(pattern); - int from = 0; - // 正常变量 - while(from < str.size() && from != -1) { - from = str.indexOf(rx,from);//返回匹配到到起始地址 - bool ok; - if(from != -1){//找到匹配的 - int width = rx.cap(4).toInt(&ok)*(sysPara->status.addSpace?2:1); - int digitalNum = rx.cap(3).toInt(&ok);//第二个匹配,数字到个数 - if(digitalNum>100){ //加粗 - digitalNum/=100; - ui->checkBoxBold->setChecked(true); - } - // 获取匹配的标签 - QString matchedTag = rx.cap(0); - // 构建新的标签,替换width属性值 - QString newTag = matchedTag; - int singlewidth = getSingleDigitWidth(); - int newWidth= (singlewidth + sysPara->para.textEditCharSpace) * digitalNum; - if(newWidth == width){ - return; - } - newTag.replace(QString("width=\"%1\"").arg(rx.cap(4)), QString("width=\"%1\"").arg(newWidth)); - // 替换原始文本中的标签 - str.replace(from, rx.matchedLength(), newTag); - from ++; - from+=newTag.length(); - } - } - } - -int TextEditOption::getSingleDigitWidth() -{ - int pixelSize = ui->labelFontSize->text().toInt(); - QFont font; - QString fontname=ui->labFontFamily->text(); - font.setFamily( - fontname // 20160812 - ); - font.setPixelSize(pixelSize); - font.setWeight(ui->checkBoxBold->isChecked() && (pixelSize<=16) ?QFont::Bold:QFont::Normal); - font.setLetterSpacing(QFont::AbsoluteSpacing,0); - QFontMetrics fontMetrics(font); - int width = (fontMetrics.width("0")); - // int width = (fontMetrics.width("0123456789"))/10; - // if(sysPara->para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide){ - // width = (fontMetrics.width("0123456789.m "))/13; - // } - return width; -} +#include "TextEditOption.h" +#include "ui_texteditoption.h" +#include "PicWidget.h" +#include "scene/picscene.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include "Public.h" +#include "myinclude.h" + +#include "QBarCode.h" +#include "dlgQrCode.h" +#include +#include + +TextEditOption::TextEditOption(QWidget *parent) : + QWidget(parent), + ui(new Ui::TextEditOption) +{ + ui->setupUi(this); + fileDialog = 0; + fileName = ""; + textEdit = 0; + newFileAppending = false; + dialogFileOperation = new DialogFileOperation(0); + dialogInsertVari = new DialogInsertVari(0); + dialogFontSize = new DialogFontSize(0); + dialogLineSpace = new DialogLineSpace(0); + editMode=0; +#ifdef _2DCODE_ + dlgQrcode = new dlgQrCode(); + barcode= new QBarCode(); + connect(barcode,SIGNAL(onBarCodeClose()),this,SLOT(onBarCodeClose())); + connect(dlgQrcode,SIGNAL(onQRCodeCloseNow()),this,SLOT(onQRCodeClose())); +#endif + //textEdit->setFontFamily(Public::getFontFamily(12)); + //textEdit->clear(); +#ifdef MYSAVEFILEDLG + dialogSaveFile =new DialogSaveFile(0); +#endif + + sceneEditItem = false; +} + +TextEditOption::~TextEditOption() +{ + delete ui; + if(fileDialog) + delete fileDialog; + if(dialogInsertVari) + delete dialogInsertVari; + if(dialogFontSize) + delete dialogFontSize; + if(dialogLineSpace) + delete dialogLineSpace; +#if _2DCODE_ + if(dlgQrcode) + delete dlgQrcode; +#endif + //free(dlgQrCode); +#ifdef MYSAVEFILEDLG + if(dialogSaveFile) delete dialogSaveFile; + if(dialogFileOperation) delete dialogFileOperation; +#endif +} + +void TextEditOption::enableButtonSave(){ + if(!ui->bottonSave->isEnabled()) + ui->bottonSave->setEnabled(true); +} + +void TextEditOption::bindText(QTextEdit *textEdit){ + this->textEdit = textEdit; + + connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); + + ui->bottonSave->setEnabled(false); + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); +#ifdef MYSAVEFILEDLG + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); +#endif + + + +} +void TextEditOption::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; +#ifdef _2DCODE_ + if(sysPara) + { + barcode->bindSysPara(sysPara); + //qDebug()<<"TextEditOption bind by TextEdit."; + } +#endif + //else qDebug()<<"TextEditOption bind by TextEdit failure"; +} + +void TextEditOption::bindPicWidget(PicWidget *picwidget){ + this->picwidget = picwidget;// stackedWidgetOption + +// connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); +// ui->bottonSave->setEnabled(false); +// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + + +} +void TextEditOption::bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText){ + this->stackedWidgetOption = stackedWidgetOption;// stackedWidgetOption + this->stackedWidgetText = stackedWidgetText; +// connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); +// ui->bottonSave->setEnabled(false); +// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + + +} +void TextEditOption::showDlg(){ + +if(editMode==PICFILE){ + + disconnect(textEdit,SIGNAL(textChanged()),0,0); + + connect(textEdit,SIGNAL(textChanged ()),this,SLOT(enableButtonSave())); + ui->bottonSave->setEnabled(false); + disconnect(dialogFileOperation,SIGNAL(openFile(QString,bool)),0,0); + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + on_pushButtonFile_pressed(); + + // dialogFileOperation->show(); +} +} + +/* + * 和DialogFileOperation对接 + * */ +void TextEditOption::onFileOpen(QString filePath,bool insertFlag) +{ + if(editMode==PICFILE){ + if(filePath.endsWith(".png") )//||filePath.endsWith(".bmp") ) + { + if(insertFlag){ + emit PicfileNameOpen(filePath,insertFlag); + } + else { + // + emit PicfileNameOpen(filePath,0); + } + return ; + } + else{ + if(stackedWidgetOption) { + stackedWidgetOption->setCurrentIndex(1); + stackedWidgetText->setCurrentIndex(1); + } + } + } + else if(editMode==TXTFILE) { + if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") + || filePath.endsWith(".bmp") || filePath.endsWith(".BMP") || filePath.endsWith(".png")) + { + QString html = ""; + QTextCharFormat fmt = textEdit->currentCharFormat (); + if(insertFlag){ + textEdit->insertHtml (html); + } + else { + textEdit->setHtml (html); + textEdit->moveCursor(QTextCursor::EndOfLine); //在插入图片的情况下,将图片至于末会导致格式还原 + } + textEdit->mergeCurrentCharFormat(fmt); + } + else if(filePath.endsWith(".xml")) + { + memset(sysPara->para.lastOpenedFileName,0,sizeof(sysPara->para.lastOpenedFileName)); + return; + } + else { + QFile file(filePath); + if(!file.open(QIODevice::ReadOnly)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + filePath); + } + else { + QByteArray data = file.readAll(); + QTextCodec *codec = Qt::codecForHtml(data); + QString str = codec->toUnicode(data); + // if (Qt::mightBeRichText(str)) { + // textEdit->setHtml(str); + // } else { + // str = QString::fromLocal8Bit(data); + // textEdit->setPlainText(str); + // } + // QTextStream in (&file);in.readAll() + if(filePath.startsWith(UDISK_DOC_ROOT_DIR)){ + str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //做相应处理 + } + + if(insertFlag){ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("Application"), tr("是否确认将文件内容追加到打开的文件?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + textEdit->insertHtml(str); + } + } + else + { + //updateFileVariWidth(str); + textEdit->setHtml(str); + fileName = filePath; + + if(sysPara){ + sysPara->sysFile =fileName; + sysPara->loadParaFromFile(); + //qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); + } + emit fileNameChanged(QFileInfo(fileName).fileName()); + textEdit->moveCursor(QTextCursor::EndOfLine); + onDialogLineSpaceAccepted(); + } + } +//#if defined(__CONVERTERBOARD__)|| defined(__VX__) +#if 1 + fsync(file.handle()); +#endif + file.close(); + } + if(insertFlag) //在打开文件的时候不设置焦点 + textEdit->setFocus(); + if(stackedWidgetOption) { + stackedWidgetOption->setCurrentIndex(0); + stackedWidgetText->setCurrentIndex(0); + // textEdit->setFocus(); + } + } + else if(editMode==SCENE) { + //开机会调用到此,然后打开文件 + if(filePath.endsWith(".xml")) + { + memset(sysPara->para.lastOpenedFileName,0,sizeof(sysPara->para.lastOpenedFileName)); + emit scenefileOpen(filePath,false);//sceneeditoption 接收这个信号然后打开文件 + emit fileNameChanged(QFileInfo(filePath).fileName()); + } + else + { + if(sceneEditItem == true) + { + if(filePath.endsWith(".gif") || filePath.endsWith(".jpeg") || filePath.endsWith(".jpg") + || filePath.endsWith(".bmp") || filePath.endsWith(".BMP") || filePath.endsWith(".png")) + { + QString html = ""; + QTextCharFormat fmt = textEdit->currentCharFormat (); + if(insertFlag){ + textEdit->insertHtml (html); + } + else { + textEdit->setHtml(html); + textEdit->moveCursor(QTextCursor::EndOfLine); //在插入图片的情况下,将图片至于末会导致格式还原 + } + textEdit->mergeCurrentCharFormat(fmt); + } + else { + QFile file(filePath); + if(!file.open(QIODevice::ReadOnly)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + filePath); + } + else { + QByteArray data = file.readAll(); + QTextCodec *codec = Qt::codecForHtml(data); + QString str = codec->toUnicode(data); + if(filePath.startsWith(UDISK_DOC_ROOT_DIR)){ + str.replace(DOC_ROOT_DIR,UDISK_DOC_ROOT_DIR); //做相应处理 + } + + if(insertFlag){ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("Application"), tr("是否确认将文件内容追加到打开的文件?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + textEdit->insertHtml(str); + } + } + else + { + textEdit->setHtml(str); + fileName = filePath; + + if(sysPara){ + sysPara->sysFile =fileName; + sysPara->loadParaFromFile(); + //qDebug()<<"onFileOpen"<sysFile; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); + } + emit fileNameChanged(QFileInfo(fileName).fileName()); + textEdit->moveCursor(QTextCursor::EndOfLine); + } + } +//#if defined(__CONVERTERBOARD__)|| defined(__VX__) +#if 1 + fsync(file.handle()); +#endif + file.close(); + } + } + /* + if(stackedWidgetOption) { + stackedWidgetOption->setCurrentIndex(0); + stackedWidgetText->setCurrentIndex(0); + } + */ + } + } +} + + +void TextEditOption::onbottonInsertImgclicked() +{ + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onInsertImgFIle_select())); + fileDialog->showFileDialog(tr("插入图片"),QString("/"),QString("img (*.bmp *.jpg *.png *.gif)")); +} + +void TextEditOption::onInsertImgFIle_select(){ + QStringList files = fileDialog->selectedFiles(); + + for(int i = 0;i < files.size(); i++){ + QString html = ""; + textEdit->insertHtml (html); + + } +} + + +void TextEditOption::onbottonInsertTextclicked() +{ + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onInsertTextFIle_select())); + fileDialog->showFileDialog(tr("插入文本"),QString(DOC_ROOT_DIR),QString("text (*.html *.txt)")); +} + +void TextEditOption::onInsertTextFIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + QFile file(files.value(i)); + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + files.value(i)); + } + else{ + QTextStream in (&file); + textEdit->insertHtml(in.readAll()); + } +//#if defined(__CONVERTERBOARD__)|| defined(__VX__) +#if 1 + fsync(file.handle()); +#endif + file.close(); + } +} + + + +void TextEditOption::onbuttonOpenclicked() +{ + if(!textEdit){ + QMessageBox::critical(this,tr("错误"),tr("TextEditOption 构造函数参数textEdit 不应当为空")); // + } + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); + fileDialog->DontUseNativeDialog; + + fileDialog->showFileDialog(tr("打开文件"),QString(DOC_ROOT_DIR),QString("Text files (*.txt *.html)")); +} + + +void TextEditOption::openFIle(QString openFileName){ + QFile file(openFileName); + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::warning(this,tr("警告"),tr("无法打开文件") + openFileName); + } + else{ + QTextStream in (&file); + textEdit->setText(in.readAll()); + fileName = openFileName; + if(sysPara){ + sysPara->sysFile =fileName; + sysPara->loadParaFromFile(); + //qDebug()<<"openFIle"<sysFile; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); + } + emit fileNameChanged(QFileInfo(fileName).fileName()); + } + file.close(); +} + + +void TextEditOption::onOpenFIle_select(){ + + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + openFIle(files.value(i)); + } +} + + + +void TextEditOption::on_buttonSaveAS_clicked() +{ +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->refreshListView(editMode); + dialogSaveFile->show(); + dialogSaveFile->setEnterFileName(""); +#else + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR),QString("files (*.html *.txt)")); +#endif + +} + + +void TextEditOption::saveFile(){ + if(fileName.endsWith(".txt")){ + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("警告"), + tr("以.txt保存将丢失所有格式,你是否愿意保存为.html格式?"), + QMessageBox::Ok | QMessageBox::Cancel); + if (ret == QMessageBox::Ok){ + fileName += ".html"; + } + } + QString html = textEdit->toHtml(); + QString pattern = "setHtml(html.replace(UDISK_DOC_ROOT_DIR,DOC_ROOT_DIR)); + } + QTextDocumentWriter writer(fileName); + + //writer.setFormat("html"); + bool success = writer.write(textEdit->document()); + if (success){ + textEdit->document()->setModified(false); + ui->bottonSave->setEnabled(false); + if(sysPara){ + sysPara->sysFile =fileName; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",fileName.toAscii().constData()); + } + } + else { + QMessageBox::warning(this,tr("警告"),tr("无法保存文件") + fileName); + } + emit fileNameChanged(QFileInfo(fileName).fileName()); + checkNewFileAppending(); +} + + +void TextEditOption::onSaveAS_FIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + fileName = files[i]; + + if(!fileName.endsWith(".html",Qt::CaseInsensitive) && !fileName.endsWith(".txt",Qt::CaseInsensitive)) + fileName += ".html"; + saveFile(); + } +} + + +void TextEditOption::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class + fileName = filename; + if(!fileName.endsWith(".html",Qt::CaseInsensitive) && !fileName.endsWith(".txt",Qt::CaseInsensitive)) + fileName += ".html"; + + saveFile(); + //emit fileNameChanged(QFileInfo(fileName).fileName()); + //qDebug()<clear(); + fileName = ""; + emit fileNameChanged(QFileInfo(fileName).fileName()); + setFontFormat(); + onDialogLineSpaceAccepted(); + } + newFileAppending = false; +} + +void TextEditOption::onSave_File_reject(){ + checkNewFileAppending(); +} + +void TextEditOption::on_bottonSave_clicked() +{ + if(sysPara->para.EditMode==SCENE){ + //在场景模式下,这个是确定按钮,切换到场景模式 + if(sceneEditItem) + { + editItemModeDone(); + emit editItemDone(); + } + + } + else + { + if(fileName.isEmpty()){ + #ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->refreshListView(editMode); + dialogSaveFile->show(); + dialogSaveFile->setEnterFileName(""); + #else + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); + fileDialog->showFileDialog(tr("保存..."),QString(DOC_ROOT_DIR),QString("HTML files (*.html)")); + #endif + } + else { + saveFile(); + newFileAppending = false; + } + } +} + + + +bool TextEditOption::maybeSave(){ + if (!textEdit->document()->isModified()) + return true; + if (fileName.startsWith(QLatin1String(":/"))) + return true; + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("文档已经改变,是否保存?")); + QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + + msgBox.exec(); + + if (msgBox.clickedButton() == saveButton) { + newFileAppending = true; + on_bottonSave_clicked(); + return false; + } else if (msgBox.clickedButton() == cancleSaveButton) { + return true; + } + else + return false; + + return true; +} +void TextEditOption::on_bottonNew_pressed() +{ + if (maybeSave()) { + //setFontFormat(); + textEdit->clear(); + fileName = ""; + QFile file(fileName); + emit fileNameChanged(QFileInfo(fileName).fileName()); + } +#ifdef VARCOLOR + textEdit->insertHtml(QString("  ")); +#endif + +} + +void TextEditOption::onOpenNewFile() +{ + //if (maybeSave()) + { + //setFontFormat(); + textEdit->clear(); + fileName = ""; + QFile file(fileName); + emit fileNameChanged(QFileInfo(fileName).fileName()); + } +#ifdef VARCOLOR + textEdit->insertHtml(QString("  ")); +#endif + +} + +void TextEditOption::on_buttonInsertVari_pressed() +{ QString s,fontname=""; + if(sysPara) + { + + //s.sprintf("%s(%02dX%02d)",sysPara->para.qrOption.text,sysPara->para.qrOption.width,sysPara->para.qrOption.height); + s= sysPara->para.qrOption.text; + if(s.length()>120)s="string to long."; + dialogInsertVari->setValue(""); + } + + if(dialogInsertVari->exec() == QDialog::Accepted && sysPara){ +// qDebug()<< "dialogInsertVari::Accepted"; + int pixelSize = ui->labelFontSize->text().toInt(); + QFont font; + fontname=ui->labFontFamily->text(); + //qDebug()<< "fontname:"<checkBoxBold->isChecked() && (pixelSize<=16) ?QFont::Bold:QFont::Normal); + + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + + //qDebug()<para.textEditCharSpace<para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide){ + width = (fontMetrics.width("0123456789.m "))/13; + } +// if(sysPara->para.printNumPoint) +// { +// width = (fontMetrics.width("0123456789."))/11 ; +// } +// else +// { +// width = (fontMetrics.width("0123456789"))/10 ; +// } + + + int height = fontMetrics.ascent()+ fontMetrics.descent(); + int digitalNum; + int varType; + + // 调整变量占位区的大小 + //qDebug()<<"leading:"<para.ExpirySplitMode; + dialogInsertVari->getValue(&varType,&digitalNum,&splitMode); + + fmt = textEdit->currentCharFormat (); + + if((varType<9 || varType==13 || varType==14 || varType == 15) // 普通变量;varType=13 is CNT3 var + // ||(varType>=20 && varType<29) // 横左变量 + // ||(varType>=40 && varType<49) // 右横变量 + ) + { + int varType1= varType; + + if(fontname.contains("SerifL") ||fontname.contains("serifl") ) + varType1= 20+varType; + else if(fontname.contains("SerifR") ||fontname.contains("serifr") ) + varType1= 20+varType; + else if(fontname.contains("bangla") ) + varType1= 30+varType; + else if(fontname.contains("biyangF") ) + varType1= 50+varType; + else if(fontname.contains("Roman") ) + varType1= 60+varType; + // varType1= 40+varType; // 变量右横时取 40,左横时取 20 + // qDebug()<<"pixelSize:"<insertHtml(QString("") + .arg(varType).arg(ui->checkBoxBold->isChecked() && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum) + .arg(height+1).arg(width*digitalNum).arg(varType1)); //插入索引后 + +// qDebug()<<"vari heigh:"<mergeCurrentCharFormat(fmt); + } // 普通变量 VarType<=8 + else if(varType >=9 && varType <=11) + { // +#ifdef _2DCODE_ + s= sysPara->para.qrOption.text; + dlgQrcode->move( (this->width() - dlgQrcode->width())/2 ,10); + if(varType==9){ + dlgQrcode->flagInsert=1; + sysPara->para.qrOption.AutoCount=1; + sysPara->para.qrOption.AutoRefresh=1; + sysPara->para.qrOption.type=0; + sysPara->para.qrOption.cntNum=digitalNum; //digitalNum + dlgQrcode->setWindowTitle(tr("二维码变量设置")); + dlgQrcode->SetOption(&sysPara->para.qrOption); + dlgQrcode->setCntCheckBoxHide(0); + dlgQrcode->show(); + } + + else if(varType==10){ + dlgQrcode->flagInsert=1; + sysPara->para.qrOption.AutoCount=1; + sysPara->para.qrOption.AutoRefresh=1; + sysPara->para.qrOption.type=1; + sysPara->para.qrOption.cntNum=digitalNum; + dlgQrcode->setCntCheckBoxHide(0); + dlgQrcode->setWindowTitle("二维码变量设置"); + dlgQrcode->SetOption(&sysPara->para.qrOption); + dlgQrcode->show(); + } + + else if(varType==11){ + barcode->move(0,0); + barcode->flagInsert=1; + sysPara->para.qrOption.AutoCount=1; + sysPara->para.qrOption.AutoRefresh=1; + sysPara->para.qrOption.type=1; + sysPara->para.qrOption.cntNum=digitalNum; + barVarFont = font; + barVarHeight=height; + barVarWidth =width; + //barcode->setCntCheckBoxHide(0); + barcode->setWindowTitle("条形码变量设置"); + barcode->SetOption(&sysPara->para.bcOption); + barcode->show(); + + } + textEdit->mergeCurrentCharFormat(fmt); +#endif + } + else if(varType ==RANDOMNUM){ //12 + //digitalNum=13; + //qDebug()<<"digitalNum"<insertHtml(QString("") + .arg(varType).arg(ui->checkBoxBold->isChecked() && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum) + .arg(height+1).arg(width*digitalNum)); //插入索引后 + + textEdit->mergeCurrentCharFormat(fmt); + } + else if(varType ==EXPIRYDATE){ //80 :/80/image/expiryDate8.bmp qrc:/80/image/expiryDate875.bmp +// QImage img; +// img.load("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/digitalWidth8.bmp"); +// img.setPixel(0,4,0xffff0Cfc); +// img.setPixel(0,5,0xffff0Cfc); +// img.save("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/curDate8.bmp"); + // 0xff00fc + int varType1 = varType; + if(fontname.contains("bangla") ) + { + varType1= 10+varType; + } + else if(fontname.contains("biyangF") ) + { + varType1= 20+varType; + } + else if(fontname.contains("Roman") ) + { + varType1= 30+varType; + } + + sysPara->print.ExpiryVar.splitMode=splitMode; + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + QFontMetrics fontMetrics(font); + QHash dateFormat; + dateFormat.insert(0,"yyyy-MM-dd"); + dateFormat.insert(1,"yyyy/MM/dd"); + dateFormat.insert(2,"yyyyMMdd"); + dateFormat.insert(3,"yyyy年MM月dd日"); + dateFormat.insert(4,"yyyy-MM-dd hh:mm"); + dateFormat.insert(5,"yyyy/MM/dd hh:mm"); + dateFormat.insert(6,"yyyyMMddhhmm"); + dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); + dateFormat.insert(8,"hh:mm"); + dateFormat.insert(9,"ddhhmm"); + dateFormat.insert(10,"dd MM yy"); + dateFormat.insert(11,"dd/MM/yy"); + dateFormat.insert(12,"dd/MM/yyyy"); + dateFormat.insert(13,"dd-MM-yy"); + dateFormat.insert(14,"dd-MM-yyyy"); + //dateFormat.insert(10,"x"); + QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode)); + //qDebug()<<"DateTime "<insertHtml(QString("") + .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(175):1) + .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 + sysPara->print.ExpiryVar.bold = ui->checkBoxBold->checkState(); + textEdit->mergeCurrentCharFormat(fmt); + }else + { + if(splitMode == 3 || splitMode ==7 ) + { + height = fontMetrics.ascent(); + } + // textEdit->insertHtml(QString("") + // .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) + // .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 + //sysPara->print.ExpiryVar.bold = ui->checkBoxBold->isChecked(); + textEdit->insertHtml(QString("") + .arg(varType1).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) + .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 + sysPara->print.ExpiryVar.bold = ui->checkBoxBold->checkState(); + textEdit->mergeCurrentCharFormat(fmt); + } + } + else if(varType ==CURDATE ){ //81 :/80/image/expiryDate8.bmp qrc:/80/image/curDate8.bmp +#if 0 + QImage img; + img.load("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/digitalWidth8.bmp"); + img.setPixel(0,4,0xffff0Cfc); + img.setPixel(0,5,0xffff0Cfc); + img.save("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/81/image/curDate8.bmp"); +#endif + int varType1 = varType; + if(fontname.contains("bangla") ) + { + varType1= 10+varType; + } + else if(fontname.contains("biyangF") ) + { + varType1= 20+varType; + } + else if(fontname.contains("biyangF") ) + { + varType1= 30+varType; + } + + // 0xff00fc + //qDebug()<<"CurDateVar height"<print.CurDateVar.splitMode = splitMode; + font.setLetterSpacing(QFont::AbsoluteSpacing, sysPara->para.textEditCharSpace); + QFontMetrics fontMetrics(font); + QHash dateFormat; + dateFormat.insert(0,"yyyy-MM-dd"); + dateFormat.insert(1,"yyyy/MM/dd"); + dateFormat.insert(2,"yyyyMMdd"); + dateFormat.insert(3,"yyyy年MM月dd日"); + dateFormat.insert(4,"yyyy-MM-dd hh:mm"); + dateFormat.insert(5,"yyyy/MM/dd hh:mm"); + dateFormat.insert(6,"yyyyMMddhhmm"); + dateFormat.insert(7,"yyyy年MM月dd日 hh:mm"); + dateFormat.insert(8,"hh:mm"); + dateFormat.insert(9,"ddhhmm"); + dateFormat.insert(10,"dd MM yy"); + dateFormat.insert(11,"dd/MM/yy"); + dateFormat.insert(12,"dd/MM/yyyy"); + dateFormat.insert(13,"dd-MM-yy"); + dateFormat.insert(14,"dd-MM-yyyy"); + //dateFormat.insert(10,"x"); +// dateFormat.insert(10,"A dd MM yy"); + QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode)); + int dateTimeWidth = fontMetrics.width(DateTime) ; + qDebug()<<"insert splitMode="<insertHtml(QString("") +// .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) +// .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 +// sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); + textEdit->insertHtml(QString("") + .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) + .arg(height+1).arg(dateTimeWidth+2)); //插入索引后 + sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); + //qDebug()<<"sysPara->print.CurDateVar.bold:"<print.CurDateVar.bold; + textEdit->mergeCurrentCharFormat(fmt); + } +#endif + if(DateTime == "x") + { + qDebug()<<" x handle"; + textEdit->insertHtml(QString("") + .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):1) + .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 + textEdit->mergeCurrentCharFormat(fmt); + }else + { + if(splitMode == 3 || splitMode ==7 ) + { + height = fontMetrics.ascent();//fontMetrics.ascent()+ fontMetrics.descent(); + } +// textEdit->insertHtml(QString("") +// .arg(varType).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) +// .arg(height+1).arg(width*(splitMode<2?9:7)+(width>>1))); //插入索引后 +// sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); + qDebug()<<"height:"<insertHtml(QString("") + .arg(varType1).arg(ui->checkBoxBold->checkState() && (pixelSize<=16)?(875):8) + .arg(height+1).arg(dateTimeWidth+4)); //插入索引后 + //sysPara->print.CurDateVar.bold = ui->checkBoxBold->checkState(); + //qDebug()<<"sysPara->print.CurDateVar.bold:"<print.CurDateVar.bold; + textEdit->mergeCurrentCharFormat(fmt); + } + } + else if(varType == CURCLASS) { //82 :/82/image/curDate1.bmp + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + QFontMetrics fontMetrics(font); + int dateTimeWidth = fontMetrics.width("A") ; + int pixBmpSize = 1; + if (ui->checkBoxBold->checkState() && (pixelSize<=16)) { + pixBmpSize = 875; + } + else { + if(pixelSize >= 9) { + pixBmpSize = 91; + } + else { + pixBmpSize = 1; + } + } + qDebug()<<"height:"<insertHtml(QString("") + .arg(varType).arg(pixBmpSize) + .arg(height+1).arg(dateTimeWidth+2)); //插入索引后 + textEdit->mergeCurrentCharFormat(fmt); + } + textEdit->setFocus(); + } +} + + +void TextEditOption::mergeFormatOnWordOrSelection(const QTextCharFormat &format) +{ + + QTextCursor cursor = textEdit->textCursor(); + //if (!cursor.hasSelection()) + // cursor.select(QTextCursor::WordUnderCursor); + //cursor.mergeCharFormat(format); + //textEdit->setTextCursor(cursor); + //qDebug()<<"mergeFormatOnWordOrSelection"<mergeCurrentCharFormat(format); +} + +void TextEditOption::updateSysParaToUI() //重载 +{ + if(sysPara){ + /*务必先设置行距*/ + dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); + onDialogLineSpaceAccepted(); + /*将文件打开*/ + QString file = QString(sysPara->para.lastOpenedFileName); + if(QFile::exists(file)){ + sysPara->sysFile =file; + onFileOpen(file,false); + } + dialogFontSize->setValue(sysPara->para.fontPixelSize); + } +} + +void TextEditOption::onMbSetLineAndChar(int line_space, int char_space) +{ + sysPara->para.textEditLineSpace = line_space; + sysPara->para.textEditCharSpace = char_space; + dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); + onDialogLineSpaceAccepted(); +} + +QLabel *TextEditOption::getLabelFontSize(){ + return ui->labelFontSize; +} + +QLabel *TextEditOption::getLabelFontFamily(){ + return ui->labFontFamily; +} + +void TextEditOption::setFontFormat(){ + if(sysPara){ + + qreal pixelSize = ui->labelFontSize->text().toFloat(); + if(pixelSize < Public::getMinFontPixelSize()) + pixelSize = sysPara->para.fontPixelSize; + + if(pixelSize < Public::getMinFontPixelSize()){ + pixelSize = Public::getMinFontPixelSize(); + } + + if (pixelSize >= 0) { + QTextCharFormat fmt; + int DPI = textEdit->logicalDpiX(); + DPI = DPI?DPI:1; + qreal pointSize = pixelSize*72/DPI; //Pixel = DPI * Point / 72 + fmt.setFontPointSize(pointSize); +#ifdef VNLGXX + QString fontFamily = dialogFontSize->getFontFamily(); + +#else + QString fontFamily = // Public::getFontFamily((int)pixelSize); + ui->labFontFamily->text(); + ui->labFontFamily->setText(fontFamily); +#endif + fmt.setFontFamily(fontFamily); + fmt.setFontWeight(ui->checkBoxBold->isChecked() && (pixelSize<=16)? QFont::Bold:QFont::Normal); + //fmt.setUnderlineStyle(); + //fmt.setVerticalAlignment(QTextCharFormat::AlignBottom); + //QfontMetrics.bottom + //fmt.setUnderlineStyle(QTextCharFormat::NoUnderline); + //qDebug() << "logicalDpiX:" << textEdit->logicalDpiX() << "logicalDpiY:" << textEdit->logicalDpiY(); + //qDebug() << "physicalDpiX:" << textEdit->physicalDpiX() << "physicalDpiX:" << textEdit->physicalDpiX(); + mergeFormatOnWordOrSelection(fmt); +// QFont font = textEdit->document()->defaultFont(); +// font.setPointSizeF(pointSize); +// textEdit->document()->setDefaultFont(font); + + //qDebug()<<"Font:"<para.fontPixelSize = font.pointSize(); + dialogFontSize->setValue(sysPara->para.fontPixelSize); + ui->checkBoxBold->setChecked(font.bold()); +} + +QPushButton * TextEditOption::getPushButtonPreview(){ + return ui->pushButtonPreview; +} +QCheckBox *TextEditOption::getCheckBoxBold(){ + return ui->checkBoxBold; +} + +void TextEditOption::on_pushButtonFile_pressed() +{ + if(sceneEditItem) + { + dialogFileOperation->refreshListView(TXTFILE); + dialogFileOperation->exec(); + } + else + { + dialogFileOperation->refreshListView(editMode); + dialogFileOperation->exec(); + } +} + + +void TextEditOption::on_buttonSelectFont_pressed() +{ + if(dialogFontSize->exec() == QDialog::Accepted){ + int fontSize; + dialogFontSize->getValue(&fontSize); + ui->labFontFamily->setText(dialogFontSize->getFontFamily()); + if(sysPara){ + sysPara->para.fontPixelSize = fontSize; + } + ui->labelFontSize->setText(QString::number(fontSize)); + setFontFormat(); + textEdit->setFocus(); + emit fontSizeChange(fontSize); + bool flagBangal=false; + if(dialogFontSize->getFontFamily() == "bangla") + flagBangal = true; + emit switchBengalLanguage(flagBangal); + } + +} + +void TextEditOption::on_checkBoxBold_released() +{ + setFontFormat(); + textEdit->setFocus(); +} + + +void TextEditOption::onDialogLineSpaceAccepted(){ + dialogLineSpace->getValue(&sysPara->para.textEditLineSpace,&sysPara->para.textEditCharSpace); +// QString str = textEdit->toHtml(); +// updateFileVariWidth(str); +// textEdit->setHtml(str); + for(QTextBlock textBlock = textEdit->document()->begin();textBlock != textEdit->document()->end(); textBlock = textBlock.next()){ + QTextBlockFormat textBlockFormat = textBlock.blockFormat(); + textBlockFormat.setAlignment(Qt::AlignBottom); + textBlockFormat.setTopMargin(-1); + textBlockFormat.setBottomMargin(sysPara->para.textEditLineSpace-1); + QTextCursor textCursor = textEdit->textCursor(); + textCursor.setPosition(textBlock.position()); + textCursor.setBlockFormat(textBlockFormat); + textEdit->setTextCursor(textCursor); + } + +// QString str = textEdit->toHtml(); +// updateFileVariWidth(str); +// textEdit->setHtml(str); + + QFont font = textEdit->font(); + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + textEdit->setFont(font); +} +void TextEditOption::on_buttonLineSpace_clicked() +{ + if(dialogLineSpace->exec() == QDialog::Accepted){ + onDialogLineSpaceAccepted(); + sysPara->saveParaToFile(); + textEdit->setFocus(); + sysPara->para.alterPrint.lineSpace = sysPara->para.textEditLineSpace; + } +} + +void TextEditOption::InsertQRCodeToEdit(QString barCodeName,int width,int height ,int enSave){ +#ifdef _2DCODE_ + textEdit->setText(""); + InsertQRCodeToEdit(barCodeName, width, height); + fileName = DOC_ROOT_DIR +QFileInfo(barCodeName).baseName() +".html"; + if(enSave) saveFile(); +#endif +} +void TextEditOption::InsertBarCodeToEdit(QString barCodeName,int width,int height ,int enSave){ +#ifdef _2DCODE_ + textEdit->setText(""); + InsertBarCodeToEdit(barCodeName, width, height); + fileName = DOC_ROOT_DIR +QFileInfo(barCodeName).baseName() +".html"; + if(enSave) saveFile(); +#endif +} +void TextEditOption::InsertBarCodeToEdit(QString barCodeName,int width,int height ) +{ +#ifdef _2DCODE_ + //dialogInsertVari->getValue(&varType,&digitalNum); + QTextCharFormat fmt = textEdit->currentCharFormat (); + textEdit->insertHtml(QString("") + .arg(barCodeName) + .arg(height).arg(width)); //插入索引后 + textEdit->mergeCurrentCharFormat(fmt); + //textEdit->setFocus(); + //qDebug()<<"TEOption:"<getValue(&varType,&digitalNum); + QTextCharFormat fmt = textEdit->currentCharFormat (); + textEdit->insertHtml(QString("") + .arg(barCodeName)//QFileInfo(barCodeName). + .arg(width).arg(height)); //插入索引后 + textEdit->mergeCurrentCharFormat(fmt); + //textEdit->setFocus(); + //qDebug()<<"TEOption:"<flagInsert ) { + dlgQrcode->GetOption((qrOption_t*)&sysPara->para.qrOption); + dlgQrcode->flagInsert=0; + if(sysPara->para.EditMode==PICFILE){ + + } + else { + + if(sysPara->para.qrOption.type==0){ + textEdit->insertHtml(QString("") + .arg(9).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 + } + else if(sysPara->para.qrOption.type==1){ + textEdit->insertHtml(QString("") + .arg(10).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 + } + else if(sysPara->para.qrOption.type==2){ + textEdit->insertHtml(QString("") + .arg(11).arg(sysPara->para.qrOption.height).arg(sysPara->para.qrOption.width)); //插入索引后 + } + } + } + sysPara->saveParaToFile(); +#endif +} +void TextEditOption::onBarCodeClose(){ +#ifdef _2DCODE_ + bcPara_t bcoption; + if(barcode->flagInsert ) { + barcode->GetOption((bcOption_t*)&sysPara->para.bcOption); + //qDebug()<<"onBarCodeClose"<para.bcOption.barType<para.bcOption.height; + barcode->GetOption2((bcPara_t*)&bcoption); + //qDebug()<<"onBarCodeClose"<para.bcOption.barType = bcoption.type; + barcode->flagInsert=0; + if(sysPara->para.EditMode==PICFILE){ + + } + else + { + fmt = textEdit->currentCharFormat (); + textEdit->insertHtml(QString("") + .arg(11).arg(bcoption.height).arg(bcoption.width).arg(bcoption.type*100+bcoption.height)); + + //插入索引后 + //qDebug()<") + // .arg(11).arg(bcoption.height).arg(bcoption.width).arg(bcoption.type*100+bcoption.height); + + int varType1= 7;//CNT1:7, CNT2:8 + int digitalNum; + if(sysPara->para.bcOption.var1En){ + digitalNum=sysPara->para.bcOption.var1Num; + textEdit->insertHtml(QString("%1%2").arg(sysPara->para.bcOption.TxtModule).arg(sysPara->para.bcOption.TxtLine)); + textEdit->insertHtml(QString("") + .arg(varType1).arg(ui->checkBoxBold->isChecked() && (barVarHeight<=16)?(digitalNum*100 + 75):digitalNum) + .arg(barVarHeight+1).arg( barVarWidth*digitalNum)); //插入索引后 + } + if(sysPara->para.bcOption.var2En) + { + digitalNum=sysPara->para.bcOption.var2Num; + textEdit->insertHtml(QString("") + .arg(varType1+1).arg(ui->checkBoxBold->isChecked() && (barVarHeight<=16)?(digitalNum*100 + 75):digitalNum) + .arg(barVarHeight+1).arg( barVarWidth*digitalNum)); //插入索引后 + } + + textEdit->mergeCurrentCharFormat(fmt); + } + } + sysPara->saveParaToFile(); +#endif +} + +void TextEditOption::onEditItemMode() +{ + ui->bottonNew->setDisabled(true); + ui->buttonSaveAS->setDisabled(true); + ui->pushButtonPreview->setDisabled(true); + ui->bottonSave->setText(tr("完成")); + sceneEditItem = true; +} +void TextEditOption::editItemModeDone() +{ + sceneEditItem = false; + ui->bottonNew->setDisabled(false); + ui->buttonSaveAS->setDisabled(false); + ui->pushButtonPreview->setDisabled(false); + ui->bottonSave->setText(tr("保存")); +} + +void TextEditOption::modbus_insert_pic(QString filename) +{ +// on_pushButtonFile_pressed(); + dialogFileOperation->modbus_openfile(filename); + +} + +void TextEditOption::updateSysParaToZero() //重载 +{ + if(sysPara){ + dialogLineSpace->setValue(sysPara->para.textEditLineSpace,sysPara->para.textEditCharSpace); + onDialogLineSpaceAccepted(); + } +} + +void TextEditOption::SetHiddenValue(bool select) +{ + dialogInsertVari->EnableHiddenValue(select); +} + +void TextEditOption::updateFileVariWidth(QString &str) + { + QString pattern = ""; + QRegExp rx(pattern); + int from = 0; + // 正常变量 + while(from < str.size() && from != -1) { + from = str.indexOf(rx,from);//返回匹配到到起始地址 + bool ok; + if(from != -1){//找到匹配的 + int width = rx.cap(4).toInt(&ok)*(sysPara->status.addSpace?2:1); + int digitalNum = rx.cap(3).toInt(&ok);//第二个匹配,数字到个数 + if(digitalNum>100){ //加粗 + digitalNum/=100; + ui->checkBoxBold->setChecked(true); + } + // 获取匹配的标签 + QString matchedTag = rx.cap(0); + // 构建新的标签,替换width属性值 + QString newTag = matchedTag; + int singlewidth = getSingleDigitWidth(); + int newWidth= (singlewidth + sysPara->para.textEditCharSpace) * digitalNum; + if(newWidth == width){ + return; + } + newTag.replace(QString("width=\"%1\"").arg(rx.cap(4)), QString("width=\"%1\"").arg(newWidth)); + // 替换原始文本中的标签 + str.replace(from, rx.matchedLength(), newTag); + from ++; + from+=newTag.length(); + } + } + } + +int TextEditOption::getSingleDigitWidth() +{ + int pixelSize = ui->labelFontSize->text().toInt(); + QFont font; + QString fontname=ui->labFontFamily->text(); + font.setFamily( + fontname // 20160812 + ); + font.setPixelSize(pixelSize); + font.setWeight(ui->checkBoxBold->isChecked() && (pixelSize<=16) ?QFont::Bold:QFont::Normal); + font.setLetterSpacing(QFont::AbsoluteSpacing,0); + QFontMetrics fontMetrics(font); + int width = (fontMetrics.width("0")); + // int width = (fontMetrics.width("0123456789"))/10; + // if(sysPara->para.flagOfModuleDecimal || sysPara->para.flagOfModuleHide){ + // width = (fontMetrics.width("0123456789.m "))/13; + // } + return width; +} diff --git a/Tftp/filetranseceiver.cpp b/Tftp/filetranseceiver.cpp index d6c5281..203353b 100644 --- a/Tftp/filetranseceiver.cpp +++ b/Tftp/filetranseceiver.cpp @@ -1,306 +1,306 @@ -#include "filetranseceiver.h" -#include -#include -#include -FileTranseceiver::FileTranseceiver(uint16_t hostshort) -{ -// struct sockaddr_in server_addr; -// bzero(&server_addr, sizeof(server_addr)); // 置字节字符串前n个字节为0,包括'\0' -// server_addr.sin_family = AF_INET; -// server_addr.sin_addr.s_addr = htons(INADDR_ANY); // 转小端,INADDR_ANY就是指定地址为0.0.0.0的地址 -// server_addr.sin_port = htons(5000); - serverThead = NULL; - sockfd = socket(PF_INET, SOCK_STREAM, 0); - - port=hostshort; - struct sockaddr_in seraddr; - seraddr.sin_family = AF_INET; - seraddr.sin_port = htons(hostshort); - seraddr.sin_addr.s_addr = htons(INADDR_ANY); - int tmp = 1; - setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(int)); - if(bind(sockfd,(struct sockaddr *)&seraddr,sizeof(seraddr)) == -1) - { - qDebug() << "tftp server bind error"; - return; - } - - if(listen(sockfd,5) == -1) - { - qDebug() << "listen error"; - return; - } - - serverThead = new QThread(); - moveToThread(serverThead); - QObject::connect(serverThead, SIGNAL(started()), this, SLOT(connectListen())); - //connect(&m_thread, SIGNAL(finished()), this, SLOT(deleteLater())); -// serverThead->start(); -// qDebug()<<"tftp server on..."; -} -FileTranseceiver::~FileTranseceiver(void) -{ - if(serverThead) { - disconnect(serverThead, SIGNAL(started()), this, SLOT(connectListen())); - if (serverThead->isRunning()) { - serverThead->quit(); - serverThead->wait(); - } - } - if(connfd) - close(connfd); - if(sockfd) - close(sockfd); -} -void FileTranseceiver::start() -{ - if(serverThead) - { - serverThead->start(); - } - qDebug()<<"tftp server on..."; -} - -void FileTranseceiver::connectListen() -{ - switch(port) - { - case 5001: - connectListen5001(); - break; - case 5002: - connectListen5002(); - break; - } -} - -void FileTranseceiver::connectListen5001() -{ - - struct msg info; - struct sockaddr_in cliaddr; - int len = sizeof(cliaddr); - pid_t pid; - int n; - QString fileName; - do - { - connfd = accept(sockfd,(struct sockaddr *)&cliaddr,(socklen_t *)&len); - if(connfd == -1) - { - qDebug() << "accept"; - continue; - } - -// pid = fork(); -// if(pid == -1) -// { -// qDebug() << "fork"; -// continue; -// } -// else if(pid == 0) - { - //close(sockfd); - while(1) - { - n = recv(connfd,&info,sizeof(info),0); - if(n == -1) - { - qDebug() << "recv"; - //exit(EXIT_FAILURE); - break; - } - if(n == 0) - { - qDebug() << "客户端退出"; - //exit(EXIT_SUCCESS); - break; - } - switch(info.type) - { -// case SEARCH: -// search_serverdir(connfd,info); -// break; - case DOWN: - ftp_download(connfd,info); - break; - case UP: - upload_ftp(connfd,info); - fileName = QString(info.fname); - qDebug()<<"emit fileRecieved(fileName)"; - emit fileRecieved(fileName); - break; - case UPGRADE: - upload_and_upgrade(connfd,info); - QFile::remove("/home/plg/QtUI"); - if(!QFile::copy("/tmp/QtUI", "/home/plg/QtUI")) - { - QMessageBox::about(0, tr("错误"), tr("更新失败!")); - break; - } - QMessageBox::information(0, tr("提示"), tr("软件更新成功,重启后生效!")); - break; - default: - break; - } - } - close(connfd); - } -// else -// { -// close(connfd); -// } - } - while(1); -} - -//将某文件中的内容传给客户端 -int FileTranseceiver::ftp_download(int connfd,struct msg info) -{ - FILE *fp; - - char name[100]; - memset(name,0,100); - sprintf(name, DOC_DIR"/%s",info.fname); -// QFile dl_file(QString::fromUtf8(name)); -// if (!dl_file.exists()) { -// return -1; -// } - //qDebug()<<"receive file name:"< +#include +#include +FileTranseceiver::FileTranseceiver(uint16_t hostshort) +{ +// struct sockaddr_in server_addr; +// bzero(&server_addr, sizeof(server_addr)); // 置字节字符串前n个字节为0,包括'\0' +// server_addr.sin_family = AF_INET; +// server_addr.sin_addr.s_addr = htons(INADDR_ANY); // 转小端,INADDR_ANY就是指定地址为0.0.0.0的地址 +// server_addr.sin_port = htons(5000); + serverThead = NULL; + sockfd = socket(PF_INET, SOCK_STREAM, 0); + + port=hostshort; + struct sockaddr_in seraddr; + seraddr.sin_family = AF_INET; + seraddr.sin_port = htons(hostshort); + seraddr.sin_addr.s_addr = htons(INADDR_ANY); + int tmp = 1; + setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(int)); + if(bind(sockfd,(struct sockaddr *)&seraddr,sizeof(seraddr)) == -1) + { + qDebug() << "tftp server bind error"; + return; + } + + if(listen(sockfd,5) == -1) + { + qDebug() << "listen error"; + return; + } + + serverThead = new QThread(); + moveToThread(serverThead); + QObject::connect(serverThead, SIGNAL(started()), this, SLOT(connectListen())); + //connect(&m_thread, SIGNAL(finished()), this, SLOT(deleteLater())); +// serverThead->start(); +// qDebug()<<"tftp server on..."; +} +FileTranseceiver::~FileTranseceiver(void) +{ + if(serverThead) { + disconnect(serverThead, SIGNAL(started()), this, SLOT(connectListen())); + if (serverThead->isRunning()) { + serverThead->quit(); + serverThead->wait(); + } + } + if(connfd) + close(connfd); + if(sockfd) + close(sockfd); +} +void FileTranseceiver::start() +{ + if(serverThead) + { + serverThead->start(); + } + qDebug()<<"tftp server on..."; +} + +void FileTranseceiver::connectListen() +{ + switch(port) + { + case 5001: + connectListen5001(); + break; + case 5002: + connectListen5002(); + break; + } +} + +void FileTranseceiver::connectListen5001() +{ + + struct msg info; + struct sockaddr_in cliaddr; + int len = sizeof(cliaddr); + pid_t pid; + int n; + QString fileName; + do + { + connfd = accept(sockfd,(struct sockaddr *)&cliaddr,(socklen_t *)&len); + if(connfd == -1) + { + qDebug() << "accept"; + continue; + } + +// pid = fork(); +// if(pid == -1) +// { +// qDebug() << "fork"; +// continue; +// } +// else if(pid == 0) + { + //close(sockfd); + while(1) + { + n = recv(connfd,&info,sizeof(info),0); + if(n == -1) + { + qDebug() << "recv"; + //exit(EXIT_FAILURE); + break; + } + if(n == 0) + { + qDebug() << "客户端退出"; + //exit(EXIT_SUCCESS); + break; + } + switch(info.type) + { +// case SEARCH: +// search_serverdir(connfd,info); +// break; + case DOWN: + ftp_download(connfd,info); + break; + case UP: + upload_ftp(connfd,info); + fileName = QString(info.fname); + qDebug()<<"emit fileRecieved(fileName)"; + emit fileRecieved(fileName); + break; + case UPGRADE: + upload_and_upgrade(connfd,info); + QFile::remove("/home/plg/QtUI"); + if(!QFile::copy("/tmp/QtUI", "/home/plg/QtUI")) + { + QMessageBox::about(0, tr("错误"), tr("更新失败!")); + break; + } + QMessageBox::information(0, tr("提示"), tr("软件更新成功,重启后生效!")); + break; + default: + break; + } + } + close(connfd); + } +// else +// { +// close(connfd); +// } + } + while(1); +} + +//将某文件中的内容传给客户端 +int FileTranseceiver::ftp_download(int connfd,struct msg info) +{ + FILE *fp; + + char name[100]; + memset(name,0,100); + sprintf(name, DOC_DIR"/%s",info.fname); +// QFile dl_file(QString::fromUtf8(name)); +// if (!dl_file.exists()) { +// return -1; +// } + //qDebug()<<"receive file name:"< -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define DOC_DIR "/home/plg/doc" -#define SEARCH 100 -#define DOWN 200 -#define END 500 -#define FAIL 300 -#define SUCCESS 400 -#define UP 600 -#define UPGRADE 601 - -struct msg -{ - int type; - int flag; - char buf[64]; - char fname[100]; -}; - -struct datasNet -{ - unsigned char Header[2];//0x51,0xa5 - unsigned char InstructionCode:8;//0x1,0x2,0x3... - unsigned char DataLenght[4]; - unsigned char *Data; - unsigned char Checksum; - unsigned char Ender[2];//0xa5,0x5a -}; -typedef unsigned char UCHAR; - -class FileTranseceiver : public QObject -{ - Q_OBJECT -public: - explicit FileTranseceiver(uint16_t hostshort); - ~FileTranseceiver(void); - - int ftp_download(int connfd,struct msg info); - int upload_ftp(int connfd,struct msg info); - void start(); - void showData(QString tag,QByteArray dat)const; - -protected slots: - void connectListen(); -private: - uint16_t port; - int sockfd; - int connfd; - QThread *serverThead; - int upload_and_upgrade(int connfd, msg info); - void connectListen5001(); - void connectListen5002(); - bool CheckSumIn( UCHAR *buf, unsigned int len); -signals: - void fileRecieved(QString fileName); -}; - -#endif // FILETRANSECEIVER_H +#ifndef FILETRANSECEIVER_H +#define FILETRANSECEIVER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define DOC_DIR "/home/plg/doc" +#define SEARCH 100 +#define DOWN 200 +#define END 500 +#define FAIL 300 +#define SUCCESS 400 +#define UP 600 +#define UPGRADE 601 + +struct msg +{ + int type; + int flag; + char buf[64]; + char fname[100]; +}; + +struct datasNet +{ + unsigned char Header[2];//0x51,0xa5 + unsigned char InstructionCode:8;//0x1,0x2,0x3... + unsigned char DataLenght[4]; + unsigned char *Data; + unsigned char Checksum; + unsigned char Ender[2];//0xa5,0x5a +}; +typedef unsigned char UCHAR; + +class FileTranseceiver : public QObject +{ + Q_OBJECT +public: + explicit FileTranseceiver(uint16_t hostshort); + ~FileTranseceiver(void); + + int ftp_download(int connfd,struct msg info); + int upload_ftp(int connfd,struct msg info); + void start(); + void showData(QString tag,QByteArray dat)const; + +protected slots: + void connectListen(); +private: + uint16_t port; + int sockfd; + int connfd; + QThread *serverThead; + int upload_and_upgrade(int connfd, msg info); + void connectListen5001(); + void connectListen5002(); + bool CheckSumIn( UCHAR *buf, unsigned int len); +signals: + void fileRecieved(QString fileName); +}; + +#endif // FILETRANSECEIVER_H diff --git a/TimeSettingDialog.cpp b/TimeSettingDialog.cpp index bd2a76a..6b29a57 100644 --- a/TimeSettingDialog.cpp +++ b/TimeSettingDialog.cpp @@ -1,53 +1,53 @@ -#include "TimeSettingDialog.h" -#include "ui_timesettingdialog.h" - -TimeSettingDialog::TimeSettingDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::TimeSettingDialog) -{ - ui->setupUi(this); - this->setWindowTitle(tr("设置时间")); - this->setFixedSize(this->geometry().width(),this->geometry().height()); -} - -TimeSettingDialog::~TimeSettingDialog() -{ - delete ui; -} - -int TimeSettingDialog::getYear(){ - return ui->spinBoxYear->value(); -} -int TimeSettingDialog::getMonth(){ - return ui->spinBoxMonth->value(); -} -int TimeSettingDialog::getDay(){ - return ui->spinBoxDay->value(); -} -int TimeSettingDialog::getHour(){ - return ui->spinBoxHour->value(); -} -int TimeSettingDialog::getMinute(){ - return ui->spinBoxMinute->value(); -} -int TimeSettingDialog::getSecond(){ - return ui->spinBoxSecond->value(); -} -void TimeSettingDialog::setYear(int value){ - ui->spinBoxYear->setValue(value); -} -void TimeSettingDialog::setMonth(int value){ - ui->spinBoxMonth->setValue(value); -} -void TimeSettingDialog::setDay(int value){ - ui->spinBoxDay->setValue(value); -} -void TimeSettingDialog::setHour(int value){ - ui->spinBoxHour->setValue(value); -} -void TimeSettingDialog::setMinute(int value){ - ui->spinBoxMinute->setValue(value); -} -void TimeSettingDialog::setSecond(int value){ - ui->spinBoxSecond->setValue(value); -} +#include "TimeSettingDialog.h" +#include "ui_timesettingdialog.h" + +TimeSettingDialog::TimeSettingDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::TimeSettingDialog) +{ + ui->setupUi(this); + this->setWindowTitle(tr("设置时间")); + this->setFixedSize(this->geometry().width(),this->geometry().height()); +} + +TimeSettingDialog::~TimeSettingDialog() +{ + delete ui; +} + +int TimeSettingDialog::getYear(){ + return ui->spinBoxYear->value(); +} +int TimeSettingDialog::getMonth(){ + return ui->spinBoxMonth->value(); +} +int TimeSettingDialog::getDay(){ + return ui->spinBoxDay->value(); +} +int TimeSettingDialog::getHour(){ + return ui->spinBoxHour->value(); +} +int TimeSettingDialog::getMinute(){ + return ui->spinBoxMinute->value(); +} +int TimeSettingDialog::getSecond(){ + return ui->spinBoxSecond->value(); +} +void TimeSettingDialog::setYear(int value){ + ui->spinBoxYear->setValue(value); +} +void TimeSettingDialog::setMonth(int value){ + ui->spinBoxMonth->setValue(value); +} +void TimeSettingDialog::setDay(int value){ + ui->spinBoxDay->setValue(value); +} +void TimeSettingDialog::setHour(int value){ + ui->spinBoxHour->setValue(value); +} +void TimeSettingDialog::setMinute(int value){ + ui->spinBoxMinute->setValue(value); +} +void TimeSettingDialog::setSecond(int value){ + ui->spinBoxSecond->setValue(value); +} diff --git a/TimeSettingDialog.h b/TimeSettingDialog.h index 81f19eb..9f3517d 100644 --- a/TimeSettingDialog.h +++ b/TimeSettingDialog.h @@ -1,34 +1,34 @@ -#ifndef TIMESETTINGDIALOG_H -#define TIMESETTINGDIALOG_H - -#include - -namespace Ui { -class TimeSettingDialog; -} - -class TimeSettingDialog : public QDialog -{ - Q_OBJECT - -public: - explicit TimeSettingDialog(QWidget *parent = 0); - ~TimeSettingDialog(); - - int getYear(); - int getMonth(); - int getDay(); - int getHour(); - int getMinute(); - int getSecond(); - void setYear(int value); - void setMonth(int value); - void setDay(int value); - void setHour(int value); - void setMinute(int value); - void setSecond(int value); -private: - Ui::TimeSettingDialog *ui; -}; - -#endif // TIMESETTINGDIALOG_H +#ifndef TIMESETTINGDIALOG_H +#define TIMESETTINGDIALOG_H + +#include + +namespace Ui { +class TimeSettingDialog; +} + +class TimeSettingDialog : public QDialog +{ + Q_OBJECT + +public: + explicit TimeSettingDialog(QWidget *parent = 0); + ~TimeSettingDialog(); + + int getYear(); + int getMonth(); + int getDay(); + int getHour(); + int getMinute(); + int getSecond(); + void setYear(int value); + void setMonth(int value); + void setDay(int value); + void setHour(int value); + void setMinute(int value); + void setSecond(int value); +private: + Ui::TimeSettingDialog *ui; +}; + +#endif // TIMESETTINGDIALOG_H diff --git a/TouchScreenConf/qtui_Capacitance b/TouchScreenConf/qtui_Capacitance index 8a07da0..84dd4a8 100644 --- a/TouchScreenConf/qtui_Capacitance +++ b/TouchScreenConf/qtui_Capacitance @@ -1,49 +1,49 @@ -#!/bin/sh -#echo "start up qtui...." -export QT_QWS_FONTDIR=/usr/lib/fonts -export QWS_MOUSE_PROTO="TSLIB:/dev/input/event1 mouseman:/dev/input/mice" - -cd /dev/ && ln -s am335x_visco_pwm pwm && ln -s am335x_suction_pwm pwm1 - -if [ -e /dev/input/touchscreen0 ]; then - TSLIB_TSDEVICE=/dev/input/touchscreen0 - export TSLIB_CALIBFILE=/etc/pointercal - export TSLIB_CONFFILE=/usr/local/etc/ts.conf - export TSLIB_PLUGINDIR=/usr/lib/ts - export TSLIB_TSDEVICE -fi - - -if [ ! -f /etc/pointercal ];then - touch /etc/pointercal - ts_calibrate -fi - -cd /home/plg -if [ ! -f /home/plg/runFlag ];then - chmod a+x InkJetPrinter - ./InkJetPrinter -qws -fi - - -#bootup QtUI -chmod +x QtUI -./QtUI -qws -display VNC:LinuxFb & -rm /home/plg/runFlag - -sleep 1 -#mount mmc and usb disk -if [ -f /dev/mmcblk0p1 ];then - mount /dev/mmcblk0p1 /mnt/mmc/ -fi - -ln -sf /mnt/udisk /udisk -if [ -f /dev/sda1 ];then - mount /dev/sda1 /mnt/udisk/ -fi - -sleep 2 -#start quectel-CM -./quectel-CM & - - +#!/bin/sh +#echo "start up qtui...." +export QT_QWS_FONTDIR=/usr/lib/fonts +export QWS_MOUSE_PROTO="TSLIB:/dev/input/event1 mouseman:/dev/input/mice" + +cd /dev/ && ln -s am335x_visco_pwm pwm && ln -s am335x_suction_pwm pwm1 + +if [ -e /dev/input/touchscreen0 ]; then + TSLIB_TSDEVICE=/dev/input/touchscreen0 + export TSLIB_CALIBFILE=/etc/pointercal + export TSLIB_CONFFILE=/usr/local/etc/ts.conf + export TSLIB_PLUGINDIR=/usr/lib/ts + export TSLIB_TSDEVICE +fi + + +if [ ! -f /etc/pointercal ];then + touch /etc/pointercal + ts_calibrate +fi + +cd /home/plg +if [ ! -f /home/plg/runFlag ];then + chmod a+x InkJetPrinter + ./InkJetPrinter -qws +fi + + +#bootup QtUI +chmod +x QtUI +./QtUI -qws -display VNC:LinuxFb & +rm /home/plg/runFlag + +sleep 1 +#mount mmc and usb disk +if [ -f /dev/mmcblk0p1 ];then + mount /dev/mmcblk0p1 /mnt/mmc/ +fi + +ln -sf /mnt/udisk /udisk +if [ -f /dev/sda1 ];then + mount /dev/sda1 /mnt/udisk/ +fi + +sleep 2 +#start quectel-CM +./quectel-CM & + + diff --git a/TouchScreenConf/qtui_Resistance b/TouchScreenConf/qtui_Resistance index aa71a2c..9099944 100644 --- a/TouchScreenConf/qtui_Resistance +++ b/TouchScreenConf/qtui_Resistance @@ -1,49 +1,49 @@ -#!/bin/sh -#echo "start up qtui...." -export QT_QWS_FONTDIR=/usr/lib/fonts -export QWS_MOUSE_PROTO="TSLIB:/dev/input/event0 mouseman:/dev/input/mice" - -cd /dev/ && ln -s am335x_visco_pwm pwm && ln -s am335x_suction_pwm pwm1 - -if [ -e /dev/input/touchscreen0 ]; then - TSLIB_TSDEVICE=/dev/input/touchscreen0 - export TSLIB_CALIBFILE=/etc/pointercal - export TSLIB_CONFFILE=/usr/local/etc/ts.conf - export TSLIB_PLUGINDIR=/usr/lib/ts - export TSLIB_TSDEVICE -fi - - -if [ ! -f /etc/pointercal ];then - touch /etc/pointercal - ts_calibrate -fi - -cd /home/plg -if [ ! -f /home/plg/runFlag ];then - chmod a+x InkJetPrinter - ./InkJetPrinter -qws -fi - - -#bootup QtUI -chmod +x QtUI -./QtUI -qws -display VNC:LinuxFb & -rm /home/plg/runFlag - -sleep 1 -#mount mmc and usb disk -if [ -f /dev/mmcblk0p1 ];then - mount /dev/mmcblk0p1 /mnt/mmc/ -fi - -ln -sf /mnt/udisk /udisk -if [ -f /dev/sda1 ];then - mount /dev/sda1 /mnt/udisk/ -fi - -sleep 2 -#start quectel-CM -./quectel-CM & - - +#!/bin/sh +#echo "start up qtui...." +export QT_QWS_FONTDIR=/usr/lib/fonts +export QWS_MOUSE_PROTO="TSLIB:/dev/input/event0 mouseman:/dev/input/mice" + +cd /dev/ && ln -s am335x_visco_pwm pwm && ln -s am335x_suction_pwm pwm1 + +if [ -e /dev/input/touchscreen0 ]; then + TSLIB_TSDEVICE=/dev/input/touchscreen0 + export TSLIB_CALIBFILE=/etc/pointercal + export TSLIB_CONFFILE=/usr/local/etc/ts.conf + export TSLIB_PLUGINDIR=/usr/lib/ts + export TSLIB_TSDEVICE +fi + + +if [ ! -f /etc/pointercal ];then + touch /etc/pointercal + ts_calibrate +fi + +cd /home/plg +if [ ! -f /home/plg/runFlag ];then + chmod a+x InkJetPrinter + ./InkJetPrinter -qws +fi + + +#bootup QtUI +chmod +x QtUI +./QtUI -qws -display VNC:LinuxFb & +rm /home/plg/runFlag + +sleep 1 +#mount mmc and usb disk +if [ -f /dev/mmcblk0p1 ];then + mount /dev/mmcblk0p1 /mnt/mmc/ +fi + +ln -sf /mnt/udisk /udisk +if [ -f /dev/sda1 ];then + mount /dev/sda1 /mnt/udisk/ +fi + +sleep 2 +#start quectel-CM +./quectel-CM & + + diff --git a/TriggerCtrl.cpp b/TriggerCtrl.cpp index 5b1ecd8..f6449eb 100644 --- a/TriggerCtrl.cpp +++ b/TriggerCtrl.cpp @@ -1,636 +1,636 @@ -#include "TriggerCtrl.h" -#include "ui_triggerctrl.h" -#include -#include -#include -#include -#include "qdebug.h" -#include -#include "myinclude.h" -#include "Public.h" -#include "VerBVersion.h" -#include "DevOp.h" -#include "InkJetPrinter.h" -extern InkJetPrinter *pInkJectPrinter; -/* readme: 20140809 -1. 同步字宽mm: 0.1+ w*(4-0.1) = 0.1+3.9w (mm) -2. 按长度喷印: -*/ - -// 20140923-12:05版本存在图形方式下变量不变绿问题,新版本已经更正 -// 20141013-16:36修正密码有效期设置错误。 -//2015-10-17 二维码变量问题 -// 2015-11-01 无聊: 要从V6S版本恢复原来的 para.set_HVData_Flag = 0; 参数 -// 估计过段时间又要要求增加 UART功能。 V6S 原来已经有这个功能了。但他们不用!! -// 20151109 新增计数1和计数器2单独立即清零 版本号 No42 -// 更新了Vietname字库,使用中文使用wenquanyiBitmap,编译uncode编码使用wenquanyimicrohei,英文自己编,越南语自己编,基于DejaVu Sans -// 新版软件更新或升级,会因参数错位,出现隔膜位置设定值(等参数)错误,引起主墨泵不工作,开机不循环等现象。(解决办法,重新检查并设置所有参数) -// 20160203:修改了变量定位方式,更新的Image图片。 将左下角更换为RGB = 250,250,0 -=== 0xFFF7FC00 -// 修正了停止打印关闭高压的问题,重新打印出现高压故障 -// 修改了密码一周一变,增加了密码校验,需要使用新版20以上的手机密码软件,密码为7位; -// 20160218 修改了提示框显示方式,避免提示阻塞处理进程 - -// 20160304 优化了变量显示; 增加了中心旋转交替功能;增加了 13位随机码打印功能; 修正界面显示字库部分汉字问题 -// 本次修改需要同时更并按ARM和FPGA - -// FPGA实现自动点距调整,实现连续点位置修正 20160714 FPGA版本 V44, 0714B -// 20160715 : 去掉了“点距电压微调”、“内存数据显示”、部分相检控制参数设置 -// 20160729: 发现打开历史记录会死机问题,原因待查。但执行删除历史记录后,可避免再次死机。 -// 20160723: 增加电眼复位功能。 与电眼清零不同,复位时,计数不清零,而是等于预设的当前值。 -// 20160718: 参考日立方案,优化打印效果 -/* - 20160728:发现历史记录打开时,会死机 - 20160729: 查找原因:fi -// 20160806:重要修改 : 毫米脉冲的系数由X8改为X256,原因是:使用X8时传递误差较大,导致1000mm会有6mm误差, 使用X256(即8位二进制表示小数时,可以精确到0.004,从而提高精度) - X8 时,小数精度为0.125而已 - - 20160812:增加左横,右横变量 - if((varType<9) // 普通变量 - ||(varType>=20 && varType<29) // 横左变量 - ||(varType>=40 && varType<49) // 右横变量 - if(fontname.contains("SerifL") ||fontname.contains("serifl") ) varType1= 20+varType; - else if(fontname.contains("SerifR") ||fontname.contains("serifr") ) varType1= 40+varType; - 20160831: 增加临时密码,每小时一变 - - 20160904: 解决重新开机后,有时不能自动打印文件问题。 - 20160905: 第二行单独变量时显示不全问题 - - // 20160912: 去掉高压故障自动关闭回收的默认值 1 - // 20160912: 设置了隐藏按键,用于对墨线时间和开机次数进行复位 No49 - 20160927: FIFO实现RAND 码上传,暂时与RST0806 No49区别开来 No50 - 20161212: 修改总产品计数器清零功能。由ARM清零改为FPGA清零 No51 // [3]总产品计数器清零FPGA - 20161217: 增加了 SPV210编译选项,以处理V6核心版驱动问题 - 修改随机码处理函数,以解决 不能输出奇数位 随机码问题。 - - 20170217: 有厂家只想打一条横线,改最小列点阵数。 - 20170224: 输入密码不回显 - 20170313: 修改开机重启或重载参数时,设定计数当前值为起始值 - 20170318: 制作0318版本的刷机文件 - - 20170803: 增加外接屏功能,20170808完成 - - */ - -//#define NON_CABLE//喷印间隔固定 -// 20160507 1138 -// 20161209 编辑 小数点喷印间隔 -// 20170603: 太阳能条码专用版本 -// Nam Ninh phồng tuyệt vời Mã Technology Co., Ltd. -TriggerCtrl::TriggerCtrl(QWidget *parent) : - QWidget(parent), - ui(new Ui::TriggerCtrl) -{ - ui->setupUi(this); - QRegExp double_rx100("10000000|([0-9]{1,8}[\.][0-9]{0,1})"); - ui->spinBoxSynTriggerPrintLen->setValidator(new QRegExpValidator(double_rx100,ui->spinBoxSynTriggerPrintLen)); -#ifdef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(0); -#endif - //#endif - pulseNumFix = new PulseNumFix(parent); - pulseNumFix->hide(); - ui->lineEditTriggerPulsePerMm->setValidator(new QDoubleValidator(0)); - connect(pulseNumFix,SIGNAL(pulseNuxFixDone(float)),this,SLOT(onPulseNumFixDone(float))); - - updateSysStatusToUI(); - - QString s; -// s.sprintf("%d.%d.%02d%s%s_", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER,SUB_VERSION,SUB_RFID); - s.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); - s = s + (QString) Public::DateToString(__DATE__)+"."+SUB_VER+SUB_RFID; - ui->test_version->setText(s); - ui->checkBoxEleEyeMakeClean->setVisible(false); - tr("独立参数"); - - if(Public::ReadLanguageName()=="Chinese"){ - ui->label_miv12->setPixmap(QPixmap(QString::fromUtf8(":/image/MIV12.png"))); - }else - { - ui->label_miv12->setPixmap(QPixmap(QString::fromUtf8(":/image/MIV13.png"))); - } - ui->spinBoxOuputPulseCol->setHidden(1); -} - -TriggerCtrl::~TriggerCtrl() -{ - delete ui; - delete pulseNumFix; -} - -void TriggerCtrl::setTriggerUI(int triggerMode){ - - ui->radioButtonDelayTrigger->setChecked(triggerMode == PRINT_TRIGGER_TIME); - ui->spinBoxDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME); - ui->labelDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME); - ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME); - ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME); - - ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); - ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); - ui->checkBoxSynMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->checkEyeTriggerSynPrintEn->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - - if(sysPara->para.eleEyeTriggerSynPrintEn && - (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) - ) - { - //ui->radioButtonSynTrigger->setChecked(1); - ui->spinBoxSynTriggerPrintLen->setEnabled(0); - ui->labelSynTriggerPrintLen->setEnabled(1); - ui->lineEditTriggerPulsePerMm->setEnabled(1); - ui->labelTriggerPulsePerMm->setEnabled(1); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); - ui->labelSynTriggerPrintLenRatio->setEnabled(1); - ui->checkBoxEleEyeMakeClean->setEnabled(1); - ui->pushButtonApplyPulseFix->setEnabled(1); - ui->comboBoxSynPrintMode->setEnabled(1); - ui->labelSynPrintMode->setEnabled(1); - //ui->checkBoxAutoSpeedEN->setEnabled (1); - ui->labelEleMaskTime->setEnabled(1); - ui->spinBoxEleMaskTime->setEnabled(1); - - //ui->spinBoxEleMaskTime->setEnabled(1); - - ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); - ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); - ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)")); - } - else - { - ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); -#ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); -#endif - ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - //ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - //ui->labelEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - //ui->spinBoxEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER) - { - ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); - } - else - { - ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); - } - ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); - ui->labelEleMaskTime->setText(tr("封锁时间(毫秒)")); - } - if(( ( //sysPara->para.eleEyeTriggerSynPrintEn || - ui->checkEyeTriggerSynPrintEn->isChecked()) - &&(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)) - || triggerMode == PRINT_TRIGGER_SYNCHRONIZER ) - { - ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); - } - else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):")); - - setSynPrintMode(sysPara->para.sysTriggerPrintMode); - - - //72版本禁用该输入框 - //67打开 - // if(triggerMode== PRINT_TRIGGER_SYNCHRONIZER){ - // const unsigned short &FpgaVer=sysPara->status.build_dat.builTime; - // if(72==FpgaVer) - // { - // ui->spinBoxSynTriggerPrintLenRatio->setValue(0); - // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false); - // } - // else if(67==FpgaVer) - // { - // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true); - // } - // } - // else{ - // ui->spinBoxSynTriggerPrintLenRatio->setValue(0); - // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false); - // } -} - -void TriggerCtrl::setSynPrintMode(int mode){ - ui->labelSynTriggerPrintLenRatio->setText((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?tr("字符宽度"):tr("喷印比例(%)")); - ui->comboBoxSynPrintMode->setCurrentIndex(mode); - //ui->spinBoxSynTriggerPrintLenRatio->setValue((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?sysPara->para.synCharWidthRatio:sysPara->para.synTriggerPrintLenRatio); - //edit@11-18 - if(SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode) - { - ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); - } - - const bool bShow=SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode; - //隐藏文本框 - ui->labelSynTriggerPrintLenRatio->setVisible(bShow); - //隐藏输入框 - ui->spinBoxSynTriggerPrintLenRatio->setVisible(bShow); -} - -void TriggerCtrl::GetTriggerUIPara(){ - if(sysPara){ - sysPara->para.printDelayMs = ui->spinBoxDelayTriggerValue->value(); - sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex(); - sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); - sysPara->para.photoElectricityRepeateNum = ui->spinBoxEleEyeTriggerRepeatCnt->value(); - - // - sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat(); - //sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->value(); -#ifdef NON_CABLE - sysPara->para.synTriggerPrintLenMm = 255.0; - ui->spinBoxSynTriggerPrintLen->setText("255"); -#endif - sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat(); - - sysPara->para.sysTriggerPrintMode = ui->comboBoxSynPrintMode->currentIndex(); - if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH) - //edit@11-19 - ;//sysPara->para.synCharWidthRatio = ui->spinBoxSynTriggerPrintLenRatio->value(); - else - sysPara->para.synTriggerPrintLenRatio = ui->spinBoxSynTriggerPrintLenRatio->value(); - - // 原代码: - //sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x7fff) | ( ui->comboBoxAltMirrType->currentIndex()==1?0x8000:0x0000); - - // 20160303: - sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x0fff) |( ( ui->comboBoxAltMirrType->currentIndex())<<12 ); - - //qDebug()<< (sysPara->para.AltMirrorGap & 0x0fff) << (sysPara->para.AltMirrorGap & 0xf000); - - if(ui->radioButtonDelayTrigger->isChecked()) - sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; - else if(ui->radioButtonEleEyeLevelTrigger->isChecked()) - sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL; - else if(ui->radioButtonEleEyeEdgetTrigger->isChecked()) - sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE; - else if(ui->radioButtonSynTrigger->isChecked()) - sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; - else - sysPara->para.printTriggerMode = PRINT_TRIGGER_NONE; - - sysPara->para.eleEyeTriggerSynPrintEn = ui->checkEyeTriggerSynPrintEn->isChecked (); - sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value(); - sysPara->para.synClearCntInEleEyeMode = ui->checkBoxSynMakeClean->isChecked(); - sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked(); - //sysPara->para.autoSynSpeedEn = ui->checkBoxAutoSpeedEN->isChecked (); - sysPara->para.autoSynSpeedEn = 0; - //sysPara->para.synPulsePerMmX8 = (unsigned short)(sysPara->para.synPulseNumPerMm *256); - sysPara->para.synPulsePerMmX8 = (unsigned short)((unsigned int)sysPara->para.synPulseNumPerMm <<8); - sysPara->para.eleMaskTime = ui->spinBoxEleMaskTime->value(); - //qDebug()<<"eleEyeClearCntInSynMode"<< sysPara->para.eleEyeClearCntInSynMode ; - sysPara->para.synchronizorActType = ui->comboBoxSyncActType->currentIndex(); - //qDebug()<<"synchronizorActType"<< sysPara->para.synchronizorActType; - - sysPara->para.pulse_sinal_value = ui->spinBoxpluseSinal->value(); - } -} -void TriggerCtrl::TriggerupdateSysParaToUI(){ - updateSysParaToUI(); -} - -void TriggerCtrl::updateSysParaToUI(){ - if(sysPara) - { - /*----------------------------------------*/ - setTriggerUI(sysPara->para.printTriggerMode); - ui->spinBoxDelayTriggerValue->setValue(sysPara->para.printDelayMs); -#ifndef NON_CABLE - ui->comboBoxTimeTriggerMode->setCurrentIndex(sysPara->para.timeTriggerPrintMode); -#endif - ui->spinBoxEleEyeTriggerIntervalMs->setValue(sysPara->para.elecEyeTriggerInterval); - ui->spinBoxOutputPulseDelayMs->setValue(sysPara->para.outputPulseDelayMs); - ui->spinBoxEleEyeTriggerRepeatCnt->setValue(sysPara->para.photoElectricityRepeateNum); - - //ui->spinBoxSynTriggerPrintLen->setValue(sysPara->para.synTriggerPrintLenMm); - ui->spinBoxSynTriggerPrintLen->setText(QString::number(sysPara->para.synTriggerPrintLenMm)); - ui->lineEditTriggerPulsePerMm->setText(QString::number(sysPara->para.synPulseNumPerMm)); - if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH) - //edit@11-19 - ;//ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synCharWidthRatio); - else - ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); - - /*----------------------------------------*/ - ui->spinBoxEleEyeTriggerPrintDelay->setValue(sysPara->para.eleEyeTriggerPrintDelay); - ui->checkBoxSynMakeClean->setChecked(sysPara->para.synClearCntInEleEyeMode); - //ui->checkBoxEleEyeMakeClean->setChecked(sysPara->para.eleEyeClearCntInSynMode); - ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f); - - ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable); - ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); - ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); - ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); - - ui->labelOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); - - //ui->spinBoxOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); - - ui->spinBoxOutputPulseDelayMs->setEnabled(true /*sysPara->para.outputPulseDelayMs*/); - ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol); - ui->checkEyeTriggerSynPrintEn->setChecked (sysPara->para.eleEyeTriggerSynPrintEn); - ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType); - //ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn ); - ui->spinBoxEleMaskTime->setValue(sysPara->para.eleMaskTime); - - ui->spinBoxAltMirrorGap->setValue( sysPara->para.AltMirrorGap & 0x0fff ); - - ui->comboBoxAltMirrType->setCurrentIndex( (sysPara->para.AltMirrorGap>>12) & 0x000F); - ui->spinBoxpluseSinal->setValue(sysPara->para.pulse_sinal_value); - - - //72版本禁用该输入框 - //67打开 - } -} - -void TriggerCtrl::applyUIPara(){ - if(sysPara){ - GetTriggerUIPara(); - if(sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER) - { - if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay ) - { - QMessageBox::information(this,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔")); - } - } - sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked(); - sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value(); - sysPara->para.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value(); - sysPara->para.OuputPulseCol = ui->spinBoxOuputPulseCol->value(); - if(( ( //sysPara->para.eleEyeTriggerSynPrintEn || - ui->checkEyeTriggerSynPrintEn->checkState()==1 ) - &&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)) - || sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER ) - { - ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); - } - else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):")); - if(sysPara->devOp->writeFpgaPrintPara() != -1) - QMessageBox::information(this,tr("提示"),tr("应用成功")); - - emit checkPrintIntervalSignal(); - } -} - -void TriggerCtrl::updateSysStatusToUI(){ - static char t_init = 0; - if(sysPara){ - if(t_init == 0){ - sysPara->loadParaFromFile(); - //qDebug()<<"sysPara->para.pulse_sinal_value="<para.pulse_sinal_value; - ui->spinBoxpluseSinal->setValue(sysPara->para.pulse_sinal_value); - t_init = 1; - } - } -} - -void TriggerCtrl::on_checkEyeTriggerSynPrintEn_pressed() -{ - -} - -void TriggerCtrl::on_radioButtonDelayTrigger_pressed() -{ - setTriggerUI(PRINT_TRIGGER_TIME); -// emit synDisableFontWidth(false); -} - -void TriggerCtrl::on_radioButtonEleEyeEdgetTrigger_pressed() -{ - setTriggerUI(PRINT_TRIGGER_ELEC_EYE_EDGE); -// emit synDisableFontWidth(false); -} - -void TriggerCtrl::on_radioButtonEleEyeLevelTrigger_pressed() -{ - setTriggerUI(PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); -// emit synDisableFontWidth(false); -} - -void TriggerCtrl::on_radioButtonSynTrigger_pressed() -{ - //edit@11-19 - sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; - setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER); -// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime; -// //72版本禁用字符宽度 -// if(72 == FpgaVer){ -// ui->spinBoxSynTriggerPrintLenRatio->setValue(0); -// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0); -// }else if (67 == FpgaVer) -// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); -// emit synDisableFontWidth(true); -} - -void TriggerCtrl::on_pushButtonApplyPulseFix_clicked() -{ - pulseNumFix->bindSysPara(sysPara); - pulseNumFix->hide(); - pulseNumFix->show(); -} - -void TriggerCtrl::onPulseNumFixDone(float value){ - ui->lineEditTriggerPulsePerMm->setText(QString::number(value)); -} - -void TriggerCtrl::on_comboBoxSynPrintMode_currentIndexChanged(int index) -{ - setSynPrintMode(index); -} -void TriggerCtrl::on_pushButtonApply_pressed() -{ - applyUIPara(); - if(sysPara)sysPara->saveParaToFile (); - emit autoUpdateFontWidthByTriggerCtrl(sysPara->status.textEditTotalCol); - TriggerCtrlLog(); -} - -void TriggerCtrl::TriggerCtrlLog(){ - - qDebug()<para.printTriggerMode); - qDebug()<lineEditTriggerPulsePerMm->text().toFloat()); - qDebug()<spinBoxSynTriggerPrintLen->text().toFloat()); - qDebug()<comboBoxSynPrintMode->currentIndex()); - qDebug()<spinBoxSynTriggerPrintLenRatio->value()); - qDebug()<comboBoxEleEyeMakeClean->currentIndex()); - qDebug()<comboBoxAltMirrType->currentIndex()); - qDebug()<spinBoxAltMirrorGap->value()); - qDebug()<spinBoxpluseSinal->value()); - qDebug()<spinBoxEleEyeTriggerRepeatCnt->value()); - qDebug()<spinBoxEleEyeTriggerIntervalMs->value()); - qDebug()<checkEyeTriggerSynPrintEn->isChecked ()); - qDebug()<spinBoxEleEyeTriggerPrintDelay->value()); - qDebug()<spinBoxEleMaskTime->value()); - qDebug()<checkBoxSynMakeClean->isChecked()); - qDebug()<spinBoxDelayTriggerValue->value()); - qDebug()<comboBoxTimeTriggerMode->currentIndex()); - qDebug()<comboBoxSyncActType->currentIndex()); - qDebug()<spinBoxProductCntPerOutputPulse->value()); - qDebug()<spinBoxOutputPulseDelayMs->value()); - qDebug()<checkBoxPulseOutputEnable->isChecked()); - - -} - -void TriggerCtrl::on_checkBoxPulseOutputEnable_clicked() -{ - bool checked = ui->checkBoxPulseOutputEnable->isChecked(); - ui->labelProductCntPerOutputPulse->setEnabled(checked); - ui->spinBoxProductCntPerOutputPulse->setEnabled(checked); - //ui->labelOutputPulseDelayMs->setEnabled(checked); - //ui->spinBoxOutputPulseDelayMs->setEnabled(checked); -} - -void TriggerCtrl::setBuildTime(QString s1) -{ - QString s; -// s.sprintf("A%d.%d.%02d%s%s_", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER,SUB_VERSION,SUB_RFID); - s.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); - s = s + (QString) Public::DateToString(__DATE__)+"."+SUB_VER+SUB_RFID;//+ "_"+ QString(__TIME__) - ui->test_version->setText(s+s1); - -} - -void TriggerCtrl::on_checkEyeTriggerSynPrintEn_clicked(bool checked) -{ - int triggerMode = sysPara->para.printTriggerMode; - if(sysPara) - { - //if( !sysPara->para.eleEyeTriggerSynPrintEn ) - if( checked) - { - //ui->radioButtonSynTrigger->setChecked(1); -#ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(1); -#endif - ui->labelSynTriggerPrintLen->setEnabled(1); - ui->lineEditTriggerPulsePerMm->setEnabled(1); - ui->labelTriggerPulsePerMm->setEnabled(1); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); - ui->labelSynTriggerPrintLenRatio->setEnabled(1); - ui->checkBoxEleEyeMakeClean->setEnabled(1); - ui->pushButtonApplyPulseFix->setEnabled(1); - ui->comboBoxSynPrintMode->setEnabled(1); - ui->labelSynPrintMode->setEnabled(1); - //ui->checkBoxAutoSpeedEN->setEnabled (1); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); - ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); - ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); - ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)")); - ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); - if(ui->comboBoxSyncActType->currentIndex() || 0b11) //如果不是在正反转打印的模式下,就切换到正反转模式 - { - ui->comboBoxSyncActType->setCurrentIndex(0); - } - } - else - { - ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); -#ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); -#endif - ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - //ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - //ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1); - ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); - ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); - ui->labelEleMaskTime->setText(tr("封锁间隔(毫秒)")); - ui->labelOutputPulseDelayMs->setText( ui->radioButtonSynTrigger->isChecked()?tr("延时(毫米):"):tr("延时(毫秒):")); - - } - } -} - -void TriggerCtrl::on_comboBoxSyncActType_activated(int index) -{ - if(index>0) - { - on_checkEyeTriggerSynPrintEn_clicked(false); - } -} - - -void TriggerCtrl::on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1) -{ - Q_UNUSED(arg1); - sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat(); -} -void TriggerCtrl::on_spinBoxSynTriggerPrintLen_textChanged(const QString &arg1) -{ - Q_UNUSED(arg1); - //sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat(); - -} - -//void TriggerCtrl::on_spinBoxEleEyeTriggerIntervalMs_valueChanged(int arg1) -//{ -// sysPara->para.elecEyeTriggerInterval = arg1; -//} - -// //2020/3/2 -// void TriggerCtrl::on_radioButtonSynTrigger_clicked() -// { - // sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; - // sysPara->para.printColDelay = 0; -// } - -void TriggerCtrl::on_radioButtonEleEyeLevelTrigger_clicked() -{ - sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL; -} - -void TriggerCtrl::on_radioButtonEleEyeEdgetTrigger_clicked() -{ - sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE; -} - -void TriggerCtrl::on_radioButtonDelayTrigger_clicked() -{ - sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; -} - - - -#define PRINT_CTRL_ADDR_BASE 0xa400 -typedef struct pulse_struct { - unsigned int pulse_value:16; -}Pulse_struct; - -void TriggerCtrl::on_spinBoxpluseSinal_valueChanged(int arg1) -{ - Pulse_struct t_pulse_struct; - sysPara->para.pulse_sinal_value = arg1; - t_pulse_struct.pulse_value = arg1*10*ui->lineEditTriggerPulsePerMm->text().toFloat(); - sysPara->devOp->fpgaWr(PRINT_CTRL_ADDR_BASE + 0x88, (unsigned char *)&t_pulse_struct, 2); -} - -void TriggerCtrl::OutputPulse() -{ - ui->checkBoxPulseOutputEnable->setChecked(true); - ui->spinBoxProductCntPerOutputPulse->setEnabled(true); - ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); -} +#include "TriggerCtrl.h" +#include "ui_triggerctrl.h" +#include +#include +#include +#include +#include "qdebug.h" +#include +#include "myinclude.h" +#include "Public.h" +#include "VerBVersion.h" +#include "DevOp.h" +#include "InkJetPrinter.h" +extern InkJetPrinter *pInkJectPrinter; +/* readme: 20140809 +1. 同步字宽mm: 0.1+ w*(4-0.1) = 0.1+3.9w (mm) +2. 按长度喷印: +*/ + +// 20140923-12:05版本存在图形方式下变量不变绿问题,新版本已经更正 +// 20141013-16:36修正密码有效期设置错误。 +//2015-10-17 二维码变量问题 +// 2015-11-01 无聊: 要从V6S版本恢复原来的 para.set_HVData_Flag = 0; 参数 +// 估计过段时间又要要求增加 UART功能。 V6S 原来已经有这个功能了。但他们不用!! +// 20151109 新增计数1和计数器2单独立即清零 版本号 No42 +// 更新了Vietname字库,使用中文使用wenquanyiBitmap,编译uncode编码使用wenquanyimicrohei,英文自己编,越南语自己编,基于DejaVu Sans +// 新版软件更新或升级,会因参数错位,出现隔膜位置设定值(等参数)错误,引起主墨泵不工作,开机不循环等现象。(解决办法,重新检查并设置所有参数) +// 20160203:修改了变量定位方式,更新的Image图片。 将左下角更换为RGB = 250,250,0 -=== 0xFFF7FC00 +// 修正了停止打印关闭高压的问题,重新打印出现高压故障 +// 修改了密码一周一变,增加了密码校验,需要使用新版20以上的手机密码软件,密码为7位; +// 20160218 修改了提示框显示方式,避免提示阻塞处理进程 + +// 20160304 优化了变量显示; 增加了中心旋转交替功能;增加了 13位随机码打印功能; 修正界面显示字库部分汉字问题 +// 本次修改需要同时更并按ARM和FPGA + +// FPGA实现自动点距调整,实现连续点位置修正 20160714 FPGA版本 V44, 0714B +// 20160715 : 去掉了“点距电压微调”、“内存数据显示”、部分相检控制参数设置 +// 20160729: 发现打开历史记录会死机问题,原因待查。但执行删除历史记录后,可避免再次死机。 +// 20160723: 增加电眼复位功能。 与电眼清零不同,复位时,计数不清零,而是等于预设的当前值。 +// 20160718: 参考日立方案,优化打印效果 +/* + 20160728:发现历史记录打开时,会死机 + 20160729: 查找原因:fi +// 20160806:重要修改 : 毫米脉冲的系数由X8改为X256,原因是:使用X8时传递误差较大,导致1000mm会有6mm误差, 使用X256(即8位二进制表示小数时,可以精确到0.004,从而提高精度) + X8 时,小数精度为0.125而已 + + 20160812:增加左横,右横变量 + if((varType<9) // 普通变量 + ||(varType>=20 && varType<29) // 横左变量 + ||(varType>=40 && varType<49) // 右横变量 + if(fontname.contains("SerifL") ||fontname.contains("serifl") ) varType1= 20+varType; + else if(fontname.contains("SerifR") ||fontname.contains("serifr") ) varType1= 40+varType; + 20160831: 增加临时密码,每小时一变 + + 20160904: 解决重新开机后,有时不能自动打印文件问题。 + 20160905: 第二行单独变量时显示不全问题 + + // 20160912: 去掉高压故障自动关闭回收的默认值 1 + // 20160912: 设置了隐藏按键,用于对墨线时间和开机次数进行复位 No49 + 20160927: FIFO实现RAND 码上传,暂时与RST0806 No49区别开来 No50 + 20161212: 修改总产品计数器清零功能。由ARM清零改为FPGA清零 No51 // [3]总产品计数器清零FPGA + 20161217: 增加了 SPV210编译选项,以处理V6核心版驱动问题 + 修改随机码处理函数,以解决 不能输出奇数位 随机码问题。 + + 20170217: 有厂家只想打一条横线,改最小列点阵数。 + 20170224: 输入密码不回显 + 20170313: 修改开机重启或重载参数时,设定计数当前值为起始值 + 20170318: 制作0318版本的刷机文件 + + 20170803: 增加外接屏功能,20170808完成 + + */ + +//#define NON_CABLE//喷印间隔固定 +// 20160507 1138 +// 20161209 编辑 小数点喷印间隔 +// 20170603: 太阳能条码专用版本 +// Nam Ninh phồng tuyệt vời Mã Technology Co., Ltd. +TriggerCtrl::TriggerCtrl(QWidget *parent) : + QWidget(parent), + ui(new Ui::TriggerCtrl) +{ + ui->setupUi(this); + QRegExp double_rx100("10000000|([0-9]{1,8}[\.][0-9]{0,1})"); + ui->spinBoxSynTriggerPrintLen->setValidator(new QRegExpValidator(double_rx100,ui->spinBoxSynTriggerPrintLen)); +#ifdef NON_CABLE + ui->spinBoxSynTriggerPrintLen->setEnabled(0); +#endif + //#endif + pulseNumFix = new PulseNumFix(parent); + pulseNumFix->hide(); + ui->lineEditTriggerPulsePerMm->setValidator(new QDoubleValidator(0)); + connect(pulseNumFix,SIGNAL(pulseNuxFixDone(float)),this,SLOT(onPulseNumFixDone(float))); + + updateSysStatusToUI(); + + QString s; +// s.sprintf("%d.%d.%02d%s%s_", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER,SUB_VERSION,SUB_RFID); + s.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); + s = s + (QString) Public::DateToString(__DATE__)+"."+SUB_VER+SUB_RFID; + ui->test_version->setText(s); + ui->checkBoxEleEyeMakeClean->setVisible(false); + tr("独立参数"); + + if(Public::ReadLanguageName()=="Chinese"){ + ui->label_miv12->setPixmap(QPixmap(QString::fromUtf8(":/image/MIV12.png"))); + }else + { + ui->label_miv12->setPixmap(QPixmap(QString::fromUtf8(":/image/MIV13.png"))); + } + ui->spinBoxOuputPulseCol->setHidden(1); +} + +TriggerCtrl::~TriggerCtrl() +{ + delete ui; + delete pulseNumFix; +} + +void TriggerCtrl::setTriggerUI(int triggerMode){ + + ui->radioButtonDelayTrigger->setChecked(triggerMode == PRINT_TRIGGER_TIME); + ui->spinBoxDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + ui->labelDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + + ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); + ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); + ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); + ui->checkBoxSynMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->checkEyeTriggerSynPrintEn->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + + if(sysPara->para.eleEyeTriggerSynPrintEn && + (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) + ) + { + //ui->radioButtonSynTrigger->setChecked(1); + ui->spinBoxSynTriggerPrintLen->setEnabled(0); + ui->labelSynTriggerPrintLen->setEnabled(1); + ui->lineEditTriggerPulsePerMm->setEnabled(1); + ui->labelTriggerPulsePerMm->setEnabled(1); + ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); + ui->labelSynTriggerPrintLenRatio->setEnabled(1); + ui->checkBoxEleEyeMakeClean->setEnabled(1); + ui->pushButtonApplyPulseFix->setEnabled(1); + ui->comboBoxSynPrintMode->setEnabled(1); + ui->labelSynPrintMode->setEnabled(1); + //ui->checkBoxAutoSpeedEN->setEnabled (1); + ui->labelEleMaskTime->setEnabled(1); + ui->spinBoxEleMaskTime->setEnabled(1); + + //ui->spinBoxEleMaskTime->setEnabled(1); + + ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); + ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); + ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)")); + } + else + { + ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); +#ifndef NON_CABLE + ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); +#endif + ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + //ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + //ui->labelEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + //ui->spinBoxEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER) + { + ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); + } + else + { + ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); + } + ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); + ui->labelEleMaskTime->setText(tr("封锁时间(毫秒)")); + } + if(( ( //sysPara->para.eleEyeTriggerSynPrintEn || + ui->checkEyeTriggerSynPrintEn->isChecked()) + &&(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)) + || triggerMode == PRINT_TRIGGER_SYNCHRONIZER ) + { + ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); + } + else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):")); + + setSynPrintMode(sysPara->para.sysTriggerPrintMode); + + + //72版本禁用该输入框 + //67打开 + // if(triggerMode== PRINT_TRIGGER_SYNCHRONIZER){ + // const unsigned short &FpgaVer=sysPara->status.build_dat.builTime; + // if(72==FpgaVer) + // { + // ui->spinBoxSynTriggerPrintLenRatio->setValue(0); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false); + // } + // else if(67==FpgaVer) + // { + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true); + // } + // } + // else{ + // ui->spinBoxSynTriggerPrintLenRatio->setValue(0); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false); + // } +} + +void TriggerCtrl::setSynPrintMode(int mode){ + ui->labelSynTriggerPrintLenRatio->setText((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?tr("字符宽度"):tr("喷印比例(%)")); + ui->comboBoxSynPrintMode->setCurrentIndex(mode); + //ui->spinBoxSynTriggerPrintLenRatio->setValue((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?sysPara->para.synCharWidthRatio:sysPara->para.synTriggerPrintLenRatio); + //edit@11-18 + if(SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode) + { + ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); + } + + const bool bShow=SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode; + //隐藏文本框 + ui->labelSynTriggerPrintLenRatio->setVisible(bShow); + //隐藏输入框 + ui->spinBoxSynTriggerPrintLenRatio->setVisible(bShow); +} + +void TriggerCtrl::GetTriggerUIPara(){ + if(sysPara){ + sysPara->para.printDelayMs = ui->spinBoxDelayTriggerValue->value(); + sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex(); + sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); + sysPara->para.photoElectricityRepeateNum = ui->spinBoxEleEyeTriggerRepeatCnt->value(); + + // + sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat(); + //sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->value(); +#ifdef NON_CABLE + sysPara->para.synTriggerPrintLenMm = 255.0; + ui->spinBoxSynTriggerPrintLen->setText("255"); +#endif + sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat(); + + sysPara->para.sysTriggerPrintMode = ui->comboBoxSynPrintMode->currentIndex(); + if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH) + //edit@11-19 + ;//sysPara->para.synCharWidthRatio = ui->spinBoxSynTriggerPrintLenRatio->value(); + else + sysPara->para.synTriggerPrintLenRatio = ui->spinBoxSynTriggerPrintLenRatio->value(); + + // 原代码: + //sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x7fff) | ( ui->comboBoxAltMirrType->currentIndex()==1?0x8000:0x0000); + + // 20160303: + sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x0fff) |( ( ui->comboBoxAltMirrType->currentIndex())<<12 ); + + //qDebug()<< (sysPara->para.AltMirrorGap & 0x0fff) << (sysPara->para.AltMirrorGap & 0xf000); + + if(ui->radioButtonDelayTrigger->isChecked()) + sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; + else if(ui->radioButtonEleEyeLevelTrigger->isChecked()) + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL; + else if(ui->radioButtonEleEyeEdgetTrigger->isChecked()) + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE; + else if(ui->radioButtonSynTrigger->isChecked()) + sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; + else + sysPara->para.printTriggerMode = PRINT_TRIGGER_NONE; + + sysPara->para.eleEyeTriggerSynPrintEn = ui->checkEyeTriggerSynPrintEn->isChecked (); + sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value(); + sysPara->para.synClearCntInEleEyeMode = ui->checkBoxSynMakeClean->isChecked(); + sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked(); + //sysPara->para.autoSynSpeedEn = ui->checkBoxAutoSpeedEN->isChecked (); + sysPara->para.autoSynSpeedEn = 0; + //sysPara->para.synPulsePerMmX8 = (unsigned short)(sysPara->para.synPulseNumPerMm *256); + sysPara->para.synPulsePerMmX8 = (unsigned short)((unsigned int)sysPara->para.synPulseNumPerMm <<8); + sysPara->para.eleMaskTime = ui->spinBoxEleMaskTime->value(); + //qDebug()<<"eleEyeClearCntInSynMode"<< sysPara->para.eleEyeClearCntInSynMode ; + sysPara->para.synchronizorActType = ui->comboBoxSyncActType->currentIndex(); + //qDebug()<<"synchronizorActType"<< sysPara->para.synchronizorActType; + + sysPara->para.pulse_sinal_value = ui->spinBoxpluseSinal->value(); + } +} +void TriggerCtrl::TriggerupdateSysParaToUI(){ + updateSysParaToUI(); +} + +void TriggerCtrl::updateSysParaToUI(){ + if(sysPara) + { + /*----------------------------------------*/ + setTriggerUI(sysPara->para.printTriggerMode); + ui->spinBoxDelayTriggerValue->setValue(sysPara->para.printDelayMs); +#ifndef NON_CABLE + ui->comboBoxTimeTriggerMode->setCurrentIndex(sysPara->para.timeTriggerPrintMode); +#endif + ui->spinBoxEleEyeTriggerIntervalMs->setValue(sysPara->para.elecEyeTriggerInterval); + ui->spinBoxOutputPulseDelayMs->setValue(sysPara->para.outputPulseDelayMs); + ui->spinBoxEleEyeTriggerRepeatCnt->setValue(sysPara->para.photoElectricityRepeateNum); + + //ui->spinBoxSynTriggerPrintLen->setValue(sysPara->para.synTriggerPrintLenMm); + ui->spinBoxSynTriggerPrintLen->setText(QString::number(sysPara->para.synTriggerPrintLenMm)); + ui->lineEditTriggerPulsePerMm->setText(QString::number(sysPara->para.synPulseNumPerMm)); + if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH) + //edit@11-19 + ;//ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synCharWidthRatio); + else + ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); + + /*----------------------------------------*/ + ui->spinBoxEleEyeTriggerPrintDelay->setValue(sysPara->para.eleEyeTriggerPrintDelay); + ui->checkBoxSynMakeClean->setChecked(sysPara->para.synClearCntInEleEyeMode); + //ui->checkBoxEleEyeMakeClean->setChecked(sysPara->para.eleEyeClearCntInSynMode); + ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f); + + ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable); + ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); + ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); + ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); + + ui->labelOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); + + //ui->spinBoxOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); + + ui->spinBoxOutputPulseDelayMs->setEnabled(true /*sysPara->para.outputPulseDelayMs*/); + ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol); + ui->checkEyeTriggerSynPrintEn->setChecked (sysPara->para.eleEyeTriggerSynPrintEn); + ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType); + //ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn ); + ui->spinBoxEleMaskTime->setValue(sysPara->para.eleMaskTime); + + ui->spinBoxAltMirrorGap->setValue( sysPara->para.AltMirrorGap & 0x0fff ); + + ui->comboBoxAltMirrType->setCurrentIndex( (sysPara->para.AltMirrorGap>>12) & 0x000F); + ui->spinBoxpluseSinal->setValue(sysPara->para.pulse_sinal_value); + + + //72版本禁用该输入框 + //67打开 + } +} + +void TriggerCtrl::applyUIPara(){ + if(sysPara){ + GetTriggerUIPara(); + if(sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER) + { + if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay ) + { + QMessageBox::information(this,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔")); + } + } + sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked(); + sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value(); + sysPara->para.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value(); + sysPara->para.OuputPulseCol = ui->spinBoxOuputPulseCol->value(); + if(( ( //sysPara->para.eleEyeTriggerSynPrintEn || + ui->checkEyeTriggerSynPrintEn->checkState()==1 ) + &&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)) + || sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER ) + { + ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); + } + else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):")); + if(sysPara->devOp->writeFpgaPrintPara() != -1) + QMessageBox::information(this,tr("提示"),tr("应用成功")); + + emit checkPrintIntervalSignal(); + } +} + +void TriggerCtrl::updateSysStatusToUI(){ + static char t_init = 0; + if(sysPara){ + if(t_init == 0){ + sysPara->loadParaFromFile(); + //qDebug()<<"sysPara->para.pulse_sinal_value="<para.pulse_sinal_value; + ui->spinBoxpluseSinal->setValue(sysPara->para.pulse_sinal_value); + t_init = 1; + } + } +} + +void TriggerCtrl::on_checkEyeTriggerSynPrintEn_pressed() +{ + +} + +void TriggerCtrl::on_radioButtonDelayTrigger_pressed() +{ + setTriggerUI(PRINT_TRIGGER_TIME); +// emit synDisableFontWidth(false); +} + +void TriggerCtrl::on_radioButtonEleEyeEdgetTrigger_pressed() +{ + setTriggerUI(PRINT_TRIGGER_ELEC_EYE_EDGE); +// emit synDisableFontWidth(false); +} + +void TriggerCtrl::on_radioButtonEleEyeLevelTrigger_pressed() +{ + setTriggerUI(PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); +// emit synDisableFontWidth(false); +} + +void TriggerCtrl::on_radioButtonSynTrigger_pressed() +{ + //edit@11-19 + sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; + setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER); +// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime; +// //72版本禁用字符宽度 +// if(72 == FpgaVer){ +// ui->spinBoxSynTriggerPrintLenRatio->setValue(0); +// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0); +// }else if (67 == FpgaVer) +// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); +// emit synDisableFontWidth(true); +} + +void TriggerCtrl::on_pushButtonApplyPulseFix_clicked() +{ + pulseNumFix->bindSysPara(sysPara); + pulseNumFix->hide(); + pulseNumFix->show(); +} + +void TriggerCtrl::onPulseNumFixDone(float value){ + ui->lineEditTriggerPulsePerMm->setText(QString::number(value)); +} + +void TriggerCtrl::on_comboBoxSynPrintMode_currentIndexChanged(int index) +{ + setSynPrintMode(index); +} +void TriggerCtrl::on_pushButtonApply_pressed() +{ + applyUIPara(); + if(sysPara)sysPara->saveParaToFile (); + emit autoUpdateFontWidthByTriggerCtrl(sysPara->status.textEditTotalCol); + TriggerCtrlLog(); +} + +void TriggerCtrl::TriggerCtrlLog(){ + + qDebug()<para.printTriggerMode); + qDebug()<lineEditTriggerPulsePerMm->text().toFloat()); + qDebug()<spinBoxSynTriggerPrintLen->text().toFloat()); + qDebug()<comboBoxSynPrintMode->currentIndex()); + qDebug()<spinBoxSynTriggerPrintLenRatio->value()); + qDebug()<comboBoxEleEyeMakeClean->currentIndex()); + qDebug()<comboBoxAltMirrType->currentIndex()); + qDebug()<spinBoxAltMirrorGap->value()); + qDebug()<spinBoxpluseSinal->value()); + qDebug()<spinBoxEleEyeTriggerRepeatCnt->value()); + qDebug()<spinBoxEleEyeTriggerIntervalMs->value()); + qDebug()<checkEyeTriggerSynPrintEn->isChecked ()); + qDebug()<spinBoxEleEyeTriggerPrintDelay->value()); + qDebug()<spinBoxEleMaskTime->value()); + qDebug()<checkBoxSynMakeClean->isChecked()); + qDebug()<spinBoxDelayTriggerValue->value()); + qDebug()<comboBoxTimeTriggerMode->currentIndex()); + qDebug()<comboBoxSyncActType->currentIndex()); + qDebug()<spinBoxProductCntPerOutputPulse->value()); + qDebug()<spinBoxOutputPulseDelayMs->value()); + qDebug()<checkBoxPulseOutputEnable->isChecked()); + + +} + +void TriggerCtrl::on_checkBoxPulseOutputEnable_clicked() +{ + bool checked = ui->checkBoxPulseOutputEnable->isChecked(); + ui->labelProductCntPerOutputPulse->setEnabled(checked); + ui->spinBoxProductCntPerOutputPulse->setEnabled(checked); + //ui->labelOutputPulseDelayMs->setEnabled(checked); + //ui->spinBoxOutputPulseDelayMs->setEnabled(checked); +} + +void TriggerCtrl::setBuildTime(QString s1) +{ + QString s; +// s.sprintf("A%d.%d.%02d%s%s_", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER,SUB_VERSION,SUB_RFID); + s.sprintf("%s.%s.", MACHINAE_VER, PUMP_VER); + s = s + (QString) Public::DateToString(__DATE__)+"."+SUB_VER+SUB_RFID;//+ "_"+ QString(__TIME__) + ui->test_version->setText(s+s1); + +} + +void TriggerCtrl::on_checkEyeTriggerSynPrintEn_clicked(bool checked) +{ + int triggerMode = sysPara->para.printTriggerMode; + if(sysPara) + { + //if( !sysPara->para.eleEyeTriggerSynPrintEn ) + if( checked) + { + //ui->radioButtonSynTrigger->setChecked(1); +#ifndef NON_CABLE + ui->spinBoxSynTriggerPrintLen->setEnabled(1); +#endif + ui->labelSynTriggerPrintLen->setEnabled(1); + ui->lineEditTriggerPulsePerMm->setEnabled(1); + ui->labelTriggerPulsePerMm->setEnabled(1); + ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); + ui->labelSynTriggerPrintLenRatio->setEnabled(1); + ui->checkBoxEleEyeMakeClean->setEnabled(1); + ui->pushButtonApplyPulseFix->setEnabled(1); + ui->comboBoxSynPrintMode->setEnabled(1); + ui->labelSynPrintMode->setEnabled(1); + //ui->checkBoxAutoSpeedEN->setEnabled (1); + ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); + ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); + ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); + ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)")); + ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):")); + if(ui->comboBoxSyncActType->currentIndex() || 0b11) //如果不是在正反转打印的模式下,就切换到正反转模式 + { + ui->comboBoxSyncActType->setCurrentIndex(0); + } + } + else + { + ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); +#ifndef NON_CABLE + ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); +#endif + ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + //ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + //ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1); + ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); + ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); + ui->labelEleMaskTime->setText(tr("封锁间隔(毫秒)")); + ui->labelOutputPulseDelayMs->setText( ui->radioButtonSynTrigger->isChecked()?tr("延时(毫米):"):tr("延时(毫秒):")); + + } + } +} + +void TriggerCtrl::on_comboBoxSyncActType_activated(int index) +{ + if(index>0) + { + on_checkEyeTriggerSynPrintEn_clicked(false); + } +} + + +void TriggerCtrl::on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1) +{ + Q_UNUSED(arg1); + sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat(); +} +void TriggerCtrl::on_spinBoxSynTriggerPrintLen_textChanged(const QString &arg1) +{ + Q_UNUSED(arg1); + //sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat(); + +} + +//void TriggerCtrl::on_spinBoxEleEyeTriggerIntervalMs_valueChanged(int arg1) +//{ +// sysPara->para.elecEyeTriggerInterval = arg1; +//} + +// //2020/3/2 +// void TriggerCtrl::on_radioButtonSynTrigger_clicked() +// { + // sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; + // sysPara->para.printColDelay = 0; +// } + +void TriggerCtrl::on_radioButtonEleEyeLevelTrigger_clicked() +{ + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL; +} + +void TriggerCtrl::on_radioButtonEleEyeEdgetTrigger_clicked() +{ + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE; +} + +void TriggerCtrl::on_radioButtonDelayTrigger_clicked() +{ + sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; +} + + + +#define PRINT_CTRL_ADDR_BASE 0xa400 +typedef struct pulse_struct { + unsigned int pulse_value:16; +}Pulse_struct; + +void TriggerCtrl::on_spinBoxpluseSinal_valueChanged(int arg1) +{ + Pulse_struct t_pulse_struct; + sysPara->para.pulse_sinal_value = arg1; + t_pulse_struct.pulse_value = arg1*10*ui->lineEditTriggerPulsePerMm->text().toFloat(); + sysPara->devOp->fpgaWr(PRINT_CTRL_ADDR_BASE + 0x88, (unsigned char *)&t_pulse_struct, 2); +} + +void TriggerCtrl::OutputPulse() +{ + ui->checkBoxPulseOutputEnable->setChecked(true); + ui->spinBoxProductCntPerOutputPulse->setEnabled(true); + ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); +} diff --git a/TriggerCtrl.h b/TriggerCtrl.h index b843797..ce9ec0c 100644 --- a/TriggerCtrl.h +++ b/TriggerCtrl.h @@ -1,88 +1,88 @@ -#ifndef TRIGGERCTRL_H -#define TRIGGERCTRL_H - -#include -#include "ParaSettingUI.h" -#include "PulseNumFix.h" -#include "mainwindow.h" -namespace Ui { -class TriggerCtrl; -} - -class TriggerCtrl : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit TriggerCtrl(QWidget *parent = 0); - ~TriggerCtrl(); - void updateSysParaToUI(); //重载 - void applyUIPara(); //重载 - void updateSysStatusToUI(); - - void setBuildTime(QString s); - void TriggerCtrlLog(); - -signals: - Q_SIGNALS: - // void synDisableFontWidth(bool); - //修改字体宽度 - - void autoUpdateFontWidthByTriggerCtrl(const unsigned int); - - void checkPrintIntervalSignal(); - -private slots: - void on_radioButtonDelayTrigger_pressed(); - void TriggerupdateSysParaToUI(); - void on_checkEyeTriggerSynPrintEn_pressed(); - void on_radioButtonEleEyeEdgetTrigger_pressed(); - - void on_radioButtonEleEyeLevelTrigger_pressed(); - - void on_radioButtonSynTrigger_pressed(); - - void on_pushButtonApplyPulseFix_clicked(); - - void onPulseNumFixDone(float); - - void on_comboBoxSynPrintMode_currentIndexChanged(int index); - void on_pushButtonApply_pressed(); - - void on_checkBoxPulseOutputEnable_clicked(); - - void on_checkEyeTriggerSynPrintEn_clicked(bool checked); - - void on_comboBoxSyncActType_activated(int index); - - void on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1); - - void on_spinBoxSynTriggerPrintLen_textChanged(const QString &arg1); - - //void on_spinBoxEleEyeTriggerIntervalMs_valueChanged(int arg1); - - //void on_radioButtonSynTrigger_clicked(); - - void on_radioButtonEleEyeLevelTrigger_clicked(); - - void on_radioButtonEleEyeEdgetTrigger_clicked(); - - void on_radioButtonDelayTrigger_clicked(); - - void on_spinBoxpluseSinal_valueChanged(int arg1); - - void OutputPulse(); - -signals: - void synDisableFontWidth(bool); - -private: - Ui::TriggerCtrl *ui; - - void setTriggerUI(int triggerMode); - void setSynPrintMode(int mode); - void GetTriggerUIPara(); - PulseNumFix *pulseNumFix; -}; - -#endif // TRIGGERCTRL_H +#ifndef TRIGGERCTRL_H +#define TRIGGERCTRL_H + +#include +#include "ParaSettingUI.h" +#include "PulseNumFix.h" +#include "mainwindow.h" +namespace Ui { +class TriggerCtrl; +} + +class TriggerCtrl : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit TriggerCtrl(QWidget *parent = 0); + ~TriggerCtrl(); + void updateSysParaToUI(); //重载 + void applyUIPara(); //重载 + void updateSysStatusToUI(); + + void setBuildTime(QString s); + void TriggerCtrlLog(); + +signals: + Q_SIGNALS: + // void synDisableFontWidth(bool); + //修改字体宽度 + + void autoUpdateFontWidthByTriggerCtrl(const unsigned int); + + void checkPrintIntervalSignal(); + +private slots: + void on_radioButtonDelayTrigger_pressed(); + void TriggerupdateSysParaToUI(); + void on_checkEyeTriggerSynPrintEn_pressed(); + void on_radioButtonEleEyeEdgetTrigger_pressed(); + + void on_radioButtonEleEyeLevelTrigger_pressed(); + + void on_radioButtonSynTrigger_pressed(); + + void on_pushButtonApplyPulseFix_clicked(); + + void onPulseNumFixDone(float); + + void on_comboBoxSynPrintMode_currentIndexChanged(int index); + void on_pushButtonApply_pressed(); + + void on_checkBoxPulseOutputEnable_clicked(); + + void on_checkEyeTriggerSynPrintEn_clicked(bool checked); + + void on_comboBoxSyncActType_activated(int index); + + void on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1); + + void on_spinBoxSynTriggerPrintLen_textChanged(const QString &arg1); + + //void on_spinBoxEleEyeTriggerIntervalMs_valueChanged(int arg1); + + //void on_radioButtonSynTrigger_clicked(); + + void on_radioButtonEleEyeLevelTrigger_clicked(); + + void on_radioButtonEleEyeEdgetTrigger_clicked(); + + void on_radioButtonDelayTrigger_clicked(); + + void on_spinBoxpluseSinal_valueChanged(int arg1); + + void OutputPulse(); + +signals: + void synDisableFontWidth(bool); + +private: + Ui::TriggerCtrl *ui; + + void setTriggerUI(int triggerMode); + void setSynPrintMode(int mode); + void GetTriggerUIPara(); + PulseNumFix *pulseNumFix; +}; + +#endif // TRIGGERCTRL_H diff --git a/UpdateFPGA.cpp b/UpdateFPGA.cpp index 10dfcab..595e64f 100644 --- a/UpdateFPGA.cpp +++ b/UpdateFPGA.cpp @@ -1,370 +1,370 @@ -#include "UpdateFPGA.h" -#include "myinclude.h" -#include "Public.h" -#include -#include -#include -#include -#include - -#pragma execution_character_set("utf-8") - -UpdateFPGA::UpdateFPGA(const QString& pythonScriptPath, QWidget* parent) - : QDialog(parent), m_PythonScriptPath(pythonScriptPath) -{ - this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint); - this->setObjectName("UpdateFPGA"); - this->setStyleSheet("QDialog#UpdateFPGA{background-color:#FFFFFF;border:0px solid #D6D6D6;}"); - this->setWindowIcon(QPixmap(":/UpdateFPGA/logo.png")); -} - -UpdateFPGA::~UpdateFPGA() -{ - if (!conversionProcess) return; - if (conversionProcess->state() == QProcess::Running) - { - conversionProcess->terminate(); - conversionProcess->waitForFinished(); - conversionProcess->deleteLater(); - conversionProcess = nullptr; - } -} - -void UpdateFPGA::init() -{ - QFile file(SYS_ROOT_DIR"UseEn"); - showChinese = true; - if(file.exists()) - { - QString langurageType = Public::ReadLanguageName(); - if(langurageType != "Chinese") - showChinese = false; - } - - setWindowTitle(tr("升级工具")); - setMinimumSize(600, 400); - - QLabel* Logo = new QLabel(this); - Logo->setFixedSize(67, 25); - Logo->setPixmap(QPixmap(":/UpdateFPGA/logo.png")); - Logo->setScaledContents(true); - - m_Title = new QLabel(this); - m_Title->setStyleSheet("font-family:\"Microsoft YaHei\";color:#333333;font-size:16px;"); - m_Title->setFixedHeight(25); - - m_Title->setText(tr("升级工具")); - - m_CloseBtn = new QPushButton(this); - m_CloseBtn->setFixedSize(25, 25); - m_CloseBtn->setIconSize(QSize(20, 20)); - m_CloseBtn->setIcon(QPixmap(":/icon/keydelete.png")); - m_CloseBtn->setCursor(Qt::PointingHandCursor); - m_CloseBtn->setStyleSheet("QPushButton{background-color:#ffffff;border-radius:3px;border:none;}\ - QPushButton::hover{background-color:#EEEEEE;}"); - connect(m_CloseBtn,&QPushButton::clicked,this,&UpdateFPGA::closeUI); - - QHBoxLayout* hlayout = new QHBoxLayout; - hlayout->addSpacing(5); - hlayout->addWidget(Logo); - hlayout->addWidget(m_Title); - hlayout->addStretch(); - hlayout->addWidget(m_CloseBtn); - hlayout->addSpacing(10); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - m_UpdateButton = new QPushButton(tr("开始升级"), this); - m_UpdateButton->setFixedHeight(30); - - logLabel = new QLabel(tr("升级日志:"), this); - logTextEdit = new QTextEdit(this); - logTextEdit->setReadOnly(true); - - mainLayout->addLayout(hlayout); - mainLayout->addWidget(m_UpdateButton); - mainLayout->addWidget(logLabel); - mainLayout->addWidget(logTextEdit, 1); - - conversionProcess = new QProcess(this); - - connect(m_UpdateButton, &QPushButton::clicked, this, &UpdateFPGA::startUpdate); - connect(conversionProcess, QOverload::of(&QProcess::finished), - this, &UpdateFPGA::processFinished); - connect(conversionProcess, &QProcess::errorOccurred, this, &UpdateFPGA::processError); - connect(conversionProcess, &QProcess::readyReadStandardOutput, [this]() { - logTextEdit->append(conversionProcess->readAllStandardOutput()); - } - ); - connect(conversionProcess, &QProcess::readyReadStandardError, [this]() { - logTextEdit->append(conversionProcess->readAllStandardError()); - } - ); -} - -void UpdateFPGA::closeUI(){ - close(); - emit upgradeFPGAFinished(true); -} - -void UpdateFPGA::startUpdate() -{ - m_CloseBtn->setEnabled(false); - if (m_PythonScriptPath.isEmpty()) - { - logTextEdit->append(tr("错误: 脚本为空")); - return; - } - QFile inputFile(m_PythonScriptPath); - if (!inputFile.exists()) - { - logTextEdit->append(tr("错误: 脚本不存在 - %1").arg(m_PythonScriptPath)); - return; - } - - logTextEdit->append(tr("开始升级...")); - logTextEdit->append(tr("文件:%1").arg(m_PythonScriptPath)); - - // 自动查找Ubuntu 22.04中可用的Python解释器 - QString pythonPath = findValidPythonInterpreter(); - if (pythonPath.isEmpty()) - { - logTextEdit->append(tr("错误: 未找到可用的Python解释器或缺少serial模块")); - m_CloseBtn->setEnabled(true); - return; - } - - logTextEdit->append(tr("使用Python解释器: %1").arg(pythonPath)); - - QStringList pythonArgs; - pythonArgs << m_PythonScriptPath; - - conversionProcess->start(pythonPath, pythonArgs); - m_UpdateButton->setEnabled(false); // 运行中禁用按钮 -} - -// 查找并验证Ubuntu系统中有效的Python解释器 -QString UpdateFPGA::findValidPythonInterpreter() -{ - QStringList pythonNames = { "python3", "python3.10", "python3.11", "python3.9" }; - QStringList searchPaths; - - QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - searchPaths << home + "/.local/bin" - << home + "/.pyenv/shims" - << home + "/.virtualenvs/*/bin" - << home + "/venv/bin" - << home + "/env/bin"; - - - searchPaths << "/usr/bin" - << "/usr/local/bin" - << "/bin" - << "/opt/bin" - << "/snap/bin"; - - - QByteArray pathEnvBytes = qgetenv("PATH"); - QString pathEnvStr = QString::fromLocal8Bit(pathEnvBytes); - QStringList pathEnv = pathEnvStr.split(QDir::listSeparator()); - foreach(const QString & path, pathEnv) - { - if (!searchPaths.contains(path)) - { - searchPaths << path; - } - } - - // 遍历所有可能的组合查找有效解释器 - foreach(const QString & path, searchPaths) - { - foreach(const QString & name, pythonNames) - { - if (path.contains("*")) - { - QDir dir(path.left(path.indexOf("*"))); - if (dir.exists()) - { - QStringList subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - foreach(const QString & subDir, subDirs) - { - QString fullPath = dir.filePath(subDir + "/bin/" + name); - if (QFile::exists(fullPath) && isValidPythonWithSerial(fullPath)) - { - return fullPath; - } - } - } - } - else - { - QString fullPath = QDir(path).filePath(name); - if (QFile::exists(fullPath) && isValidPythonWithSerial(fullPath)) - { - return fullPath; - } - } - } - } - - return ""; -} - -// 验证Python解释器是否包含serial模块 -bool UpdateFPGA::isValidPythonWithSerial(const QString& pythonPath) -{ - // 检查Python是否可运行 - QProcess testProcess; - testProcess.setProcessChannelMode(QProcess::MergedChannels); // 合并输出通道 - testProcess.start(pythonPath, { "-c", "import sys; sys.exit(0)" }); - - if (!testProcess.waitForFinished(3000) || testProcess.exitCode() != 0) - { - logTextEdit->append(tr("调试: 无效的Python解释器 - %1").arg(pythonPath)); - return false; - } - - // 检查是否安装了serial模块 - testProcess.start(pythonPath, { "-c", "import serial; print('serial found: ' + serial.__version__)" }); - if (testProcess.waitForFinished(3000)) - { - if (testProcess.exitCode() == 0) - { - QString output = testProcess.readAll().trimmed(); - logTextEdit->append(tr("调试: %1").arg(output)); - return true; - } - else - { - logTextEdit->append(tr("调试: %1 缺少serial模块").arg(pythonPath)); - } - } - else - { - logTextEdit->append(tr("调试: %1 响应超时").arg(pythonPath)); - } - - return false; -} - -// 根据错误码解析具体错误信息 -QString UpdateFPGA::getErrorDescription(int errorCode) -{ - switch (errorCode) - { - case 1: return tr("文件不存在(请检查FPGA固件文件路径)"); - case 2: return tr("无可用串口(请检查设备连接)"); - case 3: return tr("串口通信错误(可能是波特率不匹配或设备断开)"); - case 4: return tr("数据发送失败(尝试重新发送)"); - case 5: return tr("数据校验失败(数据传输过程中损坏)"); - case 6: return tr("接收数据不完整(可能是传输中断)"); - case 7: return tr("文件大小发送失败(协议握手错误)"); - case 8: return tr("文件内容发送失败(大文件传输超时)"); - case 9: return tr("未知错误(请查看详细日志)"); - default: return tr("未定义错误"); - } -} - -void UpdateFPGA::processFinished(int exitCode, QProcess::ExitStatus exitStatus) -{ - if (exitStatus == QProcess::NormalExit) - { - if (exitCode == 0) // 成功(错误码0) - { - logTextEdit->append(tr("升级成功!")); - QMessageBox::information(this, tr("成功"), tr("FPGA升级完成,请重启QtUI"), QMessageBox::Ok); - close(); // 成功后关闭界面 - emit upgradeFPGAFinished(true); - } - else // 有错误码的失败 - { - QString errorDesc = getErrorDescription(exitCode); - logTextEdit->append(tr("升级失败,错误码: %1,原因: %2") - .arg(exitCode).arg(errorDesc)); - - // 询问用户是否重试(针对可恢复错误) - QMessageBox::StandardButton reply = QMessageBox::question(this, - tr("升级失败"), - tr("错误码%1: %2\n是否重新尝试升级?") - .arg(exitCode).arg(errorDesc), - QMessageBox::Yes | QMessageBox::No); - - - if (reply == QMessageBox::Yes) - { - startUpdate(); // 重新运行 - } - else - { - close(); - emit upgradeFPGAFinished(true); - m_UpdateButton->setEnabled(true); // 允许手动再次尝试 - m_CloseBtn->setEnabled(true); - } - } - } - else // 进程异常退出(无错误码) - { - logTextEdit->append(tr("升级进程异常退出,退出码: %1").arg(exitCode)); - QMessageBox::StandardButton reply = QMessageBox::question(this, - tr("进程异常"), - tr("升级过程中程序崩溃,是否重新尝试?"), - QMessageBox::Yes | QMessageBox::No); - - if (reply == QMessageBox::Yes) - { - startUpdate(); - } - else - { - close(); - emit upgradeFPGAFinished(true); - m_UpdateButton->setEnabled(true); - m_CloseBtn->setEnabled(true); - } - } -} - -void UpdateFPGA::processError(QProcess::ProcessError error) -{ - QString errorMsg; - switch (error) - { - case QProcess::FailedToStart: - errorMsg = tr("错误: 无法启动脚本(可能是Python环境未配置)"); - break; - case QProcess::Crashed: - errorMsg = tr("错误: 脚本进程崩溃"); - break; - case QProcess::Timedout: - errorMsg = tr("错误: 启动超时(设备无响应)"); - break; - case QProcess::WriteError: - errorMsg = tr("错误: 写入进程失败(权限不足)"); - break; - case QProcess::ReadError: - errorMsg = tr("错误: 读取进程输出失败"); - break; - case QProcess::UnknownError: - default: - errorMsg = tr("错误: 未知错误"); - break; - } - - logTextEdit->append(errorMsg); - logTextEdit->append(tr("错误详情: ") + conversionProcess->readAllStandardError()); - - // 进程错误时也提示重试 - QMessageBox::StandardButton reply = QMessageBox::question(this, tr("操作错误"), errorMsg + "\n" + tr("是否重新尝试?"), QMessageBox::Yes | QMessageBox::No); - - if (reply == QMessageBox::Yes) - { - startUpdate(); - } - else - { - close(); - emit upgradeFPGAFinished(true); - m_UpdateButton->setEnabled(true); - m_CloseBtn->setEnabled(true); - } -} +#include "UpdateFPGA.h" +#include "myinclude.h" +#include "Public.h" +#include +#include +#include +#include +#include + +#pragma execution_character_set("utf-8") + +UpdateFPGA::UpdateFPGA(const QString& pythonScriptPath, QWidget* parent) + : QDialog(parent), m_PythonScriptPath(pythonScriptPath) +{ + this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint); + this->setObjectName("UpdateFPGA"); + this->setStyleSheet("QDialog#UpdateFPGA{background-color:#FFFFFF;border:0px solid #D6D6D6;}"); + this->setWindowIcon(QPixmap(":/UpdateFPGA/logo.png")); +} + +UpdateFPGA::~UpdateFPGA() +{ + if (!conversionProcess) return; + if (conversionProcess->state() == QProcess::Running) + { + conversionProcess->terminate(); + conversionProcess->waitForFinished(); + conversionProcess->deleteLater(); + conversionProcess = nullptr; + } +} + +void UpdateFPGA::init() +{ + QFile file(SYS_ROOT_DIR"UseEn"); + showChinese = true; + if(file.exists()) + { + QString langurageType = Public::ReadLanguageName(); + if(langurageType != "Chinese") + showChinese = false; + } + + setWindowTitle(tr("升级工具")); + setMinimumSize(600, 400); + + QLabel* Logo = new QLabel(this); + Logo->setFixedSize(67, 25); + Logo->setPixmap(QPixmap(":/UpdateFPGA/logo.png")); + Logo->setScaledContents(true); + + m_Title = new QLabel(this); + m_Title->setStyleSheet("font-family:\"Microsoft YaHei\";color:#333333;font-size:16px;"); + m_Title->setFixedHeight(25); + + m_Title->setText(tr("升级工具")); + + m_CloseBtn = new QPushButton(this); + m_CloseBtn->setFixedSize(25, 25); + m_CloseBtn->setIconSize(QSize(20, 20)); + m_CloseBtn->setIcon(QPixmap(":/icon/keydelete.png")); + m_CloseBtn->setCursor(Qt::PointingHandCursor); + m_CloseBtn->setStyleSheet("QPushButton{background-color:#ffffff;border-radius:3px;border:none;}\ + QPushButton::hover{background-color:#EEEEEE;}"); + connect(m_CloseBtn,&QPushButton::clicked,this,&UpdateFPGA::closeUI); + + QHBoxLayout* hlayout = new QHBoxLayout; + hlayout->addSpacing(5); + hlayout->addWidget(Logo); + hlayout->addWidget(m_Title); + hlayout->addStretch(); + hlayout->addWidget(m_CloseBtn); + hlayout->addSpacing(10); + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + m_UpdateButton = new QPushButton(tr("开始升级"), this); + m_UpdateButton->setFixedHeight(30); + + logLabel = new QLabel(tr("升级日志:"), this); + logTextEdit = new QTextEdit(this); + logTextEdit->setReadOnly(true); + + mainLayout->addLayout(hlayout); + mainLayout->addWidget(m_UpdateButton); + mainLayout->addWidget(logLabel); + mainLayout->addWidget(logTextEdit, 1); + + conversionProcess = new QProcess(this); + + connect(m_UpdateButton, &QPushButton::clicked, this, &UpdateFPGA::startUpdate); + connect(conversionProcess, QOverload::of(&QProcess::finished), + this, &UpdateFPGA::processFinished); + connect(conversionProcess, &QProcess::errorOccurred, this, &UpdateFPGA::processError); + connect(conversionProcess, &QProcess::readyReadStandardOutput, [this]() { + logTextEdit->append(conversionProcess->readAllStandardOutput()); + } + ); + connect(conversionProcess, &QProcess::readyReadStandardError, [this]() { + logTextEdit->append(conversionProcess->readAllStandardError()); + } + ); +} + +void UpdateFPGA::closeUI(){ + close(); + emit upgradeFPGAFinished(true); +} + +void UpdateFPGA::startUpdate() +{ + m_CloseBtn->setEnabled(false); + if (m_PythonScriptPath.isEmpty()) + { + logTextEdit->append(tr("错误: 脚本为空")); + return; + } + QFile inputFile(m_PythonScriptPath); + if (!inputFile.exists()) + { + logTextEdit->append(tr("错误: 脚本不存在 - %1").arg(m_PythonScriptPath)); + return; + } + + logTextEdit->append(tr("开始升级...")); + logTextEdit->append(tr("文件:%1").arg(m_PythonScriptPath)); + + // 自动查找Ubuntu 22.04中可用的Python解释器 + QString pythonPath = findValidPythonInterpreter(); + if (pythonPath.isEmpty()) + { + logTextEdit->append(tr("错误: 未找到可用的Python解释器或缺少serial模块")); + m_CloseBtn->setEnabled(true); + return; + } + + logTextEdit->append(tr("使用Python解释器: %1").arg(pythonPath)); + + QStringList pythonArgs; + pythonArgs << m_PythonScriptPath; + + conversionProcess->start(pythonPath, pythonArgs); + m_UpdateButton->setEnabled(false); // 运行中禁用按钮 +} + +// 查找并验证Ubuntu系统中有效的Python解释器 +QString UpdateFPGA::findValidPythonInterpreter() +{ + QStringList pythonNames = { "python3", "python3.10", "python3.11", "python3.9" }; + QStringList searchPaths; + + QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); + searchPaths << home + "/.local/bin" + << home + "/.pyenv/shims" + << home + "/.virtualenvs/*/bin" + << home + "/venv/bin" + << home + "/env/bin"; + + + searchPaths << "/usr/bin" + << "/usr/local/bin" + << "/bin" + << "/opt/bin" + << "/snap/bin"; + + + QByteArray pathEnvBytes = qgetenv("PATH"); + QString pathEnvStr = QString::fromLocal8Bit(pathEnvBytes); + QStringList pathEnv = pathEnvStr.split(QDir::listSeparator()); + foreach(const QString & path, pathEnv) + { + if (!searchPaths.contains(path)) + { + searchPaths << path; + } + } + + // 遍历所有可能的组合查找有效解释器 + foreach(const QString & path, searchPaths) + { + foreach(const QString & name, pythonNames) + { + if (path.contains("*")) + { + QDir dir(path.left(path.indexOf("*"))); + if (dir.exists()) + { + QStringList subDirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + foreach(const QString & subDir, subDirs) + { + QString fullPath = dir.filePath(subDir + "/bin/" + name); + if (QFile::exists(fullPath) && isValidPythonWithSerial(fullPath)) + { + return fullPath; + } + } + } + } + else + { + QString fullPath = QDir(path).filePath(name); + if (QFile::exists(fullPath) && isValidPythonWithSerial(fullPath)) + { + return fullPath; + } + } + } + } + + return ""; +} + +// 验证Python解释器是否包含serial模块 +bool UpdateFPGA::isValidPythonWithSerial(const QString& pythonPath) +{ + // 检查Python是否可运行 + QProcess testProcess; + testProcess.setProcessChannelMode(QProcess::MergedChannels); // 合并输出通道 + testProcess.start(pythonPath, { "-c", "import sys; sys.exit(0)" }); + + if (!testProcess.waitForFinished(3000) || testProcess.exitCode() != 0) + { + logTextEdit->append(tr("调试: 无效的Python解释器 - %1").arg(pythonPath)); + return false; + } + + // 检查是否安装了serial模块 + testProcess.start(pythonPath, { "-c", "import serial; print('serial found: ' + serial.__version__)" }); + if (testProcess.waitForFinished(3000)) + { + if (testProcess.exitCode() == 0) + { + QString output = testProcess.readAll().trimmed(); + logTextEdit->append(tr("调试: %1").arg(output)); + return true; + } + else + { + logTextEdit->append(tr("调试: %1 缺少serial模块").arg(pythonPath)); + } + } + else + { + logTextEdit->append(tr("调试: %1 响应超时").arg(pythonPath)); + } + + return false; +} + +// 根据错误码解析具体错误信息 +QString UpdateFPGA::getErrorDescription(int errorCode) +{ + switch (errorCode) + { + case 1: return tr("文件不存在(请检查FPGA固件文件路径)"); + case 2: return tr("无可用串口(请检查设备连接)"); + case 3: return tr("串口通信错误(可能是波特率不匹配或设备断开)"); + case 4: return tr("数据发送失败(尝试重新发送)"); + case 5: return tr("数据校验失败(数据传输过程中损坏)"); + case 6: return tr("接收数据不完整(可能是传输中断)"); + case 7: return tr("文件大小发送失败(协议握手错误)"); + case 8: return tr("文件内容发送失败(大文件传输超时)"); + case 9: return tr("未知错误(请查看详细日志)"); + default: return tr("未定义错误"); + } +} + +void UpdateFPGA::processFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + if (exitStatus == QProcess::NormalExit) + { + if (exitCode == 0) // 成功(错误码0) + { + logTextEdit->append(tr("升级成功!")); + QMessageBox::information(this, tr("成功"), tr("FPGA升级完成,请重启QtUI"), QMessageBox::Ok); + close(); // 成功后关闭界面 + emit upgradeFPGAFinished(true); + } + else // 有错误码的失败 + { + QString errorDesc = getErrorDescription(exitCode); + logTextEdit->append(tr("升级失败,错误码: %1,原因: %2") + .arg(exitCode).arg(errorDesc)); + + // 询问用户是否重试(针对可恢复错误) + QMessageBox::StandardButton reply = QMessageBox::question(this, + tr("升级失败"), + tr("错误码%1: %2\n是否重新尝试升级?") + .arg(exitCode).arg(errorDesc), + QMessageBox::Yes | QMessageBox::No); + + + if (reply == QMessageBox::Yes) + { + startUpdate(); // 重新运行 + } + else + { + close(); + emit upgradeFPGAFinished(true); + m_UpdateButton->setEnabled(true); // 允许手动再次尝试 + m_CloseBtn->setEnabled(true); + } + } + } + else // 进程异常退出(无错误码) + { + logTextEdit->append(tr("升级进程异常退出,退出码: %1").arg(exitCode)); + QMessageBox::StandardButton reply = QMessageBox::question(this, + tr("进程异常"), + tr("升级过程中程序崩溃,是否重新尝试?"), + QMessageBox::Yes | QMessageBox::No); + + if (reply == QMessageBox::Yes) + { + startUpdate(); + } + else + { + close(); + emit upgradeFPGAFinished(true); + m_UpdateButton->setEnabled(true); + m_CloseBtn->setEnabled(true); + } + } +} + +void UpdateFPGA::processError(QProcess::ProcessError error) +{ + QString errorMsg; + switch (error) + { + case QProcess::FailedToStart: + errorMsg = tr("错误: 无法启动脚本(可能是Python环境未配置)"); + break; + case QProcess::Crashed: + errorMsg = tr("错误: 脚本进程崩溃"); + break; + case QProcess::Timedout: + errorMsg = tr("错误: 启动超时(设备无响应)"); + break; + case QProcess::WriteError: + errorMsg = tr("错误: 写入进程失败(权限不足)"); + break; + case QProcess::ReadError: + errorMsg = tr("错误: 读取进程输出失败"); + break; + case QProcess::UnknownError: + default: + errorMsg = tr("错误: 未知错误"); + break; + } + + logTextEdit->append(errorMsg); + logTextEdit->append(tr("错误详情: ") + conversionProcess->readAllStandardError()); + + // 进程错误时也提示重试 + QMessageBox::StandardButton reply = QMessageBox::question(this, tr("操作错误"), errorMsg + "\n" + tr("是否重新尝试?"), QMessageBox::Yes | QMessageBox::No); + + if (reply == QMessageBox::Yes) + { + startUpdate(); + } + else + { + close(); + emit upgradeFPGAFinished(true); + m_UpdateButton->setEnabled(true); + m_CloseBtn->setEnabled(true); + } +} diff --git a/UpdateFPGA.h b/UpdateFPGA.h index 4d3eee5..34e6c1a 100644 --- a/UpdateFPGA.h +++ b/UpdateFPGA.h @@ -1,43 +1,43 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -class UpdateFPGA : public QDialog -{ - Q_OBJECT - -public: - UpdateFPGA(const QString & pythonScriptPath, QWidget *parent = nullptr); - ~UpdateFPGA(); - void init(); - -private slots: - void startUpdate(); - void processFinished(int exitCode, QProcess::ExitStatus exitStatus); - void processError(QProcess::ProcessError error); - void closeUI(); - -private: - QString m_PythonScriptPath; - QLabel* m_Title; - QPushButton* m_CloseBtn; - QPushButton* m_UpdateButton; - QLabel* logLabel; - QTextEdit* logTextEdit; - QProcess* conversionProcess; - bool showChinese; - - QString getErrorDescription(int errorCode); - QString findValidPythonInterpreter(); - bool isValidPythonWithSerial(const QString& pythonPath); - -signals: - void upgradeFPGAFinished(bool); - -}; - +#pragma once + +#include +#include +#include +#include +#include +#include + +class UpdateFPGA : public QDialog +{ + Q_OBJECT + +public: + UpdateFPGA(const QString & pythonScriptPath, QWidget *parent = nullptr); + ~UpdateFPGA(); + void init(); + +private slots: + void startUpdate(); + void processFinished(int exitCode, QProcess::ExitStatus exitStatus); + void processError(QProcess::ProcessError error); + void closeUI(); + +private: + QString m_PythonScriptPath; + QLabel* m_Title; + QPushButton* m_CloseBtn; + QPushButton* m_UpdateButton; + QLabel* logLabel; + QTextEdit* logTextEdit; + QProcess* conversionProcess; + bool showChinese; + + QString getErrorDescription(int errorCode); + QString findValidPythonInterpreter(); + bool isValidPythonWithSerial(const QString& pythonPath); + +signals: + void upgradeFPGAFinished(bool); + +}; + diff --git a/VerBVersion.h b/VerBVersion.h index 3536f5f..96099d9 100644 --- a/VerBVersion.h +++ b/VerBVersion.h @@ -9,7 +9,8 @@ #define PUMP_VER "D" //#define SUB_VER "0100" //#define SUB_VER "IND" -#define SUB_VER "GuiL" +//#define SUB_VER "GuiL" +#define SUB_VER "JingZ" #ifdef __RFID_OLD #define SUB_RFID "_RO" diff --git a/VerBVersion.h.r24 b/VerBVersion.h.r24 deleted file mode 100644 index e69de29..0000000 diff --git a/WINPY_utf8.txt b/WINPY_utf8.txt index 529c3b9..93d917a 100644 --- a/WINPY_utf8.txt +++ b/WINPY_utf8.txt @@ -1,20915 +1,20915 @@ -安a -按a -爱a -阿a -暗a -啊a -埃a -碍a -凹a -奥a -岸a -矮a -案a -俺a -挨a -唉a -昂a -氨a -胺a -哎a -吖a -嗄a -腌a -锕a -安徽省ahs -爱ai -埃ai -碍ai -矮ai -挨ai -唉ai -哎ai -哀ai -皑ai -癌ai -蔼ai -艾ai -隘ai -呆*ai -捱ai -嗳ai -嗌ai -嫒ai -瑷ai -暧ai -砹ai -锿ai -霭ai -安an -按an -暗an -岸an -案an -俺an -氨an -胺an -鞍an -谙an -埯an -揞an -犴an -庵an -桉an -铵an -鹌an -黯an -昂ang -肮ang -盎ang -安徽anhui -凹ao -奥ao -敖ao -熬ao -翱ao -袄ao -傲ao -懊ao -澳ao -嚣*ao -坳ao -拗ao -嗷ao -岙ao -廒ao -遨ao -媪ao -骜ao -獒ao -聱ao -螯ao -鏊ao -鳌ao -鏖ao -不b -部b -本b -表b -把b -变b -比b -并b -别b -百b -报b -保b -病b -北b -被b -步b -边b -八b -办b -布b -把ba -八ba -吧ba -巴ba -拔ba -霸ba -罢ba -爸ba -坝ba -芭ba -捌ba -扒ba -叭ba -笆ba -疤ba -跋ba -靶ba -耙ba -茇ba -菝ba -岜ba -灞ba -钯ba -粑ba -鲅ba -魃ba -百bai -白bai -败bai -摆bai -伯*bai -柏bai -佰bai -拜bai -稗bai -捭bai -掰bai -办ban -半ban -板ban -班ban -般ban -版ban -拌ban -搬ban -斑ban -扳ban -伴ban -颁ban -扮ban -瓣ban -绊ban -阪ban -坂ban -钣ban -瘢ban -癍ban -舨ban -帮bang -棒bang -邦bang -榜bang -梆bang -膀bang -绑bang -磅bang -蚌bang -镑bang -傍bang -谤bang -蒡bang -浜bang -报bao -保bao -包bao -剥bao -薄bao -胞bao -暴bao -宝bao -饱bao -抱bao -爆bao -炮*bao -堡bao -刨*bao -苞bao -褒bao -雹bao -豹bao -鲍bao -曝*bao -瀑*bao -葆bao -孢bao -煲bao -鸨bao -褓bao -趵bao -龅bao -北bei -被bei -倍bei -备bei -背bei -辈bei -贝bei -杯bei -卑bei -臂*bei -悲bei -碑bei -钡bei -狈bei -惫bei -焙bei -孛bei -陂bei -邶bei -埤bei -萆bei -蓓bei -呗bei -悖bei -碚bei -鹎bei -褙bei -鐾bei -鞴bei -本ben -奔ben -苯ben -笨ben -夯*ben -畚ben -坌ben -贲ben -锛ben -本报benbao -奔波benbo -本部benbu -本厂benchang -奔驰benchi -本地bendi -奔放benfang -泵beng -崩beng -蚌*beng -绷beng -甭beng -蹦beng -迸beng -嘣beng -甏beng -比bi -必bi -避bi -闭bi -辟bi -笔bi -壁bi -臂bi -毕bi -彼bi -逼bi -币bi -鼻bi -蔽bi -秘*bi -鄙bi -碧bi -蓖bi -毙bi -毖bi -庇bi -痹bi -敝bi -弊bi -陛bi -拂*bi -泌*bi -匕bi -俾bi -埤*bi -芘*bi -荜bi -荸bi -萆*bi -薜bi -吡bi -哔bi -狴bi -庳bi -愎bi -滗bi -濞bi -弼bi -妣bi -婢bi -嬖bi -璧bi -贲*bi -睥*bi -畀bi -铋bi -秕bi -裨bi -筚bi -箅bi -篦bi -舭bi -襞bi -跸bi -髀bi -变bian -边bian -便bian -编bian -遍bian -辩bian -扁bian -辨bian -鞭bian -贬bian -卞bian -辫bian -匾bian -弁bian -苄bian -忭bian -汴bian -缏bian -飚bian -煸bian -砭bian -碥bian -窆bian -褊bian -蝙bian -笾bian -鳊bian -表biao -标biao -彪biao -膘biao -勺*biao -婊biao -骠biao -杓biao -飑biao -飙biao -镖biao -镳biao -瘭biao -裱biao -鳔biao -髟biao -别bie -鳖bie -憋bie -瘪bie -蹩bie -宾bin -彬bin -斌bin -濒bin -滨bin -摈bin -傧bin -豳bin -缤bin -玢bin -槟bin -殡bin -膑bin -镔bin -髌bin -鬓bin -并bing -病bing -兵bing -柄bing -冰bing -丙bing -饼bing -秉bing -炳bing -屏*bing -禀bing -邴bing -摒bing -槟*bing -波bo -播bo -剥*bo -伯bo -拨bo -薄*bo -博bo -勃bo -驳bo -玻bo -泊bo -柏*bo -卜*bo -菠bo -钵bo -搏bo -铂bo -箔bo -帛bo -舶bo -脖bo -膊bo -渤bo -魄*bo -孛*bo -亳bo -啵bo -饽bo -檗bo -掰*bo -擘bo -礴bo -钹bo -鹁bo -簸bo -趵*bo -跛bo -踣bo -不bu -部bu -步bu -布bu -补bu -捕bu -埔*bu -卜bu -堡*bu -哺bu -埠bu -簿bu -怖bu -卟bu -逋bu -瓿bu -晡bu -钚bu -钸bu -醭bu -不安buan -不比bubi -不必bubi -不变bubian -不便bubian -步兵bubing -步步bubu -不曾buceng -补偿buchang -不啻buchi -补充buchong -不错bucuo -不大buda -不待budai -不但budan -不当budang -不得bude -不等budeng -步调budiao -不动budong -不断buduan -不对budui -部队budui -不法bufa -补发bufa -步伐bufa -不凡bufan -不妨bufang -不分bufen -部分bufen -不服bufu -不符bufu -不该bugai -不敢bugan -不甘bugan -布告bugao -不够bugou -不顾bugu -不管buguan -不过buguo -不会buhui -补给buji -部件bujian -不借bujie -不尽bujin -不仅bujin -不禁bujin -布景bujing -不久bujiu -补救bujiu -布局buju -不堪bukan -不可buke -不快bukuai -不愧bukui -不理buli -不利buli -不良buliang -不料buliao -步履bulu -不论bulun -部落buluo -不满buman -部门bumen -不免bumian -不能buneng -不怕bupa -补品bupin -不平buping -步枪buqiang -不屈buqu -不然buran -不如buru -不少bushao -不是bushi -不识bushi -部首bushou -部属bushu -部署bushu -补贴butie -不同butong -不妥butuo -部位buwei -部委buwei -不问buwen -不惜buxi -补习buxi -部下buxia -不行buxing -不幸buxing -步行buxing -不朽buxiu -不许buxu -哺养buyang -不要buyao -不宜buyi -不用buyong -哺育buyu -不在buzai -部长buzhang -不振buzhen -不只buzhi -不止buzhi -不知buzhi -不致buzhi -布置buzhi -步骤buzhou -补助buzhu -捕捉buzhuo -步子buzi -不足buzu -博物馆bwg -产c -成c -出c -长c -从c -此c -常c -处c -车c -场c -传c -采c -层c -厂c -才c -次c -虫c -除c -查c -差c -擦ca -拆*ca -嚓ca -礤ca -采cai -才cai -材cai -菜cai -财cai -裁cai -彩cai -猜cai -睬cai -踩cai -蔡cai -参can -残can -蚕can -灿can -餐can -惭can -惨can -孱can -骖can -璨can -粲can -黪can -惨案canan -惨白canbai -残暴canbao -惨怛canda -残废canfei -藏cang -仓cang -苍cang -舱cang -沧cang -苍白cangbai -仓促cangcu -仓库cangku -苍老canglao -苍茫cangmang -藏匿cangni -苍穹cangqiong -沧桑cangsang -苍天cangtian -参观canguan -残骸canhai -残疾canji -参加canjia -参见canjian -残局canju -惨剧canju -参军canjun -参看cankan -参考cankao -残酷canku -惭愧cankui -灿烂canlan -参谋canmou -残缺canque -残忍canren -孱弱canruo -残杀cansha -残生cansheng -蚕食canshi -参数canshu -惨痛cantong -参与canyu -残余canyu -残月canyue -参阅canyue -参赞canzan -惨遭canzao -参战canzhan -参照canzhao -参政canzheng -惨重canzhong -草cao -槽cao -操cao -糙cao -曹cao -嘈cao -漕cao -螬cao -艚cao -草案caoan -草稿caogao -槽糕caogao -操劳caolao -操练caolian -草率caolu -草木caomu -草拟caoni -草签caoqian -操心caoxin -草原caoyuan -嘈杂caoza -操纵caozong -操作caozuo -差不多cbd -成本核算cbhs -出版社cbs -层出不穷ccbq -从长计议ccjy -存储器ccq -长春市ccs -成都市cds -测ce -策ce -侧ce -册ce -厕ce -恻ce -测定ceding -策动cedong -策反cefan -策划cehua -测量celiang -策略celue -侧面cemian -参*cen -岑cen -涔cen -涔涔cencen -层ceng -曾*ceng -蹭ceng -层层cengceng -层次cengci -曾经cengjing -测试ceshi -厕所cesuo -测验ceyan -侧重cezhong -出发点cfd -充分发挥cffh -唱高调cgd -从古到今cgdj -查cha -差cha -插cha -察cha -茶cha -叉cha -茬cha -碴cha -搽cha -岔cha -诧cha -刹*cha -喳*cha -嚓*cha -猹cha -馇cha -汊cha -姹cha -杈cha -楂cha -槎cha -檫cha -锸cha -镲cha -衩cha -查办chaban -差别chabie -差错chacuo -差点chadian -查对chadui -差额chae -查访chafang -察访chafang -查封chafeng -查获chahuo -差*chai -柴chai -拆chai -豺chai -侪chai -钗chai -瘥chai -虿chai -拆穿chaichuan -豺狼chailang -拆散chaisan -差使chaishi -拆卸chaixie -柴油chaiyou -差价chajia -差距chaju -察觉chajue -查看chakan -察看chakan -查考chakao -查明chaming -产chan -单*chan -铲chan -阐chan -搀chan -掺chan -蝉chan -馋chan -谗chan -缠chan -颤chan -冁chan -谄chan -蒇chan -廛chan -忏chan -潺chan -澶chan -孱*chan -羼chan -婵chan -骣chan -觇chan -禅chan -镡chan -蟾chan -躔chan -铲除chanchu -产地chandi -阐发chanfa -搀扶chanfu -长chang -常chang -场chang -厂chang -唱chang -肠chang -昌chang -倡chang -偿chang -畅chang -猖chang -尝chang -敞chang -裳*chang -倘*chang -伥chang -鬯chang -苌chang -菖chang -徜chang -怅chang -惝chang -阊chang -娼chang -嫦chang -昶chang -氅chang -鲳chang -长安changan -常常changchang -长城changcheng -长春changchun -畅达changda -倡导changdao -长度changdu -长短changduan -唱歌changge -常规changgui -长河changhe -场合changhe -偿还changhuan -厂家changjia -常见changjian -长江changjiang -长久changjiu -猖獗changjue -长空changkong -畅快changkuai -猖狂changkuang -场面changmian -长眠changmian -长年changnian -长篇changpian -长期changqi -长驱changqu -常任changren -长沙changsha -厂商changshang -常识changshi -尝试changshi -长寿changshou -常数changshu -场所changsuo -畅谈changtan -长途changtu -怅惘changwang -常委changwei -倘未changwei -常温changwen -常务changwu -畅想changxiang -畅销changxiao -倡议changyi -畅饮changyin -常用changyong -常有changyou -畅游changyou -长远changyuan -厂长changzhang -长征changzheng -厂址changzhi -常驻changzhu -婵娟chanjuan -蝉联chanlian -产量chanliang -缠绵chanmian -阐明chanming -产品chanpin -产权chanquan -缠绕chanrao -产生chansheng -禅师chanshi -阐述chanshu -产物chanwu -产销chanxiao -产业chanye -产值chanzhi -朝chao -超chao -潮chao -巢chao -抄chao -钞chao -嘲chao -吵chao -炒chao -绰*chao -剿*chao -怊chao -晁chao -焯*chao -耖chao -抄报chaobao -超产chaochan -超出chaochu -朝代chaodai -超额chaoe -嘲讽chaofeng -超过chaoguo -朝晖chaohui -超级chaoji -吵架chaojia -潮解chaojie -潮流chaoliu -抄录chaolu -吵闹chaonao -嘲弄chaonong -潮湿chaoshi -潮水chaoshui -抄送chaosong -超脱chaotuo -抄袭chaoxi -朝鲜chaoxian -嘲笑chaoxiao -巢穴chaoxue -朝阳chaoyang -朝野chaoye -超越chaoyue -超支chaozhi -查清chaqing -插曲chaqu -插入charu -查哨chashao -插手chashou -查收chashou -插图chatu -查问chawen -查询chaxun -茶叶chaye -差异chayi -查阅chayue -查证chazheng -岔子chazi -插足chazu -车che -彻che -尺*che -撤che -扯che -掣che -澈che -坼che -砗che -彻底chedi -车祸chehuo -车间chejian -车辆cheliang -陈chen -沉chen -称chen -衬chen -尘chen -臣chen -晨chen -沈*chen -郴chen -辰chen -忱chen -趁chen -伧chen -谌chen -谶chen -抻chen -嗔chen -宸chen -琛chen -榇chen -碜chen -龀chen -尘埃chenai -沉淀chendian -陈腐chenfu -沉浮chenfu -成cheng -程cheng -称cheng -城cheng -承cheng -乘cheng -呈cheng -盛*cheng -撑cheng -诚cheng -橙cheng -惩cheng -澄cheng -逞cheng -骋cheng -秤cheng -丞cheng -埕cheng -噌cheng -枨cheng -柽cheng -塍cheng -瞠cheng -铖cheng -铛cheng -裎cheng -蛏cheng -酲cheng -成败chengbai -承办chengban -惩办chengban -呈报chengbao -承包chengbao -成本chengben -成材chengcai -惩处chengchu -乘除chengchu -承担chengdan -承当chengdang -成都chengdu -程度chengdu -乘法chengfa -惩罚chengfa -成功chenggong -成规chenggui -成果chengguo -称号chenghao -称呼chenghu -成绩chengji -乘机chengji -成家chengjia -成见chengjian -成交chengjiao -承接chengjie -惩戒chengjie -成就chengjiu -乘客chengke -诚恳chengken -成立chengli -乘凉chengliang -成名chengming -成年chengnian -成批chengpi -成品chengpin -诚朴chengpu -逞强chengqiang -澄清chengqing -城区chengqu -成全chengquan -诚然chengran -成人chengren -承认chengren -成色chengse -成事chengshi -诚实chengshi -城市chengshi -承受chengshou -成熟chengshu -成为chengwei -称谓chengwei -成文chengwen -呈现chengxian -呈献chengxian -城乡chengxiang -成效chengxiao -称心chengxin -诚心chengxin -程序chengxu -乘虚chengxu -撑腰chengyao -诚意chengyi -成语chengyu -成员chengyuan -称赞chengzan -成长chengzhang -城镇chengzhen -称职chengzhi -诚挚chengzhi -趁机chenji -沉积chenji -陈迹chenji -沉浸chenjin -沉静chenjing -陈旧chenjiu -陈列chenlie -沉沦chenlun -沉闷chenmen -沉湎chenmian -沉默chenmo -沉溺chenni -陈设chenshe -陈述chenshu -陈说chenshuo -沉思chensi -沉痛chentong -衬托chentuo -沉吟chenyin -衬映chenying -趁早chenzao -沉重chenzhong -沉着chenzhuo -车皮chepi -扯皮chepi -撤退chetui -撤消chexiao -车站chezhan -撤职chezhi -持chi -尺chi -齿chi -吃chi -赤chi -池chi -迟chi -翅chi -斥chi -耻chi -痴chi -匙chi -弛chi -驰chi -侈chi -炽chi -傺chi -坻chi -墀chi -茌chi -叱chi -哧chi -啻chi -嗤chi -彳chi -饬chi -媸chi -敕chi -眵chi -鸱chi -瘛chi -褫chi -蚩chi -螭chi -笞chi -篪chi -豉chi -踟chi -魑chi -翅膀chibang -赤诚chicheng -驰骋chicheng -尺寸chicun -迟到chidao -赤道chidao -尺度chidu -迟钝chidun -吃喝chihe -迟缓chihuan -吃紧chijin -吃惊chijing -持久chijiu -吃苦chiku -吃亏chikui -吃力chili -炽烈chilie -齿轮chilun -持平chiping -痴情chiqing -炽热chire -耻辱chiru -池塘chitang -耻笑chixiao -赤心chixin -痴心chixin -迟疑chiyi -迟早chizao -斥责chize -叱咤chizha -持重chizhong -吃重chizhong -赤字chizi -催化剂chj -种*chong -虫chong -重*chong -充chong -冲chong -崇chong -涌*chong -宠chong -茺chong -忡chong -憧chong -铳chong -舂chong -艟chong -宠爱chongai -崇拜chongbai -充斥chongchi -冲刺chongci -冲淡chongdan -充当chongdang -重叠chongdie -冲动chongdong -宠儿chonger -充分chongfen -冲锋chongfeng -重复chongfu -崇高chonggao -重合chonghe -重婚chonghun -冲击chongji -重建chongjian -崇敬chongjing -憧憬chongjing -充满chongman -充沛chongpei -冲破chongpo -重庆chongqing -崇尚chongshang -重申chongshen -充实chongshi -冲刷chongshua -冲天chongtian -冲突chongtu -重温chongwen -冲洗chongxi -重新chongxin -重演chongyan -重印chongyin -充裕chongyu -充足chongzu -抽chou -仇chou -臭chou -酬chou -畴chou -踌chou -稠chou -愁chou -筹chou -绸chou -瞅chou -丑chou -俦chou -帱chou -惆chou -瘳chou -雠chou -筹办chouban -筹备choubei -惆怅chouchang -抽搐chouchu -踌躇chouchu -筹措choucuo -抽调choudiao -丑恶choue -仇恨chouhen -丑化chouhua -筹划chouhua -筹集chouji -筹建choujian -酬金choujin -抽空choukong -酬劳choulao -丑陋choulou -筹码chouma -稠密choumi -筹谋choumou -愁容chourong -抽象chouxiang -酬谢chouxie -抽噎chouye -出chu -处chu -除chu -初chu -础chu -触chu -楚chu -锄chu -储chu -畜*chu -橱chu -厨chu -躇chu -雏chu -滁chu -矗chu -搐chu -亍chu -刍chu -怵chu -憷chu -绌chu -杵chu -楮chu -樗chu -褚chu -蜍chu -蹰chu -黜chu -揣chuai -搋chuai -啜chuai -嘬*chuai -膪chuai -踹chuai -揣度chuaidu -揣摩chuaimo -传chuan -船chuan -穿chuan -串chuan -川chuan -椽chuan -喘chuan -舛chuan -遄chuan -巛chuan -氚chuan -钏chuan -舡chuan -传遍chuanbian -传标chuanbiao -传播chuanbo -船舶chuanbo -船埠chuanbu -穿插chuancha -传达chuanda -传单chuandan -传导chuandao -传递chuandi -床chuang -创chuang -窗chuang -闯chuang -疮chuang -幢chuang -怆chuang -创办chuangban -闯荡chuangdang -窗户chuanghu -创见chuangjian -创建chuangjian -闯劲chuangjin -创举chuangju -窗口chuangkou -创立chuangli -窗帘chuanglian -创始chuangshi -创新chuangxin -创业chuangye -创造chuangzao -创作chuangzuo -串联chuanlian -喘气chuanqi -传奇chuanqi -传染chuanran -传授chuanshou -传输chuanshu -传述chuanshu -传说chuanshuo -传送chuansong -传统chuantong -串通chuantong -喘息chuanxi -传讯chuanxun -传扬chuanyang -传阅chuanyue -传真chuanzhen -船只chuanzhi -穿着chuanzhuo -出版chuban -出榜chubang -储备chubei -出兵chubing -初步chubu -储藏chucang -出差chucha -出产chuchan -出场chuchang -出厂chuchang -处处chuchu -橱窗chuchuang -初次chuci -储存chucun -初等chudeng -出动chudong -触动chudong -出发chufa -触发chufa -除法chufa -处罚chufa -触犯chufan -出访chufang -除非chufei -处分chufen -出轨chugui -出海chuhai -吹chui -垂chui -锤chui -椎*chui -炊chui -捶chui -陲chui -棰chui -槌chui -吹棒chuibang -吹风chuifeng -吹拂chuifu -锤炼chuilian -吹牛chuiniu -垂青chuiqing -垂涎chuixian -吹嘘chuixu -垂直chuizhi -初级chuji -出击chuji -出界chujie -出境chujing -处境chujing -处决chujue -触觉chujue -除开chukai -出口chukou -出来chulai -除了chule -出力chuli -处理chuli -矗立chuli -初恋chulian -出笼chulong -出路chulu -出马chuma -出卖chumai -出面chumian -出名chuming -除名chuming -出没chumo -春chun -纯chun -醇chun -椿chun -唇chun -淳chun -蠢chun -莼chun -鹑chun -蝽chun -出纳chuna -春播chunbo -纯粹chuncui -纯度chundu -春分chunfen -春风chunfeng -春耕chungeng -春光chunguang -醇厚chunhou -春辉chunhui -春季chunji -春节chunjie -纯洁chunjie -纯净chunjing -纯利chunli -纯朴chunpu -春秋chunqiu -春色chunse -春笋chunsun -春天chuntian -处女chunu -触怒chunu -春意chunyi -纯真chunzhen -纯正chunzheng -戳chuo -绰chuo -啜*chuo -辍chuo -踔chuo -龊chuo -戳穿chuochuan -绰号chuohao -啜泣chuoqi -出品chupin -出奇chuqi -初期chuqi -出勤chuqin -出去chuqu -出让churang -出任churen -出入churu -出色chuse -出身chushen -出神chushen -出生chusheng -畜生chusheng -出事chushi -出世chushi -处世chushi -厨师chushi -出售chushou -处所chusuo -出庭chuting -锄头chutou -出土chutu -出外chuwai -除外chuwai -出席chuxi -出息chuxi -除夕chuxi -出现chuxian -初小chuxiao -雏形chuxing -储蓄chuxu -刍议chuyi -处于chuyu -初战chuzhan -处长chuzhang -出诊chuzhen -出征chuzheng -处置chuzhi -初中chuzhong -出租chuzu -此ci -次ci -刺ci -磁ci -雌ci -词ci -茨ci -疵ci -辞ci -慈ci -瓷ci -赐ci -伺*ci -兹*ci -茈ci -呲ci -祠ci -鹚ci -糍ci -慈爱ciai -辞别cibie -磁场cichang -磁带cidai -磁道cidao -此地cidi -词典cidian -辞典cidian -刺耳cier -词根cigen -刺骨cigu -此后cihou -词汇cihui -刺激ciji -赐教cijiao -此刻cike -刺客cike -词类cilei -辞令ciling -磁盘cipan -次品cipin -辞去ciqu -刺杀cisha -此时cishi -次数cishu -辞书cishu -词素cisu -祠堂citang -辞退citui -此外ciwai -慈祥cixiang -辞行cixing -词性cixing -雌雄cixiong -次序cixu -词序cixu -刺眼ciyan -次要ciyao -词语ciyu -赐予ciyu -此致cizhi -辞职cizhi -词缀cizhui -词组cizu -超级大国cjdg -参考书cks -参考消息ckxx -参考资料ckzl -触类旁通clpt -藏龙卧虎clwh -参谋长cmc -聪明才智cmcz -出谋划策cmhc -从难从严cncy -从cong -丛cong -聪cong -葱cong -囱cong -匆cong -苁cong -淙cong -骢cong -琮cong -璁cong -从此congci -匆匆congcong -匆促congcu -从而conger -从犯congfan -聪慧conghui -从来conglai -丛林conglin -匆忙congmang -聪明congming -从前congqian -从容congrong -从事congshi -丛书congshu -从速congsu -从新congxin -从严congyan -聪颖congying -葱郁congyu -从中congzhong -凑cou -楱cou -辏cou -腠cou -凑合couhe -凑巧couqiao -成品率cpl -成千上万cqsw -从容不迫crbp -承认错误crcw -趁热打铁crdt -措手不及csbj -出生率csl -长沙市css -炊事员csy -彻头彻尾ctcw -垂头丧气ctsq -粗cu -促cu -醋cu -簇cu -卒*cu -蔟cu -徂cu -猝cu -殂cu -酢cu -蹙cu -蹴cu -篡cuan -蹿cuan -窜cuan -攒*cuan -汆cuan -撺cuan -爨cuan -镩cuan -篡夺cuanduo -窜犯cuanfan -篡改cuangai -篡权cuanquan -粗暴cubao -粗糙cucao -粗犷cuguang -催cui -脆cui -淬cui -粹cui -摧cui -衰*cui -崔cui -瘁cui -翠cui -萃cui -啐cui -悴cui -璀cui -榱cui -毳cui -隹cui -摧残cuican -脆弱cuiruo -促进cujin -存cun -村cun -寸cun -蹲*cun -忖cun -皴cun -存储cunchu -存档cundang -存放cunfang -存款cunkuan -村落cunluo -存亡cunwang -存在cunzai -村镇cunzhen -村庄cunzhuang -村子cunzi -错cuo -措cuo -撮cuo -磋cuo -搓cuo -挫cuo -厝cuo -嵯cuo -脞cuo -锉cuo -矬cuo -痤cuo -瘥*cuo -鹾cuo -蹉cuo -错案cuoan -挫败cuobai -错处cuochu -措辞cuoci -错怪cuoguai -错过cuoguo -撮合cuohe -错觉cuojue -磋商cuoshang -挫伤cuoshang -措施cuoshi -错误cuowu -挫折cuozhe -错综cuozong -粗浅cuqian -促使cushi -粗俗cusu -粗心cuxin -粗壮cuzhuang -常委会cwh -崇文区cwq -常务委员会cwwh -乘务员cwy -诚心诚意cxcy -程序控制cxkz -程序设计cxsj -长远利益cyly -朝阳区cyq -财政部czb -错综复杂czfz -操之过急czgj -出租汽车czqc -此之外czw -财政危机czwj -创造性czx -操作系统czxt -操作员czy -持之以恒czyh -的d -大d -地d -动d -到d -对d -度d -多d -电d -党d -得d -定d -等d -斗d -当d -队d -都d -点d -代d -道d -大da -打da -达da -答da -搭da -塔*da -瘩da -耷da -哒da -嗒da -怛da -妲da -沓*da -疸da -褡da -笪da -靼da -鞑da -答案daan -打败dabai -大办daban -大半daban -打扮daban -答辩dabian -大伯dabo -大部dabu -达成dacheng -大胆dadan -搭档dadang -大道dadao -达到dadao -打倒dadao -大地dadi -大敌dadi -大抵dadi -打断daduan -大队dadui -大多daduo -大凡dafan -大夫dafu -大幅dafu -答复dafu -大概dagai -大纲dagang -大国daguo -大海dahai -大好dahao -大河dahe -大亨daheng -大会dahui -大*dai -代dai -带dai -待dai -袋dai -戴dai -呆dai -歹dai -傣dai -殆dai -贷dai -逮dai -怠dai -埭dai -甙dai -呔dai -岱dai -迨dai -骀dai -绐dai -玳dai -黛dai -呆板daiban -代表daibiao -逮捕daibu -逮逋daibu -代词daici -带动daidong -怠工daigong -代价daijia -贷款daikuan -带来dailai -代理daili -带领dailing -带路dailu -黛绿dailu -代码daima -怠慢daiman -待命daiming -代数daishu -代替daiti -带头daitou -歹徒daitu -待遇daiyu -呆滞daizhi -呆子daizi -打击daji -大家dajia -打搅dajiao -大街dajie -大捷dajie -打劫dajie -搭救dajiu -大局daju -答卷dajuan -打开dakai -耷拉dala -大力dali -大连dalian -大量daliang -打量daliang -大陆dalu -大略dalue -大妈dama -单dan -但dan -弹dan -担dan -石*dan -蛋dan -淡dan -胆dan -氮dan -丹dan -旦dan -耽dan -郸dan -掸dan -惮dan -诞dan -儋dan -萏dan -啖dan -澹*dan -殚dan -赕dan -眈dan -疸dan -瘅dan -聃dan -箪dan -大脑danao -担保danbao -单薄danbao -淡薄danbao -单产danchan -诞辰danchen -单纯danchun -单词danci -担当dandang -单调dandiao -单独dandu -单方danfang -担负danfu -党dang -当dang -档dang -挡dang -荡dang -谠dang -凼dang -菪dang -宕dang -砀dang -裆dang -单干dangan -胆敢dangan -档案dangan -当场dangchang -当初dangchu -当代dangdai -当地dangdi -单个dange -耽搁dange -党风dangfeng -党纲danggang -党纪dangji -党籍dangji -当即dangji -当家dangjia -当今dangjin -当局dangju -当量dangliang -当面dangmian -党内dangnei -当年dangnian -党派dangpai -当铺dangpu -当前dangqian -当然dangran -当日dangri -当时dangshi -当天dangtian -当头dangtou -党团dangtuan -当晚dangwan -党委dangwei -当先dangxian -党校dangxiao -当心dangxin -党性dangxing -荡漾dangyang -党员dangyuan -当月dangyue -党章dangzhang -当真dangzhen -党政dangzheng -当政dangzheng -当中dangzhong -当众dangzhong -当做dangzuo -单价danjia -担架danjia -胆量danliang -胆略danlue -淡漠danmo -胆怯danqie -丹青danqing -担任danren -单身danshen -诞生dansheng -但是danshi -胆识danshi -单体danti -丹田dantian -单位danwei -耽误danwu -单项danxiang -胆小danxiao -担心danxin -淡雅danya -弹药danyao -单一danyi -单元danyuan -但愿danyuan -单质danzhi -担子danzi -掸子danzi -单字danzi -到dao -道dao -导dao -刀dao -倒dao -稻dao -岛dao -捣dao -盗dao -蹈dao -祷dao -悼dao -叨dao -帱*dao -忉dao -氘dao -焘*dao -纛dao -倒闭daobi -到处daochu -悼词daoci -到达daoda -导弹daodan -道德daode -到底daodi -倒戈daoge -捣鬼daogui -捣毁daohui -到来daolai -到了daole -道理daoli -倒立daoli -道路daolu -捣乱daoluan -倒霉daomei -叨念daonian -道歉daoqian -刀枪daoqiang -盗窃daoqie -到时daoshi -导师daoshi -倒数daoshu -导体daoti -倒退daotui -导演daoyan -道义daoyi -盗用daoyong -岛屿daoyu -导致daozhi -大批dapi -大破dapo -打破dapo -大气daqi -大庆daqing -打扰darao -打扫dasao -大厦dasha -搭讪dashan -大赦dashe -大使dashi -大事dashi -大师dashi -大势dashi -大肆dasi -打算dasuan -大体dati -大厅dating -打听dating -大同datong -大小daxiao -大写daxie -答谢daxie -大选daxuan -大学daxue -大业daye -达因dayin -打印dayin -答应daying -大于dayu -大院dayuan -大约dayue -打仗dazhang -大致dazhi -大众dazhong -打字dazi -代办处dbc -得不偿失dbcs -大部分dbf -电报挂号dbgh -大不了dbl -大步流星dblx -对不起dbq -代表团dbt -电冰箱dbx -东城区dcq -到此为止dcwz -独创性dcx -调查研究dcyj -打成一片dcyp -打电话ddh -电动机ddj -对得起ddq -大多数dds -的de -得de -地*de -德de -底*de -锝de -得逞decheng -的当dedang -得当dedang -得到dedao -得分defen -德国deguo -得奖dejiang -得救dejiu -得了dele -得力deli -等deng -灯deng -登deng -邓deng -澄*deng -蹬deng -瞪deng -凳deng -噔deng -嶝deng -戥deng -磴deng -镫deng -簦deng -登场dengchang -等待dengdai -等到dengdao -灯光dengguang -等候denghou -等级dengji -登记dengji -等价dengjia -灯具dengju -登门dengmen -灯谜dengmi -登攀dengpan -登山dengshan -灯塔dengta -登台dengtai -等同dengtong -等闲dengxian -等于dengyu -登载dengzai -得胜desheng -得失deshi -得体deti -德行dexing -得以deyi -得意deyi -德育deyu -得志dezhi -得知dezhi -得罪dezui -大幅度dfd -多方面dfm -单方面dfm -电风扇dfs -大规模dgm -多功能dgn -大公无私dgws -帝国主义dgzy -电话号码dhhm -电化教育dhjy -大会堂dht -的*di -地di -第di -低di -敌di -底di -提*di -帝di -抵di -滴di -弟di -递di -堤di -迪di -笛di -狄di -涤di -翟di -嫡di -蒂di -缔di -氐di -籴di -诋di -谛di -邸di -坻*di -荻di -嘀di -娣di -绨di -柢di -棣di -觌di -砥di -碲di -睇di -镝di -羝di -骶di -嗲dia -电dian -点dian -垫dian -典dian -店dian -颠dian -淀dian -掂dian -滇dian -碘dian -靛dian -佃dian -甸dian -惦dian -奠dian -殿dian -阽dian -坫dian -巅dian -玷dian -钿dian -癜dian -癫dian -簟dian -踮dian -电报dianbao -点播dianbo -电场dianchang -电车dianche -电池dianchi -电传dianchuan -颠倒diandao -电灯diandeng -点滴diandi -奠定dianding -电动diandong -典范dianfan -淀粉dianfen -垫付dianfu -颠覆dianfu -电感diangan -典故diangu -电荷dianhe -电弧dianhu -电话dianhua -电汇dianhui -电机dianji -电极dianji -奠基dianji -惦记dianji -典籍dianji -点将dianjiang -电解dianjie -殿军dianjun -癫狂diankuang -电缆dianlan -电力dianli -电离dianli -典礼dianli -电流dianliu -电路dianlu -电脑diannao -电能dianneng -店铺dianpu -电气dianqi -电器dianqi -点燃dianran -电容dianrong -电扇dianshan -电视dianshi -电台diantai -电梯dianti -点头diantou -电网dianwang -电位dianwei -玷污dianwu -殿下dianxia -电线dianxian -癫痫dianxian -电信dianxin -典型dianxing -电讯dianxun -电压dianya -电影dianying -店员dianyuan -点阵dianzhen -点缀dianzhui -电子dianzi -点子dianzi -电阻dianzu -调diao -掉diao -吊diao -鸟*diao -碉diao -叼diao -雕diao -凋diao -刁diao -钓diao -铞diao -铫diao -貂diao -鲷diao -碉堡diaobao -凋敝diaobi -调查diaocha -吊车diaoche -调动diaodong -调度diaodu -钓饵diaoer -调换diaohuan -掉换diaohuan -雕刻diaoke -调令diaoling -刁难diaonan -调遣diaoqian -调任diaoren -雕塑diaosu -吊唁diaoyan -调用diaoyong -钓鱼diaoyu -调子diaozi -第八diba -地板diban -地步dibu -低沉dichen -抵触dichu -抵达dida -地带didai -低档didang -抵挡didang -地道didao -弟弟didi -地点didian -地段diduan -敌对didui -迭die -跌die -爹die -碟die -蝶die -谍die -叠die -垤die -堞die -揲die -喋die -牒die -瓞die -耋die -踮*die -蹀die -鲽die -迭起dieqi -第二dier -地方difang -低估digu -敌国diguo -帝国diguo -敌后dihou -诋毁dihui -低级diji -递加dijia -递减dijian -地窖dijiao -递交dijiao -缔交dijiao -缔结dijie -第九dijiu -敌军dijun -抵抗dikang -地牢dilao -地理dili -低劣dilie -第六diliu -低落diluo -地貌dimao -地面dimian -抵命diming -定ding -顶ding -钉ding -丁ding -订ding -盯ding -叮ding -鼎ding -锭ding -仃ding -啶ding -玎ding -腚ding -碇ding -町ding -铤*ding -疔ding -耵ding -酊ding -定案dingan -定产dingchan -丁当dingdang -顶点dingdian -定夺dingduo -定额dinge -顶峰dingfeng -顶锋dingfeng -定购dinggou -订购dinggou -订户dinghu -定货dinghuo -订货dinghuo -定价dingjia -定局dingju -定居dingju -定理dingli -订立dingli -鼎立dingli -定量dingliang -定律dinglu -定期dingqi -定然dingran -盯梢dingshao -定时dingshi -顶替dingti -定性dingxing -定型dingxing -定义dingyi -定语dingyu -定员dingyuan -订阅dingyue -订正dingzheng -叮嘱dingzhu -顶撞dingzhuang -钉子dingzi -嫡派dipai -地盘dipan -第七diqi -嫡亲diqin -敌情diqing -地球diqiu -地区diqu -的确dique -敌人diren -第三disan -地势dishi -第十dishi -滴水dishui -第四disi -地铁ditie -地图ditu -丢diu -铥diu -丢掉diudiao -丢脸diulian -丢失diushi -地位diwei -敌伪diwei -第五diwu -嫡系dixi -底细dixi -地下dixia -低下dixia -底下dixia -地形dixing -弟兄dixiong -第一diyi -敌意diyi -地域diyu -抵御diyu -缔造dizao -递增dizeng -地震dizhen -敌阵dizhen -地质dizhi -地址dizhi -抵制dizhi -底子dizi -弟子dizi -党纪国法djgf -当机立断djld -多劳多得dldd -大力发展dlfz -大力加强dljq -大力开展dlkz -独立自主dlzz -多面手dms -对内搞活dngh -多年来dnl -东南亚dny -动dong -东dong -冬dong -懂dong -洞dong -冻dong -董dong -栋dong -侗dong -恫dong -垌dong -咚dong -岽dong -峒dong -氡dong -胨dong -胴dong -硐dong -鸫dong -东北dongbei -东边dongbian -东部dongbu -洞察dongcha -动词dongci -动荡dongdang -懂得dongde -东方dongfang -东风dongfeng -动工donggong -东海donghai -恫吓donghe -动机dongji -冬季dongji -东家dongjia -冻结dongjie -动静dongjing -东京dongjing -动力dongli -动量dongliang -栋梁dongliang -动乱dongluan -动脉dongmai -东南dongnan -东欧dongou -动人dongren -动身dongshen -董事dongshi -动手dongshou -动态dongtai -冬天dongtian -动听dongting -动物dongwu -东西dongxi -洞悉dongxi -动向dongxiang -动心dongxin -东亚dongya -东洋dongyang -动摇dongyao -动用dongyong -动员dongyuan -动辄dongzhe -动作dongzuo -斗dou -都*dou -豆dou -读*dou -兜dou -抖dou -陡dou -逗dou -痘dou -蔸dou -窦dou -蚪dou -篼dou -兜风doufeng -逗号douhao -逗留douliu -斗室doushi -兜售doushou -斗争douzheng -斗志douzhi -斗智douzhi -抖嘴douzui -打破常规dpcg -地平线dpx -电器化dqh -待人接物drjw -第三产业dscy -第十二届dsej -大使馆dsg -到时候dsh -电视机dsj -多少年dsn -大失所望dssw -电视台dst -低三下四dsxs -第十一届dsyj -大踏步dtb -到头来dtl -大体上dts -大同小异dtxy -度du -都du -毒du -独du -读du -渡du -杜du -堵du -镀du -顿du -督du -犊du -睹du -赌du -肚du -妒du -芏du -嘟du -渎du -椟du -牍du -蠹du -笃du -髑du -黩du -断duan -端duan -段duan -短duan -锻duan -缎duan -椴duan -煅duan -簖duan -短波duanbo -短处duanchu -短促duancu -断定duanding -短短duanduan -断交duanjiao -断绝duanjue -锻练duanlian -锻炼duanlian -短路duanlu -段落duanluo -短评duanping -短期duanqi -短缺duanque -断然duanran -煅烧duanshao -断送duansong -短途duantu -端午duanwu -端详duanxiang -短小duanxiao -断言duanyan -端阳duanyang -短语duanyu -短暂duanzan -端正duanzheng -端庄duanzhuang -读报dubao -读本duben -赌博dubo -独裁ducai -毒草ducao -独唱duchang -独创duchuang -督促ducu -毒打duda -独到dudao -度过duguo -毒害duhai -毒化duhua -都会duhui -对dui -队dui -堆dui -敦*dui -兑dui -怼dui -憝dui -碓dui -对比duibi -队部duibu -对策duice -对称duichen -对此duici -对待duidai -对等duideng -对调duidiao -对方duifang -对付duifu -对话duihua -兑换duihuan -对讲duijiang -对抗duikang -对口duikou -对垒duilei -对立duili -对联duilian -队列duilie -对流duiliu -对面duimian -对内duinei -对偶duiou -对手duishou -对数duishu -对外duiwai -队伍duiwu -兑现duixian -对象duixiang -对应duiying -对于duiyu -队员duiyuan -堆栈duizhan -队长duizhang -对照duizhao -对证duizheng -对质duizhi -对峙duizhi -对准duizhun -镀金dujin -杜绝dujue -渡口dukou -都来dulai -独立duli -度量duliang -盾dun -吨dun -顿dun -蹲dun -敦dun -墩dun -囤dun -钝dun -遁dun -沌dun -炖dun -砘dun -礅dun -盹dun -镦dun -趸dun -蹲点dundian -顿号dunhao -囤积dunji -遁迹dunji -钝角dunjiao -顿时dunshi -敦实dunshi -多duo -度*duo -夺duo -朵duo -掇duo -哆duo -垛duo -躲duo -跺duo -舵duo -剁duo -惰duo -堕duo -驮*duo -咄duo -哚duo -沲duo -缍duo -柁duo -铎duo -裰duo -踱duo -多半duoban -躲避duobi -多变duobian -多边duobian -躲藏duocang -多次duoci -夺得duode -多端duoduan -多方duofang -躲开duokai -多亏duokui -夺魁duokui -堕落duoluo -多么duome -夺目duomu -多年duonian -多情duoqing -夺取duoqu -多少duoshao -多事duoshi -掇拾duoshi -舵手duoshou -多数duoshu -多谢duoxie -多心duoxin -惰性duoxing -多样duoyang -多余duoyu -多种duozhong -肚皮dupi -毒品dupin -毒气duqi -读取duqu -度日duri -读入duru -堵塞duse -毒蛇dushe -都是dushi -毒手dushou -读数dushu -读书dushu -毒素dusu -独特dute -读物duwu -毒药duyao -独占duzhan -读者duzhe -毒汁duzhi -渎职duzhi -赌注duzhu -杜撰duzhuan -独自duzi -党委会dwh -对外开放dwkf -敌我矛盾dwmd -对外贸易dwmy -大无畏dww -动物园dwy -当务之急dwzj -邓小平dxp -大学生dxs -大显身手dxss -大西洋dxy -大跃进dyj -打印机dyj -大有可为dykw -待业青年dyqn -掉以轻心dyqx -电影院dyy -大洋洲dyz -大有作为dyzw -党支部dzb -多种多样dzdy -党政机关dzjg -多种经营dzjy -断章取义dzqy -大自然dzr -德智体dzt -电子学dzx -党中央dzy -而e -二e -尔e -儿e -恶e -额e -恩e -俄e -耳e -饵e -蛾e -饿e -峨e -鹅e -讹e -娥e -厄e -扼e -遏e -鄂e -噩e -谔e -垩e -苊e -莪e -萼e -呃e -愕e -屙e -婀e -轭e -腭e -锇e -锷e -鹗e -颚e -鳄e -恶霸eba -恶毒edu -恶感egan -恶棍egun -噩耗ehao -恶化ehua -诶ei -二极管ejg -二进制ejz -恶劣elie -鹅毛emao -噩梦emeng -恶魔emo -耳目一新emyx -恩en -蒽en -摁en -恩爱enai -恩赐enci -恩典endian -恩惠enhui -恩情enqing -而er -二er -尔er -儿er -耳er -饵er -洱er -贰er -佴er -迩er -珥er -铒er -鸸er -鲕er -耳朵erduo -儿歌erge -耳光erguang -而后erhou -尔后erhou -二届erjie -而今erjin -而况erkuang -而且erqie -而是ershi -儿童ertong -儿戏erxi -而已eryi -耳语eryu -二月eryue -儿子erzi -扼杀esha -额外ewai -扼腕ewan -额外负担ewfd -恶习exi -恶心exin -恶性exing -恶性循环exxh -扼要eyao -厄运eyun -讹诈ezha -遏止ezhi -分f -发f -方f -法f -反f -放f -复f -风f -防f -非f -服f -肥f -副f -粉f -府f -夫f -负f -封f -富f -翻f -发fa -法fa -阀fa -乏fa -伐fa -罚fa -筏fa -珐fa -垡fa -砝fa -发报fabao -法宝fabao -发表fabiao -发布fabu -发财facai -发愁fachou -发出fachu -发达fada -发电fadian -法典fadian -法定fading -发动fadong -发放fafang -发奋fafen -发愤fafen -法官faguan -法规fagui -法国faguo -发慌fahuang -发挥fahui -发火fahuo -发给faji -发迹faji -法纪faji -发家fajia -发奖fajiang -发酵fajiao -罚金fajin -发觉fajue -发掘fajue -罚款fakuan -发狂fakuang -法郎falang -法令faling -法律falu -发落faluo -发明faming -反fan -翻fan -范fan -犯fan -饭fan -繁fan -泛fan -番fan -凡fan -烦fan -返fan -藩fan -帆fan -樊fan -矾fan -钒fan -贩fan -蕃fan -蘩fan -幡fan -梵fan -燔fan -畈fan -蹯fan -翻版fanban -反比fanbi -反驳fanbo -帆布fanbu -反常fanchang -范畴fanchou -犯愁fanchou -帆船fanchuan -饭店fandian -反动fandong -翻动fandong -反对fandui -繁多fanduo -反而faner -反复fanfu -方fang -放fang -防fang -访fang -房fang -纺fang -仿fang -妨fang -芳fang -肪fang -坊fang -邡fang -彷*fang -枋fang -钫fang -舫fang -鲂fang -妨碍fangai -方案fangan -反感fangan -防备fangbei -方便fangbian -防潮fangchao -方程fangcheng -放大fangda -放荡fangdang -防盗fangdao -方法fangfa -防范fangfan -防风fangfeng -防腐fangfu -仿佛fangfu -妨害fanghai -防护fanghu -防火fanghuo -放假fangjia -房间fangjian -方面fangmian -放牧fangmu -返工fangong -反攻fangong -放屁fangpi -放弃fangqi -防区fangqu -放任fangren -放哨fangshao -放射fangshe -方式fangshi -防守fangshou -放肆fangsi -放松fangsong -仿宋fangsong -翻滚fangun -方位fangwei -防卫fangwei -访问fangwen -房屋fangwu -放下fangxia -防线fangxian -方向fangxiang -芳香fangxiang -仿效fangxiao -放心fangxin -放行fangxing -方言fangyan -防疫fangyi -防御fangyu -仿造fangzao -仿照fangzhao -方针fangzhen -仿真fangzhen -防治fangzhi -仿制fangzhi -放置fangzhi -防止fangzhi -纺织fangzhi -房子fangzi -放纵fangzong -房租fangzu -番号fanhao -繁华fanhua -反悔fanhui -返回fanhui -反击fanji -反抗fankang -反馈fankui -泛滥fanlan -范例fanli -凡例fanli -翻脸fanlian -贩卖fanmai -繁忙fanmang -烦闷fanmen -反面fanmian -反目fanmu -烦恼fannao -反叛fanpan -犯人fanren -繁荣fanrong -反射fanshe -翻身fanshen -繁盛fansheng -凡是fanshi -凡事fanshi -繁琐fansuo -烦琐fansuo -翻腾fanteng -繁体fanti -饭桶fantong -发怒fanu -饭碗fanwan -范围fanwei -反问fanwen -反响fanxiang -返销fanxiao -反省fanxing -翻修fanxiu -繁衍fanyan -翻译fanyi -翻印fanyin -反应fanying -反映fanying -繁育fanyu -翻越fanyue -翻阅fanyue -贩运fanyun -繁杂fanza -烦燥fanzao -反正fanzheng -反之fanzhi -繁殖fanzhi -繁重fanzhong -贩子fanzi -犯罪fanzui -发起faqi -法权faquan -发射fashe -发生fasheng -发誓fashi -发售fashou -法庭fating -发现faxian -发泄faxie -发行faxing -发言fayan -发扬fayang -法医fayi -发育fayu -发源fayuan -法院fayuan -法则faze -发展fazhan -法制fazhi -法治fazhi -发作fazuo -奋不顾身fbgs -分崩离析fblx -副产品fcp -发电机fdj -发动机fdj -反动派fdp -分道扬镳fdyb -非fei -肥fei -飞fei -费fei -废fei -肺fei -沸fei -菲fei -匪fei -啡fei -诽fei -吠fei -芾fei -狒fei -悱fei -淝fei -妃fei -绯fei -榧fei -腓fei -斐fei -扉fei -镄fei -痱fei -蜚fei -篚fei -翡fei -霏fei -鲱fei -匪帮feibang -诽谤feibang -飞奔feiben -非常feichang -飞驰feichi -废除feichu -非但feidan -非得feide -沸点feidian -非法feifa -非凡feifan -肺腑feifu -绯红feihong -废话feihua -飞机feiji -飞溅feijian -费解feijie -费劲feijin -飞快feikuai -费力feili -肥料feiliao -废料feiliao -肥胖feipang -废品feipin -废弃feiqi -费神feishen -废水feishui -飞速feisu -沸腾feiteng -匪徒feitu -肥沃feiwo -废物feiwu -飞舞feiwu -飞翔feixiang -费心feixin -飞行feixing -废墟feixu -飞扬feiyang -扉页feiye -非议feiyi -费用feiyong -飞跃feiyue -肥皂feizao -飞涨feizhang -废止feizhi -非洲feizhou -妃子feizi -分fen -粉fen -奋fen -份fen -粪fen -纷fen -芬fen -愤fen -酚fen -吩fen -氛fen -坟fen -焚fen -汾fen -忿fen -偾fen -瀵fen -玢*fen -棼fen -鲼fen -鼢fen -分贝fenbei -分辩fenbian -分辨fenbian -粪便fenbian -分别fenbie -分部fenbu -分布fenbu -分册fence -分寸fencun -分担fendan -分得fende -分店fendian -奋斗fendou -分队fendui -分发fenfa -奋发fenfa -纷纷fenfen -吩咐fenfu -风feng -封feng -蜂feng -丰feng -缝feng -峰feng -锋feng -疯feng -奉feng -枫feng -烽feng -逢feng -冯feng -讽feng -凤feng -俸feng -酆feng -葑feng -唪feng -沣feng -砜feng -风暴fengbao -丰碑fengbei -封闭fengbi -风波fengbo -丰产fengchan -奉承fengcheng -讽刺fengci -封存fengcun -风度fengdu -分割fenge -分隔fenge -风发fengfa -风帆fengfan -丰富fengfu -奉告fenggao -风格fengge -奉公fenggong -风光fengguang -风寒fenghan -奉还fenghuan -凤凰fenghuang -烽火fenghuo -封建fengjian -风景fengjing -疯狂fengkuang -风浪fenglang -风力fengli -风流fengliu -丰满fengman -锋芒fengmang -风貌fengmao -奉命fengming -丰年fengnian -分工fengong -奉陪fengpei -风气fengqi -风情fengqing -风趣fengqu -奉劝fengquan -缝纫fengren -风骚fengsao -风沙fengsha -风尚fengshang -风声fengsheng -丰盛fengsheng -丰收fengshou -风霜fengshuang -风水fengshui -丰硕fengshuo -奉祀fengsi -风俗fengsu -封锁fengsuo -疯瘫fengtan -封条fengtiao -风头fengtou -分管fenguan -风味fengwei -缝隙fengxi -风险fengxian -奉献fengxian -风向fengxiang -风行fengxing -奉行fengxing -蜂拥fengyong -风云fengyun -风韵fengyun -风灾fengzai -疯子fengzi -风姿fengzi -分号fenhao -分毫fenhao -分红fenhong -粉红fenhong -分化fenhua -分会fenhui -焚毁fenhui -分级fenji -分解fenjie -分界fenjie -奋进fenjin -分居fenju -分开fenkai -愤慨fenkai -分类fenlei -分离fenli -奋力fenli -分量fenliang -分裂fenlie -纷乱fenluan -分娩fenmian -分秒fenmiao -分明fenming -粉末fenmo -坟墓fenmu -愤怒fennu -分派fenpai -分配fenpei -分批fenpi -分期fenqi -分歧fenqi -奋起fenqi -分清fenqing -分区fenqu -分散fensan -焚烧fenshao -分数fenshu -分说fenshuo -粉碎fensui -分摊fentan -粪土fentu -分外fenwai -氛围fenwei -分析fenxi -奋勇fenyong -分赃fenzang -奋战fenzhan -分支fenzhi -分子fenzi -分组fenzu -丰富多采ffdc -奋发图强fftq -反过来说fgls -反革命fgm -福建省fjs -封建主义fjzy -翻来覆去flfq -法律顾问flgw -分秒必争fmbz -发明创造fmcz -否fou -缶fou -否定fouding -否决foujue -否认fouren -否则fouze -费品率fpl -废寝忘食fqws -缝纫机frj -分水岭fsl -翻天复地ftfd -丰台区ftq -非同小可ftxk -繁体字ftz -复fu -服fu -副fu -府fu -夫fu -负fu -富fu -附fu -福fu -伏fu -符fu -幅fu -腐fu -浮fu -辅fu -付fu -腹fu -妇fu -孵fu -覆fu -扶fu -辐fu -傅fu -佛fu -缚fu -父fu -弗fu -甫fu -肤fu -氟fu -敷fu -拂fu -俘fu -涪fu -袱fu -抚fu -俯fu -釜fu -斧fu -脯fu -腑fu -赴fu -赋fu -阜fu -讣fu -咐fu -匐fu -凫fu -郛fu -芙fu -芾*fu -苻fu -茯fu -莩fu -菔fu -拊fu -呋fu -幞fu -怫fu -滏fu -艴fu -孚fu -驸fu -绂fu -绋fu -桴fu -赙fu -祓fu -砩fu -黻fu -黼fu -罘fu -稃fu -馥fu -蚨fu -蜉fu -蝠fu -蝮fu -麸fu -趺fu -跗fu -鲋fu -鳆fu -腐败fubai -复辟fubi -复查fucha -浮沉fuchen -扶持fuchi -付出fuchu -副词fuci -服从fucong -附带fudai -负担fudan -辅导fudao -浮雕fudiao -浮动fudong -幅度fudu -复发fufa -伏法fufa -夫妇fufu -覆盖fugai -讣告fugao -富贵fugui -符号fuhao -附和fuhe -符合fuhe -负荷fuhe -腐化fuhua -浮华fuhua -复活fuhuo -俘获fuhuo -伏击fuji -附加fujia -附件fujian -福建fujian -佛教fujiao -附近fujin -副刊fukan -俯瞰fukan -浮夸fukua -付款fukuan -腐烂fulan -福利fuli -浮力fuli -富丽fuli -妇联fulian -附录fulu -俘虏fulu -覆灭fumie -覆没fumo -父母fumu -富农funong -妇女funu -扶贫fupin -服气fuqi -福气fuqi -夫妻fuqi -付讫fuqi -肤浅fuqian -富强fuqiang -父亲fuqin -富饶furao -夫人furen -芙蓉furong -妇孺furu -负伤fushang -辐射fushe -复试fushi -腐蚀fushi -俯视fushi -副手fushou -复数fushu -负数fushu -附属fushu -富庶fushu -赋税fushui -伏特fute -覆亡fuwang -富翁fuweng -服务fuwu -复习fuxi -浮现fuxian -赋闲fuxian -浮想fuxiang -腐朽fuxiu -抚恤fuxu -敷衍fuyan -扶养fuyang -抚养fuyang -俯仰fuyang -副业fuye -服役fuyi -复印fuyin -富有fuyou -赋有fuyou -赋于fuyu -抚育fuyu -富裕fuyu -赋予fuyu -复员fuyuan -复原fuyuan -负约fuyue -复杂fuza -负载fuzai -附则fuze -负责fuze -负债fuzhai -付帐fuzhang -复制fuzhi -扶植fuzhi -附中fuzhong -福州fuzhou -抚州fuzhou -附注fuzhu -辅助fuzhu -扶助fuzhu -服装fuzhuang -附着fuzhuo -富足fuzu -辅佐fuzuo -服务部fwb -服务态度fwtd -服务员fwy -方兴未艾fxwa -奋勇当先fydx -翻一番fyf -风言风语fyfy -发扬光大fygd -复印机fyj -发言人fyr -风雨同舟fytz -房租费fzf -副总理fzl -纺织品fzp -福州市fzs -反作用fzy -副作用fzy -负责制fzz -发展中国家fzzj -个g -国g -工g -过g -高g -干g -关g -各g -革g -公g -根g -更g -改g -管g -光g -广g -果g -格g -共g -搞g -夹*ga -噶ga -嘎ga -胳*ga -尬ga -尕ga -尜ga -旮ga -钆ga -公安部gab -改gai -该gai -盖gai -概gai -钙gai -溉gai -芥*gai -丐gai -陔gai -垓gai -戤gai -赅gai -改变gaibian -改编gaibian -该当gaidang -改道gaidao -改动gaidong -改革gaige -改观gaiguan -改过gaiguo -改悔gaihui -改建gaijian -改进gaijin -概况gaikuang -概括gaikuo -改良gailiang -概率gailu -概论gailun -概貌gaimao -概念gainian -改期gaiqi -改善gaishan -概述gaishu -概叹gaitan -改天gaitian -改选gaixuan -概要gaiyao -改造gaizao -改正gaizheng -改装gaizhuang -改组gaizu -公安局gaj -干gan -杆gan -感gan -敢gan -赶gan -甘gan -肝gan -秆gan -柑gan -竿gan -赣gan -乾*gan -坩gan -苷gan -尴gan -擀gan -泔gan -淦gan -澉gan -绀gan -橄gan -旰gan -矸gan -疳gan -酐gan -干部ganbu -感触ganchu -干脆gancui -敢当gandang -甘当gandang -感到gandao -感动gandong -感恩ganen -刚gang -钢gang -缸gang -纲gang -岗gang -港gang -杠gang -冈gang -肛gang -扛*gang -戆gang -罡gang -筻gang -尴尬ganga -港澳gangao -刚才gangcai -钢材gangcai -刚刚ganggang -刚好ganghao -港口gangkou -纲领gangling -岗哨gangshao -钢铁gangtie -港湾gangwan -岗位gangwei -港务gangwu -刚要gangyao -纲要gangyao -刚毅gangyi -干旱ganhan -感化ganhua -干活ganhuo -肝火ganhuo -感激ganji -干劲ganjin -赶紧ganjin -干净ganjing -感觉ganjue -感慨gankai -甘苦ganku -赶快gankuai -赶忙ganmang -感冒ganmao -感情ganqing -感染ganran -干扰ganrao -干涉ganshe -干事ganshi -感受ganshou -甘肃gansu -感叹gantan -干线ganxian -感想ganxiang -敢想ganxiang -感谢ganxie -甘心ganxin -感性ganxing -感应ganying -敢于ganyu -干预ganyu -甘愿ganyuan -干燥ganzao -感召ganzhao -赣州ganzhou -敢做ganzuo -高gao -搞gao -告gao -稿gao -膏gao -篙gao -皋gao -羔gao -糕gao -镐gao -睾gao -诰gao -郜gao -藁gao -缟gao -槔gao -槁gao -杲gao -锆gao -高矮gaoai -高昂gaoang -告别gaobie -高产gaochan -高超gaochao -高潮gaochao -告成gaocheng -告辞gaoci -高大gaoda -高档gaodang -高等gaodeng -高地gaodi -高低gaodi -糕点gaodian -高度gaodu -告发gaofa -高峰gaofeng -高高gaogao -高歌gaoge -高贵gaogui -高喊gaohan -搞好gaohao -高呼gaohu -搞坏gaohuai -高级gaoji -告急gaoji -高价gaojia -高见gaojian -稿件gaojian -告捷gaojie -告诫gaojie -高龄gaoling -高楼gaolou -告密gaomi -高明gaoming -高能gaoneng -高攀gaopan -高频gaopin -高强gaoqiang -高山gaoshan -高尚gaoshang -高深gaoshen -告示gaoshi -高耸gaosong -高速gaosu -告诉gaosu -高温gaowen -高小gaoxiao -高校gaoxiao -高兴gaoxing -膏药gaoyao -高原gaoyuan -高涨gaozhang -高招gaozhao -高中gaozhong -告终gaozhong -告状gaozhuang -稿子gaozi -港澳同胞gatb -怪不得gbd -各部门gbm -各部委gbw -供不应求gbyq -故步自封gbzf -共产党gcd -共产党员gcdy -工程师gcs -顾此失彼gcsb -贯彻执行gczx -共产主义gczy -各地方gdf -各大军区gdjq -广东省gds -高档商品gdsp -各单位gdw -高等院校gdyx -固定资产gdzc -个ge -各ge -革ge -合*ge -格ge -割ge -歌ge -隔ge -盖*ge -哥ge -铬ge -阁ge -戈ge -葛ge -搁ge -鸽ge -胳ge -疙ge -蛤ge -咯*ge -屹*ge -鬲ge -仡ge -哿ge -圪ge -塥ge -嗝ge -纥*ge -搿ge -膈ge -硌ge -镉ge -袼ge -颌*ge -虼ge -舸ge -骼ge -隔壁gebi -戈壁gebi -个别gebie -歌唱gechang -各处gechu -革除gechu -疙瘩geda -各地gedi -格调gediao -隔断geduan -个个gege -各个gege -各国geguo -隔阂gehe -歌喉gehou -各级geji -各界gejie -格局geju -割据geju -隔绝gejue -各类gelei -隔离geli -割裂gelie -格律gelu -革命geming -隔膜gemo -给gei -根gen -跟gen -亘gen -茛gen -哏gen -艮gen -根本genben -根除genchu -根底gendi -更geng -耕geng -颈geng -庚geng -羹geng -埂geng -耿geng -梗geng -哽geng -赓geng -绠geng -鲠geng -耕地gengdi -更迭gengdie -更动gengdong -更多gengduo -更改genggai -梗概genggai -更高genggao -更换genghuan -更加gengjia -更为gengwei -颈项gengxiang -更新gengxin -哽咽gengyan -耕耘gengyun -更正gengzheng -耿直gengzhi -梗直gengzhi -耕种gengzhong -梗阻gengzu -耕作gengzuo -根基genji -根据genju -跟前genqian -跟随gensui -根源genyuan -根治genzhi -跟着genzhuo -根子genzi -跟踪genzong -搁浅geqian -歌曲gequ -个人geren -格式geshi -歌颂gesong -个体geti -格外gewai -各位gewei -歌舞gewu -阁下gexia -各项gexiang -革新gexin -个性gexing -格言geyan -各样geyang -歌咏geyong -搁置gezhi -各种gezhong -各族gezu -国防部gfb -各方面gfm -格格不入ggbr -归根到底ggdd -恭恭敬敬ggjj -滚瓜烂熟ggls -歌功颂德ggsd -共和国ghg -各行各业ghgy -干劲冲天gjct -各级党委gjdw -各级领导gjld -国家利益gjly -国计民生gjms -工具书gjs -各尽所能gjsn -国库券gkq -工矿企业gkqy -孤陋寡闻glgw -规律性glx -国民党gmd -革命化gmh -革命家gmj -国民经济gmjj -购买力gml -光明磊落gmll -光明日报gmrb -顾名思义gmsy -冠冕堂皇gmth -刮目相看gmxk -光明正大gmzd -工农兵gnb -国内外gnw -工农业gny -工gong -公gong -共gong -供gong -功gong -攻gong -红*gong -巩gong -贡gong -汞gong -宫gong -恭gong -龚gong -躬gong -弓gong -拱gong -珙gong -肱gong -蚣gong -觥gong -公安gongan -公报gongbao -工本gongben -公布gongbu -公差gongcha -公拆gongchai -工厂gongchang -功臣gongchen -工程gongcheng -共处gongchu -供词gongci -共存gongcun -公道gongdao -公德gongde -功德gongde -工地gongdi -公敌gongdi -宫殿gongdian -攻读gongdu -公费gongfei -公愤gongfen -工夫gongfu -功夫gongfu -公告gonggao -公共gonggong -巩固gonggu -公关gongguan -公害gonghai -公函gonghan -共和gonghe -工会gonghui -供给gongji -共计gongji -攻击gongji -功绩gongji -公家gongjia -公斤gongjin -恭敬gongjing -工具gongju -公开gongkai -功课gongke -公款gongkuan -功劳gonglao -公理gongli -公里gongli -公历gongli -公路gonglu -功率gonglu -公民gongmin -共鸣gongming -公墓gongmu -功能gongneng -工农gongnong -公判gongpan -公平gongping -公仆gongpu -供求gongqiu -工区gongqu -公然gongran -工人gongren -公认gongren -供认gongren -工伤gongshang -公社gongshe -公审gongshen -工时gongshi -公事gongshi -共事gongshi -公式gongshi -公署gongshu -公司gongsi -公私gongsi -公诉gongsu -宫廷gongting -共同gongtong -恭维gongwei -公文gongwen -公物gongwu -公务gongwu -恭喜gongxi -贡献gongxian -工效gongxiao -功效gongxiao -供销gongxiao -共性gongxing -工序gongxu -共需gongxu -功勋gongxun -供养gongyang -工业gongye -工艺gongyi -供应gongying -公用gongyong -共有gongyou -公元gongyuan -公园gongyuan -公约gongyue -公允gongyun -公债gongzhai -公章gongzhang -共振gongzhen -工整gongzheng -公正gongzheng -公证gongzheng -供职gongzhi -公众gongzhong -工资gongzi -工作gongzuo -够gou -构gou -沟gou -句*gou -狗gou -钩gou -勾gou -购gou -苟gou -垢gou -佝gou -诟gou -岣gou -遘gou -媾gou -缑gou -枸gou -觏gou -彀gou -笱gou -篝gou -鞲gou -构成goucheng -勾搭gouda -勾当goudang -媾和gouhe -沟壑gouhe -构件goujian -勾结goujie -购买goumai -苟且gouqie -构思gousi -沟通goutong -勾通goutong -构陷gouxian -勾销gouxiao -购销gouxiao -勾引gouyin -构造gouzao -购置gouzhi -钩子gouzi -国庆节gqj -共青团gqt -光荣榜grb -根深蒂固gsdg -瓜熟蒂落gsdl -公使馆gsg -各式各样gsgy -甘肃省gss -工商业gsy -个体户gth -改头换面gthm -高谈阔论gtkl -鼓gu -固gu -古gu -骨gu -故gu -顾gu -股gu -谷gu -估gu -雇gu -孤gu -姑gu -贾*gu -辜gu -菇gu -咕gu -箍gu -沽gu -蛊gu -嘏gu -诂gu -菰gu -呱gu -崮gu -汩gu -梏gu -轱gu -牯gu -牿gu -臌gu -毂gu -瞽gu -罟gu -钴gu -锢gu -鸪gu -鹄*gu -痼gu -蛄gu -酤gu -觚gu -鲴gu -鹘gu -挂gua -刮gua -瓜gua -括*gua -剐gua -寡gua -褂gua -卦gua -诖gua -呱gua -栝gua -胍gua -鸹gua -瓜分guafen -瓜葛guage -挂号guahao -怪guai -乖guai -拐guai -乖舛guaichuan -乖戾guaili -乖僻guaipi -乖巧guaiqiao -怪物guaiwu -怪异guaiyi -拐杖guaizhang -挂名guaming -关guan -管guan -观guan -官guan -灌guan -贯guan -惯guan -冠guan -馆guan -罐guan -棺guan -纶*guan -倌guan -莞guan -掼guan -涫guan -盥guan -鹳guan -矜guan -鳏guan -关闭guanbi -观测guance -观察guancha -贯彻guanche -贯穿guanchuan -管道guandao -官邸guandi -观点guandian -官方guanfang -光guang -广guang -逛guang -咣guang -犷guang -桄guang -胱guang -灌溉guangai -光标guangbiao -广播guangbo -广博guangbo -光彩guangcai -广场guangchang -光大guangda -广大guangda -广东guangdong -广度guangdu -广泛guangfan -广告guanggao -光顾guanggu -光滑guanghua -光辉guanghui -光景guangjing -广阔guangkuo -光芒guangmang -广袤guangmao -光明guangming -光盘guangpan -光谱guangpu -光荣guangrong -观光guanguang -广西guangxi -光线guangxian -广义guangyi -光阴guangyin -光涌guangyong -广州guangzhou -关怀guanhuai -挂念guanian -管家guanjia -关键guanjian -管教guanjiao -关节guanjie -冠军guanjun -关卡guanka -观看guankan -关口guankou -管理guanli -贯例guanli -惯例guanli -官吏guanli -关联guanlian -官僚guanliao -观摩guanmo -灌木guanmu -官能guanneng -观念guannian -关切guanqie -观赏guanshang -管事guanshi -管束guanshu -灌输guanshu -关税guanshui -官司guansi -贯通guantong -关头guantou -观望guanwang -关系guanxi -管辖guanxia -官衔guanxian -关心guanxin -惯性guanxing -关押guanya -惯用guanyong -关于guanyu -官员guanyuan -观战guanzhan -关照guanzhao -管制guanzhi -观止guanzhi -观众guanzhong -关注guanzhu -贯注guanzhu -馆子guanzi -挂失guashi -挂帅guashuai -鼓吹guchui -故此guci -古代gudai -孤单gudan -故地gudi -古典gudian -固定guding -鼓动gudong -股东gudong -古董gudong -孤独gudu -咕嘟gudu -孤儿guer -股份gufen -辜负gufu -骨干gugan -雇工gugong -故宫gugong -古怪guguai -蛊惑guhuo -规gui -贵gui -归gui -硅gui -鬼gui -轨gui -龟gui -桂gui -瑰gui -圭gui -闺gui -诡gui -癸gui -柜gui -跪gui -刽gui -傀*gui -炔*gui -匦gui -刿gui -庋gui -宄gui -妫gui -桧gui -炅gui -晷gui -皈gui -簋gui -鲑gui -鳜gui -诡辩guibian -贵宾guibin -归并guibing -规程guicheng -归档guidang -轨道guidao -规定guiding -归队guidui -规范guifan -规格guige -归公guigong -归功guigong -桂冠guiguan -归国guiguo -规划guihua -鬼话guihua -归还guihuan -诡计guiji -轨迹guiji -贵贱guijian -归咎guijiu -规矩guiju -瑰丽guili -鬼脸guilian -龟裂guilie -规律guilu -诡秘guimi -规模guimo -归纳guina -闺女guinu -规劝guiquan -贵人guiren -归属guishu -龟缩guisuo -柜台guitai -闺秀guixiu -归于guiyu -规则guize -规章guizhang -贵重guizhong -贵州guizhou -鬼子guizi -贵族guizu -归罪guizui -顾及guji -估计guji -古迹guji -顾忌guji -估价gujia -古今gujin -古旧gujiu -故旧gujiu -故居guju -顾客guke -孤苦guku -古老gulao -孤立guli -鼓励guli -估量guliang -顾虑gulu -估摸gumo -滚gun -辊gun -棍gun -衮gun -绲gun -磙gun -鲧gun -滚动gundong -姑娘guniang -雇农gunong -滚烫guntang -棍子gunzi -国guo -过guo -果guo -锅guo -郭guo -涡*guo -裹guo -馘guo -埚guo -掴guo -呙guo -帼guo -崞guo -猓guo -椁guo -虢guo -聒guo -蜾guo -蝈guo -过半guoban -国策guoce -国产guochan -过程guocheng -过错guocuo -过度guodu -过渡guodu -果断guoduan -国法guofa -国防guofang -过分guofen -果腹guofu -果敢guogan -国歌guoge -过关guoguan -过后guohou -国会guohui -国际guoji -国籍guoji -国家guojia -国界guojie -国境guojing -国库guoku -过来guolai -过量guoliang -过虑guolu -锅炉guolu -国民guomin -过目guomu -果木guomu -国难guonan -国内guonei -果皮guopi -果品guopin -国旗guoqi -过期guoqi -国情guoqing -国庆guoqing -过去guoqu -果然guoran -过少guoshao -过甚guoshen -过剩guosheng -过时guoshi -国事guoshi -过失guoshi -果实guoshi -过头guotou -国外guowai -国王guowang -过问guowen -国务guowu -过细guoxi -国药guoyao -国营guoying -过硬guoying -过于guoyu -果园guoyuan -果真guozhen -锅子guozi -顾盼gupan -孤僻gupi -股票gupiao -骨气guqi -姑且guqie -顾全guquan -固然guran -古人guren -骨肉gurou -故事gushi -股市gushi -固守gushou -估算gusuan -固体guti -骨头gutou -故土gutu -顾问guwen -古文guwen -谷物guwu -鼓舞guwu -姑息guxi -故乡guxiang -故意guyi -雇佣guyong -固有guyou -雇员guyuan -鼓掌guzhang -故障guzhang -固执guzhi -拐弯抹角gwmj -国务委员gwwy -国务院gwy -改邪归正gxgz -更新换代gxhd -各行其事gxqs -感性认识gxrs -广西壮族gxzz -工业化gyh -工艺流程gylc -工艺美术gyms -工业品gyp -工艺品gyp -贵阳市gys -公有制gyz -各种各样gzgy -工资级别gzjb -各族人民gzrm -工作上gzs -广州市gzs -贵州省gzs -各自为政gzwz -高瞻远瞩gzyz -高瞻远嘱gzyz -工作者gzz -和h -会h -后h -化h -好h -合h -还h -活h -很h -回h -号h -毫h -花h -或h -海h -话h -红h -火h -黄h -害h -哈ha -蛤*ha -虾*ha -铪ha -哈达hada -还hai -海hai -害hai -孩hai -骸hai -氦hai -亥hai -骇hai -嘿*hai -咳*hai -嗨hai -胲hai -醢hai -海岸haian -海拔haiba -海报haibao -害虫haichong -害处haichu -海岛haidao -海港haigang -海关haiguan -还好haihao -海疆haijiang -海军haijun -海浪hailang -海绵haimian -害怕haipa -海上haishang -还是haishi -海外haiwai -海湾haiwan -海峡haixia -海啸haixiao -害羞haixiu -海洋haiyang -还要haiyao -还有haiyou -海域haiyu -海员haiyuan -孩子haizi -含han -焊han -旱han -喊han -汉han -寒han -汗han -函han -韩han -酣han -憨han -邯han -涵han -罕han -翰han -撼han -捍han -憾han -悍han -邗han -菡han -撖han -阚han -瀚han -晗han -焓han -顸han -颔han -蚶han -鼾han -寒潮hanchao -寒带handai -行*hang -航hang -夯hang -杭hang -吭*hang -巷*hang -沆hang -绗hang -珩hang -颃hang -航标hangbiao -航程hangcheng -航船hangchuan -行当hangdang -航道hangdao -航海hanghai -行家hangjia -行距hangju -航空hangkong -行列hanglie -航路hanglu -航模hangmo -函购hangou -行情hangqing -航天hangtian -航线hangxian -航向hangxiang -航行hangxing -航运hangyun -杭州hangzhou -含糊hanhu -含混hanhun -旱季hanji -函件hanjian -罕见hanjian -汉奸hanjian -喊叫hanjiao -焊接hanjie -寒冷hanleng -翰林hanlin -寒流hanliu -函授hanshou -函数hanshu -酣睡hanshui -寒酸hansuan -捍卫hanwei -含蓄hanxu -寒暄hanxuan -涵养hanyang -含义hanyi -涵义hanyi -汉语hanyu -含冤hanyuan -旱灾hanzai -汉字hanzi -汉族hanzu -好hao -号hao -毫hao -耗hao -豪hao -郝hao -浩hao -镐*hao -壕hao -嚎hao -貉*hao -蒿hao -薅hao -嗥hao -嚆hao -濠hao -灏hao -昊hao -皓hao -颢hao -蚝hao -好比haobi -毫不haobu -号称haocheng -好处haochu -浩大haoda -好歹haodai -浩荡haodang -好的haode -浩繁haofan -耗费haofei -好感haogan -好汉haohan -豪华haohua -好坏haohuai -号角haojiao -耗竭haojie -豪杰haojie -浩劫haojie -好看haokan -毫厘haoli -号令haoling -号码haoma -豪迈haomai -毫毛haomao -毫米haomi -浩淼haomiao -好奇haoqi -豪强haoqiang -豪情haoqing -好人haoren -豪绅haoshen -毫升haosheng -好事haoshi -豪爽haoshuang -好似haosi -耗损haosun -号啕haotao -好听haoting -好玩haowan -毫无haowu -好象haoxiang -好些haoxie -好样haoyang -好意haoyi -号召haozhao -好转haozhuan -汇编程序hbcx -货币回笼hbhl -货币流通hblt -河北省hbs -湖北省hbs -汇编语言hbyy -或多或少hdhs -海淀区hdq -和he -合he -河he -何he -核he -赫he -荷he -褐he -喝he -贺he -呵he -禾he -吓*he -盒he -菏he -貉he -阂he -涸he -鹤he -诃he -劾he -壑he -嗬he -阖he -纥he -曷he -盍he -颌he -蚵he -翮he -和蔼heai -哈尔滨heb -合办heban -荷包hebao -河北hebei -何必hebi -合并hebing -哈尔滨市hebs -何不hebu -喝彩hecai -合唱hechang -何尝hechang -合成hecheng -呵斥hechi -何处hechu -河川hechuan -河床hechuang -贺词heci -何等hedeng -贺电hedian -核定heding -核对hedui -合法hefa -何妨hefang -合肥hefei -合格hege -和好hehao -赫赫hehe -合乎hehu -合伙hehuo -黑hei -嘿hei -黑暗heian -黑白heibai -黑帮heibang -嘿嘿heihei -黑人heiren -黑色heise -黑市heishi -黑夜heiye -合计heji -核计heji -和解hejie -合金hejin -何苦heku -何况hekuang -合理heli -合力heli -合流heliu -河流heliu -合谋hemou -和睦hemu -很hen -狠hen -痕hen -恨hen -河南henan -狠毒hendu -很多henduo -河内henei -行*heng -横heng -衡heng -恒heng -哼heng -亨heng -蘅heng -珩*heng -桁heng -横财hengcai -哼哧hengchi -横幅hengfu -横亘henggen -横贯hengguan -横祸henghuo -横加hengjia -衡量hengliang -横蛮hengman -横批hengpi -衡器hengqi -横扫hengsao -横竖hengshu -恒心hengxin -横行hengxing -恒星hengxing -很好henhao -贺年henian -痕迹henji -很快henkuai -狠心henxin -狠抓henzhua -和平heping -和气heqi -河渠hequ -赫然heran -河山heshan -和尚heshang -合适heshi -核实heshi -合算hesuan -核算hesuan -河滩hetan -合同hetong -贺喜hexi -和谐hexie -核心hexin -贺信hexin -和煦hexu -何以heyi -合影heying -合营heying -核准hezhun -合资hezi -赫兹hezi -合作hezuo -合法权益hfqy -合肥市hfs -宏观世界hgsj -化公为私hgws -好高务远hgwy -核工业部hgyb -海关总署hgzs -后顾之忧hgzy -呼和浩特hhht -轰轰烈烈hhll -换句话说hjhs -黄金时代hjsd -环境卫生hjws -后继有人hjyr -海枯石烂hksl -合理化hlh -糊里糊涂hlht -黑龙江hlj -汗流浃背hljb -汗马功劳hmgl -海南岛hnd -河南省hns -湖南省hns -红hong -洪hong -轰hong -烘hong -哄hong -虹hong -鸿hong -宏hong -弘hong -黉hong -訇hong -讧hong -荭hong -蕻hong -薨hong -闳hong -泓hong -红尘hongchen -轰动hongdong -洪都hongdu -洪峰hongfeng -鸿沟honggou -宏观hongguan -红光hongguang -红花honghua -红军hongjun -红利hongli -洪亮hongliang -轰隆honglong -弘论honglun -鸿毛hongmao -轰鸣hongming -哄骗hongpian -红旗hongqi -红人hongren -红色hongse -洪水hongshui -哄抬hongtai -宏图hongtu -宏伟hongwei -红星hongxing -弘扬hongyang -鸿运hongyun -红晕hongyun -轰炸hongzha -后hou -候hou -厚hou -侯hou -喉hou -猴hou -吼hou -堠hou -後hou -逅hou -瘊hou -篌hou -糇hou -鲎hou -骺hou -后备houbei -后辈houbei -后边houbian -厚薄houbo -候补houbu -后尘houchen -后代houdai -厚道houdao -厚度houdu -后盾houdun -后方houfang -后果houguo -后患houhuan -后悔houhui -后记houji -后进houjin -后劲houjin -后来houlai -喉咙houlong -后门houmen -后面houmian -后期houqi -后勤houqin -后人houren -喉舌houshe -厚实houshi -后嗣housi -后台houtai -后天houtian -后退houtui -后续houxu -候选houxuan -后裔houyi -后缀houzhui -和平共处hpgc -黄埔江hpj -后勤部hqb -何去何从hqhc -合情合理hqhl -好容易hry -好事多磨hsdm -胡思乱想hslx -航天工业部htgb -昏头昏脑hthn -欢天喜地htxd -和*hu -护hu -互hu -湖hu -呼hu -户hu -弧hu -乎hu -胡hu -糊hu -虎hu -忽hu -核*hu -瑚hu -戏*hu -壶hu -葫hu -蝴hu -狐hu -唬hu -沪hu -冱hu -唿hu -囫hu -岵hu -猢hu -怙hu -惚hu -浒hu -滹hu -琥hu -槲hu -轷hu -觳hu -烀hu -煳hu -戽hu -扈hu -祜hu -瓠hu -鹄hu -鹕hu -鹱hu -笏hu -醐hu -斛hu -化hua -花hua -话hua -划hua -滑hua -华hua -画hua -哗hua -猾hua -豁*hua -骅hua -桦hua -砉hua -铧hua -画报huabao -华北huabei -哗变huabian -话柄huabing -划拨huabo -划策huace -画册huace -华东huadong -花朵huaduo -花儿huaer -化肥huafei -花费huafei -划分huafen -化工huagong -华贵huagui -化合huahe -花卉huahui -坏huai -怀huai -划*huai -淮huai -槐huai -徊huai -踝huai -怀抱huaibao -淮北huaibei -坏处huaichu -怀古huaigu -淮海huaihai -怀恨huaihen -怀旧huaijiu -淮南huainan -怀念huainian -坏人huairen -坏事huaishi -怀疑huaiyi -怀着huaizhe -滑稽huaji -画家huajia -话剧huaju -哗啦huala -画廊hualang -华丽huali -画面huamian -化名huaming -还*huan -环huan -换huan -欢huan -缓huan -患huan -幻huan -焕huan -桓huan -唤huan -痪huan -豢huan -涣huan -宦huan -郇huan -奂huan -萑huan -擐huan -圜huan -獾huan -洹huan -浣huan -漶huan -寰huan -逭huan -缳huan -锾huan -鲩huan -鬟huan -华南huanan -欢畅huanchang -缓冲huanchong -幻灯huandeng -欢度huandu -焕发huanfa -黄huang -簧huang -荒huang -皇huang -慌huang -蝗huang -磺huang -凰huang -惶huang -煌huang -晃huang -幌huang -恍huang -谎huang -隍huang -徨huang -湟huang -潢huang -遑huang -璜huang -肓huang -癀huang -蟥huang -篁huang -鳇huang -磺胺huangan -皇朝huangchao -荒诞huangdan -晃荡huangdang -皇帝huangdi -荒废huangfei -黄海huanghai -黄河huanghe -恍惚huanghu -谎话huanghua -黄昏huanghun -黄金huangjin -皇历huangli -荒凉huangliang -荒乱huangluan -慌乱huangluan -慌忙huangmang -荒谬huangmiu -恍然huangran -黄色huangse -黄山huangshan -皇上huangshang -荒唐huangtang -环顾huangu -宦官huanguan -谎言huangyan -慌张huangzhang -幌子huangzi -缓和huanhe -欢呼huanhu -环环huanhuan -滑腻huani -花鸟huaniao -还给huanji -缓急huanji -还价huanjia -环节huanjie -环境huanjing -幻境huanjing -幻景huanjing -欢聚huanju -幻觉huanjue -欢乐huanle -缓慢huanman -患难huannan -唤起huanqi -缓期huanqi -欢庆huanqing -环球huanqiu -寰球huanqiu -换取huanqu -环绕huanrao -涣散huansan -欢声huansheng -环视huanshi -欢送huansong -换算huansuan -欢腾huanteng -欢喜huanxi -幻想huanxiang -欢笑huanxiao -欢心huanxin -欢欣huanxin -环行huanxing -缓刑huanxing -唤醒huanxing -幻影huanying -欢迎huanying -寰宇huanyu -还原huanyuan -患者huanzhe -滑坡huapo -花腔huaqiang -华侨huaqiao -划清huaqing -花圈huaquan -划拳huaquan -哗然huaran -华人huaren -花色huase -化身huashen -化石huashi -划算huasuan -话题huati -滑头huatou -花纹huawen -华夏huaxia -化纤huaxian -画像huaxiang -花絮huaxu -化学huaxue -画押huaya -化验huayan -花样huayang -华裔huayi -话音huayin -话语huayu -花园huayuan -画展huazhan -花招huazhao -华中huazhong -化装huazhuang -化妆huazhuang -湖北hubei -胡扯huche -弧度hudu -忽而huer -呼喊huhan -呼号huhao -呼唤huhuan -互惠huhui -会hui -回hui -灰hui -挥hui -辉hui -汇hui -毁hui -慧hui -恢hui -绘hui -惠hui -徽hui -溃*hui -堕*hui -徊*hui -蛔hui -悔hui -卉hui -晦hui -贿hui -秽hui -烩hui -讳hui -诲hui -诙hui -茴hui -荟hui -蕙hui -咴hui -哕hui -喙hui -隳hui -洄hui -浍hui -彗hui -缋hui -珲hui -桧*hui -晖hui -恚hui -虺hui -蟪hui -麾hui -灰暗huian -回报huibao -汇报huibao -回避huibi -汇编huibian -会场huichang -回潮huichao -灰尘huichen -回春huichun -荟萃huicui -回答huida -回荡huidang -回电huidian -汇兑huidui -挥发huifa -汇费huifei -会风huifeng -回复huifu -恢复huifu -悔改huigai -回顾huigu -惠顾huigu -悔过huiguo -会合huihe -回合huihe -汇合huihe -悔恨huihen -恢弘huihong -会话huihua -回话huihua -绘画huihua -毁坏huihuai -辉煌huihuang -挥霍huihuo -会集huiji -回击huiji -汇集huiji -回家huijia -会见huijian -会聚huiju -汇聚huiju -回扣huikou -汇款huikuan -回来huilai -回笼huilong -汇率huilu -贿赂huilu -会面huimian -毁灭huimie -回民huimin -汇票huipiao -回去huiqu -挥洒huisa -灰色huise -晦涩huise -回收huishou -回首huishou -会谈huitan -会堂huitang -会同huitong -回头huitou -回味huiwei -会晤huiwu -挥舞huiwu -悔悟huiwu -麾下huixia -回想huixiang -回响huixiang -诙谐huixie -灰心huixin -彗星huixing -会演huiyan -汇演huiyan -会议huiyi -回忆huiyi -回音huiyin -辉映huiying -会员huiyuan -会战huizhan -徽章huizhang -会诊huizhen -绘制huizhi -回转huizhuan -汇总huizong -回族huizu -户籍huji -呼叫hujiao -户口hukou -虎口hukou -护理huli -互利huli -护林hulin -呼噜hulu -胡乱huluan -忽略hulue -互勉humian -混hun -浑hun -荤hun -昏hun -婚hun -魂hun -诨hun -馄hun -阍hun -溷hun -湖南hunan -胡闹hunao -昏沉hunchen -混合hunhe -浑厚hunhou -昏黄hunhuang -混迹hunji -婚礼hunli -混乱hunluan -糊弄hunong -婚配hunpei -混入hunru -浑身hunshen -混同huntong -混淆hunxiao -婚姻hunyin -昏庸hunyong -混杂hunza -混帐hunzhang -混浊hunzhuo -浑浊hunzhuo -和*huo -活huo -或huo -火huo -货huo -获huo -伙huo -霍huo -豁huo -惑huo -祸huo -劐huo -藿huo -攉huo -嚯huo -夥huo -钬huo -锪huo -镬huo -耠huo -蠖huo -火把huoba -伙伴huoban -火暴huobao -货币huobi -火柴huochai -火车huoche -豁达huoda -获得huode -霍地huodi -活动huodong -伙房huofang -祸根huogen -祸害huohai -火候huohou -火化huohua -火花huohua -祸患huohuan -活活huohuo -伙计huoji -火箭huojian -火警huojing -火炬huoju -火坑huokeng -活力huoli -霍乱huoluan -活泼huopo -获取huoqu -豁然huoran -货色huose -火山huoshan -获胜huosheng -或是huoshi -伙食huoshi -祸首huoshou -伙同huotong -货物huowu -获悉huoxi -火线huoxian -活现huoxian -或许huoxu -火药huoyao -活页huoye -活跃huoyue -货运huoyun -火灾huozai -火葬huozang -或则huoze -或者huozhe -获准huozhun -湖泊hupo -忽然huran -呼声husheng -护士hushi -忽视hushi -湖水hushui -胡说hushuo -护送husong -胡同hutong -互通hutong -户头hutou -糊涂hutu -护卫huwei -呼吸huxi -互相huxiang -呼啸huxiao -虎穴huxue -护养huyang -呼应huying -呼吁huyu -护照huzhao -互助huzhu -毫无疑问hwyw -互相爱护hxah -横行霸道hxbd -互相帮助hxbz -欢欣鼓舞hxgw -候选人hxr -合作化hzh -杭州市hzs -化整为零hzwl -级j -就j -进j -加j -经j -家j -结j -阶j -间j -件j -及j -解j -较j -机j -军j -接j -教j -极j -九j -见j -基本国策jbgc -基本上jbs -据不完全统计jbwj -饥不择食jbzs -坚持不懈jcbx -集成电路jcdl -基础上jcs -绝大部分jdbf -坚定不移jdby -绝大多数jdds -鉴定会jdh -绝对化jdh -经得起jdq -见多识广jdsg -精打细算jdxs -接二连三jels -解放后jfh -解放军jfj -解放军报jfjb -解放前jfq -仅供参考jgck -机构改革jggg -坚固耐用jgny -襟怀坦白jhtb -计划性jhx -级ji -及ji -机ji -极ji -几ji -积ji -给ji -基ji -其*ji -记ji -己ji -期*ji -系*ji -革*ji -计ji -集ji -即ji -际ji -季ji -激ji -济ji -技ji -击ji -继ji -急ji -剂ji -既ji -纪ji -寄ji -挤ji -鸡ji -迹ji -绩ji -齐*ji -奇*ji -吉ji -脊ji -辑ji -籍ji -疾ji -肌ji -棘ji -畸ji -圾ji -稽ji -箕ji -饥ji -讥ji -姬ji -缉ji -汲ji -嫉ji -蓟ji -冀ji -伎ji -祭ji -悸ji -寂ji -忌ji -妓ji -藉ji -丌ji -亟ji -乩ji -剞ji -佶ji -偈ji -诘ji -墼ji -芨ji -芰ji -荠ji -蒺ji -蕺ji -掎ji -叽ji -咭ji -哜ji -唧ji -岌ji -嵴ji -洎ji -屐ji -骥ji -畿ji -玑ji -楫ji -殛ji -戟ji -戢ji -赍ji -觊ji -犄ji -齑ji -矶ji -羁ji -嵇ji -稷ji -瘠ji -虮ji -笈ji -笄ji -暨ji -跻ji -跽ji -霁ji -鲚ji -鲫ji -髻ji -麂ji -加jia -家jia -架jia -价jia -甲jia -夹jia -假jia -钾jia -贾jia -稼jia -驾jia -嘉jia -枷jia -佳jia -荚jia -颊jia -嫁jia -茄*jia -挟*jia -嘏*jia -伽jia -郏jia -葭jia -岬jia -浃jia -迦jia -珈jia -戛jia -胛jia -恝jia -铗jia -镓jia -痂jia -瘕jia -袷jia -蛱jia -笳jia -袈jia -跏jia -加班jiaban -甲板jiaban -加倍jiabei -甲虫jiachong -家畜jiachu -家当jiadang -家底jiadi -假定jiading -加法jiafa -家访jiafang -价格jiage -加工jiagong -佳话jiahua -家伙jiahuo -加急jiaji -嘉奖jiajiang -家教jiajiao -嫁接jiajie -佳节jiajie -假借jiajie -加紧jiajin -家境jiajing -家具jiaju -加剧jiaju -加快jiakuai -加仑jialun -加码jiama -假冒jiamao -家门jiamen -加密jiami -加冕jiamian -价目jiamu -间jian -件jian -见jian -建jian -坚jian -减jian -检jian -践jian -尖jian -简jian -碱jian -剪jian -艰jian -渐jian -肩jian -键jian -健jian -柬jian -鉴jian -剑jian -歼jian -监jian -兼jian -浅*jian -奸jian -箭jian -茧jian -舰jian -俭jian -笺jian -煎jian -缄jian -硷jian -拣jian -捡jian -荐jian -槛jian -贱jian -饯jian -溅jian -涧jian -僭jian -谏jian -谫jian -菅jian -蒹jian -搛jian -囝*jian -湔jian -蹇jian -謇jian -缣jian -枧jian -楗jian -戋jian -戬jian -牮jian -犍jian -毽jian -腱jian -睑jian -锏jian -鹣jian -裥jian -笕jian -翦jian -趼jian -踺jian -鲣jian -鞯jian -吉安jian -煎熬jianao -简报jianbao -渐变jianbian -简便jianbian -简编jianbian -鉴别jianbie -兼并jianbing -尖兵jianbing -剪裁jiancai -剪彩jiancai -检测jiance -检查jiancha -检察jiancha -监察jiancha -减产jianchan -建成jiancheng -简称jiancheng -坚持jianchi -简单jiandan -建党jiandang -减低jiandi -检点jiandian -间谍jiandie -坚定jianding -鉴定jianding -监督jiandu -间断jianduan -尖端jianduan -简短jianduan -舰队jiandui -健儿jianer -减法jianfa -肩负jianfu -将jiang -降jiang -讲jiang -强*jiang -江jiang -浆jiang -蒋jiang -奖jiang -疆jiang -僵jiang -姜jiang -桨jiang -匠jiang -酱jiang -茳jiang -洚jiang -绛jiang -缰jiang -犟jiang -礓jiang -耩jiang -糨jiang -豇jiang -奖杯jiangbei -疆场jiangchang -奖惩jiangcheng -僵持jiangchi -降低jiangdi -间隔jiange -讲稿jianggao -江湖jianghu -僵化jianghua -讲话jianghua -降级jiangji -降价jiangjia -讲解jiangjie -疆界jiangjie -将近jiangjin -奖金jiangjin -讲究jiangjiu -僵局jiangju -将军jiangjun -讲课jiangke -将来jianglai -讲理jiangli -奖励jiangli -降临jianglin -将领jiangling -降落jiangluo -江南jiangnan -奖品jiangpin -讲评jiangping -奖券jiangquan -江山jiangshan -讲师jiangshi -僵尸jiangshi -讲授jiangshou -讲述jiangshu -降水jiangshui -江苏jiangsu -讲台jiangtai -讲坛jiangtan -疆土jiangtu -坚固jiangu -兼顾jiangu -监管jianguan -建国jianguo -降温jiangwen -江西jiangxi -讲习jiangxi -匠心jiangxin -讲学jiangxue -讲演jiangyan -将要jiangyao -讲义jiangyi -僵硬jiangying -奖章jiangzhang -讲座jiangzuo -监护jianhu -简化jianhua -间或jianhuo -奸计jianji -歼击jianji -剪辑jianji -减价jianjia -渐渐jianjian -健将jianjiang -建交jianjiao -间接jianjie -见解jianjie -简介jianjie -简洁jianjie -简捷jianjie -渐进jianjin -监禁jianjin -检举jianju -艰巨jianju -坚决jianjue -健康jiankang -尖刻jianke -坚苦jianku -艰苦jianku -监牢jianlao -建立jianli -尖利jianli -简历jianli -简练jianlian -简陋jianlou -简略jianlue -健美jianmei -减免jianmian -歼灭jianmie -简明jianming -缄默jianmo -艰难jiannan -键盘jianpan -简拼jianpin -简朴jianpu -俭朴jianpu -坚强jianqiang -减轻jianqing -健全jianquan -兼任jianren -坚韧jianren -兼容jianrong -尖锐jianrui -减弱jianruo -艰涩jianse -鉴赏jianshang -减少jianshao -建设jianshe -艰深jianshen -见识jianshi -坚实jianshi -监视jianshi -建树jianshu -减速jiansu -检索jiansuo -践踏jianta -健谈jiantan -检讨jiantao -简体jianti -舰艇jianting -减退jiantui -健忘jianwang -间文jianwen -见闻jianwen -间隙jianxi -奸细jianxi -艰险jianxian -见效jianxiao -间歇jianxie -简写jianxie -坚信jianxin -艰辛jianxin -减刑jianxing -检修jianxiu -简讯jianxun -检验jianyan -简要jianyao -建议jianyi -坚毅jianyi -简易jianyi -奸淫jianyin -坚硬jianying -剪影jianying -鉴于jianyu -监狱jianyu -减员jianyuan -检阅jianyue -建造jianzao -简则jianze -坚贞jianzhen -监制jianzhi -简直jianzhi -兼职jianzhi -建筑jianzhu -简装jianzhuang -健壮jianzhuang -较jiao -教jiao -交jiao -角jiao -叫jiao -脚jiao -胶jiao -浇jiao -焦jiao -觉*jiao -校*jiao -搅jiao -酵jiao -郊jiao -铰jiao -窖jiao -椒jiao -礁jiao -骄jiao -娇jiao -嚼jiao -矫jiao -侥jiao -狡jiao -饺jiao -缴jiao -绞jiao -剿jiao -轿jiao -佼jiao -僬jiao -艽jiao -茭jiao -挢jiao -噍jiao -峤jiao -徼jiao -湫*jiao -姣jiao -敫jiao -皎jiao -鹪jiao -蛟jiao -醮jiao -跤jiao -鲛jiao -骄傲jiaoao -搅拌jiaoban -狡辩jiaobian -教材jiaocai -交叉jiaocha -教程jiaocheng -交错jiaocuo -较大jiaoda -交代jiaodai -交淡jiaodan -教导jiaodao -交点jiaodian -焦点jiaodian -校订jiaoding -角度jiaodu -校对jiaodui -较多jiaoduo -焦耳jiaoer -交锋jiaofeng -交付jiaofu -浇灌jiaoguan -娇贵jiaogui -叫喊jiaohan -较好jiaohao -叫好jiaohao -狡猾jiaohua -交换jiaohuan -叫唤jiaohuan -教诲jiaohui -缴获jiaohuo -交际jiaoji -矫健jiaojian -交接jiaojie -交界jiaojie -叫苦jiaoku -较快jiaokuai -教练jiaolian -较量jiaoliang -交流jiaoliu -搅乱jiaoluan -角落jiaoluo -叫骂jiaoma -剿灭jiaomie -酵母jiaomu -交纳jiaona -缴纳jiaona -娇嫩jiaonen -交配jiaopei -骄气jiaoqi -交情jiaoqing -郊区jiaoqu -叫嚷jiaorang -角色jiaose -交涉jiaoshe -教师jiaoshi -教授jiaoshou -教唆jiaosuo -脚踏jiaota -交谈jiaotan -教堂jiaotang -交替jiaoti -教条jiaotiao -交通jiaotong -郊外jiaowai -交往jiaowang -较为jiaowei -狡黠jiaoxia -叫嚣jiaoxiao -侥幸jiaoxing -绞刑jiaoxing -教学jiaoxue -教训jiaoxun -教养jiaoyang -骄阳jiaoyang -教益jiaoyi -交易jiaoyi -交谊jiaoyi -教育jiaoyu -教员jiaoyuan -狡诈jiaozha -校正jiaozheng -脚注jiaozhu -角逐jiaozhu -浇铸jiaozhu -校准jiaozhun -焦灼jiaozhuo -娇纵jiaozong -叫做jiaozuo -家谱jiapu -假期jiaqi -价钱jiaqian -加强jiaqiang -假日jiari -加入jiaru -假如jiaru -假若jiaruo -加上jiashang -假设jiashe -加深jiashen -假使jiashi -架势jiashi -驾驶jiashi -家属jiashu -假说jiashuo -加速jiasu -枷锁jiasuo -家庭jiating -家乡jiaxiang -假想jiaxiang -家业jiaye -加以jiayi -佳音jiayin -家用jiayong -加油jiayou -家园jiayuan -夹杂jiaza -加载jiazai -家长jiazhang -价值jiazhi -加重jiazhong -假装jiazhuang -嫁妆jiazhuang -架子jiazi -家族jiazu -击败jibai -羁绊jiban -几倍jibei -基本jiben -击毙jibi -级别jibie -疾病jibing -计策jice -基层jiceng -稽查jicha -机场jichang -集成jicheng -继承jicheng -计酬jichou -基础jichu -机床jichuang -几次jici -急促jicu -积存jicun -寄存jicun -极大jida -亟待jidai -激荡jidang -记得jide -基地jidi -机电jidian -极点jidian -基调jidiao -机动jidong -激动jidong -极度jidu -几度jidu -即度jidu -季度jidu -基督jidu -嫉妒jidu -忌妒jidu -极端jiduan -结jie -阶jie -解jie -接jie -节jie -家*jie -界jie -截jie -介jie -借jie -价*jie -届jie -街jie -揭jie -洁jie -杰jie -竭jie -皆jie -秸jie -劫jie -桔jie -捷jie -睫jie -姐jie -戒jie -藉jie -芥jie -疥jie -诫jie -楷*jie -偈*jie -讦jie -诘*jie -拮jie -喈jie -嗟jie -婕jie -孑jie -桀jie -碣jie -疖jie -颉jie -蚧jie -羯jie -鲒jie -骱jie -饥饿jie -结案jiean -洁白jiebai -接班jieban -捷报jiebao -戒备jiebei -结彩jiecai -节操jiecao -阶层jieceng -劫持jiechi -杰出jiechu -解除jiechu -接触jiechu -戒除jiechu -揭穿jiechuan -结存jiecun -解答jieda -接待jiedai -借贷jiedai -街道jiedao -解冻jiedong -阶段jieduan -截断jieduan -揭发jiefa -借方jiefang -解放jiefang -街坊jiefang -结构jiegou -解雇jiegu -借故jiegu -结果jieguo -结合jiehe -结核jiehe -结婚jiehun -阶级jieji -接见jiejian -节俭jiejian -借鉴jiejian -结交jiejiao -姐姐jiejie -接近jiejin -竭尽jiejin -结晶jiejing -捷径jiejing -洁净jiejing -解救jiejiu -结局jieju -解决jiejue -孑孓jiejue -解开jiekai -揭开jiekai -解渴jieke -接口jiekou -借口jiekou -借款jiekuan -竭力jieli -接连jielian -揭露jielu -戒律jielu -结论jielun -解闷jiemen -结盟jiemeng -界面jiemian -节目jiemu -揭幕jiemu -接纳jiena -解聘jiepin -解剖jiepou -节气jieqi -接洽jieqia -截取jiequ -既而jier -节日jieri -介入jieru -解散jiesan -介绍jieshao -节省jiesheng -届时jieshi -结实jieshi -解释jieshi -揭示jieshi -解手jieshou -接受jieshou -接收jieshou -结束jieshu -解说jieshuo -结算jiesuan -解体jieti -阶梯jieti -接替jieti -接头jietou -街头jietou -解脱jietuo -结尾jiewei -解围jiewei -接吻jiewen -解析jiexi -界线jiexian -界限jiexian -揭晓jiexiao -戒严jieyan -结业jieye -介意jieyi -接应jieying -结余jieyu -节约jieyue -结帐jiezhang -接着jiezhao -节制jiezhi -介质jiezhi -戒指jiezhi -借支jiezhi -截止jiezhi -借助jiezhu -节奏jiezou -杰作jiezuo -激发jifa -技法jifa -讥讽jifeng -几个jige -及格jige -技工jigong -记功jigong -机构jigou -叽咕jigu -机关jiguan -籍贯jiguan -极光jiguang -激光jiguang -记过jiguo -极好jihao -记号jihao -集合jihe -几何jihe -稽核jihe -几乎jihu -激化jihua -计划jihua -饥荒jihuang -机会jihui -集会jihui -击毁jihui -忌讳jihui -积极jiji -机件jijian -计件jijian -急件jijian -击剑jijian -即将jijiang -计较jijiao -季节jijie -急进jijin -基金jijin -机警jijing -即景jijing -寂静jijing -急救jijiu -积聚jiju -急剧jiju -急遽jiju -寄居jiju -季刊jikan -即刻jike -疾苦jiku -击溃jikui -积累jilei -极力jili -吉利jili -激励jili -伎俩jilia -计量jiliang -寂寥jiliao -激烈jilie -吉林jilin -机灵jiling -激流jiliu -记录jilu -纪律jilu -纪录jilu -辑录jilu -击落jiluo -急忙jimang -机密jimi -寂寞jimo -计谋jimou -进jin -金jin -近jin -紧jin -斤jin -今jin -尽jin -仅jin -劲jin -浸jin -禁jin -津jin -筋jin -锦jin -晋jin -巾jin -襟jin -谨jin -靳jin -烬jin -卺jin -荩jin -堇jin -噤jin -馑jin -廑jin -妗jin -缙jin -瑾jin -槿jin -赆jin -觐jin -衿jin -缉拿jina -济南jinan -禁闭jinbi -锦标jinbiao -进步jinbu -浸沉jinchen -进程jincheng -进出jinchu -紧凑jincou -近代jindai -劲敌jindi -进度jindu -金额jine -机能jineng -技能jineng -进而jiner -进犯jinfan -经jing -精jing -京jing -径jing -井jing -静jing -竟jing -晶jing -净jing -境jing -镜jing -景jing -警jing -劲*jing -茎jing -敬jing -惊jing -睛jing -竞jing -荆jing -兢jing -鲸jing -粳jing -痉jing -靖jing -刭jing -儆jing -阱jing -菁jing -獍jing -憬jing -泾jing -迳jing -弪jing -婧jing -肼jing -胫jing -腈jing -旌jing -靓*jing -敬爱jingai -警报jingbao -警备jingbei -精兵jingbing -精采jingcai -精彩jingcai -警察jingcha -经常jingchang -精粹jingcui -静电jingdian -经典jingdian -惊动jingdong -精度jingdu -经费jingfei -精干jinggan -竟敢jinggan -警告jinggao -经过jingguo -净化jinghua -精华jinghua -经济jingji -竞技jingji -荆棘jingji -精简jingjian -境界jingjie -警戒jingjie -经久jingjiu -惊恐jingkong -经理jingli -经历jingli -精力jingli -敬礼jingli -精练jinglian -精良jingliang -经络jingluo -精美jingmei -精密jingmi -精明jingming -进攻jingong -敬佩jingpei -精辟jingpi -景气jingqi -惊奇jingqi -精巧jingqiao -精确jingque -竟然jingran -竞赛jingsai -景色jingse -经商jingshang -精神jingshen -经手jingshou -经受jingshou -精髓jingsui -静态jingtai -惊叹jingtan -晶体jingti -警惕jingti -精通jingtong -镜头jingtou -筋骨jingu -禁锢jingu -尽管jinguan -巾帼jinguo -经委jingwei -警卫jingwei -敬畏jingwei -景物jingwu -精细jingxi -京戏jingxi -惊险jingxian -景象jingxiang -经销jingxiao -经心jingxin -精心jingxin -惊心jingxin -惊醒jingxing -竞选jingxuan -惊讶jingya -经验jingyan -敬仰jingyang -经营jingying -晶莹jingying -经由jingyou -境遇jingyu -精湛jingzhan -竞争jingzheng -精制jingzhi -径直jingzhi -精致jingzhi -静止jingzhi -净值jingzhi -竟址jingzhi -净重jingzhong -镜子jingzi -静坐jingzuo -近海jinhai -今后jinhou -近乎jinhu -进化jinhua -几年jinian -记念jinian -纪念jinian -晋级jinji -紧急jinji -近郊jinjiao -紧紧jinjin -仅仅jinjin -进军jinjun -进口jinkou -尽快jinkuai -近况jinkuang -进来jinlai -近来jinlai -尽力jinli -尽量jinliang -斤两jinliang -禁令jinling -劲旅jinlu -紧密jinmi -近年jinnian -今年jinnian -金牌jinpai -紧迫jinpo -近期jinqi -近前jinqian -金钱jinqian -尽情jinqing -进去jinqu -进取jinqu -禁区jinqu -近日jinri -今日jinri -金融jinrong -进入jinru -浸入jinru -谨慎jinshen -晋升jinsheng -今是jinshi -尽是jinshi -近视jinshi -金属jinshu -近似jinsi -紧缩jinsuo -今天jintian -津贴jintie -尽头jintou -劲头jintou -浸透jintou -进退jintui -今晚jinwan -今昔jinxi -尽心jinxin -进行jinxing -进修jinxiu -锦秀jinxiu -谨严jinyan -紧要jinyao -进展jinzhan -紧张jinzhang -今朝jinzhao -紧着jinzhe -禁止jinzhi -尽职jinzhi -进驻jinzhu -金子jinzi -炯jiong -窘jiong -迥jiong -炅*jiong -扃jiong -窘迫jiongpo -迥然jiongran -击破jipo -急迫jipo -及其jiqi -极其jiqi -激起jiqi -机器jiqi -机枪jiqiang -技巧jiqiao -急切jiqie -激情jiqing -汲取jiqu -集权jiquan -既然jiran -己任jiren -继任jiren -即日jiri -吉日jiri -肌肉jirou -极少jishao -寄生jisheng -即是jishi -及时jishi -几时jishi -计时jishi -即时jishi -即使jishi -记事jishi -基石jishi -集市jishi -级数jishu -基数jishu -计数jishu -记述jishu -技术jishu -祭祀jisi -激素jisu -急速jisu -计算jisuan -机体jiti -集体jiti -肌体jiti -几天jitian -集团jituan -寄托jituo -就jiu -九jiu -旧jiu -究jiu -久jiu -救jiu -酒jiu -纠jiu -揪jiu -玖jiu -韭jiu -灸jiu -厩jiu -臼jiu -舅jiu -咎jiu -疚jiu -僦jiu -啾jiu -阄jiu -柩jiu -桕jiu -鸠jiu -鹫jiu -赳jiu -鬏jiu -就餐jiucan -纠察jiucha -纠缠jiuchan -就此jiuci -就地jiudi -就范jiufan -纠纷jiufen -纠葛jiuge -救国jiuguo -救护jiuhu -救火jiuhuo -纠集jiuji -鸠集jiuji -救济jiuji -救急jiuji -九江jiujiang -九届jiujie -就近jiujin -酒精jiujing -究竟jiujing -救命jiuming -救生jiusheng -就是jiushi -就事jiushi -救亡jiuwang -久违jiuwei -酒窝jiuwo -酒席jiuxi -救险jiuxian -揪心jiuxin -救星jiuxing -就绪jiuxu -就学jiuxue -久仰jiuyang -就要jiuyao -就业jiuye -久远jiuyuan -九月jiuyue -救灾jiuzai -纠正jiuzheng -就职jiuzhi -救治jiuzhi -九洲jiuzhou -救助jiuzhu -极为jiwei -纪委jiwei -极限jixian -迹象jixiang -吉祥jixiang -讥笑jixiao -机械jixie -记性jixing -急性jixing -畸形jixing -即兴jixing -吉凶jixiong -几许jixu -积蓄jixu -继续jixu -记叙jixu -急需jixu -集训jixun -积压jiya -羁押jiya -给养jiyang -机要jiyao -纪要jiyao -给以jiyi -记忆jiyi -技艺jiyi -基因jiyin -急用jiyong -基于jiyu -急于jiyu -机遇jiyu -给予jiyu -寄予jiyu -觊觎jiyu -纪元jiyuan -集约jiyue -记载jizai -及早jizao -急躁jizao -激增jizeng -记帐jizhang -记者jizhe -集镇jizhen -机制jizhi -及至jizhi -机智jizhi -集中jizhong -击中jizhong -记住jizhu -基准jizhun -集资jizi -经济核算jjhs -聚精会神jjhs -将计就计jjjj -戒骄戒躁jjjz -近几年来jjnl -竭尽全力jjql -节假日jjr -积极性jjx -经济效益jjxy -兢兢业业jjyy -精简整编jjzb -叽叽喳喳jjzz -艰苦奋斗jkfd -尽可能jkn -教科书jks -俱乐部jlb -交流电jld -吉林省jls -价廉物美jlwm -纪律性jlx -纪念碑jnb -几年来jnl -近年来jnl -纪念品jnp -济南市jns -吉普车jpc -坚强不屈jqbq -奖勤罚懒jqfl -机器人jqr -急起直追jqzz -截然不同jrbt -兼容性jrx -积少成多jscd -金山公司jsgs -集思广益jsgy -精神焕发jshf -计算机jsj -尽善尽美jsjm -集市贸易jsmy -介绍人jsr -就是说jss -计算所jss -江苏省jss -举世闻名jswm -介绍信jsx -技术员jsy -计算中心jszx -交通部jtb -家庭出身jtcs -惊天动地jtdd -具体地说jtds -晶体管jtg -交通工具jtgj -脚踏实地jtsd -具体说来jtsl -具ju -据ju -局ju -举ju -车*ju -句ju -聚ju -距ju -巨ju -居ju -锯ju -剧ju -矩ju -拒ju -柜*ju -桔*ju -鞠ju -拘ju -狙ju -疽ju -驹ju -菊ju -咀ju -沮ju -踞ju -俱ju -惧ju -炬ju -倨ju -讵ju -苣ju -苴ju -莒ju -掬ju -遽ju -屦ju -琚ju -枸*ju -椐ju -榘ju -榉ju -橘ju -犋ju -飓ju -钜ju -锔ju -窭ju -裾ju -趄ju -醵ju -踽ju -龃ju -雎ju -瞿*ju -鞫ju -卷juan -捐juan -鹃juan -娟juan -倦juan -眷juan -绢juan -俊*juan -鄄juan -狷juan -涓juan -桊juan -蠲juan -锩juan -镌juan -隽juan -卷进juanjin -捐款juankuan -眷恋juanlian -眷念juannian -捐躯juanqu -卷入juanru -眷属juanshu -捐献juanxian -卷烟juanyan -卷帙juanzhi -捐助juanzhu -卷宗juanzong -举办juban -具备jubei -剧本juben -巨变jubian -局部jubu -拘捕jubu -剧场juchang -据此juci -巨大juda -举动judong -居多juduo -决jue -觉jue -绝jue -角*jue -脚*jue -掘jue -嚼*jue -撅jue -攫jue -抉jue -倔jue -爵jue -诀jue -厥jue -劂jue -谲jue -矍jue -蕨jue -嗟*jue -噘jue -噱jue -崛jue -獗jue -孓jue -珏jue -桷jue -橛jue -爝jue -镢jue -蹶jue -觖jue -巨额jue -诀别juebie -决不juebu -绝不juebu -决策juece -觉察juecha -觉得juede -决定jueding -决断jueduan -绝对juedui -绝迹jueji -倔强juejiang -绝交juejiao -绝径juejing -绝境juejing -绝句jueju -决裂juelie -绝路juelu -绝密juemi -绝妙juemiao -崛起jueqi -诀窍jueqiao -决赛juesai -绝食jueshi -决死juesi -决算juesuan -绝望juewang -爵位juewei -觉悟juewu -决心juexin -觉醒juexing -决议jueyi -绝缘jueyuan -抉择jueze -决战juezhan -绝招juezhao -绝症juezheng -巨幅jufu -居功jugong -鞠躬jugong -句号juhao -聚合juhe -聚会juhui -聚集juji -巨匠jujiang -拘谨jujin -拒绝jujue -咀嚼jujue -距离juli -举例juli -剧烈julie -拘留juliu -局面jumian -居民jumin -剧目jumu -军jun -均jun -菌jun -君jun -龟*jun -钧jun -峻jun -俊jun -竣jun -浚jun -郡jun -骏jun -捃jun -皲jun -筠jun -麇jun -军操juncao -君臣junchen -均等jundeng -军队jundui -军法junfa -军阀junfa -军服junfu -军港jungang -军工jungong -竣工jungong -均衡junheng -军火junhuo -拘泥juni -军机junji -军纪junji -军舰junjian -俊杰junjie -军垦junken -军粮junliang -军令junling -骏马junma -军民junmin -军旗junqi -峻峭junqiao -俊俏junqiao -军区junqu -军权junquan -军人junren -军事junshi -军师junshi -军属junshu -军团juntuan -军委junwei -军衔junxian -军校junxiao -军械junxie -军心junxin -俊秀junxiu -军需junxu -军训junxun -军医junyi -军营junying -军用junyong -军邮junyou -均匀junyun -军长junzhang -军政junzheng -君主junzhu -军装junzhuang -君子junzi -俱全juquan -居然juran -遽然juran -沮丧jusang -局势jushi -举手jushou -拘束jushu -据说jushuo -具体juti -剧团jutuan -据悉juxi -局限juxian -居心juxin -举行juxing -矩形juxing -巨型juxing -具有juyou -据有juyou -剧院juyuan -局长juzhang -剧照juzhao -举止juzhi -居中juzhong -剧终juzhong -巨著juzhu -居住juzhu -句子juzi -节外生枝jwsz -惊心动魄jxdp -继续革命jxgm -机械化jxh -江西省jxs -谨小慎微jxsw -局限性jxx -教育部jyb -进一步jyb -家用电器jydq -教育方针jyfz -家喻户晓jyhx -加以解决jyjj -记忆力jyl -精益求精jyqj -教研室jys -见义勇为jyyw -旧中国jzg -建筑物jzw -可k -开k -看k -克k -孔k -科k -口k -空k -苦k -快k -考k -刻k -靠k -况k -块k -困k -宽k -矿k -抗k -卡k -卡ka -喀ka -咖ka -咯ka -佧ka -咔ka -胩ka -喀嚓kacha -卡车kache -咖啡kafei -开kai -凯kai -揩kai -楷kai -慨kai -剀kai -垲kai -蒈kai -忾kai -恺kai -铠kai -锎kai -锴kai -开办kaiban -开遍kaibian -开采kaicai -开场kaichang -开车kaiche -开除kaichu -开创kaichuang -开导kaidao -开刀kaidao -开动kaidong -开端kaiduan -开发kaifa -开放kaifang -开封kaifeng -开赴kaifu -凯歌kaige -开关kaiguan -开航kaihang -开户kaihu -开花kaihua -开怀kaihuai -开荒kaihuang -开会kaihui -开掘kaijue -开垦kaiken -开口kaikou -开矿kaikuang -开阔kaikuo -开朗kailang -开郎kailang -开路kailu -开明kaiming -楷模kaimo -开幕kaimu -开炮kaipao -开辟kaipi -开启kaiqi -开枪kaiqiang -开窍kaiqiao -开设kaishe -开始kaishi -开庭kaiting -开头kaitou -开脱kaituo -开拓kaituo -开外kaiwai -开销kaixiao -开心kaixin -凯旋kaixuan -开学kaixue -开颜kaiyan -开业kaiye -开战kaizhan -开展kaizhan -开张kaizhang -开支kaizhi -看kan -刊kan -坎kan -槛*kan -堪kan -勘kan -砍kan -嵌*kan -侃kan -莰kan -阚*kan -戡kan -龛kan -瞰kan -勘测kance -勘察kancha -看出kanchu -看待kandai -看到kandao -刊登kandeng -看法kanfa -砍伐kanfa -抗kang -康kang -炕kang -慷kang -糠kang -扛kang -亢kang -伉kang -闶kang -钪kang -亢奋kangfen -康复kangfu -抗衡kangheng -抗击kangji -亢进kangjin -抗拒kangju -伉俪kangli -抗日kangri -看管kanguan -抗议kangyi -看见kanjian -坎坷kanke -看来kanlai -看齐kanqi -刊头kantou -看望kanwang -刊物kanwu -勘误kanwu -看样kanyang -刊载kanzai -考kao -靠kao -拷kao -烤kao -尻kao -栲kao -犒kao -铐kao -拷贝kaobei -靠边kaobian -考查kaocha -考察kaocha -考核kaohe -靠近kaojin -考究kaojiu -靠拢kaolong -考虑kaolu -考勤kaoqin -靠山kaoshan -考试kaoshi -考题kaoti -考验kaoyan -考证kaozheng -卡片kapian -看不惯kbg -看不起kbq -刻不容缓kbrh -开诚布公kcbg -矿产资源kczy -扩大化kdh -可ke -克ke -科ke -刻ke -客ke -壳ke -颗ke -棵ke -柯ke -呵*ke -坷ke -苛ke -磕ke -咳ke -渴ke -课ke -嗑ke -岢ke -恪ke -溘ke -骒ke -缂ke -珂ke -轲ke -氪ke -瞌ke -钶ke -锞ke -稞ke -疴ke -窠ke -颏ke -蝌ke -髁ke -可爱keai -科班keban -课本keben -可比kebi -刻薄kebo -可不kebu -客车keche -课程kecheng -可耻kechi -可恶kee -可风kefeng -可否kefou -克服kefu -可观keguan -客观keguan -可贵kegui -可好kehao -可恨kehen -刻划kehua -刻画kehua -克己keji -客机keji -科技keji -可见kejian -科教kejiao -可敬kejing -窠臼kejiu -科举keju -可靠kekao -苛刻keke -可口kekou -克扣kekou -刻苦keku -克拉kela -克朗kelang -颗粒keli -可怜kelian -科目kemu -肯ken -啃ken -垦ken -恳ken -裉ken -肯定kending -可能keneng -坑keng -吭keng -铿keng -坑道kengdao -坑害kenghai -铿锵kengqiang -恳切kenqie -恳求kenqiu -垦殖kenzhi -可怕kepa -磕碰kepeng -科普kepu -客气keqi -可亲keqin -可取kequ -客人keren -客商keshang -可是keshi -科室keshi -课堂ketang -客套ketao -课题keti -客体keti -客厅keting -磕头ketou -可望kewang -渴望kewang -可喜kexi -可惜kexi -可行kexing -科学kexue -科研keyan -可以keyi -可疑keyi -刻意keyi -科员keyuan -科长kezhang -可知kezhi -克制kezhi -狂风暴雨kfby -克己奉公kjfg -科技司kjs -苦口婆心kkpx -昆明市kms -可能性knx -孔kong -空kong -控kong -恐kong -倥kong -崆kong -箜kong -空白kongbai -恐怖kongbu -控拆kongchai -空洞kongdong -空额konge -空乏kongfa -控告konggao -空喊konghan -恐吓konghe -空话konghua -恐慌konghuang -空间kongjian -空降kongjiang -恐惧kongju -空军kongjun -空旷kongkuang -恐龙konglong -空虑konglu -恐怕kongpa -空气kongqi -空前kongqian -孔雀kongque -控诉kongsu -空谈kongtan -空头kongtou -空文kongwen -空隙kongxi -空闲kongxian -空想kongxiang -空虚kongxu -空运kongyun -控制kongzhi -空中kongzhong -口kou -扣kou -抠kou -寇kou -芤kou -蔻kou -叩kou -眍kou -筘kou -口岸kouan -叩拜koubai -口才koucai -扣除kouchu -口传kouchuan -口服koufu -口供kougong -口号kouhao -口红kouhong -口角koujiao -口径koujing -口诀koujue -口令kouling -扣留kouliu -口气kouqi -口腔kouqiang -口哨koushao -口试koushi -口述koushu -口头koutou -叩头koutou -口信kouxin -扣押kouya -口语kouyu -看起来kql -口若悬河krxh -口是心非ksxf -苦ku -库ku -枯ku -酷ku -哭ku -窟ku -裤ku -刳ku -堀ku -喾ku -绔ku -骷ku -跨kua -夸kua -垮kua -挎kua -胯kua -侉kua -跨步kuabu -夸大kuada -跨度kuadu -会*kuai -快kuai -块kuai -筷kuai -侩kuai -蒯kuai -郐kuai -哙kuai -狯kuai -浍*kuai -脍kuai -会计kuaiji -快乐kuaile -快速kuaisu -宽kuan -款kuan -髋kuan -宽敞kuanchang -宽绰kuanchuo -宽大kuanda -宽待kuandai -款待kuandai -宽度kuandu -况kuang -矿kuang -狂kuang -框kuang -匡kuang -筐kuang -眶kuang -旷kuang -诓kuang -诳kuang -邝kuang -圹kuang -夼kuang -哐kuang -纩kuang -贶kuang -矿藏kuangcang -矿产kuangchan -狂风kuangfeng -矿工kuanggong -旷工kuanggong -矿井kuangjing -框框kuangkuang -哐啷kuanglang -况且kuangqie -矿区kuangqu -矿泉kuangquan -狂热kuangre -矿山kuangshan -矿石kuangshi -框图kuangtu -宽广kuanguang -狂妄kuangwang -矿物kuangwu -旷野kuangye -宽宏kuanhong -宽厚kuanhou -宽阔kuankuo -宽容kuanrong -款式kuanshi -宽恕kuanshu -款项kuanxiang -宽心kuanxin -宽裕kuanyu -垮台kuatai -跨越kuayue -夸张kuazhang -裤衩kucha -库存kucun -哭喊kuhan -奎kui -溃kui -馈kui -亏kui -盔kui -岿kui -窥kui -葵kui -魁kui -傀kui -愧kui -馗kui -匮kui -夔kui -隗kui -蒉kui -揆kui -喹kui -喟kui -悝kui -愦kui -逵kui -暌kui -睽kui -聩kui -蝰kui -篑kui -跬kui -亏本kuiben -窥测kuice -亏待kuidai -愧疚kuijiu -亏空kuikong -亏损kuisun -魁梧kuiwu -溃疡kuiyang -枯竭kujie -库仑kulun -苦闷kumen -枯木kumu -困kun -昆kun -坤kun -捆kun -悃kun -阃kun -琨kun -锟kun -醌kun -鲲kun -髡kun -苦难kunan -苦恼kunao -困厄kune -困乏kunfa -困惑kunhuo -困境kunjing -困苦kunku -昆明kunming -困难kunnan -扩kuo -括kuo -适*kuo -阔kuo -廓kuo -栝*kuo -蛞kuo -阔别kuobie -扩充kuochong -阔绰kuochuo -扩大kuoda -括号kuohao -扩建kuojian -阔气kuoqi -扩展kuozhan -扩张kuozhang -哭泣kuqi -酷暑kushu -苦头kutou -苦维kuwei -枯萎kuwei -酷刑kuxing -苦于kuyu -枯燥kuzao -可想而知kxez -科学家kxj -科学技术kxjs -可行性kxx -科学院kxy -科研部kyb -开源节流kyjl -看样子kyz -了l -来l -量l -理l -路l -里l -论l -两l -利l -领l -流l -力l -立l -料l -连l -老l -六l -轮l -类l -列l -拉la -落*la -啦la -蜡la -腊la -蓝la -垃la -喇la -辣la -剌la -邋la -旯la -砬la -瘌la -喇叭laba -来lai -赖lai -莱lai -崃lai -徕lai -涞lai -濑lai -赉lai -睐lai -铼lai -癞lai -籁lai -来宾laibin -来到laidao -来犯laifan -来访laifang -来函laihan -来回laihui -来历laili -来临lailin -赖皮laipi -来日lairi -来势laishi -来头laitou -来往laiwang -来信laixin -来源laiyuan -来者laizhe -来自laizi -癞子laizi -辣椒lajiao -拉拢lalong -喇嘛lama -腊梅lamei -兰lan -烂lan -蓝lan -览lan -栏lan -婪lan -拦lan -篮lan -阑lan -澜lan -谰lan -揽lan -懒lan -缆lan -滥lan -岚lan -漤lan -榄lan -斓lan -罱lan -镧lan -褴lan -蓝本lanben -懒怠landai -滥调landiao -懒惰landuo -浪lang -朗lang -郎lang -狼lang -琅lang -榔lang -廊lang -莨lang -蒗lang -啷lang -阆lang -锒lang -稂lang -螂lang -栏杆langan -狼狈langbei -浪潮langchao -浪荡langdang -朗读langdu -浪费langfei -狼藉langji -浪漫langman -朗诵langsong -郎中langzhong -兰花lanhua -拦截lanjie -烂漫lanman -懒散lansan -蓝色lanse -缆绳lansheng -烂熟lanshu -蓝天lantian -蓝图lantu -阑尾lanwei -拦腰lanyao -滥用lanyong -兰州lanzhou -老lao -劳lao -落*lao -牢lao -涝lao -捞lao -络*lao -佬lao -姥lao -酪lao -烙lao -潦*lao -唠lao -崂lao -栳lao -铑lao -铹lao -痨lao -耢lao -醪lao -老板laoban -老伴laoban -老本laoben -劳动laodong -牢固laogu -老汉laohan -老化laohua -牢记laoji -劳驾laojia -牢靠laokao -劳苦laoku -牢牢laolao -劳累laolei -劳力laoli -老练laolian -牢笼laolong -劳模laomo -老年laonian -老人laoren -牢骚laosao -老少laoshao -老是laoshi -老实laoshi -老师laoshi -老乡laoxiang -老爷laoye -烙印laoyin -劳支laozhi -劳资laozi -劳作laozuo -腊月layue -狼狈不堪lbbk -力不从心lbcx -来不及lbj -来不了lbl -了不起lbq -劳动保险ldbx -来得及ldj -劳动量ldl -劳动力ldl -灵丹妙药ldmy -拉丁美洲ldmz -劳动者ldz -劳动致富ldzf -了le -乐le -勒le -肋le -仂le -叻le -泐le -鳓le -乐观leguan -类lei -雷lei -累lei -勒*lei -垒lei -泪lei -镭lei -蕾lei -磊lei -儡lei -擂lei -肋lei -羸lei -诔lei -嘞lei -嫘lei -缧lei -檑lei -耒lei -酹lei -类别leibie -类次leici -雷达leida -雷管leiguan -泪痕leihen -泪花leihua -累积leiji -累计leiji -累进leijin -磊落leiluo -累年leinian -类似leisi -擂台leitai -雷同leitong -类推leitui -类型leixing -雷雨leiyu -累月leiyue -累赘leizhui -勒令leling -冷leng -棱leng -楞leng -塄leng -愣leng -冷藏lengcang -冷淡lengdan -冷宫lenggong -棱角lengjiao -冷静lengjing -冷落lengluo -冷门lengmen -冷漠lengmo -冷暖lengnuan -冷僻lengpi -冷气lengqi -冷却lengque -冷水lengshui -冷遇lengyu -乐趣lequ -勒索lesuo -乐意leyi -乐园leyuan -两个文明lgwm -拉关系lgx -联合国lhg -联合会lhh -两回事lhs -联合体lht -理li -里li -利li -力li -立li -离li -例li -历li -粒li -厘li -礼li -李li -隶li -黎li -璃li -励li -犁li -梨li -丽li -厉li -篱li -狸li -漓li -鲤li -莉li -荔li -吏li -栗li -砾li -傈li -俐li -痢li -沥li -哩li -鬲*li -俪li -俚li -郦li -坜li -苈li -莅li -蓠li -藜li -呖li -唳li -喱li -猁li -悝*li -溧li -澧li -逦li -娌li -嫠li -骊li -缡li -枥li -栎li -轹li -戾li -砺li -詈li -罹li -锂li -鹂li -疠li -疬li -蛎li -蜊li -蠡li -笠li -篥li -粝li -醴li -跞li -雳li -鲡li -鳢li -黧li -俩lia -连lian -联lian -练lian -炼lian -脸lian -链lian -莲lian -镰lian -廉lian -怜lian -涟lian -帘lian -敛lian -恋lian -蔹lian -奁lian -潋lian -濂lian -琏lian -楝lian -殓lian -臁lian -裢lian -裣lian -蠊lian -鲢lian -立案lian -恋爱lianai -联邦lianbang -练兵lianbing -联播lianbo -练达lianda -连队liandui -量liang -两liang -粮liang -良liang -亮liang -梁liang -凉liang -辆liang -粱liang -晾liang -谅liang -墚liang -莨*liang -椋liang -踉liang -靓liang -魉liang -炼钢liangang -两半liangban -量变liangbian -两边liangbian -两便liangbian -两侧liangce -两次liangci -两地liangdi -两点liangdian -量度liangdu -良方liangfang -两广liangguang -良好lianghao -两极liangji -良机liangji -谅解liangjie -量具liangju -凉快liangkuai -两立liangli -两面liangmian -练功liangong -两栖liangqi -两讫liangqi -两全liangquan -粮食liangshi -两手liangshou -凉爽liangshuang -亮堂liangtang -两条liangtiao -两头liangtou -连贯lianguan -联贯lianguan -亮相liangxiang -良心liangxin -两性liangxing -量刑liangxing -两样liangyang -粮油liangyou -良缘liangyuan -粮站liangzhan -两者liangzhe -两重liangzhong -良种liangzhong -量子liangzi -联合lianhe -联欢lianhuan -廉价lianjia -联结lianjie -连接lianjie -联接lianjie -廉洁lianjie -联军lianjun -连累lianlei -联络lianluo -连忙lianmang -联盟lianmeng -怜悯lianmin -连年liannian -脸谱lianpu -连日lianri -炼乳lianru -联赛liansai -脸色lianse -连锁liansuo -练武lianwu -联系lianxi -练习lianxi -怜惜lianxi -联想lianxiang -连续lianxu -涟漪lianyi -联姻lianyin -联营lianying -炼油lianyou -联运lianyun -连载lianzai -了*liao -料liao -疗liao -辽liao -僚liao -撩liao -聊liao -燎liao -寥liao -潦liao -撂liao -镣liao -廖liao -蓼liao -尥liao -嘹liao -獠liao -寮liao -缭liao -钌liao -鹩liao -撩拨liaobo -潦草liaocao -疗程liaocheng -料到liaodao -潦倒liaodao -料定liaoding -了结liaojie -了解liaojie -辽阔liaokuo -料理liaoli -寥寥liaoliao -寥落liaoluo -辽宁liaoning -了却liaoque -了事liaoshi -聊天liaotian -料想liaoxiang -疗养liaoyang -礼拜libai -利弊libi -里边libian -理财licai -理睬licai -立场lichang -里程licheng -历程licheng -立春lichun -历次lici -历代lidai -理当lidang -立冬lidong -列lie -裂lie -烈lie -劣lie -猎lie -冽lie -埒lie -捩lie -咧lie -洌lie -趔lie -躐lie -鬣lie -裂变liebian -列车lieche -列出liechu -列岛liedao -裂缝liefeng -列国lieguo -烈火liehuo -劣迹lieji -列举lieju -裂开liekai -裂口liekou -列宁liening -猎奇lieqi -列强lieqiang -猎取liequ -烈日lieri -列入lieru -劣绅lieshen -烈士lieshi -劣势lieshi -烈属lieshu -裂纹liewen -列席liexi -烈性liexing -立法lifa -立方lifang -礼服lifu -立功ligong -利害lihai -厉害lihai -理化lihua -礼花lihua -理会lihui -离婚lihun -立即liji -理解lijie -礼节lijie -历届lijie -力矩liju -离开likai -理科like -立刻like -理亏likui -历来lilai -历历lili -力量liliang -利率lilu -理论lilun -立论lilun -礼貌limao -里面limian -利民limin -黎民limin -黎明liming -林lin -磷lin -临lin -邻lin -淋lin -麟lin -琳lin -霖lin -鳞lin -凛lin -赁lin -吝lin -蔺lin -啉lin -嶙lin -廪lin -懔lin -遴lin -檩lin -辚lin -膦lin -瞵lin -粼lin -躏lin -淋巴linba -临别linbie -淋病linbing -林场linchang -临床linchuang -临到lindao -领ling -另ling -零ling -令ling -灵ling -岭ling -铃ling -龄ling -凌ling -棱*ling -陵ling -拎ling -玲ling -菱ling -伶ling -羚ling -酃ling -苓ling -呤ling -囹ling -泠ling -绫ling -柃ling -棂ling -瓴ling -聆ling -蛉ling -翎ling -鲮ling -令爱lingai -凌晨lingchen -灵丹lingdan -领导lingdao -领地lingdi -零点lingdian -领队lingdui -灵感linggan -领海linghai -领航linghang -领会linghui -灵魂linghun -灵活linghuo -灵机lingji -零件lingjian -领教lingjiao -灵杰lingjie -领空lingkong -凌空lingkong -玲珑linglong -零乱lingluan -凌乱lingluan -领略linglue -灵敏lingmin -陵墓lingmu -灵巧lingqiao -领取lingqu -令人lingren -凌辱lingru -零散lingsan -领事lingshi -领受lingshou -领司lingsi -零碎lingsui -灵堂lingtang -零头lingtou -领土lingtu -磷光linguang -另外lingwai -领悟lingwu -领先lingxian -领衔lingxian -零星lingxing -领袖lingxiu -另选lingxuan -灵验lingyan -领域lingyu -令尊lingzun -磷火linhuo -历年linian -临界linjie -临近linjin -邻近linjin -邻里linli -淋漓linli -凛冽linlie -临摹linmo -里弄linong -鳞伤linshang -临时linshi -临死linsi -吝惜linxi -临行linxing -林业linye -临战linzhan -临终linzhong -礼炮lipao -李鹏lipeng -礼品lipin -力气liqi -离奇liqi -力求liqiu -立秋liqiu -历任liren -例如liru -利润lirun -离散lisan -理事lishi -历史lishi -隶属lishu -礼堂litang -立体liti -例题liti -力图litu -流liu -六liu -留liu -刘liu -硫liu -柳liu -陆*liu -馏liu -瘤liu -溜liu -琉liu -榴liu -碌*liu -浏liu -遛liu -骝liu -绺liu -旒liu -熘liu -锍liu -镏liu -鹨liu -鎏liu -留步liubu -流产liuchan -流畅liuchang -流程liucheng -流传liuchuan -流窜liucuan -流动liudong -流毒liudu -流放liufang -六届liujie -浏览liulan -流利liuli -留恋liulian -流露liulu -流落liuluo -流氓liumang -留念liunian -流失liushi -流逝liushi -流体liuti -流通liutong -流亡liuwang -流泻liuxie -留心liuxin -流行liuxing -流星liuxing -留学liuxue -流血liuxue -流言liuyan -留言liuyan -留洋liuyang -留影liuying -留用liuyong -流域liuyu -六月liuyue -流转liuzhuan -例外liwai -礼物liwu -利息lixi -立夏lixia -理想lixiang -立新lixin -离心lixin -理性lixing -力行lixing -厉行lixing -离休lixiu -立意liyi -利益liyi -离异liyi -利用liyong -理由liyou -力争lizheng -立正lizheng -理智lizhi -立志lizhi -离职lizhi -例子lizi -粒子lizi -立足lizu -屡见不鲜ljbx -两极分化ljfh -逻辑设计ljsj -逻辑思维ljsw -逻辑性ljx -灵机一动ljyd -落落大方lldf -拦路虎llh -来龙去脉llqm -零零碎碎llss -来来往往llww -联绵不断lmbd -灵敏度lmd -辽宁省lns -列宁主义lnzy -龙long -垄long -弄*long -笼long -隆long -聋long -咙long -窿long -拢long -陇long -垅long -茏long -泷long -珑long -栊long -胧long -砻long -癃long -隆冬longdong -垄断longduan -隆隆longlong -笼络longluo -笼统longtong -笼罩longzhao -隆重longzhong -漏lou -露*lou -楼lou -娄lou -搂lou -篓lou -陋lou -偻lou -蒌lou -喽lou -嵝lou -镂lou -瘘lou -耧lou -蝼lou -髅lou -漏洞loudong -漏斗loudou -镂空loukong -漏网louwang -来日方长lrfc -来人来函lrlh -了如指掌lrzz -理所当然lsdr -连锁反应lsfy -领事馆lsg -理事会lsh -力所能及lsnj -拉萨市lss -流水线lsx -良师益友lsyy -路lu -六*lu -率lu -露lu -绿lu -炉lu -律lu -虑lu -滤lu -陆lu -氯lu -鲁lu -铝lu -录lu -旅lu -卢lu -吕lu -芦lu -颅lu -庐lu -掳lu -卤lu -虏lu -麓lu -碌lu -赂lu -鹿lu -潞lu -禄lu -戮lu -驴lu -侣lu -履lu -屡lu -缕lu -垆lu -蓼*lu -撸lu -噜lu -闾lu -泸lu -渌lu -漉lu -逯lu -璐lu -栌lu -榈lu -橹lu -轳lu -辂lu -辘lu -氇lu -胪lu -膂lu -镥lu -稆lu -鸬lu -鹭lu -褛lu -簏lu -舻lu -鲈lu -卵luan -乱luan -峦luan -挛luan -孪luan -滦luan -脔luan -娈luan -栾luan -鸾luan -銮luan -卵巢luanchao -乱伦luanlun -乱子luanzi -旅伴luban -路标lubiao -路程lucheng -旅程lucheng -露出luchu -屡次luci -陆地ludi -露底ludi -旅店ludian -略lue -掠lue -锊lue -掠夺lueduo -旅费lufei -露骨lugu -旅馆luguan -路过luguo -绿化luhua -炉火luhuo -路径lujing -路局luju -陆军lujun -旅客luke -履历luli -率领luling -鲁莽lumang -露面lumian -论lun -轮lun -伦lun -抡lun -仑lun -沦lun -纶lun -囵lun -论处lunchu -轮船lunchuan -论点lundian -论调lundiao -伦敦lundun -轮换lunhuan -论据lunju -轮廓lunkuo -论理lunli -伦理lunli -轮流lunliu -论述lunshu -轮胎luntai -论坛luntan -沦为lunwei -论文lunwen -沦陷lunxian -轮训lunxun -论战lunzhan -论正lunzheng -论证lunzheng -轮轴lunzhou -论著lunzhu -落luo -罗luo -螺luo -洛luo -络luo -逻luo -咯*luo -烙*luo -萝luo -锣luo -箩luo -骡luo -裸luo -骆luo -倮luo -蠃luo -荦luo -捋luo -摞luo -猡luo -泺luo -漯luo -珞luo -椤luo -脶luo -硌*luo -镙luo -瘰luo -雒luo -萝卜luobu -落成luocheng -螺钉luoding -罗汉luohan -落后luohou -落户luohu -逻辑luoji -落空luokong -落款luokuan -箩筐luokuang -罗列luolie -罗马luoma -螺母luomu -罗盘luopan -落泊luopo -落实luoshi -螺栓luoshuan -裸体luoti -骆驼luotuo -罗网luowang -螺纹luowen -落伍luowu -落选luoxuan -螺旋luoxuan -络绎luoyi -录取luqu -路人luren -绿色luse -庐山lushan -旅社lushe -律师lushi -露天lutian -路途lutu -旅途lutu -路线luxian -率先luxian -录像luxiang -旅行luxing -履行luxing -陆续luxu -录音luyin -绿荫luyin -录用luyong -旅游luyou -绿洲luzhou -露珠luzhu -路子luzi -炉子luzi -另行安排lxap -例行公事lxgs -联系人lxr -留学生lxs -另行通知lxtz -林业部lyb -老一辈lyb -另一方面lyfm -劳逸结合lyjh -利用率lyl -老一套lyt -留有余地lyyd -来者不拒lzbj -立足点lzd -老中青lzq -理直气壮lzqz -兰州市lzs -两重性lzx -面m -命m -们m -民m -毛m -没m -米m -明m -马m -么m -每m -门m -名m -磨m -美m -密m -苗m -满m -亩m -目m -呒m -马ma -么*ma -麻ma -吗ma -妈ma -骂ma -嘛ma -码ma -摩*ma -抹*ma -玛ma -蚂ma -唛ma -犸ma -嬷ma -杩ma -蟆ma -马鞍maan -麻痹mabi -马达mada -麻烦mafan -麻纺mafang -马虎mahu -麦mai -脉mai -卖mai -买mai -埋mai -迈mai -劢mai -荬mai -霾mai -买办maiban -脉搏maibo -迈步maibu -埋藏maicang -脉冲maichong -脉动maidong -埋伏maifu -卖国maiguo -脉络mailuo -买卖maimai -卖命maiming -埋没maimo -卖弄mainong -埋头maitou -卖淫maiyin -埋怨maiyuan -埋葬maizang -买帐maizhang -卖座maizuo -马力mali -麻利mali -马路malu -妈妈mama -麻木mamu -满man -慢man -曼man -漫man -蔓man -瞒man -馒man -蛮man -谩man -墁man -幔man -缦man -熳man -镘man -颟man -螨man -鳗man -鞔man -漫长manchang -忙mang -芒mang -盲mang -茫mang -氓mang -莽mang -邙mang -漭mang -硭mang -蟒mang -忙碌manglu -莽莽mangmang -盲目mangmu -茫然mangran -盲人mangren -忙于mangyu -莽原mangyuan -蛮横manheng -漫画manhua -满怀manhuai -谩骂manma -满目manmu -满腔manqiang -蔓延manyan -满意manyi -满载manzai -满足manzu -毛mao -矛mao -冒mao -貌mao -贸mao -帽mao -猫mao -茅mao -锚mao -铆mao -卯mao -茂mao -袤mao -茆mao -峁mao -泖mao -瑁mao -昴mao -牦mao -耄mao -旄mao -懋mao -瞀mao -蟊mao -髦mao -毛病maobing -毛糙maocao -冒充maochong -铆钉maoding -矛盾maodun -冒犯maofan -毛纺maofang -冒号maohao -冒尖maojian -冒进maojin -茅坑maokeng -毛利maoli -冒昧maomei -茂密maomi -冒牌maopai -毛坯maopi -贸然maoran -茂盛maosheng -冒失maoshi -矛头maotou -冒险maoxian -贸易maoyi -冒雨maoyu -毛重maozhong -帽子maozi -马上mashang -马桶matong -码头matou -马戏maxi -麻醉mazui -免不了mbl -明辨是非mbsf -满不在乎mbzh -默不作声mbzs -满城风雨mcfy -目的地mdd -目瞪口呆mdkd -描淡写mdx -么me -麽me -秘而不宣mebx -没mei -每mei -美mei -煤mei -霉mei -酶mei -梅mei -妹mei -眉mei -玫mei -枚mei -媒mei -镁mei -昧mei -寐mei -媚mei -糜*mei -谜*mei -莓mei -嵋mei -猸mei -浼mei -湄mei -楣mei -镅mei -鹛mei -袂mei -魅mei -每次meici -每当meidang -美德meide -没法meifa -每逢meifeng -每个meige -美观meiguan -玫瑰meigui -美国meiguo -美好meihao -美化meihua -媒介meijie -眉睫meijie -枚举meiju -煤矿meikuang -霉烂meilan -魅力meili -美丽meili -美满meiman -眉毛meimao -美貌meimao -妹妹meimei -美妙meimiao -眉目meimu -每年meinian -煤气meiqi -每人meiren -每日meiri -美容meirong -眉梢meishao -每时meishi -美术meishu -媒妁meishuo -煤炭meitan -每天meitian -煤田meitian -美学meixue -没有meiyou -煤油meiyou -美元meiyuan -每月meiyue -没治meizhi -每周meizhou -们men -门men -闷men -扪men -焖men -懑men -钔men -门房menfang -孟meng -猛meng -蒙meng -盟meng -梦meng -萌meng -锰meng -氓*meng -檬meng -勐meng -甍meng -瞢meng -懵meng -朦meng -礞meng -虻meng -蜢meng -蠓meng -艋meng -艨meng -蒙蔽mengbi -萌发mengfa -蒙古menggu -盟国mengguo -梦幻menghuan -蒙混menghun -梦见mengjian -猛进mengjin -梦境mengjing -猛烈menglie -蒙胧menglong -蒙昧mengmei -猛然mengran -萌生mengsheng -猛士mengshi -蒙受mengshou -梦想mengxiang -梦乡mengxiang -猛醒mengxing -萌芽mengya -盟友mengyou -盟约mengyue -猛增mengzeng -门户menhu -门路menlu -门牌menpai -门票menpiao -闷气menqi -门诊menzhen -名副其实mfqs -眉飞色舞mfsw -没关系mgx -蒙古族mgz -蒙混过关mhgg -米mi -密mi -迷mi -蜜mi -秘mi -眯mi -醚mi -靡mi -糜mi -谜mi -弥mi -觅mi -泌mi -幂mi -芈mi -谧mi -蘼mi -咪mi -嘧mi -猕mi -汨mi -宓mi -弭mi -脒mi -祢mi -敉mi -糸mi -縻mi -麋mi -面mian -棉mian -免mian -绵mian -眠mian -冕mian -勉mian -娩mian -缅mian -沔mian -渑mian -湎mian -腼mian -眄mian -面部mianbu -免除mianchu -免得miande -面对miandui -面额miane -棉花mianhua -缅怀mianhuai -面积mianji -面具mianju -面孔miankong -勉励mianli -面临mianlin -面貌mianmao -面面mianmian -绵绵mianmian -面目mianmu -面庞mianpang -面前mianqian -勉强mianqiang -面容mianrong -面色mianse -棉纱miansha -面授mianshou -免税mianshui -面谈miantan -面向mianxiang -免刑mianxing -棉絮mianxu -绵延mianyan -面议mianyi -免疫mianyi -面罩mianzhao -免职mianzhi -面子mianzi -苗miao -秒miao -描miao -庙miao -妙miao -瞄miao -藐miao -渺miao -喵miao -邈miao -缈miao -缪miao -杪miao -淼miao -眇miao -鹋miao -秒表miaobiao -描绘miaohui -妙龄miaoling -渺茫miaomang -描摹miaomo -藐视miaoshi -描述miaoshu -苗条miaotiao -苗头miaotou -描写miaoxie -瞄准miaozhun -弥补mibu -谜底midi -密度midu -灭mie -蔑mie -乜*mie -咩mie -蠛mie -篾mie -灭火miehuo -灭迹mieji -灭绝miejue -灭口miekou -蔑视mieshi -灭亡miewang -密封mifeng -蜜蜂mifeng -眯缝mifeng -迷航mihang -迷糊mihu -迷惑mihuo -密集miji -密件mijian -迷津mijin -秘诀mijue -糜烂milan -迷恋milian -密令miling -迷路milu -密码mima -迷漫miman -弥漫miman -秘密mimi -汨汨mimi -谜面mimian -密谋mimou -民min -敏min -抿min -皿min -悯min -闽min -苠min -岷min -闵min -泯min -缗min -玟min -珉min -愍min -黾min -鳘min -民办minban -民兵minbing -民法minfa -民愤minfen -民风minfeng -命ming -明ming -名ming -鸣ming -螟ming -盟*ming -铭ming -冥ming -茗ming -溟ming -暝ming -瞑ming -酩ming -敏感mingan -明白mingbai -名册mingce -名称mingcheng -明处mingchu -名次mingci -名词mingci -名单mingdan -明灯mingdeng -民歌minge -名额minge -名贵minggui -铭记mingji -名家mingjia -铭刻mingke -明快mingkuai -明朗minglang -名利mingli -明亮mingliang -明了mingliao -命令mingling -名流mingliu -明码mingma -明媚mingmei -明明mingming -名目mingmu -明年mingnian -名牌mingpai -名片mingpian -名气mingqi -明确mingque -明人mingren -名人mingren -名胜mingsheng -名声mingsheng -名堂mingtang -明天mingtian -名望mingwang -明文mingwen -明细mingxi -明显mingxian -鸣谢mingxie -明星mingxing -名言mingyan -名义mingyi -名誉mingyu -命运mingyun -明知mingzhi -明智mingzhi -明珠mingzhu -名著mingzhu -名字mingzi -民航minhang -民间minjian -敏捷minjie -民警minjing -民情minqing -敏锐minrui -民事minshi -民心minxin -民意minyi -民用minyong -民运minyun -民政minzheng -民众minzhong -民主minzhu -民族minzu -密切miqie -迷人miren -迷失mishi -秘书mishu -密探mitan -迷途mitu -谬miu -谬论miulun -谬误miuwu -迷惘miwang -迷雾miwu -迷信mixin -密友miyou -谜语miyu -蜜月miyue -马克思mks -眉开眼笑mkyx -马列主义mlzy -满面春风mmcf -马马虎虎mmhh -面面俱到mmjd -莫名其妙mmqm -默默无闻mmww -明目张胆mmzd -无*mo -磨mo -没*mo -万*mo -末mo -模mo -膜mo -摸mo -墨mo -摩mo -脉*mo -莫mo -抹mo -冒*mo -默mo -貉*mo -嘿*mo -摹mo -蘑mo -魔mo -沫mo -漠mo -寞mo -陌mo -谟mo -茉mo -蓦mo -馍mo -嫫mo -殁mo -镆mo -秣mo -瘼mo -耱mo -貊mo -貘mo -默哀moai -莫不mobu -磨擦moca -摩擦moca -磨蹭moceng -莫大moda -磨刀modao -摩登modeng -摸底modi -模范mofan -模仿mofang -摹仿mofang -莫非mofei -魔鬼mogui -模糊mohu -墨迹moji -模块mokuai -磨砺moli -磨练molian -末了moliao -末路molu -没落moluo -磨灭momie -默默momo -磨难monan -模拟moni -摹拟moni -末期moqi -默契moqi -默然moran -漠然moran -默认moren -末日mori -莫如moru -抹杀mosha -抹煞mosha -末梢moshao -陌生mosheng -模式moshi -没收moshou -魔术moshu -磨损mosun -摸索mosuo -模特mote -摩托motuo -某mou -谋mou -牟mou -侔mou -哞mou -缪*mou -眸mou -蛑mou -蝥mou -鍪mou -某地moudi -某个mouge -谋害mouhai -谋划mouhua -某军moujun -牟利mouli -谋略moulue -谋求mouqiu -牟取mouqu -谋杀mousha -谋生mousheng -某些mouxie -末尾mowei -默写moxie -模型moxing -默许moxu -模样moyang -魔掌mozhang -模子mozi -妙趣横生mqhs -门市部msb -名胜古迹msgj -妙手回春mshc -莫斯科msk -没什么msm -每时每刻msmk -秘书长msz -没事找事mszs -摩托车mtc -埋头工作mtgz -埋头苦干mtkg -亩mu -目mu -木mu -母mu -墓mu -模*mu -幕mu -牧mu -姆mu -穆mu -姥*mu -牟*mu -拇mu -牡mu -暮mu -募mu -慕mu -睦mu -仫mu -坶mu -苜mu -沐mu -毪mu -钼mu -母爱muai -墓碑mubei -目标mubiao -木材mucai -牧草mucao -目测muce -牧场muchang -目次muci -牡丹mudan -目的mudi -牧歌muge -目光muguang -幕后muhou -目击muji -募集muji -木刻muke -木料muliao -幕僚muliao -目录mulu -牧民mumin -木讷mune -木偶muou -目前muqian -母亲muqin -牧区muqu -木然muran -暮色muse -牧师mushi -目送musong -牧童mutong -牧业muye -沐浴muyu -民意测验mycy -贸易市场mysc -贸易协定myxd -民政部mzb -美中不足mzbz -毛泽东mzd -满载而归mzeg -明知故犯mzgf -毛织品mzp -目中无人mzwr -毛主席mzx -年n -能n -内n -那n -农n -你n -南n -难n -呢n -女n -泥n -哪n -拿n -念n -牛n -宁n -脑n -粘n -尼n -纳n -嗯n -那na -南na -哪na -拿na -纳na -呢*na -钠na -呐na -娜na -捺na -肭na -镎na -衲na -那边nabian -纳粹nacui -哪儿naer -那个nage -哪个nage -呐喊nahan -哪会nahui -耐nai -哪*nai -奶nai -乃nai -氖nai -奈nai -鼐nai -艿nai -萘nai -柰nai -耐烦naifan -奈何naihe -耐久naijiu -耐劳nailao -奶奶nainai -耐心naixin -耐性naixing -耐用naiyong -奶油naiyou -乃至naizhi -那里nali -哪里nali -那么name -南nan -难nan -男nan -喃nan -囝nan -囡nan -楠nan -腩nan -蝻nan -赧nan -难办nanban -南北nanbei -南边nanbian -难产nanchan -南昌nanchang -难处nanchu -难道nandao -难得nande -难点nandian -难度nandu -哪能naneng -南方nanfang -南非nanfei -难分nanfen -南风nanfeng -囊nang -攮nang -囔nang -馕nang -曩nang -囊括nangkuo -难怪nanguai -难关nanguan -南国nanguo -难过nanguo -南海nanhai -南货nanhuo -南极nanji -难解nanjie -南京nanjing -难看nankan -难堪nankan -南面nanmian -难免nanmian -难民nanmin -南宁nanning -男女nannu -赧然nanran -男人nanren -难色nanse -难事nanshi -难受nanshou -难说nanshuo -难题nanti -难听nanting -难为nanwei -男性nanxing -南亚nanya -南洋nanyang -难以nanyi -难友nanyou -难于nanyu -脑nao -闹nao -努*nao -挠nao -恼nao -淖nao -孬nao -垴nao -呶nao -猱nao -瑙nao -硇nao -铙nao -蛲nao -脑袋naodai -脑海naohai -恼火naohuo -脑筋naojin -闹剧naoju -闹事naoshi -哪怕napa -纳入naru -那时nashi -拿手nashou -纳税nashui -那些naxie -哪些naxie -纳新naxin -那样nayang -哪样nayang -那种nazhong -年产量ncl -农产品ncp -南昌市ncs -难道说nds -呢ne -哪*ne -呐*ne -讷ne -内nei -那*nei -哪*nei -馁nei -内部neibu -内存neicun -内地neidi -内阁neige -内涵neihan -内行neihang -内奸neijian -内疚neijiu -内科neike -内乱neiluan -内幕neimu -内勤neiqin -内容neirong -内外neiwai -内销neixiao -内心neixin -内因neiyin -内应neiying -内在neizai -嫩nen -恁nen -能neng -能动nengdong -能否nengfou -能干nenggan -能够nenggou -能力nengli -能量nengliang -能耐nengnai -能人nengren -能手nengshou -能源nengyuan -能者nengzhe -农副产品nfcp -年富力强nflq -能工巧匠ngqj -你ni -泥ni -尼ni -呢*ni -逆ni -拟ni -尿ni -妮ni -霓ni -倪ni -匿ni -腻ni -溺ni -伲ni -坭ni -猊ni -怩ni -昵ni -旎ni -祢*ni -慝ni -睨ni -铌ni -鲵ni -年nian -念nian -粘nian -蔫nian -拈nian -碾nian -撵nian -捻nian -酿nian -廿nian -埝nian -辇nian -黏nian -鲇nian -鲶nian -年初nianchu -年代niandai -念叨niandao -年底niandi -年度niandu -年份nianfen -娘niang -年华nianhua -年画nianhua -年级nianji -年纪nianji -年鉴nianjian -年来nianlai -年利nianli -年历nianli -拈量nianliang -年龄nianling -年迈nianmai -年年niannian -年青nianqing -年轻nianqing -年岁niansui -年头niantou -念头niantou -年限nianxian -年月nianyue -酿造nianzao -年终nianzhong -尿niao -鸟niao -溺*niao -茑niao -嬲niao -脲niao -袅niao -鸟瞰niaokan -逆差nicha -你处nichu -你的nide -拟定niding -拟订niding -镍nie -啮nie -涅nie -捏nie -聂nie -孽nie -镊nie -乜nie -陧nie -蘖nie -嗫nie -颞nie -臬nie -蹑nie -捏造niezao -腻烦nifan -泥浆nijiang -逆境nijing -泥坑nikeng -逆流niliu -你们nimen -您nin -宁ning -凝ning -拧ning -柠ning -狞ning -泞ning -佞ning -苎ning -咛ning -甯ning -聍ning -凝固ninggu -凝结ningjie -宁静ningjing -凝聚ningju -宁可ningke -宁肯ningken -宁日ningri -凝视ningshi -凝望ningwang -宁夏ningxia -宁愿ningyuan -泥泞nining -泥塑nisu -牛niu -扭niu -钮niu -纽niu -拗*niu -狃niu -忸niu -妞niu -纽带niudai -牛犊niudu -纽扣niukou -纽约niuyue -扭转niuzhuan -腻味niwei -你我niwo -拟议niyi -泥沼nizhao -逆转nizhuan -难解难分njnf -南京市njs -南极洲njz -扭亏为盈nkwy -脑力劳动nlld -年老体弱nltr -内蒙古nmg -农贸市场nmsc -那么些nmx -那么样nmy -念念不忘nnbw -难能可贵nnkg -南宁市nns -农nong -弄nong -浓nong -脓nong -侬nong -哝nong -脓包nongbao -农村nongcun -浓度nongdu -农妇nongfu -浓厚nonghou -农会nonghui -农活nonghuo -农具nongju -农历nongli -农林nonglin -农忙nongmang -农民nongmin -弄清nongqing -农时nongshi -农药nongyao -农业nongye -农艺nongyi -浓郁nongyu -耨nou -年轻化nqh -年轻人nqr -那时候nsh -能说会道nshd -南斯拉夫nslf -能上能下nsnx -逆水行舟nsxz -农田水利ntsl -女nu -奴nu -努nu -怒nu -弩nu -胬nu -孥nu -驽nu -恧nu -钕nu -衄nu -暖nuan -暖和nuanhe -暖流nuanliu -暖气nuanqi -奴婢nubi -奴才nucai -虐nue -虐待nuedai -虐疾nueji -女儿nuer -女工nugong -怒吼nuhou -奴化nuhua -怒火nuhuo -努力nuli -奴隶nuli -诺nuo -娜*nuo -挪nuo -懦nuo -糯nuo -傩nuo -搦nuo -喏nuo -锘nuo -挪用nuoyong -奴仆nupu -女人nuren -女色nuse -女士nushi -女性nuxing -女婿nuxu -女子nuzi -能文能武nwnw -弄虚作假nxzj -农作物nzw -你争我夺nzwd -欧o -偶o -哦o -鸥o -殴o -藕o -呕o -沤o -讴o -噢o -怄o -瓯o -耦o -偶然性orx -区*ou -欧ou -偶ou -鸥ou -殴ou -藕ou -呕ou -沤ou -讴ou -怄ou -瓯ou -耦ou -殴打ouda -偶尔ouer -讴歌ouge -偶合ouhe -耦合ouhe -欧姆oumu -怄气ouqi -偶然ouran -藕色ouse -偶数oushu -呕吐outu -欧阳ouyang -欧洲ouzhou -批p -平p -判p -配p -片p -派p -破p -排p -品p -皮p -喷p -盘p -偏p -评p -怕p -培p -普p -贫p -跑p -炮p -怕pa -派pa -爬pa -帕pa -扒*pa -耙*pa -啪pa -趴pa -琶pa -葩pa -杷pa -钯*pa -筢pa -派pai -排pai -拍pai -牌pai -迫*pai -哌pai -徘pai -湃pai -俳pai -蒎pai -排版paiban -拍板paiban -排比paibi -派别paibie -排场paichang -排斥paichi -排除paichu -排队paidui -牌号paihao -徘徊paihuai -排挤paiji -牌价paijia -排列pailie -拍卖paimai -派遣paiqian -排球paiqiu -派生paisheng -派头paitou -排外paiwai -排泄paixie -排演paiyan -牌照paizhao -判pan -盘pan -叛pan -番*pan -潘pan -攀pan -磐pan -盼pan -畔pan -胖pan -拚*pan -爿pan -泮pan -袢pan -襻pan -蟠pan -蹒pan -叛变panbian -判别panbie -盘缠panchan -盘存pancun -叛党pandang -攀登pandeng -盘点pandian -判定panding -判断panduan -攀附panfu -旁pang -膀*pang -磅*pang -乓pang -庞pang -耪pang -胖pang -彷pang -滂pang -逄pang -螃pang -旁边pangbian -庞大pangda -盘亘pangen -旁观pangguan -旁听pangting -旁通pangtong -滂沱pangtuo -庞杂pangza -盘踞panju -判决panjue -叛乱panluan -判明panming -叛逆panni -盘算pansuan -蟠桃pantao -叛徒pantu -盼望panwang -判刑panxing -盘旋panxuan -跑pao -炮pao -刨pao -抛pao -泡pao -咆pao -袍pao -匏pao -狍pao -庖pao -脬pao -疱pao -炮兵paobing -跑步paobu -炮弹paodan -跑道paodao -抛光paoguang -炮火paohuo -炮击paoji -抛锚paomao -泡沫paomo -抛弃paoqi -炮手paoshou -炮台paotai -炮艇paoting -咆哮paoxiao -泡影paoying -炮仗paozhang -炮制paozhi -怕死pasi -疲惫不堪pbbk -迫不急待pbjd -破除迷信pcmx -平等互利pdhl -配pei -培pei -陪pei -胚pei -呸pei -裴pei -赔pei -佩pei -沛pei -辔pei -帔pei -旆pei -锫pei -醅pei -霈pei -陪伴peiban -配备peibei -赔本peiben -赔偿peichang -陪衬peichen -配方peifang -佩服peifu -配合peihe -配给peiji -配件peijian -配角peijiao -赔款peikuan -赔礼peili -配偶peiou -陪审peishen -陪送peisong -胚胎peitai -配套peitao -陪同peitong -培训peixun -培养peiyang -配音peiyin -培育peiyu -配乐peiyue -陪葬peizang -配制peizhi -配置peizhi -培植peizhi -喷pen -盆pen -湓pen -盆地pendi -碰peng -棚peng -蓬peng -朋peng -捧peng -膨peng -砰peng -抨peng -烹peng -澎peng -彭peng -硼peng -篷peng -鹏peng -堋peng -嘭peng -怦peng -蟛peng -碰杯pengbei -碰壁pengbi -蓬勃pengbo -捧场pengchang -抨击pengji -蓬莱penglai -蓬乱pengluan -澎湃pengpai -烹饪pengren -硼砂pengsha -蓬松pengsong -烹调pengtiao -朋友pengyou -膨胀pengzhang -喷溅penjian -盆景penjing -喷射penshe -喷嚏penti -平方公里pfgl -平分秋色pfqs -批pi -皮pi -坏*pi -否*pi -辟*pi -坯pi -脾pi -疲pi -砒pi -霹pi -披pi -劈pi -琵pi -毗pi -啤pi -匹pi -痞pi -僻pi -屁pi -譬pi -丕pi -仳pi -陂*pi -陴pi -邳pi -郫pi -圮pi -埤*pi -鼙pi -芘pi -擗pi -吡*pi -噼pi -庀pi -淠pi -媲pi -纰pi -枇pi -甓pi -睥pi -罴pi -铍pi -癖pi -裨*pi -疋pi -蚍pi -蜱pi -貔pi -片pian -偏pian -便*pian -篇pian -骗pian -扁*pian -谝pian -骈pian -缏*pian -犏pian -胼pian -翩pian -蹁pian -偏差piancha -片断pianduan -片段pianduan -偏废pianfei -篇幅pianfu -偏激pianji -偏见pianjian -骗局pianju -片刻pianke -偏离pianli -片面pianmian -偏旁pianpang -偏僻pianpi -偏颇pianpo -骗取pianqu -骗人pianren -骗术pianshu -偏袒piantan -翩跹pianxian -偏向pianxiang -偏移pianyi -便宜pianyi -篇章pianzhang -骗子pianzi -票piao -漂piao -朴*piao -飘piao -瓢piao -剽piao -莩*piao -嘌piao -嫖piao -骠*piao -缥piao -殍piao -瞟piao -螵piao -漂泊piaobo -票房piaofang -漂浮piaofu -票价piaojia -票据piaoju -漂亮piaoliang -漂流piaoliu -飘流piaoliu -飘落piaoluo -票面piaomian -飘渺piaomiao -飘泊piaopo -剽窃piaoqie -飘然piaoran -飘散piaosan -飘扬piaoyang -飘游piaoyou -疲惫pibei -批驳pibo -撇pie -瞥pie -丿pie -苤pie -氕pie -批发pifa -批复pifu -皮肤pifu -皮革pige -屁股pigu -疲倦pijuan -疲劳pilao -纰漏pilou -披露pilu -品pin -贫pin -频pin -拼pin -苹pin -聘pin -拚pin -姘pin -嫔pin -榀pin -牝pin -颦pin -品尝pinchang -频传pinchuan -拼凑pincou -频带pindai -频道pindao -品德pinde -贫乏pinfa -频繁pinfan -平ping -评ping -瓶ping -凭ping -苹ping -冯*ping -乒ping -坪ping -萍ping -屏ping -俜ping -娉ping -枰ping -鲆ping -平安pingan -评比pingbi -屏蔽pingbi -平常pingchang -平川pingchuan -平淡pingdan -平等pingdeng -平地pingdi -平定pingding -评定pingding -品格pinge -平反pingfan -平凡pingfan -平方pingfang -平分pingfen -评分pingfen -评功pinggong -平衡pingheng -评级pingji -平价pingjia -评价pingjia -评奖pingjiang -凭借pingjie -平静pingjing -平均pingjun -平空pingkong -凭空pingkong -评理pingli -评论pinglun -平面pingmian -平民pingmin -屏幕pingmu -评判pingpan -乒乓pingpang -平平pingping -平壤pingrang -平日pingri -平时pingshi -平手pingshou -评说pingshuo -平素pingsu -平坦pingtan -乒坛pingtan -平稳pingwen -平息pingxi -萍乡pingxiang -平行pingxing -平易pingyi -评议pingyi -平庸pingyong -平原pingyuan -平仄pingze -屏障pingzhang -凭着pingzhe -平整pingzheng -凭证pingzheng -评注pingzhu -贫寒pinhan -品级pinji -贫困pinkun -频率pinlu -品貌pinmao -拼命pinming -品名pinming -品评pinping -聘请pinqing -贫穷pinqiong -聘任pinren -聘书pinshu -拼写pinxie -品行pinxing -品性pinxing -拼音pinyin -品质pinzhi -品种pinzhong -批判pipan -匹配pipei -批评piping -脾气piqi -譬如piru -疲软piruan -批示pishi -脾胃piwei -脾性pixing -辟谣piyao -批语piyu -批阅piyue -批注pizhu -批准pizhun -平均数pjs -披荆斩棘pjzj -评论员ply -跑马观花pmgh -破po -迫po -坡po -泼po -繁*po -朴*po -泊*po -颇po -婆po -魄po -粕po -叵po -陂*po -鄱po -泺*po -珀po -攴po -钋po -钷po -钹*po -皤po -笸po -破案poan -破产pochan -破除pochu -坡度podu -泼妇pofu -破格poge -迫害pohai -破坏pohuai -破获pohuo -迫近pojin -破旧pojiu -泼辣pola -破烂polan -魄力poli -破例poli -破裂polie -破灭pomie -迫切poqie -迫使poshi -破碎posui -破损posun -破土potu -剖pou -裒pou -掊pou -剖解poujie -剖析pouxi -破绽pozhan -蓬蓬勃勃ppbb -普普通通pptt -旁若无人prwr -普通话pth -抛头露面ptlm -普pu -谱pu -扑pu -埔pu -铺pu -暴*pu -葡pu -朴pu -蒲pu -堡*pu -脯*pu -仆pu -莆pu -菩pu -圃pu -浦pu -曝pu -瀑pu -匍pu -噗pu -溥pu -濮pu -璞pu -氆pu -镤pu -镨pu -蹼pu -普遍pubian -普查pucha -扑哧puchi -扑打puda -铺盖pugai -普及puji -铺平puping -仆人puren -菩萨pusa -铺设pushe -朴实pushi -朴素pusu -葡萄putao -普通putong -扑通putong -铺位puwei -谱写puxie -普选puxuan -铺张puzhang -普照puzhao -朴直puzhi -平易近人pyjr -拼音字母pyzm -铺张浪费pzlf -起q -前q -其q -去q -气q -全q -期q -群q -情q -区q -强q -切q -取q -七q -求q -清q -确q -权q -且q -青q -亲爱的qad -情报所qbs -千百万qbw -千变万化qbwh -取长补短qcbd -千锤百炼qcbl -恰到好处qdhc -全党全军和全国qdqg -取而代之qedz -轻而易举qeyj -千方百计qfbj -清规戒律qgjl -勤工俭学qgjx -旗鼓相当qgxd -轻工业qgy -轻工业部qgyb -勤工助学qgzx -权衡利弊qhlb -骑虎难下qhnx -青海省qhs -青红皂白qhzb -起qi -其qi -气qi -期qi -七qi -器qi -齐qi -奇qi -汽qi -企qi -漆qi -欺qi -旗qi -畦qi -启qi -弃qi -歧qi -稽*qi -缉*qi -栖qi -戚qi -妻qi -凄qi -柒qi -沏qi -棋qi -崎qi -脐qi -祈qi -祁qi -骑qi -岂qi -乞qi -契qi -砌qi -迄qi -泣qi -讫qi -亟*qi -亓qi -俟qi -圻qi -芑qi -芪qi -荠*qi -萁qi -萋qi -葺qi -蕲qi -嘁qi -屺qi -岐qi -岖*qi -汔qi -淇qi -骐qi -绮qi -琪qi -琦qi -杞qi -桤qi -槭qi -耆qi -欹qi -祺qi -憩qi -碛qi -颀qi -蛴qi -蜞qi -綦qi -綮qi -蹊qi -鳍qi -麒qi -卡*qia -恰qia -掐qia -洽qia -伽*qia -葜qia -袷*qia -髂qia -恰当qiadang -恰好qiahao -前qian -千qian -钱qian -浅qian -签qian -迁qian -铅qian -潜qian -牵qian -钳qian -纤*qian -谴qian -扦qian -钎qian -仟qian -谦qian -乾qian -黔qian -遣qian -堑qian -嵌qian -欠qian -歉qian -倩qian -佥qian -阡qian -芊qian -芡qian -茜qian -荨qian -掮qian -岍qian -悭qian -慊qian -骞qian -搴qian -褰qian -缱qian -椠qian -犍*qian -肷qian -愆qian -钤qian -虔qian -箬qian -箝qian -前辈qianbei -前边qianbian -浅薄qianbo -钱财qiancai -欠产qianchan -前程qiancheng -签到qiandao -前敌qiandi -签订qianding -签发qianfa -遣返qianfan -前方qianfang -强qiang -将*qiang -枪qiang -抢qiang -墙qiang -腔qiang -呛qiang -羌qiang -蔷qiang -戕qiang -嫱qiang -樯qiang -戗qiang -炝qiang -锖qiang -锵qiang -镪qiang -襁qiang -蜣qiang -羟qiang -跄qiang -墙壁qiangbi -枪毙qiangbi -强辩qiangbian -强大qiangda -枪弹qiangdan -强盗qiangdao -强调qiangdiao -腔调qiangdiao -强度qiangdu -抢夺qiangduo -强攻qianggong -强国qiangguo -强化qianghua -强加qiangjia -强奸qiangjian -抢劫qiangjie -强劲qiangjin -抢救qiangjiu -枪决qiangjue -强烈qianglie -强迫qiangpo -强权qiangquan -强弱qiangruo -枪杀qiangsha -强盛qiangsheng -千古qiangu -牵挂qiangua -蔷薇qiangwei -抢险qiangxian -强行qiangxing -强硬qiangying -强占qiangzhan -强者qiangzhe -强制qiangzhi -枪支qiangzhi -强壮qiangzhuang -前后qianhou -前进qianjin -前景qianjing -迁就qianjiu -歉疚qianjiu -迁居qianju -乾坤qiankun -千里qianli -前例qianli -潜力qianli -牵连qianlian -前列qianlie -浅陋qianlou -前面qianmian -签名qianming -前年qiannian -前期qianqi -千秋qianqiu -前驱qianqu -欠缺qianque -前人qianren -前任qianren -纤弱qianruo -前哨qianshao -牵涉qianshe -歉收qianshou -签署qianshu -遣送qiansong -前提qianti -前天qiantian -欠条qiantiao -前途qiantu -千瓦qianwa -千万qianwan -前往qianwang -前夕qianxi -纤细qianxi -前线qianxian -浅显qianxian -谦虚qianxu -谦逊qianxun -前言qianyan -前沿qianyan -前夜qianye -歉意qianyi -迁移qianyi -牵引qianyin -潜在qianzai -谴责qianze -前者qianzhe -签证qianzheng -牵制qianzhi -钳制qianzhi -签字qianzi -前奏qianzou -桥qiao -瞧qiao -壳*qiao -巧qiao -敲qiao -乔qiao -蕉qiao -橇qiao -锹qiao -悄qiao -侨qiao -鞘qiao -撬qiao -翘qiao -峭qiao -俏qiao -窍qiao -雀*qiao -劁qiao -诮qiao -谯qiao -荞qiao -峤*qiao -愀qiao -憔qiao -缲*qiao -樵qiao -硗qiao -跷qiao -鞒qiao -侨胞qiaobao -桥墩qiaodun -巧计qiaoji -瞧见qiaojian -侨居qiaoju -桥梁qiaoliang -窍门qiaomen -巧妙qiaomiao -桥牌qiaopai -乔迁qiaoqian -悄然qiaoran -侨务qiaowu -敲诈qiaozha -恰似qiasi -洽谈qiatan -岂不qibu -起步qibu -器材qicai -奇才qicai -凄惨qican -起草qicao -汽车qiche -骑车qiche -启程qicheng -起初qichu -凄楚qichu -其次qici -期待qidai -脐带qidai -岂但qidan -启迪qidi -起点qidian -启动qidong -气度qidu -切qie -且qie -砌*qie -茄qie -怯qie -窃qie -伽*qie -郄qie -惬qie -慊*qie -妾qie -挈qie -锲qie -箧qie -窃案qiean -切断qieduan -切合qiehe -窃据qieju -窃取qiequ -怯弱qieruo -切身qieshen -切实qieshi -切题qieti -窃听qieting -切削qiexiao -惬意qieyi -启发qifa -起飞qifei -岂非qifei -气愤qifen -气氛qifen -欺负qifu -气概qigai -乞丐qigai -岂敢qigan -气功qigong -奇怪qiguai -器官qiguan -旗号qihao -漆黑qihei -气候qihou -期货qihuo -契机qiji -奇迹qiji -期间qijian -起见qijian -器件qijian -七届qijie -迄今qijin -起来qilai -凄凉qiliang -欺凌qiling -气流qiliu -歧路qilu -起码qima -骑马qima -启蒙qimeng -奇妙qimiao -器皿qimin -亲qin -侵qin -勤qin -秦qin -钦qin -琴qin -芹qin -擒qin -禽qin -寝qin -沁qin -芩qin -揿qin -吣qin -嗪qin -噙qin -廑*qin -溱qin -檎qin -锓qin -矜*qin -覃qin -螓qin -衾qin -亲爱qinai -亲笔qinbi -岂能qineng -侵犯qinfan -勤奋qinfen -情qing -清qing -青qing -轻qing -倾qing -请qing -亲*qing -庆qing -氢qing -晴qing -卿qing -擎qing -氰qing -顷qing -苘qing -圊qing -檠qing -磬qing -蜻qing -罄qing -箐qing -綮*qing -謦qing -鲭qing -黥qing -清白qingbai -青白qingbai -情报qingbao -情操qingcao -青草qingcao -清查qingcha -清除qingchu -清楚qingchu -青春qingchun -青翠qingcui -清单qingdan -倾倒qingdao -清点qingdian -情调qingdiao -轻浮qingfu -青工qinggong -青海qinghai -庆贺qinghe -清华qinghua -情怀qinghuai -清还qinghuan -请假qingjia -请柬qingjian -请教qingjiao -情节qingjie -清洁qingjie -情景qingjing -顷刻qingke -晴空qingkong -轻快qingkuai -情况qingkuang -青睐qinglai -晴朗qinglang -情理qingli -清理qingli -轻率qinglu -轻蔑qingmie -青年qingnian -氢气qingqi -轻巧qingqiao -请求qingqiu -情趣qingqu -青山qingshan -请示qingshi -清爽qingshuang -青松qingsong -轻松qingsong -倾诉qingsu -青天qingtian -晴天qingtian -倾听qingting -倾吐qingtu -请问qingwen -倾向qingxiang -倾销qingxiao -情形qingxing -清醒qingxing -情绪qingxu -情谊qingyi -轻易qingyi -轻盈qingying -情愿qingyuan -请愿qingyuan -请战qingzhan -轻重qingzhong -倾注qingzhu -庆祝qingzhu -请罪qingzui -侵害qinhai -勤俭qinjian -亲近qinjin -亲眷qinjuan -勤快qinkuai -勤劳qinlao -亲历qinli -亲临qinlin -侵略qinlue -亲密qinmi -勤勉qinmian -钦佩qinpei -亲戚qinqi -亲切qinqie -亲热qinre -亲人qinren -侵入qinru -亲身qinshen -侵蚀qinshi -寝室qinshi -亲手qinshou -亲属qinshu -侵吞qintun -勤务qinwu -亲信qinxin -亲眼qinyan -亲友qinyou -侵占qinzhan -亲自qinzi -穷qiong -琼qiong -邛qiong -茕qiong -穹qiong -蛩qiong -筇qiong -跫qiong -銎qiong -穷国qiongguo -穷苦qiongku -穷困qiongkun -穹隆qionglong -穷期qiongqi -穷人qiongren -穷途qiongtu -气派qipai -欺骗qipian -气魄qipo -乞求qiqiu -崎岖qiqu -齐全qiquan -凄然qiran -起色qise -气色qise -其实qishi -起始qishi -启事qishi -气势qishi -启示qishi -歧视qishi -奇数qishu -汽水qishui -起诉qisu -其他qita -其它qita -奇特qite -气体qiti -汽艇qiting -企图qitu -歧途qitu -求qiu -球qiu -秋qiu -丘qiu -仇*qiu -龟*qiu -邱qiu -囚qiu -酋qiu -泅qiu -俅qiu -巯qiu -犰qiu -湫qiu -逑qiu -遒qiu -楸qiu -赇qiu -虬qiu -蚯qiu -蝤qiu -裘qiu -糗qiu -鳅qiu -鼽qiu -秋播qiubo -球场qiuchang -囚犯qiufan -秋风qiufeng -秋季qiuji -求教qiujiao -囚禁qiujin -求救qiujiu -丘陵qiuling -秋千qiuqian -求情qiuqing -求全qiuquan -秋色qiuse -求实qiushi -秋收qiushou -秋天qiutian -求学qiuxue -求战qiuzhan -求证qiuzheng -求知qiuzhi -求助qiuzhu -期望qiwang -气味qiwei -气温qiwen -奇闻qiwen -欺侮qiwu -气息qixi -栖息qixi -起先qixian -期限qixian -气象qixiang -器械qixie -齐心qixin -气压qiya -欺压qiya -气焰qiyan -企业qiye -起义qiyi -歧义qiyi -起因qiyin -启用qiyong -汽油qiyou -其余qiyu -起源qiyuan -七月qiyue -契约qiyue -欺诈qizha -气质qizhi -旗帜qizhi -其中qizhong -器重qizhong -旗子qizi -妻子qizi -勤俭建国qjjg -勤俭节约qjjy -迄今为止qjwz -取决于qjy -千钧一发qjyf -旗开得胜qkds -全力以赴qlyf -勤劳致富qlzf -千里之行qlzx -亲密无间qmwj -青年人qnr -千篇一律qpyl -清清楚楚qqcc -勤勤恳恳qqkk -切切实实qqss -确确实实qqss -恰恰相反qqxf -求全责备qqzb -恰如其分qrqf -欺人之谈qrzt -七手八脚qsbj -全神贯注qsgz -全世界qsj -切实可行qskx -切身利益qsly -青少年qsn -前所未闻qsww -前所未有qswy -气势汹汹qsxx -齐头并进qtbj -奇谈怪论qtgl -千头万绪qtwx -前提下qtx -去qu -区qu -取qu -曲qu -且*qu -渠qu -屈qu -趋qu -驱qu -趣qu -蛆qu -躯qu -娶qu -龋qu -戌*qu -诎qu -劬qu -苣*qu -蕖qu -蘧qu -岖qu -衢qu -阒qu -璩qu -觑qu -氍qu -朐qu -祛qu -磲qu -鸲qu -癯qu -蛐qu -蠼qu -麴qu -瞿qu -黢qu -全quan -权quan -圈quan -劝quan -泉quan -醛quan -颧quan -痊quan -拳quan -犬quan -券quan -诠quan -荃quan -悛quan -绻quan -辁quan -畎quan -铨quan -蜷quan -筌quan -鬈quan -全部quanbu -全党quandang -劝导quandao -蜷伏quanfu -劝告quangao -全国quanguo -权衡quanheng -全会quanhui -拳击quanji -劝解quanjie -全局quanju -全军quanjun -全力quanli -权利quanli -权力quanli -全貌quanmao -全面quanmian -劝勉quanmian -全民quanmin -全能quanneng -全年quannian -全盘quanpan -全拼quanpin -全球quanqiu -蜷曲quanqu -全权quanquan -全然quanran -全胜quansheng -权术quanshu -泉水quanshui -劝说quanshuo -圈套quantao -全体quanti -拳头quantou -权威quanwei -劝慰quanwei -全文quanwen -全县quanxian -权限quanxian -全校quanxiao -权益quanyi -权宜quanyi -劝诱quanyou -痊愈quanyu -劝止quanzhi -劝阻quanzu -区别qubie -屈才qucai -驱除quchu -取代qudai -渠道qudao -取得qude -取缔qudi -曲调qudiao -驱动qudong -确que -却que -缺que -炔que -瘸que -鹊que -榷que -雀que -阕que -阙que -悫que -确保quebao -缺点quedian -确定queding -缺乏quefa -缺口quekou -确立queli -确切queqie -确认queren -缺少queshao -缺省quesheng -确实queshi -缺席quexi -缺陷quexian -确信quexin -确凿quezao -瘸子quezi -区分qufen -屈服qufu -躯干qugan -区划quhua -曲解qujie -取经qujing -取决qujue -躯壳quke -取乐qule -群qun -裙qun -逡qun -裙带qundai -群岛qundao -去年qunian -群众qunzhong -区区ququ -屈辱quru -驱散qusan -取舍qushe -取胜qusheng -去世qushi -驱使qushi -趋势qushi -躯体quti -区位quwei -区委quwei -趣味quwei -区县quxian -去向quxiang -趋向quxiang -取消quxiao -取信quxin -曲艺quyi -区域quyu -区长quzhang -曲折quzhe -屈指quzhi -驱逐quzhu -曲子quzi -奇形怪状qxgz -全心全意qxqy -气象台qxt -气象万千qxwq -齐心协力qxxl -岂有此理qycl -前因后果qyhg -情有可原qyky -强有力qyl -求之不得qzbd -取之不尽qzbj -轻重缓急qzhj -气壮山河qzsh -千真万确qzwq -人r -如r -日r -认r -入r -任r -热r -然r -容r -让r -润r -弱r -燃r -染r -壤r -绕r -仁r -溶r -刃r -仍r -然ran -燃ran -染ran -冉ran -苒ran -蚺ran -髯ran -燃点randian -然而raner -让rang -壤rang -嚷rang -瓤rang -攘rang -禳rang -穰rang -让步rangbu -让位rangwei -让贤rangxian -然后ranhou -燃料ranliao -染料ranliao -冉冉ranran -燃烧ranshao -绕rao -扰rao -饶rao -荛rao -娆rao -桡rao -扰乱raoluan -如此而已rcey -人才济济rcjj -热re -若*re -惹re -热爱reai -热潮rechao -热忱rechen -热诚recheng -热带redai -热火rehuo -热量reliang -热烈relie -人ren -认ren -任ren -仁ren -刃ren -忍ren -壬ren -韧ren -妊ren -纫ren -仞ren -荏ren -葚ren -饪ren -轫ren -稔ren -衽ren -热闹renao -人才rencai -人次renci -仁慈renci -认错rencuo -人大renda -韧带rendai -人道rendao -认得rende -认定rending -人防renfang -仍reng -扔reng -扔掉rengdiao -人格renge -仍旧rengjiu -人工rengong -认购rengou -仍然rengran -任何renhe -人家renjia -人间renjian -人杰renjie -认可renke -人口renkou -人类renlei -人力renli -人们renmen -任免renmian -人民renmin -任命renming -忍耐rennai -任凭renping -任期renqi -认清renqing -人权renquan -荏苒renran -忍让renrang -人人renren -人参renshen -人生rensheng -人事renshi -人士renshi -认识renshi -人手renshou -忍受renshou -认输renshu -忍痛rentong -人为renwei -认为renwei -人物renwu -任务renwu -人心renxin -忍心renxin -人选renxuan -任意renyi -仁义renyi -任用renyong -人员renyuan -认帐renzhang -认真renzhen -人质renzhi -任职renzhi -认罪renzui -认作renzuo -热切reqie -热情reqing -惹事reshi -热线rexian -热心rexin -热血rexue -人工合成rghc -热火朝天rhct -如虎添翼rhty -日ri -日报ribao -日本riben -日产richan -日常richang -日程richeng -日光riguang -日后rihou -日记riji -日久rijiu -日历rili -日落riluo -日内rinei -日期riqi -日夜riye -日益riyi -日用riyong -日照rizhao -日中rizhong -日子rizi -软件包rjb -人杰地灵rjdl -人尽其才rjqc -如饥似渴rjsk -日久天长rjtc -任劳任怨rlry -热泪盈眶rlyk -人民币rmb -人民代表大会rmdh -人民日报rmrb -燃眉之急rmzj -容rong -溶rong -荣rong -熔rong -融rong -绒rong -戎rong -茸rong -蓉rong -冗rong -嵘rong -狨rong -榕rong -肜rong -蝾rong -熔点rongdian -容光rongguang -融合ronghe -溶化ronghua -熔化ronghua -融化ronghua -融会ronghui -荣获ronghuo -容积rongji -溶解rongjie -容量rongliang -戎马rongma -容貌rongmao -容纳rongna -融洽rongqia -容忍rongren -荣辱rongru -容身rongshen -绒线rongxian -荣幸rongxing -容许rongxu -荣耀rongyao -溶液rongye -容易rongyi -荣誉rongyu -溶质rongzhi -肉rou -揉rou -柔rou -糅rou -蹂rou -鞣rou -柔和rouhe -肉麻rouma -柔软rouruan -肉体routi -任人为贤rrwx -日日夜夜rryy -人生观rsg -认识论rsl -惹事生非rssf -如上所述rsss -如ru -入ru -儒ru -乳ru -茹ru -蠕ru -孺ru -辱ru -汝ru -褥ru -蓐ru -薷ru -嚅ru -洳ru -溽ru -濡ru -缛ru -铷ru -襦ru -颥ru -软ruan -阮ruan -朊ruan -软骨ruangu -软件ruanjian -软禁ruanjin -软盘ruanpan -如常ruchang -如此ruci -入党rudang -蠕动rudong -乳房rufang -如果ruguo -如何ruhe -瑞rui -锐rui -蕊rui -芮rui -蕤rui -枘rui -睿rui -蚋rui -锐利ruili -瑞雪ruixue -锐意ruiyi -儒家rujia -如今rujin -辱骂ruma -入门rumen -入迷rumi -润run -闰run -润滑runhua -弱ruo -若ruo -偌ruo -弱点ruodian -若干ruogan -若是ruoshi -弱小ruoxiao -如期ruqi -入侵ruqin -如若ruruo -儒生rusheng -入手rushou -如同rutong -如下ruxia -入选ruxuan -如意ruyi -如愿ruyuan -入帐ruzhang -人武部rwb -若无其事rwqs -人言可畏rykw -日用品ryp -若有所思ryss -人之长情rzcq -是s -上s -时s -生s -说s -社s -深s -水s -所s -三s -十s -使s -事s -数s -四s -实s -少s -式s -山s -手s -撒sa -萨sa -洒sa -卅sa -仨sa -挲sa -脎sa -飒sa -撒谎sahuang -塞sai -思*sai -赛sai -腮sai -鳃sai -噻sai -赛车saiche -塞子saizi -撒娇sajiao -三san -散san -叁san -伞san -馓san -毵san -糁san -散步sanbu -散布sanbu -散发sanfa -三废sanfei -桑sang -丧sang -嗓sang -搡sang -磉sang -颡sang -丧命sangming -丧失sangshi -三国sanguo -三好sanhao -散会sanhui -三角sanjiao -三届sanjie -散失sanshi -散文sanwen -三月sanyue -扫sao -梢*sao -搔sao -骚sao -嫂sao -埽sao -缫sao -缲sao -臊sao -瘙sao -鳋sao -扫除saochu -扫荡saodang -扫地saodi -骚动saodong -骚乱saoluan -扫描saomiao -扫墓saomu -骚扰saorao -瘙痒saoyang -扫帚saozhou -洒脱satuo -说不定sbd -舍不得sbd -说不过去sbgq -说不来sbl -数不胜数sbss -素不相识sbxs -身不由己sbyj -上层建筑scjz -生产力scl -生产率scl -水产品scp -四川省scs -市场调节sctj -市场信息scxx -生动活泼sdhp -山东省sds -水电站sdz -色se -塞*se -瑟se -涩se -啬se -铯se -穑se -视而不见sebj -色彩secai -色调sediao -色盲semang -森sen -僧seng -僧侣senglu -森林senlin -森严senyan -色情seqing -瑟瑟sese -十二月sey -色泽seze -司法部sfb -赏罚分明sffm -说服力sfl -手风琴sfq -三番五次sfwc -四个现代化sgxh -手工业sgy -沙sha -杀sha -砂sha -啥sha -纱sha -莎sha -刹sha -傻sha -煞sha -杉sha -厦*sha -唼sha -嗄*sha -挲*sha -歃sha -铩sha -痧sha -裟sha -霎sha -鲨sha -煞白shabai -刹车shache -煞车shache -沙发shafa -傻瓜shagua -沙皇shahuang -色*shai -筛shai -晒shai -晒台shaitai -砂烬shajin -沙龙shalong -沙漠shamo -山shan -单*shan -闪shan -善shan -珊shan -扇shan -陕shan -掸*shan -苫shan -杉shan -删shan -煽shan -衫shan -擅shan -赡shan -膳shan -汕shan -缮shan -栅*shan -剡shan -讪shan -鄯shan -埏shan -芟shan -潸shan -姗shan -嬗shan -骟shan -膻shan -禅*shan -钐shan -疝shan -蟮shan -舢shan -跚shan -鳝shan -刹那shana -山坳shanao -陕北shanbei -擅长shanchang -删除shanchu -山川shanchuan -山地shandi -闪电shandian -扇动shandong -煽动shandong -山东shandong -山峰shanfeng -上shang -商shang -伤shang -尚shang -汤*shang -墒shang -赏shang -晌shang -裳shang -垧shang -绱shang -殇shang -熵shang -觞shang -删改shangai -山岗shangang -山冈shangang -上班shangban -上报shangbao -上边shangbian -商标shangbiao -上部shangbu -上策shangce -上层shangceng -商场shangchang -上次shangci -赏赐shangci -上当shangdang -上等shangdeng -上帝shangdi -商店shangdian -上调shangdiao -商定shangding -上访shangfang -伤感shanggan -上告shanggao -赏光shangguang -上海shanghai -伤害shanghai -商行shanghang -上级shangji -上集shangji -上进shangjin -上空shangkong -上来shanglai -商量shangliang -上流shangliu -上门shangmen -上面shangmian -上年shangnian -山沟shangou -商品shangpin -商洽shangqia -上前shangqian -尚且shangqie -上去shangqu -商榷shangque -商人shangren -上任shangren -上山shangshan -上升shangsheng -赏识shangshi -上述shangshu -上司shangsi -上诉shangsu -商谈shangtan -商讨shangtao -闪光shanguang -上文shangwen -上午shangwu -商务shangwu -上下shangxia -上限shangxian -伤心shangxin -上旬shangxun -上演shangyan -商业shangye -商议shangyi -上映shangying -上游shangyou -上涨shangzhang -上阵shangzhen -山河shanhe -善后shanhou -删节shanjie -善良shanliang -山林shanlin -山岭shanling -山脉shanmai -杉木shanmu -山区shanqu -扇区shanqu -山水shanshui -闪烁shanshuo -山头shantou -山西shanxi -陕西shanxi -赡养shanyang -闪耀shanyao -善意shanyi -善于shanyu -善战shanzhan -擅自shanzi -少shao -烧shao -稍shao -绍shao -召*shao -哨shao -梢shao -鞘*shao -捎shao -芍shao -勺shao -韶shao -邵shao -劭shao -苕shao -潲shao -杓*shao -蛸shao -筲shao -艄shao -哨兵shaobing -艄公shaogong -烧毁shaohui -少见shaojian -哨卡shaoka -少量shaoliang -少年shaonian -少女shaonu -烧伤shaoshang -少数shaoshu -哨所shaosuo -稍微shaowei -少许shaoxu -稍许shaoxu -少爷shaoye -少有shaoyou -少于shaoyu -少壮shaozhuang -沙哑shaya -砂眼shayan -傻子shazi -社she -设she -射she -摄she -舌she -折*she -涉she -舍she -蛇she -奢she -赊she -赦she -慑she -厍she -佘she -摺*she -猞she -滠she -歙she -畲she -麝she -设备shebei -射程shecheng -奢侈shechi -舍得shede -设法shefa -慑服shefu -赊购shegou -奢华shehua -社会shehui -社稷sheji -涉及sheji -设计sheji -射击sheji -舍己sheji -社交shejiao -设立sheli -涉猎shelie -社论shelun -深shen -身shen -神shen -什*shen -伸shen -参*shen -甚shen -渗shen -沈shen -肾shen -审shen -申shen -慎shen -砷shen -呻shen -娠shen -绅shen -婶shen -诜shen -谂shen -莘shen -葚*shen -哂shen -渖shen -椹shen -胂shen -矧shen -蜃shen -深奥shenao -申报shenbao -身边shenbian -申辩shenbian -身材shencai -审查shencha -深沉shenchen -深处shenchu -审处shenchu -审定shending -深度shendu -甚而shener -身分shenfen -身份shenfen -生sheng -胜sheng -声sheng -省sheng -升sheng -盛sheng -绳sheng -剩sheng -圣sheng -牲sheng -乘*sheng -甥sheng -嵊sheng -渑*sheng -晟sheng -眚sheng -笙sheng -生财shengcai -生产shengchan -生成shengcheng -牲畜shengchu -生存shengcun -盛大shengda -省得shengde -胜地shengdi -盛典shengdian -声调shengdiao -生动shengdong -省份shengfen -胜负shengfu -省府shengfu -生根shenggen -升华shenghua -省会shenghui -盛会shenghui -生活shenghuo -生机shengji -生计shengji -升级shengji -圣洁shengjie -圣经shengjing -盛开shengkai -牲口shengkou -盛况shengkuang -生理shengli -胜利shengli -省力shengli -省略shenglue -生命shengming -声明shengming -盛名shengming -生怕shengpa -生僻shengpi -生平shengping -升旗shengqi -生前shengqian -升迁shengqian -盛情shengqing -生趣shengqu -省去shengqu -胜任shengren -生日shengri -省事shengshi -盛事shengshi -声势shengshi -生疏shengshu -生死shengsi -胜似shengsi -胜诉shengsu -绳索shengsuo -生态shengtai -声讨shengtao -声望shengwang -省委shengwei -生物shengwu -生息shengxi -剩下shengxia -盛夏shengxia -圣贤shengxian -生效shengxiao -生肖shengxiao -盛行shengxing -生涯shengya -生意shengyi -声音shengyin -生于shengyu -生育shengyu -胜于shengyu -声誉shengyu -剩余shengyu -声援shengyuan -生长shengzhang -省长shengzhang -声张shengzhang -胜仗shengzhang -生殖shengzhi -圣旨shengzhi -盛装shengzhuang -审核shenhe -深厚shenhou -深化shenhua -神话shenhua -甚或shenhuo -审计shenji -神经shenjing -深刻shenke -审理shenli -什么shenme -审美shenmei -神秘shenmi -申明shenming -审判shenpan -身旁shenpang -审批shenpi -神气shenqi -神奇shenqi -深浅shenqian -深切shenqie -深情shenqing -申请shenqing -身躯shenqu -深入shenru -渗入shenru -神圣shensheng -身世shenshi -绅士shenshi -伸手shenshou -申述shenshu -神速shensu -申诉shensu -伸缩shensuo -神态shentai -身体shenti -神通shentong -渗透shentou -审问shenwen -神仙shenxian -审讯shenxun -沈阳shenyang -审议shenyi -呻吟shenyin -身影shenying -深远shenyuan -申冤shenyuan -审阅shenyue -深造shenzao -伸张shenzhang -深圳shenzhen -甚至shenzhi -深重shenzhong -慎重shenzhong -神州shenzhou -舍弃sheqi -赊欠sheqian -设施sheshi -社团shetuan -奢望shewang -射线shexian -涉嫌shexian -设想shexiang -赊销shexiao -设宴sheyan -摄影sheying -社员sheyuan -社长shezhang -设置shezhi -涉足shezu -社会公德shgd -是shi -时shi -十shi -使shi -事shi -实shi -式shi -识shi -世shi -试shi -石shi -什shi -示shi -市shi -史shi -师shi -始shi -施shi -士shi -势shi -湿shi -适shi -食shi -失shi -视shi -室shi -氏shi -似*shi -蚀shi -诗shi -释shi -殖*shi -拾shi -饰shi -驶shi -匙*shi -狮shi -尸shi -虱shi -矢shi -屎shi -柿shi -拭shi -誓shi -逝shi -嗜shi -噬shi -仕shi -侍shi -恃shi -嘘*shi -峙*shi -谥shi -埘shi -莳shi -蓍shi -弑shi -轼shi -贳shi -炻shi -铈shi -螫shi -舐shi -筮shi -酾shi -豕shi -鲥shi -鲺shi -失败shibai -势必shibi -事变shibian -师表shibiao -识别shibie -失策shice -史册shice -视察shicha -时常shichang -失常shichang -市场shichang -时辰shichen -失传shichuan -侍从shicong -时代shidai -世代shidai -适当shidang -是的shide -实地shidi -试点shidian -失调shidiao -失掉shidiao -事端shiduan -拾掇shiduo -时而shier -示范shifan -师范shifan -施放shifang -释放shifang -是非shifei -时分shifen -十分shifen -侍奉shifeng -是否shifou -师傅shifu -实干shigan -是个shige -诗歌shige -施工shigong -事故shigu -世故shigu -尸骨shigu -使馆shiguan -时光shiguang -嗜好shihao -适合shihe -时候shihou -事后shihou -侍候shihou -使唤shihuan -实惠shihui -失火shihuo -时机shiji -事迹shiji -实际shiji -世纪shiji -试剂shiji -史籍shiji -施加shijia -市价shijia -时间shijian -事件shijian -世间shijian -实践shijian -视角shijiao -市郊shijiao -使节shijie -十届shijie -世界shijie -使劲shijin -市井shijing -时局shiju -视觉shijue -时刻shike -石刻shike -市侩shikuai -实况shikuang -事理shili -实力shili -事例shili -势利shili -失利shili -势力shili -视力shili -示例shili -失恋shilian -适量shiliang -矢量shiliang -拾零shiling -失灵shiling -适龄shiling -时髦shimao -失密shimi -市民shimin -使命shiming -市内shinei -室内shinei -诗篇shipian -食品shipin -视频shipin -识破shipo -时期shiqi -事前shiqian -失窃shiqie -事情shiqing -实情shiqing -时区shiqu -时取shiqu -失去shiqu -市区shiqu -诗人shiren -市容shirong -湿润shirun -示弱shiruo -失散shisan -失色shise -施舍shishe -师生shisheng -失声shisheng -时时shishi -时事shishi -适时shishi -事实shishi -失事shishi -实施shishi -失实shishi -逝世shishi -史诗shishi -失势shishi -誓师shishi -尸首shishou -失守shishou -实数shishu -施属shishu -世俗shisu -失算shisuan -事态shitai -试探shitan -食堂shitang -实体shiti -尸体shiti -石头shitou -势头shitou -师团shituan -十万shiwan -失望shiwang -市委shiwei -示威shiwei -时务shiwu -事物shiwu -事务shiwu -实物shiwu -食物shiwu -饰物shiwu -失误shiwu -实习shixi -事先shixian -视线shixian -实现shixian -试想shixiang -事项shixiang -实效shixiao -试销shixiao -失信shixin -实行shixing -试行shixing -施行shixing -失修shixiu -实学shixue -史学shixue -实验shiyan -试验shiyan -食言shiyan -誓言shiyan -式样shiyang -事业shiye -实业shiye -失业shiye -视野shiye -时宜shiyi -事宜shiyi -示意shiyi -诗意shiyi -适宜shiyi -释疑shiyi -适应shiying -使用shiyong -实用shiyong -试用shiyong -适用shiyong -事由shiyou -石油shiyou -誓由shiyou -适于shiyu -誓愿shiyuan -十月shiyue -失约shiyue -实在shizai -实战shizhan -施展shizhan -市长shizhang -师长shizhang -使者shizhe -侍者shizhe -失真shizhen -市镇shizhen -市政shizheng -试制shizhi -实质shizhi -市制shizhi -食指shizhi -失职shizhi -适中shizhong -示众shizhong -始终shizhong -时装shizhuang -师资shizi -十足shizu -实足shizu -失足shizu -始祖shizu -手shou -受shou -收shou -首shou -守shou -熟*shou -授shou -寿shou -兽shou -售shou -瘦shou -狩shou -绶shou -艏shou -守备shoubei -手表shoubiao -收兵shoubing -收藏shoucang -手册shouce -首倡shouchang -寿辰shouchen -收成shoucheng -首创shouchuang -首次shouci -收存shoucun -寿诞shoudan -受到shoudao -守敌shoudi -首度shoudu -首都shoudu -手段shouduan -守法shoufa -首犯shoufan -收复shoufu -首府shoufu -手感shougan -手稿shougao -收割shouge -收购shougou -受害shouhai -守候shouhou -守护shouhu -收回shouhui -受贿shouhui -收获shouhuo -收集shouji -售价shoujia -受奖shoujiang -授奖shoujiang -手脚shoujiao -收缴shoujiao -首届shoujie -守旧shoujiu -收据shouju -授课shouke -受理shouli -收敛shoulian -首领shouling -收留shouliu -收录shoulu -收买shoumai -授命shouming -寿命shouming -首脑shounao -首批shoupi -授权shouquan -收容shourong -收入shouru -手软shouruan -瘦弱shouruo -首饰shoushi -手术shoushu -收缩shousuo -收条shoutiao -收听shouting -收尾shouwei -首尾shouwei -首先shouxian -首相shouxiang -瘦小shouxiao -收效shouxiao -手续shouxu -瘦削shouxue -收养shouyang -首要shouyao -受益shouyi -收益shouyi -兽医shouyi -受用shouyong -授予shouyu -守则shouze -首长shouzhang -收支shouzhi -生活上shs -上海市shs -数shu -书shu -树shu -属shu -术shu -输shu -述shu -熟shu -束shu -鼠shu -疏shu -殊shu -舒shu -蔬shu -薯shu -叔shu -署shu -枢shu -梳shu -抒shu -淑shu -赎shu -孰shu -暑shu -曙shu -蜀shu -黍shu -戍shu -竖shu -墅shu -庶shu -漱shu -恕shu -俞*shu -丨shu -倏shu -塾shu -菽shu -摅shu -沭shu -澍shu -姝shu -纾shu -毹shu -腧shu -殳shu -秫shu -刷shua -耍shua -唰shua -衰shuai -帅shuai -摔shuai -甩shuai -蟀shuai -衰败shuaibai -摔打shuaida -摔交shuaijiao -衰竭shuaijie -衰老shuailao -衰弱shuairuo -衰退shuaitui -衰亡shuaiwang -耍赖shualai -栓shuan -拴shuan -闩shuan -涮shuan -双shuang -霜shuang -爽shuang -泷*shuang -孀shuang -双边shuangbian -双方shuangfang -爽口shuangkou -爽快shuangkuai -爽朗shuanglang -双拼shuangpin -双重shuangzhong -耍弄shuanong -刷洗shuaxi -刷新shuaxin -书报shubao -书本shuben -蔬菜shucai -舒畅shuchang -输出shuchu -树丛shucong -疏导shudao -书店shudian -数额shue -抒发shufa -书法shufa -舒服shufu -束缚shufu -曙光shuguang -蜀汉shuhan -疏忽shuhu -倏忽shuhu -书画shuhua -水shui -说*shui -谁shui -睡shui -税shui -水稻shuidao -水电shuidian -水分shuifen -水果shuiguo -水火shuihuo -水晶shuijing -水库shuiku -水利shuili -水流shuiliu -睡眠shuimian -水平shuiping -税收shuishou -税务shuiwu -水下shuixia -水性shuixing -水源shuiyuan -水灾shuizai -谁知shuizhi -书记shuji -书籍shuji -暑假shujia -数据shuju -书刊shukan -数理shuli -树立shuli -竖立shuli -熟练shulian -数量shuliang -数列shulie -疏漏shulou -数落shuluo -数码shuma -书面shumian -庶民shumin -数目shumu -书目shumu -树木shumu -顺shun -吮shun -瞬shun -舜shun -顺便shunbian -顺差shuncha -顺次shunci -顺从shuncong -顺当shundang -顺道shundao -顺风shunfeng -枢纽shuniu -顺利shunli -顺路shunlu -瞬时shunshi -顺势shunshi -顺心shunxin -顺序shunxu -顺应shunying -顺着shunzhuo -说shuo -数*shuo -硕shuo -朔shuo -烁shuo -蒴shuo -搠shuo -妁shuo -槊shuo -铄shuo -说到shuodao -说道shuodao -说动shuodong -说法shuofa -说服shuofu -硕果shuoguo -说话shuohua -说教shuojiao -说明shuoming -说情shuoqing -硕士shuoshi -述评shuping -署期shuqi -暑期shuqi -抒情shuqing -熟人shuren -输入shuru -疏散shusan -属实shushi -熟识shushi -舒适shushi -束手shushou -叔叔shushu -数说shushuo -述说shushuo -输送shusong -疏松shusong -舒坦shutan -疏通shutong -熟悉shuxi -属相shuxiang -舒心shuxin -书信shuxin -属性shuxing -数学shuxue -属于shuyu -术语shuyu -疏远shuyuan -舒展shuzhan -数值shuzhi -树脂shuzhi -梳妆shuzhuang -数字shuzi -赎罪shuzui -售货员shy -社会主义shzy -四si -思si -死si -斯si -丝si -似si -司si -饲si -食*si -私si -厕*si -撕si -嘶si -肆si -寺si -嗣si -伺si -巳si -厮si -俟*si -兕si -厶si -咝si -汜si -泗si -澌si -姒si -驷si -缌si -祀si -锶si -鸶si -耜si -蛳si -笥si -死板siban -四边sibian -死别sibie -思潮sichao -丝绸sichou -四处sichu -四川sichuan -死党sidang -死敌sidi -司法sifa -四方sifang -四海sihai -丝毫sihao -嗣后sihou -似乎sihu -四化sihua -死缓sihuan -撕毁sihui -死活sihuo -四季siji -司机siji -私交sijiao -四届sijie -思考sikao -私利sili -私了siliao -司令siling -思路silu -四面simian -思念sinian -私念sinian -死去siqu -私人siren -死伤sishang -私事sishi -死尸sishi -死水sishui -思索sisuo -四体siti -私吞situn -死亡siwang -思维siwei -斯文siwen -私下sixia -思想sixiang -四项sixiang -死心sixin -私心sixin -肆行sixing -死刑sixing -私有siyou -私欲siyu -寺院siyuan -四月siyue -死者sizhe -四周sizhou -私自sizi -死罪sizui -拾金不昧sjbm -身经百战sjbz -书记处sjc -世界观sjg -舍己救人sjjr -数据库sjk -省军区sjq -杀鸡取蛋sjqd -实际上sjs -设计所sjs -试金石sjs -舍己为人sjwr -设计院sjy -随机应变sjyb -十进制sjz -石家庄sjz -适可而止skez -数理化slh -收录机slj -十六进制sljz -三令五申slws -司令员sly -四面八方smbf -手忙脚乱smjl -生命力sml -说明书sms -什么样smy -深谋远虑smyl -数目字smz -松song -送song -宋song -颂song -耸song -怂song -讼song -诵song -凇song -菘song -崧song -嵩song -忪song -悚song -淞song -竦song -松绑songbang -送别songbie -松弛songchi -松动songdong -颂歌songge -松劲songjin -松快songkuai -耸立songli -送礼songli -松散songsan -松涛songtao -松懈songxie -颂扬songyang -怂恿songyong -送葬songzang -送终songzhong -搜sou -艘sou -擞sou -嗽sou -叟sou -薮sou -嗖sou -嗾sou -馊sou -溲sou -飕sou -瞍sou -锼sou -螋sou -搜查soucha -搜集souji -搜索sousuo -搜寻souxun -售票处spc -食品工业spgy -水平线spx -生气勃勃sqbb -诗情画意sqhy -盛气凌人sqlr -山穷水尽sqsj -十全十美sqsm -首屈一指sqyz -四人帮srb -损人利己srlj -深入浅出srqc -似是而非ssef -时时刻刻sskk -姗姗来迟sslc -实事求是ssqs -事实上sss -随时随地sssd -善始善终sssz -顺水推舟sstz -四通公司stgs -四通集团stjt -身体力行stlx -生态平衡stph -素su -速su -苏su -塑su -缩su -俗su -诉su -宿su -肃su -酥su -粟su -僳su -溯su -夙su -谡su -蔌su -嗉su -愫su -涑su -簌su -觫su -稣su -算suan -酸suan -蒜suan -狻suan -酸楚suanchu -算法suanfa -算计suanji -算了suanle -算盘suanpan -算术suanshu -酸疼suanteng -酸痛suantong -素材sucai -速成sucheng -苏丹sudan -速度sudu -俗话suhua -随sui -穗sui -碎sui -虽sui -岁sui -尿*sui -隋sui -绥sui -髓sui -遂sui -隧sui -祟sui -谇sui -荽sui -濉sui -邃sui -燧sui -眭sui -睢sui -随笔suibi -随便suibian -随处suichu -随从suicong -随地suidi -随和suihe -随后suihou -随机suiji -随即suiji -虽然suiran -随身suishen -随时suishi -随手suishou -岁数suishu -虽说suishuo -随同suitong -随心suixin -随行suixing -随意suiyi -遂意suiyi -岁月suiyue -虽则suize -随着suizhe -诉苦suku -苏联sulian -塑料suliao -速率sulu -素描sumiao -肃穆sumu -损sun -孙sun -笋sun -荪sun -狲sun -飧sun -榫sun -隼sun -损害sunhai -损耗sunhao -损坏sunhuai -损伤sunshang -损失sunshi -孙子sunzi -所suo -缩suo -锁suo -索suo -莎*suo -蓑suo -梭suo -唆suo -琐suo -唢suo -嗦suo -嗍suo -娑suo -桫suo -挲*suo -睃suo -羧suo -所得suode -缩短suoduan -缩减suojian -锁链suolian -所能suoneng -索取suoqu -唆使suoshi -所属suoshu -琐碎suosui -所为suowei -所谓suowei -缩小suoxiao -缩写suoxie -琐屑suoxie -索性suoxing -所以suoyi -索引suoyin -缩影suoying -所有suoyou -所在suozai -所长suozhang -所至suozhi -梭子suozi -肃清suqing -苏区suqu -宿舍sushe -素数sushu -诉说sushuo -诉讼susong -速效suxiao -速写suxie -苏醒suxing -素养suyang -宿营suying -溯源suyuan -宿愿suyuan -夙愿suyuan -塑造suzao -速战suzhan -素质suzhi -苏州suzhou -苏维埃swa -税务局swj -手舞足蹈swzd -少先队sxd -身心健康sxjk -思想上sxs -山西省sxs -陕西省sxs -顺息万变sxwb -所向无敌sxwd -思想性sxx -商业部syb -说一不二sybe -收音机syj -使用价值syjz -所有权syq -沈阳市sys -实用性syx -十一月syy -所有制syz -私有制syz -时至今日szjr -三中全会szqh -始终如一szry -深圳四通szst -所作所为szsw -甚至于szy -他t -同t -它t -提t -题t -体t -图t -天t -头t -通t -条t -特t -土t -团t -统t -台t -她t -太t -套t -铁t -他ta -它ta -她ta -塔ta -踏ta -塌ta -獭ta -挞ta -蹋ta -拓*ta -嗒*ta -闼ta -溻ta -漯*ta -遢ta -榻ta -沓ta -铊ta -趿ta -鳎ta -踏步tabu -他的tade -它的tade -她的tade -塌方tafang -台tai -太tai -态tai -胎tai -抬tai -泰tai -苔tai -酞tai -汰tai -邰tai -薹tai -呔*tai -骀*tai -肽tai -炱tai -钛tai -跆tai -鲐tai -台北taibei -台词taici -态度taidu -台风taifeng -台阶taijie -太平taiping -泰然tairan -泰山taishan -态势taishi -太太taitai -抬头taitou -台湾taiwan -太阳taiyang -太原taiyuan -天安门tam -他们tamen -它们tamen -她们tamen -谈tan -碳tan -探tan -炭tan -弹*tan -坦tan -贪tan -滩tan -坍tan -摊tan -瘫tan -坛tan -檀tan -痰tan -潭tan -谭tan -毯tan -袒tan -叹tan -郯tan -澹tan -昙tan -忐tan -钽tan -锬tan -镡*tan -坦白tanbai -探测tance -探访tanfang -谈锋tanfeng -叹服tanfu -堂tang -糖tang -唐tang -塘tang -汤tang -搪tang -棠tang -膛tang -倘tang -躺tang -淌tang -趟tang -烫tang -傥tang -帑tang -溏tang -瑭tang -樘tang -铴tang -镗tang -耥tang -螗tang -螳tang -羰tang -醣tang -倘不tangbu -搪瓷tangci -弹弓tangong -倘若tangruo -搪塞tangsai -烫伤tangshang -堂堂tangtang -唐突tangtu -弹劾tanhe -袒护tanhu -谈话tanhua -瘫痪tanhuan -探究tanjiu -坦克tanke -贪婪tanlan -坦率tanlu -谈论tanlun -摊派tanpai -谈判tanpan -叹气tanqi -探亲tanqin -弹琴tanqin -坦然tanran -探索tansuo -探讨tantao -谈天tantian -探听tanting -贪图tantu -谈吐tantu -滩涂tantu -探望tanwang -探问tanwen -贪污tanwu -叹息tanxi -探险tanxian -谈心tanxin -弹性tanxing -探询tanxun -贪赃tanzang -套tao -讨tao -逃tao -陶tao -萄tao -桃tao -掏tao -涛tao -滔tao -绦tao -淘tao -鼗tao -叨*tao -啕tao -洮tao -韬tao -焘tao -饕tao -逃奔taoben -逃避taobi -逃兵taobing -逃窜taocuan -逃遁taodun -讨伐taofa -讨饭taofan -套购taogou -讨好taohao -讨还taohuan -讨价taojia -桃李taoli -韬略taolue -讨论taolun -逃命taoming -逃难taonan -逃跑taopao -淘气taoqi -逃生taosheng -淘汰taotai -滔滔taotao -逃脱taotuo -逃亡taowang -讨厌taoyan -陶冶taoye -桃子taozi -逃走taozou -陶醉taozui -踏青taqing -他人taren -踏实tashi -他说tashuo -他乡taxiang -挑拨离间tblj -台北市tbs -贪便宜tby -统筹兼顾tcjg -铁道部tdb -土地改革tdgg -同等学历tdxl -特te -忒te -忑te -慝*te -铽te -特别tebie -特产techan -特长techang -特出techu -特此teci -特大teda -特等tedeng -特地tedi -特点tedian -特定teding -特级teji -特技teji -特急teji -特将tejiang -特刊tekan -特快tekuai -特例teli -腾teng -疼teng -藤teng -誊teng -滕teng -疼爱tengai -腾达tengda -誊写tengxie -特派tepai -特区tequ -特权tequan -托儿所tes -特色tese -特使teshi -特殊teshu -特为tewei -特务tewu -特效texiao -特写texie -特性texing -特邀teyao -特意teyi -特有teyou -特约teyue -特征tezheng -特制tezhi -特种tezhong -突飞猛进tfmj -铁饭碗tfw -同甘共苦tggk -提货单thd -谈何容易thry -提ti -题ti -体ti -替ti -梯ti -惕ti -剔ti -踢ti -锑ti -蹄ti -啼ti -嚏ti -涕ti -剃ti -屉ti -倜ti -荑*ti -悌ti -逖ti -绨*ti -缇ti -鹈ti -裼ti -醍ti -天tian -田tian -添tian -填tian -甜tian -佃*tian -恬tian -舔tian -腆tian -掭tian -忝tian -阗tian -殄tian -畋tian -填报tianbao -天边tianbian -填表tianbiao -填补tianbu -天才tiancai -天长tianchang -填充tianchong -天地tiandi -田地tiandi -天鹅tiane -天府tianfu -天赋tianfu -天机tianji -天际tianji -添加tianjia -天津tianjin -恬静tianjing -天空tiankong -填空tiankong -天理tianli -天良tianliang -天亮tianliang -甜美tianmei -甜蜜tianmi -天明tianming -天平tianping -天气tianqi -天桥tianqiao -天然tianran -天壤tianrang -天色tianse -天上tianshang -天生tiansheng -天使tianshi -天堂tiantang -天体tianti -天天tiantian -甜头tiantou -天文tianwen -天下tianxia -天险tianxian -天仙tianxian -天性tianxing -天涯tianya -田野tianye -天真tianzhen -天职tianzhi -添置tianzhi -天资tianzi -条tiao -调*tiao -跳tiao -挑tiao -迢tiao -眺tiao -佻tiao -苕*tiao -祧tiao -窕tiao -蜩tiao -笤tiao -粜tiao -龆tiao -鲦tiao -髫tiao -挑拔tiaoba -跳动tiaodong -挑动tiaodong -挑逗tiaodou -跳高tiaogao -调和tiaohe -调剂tiaoji -条件tiaojian -调解tiaojie -调节tiaojie -条款tiaokuan -调理tiaoli -条理tiaoli -条例tiaoli -条令tiaoling -调配tiaopei -挑剔tiaoti -调停tiaoting -条文tiaowen -跳舞tiaowu -调戏tiaoxi -挑衅tiaoxin -挑选tiaoxuan -条约tiaoyue -挑战tiaozhan -调整tiaozheng -条子tiaozi -提拨tibo -题材ticai -体裁ticai -体操ticao -体察ticha -提倡tichang -提成ticheng -提出tichu -剔除tichu -题词tici -替代tidai -梯队tidui -铁tie -贴tie -帖tie -萜tie -餮tie -贴补tiebu -铁道tiedao -贴近tiejin -铁路tielu -贴切tieqie -贴身tieshen -铁证tiezheng -提法tifa -提防tifang -提纲tigang -提高tigao -体格tige -提供tigong -替换tihuan -体会tihui -提货tihuo -体积tiji -提价tijia -体力tili -体例tili -提炼tilian -体谅tiliang -体面timian -提名timing -题名timing -题目timu -听ting -停ting -庭ting -挺ting -廷ting -厅ting -烃ting -汀ting -亭ting -艇ting -莛ting -葶ting -婷ting -梃ting -町*ting -铤ting -蜓ting -霆ting -挺拔tingba -停办tingban -停泊tingbo -停产tingchan -听从tingcong -停顿tingdun -停工tinggong -挺括tinggua -听候tinghou -听话tinghua -停火tinghuo -听见tingjian -厅局tingju -听觉tingjue -停留tingliu -听凭tingping -听取tingqu -听任tingren -听说tingshuo -听信tingxin -厅长tingzhang -停止tingzhi -停职tingzhi -停滞tingzhi -听众tingzhong -提起tiqi -提前tiqian -提取tiqu -提升tisheng -提示tishi -体坛titan -体贴titie -提问tiwen -体温tiwen -体系tixi -体现tixian -体型tixing -提醒tixing -体验tiyan -提要tiyao -提议tiyi -体育tiyu -体制tizhi -体质tizhi -题字tizi -统计表tjb -条件反射tjfs -讨价还价tjhj -天津市tjs -条件下tjx -讨论会tlh -拖拉机tlj -他们的tmd -同盟会tmh -天南地北tndb -同tong -通tong -统tong -铜tong -痛tong -筒tong -童tong -桶tong -侗*tong -恫*tong -桐tong -酮tong -瞳tong -彤tong -捅tong -佟tong -仝tong -垌*tong -茼tong -嗵tong -峒*tong -恸tong -潼tong -砼tong -同伴tongban -同胞tongbao -通报tongbao -同辈tongbei -通病tongbing -同步tongbu -通常tongchang -通称tongcheng -统称tongcheng -痛斥tongchi -统筹tongchou -痛楚tongchu -同窗tongchuang -同道tongdao -通道tongdao -同等tongdeng -通电tongdian -通牒tongdie -通读tongdu -通告tonggao -统购tonggou -通过tongguo -通航tonghang -痛恨tonghen -同化tonghua -通话tonghua -童话tonghua -痛悔tonghui -通婚tonghun -统计tongji -通辑tongji -痛击tongji -同居tongju -痛苦tongku -痛哭tongku -痛快tongkuai -同僚tongliao -通令tongling -同盟tongmeng -同年tongnian -童年tongnian -同期tongqi -通气tongqi -同情tongqing -通融tongrong -同上tongshang -通商tongshang -同时tongshi -同事tongshi -统属tongshu -统帅tongshuai -通顺tongshun -通俗tongsu -通往tongwang -痛恶tongwu -痛惜tongxi -统辖tongxia -通向tongxiang -同乡tongxiang -统销tongxiao -通宵tongxiao -通晓tongxiao -同心tongxin -痛心tongxin -通信tongxin -同行tongxing -通行tongxing -同性tongxing -同学tongxue -通讯tongxun -同样tongyang -统一tongyi -同意tongyi -通用tongyong -通邮tongyou -统战tongzhan -同志tongzhi -统治tongzhi -通知tongzhi -头tou -投tou -透tou -偷tou -钭tou -骰tou -投案touan -头版touban -投奔touben -投标toubiao -投产touchan -透彻touche -头等toudeng -投放toufang -投机touji -投靠toukao -投篮toulan -偷懒toulan -头颅toulu -透露toulu -头面toumian -透明touming -头目toumu -头脑tounao -投票toupiao -透气touqi -投入touru -投身toushen -透视toushi -头痛toutong -偷闲touxian -投降touxiang -头绪touxu -投影touying -投掷touzhi -头子touzi -投资touzi -突破口tpk -太平洋tpy -通情达理tqdl -天气预报tqyb -突然袭击trxj -妥善处理tscl -通俗读物tsdw -挺身而出tsec -图书馆tsg -滔滔不绝ttbj -痛痛快快ttkk -团体赛tts -踏踏实实ttss -图tu -土tu -突tu -途tu -徒tu -凸tu -涂tu -吐tu -兔tu -屠tu -秃tu -堍tu -荼tu -菟tu -钍tu -酴tu -团tuan -湍tuan -抟tuan -彖tuan -疃tuan -图案tuan -湍急tuanji -团结tuanjie -团聚tuanju -湍流tuanliu -团体tuanti -团员tuanyuan -团圆tuanyuan -团长tuanzhang -突变tubian -图表tubiao -土产tuchan -突出tuchu -土地tudi -徒弟tudi -土匪tufei -土改tugai -涂改tugai -图画tuhua -土话tuhua -推tui -退tui -腿tui -颓tui -蜕tui -褪tui -忒*tui -煺tui -蜕变tuibian -退步tuibu -推测tuice -推迟tuichi -推崇tuichong -退出tuichu -推导tuidao -推动tuidong -推断tuiduan -推翻tuifan -颓废tuifei -推广tuiguang -退化tuihua -蜕化tuihua -退回tuihui -推荐tuijian -推进tuijin -推举tuiju -推开tuikai -推理tuili -推论tuilun -推敲tuiqiao -推却tuique -退却tuique -推让tuirang -退让tuirang -颓丧tuisang -退色tuise -推算tuisuan -退缩tuisuo -颓唐tuitang -推托tuituo -退伍tuiwu -推向tuixiang -推销tuixiao -推卸tuixie -推行tuixing -退休tuixiu -退学tuixue -推移tuiyi -退职tuizhi -突击tuji -图解tujie -途径tujing -徒劳tulao -图例tuli -吐露tulu -囤*tun -褪*tun -吞tun -屯tun -臀tun -氽tun -饨tun -暾tun -豚tun -吞并tunbing -吞没tunmo -吞吐tuntu -脱tuo -拖tuo -托tuo -妥tuo -椭tuo -舵*tuo -魄*tuo -鸵tuo -陀tuo -驮tuo -驼tuo -拓tuo -唾tuo -乇tuo -佗tuo -坨tuo -庹tuo -沱tuo -柝tuo -柁*tuo -橐tuo -砣tuo -铊*tuo -箨tuo -酡tuo -跎tuo -鼍tuo -驼背tuobei -拓补tuobu -脱出tuochu -妥当tuodang -脱轨tuogui -拓荒tuohuang -脱节tuojie -拖拉tuola -脱离tuoli -唾骂tuoma -唾弃tuoqi -妥善tuoshan -脱身tuoshen -妥协tuoxie -拖延tuoyan -唾液tuoye -图片tupian -突破tupo -突起tuqi -突然turan -徒然turan -土壤turang -屠杀tusha -徒手tushou -图书tushu -吐痰tutan -突围tuwei -突兀tuwu -图象tuxiang -图像tuxiang -图形tuxing -徒刑tuxing -图章tuzhang -图纸tuzhi -途中tuzhong -土著tuzhu -秃子tuzi -贪污盗窃twdq -台湾省tws -贪污受贿twsh -提心吊胆txdd -通讯社txs -同心同德txtd -同心协力txxl -推心置腹txzf -体育场tyc -体育锻炼tydl -体育馆tyg -腾云驾雾tyjw -太阳能tyn -太原市tys -天衣无缝tywf -通用性tyx -体育运动tyyd -团支部tzb -停滞不前tzbq -同志们tzm -天灾人祸tzrh -听之任之tzrz -通知书tzs -为w -我w -无w -问w -外w -五w -位w -物w -委w -完w -温w -万w -文w -往w -武w -务w -王w -围w -误w -晚w -瓦wa -挖wa -凹*wa -哇wa -蛙wa -洼wa -娃wa -袜wa -佤wa -娲wa -腽wa -外wai -歪wai -外币waibi -外边waibian -外表waibiao -外宾waibin -外部waibu -外传waichuan -外存waicun -外地waidi -外调waidiao -歪风waifeng -外观waiguan -外国waiguo -外行waihang -外汇waihui -外加waijia -外交waijiao -外界waijie -外景waijing -外科waike -外快waikuai -外流wailiu -外貌waimao -外贸waimao -外面waimian -外勤waiqin -歪曲waiqu -外商waishang -外伤waishang -外设waishe -外省waisheng -外甥waisheng -外事waishi -外围waiwei -外文waiwen -外线waixian -外销waixiao -歪斜waixie -外延waiyan -外因waiyin -外语waiyu -外援waiyuan -外在waizai -外债waizhai -外资waizi -瓦解wajie -挖掘wajue -挖苦waku -瓦砾wali -完wan -万wan -晚wan -弯wan -碗wan -顽wan -湾wan -挽wan -玩wan -蔓*wan -娩*wan -豌wan -丸wan -烷wan -皖wan -惋wan -宛wan -婉wan -腕wan -剜wan -芄wan -莞*wan -菀wan -纨wan -绾wan -琬wan -脘wan -畹wan -蜿wan -万般wanban -晚报wanbao -完备wanbei -完毕wanbi -完成wancheng -万代wandai -顽敌wandi -万吨wandun -万恶wane -万分wanfen -往wang -王wang -望wang -网wang -忘wang -妄wang -亡wang -旺wang -芒*wang -汪wang -枉wang -罔wang -尢wang -惘wang -辋wang -魍wang -往常wangchang -王朝wangchao -忘掉wangdiao -妄动wangdong -枉法wangfa -往返wangfan -枉费wangfei -往复wangfu -王国wangguo -亡国wangguo -往后wanghou -忘怀wanghuai -忘记wangji -旺季wangji -往来wanglai -网络wangluo -亡命wangming -往年wangnian -完工wangong -忘却wangque -枉然wangran -惘然wangran -往日wangri -旺盛wangsheng -往事wangshi -妄图wangtu -万古wangu -顽固wangu -往往wangwang -汪汪wangwang -忘我wangwo -往昔wangxi -妄想wangxiang -汪洋wangyang -望远wangyuan -王子wangzi -完好wanhao -晚会wanhui -挽回wanhui -晚婚wanhun -晚间wanjian -完结wanjie -挽救wanjiu -玩具wanju -顽抗wankang -完了wanle -挽力wanli -弯路wanlu -完美wanmei -万能wanneng -万年wannian -晚年wannian -玩弄wannong -晚期wanqi -顽强wanqiang -弯曲wanqu -完全wanquan -完善wanshan -晚上wanshang -玩赏wanshang -万事wanshi -万世wanshi -玩耍wanshua -万岁wansui -万万wanwan -万物wanwu -晚霞wanxia -万象wanxiang -玩笑wanxiao -万幸wanxing -婉言wanyan -万一wanyi -万元wanyuan -完整wanzheng -顽症wanzheng -万众wanzhong -宛转wanzhuan -瓦斯wasi -瓦特wate -娃娃wawa -外部设备wbsb -微不足道wbzd -无产阶级wcjj -微处理机wclj -无产者wcz -为wei -位wei -委wei -围wei -维wei -唯wei -卫wei -微wei -伟wei -未wei -威wei -危wei -尾wei -谓wei -喂wei -味wei -胃wei -魏wei -伪wei -遗*wei -违wei -韦wei -畏wei -纬wei -巍wei -桅wei -惟wei -潍wei -苇wei -萎wei -蔚wei -渭wei -尉wei -慰wei -偎wei -诿wei -隈wei -隗*wei -圩*wei -葳wei -薇wei -囗wei -帏wei -帷wei -崴wei -嵬wei -猥wei -猬wei -闱wei -沩wei -洧wei -涠wei -逶wei -娓wei -玮wei -韪wei -軎wei -炜wei -煨wei -痿wei -艉wei -鲔wei -尾巴weiba -违背weibei -未必weibi -威逼weibi -微波weibo -微薄weibo -未曾weiceng -未尝weichang -维持weichi -为此weici -伟大weida -味道weidao -纬度weidu -唯独weidu -巍峨weie -违法weifa -违反weifan -违犯weifan -威风weifeng -桅杆weigan -微观weiguan -危害weihai -为何weihe -维护weihu -危及weiji -微机weiji -危机weiji -危急weiji -围歼weijian -围剿weijiao -慰藉weijie -违禁weijin -未经weijing -畏惧weiju -违抗weikang -未可weike -唯恐weikong -惟恐weikong -胃口weikou -未来weilai -慰劳weilao -为了weile -威力weili -委靡weimi -未免weimian -微妙weimiao -帷幕weimu -危难weinan -畏难weinan -未能weineng -委派weipai -为期weiqi -畏怯weiqie -委曲weiqu -委屈weiqu -未然weiran -巍然weiran -围绕weirao -伟人weiren -委任weiren -微弱weiruo -威慑weishe -为生weisheng -卫生weisheng -尾声weisheng -卫士weishi -威势weishi -为首weishou -为数weishu -尾随weisui -未遂weisui -畏缩weisuo -萎缩weisuo -猥琐weisuo -委托weituo -委婉weiwan -危亡weiwang -巍巍weiwei -慰问weiwen -唯物weiwu -威武weiwu -微细weixi -威吓weixia -危险weixian -微小weixiao -微笑weixiao -威协weixie -威胁weixie -猥亵weixie -维新weixin -唯心weixin -违心weixin -威信weixin -微型weixing -卫星weixing -维修weixiu -威严weiyan -伟业weiye -唯一weiyi -位移weiyi -位于weiyu -谓语weiyu -委员weiyuan -为止weizhi -位置weizhi -未知weizhi -为重weizhong -为主weizhu -伪装weizhuang -问wen -温wen -文wen -稳wen -纹wen -闻wen -蚊wen -瘟wen -吻wen -紊wen -刎wen -阌wen -汶wen -璺wen -雯wen -文本wenben -瘟病wenbing -稳步wenbu -问答wenda -稳定wending -温度wendu -嗡weng -翁weng -瓮weng -蓊weng -蕹weng -稳固wengu -问好wenhao -温和wenhe -吻合wenhe -文化wenhua -文件wenjian -稳健wenjian -问津wenjin -文静wenjing -文具wenju -文科wenke -文盲wenmang -文明wenming -闻名wenming -温暖wennuan -文凭wenping -文人wenren -温柔wenrou -问世wenshi -文坛wentan -问题wenti -文体wenti -稳妥wentuo -文物wenwu -文献wenxian -文选wenxuan -文学wenxue -问讯wenxun -闻讯wenxun -文艺wenyi -瘟疫wenyi -文娱wenyu -文摘wenzhai -文章wenzhang -稳重wenzhong -文字wenzi -问罪wenzui -望而生畏wesw -闻风而动wfed -违法乱纪wflj -歪风邪气wfxq -温故知新wgzx -文化部whb -文汇报whb -文化馆whg -文化宫whg -武汉市whs -五湖四海whsh -忘乎所以whsy -问寒问暖whwn -文化娱乐whyl -玩忽职守whzs -外交部wjb -无纪律wjl -五讲四美wjsm -无拘无束wjws -无可奉告wkfg -无可非议wkfy -无可奈何wknh -乌鲁木齐wlmq -无理取闹wlqn -无论如何wlrh -物美价廉wmjl -误码率wml -文明礼貌wmlm -无名英雄wmyx -无能为力wnwl -我wo -握wo -窝wo -蜗wo -涡wo -沃wo -挝wo -卧wo -斡wo -倭wo -莴wo -喔wo -幄wo -渥wo -肟wo -硪wo -龌wo -窝藏wocang -卧床wochuang -我党wodang -卧倒wodao -我的wode -窝工wogong -我国woguo -我军wojun -我们women -窝囊wonang -我省wosheng -我校woxiao -为期不远wqby -无穷无尽wqwj -误入歧途wrqt -卫生部wsb -纹丝不动wsbd -万事大吉wsdj -万事俱备wsjb -为什么wsm -无所谓wsw -为所欲为wsyw -无所作为wszw -无wu -五wu -物wu -武wu -务wu -误wu -伍wu -舞wu -污wu -悟wu -雾wu -午wu -恶*wu -屋wu -乌wu -吴wu -亡*wu -诬wu -钨wu -巫wu -呜wu -芜wu -梧wu -吾wu -毋wu -捂wu -侮wu -坞wu -戊wu -晤wu -勿wu -兀wu -仵wu -阢wu -邬wu -圬wu -芴wu -唔wu -庑wu -怃wu -忤wu -浯wu -寤wu -迕wu -妩wu -婺wu -骛wu -杌wu -牾wu -於*wu -焐wu -鹉wu -鹜wu -痦wu -蜈wu -鋈wu -鼯wu -吾辈wubei -无比wubi -五笔wubi -务必wubi -舞弊wubi -无边wubian -无不wubu -五彩wucai -误差wucha -无常wuchang -无偿wuchang -舞场wuchang -武昌wuchang -无耻wuchi -无从wucong -武打wuda -舞蹈wudao -无敌wudi -舞动wudong -武斗wudou -武断wuduan -无法wufa -无妨wufang -无非wufei -武功wugong -污垢wugou -无故wugu -无关wuguan -五官wuguan -武官wuguan -无害wuhai -诬害wuhai -武汉wuhan -无何wuhe -乌黑wuhei -五湖wuhu -呜呼wuhu -误会wuhui -舞会wuhui -污秽wuhui -无及wuji -无机wuji -物价wujia -无间wujian -物件wujian -误解wujie -五届wujie -五金wujin -无愧wukui -无赖wulai -诬赖wulai -无理wuli -物理wuli -无礼wuli -物力wuli -武力wuli -无聊wuliao -无虑wulu -无论wulun -污蔑wumie -诬蔑wumie -无奈wunai -无能wuneng -毋宁wuning -务农wunong -物品wupin -无期wuqi -五七wuqi -武器wuqi -无情wuqing -无穷wuqiong -舞曲wuqu -无权wuquan -污染wuran -无任wuren -污辱wuru -侮辱wuru -物色wuse -无上wushang -误伤wushang -无声wusheng -午时wushi -务使wushi -无视wushi -误事wushi -务实wushi -无数wushu -武术wushu -无双wushuang -午睡wushui -五四wusi -无私wusi -舞台wutai -无题wuti -物体wuti -舞厅wuting -无为wuwei -无谓wuwei -无物wuwu -无暇wuxia -无限wuxian -诬陷wuxian -无效wuxiao -五星wuxing -午休wuxiu -无须wuxu -无需wuxu -务虚wuxu -午夜wuye -五一wuyi -无益wuyi -无疑wuyi -无垠wuyin -无用wuyong -毋庸wuyong -无余wuyu -无缘wuyuan -五月wuyue -物证wuzheng -无知wuzhi -物质wuzhi -武装wuzhuang -物资wuzi -兀自wuzi -误字wuzi -无罪wuzui -无微不至wwbz -唯物论wwl -卧薪尝胆wxcd -无线电wxd -微型机wxj -唯心论wxl -问心无愧wxwk -委员会wyh -无缘无故wywg -委员长wyz -误字率wzl -无足轻重wzqz -未知数wzs -完整无缺wzwq -学x -下x -行x -小x -线x -性x -新x -些x -想x -心x -向x -相x -系x -席x -现x -西x -修x -象x -先x -形x -心安理得xald -西安市xas -西半球xbq -相比之下xbzx -宣传部xcb -新陈代谢xcdx -新产品xcp -畜产品xcp -西城区xcq -喜出望外xcww -相对而言xdey -现代化xdh -想当然xdr -相对误差xdwc -先睹为快xdwk -形而上学xesx -显而易见xeyj -西方国家xfgj -消费品xfp -想方设法xfsf -先发制人xfzr -兴高采烈xgcl -新华社xhs -新华书店xhsd -系xi -席xi -西xi -习xi -细xi -吸xi -析xi -喜xi -洗xi -铣xi -稀xi -戏xi -隙xi -希xi -息xi -袭xi -锡xi -烯xi -牺xi -悉xi -惜xi -溪xi -腊*xi -栖*xi -昔xi -熙xi -硒xi -矽xi -晰xi -嘻xi -膝xi -夕xi -熄xi -汐xi -犀xi -檄xi -媳xi -僖xi -兮xi -隰xi -郗xi -茜*xi -菥xi -葸xi -蓰xi -奚xi -唏xi -徙xi -饩xi -阋xi -浠xi -淅xi -屣xi -嬉xi -玺xi -樨xi -曦xi -觋xi -欷xi -歙*xi -熹xi -禊xi -禧xi -皙xi -穸xi -裼*xi -蜥xi -螅xi -蟋xi -舄xi -舾xi -羲xi -粞xi -翕xi -醯xi -蹊*xi -鼷xi -下xia -夏xia -吓xia -狭xia -霞xia -唬*xia -瞎xia -虾xia -匣xia -辖xia -暇xia -峡xia -侠xia -厦xia -呷xia -狎xia -遐xia -瑕xia -柙xia -硖xia -瘕*xia -罅xia -黠xia -狭隘xiaai -下班xiaban -下辈xiabei -下边xiabian -下策xiace -下层xiaceng -下场xiachang -下沉xiachen -下次xiaci -瑕疵xiaci -下达xiada -吓倒xiadao -下等xiadeng -下毒xiadu -下发xiafa -下放xiafang -峡谷xiagu -霞光xiaguang -瞎话xiahua -喜爱xiai -下级xiaji -下集xiaji -夏季xiaji -下降xiajiang -侠客xiake -下来xialai -下联xialian -夏粮xialiang -下列xialie -下令xialing -下流xialiu -下落xialuo -下马xiama -厦门xiamen -下面xiamian -线xian -现xian -先xian -县xian -限xian -见*xian -显xian -鲜xian -献xian -险xian -陷xian -宪xian -纤xian -洗*xian -掀xian -弦xian -铣*xian -腺xian -锨xian -仙xian -咸xian -贤xian -衔xian -舷xian -闲xian -涎xian -嫌xian -馅xian -羡xian -冼xian -苋xian -莶xian -藓xian -岘xian -猃xian -暹xian -娴xian -氙xian -燹xian -祆xian -鹇xian -痫xian -蚬xian -筅xian -籼xian -酰xian -跣xian -跹xian -霰xian -西安xian -献宝xianbao -先辈xianbei -现场xianchang -现成xiancheng -县城xiancheng -献丑xianchou -献词xianci -现存xiancun -现代xiandai -先导xiandao -显得xiande -险地xiandi -限定xianding -限度xiandu -线段xianduan -限额xiane -险恶xiane -宪法xianfa -先锋xianfeng -险峰xianfeng -想xiang -向xiang -相xiang -象xiang -响xiang -项xiang -箱xiang -乡xiang -降*xiang -香xiang -像xiang -详xiang -橡xiang -享xiang -湘xiang -厢xiang -镶xiang -襄xiang -翔xiang -祥xiang -巷xiang -芗xiang -葙xiang -饷xiang -庠xiang -骧xiang -缃xiang -蟓xiang -鲞xiang -飨xiang -相爱xiangai -相比xiangbi -想必xiangbi -相差xiangcha -相称xiangcheng -相处xiangchu -相传xiangchuan -乡村xiangcun -相当xiangdang -向导xiangdao -相等xiangdeng -相对xiangdui -想法xiangfa -相反xiangfan -相仿xiangfang -相干xianggan -香港xianggang -相隔xiangge -相关xiangguan -相好xianghao -相互xianghu -相继xiangji -相加xiangjia -相见xiangjian -相减xiangjian -相交xiangjiao -橡胶xiangjiao -相近xiangjin -详尽xiangjin -巷口xiangkou -向来xianglai -相连xianglian -向量xiangliang -响亮xiangliang -相貌xiangmao -项目xiangmu -想念xiangnian -相片xiangpian -想起xiangqi -详情xiangqing -向上xiangshang -相声xiangsheng -响声xiangsheng -相识xiangshi -翔实xiangshi -享受xiangshou -相思xiangsi -相似xiangsi -香甜xiangtian -相同xiangtong -相投xiangtou -显贵xiangui -向往xiangwang -详细xiangxi -向下xiangxia -乡下xiangxia -象限xiangxian -想象xiangxiang -相信xiangxin -香烟xiangyan -相依xiangyi -相宜xiangyi -相应xiangying -相映xiangying -响应xiangying -享用xiangyong -相遇xiangyu -相约xiangyue -乡镇xiangzhen -象征xiangzheng -箱子xiangzi -陷害xianhai -显赫xianhe -鲜红xianhong -先后xianhou -鲜花xianhua -献花xianhua -闲话xianhua -贤惠xianhui -献计xianji -献技xianji -显见xianjian -衔接xianjie -先进xianjin -现金xianjin -险境xianjing -陷阱xianjing -现款xiankuan -现况xiankuang -先例xianli -献礼xianli -先烈xianlie -线路xianlu -显露xianlu -鲜美xianmei -鲜明xianming -贤明xianming -显目xianmu -羡慕xianmu -贤能xianneng -先期xianqi -掀起xianqi -限期xianqi -嫌弃xianqi -先前xianqian -先遣xianqian -险情xianqing -先驱xianqu -显然xianran -贤人xianren -闲人xianren -现任xianren -陷入xianru -闲散xiansan -献身xianshen -先生xiansheng -先是xianshi -现实xianshi -显示xianshi -娴熟xianshu -线索xiansuo -闲谈xiantan -险滩xiantan -先天xiantian -线条xiantiao -县委xianwei -纤维xianwei -显现xianxian -现象xianxiang -现行xianxing -鲜血xianxue -显眼xianyan -鲜艳xianyan -显要xianyao -险要xianyao -显耀xianyao -现役xianyi -嫌疑xianyi -现有xianyou -限于xianyu -闲杂xianza -现在xianzai -县长xianzhang -宪章xianzhang -限制xianzhi -先知xianzhi -闲置xianzhi -闲职xianzhi -显著xianzhu -现状xianzhuang -险阻xianzu -小xiao -消xiao -削xiao -效xiao -笑xiao -校xiao -销xiao -硝xiao -萧xiao -肖xiao -孝xiao -霄xiao -哮xiao -嚣xiao -宵xiao -淆xiao -晓xiao -啸xiao -哓xiao -崤xiao -潇xiao -逍xiao -骁xiao -绡xiao -枭xiao -枵xiao -蛸*xiao -筱xiao -箫xiao -魈xiao -小报xiaobao -小辈xiaobei -笑柄xiaobing -消沉xiaochen -消除xiaochu -消毒xiaodu -效法xiaofa -小贩xiaofan -消防xiaofang -消费xiaofei -校风xiaofeng -小鬼xiaogui -效果xiaoguo -小孩xiaohai -消耗xiaohao -消化xiaohua -笑话xiaohua -小惠xiaohui -销毁xiaohui -销魂xiaohun -消极xiaoji -削减xiaojian -小结xiaojie -小姐xiaojie -孝敬xiaojing -校刊xiaokan -小康xiaokang -效劳xiaolao -效力xiaoli -销路xiaolu -效率xiaolu -消灭xiaomie -消磨xiaomo -效能xiaoneng -消气xiaoqi -消遣xiaoqian -笑容xiaorong -削弱xiaoruo -潇洒xiaosa -校舍xiaoshe -小时xiaoshi -消失xiaoshi -消逝xiaoshi -消瘦xiaoshou -销售xiaoshou -小数xiaoshu -小说xiaoshuo -萧条xiaotiao -消息xiaoxi -肖像xiaoxiang -小心xiaoxin -枭雄xiaoxiong -小学xiaoxue -效验xiaoyan -逍遥xiaoyao -效益xiaoyi -效应xiaoying -校友xiaoyou -小于xiaoyu -校园xiaoyuan -销赃xiaozang -校长xiaozhang -嚣张xiaozhang -效忠xiaozhong -小组xiaozu -下情xiaqing -下去xiaqu -辖区xiaqu -下手xiashou -夏收xiashou -下属xiashu -下水xiashui -下台xiatai -夏天xiatian -下文xiawen -下午xiawu -下限xiaxian -下乡xiaxiang -遐想xiaxiang -狭义xiayi -下游xiayou -狭窄xiazhai -夏至xiazhi -夏种xiazhong -喜报xibao -细胞xibao -西北xibei -西边xibian -稀薄xibo -锡箔xibo -西餐xican -洗涤xidi -吸毒xidu -些xie -解*xie -写xie -斜xie -谢xie -协xie -械xie -叶*xie -血*xie -卸xie -屑xie -鞋xie -歇xie -邪xie -胁xie -蟹xie -泄xie -泻xie -契*xie -楔xie -蝎xie -挟xie -携xie -谐xie -懈xie -偕xie -亵xie -勰xie -燮xie -薤xie -撷xie -獬xie -廨xie -渫xie -瀣xie -邂xie -绁xie -缬xie -榭xie -榍xie -颉*xie -躞xie -写出xiechu -协从xiecong -携带xiedai -邪道xiedao -协调xiediao -协定xieding -亵渎xiedu -邪恶xiee -协和xiehe -谐和xiehe -协会xiehui -谢绝xiejue -协力xieli -泄漏xielou -邪路xielu -泄露xielu -泄密xiemi -邪念xienian -胁迫xiepo -邪气xieqi -协商xieshang -写生xiesheng -携手xieshou -邪说xieshuo -协同xietong -歇息xiexi -谢谢xiexie -协议xieyi -谐音xieyin -协约xieyue -写照xiezhao -协助xiezhu -鞋子xiezi -写作xiezuo -协作xiezuo -西方xifang -西风xifeng -西服xifu -吸附xifu -媳妇xifu -习惯xiguan -西汉xihan -稀罕xihan -希罕xihan -喜欢xihuan -袭击xiji -细节xijie -洗劫xijie -喜剧xiju -戏剧xiju -席卷xijuan -细菌xijun -犀利xili -系列xilie -奚落xiluo -熄灭ximie -新xin -心xin -信xin -锌xin -芯xin -辛xin -寻*xin -欣xin -薪xin -忻xin -衅xin -囟xin -馨xin -昕xin -歆xin -镡*xin -鑫xin -心爱xinai -西南xinan -新春xinchun -信贷xindai -心得xinde -心烦xinfan -心服xinfu -信服xinfu -行xing -性xing -形xing -型xing -星xing -兴xing -省*xing -醒xing -姓xing -幸xing -腥xing -猩xing -惺xing -刑xing -邢xing -杏xing -陉xing -荇xing -荥xing -擤xing -饧xing -悻xing -硎xing -心甘xingan -兴办xingban -性别xingbie -姓别xingbie -刑场xingchang -星辰xingchen -形成xingcheng -行程xingcheng -行动xingdong -幸而xinger -刑法xingfa -刑罚xingfa -兴奋xingfen -幸福xingfu -性格xingge -幸好xinghao -型号xinghao -行贿xinghui -星火xinghuo -性急xingji -形迹xingji -兴建xingjian -行径xingjing -行军xingjun -星空xingkong -幸亏xingkui -行李xingli -行旅xinglu -幸免xingmian -性命xingming -姓名xingming -醒目xingmu -性能xingneng -行期xingqi -兴起xingqi -星期xingqi -性情xingqing -星球xingqiu -兴趣xingqu -形容xingrong -行商xingshang -兴盛xingsheng -行使xingshi -行事xingshi -行驶xingshi -形式xingshi -幸事xingshi -刑事xingshi -形势xingshi -姓氏xingshi -行署xingshu -兴衰xingshuai -形态xingtai -形体xingti -兴亡xingwang -兴旺xingwang -行为xingwei -行文xingwen -醒悟xingwu -形象xingxiang -行销xingxiao -星星xingxing -行凶xingxiong -兴修xingxiu -行业xingye -星夜xingye -幸运xingyun -行政xingzheng -性质xingzhi -兴致xingzhi -形状xingzhuang -行走xingzou -信号xinhao -心狠xinhen -心慌xinhuang -信汇xinhui -细腻xini -西宁xining -心急xinji -信件xinjian -新疆xinjiang -新近xinjin -新居xinju -心坎xinkan -辛苦xinku -信赖xinlai -辛劳xinlao -心理xinli -心里xinli -心灵xinling -心目xinmu -信念xinnian -戏弄xinong -新奇xinqi -辛勤xinqin -心情xinqing -新区xinqu -新人xinren -信任xinren -欣赏xinshang -新生xinsheng -心声xinsheng -新事xinshi -新式xinshi -新书xinshu -薪水xinshui -心酸xinsuan -辛酸xinsuan -心疼xinteng -心田xintian -心跳xintiao -心头xintou -欣慰xinwei -新闻xinwen -心细xinxi -信息xinxi -欣喜xinxi -新鲜xinxian -心想xinxiang -信箱xinxiang -馨香xinxiang -信心xinxin -新型xinxing -新星xinxing -新兴xinxing -心虚xinxu -心血xinxue -信仰xinyang -心意xinyi -新异xinyi -新颖xinying -信用xinyong -新余xinyu -信誉xinyu -心愿xinyuan -心脏xinzang -新址xinzhi -心中xinzhong -雄xiong -胸xiong -兄xiong -凶xiong -熊xiong -匈xiong -汹xiong -芎xiong -雄辩xiongbian -雄兵xiongbing -凶残xiongcan -兄弟xiongdi -凶恶xionge -雄关xiongguan -凶狠xionghen -雄厚xionghou -胸怀xionghuai -雄健xiongjian -胸口xiongkou -熊猫xiongmao -凶猛xiongmeng -匈奴xiongnu -凶器xiongqi -凶杀xiongsha -雄师xiongshi -凶手xiongshou -胸膛xiongtang -雄伟xiongwei -雄心xiongxin -汹涌xiongyong -雄壮xiongzhuang -雄姿xiongzi -西欧xiou -习气xiqi -吸气xiqi -喜气xiqi -稀奇xiqi -希奇xiqi -喜庆xiqing -吸取xiqu -戏曲xiqu -昔日xiri -牺牲xisheng -西式xishi -喜事xishi -稀释xishi -吸收xishou -系数xishu -洗刷xishua -吸吮xishun -习俗xisu -习题xiti -西天xitian -系统xitong -修xiu -锈xiu -休xiu -袖xiu -秀xiu -朽xiu -宿*xiu -臭*xiu -羞xiu -嗅xiu -绣xiu -咻xiu -岫xiu -馐xiu -庥xiu -溴xiu -鸺xiu -貅xiu -髹xiu -修补xiubu -秀才xiucai -羞耻xiuchi -修辞xiuci -修订xiuding -修复xiufu -修改xiugai -修建xiujian -修剪xiujian -嗅觉xiujue -休克xiuke -羞愧xiukui -修理xiuli -秀丽xiuli -秀气xiuqi -羞辱xiuru -羞涩xiuse -修饰xiushi -休息xiuxi -休想xiuxiang -修养xiuyang -休养xiuyang -修造xiuzao -袖章xiuzhang -袖珍xiuzhen -修正xiuzheng -修筑xiuzhu -希望xiwang -席位xiwei -细微xiwei -西文xiwen -檄文xiwen -细小xixiao -细心xixin -悉心xixin -喜讯xixun -吸烟xiyan -西洋xiyang -西医xiyi -吸引xiyin -希有xiyou -戏院xiyuan -喜悦xiyue -西藏xizang -洗澡xizao -细则xize -细致xizhi -习作xizuo -下基层xjc -现阶段xjd -新技术xjs -献计献策xjxc -先见之明xjzm -兴利除弊xlcb -系列化xlh -稀里糊涂xlht -狭路相逢xlxf -畜牧业xmy -心满意足xmyz -西宁市xns -小朋友xpy -向前看xqk -喜气洋洋xqyy -先人后己xrhj -兴师动众xsdz -销售额xse -刑事犯罪xsfz -小时候xsh -新时期xsq -新生事物xssw -形式主义xszy -相提并论xtbl -续xu -许xu -须xu -需xu -序xu -虚xu -絮xu -畜xu -叙xu -蓄xu -绪xu -徐xu -墟xu -戌xu -嘘xu -酗xu -旭xu -恤xu -婿xu -吁*xu -诩xu -勖xu -圩xu -蓿xu -洫xu -浒*xu -溆xu -顼xu -栩xu -煦xu -砉*xu -盱xu -胥xu -糈xu -醑xu -选xuan -旋xuan -宣xuan -悬xuan -玄xuan -券*xuan -轩xuan -喧xuan -癣xuan -眩xuan -绚xuan -儇xuan -谖xuan -萱xuan -揎xuan -泫xuan -渲xuan -漩xuan -璇xuan -楦xuan -暄xuan -炫xuan -煊xuan -碹xuan -铉xuan -镟xuan -痃xuan -悬案xuanan -轩昂xuanang -选拔xuanba -宣布xuanbu -选材xuancai -选场xuanchang -宣称xuancheng -宣传xuanchuan -选定xuanding -宣读xuandu -宣告xuangao -选购xuangou -悬挂xuangua -玄乎xuanhu -喧哗xuanhua -选集xuanji -宣讲xuanjiang -选举xuanju -绚烂xuanlan -绚丽xuanli -选录xuanlu -旋律xuanlu -选民xuanmin -喧闹xuannao -悬念xuannian -选派xuanpai -宣判xuanpan -选配xuanpei -选票xuanpiao -选区xuanqu -选取xuanqu -喧嚷xuanrang -宣誓xuanshi -选手xuanshou -悬殊xuanshu -旋涡xuanwo -玄虚xuanxu -悬崖xuanya -宣言xuanyan -宣扬xuanyang -炫耀xuanyao -选用xuanyong -选择xuanze -宣战xuanzhan -选种xuanzhong -旋转xuanzhuan -许多xuduo -学xue -血xue -削*xue -雪xue -穴xue -靴xue -薛xue -谑xue -噱*xue -泶xue -踅xue -鳕xue -学报xuebao -学部xuebu -学潮xuechao -学费xuefei -学风xuefeng -学府xuefu -血汗xuehan -学好xuehao -学会xuehui -学籍xueji -血迹xueji -学科xueke -血泪xuelei -学历xueli -学龄xueling -学年xuenian -学派xuepai -学期xueqi -血肉xuerou -学生xuesheng -学时xueshi -学识xueshi -学士xueshi -学术xueshu -血书xueshu -学说xueshuo -血统xuetong -学徒xuetu -学位xuewei -学问xuewen -学习xuexi -血洗xuexi -学校xuexiao -血压xueya -学业xueye -血液xueye -学友xueyou -学员xueyuan -学院xueyuan -血晕xueyun -血战xuezhan -学者xuezhe -学制xuezhi -虚构xugou -序号xuhao -蓄积xuji -虚假xujia -叙旧xujiu -许可xuke -序列xulie -绪论xulun -虚名xuming -序幕xumu -畜牧xumu -训xun -旬xun -迅xun -讯xun -寻xun -循xun -巡xun -荤*xun -浚*xun -勋xun -熏xun -询xun -驯xun -殉xun -汛xun -逊xun -巽xun -郇*xun -埙xun -荀xun -蕈xun -薰xun -峋xun -徇xun -獯xun -恂xun -洵xun -浔xun -曛xun -窨*xun -醺xun -鲟xun -巡捕xunbu -巡查xuncha -寻常xunchang -驯服xunfu -殉国xunguo -巡航xunhang -循环xunhuan -巡回xunhui -虚拟xuni -寻机xunji -巡警xunjing -勋爵xunjue -训练xunlian -巡逻xunluo -迅猛xunmeng -寻求xunqiu -逊色xunse -巡视xunshi -徇私xunsi -迅速xunsu -熏陶xuntao -许诺xunuo -讯问xunwen -询问xunwen -寻衅xunxin -循序xunxu -勋章xunzhang -寻找xunzhao -殉职xunzhi -寻址xunzhi -需求xuqiu -序曲xuqu -虚荣xurong -虚弱xuruo -虚设xushe -叙事xushi -虚实xushi -序数xushu -虚数xushu -叙述xushu -叙说xushuo -虚伪xuwei -虚心xuxin -序言xuyan -需要xuyao -须臾xuyu -许愿xuyuan -须知xuzhi -宣武区xwq -信息处理xxcl -循序见进xxjj -辛辛苦苦xxkk -信息量xxl -熙熙攘攘xxrr -小学生xxs -欣欣向荣xxxr -小心翼翼xxyy -下一步xyb -胸有成竹xycz -洗衣机xyj -小意思xys -习以为常xywc -新颖性xyx -兴致勃勃xzbb -新中国xzg -行政区域xzqy -雪中送炭xzst -心中无数xzws -选择性xzx -心中有数xzys -行之有效xzyx -一y -有y -用y -要y -以y -于y -也y -样y -义y -与y -由y -压y -员y -月y -意y -又y -运y -原y -油y -验y -压ya -亚ya -呀ya -牙ya -芽ya -雅ya -蚜ya -鸭ya -匹*ya -押ya -鸦ya -丫ya -崖ya -衙ya -涯ya -哑ya -讶ya -伢ya -垭ya -揠ya -岈ya -迓ya -娅ya -琊ya -桠ya -氩ya -砑ya -睚ya -痖ya -哑巴yaba -牙齿yachi -压倒yadao -压服yafu -牙关yaguan -雅观yaguan -压价yajia -押金yajin -亚军yajun -压力yali -验yan -研yan -严yan -眼yan -言yan -盐yan -演yan -岩yan -沿yan -烟yan -延yan -掩yan -宴yan -炎yan -颜yan -燕yan -衍yan -铅*yan -焉yan -咽yan -阉yan -淹yan -蜒yan -阎yan -奄yan -艳yan -堰yan -厌yan -砚yan -雁yan -唁yan -彦yan -焰yan -谚yan -殷*yan -厣yan -赝yan -剡*yan -俨yan -偃yan -兖yan -谳yan -阽*yan -郾yan -鄢yan -芫*yan -菸yan -崦yan -恹yan -闫yan -阏yan -湮yan -滟yan -妍yan -嫣yan -琰yan -檐yan -晏yan -胭yan -腌*yan -焱yan -罨yan -筵yan -酽yan -魇yan -餍yan -鼹yan -沿岸yanan -严办yanban -掩蔽yanbi -演变yanbian -烟草yancao -延长yanchang -演唱yanchang -严惩yancheng -延迟yanchi -演出yanchu -唁电yandian -严冬yandong -厌恶yane -厌烦yanfan -样yang -养yang -氧yang -扬yang -洋yang -阳yang -羊yang -秧yang -央yang -杨yang -仰yang -殃yang -鸯yang -佯yang -疡yang -痒yang -漾yang -徉yang -怏yang -泱yang -炀yang -烊yang -恙yang -蛘yang -鞅yang -掩盖yangai -样板yangban -样本yangben -洋财yangcai -养成yangcheng -沿革yange -严格yange -阳光yangguang -洋行yanghang -养护yanghu -氧化yanghua -养料yangliao -杨柳yangliu -仰面yangmian -殃民yangmin -仰慕yangmu -样品yangpin -洋气yangqi -扬弃yangqi -央求yangqiu -养伤yangshang -样式yangshi -阳台yangtai -眼光yanguang -仰望yangwang -洋务yangwu -洋相yangxiang -扬言yangyan -样样yangyang -洋溢yangyi -养育yangyu -养殖yangzhi -样子yangzi -沿海yanhai -严寒yanhan -眼红yanhong -咽喉yanhou -掩护yanhu -眼花yanhua -延缓yanhuan -宴会yanhui -焰火yanhuo -演讲yanjiang -眼界yanjie -严禁yanjin -严谨yanjin -眼镜yanjing -眼睛yanjing -研究yanjiu -严峻yanjun -眼看yankan -严酷yanku -眼眶yankuang -眼泪yanlei -眼力yanli -严厉yanli -艳丽yanli -眼帘yanlian -眼亮yanliang -言路yanlu -沿路yanlu -言论yanlun -掩埋yanmai -严密yanmi -严明yanming -烟幕yanmu -延年yannian -延期yanqi -眼前yanqian -宴请yanqing -俨然yanran -炎热yanre -眼色yanse -颜色yanse -延伸yanshen -岩石yanshi -演示yanshi -掩饰yanshi -验收yanshou -严守yanshou -延寿yanshou -演说yanshuo -严肃yansu -演算yansuan -言谈yantan -研讨yantao -沿途yantu -阎王yanwang -延误yanwu -烟雾yanwu -宴席yanxi -筵席yanxi -演习yanxi -沿袭yanxi -眼下yanxia -沿线yanxian -言行yanxing -严刑yanxing -延续yanxu -艳阳yanyang -演义yanyi -演绎yanyi -掩映yanying -沿用yanyong -言语yanyu -演员yanyuan -厌战yanzhan -沿着yanzhe -验证yanzheng -研制yanzhi -严重yanzhong -演奏yanzou -要yao -药yao -约*yao -摇yao -腰yao -咬yao -邀yao -耀yao -陶*yao -侥*yao -疟yao -妖yao -瑶yao -尧yao -遥yao -窑yao -谣yao -姚yao -舀yao -钥*yao -夭yao -爻yao -吆yao -崾yao -徭yao -幺yao -珧yao -杳yao -轺yao -曜yao -肴yao -铫*yao -鹞yao -窈yao -繇yao -鳐yao -摇摆yaobai -腰包yaobao -要不yaobu -谣传yaochuan -要得yaode -要点yaodian -摇动yaodong -窑洞yaodong -遥感yaogan -妖怪yaoguai -要害yaohai -摇撼yaohan -摇晃yaohuang -要件yaojian -要紧yaojin -摇控yaokong -遥控yaokong -摇篮yaolan -要领yaoling -要么yaome -妖魔yaomo -要目yaomu -邀请yaoqing -要求yaoqiu -要塞yaosai -要是yaoshi -钥匙yaoshi -要素yaosu -窈窕yaotiao -摇头yaotou -要闻yaowen -药物yaowu -要挟yaoxie -耀眼yaoyan -谣言yaoyan -妖艳yaoyan -夭折yaozhe -要职yaozhi -鸦片yapian -压迫yapo -压强yaqiang -压缩yasuo -雅兴yaxing -压仰yayang -压抑yayi -压榨yazha -压制yazhi -雅致yazhi -亚洲yazhou -鸭子yazi -雅座yazuo -要不得ybd -一般的说ybds -一部分ybf -要不然ybr -要不是ybs -一般说来ybsl -要不要yby -一辈子ybz -一把抓ybz -用不着ybz -扬长避短ycbd -由此可见yckj -银川市ycs -与此同时ycts -有偿转让yczr -邮电部ydb -有道德ydd -邮电局ydj -一刀切ydq -运动员ydy -印度洋ydy -因地制宜ydzy -也ye -业ye -页ye -叶ye -液ye -夜ye -野ye -爷ye -冶ye -邪*ye -哗*ye -咽*ye -椰ye -噎ye -耶ye -掖ye -曳ye -腋ye -拽*ye -靥ye -谒ye -邺ye -揶ye -晔ye -烨ye -铘ye -夜餐yecan -野餐yecan -野火yehuo -业绩yeji -夜间yejian -冶金yejin -夜里yeli -冶练yelian -野蛮yeman -夜幕yemu -夜色yese -也是yeshi -夜市yeshi -野兽yeshou -液体yeti -野外yewai -夜晚yewan -业务yewu -夜校yexiao -野心yexin -野性yexing -也许yexu -幼儿园yey -爷爷yeye -野营yeying -业余yeyu -野战yezhan -叶子yezi -一方面yfm -一分为二yfwe -阳奉阴违yfyw -一概而论ygel -一国两制yglz -有根有据ygyj -严格要求ygyq -有何特长yhtc -银行帐号yhzh -炎黄子孙yhzs -一yi -以yi -义yi -意yi -已yi -移yi -医yi -议yi -依yi -易yi -乙yi -艺yi -益yi -异yi -宜yi -仪yi -亿yi -遗yi -伊yi -役yi -衣yi -疑yi -亦yi -谊yi -翼yi -译yi -抑yi -忆yi -疫yi -壹yi -揖yi -铱yi -颐yi -夷yi -胰yi -沂yi -姨yi -彝yi -椅yi -蚁yi -倚yi -矣yi -邑yi -屹yi -臆yi -逸yi -肄yi -裔yi -毅yi -溢yi -诣yi -翌yi -绎yi -刈yi -劓yi -仡*yi -佚yi -佾yi -诒yi -圯yi -埸yi -懿yi -苡yi -荑yi -薏yi -弈yi -奕yi -挹yi -弋yi -呓yi -咦yi -咿yi -嗌*yi -噫yi -峄yi -嶷yi -猗yi -饴yi -怿yi -怡yi -悒yi -漪yi -迤yi -驿yi -缢yi -殪yi -轶yi -贻yi -欹*yi -旖yi -熠yi -眙yi -钇yi -镒yi -镱yi -痍yi -瘗yi -癔yi -翊yi -蜴yi -舣yi -羿yi -翳yi -酏yi -黟yi -议案yian -疑案yian -一半yiban -一般yiban -一斑yiban -一边yibian -以便yibian -仪表yibiao -一并yibing -异步yibu -遗产yichan -异常yichang -议程yicheng -益处yichu -遗传yichuan -一次yici -依次yici -依从yicong -一代yidai -一带yidai -一旦yidan -一点yidian -一定yiding -议定yiding -移动yidong -一度yidu -遗毒yidu -一端yiduan -臆断yiduan -亿吨yidun -一发yifa -依法yifa -义愤yifen -衣服yifu -依附yifu -一概yigai -一个yige -一共yigong -议购yigou -已故yigu -一贯yiguan -异国yiguo -遗憾yihan -遗恨yihen -以后yihou -异化yihua -议会yihui -疑惑yihuo -以及yiji -异己yiji -遗迹yiji -议价yijia -意见yijian -移交yijiao -一届yijie -一经yijing -已经yijing -意境yijing -依旧yijiu -一举yiju -依据yiju -移居yiju -议决yijue -依靠yikao -倚靠yikao -一刻yike -医科yike -一块yikuai -以来yilai -依赖yilai -一览yilan -一例yili -毅力yili -屹立yili -一连yilian -意料yiliao -医疗yiliao -遗留yiliu -遗漏yilou -一律yilu -疑虑yilu -议论yilun -一面yimian -以免yimian -疫苗yimiao -移民yimin -因yin -引yin -阴yin -印yin -音yin -银yin -烟*yin -隐yin -饮yin -荫yin -茵yin -殷yin -姻yin -吟yin -淫yin -寅yin -尹yin -胤yin -鄞yin -圻*yin -垠yin -堙yin -茚yin -吲yin -喑yin -狺yin -夤yin -洇yin -湮*yin -氤yin -铟yin -瘾yin -窨yin -蚓yin -霪yin -龈yin -疑难yinan -阴暗yinan -隐蔽yinbi -音标yinbiao -隐藏yincang -阴沉yinchen -银川yinchuan -因此yinci -引导yindao -音调yindiao -印度yindu -引渡yindu -以内yinei -因而yiner -印发yinfa -音符yinfu -应ying -影ying -硬ying -营ying -英ying -映ying -迎ying -樱ying -婴ying -鹰ying -缨ying -莹ying -萤ying -荧ying -蝇ying -赢ying -盈ying -颖ying -嬴ying -郢ying -茔ying -荥*ying -莺ying -萦ying -蓥ying -撄ying -嘤ying -膺ying -滢ying -潆ying -瀛ying -瑛ying -璎ying -楹ying -媵ying -鹦ying -瘿ying -颍ying -罂ying -英镑yingbang -硬币yingbi -应变yingbian -映衬yingchen -应酬yingchou -迎春yingchun -应当yingdang -赢得yingde -婴儿yinger -营房yingfang -迎风yingfeng -应付yingfu -应该yinggai -英国yingguo -樱花yinghua -英魂yinghun -应急yingji -硬件yingjian -迎接yingjie -应届yingjie -英杰yingjie -营救yingjiu -英俊yingjun -盈亏yingkui -赢利yingli -盈利yingli -英烈yinglie -迎面yingmian -英明yingming -硬盘yingpan -影片yingpian -硬拼yingpin -影射yingshe -映射yingshe -樱桃yingtao -迎头yingtou -因果yinguo -影响yingxiang -硬性yingxing -英雄yingxiong -营养yingyang -应邀yingyao -营业yingye -应用yingyong -英勇yingyong -应有yingyou -英语yingyu -盈余yingyu -营造yingzao -应战yingzhan -迎战yingzhan -映照yingzhao -应征yingzheng -影子yingzi -英姿yingzi -银行yinhang -引号yinhao -殷红yinhong -隐患yinhuan -淫秽yinhui -阴魂yinhun -意念yinian -姨娘yiniang -阴极yinji -印鉴yinjian -引进yinjin -引力yinli -阴历yinli -阴凉yinliang -引路yinlu -隐瞒yinman -阴谋yinmou -银幕yinmu -隐慝yinni -银牌yinpai -引起yinqi -殷切yinqie -殷勤yinqin -引擎yinqing -引人yinren -饮食yinshi -印刷yinshua -饮水yinshui -因素yinsu -阴天yintian -引退yintui -因为yinwei -淫威yinwei -阴险yinxian -印象yinxiang -音响yinxiang -音信yinxin -因循yinxun -引言yinyan -阴影yinying -引用yinyong -引诱yinyou -阴雨yinyu -姻缘yinyuan -隐约yinyue -音乐yinyue -引证yinzheng -印证yinzheng -一片yipian -一瞥yipie -一起yiqi -一齐yiqi -义气yiqi -意气yiqi -仪器yiqi -遗弃yiqi -以前yiqian -一切yiqie -依然yiran -亦然yiran -毅然yiran -艺人yiren -宜人yiren -遗容yirong -以上yishang -一生yisheng -医生yisheng -一时yishi -一事yishi -意识yishi -议事yishi -逸事yishi -仪式yishi -医师yishi -医士yishi -遗失yishi -一手yishou -遗书yishu -艺术yishu -意思yisi -一体yiti -议题yiti -遗体yiti -一天yitian -一同yitong -异同yitong -一头yitou -意图yitu -疑团yituan -以外yiwai -意外yiwai -亿万yiwan -以往yiwang -遗忘yiwang -以为yiwei -意味yiwei -意文yiwen -疑问yiwen -译文yiwen -一无yiwu -义务yiwu -遗物yiwu -医务yiwu -贻误yiwu -一下yixia -以下yixia -一线yixian -一向yixiang -一项yixiang -意向yixiang -遗像yixiang -一些yixie -一心yixin -疑心yixin -异性yixing -医学yixue -一言yiyan -义演yiyan -遗言yiyan -一样yiyang -医药yiyao -意义yiyi -异议yiyi -义勇yiyong -易于yiyu -议员yiyuan -意愿yiyuan -医院yiyuan -亿元yiyuan -遗愿yiyuan -疑云yiyun -一再yizai -一早yizao -臆造yizao -依仗yizhang -仪仗yizhang -一朝yizhao -衣着yizhao -依照yizhao -一阵yizhen -一直yizhi -一致yizhi -以至yizhi -以致yizhi -意志yizhi -抑制yizhi -医治yizhi -抑止yizhi -移植yizhi -遗址yizhi -一种yizhong -遗嘱yizhu -研究会yjh -有纪律yjl -研究生yjs -研究所yjs -研究室yjs -养精畜锐yjxr -研究员yjy -拥军优属yjys -一技之长yjzc -一口气ykq -一览表ylb -以理服人ylfr -阅览室yls -有理想ylx -有利于yly -越来越yly -有目共睹ymgd -一目了然ymlr -有没有ymy -云南省yns -育*yo -哟yo -唷yo -用yong -勇yong -永yong -拥yong -涌yong -蛹yong -庸yong -佣yong -臃yong -痈yong -雍yong -踊yong -咏yong -泳yong -恿yong -俑yong -壅yong -墉yong -喁yong -慵yong -邕yong -镛yong -甬yong -鳙yong -饔yong -拥抱yongbao -永别yongbie -永不yongbu -用处yongchu -用度yongdu -用法yongfa -用费yongfei -勇敢yonggan -用功yonggong -永恒yongheng -用户yonghu -拥护yonghu -拥挤yongji -永久yongjiu -用具yongju -永诀yongjue -用力yongli -庸碌yonglu -勇猛yongmeng -用品yongpin -勇气yongqi -勇士yongshi -庸俗yongsu -咏叹yongtan -用途yongtu -涌现yongxian -用心yongxin -用意yongyi -拥有yongyou -用于yongyu -勇于yongyu -永远yongyuan -踊跃yongyue -有you -由you -又you -油you -右you -友you -优you -幼you -游you -尤you -诱you -犹you -幽you -悠you -忧you -邮you -铀you -酉you -佑you -釉you -卣you -攸you -侑you -莠you -莜you -莸you -尢*you -呦you -囿you -宥you -柚you -猷you -牖you -铕you -疣you -蚰you -蚴you -蝣you -蝤*you -繇*you -鱿you -黝you -鼬you -有碍youai -友爱youai -幽暗youan -友邦youbang -右边youbian -忧愁youchou -由此youci -有错youcuo -有待youdai -优待youdai -诱导youdao -有的youde -优等youdeng -有点youdian -邮电youdian -优点youdian -诱发youfa -有功yougong -有关youguan -有害youhai -友好youhao -优化youhua -油画youhua -幽会youhui -优惠youhui -诱惑youhuo -有机youji -游击youji -有劲youjin -幽静youjing -悠久youjiu -邮局youju -由来youlai -游览youlan -有劳youlao -有利youli -有力youli -游离youli -优良youliang -优劣youlie -幽灵youling -忧虑youlu -优美youmei -幼苗youmiao -有名youming -幽默youmo -右派youpai -诱骗youpian -邮票youpiao -尤其youqi -油漆youqi -友情youqing -右倾youqing -有趣youqu -油然youran -犹如youru -有色youse -优胜yousheng -有时youshi -有事youshi -有失youshi -优势youshi -有数youshu -油水youshui -有所yousuo -有望youwang -有为youwei -游戏youxi -有限youxian -优先youxian -悠闲youxian -有效youxiao -幼小youxiao -有些youxie -有心youxin -游行youxing -优秀youxiu -幽雅youya -悠扬youyang -又要youyao -有益youyi -优异youyi -友谊youyi -有用youyong -游泳youyong -有余youyu -由于youyu -犹豫youyu -忧郁youyu -悠远youyuan -优越youyue -有着youzhe -邮政youzheng -优质youzhi -幼稚youzhi -由衷youzhong -邮资youzi -有求必应yqby -以权谋私yqms -有气无力yqwl -迎刃而解yrej -因人而异yrey -与人为善yrws -引人注目yrzm -意识到ysd -艺术家ysj -因势利导ysld -印刷体yst -意识形态ysxt -衣食住行yszx -以身作则yszz -研讨会yth -一条龙ytl -一条心ytx -有条有理ytyl -于yu -与yu -育yu -鱼yu -雨yu -玉yu -余yu -遇yu -预yu -域yu -语yu -愈yu -渔yu -予yu -羽yu -愚yu -御yu -谷*yu -欲yu -宇yu -蔚*yu -尉*yu -迂yu -淤yu -盂yu -榆yu -虞yu -舆yu -俞yu -逾yu -愉yu -渝yu -隅yu -娱yu -屿yu -禹yu -芋yu -郁yu -吁yu -喻yu -峪yu -狱yu -誉yu -浴yu -寓yu -裕yu -豫yu -驭yu -粥*yu -禺yu -毓yu -伛yu -俣yu -谀yu -谕yu -萸yu -菀*yu -蓣yu -揄yu -圄yu -圉yu -嵛yu -狳yu -饫yu -馀yu -庾yu -阈yu -鬻yu -妪yu -妤yu -纡yu -瑜yu -昱yu -觎yu -腴yu -腧*yu -欤yu -於yu -煜yu -熨yu -燠yu -聿yu -钰yu -鹆yu -鹬yu -瘐yu -瘀yu -窬yu -窳yu -蜮yu -蝓yu -竽yu -臾yu -舁yu -雩yu -龉yu -员yuan -原yuan -圆yuan -源yuan -元yuan -远yuan -愿yuan -院yuan -缘yuan -援yuan -园yuan -怨yuan -鸳yuan -渊yuan -冤yuan -垣yuan -袁yuan -辕yuan -猿yuan -苑yuan -垸yuan -塬yuan -芫yuan -掾yuan -圜*yuan -沅yuan -媛yuan -瑗yuan -橼yuan -爰yuan -眢yuan -鸢yuan -螈yuan -箢yuan -鼋yuan -原本yuanben -渊博yuanbo -冤仇yuanchou -远大yuanda -元旦yuandan -园地yuandi -园丁yuanding -远东yuandong -远方yuanfang -缘分yuanfen -原告yuangao -原故yuangu -缘故yuangu -圆滑yuanhua -原籍yuanji -冤家yuanjia -元件yuanjian -远见yuanjian -远近yuanjin -远景yuanjing -援救yuanjiu -原来yuanlai -原理yuanli -原谅yuanliang -原料yuanliao -远虑yuanlu -圆满yuanman -远谋yuanmou -远期yuanqi -冤屈yuanqu -源泉yuanquan -原始yuanshi -远视yuanshi -元首yuanshou -元帅yuanshuai -元素yuansu -援外yuanwai -愿望yuanwang -冤枉yuanwang -原先yuanxian -远销yuanxiao -元宵yuanxiao -院校yuanxiao -原形yuanxing -怨言yuanyan -原野yuanye -愿意yuanyi -园艺yuanyi -原因yuanyin -援引yuanyin -原有yuanyou -缘由yuanyou -远游yuanyou -远远yuanyuan -渊源yuanyuan -元月yuanyue -原则yuanze -院长yuanzhang -远征yuanzheng -援助yuanzhu -原子yuanzi -院子yuanzi -预报yubao -预备yubei -愚笨yuben -余步yubu -预测yuce -愚蠢yuchun -遇到yudao -预定yuding -预订yuding -余毒yudu -月yue -说*yue -越yue -约yue -乐*yue -跃yue -曰yue -阅yue -钥yue -岳yue -粤yue -悦yue -龠yue -瀹yue -栎*yue -樾yue -刖yue -钺yue -月报yuebao -月初yuechu -月底yuedi -约定yueding -月度yuedu -阅读yuedu -乐队yuedui -约法yuefa -月份yuefen -月光yueguang -越轨yuegui -约会yuehui -越界yuejie -跃进yuejin -越境yuejing -阅览yuelan -阅历yueli -月亮yueliang -月末yuemo -约莫yuemo -越南yuenan -乐谱yuepu -乐器yueqi -月球yueqiu -乐曲yuequ -月色yuese -越是yueshi -约束yueshu -月台yuetai -乐团yuetuan -约有yueyou -乐章yuezhang -预防yufang -预风yufeng -预付yufu -预感yugan -预告yugao -预购yugou -遇害yuhai -宇航yuhang -与会yuhui -迂回yuhui -雨季yuji -预计yuji -遇见yujian -预见yujian -语句yuju -豫剧yuju -愉快yukuai -娱乐yule -鱼雷yulei -预料yuliao -雨露yulu -舆论yulun -愚昧yumei -育苗yumiao -预谋yumou -运yun -员*yun -云yun -匀yun -均*yun -允yun -孕yun -耘yun -郧yun -陨yun -蕴yun -酝yun -晕yun -韵yun -郓yun -芸yun -狁yun -恽yun -愠yun -纭yun -韫yun -殒yun -昀yun -氲yun -熨yun -遇难yunan -云彩yuncai -蕴藏yuncang -匀称yuncheng -运动yundong -熨斗yundou -云海yunhai -运河yunhe -韵律yunlu -陨落yunluo -云南yunnan -酝酿yunnian -允诺yunnuo -愚弄yunong -运气yunqi -运输yunshu -运算yunsuan -云梯yunti -运往yunwang -韵味yunwei -云雾yunwu -云霞yunxia -运行yunxing -允许yunxu -运用yunyong -孕育yunyu -运载yunzai -运转yunzhuan -与其yuqi -语气yuqi -预期yuqi -预审yushen -于是yushi -预示yushi -预售yushou -雨水yushui -预算yusuan -欲望yuwang -语文yuwen -预习yuxi -预先yuxian -遇险yuxian -预想yuxiang -预言yuyan -语言yuyan -寓言yuyan -预演yuyan -予以yuyi -寓于yuyu -愉悦yuyue -预兆yuzhao -预支yuzhi -宇宙yuzhou -有文化ywh -业务联系ywlx -意味着ywz -有限公司yxgs -一系列yxl -有效期yxq -医学院yxy -一心一意yxyy -游泳池yyc -营业额yye -夜以继日yyjr -应用科学yykx -一言堂yyt -引以为戒yywj -优越性yyx -营业员yyy -隐隐约约yyyy -运用自如yyzr -拥政爱民yzam -原子能yzn -已知数yzs -有助于yzy -言之有理yzyl -在z -这z -主z -中z -种z -着z -争z -战z -作z -正z -之z -制z -重z -组z -治z -只z -子z -自z -质z -指z -杂za -扎*za -咱za -匝za -砸za -咋za -咂za -在zai -再zai -载zai -栽zai -灾zai -仔*zai -哉zai -宰zai -崽zai -甾zai -再版zaiban -再不zaibu -在场zaichang -再度zaidu -宰割zaige -灾害zaihai -再好zaihao -在乎zaihu -灾荒zaihuang -再会zaihui -灾祸zaihuo -再见zaijian -在理zaili -灾民zaimin -灾难zainan -栽培zaipei -再起zaiqi -灾情zaiqing -灾区zaiqu -再三zaisan -在世zaishi -再说zaishuo -载体zaiti -在下zaixia -再现zaixian -宰相zaixiang -在意zaiyi -在于zaiyu -再造zaizao -再则zaize -在职zaizhi -再植zaizhi -杂技zaji -杂粮zaliang -杂乱zaluan -赞zan -咱zan -暂zan -攒zan -拶zan -瓒zan -昝zan -簪zan -糌zan -趱zan -錾zan -赞成zancheng -暂定zanding -藏*zang -脏zang -葬zang -赃zang -奘zang -驵zang -臧zang -赞歌zange -赃款zangkuan -葬送zangsong -赃物zangwu -藏族zangzu -杂念zanian -赞美zanmei -咱们zanmen -暂且zanqie -暂缺zanque -赞赏zanshang -暂时zanshi -赞颂zansong -赞叹zantan -暂停zanting -赞同zantong -暂行zanxing -赞扬zanyang -暂用zanyong -赞助zanzhu -造zao -早zao -遭zao -燥zao -凿zao -糟zao -枣zao -皂zao -藻zao -澡zao -蚤zao -躁zao -噪zao -灶zao -唣zao -早晨zaochen -造成zaocheng -凿穿zaochuan -造次zaoci -造词zaoci -遭到zaodao -早稻zaodao -造反zaofan -早饭zaofan -造福zaofu -糟糕zaogao -造化zaohua -造价zaojia -造就zaojiu -造林zaolin -早年zaonian -糟粕zaopo -早期zaoqi -早日zaori -早上zaoshang -遭受zaoshou -早衰zaoshuai -糟蹋zaota -早晚zaowan -造型zaoxing -遭殃zaoyang -造谣zaoyao -造诣zaoyi -早已zaoyi -噪音zaoyin -遭遇zaoyu -造字zaozi -杂谈zatan -杂文zawen -杂质zazhi -杂志zazhi -资本主义zbzy -资产阶级zcjj -增长率zcl -总参谋部zcmb -真才实学zcsx -自动化zdh -自动检测zdjc -自动检索zdjs -自动控制zdkz -主动权zdq -招待所zds -总的说来zdsl -主动性zdx -则ze -择ze -责ze -侧*ze -泽ze -咋*ze -仄ze -赜ze -啧ze -帻ze -迮ze -昃ze -笮ze -箦ze -舴ze -责备zebei -责成zecheng -责罚zefa -责怪zeguai -贼zei -责令zeling -责骂zema -怎zen -谮zen -增zeng -曾zeng -综*zeng -憎zeng -赠zeng -缯zeng -甑zeng -罾zeng -锃zeng -增补zengbu -增产zengchan -增长zengchang -增大zengda -增订zengding -增多zengduo -增高zenggao -憎恨zenghen -增加zengjia -增减zengjian -增进zengjin -增量zengliang -赠品zengpin -增强zengqiang -增删zengshan -增设zengshe -赠送zengsong -增添zengtian -赠言zengyan -增益zengyi -增援zengyuan -怎么zenme -怎奈zennai -怎样zenyang -责任zeren -责问zewen -总而言之zeyz -争分夺秒zfdm -针锋相对zfxd -自负盈亏zfyk -中关村zgc -自告奋勇zgfy -中国共产党zggd -总工会zgh -中国特色的zgtd -中国银行zgyh -自古以来zgyl -中国政府zgzf -中共中央zgzy -查*zha -扎zha -炸zha -闸zha -铡zha -轧zha -渣zha -蜡*zha -喳zha -札zha -眨zha -栅zha -榨zha -咋*zha -乍zha -诈zha -柞*zha -揸zha -吒zha -咤zha -哳zha -喋*zha -楂*zha -砟zha -痄zha -蚱zha -齄zha -炸弹zhadan -扎根zhagen -炸毁zhahui -寨zhai -侧*zhai -择*zhai -摘zhai -窄zhai -斋zhai -翟*zhai -祭*zhai -宅zhai -债zhai -砦zhai -瘵zhai -摘录zhailu -债权zhaiquan -债务zhaiwu -窄小zhaixiao -摘要zhaiyao -札记zhaji -战zhan -展zhan -站zhan -占zhan -粘*zhan -颤*zhan -瞻zhan -毡zhan -詹zhan -沾zhan -盏zhan -斩zhan -辗zhan -崭zhan -蘸zhan -栈zhan -湛zhan -绽zhan -谵zhan -搌zhan -旃zhan -战败zhanbai -战报zhanbao -战备zhanbei -战场zhanchang -展翅zhanchi -展出zhanchu -战地zhandi -战斗zhandou -战犯zhanfan -长*zhang -张zhang -章zhang -掌zhang -仗zhang -障zhang -胀zhang -涨zhang -账zhang -樟zhang -彰zhang -漳zhang -杖zhang -丈zhang -帐zhang -瘴zhang -仉zhang -鄣zhang -幛zhang -嶂zhang -獐zhang -嫜zhang -璋zhang -蟑zhang -障碍zhangai -站岗zhangang -长辈zhangbei -章程zhangcheng -长大zhangda -战歌zhange -章法zhangfa -帐房zhangfang -丈夫zhangfu -掌管zhangguan -帐号zhanghao -章节zhangjie -帐目zhangmu -战功zhangong -掌权zhangquan -张贴zhangtie -战鼓zhangu -沾光zhanguang -战国zhanguo -战果zhanguo -张望zhangwang -掌握zhangwo -张扬zhangyang -战壕zhanhao -战后zhanhou -战机zhanji -战绩zhanji -战局zhanju -占据zhanju -展开zhankai -战况zhankuang -展览zhanlan -占领zhanling -战略zhanlue -战马zhanma -展品zhanpin -战区zhanqu -沾染zhanran -战胜zhansheng -战时zhanshi -战事zhanshi -战士zhanshi -展示zhanshi -战术zhanshu -展望zhanwang -战线zhanxian -展现zhanxian -展销zhanxiao -崭新zhanxin -瞻仰zhanyang -战役zhanyi -占用zhanyong -占有zhanyou -战友zhanyou -站长zhanzhang -战争zhanzheng -着*zhao -照zhao -找zhao -招zhao -朝*zhao -召zhao -赵zhao -爪zhao -罩zhao -沼zhao -兆zhao -嘲*zhao -昭zhao -肇zhao -诏zhao -啁*zhao -棹zhao -钊zhao -笊zhao -照办zhaoban -照搬zhaoban -招标zhaobiao -照常zhaochang -照抄zhaochao -招待zhaodai -照发zhaofa -招工zhaogong -照顾zhaogu -招呼zhaohu -召唤zhaohuan -照会zhaohui -着急zhaoji -招集zhaoji -召集zhaoji -招架zhaojia -召开zhaokai -招考zhaokao -招揽zhaolan -着力zhaoli -照例zhaoli -照料zhaoliao -着落zhaoluo -着迷zhaomi -照明zhaoming -招聘zhaopin -朝气zhaoqi -招惹zhaore -照射zhaoshe -招生zhaosheng -着手zhaoshou -招手zhaoshou -招收zhaoshou -招贴zhaotie -朝夕zhaoxi -朝霞zhaoxia -着想zhaoxiang -照相zhaoxiang -昭雪zhaoxue -找寻zhaoxun -着眼zhaoyan -照样zhaoyang -照耀zhaoyao -照应zhaoying -招展zhaozhan -招致zhaozhi -着重zhaozhong -照着zhaozhuo -诈骗zhapian -榨取zhaqu -诈取zhaqu -扎实zhashi -炸药zhayao -渣滓zhazi -这zhe -着zhe -者zhe -折zhe -哲zhe -浙zhe -遮zhe -蛰zhe -辙zhe -锗zhe -蔗zhe -谪zhe -摺zhe -柘zhe -辄zhe -磔zhe -鹧zhe -褶zhe -蜇zhe -赭zhe -这般zheban -这边zhebian -这次zheci -遮挡zhedang -这点zhedian -折叠zhedie -折服zhefu -遮盖zhegai -这个zhege -折合zhehe -浙江zhejiang -折旧zhejiu -折扣zhekou -这里zheli -哲理zheli -这么zheme -折磨zhemo -真zhen -针zhen -阵zhen -镇zhen -振zhen -震zhen -珍zhen -诊zhen -斟zhen -甄zhen -砧zhen -臻zhen -贞zhen -侦zhen -枕zhen -疹zhen -圳zhen -蓁zhen -浈zhen -溱*zhen -缜zhen -桢zhen -椹*zhen -榛zhen -轸zhen -赈zhen -胗zhen -朕zhen -祯zhen -畛zhen -稹zhen -鸩zhen -箴zhen -珍爱zhenai -珍宝zhenbao -针砭zhenbian -珍藏zhencang -贞操zhencao -侦察zhencha -真诚zhencheng -震荡zhendang -阵地zhendi -真谛zhendi -震动zhendong -诊断zhenduan -针对zhendui -振奋zhenfen -争zheng -正zheng -政zheng -整zheng -证zheng -征zheng -蒸zheng -症zheng -丁*zheng -郑zheng -挣zheng -睁zheng -狰zheng -怔zheng -拯zheng -帧zheng -诤zheng -峥zheng -徵zheng -钲zheng -铮zheng -筝zheng -争霸zhengba -整备zhengbei -正比zhengbi -政变zhengbian -争辩zhengbian -整编zhengbian -征兵zhengbing -政策zhengce -正常zhengchang -争吵zhengchao -征程zhengcheng -争持zhengchi -正大zhengda -正当zhengdang -政党zhengdang -整党zhengdang -正道zhengdao -争端zhengduan -整顿zhengdun -争夺zhengduo -蒸发zhengfa -政法zhengfa -正反zhengfan -整风zhengfeng -政府zhengfu -征服zhengfu -整改zhenggai -整个zhengge -征购zhenggou -争光zhengguang -正规zhenggui -正轨zhenggui -正好zhenghao -政绩zhengji -征集zhengji -证件zhengjian -政见zhengjian -整洁zhengjie -政局zhengju -证据zhengju -正理zhengli -整理zhengli -正梁zhengliang -政令zhengling -争论zhenglun -政论zhenglun -正面zhengmian -争鸣zhengming -证明zhengming -正派zhengpai -征聘zhengpin -争气zhengqi -正气zhengqi -蒸气zhengqi -整齐zhengqi -正巧zhengqiao -征求zhengqiu -争取zhengqu -政权zhengquan -正确zhengque -证人zhengren -正是zhengshi -正式zhengshi -正视zhengshi -证实zhengshi -征收zhengshou -整数zhengshu -证书zhengshu -征税zhengshui -整套zhengtao -正题zhengti -政体zhengti -整体zhengti -整天zhengtian -征调zhengtiao -正统zhengtong -征途zhengtu -珍贵zhengui -政委zhengwei -正文zhengwen -征文zhengwen -政务zhengwu -争先zhengxian -政协zhengxie -整形zhengxing -整修zhengxiu -征询zhengxun -争艳zhengyan -正业zhengye -正义zhengyi -争议zhengyi -征用zhengyong -正月zhengyue -正在zhengzai -挣扎zhengzha -整整zhengzheng -正直zhengzhi -政治zhengzhi -争执zhengzhi -正中zhengzhong -郑重zhengzhong -郑州zhengzhou -症状zhengzhuang -正宗zhengzong -震撼zhenhan -侦缉zhenji -真假zhenjia -阵脚zhenjiao -贞节zhenjie -贞洁zhenjie -镇静zhenjing -震惊zhenjing -真空zhenkong -真理zhenli -诊疗zhenliao -珍品zhenpin -珍奇zhenqi -真切zhenqie -真情zhenqing -真确zhenque -真人zhenren -阵容zhenrong -真是zhenshi -真实zhenshi -阵势zhenshi -珍视zhenshi -侦探zhentan -阵亡zhenwang -珍惜zhenxi -阵线zhenxian -真相zhenxiang -振兴zhenxing -镇压zhenya -阵阵zhenzhen -真正zhenzheng -真知zhenzhi -真挚zhenzhi -珍重zhenzhong -珍珠zhenzhu -斟酌zhenzhuo -振作zhenzuo -这是zheshi -这时zheshi -折腾zheteng -这些zhexie -哲学zhexue -遮掩zheyan -这样zheyang -这种zhezhong -折中zhezhong -之zhi -制zhi -治zhi -只zhi -质zhi -指zhi -直zhi -支zhi -织zhi -止zhi -至zhi -置zhi -志zhi -值zhi -知zhi -识*zhi -执zhi -职zhi -植zhi -纸zhi -致zhi -枝zhi -殖zhi -脂zhi -智zhi -氏*zhi -肢zhi -秩zhi -址zhi -滞zhi -汁zhi -芝zhi -吱zhi -蜘zhi -侄zhi -趾zhi -旨zhi -挚zhi -掷zhi -帜zhi -峙zhi -稚zhi -炙zhi -痔zhi -窒zhi -卮zhi -陟zhi -郅zhi -埴zhi -芷zhi -摭zhi -帙zhi -徵*zhi -忮zhi -彘zhi -咫zhi -骘zhi -栉zhi -枳zhi -栀zhi -桎zhi -轵zhi -轾zhi -贽zhi -胝zhi -膣zhi -祉zhi -祗zhi -黹zhi -雉zhi -鸷zhi -痣zhi -蛭zhi -絷zhi -酯zhi -跖zhi -踬zhi -踯zhi -豸zhi -觯zhi -治安zhian -值班zhiban -植保zhibao -置备zhibei -质变zhibian -指标zhibiao -职别zhibie -支部zhibu -制裁zhicai -支撑zhicheng -职称zhicheng -支持zhichi -指出zhichu -支出zhichu -至此zhici -值此zhici -直达zhida -只当zhidang -直到zhidao -指导zhidao -知道zhidao -只得zhide -值得zhide -质地zhidi -指点zhidian -制定zhiding -指定zhiding -制订zhiding -制度zhidu -支队zhidui -至多zhiduo -知法zhifa -执法zhifa -制服zhifu -支付zhifu -职工zhigong -只顾zhigu -只管zhiguan -直观zhiguan -治国zhiguo -只好zhihao -之后zhihou -指挥zhihui -智慧zhihui -知己zhiji -指甲zhijia -之间zhijian -只见zhijian -指教zhijiao -直接zhijie -枝节zhijie -至今zhijin -直经zhijing -直径zhijing -止境zhijing -致敬zhijing -知觉zhijue -治理zhili -致力zhili -智力zhili -质量zhiliang -治疗zhiliao -指令zhiling -直流zhiliu -支流zhiliu -殖民zhimin -致命zhiming -指明zhiming -知名zhiming -智谋zhimou -指南zhinan -智囊zhinang -之内zhinei -只能zhineng -职能zhineng -智能zhineng -只怕zhipa -指派zhipai -支配zhipei -支票zhipiao -制品zhipin -志气zhiqi -之前zhiqian -支前zhiqian -值勤zhiqin -执勤zhiqin -知情zhiqing -知青zhiqing -智取zhiqu -志趣zhiqu -知趣zhiqu -职权zhiquan -值日zhiri -治丧zhisang -之上zhishang -直上zhishang -至上zhishang -至少zhishao -制胜zhisheng -之声zhisheng -只是zhishi -指使zhishi -支使zhishi -致使zhishi -知事zhishi -指示zhishi -知识zhishi -指数zhishu -支书zhishu -直属zhishu -植树zhishu -直爽zhishuang -治水zhishui -直说zhishuo -致死zhisi -之外zhiwai -指望zhiwang -职位zhiwei -质问zhiwen -植物zhiwu -职务zhiwu -窒息zhixi -之下zhixia -直线zhixian -指向zhixiang -志向zhixiang -知心zhixin -执行zhixing -只许zhixu -秩序zhixu -直言zhiyan -只要zhiyao -职业zhiye -致意zhiyi -旨意zhiyi -质疑zhiyi -指引zhiyin -知音zhiyin -只有zhiyou -至于zhiyu -置于zhiyu -智育zhiyu -职员zhiyuan -支援zhiyuan -志愿zhiyuan -制约zhiyue -制造zhizao -指责zhize -职责zhize -纸张zhizhang -职掌zhizhang -执照zhizhao -指正zhizheng -执政zhizheng -制止zhizhi -直至zhizhi -之中zhizhong -支助zhizhu -支柱zhizhu -知足zhizu -制作zhizuo -走后门zhm -中华民国zhmg -中华民族zhmz -中zhong -种zhong -重zhong -众zhong -钟zhong -终zhong -忠zhong -肿zhong -仲zhong -盅zhong -衷zhong -冢zhong -忪*zhong -锺zhong -螽zhong -舯zhong -踵zhong -钟爱zhongai -重办zhongban -重兵zhongbing -中部zhongbu -仲裁zhongcai -中层zhongceng -衷肠zhongchang -忠诚zhongcheng -重大zhongda -重担zhongdan -中等zhongdeng -种地zhongdi -重地zhongdi -重点zhongdian -终点zhongdian -中东zhongdong -中断zhongduan -终端zhongduan -中队zhongdui -众多zhongduo -重犯zhongfan -忠告zhonggao -中共zhonggong -中国zhongguo -忠厚zhonghou -中华zhonghua -中级zhongji -终极zhongji -重价zhongjia -中间zhongjian -中坚zhongjian -中奖zhongjiang -终结zhongjie -终究zhongjiu -终久zhongjiu -终局zhongju -中肯zhongken -种类zhonglei -中立zhongli -重量zhongliang -终了zhongliao -中流zhongliu -肿瘤zhongliu -中美zhongmei -众目zhongmu -中年zhongnian -终年zhongnian -中秋zhongqiu -重任zhongren -中日zhongri -终日zhongri -中伤zhongshang -重赏zhongshang -终身zhongshen -终生zhongsheng -重视zhongshi -忠实zhongshi -中枢zhongshu -众说zhongshuo -中苏zhongsu -终天zhongtian -中途zhongtu -重托zhongtuo -中外zhongwai -重围zhongwei -中文zhongwen -中午zhongwu -中西zhongxi -中心zhongxin -忠心zhongxin -衷心zhongxin -中性zhongxing -中学zhongxue -中旬zhongxun -忠言zhongyan -中央zhongyang -中药zhongyao -重要zhongyao -中医zhongyi -重用zhongyong -中庸zhongyong -中游zhongyou -终于zhongyu -忠于zhongyu -忠贞zhongzhen -中止zhongzhi -种植zhongzhi -终止zhongzhi -种种zhongzhong -中专zhongzhuan -种族zhongzu -轴zhou -周zhou -洲zhou -州zhou -皱zhou -骤zhou -舟zhou -诌zhou -粥zhou -肘zhou -帚zhou -咒zhou -宙zhou -昼zhou -荮zhou -啁zhou -妯zhou -纣zhou -绉zhou -胄zhou -碡zhou -籀zhou -繇*zhou -酎zhou -周到zhoudao -咒骂zhouma -周密zhoumi -周末zhoumo -周期zhouqi -周全zhouquan -周围zhouwei -周旋zhouxuan -昼夜zhouye -周折zhouzhe -周知zhouzhi -周转zhouzhuan -总后勤部zhqb -中华人民共和国zhrg -主zhu -注zhu -著zhu -住zhu -助zhu -猪zhu -铸zhu -属*zhu -株zhu -筑zhu -柱zhu -术*zhu -驻zhu -逐zhu -祝zhu -竹zhu -贮zhu -珠zhu -朱zhu -诸zhu -蛛zhu -诛zhu -烛zhu -煮zhu -拄zhu -瞩zhu -嘱zhu -蛀zhu -伫zhu -侏zhu -邾zhu -茱zhu -洙zhu -渚zhu -潴zhu -杼zhu -槠zhu -橥zhu -炷zhu -铢zhu -疰zhu -瘃zhu -褚*zhu -竺zhu -箸zhu -舳zhu -翥zhu -躅zhu -麈zhu -抓zhua -挝*zhua -抓好zhuahao -转*zhuai -曳*zhuai -拽zhuai -抓紧zhuajin -转zhuan -专zhuan -传*zhuan -砖zhuan -撰zhuan -赚zhuan -篆zhuan -啭zhuan -馔zhuan -沌*zhuan -颛zhuan -转变zhuanbian -转播zhuanbo -专长zhuanchang -专程zhuancheng -转达zhuanda -转发zhuanfa -装zhuang -状zhuang -壮zhuang -庄zhuang -撞zhuang -幢*zhuang -桩zhuang -妆zhuang -僮zhuang -奘*zhuang -转告zhuangao -装扮zhuangban -装备zhuangbei -壮大zhuangda -装订zhuangding -壮观zhuangguan -装甲zhuangjia -庄稼zhuangjia -庄嫁zhuangjia -壮举zhuangju -状况zhuangkuang -壮阔zhuangkuo -壮丽zhuangli -壮烈zhuanglie -装配zhuangpei -装饰zhuangshi -状态zhuangtai -装卸zhuangxie -庄严zhuangyan -庄园zhuangyuan -装运zhuangyun -装置zhuangzhi -壮志zhuangzhi -庄重zhuangzhong -转化zhuanhua -转换zhuanhuan -转给zhuanji -专家zhuanjia -专科zhuanke -专利zhuanli -专门zhuanmen -转让zhuanrang -专题zhuanti -转向zhuanxiang -专心zhuanxin -转眼zhuanyan -专业zhuanye -转移zhuanyi -专员zhuanyuan -转载zhuanzai -转折zhuanzhe -转正zhuanzheng -专政zhuanzheng -专制zhuanzhi -专职zhuanzhi -专注zhuanzhu -专著zhuanzhu -主办zhuban -逐步zhubu -贮藏zhucang -注册zhuce -助长zhuchang -主持zhuchi -主次zhuci -主导zhudao -注定zhuding -主动zhudong -主队zhudui -主犯zhufan -住房zhufang -祝福zhufu -嘱咐zhufu -逐个zhuge -主攻zhugong -助工zhugong -主管zhuguan -主观zhuguan -追zhui -锥zhui -椎zhui -赘zhui -坠zhui -缀zhui -惴zhui -骓zhui -缒zhui -追捕zhuibu -追查zhuicha -追悼zhuidao -追赶zhuigan -坠毁zhuihui -追加zhuijia -追究zhuijiu -追求zhuiqiu -追认zhuiren -追溯zhuisu -追随zhuisui -追问zhuiwen -追逐zhuizhu -追踪zhuizong -主机zhuji -主见zhujian -逐渐zhujian -主将zhujiang -主讲zhujiang -主教zhujiao -主角zhujiao -注解zhujie -祝酒zhujiu -主力zhuli -助理zhuli -株连zhulian -主粮zhuliang -主流zhuliu -驻留zhuliu -著名zhuming -主谋zhumou -注目zhumu -瞩目zhumu -准zhun -屯*zhun -谆zhun -肫zhun -窀zhun -准备zhunbei -逐年zhunian -准确zhunque -准绳zhunsheng -准时zhunshi -准许zhunxu -准则zhunze -着*zhuo -著*zhuo -捉zhuo -桌zhuo -缴*zhuo -拙zhuo -卓zhuo -琢zhuo -茁zhuo -酌zhuo -啄zhuo -灼zhuo -浊zhuo -倬zhuo -诼zhuo -擢zhuo -浞zhuo -涿zhuo -濯zhuo -棹*zhuo -焯zhuo -禚zhuo -斫zhuo -镯zhuo -拙劣zhuolie -琢磨zhuomo -捉弄zhuonong -酌情zhuoqing -卓越zhuoyue -茁壮zhuozhuang -主权zhuquan -主人zhuren -主任zhuren -诸如zhuru -注色zhuse -注视zhushi -柱石zhushi -注释zhushi -助手zhushou -主送zhusong -住宿zhusu -珠算zhusuan -主题zhuti -主体zhuti -逐条zhutiao -嘱托zhutuo -诸位zhuwei -主席zhuxi -注销zhuxiao -主要zhuyao -逐一zhuyi -主义zhuyi -主意zhuyi -注意zhuyi -祝愿zhuyuan -逐月zhuyue -主宰zhuzai -铸造zhuzao -驻扎zhuzha -住宅zhuzhai -主张zhuzhang -住址zhuzhi -注重zhuzhong -著作zhuzuo -子zi -自zi -资zi -字zi -紫zi -仔zi -籽zi -姿zi -吱*zi -兹zi -咨zi -滋zi -淄zi -孜zi -滓zi -渍zi -谘zi -茈*zi -呲*zi -嵫zi -姊zi -孳zi -缁zi -梓zi -辎zi -赀zi -恣zi -眦zi -锱zi -秭zi -耔zi -笫zi -粢zi -趑zi -觜zi -訾zi -龇zi -鲻zi -髭zi -自爱ziai -自白zibai -自卑zibei -资本ziben -资产zichan -滋长zichang -自称zicheng -自传zichuan -自从zicong -子弟zidi -字典zidian -自动zidong -自发zifa -自费zifei -自封zifeng -自负zifu -字符zifu -资格zige -字根zigen -自豪zihao -自给ziji -自己ziji -字迹ziji -字节zijie -资金zijin -自救zijiu -自居ziju -自觉zijue -字库ziku -自夸zikua -自理zili -资历zili -资料ziliao -自满ziman -自勉zimian -字母zimu -字幕zimu -子女zinu -自强ziqiang -自然ziran -滋润zirun -自杀zisha -自身zishen -姿势zishi -自述zishu -自私zisi -姿态zitai -字体ziti -字帖zitie -自卫ziwei -滋味ziwei -自问ziwen -自我ziwo -仔细zixi -自信zixin -自修zixiu -自叙zixu -自选zixuan -自学zixue -咨询zixun -滋养ziyang -自由ziyou -自愿ziyuan -资源ziyuan -自找zizhao -自治zizhi -自重zizhong -资助zizhu -自尊zizun -直截了当zjld -浙江省zjs -这就是说zjss -中纪委zjw -再接再厉zjzl -中联部zlb -专利法zlf -质量管理zlgl -自力更生zlgs -展览会zlh -智力开发zlkf -专利权zlq -知名人士zmrs -这么些zmx -这么样zmy -怎么样zmy -总zong -纵zong -宗zong -综zong -棕zong -鬃zong -踪zong -偬zong -枞zong -腙zong -粽zong -总部zongbu -总裁zongcai -总参zongcan -总队zongdui -总额zonge -总纲zonggang -总共zonggong -纵贯zongguan -总和zonghe -综合zonghe -纵横zongheng -总后zonghou -总计zongji -踪迹zongji -宗教zongjiao -总结zongjie -总局zongju -总括zongkuo -总理zongli -总论zonglun -宗派zongpai -纵情zongqing -纵深zongshen -总是zongshi -纵使zongshi -总数zongshu -总算zongsuan -总体zongti -总统zongtong -总务zongwu -踪影zongying -总帐zongzhang -总政zongzheng -总之zongzhi -宗旨zongzhi -走zou -邹zou -奏zou -揍zou -诹zou -陬zou -鄹zou -驺zou -鲰zou -走访zoufang -邹虹zouhong -走私zousi -奏效zouxiao -酌情处理zqcl -中青年zqn -朝气蓬勃zqpb -准确无误zqww -正确性zqx -诸如此类zrcl -责任感zrg -自然界zrj -主人翁zrw -责任心zrx -责任制zrz -再生产zsc -自上而下zsex -知识分子zsfz -这时候zsh -知识化zsh -株式会社zshs -总书记zsj -装饰品zsp -综上所述zsss -之所以zsy -自始至终zszz -众所周知zszz -座谈会zth -组zu -族zu -足zu -阻zu -祖zu -租zu -卒zu -诅zu -俎zu -菹zu -镞zu -阻碍zuai -钻zuan -赚*zuan -纂zuan -攥zuan -缵zuan -躜zuan -钻研zuanyan -组成zucheng -阻挡zudang -组阁zuge -足够zugou -祖国zuguo -组合zuhe -最zui -罪zui -嘴zui -堆*zui -咀*zui -醉zui -蕞zui -最初zuichu -最大zuida -最低zuidi -罪恶zuie -罪犯zuifan -最高zuigao -罪过zuiguo -最好zuihao -最后zuihou -最坏zuihuai -最佳zuijia -最近zuijin -嘴脸zuilian -罪名zuiming -罪孽zuinie -罪人zuiren -最先zuixian -最小zuixiao -最新zuixin -醉心zuixin -罪行zuixing -罪责zuize -罪证zuizheng -最终zuizhong -罪状zuizhuang -阻击zuji -租界zujie -租借zujie -阻拦zulan -阻力zuli -租赁zulin -尊zun -遵zun -撙zun -樽zun -鳟zun -阻挠zunao -遵从zuncong -尊贵zungui -尊敬zunjing -遵守zunshou -遵循zunxun -尊严zunyan -遵照zunzhao -尊重zunzhong -作zuo -做zuo -左zuo -座zuo -坐zuo -昨zuo -撮*zuo -凿*zuo -搓*zuo -琢*zuo -佐zuo -柞zuo -阼zuo -唑zuo -嘬zuo -怍zuo -胙zuo -祚zuo -笮*zuo -作案zuoan -作弊zuobi -左边zuobian -坐标zuobiao -做到zuodao -作法zuofa -做法zuofa -作废zuofei -作风zuofeng -做工zuogong -作怪zuoguai -做好zuohao -作家zuojia -作客zuoke -作乐zuole -作乱zuoluan -坐落zuoluo -左派zuopai -作品zuopin -左倾zuoqing -做人zuoren -昨日zuori -做事zuoshi -坐视zuoshi -座谈zuotan -昨天zuotian -昨晚zuowan -作为zuowei -座位zuowei -坐位zuowei -作文zuowen -作物zuowu -作业zuoye -昨夜zuoye -作用zuoyong -左右zuoyou -作战zuozhan -作者zuozhe -作证zuozheng -作主zuozhu -做主zuozhu -做作zuozuo -足球zuqiu -阻塞zuse -祖师zushi -祖先zuxian -组长zuzhang -组织zuzhi -阻止zuzhi -祖宗zuzong -中外合资zwhz -责无旁贷zwpd -中宣部zxb -自行车zxc -自下而上zxes -忠心耿耿zxgg -展销会zxh -照相机zxj -争先恐后zxkh -中学生zxs -主席团zxt -中小学zxx -自信心zxx -中央办公厅zybt -着眼点zyd -专业对口zydk -中央电视台zydt -中央各部委zygw -专业化zyh -专业户zyh -中央军委zyjw -座右铭zym -中央全会zyqh -中央人民广播电台zyrt -主要人员zyry -专业人员zyry -中央书记处zysc -中央委员会zywh -中央委员zywy -重要性zyx -主要原因zyyy -中央政治局zyzj -专业知识zyzs -中组部zzb -组织部zzb -政治部zzb -政治处zzc -转折点zzd -置之度外zzdw -政治局zzj -自治区zzq -蒸蒸日上zzrs -组织上zzs -郑州市zzs -组织性zzx -自尊心zzx -赵紫阳zzy -总政治部zzzb -喷码pm -优喷yp -科技kj -比洋by -公司gs -有限公司yxgz -股份公司gfgs -企业qy -标准bz -喷码机pmj -电线dx -电缆dl -电线电缆dxdl -电力电缆dldl -绝缘jy -绝缘层jyc -导体dt -导线dx -电力dl -通信tx -控制电缆kzdl -补偿电缆bcdl -屏蔽电缆pbdl -高温电缆gwdl -计算机电缆jsjdl -信号电缆xhdl -同轴电缆tzdl -耐火电缆nhdl -船用电缆cydl -铝合金电缆lhjdl -单股dg -多股dg -连接lj -电路dl -电器dq -型号xh -铜t -铝l -铅包qb -铝包qb -聚氯乙烯jlyx -电磁线dcx -北京市bj -东城区dcq -西城区xcq -崇文区cwq -宣武区xwq -朝阳区zyq -海淀区hdq -丰台区ftq -房山区fsq -通州区tzq -顺义区syq -昌平区cpq -大兴区txq -怀柔区hrq -平谷区pgq -门头沟区mtgq -石景山区sjsq -天津市tjs -和平区hpq -河东区hdq -河西区hxq -南开区nkq -河北区hbq -红桥区hqq -塘沽区tgq -汉沽区hgq -大港区tgq -东丽区dlq -西青区xqq -北辰区bcq -津南区jnq -武清区wqq -宝坻区bdq -河北省hbs -辛集市xjs -藁城市gcs -晋州市jzs -新乐市xls -鹿泉市lqs -唐山市tss -遵化市zhs -安市as -邯郸市hds -武安市was -邢台市xts -南宫市ngs -沙河市shs -保定市bds -涿州市zzs -定州市dzs -安国市ags -承德市cds -沧州市czs -泊头市bts -任丘市rqs -黄骅市hhs -河间市hjs -廊坊市lfs -霸州市bzs -三河市shs -衡水市hss -冀州市jzs -深州市szs -石家庄市sjzs -张家口市zjks -高碑店市gbds -秦皇岛市qhds -山西省sxs -太原市tys -古交市gjs -大同市dts -阳泉市yqs -长治市czs -潞城市lcs -晋城市jcs -高平市gps -朔州市szs -晋中市jzs -介休市jxs -运城市ycs -河津市hjs -永济市sjs -忻州市xzs -原平市yps -临汾市lfs -侯马市hms -霍州市hzs -吕梁市lls -孝义市xys -汾阳市fys -内蒙古自治区nmg -包头市bts -乌海市whs -赤峰市cfs -通辽市tls -根河市ghs -丰镇市fzs -辽宁省LNS -沈阳市sys -新民市xms -大连市dls -庄河市zhs -鞍山市ass -海城市hcs -抚顺市fss -本溪市bxs -丹东市dds -东港市dgs -凤城市fcs -锦州市jzs -凌海市lhs -北宁市bns -营口市yks -盖州市gzs -阜新市fxs -辽阳市lys -灯塔市dts -盘锦市pjs -铁岭市tls -开原市kys -朝阳市zys -凌源市lys -北票市bps -兴城市xcs -大石桥市dsqs -瓦房店市wfds -普兰店市plds -调兵山市dbss -葫芦岛市hlds -吉林省jls -长春市ccs -九台市jts -榆树市yss -德惠市dhs -吉林市jls -舒兰市sls -桦甸市hds -蛟河市jhs -磐石市pss -四平市sps -双辽市sls -辽源市lys -通化市ths -集安市jas -白山市bss -临江市ljs -松原市sys -白城市bcs -大安市das -洮南市tns -延吉市yjs -图们市tms -敦化市ghs -龙井市ljs -珲春市hcs -和龙市hls -公主岭市gzls -梅河口市mhks -黑龙江省hljs -阿城市acs -尚志市szs -双城市scs -五常市wcs -讷河市nhs -鹤岗市hgs -鸡西市jxs -密山市mss -虎林市hls -大庆市dqs -伊春市ycs -铁力市tls -宁安市nas -海林市hls -穆棱市mls -同江市tjs -富锦市fjs -黑河市hhs -北安市bas -绥化市shs -安达市ads -肇东市zds -海伦市hls -七台河市qths -双鸭山市syss -牡丹江市mdjs -佳木斯市jmss -绥芬河市sfhs -哈尔滨市hebs -齐齐哈尔市qqhes -五大连池市wdlcs -上海市shs -黄浦区hpq -卢湾区lwq -徐汇区xhq -长宁区cnq -静安区jaq -普陀区ptq -闸北区zbq -虹口区hkq -杨浦区ypq -宝山区bsq -闵行区mxq -嘉定区jdq -松江区sjq -金山区jsq -青浦区qpq -南汇区nhq -奉贤区fxq -崇明县浦东新区cmxpdxq -江苏省jss -南京市njs -无锡市wxs -江阴市jys -宜兴市yxs -徐州市xzs -邳州市pzs -新沂市xys -常州市czs -金坛市jts -溧阳市lys -苏州市szs -常熟市css -太仓市dcs -昆山市hss -吴江市wjs -南通市nns -如皋市rgs -通州市tzs -海门市hms -启东市qds -淮安市has -盐城市ycs -东台市dts -大丰市dfs -扬州市yzs -高邮市gys -江都市jds -仪征市yzs -镇江市zjs -丹阳市dys -扬中市yzs -句容市jrs -泰州市dzs -泰兴市dxs -姜堰市jys -靖江市jjs -兴化市xhs -宿迁市sqs -连云港市lygs -张家港市zjgs -浙江省zjs -杭州市hzs -建德市jds -富阳市fys -临安市las -宁波市nbx -余姚市yys -慈溪市cxs -奉化市fhs -温州市wzs -瑞安市ras -乐清市lqs -嘉兴市jxs -海宁市hns -平湖市phs -桐乡市txs -湖州市hzs -绍兴市sxs -诸暨市zjs -上虞市sys -嵊州市szs -金华市jhs -兰溪市lxs -义乌市yws -东阳市dys -永康市yks -衢州市qzs -江山市jss -舟山市zss -台州市tzs -临海市lhs -丽水市lss -龙泉市lqs -安徽省ahs -合肥市hfs -芜湖市whs -蚌埠市bbs -淮南市hns -淮北市hbs -铜陵市tls -安庆市aqs -桐城市tcs -黄山市hss -滁州市czs -天长市dcs -明光市mgs -阜阳市fys -界首市jss -宿州市szs -巢湖市chs -六安市las -亳州市hzs -池州市czs -宣城市ycs -宁国市ngs -马鞍山市mass -福建省fjs -福州市fjs -福清市fqs -长乐市cls -厦门市xms -莆田市pts -三明市sms -永安市yas -泉州市qzs -石狮市sss -晋江市jjs -南安市nas -漳州市zzs -龙海市lhs -南平市nps -建瓯市jos -邵武市sws -建阳市jys -龙岩市lys -漳平市zps -宁德市nds -福安市fas -福鼎市fds -武夷山市wyss -江西省jxs -南昌市ncs -乐平市lps -萍乡市pxs -九江市jjs -瑞昌市rcs -新余市xys -鹰潭市yts -贵溪市gxs -赣州市gzs -瑞金市rjs -南康市nks -吉安市jas -宜春市ycs -丰城市fcs -樟树市zss -高安市gas -抚州市fzs -上饶市srs -德兴市dxs -井冈山市jgss -景德镇市jdzs -山东省sds -济南市jns -章丘市zqs -青岛市qds -胶南市jns -胶州市jzs -平度市pds -莱西市lxs -即墨市jms -淄博市zbs -枣庄市zzs -滕州市tzs -烟台市yts -龙口市lks -莱阳市lys -莱州市lzs -招远市zys -蓬莱市pls -栖霞市qxs -海阳市hys -潍坊市wfs -青州市qzs -诸城市zcs -寿光市sgs -安丘市aqs -高密市gms -昌邑市cys -济宁市jns -曲阜市qfs -兖州市yzs -邹城市zcs -泰安市tas -新泰市xts -肥城市fcs -威海市whs -乳山市rss -文登市wds -荣成市rcs -日照市rzs -莱芜市lws -临沂市lys -德州市dzs -乐陵市lls -禹城市ycs -聊城市lcs -临清市lqs -滨州市bzs -菏泽市hzs -河南省hns -郑州市zzs -巩义市gys -新郑市xzs -新密市xms -登封市dfs -荥阳市xys -开封市kfs -洛阳市lys -偃师市yss -汝州市rzs -舞钢市wgs -安阳市ays -林州市lzs -新乡市xxs -卫辉市whs -辉县市hxs -焦作市jzs -沁阳市qys -孟州市mzs -濮阳市pys -许昌市xcs -禹州市yzs -长葛市cgs -漯河市lhs -义马市yms -灵宝市lbs -南阳市nys -邓州市dzs -商丘市sqs -永城市ycs -信阳市xys -周口市zks -项城市dcs -济源市jys -三门峡市smxs -平顶山市pdss -驻马店市zmds -湖北省hbs -武汉市whs -黄石市hss -大冶市dys -十堰市sys -荆州市jzs -洪湖市hhs -石首市sss -松滋市szs -宜昌市ycs -宜都市yds -当阳市dys -枝江市jjs -襄樊市xfs -枣阳市zys -宜城市ycs -鄂州市ezs -荆门市jms -钟祥市zxs -孝感市xgs -应城市ycs -安陆市als -汉川市hcs -黄冈市hgs -麻城市mcs -武穴市wxs -咸宁市xns -赤壁市cbs -随州市szs -广水市gss -仙桃市xts -天门市tms -潜江市qjs -恩施市ess -利川市lcs -丹江口市djks -老河口市lhks -神农架林区snjlq -湖南省hns -长沙市css -浏阳市lys -株洲市zzs -醴陵市lls -湘潭市xts -湘乡市xxs -韶山市sss -衡阳市hys -耒阳市lys -常宁市cns -邵阳市sys -武冈市wgs -岳阳市yys -临湘市lxs -汨罗市mls -常德市cds -津市市jss -益阳市yys -沅江市yjs -郴州市czs -资兴市zxs -永州市yzs -怀化市hhs -洪江市hjs -娄底市lds -涟源市lys -吉首市jss -冷水江市lsjs -张家界市zjjs -广东省gds -广州市gzs -从化市chs -增城市zcs -深圳市szs -珠海市zhs -汕头市sts -韶关市sgs -乐昌市lcs -南雄市nxs -佛山市fss -江门市jms -台山市tss -开平市kps -鹤山市hss -恩平市eps -湛江市zjs -廉江市ljs -雷州市lzs -吴川市wcs -茂名市mms -西昌市xcs -峨眉山市emss -都江堰市djys -攀枝花市pzhs -贵州省gzs -贵阳市gys -清镇市qzs -遵义市zys -赤水市css -仁怀市rhs -安顺市ass -毕节市bjs -兴义市xys -凯里市kls -都匀市dys -福泉市fqs -六盘水市lpss -六枝特区lztq -万山特区wstq -云南省yns -昆明市kms -安宁市ans -曲靖市qjs -宣威市xws -玉溪市yxs -保山市bss -昭通市zts -丽江市ljs -思茅市sms -临沧市lqs -个旧市gjs -开远市kys -景洪市jhs -楚雄市cxs -大理市dls -潞西市lxs -瑞丽市rls -西藏自治区xzzzq -拉萨市lss -陕西省sxs -西安市xas -铜川市tcs -宝鸡市bjs -咸阳市xys -渭南市wns -韩城市hcs -华阴市hys -延安市yas -汉中市azs -榆林市yls -安康市aks -商洛市sls -甘肃省gss -兰州市lzs -金昌市jcs -白银市bys -天水市tss -武威市wws -张掖市zys -平凉市pls -酒泉市jqs -玉门市yms -敦煌市dhs -庆阳市qys -定西市dxs -陇南市lns -临夏市lxs -合作市hzs -嘉峪关市jygs -青海省qhs -西宁市xns -德令哈市dlhs -格尔木市gems -宁夏回族自治区nxhzzzq -银川市ycs -灵武市lws -吴忠市wzs -固原市gys -中卫市zws -石嘴山市szss -青铜峡市qtxs -新疆维吾尔自治区xjwwezzq -喀什市kss -昌吉市cjs -阜康市fks -米泉市mqs -博乐市bls -伊宁市yns -奎屯市kts -塔城市tcs -乌苏市wss -石河子市shzs -阿拉尔市ales -五家渠市wjqs -吐鲁番市tlfs -阿克苏市akss -阿图什市atss -库尔勒市kels -阿勒泰市alts -乌鲁木齐市wlmqs -克拉玛依市klmys -图木舒克市tmsks -香港特别行政区 -中西区zxq -东区dq -观塘区gtq -南区nq -湾仔区wzq -离岛区ldq -葵青区kqq -北区bq -西贡区xgq -沙田区stq -屯门区tmq -大埔区dpq -荃湾区qwq -元朗区ylq -九龙城区jtcq -油尖旺区yjwq -深水埗区ssbq -黄大仙区hdxq -台湾省tws -台北市tbs -高雄市gxs -基隆市jls -台中市tzs -台南市tns -新竹市xzs -嘉义市jys -板桥市bqs -宜兰市yls -竹北市zbs -桃园市tys -苗栗市mls -丰原市fys -彰化市zhs -南投市nts -太保市tbs -斗六市dls -新营市xys -凤山市fss -屏东市pds -台东市tds -花莲市hls -马公市mgs +安a +按a +爱a +阿a +暗a +啊a +埃a +碍a +凹a +奥a +岸a +矮a +案a +俺a +挨a +唉a +昂a +氨a +胺a +哎a +吖a +嗄a +腌a +锕a +安徽省ahs +爱ai +埃ai +碍ai +矮ai +挨ai +唉ai +哎ai +哀ai +皑ai +癌ai +蔼ai +艾ai +隘ai +呆*ai +捱ai +嗳ai +嗌ai +嫒ai +瑷ai +暧ai +砹ai +锿ai +霭ai +安an +按an +暗an +岸an +案an +俺an +氨an +胺an +鞍an +谙an +埯an +揞an +犴an +庵an +桉an +铵an +鹌an +黯an +昂ang +肮ang +盎ang +安徽anhui +凹ao +奥ao +敖ao +熬ao +翱ao +袄ao +傲ao +懊ao +澳ao +嚣*ao +坳ao +拗ao +嗷ao +岙ao +廒ao +遨ao +媪ao +骜ao +獒ao +聱ao +螯ao +鏊ao +鳌ao +鏖ao +不b +部b +本b +表b +把b +变b +比b +并b +别b +百b +报b +保b +病b +北b +被b +步b +边b +八b +办b +布b +把ba +八ba +吧ba +巴ba +拔ba +霸ba +罢ba +爸ba +坝ba +芭ba +捌ba +扒ba +叭ba +笆ba +疤ba +跋ba +靶ba +耙ba +茇ba +菝ba +岜ba +灞ba +钯ba +粑ba +鲅ba +魃ba +百bai +白bai +败bai +摆bai +伯*bai +柏bai +佰bai +拜bai +稗bai +捭bai +掰bai +办ban +半ban +板ban +班ban +般ban +版ban +拌ban +搬ban +斑ban +扳ban +伴ban +颁ban +扮ban +瓣ban +绊ban +阪ban +坂ban +钣ban +瘢ban +癍ban +舨ban +帮bang +棒bang +邦bang +榜bang +梆bang +膀bang +绑bang +磅bang +蚌bang +镑bang +傍bang +谤bang +蒡bang +浜bang +报bao +保bao +包bao +剥bao +薄bao +胞bao +暴bao +宝bao +饱bao +抱bao +爆bao +炮*bao +堡bao +刨*bao +苞bao +褒bao +雹bao +豹bao +鲍bao +曝*bao +瀑*bao +葆bao +孢bao +煲bao +鸨bao +褓bao +趵bao +龅bao +北bei +被bei +倍bei +备bei +背bei +辈bei +贝bei +杯bei +卑bei +臂*bei +悲bei +碑bei +钡bei +狈bei +惫bei +焙bei +孛bei +陂bei +邶bei +埤bei +萆bei +蓓bei +呗bei +悖bei +碚bei +鹎bei +褙bei +鐾bei +鞴bei +本ben +奔ben +苯ben +笨ben +夯*ben +畚ben +坌ben +贲ben +锛ben +本报benbao +奔波benbo +本部benbu +本厂benchang +奔驰benchi +本地bendi +奔放benfang +泵beng +崩beng +蚌*beng +绷beng +甭beng +蹦beng +迸beng +嘣beng +甏beng +比bi +必bi +避bi +闭bi +辟bi +笔bi +壁bi +臂bi +毕bi +彼bi +逼bi +币bi +鼻bi +蔽bi +秘*bi +鄙bi +碧bi +蓖bi +毙bi +毖bi +庇bi +痹bi +敝bi +弊bi +陛bi +拂*bi +泌*bi +匕bi +俾bi +埤*bi +芘*bi +荜bi +荸bi +萆*bi +薜bi +吡bi +哔bi +狴bi +庳bi +愎bi +滗bi +濞bi +弼bi +妣bi +婢bi +嬖bi +璧bi +贲*bi +睥*bi +畀bi +铋bi +秕bi +裨bi +筚bi +箅bi +篦bi +舭bi +襞bi +跸bi +髀bi +变bian +边bian +便bian +编bian +遍bian +辩bian +扁bian +辨bian +鞭bian +贬bian +卞bian +辫bian +匾bian +弁bian +苄bian +忭bian +汴bian +缏bian +飚bian +煸bian +砭bian +碥bian +窆bian +褊bian +蝙bian +笾bian +鳊bian +表biao +标biao +彪biao +膘biao +勺*biao +婊biao +骠biao +杓biao +飑biao +飙biao +镖biao +镳biao +瘭biao +裱biao +鳔biao +髟biao +别bie +鳖bie +憋bie +瘪bie +蹩bie +宾bin +彬bin +斌bin +濒bin +滨bin +摈bin +傧bin +豳bin +缤bin +玢bin +槟bin +殡bin +膑bin +镔bin +髌bin +鬓bin +并bing +病bing +兵bing +柄bing +冰bing +丙bing +饼bing +秉bing +炳bing +屏*bing +禀bing +邴bing +摒bing +槟*bing +波bo +播bo +剥*bo +伯bo +拨bo +薄*bo +博bo +勃bo +驳bo +玻bo +泊bo +柏*bo +卜*bo +菠bo +钵bo +搏bo +铂bo +箔bo +帛bo +舶bo +脖bo +膊bo +渤bo +魄*bo +孛*bo +亳bo +啵bo +饽bo +檗bo +掰*bo +擘bo +礴bo +钹bo +鹁bo +簸bo +趵*bo +跛bo +踣bo +不bu +部bu +步bu +布bu +补bu +捕bu +埔*bu +卜bu +堡*bu +哺bu +埠bu +簿bu +怖bu +卟bu +逋bu +瓿bu +晡bu +钚bu +钸bu +醭bu +不安buan +不比bubi +不必bubi +不变bubian +不便bubian +步兵bubing +步步bubu +不曾buceng +补偿buchang +不啻buchi +补充buchong +不错bucuo +不大buda +不待budai +不但budan +不当budang +不得bude +不等budeng +步调budiao +不动budong +不断buduan +不对budui +部队budui +不法bufa +补发bufa +步伐bufa +不凡bufan +不妨bufang +不分bufen +部分bufen +不服bufu +不符bufu +不该bugai +不敢bugan +不甘bugan +布告bugao +不够bugou +不顾bugu +不管buguan +不过buguo +不会buhui +补给buji +部件bujian +不借bujie +不尽bujin +不仅bujin +不禁bujin +布景bujing +不久bujiu +补救bujiu +布局buju +不堪bukan +不可buke +不快bukuai +不愧bukui +不理buli +不利buli +不良buliang +不料buliao +步履bulu +不论bulun +部落buluo +不满buman +部门bumen +不免bumian +不能buneng +不怕bupa +补品bupin +不平buping +步枪buqiang +不屈buqu +不然buran +不如buru +不少bushao +不是bushi +不识bushi +部首bushou +部属bushu +部署bushu +补贴butie +不同butong +不妥butuo +部位buwei +部委buwei +不问buwen +不惜buxi +补习buxi +部下buxia +不行buxing +不幸buxing +步行buxing +不朽buxiu +不许buxu +哺养buyang +不要buyao +不宜buyi +不用buyong +哺育buyu +不在buzai +部长buzhang +不振buzhen +不只buzhi +不止buzhi +不知buzhi +不致buzhi +布置buzhi +步骤buzhou +补助buzhu +捕捉buzhuo +步子buzi +不足buzu +博物馆bwg +产c +成c +出c +长c +从c +此c +常c +处c +车c +场c +传c +采c +层c +厂c +才c +次c +虫c +除c +查c +差c +擦ca +拆*ca +嚓ca +礤ca +采cai +才cai +材cai +菜cai +财cai +裁cai +彩cai +猜cai +睬cai +踩cai +蔡cai +参can +残can +蚕can +灿can +餐can +惭can +惨can +孱can +骖can +璨can +粲can +黪can +惨案canan +惨白canbai +残暴canbao +惨怛canda +残废canfei +藏cang +仓cang +苍cang +舱cang +沧cang +苍白cangbai +仓促cangcu +仓库cangku +苍老canglao +苍茫cangmang +藏匿cangni +苍穹cangqiong +沧桑cangsang +苍天cangtian +参观canguan +残骸canhai +残疾canji +参加canjia +参见canjian +残局canju +惨剧canju +参军canjun +参看cankan +参考cankao +残酷canku +惭愧cankui +灿烂canlan +参谋canmou +残缺canque +残忍canren +孱弱canruo +残杀cansha +残生cansheng +蚕食canshi +参数canshu +惨痛cantong +参与canyu +残余canyu +残月canyue +参阅canyue +参赞canzan +惨遭canzao +参战canzhan +参照canzhao +参政canzheng +惨重canzhong +草cao +槽cao +操cao +糙cao +曹cao +嘈cao +漕cao +螬cao +艚cao +草案caoan +草稿caogao +槽糕caogao +操劳caolao +操练caolian +草率caolu +草木caomu +草拟caoni +草签caoqian +操心caoxin +草原caoyuan +嘈杂caoza +操纵caozong +操作caozuo +差不多cbd +成本核算cbhs +出版社cbs +层出不穷ccbq +从长计议ccjy +存储器ccq +长春市ccs +成都市cds +测ce +策ce +侧ce +册ce +厕ce +恻ce +测定ceding +策动cedong +策反cefan +策划cehua +测量celiang +策略celue +侧面cemian +参*cen +岑cen +涔cen +涔涔cencen +层ceng +曾*ceng +蹭ceng +层层cengceng +层次cengci +曾经cengjing +测试ceshi +厕所cesuo +测验ceyan +侧重cezhong +出发点cfd +充分发挥cffh +唱高调cgd +从古到今cgdj +查cha +差cha +插cha +察cha +茶cha +叉cha +茬cha +碴cha +搽cha +岔cha +诧cha +刹*cha +喳*cha +嚓*cha +猹cha +馇cha +汊cha +姹cha +杈cha +楂cha +槎cha +檫cha +锸cha +镲cha +衩cha +查办chaban +差别chabie +差错chacuo +差点chadian +查对chadui +差额chae +查访chafang +察访chafang +查封chafeng +查获chahuo +差*chai +柴chai +拆chai +豺chai +侪chai +钗chai +瘥chai +虿chai +拆穿chaichuan +豺狼chailang +拆散chaisan +差使chaishi +拆卸chaixie +柴油chaiyou +差价chajia +差距chaju +察觉chajue +查看chakan +察看chakan +查考chakao +查明chaming +产chan +单*chan +铲chan +阐chan +搀chan +掺chan +蝉chan +馋chan +谗chan +缠chan +颤chan +冁chan +谄chan +蒇chan +廛chan +忏chan +潺chan +澶chan +孱*chan +羼chan +婵chan +骣chan +觇chan +禅chan +镡chan +蟾chan +躔chan +铲除chanchu +产地chandi +阐发chanfa +搀扶chanfu +长chang +常chang +场chang +厂chang +唱chang +肠chang +昌chang +倡chang +偿chang +畅chang +猖chang +尝chang +敞chang +裳*chang +倘*chang +伥chang +鬯chang +苌chang +菖chang +徜chang +怅chang +惝chang +阊chang +娼chang +嫦chang +昶chang +氅chang +鲳chang +长安changan +常常changchang +长城changcheng +长春changchun +畅达changda +倡导changdao +长度changdu +长短changduan +唱歌changge +常规changgui +长河changhe +场合changhe +偿还changhuan +厂家changjia +常见changjian +长江changjiang +长久changjiu +猖獗changjue +长空changkong +畅快changkuai +猖狂changkuang +场面changmian +长眠changmian +长年changnian +长篇changpian +长期changqi +长驱changqu +常任changren +长沙changsha +厂商changshang +常识changshi +尝试changshi +长寿changshou +常数changshu +场所changsuo +畅谈changtan +长途changtu +怅惘changwang +常委changwei +倘未changwei +常温changwen +常务changwu +畅想changxiang +畅销changxiao +倡议changyi +畅饮changyin +常用changyong +常有changyou +畅游changyou +长远changyuan +厂长changzhang +长征changzheng +厂址changzhi +常驻changzhu +婵娟chanjuan +蝉联chanlian +产量chanliang +缠绵chanmian +阐明chanming +产品chanpin +产权chanquan +缠绕chanrao +产生chansheng +禅师chanshi +阐述chanshu +产物chanwu +产销chanxiao +产业chanye +产值chanzhi +朝chao +超chao +潮chao +巢chao +抄chao +钞chao +嘲chao +吵chao +炒chao +绰*chao +剿*chao +怊chao +晁chao +焯*chao +耖chao +抄报chaobao +超产chaochan +超出chaochu +朝代chaodai +超额chaoe +嘲讽chaofeng +超过chaoguo +朝晖chaohui +超级chaoji +吵架chaojia +潮解chaojie +潮流chaoliu +抄录chaolu +吵闹chaonao +嘲弄chaonong +潮湿chaoshi +潮水chaoshui +抄送chaosong +超脱chaotuo +抄袭chaoxi +朝鲜chaoxian +嘲笑chaoxiao +巢穴chaoxue +朝阳chaoyang +朝野chaoye +超越chaoyue +超支chaozhi +查清chaqing +插曲chaqu +插入charu +查哨chashao +插手chashou +查收chashou +插图chatu +查问chawen +查询chaxun +茶叶chaye +差异chayi +查阅chayue +查证chazheng +岔子chazi +插足chazu +车che +彻che +尺*che +撤che +扯che +掣che +澈che +坼che +砗che +彻底chedi +车祸chehuo +车间chejian +车辆cheliang +陈chen +沉chen +称chen +衬chen +尘chen +臣chen +晨chen +沈*chen +郴chen +辰chen +忱chen +趁chen +伧chen +谌chen +谶chen +抻chen +嗔chen +宸chen +琛chen +榇chen +碜chen +龀chen +尘埃chenai +沉淀chendian +陈腐chenfu +沉浮chenfu +成cheng +程cheng +称cheng +城cheng +承cheng +乘cheng +呈cheng +盛*cheng +撑cheng +诚cheng +橙cheng +惩cheng +澄cheng +逞cheng +骋cheng +秤cheng +丞cheng +埕cheng +噌cheng +枨cheng +柽cheng +塍cheng +瞠cheng +铖cheng +铛cheng +裎cheng +蛏cheng +酲cheng +成败chengbai +承办chengban +惩办chengban +呈报chengbao +承包chengbao +成本chengben +成材chengcai +惩处chengchu +乘除chengchu +承担chengdan +承当chengdang +成都chengdu +程度chengdu +乘法chengfa +惩罚chengfa +成功chenggong +成规chenggui +成果chengguo +称号chenghao +称呼chenghu +成绩chengji +乘机chengji +成家chengjia +成见chengjian +成交chengjiao +承接chengjie +惩戒chengjie +成就chengjiu +乘客chengke +诚恳chengken +成立chengli +乘凉chengliang +成名chengming +成年chengnian +成批chengpi +成品chengpin +诚朴chengpu +逞强chengqiang +澄清chengqing +城区chengqu +成全chengquan +诚然chengran +成人chengren +承认chengren +成色chengse +成事chengshi +诚实chengshi +城市chengshi +承受chengshou +成熟chengshu +成为chengwei +称谓chengwei +成文chengwen +呈现chengxian +呈献chengxian +城乡chengxiang +成效chengxiao +称心chengxin +诚心chengxin +程序chengxu +乘虚chengxu +撑腰chengyao +诚意chengyi +成语chengyu +成员chengyuan +称赞chengzan +成长chengzhang +城镇chengzhen +称职chengzhi +诚挚chengzhi +趁机chenji +沉积chenji +陈迹chenji +沉浸chenjin +沉静chenjing +陈旧chenjiu +陈列chenlie +沉沦chenlun +沉闷chenmen +沉湎chenmian +沉默chenmo +沉溺chenni +陈设chenshe +陈述chenshu +陈说chenshuo +沉思chensi +沉痛chentong +衬托chentuo +沉吟chenyin +衬映chenying +趁早chenzao +沉重chenzhong +沉着chenzhuo +车皮chepi +扯皮chepi +撤退chetui +撤消chexiao +车站chezhan +撤职chezhi +持chi +尺chi +齿chi +吃chi +赤chi +池chi +迟chi +翅chi +斥chi +耻chi +痴chi +匙chi +弛chi +驰chi +侈chi +炽chi +傺chi +坻chi +墀chi +茌chi +叱chi +哧chi +啻chi +嗤chi +彳chi +饬chi +媸chi +敕chi +眵chi +鸱chi +瘛chi +褫chi +蚩chi +螭chi +笞chi +篪chi +豉chi +踟chi +魑chi +翅膀chibang +赤诚chicheng +驰骋chicheng +尺寸chicun +迟到chidao +赤道chidao +尺度chidu +迟钝chidun +吃喝chihe +迟缓chihuan +吃紧chijin +吃惊chijing +持久chijiu +吃苦chiku +吃亏chikui +吃力chili +炽烈chilie +齿轮chilun +持平chiping +痴情chiqing +炽热chire +耻辱chiru +池塘chitang +耻笑chixiao +赤心chixin +痴心chixin +迟疑chiyi +迟早chizao +斥责chize +叱咤chizha +持重chizhong +吃重chizhong +赤字chizi +催化剂chj +种*chong +虫chong +重*chong +充chong +冲chong +崇chong +涌*chong +宠chong +茺chong +忡chong +憧chong +铳chong +舂chong +艟chong +宠爱chongai +崇拜chongbai +充斥chongchi +冲刺chongci +冲淡chongdan +充当chongdang +重叠chongdie +冲动chongdong +宠儿chonger +充分chongfen +冲锋chongfeng +重复chongfu +崇高chonggao +重合chonghe +重婚chonghun +冲击chongji +重建chongjian +崇敬chongjing +憧憬chongjing +充满chongman +充沛chongpei +冲破chongpo +重庆chongqing +崇尚chongshang +重申chongshen +充实chongshi +冲刷chongshua +冲天chongtian +冲突chongtu +重温chongwen +冲洗chongxi +重新chongxin +重演chongyan +重印chongyin +充裕chongyu +充足chongzu +抽chou +仇chou +臭chou +酬chou +畴chou +踌chou +稠chou +愁chou +筹chou +绸chou +瞅chou +丑chou +俦chou +帱chou +惆chou +瘳chou +雠chou +筹办chouban +筹备choubei +惆怅chouchang +抽搐chouchu +踌躇chouchu +筹措choucuo +抽调choudiao +丑恶choue +仇恨chouhen +丑化chouhua +筹划chouhua +筹集chouji +筹建choujian +酬金choujin +抽空choukong +酬劳choulao +丑陋choulou +筹码chouma +稠密choumi +筹谋choumou +愁容chourong +抽象chouxiang +酬谢chouxie +抽噎chouye +出chu +处chu +除chu +初chu +础chu +触chu +楚chu +锄chu +储chu +畜*chu +橱chu +厨chu +躇chu +雏chu +滁chu +矗chu +搐chu +亍chu +刍chu +怵chu +憷chu +绌chu +杵chu +楮chu +樗chu +褚chu +蜍chu +蹰chu +黜chu +揣chuai +搋chuai +啜chuai +嘬*chuai +膪chuai +踹chuai +揣度chuaidu +揣摩chuaimo +传chuan +船chuan +穿chuan +串chuan +川chuan +椽chuan +喘chuan +舛chuan +遄chuan +巛chuan +氚chuan +钏chuan +舡chuan +传遍chuanbian +传标chuanbiao +传播chuanbo +船舶chuanbo +船埠chuanbu +穿插chuancha +传达chuanda +传单chuandan +传导chuandao +传递chuandi +床chuang +创chuang +窗chuang +闯chuang +疮chuang +幢chuang +怆chuang +创办chuangban +闯荡chuangdang +窗户chuanghu +创见chuangjian +创建chuangjian +闯劲chuangjin +创举chuangju +窗口chuangkou +创立chuangli +窗帘chuanglian +创始chuangshi +创新chuangxin +创业chuangye +创造chuangzao +创作chuangzuo +串联chuanlian +喘气chuanqi +传奇chuanqi +传染chuanran +传授chuanshou +传输chuanshu +传述chuanshu +传说chuanshuo +传送chuansong +传统chuantong +串通chuantong +喘息chuanxi +传讯chuanxun +传扬chuanyang +传阅chuanyue +传真chuanzhen +船只chuanzhi +穿着chuanzhuo +出版chuban +出榜chubang +储备chubei +出兵chubing +初步chubu +储藏chucang +出差chucha +出产chuchan +出场chuchang +出厂chuchang +处处chuchu +橱窗chuchuang +初次chuci +储存chucun +初等chudeng +出动chudong +触动chudong +出发chufa +触发chufa +除法chufa +处罚chufa +触犯chufan +出访chufang +除非chufei +处分chufen +出轨chugui +出海chuhai +吹chui +垂chui +锤chui +椎*chui +炊chui +捶chui +陲chui +棰chui +槌chui +吹棒chuibang +吹风chuifeng +吹拂chuifu +锤炼chuilian +吹牛chuiniu +垂青chuiqing +垂涎chuixian +吹嘘chuixu +垂直chuizhi +初级chuji +出击chuji +出界chujie +出境chujing +处境chujing +处决chujue +触觉chujue +除开chukai +出口chukou +出来chulai +除了chule +出力chuli +处理chuli +矗立chuli +初恋chulian +出笼chulong +出路chulu +出马chuma +出卖chumai +出面chumian +出名chuming +除名chuming +出没chumo +春chun +纯chun +醇chun +椿chun +唇chun +淳chun +蠢chun +莼chun +鹑chun +蝽chun +出纳chuna +春播chunbo +纯粹chuncui +纯度chundu +春分chunfen +春风chunfeng +春耕chungeng +春光chunguang +醇厚chunhou +春辉chunhui +春季chunji +春节chunjie +纯洁chunjie +纯净chunjing +纯利chunli +纯朴chunpu +春秋chunqiu +春色chunse +春笋chunsun +春天chuntian +处女chunu +触怒chunu +春意chunyi +纯真chunzhen +纯正chunzheng +戳chuo +绰chuo +啜*chuo +辍chuo +踔chuo +龊chuo +戳穿chuochuan +绰号chuohao +啜泣chuoqi +出品chupin +出奇chuqi +初期chuqi +出勤chuqin +出去chuqu +出让churang +出任churen +出入churu +出色chuse +出身chushen +出神chushen +出生chusheng +畜生chusheng +出事chushi +出世chushi +处世chushi +厨师chushi +出售chushou +处所chusuo +出庭chuting +锄头chutou +出土chutu +出外chuwai +除外chuwai +出席chuxi +出息chuxi +除夕chuxi +出现chuxian +初小chuxiao +雏形chuxing +储蓄chuxu +刍议chuyi +处于chuyu +初战chuzhan +处长chuzhang +出诊chuzhen +出征chuzheng +处置chuzhi +初中chuzhong +出租chuzu +此ci +次ci +刺ci +磁ci +雌ci +词ci +茨ci +疵ci +辞ci +慈ci +瓷ci +赐ci +伺*ci +兹*ci +茈ci +呲ci +祠ci +鹚ci +糍ci +慈爱ciai +辞别cibie +磁场cichang +磁带cidai +磁道cidao +此地cidi +词典cidian +辞典cidian +刺耳cier +词根cigen +刺骨cigu +此后cihou +词汇cihui +刺激ciji +赐教cijiao +此刻cike +刺客cike +词类cilei +辞令ciling +磁盘cipan +次品cipin +辞去ciqu +刺杀cisha +此时cishi +次数cishu +辞书cishu +词素cisu +祠堂citang +辞退citui +此外ciwai +慈祥cixiang +辞行cixing +词性cixing +雌雄cixiong +次序cixu +词序cixu +刺眼ciyan +次要ciyao +词语ciyu +赐予ciyu +此致cizhi +辞职cizhi +词缀cizhui +词组cizu +超级大国cjdg +参考书cks +参考消息ckxx +参考资料ckzl +触类旁通clpt +藏龙卧虎clwh +参谋长cmc +聪明才智cmcz +出谋划策cmhc +从难从严cncy +从cong +丛cong +聪cong +葱cong +囱cong +匆cong +苁cong +淙cong +骢cong +琮cong +璁cong +从此congci +匆匆congcong +匆促congcu +从而conger +从犯congfan +聪慧conghui +从来conglai +丛林conglin +匆忙congmang +聪明congming +从前congqian +从容congrong +从事congshi +丛书congshu +从速congsu +从新congxin +从严congyan +聪颖congying +葱郁congyu +从中congzhong +凑cou +楱cou +辏cou +腠cou +凑合couhe +凑巧couqiao +成品率cpl +成千上万cqsw +从容不迫crbp +承认错误crcw +趁热打铁crdt +措手不及csbj +出生率csl +长沙市css +炊事员csy +彻头彻尾ctcw +垂头丧气ctsq +粗cu +促cu +醋cu +簇cu +卒*cu +蔟cu +徂cu +猝cu +殂cu +酢cu +蹙cu +蹴cu +篡cuan +蹿cuan +窜cuan +攒*cuan +汆cuan +撺cuan +爨cuan +镩cuan +篡夺cuanduo +窜犯cuanfan +篡改cuangai +篡权cuanquan +粗暴cubao +粗糙cucao +粗犷cuguang +催cui +脆cui +淬cui +粹cui +摧cui +衰*cui +崔cui +瘁cui +翠cui +萃cui +啐cui +悴cui +璀cui +榱cui +毳cui +隹cui +摧残cuican +脆弱cuiruo +促进cujin +存cun +村cun +寸cun +蹲*cun +忖cun +皴cun +存储cunchu +存档cundang +存放cunfang +存款cunkuan +村落cunluo +存亡cunwang +存在cunzai +村镇cunzhen +村庄cunzhuang +村子cunzi +错cuo +措cuo +撮cuo +磋cuo +搓cuo +挫cuo +厝cuo +嵯cuo +脞cuo +锉cuo +矬cuo +痤cuo +瘥*cuo +鹾cuo +蹉cuo +错案cuoan +挫败cuobai +错处cuochu +措辞cuoci +错怪cuoguai +错过cuoguo +撮合cuohe +错觉cuojue +磋商cuoshang +挫伤cuoshang +措施cuoshi +错误cuowu +挫折cuozhe +错综cuozong +粗浅cuqian +促使cushi +粗俗cusu +粗心cuxin +粗壮cuzhuang +常委会cwh +崇文区cwq +常务委员会cwwh +乘务员cwy +诚心诚意cxcy +程序控制cxkz +程序设计cxsj +长远利益cyly +朝阳区cyq +财政部czb +错综复杂czfz +操之过急czgj +出租汽车czqc +此之外czw +财政危机czwj +创造性czx +操作系统czxt +操作员czy +持之以恒czyh +的d +大d +地d +动d +到d +对d +度d +多d +电d +党d +得d +定d +等d +斗d +当d +队d +都d +点d +代d +道d +大da +打da +达da +答da +搭da +塔*da +瘩da +耷da +哒da +嗒da +怛da +妲da +沓*da +疸da +褡da +笪da +靼da +鞑da +答案daan +打败dabai +大办daban +大半daban +打扮daban +答辩dabian +大伯dabo +大部dabu +达成dacheng +大胆dadan +搭档dadang +大道dadao +达到dadao +打倒dadao +大地dadi +大敌dadi +大抵dadi +打断daduan +大队dadui +大多daduo +大凡dafan +大夫dafu +大幅dafu +答复dafu +大概dagai +大纲dagang +大国daguo +大海dahai +大好dahao +大河dahe +大亨daheng +大会dahui +大*dai +代dai +带dai +待dai +袋dai +戴dai +呆dai +歹dai +傣dai +殆dai +贷dai +逮dai +怠dai +埭dai +甙dai +呔dai +岱dai +迨dai +骀dai +绐dai +玳dai +黛dai +呆板daiban +代表daibiao +逮捕daibu +逮逋daibu +代词daici +带动daidong +怠工daigong +代价daijia +贷款daikuan +带来dailai +代理daili +带领dailing +带路dailu +黛绿dailu +代码daima +怠慢daiman +待命daiming +代数daishu +代替daiti +带头daitou +歹徒daitu +待遇daiyu +呆滞daizhi +呆子daizi +打击daji +大家dajia +打搅dajiao +大街dajie +大捷dajie +打劫dajie +搭救dajiu +大局daju +答卷dajuan +打开dakai +耷拉dala +大力dali +大连dalian +大量daliang +打量daliang +大陆dalu +大略dalue +大妈dama +单dan +但dan +弹dan +担dan +石*dan +蛋dan +淡dan +胆dan +氮dan +丹dan +旦dan +耽dan +郸dan +掸dan +惮dan +诞dan +儋dan +萏dan +啖dan +澹*dan +殚dan +赕dan +眈dan +疸dan +瘅dan +聃dan +箪dan +大脑danao +担保danbao +单薄danbao +淡薄danbao +单产danchan +诞辰danchen +单纯danchun +单词danci +担当dandang +单调dandiao +单独dandu +单方danfang +担负danfu +党dang +当dang +档dang +挡dang +荡dang +谠dang +凼dang +菪dang +宕dang +砀dang +裆dang +单干dangan +胆敢dangan +档案dangan +当场dangchang +当初dangchu +当代dangdai +当地dangdi +单个dange +耽搁dange +党风dangfeng +党纲danggang +党纪dangji +党籍dangji +当即dangji +当家dangjia +当今dangjin +当局dangju +当量dangliang +当面dangmian +党内dangnei +当年dangnian +党派dangpai +当铺dangpu +当前dangqian +当然dangran +当日dangri +当时dangshi +当天dangtian +当头dangtou +党团dangtuan +当晚dangwan +党委dangwei +当先dangxian +党校dangxiao +当心dangxin +党性dangxing +荡漾dangyang +党员dangyuan +当月dangyue +党章dangzhang +当真dangzhen +党政dangzheng +当政dangzheng +当中dangzhong +当众dangzhong +当做dangzuo +单价danjia +担架danjia +胆量danliang +胆略danlue +淡漠danmo +胆怯danqie +丹青danqing +担任danren +单身danshen +诞生dansheng +但是danshi +胆识danshi +单体danti +丹田dantian +单位danwei +耽误danwu +单项danxiang +胆小danxiao +担心danxin +淡雅danya +弹药danyao +单一danyi +单元danyuan +但愿danyuan +单质danzhi +担子danzi +掸子danzi +单字danzi +到dao +道dao +导dao +刀dao +倒dao +稻dao +岛dao +捣dao +盗dao +蹈dao +祷dao +悼dao +叨dao +帱*dao +忉dao +氘dao +焘*dao +纛dao +倒闭daobi +到处daochu +悼词daoci +到达daoda +导弹daodan +道德daode +到底daodi +倒戈daoge +捣鬼daogui +捣毁daohui +到来daolai +到了daole +道理daoli +倒立daoli +道路daolu +捣乱daoluan +倒霉daomei +叨念daonian +道歉daoqian +刀枪daoqiang +盗窃daoqie +到时daoshi +导师daoshi +倒数daoshu +导体daoti +倒退daotui +导演daoyan +道义daoyi +盗用daoyong +岛屿daoyu +导致daozhi +大批dapi +大破dapo +打破dapo +大气daqi +大庆daqing +打扰darao +打扫dasao +大厦dasha +搭讪dashan +大赦dashe +大使dashi +大事dashi +大师dashi +大势dashi +大肆dasi +打算dasuan +大体dati +大厅dating +打听dating +大同datong +大小daxiao +大写daxie +答谢daxie +大选daxuan +大学daxue +大业daye +达因dayin +打印dayin +答应daying +大于dayu +大院dayuan +大约dayue +打仗dazhang +大致dazhi +大众dazhong +打字dazi +代办处dbc +得不偿失dbcs +大部分dbf +电报挂号dbgh +大不了dbl +大步流星dblx +对不起dbq +代表团dbt +电冰箱dbx +东城区dcq +到此为止dcwz +独创性dcx +调查研究dcyj +打成一片dcyp +打电话ddh +电动机ddj +对得起ddq +大多数dds +的de +得de +地*de +德de +底*de +锝de +得逞decheng +的当dedang +得当dedang +得到dedao +得分defen +德国deguo +得奖dejiang +得救dejiu +得了dele +得力deli +等deng +灯deng +登deng +邓deng +澄*deng +蹬deng +瞪deng +凳deng +噔deng +嶝deng +戥deng +磴deng +镫deng +簦deng +登场dengchang +等待dengdai +等到dengdao +灯光dengguang +等候denghou +等级dengji +登记dengji +等价dengjia +灯具dengju +登门dengmen +灯谜dengmi +登攀dengpan +登山dengshan +灯塔dengta +登台dengtai +等同dengtong +等闲dengxian +等于dengyu +登载dengzai +得胜desheng +得失deshi +得体deti +德行dexing +得以deyi +得意deyi +德育deyu +得志dezhi +得知dezhi +得罪dezui +大幅度dfd +多方面dfm +单方面dfm +电风扇dfs +大规模dgm +多功能dgn +大公无私dgws +帝国主义dgzy +电话号码dhhm +电化教育dhjy +大会堂dht +的*di +地di +第di +低di +敌di +底di +提*di +帝di +抵di +滴di +弟di +递di +堤di +迪di +笛di +狄di +涤di +翟di +嫡di +蒂di +缔di +氐di +籴di +诋di +谛di +邸di +坻*di +荻di +嘀di +娣di +绨di +柢di +棣di +觌di +砥di +碲di +睇di +镝di +羝di +骶di +嗲dia +电dian +点dian +垫dian +典dian +店dian +颠dian +淀dian +掂dian +滇dian +碘dian +靛dian +佃dian +甸dian +惦dian +奠dian +殿dian +阽dian +坫dian +巅dian +玷dian +钿dian +癜dian +癫dian +簟dian +踮dian +电报dianbao +点播dianbo +电场dianchang +电车dianche +电池dianchi +电传dianchuan +颠倒diandao +电灯diandeng +点滴diandi +奠定dianding +电动diandong +典范dianfan +淀粉dianfen +垫付dianfu +颠覆dianfu +电感diangan +典故diangu +电荷dianhe +电弧dianhu +电话dianhua +电汇dianhui +电机dianji +电极dianji +奠基dianji +惦记dianji +典籍dianji +点将dianjiang +电解dianjie +殿军dianjun +癫狂diankuang +电缆dianlan +电力dianli +电离dianli +典礼dianli +电流dianliu +电路dianlu +电脑diannao +电能dianneng +店铺dianpu +电气dianqi +电器dianqi +点燃dianran +电容dianrong +电扇dianshan +电视dianshi +电台diantai +电梯dianti +点头diantou +电网dianwang +电位dianwei +玷污dianwu +殿下dianxia +电线dianxian +癫痫dianxian +电信dianxin +典型dianxing +电讯dianxun +电压dianya +电影dianying +店员dianyuan +点阵dianzhen +点缀dianzhui +电子dianzi +点子dianzi +电阻dianzu +调diao +掉diao +吊diao +鸟*diao +碉diao +叼diao +雕diao +凋diao +刁diao +钓diao +铞diao +铫diao +貂diao +鲷diao +碉堡diaobao +凋敝diaobi +调查diaocha +吊车diaoche +调动diaodong +调度diaodu +钓饵diaoer +调换diaohuan +掉换diaohuan +雕刻diaoke +调令diaoling +刁难diaonan +调遣diaoqian +调任diaoren +雕塑diaosu +吊唁diaoyan +调用diaoyong +钓鱼diaoyu +调子diaozi +第八diba +地板diban +地步dibu +低沉dichen +抵触dichu +抵达dida +地带didai +低档didang +抵挡didang +地道didao +弟弟didi +地点didian +地段diduan +敌对didui +迭die +跌die +爹die +碟die +蝶die +谍die +叠die +垤die +堞die +揲die +喋die +牒die +瓞die +耋die +踮*die +蹀die +鲽die +迭起dieqi +第二dier +地方difang +低估digu +敌国diguo +帝国diguo +敌后dihou +诋毁dihui +低级diji +递加dijia +递减dijian +地窖dijiao +递交dijiao +缔交dijiao +缔结dijie +第九dijiu +敌军dijun +抵抗dikang +地牢dilao +地理dili +低劣dilie +第六diliu +低落diluo +地貌dimao +地面dimian +抵命diming +定ding +顶ding +钉ding +丁ding +订ding +盯ding +叮ding +鼎ding +锭ding +仃ding +啶ding +玎ding +腚ding +碇ding +町ding +铤*ding +疔ding +耵ding +酊ding +定案dingan +定产dingchan +丁当dingdang +顶点dingdian +定夺dingduo +定额dinge +顶峰dingfeng +顶锋dingfeng +定购dinggou +订购dinggou +订户dinghu +定货dinghuo +订货dinghuo +定价dingjia +定局dingju +定居dingju +定理dingli +订立dingli +鼎立dingli +定量dingliang +定律dinglu +定期dingqi +定然dingran +盯梢dingshao +定时dingshi +顶替dingti +定性dingxing +定型dingxing +定义dingyi +定语dingyu +定员dingyuan +订阅dingyue +订正dingzheng +叮嘱dingzhu +顶撞dingzhuang +钉子dingzi +嫡派dipai +地盘dipan +第七diqi +嫡亲diqin +敌情diqing +地球diqiu +地区diqu +的确dique +敌人diren +第三disan +地势dishi +第十dishi +滴水dishui +第四disi +地铁ditie +地图ditu +丢diu +铥diu +丢掉diudiao +丢脸diulian +丢失diushi +地位diwei +敌伪diwei +第五diwu +嫡系dixi +底细dixi +地下dixia +低下dixia +底下dixia +地形dixing +弟兄dixiong +第一diyi +敌意diyi +地域diyu +抵御diyu +缔造dizao +递增dizeng +地震dizhen +敌阵dizhen +地质dizhi +地址dizhi +抵制dizhi +底子dizi +弟子dizi +党纪国法djgf +当机立断djld +多劳多得dldd +大力发展dlfz +大力加强dljq +大力开展dlkz +独立自主dlzz +多面手dms +对内搞活dngh +多年来dnl +东南亚dny +动dong +东dong +冬dong +懂dong +洞dong +冻dong +董dong +栋dong +侗dong +恫dong +垌dong +咚dong +岽dong +峒dong +氡dong +胨dong +胴dong +硐dong +鸫dong +东北dongbei +东边dongbian +东部dongbu +洞察dongcha +动词dongci +动荡dongdang +懂得dongde +东方dongfang +东风dongfeng +动工donggong +东海donghai +恫吓donghe +动机dongji +冬季dongji +东家dongjia +冻结dongjie +动静dongjing +东京dongjing +动力dongli +动量dongliang +栋梁dongliang +动乱dongluan +动脉dongmai +东南dongnan +东欧dongou +动人dongren +动身dongshen +董事dongshi +动手dongshou +动态dongtai +冬天dongtian +动听dongting +动物dongwu +东西dongxi +洞悉dongxi +动向dongxiang +动心dongxin +东亚dongya +东洋dongyang +动摇dongyao +动用dongyong +动员dongyuan +动辄dongzhe +动作dongzuo +斗dou +都*dou +豆dou +读*dou +兜dou +抖dou +陡dou +逗dou +痘dou +蔸dou +窦dou +蚪dou +篼dou +兜风doufeng +逗号douhao +逗留douliu +斗室doushi +兜售doushou +斗争douzheng +斗志douzhi +斗智douzhi +抖嘴douzui +打破常规dpcg +地平线dpx +电器化dqh +待人接物drjw +第三产业dscy +第十二届dsej +大使馆dsg +到时候dsh +电视机dsj +多少年dsn +大失所望dssw +电视台dst +低三下四dsxs +第十一届dsyj +大踏步dtb +到头来dtl +大体上dts +大同小异dtxy +度du +都du +毒du +独du +读du +渡du +杜du +堵du +镀du +顿du +督du +犊du +睹du +赌du +肚du +妒du +芏du +嘟du +渎du +椟du +牍du +蠹du +笃du +髑du +黩du +断duan +端duan +段duan +短duan +锻duan +缎duan +椴duan +煅duan +簖duan +短波duanbo +短处duanchu +短促duancu +断定duanding +短短duanduan +断交duanjiao +断绝duanjue +锻练duanlian +锻炼duanlian +短路duanlu +段落duanluo +短评duanping +短期duanqi +短缺duanque +断然duanran +煅烧duanshao +断送duansong +短途duantu +端午duanwu +端详duanxiang +短小duanxiao +断言duanyan +端阳duanyang +短语duanyu +短暂duanzan +端正duanzheng +端庄duanzhuang +读报dubao +读本duben +赌博dubo +独裁ducai +毒草ducao +独唱duchang +独创duchuang +督促ducu +毒打duda +独到dudao +度过duguo +毒害duhai +毒化duhua +都会duhui +对dui +队dui +堆dui +敦*dui +兑dui +怼dui +憝dui +碓dui +对比duibi +队部duibu +对策duice +对称duichen +对此duici +对待duidai +对等duideng +对调duidiao +对方duifang +对付duifu +对话duihua +兑换duihuan +对讲duijiang +对抗duikang +对口duikou +对垒duilei +对立duili +对联duilian +队列duilie +对流duiliu +对面duimian +对内duinei +对偶duiou +对手duishou +对数duishu +对外duiwai +队伍duiwu +兑现duixian +对象duixiang +对应duiying +对于duiyu +队员duiyuan +堆栈duizhan +队长duizhang +对照duizhao +对证duizheng +对质duizhi +对峙duizhi +对准duizhun +镀金dujin +杜绝dujue +渡口dukou +都来dulai +独立duli +度量duliang +盾dun +吨dun +顿dun +蹲dun +敦dun +墩dun +囤dun +钝dun +遁dun +沌dun +炖dun +砘dun +礅dun +盹dun +镦dun +趸dun +蹲点dundian +顿号dunhao +囤积dunji +遁迹dunji +钝角dunjiao +顿时dunshi +敦实dunshi +多duo +度*duo +夺duo +朵duo +掇duo +哆duo +垛duo +躲duo +跺duo +舵duo +剁duo +惰duo +堕duo +驮*duo +咄duo +哚duo +沲duo +缍duo +柁duo +铎duo +裰duo +踱duo +多半duoban +躲避duobi +多变duobian +多边duobian +躲藏duocang +多次duoci +夺得duode +多端duoduan +多方duofang +躲开duokai +多亏duokui +夺魁duokui +堕落duoluo +多么duome +夺目duomu +多年duonian +多情duoqing +夺取duoqu +多少duoshao +多事duoshi +掇拾duoshi +舵手duoshou +多数duoshu +多谢duoxie +多心duoxin +惰性duoxing +多样duoyang +多余duoyu +多种duozhong +肚皮dupi +毒品dupin +毒气duqi +读取duqu +度日duri +读入duru +堵塞duse +毒蛇dushe +都是dushi +毒手dushou +读数dushu +读书dushu +毒素dusu +独特dute +读物duwu +毒药duyao +独占duzhan +读者duzhe +毒汁duzhi +渎职duzhi +赌注duzhu +杜撰duzhuan +独自duzi +党委会dwh +对外开放dwkf +敌我矛盾dwmd +对外贸易dwmy +大无畏dww +动物园dwy +当务之急dwzj +邓小平dxp +大学生dxs +大显身手dxss +大西洋dxy +大跃进dyj +打印机dyj +大有可为dykw +待业青年dyqn +掉以轻心dyqx +电影院dyy +大洋洲dyz +大有作为dyzw +党支部dzb +多种多样dzdy +党政机关dzjg +多种经营dzjy +断章取义dzqy +大自然dzr +德智体dzt +电子学dzx +党中央dzy +而e +二e +尔e +儿e +恶e +额e +恩e +俄e +耳e +饵e +蛾e +饿e +峨e +鹅e +讹e +娥e +厄e +扼e +遏e +鄂e +噩e +谔e +垩e +苊e +莪e +萼e +呃e +愕e +屙e +婀e +轭e +腭e +锇e +锷e +鹗e +颚e +鳄e +恶霸eba +恶毒edu +恶感egan +恶棍egun +噩耗ehao +恶化ehua +诶ei +二极管ejg +二进制ejz +恶劣elie +鹅毛emao +噩梦emeng +恶魔emo +耳目一新emyx +恩en +蒽en +摁en +恩爱enai +恩赐enci +恩典endian +恩惠enhui +恩情enqing +而er +二er +尔er +儿er +耳er +饵er +洱er +贰er +佴er +迩er +珥er +铒er +鸸er +鲕er +耳朵erduo +儿歌erge +耳光erguang +而后erhou +尔后erhou +二届erjie +而今erjin +而况erkuang +而且erqie +而是ershi +儿童ertong +儿戏erxi +而已eryi +耳语eryu +二月eryue +儿子erzi +扼杀esha +额外ewai +扼腕ewan +额外负担ewfd +恶习exi +恶心exin +恶性exing +恶性循环exxh +扼要eyao +厄运eyun +讹诈ezha +遏止ezhi +分f +发f +方f +法f +反f +放f +复f +风f +防f +非f +服f +肥f +副f +粉f +府f +夫f +负f +封f +富f +翻f +发fa +法fa +阀fa +乏fa +伐fa +罚fa +筏fa +珐fa +垡fa +砝fa +发报fabao +法宝fabao +发表fabiao +发布fabu +发财facai +发愁fachou +发出fachu +发达fada +发电fadian +法典fadian +法定fading +发动fadong +发放fafang +发奋fafen +发愤fafen +法官faguan +法规fagui +法国faguo +发慌fahuang +发挥fahui +发火fahuo +发给faji +发迹faji +法纪faji +发家fajia +发奖fajiang +发酵fajiao +罚金fajin +发觉fajue +发掘fajue +罚款fakuan +发狂fakuang +法郎falang +法令faling +法律falu +发落faluo +发明faming +反fan +翻fan +范fan +犯fan +饭fan +繁fan +泛fan +番fan +凡fan +烦fan +返fan +藩fan +帆fan +樊fan +矾fan +钒fan +贩fan +蕃fan +蘩fan +幡fan +梵fan +燔fan +畈fan +蹯fan +翻版fanban +反比fanbi +反驳fanbo +帆布fanbu +反常fanchang +范畴fanchou +犯愁fanchou +帆船fanchuan +饭店fandian +反动fandong +翻动fandong +反对fandui +繁多fanduo +反而faner +反复fanfu +方fang +放fang +防fang +访fang +房fang +纺fang +仿fang +妨fang +芳fang +肪fang +坊fang +邡fang +彷*fang +枋fang +钫fang +舫fang +鲂fang +妨碍fangai +方案fangan +反感fangan +防备fangbei +方便fangbian +防潮fangchao +方程fangcheng +放大fangda +放荡fangdang +防盗fangdao +方法fangfa +防范fangfan +防风fangfeng +防腐fangfu +仿佛fangfu +妨害fanghai +防护fanghu +防火fanghuo +放假fangjia +房间fangjian +方面fangmian +放牧fangmu +返工fangong +反攻fangong +放屁fangpi +放弃fangqi +防区fangqu +放任fangren +放哨fangshao +放射fangshe +方式fangshi +防守fangshou +放肆fangsi +放松fangsong +仿宋fangsong +翻滚fangun +方位fangwei +防卫fangwei +访问fangwen +房屋fangwu +放下fangxia +防线fangxian +方向fangxiang +芳香fangxiang +仿效fangxiao +放心fangxin +放行fangxing +方言fangyan +防疫fangyi +防御fangyu +仿造fangzao +仿照fangzhao +方针fangzhen +仿真fangzhen +防治fangzhi +仿制fangzhi +放置fangzhi +防止fangzhi +纺织fangzhi +房子fangzi +放纵fangzong +房租fangzu +番号fanhao +繁华fanhua +反悔fanhui +返回fanhui +反击fanji +反抗fankang +反馈fankui +泛滥fanlan +范例fanli +凡例fanli +翻脸fanlian +贩卖fanmai +繁忙fanmang +烦闷fanmen +反面fanmian +反目fanmu +烦恼fannao +反叛fanpan +犯人fanren +繁荣fanrong +反射fanshe +翻身fanshen +繁盛fansheng +凡是fanshi +凡事fanshi +繁琐fansuo +烦琐fansuo +翻腾fanteng +繁体fanti +饭桶fantong +发怒fanu +饭碗fanwan +范围fanwei +反问fanwen +反响fanxiang +返销fanxiao +反省fanxing +翻修fanxiu +繁衍fanyan +翻译fanyi +翻印fanyin +反应fanying +反映fanying +繁育fanyu +翻越fanyue +翻阅fanyue +贩运fanyun +繁杂fanza +烦燥fanzao +反正fanzheng +反之fanzhi +繁殖fanzhi +繁重fanzhong +贩子fanzi +犯罪fanzui +发起faqi +法权faquan +发射fashe +发生fasheng +发誓fashi +发售fashou +法庭fating +发现faxian +发泄faxie +发行faxing +发言fayan +发扬fayang +法医fayi +发育fayu +发源fayuan +法院fayuan +法则faze +发展fazhan +法制fazhi +法治fazhi +发作fazuo +奋不顾身fbgs +分崩离析fblx +副产品fcp +发电机fdj +发动机fdj +反动派fdp +分道扬镳fdyb +非fei +肥fei +飞fei +费fei +废fei +肺fei +沸fei +菲fei +匪fei +啡fei +诽fei +吠fei +芾fei +狒fei +悱fei +淝fei +妃fei +绯fei +榧fei +腓fei +斐fei +扉fei +镄fei +痱fei +蜚fei +篚fei +翡fei +霏fei +鲱fei +匪帮feibang +诽谤feibang +飞奔feiben +非常feichang +飞驰feichi +废除feichu +非但feidan +非得feide +沸点feidian +非法feifa +非凡feifan +肺腑feifu +绯红feihong +废话feihua +飞机feiji +飞溅feijian +费解feijie +费劲feijin +飞快feikuai +费力feili +肥料feiliao +废料feiliao +肥胖feipang +废品feipin +废弃feiqi +费神feishen +废水feishui +飞速feisu +沸腾feiteng +匪徒feitu +肥沃feiwo +废物feiwu +飞舞feiwu +飞翔feixiang +费心feixin +飞行feixing +废墟feixu +飞扬feiyang +扉页feiye +非议feiyi +费用feiyong +飞跃feiyue +肥皂feizao +飞涨feizhang +废止feizhi +非洲feizhou +妃子feizi +分fen +粉fen +奋fen +份fen +粪fen +纷fen +芬fen +愤fen +酚fen +吩fen +氛fen +坟fen +焚fen +汾fen +忿fen +偾fen +瀵fen +玢*fen +棼fen +鲼fen +鼢fen +分贝fenbei +分辩fenbian +分辨fenbian +粪便fenbian +分别fenbie +分部fenbu +分布fenbu +分册fence +分寸fencun +分担fendan +分得fende +分店fendian +奋斗fendou +分队fendui +分发fenfa +奋发fenfa +纷纷fenfen +吩咐fenfu +风feng +封feng +蜂feng +丰feng +缝feng +峰feng +锋feng +疯feng +奉feng +枫feng +烽feng +逢feng +冯feng +讽feng +凤feng +俸feng +酆feng +葑feng +唪feng +沣feng +砜feng +风暴fengbao +丰碑fengbei +封闭fengbi +风波fengbo +丰产fengchan +奉承fengcheng +讽刺fengci +封存fengcun +风度fengdu +分割fenge +分隔fenge +风发fengfa +风帆fengfan +丰富fengfu +奉告fenggao +风格fengge +奉公fenggong +风光fengguang +风寒fenghan +奉还fenghuan +凤凰fenghuang +烽火fenghuo +封建fengjian +风景fengjing +疯狂fengkuang +风浪fenglang +风力fengli +风流fengliu +丰满fengman +锋芒fengmang +风貌fengmao +奉命fengming +丰年fengnian +分工fengong +奉陪fengpei +风气fengqi +风情fengqing +风趣fengqu +奉劝fengquan +缝纫fengren +风骚fengsao +风沙fengsha +风尚fengshang +风声fengsheng +丰盛fengsheng +丰收fengshou +风霜fengshuang +风水fengshui +丰硕fengshuo +奉祀fengsi +风俗fengsu +封锁fengsuo +疯瘫fengtan +封条fengtiao +风头fengtou +分管fenguan +风味fengwei +缝隙fengxi +风险fengxian +奉献fengxian +风向fengxiang +风行fengxing +奉行fengxing +蜂拥fengyong +风云fengyun +风韵fengyun +风灾fengzai +疯子fengzi +风姿fengzi +分号fenhao +分毫fenhao +分红fenhong +粉红fenhong +分化fenhua +分会fenhui +焚毁fenhui +分级fenji +分解fenjie +分界fenjie +奋进fenjin +分居fenju +分开fenkai +愤慨fenkai +分类fenlei +分离fenli +奋力fenli +分量fenliang +分裂fenlie +纷乱fenluan +分娩fenmian +分秒fenmiao +分明fenming +粉末fenmo +坟墓fenmu +愤怒fennu +分派fenpai +分配fenpei +分批fenpi +分期fenqi +分歧fenqi +奋起fenqi +分清fenqing +分区fenqu +分散fensan +焚烧fenshao +分数fenshu +分说fenshuo +粉碎fensui +分摊fentan +粪土fentu +分外fenwai +氛围fenwei +分析fenxi +奋勇fenyong +分赃fenzang +奋战fenzhan +分支fenzhi +分子fenzi +分组fenzu +丰富多采ffdc +奋发图强fftq +反过来说fgls +反革命fgm +福建省fjs +封建主义fjzy +翻来覆去flfq +法律顾问flgw +分秒必争fmbz +发明创造fmcz +否fou +缶fou +否定fouding +否决foujue +否认fouren +否则fouze +费品率fpl +废寝忘食fqws +缝纫机frj +分水岭fsl +翻天复地ftfd +丰台区ftq +非同小可ftxk +繁体字ftz +复fu +服fu +副fu +府fu +夫fu +负fu +富fu +附fu +福fu +伏fu +符fu +幅fu +腐fu +浮fu +辅fu +付fu +腹fu +妇fu +孵fu +覆fu +扶fu +辐fu +傅fu +佛fu +缚fu +父fu +弗fu +甫fu +肤fu +氟fu +敷fu +拂fu +俘fu +涪fu +袱fu +抚fu +俯fu +釜fu +斧fu +脯fu +腑fu +赴fu +赋fu +阜fu +讣fu +咐fu +匐fu +凫fu +郛fu +芙fu +芾*fu +苻fu +茯fu +莩fu +菔fu +拊fu +呋fu +幞fu +怫fu +滏fu +艴fu +孚fu +驸fu +绂fu +绋fu +桴fu +赙fu +祓fu +砩fu +黻fu +黼fu +罘fu +稃fu +馥fu +蚨fu +蜉fu +蝠fu +蝮fu +麸fu +趺fu +跗fu +鲋fu +鳆fu +腐败fubai +复辟fubi +复查fucha +浮沉fuchen +扶持fuchi +付出fuchu +副词fuci +服从fucong +附带fudai +负担fudan +辅导fudao +浮雕fudiao +浮动fudong +幅度fudu +复发fufa +伏法fufa +夫妇fufu +覆盖fugai +讣告fugao +富贵fugui +符号fuhao +附和fuhe +符合fuhe +负荷fuhe +腐化fuhua +浮华fuhua +复活fuhuo +俘获fuhuo +伏击fuji +附加fujia +附件fujian +福建fujian +佛教fujiao +附近fujin +副刊fukan +俯瞰fukan +浮夸fukua +付款fukuan +腐烂fulan +福利fuli +浮力fuli +富丽fuli +妇联fulian +附录fulu +俘虏fulu +覆灭fumie +覆没fumo +父母fumu +富农funong +妇女funu +扶贫fupin +服气fuqi +福气fuqi +夫妻fuqi +付讫fuqi +肤浅fuqian +富强fuqiang +父亲fuqin +富饶furao +夫人furen +芙蓉furong +妇孺furu +负伤fushang +辐射fushe +复试fushi +腐蚀fushi +俯视fushi +副手fushou +复数fushu +负数fushu +附属fushu +富庶fushu +赋税fushui +伏特fute +覆亡fuwang +富翁fuweng +服务fuwu +复习fuxi +浮现fuxian +赋闲fuxian +浮想fuxiang +腐朽fuxiu +抚恤fuxu +敷衍fuyan +扶养fuyang +抚养fuyang +俯仰fuyang +副业fuye +服役fuyi +复印fuyin +富有fuyou +赋有fuyou +赋于fuyu +抚育fuyu +富裕fuyu +赋予fuyu +复员fuyuan +复原fuyuan +负约fuyue +复杂fuza +负载fuzai +附则fuze +负责fuze +负债fuzhai +付帐fuzhang +复制fuzhi +扶植fuzhi +附中fuzhong +福州fuzhou +抚州fuzhou +附注fuzhu +辅助fuzhu +扶助fuzhu +服装fuzhuang +附着fuzhuo +富足fuzu +辅佐fuzuo +服务部fwb +服务态度fwtd +服务员fwy +方兴未艾fxwa +奋勇当先fydx +翻一番fyf +风言风语fyfy +发扬光大fygd +复印机fyj +发言人fyr +风雨同舟fytz +房租费fzf +副总理fzl +纺织品fzp +福州市fzs +反作用fzy +副作用fzy +负责制fzz +发展中国家fzzj +个g +国g +工g +过g +高g +干g +关g +各g +革g +公g +根g +更g +改g +管g +光g +广g +果g +格g +共g +搞g +夹*ga +噶ga +嘎ga +胳*ga +尬ga +尕ga +尜ga +旮ga +钆ga +公安部gab +改gai +该gai +盖gai +概gai +钙gai +溉gai +芥*gai +丐gai +陔gai +垓gai +戤gai +赅gai +改变gaibian +改编gaibian +该当gaidang +改道gaidao +改动gaidong +改革gaige +改观gaiguan +改过gaiguo +改悔gaihui +改建gaijian +改进gaijin +概况gaikuang +概括gaikuo +改良gailiang +概率gailu +概论gailun +概貌gaimao +概念gainian +改期gaiqi +改善gaishan +概述gaishu +概叹gaitan +改天gaitian +改选gaixuan +概要gaiyao +改造gaizao +改正gaizheng +改装gaizhuang +改组gaizu +公安局gaj +干gan +杆gan +感gan +敢gan +赶gan +甘gan +肝gan +秆gan +柑gan +竿gan +赣gan +乾*gan +坩gan +苷gan +尴gan +擀gan +泔gan +淦gan +澉gan +绀gan +橄gan +旰gan +矸gan +疳gan +酐gan +干部ganbu +感触ganchu +干脆gancui +敢当gandang +甘当gandang +感到gandao +感动gandong +感恩ganen +刚gang +钢gang +缸gang +纲gang +岗gang +港gang +杠gang +冈gang +肛gang +扛*gang +戆gang +罡gang +筻gang +尴尬ganga +港澳gangao +刚才gangcai +钢材gangcai +刚刚ganggang +刚好ganghao +港口gangkou +纲领gangling +岗哨gangshao +钢铁gangtie +港湾gangwan +岗位gangwei +港务gangwu +刚要gangyao +纲要gangyao +刚毅gangyi +干旱ganhan +感化ganhua +干活ganhuo +肝火ganhuo +感激ganji +干劲ganjin +赶紧ganjin +干净ganjing +感觉ganjue +感慨gankai +甘苦ganku +赶快gankuai +赶忙ganmang +感冒ganmao +感情ganqing +感染ganran +干扰ganrao +干涉ganshe +干事ganshi +感受ganshou +甘肃gansu +感叹gantan +干线ganxian +感想ganxiang +敢想ganxiang +感谢ganxie +甘心ganxin +感性ganxing +感应ganying +敢于ganyu +干预ganyu +甘愿ganyuan +干燥ganzao +感召ganzhao +赣州ganzhou +敢做ganzuo +高gao +搞gao +告gao +稿gao +膏gao +篙gao +皋gao +羔gao +糕gao +镐gao +睾gao +诰gao +郜gao +藁gao +缟gao +槔gao +槁gao +杲gao +锆gao +高矮gaoai +高昂gaoang +告别gaobie +高产gaochan +高超gaochao +高潮gaochao +告成gaocheng +告辞gaoci +高大gaoda +高档gaodang +高等gaodeng +高地gaodi +高低gaodi +糕点gaodian +高度gaodu +告发gaofa +高峰gaofeng +高高gaogao +高歌gaoge +高贵gaogui +高喊gaohan +搞好gaohao +高呼gaohu +搞坏gaohuai +高级gaoji +告急gaoji +高价gaojia +高见gaojian +稿件gaojian +告捷gaojie +告诫gaojie +高龄gaoling +高楼gaolou +告密gaomi +高明gaoming +高能gaoneng +高攀gaopan +高频gaopin +高强gaoqiang +高山gaoshan +高尚gaoshang +高深gaoshen +告示gaoshi +高耸gaosong +高速gaosu +告诉gaosu +高温gaowen +高小gaoxiao +高校gaoxiao +高兴gaoxing +膏药gaoyao +高原gaoyuan +高涨gaozhang +高招gaozhao +高中gaozhong +告终gaozhong +告状gaozhuang +稿子gaozi +港澳同胞gatb +怪不得gbd +各部门gbm +各部委gbw +供不应求gbyq +故步自封gbzf +共产党gcd +共产党员gcdy +工程师gcs +顾此失彼gcsb +贯彻执行gczx +共产主义gczy +各地方gdf +各大军区gdjq +广东省gds +高档商品gdsp +各单位gdw +高等院校gdyx +固定资产gdzc +个ge +各ge +革ge +合*ge +格ge +割ge +歌ge +隔ge +盖*ge +哥ge +铬ge +阁ge +戈ge +葛ge +搁ge +鸽ge +胳ge +疙ge +蛤ge +咯*ge +屹*ge +鬲ge +仡ge +哿ge +圪ge +塥ge +嗝ge +纥*ge +搿ge +膈ge +硌ge +镉ge +袼ge +颌*ge +虼ge +舸ge +骼ge +隔壁gebi +戈壁gebi +个别gebie +歌唱gechang +各处gechu +革除gechu +疙瘩geda +各地gedi +格调gediao +隔断geduan +个个gege +各个gege +各国geguo +隔阂gehe +歌喉gehou +各级geji +各界gejie +格局geju +割据geju +隔绝gejue +各类gelei +隔离geli +割裂gelie +格律gelu +革命geming +隔膜gemo +给gei +根gen +跟gen +亘gen +茛gen +哏gen +艮gen +根本genben +根除genchu +根底gendi +更geng +耕geng +颈geng +庚geng +羹geng +埂geng +耿geng +梗geng +哽geng +赓geng +绠geng +鲠geng +耕地gengdi +更迭gengdie +更动gengdong +更多gengduo +更改genggai +梗概genggai +更高genggao +更换genghuan +更加gengjia +更为gengwei +颈项gengxiang +更新gengxin +哽咽gengyan +耕耘gengyun +更正gengzheng +耿直gengzhi +梗直gengzhi +耕种gengzhong +梗阻gengzu +耕作gengzuo +根基genji +根据genju +跟前genqian +跟随gensui +根源genyuan +根治genzhi +跟着genzhuo +根子genzi +跟踪genzong +搁浅geqian +歌曲gequ +个人geren +格式geshi +歌颂gesong +个体geti +格外gewai +各位gewei +歌舞gewu +阁下gexia +各项gexiang +革新gexin +个性gexing +格言geyan +各样geyang +歌咏geyong +搁置gezhi +各种gezhong +各族gezu +国防部gfb +各方面gfm +格格不入ggbr +归根到底ggdd +恭恭敬敬ggjj +滚瓜烂熟ggls +歌功颂德ggsd +共和国ghg +各行各业ghgy +干劲冲天gjct +各级党委gjdw +各级领导gjld +国家利益gjly +国计民生gjms +工具书gjs +各尽所能gjsn +国库券gkq +工矿企业gkqy +孤陋寡闻glgw +规律性glx +国民党gmd +革命化gmh +革命家gmj +国民经济gmjj +购买力gml +光明磊落gmll +光明日报gmrb +顾名思义gmsy +冠冕堂皇gmth +刮目相看gmxk +光明正大gmzd +工农兵gnb +国内外gnw +工农业gny +工gong +公gong +共gong +供gong +功gong +攻gong +红*gong +巩gong +贡gong +汞gong +宫gong +恭gong +龚gong +躬gong +弓gong +拱gong +珙gong +肱gong +蚣gong +觥gong +公安gongan +公报gongbao +工本gongben +公布gongbu +公差gongcha +公拆gongchai +工厂gongchang +功臣gongchen +工程gongcheng +共处gongchu +供词gongci +共存gongcun +公道gongdao +公德gongde +功德gongde +工地gongdi +公敌gongdi +宫殿gongdian +攻读gongdu +公费gongfei +公愤gongfen +工夫gongfu +功夫gongfu +公告gonggao +公共gonggong +巩固gonggu +公关gongguan +公害gonghai +公函gonghan +共和gonghe +工会gonghui +供给gongji +共计gongji +攻击gongji +功绩gongji +公家gongjia +公斤gongjin +恭敬gongjing +工具gongju +公开gongkai +功课gongke +公款gongkuan +功劳gonglao +公理gongli +公里gongli +公历gongli +公路gonglu +功率gonglu +公民gongmin +共鸣gongming +公墓gongmu +功能gongneng +工农gongnong +公判gongpan +公平gongping +公仆gongpu +供求gongqiu +工区gongqu +公然gongran +工人gongren +公认gongren +供认gongren +工伤gongshang +公社gongshe +公审gongshen +工时gongshi +公事gongshi +共事gongshi +公式gongshi +公署gongshu +公司gongsi +公私gongsi +公诉gongsu +宫廷gongting +共同gongtong +恭维gongwei +公文gongwen +公物gongwu +公务gongwu +恭喜gongxi +贡献gongxian +工效gongxiao +功效gongxiao +供销gongxiao +共性gongxing +工序gongxu +共需gongxu +功勋gongxun +供养gongyang +工业gongye +工艺gongyi +供应gongying +公用gongyong +共有gongyou +公元gongyuan +公园gongyuan +公约gongyue +公允gongyun +公债gongzhai +公章gongzhang +共振gongzhen +工整gongzheng +公正gongzheng +公证gongzheng +供职gongzhi +公众gongzhong +工资gongzi +工作gongzuo +够gou +构gou +沟gou +句*gou +狗gou +钩gou +勾gou +购gou +苟gou +垢gou +佝gou +诟gou +岣gou +遘gou +媾gou +缑gou +枸gou +觏gou +彀gou +笱gou +篝gou +鞲gou +构成goucheng +勾搭gouda +勾当goudang +媾和gouhe +沟壑gouhe +构件goujian +勾结goujie +购买goumai +苟且gouqie +构思gousi +沟通goutong +勾通goutong +构陷gouxian +勾销gouxiao +购销gouxiao +勾引gouyin +构造gouzao +购置gouzhi +钩子gouzi +国庆节gqj +共青团gqt +光荣榜grb +根深蒂固gsdg +瓜熟蒂落gsdl +公使馆gsg +各式各样gsgy +甘肃省gss +工商业gsy +个体户gth +改头换面gthm +高谈阔论gtkl +鼓gu +固gu +古gu +骨gu +故gu +顾gu +股gu +谷gu +估gu +雇gu +孤gu +姑gu +贾*gu +辜gu +菇gu +咕gu +箍gu +沽gu +蛊gu +嘏gu +诂gu +菰gu +呱gu +崮gu +汩gu +梏gu +轱gu +牯gu +牿gu +臌gu +毂gu +瞽gu +罟gu +钴gu +锢gu +鸪gu +鹄*gu +痼gu +蛄gu +酤gu +觚gu +鲴gu +鹘gu +挂gua +刮gua +瓜gua +括*gua +剐gua +寡gua +褂gua +卦gua +诖gua +呱gua +栝gua +胍gua +鸹gua +瓜分guafen +瓜葛guage +挂号guahao +怪guai +乖guai +拐guai +乖舛guaichuan +乖戾guaili +乖僻guaipi +乖巧guaiqiao +怪物guaiwu +怪异guaiyi +拐杖guaizhang +挂名guaming +关guan +管guan +观guan +官guan +灌guan +贯guan +惯guan +冠guan +馆guan +罐guan +棺guan +纶*guan +倌guan +莞guan +掼guan +涫guan +盥guan +鹳guan +矜guan +鳏guan +关闭guanbi +观测guance +观察guancha +贯彻guanche +贯穿guanchuan +管道guandao +官邸guandi +观点guandian +官方guanfang +光guang +广guang +逛guang +咣guang +犷guang +桄guang +胱guang +灌溉guangai +光标guangbiao +广播guangbo +广博guangbo +光彩guangcai +广场guangchang +光大guangda +广大guangda +广东guangdong +广度guangdu +广泛guangfan +广告guanggao +光顾guanggu +光滑guanghua +光辉guanghui +光景guangjing +广阔guangkuo +光芒guangmang +广袤guangmao +光明guangming +光盘guangpan +光谱guangpu +光荣guangrong +观光guanguang +广西guangxi +光线guangxian +广义guangyi +光阴guangyin +光涌guangyong +广州guangzhou +关怀guanhuai +挂念guanian +管家guanjia +关键guanjian +管教guanjiao +关节guanjie +冠军guanjun +关卡guanka +观看guankan +关口guankou +管理guanli +贯例guanli +惯例guanli +官吏guanli +关联guanlian +官僚guanliao +观摩guanmo +灌木guanmu +官能guanneng +观念guannian +关切guanqie +观赏guanshang +管事guanshi +管束guanshu +灌输guanshu +关税guanshui +官司guansi +贯通guantong +关头guantou +观望guanwang +关系guanxi +管辖guanxia +官衔guanxian +关心guanxin +惯性guanxing +关押guanya +惯用guanyong +关于guanyu +官员guanyuan +观战guanzhan +关照guanzhao +管制guanzhi +观止guanzhi +观众guanzhong +关注guanzhu +贯注guanzhu +馆子guanzi +挂失guashi +挂帅guashuai +鼓吹guchui +故此guci +古代gudai +孤单gudan +故地gudi +古典gudian +固定guding +鼓动gudong +股东gudong +古董gudong +孤独gudu +咕嘟gudu +孤儿guer +股份gufen +辜负gufu +骨干gugan +雇工gugong +故宫gugong +古怪guguai +蛊惑guhuo +规gui +贵gui +归gui +硅gui +鬼gui +轨gui +龟gui +桂gui +瑰gui +圭gui +闺gui +诡gui +癸gui +柜gui +跪gui +刽gui +傀*gui +炔*gui +匦gui +刿gui +庋gui +宄gui +妫gui +桧gui +炅gui +晷gui +皈gui +簋gui +鲑gui +鳜gui +诡辩guibian +贵宾guibin +归并guibing +规程guicheng +归档guidang +轨道guidao +规定guiding +归队guidui +规范guifan +规格guige +归公guigong +归功guigong +桂冠guiguan +归国guiguo +规划guihua +鬼话guihua +归还guihuan +诡计guiji +轨迹guiji +贵贱guijian +归咎guijiu +规矩guiju +瑰丽guili +鬼脸guilian +龟裂guilie +规律guilu +诡秘guimi +规模guimo +归纳guina +闺女guinu +规劝guiquan +贵人guiren +归属guishu +龟缩guisuo +柜台guitai +闺秀guixiu +归于guiyu +规则guize +规章guizhang +贵重guizhong +贵州guizhou +鬼子guizi +贵族guizu +归罪guizui +顾及guji +估计guji +古迹guji +顾忌guji +估价gujia +古今gujin +古旧gujiu +故旧gujiu +故居guju +顾客guke +孤苦guku +古老gulao +孤立guli +鼓励guli +估量guliang +顾虑gulu +估摸gumo +滚gun +辊gun +棍gun +衮gun +绲gun +磙gun +鲧gun +滚动gundong +姑娘guniang +雇农gunong +滚烫guntang +棍子gunzi +国guo +过guo +果guo +锅guo +郭guo +涡*guo +裹guo +馘guo +埚guo +掴guo +呙guo +帼guo +崞guo +猓guo +椁guo +虢guo +聒guo +蜾guo +蝈guo +过半guoban +国策guoce +国产guochan +过程guocheng +过错guocuo +过度guodu +过渡guodu +果断guoduan +国法guofa +国防guofang +过分guofen +果腹guofu +果敢guogan +国歌guoge +过关guoguan +过后guohou +国会guohui +国际guoji +国籍guoji +国家guojia +国界guojie +国境guojing +国库guoku +过来guolai +过量guoliang +过虑guolu +锅炉guolu +国民guomin +过目guomu +果木guomu +国难guonan +国内guonei +果皮guopi +果品guopin +国旗guoqi +过期guoqi +国情guoqing +国庆guoqing +过去guoqu +果然guoran +过少guoshao +过甚guoshen +过剩guosheng +过时guoshi +国事guoshi +过失guoshi +果实guoshi +过头guotou +国外guowai +国王guowang +过问guowen +国务guowu +过细guoxi +国药guoyao +国营guoying +过硬guoying +过于guoyu +果园guoyuan +果真guozhen +锅子guozi +顾盼gupan +孤僻gupi +股票gupiao +骨气guqi +姑且guqie +顾全guquan +固然guran +古人guren +骨肉gurou +故事gushi +股市gushi +固守gushou +估算gusuan +固体guti +骨头gutou +故土gutu +顾问guwen +古文guwen +谷物guwu +鼓舞guwu +姑息guxi +故乡guxiang +故意guyi +雇佣guyong +固有guyou +雇员guyuan +鼓掌guzhang +故障guzhang +固执guzhi +拐弯抹角gwmj +国务委员gwwy +国务院gwy +改邪归正gxgz +更新换代gxhd +各行其事gxqs +感性认识gxrs +广西壮族gxzz +工业化gyh +工艺流程gylc +工艺美术gyms +工业品gyp +工艺品gyp +贵阳市gys +公有制gyz +各种各样gzgy +工资级别gzjb +各族人民gzrm +工作上gzs +广州市gzs +贵州省gzs +各自为政gzwz +高瞻远瞩gzyz +高瞻远嘱gzyz +工作者gzz +和h +会h +后h +化h +好h +合h +还h +活h +很h +回h +号h +毫h +花h +或h +海h +话h +红h +火h +黄h +害h +哈ha +蛤*ha +虾*ha +铪ha +哈达hada +还hai +海hai +害hai +孩hai +骸hai +氦hai +亥hai +骇hai +嘿*hai +咳*hai +嗨hai +胲hai +醢hai +海岸haian +海拔haiba +海报haibao +害虫haichong +害处haichu +海岛haidao +海港haigang +海关haiguan +还好haihao +海疆haijiang +海军haijun +海浪hailang +海绵haimian +害怕haipa +海上haishang +还是haishi +海外haiwai +海湾haiwan +海峡haixia +海啸haixiao +害羞haixiu +海洋haiyang +还要haiyao +还有haiyou +海域haiyu +海员haiyuan +孩子haizi +含han +焊han +旱han +喊han +汉han +寒han +汗han +函han +韩han +酣han +憨han +邯han +涵han +罕han +翰han +撼han +捍han +憾han +悍han +邗han +菡han +撖han +阚han +瀚han +晗han +焓han +顸han +颔han +蚶han +鼾han +寒潮hanchao +寒带handai +行*hang +航hang +夯hang +杭hang +吭*hang +巷*hang +沆hang +绗hang +珩hang +颃hang +航标hangbiao +航程hangcheng +航船hangchuan +行当hangdang +航道hangdao +航海hanghai +行家hangjia +行距hangju +航空hangkong +行列hanglie +航路hanglu +航模hangmo +函购hangou +行情hangqing +航天hangtian +航线hangxian +航向hangxiang +航行hangxing +航运hangyun +杭州hangzhou +含糊hanhu +含混hanhun +旱季hanji +函件hanjian +罕见hanjian +汉奸hanjian +喊叫hanjiao +焊接hanjie +寒冷hanleng +翰林hanlin +寒流hanliu +函授hanshou +函数hanshu +酣睡hanshui +寒酸hansuan +捍卫hanwei +含蓄hanxu +寒暄hanxuan +涵养hanyang +含义hanyi +涵义hanyi +汉语hanyu +含冤hanyuan +旱灾hanzai +汉字hanzi +汉族hanzu +好hao +号hao +毫hao +耗hao +豪hao +郝hao +浩hao +镐*hao +壕hao +嚎hao +貉*hao +蒿hao +薅hao +嗥hao +嚆hao +濠hao +灏hao +昊hao +皓hao +颢hao +蚝hao +好比haobi +毫不haobu +号称haocheng +好处haochu +浩大haoda +好歹haodai +浩荡haodang +好的haode +浩繁haofan +耗费haofei +好感haogan +好汉haohan +豪华haohua +好坏haohuai +号角haojiao +耗竭haojie +豪杰haojie +浩劫haojie +好看haokan +毫厘haoli +号令haoling +号码haoma +豪迈haomai +毫毛haomao +毫米haomi +浩淼haomiao +好奇haoqi +豪强haoqiang +豪情haoqing +好人haoren +豪绅haoshen +毫升haosheng +好事haoshi +豪爽haoshuang +好似haosi +耗损haosun +号啕haotao +好听haoting +好玩haowan +毫无haowu +好象haoxiang +好些haoxie +好样haoyang +好意haoyi +号召haozhao +好转haozhuan +汇编程序hbcx +货币回笼hbhl +货币流通hblt +河北省hbs +湖北省hbs +汇编语言hbyy +或多或少hdhs +海淀区hdq +和he +合he +河he +何he +核he +赫he +荷he +褐he +喝he +贺he +呵he +禾he +吓*he +盒he +菏he +貉he +阂he +涸he +鹤he +诃he +劾he +壑he +嗬he +阖he +纥he +曷he +盍he +颌he +蚵he +翮he +和蔼heai +哈尔滨heb +合办heban +荷包hebao +河北hebei +何必hebi +合并hebing +哈尔滨市hebs +何不hebu +喝彩hecai +合唱hechang +何尝hechang +合成hecheng +呵斥hechi +何处hechu +河川hechuan +河床hechuang +贺词heci +何等hedeng +贺电hedian +核定heding +核对hedui +合法hefa +何妨hefang +合肥hefei +合格hege +和好hehao +赫赫hehe +合乎hehu +合伙hehuo +黑hei +嘿hei +黑暗heian +黑白heibai +黑帮heibang +嘿嘿heihei +黑人heiren +黑色heise +黑市heishi +黑夜heiye +合计heji +核计heji +和解hejie +合金hejin +何苦heku +何况hekuang +合理heli +合力heli +合流heliu +河流heliu +合谋hemou +和睦hemu +很hen +狠hen +痕hen +恨hen +河南henan +狠毒hendu +很多henduo +河内henei +行*heng +横heng +衡heng +恒heng +哼heng +亨heng +蘅heng +珩*heng +桁heng +横财hengcai +哼哧hengchi +横幅hengfu +横亘henggen +横贯hengguan +横祸henghuo +横加hengjia +衡量hengliang +横蛮hengman +横批hengpi +衡器hengqi +横扫hengsao +横竖hengshu +恒心hengxin +横行hengxing +恒星hengxing +很好henhao +贺年henian +痕迹henji +很快henkuai +狠心henxin +狠抓henzhua +和平heping +和气heqi +河渠hequ +赫然heran +河山heshan +和尚heshang +合适heshi +核实heshi +合算hesuan +核算hesuan +河滩hetan +合同hetong +贺喜hexi +和谐hexie +核心hexin +贺信hexin +和煦hexu +何以heyi +合影heying +合营heying +核准hezhun +合资hezi +赫兹hezi +合作hezuo +合法权益hfqy +合肥市hfs +宏观世界hgsj +化公为私hgws +好高务远hgwy +核工业部hgyb +海关总署hgzs +后顾之忧hgzy +呼和浩特hhht +轰轰烈烈hhll +换句话说hjhs +黄金时代hjsd +环境卫生hjws +后继有人hjyr +海枯石烂hksl +合理化hlh +糊里糊涂hlht +黑龙江hlj +汗流浃背hljb +汗马功劳hmgl +海南岛hnd +河南省hns +湖南省hns +红hong +洪hong +轰hong +烘hong +哄hong +虹hong +鸿hong +宏hong +弘hong +黉hong +訇hong +讧hong +荭hong +蕻hong +薨hong +闳hong +泓hong +红尘hongchen +轰动hongdong +洪都hongdu +洪峰hongfeng +鸿沟honggou +宏观hongguan +红光hongguang +红花honghua +红军hongjun +红利hongli +洪亮hongliang +轰隆honglong +弘论honglun +鸿毛hongmao +轰鸣hongming +哄骗hongpian +红旗hongqi +红人hongren +红色hongse +洪水hongshui +哄抬hongtai +宏图hongtu +宏伟hongwei +红星hongxing +弘扬hongyang +鸿运hongyun +红晕hongyun +轰炸hongzha +后hou +候hou +厚hou +侯hou +喉hou +猴hou +吼hou +堠hou +後hou +逅hou +瘊hou +篌hou +糇hou +鲎hou +骺hou +后备houbei +后辈houbei +后边houbian +厚薄houbo +候补houbu +后尘houchen +后代houdai +厚道houdao +厚度houdu +后盾houdun +后方houfang +后果houguo +后患houhuan +后悔houhui +后记houji +后进houjin +后劲houjin +后来houlai +喉咙houlong +后门houmen +后面houmian +后期houqi +后勤houqin +后人houren +喉舌houshe +厚实houshi +后嗣housi +后台houtai +后天houtian +后退houtui +后续houxu +候选houxuan +后裔houyi +后缀houzhui +和平共处hpgc +黄埔江hpj +后勤部hqb +何去何从hqhc +合情合理hqhl +好容易hry +好事多磨hsdm +胡思乱想hslx +航天工业部htgb +昏头昏脑hthn +欢天喜地htxd +和*hu +护hu +互hu +湖hu +呼hu +户hu +弧hu +乎hu +胡hu +糊hu +虎hu +忽hu +核*hu +瑚hu +戏*hu +壶hu +葫hu +蝴hu +狐hu +唬hu +沪hu +冱hu +唿hu +囫hu +岵hu +猢hu +怙hu +惚hu +浒hu +滹hu +琥hu +槲hu +轷hu +觳hu +烀hu +煳hu +戽hu +扈hu +祜hu +瓠hu +鹄hu +鹕hu +鹱hu +笏hu +醐hu +斛hu +化hua +花hua +话hua +划hua +滑hua +华hua +画hua +哗hua +猾hua +豁*hua +骅hua +桦hua +砉hua +铧hua +画报huabao +华北huabei +哗变huabian +话柄huabing +划拨huabo +划策huace +画册huace +华东huadong +花朵huaduo +花儿huaer +化肥huafei +花费huafei +划分huafen +化工huagong +华贵huagui +化合huahe +花卉huahui +坏huai +怀huai +划*huai +淮huai +槐huai +徊huai +踝huai +怀抱huaibao +淮北huaibei +坏处huaichu +怀古huaigu +淮海huaihai +怀恨huaihen +怀旧huaijiu +淮南huainan +怀念huainian +坏人huairen +坏事huaishi +怀疑huaiyi +怀着huaizhe +滑稽huaji +画家huajia +话剧huaju +哗啦huala +画廊hualang +华丽huali +画面huamian +化名huaming +还*huan +环huan +换huan +欢huan +缓huan +患huan +幻huan +焕huan +桓huan +唤huan +痪huan +豢huan +涣huan +宦huan +郇huan +奂huan +萑huan +擐huan +圜huan +獾huan +洹huan +浣huan +漶huan +寰huan +逭huan +缳huan +锾huan +鲩huan +鬟huan +华南huanan +欢畅huanchang +缓冲huanchong +幻灯huandeng +欢度huandu +焕发huanfa +黄huang +簧huang +荒huang +皇huang +慌huang +蝗huang +磺huang +凰huang +惶huang +煌huang +晃huang +幌huang +恍huang +谎huang +隍huang +徨huang +湟huang +潢huang +遑huang +璜huang +肓huang +癀huang +蟥huang +篁huang +鳇huang +磺胺huangan +皇朝huangchao +荒诞huangdan +晃荡huangdang +皇帝huangdi +荒废huangfei +黄海huanghai +黄河huanghe +恍惚huanghu +谎话huanghua +黄昏huanghun +黄金huangjin +皇历huangli +荒凉huangliang +荒乱huangluan +慌乱huangluan +慌忙huangmang +荒谬huangmiu +恍然huangran +黄色huangse +黄山huangshan +皇上huangshang +荒唐huangtang +环顾huangu +宦官huanguan +谎言huangyan +慌张huangzhang +幌子huangzi +缓和huanhe +欢呼huanhu +环环huanhuan +滑腻huani +花鸟huaniao +还给huanji +缓急huanji +还价huanjia +环节huanjie +环境huanjing +幻境huanjing +幻景huanjing +欢聚huanju +幻觉huanjue +欢乐huanle +缓慢huanman +患难huannan +唤起huanqi +缓期huanqi +欢庆huanqing +环球huanqiu +寰球huanqiu +换取huanqu +环绕huanrao +涣散huansan +欢声huansheng +环视huanshi +欢送huansong +换算huansuan +欢腾huanteng +欢喜huanxi +幻想huanxiang +欢笑huanxiao +欢心huanxin +欢欣huanxin +环行huanxing +缓刑huanxing +唤醒huanxing +幻影huanying +欢迎huanying +寰宇huanyu +还原huanyuan +患者huanzhe +滑坡huapo +花腔huaqiang +华侨huaqiao +划清huaqing +花圈huaquan +划拳huaquan +哗然huaran +华人huaren +花色huase +化身huashen +化石huashi +划算huasuan +话题huati +滑头huatou +花纹huawen +华夏huaxia +化纤huaxian +画像huaxiang +花絮huaxu +化学huaxue +画押huaya +化验huayan +花样huayang +华裔huayi +话音huayin +话语huayu +花园huayuan +画展huazhan +花招huazhao +华中huazhong +化装huazhuang +化妆huazhuang +湖北hubei +胡扯huche +弧度hudu +忽而huer +呼喊huhan +呼号huhao +呼唤huhuan +互惠huhui +会hui +回hui +灰hui +挥hui +辉hui +汇hui +毁hui +慧hui +恢hui +绘hui +惠hui +徽hui +溃*hui +堕*hui +徊*hui +蛔hui +悔hui +卉hui +晦hui +贿hui +秽hui +烩hui +讳hui +诲hui +诙hui +茴hui +荟hui +蕙hui +咴hui +哕hui +喙hui +隳hui +洄hui +浍hui +彗hui +缋hui +珲hui +桧*hui +晖hui +恚hui +虺hui +蟪hui +麾hui +灰暗huian +回报huibao +汇报huibao +回避huibi +汇编huibian +会场huichang +回潮huichao +灰尘huichen +回春huichun +荟萃huicui +回答huida +回荡huidang +回电huidian +汇兑huidui +挥发huifa +汇费huifei +会风huifeng +回复huifu +恢复huifu +悔改huigai +回顾huigu +惠顾huigu +悔过huiguo +会合huihe +回合huihe +汇合huihe +悔恨huihen +恢弘huihong +会话huihua +回话huihua +绘画huihua +毁坏huihuai +辉煌huihuang +挥霍huihuo +会集huiji +回击huiji +汇集huiji +回家huijia +会见huijian +会聚huiju +汇聚huiju +回扣huikou +汇款huikuan +回来huilai +回笼huilong +汇率huilu +贿赂huilu +会面huimian +毁灭huimie +回民huimin +汇票huipiao +回去huiqu +挥洒huisa +灰色huise +晦涩huise +回收huishou +回首huishou +会谈huitan +会堂huitang +会同huitong +回头huitou +回味huiwei +会晤huiwu +挥舞huiwu +悔悟huiwu +麾下huixia +回想huixiang +回响huixiang +诙谐huixie +灰心huixin +彗星huixing +会演huiyan +汇演huiyan +会议huiyi +回忆huiyi +回音huiyin +辉映huiying +会员huiyuan +会战huizhan +徽章huizhang +会诊huizhen +绘制huizhi +回转huizhuan +汇总huizong +回族huizu +户籍huji +呼叫hujiao +户口hukou +虎口hukou +护理huli +互利huli +护林hulin +呼噜hulu +胡乱huluan +忽略hulue +互勉humian +混hun +浑hun +荤hun +昏hun +婚hun +魂hun +诨hun +馄hun +阍hun +溷hun +湖南hunan +胡闹hunao +昏沉hunchen +混合hunhe +浑厚hunhou +昏黄hunhuang +混迹hunji +婚礼hunli +混乱hunluan +糊弄hunong +婚配hunpei +混入hunru +浑身hunshen +混同huntong +混淆hunxiao +婚姻hunyin +昏庸hunyong +混杂hunza +混帐hunzhang +混浊hunzhuo +浑浊hunzhuo +和*huo +活huo +或huo +火huo +货huo +获huo +伙huo +霍huo +豁huo +惑huo +祸huo +劐huo +藿huo +攉huo +嚯huo +夥huo +钬huo +锪huo +镬huo +耠huo +蠖huo +火把huoba +伙伴huoban +火暴huobao +货币huobi +火柴huochai +火车huoche +豁达huoda +获得huode +霍地huodi +活动huodong +伙房huofang +祸根huogen +祸害huohai +火候huohou +火化huohua +火花huohua +祸患huohuan +活活huohuo +伙计huoji +火箭huojian +火警huojing +火炬huoju +火坑huokeng +活力huoli +霍乱huoluan +活泼huopo +获取huoqu +豁然huoran +货色huose +火山huoshan +获胜huosheng +或是huoshi +伙食huoshi +祸首huoshou +伙同huotong +货物huowu +获悉huoxi +火线huoxian +活现huoxian +或许huoxu +火药huoyao +活页huoye +活跃huoyue +货运huoyun +火灾huozai +火葬huozang +或则huoze +或者huozhe +获准huozhun +湖泊hupo +忽然huran +呼声husheng +护士hushi +忽视hushi +湖水hushui +胡说hushuo +护送husong +胡同hutong +互通hutong +户头hutou +糊涂hutu +护卫huwei +呼吸huxi +互相huxiang +呼啸huxiao +虎穴huxue +护养huyang +呼应huying +呼吁huyu +护照huzhao +互助huzhu +毫无疑问hwyw +互相爱护hxah +横行霸道hxbd +互相帮助hxbz +欢欣鼓舞hxgw +候选人hxr +合作化hzh +杭州市hzs +化整为零hzwl +级j +就j +进j +加j +经j +家j +结j +阶j +间j +件j +及j +解j +较j +机j +军j +接j +教j +极j +九j +见j +基本国策jbgc +基本上jbs +据不完全统计jbwj +饥不择食jbzs +坚持不懈jcbx +集成电路jcdl +基础上jcs +绝大部分jdbf +坚定不移jdby +绝大多数jdds +鉴定会jdh +绝对化jdh +经得起jdq +见多识广jdsg +精打细算jdxs +接二连三jels +解放后jfh +解放军jfj +解放军报jfjb +解放前jfq +仅供参考jgck +机构改革jggg +坚固耐用jgny +襟怀坦白jhtb +计划性jhx +级ji +及ji +机ji +极ji +几ji +积ji +给ji +基ji +其*ji +记ji +己ji +期*ji +系*ji +革*ji +计ji +集ji +即ji +际ji +季ji +激ji +济ji +技ji +击ji +继ji +急ji +剂ji +既ji +纪ji +寄ji +挤ji +鸡ji +迹ji +绩ji +齐*ji +奇*ji +吉ji +脊ji +辑ji +籍ji +疾ji +肌ji +棘ji +畸ji +圾ji +稽ji +箕ji +饥ji +讥ji +姬ji +缉ji +汲ji +嫉ji +蓟ji +冀ji +伎ji +祭ji +悸ji +寂ji +忌ji +妓ji +藉ji +丌ji +亟ji +乩ji +剞ji +佶ji +偈ji +诘ji +墼ji +芨ji +芰ji +荠ji +蒺ji +蕺ji +掎ji +叽ji +咭ji +哜ji +唧ji +岌ji +嵴ji +洎ji +屐ji +骥ji +畿ji +玑ji +楫ji +殛ji +戟ji +戢ji +赍ji +觊ji +犄ji +齑ji +矶ji +羁ji +嵇ji +稷ji +瘠ji +虮ji +笈ji +笄ji +暨ji +跻ji +跽ji +霁ji +鲚ji +鲫ji +髻ji +麂ji +加jia +家jia +架jia +价jia +甲jia +夹jia +假jia +钾jia +贾jia +稼jia +驾jia +嘉jia +枷jia +佳jia +荚jia +颊jia +嫁jia +茄*jia +挟*jia +嘏*jia +伽jia +郏jia +葭jia +岬jia +浃jia +迦jia +珈jia +戛jia +胛jia +恝jia +铗jia +镓jia +痂jia +瘕jia +袷jia +蛱jia +笳jia +袈jia +跏jia +加班jiaban +甲板jiaban +加倍jiabei +甲虫jiachong +家畜jiachu +家当jiadang +家底jiadi +假定jiading +加法jiafa +家访jiafang +价格jiage +加工jiagong +佳话jiahua +家伙jiahuo +加急jiaji +嘉奖jiajiang +家教jiajiao +嫁接jiajie +佳节jiajie +假借jiajie +加紧jiajin +家境jiajing +家具jiaju +加剧jiaju +加快jiakuai +加仑jialun +加码jiama +假冒jiamao +家门jiamen +加密jiami +加冕jiamian +价目jiamu +间jian +件jian +见jian +建jian +坚jian +减jian +检jian +践jian +尖jian +简jian +碱jian +剪jian +艰jian +渐jian +肩jian +键jian +健jian +柬jian +鉴jian +剑jian +歼jian +监jian +兼jian +浅*jian +奸jian +箭jian +茧jian +舰jian +俭jian +笺jian +煎jian +缄jian +硷jian +拣jian +捡jian +荐jian +槛jian +贱jian +饯jian +溅jian +涧jian +僭jian +谏jian +谫jian +菅jian +蒹jian +搛jian +囝*jian +湔jian +蹇jian +謇jian +缣jian +枧jian +楗jian +戋jian +戬jian +牮jian +犍jian +毽jian +腱jian +睑jian +锏jian +鹣jian +裥jian +笕jian +翦jian +趼jian +踺jian +鲣jian +鞯jian +吉安jian +煎熬jianao +简报jianbao +渐变jianbian +简便jianbian +简编jianbian +鉴别jianbie +兼并jianbing +尖兵jianbing +剪裁jiancai +剪彩jiancai +检测jiance +检查jiancha +检察jiancha +监察jiancha +减产jianchan +建成jiancheng +简称jiancheng +坚持jianchi +简单jiandan +建党jiandang +减低jiandi +检点jiandian +间谍jiandie +坚定jianding +鉴定jianding +监督jiandu +间断jianduan +尖端jianduan +简短jianduan +舰队jiandui +健儿jianer +减法jianfa +肩负jianfu +将jiang +降jiang +讲jiang +强*jiang +江jiang +浆jiang +蒋jiang +奖jiang +疆jiang +僵jiang +姜jiang +桨jiang +匠jiang +酱jiang +茳jiang +洚jiang +绛jiang +缰jiang +犟jiang +礓jiang +耩jiang +糨jiang +豇jiang +奖杯jiangbei +疆场jiangchang +奖惩jiangcheng +僵持jiangchi +降低jiangdi +间隔jiange +讲稿jianggao +江湖jianghu +僵化jianghua +讲话jianghua +降级jiangji +降价jiangjia +讲解jiangjie +疆界jiangjie +将近jiangjin +奖金jiangjin +讲究jiangjiu +僵局jiangju +将军jiangjun +讲课jiangke +将来jianglai +讲理jiangli +奖励jiangli +降临jianglin +将领jiangling +降落jiangluo +江南jiangnan +奖品jiangpin +讲评jiangping +奖券jiangquan +江山jiangshan +讲师jiangshi +僵尸jiangshi +讲授jiangshou +讲述jiangshu +降水jiangshui +江苏jiangsu +讲台jiangtai +讲坛jiangtan +疆土jiangtu +坚固jiangu +兼顾jiangu +监管jianguan +建国jianguo +降温jiangwen +江西jiangxi +讲习jiangxi +匠心jiangxin +讲学jiangxue +讲演jiangyan +将要jiangyao +讲义jiangyi +僵硬jiangying +奖章jiangzhang +讲座jiangzuo +监护jianhu +简化jianhua +间或jianhuo +奸计jianji +歼击jianji +剪辑jianji +减价jianjia +渐渐jianjian +健将jianjiang +建交jianjiao +间接jianjie +见解jianjie +简介jianjie +简洁jianjie +简捷jianjie +渐进jianjin +监禁jianjin +检举jianju +艰巨jianju +坚决jianjue +健康jiankang +尖刻jianke +坚苦jianku +艰苦jianku +监牢jianlao +建立jianli +尖利jianli +简历jianli +简练jianlian +简陋jianlou +简略jianlue +健美jianmei +减免jianmian +歼灭jianmie +简明jianming +缄默jianmo +艰难jiannan +键盘jianpan +简拼jianpin +简朴jianpu +俭朴jianpu +坚强jianqiang +减轻jianqing +健全jianquan +兼任jianren +坚韧jianren +兼容jianrong +尖锐jianrui +减弱jianruo +艰涩jianse +鉴赏jianshang +减少jianshao +建设jianshe +艰深jianshen +见识jianshi +坚实jianshi +监视jianshi +建树jianshu +减速jiansu +检索jiansuo +践踏jianta +健谈jiantan +检讨jiantao +简体jianti +舰艇jianting +减退jiantui +健忘jianwang +间文jianwen +见闻jianwen +间隙jianxi +奸细jianxi +艰险jianxian +见效jianxiao +间歇jianxie +简写jianxie +坚信jianxin +艰辛jianxin +减刑jianxing +检修jianxiu +简讯jianxun +检验jianyan +简要jianyao +建议jianyi +坚毅jianyi +简易jianyi +奸淫jianyin +坚硬jianying +剪影jianying +鉴于jianyu +监狱jianyu +减员jianyuan +检阅jianyue +建造jianzao +简则jianze +坚贞jianzhen +监制jianzhi +简直jianzhi +兼职jianzhi +建筑jianzhu +简装jianzhuang +健壮jianzhuang +较jiao +教jiao +交jiao +角jiao +叫jiao +脚jiao +胶jiao +浇jiao +焦jiao +觉*jiao +校*jiao +搅jiao +酵jiao +郊jiao +铰jiao +窖jiao +椒jiao +礁jiao +骄jiao +娇jiao +嚼jiao +矫jiao +侥jiao +狡jiao +饺jiao +缴jiao +绞jiao +剿jiao +轿jiao +佼jiao +僬jiao +艽jiao +茭jiao +挢jiao +噍jiao +峤jiao +徼jiao +湫*jiao +姣jiao +敫jiao +皎jiao +鹪jiao +蛟jiao +醮jiao +跤jiao +鲛jiao +骄傲jiaoao +搅拌jiaoban +狡辩jiaobian +教材jiaocai +交叉jiaocha +教程jiaocheng +交错jiaocuo +较大jiaoda +交代jiaodai +交淡jiaodan +教导jiaodao +交点jiaodian +焦点jiaodian +校订jiaoding +角度jiaodu +校对jiaodui +较多jiaoduo +焦耳jiaoer +交锋jiaofeng +交付jiaofu +浇灌jiaoguan +娇贵jiaogui +叫喊jiaohan +较好jiaohao +叫好jiaohao +狡猾jiaohua +交换jiaohuan +叫唤jiaohuan +教诲jiaohui +缴获jiaohuo +交际jiaoji +矫健jiaojian +交接jiaojie +交界jiaojie +叫苦jiaoku +较快jiaokuai +教练jiaolian +较量jiaoliang +交流jiaoliu +搅乱jiaoluan +角落jiaoluo +叫骂jiaoma +剿灭jiaomie +酵母jiaomu +交纳jiaona +缴纳jiaona +娇嫩jiaonen +交配jiaopei +骄气jiaoqi +交情jiaoqing +郊区jiaoqu +叫嚷jiaorang +角色jiaose +交涉jiaoshe +教师jiaoshi +教授jiaoshou +教唆jiaosuo +脚踏jiaota +交谈jiaotan +教堂jiaotang +交替jiaoti +教条jiaotiao +交通jiaotong +郊外jiaowai +交往jiaowang +较为jiaowei +狡黠jiaoxia +叫嚣jiaoxiao +侥幸jiaoxing +绞刑jiaoxing +教学jiaoxue +教训jiaoxun +教养jiaoyang +骄阳jiaoyang +教益jiaoyi +交易jiaoyi +交谊jiaoyi +教育jiaoyu +教员jiaoyuan +狡诈jiaozha +校正jiaozheng +脚注jiaozhu +角逐jiaozhu +浇铸jiaozhu +校准jiaozhun +焦灼jiaozhuo +娇纵jiaozong +叫做jiaozuo +家谱jiapu +假期jiaqi +价钱jiaqian +加强jiaqiang +假日jiari +加入jiaru +假如jiaru +假若jiaruo +加上jiashang +假设jiashe +加深jiashen +假使jiashi +架势jiashi +驾驶jiashi +家属jiashu +假说jiashuo +加速jiasu +枷锁jiasuo +家庭jiating +家乡jiaxiang +假想jiaxiang +家业jiaye +加以jiayi +佳音jiayin +家用jiayong +加油jiayou +家园jiayuan +夹杂jiaza +加载jiazai +家长jiazhang +价值jiazhi +加重jiazhong +假装jiazhuang +嫁妆jiazhuang +架子jiazi +家族jiazu +击败jibai +羁绊jiban +几倍jibei +基本jiben +击毙jibi +级别jibie +疾病jibing +计策jice +基层jiceng +稽查jicha +机场jichang +集成jicheng +继承jicheng +计酬jichou +基础jichu +机床jichuang +几次jici +急促jicu +积存jicun +寄存jicun +极大jida +亟待jidai +激荡jidang +记得jide +基地jidi +机电jidian +极点jidian +基调jidiao +机动jidong +激动jidong +极度jidu +几度jidu +即度jidu +季度jidu +基督jidu +嫉妒jidu +忌妒jidu +极端jiduan +结jie +阶jie +解jie +接jie +节jie +家*jie +界jie +截jie +介jie +借jie +价*jie +届jie +街jie +揭jie +洁jie +杰jie +竭jie +皆jie +秸jie +劫jie +桔jie +捷jie +睫jie +姐jie +戒jie +藉jie +芥jie +疥jie +诫jie +楷*jie +偈*jie +讦jie +诘*jie +拮jie +喈jie +嗟jie +婕jie +孑jie +桀jie +碣jie +疖jie +颉jie +蚧jie +羯jie +鲒jie +骱jie +饥饿jie +结案jiean +洁白jiebai +接班jieban +捷报jiebao +戒备jiebei +结彩jiecai +节操jiecao +阶层jieceng +劫持jiechi +杰出jiechu +解除jiechu +接触jiechu +戒除jiechu +揭穿jiechuan +结存jiecun +解答jieda +接待jiedai +借贷jiedai +街道jiedao +解冻jiedong +阶段jieduan +截断jieduan +揭发jiefa +借方jiefang +解放jiefang +街坊jiefang +结构jiegou +解雇jiegu +借故jiegu +结果jieguo +结合jiehe +结核jiehe +结婚jiehun +阶级jieji +接见jiejian +节俭jiejian +借鉴jiejian +结交jiejiao +姐姐jiejie +接近jiejin +竭尽jiejin +结晶jiejing +捷径jiejing +洁净jiejing +解救jiejiu +结局jieju +解决jiejue +孑孓jiejue +解开jiekai +揭开jiekai +解渴jieke +接口jiekou +借口jiekou +借款jiekuan +竭力jieli +接连jielian +揭露jielu +戒律jielu +结论jielun +解闷jiemen +结盟jiemeng +界面jiemian +节目jiemu +揭幕jiemu +接纳jiena +解聘jiepin +解剖jiepou +节气jieqi +接洽jieqia +截取jiequ +既而jier +节日jieri +介入jieru +解散jiesan +介绍jieshao +节省jiesheng +届时jieshi +结实jieshi +解释jieshi +揭示jieshi +解手jieshou +接受jieshou +接收jieshou +结束jieshu +解说jieshuo +结算jiesuan +解体jieti +阶梯jieti +接替jieti +接头jietou +街头jietou +解脱jietuo +结尾jiewei +解围jiewei +接吻jiewen +解析jiexi +界线jiexian +界限jiexian +揭晓jiexiao +戒严jieyan +结业jieye +介意jieyi +接应jieying +结余jieyu +节约jieyue +结帐jiezhang +接着jiezhao +节制jiezhi +介质jiezhi +戒指jiezhi +借支jiezhi +截止jiezhi +借助jiezhu +节奏jiezou +杰作jiezuo +激发jifa +技法jifa +讥讽jifeng +几个jige +及格jige +技工jigong +记功jigong +机构jigou +叽咕jigu +机关jiguan +籍贯jiguan +极光jiguang +激光jiguang +记过jiguo +极好jihao +记号jihao +集合jihe +几何jihe +稽核jihe +几乎jihu +激化jihua +计划jihua +饥荒jihuang +机会jihui +集会jihui +击毁jihui +忌讳jihui +积极jiji +机件jijian +计件jijian +急件jijian +击剑jijian +即将jijiang +计较jijiao +季节jijie +急进jijin +基金jijin +机警jijing +即景jijing +寂静jijing +急救jijiu +积聚jiju +急剧jiju +急遽jiju +寄居jiju +季刊jikan +即刻jike +疾苦jiku +击溃jikui +积累jilei +极力jili +吉利jili +激励jili +伎俩jilia +计量jiliang +寂寥jiliao +激烈jilie +吉林jilin +机灵jiling +激流jiliu +记录jilu +纪律jilu +纪录jilu +辑录jilu +击落jiluo +急忙jimang +机密jimi +寂寞jimo +计谋jimou +进jin +金jin +近jin +紧jin +斤jin +今jin +尽jin +仅jin +劲jin +浸jin +禁jin +津jin +筋jin +锦jin +晋jin +巾jin +襟jin +谨jin +靳jin +烬jin +卺jin +荩jin +堇jin +噤jin +馑jin +廑jin +妗jin +缙jin +瑾jin +槿jin +赆jin +觐jin +衿jin +缉拿jina +济南jinan +禁闭jinbi +锦标jinbiao +进步jinbu +浸沉jinchen +进程jincheng +进出jinchu +紧凑jincou +近代jindai +劲敌jindi +进度jindu +金额jine +机能jineng +技能jineng +进而jiner +进犯jinfan +经jing +精jing +京jing +径jing +井jing +静jing +竟jing +晶jing +净jing +境jing +镜jing +景jing +警jing +劲*jing +茎jing +敬jing +惊jing +睛jing +竞jing +荆jing +兢jing +鲸jing +粳jing +痉jing +靖jing +刭jing +儆jing +阱jing +菁jing +獍jing +憬jing +泾jing +迳jing +弪jing +婧jing +肼jing +胫jing +腈jing +旌jing +靓*jing +敬爱jingai +警报jingbao +警备jingbei +精兵jingbing +精采jingcai +精彩jingcai +警察jingcha +经常jingchang +精粹jingcui +静电jingdian +经典jingdian +惊动jingdong +精度jingdu +经费jingfei +精干jinggan +竟敢jinggan +警告jinggao +经过jingguo +净化jinghua +精华jinghua +经济jingji +竞技jingji +荆棘jingji +精简jingjian +境界jingjie +警戒jingjie +经久jingjiu +惊恐jingkong +经理jingli +经历jingli +精力jingli +敬礼jingli +精练jinglian +精良jingliang +经络jingluo +精美jingmei +精密jingmi +精明jingming +进攻jingong +敬佩jingpei +精辟jingpi +景气jingqi +惊奇jingqi +精巧jingqiao +精确jingque +竟然jingran +竞赛jingsai +景色jingse +经商jingshang +精神jingshen +经手jingshou +经受jingshou +精髓jingsui +静态jingtai +惊叹jingtan +晶体jingti +警惕jingti +精通jingtong +镜头jingtou +筋骨jingu +禁锢jingu +尽管jinguan +巾帼jinguo +经委jingwei +警卫jingwei +敬畏jingwei +景物jingwu +精细jingxi +京戏jingxi +惊险jingxian +景象jingxiang +经销jingxiao +经心jingxin +精心jingxin +惊心jingxin +惊醒jingxing +竞选jingxuan +惊讶jingya +经验jingyan +敬仰jingyang +经营jingying +晶莹jingying +经由jingyou +境遇jingyu +精湛jingzhan +竞争jingzheng +精制jingzhi +径直jingzhi +精致jingzhi +静止jingzhi +净值jingzhi +竟址jingzhi +净重jingzhong +镜子jingzi +静坐jingzuo +近海jinhai +今后jinhou +近乎jinhu +进化jinhua +几年jinian +记念jinian +纪念jinian +晋级jinji +紧急jinji +近郊jinjiao +紧紧jinjin +仅仅jinjin +进军jinjun +进口jinkou +尽快jinkuai +近况jinkuang +进来jinlai +近来jinlai +尽力jinli +尽量jinliang +斤两jinliang +禁令jinling +劲旅jinlu +紧密jinmi +近年jinnian +今年jinnian +金牌jinpai +紧迫jinpo +近期jinqi +近前jinqian +金钱jinqian +尽情jinqing +进去jinqu +进取jinqu +禁区jinqu +近日jinri +今日jinri +金融jinrong +进入jinru +浸入jinru +谨慎jinshen +晋升jinsheng +今是jinshi +尽是jinshi +近视jinshi +金属jinshu +近似jinsi +紧缩jinsuo +今天jintian +津贴jintie +尽头jintou +劲头jintou +浸透jintou +进退jintui +今晚jinwan +今昔jinxi +尽心jinxin +进行jinxing +进修jinxiu +锦秀jinxiu +谨严jinyan +紧要jinyao +进展jinzhan +紧张jinzhang +今朝jinzhao +紧着jinzhe +禁止jinzhi +尽职jinzhi +进驻jinzhu +金子jinzi +炯jiong +窘jiong +迥jiong +炅*jiong +扃jiong +窘迫jiongpo +迥然jiongran +击破jipo +急迫jipo +及其jiqi +极其jiqi +激起jiqi +机器jiqi +机枪jiqiang +技巧jiqiao +急切jiqie +激情jiqing +汲取jiqu +集权jiquan +既然jiran +己任jiren +继任jiren +即日jiri +吉日jiri +肌肉jirou +极少jishao +寄生jisheng +即是jishi +及时jishi +几时jishi +计时jishi +即时jishi +即使jishi +记事jishi +基石jishi +集市jishi +级数jishu +基数jishu +计数jishu +记述jishu +技术jishu +祭祀jisi +激素jisu +急速jisu +计算jisuan +机体jiti +集体jiti +肌体jiti +几天jitian +集团jituan +寄托jituo +就jiu +九jiu +旧jiu +究jiu +久jiu +救jiu +酒jiu +纠jiu +揪jiu +玖jiu +韭jiu +灸jiu +厩jiu +臼jiu +舅jiu +咎jiu +疚jiu +僦jiu +啾jiu +阄jiu +柩jiu +桕jiu +鸠jiu +鹫jiu +赳jiu +鬏jiu +就餐jiucan +纠察jiucha +纠缠jiuchan +就此jiuci +就地jiudi +就范jiufan +纠纷jiufen +纠葛jiuge +救国jiuguo +救护jiuhu +救火jiuhuo +纠集jiuji +鸠集jiuji +救济jiuji +救急jiuji +九江jiujiang +九届jiujie +就近jiujin +酒精jiujing +究竟jiujing +救命jiuming +救生jiusheng +就是jiushi +就事jiushi +救亡jiuwang +久违jiuwei +酒窝jiuwo +酒席jiuxi +救险jiuxian +揪心jiuxin +救星jiuxing +就绪jiuxu +就学jiuxue +久仰jiuyang +就要jiuyao +就业jiuye +久远jiuyuan +九月jiuyue +救灾jiuzai +纠正jiuzheng +就职jiuzhi +救治jiuzhi +九洲jiuzhou +救助jiuzhu +极为jiwei +纪委jiwei +极限jixian +迹象jixiang +吉祥jixiang +讥笑jixiao +机械jixie +记性jixing +急性jixing +畸形jixing +即兴jixing +吉凶jixiong +几许jixu +积蓄jixu +继续jixu +记叙jixu +急需jixu +集训jixun +积压jiya +羁押jiya +给养jiyang +机要jiyao +纪要jiyao +给以jiyi +记忆jiyi +技艺jiyi +基因jiyin +急用jiyong +基于jiyu +急于jiyu +机遇jiyu +给予jiyu +寄予jiyu +觊觎jiyu +纪元jiyuan +集约jiyue +记载jizai +及早jizao +急躁jizao +激增jizeng +记帐jizhang +记者jizhe +集镇jizhen +机制jizhi +及至jizhi +机智jizhi +集中jizhong +击中jizhong +记住jizhu +基准jizhun +集资jizi +经济核算jjhs +聚精会神jjhs +将计就计jjjj +戒骄戒躁jjjz +近几年来jjnl +竭尽全力jjql +节假日jjr +积极性jjx +经济效益jjxy +兢兢业业jjyy +精简整编jjzb +叽叽喳喳jjzz +艰苦奋斗jkfd +尽可能jkn +教科书jks +俱乐部jlb +交流电jld +吉林省jls +价廉物美jlwm +纪律性jlx +纪念碑jnb +几年来jnl +近年来jnl +纪念品jnp +济南市jns +吉普车jpc +坚强不屈jqbq +奖勤罚懒jqfl +机器人jqr +急起直追jqzz +截然不同jrbt +兼容性jrx +积少成多jscd +金山公司jsgs +集思广益jsgy +精神焕发jshf +计算机jsj +尽善尽美jsjm +集市贸易jsmy +介绍人jsr +就是说jss +计算所jss +江苏省jss +举世闻名jswm +介绍信jsx +技术员jsy +计算中心jszx +交通部jtb +家庭出身jtcs +惊天动地jtdd +具体地说jtds +晶体管jtg +交通工具jtgj +脚踏实地jtsd +具体说来jtsl +具ju +据ju +局ju +举ju +车*ju +句ju +聚ju +距ju +巨ju +居ju +锯ju +剧ju +矩ju +拒ju +柜*ju +桔*ju +鞠ju +拘ju +狙ju +疽ju +驹ju +菊ju +咀ju +沮ju +踞ju +俱ju +惧ju +炬ju +倨ju +讵ju +苣ju +苴ju +莒ju +掬ju +遽ju +屦ju +琚ju +枸*ju +椐ju +榘ju +榉ju +橘ju +犋ju +飓ju +钜ju +锔ju +窭ju +裾ju +趄ju +醵ju +踽ju +龃ju +雎ju +瞿*ju +鞫ju +卷juan +捐juan +鹃juan +娟juan +倦juan +眷juan +绢juan +俊*juan +鄄juan +狷juan +涓juan +桊juan +蠲juan +锩juan +镌juan +隽juan +卷进juanjin +捐款juankuan +眷恋juanlian +眷念juannian +捐躯juanqu +卷入juanru +眷属juanshu +捐献juanxian +卷烟juanyan +卷帙juanzhi +捐助juanzhu +卷宗juanzong +举办juban +具备jubei +剧本juben +巨变jubian +局部jubu +拘捕jubu +剧场juchang +据此juci +巨大juda +举动judong +居多juduo +决jue +觉jue +绝jue +角*jue +脚*jue +掘jue +嚼*jue +撅jue +攫jue +抉jue +倔jue +爵jue +诀jue +厥jue +劂jue +谲jue +矍jue +蕨jue +嗟*jue +噘jue +噱jue +崛jue +獗jue +孓jue +珏jue +桷jue +橛jue +爝jue +镢jue +蹶jue +觖jue +巨额jue +诀别juebie +决不juebu +绝不juebu +决策juece +觉察juecha +觉得juede +决定jueding +决断jueduan +绝对juedui +绝迹jueji +倔强juejiang +绝交juejiao +绝径juejing +绝境juejing +绝句jueju +决裂juelie +绝路juelu +绝密juemi +绝妙juemiao +崛起jueqi +诀窍jueqiao +决赛juesai +绝食jueshi +决死juesi +决算juesuan +绝望juewang +爵位juewei +觉悟juewu +决心juexin +觉醒juexing +决议jueyi +绝缘jueyuan +抉择jueze +决战juezhan +绝招juezhao +绝症juezheng +巨幅jufu +居功jugong +鞠躬jugong +句号juhao +聚合juhe +聚会juhui +聚集juji +巨匠jujiang +拘谨jujin +拒绝jujue +咀嚼jujue +距离juli +举例juli +剧烈julie +拘留juliu +局面jumian +居民jumin +剧目jumu +军jun +均jun +菌jun +君jun +龟*jun +钧jun +峻jun +俊jun +竣jun +浚jun +郡jun +骏jun +捃jun +皲jun +筠jun +麇jun +军操juncao +君臣junchen +均等jundeng +军队jundui +军法junfa +军阀junfa +军服junfu +军港jungang +军工jungong +竣工jungong +均衡junheng +军火junhuo +拘泥juni +军机junji +军纪junji +军舰junjian +俊杰junjie +军垦junken +军粮junliang +军令junling +骏马junma +军民junmin +军旗junqi +峻峭junqiao +俊俏junqiao +军区junqu +军权junquan +军人junren +军事junshi +军师junshi +军属junshu +军团juntuan +军委junwei +军衔junxian +军校junxiao +军械junxie +军心junxin +俊秀junxiu +军需junxu +军训junxun +军医junyi +军营junying +军用junyong +军邮junyou +均匀junyun +军长junzhang +军政junzheng +君主junzhu +军装junzhuang +君子junzi +俱全juquan +居然juran +遽然juran +沮丧jusang +局势jushi +举手jushou +拘束jushu +据说jushuo +具体juti +剧团jutuan +据悉juxi +局限juxian +居心juxin +举行juxing +矩形juxing +巨型juxing +具有juyou +据有juyou +剧院juyuan +局长juzhang +剧照juzhao +举止juzhi +居中juzhong +剧终juzhong +巨著juzhu +居住juzhu +句子juzi +节外生枝jwsz +惊心动魄jxdp +继续革命jxgm +机械化jxh +江西省jxs +谨小慎微jxsw +局限性jxx +教育部jyb +进一步jyb +家用电器jydq +教育方针jyfz +家喻户晓jyhx +加以解决jyjj +记忆力jyl +精益求精jyqj +教研室jys +见义勇为jyyw +旧中国jzg +建筑物jzw +可k +开k +看k +克k +孔k +科k +口k +空k +苦k +快k +考k +刻k +靠k +况k +块k +困k +宽k +矿k +抗k +卡k +卡ka +喀ka +咖ka +咯ka +佧ka +咔ka +胩ka +喀嚓kacha +卡车kache +咖啡kafei +开kai +凯kai +揩kai +楷kai +慨kai +剀kai +垲kai +蒈kai +忾kai +恺kai +铠kai +锎kai +锴kai +开办kaiban +开遍kaibian +开采kaicai +开场kaichang +开车kaiche +开除kaichu +开创kaichuang +开导kaidao +开刀kaidao +开动kaidong +开端kaiduan +开发kaifa +开放kaifang +开封kaifeng +开赴kaifu +凯歌kaige +开关kaiguan +开航kaihang +开户kaihu +开花kaihua +开怀kaihuai +开荒kaihuang +开会kaihui +开掘kaijue +开垦kaiken +开口kaikou +开矿kaikuang +开阔kaikuo +开朗kailang +开郎kailang +开路kailu +开明kaiming +楷模kaimo +开幕kaimu +开炮kaipao +开辟kaipi +开启kaiqi +开枪kaiqiang +开窍kaiqiao +开设kaishe +开始kaishi +开庭kaiting +开头kaitou +开脱kaituo +开拓kaituo +开外kaiwai +开销kaixiao +开心kaixin +凯旋kaixuan +开学kaixue +开颜kaiyan +开业kaiye +开战kaizhan +开展kaizhan +开张kaizhang +开支kaizhi +看kan +刊kan +坎kan +槛*kan +堪kan +勘kan +砍kan +嵌*kan +侃kan +莰kan +阚*kan +戡kan +龛kan +瞰kan +勘测kance +勘察kancha +看出kanchu +看待kandai +看到kandao +刊登kandeng +看法kanfa +砍伐kanfa +抗kang +康kang +炕kang +慷kang +糠kang +扛kang +亢kang +伉kang +闶kang +钪kang +亢奋kangfen +康复kangfu +抗衡kangheng +抗击kangji +亢进kangjin +抗拒kangju +伉俪kangli +抗日kangri +看管kanguan +抗议kangyi +看见kanjian +坎坷kanke +看来kanlai +看齐kanqi +刊头kantou +看望kanwang +刊物kanwu +勘误kanwu +看样kanyang +刊载kanzai +考kao +靠kao +拷kao +烤kao +尻kao +栲kao +犒kao +铐kao +拷贝kaobei +靠边kaobian +考查kaocha +考察kaocha +考核kaohe +靠近kaojin +考究kaojiu +靠拢kaolong +考虑kaolu +考勤kaoqin +靠山kaoshan +考试kaoshi +考题kaoti +考验kaoyan +考证kaozheng +卡片kapian +看不惯kbg +看不起kbq +刻不容缓kbrh +开诚布公kcbg +矿产资源kczy +扩大化kdh +可ke +克ke +科ke +刻ke +客ke +壳ke +颗ke +棵ke +柯ke +呵*ke +坷ke +苛ke +磕ke +咳ke +渴ke +课ke +嗑ke +岢ke +恪ke +溘ke +骒ke +缂ke +珂ke +轲ke +氪ke +瞌ke +钶ke +锞ke +稞ke +疴ke +窠ke +颏ke +蝌ke +髁ke +可爱keai +科班keban +课本keben +可比kebi +刻薄kebo +可不kebu +客车keche +课程kecheng +可耻kechi +可恶kee +可风kefeng +可否kefou +克服kefu +可观keguan +客观keguan +可贵kegui +可好kehao +可恨kehen +刻划kehua +刻画kehua +克己keji +客机keji +科技keji +可见kejian +科教kejiao +可敬kejing +窠臼kejiu +科举keju +可靠kekao +苛刻keke +可口kekou +克扣kekou +刻苦keku +克拉kela +克朗kelang +颗粒keli +可怜kelian +科目kemu +肯ken +啃ken +垦ken +恳ken +裉ken +肯定kending +可能keneng +坑keng +吭keng +铿keng +坑道kengdao +坑害kenghai +铿锵kengqiang +恳切kenqie +恳求kenqiu +垦殖kenzhi +可怕kepa +磕碰kepeng +科普kepu +客气keqi +可亲keqin +可取kequ +客人keren +客商keshang +可是keshi +科室keshi +课堂ketang +客套ketao +课题keti +客体keti +客厅keting +磕头ketou +可望kewang +渴望kewang +可喜kexi +可惜kexi +可行kexing +科学kexue +科研keyan +可以keyi +可疑keyi +刻意keyi +科员keyuan +科长kezhang +可知kezhi +克制kezhi +狂风暴雨kfby +克己奉公kjfg +科技司kjs +苦口婆心kkpx +昆明市kms +可能性knx +孔kong +空kong +控kong +恐kong +倥kong +崆kong +箜kong +空白kongbai +恐怖kongbu +控拆kongchai +空洞kongdong +空额konge +空乏kongfa +控告konggao +空喊konghan +恐吓konghe +空话konghua +恐慌konghuang +空间kongjian +空降kongjiang +恐惧kongju +空军kongjun +空旷kongkuang +恐龙konglong +空虑konglu +恐怕kongpa +空气kongqi +空前kongqian +孔雀kongque +控诉kongsu +空谈kongtan +空头kongtou +空文kongwen +空隙kongxi +空闲kongxian +空想kongxiang +空虚kongxu +空运kongyun +控制kongzhi +空中kongzhong +口kou +扣kou +抠kou +寇kou +芤kou +蔻kou +叩kou +眍kou +筘kou +口岸kouan +叩拜koubai +口才koucai +扣除kouchu +口传kouchuan +口服koufu +口供kougong +口号kouhao +口红kouhong +口角koujiao +口径koujing +口诀koujue +口令kouling +扣留kouliu +口气kouqi +口腔kouqiang +口哨koushao +口试koushi +口述koushu +口头koutou +叩头koutou +口信kouxin +扣押kouya +口语kouyu +看起来kql +口若悬河krxh +口是心非ksxf +苦ku +库ku +枯ku +酷ku +哭ku +窟ku +裤ku +刳ku +堀ku +喾ku +绔ku +骷ku +跨kua +夸kua +垮kua +挎kua +胯kua +侉kua +跨步kuabu +夸大kuada +跨度kuadu +会*kuai +快kuai +块kuai +筷kuai +侩kuai +蒯kuai +郐kuai +哙kuai +狯kuai +浍*kuai +脍kuai +会计kuaiji +快乐kuaile +快速kuaisu +宽kuan +款kuan +髋kuan +宽敞kuanchang +宽绰kuanchuo +宽大kuanda +宽待kuandai +款待kuandai +宽度kuandu +况kuang +矿kuang +狂kuang +框kuang +匡kuang +筐kuang +眶kuang +旷kuang +诓kuang +诳kuang +邝kuang +圹kuang +夼kuang +哐kuang +纩kuang +贶kuang +矿藏kuangcang +矿产kuangchan +狂风kuangfeng +矿工kuanggong +旷工kuanggong +矿井kuangjing +框框kuangkuang +哐啷kuanglang +况且kuangqie +矿区kuangqu +矿泉kuangquan +狂热kuangre +矿山kuangshan +矿石kuangshi +框图kuangtu +宽广kuanguang +狂妄kuangwang +矿物kuangwu +旷野kuangye +宽宏kuanhong +宽厚kuanhou +宽阔kuankuo +宽容kuanrong +款式kuanshi +宽恕kuanshu +款项kuanxiang +宽心kuanxin +宽裕kuanyu +垮台kuatai +跨越kuayue +夸张kuazhang +裤衩kucha +库存kucun +哭喊kuhan +奎kui +溃kui +馈kui +亏kui +盔kui +岿kui +窥kui +葵kui +魁kui +傀kui +愧kui +馗kui +匮kui +夔kui +隗kui +蒉kui +揆kui +喹kui +喟kui +悝kui +愦kui +逵kui +暌kui +睽kui +聩kui +蝰kui +篑kui +跬kui +亏本kuiben +窥测kuice +亏待kuidai +愧疚kuijiu +亏空kuikong +亏损kuisun +魁梧kuiwu +溃疡kuiyang +枯竭kujie +库仑kulun +苦闷kumen +枯木kumu +困kun +昆kun +坤kun +捆kun +悃kun +阃kun +琨kun +锟kun +醌kun +鲲kun +髡kun +苦难kunan +苦恼kunao +困厄kune +困乏kunfa +困惑kunhuo +困境kunjing +困苦kunku +昆明kunming +困难kunnan +扩kuo +括kuo +适*kuo +阔kuo +廓kuo +栝*kuo +蛞kuo +阔别kuobie +扩充kuochong +阔绰kuochuo +扩大kuoda +括号kuohao +扩建kuojian +阔气kuoqi +扩展kuozhan +扩张kuozhang +哭泣kuqi +酷暑kushu +苦头kutou +苦维kuwei +枯萎kuwei +酷刑kuxing +苦于kuyu +枯燥kuzao +可想而知kxez +科学家kxj +科学技术kxjs +可行性kxx +科学院kxy +科研部kyb +开源节流kyjl +看样子kyz +了l +来l +量l +理l +路l +里l +论l +两l +利l +领l +流l +力l +立l +料l +连l +老l +六l +轮l +类l +列l +拉la +落*la +啦la +蜡la +腊la +蓝la +垃la +喇la +辣la +剌la +邋la +旯la +砬la +瘌la +喇叭laba +来lai +赖lai +莱lai +崃lai +徕lai +涞lai +濑lai +赉lai +睐lai +铼lai +癞lai +籁lai +来宾laibin +来到laidao +来犯laifan +来访laifang +来函laihan +来回laihui +来历laili +来临lailin +赖皮laipi +来日lairi +来势laishi +来头laitou +来往laiwang +来信laixin +来源laiyuan +来者laizhe +来自laizi +癞子laizi +辣椒lajiao +拉拢lalong +喇嘛lama +腊梅lamei +兰lan +烂lan +蓝lan +览lan +栏lan +婪lan +拦lan +篮lan +阑lan +澜lan +谰lan +揽lan +懒lan +缆lan +滥lan +岚lan +漤lan +榄lan +斓lan +罱lan +镧lan +褴lan +蓝本lanben +懒怠landai +滥调landiao +懒惰landuo +浪lang +朗lang +郎lang +狼lang +琅lang +榔lang +廊lang +莨lang +蒗lang +啷lang +阆lang +锒lang +稂lang +螂lang +栏杆langan +狼狈langbei +浪潮langchao +浪荡langdang +朗读langdu +浪费langfei +狼藉langji +浪漫langman +朗诵langsong +郎中langzhong +兰花lanhua +拦截lanjie +烂漫lanman +懒散lansan +蓝色lanse +缆绳lansheng +烂熟lanshu +蓝天lantian +蓝图lantu +阑尾lanwei +拦腰lanyao +滥用lanyong +兰州lanzhou +老lao +劳lao +落*lao +牢lao +涝lao +捞lao +络*lao +佬lao +姥lao +酪lao +烙lao +潦*lao +唠lao +崂lao +栳lao +铑lao +铹lao +痨lao +耢lao +醪lao +老板laoban +老伴laoban +老本laoben +劳动laodong +牢固laogu +老汉laohan +老化laohua +牢记laoji +劳驾laojia +牢靠laokao +劳苦laoku +牢牢laolao +劳累laolei +劳力laoli +老练laolian +牢笼laolong +劳模laomo +老年laonian +老人laoren +牢骚laosao +老少laoshao +老是laoshi +老实laoshi +老师laoshi +老乡laoxiang +老爷laoye +烙印laoyin +劳支laozhi +劳资laozi +劳作laozuo +腊月layue +狼狈不堪lbbk +力不从心lbcx +来不及lbj +来不了lbl +了不起lbq +劳动保险ldbx +来得及ldj +劳动量ldl +劳动力ldl +灵丹妙药ldmy +拉丁美洲ldmz +劳动者ldz +劳动致富ldzf +了le +乐le +勒le +肋le +仂le +叻le +泐le +鳓le +乐观leguan +类lei +雷lei +累lei +勒*lei +垒lei +泪lei +镭lei +蕾lei +磊lei +儡lei +擂lei +肋lei +羸lei +诔lei +嘞lei +嫘lei +缧lei +檑lei +耒lei +酹lei +类别leibie +类次leici +雷达leida +雷管leiguan +泪痕leihen +泪花leihua +累积leiji +累计leiji +累进leijin +磊落leiluo +累年leinian +类似leisi +擂台leitai +雷同leitong +类推leitui +类型leixing +雷雨leiyu +累月leiyue +累赘leizhui +勒令leling +冷leng +棱leng +楞leng +塄leng +愣leng +冷藏lengcang +冷淡lengdan +冷宫lenggong +棱角lengjiao +冷静lengjing +冷落lengluo +冷门lengmen +冷漠lengmo +冷暖lengnuan +冷僻lengpi +冷气lengqi +冷却lengque +冷水lengshui +冷遇lengyu +乐趣lequ +勒索lesuo +乐意leyi +乐园leyuan +两个文明lgwm +拉关系lgx +联合国lhg +联合会lhh +两回事lhs +联合体lht +理li +里li +利li +力li +立li +离li +例li +历li +粒li +厘li +礼li +李li +隶li +黎li +璃li +励li +犁li +梨li +丽li +厉li +篱li +狸li +漓li +鲤li +莉li +荔li +吏li +栗li +砾li +傈li +俐li +痢li +沥li +哩li +鬲*li +俪li +俚li +郦li +坜li +苈li +莅li +蓠li +藜li +呖li +唳li +喱li +猁li +悝*li +溧li +澧li +逦li +娌li +嫠li +骊li +缡li +枥li +栎li +轹li +戾li +砺li +詈li +罹li +锂li +鹂li +疠li +疬li +蛎li +蜊li +蠡li +笠li +篥li +粝li +醴li +跞li +雳li +鲡li +鳢li +黧li +俩lia +连lian +联lian +练lian +炼lian +脸lian +链lian +莲lian +镰lian +廉lian +怜lian +涟lian +帘lian +敛lian +恋lian +蔹lian +奁lian +潋lian +濂lian +琏lian +楝lian +殓lian +臁lian +裢lian +裣lian +蠊lian +鲢lian +立案lian +恋爱lianai +联邦lianbang +练兵lianbing +联播lianbo +练达lianda +连队liandui +量liang +两liang +粮liang +良liang +亮liang +梁liang +凉liang +辆liang +粱liang +晾liang +谅liang +墚liang +莨*liang +椋liang +踉liang +靓liang +魉liang +炼钢liangang +两半liangban +量变liangbian +两边liangbian +两便liangbian +两侧liangce +两次liangci +两地liangdi +两点liangdian +量度liangdu +良方liangfang +两广liangguang +良好lianghao +两极liangji +良机liangji +谅解liangjie +量具liangju +凉快liangkuai +两立liangli +两面liangmian +练功liangong +两栖liangqi +两讫liangqi +两全liangquan +粮食liangshi +两手liangshou +凉爽liangshuang +亮堂liangtang +两条liangtiao +两头liangtou +连贯lianguan +联贯lianguan +亮相liangxiang +良心liangxin +两性liangxing +量刑liangxing +两样liangyang +粮油liangyou +良缘liangyuan +粮站liangzhan +两者liangzhe +两重liangzhong +良种liangzhong +量子liangzi +联合lianhe +联欢lianhuan +廉价lianjia +联结lianjie +连接lianjie +联接lianjie +廉洁lianjie +联军lianjun +连累lianlei +联络lianluo +连忙lianmang +联盟lianmeng +怜悯lianmin +连年liannian +脸谱lianpu +连日lianri +炼乳lianru +联赛liansai +脸色lianse +连锁liansuo +练武lianwu +联系lianxi +练习lianxi +怜惜lianxi +联想lianxiang +连续lianxu +涟漪lianyi +联姻lianyin +联营lianying +炼油lianyou +联运lianyun +连载lianzai +了*liao +料liao +疗liao +辽liao +僚liao +撩liao +聊liao +燎liao +寥liao +潦liao +撂liao +镣liao +廖liao +蓼liao +尥liao +嘹liao +獠liao +寮liao +缭liao +钌liao +鹩liao +撩拨liaobo +潦草liaocao +疗程liaocheng +料到liaodao +潦倒liaodao +料定liaoding +了结liaojie +了解liaojie +辽阔liaokuo +料理liaoli +寥寥liaoliao +寥落liaoluo +辽宁liaoning +了却liaoque +了事liaoshi +聊天liaotian +料想liaoxiang +疗养liaoyang +礼拜libai +利弊libi +里边libian +理财licai +理睬licai +立场lichang +里程licheng +历程licheng +立春lichun +历次lici +历代lidai +理当lidang +立冬lidong +列lie +裂lie +烈lie +劣lie +猎lie +冽lie +埒lie +捩lie +咧lie +洌lie +趔lie +躐lie +鬣lie +裂变liebian +列车lieche +列出liechu +列岛liedao +裂缝liefeng +列国lieguo +烈火liehuo +劣迹lieji +列举lieju +裂开liekai +裂口liekou +列宁liening +猎奇lieqi +列强lieqiang +猎取liequ +烈日lieri +列入lieru +劣绅lieshen +烈士lieshi +劣势lieshi +烈属lieshu +裂纹liewen +列席liexi +烈性liexing +立法lifa +立方lifang +礼服lifu +立功ligong +利害lihai +厉害lihai +理化lihua +礼花lihua +理会lihui +离婚lihun +立即liji +理解lijie +礼节lijie +历届lijie +力矩liju +离开likai +理科like +立刻like +理亏likui +历来lilai +历历lili +力量liliang +利率lilu +理论lilun +立论lilun +礼貌limao +里面limian +利民limin +黎民limin +黎明liming +林lin +磷lin +临lin +邻lin +淋lin +麟lin +琳lin +霖lin +鳞lin +凛lin +赁lin +吝lin +蔺lin +啉lin +嶙lin +廪lin +懔lin +遴lin +檩lin +辚lin +膦lin +瞵lin +粼lin +躏lin +淋巴linba +临别linbie +淋病linbing +林场linchang +临床linchuang +临到lindao +领ling +另ling +零ling +令ling +灵ling +岭ling +铃ling +龄ling +凌ling +棱*ling +陵ling +拎ling +玲ling +菱ling +伶ling +羚ling +酃ling +苓ling +呤ling +囹ling +泠ling +绫ling +柃ling +棂ling +瓴ling +聆ling +蛉ling +翎ling +鲮ling +令爱lingai +凌晨lingchen +灵丹lingdan +领导lingdao +领地lingdi +零点lingdian +领队lingdui +灵感linggan +领海linghai +领航linghang +领会linghui +灵魂linghun +灵活linghuo +灵机lingji +零件lingjian +领教lingjiao +灵杰lingjie +领空lingkong +凌空lingkong +玲珑linglong +零乱lingluan +凌乱lingluan +领略linglue +灵敏lingmin +陵墓lingmu +灵巧lingqiao +领取lingqu +令人lingren +凌辱lingru +零散lingsan +领事lingshi +领受lingshou +领司lingsi +零碎lingsui +灵堂lingtang +零头lingtou +领土lingtu +磷光linguang +另外lingwai +领悟lingwu +领先lingxian +领衔lingxian +零星lingxing +领袖lingxiu +另选lingxuan +灵验lingyan +领域lingyu +令尊lingzun +磷火linhuo +历年linian +临界linjie +临近linjin +邻近linjin +邻里linli +淋漓linli +凛冽linlie +临摹linmo +里弄linong +鳞伤linshang +临时linshi +临死linsi +吝惜linxi +临行linxing +林业linye +临战linzhan +临终linzhong +礼炮lipao +李鹏lipeng +礼品lipin +力气liqi +离奇liqi +力求liqiu +立秋liqiu +历任liren +例如liru +利润lirun +离散lisan +理事lishi +历史lishi +隶属lishu +礼堂litang +立体liti +例题liti +力图litu +流liu +六liu +留liu +刘liu +硫liu +柳liu +陆*liu +馏liu +瘤liu +溜liu +琉liu +榴liu +碌*liu +浏liu +遛liu +骝liu +绺liu +旒liu +熘liu +锍liu +镏liu +鹨liu +鎏liu +留步liubu +流产liuchan +流畅liuchang +流程liucheng +流传liuchuan +流窜liucuan +流动liudong +流毒liudu +流放liufang +六届liujie +浏览liulan +流利liuli +留恋liulian +流露liulu +流落liuluo +流氓liumang +留念liunian +流失liushi +流逝liushi +流体liuti +流通liutong +流亡liuwang +流泻liuxie +留心liuxin +流行liuxing +流星liuxing +留学liuxue +流血liuxue +流言liuyan +留言liuyan +留洋liuyang +留影liuying +留用liuyong +流域liuyu +六月liuyue +流转liuzhuan +例外liwai +礼物liwu +利息lixi +立夏lixia +理想lixiang +立新lixin +离心lixin +理性lixing +力行lixing +厉行lixing +离休lixiu +立意liyi +利益liyi +离异liyi +利用liyong +理由liyou +力争lizheng +立正lizheng +理智lizhi +立志lizhi +离职lizhi +例子lizi +粒子lizi +立足lizu +屡见不鲜ljbx +两极分化ljfh +逻辑设计ljsj +逻辑思维ljsw +逻辑性ljx +灵机一动ljyd +落落大方lldf +拦路虎llh +来龙去脉llqm +零零碎碎llss +来来往往llww +联绵不断lmbd +灵敏度lmd +辽宁省lns +列宁主义lnzy +龙long +垄long +弄*long +笼long +隆long +聋long +咙long +窿long +拢long +陇long +垅long +茏long +泷long +珑long +栊long +胧long +砻long +癃long +隆冬longdong +垄断longduan +隆隆longlong +笼络longluo +笼统longtong +笼罩longzhao +隆重longzhong +漏lou +露*lou +楼lou +娄lou +搂lou +篓lou +陋lou +偻lou +蒌lou +喽lou +嵝lou +镂lou +瘘lou +耧lou +蝼lou +髅lou +漏洞loudong +漏斗loudou +镂空loukong +漏网louwang +来日方长lrfc +来人来函lrlh +了如指掌lrzz +理所当然lsdr +连锁反应lsfy +领事馆lsg +理事会lsh +力所能及lsnj +拉萨市lss +流水线lsx +良师益友lsyy +路lu +六*lu +率lu +露lu +绿lu +炉lu +律lu +虑lu +滤lu +陆lu +氯lu +鲁lu +铝lu +录lu +旅lu +卢lu +吕lu +芦lu +颅lu +庐lu +掳lu +卤lu +虏lu +麓lu +碌lu +赂lu +鹿lu +潞lu +禄lu +戮lu +驴lu +侣lu +履lu +屡lu +缕lu +垆lu +蓼*lu +撸lu +噜lu +闾lu +泸lu +渌lu +漉lu +逯lu +璐lu +栌lu +榈lu +橹lu +轳lu +辂lu +辘lu +氇lu +胪lu +膂lu +镥lu +稆lu +鸬lu +鹭lu +褛lu +簏lu +舻lu +鲈lu +卵luan +乱luan +峦luan +挛luan +孪luan +滦luan +脔luan +娈luan +栾luan +鸾luan +銮luan +卵巢luanchao +乱伦luanlun +乱子luanzi +旅伴luban +路标lubiao +路程lucheng +旅程lucheng +露出luchu +屡次luci +陆地ludi +露底ludi +旅店ludian +略lue +掠lue +锊lue +掠夺lueduo +旅费lufei +露骨lugu +旅馆luguan +路过luguo +绿化luhua +炉火luhuo +路径lujing +路局luju +陆军lujun +旅客luke +履历luli +率领luling +鲁莽lumang +露面lumian +论lun +轮lun +伦lun +抡lun +仑lun +沦lun +纶lun +囵lun +论处lunchu +轮船lunchuan +论点lundian +论调lundiao +伦敦lundun +轮换lunhuan +论据lunju +轮廓lunkuo +论理lunli +伦理lunli +轮流lunliu +论述lunshu +轮胎luntai +论坛luntan +沦为lunwei +论文lunwen +沦陷lunxian +轮训lunxun +论战lunzhan +论正lunzheng +论证lunzheng +轮轴lunzhou +论著lunzhu +落luo +罗luo +螺luo +洛luo +络luo +逻luo +咯*luo +烙*luo +萝luo +锣luo +箩luo +骡luo +裸luo +骆luo +倮luo +蠃luo +荦luo +捋luo +摞luo +猡luo +泺luo +漯luo +珞luo +椤luo +脶luo +硌*luo +镙luo +瘰luo +雒luo +萝卜luobu +落成luocheng +螺钉luoding +罗汉luohan +落后luohou +落户luohu +逻辑luoji +落空luokong +落款luokuan +箩筐luokuang +罗列luolie +罗马luoma +螺母luomu +罗盘luopan +落泊luopo +落实luoshi +螺栓luoshuan +裸体luoti +骆驼luotuo +罗网luowang +螺纹luowen +落伍luowu +落选luoxuan +螺旋luoxuan +络绎luoyi +录取luqu +路人luren +绿色luse +庐山lushan +旅社lushe +律师lushi +露天lutian +路途lutu +旅途lutu +路线luxian +率先luxian +录像luxiang +旅行luxing +履行luxing +陆续luxu +录音luyin +绿荫luyin +录用luyong +旅游luyou +绿洲luzhou +露珠luzhu +路子luzi +炉子luzi +另行安排lxap +例行公事lxgs +联系人lxr +留学生lxs +另行通知lxtz +林业部lyb +老一辈lyb +另一方面lyfm +劳逸结合lyjh +利用率lyl +老一套lyt +留有余地lyyd +来者不拒lzbj +立足点lzd +老中青lzq +理直气壮lzqz +兰州市lzs +两重性lzx +面m +命m +们m +民m +毛m +没m +米m +明m +马m +么m +每m +门m +名m +磨m +美m +密m +苗m +满m +亩m +目m +呒m +马ma +么*ma +麻ma +吗ma +妈ma +骂ma +嘛ma +码ma +摩*ma +抹*ma +玛ma +蚂ma +唛ma +犸ma +嬷ma +杩ma +蟆ma +马鞍maan +麻痹mabi +马达mada +麻烦mafan +麻纺mafang +马虎mahu +麦mai +脉mai +卖mai +买mai +埋mai +迈mai +劢mai +荬mai +霾mai +买办maiban +脉搏maibo +迈步maibu +埋藏maicang +脉冲maichong +脉动maidong +埋伏maifu +卖国maiguo +脉络mailuo +买卖maimai +卖命maiming +埋没maimo +卖弄mainong +埋头maitou +卖淫maiyin +埋怨maiyuan +埋葬maizang +买帐maizhang +卖座maizuo +马力mali +麻利mali +马路malu +妈妈mama +麻木mamu +满man +慢man +曼man +漫man +蔓man +瞒man +馒man +蛮man +谩man +墁man +幔man +缦man +熳man +镘man +颟man +螨man +鳗man +鞔man +漫长manchang +忙mang +芒mang +盲mang +茫mang +氓mang +莽mang +邙mang +漭mang +硭mang +蟒mang +忙碌manglu +莽莽mangmang +盲目mangmu +茫然mangran +盲人mangren +忙于mangyu +莽原mangyuan +蛮横manheng +漫画manhua +满怀manhuai +谩骂manma +满目manmu +满腔manqiang +蔓延manyan +满意manyi +满载manzai +满足manzu +毛mao +矛mao +冒mao +貌mao +贸mao +帽mao +猫mao +茅mao +锚mao +铆mao +卯mao +茂mao +袤mao +茆mao +峁mao +泖mao +瑁mao +昴mao +牦mao +耄mao +旄mao +懋mao +瞀mao +蟊mao +髦mao +毛病maobing +毛糙maocao +冒充maochong +铆钉maoding +矛盾maodun +冒犯maofan +毛纺maofang +冒号maohao +冒尖maojian +冒进maojin +茅坑maokeng +毛利maoli +冒昧maomei +茂密maomi +冒牌maopai +毛坯maopi +贸然maoran +茂盛maosheng +冒失maoshi +矛头maotou +冒险maoxian +贸易maoyi +冒雨maoyu +毛重maozhong +帽子maozi +马上mashang +马桶matong +码头matou +马戏maxi +麻醉mazui +免不了mbl +明辨是非mbsf +满不在乎mbzh +默不作声mbzs +满城风雨mcfy +目的地mdd +目瞪口呆mdkd +描淡写mdx +么me +麽me +秘而不宣mebx +没mei +每mei +美mei +煤mei +霉mei +酶mei +梅mei +妹mei +眉mei +玫mei +枚mei +媒mei +镁mei +昧mei +寐mei +媚mei +糜*mei +谜*mei +莓mei +嵋mei +猸mei +浼mei +湄mei +楣mei +镅mei +鹛mei +袂mei +魅mei +每次meici +每当meidang +美德meide +没法meifa +每逢meifeng +每个meige +美观meiguan +玫瑰meigui +美国meiguo +美好meihao +美化meihua +媒介meijie +眉睫meijie +枚举meiju +煤矿meikuang +霉烂meilan +魅力meili +美丽meili +美满meiman +眉毛meimao +美貌meimao +妹妹meimei +美妙meimiao +眉目meimu +每年meinian +煤气meiqi +每人meiren +每日meiri +美容meirong +眉梢meishao +每时meishi +美术meishu +媒妁meishuo +煤炭meitan +每天meitian +煤田meitian +美学meixue +没有meiyou +煤油meiyou +美元meiyuan +每月meiyue +没治meizhi +每周meizhou +们men +门men +闷men +扪men +焖men +懑men +钔men +门房menfang +孟meng +猛meng +蒙meng +盟meng +梦meng +萌meng +锰meng +氓*meng +檬meng +勐meng +甍meng +瞢meng +懵meng +朦meng +礞meng +虻meng +蜢meng +蠓meng +艋meng +艨meng +蒙蔽mengbi +萌发mengfa +蒙古menggu +盟国mengguo +梦幻menghuan +蒙混menghun +梦见mengjian +猛进mengjin +梦境mengjing +猛烈menglie +蒙胧menglong +蒙昧mengmei +猛然mengran +萌生mengsheng +猛士mengshi +蒙受mengshou +梦想mengxiang +梦乡mengxiang +猛醒mengxing +萌芽mengya +盟友mengyou +盟约mengyue +猛增mengzeng +门户menhu +门路menlu +门牌menpai +门票menpiao +闷气menqi +门诊menzhen +名副其实mfqs +眉飞色舞mfsw +没关系mgx +蒙古族mgz +蒙混过关mhgg +米mi +密mi +迷mi +蜜mi +秘mi +眯mi +醚mi +靡mi +糜mi +谜mi +弥mi +觅mi +泌mi +幂mi +芈mi +谧mi +蘼mi +咪mi +嘧mi +猕mi +汨mi +宓mi +弭mi +脒mi +祢mi +敉mi +糸mi +縻mi +麋mi +面mian +棉mian +免mian +绵mian +眠mian +冕mian +勉mian +娩mian +缅mian +沔mian +渑mian +湎mian +腼mian +眄mian +面部mianbu +免除mianchu +免得miande +面对miandui +面额miane +棉花mianhua +缅怀mianhuai +面积mianji +面具mianju +面孔miankong +勉励mianli +面临mianlin +面貌mianmao +面面mianmian +绵绵mianmian +面目mianmu +面庞mianpang +面前mianqian +勉强mianqiang +面容mianrong +面色mianse +棉纱miansha +面授mianshou +免税mianshui +面谈miantan +面向mianxiang +免刑mianxing +棉絮mianxu +绵延mianyan +面议mianyi +免疫mianyi +面罩mianzhao +免职mianzhi +面子mianzi +苗miao +秒miao +描miao +庙miao +妙miao +瞄miao +藐miao +渺miao +喵miao +邈miao +缈miao +缪miao +杪miao +淼miao +眇miao +鹋miao +秒表miaobiao +描绘miaohui +妙龄miaoling +渺茫miaomang +描摹miaomo +藐视miaoshi +描述miaoshu +苗条miaotiao +苗头miaotou +描写miaoxie +瞄准miaozhun +弥补mibu +谜底midi +密度midu +灭mie +蔑mie +乜*mie +咩mie +蠛mie +篾mie +灭火miehuo +灭迹mieji +灭绝miejue +灭口miekou +蔑视mieshi +灭亡miewang +密封mifeng +蜜蜂mifeng +眯缝mifeng +迷航mihang +迷糊mihu +迷惑mihuo +密集miji +密件mijian +迷津mijin +秘诀mijue +糜烂milan +迷恋milian +密令miling +迷路milu +密码mima +迷漫miman +弥漫miman +秘密mimi +汨汨mimi +谜面mimian +密谋mimou +民min +敏min +抿min +皿min +悯min +闽min +苠min +岷min +闵min +泯min +缗min +玟min +珉min +愍min +黾min +鳘min +民办minban +民兵minbing +民法minfa +民愤minfen +民风minfeng +命ming +明ming +名ming +鸣ming +螟ming +盟*ming +铭ming +冥ming +茗ming +溟ming +暝ming +瞑ming +酩ming +敏感mingan +明白mingbai +名册mingce +名称mingcheng +明处mingchu +名次mingci +名词mingci +名单mingdan +明灯mingdeng +民歌minge +名额minge +名贵minggui +铭记mingji +名家mingjia +铭刻mingke +明快mingkuai +明朗minglang +名利mingli +明亮mingliang +明了mingliao +命令mingling +名流mingliu +明码mingma +明媚mingmei +明明mingming +名目mingmu +明年mingnian +名牌mingpai +名片mingpian +名气mingqi +明确mingque +明人mingren +名人mingren +名胜mingsheng +名声mingsheng +名堂mingtang +明天mingtian +名望mingwang +明文mingwen +明细mingxi +明显mingxian +鸣谢mingxie +明星mingxing +名言mingyan +名义mingyi +名誉mingyu +命运mingyun +明知mingzhi +明智mingzhi +明珠mingzhu +名著mingzhu +名字mingzi +民航minhang +民间minjian +敏捷minjie +民警minjing +民情minqing +敏锐minrui +民事minshi +民心minxin +民意minyi +民用minyong +民运minyun +民政minzheng +民众minzhong +民主minzhu +民族minzu +密切miqie +迷人miren +迷失mishi +秘书mishu +密探mitan +迷途mitu +谬miu +谬论miulun +谬误miuwu +迷惘miwang +迷雾miwu +迷信mixin +密友miyou +谜语miyu +蜜月miyue +马克思mks +眉开眼笑mkyx +马列主义mlzy +满面春风mmcf +马马虎虎mmhh +面面俱到mmjd +莫名其妙mmqm +默默无闻mmww +明目张胆mmzd +无*mo +磨mo +没*mo +万*mo +末mo +模mo +膜mo +摸mo +墨mo +摩mo +脉*mo +莫mo +抹mo +冒*mo +默mo +貉*mo +嘿*mo +摹mo +蘑mo +魔mo +沫mo +漠mo +寞mo +陌mo +谟mo +茉mo +蓦mo +馍mo +嫫mo +殁mo +镆mo +秣mo +瘼mo +耱mo +貊mo +貘mo +默哀moai +莫不mobu +磨擦moca +摩擦moca +磨蹭moceng +莫大moda +磨刀modao +摩登modeng +摸底modi +模范mofan +模仿mofang +摹仿mofang +莫非mofei +魔鬼mogui +模糊mohu +墨迹moji +模块mokuai +磨砺moli +磨练molian +末了moliao +末路molu +没落moluo +磨灭momie +默默momo +磨难monan +模拟moni +摹拟moni +末期moqi +默契moqi +默然moran +漠然moran +默认moren +末日mori +莫如moru +抹杀mosha +抹煞mosha +末梢moshao +陌生mosheng +模式moshi +没收moshou +魔术moshu +磨损mosun +摸索mosuo +模特mote +摩托motuo +某mou +谋mou +牟mou +侔mou +哞mou +缪*mou +眸mou +蛑mou +蝥mou +鍪mou +某地moudi +某个mouge +谋害mouhai +谋划mouhua +某军moujun +牟利mouli +谋略moulue +谋求mouqiu +牟取mouqu +谋杀mousha +谋生mousheng +某些mouxie +末尾mowei +默写moxie +模型moxing +默许moxu +模样moyang +魔掌mozhang +模子mozi +妙趣横生mqhs +门市部msb +名胜古迹msgj +妙手回春mshc +莫斯科msk +没什么msm +每时每刻msmk +秘书长msz +没事找事mszs +摩托车mtc +埋头工作mtgz +埋头苦干mtkg +亩mu +目mu +木mu +母mu +墓mu +模*mu +幕mu +牧mu +姆mu +穆mu +姥*mu +牟*mu +拇mu +牡mu +暮mu +募mu +慕mu +睦mu +仫mu +坶mu +苜mu +沐mu +毪mu +钼mu +母爱muai +墓碑mubei +目标mubiao +木材mucai +牧草mucao +目测muce +牧场muchang +目次muci +牡丹mudan +目的mudi +牧歌muge +目光muguang +幕后muhou +目击muji +募集muji +木刻muke +木料muliao +幕僚muliao +目录mulu +牧民mumin +木讷mune +木偶muou +目前muqian +母亲muqin +牧区muqu +木然muran +暮色muse +牧师mushi +目送musong +牧童mutong +牧业muye +沐浴muyu +民意测验mycy +贸易市场mysc +贸易协定myxd +民政部mzb +美中不足mzbz +毛泽东mzd +满载而归mzeg +明知故犯mzgf +毛织品mzp +目中无人mzwr +毛主席mzx +年n +能n +内n +那n +农n +你n +南n +难n +呢n +女n +泥n +哪n +拿n +念n +牛n +宁n +脑n +粘n +尼n +纳n +嗯n +那na +南na +哪na +拿na +纳na +呢*na +钠na +呐na +娜na +捺na +肭na +镎na +衲na +那边nabian +纳粹nacui +哪儿naer +那个nage +哪个nage +呐喊nahan +哪会nahui +耐nai +哪*nai +奶nai +乃nai +氖nai +奈nai +鼐nai +艿nai +萘nai +柰nai +耐烦naifan +奈何naihe +耐久naijiu +耐劳nailao +奶奶nainai +耐心naixin +耐性naixing +耐用naiyong +奶油naiyou +乃至naizhi +那里nali +哪里nali +那么name +南nan +难nan +男nan +喃nan +囝nan +囡nan +楠nan +腩nan +蝻nan +赧nan +难办nanban +南北nanbei +南边nanbian +难产nanchan +南昌nanchang +难处nanchu +难道nandao +难得nande +难点nandian +难度nandu +哪能naneng +南方nanfang +南非nanfei +难分nanfen +南风nanfeng +囊nang +攮nang +囔nang +馕nang +曩nang +囊括nangkuo +难怪nanguai +难关nanguan +南国nanguo +难过nanguo +南海nanhai +南货nanhuo +南极nanji +难解nanjie +南京nanjing +难看nankan +难堪nankan +南面nanmian +难免nanmian +难民nanmin +南宁nanning +男女nannu +赧然nanran +男人nanren +难色nanse +难事nanshi +难受nanshou +难说nanshuo +难题nanti +难听nanting +难为nanwei +男性nanxing +南亚nanya +南洋nanyang +难以nanyi +难友nanyou +难于nanyu +脑nao +闹nao +努*nao +挠nao +恼nao +淖nao +孬nao +垴nao +呶nao +猱nao +瑙nao +硇nao +铙nao +蛲nao +脑袋naodai +脑海naohai +恼火naohuo +脑筋naojin +闹剧naoju +闹事naoshi +哪怕napa +纳入naru +那时nashi +拿手nashou +纳税nashui +那些naxie +哪些naxie +纳新naxin +那样nayang +哪样nayang +那种nazhong +年产量ncl +农产品ncp +南昌市ncs +难道说nds +呢ne +哪*ne +呐*ne +讷ne +内nei +那*nei +哪*nei +馁nei +内部neibu +内存neicun +内地neidi +内阁neige +内涵neihan +内行neihang +内奸neijian +内疚neijiu +内科neike +内乱neiluan +内幕neimu +内勤neiqin +内容neirong +内外neiwai +内销neixiao +内心neixin +内因neiyin +内应neiying +内在neizai +嫩nen +恁nen +能neng +能动nengdong +能否nengfou +能干nenggan +能够nenggou +能力nengli +能量nengliang +能耐nengnai +能人nengren +能手nengshou +能源nengyuan +能者nengzhe +农副产品nfcp +年富力强nflq +能工巧匠ngqj +你ni +泥ni +尼ni +呢*ni +逆ni +拟ni +尿ni +妮ni +霓ni +倪ni +匿ni +腻ni +溺ni +伲ni +坭ni +猊ni +怩ni +昵ni +旎ni +祢*ni +慝ni +睨ni +铌ni +鲵ni +年nian +念nian +粘nian +蔫nian +拈nian +碾nian +撵nian +捻nian +酿nian +廿nian +埝nian +辇nian +黏nian +鲇nian +鲶nian +年初nianchu +年代niandai +念叨niandao +年底niandi +年度niandu +年份nianfen +娘niang +年华nianhua +年画nianhua +年级nianji +年纪nianji +年鉴nianjian +年来nianlai +年利nianli +年历nianli +拈量nianliang +年龄nianling +年迈nianmai +年年niannian +年青nianqing +年轻nianqing +年岁niansui +年头niantou +念头niantou +年限nianxian +年月nianyue +酿造nianzao +年终nianzhong +尿niao +鸟niao +溺*niao +茑niao +嬲niao +脲niao +袅niao +鸟瞰niaokan +逆差nicha +你处nichu +你的nide +拟定niding +拟订niding +镍nie +啮nie +涅nie +捏nie +聂nie +孽nie +镊nie +乜nie +陧nie +蘖nie +嗫nie +颞nie +臬nie +蹑nie +捏造niezao +腻烦nifan +泥浆nijiang +逆境nijing +泥坑nikeng +逆流niliu +你们nimen +您nin +宁ning +凝ning +拧ning +柠ning +狞ning +泞ning +佞ning +苎ning +咛ning +甯ning +聍ning +凝固ninggu +凝结ningjie +宁静ningjing +凝聚ningju +宁可ningke +宁肯ningken +宁日ningri +凝视ningshi +凝望ningwang +宁夏ningxia +宁愿ningyuan +泥泞nining +泥塑nisu +牛niu +扭niu +钮niu +纽niu +拗*niu +狃niu +忸niu +妞niu +纽带niudai +牛犊niudu +纽扣niukou +纽约niuyue +扭转niuzhuan +腻味niwei +你我niwo +拟议niyi +泥沼nizhao +逆转nizhuan +难解难分njnf +南京市njs +南极洲njz +扭亏为盈nkwy +脑力劳动nlld +年老体弱nltr +内蒙古nmg +农贸市场nmsc +那么些nmx +那么样nmy +念念不忘nnbw +难能可贵nnkg +南宁市nns +农nong +弄nong +浓nong +脓nong +侬nong +哝nong +脓包nongbao +农村nongcun +浓度nongdu +农妇nongfu +浓厚nonghou +农会nonghui +农活nonghuo +农具nongju +农历nongli +农林nonglin +农忙nongmang +农民nongmin +弄清nongqing +农时nongshi +农药nongyao +农业nongye +农艺nongyi +浓郁nongyu +耨nou +年轻化nqh +年轻人nqr +那时候nsh +能说会道nshd +南斯拉夫nslf +能上能下nsnx +逆水行舟nsxz +农田水利ntsl +女nu +奴nu +努nu +怒nu +弩nu +胬nu +孥nu +驽nu +恧nu +钕nu +衄nu +暖nuan +暖和nuanhe +暖流nuanliu +暖气nuanqi +奴婢nubi +奴才nucai +虐nue +虐待nuedai +虐疾nueji +女儿nuer +女工nugong +怒吼nuhou +奴化nuhua +怒火nuhuo +努力nuli +奴隶nuli +诺nuo +娜*nuo +挪nuo +懦nuo +糯nuo +傩nuo +搦nuo +喏nuo +锘nuo +挪用nuoyong +奴仆nupu +女人nuren +女色nuse +女士nushi +女性nuxing +女婿nuxu +女子nuzi +能文能武nwnw +弄虚作假nxzj +农作物nzw +你争我夺nzwd +欧o +偶o +哦o +鸥o +殴o +藕o +呕o +沤o +讴o +噢o +怄o +瓯o +耦o +偶然性orx +区*ou +欧ou +偶ou +鸥ou +殴ou +藕ou +呕ou +沤ou +讴ou +怄ou +瓯ou +耦ou +殴打ouda +偶尔ouer +讴歌ouge +偶合ouhe +耦合ouhe +欧姆oumu +怄气ouqi +偶然ouran +藕色ouse +偶数oushu +呕吐outu +欧阳ouyang +欧洲ouzhou +批p +平p +判p +配p +片p +派p +破p +排p +品p +皮p +喷p +盘p +偏p +评p +怕p +培p +普p +贫p +跑p +炮p +怕pa +派pa +爬pa +帕pa +扒*pa +耙*pa +啪pa +趴pa +琶pa +葩pa +杷pa +钯*pa +筢pa +派pai +排pai +拍pai +牌pai +迫*pai +哌pai +徘pai +湃pai +俳pai +蒎pai +排版paiban +拍板paiban +排比paibi +派别paibie +排场paichang +排斥paichi +排除paichu +排队paidui +牌号paihao +徘徊paihuai +排挤paiji +牌价paijia +排列pailie +拍卖paimai +派遣paiqian +排球paiqiu +派生paisheng +派头paitou +排外paiwai +排泄paixie +排演paiyan +牌照paizhao +判pan +盘pan +叛pan +番*pan +潘pan +攀pan +磐pan +盼pan +畔pan +胖pan +拚*pan +爿pan +泮pan +袢pan +襻pan +蟠pan +蹒pan +叛变panbian +判别panbie +盘缠panchan +盘存pancun +叛党pandang +攀登pandeng +盘点pandian +判定panding +判断panduan +攀附panfu +旁pang +膀*pang +磅*pang +乓pang +庞pang +耪pang +胖pang +彷pang +滂pang +逄pang +螃pang +旁边pangbian +庞大pangda +盘亘pangen +旁观pangguan +旁听pangting +旁通pangtong +滂沱pangtuo +庞杂pangza +盘踞panju +判决panjue +叛乱panluan +判明panming +叛逆panni +盘算pansuan +蟠桃pantao +叛徒pantu +盼望panwang +判刑panxing +盘旋panxuan +跑pao +炮pao +刨pao +抛pao +泡pao +咆pao +袍pao +匏pao +狍pao +庖pao +脬pao +疱pao +炮兵paobing +跑步paobu +炮弹paodan +跑道paodao +抛光paoguang +炮火paohuo +炮击paoji +抛锚paomao +泡沫paomo +抛弃paoqi +炮手paoshou +炮台paotai +炮艇paoting +咆哮paoxiao +泡影paoying +炮仗paozhang +炮制paozhi +怕死pasi +疲惫不堪pbbk +迫不急待pbjd +破除迷信pcmx +平等互利pdhl +配pei +培pei +陪pei +胚pei +呸pei +裴pei +赔pei +佩pei +沛pei +辔pei +帔pei +旆pei +锫pei +醅pei +霈pei +陪伴peiban +配备peibei +赔本peiben +赔偿peichang +陪衬peichen +配方peifang +佩服peifu +配合peihe +配给peiji +配件peijian +配角peijiao +赔款peikuan +赔礼peili +配偶peiou +陪审peishen +陪送peisong +胚胎peitai +配套peitao +陪同peitong +培训peixun +培养peiyang +配音peiyin +培育peiyu +配乐peiyue +陪葬peizang +配制peizhi +配置peizhi +培植peizhi +喷pen +盆pen +湓pen +盆地pendi +碰peng +棚peng +蓬peng +朋peng +捧peng +膨peng +砰peng +抨peng +烹peng +澎peng +彭peng +硼peng +篷peng +鹏peng +堋peng +嘭peng +怦peng +蟛peng +碰杯pengbei +碰壁pengbi +蓬勃pengbo +捧场pengchang +抨击pengji +蓬莱penglai +蓬乱pengluan +澎湃pengpai +烹饪pengren +硼砂pengsha +蓬松pengsong +烹调pengtiao +朋友pengyou +膨胀pengzhang +喷溅penjian +盆景penjing +喷射penshe +喷嚏penti +平方公里pfgl +平分秋色pfqs +批pi +皮pi +坏*pi +否*pi +辟*pi +坯pi +脾pi +疲pi +砒pi +霹pi +披pi +劈pi +琵pi +毗pi +啤pi +匹pi +痞pi +僻pi +屁pi +譬pi +丕pi +仳pi +陂*pi +陴pi +邳pi +郫pi +圮pi +埤*pi +鼙pi +芘pi +擗pi +吡*pi +噼pi +庀pi +淠pi +媲pi +纰pi +枇pi +甓pi +睥pi +罴pi +铍pi +癖pi +裨*pi +疋pi +蚍pi +蜱pi +貔pi +片pian +偏pian +便*pian +篇pian +骗pian +扁*pian +谝pian +骈pian +缏*pian +犏pian +胼pian +翩pian +蹁pian +偏差piancha +片断pianduan +片段pianduan +偏废pianfei +篇幅pianfu +偏激pianji +偏见pianjian +骗局pianju +片刻pianke +偏离pianli +片面pianmian +偏旁pianpang +偏僻pianpi +偏颇pianpo +骗取pianqu +骗人pianren +骗术pianshu +偏袒piantan +翩跹pianxian +偏向pianxiang +偏移pianyi +便宜pianyi +篇章pianzhang +骗子pianzi +票piao +漂piao +朴*piao +飘piao +瓢piao +剽piao +莩*piao +嘌piao +嫖piao +骠*piao +缥piao +殍piao +瞟piao +螵piao +漂泊piaobo +票房piaofang +漂浮piaofu +票价piaojia +票据piaoju +漂亮piaoliang +漂流piaoliu +飘流piaoliu +飘落piaoluo +票面piaomian +飘渺piaomiao +飘泊piaopo +剽窃piaoqie +飘然piaoran +飘散piaosan +飘扬piaoyang +飘游piaoyou +疲惫pibei +批驳pibo +撇pie +瞥pie +丿pie +苤pie +氕pie +批发pifa +批复pifu +皮肤pifu +皮革pige +屁股pigu +疲倦pijuan +疲劳pilao +纰漏pilou +披露pilu +品pin +贫pin +频pin +拼pin +苹pin +聘pin +拚pin +姘pin +嫔pin +榀pin +牝pin +颦pin +品尝pinchang +频传pinchuan +拼凑pincou +频带pindai +频道pindao +品德pinde +贫乏pinfa +频繁pinfan +平ping +评ping +瓶ping +凭ping +苹ping +冯*ping +乒ping +坪ping +萍ping +屏ping +俜ping +娉ping +枰ping +鲆ping +平安pingan +评比pingbi +屏蔽pingbi +平常pingchang +平川pingchuan +平淡pingdan +平等pingdeng +平地pingdi +平定pingding +评定pingding +品格pinge +平反pingfan +平凡pingfan +平方pingfang +平分pingfen +评分pingfen +评功pinggong +平衡pingheng +评级pingji +平价pingjia +评价pingjia +评奖pingjiang +凭借pingjie +平静pingjing +平均pingjun +平空pingkong +凭空pingkong +评理pingli +评论pinglun +平面pingmian +平民pingmin +屏幕pingmu +评判pingpan +乒乓pingpang +平平pingping +平壤pingrang +平日pingri +平时pingshi +平手pingshou +评说pingshuo +平素pingsu +平坦pingtan +乒坛pingtan +平稳pingwen +平息pingxi +萍乡pingxiang +平行pingxing +平易pingyi +评议pingyi +平庸pingyong +平原pingyuan +平仄pingze +屏障pingzhang +凭着pingzhe +平整pingzheng +凭证pingzheng +评注pingzhu +贫寒pinhan +品级pinji +贫困pinkun +频率pinlu +品貌pinmao +拼命pinming +品名pinming +品评pinping +聘请pinqing +贫穷pinqiong +聘任pinren +聘书pinshu +拼写pinxie +品行pinxing +品性pinxing +拼音pinyin +品质pinzhi +品种pinzhong +批判pipan +匹配pipei +批评piping +脾气piqi +譬如piru +疲软piruan +批示pishi +脾胃piwei +脾性pixing +辟谣piyao +批语piyu +批阅piyue +批注pizhu +批准pizhun +平均数pjs +披荆斩棘pjzj +评论员ply +跑马观花pmgh +破po +迫po +坡po +泼po +繁*po +朴*po +泊*po +颇po +婆po +魄po +粕po +叵po +陂*po +鄱po +泺*po +珀po +攴po +钋po +钷po +钹*po +皤po +笸po +破案poan +破产pochan +破除pochu +坡度podu +泼妇pofu +破格poge +迫害pohai +破坏pohuai +破获pohuo +迫近pojin +破旧pojiu +泼辣pola +破烂polan +魄力poli +破例poli +破裂polie +破灭pomie +迫切poqie +迫使poshi +破碎posui +破损posun +破土potu +剖pou +裒pou +掊pou +剖解poujie +剖析pouxi +破绽pozhan +蓬蓬勃勃ppbb +普普通通pptt +旁若无人prwr +普通话pth +抛头露面ptlm +普pu +谱pu +扑pu +埔pu +铺pu +暴*pu +葡pu +朴pu +蒲pu +堡*pu +脯*pu +仆pu +莆pu +菩pu +圃pu +浦pu +曝pu +瀑pu +匍pu +噗pu +溥pu +濮pu +璞pu +氆pu +镤pu +镨pu +蹼pu +普遍pubian +普查pucha +扑哧puchi +扑打puda +铺盖pugai +普及puji +铺平puping +仆人puren +菩萨pusa +铺设pushe +朴实pushi +朴素pusu +葡萄putao +普通putong +扑通putong +铺位puwei +谱写puxie +普选puxuan +铺张puzhang +普照puzhao +朴直puzhi +平易近人pyjr +拼音字母pyzm +铺张浪费pzlf +起q +前q +其q +去q +气q +全q +期q +群q +情q +区q +强q +切q +取q +七q +求q +清q +确q +权q +且q +青q +亲爱的qad +情报所qbs +千百万qbw +千变万化qbwh +取长补短qcbd +千锤百炼qcbl +恰到好处qdhc +全党全军和全国qdqg +取而代之qedz +轻而易举qeyj +千方百计qfbj +清规戒律qgjl +勤工俭学qgjx +旗鼓相当qgxd +轻工业qgy +轻工业部qgyb +勤工助学qgzx +权衡利弊qhlb +骑虎难下qhnx +青海省qhs +青红皂白qhzb +起qi +其qi +气qi +期qi +七qi +器qi +齐qi +奇qi +汽qi +企qi +漆qi +欺qi +旗qi +畦qi +启qi +弃qi +歧qi +稽*qi +缉*qi +栖qi +戚qi +妻qi +凄qi +柒qi +沏qi +棋qi +崎qi +脐qi +祈qi +祁qi +骑qi +岂qi +乞qi +契qi +砌qi +迄qi +泣qi +讫qi +亟*qi +亓qi +俟qi +圻qi +芑qi +芪qi +荠*qi +萁qi +萋qi +葺qi +蕲qi +嘁qi +屺qi +岐qi +岖*qi +汔qi +淇qi +骐qi +绮qi +琪qi +琦qi +杞qi +桤qi +槭qi +耆qi +欹qi +祺qi +憩qi +碛qi +颀qi +蛴qi +蜞qi +綦qi +綮qi +蹊qi +鳍qi +麒qi +卡*qia +恰qia +掐qia +洽qia +伽*qia +葜qia +袷*qia +髂qia +恰当qiadang +恰好qiahao +前qian +千qian +钱qian +浅qian +签qian +迁qian +铅qian +潜qian +牵qian +钳qian +纤*qian +谴qian +扦qian +钎qian +仟qian +谦qian +乾qian +黔qian +遣qian +堑qian +嵌qian +欠qian +歉qian +倩qian +佥qian +阡qian +芊qian +芡qian +茜qian +荨qian +掮qian +岍qian +悭qian +慊qian +骞qian +搴qian +褰qian +缱qian +椠qian +犍*qian +肷qian +愆qian +钤qian +虔qian +箬qian +箝qian +前辈qianbei +前边qianbian +浅薄qianbo +钱财qiancai +欠产qianchan +前程qiancheng +签到qiandao +前敌qiandi +签订qianding +签发qianfa +遣返qianfan +前方qianfang +强qiang +将*qiang +枪qiang +抢qiang +墙qiang +腔qiang +呛qiang +羌qiang +蔷qiang +戕qiang +嫱qiang +樯qiang +戗qiang +炝qiang +锖qiang +锵qiang +镪qiang +襁qiang +蜣qiang +羟qiang +跄qiang +墙壁qiangbi +枪毙qiangbi +强辩qiangbian +强大qiangda +枪弹qiangdan +强盗qiangdao +强调qiangdiao +腔调qiangdiao +强度qiangdu +抢夺qiangduo +强攻qianggong +强国qiangguo +强化qianghua +强加qiangjia +强奸qiangjian +抢劫qiangjie +强劲qiangjin +抢救qiangjiu +枪决qiangjue +强烈qianglie +强迫qiangpo +强权qiangquan +强弱qiangruo +枪杀qiangsha +强盛qiangsheng +千古qiangu +牵挂qiangua +蔷薇qiangwei +抢险qiangxian +强行qiangxing +强硬qiangying +强占qiangzhan +强者qiangzhe +强制qiangzhi +枪支qiangzhi +强壮qiangzhuang +前后qianhou +前进qianjin +前景qianjing +迁就qianjiu +歉疚qianjiu +迁居qianju +乾坤qiankun +千里qianli +前例qianli +潜力qianli +牵连qianlian +前列qianlie +浅陋qianlou +前面qianmian +签名qianming +前年qiannian +前期qianqi +千秋qianqiu +前驱qianqu +欠缺qianque +前人qianren +前任qianren +纤弱qianruo +前哨qianshao +牵涉qianshe +歉收qianshou +签署qianshu +遣送qiansong +前提qianti +前天qiantian +欠条qiantiao +前途qiantu +千瓦qianwa +千万qianwan +前往qianwang +前夕qianxi +纤细qianxi +前线qianxian +浅显qianxian +谦虚qianxu +谦逊qianxun +前言qianyan +前沿qianyan +前夜qianye +歉意qianyi +迁移qianyi +牵引qianyin +潜在qianzai +谴责qianze +前者qianzhe +签证qianzheng +牵制qianzhi +钳制qianzhi +签字qianzi +前奏qianzou +桥qiao +瞧qiao +壳*qiao +巧qiao +敲qiao +乔qiao +蕉qiao +橇qiao +锹qiao +悄qiao +侨qiao +鞘qiao +撬qiao +翘qiao +峭qiao +俏qiao +窍qiao +雀*qiao +劁qiao +诮qiao +谯qiao +荞qiao +峤*qiao +愀qiao +憔qiao +缲*qiao +樵qiao +硗qiao +跷qiao +鞒qiao +侨胞qiaobao +桥墩qiaodun +巧计qiaoji +瞧见qiaojian +侨居qiaoju +桥梁qiaoliang +窍门qiaomen +巧妙qiaomiao +桥牌qiaopai +乔迁qiaoqian +悄然qiaoran +侨务qiaowu +敲诈qiaozha +恰似qiasi +洽谈qiatan +岂不qibu +起步qibu +器材qicai +奇才qicai +凄惨qican +起草qicao +汽车qiche +骑车qiche +启程qicheng +起初qichu +凄楚qichu +其次qici +期待qidai +脐带qidai +岂但qidan +启迪qidi +起点qidian +启动qidong +气度qidu +切qie +且qie +砌*qie +茄qie +怯qie +窃qie +伽*qie +郄qie +惬qie +慊*qie +妾qie +挈qie +锲qie +箧qie +窃案qiean +切断qieduan +切合qiehe +窃据qieju +窃取qiequ +怯弱qieruo +切身qieshen +切实qieshi +切题qieti +窃听qieting +切削qiexiao +惬意qieyi +启发qifa +起飞qifei +岂非qifei +气愤qifen +气氛qifen +欺负qifu +气概qigai +乞丐qigai +岂敢qigan +气功qigong +奇怪qiguai +器官qiguan +旗号qihao +漆黑qihei +气候qihou +期货qihuo +契机qiji +奇迹qiji +期间qijian +起见qijian +器件qijian +七届qijie +迄今qijin +起来qilai +凄凉qiliang +欺凌qiling +气流qiliu +歧路qilu +起码qima +骑马qima +启蒙qimeng +奇妙qimiao +器皿qimin +亲qin +侵qin +勤qin +秦qin +钦qin +琴qin +芹qin +擒qin +禽qin +寝qin +沁qin +芩qin +揿qin +吣qin +嗪qin +噙qin +廑*qin +溱qin +檎qin +锓qin +矜*qin +覃qin +螓qin +衾qin +亲爱qinai +亲笔qinbi +岂能qineng +侵犯qinfan +勤奋qinfen +情qing +清qing +青qing +轻qing +倾qing +请qing +亲*qing +庆qing +氢qing +晴qing +卿qing +擎qing +氰qing +顷qing +苘qing +圊qing +檠qing +磬qing +蜻qing +罄qing +箐qing +綮*qing +謦qing +鲭qing +黥qing +清白qingbai +青白qingbai +情报qingbao +情操qingcao +青草qingcao +清查qingcha +清除qingchu +清楚qingchu +青春qingchun +青翠qingcui +清单qingdan +倾倒qingdao +清点qingdian +情调qingdiao +轻浮qingfu +青工qinggong +青海qinghai +庆贺qinghe +清华qinghua +情怀qinghuai +清还qinghuan +请假qingjia +请柬qingjian +请教qingjiao +情节qingjie +清洁qingjie +情景qingjing +顷刻qingke +晴空qingkong +轻快qingkuai +情况qingkuang +青睐qinglai +晴朗qinglang +情理qingli +清理qingli +轻率qinglu +轻蔑qingmie +青年qingnian +氢气qingqi +轻巧qingqiao +请求qingqiu +情趣qingqu +青山qingshan +请示qingshi +清爽qingshuang +青松qingsong +轻松qingsong +倾诉qingsu +青天qingtian +晴天qingtian +倾听qingting +倾吐qingtu +请问qingwen +倾向qingxiang +倾销qingxiao +情形qingxing +清醒qingxing +情绪qingxu +情谊qingyi +轻易qingyi +轻盈qingying +情愿qingyuan +请愿qingyuan +请战qingzhan +轻重qingzhong +倾注qingzhu +庆祝qingzhu +请罪qingzui +侵害qinhai +勤俭qinjian +亲近qinjin +亲眷qinjuan +勤快qinkuai +勤劳qinlao +亲历qinli +亲临qinlin +侵略qinlue +亲密qinmi +勤勉qinmian +钦佩qinpei +亲戚qinqi +亲切qinqie +亲热qinre +亲人qinren +侵入qinru +亲身qinshen +侵蚀qinshi +寝室qinshi +亲手qinshou +亲属qinshu +侵吞qintun +勤务qinwu +亲信qinxin +亲眼qinyan +亲友qinyou +侵占qinzhan +亲自qinzi +穷qiong +琼qiong +邛qiong +茕qiong +穹qiong +蛩qiong +筇qiong +跫qiong +銎qiong +穷国qiongguo +穷苦qiongku +穷困qiongkun +穹隆qionglong +穷期qiongqi +穷人qiongren +穷途qiongtu +气派qipai +欺骗qipian +气魄qipo +乞求qiqiu +崎岖qiqu +齐全qiquan +凄然qiran +起色qise +气色qise +其实qishi +起始qishi +启事qishi +气势qishi +启示qishi +歧视qishi +奇数qishu +汽水qishui +起诉qisu +其他qita +其它qita +奇特qite +气体qiti +汽艇qiting +企图qitu +歧途qitu +求qiu +球qiu +秋qiu +丘qiu +仇*qiu +龟*qiu +邱qiu +囚qiu +酋qiu +泅qiu +俅qiu +巯qiu +犰qiu +湫qiu +逑qiu +遒qiu +楸qiu +赇qiu +虬qiu +蚯qiu +蝤qiu +裘qiu +糗qiu +鳅qiu +鼽qiu +秋播qiubo +球场qiuchang +囚犯qiufan +秋风qiufeng +秋季qiuji +求教qiujiao +囚禁qiujin +求救qiujiu +丘陵qiuling +秋千qiuqian +求情qiuqing +求全qiuquan +秋色qiuse +求实qiushi +秋收qiushou +秋天qiutian +求学qiuxue +求战qiuzhan +求证qiuzheng +求知qiuzhi +求助qiuzhu +期望qiwang +气味qiwei +气温qiwen +奇闻qiwen +欺侮qiwu +气息qixi +栖息qixi +起先qixian +期限qixian +气象qixiang +器械qixie +齐心qixin +气压qiya +欺压qiya +气焰qiyan +企业qiye +起义qiyi +歧义qiyi +起因qiyin +启用qiyong +汽油qiyou +其余qiyu +起源qiyuan +七月qiyue +契约qiyue +欺诈qizha +气质qizhi +旗帜qizhi +其中qizhong +器重qizhong +旗子qizi +妻子qizi +勤俭建国qjjg +勤俭节约qjjy +迄今为止qjwz +取决于qjy +千钧一发qjyf +旗开得胜qkds +全力以赴qlyf +勤劳致富qlzf +千里之行qlzx +亲密无间qmwj +青年人qnr +千篇一律qpyl +清清楚楚qqcc +勤勤恳恳qqkk +切切实实qqss +确确实实qqss +恰恰相反qqxf +求全责备qqzb +恰如其分qrqf +欺人之谈qrzt +七手八脚qsbj +全神贯注qsgz +全世界qsj +切实可行qskx +切身利益qsly +青少年qsn +前所未闻qsww +前所未有qswy +气势汹汹qsxx +齐头并进qtbj +奇谈怪论qtgl +千头万绪qtwx +前提下qtx +去qu +区qu +取qu +曲qu +且*qu +渠qu +屈qu +趋qu +驱qu +趣qu +蛆qu +躯qu +娶qu +龋qu +戌*qu +诎qu +劬qu +苣*qu +蕖qu +蘧qu +岖qu +衢qu +阒qu +璩qu +觑qu +氍qu +朐qu +祛qu +磲qu +鸲qu +癯qu +蛐qu +蠼qu +麴qu +瞿qu +黢qu +全quan +权quan +圈quan +劝quan +泉quan +醛quan +颧quan +痊quan +拳quan +犬quan +券quan +诠quan +荃quan +悛quan +绻quan +辁quan +畎quan +铨quan +蜷quan +筌quan +鬈quan +全部quanbu +全党quandang +劝导quandao +蜷伏quanfu +劝告quangao +全国quanguo +权衡quanheng +全会quanhui +拳击quanji +劝解quanjie +全局quanju +全军quanjun +全力quanli +权利quanli +权力quanli +全貌quanmao +全面quanmian +劝勉quanmian +全民quanmin +全能quanneng +全年quannian +全盘quanpan +全拼quanpin +全球quanqiu +蜷曲quanqu +全权quanquan +全然quanran +全胜quansheng +权术quanshu +泉水quanshui +劝说quanshuo +圈套quantao +全体quanti +拳头quantou +权威quanwei +劝慰quanwei +全文quanwen +全县quanxian +权限quanxian +全校quanxiao +权益quanyi +权宜quanyi +劝诱quanyou +痊愈quanyu +劝止quanzhi +劝阻quanzu +区别qubie +屈才qucai +驱除quchu +取代qudai +渠道qudao +取得qude +取缔qudi +曲调qudiao +驱动qudong +确que +却que +缺que +炔que +瘸que +鹊que +榷que +雀que +阕que +阙que +悫que +确保quebao +缺点quedian +确定queding +缺乏quefa +缺口quekou +确立queli +确切queqie +确认queren +缺少queshao +缺省quesheng +确实queshi +缺席quexi +缺陷quexian +确信quexin +确凿quezao +瘸子quezi +区分qufen +屈服qufu +躯干qugan +区划quhua +曲解qujie +取经qujing +取决qujue +躯壳quke +取乐qule +群qun +裙qun +逡qun +裙带qundai +群岛qundao +去年qunian +群众qunzhong +区区ququ +屈辱quru +驱散qusan +取舍qushe +取胜qusheng +去世qushi +驱使qushi +趋势qushi +躯体quti +区位quwei +区委quwei +趣味quwei +区县quxian +去向quxiang +趋向quxiang +取消quxiao +取信quxin +曲艺quyi +区域quyu +区长quzhang +曲折quzhe +屈指quzhi +驱逐quzhu +曲子quzi +奇形怪状qxgz +全心全意qxqy +气象台qxt +气象万千qxwq +齐心协力qxxl +岂有此理qycl +前因后果qyhg +情有可原qyky +强有力qyl +求之不得qzbd +取之不尽qzbj +轻重缓急qzhj +气壮山河qzsh +千真万确qzwq +人r +如r +日r +认r +入r +任r +热r +然r +容r +让r +润r +弱r +燃r +染r +壤r +绕r +仁r +溶r +刃r +仍r +然ran +燃ran +染ran +冉ran +苒ran +蚺ran +髯ran +燃点randian +然而raner +让rang +壤rang +嚷rang +瓤rang +攘rang +禳rang +穰rang +让步rangbu +让位rangwei +让贤rangxian +然后ranhou +燃料ranliao +染料ranliao +冉冉ranran +燃烧ranshao +绕rao +扰rao +饶rao +荛rao +娆rao +桡rao +扰乱raoluan +如此而已rcey +人才济济rcjj +热re +若*re +惹re +热爱reai +热潮rechao +热忱rechen +热诚recheng +热带redai +热火rehuo +热量reliang +热烈relie +人ren +认ren +任ren +仁ren +刃ren +忍ren +壬ren +韧ren +妊ren +纫ren +仞ren +荏ren +葚ren +饪ren +轫ren +稔ren +衽ren +热闹renao +人才rencai +人次renci +仁慈renci +认错rencuo +人大renda +韧带rendai +人道rendao +认得rende +认定rending +人防renfang +仍reng +扔reng +扔掉rengdiao +人格renge +仍旧rengjiu +人工rengong +认购rengou +仍然rengran +任何renhe +人家renjia +人间renjian +人杰renjie +认可renke +人口renkou +人类renlei +人力renli +人们renmen +任免renmian +人民renmin +任命renming +忍耐rennai +任凭renping +任期renqi +认清renqing +人权renquan +荏苒renran +忍让renrang +人人renren +人参renshen +人生rensheng +人事renshi +人士renshi +认识renshi +人手renshou +忍受renshou +认输renshu +忍痛rentong +人为renwei +认为renwei +人物renwu +任务renwu +人心renxin +忍心renxin +人选renxuan +任意renyi +仁义renyi +任用renyong +人员renyuan +认帐renzhang +认真renzhen +人质renzhi +任职renzhi +认罪renzui +认作renzuo +热切reqie +热情reqing +惹事reshi +热线rexian +热心rexin +热血rexue +人工合成rghc +热火朝天rhct +如虎添翼rhty +日ri +日报ribao +日本riben +日产richan +日常richang +日程richeng +日光riguang +日后rihou +日记riji +日久rijiu +日历rili +日落riluo +日内rinei +日期riqi +日夜riye +日益riyi +日用riyong +日照rizhao +日中rizhong +日子rizi +软件包rjb +人杰地灵rjdl +人尽其才rjqc +如饥似渴rjsk +日久天长rjtc +任劳任怨rlry +热泪盈眶rlyk +人民币rmb +人民代表大会rmdh +人民日报rmrb +燃眉之急rmzj +容rong +溶rong +荣rong +熔rong +融rong +绒rong +戎rong +茸rong +蓉rong +冗rong +嵘rong +狨rong +榕rong +肜rong +蝾rong +熔点rongdian +容光rongguang +融合ronghe +溶化ronghua +熔化ronghua +融化ronghua +融会ronghui +荣获ronghuo +容积rongji +溶解rongjie +容量rongliang +戎马rongma +容貌rongmao +容纳rongna +融洽rongqia +容忍rongren +荣辱rongru +容身rongshen +绒线rongxian +荣幸rongxing +容许rongxu +荣耀rongyao +溶液rongye +容易rongyi +荣誉rongyu +溶质rongzhi +肉rou +揉rou +柔rou +糅rou +蹂rou +鞣rou +柔和rouhe +肉麻rouma +柔软rouruan +肉体routi +任人为贤rrwx +日日夜夜rryy +人生观rsg +认识论rsl +惹事生非rssf +如上所述rsss +如ru +入ru +儒ru +乳ru +茹ru +蠕ru +孺ru +辱ru +汝ru +褥ru +蓐ru +薷ru +嚅ru +洳ru +溽ru +濡ru +缛ru +铷ru +襦ru +颥ru +软ruan +阮ruan +朊ruan +软骨ruangu +软件ruanjian +软禁ruanjin +软盘ruanpan +如常ruchang +如此ruci +入党rudang +蠕动rudong +乳房rufang +如果ruguo +如何ruhe +瑞rui +锐rui +蕊rui +芮rui +蕤rui +枘rui +睿rui +蚋rui +锐利ruili +瑞雪ruixue +锐意ruiyi +儒家rujia +如今rujin +辱骂ruma +入门rumen +入迷rumi +润run +闰run +润滑runhua +弱ruo +若ruo +偌ruo +弱点ruodian +若干ruogan +若是ruoshi +弱小ruoxiao +如期ruqi +入侵ruqin +如若ruruo +儒生rusheng +入手rushou +如同rutong +如下ruxia +入选ruxuan +如意ruyi +如愿ruyuan +入帐ruzhang +人武部rwb +若无其事rwqs +人言可畏rykw +日用品ryp +若有所思ryss +人之长情rzcq +是s +上s +时s +生s +说s +社s +深s +水s +所s +三s +十s +使s +事s +数s +四s +实s +少s +式s +山s +手s +撒sa +萨sa +洒sa +卅sa +仨sa +挲sa +脎sa +飒sa +撒谎sahuang +塞sai +思*sai +赛sai +腮sai +鳃sai +噻sai +赛车saiche +塞子saizi +撒娇sajiao +三san +散san +叁san +伞san +馓san +毵san +糁san +散步sanbu +散布sanbu +散发sanfa +三废sanfei +桑sang +丧sang +嗓sang +搡sang +磉sang +颡sang +丧命sangming +丧失sangshi +三国sanguo +三好sanhao +散会sanhui +三角sanjiao +三届sanjie +散失sanshi +散文sanwen +三月sanyue +扫sao +梢*sao +搔sao +骚sao +嫂sao +埽sao +缫sao +缲sao +臊sao +瘙sao +鳋sao +扫除saochu +扫荡saodang +扫地saodi +骚动saodong +骚乱saoluan +扫描saomiao +扫墓saomu +骚扰saorao +瘙痒saoyang +扫帚saozhou +洒脱satuo +说不定sbd +舍不得sbd +说不过去sbgq +说不来sbl +数不胜数sbss +素不相识sbxs +身不由己sbyj +上层建筑scjz +生产力scl +生产率scl +水产品scp +四川省scs +市场调节sctj +市场信息scxx +生动活泼sdhp +山东省sds +水电站sdz +色se +塞*se +瑟se +涩se +啬se +铯se +穑se +视而不见sebj +色彩secai +色调sediao +色盲semang +森sen +僧seng +僧侣senglu +森林senlin +森严senyan +色情seqing +瑟瑟sese +十二月sey +色泽seze +司法部sfb +赏罚分明sffm +说服力sfl +手风琴sfq +三番五次sfwc +四个现代化sgxh +手工业sgy +沙sha +杀sha +砂sha +啥sha +纱sha +莎sha +刹sha +傻sha +煞sha +杉sha +厦*sha +唼sha +嗄*sha +挲*sha +歃sha +铩sha +痧sha +裟sha +霎sha +鲨sha +煞白shabai +刹车shache +煞车shache +沙发shafa +傻瓜shagua +沙皇shahuang +色*shai +筛shai +晒shai +晒台shaitai +砂烬shajin +沙龙shalong +沙漠shamo +山shan +单*shan +闪shan +善shan +珊shan +扇shan +陕shan +掸*shan +苫shan +杉shan +删shan +煽shan +衫shan +擅shan +赡shan +膳shan +汕shan +缮shan +栅*shan +剡shan +讪shan +鄯shan +埏shan +芟shan +潸shan +姗shan +嬗shan +骟shan +膻shan +禅*shan +钐shan +疝shan +蟮shan +舢shan +跚shan +鳝shan +刹那shana +山坳shanao +陕北shanbei +擅长shanchang +删除shanchu +山川shanchuan +山地shandi +闪电shandian +扇动shandong +煽动shandong +山东shandong +山峰shanfeng +上shang +商shang +伤shang +尚shang +汤*shang +墒shang +赏shang +晌shang +裳shang +垧shang +绱shang +殇shang +熵shang +觞shang +删改shangai +山岗shangang +山冈shangang +上班shangban +上报shangbao +上边shangbian +商标shangbiao +上部shangbu +上策shangce +上层shangceng +商场shangchang +上次shangci +赏赐shangci +上当shangdang +上等shangdeng +上帝shangdi +商店shangdian +上调shangdiao +商定shangding +上访shangfang +伤感shanggan +上告shanggao +赏光shangguang +上海shanghai +伤害shanghai +商行shanghang +上级shangji +上集shangji +上进shangjin +上空shangkong +上来shanglai +商量shangliang +上流shangliu +上门shangmen +上面shangmian +上年shangnian +山沟shangou +商品shangpin +商洽shangqia +上前shangqian +尚且shangqie +上去shangqu +商榷shangque +商人shangren +上任shangren +上山shangshan +上升shangsheng +赏识shangshi +上述shangshu +上司shangsi +上诉shangsu +商谈shangtan +商讨shangtao +闪光shanguang +上文shangwen +上午shangwu +商务shangwu +上下shangxia +上限shangxian +伤心shangxin +上旬shangxun +上演shangyan +商业shangye +商议shangyi +上映shangying +上游shangyou +上涨shangzhang +上阵shangzhen +山河shanhe +善后shanhou +删节shanjie +善良shanliang +山林shanlin +山岭shanling +山脉shanmai +杉木shanmu +山区shanqu +扇区shanqu +山水shanshui +闪烁shanshuo +山头shantou +山西shanxi +陕西shanxi +赡养shanyang +闪耀shanyao +善意shanyi +善于shanyu +善战shanzhan +擅自shanzi +少shao +烧shao +稍shao +绍shao +召*shao +哨shao +梢shao +鞘*shao +捎shao +芍shao +勺shao +韶shao +邵shao +劭shao +苕shao +潲shao +杓*shao +蛸shao +筲shao +艄shao +哨兵shaobing +艄公shaogong +烧毁shaohui +少见shaojian +哨卡shaoka +少量shaoliang +少年shaonian +少女shaonu +烧伤shaoshang +少数shaoshu +哨所shaosuo +稍微shaowei +少许shaoxu +稍许shaoxu +少爷shaoye +少有shaoyou +少于shaoyu +少壮shaozhuang +沙哑shaya +砂眼shayan +傻子shazi +社she +设she +射she +摄she +舌she +折*she +涉she +舍she +蛇she +奢she +赊she +赦she +慑she +厍she +佘she +摺*she +猞she +滠she +歙she +畲she +麝she +设备shebei +射程shecheng +奢侈shechi +舍得shede +设法shefa +慑服shefu +赊购shegou +奢华shehua +社会shehui +社稷sheji +涉及sheji +设计sheji +射击sheji +舍己sheji +社交shejiao +设立sheli +涉猎shelie +社论shelun +深shen +身shen +神shen +什*shen +伸shen +参*shen +甚shen +渗shen +沈shen +肾shen +审shen +申shen +慎shen +砷shen +呻shen +娠shen +绅shen +婶shen +诜shen +谂shen +莘shen +葚*shen +哂shen +渖shen +椹shen +胂shen +矧shen +蜃shen +深奥shenao +申报shenbao +身边shenbian +申辩shenbian +身材shencai +审查shencha +深沉shenchen +深处shenchu +审处shenchu +审定shending +深度shendu +甚而shener +身分shenfen +身份shenfen +生sheng +胜sheng +声sheng +省sheng +升sheng +盛sheng +绳sheng +剩sheng +圣sheng +牲sheng +乘*sheng +甥sheng +嵊sheng +渑*sheng +晟sheng +眚sheng +笙sheng +生财shengcai +生产shengchan +生成shengcheng +牲畜shengchu +生存shengcun +盛大shengda +省得shengde +胜地shengdi +盛典shengdian +声调shengdiao +生动shengdong +省份shengfen +胜负shengfu +省府shengfu +生根shenggen +升华shenghua +省会shenghui +盛会shenghui +生活shenghuo +生机shengji +生计shengji +升级shengji +圣洁shengjie +圣经shengjing +盛开shengkai +牲口shengkou +盛况shengkuang +生理shengli +胜利shengli +省力shengli +省略shenglue +生命shengming +声明shengming +盛名shengming +生怕shengpa +生僻shengpi +生平shengping +升旗shengqi +生前shengqian +升迁shengqian +盛情shengqing +生趣shengqu +省去shengqu +胜任shengren +生日shengri +省事shengshi +盛事shengshi +声势shengshi +生疏shengshu +生死shengsi +胜似shengsi +胜诉shengsu +绳索shengsuo +生态shengtai +声讨shengtao +声望shengwang +省委shengwei +生物shengwu +生息shengxi +剩下shengxia +盛夏shengxia +圣贤shengxian +生效shengxiao +生肖shengxiao +盛行shengxing +生涯shengya +生意shengyi +声音shengyin +生于shengyu +生育shengyu +胜于shengyu +声誉shengyu +剩余shengyu +声援shengyuan +生长shengzhang +省长shengzhang +声张shengzhang +胜仗shengzhang +生殖shengzhi +圣旨shengzhi +盛装shengzhuang +审核shenhe +深厚shenhou +深化shenhua +神话shenhua +甚或shenhuo +审计shenji +神经shenjing +深刻shenke +审理shenli +什么shenme +审美shenmei +神秘shenmi +申明shenming +审判shenpan +身旁shenpang +审批shenpi +神气shenqi +神奇shenqi +深浅shenqian +深切shenqie +深情shenqing +申请shenqing +身躯shenqu +深入shenru +渗入shenru +神圣shensheng +身世shenshi +绅士shenshi +伸手shenshou +申述shenshu +神速shensu +申诉shensu +伸缩shensuo +神态shentai +身体shenti +神通shentong +渗透shentou +审问shenwen +神仙shenxian +审讯shenxun +沈阳shenyang +审议shenyi +呻吟shenyin +身影shenying +深远shenyuan +申冤shenyuan +审阅shenyue +深造shenzao +伸张shenzhang +深圳shenzhen +甚至shenzhi +深重shenzhong +慎重shenzhong +神州shenzhou +舍弃sheqi +赊欠sheqian +设施sheshi +社团shetuan +奢望shewang +射线shexian +涉嫌shexian +设想shexiang +赊销shexiao +设宴sheyan +摄影sheying +社员sheyuan +社长shezhang +设置shezhi +涉足shezu +社会公德shgd +是shi +时shi +十shi +使shi +事shi +实shi +式shi +识shi +世shi +试shi +石shi +什shi +示shi +市shi +史shi +师shi +始shi +施shi +士shi +势shi +湿shi +适shi +食shi +失shi +视shi +室shi +氏shi +似*shi +蚀shi +诗shi +释shi +殖*shi +拾shi +饰shi +驶shi +匙*shi +狮shi +尸shi +虱shi +矢shi +屎shi +柿shi +拭shi +誓shi +逝shi +嗜shi +噬shi +仕shi +侍shi +恃shi +嘘*shi +峙*shi +谥shi +埘shi +莳shi +蓍shi +弑shi +轼shi +贳shi +炻shi +铈shi +螫shi +舐shi +筮shi +酾shi +豕shi +鲥shi +鲺shi +失败shibai +势必shibi +事变shibian +师表shibiao +识别shibie +失策shice +史册shice +视察shicha +时常shichang +失常shichang +市场shichang +时辰shichen +失传shichuan +侍从shicong +时代shidai +世代shidai +适当shidang +是的shide +实地shidi +试点shidian +失调shidiao +失掉shidiao +事端shiduan +拾掇shiduo +时而shier +示范shifan +师范shifan +施放shifang +释放shifang +是非shifei +时分shifen +十分shifen +侍奉shifeng +是否shifou +师傅shifu +实干shigan +是个shige +诗歌shige +施工shigong +事故shigu +世故shigu +尸骨shigu +使馆shiguan +时光shiguang +嗜好shihao +适合shihe +时候shihou +事后shihou +侍候shihou +使唤shihuan +实惠shihui +失火shihuo +时机shiji +事迹shiji +实际shiji +世纪shiji +试剂shiji +史籍shiji +施加shijia +市价shijia +时间shijian +事件shijian +世间shijian +实践shijian +视角shijiao +市郊shijiao +使节shijie +十届shijie +世界shijie +使劲shijin +市井shijing +时局shiju +视觉shijue +时刻shike +石刻shike +市侩shikuai +实况shikuang +事理shili +实力shili +事例shili +势利shili +失利shili +势力shili +视力shili +示例shili +失恋shilian +适量shiliang +矢量shiliang +拾零shiling +失灵shiling +适龄shiling +时髦shimao +失密shimi +市民shimin +使命shiming +市内shinei +室内shinei +诗篇shipian +食品shipin +视频shipin +识破shipo +时期shiqi +事前shiqian +失窃shiqie +事情shiqing +实情shiqing +时区shiqu +时取shiqu +失去shiqu +市区shiqu +诗人shiren +市容shirong +湿润shirun +示弱shiruo +失散shisan +失色shise +施舍shishe +师生shisheng +失声shisheng +时时shishi +时事shishi +适时shishi +事实shishi +失事shishi +实施shishi +失实shishi +逝世shishi +史诗shishi +失势shishi +誓师shishi +尸首shishou +失守shishou +实数shishu +施属shishu +世俗shisu +失算shisuan +事态shitai +试探shitan +食堂shitang +实体shiti +尸体shiti +石头shitou +势头shitou +师团shituan +十万shiwan +失望shiwang +市委shiwei +示威shiwei +时务shiwu +事物shiwu +事务shiwu +实物shiwu +食物shiwu +饰物shiwu +失误shiwu +实习shixi +事先shixian +视线shixian +实现shixian +试想shixiang +事项shixiang +实效shixiao +试销shixiao +失信shixin +实行shixing +试行shixing +施行shixing +失修shixiu +实学shixue +史学shixue +实验shiyan +试验shiyan +食言shiyan +誓言shiyan +式样shiyang +事业shiye +实业shiye +失业shiye +视野shiye +时宜shiyi +事宜shiyi +示意shiyi +诗意shiyi +适宜shiyi +释疑shiyi +适应shiying +使用shiyong +实用shiyong +试用shiyong +适用shiyong +事由shiyou +石油shiyou +誓由shiyou +适于shiyu +誓愿shiyuan +十月shiyue +失约shiyue +实在shizai +实战shizhan +施展shizhan +市长shizhang +师长shizhang +使者shizhe +侍者shizhe +失真shizhen +市镇shizhen +市政shizheng +试制shizhi +实质shizhi +市制shizhi +食指shizhi +失职shizhi +适中shizhong +示众shizhong +始终shizhong +时装shizhuang +师资shizi +十足shizu +实足shizu +失足shizu +始祖shizu +手shou +受shou +收shou +首shou +守shou +熟*shou +授shou +寿shou +兽shou +售shou +瘦shou +狩shou +绶shou +艏shou +守备shoubei +手表shoubiao +收兵shoubing +收藏shoucang +手册shouce +首倡shouchang +寿辰shouchen +收成shoucheng +首创shouchuang +首次shouci +收存shoucun +寿诞shoudan +受到shoudao +守敌shoudi +首度shoudu +首都shoudu +手段shouduan +守法shoufa +首犯shoufan +收复shoufu +首府shoufu +手感shougan +手稿shougao +收割shouge +收购shougou +受害shouhai +守候shouhou +守护shouhu +收回shouhui +受贿shouhui +收获shouhuo +收集shouji +售价shoujia +受奖shoujiang +授奖shoujiang +手脚shoujiao +收缴shoujiao +首届shoujie +守旧shoujiu +收据shouju +授课shouke +受理shouli +收敛shoulian +首领shouling +收留shouliu +收录shoulu +收买shoumai +授命shouming +寿命shouming +首脑shounao +首批shoupi +授权shouquan +收容shourong +收入shouru +手软shouruan +瘦弱shouruo +首饰shoushi +手术shoushu +收缩shousuo +收条shoutiao +收听shouting +收尾shouwei +首尾shouwei +首先shouxian +首相shouxiang +瘦小shouxiao +收效shouxiao +手续shouxu +瘦削shouxue +收养shouyang +首要shouyao +受益shouyi +收益shouyi +兽医shouyi +受用shouyong +授予shouyu +守则shouze +首长shouzhang +收支shouzhi +生活上shs +上海市shs +数shu +书shu +树shu +属shu +术shu +输shu +述shu +熟shu +束shu +鼠shu +疏shu +殊shu +舒shu +蔬shu +薯shu +叔shu +署shu +枢shu +梳shu +抒shu +淑shu +赎shu +孰shu +暑shu +曙shu +蜀shu +黍shu +戍shu +竖shu +墅shu +庶shu +漱shu +恕shu +俞*shu +丨shu +倏shu +塾shu +菽shu +摅shu +沭shu +澍shu +姝shu +纾shu +毹shu +腧shu +殳shu +秫shu +刷shua +耍shua +唰shua +衰shuai +帅shuai +摔shuai +甩shuai +蟀shuai +衰败shuaibai +摔打shuaida +摔交shuaijiao +衰竭shuaijie +衰老shuailao +衰弱shuairuo +衰退shuaitui +衰亡shuaiwang +耍赖shualai +栓shuan +拴shuan +闩shuan +涮shuan +双shuang +霜shuang +爽shuang +泷*shuang +孀shuang +双边shuangbian +双方shuangfang +爽口shuangkou +爽快shuangkuai +爽朗shuanglang +双拼shuangpin +双重shuangzhong +耍弄shuanong +刷洗shuaxi +刷新shuaxin +书报shubao +书本shuben +蔬菜shucai +舒畅shuchang +输出shuchu +树丛shucong +疏导shudao +书店shudian +数额shue +抒发shufa +书法shufa +舒服shufu +束缚shufu +曙光shuguang +蜀汉shuhan +疏忽shuhu +倏忽shuhu +书画shuhua +水shui +说*shui +谁shui +睡shui +税shui +水稻shuidao +水电shuidian +水分shuifen +水果shuiguo +水火shuihuo +水晶shuijing +水库shuiku +水利shuili +水流shuiliu +睡眠shuimian +水平shuiping +税收shuishou +税务shuiwu +水下shuixia +水性shuixing +水源shuiyuan +水灾shuizai +谁知shuizhi +书记shuji +书籍shuji +暑假shujia +数据shuju +书刊shukan +数理shuli +树立shuli +竖立shuli +熟练shulian +数量shuliang +数列shulie +疏漏shulou +数落shuluo +数码shuma +书面shumian +庶民shumin +数目shumu +书目shumu +树木shumu +顺shun +吮shun +瞬shun +舜shun +顺便shunbian +顺差shuncha +顺次shunci +顺从shuncong +顺当shundang +顺道shundao +顺风shunfeng +枢纽shuniu +顺利shunli +顺路shunlu +瞬时shunshi +顺势shunshi +顺心shunxin +顺序shunxu +顺应shunying +顺着shunzhuo +说shuo +数*shuo +硕shuo +朔shuo +烁shuo +蒴shuo +搠shuo +妁shuo +槊shuo +铄shuo +说到shuodao +说道shuodao +说动shuodong +说法shuofa +说服shuofu +硕果shuoguo +说话shuohua +说教shuojiao +说明shuoming +说情shuoqing +硕士shuoshi +述评shuping +署期shuqi +暑期shuqi +抒情shuqing +熟人shuren +输入shuru +疏散shusan +属实shushi +熟识shushi +舒适shushi +束手shushou +叔叔shushu +数说shushuo +述说shushuo +输送shusong +疏松shusong +舒坦shutan +疏通shutong +熟悉shuxi +属相shuxiang +舒心shuxin +书信shuxin +属性shuxing +数学shuxue +属于shuyu +术语shuyu +疏远shuyuan +舒展shuzhan +数值shuzhi +树脂shuzhi +梳妆shuzhuang +数字shuzi +赎罪shuzui +售货员shy +社会主义shzy +四si +思si +死si +斯si +丝si +似si +司si +饲si +食*si +私si +厕*si +撕si +嘶si +肆si +寺si +嗣si +伺si +巳si +厮si +俟*si +兕si +厶si +咝si +汜si +泗si +澌si +姒si +驷si +缌si +祀si +锶si +鸶si +耜si +蛳si +笥si +死板siban +四边sibian +死别sibie +思潮sichao +丝绸sichou +四处sichu +四川sichuan +死党sidang +死敌sidi +司法sifa +四方sifang +四海sihai +丝毫sihao +嗣后sihou +似乎sihu +四化sihua +死缓sihuan +撕毁sihui +死活sihuo +四季siji +司机siji +私交sijiao +四届sijie +思考sikao +私利sili +私了siliao +司令siling +思路silu +四面simian +思念sinian +私念sinian +死去siqu +私人siren +死伤sishang +私事sishi +死尸sishi +死水sishui +思索sisuo +四体siti +私吞situn +死亡siwang +思维siwei +斯文siwen +私下sixia +思想sixiang +四项sixiang +死心sixin +私心sixin +肆行sixing +死刑sixing +私有siyou +私欲siyu +寺院siyuan +四月siyue +死者sizhe +四周sizhou +私自sizi +死罪sizui +拾金不昧sjbm +身经百战sjbz +书记处sjc +世界观sjg +舍己救人sjjr +数据库sjk +省军区sjq +杀鸡取蛋sjqd +实际上sjs +设计所sjs +试金石sjs +舍己为人sjwr +设计院sjy +随机应变sjyb +十进制sjz +石家庄sjz +适可而止skez +数理化slh +收录机slj +十六进制sljz +三令五申slws +司令员sly +四面八方smbf +手忙脚乱smjl +生命力sml +说明书sms +什么样smy +深谋远虑smyl +数目字smz +松song +送song +宋song +颂song +耸song +怂song +讼song +诵song +凇song +菘song +崧song +嵩song +忪song +悚song +淞song +竦song +松绑songbang +送别songbie +松弛songchi +松动songdong +颂歌songge +松劲songjin +松快songkuai +耸立songli +送礼songli +松散songsan +松涛songtao +松懈songxie +颂扬songyang +怂恿songyong +送葬songzang +送终songzhong +搜sou +艘sou +擞sou +嗽sou +叟sou +薮sou +嗖sou +嗾sou +馊sou +溲sou +飕sou +瞍sou +锼sou +螋sou +搜查soucha +搜集souji +搜索sousuo +搜寻souxun +售票处spc +食品工业spgy +水平线spx +生气勃勃sqbb +诗情画意sqhy +盛气凌人sqlr +山穷水尽sqsj +十全十美sqsm +首屈一指sqyz +四人帮srb +损人利己srlj +深入浅出srqc +似是而非ssef +时时刻刻sskk +姗姗来迟sslc +实事求是ssqs +事实上sss +随时随地sssd +善始善终sssz +顺水推舟sstz +四通公司stgs +四通集团stjt +身体力行stlx +生态平衡stph +素su +速su +苏su +塑su +缩su +俗su +诉su +宿su +肃su +酥su +粟su +僳su +溯su +夙su +谡su +蔌su +嗉su +愫su +涑su +簌su +觫su +稣su +算suan +酸suan +蒜suan +狻suan +酸楚suanchu +算法suanfa +算计suanji +算了suanle +算盘suanpan +算术suanshu +酸疼suanteng +酸痛suantong +素材sucai +速成sucheng +苏丹sudan +速度sudu +俗话suhua +随sui +穗sui +碎sui +虽sui +岁sui +尿*sui +隋sui +绥sui +髓sui +遂sui +隧sui +祟sui +谇sui +荽sui +濉sui +邃sui +燧sui +眭sui +睢sui +随笔suibi +随便suibian +随处suichu +随从suicong +随地suidi +随和suihe +随后suihou +随机suiji +随即suiji +虽然suiran +随身suishen +随时suishi +随手suishou +岁数suishu +虽说suishuo +随同suitong +随心suixin +随行suixing +随意suiyi +遂意suiyi +岁月suiyue +虽则suize +随着suizhe +诉苦suku +苏联sulian +塑料suliao +速率sulu +素描sumiao +肃穆sumu +损sun +孙sun +笋sun +荪sun +狲sun +飧sun +榫sun +隼sun +损害sunhai +损耗sunhao +损坏sunhuai +损伤sunshang +损失sunshi +孙子sunzi +所suo +缩suo +锁suo +索suo +莎*suo +蓑suo +梭suo +唆suo +琐suo +唢suo +嗦suo +嗍suo +娑suo +桫suo +挲*suo +睃suo +羧suo +所得suode +缩短suoduan +缩减suojian +锁链suolian +所能suoneng +索取suoqu +唆使suoshi +所属suoshu +琐碎suosui +所为suowei +所谓suowei +缩小suoxiao +缩写suoxie +琐屑suoxie +索性suoxing +所以suoyi +索引suoyin +缩影suoying +所有suoyou +所在suozai +所长suozhang +所至suozhi +梭子suozi +肃清suqing +苏区suqu +宿舍sushe +素数sushu +诉说sushuo +诉讼susong +速效suxiao +速写suxie +苏醒suxing +素养suyang +宿营suying +溯源suyuan +宿愿suyuan +夙愿suyuan +塑造suzao +速战suzhan +素质suzhi +苏州suzhou +苏维埃swa +税务局swj +手舞足蹈swzd +少先队sxd +身心健康sxjk +思想上sxs +山西省sxs +陕西省sxs +顺息万变sxwb +所向无敌sxwd +思想性sxx +商业部syb +说一不二sybe +收音机syj +使用价值syjz +所有权syq +沈阳市sys +实用性syx +十一月syy +所有制syz +私有制syz +时至今日szjr +三中全会szqh +始终如一szry +深圳四通szst +所作所为szsw +甚至于szy +他t +同t +它t +提t +题t +体t +图t +天t +头t +通t +条t +特t +土t +团t +统t +台t +她t +太t +套t +铁t +他ta +它ta +她ta +塔ta +踏ta +塌ta +獭ta +挞ta +蹋ta +拓*ta +嗒*ta +闼ta +溻ta +漯*ta +遢ta +榻ta +沓ta +铊ta +趿ta +鳎ta +踏步tabu +他的tade +它的tade +她的tade +塌方tafang +台tai +太tai +态tai +胎tai +抬tai +泰tai +苔tai +酞tai +汰tai +邰tai +薹tai +呔*tai +骀*tai +肽tai +炱tai +钛tai +跆tai +鲐tai +台北taibei +台词taici +态度taidu +台风taifeng +台阶taijie +太平taiping +泰然tairan +泰山taishan +态势taishi +太太taitai +抬头taitou +台湾taiwan +太阳taiyang +太原taiyuan +天安门tam +他们tamen +它们tamen +她们tamen +谈tan +碳tan +探tan +炭tan +弹*tan +坦tan +贪tan +滩tan +坍tan +摊tan +瘫tan +坛tan +檀tan +痰tan +潭tan +谭tan +毯tan +袒tan +叹tan +郯tan +澹tan +昙tan +忐tan +钽tan +锬tan +镡*tan +坦白tanbai +探测tance +探访tanfang +谈锋tanfeng +叹服tanfu +堂tang +糖tang +唐tang +塘tang +汤tang +搪tang +棠tang +膛tang +倘tang +躺tang +淌tang +趟tang +烫tang +傥tang +帑tang +溏tang +瑭tang +樘tang +铴tang +镗tang +耥tang +螗tang +螳tang +羰tang +醣tang +倘不tangbu +搪瓷tangci +弹弓tangong +倘若tangruo +搪塞tangsai +烫伤tangshang +堂堂tangtang +唐突tangtu +弹劾tanhe +袒护tanhu +谈话tanhua +瘫痪tanhuan +探究tanjiu +坦克tanke +贪婪tanlan +坦率tanlu +谈论tanlun +摊派tanpai +谈判tanpan +叹气tanqi +探亲tanqin +弹琴tanqin +坦然tanran +探索tansuo +探讨tantao +谈天tantian +探听tanting +贪图tantu +谈吐tantu +滩涂tantu +探望tanwang +探问tanwen +贪污tanwu +叹息tanxi +探险tanxian +谈心tanxin +弹性tanxing +探询tanxun +贪赃tanzang +套tao +讨tao +逃tao +陶tao +萄tao +桃tao +掏tao +涛tao +滔tao +绦tao +淘tao +鼗tao +叨*tao +啕tao +洮tao +韬tao +焘tao +饕tao +逃奔taoben +逃避taobi +逃兵taobing +逃窜taocuan +逃遁taodun +讨伐taofa +讨饭taofan +套购taogou +讨好taohao +讨还taohuan +讨价taojia +桃李taoli +韬略taolue +讨论taolun +逃命taoming +逃难taonan +逃跑taopao +淘气taoqi +逃生taosheng +淘汰taotai +滔滔taotao +逃脱taotuo +逃亡taowang +讨厌taoyan +陶冶taoye +桃子taozi +逃走taozou +陶醉taozui +踏青taqing +他人taren +踏实tashi +他说tashuo +他乡taxiang +挑拨离间tblj +台北市tbs +贪便宜tby +统筹兼顾tcjg +铁道部tdb +土地改革tdgg +同等学历tdxl +特te +忒te +忑te +慝*te +铽te +特别tebie +特产techan +特长techang +特出techu +特此teci +特大teda +特等tedeng +特地tedi +特点tedian +特定teding +特级teji +特技teji +特急teji +特将tejiang +特刊tekan +特快tekuai +特例teli +腾teng +疼teng +藤teng +誊teng +滕teng +疼爱tengai +腾达tengda +誊写tengxie +特派tepai +特区tequ +特权tequan +托儿所tes +特色tese +特使teshi +特殊teshu +特为tewei +特务tewu +特效texiao +特写texie +特性texing +特邀teyao +特意teyi +特有teyou +特约teyue +特征tezheng +特制tezhi +特种tezhong +突飞猛进tfmj +铁饭碗tfw +同甘共苦tggk +提货单thd +谈何容易thry +提ti +题ti +体ti +替ti +梯ti +惕ti +剔ti +踢ti +锑ti +蹄ti +啼ti +嚏ti +涕ti +剃ti +屉ti +倜ti +荑*ti +悌ti +逖ti +绨*ti +缇ti +鹈ti +裼ti +醍ti +天tian +田tian +添tian +填tian +甜tian +佃*tian +恬tian +舔tian +腆tian +掭tian +忝tian +阗tian +殄tian +畋tian +填报tianbao +天边tianbian +填表tianbiao +填补tianbu +天才tiancai +天长tianchang +填充tianchong +天地tiandi +田地tiandi +天鹅tiane +天府tianfu +天赋tianfu +天机tianji +天际tianji +添加tianjia +天津tianjin +恬静tianjing +天空tiankong +填空tiankong +天理tianli +天良tianliang +天亮tianliang +甜美tianmei +甜蜜tianmi +天明tianming +天平tianping +天气tianqi +天桥tianqiao +天然tianran +天壤tianrang +天色tianse +天上tianshang +天生tiansheng +天使tianshi +天堂tiantang +天体tianti +天天tiantian +甜头tiantou +天文tianwen +天下tianxia +天险tianxian +天仙tianxian +天性tianxing +天涯tianya +田野tianye +天真tianzhen +天职tianzhi +添置tianzhi +天资tianzi +条tiao +调*tiao +跳tiao +挑tiao +迢tiao +眺tiao +佻tiao +苕*tiao +祧tiao +窕tiao +蜩tiao +笤tiao +粜tiao +龆tiao +鲦tiao +髫tiao +挑拔tiaoba +跳动tiaodong +挑动tiaodong +挑逗tiaodou +跳高tiaogao +调和tiaohe +调剂tiaoji +条件tiaojian +调解tiaojie +调节tiaojie +条款tiaokuan +调理tiaoli +条理tiaoli +条例tiaoli +条令tiaoling +调配tiaopei +挑剔tiaoti +调停tiaoting +条文tiaowen +跳舞tiaowu +调戏tiaoxi +挑衅tiaoxin +挑选tiaoxuan +条约tiaoyue +挑战tiaozhan +调整tiaozheng +条子tiaozi +提拨tibo +题材ticai +体裁ticai +体操ticao +体察ticha +提倡tichang +提成ticheng +提出tichu +剔除tichu +题词tici +替代tidai +梯队tidui +铁tie +贴tie +帖tie +萜tie +餮tie +贴补tiebu +铁道tiedao +贴近tiejin +铁路tielu +贴切tieqie +贴身tieshen +铁证tiezheng +提法tifa +提防tifang +提纲tigang +提高tigao +体格tige +提供tigong +替换tihuan +体会tihui +提货tihuo +体积tiji +提价tijia +体力tili +体例tili +提炼tilian +体谅tiliang +体面timian +提名timing +题名timing +题目timu +听ting +停ting +庭ting +挺ting +廷ting +厅ting +烃ting +汀ting +亭ting +艇ting +莛ting +葶ting +婷ting +梃ting +町*ting +铤ting +蜓ting +霆ting +挺拔tingba +停办tingban +停泊tingbo +停产tingchan +听从tingcong +停顿tingdun +停工tinggong +挺括tinggua +听候tinghou +听话tinghua +停火tinghuo +听见tingjian +厅局tingju +听觉tingjue +停留tingliu +听凭tingping +听取tingqu +听任tingren +听说tingshuo +听信tingxin +厅长tingzhang +停止tingzhi +停职tingzhi +停滞tingzhi +听众tingzhong +提起tiqi +提前tiqian +提取tiqu +提升tisheng +提示tishi +体坛titan +体贴titie +提问tiwen +体温tiwen +体系tixi +体现tixian +体型tixing +提醒tixing +体验tiyan +提要tiyao +提议tiyi +体育tiyu +体制tizhi +体质tizhi +题字tizi +统计表tjb +条件反射tjfs +讨价还价tjhj +天津市tjs +条件下tjx +讨论会tlh +拖拉机tlj +他们的tmd +同盟会tmh +天南地北tndb +同tong +通tong +统tong +铜tong +痛tong +筒tong +童tong +桶tong +侗*tong +恫*tong +桐tong +酮tong +瞳tong +彤tong +捅tong +佟tong +仝tong +垌*tong +茼tong +嗵tong +峒*tong +恸tong +潼tong +砼tong +同伴tongban +同胞tongbao +通报tongbao +同辈tongbei +通病tongbing +同步tongbu +通常tongchang +通称tongcheng +统称tongcheng +痛斥tongchi +统筹tongchou +痛楚tongchu +同窗tongchuang +同道tongdao +通道tongdao +同等tongdeng +通电tongdian +通牒tongdie +通读tongdu +通告tonggao +统购tonggou +通过tongguo +通航tonghang +痛恨tonghen +同化tonghua +通话tonghua +童话tonghua +痛悔tonghui +通婚tonghun +统计tongji +通辑tongji +痛击tongji +同居tongju +痛苦tongku +痛哭tongku +痛快tongkuai +同僚tongliao +通令tongling +同盟tongmeng +同年tongnian +童年tongnian +同期tongqi +通气tongqi +同情tongqing +通融tongrong +同上tongshang +通商tongshang +同时tongshi +同事tongshi +统属tongshu +统帅tongshuai +通顺tongshun +通俗tongsu +通往tongwang +痛恶tongwu +痛惜tongxi +统辖tongxia +通向tongxiang +同乡tongxiang +统销tongxiao +通宵tongxiao +通晓tongxiao +同心tongxin +痛心tongxin +通信tongxin +同行tongxing +通行tongxing +同性tongxing +同学tongxue +通讯tongxun +同样tongyang +统一tongyi +同意tongyi +通用tongyong +通邮tongyou +统战tongzhan +同志tongzhi +统治tongzhi +通知tongzhi +头tou +投tou +透tou +偷tou +钭tou +骰tou +投案touan +头版touban +投奔touben +投标toubiao +投产touchan +透彻touche +头等toudeng +投放toufang +投机touji +投靠toukao +投篮toulan +偷懒toulan +头颅toulu +透露toulu +头面toumian +透明touming +头目toumu +头脑tounao +投票toupiao +透气touqi +投入touru +投身toushen +透视toushi +头痛toutong +偷闲touxian +投降touxiang +头绪touxu +投影touying +投掷touzhi +头子touzi +投资touzi +突破口tpk +太平洋tpy +通情达理tqdl +天气预报tqyb +突然袭击trxj +妥善处理tscl +通俗读物tsdw +挺身而出tsec +图书馆tsg +滔滔不绝ttbj +痛痛快快ttkk +团体赛tts +踏踏实实ttss +图tu +土tu +突tu +途tu +徒tu +凸tu +涂tu +吐tu +兔tu +屠tu +秃tu +堍tu +荼tu +菟tu +钍tu +酴tu +团tuan +湍tuan +抟tuan +彖tuan +疃tuan +图案tuan +湍急tuanji +团结tuanjie +团聚tuanju +湍流tuanliu +团体tuanti +团员tuanyuan +团圆tuanyuan +团长tuanzhang +突变tubian +图表tubiao +土产tuchan +突出tuchu +土地tudi +徒弟tudi +土匪tufei +土改tugai +涂改tugai +图画tuhua +土话tuhua +推tui +退tui +腿tui +颓tui +蜕tui +褪tui +忒*tui +煺tui +蜕变tuibian +退步tuibu +推测tuice +推迟tuichi +推崇tuichong +退出tuichu +推导tuidao +推动tuidong +推断tuiduan +推翻tuifan +颓废tuifei +推广tuiguang +退化tuihua +蜕化tuihua +退回tuihui +推荐tuijian +推进tuijin +推举tuiju +推开tuikai +推理tuili +推论tuilun +推敲tuiqiao +推却tuique +退却tuique +推让tuirang +退让tuirang +颓丧tuisang +退色tuise +推算tuisuan +退缩tuisuo +颓唐tuitang +推托tuituo +退伍tuiwu +推向tuixiang +推销tuixiao +推卸tuixie +推行tuixing +退休tuixiu +退学tuixue +推移tuiyi +退职tuizhi +突击tuji +图解tujie +途径tujing +徒劳tulao +图例tuli +吐露tulu +囤*tun +褪*tun +吞tun +屯tun +臀tun +氽tun +饨tun +暾tun +豚tun +吞并tunbing +吞没tunmo +吞吐tuntu +脱tuo +拖tuo +托tuo +妥tuo +椭tuo +舵*tuo +魄*tuo +鸵tuo +陀tuo +驮tuo +驼tuo +拓tuo +唾tuo +乇tuo +佗tuo +坨tuo +庹tuo +沱tuo +柝tuo +柁*tuo +橐tuo +砣tuo +铊*tuo +箨tuo +酡tuo +跎tuo +鼍tuo +驼背tuobei +拓补tuobu +脱出tuochu +妥当tuodang +脱轨tuogui +拓荒tuohuang +脱节tuojie +拖拉tuola +脱离tuoli +唾骂tuoma +唾弃tuoqi +妥善tuoshan +脱身tuoshen +妥协tuoxie +拖延tuoyan +唾液tuoye +图片tupian +突破tupo +突起tuqi +突然turan +徒然turan +土壤turang +屠杀tusha +徒手tushou +图书tushu +吐痰tutan +突围tuwei +突兀tuwu +图象tuxiang +图像tuxiang +图形tuxing +徒刑tuxing +图章tuzhang +图纸tuzhi +途中tuzhong +土著tuzhu +秃子tuzi +贪污盗窃twdq +台湾省tws +贪污受贿twsh +提心吊胆txdd +通讯社txs +同心同德txtd +同心协力txxl +推心置腹txzf +体育场tyc +体育锻炼tydl +体育馆tyg +腾云驾雾tyjw +太阳能tyn +太原市tys +天衣无缝tywf +通用性tyx +体育运动tyyd +团支部tzb +停滞不前tzbq +同志们tzm +天灾人祸tzrh +听之任之tzrz +通知书tzs +为w +我w +无w +问w +外w +五w +位w +物w +委w +完w +温w +万w +文w +往w +武w +务w +王w +围w +误w +晚w +瓦wa +挖wa +凹*wa +哇wa +蛙wa +洼wa +娃wa +袜wa +佤wa +娲wa +腽wa +外wai +歪wai +外币waibi +外边waibian +外表waibiao +外宾waibin +外部waibu +外传waichuan +外存waicun +外地waidi +外调waidiao +歪风waifeng +外观waiguan +外国waiguo +外行waihang +外汇waihui +外加waijia +外交waijiao +外界waijie +外景waijing +外科waike +外快waikuai +外流wailiu +外貌waimao +外贸waimao +外面waimian +外勤waiqin +歪曲waiqu +外商waishang +外伤waishang +外设waishe +外省waisheng +外甥waisheng +外事waishi +外围waiwei +外文waiwen +外线waixian +外销waixiao +歪斜waixie +外延waiyan +外因waiyin +外语waiyu +外援waiyuan +外在waizai +外债waizhai +外资waizi +瓦解wajie +挖掘wajue +挖苦waku +瓦砾wali +完wan +万wan +晚wan +弯wan +碗wan +顽wan +湾wan +挽wan +玩wan +蔓*wan +娩*wan +豌wan +丸wan +烷wan +皖wan +惋wan +宛wan +婉wan +腕wan +剜wan +芄wan +莞*wan +菀wan +纨wan +绾wan +琬wan +脘wan +畹wan +蜿wan +万般wanban +晚报wanbao +完备wanbei +完毕wanbi +完成wancheng +万代wandai +顽敌wandi +万吨wandun +万恶wane +万分wanfen +往wang +王wang +望wang +网wang +忘wang +妄wang +亡wang +旺wang +芒*wang +汪wang +枉wang +罔wang +尢wang +惘wang +辋wang +魍wang +往常wangchang +王朝wangchao +忘掉wangdiao +妄动wangdong +枉法wangfa +往返wangfan +枉费wangfei +往复wangfu +王国wangguo +亡国wangguo +往后wanghou +忘怀wanghuai +忘记wangji +旺季wangji +往来wanglai +网络wangluo +亡命wangming +往年wangnian +完工wangong +忘却wangque +枉然wangran +惘然wangran +往日wangri +旺盛wangsheng +往事wangshi +妄图wangtu +万古wangu +顽固wangu +往往wangwang +汪汪wangwang +忘我wangwo +往昔wangxi +妄想wangxiang +汪洋wangyang +望远wangyuan +王子wangzi +完好wanhao +晚会wanhui +挽回wanhui +晚婚wanhun +晚间wanjian +完结wanjie +挽救wanjiu +玩具wanju +顽抗wankang +完了wanle +挽力wanli +弯路wanlu +完美wanmei +万能wanneng +万年wannian +晚年wannian +玩弄wannong +晚期wanqi +顽强wanqiang +弯曲wanqu +完全wanquan +完善wanshan +晚上wanshang +玩赏wanshang +万事wanshi +万世wanshi +玩耍wanshua +万岁wansui +万万wanwan +万物wanwu +晚霞wanxia +万象wanxiang +玩笑wanxiao +万幸wanxing +婉言wanyan +万一wanyi +万元wanyuan +完整wanzheng +顽症wanzheng +万众wanzhong +宛转wanzhuan +瓦斯wasi +瓦特wate +娃娃wawa +外部设备wbsb +微不足道wbzd +无产阶级wcjj +微处理机wclj +无产者wcz +为wei +位wei +委wei +围wei +维wei +唯wei +卫wei +微wei +伟wei +未wei +威wei +危wei +尾wei +谓wei +喂wei +味wei +胃wei +魏wei +伪wei +遗*wei +违wei +韦wei +畏wei +纬wei +巍wei +桅wei +惟wei +潍wei +苇wei +萎wei +蔚wei +渭wei +尉wei +慰wei +偎wei +诿wei +隈wei +隗*wei +圩*wei +葳wei +薇wei +囗wei +帏wei +帷wei +崴wei +嵬wei +猥wei +猬wei +闱wei +沩wei +洧wei +涠wei +逶wei +娓wei +玮wei +韪wei +軎wei +炜wei +煨wei +痿wei +艉wei +鲔wei +尾巴weiba +违背weibei +未必weibi +威逼weibi +微波weibo +微薄weibo +未曾weiceng +未尝weichang +维持weichi +为此weici +伟大weida +味道weidao +纬度weidu +唯独weidu +巍峨weie +违法weifa +违反weifan +违犯weifan +威风weifeng +桅杆weigan +微观weiguan +危害weihai +为何weihe +维护weihu +危及weiji +微机weiji +危机weiji +危急weiji +围歼weijian +围剿weijiao +慰藉weijie +违禁weijin +未经weijing +畏惧weiju +违抗weikang +未可weike +唯恐weikong +惟恐weikong +胃口weikou +未来weilai +慰劳weilao +为了weile +威力weili +委靡weimi +未免weimian +微妙weimiao +帷幕weimu +危难weinan +畏难weinan +未能weineng +委派weipai +为期weiqi +畏怯weiqie +委曲weiqu +委屈weiqu +未然weiran +巍然weiran +围绕weirao +伟人weiren +委任weiren +微弱weiruo +威慑weishe +为生weisheng +卫生weisheng +尾声weisheng +卫士weishi +威势weishi +为首weishou +为数weishu +尾随weisui +未遂weisui +畏缩weisuo +萎缩weisuo +猥琐weisuo +委托weituo +委婉weiwan +危亡weiwang +巍巍weiwei +慰问weiwen +唯物weiwu +威武weiwu +微细weixi +威吓weixia +危险weixian +微小weixiao +微笑weixiao +威协weixie +威胁weixie +猥亵weixie +维新weixin +唯心weixin +违心weixin +威信weixin +微型weixing +卫星weixing +维修weixiu +威严weiyan +伟业weiye +唯一weiyi +位移weiyi +位于weiyu +谓语weiyu +委员weiyuan +为止weizhi +位置weizhi +未知weizhi +为重weizhong +为主weizhu +伪装weizhuang +问wen +温wen +文wen +稳wen +纹wen +闻wen +蚊wen +瘟wen +吻wen +紊wen +刎wen +阌wen +汶wen +璺wen +雯wen +文本wenben +瘟病wenbing +稳步wenbu +问答wenda +稳定wending +温度wendu +嗡weng +翁weng +瓮weng +蓊weng +蕹weng +稳固wengu +问好wenhao +温和wenhe +吻合wenhe +文化wenhua +文件wenjian +稳健wenjian +问津wenjin +文静wenjing +文具wenju +文科wenke +文盲wenmang +文明wenming +闻名wenming +温暖wennuan +文凭wenping +文人wenren +温柔wenrou +问世wenshi +文坛wentan +问题wenti +文体wenti +稳妥wentuo +文物wenwu +文献wenxian +文选wenxuan +文学wenxue +问讯wenxun +闻讯wenxun +文艺wenyi +瘟疫wenyi +文娱wenyu +文摘wenzhai +文章wenzhang +稳重wenzhong +文字wenzi +问罪wenzui +望而生畏wesw +闻风而动wfed +违法乱纪wflj +歪风邪气wfxq +温故知新wgzx +文化部whb +文汇报whb +文化馆whg +文化宫whg +武汉市whs +五湖四海whsh +忘乎所以whsy +问寒问暖whwn +文化娱乐whyl +玩忽职守whzs +外交部wjb +无纪律wjl +五讲四美wjsm +无拘无束wjws +无可奉告wkfg +无可非议wkfy +无可奈何wknh +乌鲁木齐wlmq +无理取闹wlqn +无论如何wlrh +物美价廉wmjl +误码率wml +文明礼貌wmlm +无名英雄wmyx +无能为力wnwl +我wo +握wo +窝wo +蜗wo +涡wo +沃wo +挝wo +卧wo +斡wo +倭wo +莴wo +喔wo +幄wo +渥wo +肟wo +硪wo +龌wo +窝藏wocang +卧床wochuang +我党wodang +卧倒wodao +我的wode +窝工wogong +我国woguo +我军wojun +我们women +窝囊wonang +我省wosheng +我校woxiao +为期不远wqby +无穷无尽wqwj +误入歧途wrqt +卫生部wsb +纹丝不动wsbd +万事大吉wsdj +万事俱备wsjb +为什么wsm +无所谓wsw +为所欲为wsyw +无所作为wszw +无wu +五wu +物wu +武wu +务wu +误wu +伍wu +舞wu +污wu +悟wu +雾wu +午wu +恶*wu +屋wu +乌wu +吴wu +亡*wu +诬wu +钨wu +巫wu +呜wu +芜wu +梧wu +吾wu +毋wu +捂wu +侮wu +坞wu +戊wu +晤wu +勿wu +兀wu +仵wu +阢wu +邬wu +圬wu +芴wu +唔wu +庑wu +怃wu +忤wu +浯wu +寤wu +迕wu +妩wu +婺wu +骛wu +杌wu +牾wu +於*wu +焐wu +鹉wu +鹜wu +痦wu +蜈wu +鋈wu +鼯wu +吾辈wubei +无比wubi +五笔wubi +务必wubi +舞弊wubi +无边wubian +无不wubu +五彩wucai +误差wucha +无常wuchang +无偿wuchang +舞场wuchang +武昌wuchang +无耻wuchi +无从wucong +武打wuda +舞蹈wudao +无敌wudi +舞动wudong +武斗wudou +武断wuduan +无法wufa +无妨wufang +无非wufei +武功wugong +污垢wugou +无故wugu +无关wuguan +五官wuguan +武官wuguan +无害wuhai +诬害wuhai +武汉wuhan +无何wuhe +乌黑wuhei +五湖wuhu +呜呼wuhu +误会wuhui +舞会wuhui +污秽wuhui +无及wuji +无机wuji +物价wujia +无间wujian +物件wujian +误解wujie +五届wujie +五金wujin +无愧wukui +无赖wulai +诬赖wulai +无理wuli +物理wuli +无礼wuli +物力wuli +武力wuli +无聊wuliao +无虑wulu +无论wulun +污蔑wumie +诬蔑wumie +无奈wunai +无能wuneng +毋宁wuning +务农wunong +物品wupin +无期wuqi +五七wuqi +武器wuqi +无情wuqing +无穷wuqiong +舞曲wuqu +无权wuquan +污染wuran +无任wuren +污辱wuru +侮辱wuru +物色wuse +无上wushang +误伤wushang +无声wusheng +午时wushi +务使wushi +无视wushi +误事wushi +务实wushi +无数wushu +武术wushu +无双wushuang +午睡wushui +五四wusi +无私wusi +舞台wutai +无题wuti +物体wuti +舞厅wuting +无为wuwei +无谓wuwei +无物wuwu +无暇wuxia +无限wuxian +诬陷wuxian +无效wuxiao +五星wuxing +午休wuxiu +无须wuxu +无需wuxu +务虚wuxu +午夜wuye +五一wuyi +无益wuyi +无疑wuyi +无垠wuyin +无用wuyong +毋庸wuyong +无余wuyu +无缘wuyuan +五月wuyue +物证wuzheng +无知wuzhi +物质wuzhi +武装wuzhuang +物资wuzi +兀自wuzi +误字wuzi +无罪wuzui +无微不至wwbz +唯物论wwl +卧薪尝胆wxcd +无线电wxd +微型机wxj +唯心论wxl +问心无愧wxwk +委员会wyh +无缘无故wywg +委员长wyz +误字率wzl +无足轻重wzqz +未知数wzs +完整无缺wzwq +学x +下x +行x +小x +线x +性x +新x +些x +想x +心x +向x +相x +系x +席x +现x +西x +修x +象x +先x +形x +心安理得xald +西安市xas +西半球xbq +相比之下xbzx +宣传部xcb +新陈代谢xcdx +新产品xcp +畜产品xcp +西城区xcq +喜出望外xcww +相对而言xdey +现代化xdh +想当然xdr +相对误差xdwc +先睹为快xdwk +形而上学xesx +显而易见xeyj +西方国家xfgj +消费品xfp +想方设法xfsf +先发制人xfzr +兴高采烈xgcl +新华社xhs +新华书店xhsd +系xi +席xi +西xi +习xi +细xi +吸xi +析xi +喜xi +洗xi +铣xi +稀xi +戏xi +隙xi +希xi +息xi +袭xi +锡xi +烯xi +牺xi +悉xi +惜xi +溪xi +腊*xi +栖*xi +昔xi +熙xi +硒xi +矽xi +晰xi +嘻xi +膝xi +夕xi +熄xi +汐xi +犀xi +檄xi +媳xi +僖xi +兮xi +隰xi +郗xi +茜*xi +菥xi +葸xi +蓰xi +奚xi +唏xi +徙xi +饩xi +阋xi +浠xi +淅xi +屣xi +嬉xi +玺xi +樨xi +曦xi +觋xi +欷xi +歙*xi +熹xi +禊xi +禧xi +皙xi +穸xi +裼*xi +蜥xi +螅xi +蟋xi +舄xi +舾xi +羲xi +粞xi +翕xi +醯xi +蹊*xi +鼷xi +下xia +夏xia +吓xia +狭xia +霞xia +唬*xia +瞎xia +虾xia +匣xia +辖xia +暇xia +峡xia +侠xia +厦xia +呷xia +狎xia +遐xia +瑕xia +柙xia +硖xia +瘕*xia +罅xia +黠xia +狭隘xiaai +下班xiaban +下辈xiabei +下边xiabian +下策xiace +下层xiaceng +下场xiachang +下沉xiachen +下次xiaci +瑕疵xiaci +下达xiada +吓倒xiadao +下等xiadeng +下毒xiadu +下发xiafa +下放xiafang +峡谷xiagu +霞光xiaguang +瞎话xiahua +喜爱xiai +下级xiaji +下集xiaji +夏季xiaji +下降xiajiang +侠客xiake +下来xialai +下联xialian +夏粮xialiang +下列xialie +下令xialing +下流xialiu +下落xialuo +下马xiama +厦门xiamen +下面xiamian +线xian +现xian +先xian +县xian +限xian +见*xian +显xian +鲜xian +献xian +险xian +陷xian +宪xian +纤xian +洗*xian +掀xian +弦xian +铣*xian +腺xian +锨xian +仙xian +咸xian +贤xian +衔xian +舷xian +闲xian +涎xian +嫌xian +馅xian +羡xian +冼xian +苋xian +莶xian +藓xian +岘xian +猃xian +暹xian +娴xian +氙xian +燹xian +祆xian +鹇xian +痫xian +蚬xian +筅xian +籼xian +酰xian +跣xian +跹xian +霰xian +西安xian +献宝xianbao +先辈xianbei +现场xianchang +现成xiancheng +县城xiancheng +献丑xianchou +献词xianci +现存xiancun +现代xiandai +先导xiandao +显得xiande +险地xiandi +限定xianding +限度xiandu +线段xianduan +限额xiane +险恶xiane +宪法xianfa +先锋xianfeng +险峰xianfeng +想xiang +向xiang +相xiang +象xiang +响xiang +项xiang +箱xiang +乡xiang +降*xiang +香xiang +像xiang +详xiang +橡xiang +享xiang +湘xiang +厢xiang +镶xiang +襄xiang +翔xiang +祥xiang +巷xiang +芗xiang +葙xiang +饷xiang +庠xiang +骧xiang +缃xiang +蟓xiang +鲞xiang +飨xiang +相爱xiangai +相比xiangbi +想必xiangbi +相差xiangcha +相称xiangcheng +相处xiangchu +相传xiangchuan +乡村xiangcun +相当xiangdang +向导xiangdao +相等xiangdeng +相对xiangdui +想法xiangfa +相反xiangfan +相仿xiangfang +相干xianggan +香港xianggang +相隔xiangge +相关xiangguan +相好xianghao +相互xianghu +相继xiangji +相加xiangjia +相见xiangjian +相减xiangjian +相交xiangjiao +橡胶xiangjiao +相近xiangjin +详尽xiangjin +巷口xiangkou +向来xianglai +相连xianglian +向量xiangliang +响亮xiangliang +相貌xiangmao +项目xiangmu +想念xiangnian +相片xiangpian +想起xiangqi +详情xiangqing +向上xiangshang +相声xiangsheng +响声xiangsheng +相识xiangshi +翔实xiangshi +享受xiangshou +相思xiangsi +相似xiangsi +香甜xiangtian +相同xiangtong +相投xiangtou +显贵xiangui +向往xiangwang +详细xiangxi +向下xiangxia +乡下xiangxia +象限xiangxian +想象xiangxiang +相信xiangxin +香烟xiangyan +相依xiangyi +相宜xiangyi +相应xiangying +相映xiangying +响应xiangying +享用xiangyong +相遇xiangyu +相约xiangyue +乡镇xiangzhen +象征xiangzheng +箱子xiangzi +陷害xianhai +显赫xianhe +鲜红xianhong +先后xianhou +鲜花xianhua +献花xianhua +闲话xianhua +贤惠xianhui +献计xianji +献技xianji +显见xianjian +衔接xianjie +先进xianjin +现金xianjin +险境xianjing +陷阱xianjing +现款xiankuan +现况xiankuang +先例xianli +献礼xianli +先烈xianlie +线路xianlu +显露xianlu +鲜美xianmei +鲜明xianming +贤明xianming +显目xianmu +羡慕xianmu +贤能xianneng +先期xianqi +掀起xianqi +限期xianqi +嫌弃xianqi +先前xianqian +先遣xianqian +险情xianqing +先驱xianqu +显然xianran +贤人xianren +闲人xianren +现任xianren +陷入xianru +闲散xiansan +献身xianshen +先生xiansheng +先是xianshi +现实xianshi +显示xianshi +娴熟xianshu +线索xiansuo +闲谈xiantan +险滩xiantan +先天xiantian +线条xiantiao +县委xianwei +纤维xianwei +显现xianxian +现象xianxiang +现行xianxing +鲜血xianxue +显眼xianyan +鲜艳xianyan +显要xianyao +险要xianyao +显耀xianyao +现役xianyi +嫌疑xianyi +现有xianyou +限于xianyu +闲杂xianza +现在xianzai +县长xianzhang +宪章xianzhang +限制xianzhi +先知xianzhi +闲置xianzhi +闲职xianzhi +显著xianzhu +现状xianzhuang +险阻xianzu +小xiao +消xiao +削xiao +效xiao +笑xiao +校xiao +销xiao +硝xiao +萧xiao +肖xiao +孝xiao +霄xiao +哮xiao +嚣xiao +宵xiao +淆xiao +晓xiao +啸xiao +哓xiao +崤xiao +潇xiao +逍xiao +骁xiao +绡xiao +枭xiao +枵xiao +蛸*xiao +筱xiao +箫xiao +魈xiao +小报xiaobao +小辈xiaobei +笑柄xiaobing +消沉xiaochen +消除xiaochu +消毒xiaodu +效法xiaofa +小贩xiaofan +消防xiaofang +消费xiaofei +校风xiaofeng +小鬼xiaogui +效果xiaoguo +小孩xiaohai +消耗xiaohao +消化xiaohua +笑话xiaohua +小惠xiaohui +销毁xiaohui +销魂xiaohun +消极xiaoji +削减xiaojian +小结xiaojie +小姐xiaojie +孝敬xiaojing +校刊xiaokan +小康xiaokang +效劳xiaolao +效力xiaoli +销路xiaolu +效率xiaolu +消灭xiaomie +消磨xiaomo +效能xiaoneng +消气xiaoqi +消遣xiaoqian +笑容xiaorong +削弱xiaoruo +潇洒xiaosa +校舍xiaoshe +小时xiaoshi +消失xiaoshi +消逝xiaoshi +消瘦xiaoshou +销售xiaoshou +小数xiaoshu +小说xiaoshuo +萧条xiaotiao +消息xiaoxi +肖像xiaoxiang +小心xiaoxin +枭雄xiaoxiong +小学xiaoxue +效验xiaoyan +逍遥xiaoyao +效益xiaoyi +效应xiaoying +校友xiaoyou +小于xiaoyu +校园xiaoyuan +销赃xiaozang +校长xiaozhang +嚣张xiaozhang +效忠xiaozhong +小组xiaozu +下情xiaqing +下去xiaqu +辖区xiaqu +下手xiashou +夏收xiashou +下属xiashu +下水xiashui +下台xiatai +夏天xiatian +下文xiawen +下午xiawu +下限xiaxian +下乡xiaxiang +遐想xiaxiang +狭义xiayi +下游xiayou +狭窄xiazhai +夏至xiazhi +夏种xiazhong +喜报xibao +细胞xibao +西北xibei +西边xibian +稀薄xibo +锡箔xibo +西餐xican +洗涤xidi +吸毒xidu +些xie +解*xie +写xie +斜xie +谢xie +协xie +械xie +叶*xie +血*xie +卸xie +屑xie +鞋xie +歇xie +邪xie +胁xie +蟹xie +泄xie +泻xie +契*xie +楔xie +蝎xie +挟xie +携xie +谐xie +懈xie +偕xie +亵xie +勰xie +燮xie +薤xie +撷xie +獬xie +廨xie +渫xie +瀣xie +邂xie +绁xie +缬xie +榭xie +榍xie +颉*xie +躞xie +写出xiechu +协从xiecong +携带xiedai +邪道xiedao +协调xiediao +协定xieding +亵渎xiedu +邪恶xiee +协和xiehe +谐和xiehe +协会xiehui +谢绝xiejue +协力xieli +泄漏xielou +邪路xielu +泄露xielu +泄密xiemi +邪念xienian +胁迫xiepo +邪气xieqi +协商xieshang +写生xiesheng +携手xieshou +邪说xieshuo +协同xietong +歇息xiexi +谢谢xiexie +协议xieyi +谐音xieyin +协约xieyue +写照xiezhao +协助xiezhu +鞋子xiezi +写作xiezuo +协作xiezuo +西方xifang +西风xifeng +西服xifu +吸附xifu +媳妇xifu +习惯xiguan +西汉xihan +稀罕xihan +希罕xihan +喜欢xihuan +袭击xiji +细节xijie +洗劫xijie +喜剧xiju +戏剧xiju +席卷xijuan +细菌xijun +犀利xili +系列xilie +奚落xiluo +熄灭ximie +新xin +心xin +信xin +锌xin +芯xin +辛xin +寻*xin +欣xin +薪xin +忻xin +衅xin +囟xin +馨xin +昕xin +歆xin +镡*xin +鑫xin +心爱xinai +西南xinan +新春xinchun +信贷xindai +心得xinde +心烦xinfan +心服xinfu +信服xinfu +行xing +性xing +形xing +型xing +星xing +兴xing +省*xing +醒xing +姓xing +幸xing +腥xing +猩xing +惺xing +刑xing +邢xing +杏xing +陉xing +荇xing +荥xing +擤xing +饧xing +悻xing +硎xing +心甘xingan +兴办xingban +性别xingbie +姓别xingbie +刑场xingchang +星辰xingchen +形成xingcheng +行程xingcheng +行动xingdong +幸而xinger +刑法xingfa +刑罚xingfa +兴奋xingfen +幸福xingfu +性格xingge +幸好xinghao +型号xinghao +行贿xinghui +星火xinghuo +性急xingji +形迹xingji +兴建xingjian +行径xingjing +行军xingjun +星空xingkong +幸亏xingkui +行李xingli +行旅xinglu +幸免xingmian +性命xingming +姓名xingming +醒目xingmu +性能xingneng +行期xingqi +兴起xingqi +星期xingqi +性情xingqing +星球xingqiu +兴趣xingqu +形容xingrong +行商xingshang +兴盛xingsheng +行使xingshi +行事xingshi +行驶xingshi +形式xingshi +幸事xingshi +刑事xingshi +形势xingshi +姓氏xingshi +行署xingshu +兴衰xingshuai +形态xingtai +形体xingti +兴亡xingwang +兴旺xingwang +行为xingwei +行文xingwen +醒悟xingwu +形象xingxiang +行销xingxiao +星星xingxing +行凶xingxiong +兴修xingxiu +行业xingye +星夜xingye +幸运xingyun +行政xingzheng +性质xingzhi +兴致xingzhi +形状xingzhuang +行走xingzou +信号xinhao +心狠xinhen +心慌xinhuang +信汇xinhui +细腻xini +西宁xining +心急xinji +信件xinjian +新疆xinjiang +新近xinjin +新居xinju +心坎xinkan +辛苦xinku +信赖xinlai +辛劳xinlao +心理xinli +心里xinli +心灵xinling +心目xinmu +信念xinnian +戏弄xinong +新奇xinqi +辛勤xinqin +心情xinqing +新区xinqu +新人xinren +信任xinren +欣赏xinshang +新生xinsheng +心声xinsheng +新事xinshi +新式xinshi +新书xinshu +薪水xinshui +心酸xinsuan +辛酸xinsuan +心疼xinteng +心田xintian +心跳xintiao +心头xintou +欣慰xinwei +新闻xinwen +心细xinxi +信息xinxi +欣喜xinxi +新鲜xinxian +心想xinxiang +信箱xinxiang +馨香xinxiang +信心xinxin +新型xinxing +新星xinxing +新兴xinxing +心虚xinxu +心血xinxue +信仰xinyang +心意xinyi +新异xinyi +新颖xinying +信用xinyong +新余xinyu +信誉xinyu +心愿xinyuan +心脏xinzang +新址xinzhi +心中xinzhong +雄xiong +胸xiong +兄xiong +凶xiong +熊xiong +匈xiong +汹xiong +芎xiong +雄辩xiongbian +雄兵xiongbing +凶残xiongcan +兄弟xiongdi +凶恶xionge +雄关xiongguan +凶狠xionghen +雄厚xionghou +胸怀xionghuai +雄健xiongjian +胸口xiongkou +熊猫xiongmao +凶猛xiongmeng +匈奴xiongnu +凶器xiongqi +凶杀xiongsha +雄师xiongshi +凶手xiongshou +胸膛xiongtang +雄伟xiongwei +雄心xiongxin +汹涌xiongyong +雄壮xiongzhuang +雄姿xiongzi +西欧xiou +习气xiqi +吸气xiqi +喜气xiqi +稀奇xiqi +希奇xiqi +喜庆xiqing +吸取xiqu +戏曲xiqu +昔日xiri +牺牲xisheng +西式xishi +喜事xishi +稀释xishi +吸收xishou +系数xishu +洗刷xishua +吸吮xishun +习俗xisu +习题xiti +西天xitian +系统xitong +修xiu +锈xiu +休xiu +袖xiu +秀xiu +朽xiu +宿*xiu +臭*xiu +羞xiu +嗅xiu +绣xiu +咻xiu +岫xiu +馐xiu +庥xiu +溴xiu +鸺xiu +貅xiu +髹xiu +修补xiubu +秀才xiucai +羞耻xiuchi +修辞xiuci +修订xiuding +修复xiufu +修改xiugai +修建xiujian +修剪xiujian +嗅觉xiujue +休克xiuke +羞愧xiukui +修理xiuli +秀丽xiuli +秀气xiuqi +羞辱xiuru +羞涩xiuse +修饰xiushi +休息xiuxi +休想xiuxiang +修养xiuyang +休养xiuyang +修造xiuzao +袖章xiuzhang +袖珍xiuzhen +修正xiuzheng +修筑xiuzhu +希望xiwang +席位xiwei +细微xiwei +西文xiwen +檄文xiwen +细小xixiao +细心xixin +悉心xixin +喜讯xixun +吸烟xiyan +西洋xiyang +西医xiyi +吸引xiyin +希有xiyou +戏院xiyuan +喜悦xiyue +西藏xizang +洗澡xizao +细则xize +细致xizhi +习作xizuo +下基层xjc +现阶段xjd +新技术xjs +献计献策xjxc +先见之明xjzm +兴利除弊xlcb +系列化xlh +稀里糊涂xlht +狭路相逢xlxf +畜牧业xmy +心满意足xmyz +西宁市xns +小朋友xpy +向前看xqk +喜气洋洋xqyy +先人后己xrhj +兴师动众xsdz +销售额xse +刑事犯罪xsfz +小时候xsh +新时期xsq +新生事物xssw +形式主义xszy +相提并论xtbl +续xu +许xu +须xu +需xu +序xu +虚xu +絮xu +畜xu +叙xu +蓄xu +绪xu +徐xu +墟xu +戌xu +嘘xu +酗xu +旭xu +恤xu +婿xu +吁*xu +诩xu +勖xu +圩xu +蓿xu +洫xu +浒*xu +溆xu +顼xu +栩xu +煦xu +砉*xu +盱xu +胥xu +糈xu +醑xu +选xuan +旋xuan +宣xuan +悬xuan +玄xuan +券*xuan +轩xuan +喧xuan +癣xuan +眩xuan +绚xuan +儇xuan +谖xuan +萱xuan +揎xuan +泫xuan +渲xuan +漩xuan +璇xuan +楦xuan +暄xuan +炫xuan +煊xuan +碹xuan +铉xuan +镟xuan +痃xuan +悬案xuanan +轩昂xuanang +选拔xuanba +宣布xuanbu +选材xuancai +选场xuanchang +宣称xuancheng +宣传xuanchuan +选定xuanding +宣读xuandu +宣告xuangao +选购xuangou +悬挂xuangua +玄乎xuanhu +喧哗xuanhua +选集xuanji +宣讲xuanjiang +选举xuanju +绚烂xuanlan +绚丽xuanli +选录xuanlu +旋律xuanlu +选民xuanmin +喧闹xuannao +悬念xuannian +选派xuanpai +宣判xuanpan +选配xuanpei +选票xuanpiao +选区xuanqu +选取xuanqu +喧嚷xuanrang +宣誓xuanshi +选手xuanshou +悬殊xuanshu +旋涡xuanwo +玄虚xuanxu +悬崖xuanya +宣言xuanyan +宣扬xuanyang +炫耀xuanyao +选用xuanyong +选择xuanze +宣战xuanzhan +选种xuanzhong +旋转xuanzhuan +许多xuduo +学xue +血xue +削*xue +雪xue +穴xue +靴xue +薛xue +谑xue +噱*xue +泶xue +踅xue +鳕xue +学报xuebao +学部xuebu +学潮xuechao +学费xuefei +学风xuefeng +学府xuefu +血汗xuehan +学好xuehao +学会xuehui +学籍xueji +血迹xueji +学科xueke +血泪xuelei +学历xueli +学龄xueling +学年xuenian +学派xuepai +学期xueqi +血肉xuerou +学生xuesheng +学时xueshi +学识xueshi +学士xueshi +学术xueshu +血书xueshu +学说xueshuo +血统xuetong +学徒xuetu +学位xuewei +学问xuewen +学习xuexi +血洗xuexi +学校xuexiao +血压xueya +学业xueye +血液xueye +学友xueyou +学员xueyuan +学院xueyuan +血晕xueyun +血战xuezhan +学者xuezhe +学制xuezhi +虚构xugou +序号xuhao +蓄积xuji +虚假xujia +叙旧xujiu +许可xuke +序列xulie +绪论xulun +虚名xuming +序幕xumu +畜牧xumu +训xun +旬xun +迅xun +讯xun +寻xun +循xun +巡xun +荤*xun +浚*xun +勋xun +熏xun +询xun +驯xun +殉xun +汛xun +逊xun +巽xun +郇*xun +埙xun +荀xun +蕈xun +薰xun +峋xun +徇xun +獯xun +恂xun +洵xun +浔xun +曛xun +窨*xun +醺xun +鲟xun +巡捕xunbu +巡查xuncha +寻常xunchang +驯服xunfu +殉国xunguo +巡航xunhang +循环xunhuan +巡回xunhui +虚拟xuni +寻机xunji +巡警xunjing +勋爵xunjue +训练xunlian +巡逻xunluo +迅猛xunmeng +寻求xunqiu +逊色xunse +巡视xunshi +徇私xunsi +迅速xunsu +熏陶xuntao +许诺xunuo +讯问xunwen +询问xunwen +寻衅xunxin +循序xunxu +勋章xunzhang +寻找xunzhao +殉职xunzhi +寻址xunzhi +需求xuqiu +序曲xuqu +虚荣xurong +虚弱xuruo +虚设xushe +叙事xushi +虚实xushi +序数xushu +虚数xushu +叙述xushu +叙说xushuo +虚伪xuwei +虚心xuxin +序言xuyan +需要xuyao +须臾xuyu +许愿xuyuan +须知xuzhi +宣武区xwq +信息处理xxcl +循序见进xxjj +辛辛苦苦xxkk +信息量xxl +熙熙攘攘xxrr +小学生xxs +欣欣向荣xxxr +小心翼翼xxyy +下一步xyb +胸有成竹xycz +洗衣机xyj +小意思xys +习以为常xywc +新颖性xyx +兴致勃勃xzbb +新中国xzg +行政区域xzqy +雪中送炭xzst +心中无数xzws +选择性xzx +心中有数xzys +行之有效xzyx +一y +有y +用y +要y +以y +于y +也y +样y +义y +与y +由y +压y +员y +月y +意y +又y +运y +原y +油y +验y +压ya +亚ya +呀ya +牙ya +芽ya +雅ya +蚜ya +鸭ya +匹*ya +押ya +鸦ya +丫ya +崖ya +衙ya +涯ya +哑ya +讶ya +伢ya +垭ya +揠ya +岈ya +迓ya +娅ya +琊ya +桠ya +氩ya +砑ya +睚ya +痖ya +哑巴yaba +牙齿yachi +压倒yadao +压服yafu +牙关yaguan +雅观yaguan +压价yajia +押金yajin +亚军yajun +压力yali +验yan +研yan +严yan +眼yan +言yan +盐yan +演yan +岩yan +沿yan +烟yan +延yan +掩yan +宴yan +炎yan +颜yan +燕yan +衍yan +铅*yan +焉yan +咽yan +阉yan +淹yan +蜒yan +阎yan +奄yan +艳yan +堰yan +厌yan +砚yan +雁yan +唁yan +彦yan +焰yan +谚yan +殷*yan +厣yan +赝yan +剡*yan +俨yan +偃yan +兖yan +谳yan +阽*yan +郾yan +鄢yan +芫*yan +菸yan +崦yan +恹yan +闫yan +阏yan +湮yan +滟yan +妍yan +嫣yan +琰yan +檐yan +晏yan +胭yan +腌*yan +焱yan +罨yan +筵yan +酽yan +魇yan +餍yan +鼹yan +沿岸yanan +严办yanban +掩蔽yanbi +演变yanbian +烟草yancao +延长yanchang +演唱yanchang +严惩yancheng +延迟yanchi +演出yanchu +唁电yandian +严冬yandong +厌恶yane +厌烦yanfan +样yang +养yang +氧yang +扬yang +洋yang +阳yang +羊yang +秧yang +央yang +杨yang +仰yang +殃yang +鸯yang +佯yang +疡yang +痒yang +漾yang +徉yang +怏yang +泱yang +炀yang +烊yang +恙yang +蛘yang +鞅yang +掩盖yangai +样板yangban +样本yangben +洋财yangcai +养成yangcheng +沿革yange +严格yange +阳光yangguang +洋行yanghang +养护yanghu +氧化yanghua +养料yangliao +杨柳yangliu +仰面yangmian +殃民yangmin +仰慕yangmu +样品yangpin +洋气yangqi +扬弃yangqi +央求yangqiu +养伤yangshang +样式yangshi +阳台yangtai +眼光yanguang +仰望yangwang +洋务yangwu +洋相yangxiang +扬言yangyan +样样yangyang +洋溢yangyi +养育yangyu +养殖yangzhi +样子yangzi +沿海yanhai +严寒yanhan +眼红yanhong +咽喉yanhou +掩护yanhu +眼花yanhua +延缓yanhuan +宴会yanhui +焰火yanhuo +演讲yanjiang +眼界yanjie +严禁yanjin +严谨yanjin +眼镜yanjing +眼睛yanjing +研究yanjiu +严峻yanjun +眼看yankan +严酷yanku +眼眶yankuang +眼泪yanlei +眼力yanli +严厉yanli +艳丽yanli +眼帘yanlian +眼亮yanliang +言路yanlu +沿路yanlu +言论yanlun +掩埋yanmai +严密yanmi +严明yanming +烟幕yanmu +延年yannian +延期yanqi +眼前yanqian +宴请yanqing +俨然yanran +炎热yanre +眼色yanse +颜色yanse +延伸yanshen +岩石yanshi +演示yanshi +掩饰yanshi +验收yanshou +严守yanshou +延寿yanshou +演说yanshuo +严肃yansu +演算yansuan +言谈yantan +研讨yantao +沿途yantu +阎王yanwang +延误yanwu +烟雾yanwu +宴席yanxi +筵席yanxi +演习yanxi +沿袭yanxi +眼下yanxia +沿线yanxian +言行yanxing +严刑yanxing +延续yanxu +艳阳yanyang +演义yanyi +演绎yanyi +掩映yanying +沿用yanyong +言语yanyu +演员yanyuan +厌战yanzhan +沿着yanzhe +验证yanzheng +研制yanzhi +严重yanzhong +演奏yanzou +要yao +药yao +约*yao +摇yao +腰yao +咬yao +邀yao +耀yao +陶*yao +侥*yao +疟yao +妖yao +瑶yao +尧yao +遥yao +窑yao +谣yao +姚yao +舀yao +钥*yao +夭yao +爻yao +吆yao +崾yao +徭yao +幺yao +珧yao +杳yao +轺yao +曜yao +肴yao +铫*yao +鹞yao +窈yao +繇yao +鳐yao +摇摆yaobai +腰包yaobao +要不yaobu +谣传yaochuan +要得yaode +要点yaodian +摇动yaodong +窑洞yaodong +遥感yaogan +妖怪yaoguai +要害yaohai +摇撼yaohan +摇晃yaohuang +要件yaojian +要紧yaojin +摇控yaokong +遥控yaokong +摇篮yaolan +要领yaoling +要么yaome +妖魔yaomo +要目yaomu +邀请yaoqing +要求yaoqiu +要塞yaosai +要是yaoshi +钥匙yaoshi +要素yaosu +窈窕yaotiao +摇头yaotou +要闻yaowen +药物yaowu +要挟yaoxie +耀眼yaoyan +谣言yaoyan +妖艳yaoyan +夭折yaozhe +要职yaozhi +鸦片yapian +压迫yapo +压强yaqiang +压缩yasuo +雅兴yaxing +压仰yayang +压抑yayi +压榨yazha +压制yazhi +雅致yazhi +亚洲yazhou +鸭子yazi +雅座yazuo +要不得ybd +一般的说ybds +一部分ybf +要不然ybr +要不是ybs +一般说来ybsl +要不要yby +一辈子ybz +一把抓ybz +用不着ybz +扬长避短ycbd +由此可见yckj +银川市ycs +与此同时ycts +有偿转让yczr +邮电部ydb +有道德ydd +邮电局ydj +一刀切ydq +运动员ydy +印度洋ydy +因地制宜ydzy +也ye +业ye +页ye +叶ye +液ye +夜ye +野ye +爷ye +冶ye +邪*ye +哗*ye +咽*ye +椰ye +噎ye +耶ye +掖ye +曳ye +腋ye +拽*ye +靥ye +谒ye +邺ye +揶ye +晔ye +烨ye +铘ye +夜餐yecan +野餐yecan +野火yehuo +业绩yeji +夜间yejian +冶金yejin +夜里yeli +冶练yelian +野蛮yeman +夜幕yemu +夜色yese +也是yeshi +夜市yeshi +野兽yeshou +液体yeti +野外yewai +夜晚yewan +业务yewu +夜校yexiao +野心yexin +野性yexing +也许yexu +幼儿园yey +爷爷yeye +野营yeying +业余yeyu +野战yezhan +叶子yezi +一方面yfm +一分为二yfwe +阳奉阴违yfyw +一概而论ygel +一国两制yglz +有根有据ygyj +严格要求ygyq +有何特长yhtc +银行帐号yhzh +炎黄子孙yhzs +一yi +以yi +义yi +意yi +已yi +移yi +医yi +议yi +依yi +易yi +乙yi +艺yi +益yi +异yi +宜yi +仪yi +亿yi +遗yi +伊yi +役yi +衣yi +疑yi +亦yi +谊yi +翼yi +译yi +抑yi +忆yi +疫yi +壹yi +揖yi +铱yi +颐yi +夷yi +胰yi +沂yi +姨yi +彝yi +椅yi +蚁yi +倚yi +矣yi +邑yi +屹yi +臆yi +逸yi +肄yi +裔yi +毅yi +溢yi +诣yi +翌yi +绎yi +刈yi +劓yi +仡*yi +佚yi +佾yi +诒yi +圯yi +埸yi +懿yi +苡yi +荑yi +薏yi +弈yi +奕yi +挹yi +弋yi +呓yi +咦yi +咿yi +嗌*yi +噫yi +峄yi +嶷yi +猗yi +饴yi +怿yi +怡yi +悒yi +漪yi +迤yi +驿yi +缢yi +殪yi +轶yi +贻yi +欹*yi +旖yi +熠yi +眙yi +钇yi +镒yi +镱yi +痍yi +瘗yi +癔yi +翊yi +蜴yi +舣yi +羿yi +翳yi +酏yi +黟yi +议案yian +疑案yian +一半yiban +一般yiban +一斑yiban +一边yibian +以便yibian +仪表yibiao +一并yibing +异步yibu +遗产yichan +异常yichang +议程yicheng +益处yichu +遗传yichuan +一次yici +依次yici +依从yicong +一代yidai +一带yidai +一旦yidan +一点yidian +一定yiding +议定yiding +移动yidong +一度yidu +遗毒yidu +一端yiduan +臆断yiduan +亿吨yidun +一发yifa +依法yifa +义愤yifen +衣服yifu +依附yifu +一概yigai +一个yige +一共yigong +议购yigou +已故yigu +一贯yiguan +异国yiguo +遗憾yihan +遗恨yihen +以后yihou +异化yihua +议会yihui +疑惑yihuo +以及yiji +异己yiji +遗迹yiji +议价yijia +意见yijian +移交yijiao +一届yijie +一经yijing +已经yijing +意境yijing +依旧yijiu +一举yiju +依据yiju +移居yiju +议决yijue +依靠yikao +倚靠yikao +一刻yike +医科yike +一块yikuai +以来yilai +依赖yilai +一览yilan +一例yili +毅力yili +屹立yili +一连yilian +意料yiliao +医疗yiliao +遗留yiliu +遗漏yilou +一律yilu +疑虑yilu +议论yilun +一面yimian +以免yimian +疫苗yimiao +移民yimin +因yin +引yin +阴yin +印yin +音yin +银yin +烟*yin +隐yin +饮yin +荫yin +茵yin +殷yin +姻yin +吟yin +淫yin +寅yin +尹yin +胤yin +鄞yin +圻*yin +垠yin +堙yin +茚yin +吲yin +喑yin +狺yin +夤yin +洇yin +湮*yin +氤yin +铟yin +瘾yin +窨yin +蚓yin +霪yin +龈yin +疑难yinan +阴暗yinan +隐蔽yinbi +音标yinbiao +隐藏yincang +阴沉yinchen +银川yinchuan +因此yinci +引导yindao +音调yindiao +印度yindu +引渡yindu +以内yinei +因而yiner +印发yinfa +音符yinfu +应ying +影ying +硬ying +营ying +英ying +映ying +迎ying +樱ying +婴ying +鹰ying +缨ying +莹ying +萤ying +荧ying +蝇ying +赢ying +盈ying +颖ying +嬴ying +郢ying +茔ying +荥*ying +莺ying +萦ying +蓥ying +撄ying +嘤ying +膺ying +滢ying +潆ying +瀛ying +瑛ying +璎ying +楹ying +媵ying +鹦ying +瘿ying +颍ying +罂ying +英镑yingbang +硬币yingbi +应变yingbian +映衬yingchen +应酬yingchou +迎春yingchun +应当yingdang +赢得yingde +婴儿yinger +营房yingfang +迎风yingfeng +应付yingfu +应该yinggai +英国yingguo +樱花yinghua +英魂yinghun +应急yingji +硬件yingjian +迎接yingjie +应届yingjie +英杰yingjie +营救yingjiu +英俊yingjun +盈亏yingkui +赢利yingli +盈利yingli +英烈yinglie +迎面yingmian +英明yingming +硬盘yingpan +影片yingpian +硬拼yingpin +影射yingshe +映射yingshe +樱桃yingtao +迎头yingtou +因果yinguo +影响yingxiang +硬性yingxing +英雄yingxiong +营养yingyang +应邀yingyao +营业yingye +应用yingyong +英勇yingyong +应有yingyou +英语yingyu +盈余yingyu +营造yingzao +应战yingzhan +迎战yingzhan +映照yingzhao +应征yingzheng +影子yingzi +英姿yingzi +银行yinhang +引号yinhao +殷红yinhong +隐患yinhuan +淫秽yinhui +阴魂yinhun +意念yinian +姨娘yiniang +阴极yinji +印鉴yinjian +引进yinjin +引力yinli +阴历yinli +阴凉yinliang +引路yinlu +隐瞒yinman +阴谋yinmou +银幕yinmu +隐慝yinni +银牌yinpai +引起yinqi +殷切yinqie +殷勤yinqin +引擎yinqing +引人yinren +饮食yinshi +印刷yinshua +饮水yinshui +因素yinsu +阴天yintian +引退yintui +因为yinwei +淫威yinwei +阴险yinxian +印象yinxiang +音响yinxiang +音信yinxin +因循yinxun +引言yinyan +阴影yinying +引用yinyong +引诱yinyou +阴雨yinyu +姻缘yinyuan +隐约yinyue +音乐yinyue +引证yinzheng +印证yinzheng +一片yipian +一瞥yipie +一起yiqi +一齐yiqi +义气yiqi +意气yiqi +仪器yiqi +遗弃yiqi +以前yiqian +一切yiqie +依然yiran +亦然yiran +毅然yiran +艺人yiren +宜人yiren +遗容yirong +以上yishang +一生yisheng +医生yisheng +一时yishi +一事yishi +意识yishi +议事yishi +逸事yishi +仪式yishi +医师yishi +医士yishi +遗失yishi +一手yishou +遗书yishu +艺术yishu +意思yisi +一体yiti +议题yiti +遗体yiti +一天yitian +一同yitong +异同yitong +一头yitou +意图yitu +疑团yituan +以外yiwai +意外yiwai +亿万yiwan +以往yiwang +遗忘yiwang +以为yiwei +意味yiwei +意文yiwen +疑问yiwen +译文yiwen +一无yiwu +义务yiwu +遗物yiwu +医务yiwu +贻误yiwu +一下yixia +以下yixia +一线yixian +一向yixiang +一项yixiang +意向yixiang +遗像yixiang +一些yixie +一心yixin +疑心yixin +异性yixing +医学yixue +一言yiyan +义演yiyan +遗言yiyan +一样yiyang +医药yiyao +意义yiyi +异议yiyi +义勇yiyong +易于yiyu +议员yiyuan +意愿yiyuan +医院yiyuan +亿元yiyuan +遗愿yiyuan +疑云yiyun +一再yizai +一早yizao +臆造yizao +依仗yizhang +仪仗yizhang +一朝yizhao +衣着yizhao +依照yizhao +一阵yizhen +一直yizhi +一致yizhi +以至yizhi +以致yizhi +意志yizhi +抑制yizhi +医治yizhi +抑止yizhi +移植yizhi +遗址yizhi +一种yizhong +遗嘱yizhu +研究会yjh +有纪律yjl +研究生yjs +研究所yjs +研究室yjs +养精畜锐yjxr +研究员yjy +拥军优属yjys +一技之长yjzc +一口气ykq +一览表ylb +以理服人ylfr +阅览室yls +有理想ylx +有利于yly +越来越yly +有目共睹ymgd +一目了然ymlr +有没有ymy +云南省yns +育*yo +哟yo +唷yo +用yong +勇yong +永yong +拥yong +涌yong +蛹yong +庸yong +佣yong +臃yong +痈yong +雍yong +踊yong +咏yong +泳yong +恿yong +俑yong +壅yong +墉yong +喁yong +慵yong +邕yong +镛yong +甬yong +鳙yong +饔yong +拥抱yongbao +永别yongbie +永不yongbu +用处yongchu +用度yongdu +用法yongfa +用费yongfei +勇敢yonggan +用功yonggong +永恒yongheng +用户yonghu +拥护yonghu +拥挤yongji +永久yongjiu +用具yongju +永诀yongjue +用力yongli +庸碌yonglu +勇猛yongmeng +用品yongpin +勇气yongqi +勇士yongshi +庸俗yongsu +咏叹yongtan +用途yongtu +涌现yongxian +用心yongxin +用意yongyi +拥有yongyou +用于yongyu +勇于yongyu +永远yongyuan +踊跃yongyue +有you +由you +又you +油you +右you +友you +优you +幼you +游you +尤you +诱you +犹you +幽you +悠you +忧you +邮you +铀you +酉you +佑you +釉you +卣you +攸you +侑you +莠you +莜you +莸you +尢*you +呦you +囿you +宥you +柚you +猷you +牖you +铕you +疣you +蚰you +蚴you +蝣you +蝤*you +繇*you +鱿you +黝you +鼬you +有碍youai +友爱youai +幽暗youan +友邦youbang +右边youbian +忧愁youchou +由此youci +有错youcuo +有待youdai +优待youdai +诱导youdao +有的youde +优等youdeng +有点youdian +邮电youdian +优点youdian +诱发youfa +有功yougong +有关youguan +有害youhai +友好youhao +优化youhua +油画youhua +幽会youhui +优惠youhui +诱惑youhuo +有机youji +游击youji +有劲youjin +幽静youjing +悠久youjiu +邮局youju +由来youlai +游览youlan +有劳youlao +有利youli +有力youli +游离youli +优良youliang +优劣youlie +幽灵youling +忧虑youlu +优美youmei +幼苗youmiao +有名youming +幽默youmo +右派youpai +诱骗youpian +邮票youpiao +尤其youqi +油漆youqi +友情youqing +右倾youqing +有趣youqu +油然youran +犹如youru +有色youse +优胜yousheng +有时youshi +有事youshi +有失youshi +优势youshi +有数youshu +油水youshui +有所yousuo +有望youwang +有为youwei +游戏youxi +有限youxian +优先youxian +悠闲youxian +有效youxiao +幼小youxiao +有些youxie +有心youxin +游行youxing +优秀youxiu +幽雅youya +悠扬youyang +又要youyao +有益youyi +优异youyi +友谊youyi +有用youyong +游泳youyong +有余youyu +由于youyu +犹豫youyu +忧郁youyu +悠远youyuan +优越youyue +有着youzhe +邮政youzheng +优质youzhi +幼稚youzhi +由衷youzhong +邮资youzi +有求必应yqby +以权谋私yqms +有气无力yqwl +迎刃而解yrej +因人而异yrey +与人为善yrws +引人注目yrzm +意识到ysd +艺术家ysj +因势利导ysld +印刷体yst +意识形态ysxt +衣食住行yszx +以身作则yszz +研讨会yth +一条龙ytl +一条心ytx +有条有理ytyl +于yu +与yu +育yu +鱼yu +雨yu +玉yu +余yu +遇yu +预yu +域yu +语yu +愈yu +渔yu +予yu +羽yu +愚yu +御yu +谷*yu +欲yu +宇yu +蔚*yu +尉*yu +迂yu +淤yu +盂yu +榆yu +虞yu +舆yu +俞yu +逾yu +愉yu +渝yu +隅yu +娱yu +屿yu +禹yu +芋yu +郁yu +吁yu +喻yu +峪yu +狱yu +誉yu +浴yu +寓yu +裕yu +豫yu +驭yu +粥*yu +禺yu +毓yu +伛yu +俣yu +谀yu +谕yu +萸yu +菀*yu +蓣yu +揄yu +圄yu +圉yu +嵛yu +狳yu +饫yu +馀yu +庾yu +阈yu +鬻yu +妪yu +妤yu +纡yu +瑜yu +昱yu +觎yu +腴yu +腧*yu +欤yu +於yu +煜yu +熨yu +燠yu +聿yu +钰yu +鹆yu +鹬yu +瘐yu +瘀yu +窬yu +窳yu +蜮yu +蝓yu +竽yu +臾yu +舁yu +雩yu +龉yu +员yuan +原yuan +圆yuan +源yuan +元yuan +远yuan +愿yuan +院yuan +缘yuan +援yuan +园yuan +怨yuan +鸳yuan +渊yuan +冤yuan +垣yuan +袁yuan +辕yuan +猿yuan +苑yuan +垸yuan +塬yuan +芫yuan +掾yuan +圜*yuan +沅yuan +媛yuan +瑗yuan +橼yuan +爰yuan +眢yuan +鸢yuan +螈yuan +箢yuan +鼋yuan +原本yuanben +渊博yuanbo +冤仇yuanchou +远大yuanda +元旦yuandan +园地yuandi +园丁yuanding +远东yuandong +远方yuanfang +缘分yuanfen +原告yuangao +原故yuangu +缘故yuangu +圆滑yuanhua +原籍yuanji +冤家yuanjia +元件yuanjian +远见yuanjian +远近yuanjin +远景yuanjing +援救yuanjiu +原来yuanlai +原理yuanli +原谅yuanliang +原料yuanliao +远虑yuanlu +圆满yuanman +远谋yuanmou +远期yuanqi +冤屈yuanqu +源泉yuanquan +原始yuanshi +远视yuanshi +元首yuanshou +元帅yuanshuai +元素yuansu +援外yuanwai +愿望yuanwang +冤枉yuanwang +原先yuanxian +远销yuanxiao +元宵yuanxiao +院校yuanxiao +原形yuanxing +怨言yuanyan +原野yuanye +愿意yuanyi +园艺yuanyi +原因yuanyin +援引yuanyin +原有yuanyou +缘由yuanyou +远游yuanyou +远远yuanyuan +渊源yuanyuan +元月yuanyue +原则yuanze +院长yuanzhang +远征yuanzheng +援助yuanzhu +原子yuanzi +院子yuanzi +预报yubao +预备yubei +愚笨yuben +余步yubu +预测yuce +愚蠢yuchun +遇到yudao +预定yuding +预订yuding +余毒yudu +月yue +说*yue +越yue +约yue +乐*yue +跃yue +曰yue +阅yue +钥yue +岳yue +粤yue +悦yue +龠yue +瀹yue +栎*yue +樾yue +刖yue +钺yue +月报yuebao +月初yuechu +月底yuedi +约定yueding +月度yuedu +阅读yuedu +乐队yuedui +约法yuefa +月份yuefen +月光yueguang +越轨yuegui +约会yuehui +越界yuejie +跃进yuejin +越境yuejing +阅览yuelan +阅历yueli +月亮yueliang +月末yuemo +约莫yuemo +越南yuenan +乐谱yuepu +乐器yueqi +月球yueqiu +乐曲yuequ +月色yuese +越是yueshi +约束yueshu +月台yuetai +乐团yuetuan +约有yueyou +乐章yuezhang +预防yufang +预风yufeng +预付yufu +预感yugan +预告yugao +预购yugou +遇害yuhai +宇航yuhang +与会yuhui +迂回yuhui +雨季yuji +预计yuji +遇见yujian +预见yujian +语句yuju +豫剧yuju +愉快yukuai +娱乐yule +鱼雷yulei +预料yuliao +雨露yulu +舆论yulun +愚昧yumei +育苗yumiao +预谋yumou +运yun +员*yun +云yun +匀yun +均*yun +允yun +孕yun +耘yun +郧yun +陨yun +蕴yun +酝yun +晕yun +韵yun +郓yun +芸yun +狁yun +恽yun +愠yun +纭yun +韫yun +殒yun +昀yun +氲yun +熨yun +遇难yunan +云彩yuncai +蕴藏yuncang +匀称yuncheng +运动yundong +熨斗yundou +云海yunhai +运河yunhe +韵律yunlu +陨落yunluo +云南yunnan +酝酿yunnian +允诺yunnuo +愚弄yunong +运气yunqi +运输yunshu +运算yunsuan +云梯yunti +运往yunwang +韵味yunwei +云雾yunwu +云霞yunxia +运行yunxing +允许yunxu +运用yunyong +孕育yunyu +运载yunzai +运转yunzhuan +与其yuqi +语气yuqi +预期yuqi +预审yushen +于是yushi +预示yushi +预售yushou +雨水yushui +预算yusuan +欲望yuwang +语文yuwen +预习yuxi +预先yuxian +遇险yuxian +预想yuxiang +预言yuyan +语言yuyan +寓言yuyan +预演yuyan +予以yuyi +寓于yuyu +愉悦yuyue +预兆yuzhao +预支yuzhi +宇宙yuzhou +有文化ywh +业务联系ywlx +意味着ywz +有限公司yxgs +一系列yxl +有效期yxq +医学院yxy +一心一意yxyy +游泳池yyc +营业额yye +夜以继日yyjr +应用科学yykx +一言堂yyt +引以为戒yywj +优越性yyx +营业员yyy +隐隐约约yyyy +运用自如yyzr +拥政爱民yzam +原子能yzn +已知数yzs +有助于yzy +言之有理yzyl +在z +这z +主z +中z +种z +着z +争z +战z +作z +正z +之z +制z +重z +组z +治z +只z +子z +自z +质z +指z +杂za +扎*za +咱za +匝za +砸za +咋za +咂za +在zai +再zai +载zai +栽zai +灾zai +仔*zai +哉zai +宰zai +崽zai +甾zai +再版zaiban +再不zaibu +在场zaichang +再度zaidu +宰割zaige +灾害zaihai +再好zaihao +在乎zaihu +灾荒zaihuang +再会zaihui +灾祸zaihuo +再见zaijian +在理zaili +灾民zaimin +灾难zainan +栽培zaipei +再起zaiqi +灾情zaiqing +灾区zaiqu +再三zaisan +在世zaishi +再说zaishuo +载体zaiti +在下zaixia +再现zaixian +宰相zaixiang +在意zaiyi +在于zaiyu +再造zaizao +再则zaize +在职zaizhi +再植zaizhi +杂技zaji +杂粮zaliang +杂乱zaluan +赞zan +咱zan +暂zan +攒zan +拶zan +瓒zan +昝zan +簪zan +糌zan +趱zan +錾zan +赞成zancheng +暂定zanding +藏*zang +脏zang +葬zang +赃zang +奘zang +驵zang +臧zang +赞歌zange +赃款zangkuan +葬送zangsong +赃物zangwu +藏族zangzu +杂念zanian +赞美zanmei +咱们zanmen +暂且zanqie +暂缺zanque +赞赏zanshang +暂时zanshi +赞颂zansong +赞叹zantan +暂停zanting +赞同zantong +暂行zanxing +赞扬zanyang +暂用zanyong +赞助zanzhu +造zao +早zao +遭zao +燥zao +凿zao +糟zao +枣zao +皂zao +藻zao +澡zao +蚤zao +躁zao +噪zao +灶zao +唣zao +早晨zaochen +造成zaocheng +凿穿zaochuan +造次zaoci +造词zaoci +遭到zaodao +早稻zaodao +造反zaofan +早饭zaofan +造福zaofu +糟糕zaogao +造化zaohua +造价zaojia +造就zaojiu +造林zaolin +早年zaonian +糟粕zaopo +早期zaoqi +早日zaori +早上zaoshang +遭受zaoshou +早衰zaoshuai +糟蹋zaota +早晚zaowan +造型zaoxing +遭殃zaoyang +造谣zaoyao +造诣zaoyi +早已zaoyi +噪音zaoyin +遭遇zaoyu +造字zaozi +杂谈zatan +杂文zawen +杂质zazhi +杂志zazhi +资本主义zbzy +资产阶级zcjj +增长率zcl +总参谋部zcmb +真才实学zcsx +自动化zdh +自动检测zdjc +自动检索zdjs +自动控制zdkz +主动权zdq +招待所zds +总的说来zdsl +主动性zdx +则ze +择ze +责ze +侧*ze +泽ze +咋*ze +仄ze +赜ze +啧ze +帻ze +迮ze +昃ze +笮ze +箦ze +舴ze +责备zebei +责成zecheng +责罚zefa +责怪zeguai +贼zei +责令zeling +责骂zema +怎zen +谮zen +增zeng +曾zeng +综*zeng +憎zeng +赠zeng +缯zeng +甑zeng +罾zeng +锃zeng +增补zengbu +增产zengchan +增长zengchang +增大zengda +增订zengding +增多zengduo +增高zenggao +憎恨zenghen +增加zengjia +增减zengjian +增进zengjin +增量zengliang +赠品zengpin +增强zengqiang +增删zengshan +增设zengshe +赠送zengsong +增添zengtian +赠言zengyan +增益zengyi +增援zengyuan +怎么zenme +怎奈zennai +怎样zenyang +责任zeren +责问zewen +总而言之zeyz +争分夺秒zfdm +针锋相对zfxd +自负盈亏zfyk +中关村zgc +自告奋勇zgfy +中国共产党zggd +总工会zgh +中国特色的zgtd +中国银行zgyh +自古以来zgyl +中国政府zgzf +中共中央zgzy +查*zha +扎zha +炸zha +闸zha +铡zha +轧zha +渣zha +蜡*zha +喳zha +札zha +眨zha +栅zha +榨zha +咋*zha +乍zha +诈zha +柞*zha +揸zha +吒zha +咤zha +哳zha +喋*zha +楂*zha +砟zha +痄zha +蚱zha +齄zha +炸弹zhadan +扎根zhagen +炸毁zhahui +寨zhai +侧*zhai +择*zhai +摘zhai +窄zhai +斋zhai +翟*zhai +祭*zhai +宅zhai +债zhai +砦zhai +瘵zhai +摘录zhailu +债权zhaiquan +债务zhaiwu +窄小zhaixiao +摘要zhaiyao +札记zhaji +战zhan +展zhan +站zhan +占zhan +粘*zhan +颤*zhan +瞻zhan +毡zhan +詹zhan +沾zhan +盏zhan +斩zhan +辗zhan +崭zhan +蘸zhan +栈zhan +湛zhan +绽zhan +谵zhan +搌zhan +旃zhan +战败zhanbai +战报zhanbao +战备zhanbei +战场zhanchang +展翅zhanchi +展出zhanchu +战地zhandi +战斗zhandou +战犯zhanfan +长*zhang +张zhang +章zhang +掌zhang +仗zhang +障zhang +胀zhang +涨zhang +账zhang +樟zhang +彰zhang +漳zhang +杖zhang +丈zhang +帐zhang +瘴zhang +仉zhang +鄣zhang +幛zhang +嶂zhang +獐zhang +嫜zhang +璋zhang +蟑zhang +障碍zhangai +站岗zhangang +长辈zhangbei +章程zhangcheng +长大zhangda +战歌zhange +章法zhangfa +帐房zhangfang +丈夫zhangfu +掌管zhangguan +帐号zhanghao +章节zhangjie +帐目zhangmu +战功zhangong +掌权zhangquan +张贴zhangtie +战鼓zhangu +沾光zhanguang +战国zhanguo +战果zhanguo +张望zhangwang +掌握zhangwo +张扬zhangyang +战壕zhanhao +战后zhanhou +战机zhanji +战绩zhanji +战局zhanju +占据zhanju +展开zhankai +战况zhankuang +展览zhanlan +占领zhanling +战略zhanlue +战马zhanma +展品zhanpin +战区zhanqu +沾染zhanran +战胜zhansheng +战时zhanshi +战事zhanshi +战士zhanshi +展示zhanshi +战术zhanshu +展望zhanwang +战线zhanxian +展现zhanxian +展销zhanxiao +崭新zhanxin +瞻仰zhanyang +战役zhanyi +占用zhanyong +占有zhanyou +战友zhanyou +站长zhanzhang +战争zhanzheng +着*zhao +照zhao +找zhao +招zhao +朝*zhao +召zhao +赵zhao +爪zhao +罩zhao +沼zhao +兆zhao +嘲*zhao +昭zhao +肇zhao +诏zhao +啁*zhao +棹zhao +钊zhao +笊zhao +照办zhaoban +照搬zhaoban +招标zhaobiao +照常zhaochang +照抄zhaochao +招待zhaodai +照发zhaofa +招工zhaogong +照顾zhaogu +招呼zhaohu +召唤zhaohuan +照会zhaohui +着急zhaoji +招集zhaoji +召集zhaoji +招架zhaojia +召开zhaokai +招考zhaokao +招揽zhaolan +着力zhaoli +照例zhaoli +照料zhaoliao +着落zhaoluo +着迷zhaomi +照明zhaoming +招聘zhaopin +朝气zhaoqi +招惹zhaore +照射zhaoshe +招生zhaosheng +着手zhaoshou +招手zhaoshou +招收zhaoshou +招贴zhaotie +朝夕zhaoxi +朝霞zhaoxia +着想zhaoxiang +照相zhaoxiang +昭雪zhaoxue +找寻zhaoxun +着眼zhaoyan +照样zhaoyang +照耀zhaoyao +照应zhaoying +招展zhaozhan +招致zhaozhi +着重zhaozhong +照着zhaozhuo +诈骗zhapian +榨取zhaqu +诈取zhaqu +扎实zhashi +炸药zhayao +渣滓zhazi +这zhe +着zhe +者zhe +折zhe +哲zhe +浙zhe +遮zhe +蛰zhe +辙zhe +锗zhe +蔗zhe +谪zhe +摺zhe +柘zhe +辄zhe +磔zhe +鹧zhe +褶zhe +蜇zhe +赭zhe +这般zheban +这边zhebian +这次zheci +遮挡zhedang +这点zhedian +折叠zhedie +折服zhefu +遮盖zhegai +这个zhege +折合zhehe +浙江zhejiang +折旧zhejiu +折扣zhekou +这里zheli +哲理zheli +这么zheme +折磨zhemo +真zhen +针zhen +阵zhen +镇zhen +振zhen +震zhen +珍zhen +诊zhen +斟zhen +甄zhen +砧zhen +臻zhen +贞zhen +侦zhen +枕zhen +疹zhen +圳zhen +蓁zhen +浈zhen +溱*zhen +缜zhen +桢zhen +椹*zhen +榛zhen +轸zhen +赈zhen +胗zhen +朕zhen +祯zhen +畛zhen +稹zhen +鸩zhen +箴zhen +珍爱zhenai +珍宝zhenbao +针砭zhenbian +珍藏zhencang +贞操zhencao +侦察zhencha +真诚zhencheng +震荡zhendang +阵地zhendi +真谛zhendi +震动zhendong +诊断zhenduan +针对zhendui +振奋zhenfen +争zheng +正zheng +政zheng +整zheng +证zheng +征zheng +蒸zheng +症zheng +丁*zheng +郑zheng +挣zheng +睁zheng +狰zheng +怔zheng +拯zheng +帧zheng +诤zheng +峥zheng +徵zheng +钲zheng +铮zheng +筝zheng +争霸zhengba +整备zhengbei +正比zhengbi +政变zhengbian +争辩zhengbian +整编zhengbian +征兵zhengbing +政策zhengce +正常zhengchang +争吵zhengchao +征程zhengcheng +争持zhengchi +正大zhengda +正当zhengdang +政党zhengdang +整党zhengdang +正道zhengdao +争端zhengduan +整顿zhengdun +争夺zhengduo +蒸发zhengfa +政法zhengfa +正反zhengfan +整风zhengfeng +政府zhengfu +征服zhengfu +整改zhenggai +整个zhengge +征购zhenggou +争光zhengguang +正规zhenggui +正轨zhenggui +正好zhenghao +政绩zhengji +征集zhengji +证件zhengjian +政见zhengjian +整洁zhengjie +政局zhengju +证据zhengju +正理zhengli +整理zhengli +正梁zhengliang +政令zhengling +争论zhenglun +政论zhenglun +正面zhengmian +争鸣zhengming +证明zhengming +正派zhengpai +征聘zhengpin +争气zhengqi +正气zhengqi +蒸气zhengqi +整齐zhengqi +正巧zhengqiao +征求zhengqiu +争取zhengqu +政权zhengquan +正确zhengque +证人zhengren +正是zhengshi +正式zhengshi +正视zhengshi +证实zhengshi +征收zhengshou +整数zhengshu +证书zhengshu +征税zhengshui +整套zhengtao +正题zhengti +政体zhengti +整体zhengti +整天zhengtian +征调zhengtiao +正统zhengtong +征途zhengtu +珍贵zhengui +政委zhengwei +正文zhengwen +征文zhengwen +政务zhengwu +争先zhengxian +政协zhengxie +整形zhengxing +整修zhengxiu +征询zhengxun +争艳zhengyan +正业zhengye +正义zhengyi +争议zhengyi +征用zhengyong +正月zhengyue +正在zhengzai +挣扎zhengzha +整整zhengzheng +正直zhengzhi +政治zhengzhi +争执zhengzhi +正中zhengzhong +郑重zhengzhong +郑州zhengzhou +症状zhengzhuang +正宗zhengzong +震撼zhenhan +侦缉zhenji +真假zhenjia +阵脚zhenjiao +贞节zhenjie +贞洁zhenjie +镇静zhenjing +震惊zhenjing +真空zhenkong +真理zhenli +诊疗zhenliao +珍品zhenpin +珍奇zhenqi +真切zhenqie +真情zhenqing +真确zhenque +真人zhenren +阵容zhenrong +真是zhenshi +真实zhenshi +阵势zhenshi +珍视zhenshi +侦探zhentan +阵亡zhenwang +珍惜zhenxi +阵线zhenxian +真相zhenxiang +振兴zhenxing +镇压zhenya +阵阵zhenzhen +真正zhenzheng +真知zhenzhi +真挚zhenzhi +珍重zhenzhong +珍珠zhenzhu +斟酌zhenzhuo +振作zhenzuo +这是zheshi +这时zheshi +折腾zheteng +这些zhexie +哲学zhexue +遮掩zheyan +这样zheyang +这种zhezhong +折中zhezhong +之zhi +制zhi +治zhi +只zhi +质zhi +指zhi +直zhi +支zhi +织zhi +止zhi +至zhi +置zhi +志zhi +值zhi +知zhi +识*zhi +执zhi +职zhi +植zhi +纸zhi +致zhi +枝zhi +殖zhi +脂zhi +智zhi +氏*zhi +肢zhi +秩zhi +址zhi +滞zhi +汁zhi +芝zhi +吱zhi +蜘zhi +侄zhi +趾zhi +旨zhi +挚zhi +掷zhi +帜zhi +峙zhi +稚zhi +炙zhi +痔zhi +窒zhi +卮zhi +陟zhi +郅zhi +埴zhi +芷zhi +摭zhi +帙zhi +徵*zhi +忮zhi +彘zhi +咫zhi +骘zhi +栉zhi +枳zhi +栀zhi +桎zhi +轵zhi +轾zhi +贽zhi +胝zhi +膣zhi +祉zhi +祗zhi +黹zhi +雉zhi +鸷zhi +痣zhi +蛭zhi +絷zhi +酯zhi +跖zhi +踬zhi +踯zhi +豸zhi +觯zhi +治安zhian +值班zhiban +植保zhibao +置备zhibei +质变zhibian +指标zhibiao +职别zhibie +支部zhibu +制裁zhicai +支撑zhicheng +职称zhicheng +支持zhichi +指出zhichu +支出zhichu +至此zhici +值此zhici +直达zhida +只当zhidang +直到zhidao +指导zhidao +知道zhidao +只得zhide +值得zhide +质地zhidi +指点zhidian +制定zhiding +指定zhiding +制订zhiding +制度zhidu +支队zhidui +至多zhiduo +知法zhifa +执法zhifa +制服zhifu +支付zhifu +职工zhigong +只顾zhigu +只管zhiguan +直观zhiguan +治国zhiguo +只好zhihao +之后zhihou +指挥zhihui +智慧zhihui +知己zhiji +指甲zhijia +之间zhijian +只见zhijian +指教zhijiao +直接zhijie +枝节zhijie +至今zhijin +直经zhijing +直径zhijing +止境zhijing +致敬zhijing +知觉zhijue +治理zhili +致力zhili +智力zhili +质量zhiliang +治疗zhiliao +指令zhiling +直流zhiliu +支流zhiliu +殖民zhimin +致命zhiming +指明zhiming +知名zhiming +智谋zhimou +指南zhinan +智囊zhinang +之内zhinei +只能zhineng +职能zhineng +智能zhineng +只怕zhipa +指派zhipai +支配zhipei +支票zhipiao +制品zhipin +志气zhiqi +之前zhiqian +支前zhiqian +值勤zhiqin +执勤zhiqin +知情zhiqing +知青zhiqing +智取zhiqu +志趣zhiqu +知趣zhiqu +职权zhiquan +值日zhiri +治丧zhisang +之上zhishang +直上zhishang +至上zhishang +至少zhishao +制胜zhisheng +之声zhisheng +只是zhishi +指使zhishi +支使zhishi +致使zhishi +知事zhishi +指示zhishi +知识zhishi +指数zhishu +支书zhishu +直属zhishu +植树zhishu +直爽zhishuang +治水zhishui +直说zhishuo +致死zhisi +之外zhiwai +指望zhiwang +职位zhiwei +质问zhiwen +植物zhiwu +职务zhiwu +窒息zhixi +之下zhixia +直线zhixian +指向zhixiang +志向zhixiang +知心zhixin +执行zhixing +只许zhixu +秩序zhixu +直言zhiyan +只要zhiyao +职业zhiye +致意zhiyi +旨意zhiyi +质疑zhiyi +指引zhiyin +知音zhiyin +只有zhiyou +至于zhiyu +置于zhiyu +智育zhiyu +职员zhiyuan +支援zhiyuan +志愿zhiyuan +制约zhiyue +制造zhizao +指责zhize +职责zhize +纸张zhizhang +职掌zhizhang +执照zhizhao +指正zhizheng +执政zhizheng +制止zhizhi +直至zhizhi +之中zhizhong +支助zhizhu +支柱zhizhu +知足zhizu +制作zhizuo +走后门zhm +中华民国zhmg +中华民族zhmz +中zhong +种zhong +重zhong +众zhong +钟zhong +终zhong +忠zhong +肿zhong +仲zhong +盅zhong +衷zhong +冢zhong +忪*zhong +锺zhong +螽zhong +舯zhong +踵zhong +钟爱zhongai +重办zhongban +重兵zhongbing +中部zhongbu +仲裁zhongcai +中层zhongceng +衷肠zhongchang +忠诚zhongcheng +重大zhongda +重担zhongdan +中等zhongdeng +种地zhongdi +重地zhongdi +重点zhongdian +终点zhongdian +中东zhongdong +中断zhongduan +终端zhongduan +中队zhongdui +众多zhongduo +重犯zhongfan +忠告zhonggao +中共zhonggong +中国zhongguo +忠厚zhonghou +中华zhonghua +中级zhongji +终极zhongji +重价zhongjia +中间zhongjian +中坚zhongjian +中奖zhongjiang +终结zhongjie +终究zhongjiu +终久zhongjiu +终局zhongju +中肯zhongken +种类zhonglei +中立zhongli +重量zhongliang +终了zhongliao +中流zhongliu +肿瘤zhongliu +中美zhongmei +众目zhongmu +中年zhongnian +终年zhongnian +中秋zhongqiu +重任zhongren +中日zhongri +终日zhongri +中伤zhongshang +重赏zhongshang +终身zhongshen +终生zhongsheng +重视zhongshi +忠实zhongshi +中枢zhongshu +众说zhongshuo +中苏zhongsu +终天zhongtian +中途zhongtu +重托zhongtuo +中外zhongwai +重围zhongwei +中文zhongwen +中午zhongwu +中西zhongxi +中心zhongxin +忠心zhongxin +衷心zhongxin +中性zhongxing +中学zhongxue +中旬zhongxun +忠言zhongyan +中央zhongyang +中药zhongyao +重要zhongyao +中医zhongyi +重用zhongyong +中庸zhongyong +中游zhongyou +终于zhongyu +忠于zhongyu +忠贞zhongzhen +中止zhongzhi +种植zhongzhi +终止zhongzhi +种种zhongzhong +中专zhongzhuan +种族zhongzu +轴zhou +周zhou +洲zhou +州zhou +皱zhou +骤zhou +舟zhou +诌zhou +粥zhou +肘zhou +帚zhou +咒zhou +宙zhou +昼zhou +荮zhou +啁zhou +妯zhou +纣zhou +绉zhou +胄zhou +碡zhou +籀zhou +繇*zhou +酎zhou +周到zhoudao +咒骂zhouma +周密zhoumi +周末zhoumo +周期zhouqi +周全zhouquan +周围zhouwei +周旋zhouxuan +昼夜zhouye +周折zhouzhe +周知zhouzhi +周转zhouzhuan +总后勤部zhqb +中华人民共和国zhrg +主zhu +注zhu +著zhu +住zhu +助zhu +猪zhu +铸zhu +属*zhu +株zhu +筑zhu +柱zhu +术*zhu +驻zhu +逐zhu +祝zhu +竹zhu +贮zhu +珠zhu +朱zhu +诸zhu +蛛zhu +诛zhu +烛zhu +煮zhu +拄zhu +瞩zhu +嘱zhu +蛀zhu +伫zhu +侏zhu +邾zhu +茱zhu +洙zhu +渚zhu +潴zhu +杼zhu +槠zhu +橥zhu +炷zhu +铢zhu +疰zhu +瘃zhu +褚*zhu +竺zhu +箸zhu +舳zhu +翥zhu +躅zhu +麈zhu +抓zhua +挝*zhua +抓好zhuahao +转*zhuai +曳*zhuai +拽zhuai +抓紧zhuajin +转zhuan +专zhuan +传*zhuan +砖zhuan +撰zhuan +赚zhuan +篆zhuan +啭zhuan +馔zhuan +沌*zhuan +颛zhuan +转变zhuanbian +转播zhuanbo +专长zhuanchang +专程zhuancheng +转达zhuanda +转发zhuanfa +装zhuang +状zhuang +壮zhuang +庄zhuang +撞zhuang +幢*zhuang +桩zhuang +妆zhuang +僮zhuang +奘*zhuang +转告zhuangao +装扮zhuangban +装备zhuangbei +壮大zhuangda +装订zhuangding +壮观zhuangguan +装甲zhuangjia +庄稼zhuangjia +庄嫁zhuangjia +壮举zhuangju +状况zhuangkuang +壮阔zhuangkuo +壮丽zhuangli +壮烈zhuanglie +装配zhuangpei +装饰zhuangshi +状态zhuangtai +装卸zhuangxie +庄严zhuangyan +庄园zhuangyuan +装运zhuangyun +装置zhuangzhi +壮志zhuangzhi +庄重zhuangzhong +转化zhuanhua +转换zhuanhuan +转给zhuanji +专家zhuanjia +专科zhuanke +专利zhuanli +专门zhuanmen +转让zhuanrang +专题zhuanti +转向zhuanxiang +专心zhuanxin +转眼zhuanyan +专业zhuanye +转移zhuanyi +专员zhuanyuan +转载zhuanzai +转折zhuanzhe +转正zhuanzheng +专政zhuanzheng +专制zhuanzhi +专职zhuanzhi +专注zhuanzhu +专著zhuanzhu +主办zhuban +逐步zhubu +贮藏zhucang +注册zhuce +助长zhuchang +主持zhuchi +主次zhuci +主导zhudao +注定zhuding +主动zhudong +主队zhudui +主犯zhufan +住房zhufang +祝福zhufu +嘱咐zhufu +逐个zhuge +主攻zhugong +助工zhugong +主管zhuguan +主观zhuguan +追zhui +锥zhui +椎zhui +赘zhui +坠zhui +缀zhui +惴zhui +骓zhui +缒zhui +追捕zhuibu +追查zhuicha +追悼zhuidao +追赶zhuigan +坠毁zhuihui +追加zhuijia +追究zhuijiu +追求zhuiqiu +追认zhuiren +追溯zhuisu +追随zhuisui +追问zhuiwen +追逐zhuizhu +追踪zhuizong +主机zhuji +主见zhujian +逐渐zhujian +主将zhujiang +主讲zhujiang +主教zhujiao +主角zhujiao +注解zhujie +祝酒zhujiu +主力zhuli +助理zhuli +株连zhulian +主粮zhuliang +主流zhuliu +驻留zhuliu +著名zhuming +主谋zhumou +注目zhumu +瞩目zhumu +准zhun +屯*zhun +谆zhun +肫zhun +窀zhun +准备zhunbei +逐年zhunian +准确zhunque +准绳zhunsheng +准时zhunshi +准许zhunxu +准则zhunze +着*zhuo +著*zhuo +捉zhuo +桌zhuo +缴*zhuo +拙zhuo +卓zhuo +琢zhuo +茁zhuo +酌zhuo +啄zhuo +灼zhuo +浊zhuo +倬zhuo +诼zhuo +擢zhuo +浞zhuo +涿zhuo +濯zhuo +棹*zhuo +焯zhuo +禚zhuo +斫zhuo +镯zhuo +拙劣zhuolie +琢磨zhuomo +捉弄zhuonong +酌情zhuoqing +卓越zhuoyue +茁壮zhuozhuang +主权zhuquan +主人zhuren +主任zhuren +诸如zhuru +注色zhuse +注视zhushi +柱石zhushi +注释zhushi +助手zhushou +主送zhusong +住宿zhusu +珠算zhusuan +主题zhuti +主体zhuti +逐条zhutiao +嘱托zhutuo +诸位zhuwei +主席zhuxi +注销zhuxiao +主要zhuyao +逐一zhuyi +主义zhuyi +主意zhuyi +注意zhuyi +祝愿zhuyuan +逐月zhuyue +主宰zhuzai +铸造zhuzao +驻扎zhuzha +住宅zhuzhai +主张zhuzhang +住址zhuzhi +注重zhuzhong +著作zhuzuo +子zi +自zi +资zi +字zi +紫zi +仔zi +籽zi +姿zi +吱*zi +兹zi +咨zi +滋zi +淄zi +孜zi +滓zi +渍zi +谘zi +茈*zi +呲*zi +嵫zi +姊zi +孳zi +缁zi +梓zi +辎zi +赀zi +恣zi +眦zi +锱zi +秭zi +耔zi +笫zi +粢zi +趑zi +觜zi +訾zi +龇zi +鲻zi +髭zi +自爱ziai +自白zibai +自卑zibei +资本ziben +资产zichan +滋长zichang +自称zicheng +自传zichuan +自从zicong +子弟zidi +字典zidian +自动zidong +自发zifa +自费zifei +自封zifeng +自负zifu +字符zifu +资格zige +字根zigen +自豪zihao +自给ziji +自己ziji +字迹ziji +字节zijie +资金zijin +自救zijiu +自居ziju +自觉zijue +字库ziku +自夸zikua +自理zili +资历zili +资料ziliao +自满ziman +自勉zimian +字母zimu +字幕zimu +子女zinu +自强ziqiang +自然ziran +滋润zirun +自杀zisha +自身zishen +姿势zishi +自述zishu +自私zisi +姿态zitai +字体ziti +字帖zitie +自卫ziwei +滋味ziwei +自问ziwen +自我ziwo +仔细zixi +自信zixin +自修zixiu +自叙zixu +自选zixuan +自学zixue +咨询zixun +滋养ziyang +自由ziyou +自愿ziyuan +资源ziyuan +自找zizhao +自治zizhi +自重zizhong +资助zizhu +自尊zizun +直截了当zjld +浙江省zjs +这就是说zjss +中纪委zjw +再接再厉zjzl +中联部zlb +专利法zlf +质量管理zlgl +自力更生zlgs +展览会zlh +智力开发zlkf +专利权zlq +知名人士zmrs +这么些zmx +这么样zmy +怎么样zmy +总zong +纵zong +宗zong +综zong +棕zong +鬃zong +踪zong +偬zong +枞zong +腙zong +粽zong +总部zongbu +总裁zongcai +总参zongcan +总队zongdui +总额zonge +总纲zonggang +总共zonggong +纵贯zongguan +总和zonghe +综合zonghe +纵横zongheng +总后zonghou +总计zongji +踪迹zongji +宗教zongjiao +总结zongjie +总局zongju +总括zongkuo +总理zongli +总论zonglun +宗派zongpai +纵情zongqing +纵深zongshen +总是zongshi +纵使zongshi +总数zongshu +总算zongsuan +总体zongti +总统zongtong +总务zongwu +踪影zongying +总帐zongzhang +总政zongzheng +总之zongzhi +宗旨zongzhi +走zou +邹zou +奏zou +揍zou +诹zou +陬zou +鄹zou +驺zou +鲰zou +走访zoufang +邹虹zouhong +走私zousi +奏效zouxiao +酌情处理zqcl +中青年zqn +朝气蓬勃zqpb +准确无误zqww +正确性zqx +诸如此类zrcl +责任感zrg +自然界zrj +主人翁zrw +责任心zrx +责任制zrz +再生产zsc +自上而下zsex +知识分子zsfz +这时候zsh +知识化zsh +株式会社zshs +总书记zsj +装饰品zsp +综上所述zsss +之所以zsy +自始至终zszz +众所周知zszz +座谈会zth +组zu +族zu +足zu +阻zu +祖zu +租zu +卒zu +诅zu +俎zu +菹zu +镞zu +阻碍zuai +钻zuan +赚*zuan +纂zuan +攥zuan +缵zuan +躜zuan +钻研zuanyan +组成zucheng +阻挡zudang +组阁zuge +足够zugou +祖国zuguo +组合zuhe +最zui +罪zui +嘴zui +堆*zui +咀*zui +醉zui +蕞zui +最初zuichu +最大zuida +最低zuidi +罪恶zuie +罪犯zuifan +最高zuigao +罪过zuiguo +最好zuihao +最后zuihou +最坏zuihuai +最佳zuijia +最近zuijin +嘴脸zuilian +罪名zuiming +罪孽zuinie +罪人zuiren +最先zuixian +最小zuixiao +最新zuixin +醉心zuixin +罪行zuixing +罪责zuize +罪证zuizheng +最终zuizhong +罪状zuizhuang +阻击zuji +租界zujie +租借zujie +阻拦zulan +阻力zuli +租赁zulin +尊zun +遵zun +撙zun +樽zun +鳟zun +阻挠zunao +遵从zuncong +尊贵zungui +尊敬zunjing +遵守zunshou +遵循zunxun +尊严zunyan +遵照zunzhao +尊重zunzhong +作zuo +做zuo +左zuo +座zuo +坐zuo +昨zuo +撮*zuo +凿*zuo +搓*zuo +琢*zuo +佐zuo +柞zuo +阼zuo +唑zuo +嘬zuo +怍zuo +胙zuo +祚zuo +笮*zuo +作案zuoan +作弊zuobi +左边zuobian +坐标zuobiao +做到zuodao +作法zuofa +做法zuofa +作废zuofei +作风zuofeng +做工zuogong +作怪zuoguai +做好zuohao +作家zuojia +作客zuoke +作乐zuole +作乱zuoluan +坐落zuoluo +左派zuopai +作品zuopin +左倾zuoqing +做人zuoren +昨日zuori +做事zuoshi +坐视zuoshi +座谈zuotan +昨天zuotian +昨晚zuowan +作为zuowei +座位zuowei +坐位zuowei +作文zuowen +作物zuowu +作业zuoye +昨夜zuoye +作用zuoyong +左右zuoyou +作战zuozhan +作者zuozhe +作证zuozheng +作主zuozhu +做主zuozhu +做作zuozuo +足球zuqiu +阻塞zuse +祖师zushi +祖先zuxian +组长zuzhang +组织zuzhi +阻止zuzhi +祖宗zuzong +中外合资zwhz +责无旁贷zwpd +中宣部zxb +自行车zxc +自下而上zxes +忠心耿耿zxgg +展销会zxh +照相机zxj +争先恐后zxkh +中学生zxs +主席团zxt +中小学zxx +自信心zxx +中央办公厅zybt +着眼点zyd +专业对口zydk +中央电视台zydt +中央各部委zygw +专业化zyh +专业户zyh +中央军委zyjw +座右铭zym +中央全会zyqh +中央人民广播电台zyrt +主要人员zyry +专业人员zyry +中央书记处zysc +中央委员会zywh +中央委员zywy +重要性zyx +主要原因zyyy +中央政治局zyzj +专业知识zyzs +中组部zzb +组织部zzb +政治部zzb +政治处zzc +转折点zzd +置之度外zzdw +政治局zzj +自治区zzq +蒸蒸日上zzrs +组织上zzs +郑州市zzs +组织性zzx +自尊心zzx +赵紫阳zzy +总政治部zzzb +喷码pm +优喷yp +科技kj +比洋by +公司gs +有限公司yxgz +股份公司gfgs +企业qy +标准bz +喷码机pmj +电线dx +电缆dl +电线电缆dxdl +电力电缆dldl +绝缘jy +绝缘层jyc +导体dt +导线dx +电力dl +通信tx +控制电缆kzdl +补偿电缆bcdl +屏蔽电缆pbdl +高温电缆gwdl +计算机电缆jsjdl +信号电缆xhdl +同轴电缆tzdl +耐火电缆nhdl +船用电缆cydl +铝合金电缆lhjdl +单股dg +多股dg +连接lj +电路dl +电器dq +型号xh +铜t +铝l +铅包qb +铝包qb +聚氯乙烯jlyx +电磁线dcx +北京市bj +东城区dcq +西城区xcq +崇文区cwq +宣武区xwq +朝阳区zyq +海淀区hdq +丰台区ftq +房山区fsq +通州区tzq +顺义区syq +昌平区cpq +大兴区txq +怀柔区hrq +平谷区pgq +门头沟区mtgq +石景山区sjsq +天津市tjs +和平区hpq +河东区hdq +河西区hxq +南开区nkq +河北区hbq +红桥区hqq +塘沽区tgq +汉沽区hgq +大港区tgq +东丽区dlq +西青区xqq +北辰区bcq +津南区jnq +武清区wqq +宝坻区bdq +河北省hbs +辛集市xjs +藁城市gcs +晋州市jzs +新乐市xls +鹿泉市lqs +唐山市tss +遵化市zhs +安市as +邯郸市hds +武安市was +邢台市xts +南宫市ngs +沙河市shs +保定市bds +涿州市zzs +定州市dzs +安国市ags +承德市cds +沧州市czs +泊头市bts +任丘市rqs +黄骅市hhs +河间市hjs +廊坊市lfs +霸州市bzs +三河市shs +衡水市hss +冀州市jzs +深州市szs +石家庄市sjzs +张家口市zjks +高碑店市gbds +秦皇岛市qhds +山西省sxs +太原市tys +古交市gjs +大同市dts +阳泉市yqs +长治市czs +潞城市lcs +晋城市jcs +高平市gps +朔州市szs +晋中市jzs +介休市jxs +运城市ycs +河津市hjs +永济市sjs +忻州市xzs +原平市yps +临汾市lfs +侯马市hms +霍州市hzs +吕梁市lls +孝义市xys +汾阳市fys +内蒙古自治区nmg +包头市bts +乌海市whs +赤峰市cfs +通辽市tls +根河市ghs +丰镇市fzs +辽宁省LNS +沈阳市sys +新民市xms +大连市dls +庄河市zhs +鞍山市ass +海城市hcs +抚顺市fss +本溪市bxs +丹东市dds +东港市dgs +凤城市fcs +锦州市jzs +凌海市lhs +北宁市bns +营口市yks +盖州市gzs +阜新市fxs +辽阳市lys +灯塔市dts +盘锦市pjs +铁岭市tls +开原市kys +朝阳市zys +凌源市lys +北票市bps +兴城市xcs +大石桥市dsqs +瓦房店市wfds +普兰店市plds +调兵山市dbss +葫芦岛市hlds +吉林省jls +长春市ccs +九台市jts +榆树市yss +德惠市dhs +吉林市jls +舒兰市sls +桦甸市hds +蛟河市jhs +磐石市pss +四平市sps +双辽市sls +辽源市lys +通化市ths +集安市jas +白山市bss +临江市ljs +松原市sys +白城市bcs +大安市das +洮南市tns +延吉市yjs +图们市tms +敦化市ghs +龙井市ljs +珲春市hcs +和龙市hls +公主岭市gzls +梅河口市mhks +黑龙江省hljs +阿城市acs +尚志市szs +双城市scs +五常市wcs +讷河市nhs +鹤岗市hgs +鸡西市jxs +密山市mss +虎林市hls +大庆市dqs +伊春市ycs +铁力市tls +宁安市nas +海林市hls +穆棱市mls +同江市tjs +富锦市fjs +黑河市hhs +北安市bas +绥化市shs +安达市ads +肇东市zds +海伦市hls +七台河市qths +双鸭山市syss +牡丹江市mdjs +佳木斯市jmss +绥芬河市sfhs +哈尔滨市hebs +齐齐哈尔市qqhes +五大连池市wdlcs +上海市shs +黄浦区hpq +卢湾区lwq +徐汇区xhq +长宁区cnq +静安区jaq +普陀区ptq +闸北区zbq +虹口区hkq +杨浦区ypq +宝山区bsq +闵行区mxq +嘉定区jdq +松江区sjq +金山区jsq +青浦区qpq +南汇区nhq +奉贤区fxq +崇明县浦东新区cmxpdxq +江苏省jss +南京市njs +无锡市wxs +江阴市jys +宜兴市yxs +徐州市xzs +邳州市pzs +新沂市xys +常州市czs +金坛市jts +溧阳市lys +苏州市szs +常熟市css +太仓市dcs +昆山市hss +吴江市wjs +南通市nns +如皋市rgs +通州市tzs +海门市hms +启东市qds +淮安市has +盐城市ycs +东台市dts +大丰市dfs +扬州市yzs +高邮市gys +江都市jds +仪征市yzs +镇江市zjs +丹阳市dys +扬中市yzs +句容市jrs +泰州市dzs +泰兴市dxs +姜堰市jys +靖江市jjs +兴化市xhs +宿迁市sqs +连云港市lygs +张家港市zjgs +浙江省zjs +杭州市hzs +建德市jds +富阳市fys +临安市las +宁波市nbx +余姚市yys +慈溪市cxs +奉化市fhs +温州市wzs +瑞安市ras +乐清市lqs +嘉兴市jxs +海宁市hns +平湖市phs +桐乡市txs +湖州市hzs +绍兴市sxs +诸暨市zjs +上虞市sys +嵊州市szs +金华市jhs +兰溪市lxs +义乌市yws +东阳市dys +永康市yks +衢州市qzs +江山市jss +舟山市zss +台州市tzs +临海市lhs +丽水市lss +龙泉市lqs +安徽省ahs +合肥市hfs +芜湖市whs +蚌埠市bbs +淮南市hns +淮北市hbs +铜陵市tls +安庆市aqs +桐城市tcs +黄山市hss +滁州市czs +天长市dcs +明光市mgs +阜阳市fys +界首市jss +宿州市szs +巢湖市chs +六安市las +亳州市hzs +池州市czs +宣城市ycs +宁国市ngs +马鞍山市mass +福建省fjs +福州市fjs +福清市fqs +长乐市cls +厦门市xms +莆田市pts +三明市sms +永安市yas +泉州市qzs +石狮市sss +晋江市jjs +南安市nas +漳州市zzs +龙海市lhs +南平市nps +建瓯市jos +邵武市sws +建阳市jys +龙岩市lys +漳平市zps +宁德市nds +福安市fas +福鼎市fds +武夷山市wyss +江西省jxs +南昌市ncs +乐平市lps +萍乡市pxs +九江市jjs +瑞昌市rcs +新余市xys +鹰潭市yts +贵溪市gxs +赣州市gzs +瑞金市rjs +南康市nks +吉安市jas +宜春市ycs +丰城市fcs +樟树市zss +高安市gas +抚州市fzs +上饶市srs +德兴市dxs +井冈山市jgss +景德镇市jdzs +山东省sds +济南市jns +章丘市zqs +青岛市qds +胶南市jns +胶州市jzs +平度市pds +莱西市lxs +即墨市jms +淄博市zbs +枣庄市zzs +滕州市tzs +烟台市yts +龙口市lks +莱阳市lys +莱州市lzs +招远市zys +蓬莱市pls +栖霞市qxs +海阳市hys +潍坊市wfs +青州市qzs +诸城市zcs +寿光市sgs +安丘市aqs +高密市gms +昌邑市cys +济宁市jns +曲阜市qfs +兖州市yzs +邹城市zcs +泰安市tas +新泰市xts +肥城市fcs +威海市whs +乳山市rss +文登市wds +荣成市rcs +日照市rzs +莱芜市lws +临沂市lys +德州市dzs +乐陵市lls +禹城市ycs +聊城市lcs +临清市lqs +滨州市bzs +菏泽市hzs +河南省hns +郑州市zzs +巩义市gys +新郑市xzs +新密市xms +登封市dfs +荥阳市xys +开封市kfs +洛阳市lys +偃师市yss +汝州市rzs +舞钢市wgs +安阳市ays +林州市lzs +新乡市xxs +卫辉市whs +辉县市hxs +焦作市jzs +沁阳市qys +孟州市mzs +濮阳市pys +许昌市xcs +禹州市yzs +长葛市cgs +漯河市lhs +义马市yms +灵宝市lbs +南阳市nys +邓州市dzs +商丘市sqs +永城市ycs +信阳市xys +周口市zks +项城市dcs +济源市jys +三门峡市smxs +平顶山市pdss +驻马店市zmds +湖北省hbs +武汉市whs +黄石市hss +大冶市dys +十堰市sys +荆州市jzs +洪湖市hhs +石首市sss +松滋市szs +宜昌市ycs +宜都市yds +当阳市dys +枝江市jjs +襄樊市xfs +枣阳市zys +宜城市ycs +鄂州市ezs +荆门市jms +钟祥市zxs +孝感市xgs +应城市ycs +安陆市als +汉川市hcs +黄冈市hgs +麻城市mcs +武穴市wxs +咸宁市xns +赤壁市cbs +随州市szs +广水市gss +仙桃市xts +天门市tms +潜江市qjs +恩施市ess +利川市lcs +丹江口市djks +老河口市lhks +神农架林区snjlq +湖南省hns +长沙市css +浏阳市lys +株洲市zzs +醴陵市lls +湘潭市xts +湘乡市xxs +韶山市sss +衡阳市hys +耒阳市lys +常宁市cns +邵阳市sys +武冈市wgs +岳阳市yys +临湘市lxs +汨罗市mls +常德市cds +津市市jss +益阳市yys +沅江市yjs +郴州市czs +资兴市zxs +永州市yzs +怀化市hhs +洪江市hjs +娄底市lds +涟源市lys +吉首市jss +冷水江市lsjs +张家界市zjjs +广东省gds +广州市gzs +从化市chs +增城市zcs +深圳市szs +珠海市zhs +汕头市sts +韶关市sgs +乐昌市lcs +南雄市nxs +佛山市fss +江门市jms +台山市tss +开平市kps +鹤山市hss +恩平市eps +湛江市zjs +廉江市ljs +雷州市lzs +吴川市wcs +茂名市mms +西昌市xcs +峨眉山市emss +都江堰市djys +攀枝花市pzhs +贵州省gzs +贵阳市gys +清镇市qzs +遵义市zys +赤水市css +仁怀市rhs +安顺市ass +毕节市bjs +兴义市xys +凯里市kls +都匀市dys +福泉市fqs +六盘水市lpss +六枝特区lztq +万山特区wstq +云南省yns +昆明市kms +安宁市ans +曲靖市qjs +宣威市xws +玉溪市yxs +保山市bss +昭通市zts +丽江市ljs +思茅市sms +临沧市lqs +个旧市gjs +开远市kys +景洪市jhs +楚雄市cxs +大理市dls +潞西市lxs +瑞丽市rls +西藏自治区xzzzq +拉萨市lss +陕西省sxs +西安市xas +铜川市tcs +宝鸡市bjs +咸阳市xys +渭南市wns +韩城市hcs +华阴市hys +延安市yas +汉中市azs +榆林市yls +安康市aks +商洛市sls +甘肃省gss +兰州市lzs +金昌市jcs +白银市bys +天水市tss +武威市wws +张掖市zys +平凉市pls +酒泉市jqs +玉门市yms +敦煌市dhs +庆阳市qys +定西市dxs +陇南市lns +临夏市lxs +合作市hzs +嘉峪关市jygs +青海省qhs +西宁市xns +德令哈市dlhs +格尔木市gems +宁夏回族自治区nxhzzzq +银川市ycs +灵武市lws +吴忠市wzs +固原市gys +中卫市zws +石嘴山市szss +青铜峡市qtxs +新疆维吾尔自治区xjwwezzq +喀什市kss +昌吉市cjs +阜康市fks +米泉市mqs +博乐市bls +伊宁市yns +奎屯市kts +塔城市tcs +乌苏市wss +石河子市shzs +阿拉尔市ales +五家渠市wjqs +吐鲁番市tlfs +阿克苏市akss +阿图什市atss +库尔勒市kels +阿勒泰市alts +乌鲁木齐市wlmqs +克拉玛依市klmys +图木舒克市tmsks +香港特别行政区 +中西区zxq +东区dq +观塘区gtq +南区nq +湾仔区wzq +离岛区ldq +葵青区kqq +北区bq +西贡区xgq +沙田区stq +屯门区tmq +大埔区dpq +荃湾区qwq +元朗区ylq +九龙城区jtcq +油尖旺区yjwq +深水埗区ssbq +黄大仙区hdxq +台湾省tws +台北市tbs +高雄市gxs +基隆市jls +台中市tzs +台南市tns +新竹市xzs +嘉义市jys +板桥市bqs +宜兰市yls +竹北市zbs +桃园市tys +苗栗市mls +丰原市fys +彰化市zhs +南投市nts +太保市tbs +斗六市dls +新营市xys +凤山市fss +屏东市pds +台东市tds +花莲市hls +马公市mgs diff --git a/WINPY_utf8.txt.backup b/WINPY_utf8.txt.backup deleted file mode 100644 index 70fda10..0000000 --- a/WINPY_utf8.txt.backup +++ /dev/null @@ -1,21660 +0,0 @@ -安a -按a -爱a -阿a -暗a -啊a -埃a -碍a -凹a -奥a -岸a -矮a -案a -俺a -挨a -唉a -昂a -氨a -胺a -哎a -吖a -嗄a -腌a -锕a -按步就班abjb -阿飞afei -按规定agd -爱国主义agzy -安徽省ahs -爱ai -埃ai -碍ai -矮ai -挨ai -唉ai -哎ai -哀ai -皑ai -癌ai -蔼ai -艾ai -隘ai -呆*ai -捱ai -嗳ai -嗌ai -嫒ai -瑷ai -暧ai -砹ai -锿ai -霭ai -爱戴aidai -哀悼aidao -爱抚aifu -爱国aiguo -爱好aihao -爱护aihu -挨近aijin -暧昧aimei -爱幕aimu -爱情aiqing -哀求aiqiu -爱人airen -爱惜aixi -哀乐aiyue -癌症aizheng -按计划ajh -爱科学akx -阿拉伯alb -爱劳动ald -按劳分配alfp -按劳取酬alqc -安an -按an -广*an -厂*an -暗an -岸an -案an -俺an -氨an -胺an -鞍an -谙an -埯an -揞an -犴an -庵an -桉an -铵an -鹌an -黯an -暗暗anan -岸边anbian -暗藏ancang -安插ancha -暗淡andan -安定anding -安放anfang -昂ang -肮ang -盎ang -昂贵anggui -昂然angran -盎然angran -昂首angshou -昂扬angyang -肮脏angzang -暗害anhai -安徽anhui -案件anjian -暗箭anjian -安静anjing -鞍马anma -安谧anmi -按摩anmo -安宁anning -安排anpai -按期anqi -案情anqing -安全anquan -岸然anran -暗杀ansha -暗伤anshang -按时anshi -暗示anshi -暗室anshi -暗算ansuan -安慰anwei -安稳anwen -暗想anxiang -安详anxiang -案由anyou -按照anzhao -安置anzhi -暗中anzhong -安装anzhuang -凹ao -奥ao -敖ao -熬ao -翱ao -袄ao -傲ao -懊ao -澳ao -嚣*ao -坳ao -拗ao -嗷ao -岙ao -廒ao -遨ao -媪ao -骜ao -獒ao -聱ao -螯ao -鏊ao -鳌ao -鏖ao -懊悔aohui -傲慢aoman -奥秘aomi -奥秒aomiao -奥妙aomiao -懊丧aosang -翱翔aoxiang -安全生产aqsc -爱人民arm -按时完成aswc -按需分配axfp -奥运会ayh -阿姨ayi -爱祖国azg -不b -部b -本b -表b -把b -变b -比b -并b -别b -百b -报b -保b -病b -北b -被b -步b -边b -八b -办b -布b -把ba -八ba -吧ba -巴ba -拔ba -霸ba -罢ba -爸ba -坝ba -芭ba -捌ba -扒ba -叭ba -笆ba -疤ba -跋ba -靶ba -耙ba -茇ba -菝ba -岜ba -灞ba -钯ba -粑ba -鲅ba -魃ba -爸爸baba -把柄babing -八成bacheng -把持bachi -霸道badao -八方bafang -拔高bagao -罢工bagong -八股bagu -八卦bagua -把关baguan -罢官baguan -百bai -白bai -败bai -摆bai -伯*bai -柏bai -佰bai -拜bai -稗bai -捭bai -掰bai -百般baiban -百倍baibei -败北baibei -摆布baibu -白痴baichi -摆动baidong -摆渡baidu -拜访baifang -百分baifen -白宫baigong -白话baihua -败坏baihuai -百货baihuo -拜见baijian -败将baijiang -白金baijin -败局baiju -败类bailei -败露bailu -拜年bainian -摆弄bainong -白色baise -摆设baishe -白天baitian -摆脱baituo -拜托baituo -百万baiwan -百姓baixing -败仗baizhang -拔尖bajian -巴结bajie -八届bajie -罢了bale -巴黎bali -笆篱bali -罢免bamian -办ban -半ban -板ban -班ban -般ban -版ban -拌ban -搬ban -斑ban -扳ban -伴ban -颁ban -扮ban -瓣ban -绊ban -阪ban -坂ban -钣ban -瘢ban -癍ban -舨ban -办案banan -版本banben -半边banbian -颁布banbu -办厂banchang -班车banche -班次banci -半岛bandao -半点bandian -颁发banfa -办法banfa -班房banfang -帮bang -棒bang -邦bang -榜bang -梆bang -膀bang -绑bang -磅bang -蚌bang -镑bang -傍bang -谤bang -蒡bang -浜bang -帮会banghui -绑架bangjia -邦交bangjiao -邦联banglian -帮忙bangmang -办公bangong -帮派bangpai -帮腔bangqiang -帮手bangshou -傍晚bangwan -帮凶bangxiong -榜样bangyang -帮助bangzhu -版画banhua -班级banji -班机banji -半截banjie -半径banjing -办理banli -伴侣banlu -版面banmian -半年bannian -搬弄bannong -般配banpei -版权banquan -办事banshi -板书banshu -半月banyue -搬运banyun -班长banzhang -班子banzi -伴奏banzou -班组banzu -报bao -保bao -包bao -剥bao -薄bao -胞bao -暴bao -宝bao -饱bao -抱bao -爆bao -炮*bao -堡bao -刨*bao -苞bao -褒bao -雹bao -豹bao -鲍bao -曝*bao -瀑*bao -葆bao -孢bao -煲bao -鸨bao -褓bao -趵bao -龅bao -保安baoan -包办baoban -宝贝baobei -包庇baobi -褒庇baobi -褒贬baobian -报表baobiao -保镖baobiao -包藏baocang -包产baochan -保持baochi -报仇baochou -报酬baochou -保存baocun -报答baoda -报到baodao -报道baodao -报导baodao -暴发baofa -爆发baofa -报废baofei -暴风baofeng -报复baofu -抱负baofu -包袱baofu -报告baogao -包工baogong -保管baoguan -曝光baoguang -宝贵baogui -包含baohan -饱含baohan -包涵baohan -饱和baohe -保护baohu -报价baojia -保健baojian -报警baojing -暴君baojun -报刊baokan -宝库baoku -包括baokuo -包揽baolan -堡垒baolei -暴利baoli -暴力baoli -保留baoliu -暴露baolu -曝露baolu -暴乱baoluan -饱满baoman -保密baomi -报名baoming -报幕baomu -保姆baomu -爆破baopo -抱歉baoqian -报社baoshe -报失baoshi -宝石baoshi -保守baoshou -宝塔baota -报童baotong -报头baotou -暴徒baotu -保卫baowei -包围baowei -保险baoxian -报销baoxiao -包销baoxiao -暴行baoxing -保养baoyang -报应baoying -保佑baoyou -暴雨baoyu -抱怨baoyuan -包扎baoza -宝藏baozang -爆炸baozha -保障baozhang -保证baozheng -报纸baozhi -保重baozhong -爆竹baozhu -包装baozhuang -霸权baquan -跋涉bashe -把守bashou -扒手bashou -霸王bawang -把握bawo -把戏baxi -巴西baxi -罢休baxiu -八月bayue -霸占bazhan -巴不得bbd -并不是bbs -半边天bbt -本报讯bbx -北冰洋bby -不败之地bbzd -不白之冤bbzy -半成品bcp -不得不bdb -背道而驰bdec -标点符号bdfh -不断发展bdfz -不得了bdl -背地里bdl -不动声色bdss -半导体bdt -本单位bdw -北bei -被bei -倍bei -备bei -背bei -辈bei -贝bei -杯bei -卑bei -臂*bei -悲bei -碑bei -钡bei -狈bei -惫bei -焙bei -孛bei -陂bei -邶bei -埤bei -萆bei -蓓bei -呗bei -悖bei -碚bei -鹎bei -褙bei -鐾bei -鞴bei -悲哀beiai -备案beian -背包beibao -卑鄙beibi -北边beibian -北部beibu -被捕beibu -悲惨beican -被动beidong -北方beifang -备份beifen -悲愤beifen -被告beigao -悲观beiguan -被害beihai -背后beihou -悲欢beihuan -北极beiji -备件beijian -卑贱beijian -北京beijing -背景beijing -悲剧beiju -碑刻beike -备课beike -背离beili -卑劣beilie -北面beimian -北能beineng -悖逆beini -背叛beipan -被迫beipo -背弃beiqi -悲伤beishang -北宋beisong -背诵beisong -被套beitao -悲痛beitong -北纬beiwei -卑微beiwei -碑文beiwen -背心beixin -背影beiying -备用beiyong -备注beizhu -本ben -奔ben -苯ben -笨ben -夯*ben -畚ben -坌ben -贲ben -锛ben -本报benbao -奔波benbo -本部benbu -本厂benchang -奔驰benchi -本地bendi -奔放benfang -泵beng -崩beng -蚌*beng -绷beng -甭beng -蹦beng -迸beng -嘣beng -甏beng -绷带bengdai -迸发bengfa -崩溃bengkui -崩裂benglie -迸裂benglie -崩塌bengta -本国benguo -本届benjie -本科benke -本来benlai -本领benling -奔流benliu -奔命benming -本能benneng -本年bennian -本钱benqian -本人benren -本色bense -本身benshen -本事benshi -本市benshi -奔腾benteng -本文benwen -本校benxiao -本性benxing -本月benyue -本着benzhe -本质benzhi -本职benzhi -笨重benzhong -笨拙benzhuo -奔走benzou -百分比bfb -半封建bfj -百废具兴bfjx -暴风雪bfx -不管不顾bgbg -不甘落后bglh -办公室bgs -办公厅bgt -报告文学bgwx -闭关自守bgzs -不寒而栗bhel -百花齐放bhqf -百货商店bhsd -比bi -必bi -避bi -闭bi -辟bi -笔bi -壁bi -臂bi -毕bi -彼bi -逼bi -币bi -鼻bi -蔽bi -秘*bi -鄙bi -碧bi -蓖bi -毙bi -毖bi -庇bi -痹bi -敝bi -弊bi -陛bi -拂*bi -泌*bi -匕bi -俾bi -埤*bi -芘*bi -荜bi -荸bi -萆*bi -薜bi -吡bi -哔bi -狴bi -庳bi -愎bi -滗bi -濞bi -弼bi -妣bi -婢bi -嬖bi -璧bi -贲*bi -睥*bi -畀bi -铋bi -秕bi -裨bi -筚bi -箅bi -篦bi -舭bi -襞bi -跸bi -髀bi -变bian -边bian -便bian -编bian -遍bian -辩bian -扁bian -辨bian -鞭bian -贬bian -卞bian -辫bian -匾bian -弁bian -苄bian -忭bian -汴bian -缏bian -飚bian -煸bian -砭bian -碥bian -窆bian -褊bian -蝙bian -笾bian -鳊bian -彼岸bian -辨别bianbie -辩驳bianbo -鞭策biance -变成biancheng -编程biancheng -鞭笞bianchi -边陲bianchui -便当biandang -编导biandao -遍地biandi -贬低biandi -变动biandong -匾额biane -边防bianfang -变革biange -变更biangeng -变卦biangua -边关bianguan -便函bianhan -编号bianhao -辩护bianhu -变化bianhua -变换bianhuan -变幻bianhuan -边际bianji -编辑bianji -边疆bianjiang -辩解bianjie -边界bianjie -边境bianjing -便利bianli -变量bianliang -辩论bianlun -编码bianma -辩明bianming -编排bianpai -鞭炮bianpao -变迁bianqian -辨认bianren -鞭挞bianta -变态biantai -变天biantian -便条biantiao -变为bianwei -辨析bianxi -变相bianxiang -编写bianxie -变心bianxin -边沿bianyan -变样bianyang -贬义bianyi -便衣bianyi -编译bianyi -便于bianyu -边远bianyuan -边缘bianyuan -编造bianzao -编者bianzhe -辩证bianzheng -变质bianzhi -编制bianzhi -编织bianzhi -贬值bianzhi -编撰bianzhuan -辫子bianzi -编组bianzu -编纂bianzuan -表biao -标biao -彪biao -膘biao -勺*biao -婊biao -骠biao -杓biao -飑biao -飙biao -镖biao -镳biao -瘭biao -裱biao -鳔biao -髟biao -表白biaobai -标榜biaobang -标本biaoben -标兵biaobing -表层biaoceng -表达biaoda -标点biaodian -表格biaoge -标号biaohao -标记biaoji -标价biaojia -表决biaojue -标量biaoliang -表露biaolu -表面biaomian -表明biaoming -标明biaoming -标签biaoqian -表情biaoqing -表示biaoshi -表述biaoshu -表态biaotai -标题biaoti -表现biaoxian -表演biaoyan -表扬biaoyang -表语biaoyu -标语biaoyu -表彰biaozhang -标志biaozhi -标致biaozhi -标准biaozhun -臂膀bibang -必备bibei -弊病bibing -彼此bici -笔调bidiao -必定biding -笔端biduan -弊端biduan -别bie -鳖bie -憋bie -瘪bie -蹩bie -别称biecheng -别处biechu -别的biede -别动biedong -别管bieguan -别后biehou -憋脚biejiao -别看biekan -别离bieli -别名bieming -别扭bieniu -憋气bieqi -别人bieren -别墅bieshu -别提bieti -别样bieyang -别致biezhi -笔法bifa -比反bifan -比方bifang -逼供bigong -闭关biguan -庇护bihu -笔画bihua -避讳bihui -笔记biji -笔迹biji -比价bijia -必将bijiang -比较bijiao -逼近bijin -毕竟bijing -避开bikai -碧空bikong -比来bilai -碧蓝bilan -壁垒bilei -比例bili -碧绿bilu -避免bimian -笔名biming -闭幕bimu -宾bin -彬bin -斌bin -濒bin -滨bin -摈bin -傧bin -豳bin -缤bin -玢bin -槟bin -殡bin -膑bin -镔bin -髌bin -鬓bin -避难binan -彬彬binbin -鬓发binfa -缤纷binfen -并bing -病bing -兵bing -柄bing -冰bing -丙bing -饼bing -秉bing -炳bing -屏*bing -禀bing -邴bing -摒bing -槟*bing -冰雹bingbao -病变bingbian -兵变bingbian -并不bingbu -冰川bingchuan -并存bingcun -冰冻bingdong -病毒bingdu -并发bingfa -并非bingfei -禀赋bingfu -秉公binggong -病故binggu -病假bingjia -并肩bingjian -并进bingjin -并举bingju -病菌bingjun -冰冷bingleng -并力bingli -兵力bingli -并联binglian -并列binglie -兵马bingma -病魔bingmo -兵器bingqi -并且bingqie -病情bingqing -兵权bingquan -病人bingren -冰山bingshan -冰霜bingshuang -病态bingtai -兵团bingtuan -宾馆binguan -病危bingwei -并行bingxing -秉性bingxing -禀性bingxing -兵役bingyi -病因bingyin -兵营bingying -兵员bingyuan -病灶bingzao -兵站bingzhan -兵种bingzhong -并重bingzhong -比拟bini -濒临binlin -摈弃binqi -宾语binyu -逼迫bipo -必然biran -比如biru -比赛bisai -闭塞bise -毕生bisheng -必胜bisheng -比试bishi -笔试bishi -鄙视bishi -匕首bishou -避暑bishu -笔挺biting -比武biwu -避嫌bixian -必须bixu -必需bixu -碧血bixue -必要biyao -毕业biye -裨益biyi -鄙夷biyi -比喻biyu -笔者bizhe -逼真bizhen -比值bizhi -笔直bizhi -比重bizhong -鼻祖bizu -编辑部bjb -并驾齐驱bjqq -北京市bjs -不拘小节bjxj -八进制bjz -百家争呜bjzw -不可不bkb -不可否认bkfr -不可思议bksy -报刊杂志bkzz -拨乱反正blfz -博览会blh -不了了之bllz -芭蕾舞blw -不谋而合bmeh -表面化bmh -八面玲珑bmll -不能不bnb -百年大计bndj -苯鸟先飞bnxf -波bo -播bo -剥*bo -伯bo -拨bo -薄*bo -博bo -勃bo -驳bo -玻bo -泊bo -柏*bo -卜*bo -菠bo -钵bo -搏bo -铂bo -箔bo -帛bo -舶bo -脖bo -膊bo -渤bo -魄*bo -孛*bo -亳bo -啵bo -饽bo -檗bo -掰*bo -擘bo -礴bo -钹bo -鹁bo -簸bo -趵*bo -跛bo -踣bo -博爱boai -伯伯bobo -勃勃bobo -驳斥bochi -博大boda -驳倒bodao -博得bode -波动bodong -搏斗bodou -剥夺boduo -博古bogu -渤海bohai -驳回bohui -搏击boji -拨款bokuan -博览bolan -波浪bolang -玻璃boli -伯母bomu -勃然boran -薄弱boruo -博士boshi -播送bosong -波涛botao -博物bowu -博学boxue -剥削boxue -播音boyin -波折bozhe -播种bozhong -不求甚解bqsj -不切实际bqsj -霸权主义bqzy -薄弱环节brhj -必然性brx -不三不四bsbs -办事处bsc -不胜举bsj -本世纪bsj -办事员bsy -饱食终日bszr -半途而废btef -不同凡响btfx -遍体鳞伤btls -不bu -部bu -步bu -布bu -补bu -捕bu -埔*bu -卜bu -堡*bu -哺bu -埠bu -簿bu -怖bu -卟bu -逋bu -瓿bu -晡bu -钚bu -钸bu -醭bu -不安buan -不比bubi -不必bubi -不变bubian -不便bubian -步兵bubing -步步bubu -不曾buceng -补偿buchang -不啻buchi -补充buchong -不错bucuo -不大buda -不待budai -不但budan -不当budang -不得bude -不等budeng -步调budiao -不动budong -不断buduan -不对budui -部队budui -不法bufa -补发bufa -步伐bufa -不凡bufan -不妨bufang -不分bufen -部分bufen -不服bufu -不符bufu -不该bugai -不敢bugan -不甘bugan -布告bugao -不够bugou -不顾bugu -不管buguan -不过buguo -不会buhui -补给buji -部件bujian -不借bujie -不尽bujin -不仅bujin -不禁bujin -布景bujing -不久bujiu -补救bujiu -布局buju -不堪bukan -不可buke -不快bukuai -不愧bukui -不理buli -不利buli -不良buliang -不料buliao -步履bulu -不论bulun -部落buluo -不满buman -部门bumen -不免bumian -不能buneng -不怕bupa -补品bupin -不平buping -步枪buqiang -不屈buqu -不然buran -不如buru -不少bushao -不是bushi -不识bushi -部首bushou -部属bushu -部署bushu -补贴butie -不同butong -不妥butuo -部位buwei -部委buwei -不问buwen -不惜buxi -补习buxi -部下buxia -不行buxing -不幸buxing -步行buxing -不朽buxiu -不许buxu -哺养buyang -不要buyao -不宜buyi -不用buyong -哺育buyu -不在buzai -部长buzhang -不振buzhen -不只buzhi -不止buzhi -不知buzhi -不致buzhi -布置buzhi -步骤buzhou -补助buzhu -捕捉buzhuo -步子buzi -不足buzu -博物馆bwg -保卫祖国bwzg -标新立异bxly -必需品bxp -背信弃义bxqy -不相上下bxsx -不学无术bxws -不约而同byet -不言而喻byey -不要紧byj -边缘科学bykx -半夜三更bysg -别有天地bytd -必要性byx -不由自主byzz -编者按bza -不着边际bzbj -百折不挠bzbn -辩证法bzf -标准化bzh -标准件bzj -不知所措bzsc -不择手段bzsd -不至于bzy -标志着bzz -不正之风bzzf -产c -成c -出c -长c -从c -此c -常c -处c -车c -场c -传c -采c -层c -厂c -才c -次c -虫c -除c -查c -差c -擦ca -拆*ca -嚓ca -礤ca -采cai -才cai -材cai -菜cai -财cai -裁cai -彩cai -猜cai -睬cai -踩cai -蔡cai -财宝caibao -猜测caice -财产caichan -菜单caidan -彩电caidian -裁定caiding -采伐caifa -采访caifang -财富caifu -才干caigan -采购caigou -才华caihua -采集caiji -裁减caijian -财经caijing -采掘caijue -裁决caijue -采矿caikuang -财力caili -材料cailiao -财贸caimao -采纳caina -才能caineng -彩排caipai -裁判caipan -彩票caipiao -才气caiqi -采取caiqu -财权caiquan -猜拳caiquan -彩色caise -才识caishi -财团caituan -财物caiwu -财务caiwu -采撷caixie -才学caixue -菜肴caiyao -猜疑caiyi -采用caiyong -财源caiyuan -财政caizheng -才智caizhi -财主caizhu -才子caizi -参can -残can -蚕can -灿can -餐can -惭can -惨can -孱can -骖can -璨can -粲can -黪can -惨案canan -惨白canbai -残暴canbao -惨怛canda -残废canfei -藏cang -仓cang -苍cang -舱cang -沧cang -苍白cangbai -仓促cangcu -仓库cangku -苍老canglao -苍茫cangmang -藏匿cangni -苍穹cangqiong -沧桑cangsang -苍天cangtian -参观canguan -残骸canhai -残疾canji -参加canjia -参见canjian -残局canju -惨剧canju -参军canjun -参看cankan -参考cankao -残酷canku -惭愧cankui -灿烂canlan -参谋canmou -残缺canque -残忍canren -孱弱canruo -残杀cansha -残生cansheng -蚕食canshi -参数canshu -惨痛cantong -参与canyu -残余canyu -残月canyue -参阅canyue -参赞canzan -惨遭canzao -参战canzhan -参照canzhao -参政canzheng -惨重canzhong -草cao -槽cao -操cao -糙cao -曹cao -嘈cao -漕cao -螬cao -艚cao -草案caoan -草稿caogao -槽糕caogao -操劳caolao -操练caolian -草率caolu -草木caomu -草拟caoni -草签caoqian -操心caoxin -草原caoyuan -嘈杂caoza -操纵caozong -操作caozuo -差不多cbd -成本核算cbhs -出版社cbs -层出不穷ccbq -从长计议ccjy -存储器ccq -长春市ccs -成都市cds -测ce -策ce -侧ce -册ce -厕ce -恻ce -测定ceding -策动cedong -策反cefan -策划cehua -测量celiang -策略celue -侧面cemian -参*cen -岑cen -涔cen -涔涔cencen -层ceng -曾*ceng -蹭ceng -层层cengceng -层次cengci -曾经cengjing -测试ceshi -厕所cesuo -测验ceyan -侧重cezhong -出发点cfd -充分发挥cffh -唱高调cgd -从古到今cgdj -查cha -差cha -插cha -察cha -茶cha -叉cha -茬cha -碴cha -搽cha -岔cha -诧cha -刹*cha -喳*cha -嚓*cha -猹cha -馇cha -汊cha -姹cha -杈cha -楂cha -槎cha -檫cha -锸cha -镲cha -衩cha -查办chaban -差别chabie -差错chacuo -差点chadian -查对chadui -差额chae -查访chafang -察访chafang -查封chafeng -查获chahuo -差*chai -柴chai -拆chai -豺chai -侪chai -钗chai -瘥chai -虿chai -拆穿chaichuan -豺狼chailang -拆散chaisan -差使chaishi -拆卸chaixie -柴油chaiyou -差价chajia -差距chaju -察觉chajue -查看chakan -察看chakan -查考chakao -查明chaming -产chan -单*chan -铲chan -阐chan -搀chan -掺chan -蝉chan -馋chan -谗chan -缠chan -颤chan -冁chan -谄chan -蒇chan -廛chan -忏chan -潺chan -澶chan -孱*chan -羼chan -婵chan -骣chan -觇chan -禅chan -镡chan -蟾chan -躔chan -铲除chanchu -产地chandi -阐发chanfa -搀扶chanfu -长chang -常chang -场chang -厂chang -唱chang -肠chang -昌chang -倡chang -偿chang -畅chang -猖chang -尝chang -敞chang -裳*chang -倘*chang -伥chang -鬯chang -苌chang -菖chang -徜chang -怅chang -惝chang -阊chang -娼chang -嫦chang -昶chang -氅chang -鲳chang -长安changan -常常changchang -长城changcheng -长春changchun -畅达changda -倡导changdao -长度changdu -长短changduan -唱歌changge -常规changgui -长河changhe -场合changhe -偿还changhuan -厂家changjia -常见changjian -长江changjiang -长久changjiu -猖獗changjue -长空changkong -畅快changkuai -猖狂changkuang -场面changmian -长眠changmian -长年changnian -长篇changpian -长期changqi -长驱changqu -常任changren -长沙changsha -厂商changshang -常识changshi -尝试changshi -长寿changshou -常数changshu -场所changsuo -畅谈changtan -长途changtu -怅惘changwang -常委changwei -倘未changwei -常温changwen -常务changwu -畅想changxiang -畅销changxiao -倡议changyi -畅饮changyin -常用changyong -常有changyou -畅游changyou -长远changyuan -厂长changzhang -长征changzheng -厂址changzhi -常驻changzhu -婵娟chanjuan -蝉联chanlian -产量chanliang -缠绵chanmian -阐明chanming -产品chanpin -产权chanquan -缠绕chanrao -产生chansheng -禅师chanshi -阐述chanshu -产物chanwu -产销chanxiao -产业chanye -产值chanzhi -朝chao -超chao -潮chao -巢chao -抄chao -钞chao -嘲chao -吵chao -炒chao -绰*chao -剿*chao -怊chao -晁chao -焯*chao -耖chao -抄报chaobao -超产chaochan -超出chaochu -朝代chaodai -超额chaoe -嘲讽chaofeng -超过chaoguo -朝晖chaohui -超级chaoji -吵架chaojia -潮解chaojie -潮流chaoliu -抄录chaolu -吵闹chaonao -嘲弄chaonong -潮湿chaoshi -潮水chaoshui -抄送chaosong -超脱chaotuo -抄袭chaoxi -朝鲜chaoxian -嘲笑chaoxiao -巢穴chaoxue -朝阳chaoyang -朝野chaoye -超越chaoyue -超支chaozhi -查清chaqing -插曲chaqu -插入charu -查哨chashao -插手chashou -查收chashou -插图chatu -查问chawen -查询chaxun -茶叶chaye -差异chayi -查阅chayue -查证chazheng -岔子chazi -插足chazu -车che -彻che -尺*che -撤che -扯che -掣che -澈che -坼che -砗che -彻底chedi -车祸chehuo -车间chejian -车辆cheliang -陈chen -沉chen -称chen -衬chen -尘chen -臣chen -晨chen -沈*chen -郴chen -辰chen -忱chen -趁chen -伧chen -谌chen -谶chen -抻chen -嗔chen -宸chen -琛chen -榇chen -碜chen -龀chen -尘埃chenai -沉淀chendian -陈腐chenfu -沉浮chenfu -成cheng -程cheng -称cheng -城cheng -承cheng -乘cheng -呈cheng -盛*cheng -撑cheng -诚cheng -橙cheng -惩cheng -澄cheng -逞cheng -骋cheng -秤cheng -丞cheng -埕cheng -噌cheng -枨cheng -柽cheng -塍cheng -瞠cheng -铖cheng -铛cheng -裎cheng -蛏cheng -酲cheng -成败chengbai -承办chengban -惩办chengban -呈报chengbao -承包chengbao -成本chengben -成材chengcai -惩处chengchu -乘除chengchu -承担chengdan -承当chengdang -成都chengdu -程度chengdu -乘法chengfa -惩罚chengfa -成功chenggong -成规chenggui -成果chengguo -称号chenghao -称呼chenghu -成绩chengji -乘机chengji -成家chengjia -成见chengjian -成交chengjiao -承接chengjie -惩戒chengjie -成就chengjiu -乘客chengke -诚恳chengken -成立chengli -乘凉chengliang -成名chengming -成年chengnian -成批chengpi -成品chengpin -诚朴chengpu -逞强chengqiang -澄清chengqing -城区chengqu -成全chengquan -诚然chengran -成人chengren -承认chengren -成色chengse -成事chengshi -诚实chengshi -城市chengshi -承受chengshou -成熟chengshu -成为chengwei -称谓chengwei -成文chengwen -呈现chengxian -呈献chengxian -城乡chengxiang -成效chengxiao -称心chengxin -诚心chengxin -程序chengxu -乘虚chengxu -撑腰chengyao -诚意chengyi -成语chengyu -成员chengyuan -称赞chengzan -成长chengzhang -城镇chengzhen -称职chengzhi -诚挚chengzhi -趁机chenji -沉积chenji -陈迹chenji -沉浸chenjin -沉静chenjing -陈旧chenjiu -陈列chenlie -沉沦chenlun -沉闷chenmen -沉湎chenmian -沉默chenmo -沉溺chenni -陈设chenshe -陈述chenshu -陈说chenshuo -沉思chensi -沉痛chentong -衬托chentuo -沉吟chenyin -衬映chenying -趁早chenzao -沉重chenzhong -沉着chenzhuo -车皮chepi -扯皮chepi -撤退chetui -撤消chexiao -车站chezhan -撤职chezhi -持chi -尺chi -齿chi -吃chi -赤chi -池chi -迟chi -翅chi -斥chi -耻chi -痴chi -匙chi -弛chi -驰chi -侈chi -炽chi -傺chi -坻chi -墀chi -茌chi -叱chi -哧chi -啻chi -嗤chi -彳chi -饬chi -媸chi -敕chi -眵chi -鸱chi -瘛chi -褫chi -蚩chi -螭chi -笞chi -篪chi -豉chi -踟chi -魑chi -翅膀chibang -赤诚chicheng -驰骋chicheng -尺寸chicun -迟到chidao -赤道chidao -尺度chidu -迟钝chidun -吃喝chihe -迟缓chihuan -吃紧chijin -吃惊chijing -持久chijiu -吃苦chiku -吃亏chikui -吃力chili -炽烈chilie -齿轮chilun -持平chiping -痴情chiqing -炽热chire -耻辱chiru -池塘chitang -耻笑chixiao -赤心chixin -痴心chixin -迟疑chiyi -迟早chizao -斥责chize -叱咤chizha -持重chizhong -吃重chizhong -赤字chizi -催化剂chj -种*chong -虫chong -重*chong -充chong -冲chong -崇chong -涌*chong -宠chong -茺chong -忡chong -憧chong -铳chong -舂chong -艟chong -宠爱chongai -崇拜chongbai -充斥chongchi -冲刺chongci -冲淡chongdan -充当chongdang -重叠chongdie -冲动chongdong -宠儿chonger -充分chongfen -冲锋chongfeng -重复chongfu -崇高chonggao -重合chonghe -重婚chonghun -冲击chongji -重建chongjian -崇敬chongjing -憧憬chongjing -充满chongman -充沛chongpei -冲破chongpo -重庆chongqing -崇尚chongshang -重申chongshen -充实chongshi -冲刷chongshua -冲天chongtian -冲突chongtu -重温chongwen -冲洗chongxi -重新chongxin -重演chongyan -重印chongyin -充裕chongyu -充足chongzu -抽chou -仇chou -臭chou -酬chou -畴chou -踌chou -稠chou -愁chou -筹chou -绸chou -瞅chou -丑chou -俦chou -帱chou -惆chou -瘳chou -雠chou -筹办chouban -筹备choubei -惆怅chouchang -抽搐chouchu -踌躇chouchu -筹措choucuo -抽调choudiao -丑恶choue -仇恨chouhen -丑化chouhua -筹划chouhua -筹集chouji -筹建choujian -酬金choujin -抽空choukong -酬劳choulao -丑陋choulou -筹码chouma -稠密choumi -筹谋choumou -愁容chourong -抽象chouxiang -酬谢chouxie -抽噎chouye -出chu -处chu -除chu -初chu -础chu -触chu -楚chu -锄chu -储chu -畜*chu -橱chu -厨chu -躇chu -雏chu -滁chu -矗chu -搐chu -亍chu -刍chu -怵chu -憷chu -绌chu -杵chu -楮chu -樗chu -褚chu -蜍chu -蹰chu -黜chu -揣chuai -搋chuai -啜chuai -嘬*chuai -膪chuai -踹chuai -揣度chuaidu -揣摩chuaimo -传chuan -船chuan -穿chuan -串chuan -川chuan -椽chuan -喘chuan -舛chuan -遄chuan -巛chuan -氚chuan -钏chuan -舡chuan -传遍chuanbian -传标chuanbiao -传播chuanbo -船舶chuanbo -船埠chuanbu -穿插chuancha -传达chuanda -传单chuandan -传导chuandao -传递chuandi -床chuang -创chuang -窗chuang -闯chuang -疮chuang -幢chuang -怆chuang -创办chuangban -闯荡chuangdang -窗户chuanghu -创见chuangjian -创建chuangjian -闯劲chuangjin -创举chuangju -窗口chuangkou -创立chuangli -窗帘chuanglian -创始chuangshi -创新chuangxin -创业chuangye -创造chuangzao -创作chuangzuo -串联chuanlian -喘气chuanqi -传奇chuanqi -传染chuanran -传授chuanshou -传输chuanshu -传述chuanshu -传说chuanshuo -传送chuansong -传统chuantong -串通chuantong -喘息chuanxi -传讯chuanxun -传扬chuanyang -传阅chuanyue -传真chuanzhen -船只chuanzhi -穿着chuanzhuo -出版chuban -出榜chubang -储备chubei -出兵chubing -初步chubu -储藏chucang -出差chucha -出产chuchan -出场chuchang -出厂chuchang -处处chuchu -橱窗chuchuang -初次chuci -储存chucun -初等chudeng -出动chudong -触动chudong -出发chufa -触发chufa -除法chufa -处罚chufa -触犯chufan -出访chufang -除非chufei -处分chufen -出轨chugui -出海chuhai -吹chui -垂chui -锤chui -椎*chui -炊chui -捶chui -陲chui -棰chui -槌chui -吹棒chuibang -吹风chuifeng -吹拂chuifu -锤炼chuilian -吹牛chuiniu -垂青chuiqing -垂涎chuixian -吹嘘chuixu -垂直chuizhi -初级chuji -出击chuji -出界chujie -出境chujing -处境chujing -处决chujue -触觉chujue -除开chukai -出口chukou -出来chulai -除了chule -出力chuli -处理chuli -矗立chuli -初恋chulian -出笼chulong -出路chulu -出马chuma -出卖chumai -出面chumian -出名chuming -除名chuming -出没chumo -春chun -纯chun -醇chun -椿chun -唇chun -淳chun -蠢chun -莼chun -鹑chun -蝽chun -出纳chuna -春播chunbo -纯粹chuncui -纯度chundu -春分chunfen -春风chunfeng -春耕chungeng -春光chunguang -醇厚chunhou -春辉chunhui -春季chunji -春节chunjie -纯洁chunjie -纯净chunjing -纯利chunli -纯朴chunpu -春秋chunqiu -春色chunse -春笋chunsun -春天chuntian -处女chunu -触怒chunu -春意chunyi -纯真chunzhen -纯正chunzheng -戳chuo -绰chuo -啜*chuo -辍chuo -踔chuo -龊chuo -戳穿chuochuan -绰号chuohao -啜泣chuoqi -出品chupin -出奇chuqi -初期chuqi -出勤chuqin -出去chuqu -出让churang -出任churen -出入churu -出色chuse -出身chushen -出神chushen -出生chusheng -畜生chusheng -出事chushi -出世chushi -处世chushi -厨师chushi -出售chushou -处所chusuo -出庭chuting -锄头chutou -出土chutu -出外chuwai -除外chuwai -出席chuxi -出息chuxi -除夕chuxi -出现chuxian -初小chuxiao -雏形chuxing -储蓄chuxu -刍议chuyi -处于chuyu -初战chuzhan -处长chuzhang -出诊chuzhen -出征chuzheng -处置chuzhi -初中chuzhong -出租chuzu -此ci -次ci -刺ci -磁ci -雌ci -词ci -茨ci -疵ci -辞ci -慈ci -瓷ci -赐ci -伺*ci -兹*ci -茈ci -呲ci -祠ci -鹚ci -糍ci -慈爱ciai -辞别cibie -磁场cichang -磁带cidai -磁道cidao -此地cidi -词典cidian -辞典cidian -刺耳cier -词根cigen -刺骨cigu -此后cihou -词汇cihui -刺激ciji -赐教cijiao -此刻cike -刺客cike -词类cilei -辞令ciling -磁盘cipan -次品cipin -辞去ciqu -刺杀cisha -此时cishi -次数cishu -辞书cishu -词素cisu -祠堂citang -辞退citui -此外ciwai -慈祥cixiang -辞行cixing -词性cixing -雌雄cixiong -次序cixu -词序cixu -刺眼ciyan -次要ciyao -词语ciyu -赐予ciyu -此致cizhi -辞职cizhi -词缀cizhui -词组cizu -超级大国cjdg -参考书cks -参考消息ckxx -参考资料ckzl -触类旁通clpt -藏龙卧虎clwh -参谋长cmc -聪明才智cmcz -出谋划策cmhc -从难从严cncy -从cong -丛cong -聪cong -葱cong -囱cong -匆cong -苁cong -淙cong -骢cong -琮cong -璁cong -从此congci -匆匆congcong -匆促congcu -从而conger -从犯congfan -聪慧conghui -从来conglai -丛林conglin -匆忙congmang -聪明congming -从前congqian -从容congrong -从事congshi -丛书congshu -从速congsu -从新congxin -从严congyan -聪颖congying -葱郁congyu -从中congzhong -凑cou -楱cou -辏cou -腠cou -凑合couhe -凑巧couqiao -成品率cpl -成千上万cqsw -从容不迫crbp -承认错误crcw -趁热打铁crdt -措手不及csbj -出生率csl -长沙市css -炊事员csy -彻头彻尾ctcw -垂头丧气ctsq -粗cu -促cu -醋cu -簇cu -卒*cu -蔟cu -徂cu -猝cu -殂cu -酢cu -蹙cu -蹴cu -篡cuan -蹿cuan -窜cuan -攒*cuan -汆cuan -撺cuan -爨cuan -镩cuan -篡夺cuanduo -窜犯cuanfan -篡改cuangai -篡权cuanquan -粗暴cubao -粗糙cucao -粗犷cuguang -催cui -脆cui -淬cui -粹cui -摧cui -衰*cui -崔cui -瘁cui -翠cui -萃cui -啐cui -悴cui -璀cui -榱cui -毳cui -隹cui -摧残cuican -脆弱cuiruo -促进cujin -存cun -村cun -寸cun -蹲*cun -忖cun -皴cun -存储cunchu -存档cundang -存放cunfang -存款cunkuan -村落cunluo -存亡cunwang -存在cunzai -村镇cunzhen -村庄cunzhuang -村子cunzi -错cuo -措cuo -撮cuo -磋cuo -搓cuo -挫cuo -厝cuo -嵯cuo -脞cuo -锉cuo -矬cuo -痤cuo -瘥*cuo -鹾cuo -蹉cuo -错案cuoan -挫败cuobai -错处cuochu -措辞cuoci -错怪cuoguai -错过cuoguo -撮合cuohe -错觉cuojue -磋商cuoshang -挫伤cuoshang -措施cuoshi -错误cuowu -挫折cuozhe -错综cuozong -粗浅cuqian -促使cushi -粗俗cusu -粗心cuxin -粗壮cuzhuang -常委会cwh -崇文区cwq -常务委员会cwwh -乘务员cwy -诚心诚意cxcy -程序控制cxkz -程序设计cxsj -长远利益cyly -朝阳区cyq -财政部czb -错综复杂czfz -操之过急czgj -出租汽车czqc -此之外czw -财政危机czwj -创造性czx -操作系统czxt -操作员czy -持之以恒czyh -的d -大d -地d -动d -到d -对d -度d -多d -电d -党d -得d -定d -等d -斗d -当d -队d -都d -点d -代d -道d -大da -打da -达da -答da -搭da -塔*da -瘩da -耷da -哒da -嗒da -怛da -妲da -沓*da -疸da -褡da -笪da -靼da -鞑da -答案daan -打败dabai -大办daban -大半daban -打扮daban -答辩dabian -大伯dabo -大部dabu -达成dacheng -大胆dadan -搭档dadang -大道dadao -达到dadao -打倒dadao -大地dadi -大敌dadi -大抵dadi -打断daduan -大队dadui -大多daduo -大凡dafan -大夫dafu -大幅dafu -答复dafu -大概dagai -大纲dagang -大国daguo -大海dahai -大好dahao -大河dahe -大亨daheng -大会dahui -大*dai -代dai -带dai -待dai -袋dai -戴dai -呆dai -歹dai -傣dai -殆dai -贷dai -逮dai -怠dai -埭dai -甙dai -呔dai -岱dai -迨dai -骀dai -绐dai -玳dai -黛dai -呆板daiban -代表daibiao -逮捕daibu -逮逋daibu -代词daici -带动daidong -怠工daigong -代价daijia -贷款daikuan -带来dailai -代理daili -带领dailing -带路dailu -黛绿dailu -代码daima -怠慢daiman -待命daiming -代数daishu -代替daiti -带头daitou -歹徒daitu -待遇daiyu -呆滞daizhi -呆子daizi -打击daji -大家dajia -打搅dajiao -大街dajie -大捷dajie -打劫dajie -搭救dajiu -大局daju -答卷dajuan -打开dakai -耷拉dala -大力dali -大连dalian -大量daliang -打量daliang -大陆dalu -大略dalue -大妈dama -单dan -但dan -弹dan -担dan -石*dan -蛋dan -淡dan -胆dan -氮dan -丹dan -旦dan -耽dan -郸dan -掸dan -惮dan -诞dan -儋dan -萏dan -啖dan -澹*dan -殚dan -赕dan -眈dan -疸dan -瘅dan -聃dan -箪dan -大脑danao -担保danbao -单薄danbao -淡薄danbao -单产danchan -诞辰danchen -单纯danchun -单词danci -担当dandang -单调dandiao -单独dandu -单方danfang -担负danfu -党dang -当dang -档dang -挡dang -荡dang -谠dang -凼dang -菪dang -宕dang -砀dang -裆dang -单干dangan -胆敢dangan -档案dangan -当场dangchang -当初dangchu -当代dangdai -当地dangdi -单个dange -耽搁dange -党风dangfeng -党纲danggang -党纪dangji -党籍dangji -当即dangji -当家dangjia -当今dangjin -当局dangju -当量dangliang -当面dangmian -党内dangnei -当年dangnian -党派dangpai -当铺dangpu -当前dangqian -当然dangran -当日dangri -当时dangshi -当天dangtian -当头dangtou -党团dangtuan -当晚dangwan -党委dangwei -当先dangxian -党校dangxiao -当心dangxin -党性dangxing -荡漾dangyang -党员dangyuan -当月dangyue -党章dangzhang -当真dangzhen -党政dangzheng -当政dangzheng -当中dangzhong -当众dangzhong -当做dangzuo -单价danjia -担架danjia -胆量danliang -胆略danlue -淡漠danmo -胆怯danqie -丹青danqing -担任danren -单身danshen -诞生dansheng -但是danshi -胆识danshi -单体danti -丹田dantian -单位danwei -耽误danwu -单项danxiang -胆小danxiao -担心danxin -淡雅danya -弹药danyao -单一danyi -单元danyuan -但愿danyuan -单质danzhi -担子danzi -掸子danzi -单字danzi -到dao -道dao -导dao -刀dao -倒dao -稻dao -岛dao -捣dao -盗dao -蹈dao -祷dao -悼dao -叨dao -帱*dao -忉dao -氘dao -焘*dao -纛dao -倒闭daobi -到处daochu -悼词daoci -到达daoda -导弹daodan -道德daode -到底daodi -倒戈daoge -捣鬼daogui -捣毁daohui -到来daolai -到了daole -道理daoli -倒立daoli -道路daolu -捣乱daoluan -倒霉daomei -叨念daonian -道歉daoqian -刀枪daoqiang -盗窃daoqie -到时daoshi -导师daoshi -倒数daoshu -导体daoti -倒退daotui -导演daoyan -道义daoyi -盗用daoyong -岛屿daoyu -导致daozhi -大批dapi -大破dapo -打破dapo -大气daqi -大庆daqing -打扰darao -打扫dasao -大厦dasha -搭讪dashan -大赦dashe -大使dashi -大事dashi -大师dashi -大势dashi -大肆dasi -打算dasuan -大体dati -大厅dating -打听dating -大同datong -大小daxiao -大写daxie -答谢daxie -大选daxuan -大学daxue -大业daye -达因dayin -打印dayin -答应daying -大于dayu -大院dayuan -大约dayue -打仗dazhang -大致dazhi -大众dazhong -打字dazi -代办处dbc -得不偿失dbcs -大部分dbf -电报挂号dbgh -大不了dbl -大步流星dblx -对不起dbq -代表团dbt -电冰箱dbx -东城区dcq -到此为止dcwz -独创性dcx -调查研究dcyj -打成一片dcyp -打电话ddh -电动机ddj -对得起ddq -大多数dds -的de -得de -地*de -德de -底*de -锝de -得逞decheng -的当dedang -得当dedang -得到dedao -得分defen -德国deguo -得奖dejiang -得救dejiu -得了dele -得力deli -等deng -灯deng -登deng -邓deng -澄*deng -蹬deng -瞪deng -凳deng -噔deng -嶝deng -戥deng -磴deng -镫deng -簦deng -登场dengchang -等待dengdai -等到dengdao -灯光dengguang -等候denghou -等级dengji -登记dengji -等价dengjia -灯具dengju -登门dengmen -灯谜dengmi -登攀dengpan -登山dengshan -灯塔dengta -登台dengtai -等同dengtong -等闲dengxian -等于dengyu -登载dengzai -得胜desheng -得失deshi -得体deti -德行dexing -得以deyi -得意deyi -德育deyu -得志dezhi -得知dezhi -得罪dezui -大幅度dfd -多方面dfm -单方面dfm -电风扇dfs -大规模dgm -多功能dgn -大公无私dgws -帝国主义dgzy -电话号码dhhm -电化教育dhjy -大会堂dht -的*di -地di -第di -低di -敌di -底di -提*di -帝di -抵di -滴di -弟di -递di -堤di -迪di -笛di -狄di -涤di -翟di -嫡di -蒂di -缔di -氐di -籴di -诋di -谛di -邸di -坻*di -荻di -嘀di -娣di -绨di -柢di -棣di -觌di -砥di -碲di -睇di -镝di -羝di -骶di -嗲dia -电dian -点dian -垫dian -典dian -店dian -颠dian -淀dian -掂dian -滇dian -碘dian -靛dian -佃dian -甸dian -惦dian -奠dian -殿dian -阽dian -坫dian -巅dian -玷dian -钿dian -癜dian -癫dian -簟dian -踮dian -电报dianbao -点播dianbo -电场dianchang -电车dianche -电池dianchi -电传dianchuan -颠倒diandao -电灯diandeng -点滴diandi -奠定dianding -电动diandong -典范dianfan -淀粉dianfen -垫付dianfu -颠覆dianfu -电感diangan -典故diangu -电荷dianhe -电弧dianhu -电话dianhua -电汇dianhui -电机dianji -电极dianji -奠基dianji -惦记dianji -典籍dianji -点将dianjiang -电解dianjie -殿军dianjun -癫狂diankuang -电缆dianlan -电力dianli -电离dianli -典礼dianli -电流dianliu -电路dianlu -电脑diannao -电能dianneng -店铺dianpu -电气dianqi -电器dianqi -点燃dianran -电容dianrong -电扇dianshan -电视dianshi -电台diantai -电梯dianti -点头diantou -电网dianwang -电位dianwei -玷污dianwu -殿下dianxia -电线dianxian -癫痫dianxian -电信dianxin -典型dianxing -电讯dianxun -电压dianya -电影dianying -店员dianyuan -点阵dianzhen -点缀dianzhui -电子dianzi -点子dianzi -电阻dianzu -调diao -掉diao -吊diao -鸟*diao -碉diao -叼diao -雕diao -凋diao -刁diao -钓diao -铞diao -铫diao -貂diao -鲷diao -碉堡diaobao -凋敝diaobi -调查diaocha -吊车diaoche -调动diaodong -调度diaodu -钓饵diaoer -调换diaohuan -掉换diaohuan -雕刻diaoke -调令diaoling -刁难diaonan -调遣diaoqian -调任diaoren -雕塑diaosu -吊唁diaoyan -调用diaoyong -钓鱼diaoyu -调子diaozi -第八diba -地板diban -地步dibu -低沉dichen -抵触dichu -抵达dida -地带didai -低档didang -抵挡didang -地道didao -弟弟didi -地点didian -地段diduan -敌对didui -迭die -跌die -爹die -碟die -蝶die -谍die -叠die -垤die -堞die -揲die -喋die -牒die -瓞die -耋die -踮*die -蹀die -鲽die -迭起dieqi -第二dier -地方difang -低估digu -敌国diguo -帝国diguo -敌后dihou -诋毁dihui -低级diji -递加dijia -递减dijian -地窖dijiao -递交dijiao -缔交dijiao -缔结dijie -第九dijiu -敌军dijun -抵抗dikang -地牢dilao -地理dili -低劣dilie -第六diliu -低落diluo -地貌dimao -地面dimian -抵命diming -定ding -顶ding -钉ding -丁ding -订ding -盯ding -叮ding -鼎ding -锭ding -仃ding -啶ding -玎ding -腚ding -碇ding -町ding -铤*ding -疔ding -耵ding -酊ding -定案dingan -定产dingchan -丁当dingdang -顶点dingdian -定夺dingduo -定额dinge -顶峰dingfeng -顶锋dingfeng -定购dinggou -订购dinggou -订户dinghu -定货dinghuo -订货dinghuo -定价dingjia -定局dingju -定居dingju -定理dingli -订立dingli -鼎立dingli -定量dingliang -定律dinglu -定期dingqi -定然dingran -盯梢dingshao -定时dingshi -顶替dingti -定性dingxing -定型dingxing -定义dingyi -定语dingyu -定员dingyuan -订阅dingyue -订正dingzheng -叮嘱dingzhu -顶撞dingzhuang -钉子dingzi -嫡派dipai -地盘dipan -第七diqi -嫡亲diqin -敌情diqing -地球diqiu -地区diqu -的确dique -敌人diren -第三disan -地势dishi -第十dishi -滴水dishui -第四disi -地铁ditie -地图ditu -丢diu -铥diu -丢掉diudiao -丢脸diulian -丢失diushi -地位diwei -敌伪diwei -第五diwu -嫡系dixi -底细dixi -地下dixia -低下dixia -底下dixia -地形dixing -弟兄dixiong -第一diyi -敌意diyi -地域diyu -抵御diyu -缔造dizao -递增dizeng -地震dizhen -敌阵dizhen -地质dizhi -地址dizhi -抵制dizhi -底子dizi -弟子dizi -党纪国法djgf -当机立断djld -多劳多得dldd -大力发展dlfz -大力加强dljq -大力开展dlkz -独立自主dlzz -多面手dms -对内搞活dngh -多年来dnl -东南亚dny -动dong -东dong -冬dong -懂dong -洞dong -冻dong -董dong -栋dong -侗dong -恫dong -垌dong -咚dong -岽dong -峒dong -氡dong -胨dong -胴dong -硐dong -鸫dong -东北dongbei -东边dongbian -东部dongbu -洞察dongcha -动词dongci -动荡dongdang -懂得dongde -东方dongfang -东风dongfeng -动工donggong -东海donghai -恫吓donghe -动机dongji -冬季dongji -东家dongjia -冻结dongjie -动静dongjing -东京dongjing -动力dongli -动量dongliang -栋梁dongliang -动乱dongluan -动脉dongmai -东南dongnan -东欧dongou -动人dongren -动身dongshen -董事dongshi -动手dongshou -动态dongtai -冬天dongtian -动听dongting -动物dongwu -东西dongxi -洞悉dongxi -动向dongxiang -动心dongxin -东亚dongya -东洋dongyang -动摇dongyao -动用dongyong -动员dongyuan -动辄dongzhe -动作dongzuo -斗dou -都*dou -豆dou -读*dou -兜dou -抖dou -陡dou -逗dou -痘dou -蔸dou -窦dou -蚪dou -篼dou -兜风doufeng -逗号douhao -逗留douliu -斗室doushi -兜售doushou -斗争douzheng -斗志douzhi -斗智douzhi -抖嘴douzui -打破常规dpcg -地平线dpx -电器化dqh -待人接物drjw -第三产业dscy -第十二届dsej -大使馆dsg -到时候dsh -电视机dsj -多少年dsn -大失所望dssw -电视台dst -低三下四dsxs -第十一届dsyj -大踏步dtb -到头来dtl -大体上dts -大同小异dtxy -度du -都du -毒du -独du -读du -渡du -杜du -堵du -镀du -顿du -督du -犊du -睹du -赌du -肚du -妒du -芏du -嘟du -渎du -椟du -牍du -蠹du -笃du -髑du -黩du -断duan -端duan -段duan -短duan -锻duan -缎duan -椴duan -煅duan -簖duan -短波duanbo -短处duanchu -短促duancu -断定duanding -短短duanduan -断交duanjiao -断绝duanjue -锻练duanlian -锻炼duanlian -短路duanlu -段落duanluo -短评duanping -短期duanqi -短缺duanque -断然duanran -煅烧duanshao -断送duansong -短途duantu -端午duanwu -端详duanxiang -短小duanxiao -断言duanyan -端阳duanyang -短语duanyu -短暂duanzan -端正duanzheng -端庄duanzhuang -读报dubao -读本duben -赌博dubo -独裁ducai -毒草ducao -独唱duchang -独创duchuang -督促ducu -毒打duda -独到dudao -度过duguo -毒害duhai -毒化duhua -都会duhui -对dui -队dui -堆dui -敦*dui -兑dui -怼dui -憝dui -碓dui -对比duibi -队部duibu -对策duice -对称duichen -对此duici -对待duidai -对等duideng -对调duidiao -对方duifang -对付duifu -对话duihua -兑换duihuan -对讲duijiang -对抗duikang -对口duikou -对垒duilei -对立duili -对联duilian -队列duilie -对流duiliu -对面duimian -对内duinei -对偶duiou -对手duishou -对数duishu -对外duiwai -队伍duiwu -兑现duixian -对象duixiang -对应duiying -对于duiyu -队员duiyuan -堆栈duizhan -队长duizhang -对照duizhao -对证duizheng -对质duizhi -对峙duizhi -对准duizhun -镀金dujin -杜绝dujue -渡口dukou -都来dulai -独立duli -度量duliang -盾dun -吨dun -顿dun -蹲dun -敦dun -墩dun -囤dun -钝dun -遁dun -沌dun -炖dun -砘dun -礅dun -盹dun -镦dun -趸dun -蹲点dundian -顿号dunhao -囤积dunji -遁迹dunji -钝角dunjiao -顿时dunshi -敦实dunshi -多duo -度*duo -夺duo -朵duo -掇duo -哆duo -垛duo -躲duo -跺duo -舵duo -剁duo -惰duo -堕duo -驮*duo -咄duo -哚duo -沲duo -缍duo -柁duo -铎duo -裰duo -踱duo -多半duoban -躲避duobi -多变duobian -多边duobian -躲藏duocang -多次duoci -夺得duode -多端duoduan -多方duofang -躲开duokai -多亏duokui -夺魁duokui -堕落duoluo -多么duome -夺目duomu -多年duonian -多情duoqing -夺取duoqu -多少duoshao -多事duoshi -掇拾duoshi -舵手duoshou -多数duoshu -多谢duoxie -多心duoxin -惰性duoxing -多样duoyang -多余duoyu -多种duozhong -肚皮dupi -毒品dupin -毒气duqi -读取duqu -度日duri -读入duru -堵塞duse -毒蛇dushe -都是dushi -毒手dushou -读数dushu -读书dushu -毒素dusu -独特dute -读物duwu -毒药duyao -独占duzhan -读者duzhe -毒汁duzhi -渎职duzhi -赌注duzhu -杜撰duzhuan -独自duzi -党委会dwh -对外开放dwkf -敌我矛盾dwmd -对外贸易dwmy -大无畏dww -动物园dwy -当务之急dwzj -邓小平dxp -大学生dxs -大显身手dxss -大西洋dxy -大跃进dyj -打印机dyj -大有可为dykw -待业青年dyqn -掉以轻心dyqx -电影院dyy -大洋洲dyz -大有作为dyzw -党支部dzb -多种多样dzdy -党政机关dzjg -多种经营dzjy -断章取义dzqy -大自然dzr -德智体dzt -电子学dzx -党中央dzy -而e -二e -尔e -儿e -恶e -额e -恩e -俄e -耳e -饵e -蛾e -饿e -峨e -鹅e -讹e -娥e -厄e -扼e -遏e -鄂e -噩e -谔e -垩e -苊e -莪e -萼e -呃e -愕e -屙e -婀e -轭e -腭e -锇e -锷e -鹗e -颚e -鳄e -恶霸eba -恶毒edu -恶感egan -恶棍egun -噩耗ehao -恶化ehua -诶ei -二极管ejg -二进制ejz -恶劣elie -鹅毛emao -噩梦emeng -恶魔emo -耳目一新emyx -恩en -蒽en -摁en -恩爱enai -恩赐enci -恩典endian -恩惠enhui -恩情enqing -而er -二er -尔er -儿er -耳er -饵er -洱er -贰er -佴er -迩er -珥er -铒er -鸸er -鲕er -耳朵erduo -儿歌erge -耳光erguang -而后erhou -尔后erhou -二届erjie -而今erjin -而况erkuang -而且erqie -而是ershi -儿童ertong -儿戏erxi -而已eryi -耳语eryu -二月eryue -儿子erzi -扼杀esha -额外ewai -扼腕ewan -额外负担ewfd -恶习exi -恶心exin -恶性exing -恶性循环exxh -扼要eyao -厄运eyun -讹诈ezha -遏止ezhi -分f -发f -方f -法f -反f -放f -复f -风f -防f -非f -服f -肥f -副f -粉f -府f -夫f -负f -封f -富f -翻f -发fa -法fa -阀fa -乏fa -伐fa -罚fa -筏fa -珐fa -垡fa -砝fa -发报fabao -法宝fabao -发表fabiao -发布fabu -发财facai -发愁fachou -发出fachu -发达fada -发电fadian -法典fadian -法定fading -发动fadong -发放fafang -发奋fafen -发愤fafen -法官faguan -法规fagui -法国faguo -发慌fahuang -发挥fahui -发火fahuo -发给faji -发迹faji -法纪faji -发家fajia -发奖fajiang -发酵fajiao -罚金fajin -发觉fajue -发掘fajue -罚款fakuan -发狂fakuang -法郎falang -法令faling -法律falu -发落faluo -发明faming -反fan -翻fan -范fan -犯fan -饭fan -繁fan -泛fan -番fan -凡fan -烦fan -返fan -藩fan -帆fan -樊fan -矾fan -钒fan -贩fan -蕃fan -蘩fan -幡fan -梵fan -燔fan -畈fan -蹯fan -翻版fanban -反比fanbi -反驳fanbo -帆布fanbu -反常fanchang -范畴fanchou -犯愁fanchou -帆船fanchuan -饭店fandian -反动fandong -翻动fandong -反对fandui -繁多fanduo -反而faner -反复fanfu -方fang -放fang -防fang -访fang -房fang -纺fang -仿fang -妨fang -芳fang -肪fang -坊fang -邡fang -彷*fang -枋fang -钫fang -舫fang -鲂fang -妨碍fangai -方案fangan -反感fangan -防备fangbei -方便fangbian -防潮fangchao -方程fangcheng -放大fangda -放荡fangdang -防盗fangdao -方法fangfa -防范fangfan -防风fangfeng -防腐fangfu -仿佛fangfu -妨害fanghai -防护fanghu -防火fanghuo -放假fangjia -房间fangjian -方面fangmian -放牧fangmu -返工fangong -反攻fangong -放屁fangpi -放弃fangqi -防区fangqu -放任fangren -放哨fangshao -放射fangshe -方式fangshi -防守fangshou -放肆fangsi -放松fangsong -仿宋fangsong -翻滚fangun -方位fangwei -防卫fangwei -访问fangwen -房屋fangwu -放下fangxia -防线fangxian -方向fangxiang -芳香fangxiang -仿效fangxiao -放心fangxin -放行fangxing -方言fangyan -防疫fangyi -防御fangyu -仿造fangzao -仿照fangzhao -方针fangzhen -仿真fangzhen -防治fangzhi -仿制fangzhi -放置fangzhi -防止fangzhi -纺织fangzhi -房子fangzi -放纵fangzong -房租fangzu -番号fanhao -繁华fanhua -反悔fanhui -返回fanhui -反击fanji -反抗fankang -反馈fankui -泛滥fanlan -范例fanli -凡例fanli -翻脸fanlian -贩卖fanmai -繁忙fanmang -烦闷fanmen -反面fanmian -反目fanmu -烦恼fannao -反叛fanpan -犯人fanren -繁荣fanrong -反射fanshe -翻身fanshen -繁盛fansheng -凡是fanshi -凡事fanshi -繁琐fansuo -烦琐fansuo -翻腾fanteng -繁体fanti -饭桶fantong -发怒fanu -饭碗fanwan -范围fanwei -反问fanwen -反响fanxiang -返销fanxiao -反省fanxing -翻修fanxiu -繁衍fanyan -翻译fanyi -翻印fanyin -反应fanying -反映fanying -繁育fanyu -翻越fanyue -翻阅fanyue -贩运fanyun -繁杂fanza -烦燥fanzao -反正fanzheng -反之fanzhi -繁殖fanzhi -繁重fanzhong -贩子fanzi -犯罪fanzui -发起faqi -法权faquan -发射fashe -发生fasheng -发誓fashi -发售fashou -法庭fating -发现faxian -发泄faxie -发行faxing -发言fayan -发扬fayang -法医fayi -发育fayu -发源fayuan -法院fayuan -法则faze -发展fazhan -法制fazhi -法治fazhi -发作fazuo -奋不顾身fbgs -分崩离析fblx -副产品fcp -发电机fdj -发动机fdj -反动派fdp -分道扬镳fdyb -非fei -肥fei -飞fei -费fei -废fei -肺fei -沸fei -菲fei -匪fei -啡fei -诽fei -吠fei -芾fei -狒fei -悱fei -淝fei -妃fei -绯fei -榧fei -腓fei -斐fei -扉fei -镄fei -痱fei -蜚fei -篚fei -翡fei -霏fei -鲱fei -匪帮feibang -诽谤feibang -飞奔feiben -非常feichang -飞驰feichi -废除feichu -非但feidan -非得feide -沸点feidian -非法feifa -非凡feifan -肺腑feifu -绯红feihong -废话feihua -飞机feiji -飞溅feijian -费解feijie -费劲feijin -飞快feikuai -费力feili -肥料feiliao -废料feiliao -肥胖feipang -废品feipin -废弃feiqi -费神feishen -废水feishui -飞速feisu -沸腾feiteng -匪徒feitu -肥沃feiwo -废物feiwu -飞舞feiwu -飞翔feixiang -费心feixin -飞行feixing -废墟feixu -飞扬feiyang -扉页feiye -非议feiyi -费用feiyong -飞跃feiyue -肥皂feizao -飞涨feizhang -废止feizhi -非洲feizhou -妃子feizi -分fen -粉fen -奋fen -份fen -粪fen -纷fen -芬fen -愤fen -酚fen -吩fen -氛fen -坟fen -焚fen -汾fen -忿fen -偾fen -瀵fen -玢*fen -棼fen -鲼fen -鼢fen -分贝fenbei -分辩fenbian -分辨fenbian -粪便fenbian -分别fenbie -分部fenbu -分布fenbu -分册fence -分寸fencun -分担fendan -分得fende -分店fendian -奋斗fendou -分队fendui -分发fenfa -奋发fenfa -纷纷fenfen -吩咐fenfu -风feng -封feng -蜂feng -丰feng -缝feng -峰feng -锋feng -疯feng -奉feng -枫feng -烽feng -逢feng -冯feng -讽feng -凤feng -俸feng -酆feng -葑feng -唪feng -沣feng -砜feng -风暴fengbao -丰碑fengbei -封闭fengbi -风波fengbo -丰产fengchan -奉承fengcheng -讽刺fengci -封存fengcun -风度fengdu -分割fenge -分隔fenge -风发fengfa -风帆fengfan -丰富fengfu -奉告fenggao -风格fengge -奉公fenggong -风光fengguang -风寒fenghan -奉还fenghuan -凤凰fenghuang -烽火fenghuo -封建fengjian -风景fengjing -疯狂fengkuang -风浪fenglang -风力fengli -风流fengliu -丰满fengman -锋芒fengmang -风貌fengmao -奉命fengming -丰年fengnian -分工fengong -奉陪fengpei -风气fengqi -风情fengqing -风趣fengqu -奉劝fengquan -缝纫fengren -风骚fengsao -风沙fengsha -风尚fengshang -风声fengsheng -丰盛fengsheng -丰收fengshou -风霜fengshuang -风水fengshui -丰硕fengshuo -奉祀fengsi -风俗fengsu -封锁fengsuo -疯瘫fengtan -封条fengtiao -风头fengtou -分管fenguan -风味fengwei -缝隙fengxi -风险fengxian -奉献fengxian -风向fengxiang -风行fengxing -奉行fengxing -蜂拥fengyong -风云fengyun -风韵fengyun -风灾fengzai -疯子fengzi -风姿fengzi -分号fenhao -分毫fenhao -分红fenhong -粉红fenhong -分化fenhua -分会fenhui -焚毁fenhui -分级fenji -分解fenjie -分界fenjie -奋进fenjin -分居fenju -分开fenkai -愤慨fenkai -分类fenlei -分离fenli -奋力fenli -分量fenliang -分裂fenlie -纷乱fenluan -分娩fenmian -分秒fenmiao -分明fenming -粉末fenmo -坟墓fenmu -愤怒fennu -分派fenpai -分配fenpei -分批fenpi -分期fenqi -分歧fenqi -奋起fenqi -分清fenqing -分区fenqu -分散fensan -焚烧fenshao -分数fenshu -分说fenshuo -粉碎fensui -分摊fentan -粪土fentu -分外fenwai -氛围fenwei -分析fenxi -奋勇fenyong -分赃fenzang -奋战fenzhan -分支fenzhi -分子fenzi -分组fenzu -丰富多采ffdc -奋发图强fftq -反过来说fgls -反革命fgm -福建省fjs -封建主义fjzy -翻来覆去flfq -法律顾问flgw -分秒必争fmbz -发明创造fmcz -否fou -缶fou -否定fouding -否决foujue -否认fouren -否则fouze -费品率fpl -废寝忘食fqws -缝纫机frj -分水岭fsl -翻天复地ftfd -丰台区ftq -非同小可ftxk -繁体字ftz -复fu -服fu -副fu -府fu -夫fu -负fu -富fu -附fu -福fu -伏fu -符fu -幅fu -腐fu -浮fu -辅fu -付fu -腹fu -妇fu -孵fu -覆fu -扶fu -辐fu -傅fu -佛fu -缚fu -父fu -弗fu -甫fu -肤fu -氟fu -敷fu -拂fu -俘fu -涪fu -袱fu -抚fu -俯fu -釜fu -斧fu -脯fu -腑fu -赴fu -赋fu -阜fu -讣fu -咐fu -匐fu -凫fu -郛fu -芙fu -芾*fu -苻fu -茯fu -莩fu -菔fu -拊fu -呋fu -幞fu -怫fu -滏fu -艴fu -孚fu -驸fu -绂fu -绋fu -桴fu -赙fu -祓fu -砩fu -黻fu -黼fu -罘fu -稃fu -馥fu -蚨fu -蜉fu -蝠fu -蝮fu -麸fu -趺fu -跗fu -鲋fu -鳆fu -腐败fubai -复辟fubi -复查fucha -浮沉fuchen -扶持fuchi -付出fuchu -副词fuci -服从fucong -附带fudai -负担fudan -辅导fudao -浮雕fudiao -浮动fudong -幅度fudu -复发fufa -伏法fufa -夫妇fufu -覆盖fugai -讣告fugao -富贵fugui -符号fuhao -附和fuhe -符合fuhe -负荷fuhe -腐化fuhua -浮华fuhua -复活fuhuo -俘获fuhuo -伏击fuji -附加fujia -附件fujian -福建fujian -佛教fujiao -附近fujin -副刊fukan -俯瞰fukan -浮夸fukua -付款fukuan -腐烂fulan -福利fuli -浮力fuli -富丽fuli -妇联fulian -附录fulu -俘虏fulu -覆灭fumie -覆没fumo -父母fumu -富农funong -妇女funu -扶贫fupin -服气fuqi -福气fuqi -夫妻fuqi -付讫fuqi -肤浅fuqian -富强fuqiang -父亲fuqin -富饶furao -夫人furen -芙蓉furong -妇孺furu -负伤fushang -辐射fushe -复试fushi -腐蚀fushi -俯视fushi -副手fushou -复数fushu -负数fushu -附属fushu -富庶fushu -赋税fushui -伏特fute -覆亡fuwang -富翁fuweng -服务fuwu -复习fuxi -浮现fuxian -赋闲fuxian -浮想fuxiang -腐朽fuxiu -抚恤fuxu -敷衍fuyan -扶养fuyang -抚养fuyang -俯仰fuyang -副业fuye -服役fuyi -复印fuyin -富有fuyou -赋有fuyou -赋于fuyu -抚育fuyu -富裕fuyu -赋予fuyu -复员fuyuan -复原fuyuan -负约fuyue -复杂fuza -负载fuzai -附则fuze -负责fuze -负债fuzhai -付帐fuzhang -复制fuzhi -扶植fuzhi -附中fuzhong -福州fuzhou -抚州fuzhou -附注fuzhu -辅助fuzhu -扶助fuzhu -服装fuzhuang -附着fuzhuo -富足fuzu -辅佐fuzuo -服务部fwb -服务态度fwtd -服务员fwy -方兴未艾fxwa -奋勇当先fydx -翻一番fyf -风言风语fyfy -发扬光大fygd -复印机fyj -发言人fyr -风雨同舟fytz -房租费fzf -副总理fzl -纺织品fzp -福州市fzs -反作用fzy -副作用fzy -负责制fzz -发展中国家fzzj -个g -国g -工g -过g -高g -干g -关g -各g -革g -公g -根g -更g -改g -管g -光g -广g -果g -格g -共g -搞g -夹*ga -噶ga -嘎ga -胳*ga -尬ga -尕ga -尜ga -旮ga -钆ga -公安部gab -改gai -该gai -盖gai -概gai -钙gai -溉gai -芥*gai -丐gai -陔gai -垓gai -戤gai -赅gai -改变gaibian -改编gaibian -该当gaidang -改道gaidao -改动gaidong -改革gaige -改观gaiguan -改过gaiguo -改悔gaihui -改建gaijian -改进gaijin -概况gaikuang -概括gaikuo -改良gailiang -概率gailu -概论gailun -概貌gaimao -概念gainian -改期gaiqi -改善gaishan -概述gaishu -概叹gaitan -改天gaitian -改选gaixuan -概要gaiyao -改造gaizao -改正gaizheng -改装gaizhuang -改组gaizu -公安局gaj -干gan -杆gan -感gan -敢gan -赶gan -甘gan -肝gan -秆gan -柑gan -竿gan -赣gan -乾*gan -坩gan -苷gan -尴gan -擀gan -泔gan -淦gan -澉gan -绀gan -橄gan -旰gan -矸gan -疳gan -酐gan -干部ganbu -感触ganchu -干脆gancui -敢当gandang -甘当gandang -感到gandao -感动gandong -感恩ganen -刚gang -钢gang -缸gang -纲gang -岗gang -港gang -杠gang -冈gang -肛gang -扛*gang -戆gang -罡gang -筻gang -尴尬ganga -港澳gangao -刚才gangcai -钢材gangcai -刚刚ganggang -刚好ganghao -港口gangkou -纲领gangling -岗哨gangshao -钢铁gangtie -港湾gangwan -岗位gangwei -港务gangwu -刚要gangyao -纲要gangyao -刚毅gangyi -干旱ganhan -感化ganhua -干活ganhuo -肝火ganhuo -感激ganji -干劲ganjin -赶紧ganjin -干净ganjing -感觉ganjue -感慨gankai -甘苦ganku -赶快gankuai -赶忙ganmang -感冒ganmao -感情ganqing -感染ganran -干扰ganrao -干涉ganshe -干事ganshi -感受ganshou -甘肃gansu -感叹gantan -干线ganxian -感想ganxiang -敢想ganxiang -感谢ganxie -甘心ganxin -感性ganxing -感应ganying -敢于ganyu -干预ganyu -甘愿ganyuan -干燥ganzao -感召ganzhao -赣州ganzhou -敢做ganzuo -高gao -搞gao -告gao -稿gao -膏gao -篙gao -皋gao -羔gao -糕gao -镐gao -睾gao -诰gao -郜gao -藁gao -缟gao -槔gao -槁gao -杲gao -锆gao -高矮gaoai -高昂gaoang -告别gaobie -高产gaochan -高超gaochao -高潮gaochao -告成gaocheng -告辞gaoci -高大gaoda -高档gaodang -高等gaodeng -高地gaodi -高低gaodi -糕点gaodian -高度gaodu -告发gaofa -高峰gaofeng -高高gaogao -高歌gaoge -高贵gaogui -高喊gaohan -搞好gaohao -高呼gaohu -搞坏gaohuai -高级gaoji -告急gaoji -高价gaojia -高见gaojian -稿件gaojian -告捷gaojie -告诫gaojie -高龄gaoling -高楼gaolou -告密gaomi -高明gaoming -高能gaoneng -高攀gaopan -高频gaopin -高强gaoqiang -高山gaoshan -高尚gaoshang -高深gaoshen -告示gaoshi -高耸gaosong -高速gaosu -告诉gaosu -高温gaowen -高小gaoxiao -高校gaoxiao -高兴gaoxing -膏药gaoyao -高原gaoyuan -高涨gaozhang -高招gaozhao -高中gaozhong -告终gaozhong -告状gaozhuang -稿子gaozi -港澳同胞gatb -怪不得gbd -各部门gbm -各部委gbw -供不应求gbyq -故步自封gbzf -共产党gcd -共产党员gcdy -工程师gcs -顾此失彼gcsb -贯彻执行gczx -共产主义gczy -各地方gdf -各大军区gdjq -广东省gds -高档商品gdsp -各单位gdw -高等院校gdyx -固定资产gdzc -个ge -各ge -革ge -合*ge -格ge -割ge -歌ge -隔ge -盖*ge -哥ge -铬ge -阁ge -戈ge -葛ge -搁ge -鸽ge -胳ge -疙ge -蛤ge -咯*ge -屹*ge -鬲ge -仡ge -哿ge -圪ge -塥ge -嗝ge -纥*ge -搿ge -膈ge -硌ge -镉ge -袼ge -颌*ge -虼ge -舸ge -骼ge -隔壁gebi -戈壁gebi -个别gebie -歌唱gechang -各处gechu -革除gechu -疙瘩geda -各地gedi -格调gediao -隔断geduan -个个gege -各个gege -各国geguo -隔阂gehe -歌喉gehou -各级geji -各界gejie -格局geju -割据geju -隔绝gejue -各类gelei -隔离geli -割裂gelie -格律gelu -革命geming -隔膜gemo -根gen -跟gen -亘gen -茛gen -哏gen -艮gen -根本genben -根除genchu -根底gendi -更geng -耕geng -颈geng -庚geng -羹geng -埂geng -耿geng -梗geng -哽geng -赓geng -绠geng -鲠geng -耕地gengdi -更迭gengdie -更动gengdong -更多gengduo -更改genggai -梗概genggai -更高genggao -更换genghuan -更加gengjia -更为gengwei -颈项gengxiang -更新gengxin -哽咽gengyan -耕耘gengyun -更正gengzheng -耿直gengzhi -梗直gengzhi -耕种gengzhong -梗阻gengzu -耕作gengzuo -根基genji -根据genju -跟前genqian -跟随gensui -根源genyuan -根治genzhi -跟着genzhuo -根子genzi -跟踪genzong -搁浅geqian -歌曲gequ -个人geren -格式geshi -歌颂gesong -个体geti -格外gewai -各位gewei -歌舞gewu -阁下gexia -各项gexiang -革新gexin -个性gexing -格言geyan -各样geyang -歌咏geyong -搁置gezhi -各种gezhong -各族gezu -国防部gfb -各方面gfm -格格不入ggbr -归根到底ggdd -恭恭敬敬ggjj -滚瓜烂熟ggls -歌功颂德ggsd -共和国ghg -各行各业ghgy -干劲冲天gjct -各级党委gjdw -各级领导gjld -国家利益gjly -国计民生gjms -工具书gjs -各尽所能gjsn -国库券gkq -工矿企业gkqy -孤陋寡闻glgw -规律性glx -国民党gmd -革命化gmh -革命家gmj -国民经济gmjj -购买力gml -光明磊落gmll -光明日报gmrb -顾名思义gmsy -冠冕堂皇gmth -刮目相看gmxk -光明正大gmzd -工农兵gnb -国内外gnw -工农业gny -工gong -公gong -共gong -供gong -功gong -攻gong -红*gong -巩gong -贡gong -汞gong -宫gong -恭gong -龚gong -躬gong -弓gong -拱gong -珙gong -肱gong -蚣gong -觥gong -公安gongan -公报gongbao -工本gongben -公布gongbu -公差gongcha -公拆gongchai -工厂gongchang -功臣gongchen -工程gongcheng -共处gongchu -供词gongci -共存gongcun -公道gongdao -公德gongde -功德gongde -工地gongdi -公敌gongdi -宫殿gongdian -攻读gongdu -公费gongfei -公愤gongfen -工夫gongfu -功夫gongfu -公告gonggao -公共gonggong -巩固gonggu -公关gongguan -公害gonghai -公函gonghan -共和gonghe -工会gonghui -供给gongji -共计gongji -攻击gongji -功绩gongji -公家gongjia -公斤gongjin -恭敬gongjing -工具gongju -公开gongkai -功课gongke -公款gongkuan -功劳gonglao -公理gongli -公里gongli -公历gongli -公路gonglu -功率gonglu -公民gongmin -共鸣gongming -公墓gongmu -功能gongneng -工农gongnong -公判gongpan -公平gongping -公仆gongpu -供求gongqiu -工区gongqu -公然gongran -工人gongren -公认gongren -供认gongren -工伤gongshang -公社gongshe -公审gongshen -工时gongshi -公事gongshi -共事gongshi -公式gongshi -公署gongshu -公司gongsi -公私gongsi -公诉gongsu -宫廷gongting -共同gongtong -恭维gongwei -公文gongwen -公物gongwu -公务gongwu -恭喜gongxi -贡献gongxian -工效gongxiao -功效gongxiao -供销gongxiao -共性gongxing -工序gongxu -共需gongxu -功勋gongxun -供养gongyang -工业gongye -工艺gongyi -供应gongying -公用gongyong -共有gongyou -公元gongyuan -公园gongyuan -公约gongyue -公允gongyun -公债gongzhai -公章gongzhang -共振gongzhen -工整gongzheng -公正gongzheng -公证gongzheng -供职gongzhi -公众gongzhong -工资gongzi -工作gongzuo -够gou -构gou -沟gou -句*gou -狗gou -钩gou -勾gou -购gou -苟gou -垢gou -佝gou -诟gou -岣gou -遘gou -媾gou -缑gou -枸gou -觏gou -彀gou -笱gou -篝gou -鞲gou -构成goucheng -勾搭gouda -勾当goudang -媾和gouhe -沟壑gouhe -构件goujian -勾结goujie -购买goumai -苟且gouqie -构思gousi -沟通goutong -勾通goutong -构陷gouxian -勾销gouxiao -购销gouxiao -勾引gouyin -构造gouzao -购置gouzhi -钩子gouzi -国庆节gqj -共青团gqt -光荣榜grb -根深蒂固gsdg -瓜熟蒂落gsdl -公使馆gsg -各式各样gsgy -甘肃省gss -工商业gsy -个体户gth -改头换面gthm -高谈阔论gtkl -鼓gu -固gu -古gu -骨gu -故gu -顾gu -股gu -谷gu -估gu -雇gu -孤gu -姑gu -贾*gu -辜gu -菇gu -咕gu -箍gu -沽gu -蛊gu -嘏gu -诂gu -菰gu -呱gu -崮gu -汩gu -梏gu -轱gu -牯gu -牿gu -臌gu -毂gu -瞽gu -罟gu -钴gu -锢gu -鸪gu -鹄*gu -痼gu -蛄gu -酤gu -觚gu -鲴gu -鹘gu -挂gua -刮gua -瓜gua -括*gua -剐gua -寡gua -褂gua -卦gua -诖gua -呱gua -栝gua -胍gua -鸹gua -瓜分guafen -瓜葛guage -挂号guahao -怪guai -乖guai -拐guai -乖舛guaichuan -乖戾guaili -乖僻guaipi -乖巧guaiqiao -怪物guaiwu -怪异guaiyi -拐杖guaizhang -挂名guaming -关guan -管guan -观guan -官guan -灌guan -贯guan -惯guan -冠guan -馆guan -罐guan -棺guan -纶*guan -倌guan -莞guan -掼guan -涫guan -盥guan -鹳guan -矜guan -鳏guan -关闭guanbi -观测guance -观察guancha -贯彻guanche -贯穿guanchuan -管道guandao -官邸guandi -观点guandian -官方guanfang -光guang -广guang -逛guang -咣guang -犷guang -桄guang -胱guang -灌溉guangai -光标guangbiao -广播guangbo -广博guangbo -光彩guangcai -广场guangchang -光大guangda -广大guangda -广东guangdong -广度guangdu -广泛guangfan -广告guanggao -光顾guanggu -光滑guanghua -光辉guanghui -光景guangjing -广阔guangkuo -光芒guangmang -广袤guangmao -光明guangming -光盘guangpan -光谱guangpu -光荣guangrong -观光guanguang -广西guangxi -光线guangxian -广义guangyi -光阴guangyin -光涌guangyong -广州guangzhou -关怀guanhuai -挂念guanian -管家guanjia -关键guanjian -管教guanjiao -关节guanjie -冠军guanjun -关卡guanka -观看guankan -关口guankou -管理guanli -贯例guanli -惯例guanli -官吏guanli -关联guanlian -官僚guanliao -观摩guanmo -灌木guanmu -官能guanneng -观念guannian -关切guanqie -观赏guanshang -管事guanshi -管束guanshu -灌输guanshu -关税guanshui -官司guansi -贯通guantong -关头guantou -观望guanwang -关系guanxi -管辖guanxia -官衔guanxian -关心guanxin -惯性guanxing -关押guanya -惯用guanyong -关于guanyu -官员guanyuan -观战guanzhan -关照guanzhao -管制guanzhi -观止guanzhi -观众guanzhong -关注guanzhu -贯注guanzhu -馆子guanzi -挂失guashi -挂帅guashuai -鼓吹guchui -故此guci -古代gudai -孤单gudan -故地gudi -古典gudian -固定guding -鼓动gudong -股东gudong -古董gudong -孤独gudu -咕嘟gudu -孤儿guer -股份gufen -辜负gufu -骨干gugan -雇工gugong -故宫gugong -古怪guguai -蛊惑guhuo -规gui -贵gui -归gui -硅gui -鬼gui -轨gui -龟gui -桂gui -瑰gui -圭gui -闺gui -诡gui -癸gui -柜gui -跪gui -刽gui -傀*gui -炔*gui -匦gui -刿gui -庋gui -宄gui -妫gui -桧gui -炅gui -晷gui -皈gui -簋gui -鲑gui -鳜gui -诡辩guibian -贵宾guibin -归并guibing -规程guicheng -归档guidang -轨道guidao -规定guiding -归队guidui -规范guifan -规格guige -归公guigong -归功guigong -桂冠guiguan -归国guiguo -规划guihua -鬼话guihua -归还guihuan -诡计guiji -轨迹guiji -贵贱guijian -归咎guijiu -规矩guiju -瑰丽guili -鬼脸guilian -龟裂guilie -规律guilu -诡秘guimi -规模guimo -归纳guina -闺女guinu -规劝guiquan -贵人guiren -归属guishu -龟缩guisuo -柜台guitai -闺秀guixiu -归于guiyu -规则guize -规章guizhang -贵重guizhong -贵州guizhou -鬼子guizi -贵族guizu -归罪guizui -顾及guji -估计guji -古迹guji -顾忌guji -估价gujia -古今gujin -古旧gujiu -故旧gujiu -故居guju -顾客guke -孤苦guku -古老gulao -孤立guli -鼓励guli -估量guliang -顾虑gulu -估摸gumo -滚gun -辊gun -棍gun -衮gun -绲gun -磙gun -鲧gun -滚动gundong -姑娘guniang -雇农gunong -滚烫guntang -棍子gunzi -国guo -过guo -果guo -锅guo -郭guo -涡*guo -裹guo -馘guo -埚guo -掴guo -呙guo -帼guo -崞guo -猓guo -椁guo -虢guo -聒guo -蜾guo -蝈guo -过半guoban -国策guoce -国产guochan -过程guocheng -过错guocuo -过度guodu -过渡guodu -果断guoduan -国法guofa -国防guofang -过分guofen -果腹guofu -果敢guogan -国歌guoge -过关guoguan -过后guohou -国会guohui -国际guoji -国籍guoji -国家guojia -国界guojie -国境guojing -国库guoku -过来guolai -过量guoliang -过虑guolu -锅炉guolu -国民guomin -过目guomu -果木guomu -国难guonan -国内guonei -果皮guopi -果品guopin -国旗guoqi -过期guoqi -国情guoqing -国庆guoqing -过去guoqu -果然guoran -过少guoshao -过甚guoshen -过剩guosheng -过时guoshi -国事guoshi -过失guoshi -果实guoshi -过头guotou -国外guowai -国王guowang -过问guowen -国务guowu -过细guoxi -国药guoyao -国营guoying -过硬guoying -过于guoyu -果园guoyuan -果真guozhen -锅子guozi -顾盼gupan -孤僻gupi -股票gupiao -骨气guqi -姑且guqie -顾全guquan -固然guran -古人guren -骨肉gurou -故事gushi -股市gushi -固守gushou -估算gusuan -固体guti -骨头gutou -故土gutu -顾问guwen -古文guwen -谷物guwu -鼓舞guwu -姑息guxi -故乡guxiang -故意guyi -雇佣guyong -固有guyou -雇员guyuan -鼓掌guzhang -故障guzhang -固执guzhi -拐弯抹角gwmj -国务委员gwwy -国务院gwy -改邪归正gxgz -更新换代gxhd -各行其事gxqs -感性认识gxrs -广西壮族gxzz -工业化gyh -工艺流程gylc -工艺美术gyms -工业品gyp -工艺品gyp -贵阳市gys -公有制gyz -各种各样gzgy -工资级别gzjb -各族人民gzrm -工作上gzs -广州市gzs -贵州省gzs -各自为政gzwz -高瞻远瞩gzyz -高瞻远嘱gzyz -工作者gzz -和h -会h -后h -化h -好h -合h -还h -活h -很h -回h -号h -毫h -花h -或h -海h -话h -红h -火h -黄h -害h -哈ha -蛤*ha -虾*ha -铪ha -哈达hada -还hai -海hai -害hai -孩hai -骸hai -氦hai -亥hai -骇hai -嘿*hai -咳*hai -嗨hai -胲hai -醢hai -海岸haian -海拔haiba -海报haibao -害虫haichong -害处haichu -海岛haidao -海港haigang -海关haiguan -还好haihao -海疆haijiang -海军haijun -海浪hailang -海绵haimian -害怕haipa -海上haishang -还是haishi -海外haiwai -海湾haiwan -海峡haixia -海啸haixiao -害羞haixiu -海洋haiyang -还要haiyao -还有haiyou -海域haiyu -海员haiyuan -孩子haizi -含han -焊han -旱han -喊han -汉han -寒han -汗han -函han -韩han -酣han -憨han -邯han -涵han -罕han -翰han -撼han -捍han -憾han -悍han -邗han -菡han -撖han -阚han -瀚han -晗han -焓han -顸han -颔han -蚶han -鼾han -寒潮hanchao -寒带handai -行*hang -航hang -夯hang -杭hang -吭*hang -巷*hang -沆hang -绗hang -珩hang -颃hang -航标hangbiao -航程hangcheng -航船hangchuan -行当hangdang -航道hangdao -航海hanghai -行家hangjia -行距hangju -航空hangkong -行列hanglie -航路hanglu -航模hangmo -函购hangou -行情hangqing -航天hangtian -航线hangxian -航向hangxiang -航行hangxing -航运hangyun -杭州hangzhou -含糊hanhu -含混hanhun -旱季hanji -函件hanjian -罕见hanjian -汉奸hanjian -喊叫hanjiao -焊接hanjie -寒冷hanleng -翰林hanlin -寒流hanliu -函授hanshou -函数hanshu -酣睡hanshui -寒酸hansuan -捍卫hanwei -含蓄hanxu -寒暄hanxuan -涵养hanyang -含义hanyi -涵义hanyi -汉语hanyu -含冤hanyuan -旱灾hanzai -汉字hanzi -汉族hanzu -好hao -号hao -毫hao -耗hao -豪hao -郝hao -浩hao -镐*hao -壕hao -嚎hao -貉*hao -蒿hao -薅hao -嗥hao -嚆hao -濠hao -灏hao -昊hao -皓hao -颢hao -蚝hao -好比haobi -毫不haobu -号称haocheng -好处haochu -浩大haoda -好歹haodai -浩荡haodang -好的haode -浩繁haofan -耗费haofei -好感haogan -好汉haohan -豪华haohua -好坏haohuai -号角haojiao -耗竭haojie -豪杰haojie -浩劫haojie -好看haokan -毫厘haoli -号令haoling -号码haoma -豪迈haomai -毫毛haomao -毫米haomi -浩淼haomiao -好奇haoqi -豪强haoqiang -豪情haoqing -好人haoren -豪绅haoshen -毫升haosheng -好事haoshi -豪爽haoshuang -好似haosi -耗损haosun -号啕haotao -好听haoting -好玩haowan -毫无haowu -好象haoxiang -好些haoxie -好样haoyang -好意haoyi -号召haozhao -好转haozhuan -汇编程序hbcx -货币回笼hbhl -货币流通hblt -河北省hbs -湖北省hbs -汇编语言hbyy -或多或少hdhs -海淀区hdq -和he -合he -河he -何he -核he -赫he -荷he -褐he -喝he -贺he -呵he -禾he -吓*he -盒he -菏he -貉he -阂he -涸he -鹤he -诃he -劾he -壑he -嗬he -阖he -纥he -曷he -盍he -颌he -蚵he -翮he -和蔼heai -哈尔滨heb -合办heban -荷包hebao -河北hebei -何必hebi -合并hebing -哈尔滨市hebs -何不hebu -喝彩hecai -合唱hechang -何尝hechang -合成hecheng -呵斥hechi -何处hechu -河川hechuan -河床hechuang -贺词heci -何等hedeng -贺电hedian -核定heding -核对hedui -合法hefa -何妨hefang -合肥hefei -合格hege -和好hehao -赫赫hehe -合乎hehu -合伙hehuo -黑hei -嘿hei -黑暗heian -黑白heibai -黑帮heibang -嘿嘿heihei -黑人heiren -黑色heise -黑市heishi -黑夜heiye -合计heji -核计heji -和解hejie -合金hejin -何苦heku -何况hekuang -合理heli -合力heli -合流heliu -河流heliu -合谋hemou -和睦hemu -很hen -狠hen -痕hen -恨hen -河南henan -狠毒hendu -很多henduo -河内henei -行*heng -横heng -衡heng -恒heng -哼heng -亨heng -蘅heng -珩*heng -桁heng -横财hengcai -哼哧hengchi -横幅hengfu -横亘henggen -横贯hengguan -横祸henghuo -横加hengjia -衡量hengliang -横蛮hengman -横批hengpi -衡器hengqi -横扫hengsao -横竖hengshu -恒心hengxin -横行hengxing -恒星hengxing -很好henhao -贺年henian -痕迹henji -很快henkuai -狠心henxin -狠抓henzhua -和平heping -和气heqi -河渠hequ -赫然heran -河山heshan -和尚heshang -合适heshi -核实heshi -合算hesuan -核算hesuan -河滩hetan -合同hetong -贺喜hexi -和谐hexie -核心hexin -贺信hexin -和煦hexu -何以heyi -合影heying -合营heying -核准hezhun -合资hezi -赫兹hezi -合作hezuo -合法权益hfqy -合肥市hfs -宏观世界hgsj -化公为私hgws -好高务远hgwy -核工业部hgyb -海关总署hgzs -后顾之忧hgzy -呼和浩特hhht -轰轰烈烈hhll -换句话说hjhs -黄金时代hjsd -环境卫生hjws -后继有人hjyr -海枯石烂hksl -合理化hlh -糊里糊涂hlht -黑龙江hlj -汗流浃背hljb -汗马功劳hmgl -海南岛hnd -河南省hns -湖南省hns -红hong -洪hong -轰hong -烘hong -哄hong -虹hong -鸿hong -宏hong -弘hong -黉hong -訇hong -讧hong -荭hong -蕻hong -薨hong -闳hong -泓hong -红尘hongchen -轰动hongdong -洪都hongdu -洪峰hongfeng -鸿沟honggou -宏观hongguan -红光hongguang -红花honghua -红军hongjun -红利hongli -洪亮hongliang -轰隆honglong -弘论honglun -鸿毛hongmao -轰鸣hongming -哄骗hongpian -红旗hongqi -红人hongren -红色hongse -洪水hongshui -哄抬hongtai -宏图hongtu -宏伟hongwei -红星hongxing -弘扬hongyang -鸿运hongyun -红晕hongyun -轰炸hongzha -后hou -候hou -厚hou -侯hou -喉hou -猴hou -吼hou -堠hou -後hou -逅hou -瘊hou -篌hou -糇hou -鲎hou -骺hou -后备houbei -后辈houbei -后边houbian -厚薄houbo -候补houbu -后尘houchen -后代houdai -厚道houdao -厚度houdu -后盾houdun -后方houfang -后果houguo -后患houhuan -后悔houhui -后记houji -后进houjin -后劲houjin -后来houlai -喉咙houlong -后门houmen -后面houmian -后期houqi -后勤houqin -后人houren -喉舌houshe -厚实houshi -后嗣housi -后台houtai -后天houtian -后退houtui -后续houxu -候选houxuan -后裔houyi -后缀houzhui -和平共处hpgc -黄埔江hpj -后勤部hqb -何去何从hqhc -合情合理hqhl -好容易hry -好事多磨hsdm -胡思乱想hslx -航天工业部htgb -昏头昏脑hthn -欢天喜地htxd -和*hu -护hu -互hu -湖hu -呼hu -户hu -弧hu -乎hu -胡hu -糊hu -虎hu -忽hu -核*hu -瑚hu -戏*hu -壶hu -葫hu -蝴hu -狐hu -唬hu -沪hu -冱hu -唿hu -囫hu -岵hu -猢hu -怙hu -惚hu -浒hu -滹hu -琥hu -槲hu -轷hu -觳hu -烀hu -煳hu -戽hu -扈hu -祜hu -瓠hu -鹄hu -鹕hu -鹱hu -笏hu -醐hu -斛hu -化hua -花hua -话hua -划hua -滑hua -华hua -画hua -哗hua -猾hua -豁*hua -骅hua -桦hua -砉hua -铧hua -画报huabao -华北huabei -哗变huabian -话柄huabing -划拨huabo -划策huace -画册huace -华东huadong -花朵huaduo -花儿huaer -化肥huafei -花费huafei -划分huafen -化工huagong -华贵huagui -化合huahe -花卉huahui -坏huai -怀huai -划*huai -淮huai -槐huai -徊huai -踝huai -怀抱huaibao -淮北huaibei -坏处huaichu -怀古huaigu -淮海huaihai -怀恨huaihen -怀旧huaijiu -淮南huainan -怀念huainian -坏人huairen -坏事huaishi -怀疑huaiyi -怀着huaizhe -滑稽huaji -画家huajia -话剧huaju -哗啦huala -画廊hualang -华丽huali -画面huamian -化名huaming -还*huan -环huan -换huan -欢huan -缓huan -患huan -幻huan -焕huan -桓huan -唤huan -痪huan -豢huan -涣huan -宦huan -郇huan -奂huan -萑huan -擐huan -圜huan -獾huan -洹huan -浣huan -漶huan -寰huan -逭huan -缳huan -锾huan -鲩huan -鬟huan -华南huanan -欢畅huanchang -缓冲huanchong -幻灯huandeng -欢度huandu -焕发huanfa -黄huang -簧huang -荒huang -皇huang -慌huang -蝗huang -磺huang -凰huang -惶huang -煌huang -晃huang -幌huang -恍huang -谎huang -隍huang -徨huang -湟huang -潢huang -遑huang -璜huang -肓huang -癀huang -蟥huang -篁huang -鳇huang -磺胺huangan -皇朝huangchao -荒诞huangdan -晃荡huangdang -皇帝huangdi -荒废huangfei -黄海huanghai -黄河huanghe -恍惚huanghu -谎话huanghua -黄昏huanghun -黄金huangjin -皇历huangli -荒凉huangliang -荒乱huangluan -慌乱huangluan -慌忙huangmang -荒谬huangmiu -恍然huangran -黄色huangse -黄山huangshan -皇上huangshang -荒唐huangtang -环顾huangu -宦官huanguan -谎言huangyan -慌张huangzhang -幌子huangzi -缓和huanhe -欢呼huanhu -环环huanhuan -滑腻huani -花鸟huaniao -还给huanji -缓急huanji -还价huanjia -环节huanjie -环境huanjing -幻境huanjing -幻景huanjing -欢聚huanju -幻觉huanjue -欢乐huanle -缓慢huanman -患难huannan -唤起huanqi -缓期huanqi -欢庆huanqing -环球huanqiu -寰球huanqiu -换取huanqu -环绕huanrao -涣散huansan -欢声huansheng -环视huanshi -欢送huansong -换算huansuan -欢腾huanteng -欢喜huanxi -幻想huanxiang -欢笑huanxiao -欢心huanxin -欢欣huanxin -环行huanxing -缓刑huanxing -唤醒huanxing -幻影huanying -欢迎huanying -寰宇huanyu -还原huanyuan -患者huanzhe -滑坡huapo -花腔huaqiang -华侨huaqiao -划清huaqing -花圈huaquan -划拳huaquan -哗然huaran -华人huaren -花色huase -化身huashen -化石huashi -划算huasuan -话题huati -滑头huatou -花纹huawen -华夏huaxia -化纤huaxian -画像huaxiang -花絮huaxu -化学huaxue -画押huaya -化验huayan -花样huayang -华裔huayi -话音huayin -话语huayu -花园huayuan -画展huazhan -花招huazhao -华中huazhong -化装huazhuang -化妆huazhuang -湖北hubei -胡扯huche -弧度hudu -忽而huer -呼喊huhan -呼号huhao -呼唤huhuan -互惠huhui -会hui -回hui -灰hui -挥hui -辉hui -汇hui -毁hui -慧hui -恢hui -绘hui -惠hui -徽hui -溃*hui -堕*hui -徊*hui -蛔hui -悔hui -卉hui -晦hui -贿hui -秽hui -烩hui -讳hui -诲hui -诙hui -茴hui -荟hui -蕙hui -咴hui -哕hui -喙hui -隳hui -洄hui -浍hui -彗hui -缋hui -珲hui -桧*hui -晖hui -恚hui -虺hui -蟪hui -麾hui -灰暗huian -回报huibao -汇报huibao -回避huibi -汇编huibian -会场huichang -回潮huichao -灰尘huichen -回春huichun -荟萃huicui -回答huida -回荡huidang -回电huidian -汇兑huidui -挥发huifa -汇费huifei -会风huifeng -回复huifu -恢复huifu -悔改huigai -回顾huigu -惠顾huigu -悔过huiguo -会合huihe -回合huihe -汇合huihe -悔恨huihen -恢弘huihong -会话huihua -回话huihua -绘画huihua -毁坏huihuai -辉煌huihuang -挥霍huihuo -会集huiji -回击huiji -汇集huiji -回家huijia -会见huijian -会聚huiju -汇聚huiju -回扣huikou -汇款huikuan -回来huilai -回笼huilong -汇率huilu -贿赂huilu -会面huimian -毁灭huimie -回民huimin -汇票huipiao -回去huiqu -挥洒huisa -灰色huise -晦涩huise -回收huishou -回首huishou -会谈huitan -会堂huitang -会同huitong -回头huitou -回味huiwei -会晤huiwu -挥舞huiwu -悔悟huiwu -麾下huixia -回想huixiang -回响huixiang -诙谐huixie -灰心huixin -彗星huixing -会演huiyan -汇演huiyan -会议huiyi -回忆huiyi -回音huiyin -辉映huiying -会员huiyuan -会战huizhan -徽章huizhang -会诊huizhen -绘制huizhi -回转huizhuan -汇总huizong -回族huizu -户籍huji -呼叫hujiao -户口hukou -虎口hukou -护理huli -互利huli -护林hulin -呼噜hulu -胡乱huluan -忽略hulue -互勉humian -混hun -浑hun -荤hun -昏hun -婚hun -魂hun -诨hun -馄hun -阍hun -溷hun -湖南hunan -胡闹hunao -昏沉hunchen -混合hunhe -浑厚hunhou -昏黄hunhuang -混迹hunji -婚礼hunli -混乱hunluan -糊弄hunong -婚配hunpei -混入hunru -浑身hunshen -混同huntong -混淆hunxiao -婚姻hunyin -昏庸hunyong -混杂hunza -混帐hunzhang -混浊hunzhuo -浑浊hunzhuo -和*huo -活huo -或huo -火huo -货huo -获huo -伙huo -霍huo -豁huo -惑huo -祸huo -劐huo -藿huo -攉huo -嚯huo -夥huo -钬huo -锪huo -镬huo -耠huo -蠖huo -火把huoba -伙伴huoban -火暴huobao -货币huobi -火柴huochai -火车huoche -豁达huoda -获得huode -霍地huodi -活动huodong -伙房huofang -祸根huogen -祸害huohai -火候huohou -火化huohua -火花huohua -祸患huohuan -活活huohuo -伙计huoji -火箭huojian -火警huojing -火炬huoju -火坑huokeng -活力huoli -霍乱huoluan -活泼huopo -获取huoqu -豁然huoran -货色huose -火山huoshan -获胜huosheng -或是huoshi -伙食huoshi -祸首huoshou -伙同huotong -货物huowu -获悉huoxi -火线huoxian -活现huoxian -或许huoxu -火药huoyao -活页huoye -活跃huoyue -货运huoyun -火灾huozai -火葬huozang -或则huoze -或者huozhe -获准huozhun -湖泊hupo -忽然huran -呼声husheng -护士hushi -忽视hushi -湖水hushui -胡说hushuo -护送husong -胡同hutong -互通hutong -户头hutou -糊涂hutu -护卫huwei -呼吸huxi -互相huxiang -呼啸huxiao -虎穴huxue -护养huyang -呼应huying -呼吁huyu -护照huzhao -互助huzhu -毫无疑问hwyw -互相爱护hxah -横行霸道hxbd -互相帮助hxbz -欢欣鼓舞hxgw -候选人hxr -合作化hzh -杭州市hzs -化整为零hzwl -级j -就j -进j -加j -经j -家j -结j -阶j -间j -件j -及j -解j -较j -机j -军j -接j -教j -极j -九j -见j -基本国策jbgc -基本上jbs -据不完全统计jbwj -饥不择食jbzs -坚持不懈jcbx -集成电路jcdl -基础上jcs -绝大部分jdbf -坚定不移jdby -绝大多数jdds -鉴定会jdh -绝对化jdh -经得起jdq -见多识广jdsg -精打细算jdxs -接二连三jels -解放后jfh -解放军jfj -解放军报jfjb -解放前jfq -仅供参考jgck -机构改革jggg -坚固耐用jgny -襟怀坦白jhtb -计划性jhx -级ji -及ji -机ji -极ji -几ji -积ji -给ji -基ji -其*ji -记ji -己ji -期*ji -系*ji -革*ji -计ji -集ji -即ji -际ji -季ji -激ji -济ji -技ji -击ji -继ji -急ji -剂ji -既ji -纪ji -寄ji -挤ji -鸡ji -迹ji -绩ji -齐*ji -奇*ji -吉ji -脊ji -辑ji -籍ji -疾ji -肌ji -棘ji -畸ji -圾ji -稽ji -箕ji -饥ji -讥ji -姬ji -缉ji -汲ji -嫉ji -蓟ji -冀ji -伎ji -祭ji -悸ji -寂ji -忌ji -妓ji -藉ji -丌ji -亟ji -乩ji -剞ji -佶ji -偈ji -诘ji -墼ji -芨ji -芰ji -荠ji -蒺ji -蕺ji -掎ji -叽ji -咭ji -哜ji -唧ji -岌ji -嵴ji -洎ji -屐ji -骥ji -畿ji -玑ji -楫ji -殛ji -戟ji -戢ji -赍ji -觊ji -犄ji -齑ji -矶ji -羁ji -嵇ji -稷ji -瘠ji -虮ji -笈ji -笄ji -暨ji -跻ji -跽ji -霁ji -鲚ji -鲫ji -髻ji -麂ji -加jia -家jia -架jia -价jia -甲jia -夹jia -假jia -钾jia -贾jia -稼jia -驾jia -嘉jia -枷jia -佳jia -荚jia -颊jia -嫁jia -茄*jia -挟*jia -嘏*jia -伽jia -郏jia -葭jia -岬jia -浃jia -迦jia -珈jia -戛jia -胛jia -恝jia -铗jia -镓jia -痂jia -瘕jia -袷jia -蛱jia -笳jia -袈jia -跏jia -加班jiaban -甲板jiaban -加倍jiabei -甲虫jiachong -家畜jiachu -家当jiadang -家底jiadi -假定jiading -加法jiafa -家访jiafang -价格jiage -加工jiagong -佳话jiahua -家伙jiahuo -加急jiaji -嘉奖jiajiang -家教jiajiao -嫁接jiajie -佳节jiajie -假借jiajie -加紧jiajin -家境jiajing -家具jiaju -加剧jiaju -加快jiakuai -加仑jialun -加码jiama -假冒jiamao -家门jiamen -加密jiami -加冕jiamian -价目jiamu -间jian -件jian -见jian -建jian -坚jian -减jian -检jian -践jian -尖jian -简jian -碱jian -剪jian -艰jian -渐jian -肩jian -键jian -健jian -柬jian -鉴jian -剑jian -歼jian -监jian -兼jian -浅*jian -奸jian -箭jian -茧jian -舰jian -俭jian -笺jian -煎jian -缄jian -硷jian -拣jian -捡jian -荐jian -槛jian -贱jian -饯jian -溅jian -涧jian -僭jian -谏jian -谫jian -菅jian -蒹jian -搛jian -囝*jian -湔jian -蹇jian -謇jian -缣jian -枧jian -楗jian -戋jian -戬jian -牮jian -犍jian -毽jian -腱jian -睑jian -锏jian -鹣jian -裥jian -笕jian -翦jian -趼jian -踺jian -鲣jian -鞯jian -吉安jian -煎熬jianao -简报jianbao -渐变jianbian -简便jianbian -简编jianbian -鉴别jianbie -兼并jianbing -尖兵jianbing -剪裁jiancai -剪彩jiancai -检测jiance -检查jiancha -检察jiancha -监察jiancha -减产jianchan -建成jiancheng -简称jiancheng -坚持jianchi -简单jiandan -建党jiandang -减低jiandi -检点jiandian -间谍jiandie -坚定jianding -鉴定jianding -监督jiandu -间断jianduan -尖端jianduan -简短jianduan -舰队jiandui -健儿jianer -减法jianfa -肩负jianfu -将jiang -降jiang -讲jiang -强*jiang -江jiang -浆jiang -蒋jiang -奖jiang -疆jiang -僵jiang -姜jiang -桨jiang -匠jiang -酱jiang -茳jiang -洚jiang -绛jiang -缰jiang -犟jiang -礓jiang -耩jiang -糨jiang -豇jiang -奖杯jiangbei -疆场jiangchang -奖惩jiangcheng -僵持jiangchi -降低jiangdi -间隔jiange -讲稿jianggao -江湖jianghu -僵化jianghua -讲话jianghua -降级jiangji -降价jiangjia -讲解jiangjie -疆界jiangjie -将近jiangjin -奖金jiangjin -讲究jiangjiu -僵局jiangju -将军jiangjun -讲课jiangke -将来jianglai -讲理jiangli -奖励jiangli -降临jianglin -将领jiangling -降落jiangluo -江南jiangnan -奖品jiangpin -讲评jiangping -奖券jiangquan -江山jiangshan -讲师jiangshi -僵尸jiangshi -讲授jiangshou -讲述jiangshu -降水jiangshui -江苏jiangsu -讲台jiangtai -讲坛jiangtan -疆土jiangtu -坚固jiangu -兼顾jiangu -监管jianguan -建国jianguo -降温jiangwen -江西jiangxi -讲习jiangxi -匠心jiangxin -讲学jiangxue -讲演jiangyan -将要jiangyao -讲义jiangyi -僵硬jiangying -奖章jiangzhang -讲座jiangzuo -监护jianhu -简化jianhua -间或jianhuo -奸计jianji -歼击jianji -剪辑jianji -减价jianjia -渐渐jianjian -健将jianjiang -建交jianjiao -间接jianjie -见解jianjie -简介jianjie -简洁jianjie -简捷jianjie -渐进jianjin -监禁jianjin -检举jianju -艰巨jianju -坚决jianjue -健康jiankang -尖刻jianke -坚苦jianku -艰苦jianku -监牢jianlao -建立jianli -尖利jianli -简历jianli -简练jianlian -简陋jianlou -简略jianlue -健美jianmei -减免jianmian -歼灭jianmie -简明jianming -缄默jianmo -艰难jiannan -键盘jianpan -简拼jianpin -简朴jianpu -俭朴jianpu -坚强jianqiang -减轻jianqing -健全jianquan -兼任jianren -坚韧jianren -兼容jianrong -尖锐jianrui -减弱jianruo -艰涩jianse -鉴赏jianshang -减少jianshao -建设jianshe -艰深jianshen -见识jianshi -坚实jianshi -监视jianshi -建树jianshu -减速jiansu -检索jiansuo -践踏jianta -健谈jiantan -检讨jiantao -简体jianti -舰艇jianting -减退jiantui -健忘jianwang -间文jianwen -见闻jianwen -间隙jianxi -奸细jianxi -艰险jianxian -见效jianxiao -间歇jianxie -简写jianxie -坚信jianxin -艰辛jianxin -减刑jianxing -检修jianxiu -简讯jianxun -检验jianyan -简要jianyao -建议jianyi -坚毅jianyi -简易jianyi -奸淫jianyin -坚硬jianying -剪影jianying -鉴于jianyu -监狱jianyu -减员jianyuan -检阅jianyue -建造jianzao -简则jianze -坚贞jianzhen -监制jianzhi -简直jianzhi -兼职jianzhi -建筑jianzhu -简装jianzhuang -健壮jianzhuang -较jiao -教jiao -交jiao -角jiao -叫jiao -脚jiao -胶jiao -浇jiao -焦jiao -觉*jiao -校*jiao -搅jiao -酵jiao -郊jiao -铰jiao -窖jiao -椒jiao -礁jiao -骄jiao -娇jiao -嚼jiao -矫jiao -侥jiao -狡jiao -饺jiao -缴jiao -绞jiao -剿jiao -轿jiao -佼jiao -僬jiao -艽jiao -茭jiao -挢jiao -噍jiao -峤jiao -徼jiao -湫*jiao -姣jiao -敫jiao -皎jiao -鹪jiao -蛟jiao -醮jiao -跤jiao -鲛jiao -骄傲jiaoao -搅拌jiaoban -狡辩jiaobian -教材jiaocai -交叉jiaocha -教程jiaocheng -交错jiaocuo -较大jiaoda -交代jiaodai -交淡jiaodan -教导jiaodao -交点jiaodian -焦点jiaodian -校订jiaoding -角度jiaodu -校对jiaodui -较多jiaoduo -焦耳jiaoer -交锋jiaofeng -交付jiaofu -浇灌jiaoguan -娇贵jiaogui -叫喊jiaohan -较好jiaohao -叫好jiaohao -狡猾jiaohua -交换jiaohuan -叫唤jiaohuan -教诲jiaohui -缴获jiaohuo -交际jiaoji -矫健jiaojian -交接jiaojie -交界jiaojie -叫苦jiaoku -较快jiaokuai -教练jiaolian -较量jiaoliang -交流jiaoliu -搅乱jiaoluan -角落jiaoluo -叫骂jiaoma -剿灭jiaomie -酵母jiaomu -交纳jiaona -缴纳jiaona -娇嫩jiaonen -交配jiaopei -骄气jiaoqi -交情jiaoqing -郊区jiaoqu -叫嚷jiaorang -角色jiaose -交涉jiaoshe -教师jiaoshi -教授jiaoshou -教唆jiaosuo -脚踏jiaota -交谈jiaotan -教堂jiaotang -交替jiaoti -教条jiaotiao -交通jiaotong -郊外jiaowai -交往jiaowang -较为jiaowei -狡黠jiaoxia -叫嚣jiaoxiao -侥幸jiaoxing -绞刑jiaoxing -教学jiaoxue -教训jiaoxun -教养jiaoyang -骄阳jiaoyang -教益jiaoyi -交易jiaoyi -交谊jiaoyi -教育jiaoyu -教员jiaoyuan -狡诈jiaozha -校正jiaozheng -脚注jiaozhu -角逐jiaozhu -浇铸jiaozhu -校准jiaozhun -焦灼jiaozhuo -娇纵jiaozong -叫做jiaozuo -家谱jiapu -假期jiaqi -价钱jiaqian -加强jiaqiang -假日jiari -加入jiaru -假如jiaru -假若jiaruo -加上jiashang -假设jiashe -加深jiashen -假使jiashi -架势jiashi -驾驶jiashi -家属jiashu -假说jiashuo -加速jiasu -枷锁jiasuo -家庭jiating -家乡jiaxiang -假想jiaxiang -家业jiaye -加以jiayi -佳音jiayin -家用jiayong -加油jiayou -家园jiayuan -夹杂jiaza -加载jiazai -家长jiazhang -价值jiazhi -加重jiazhong -假装jiazhuang -嫁妆jiazhuang -架子jiazi -家族jiazu -击败jibai -羁绊jiban -几倍jibei -基本jiben -击毙jibi -级别jibie -疾病jibing -计策jice -基层jiceng -稽查jicha -机场jichang -集成jicheng -继承jicheng -计酬jichou -基础jichu -机床jichuang -几次jici -急促jicu -积存jicun -寄存jicun -极大jida -亟待jidai -激荡jidang -记得jide -基地jidi -机电jidian -极点jidian -基调jidiao -机动jidong -激动jidong -极度jidu -几度jidu -即度jidu -季度jidu -基督jidu -嫉妒jidu -忌妒jidu -极端jiduan -结jie -阶jie -解jie -接jie -节jie -家*jie -界jie -截jie -介jie -借jie -价*jie -届jie -街jie -揭jie -洁jie -杰jie -竭jie -皆jie -秸jie -劫jie -桔jie -捷jie -睫jie -姐jie -戒jie -藉jie -芥jie -疥jie -诫jie -楷*jie -偈*jie -讦jie -诘*jie -拮jie -喈jie -嗟jie -婕jie -孑jie -桀jie -碣jie -疖jie -颉jie -蚧jie -羯jie -鲒jie -骱jie -饥饿jie -结案jiean -洁白jiebai -接班jieban -捷报jiebao -戒备jiebei -结彩jiecai -节操jiecao -阶层jieceng -劫持jiechi -杰出jiechu -解除jiechu -接触jiechu -戒除jiechu -揭穿jiechuan -结存jiecun -解答jieda -接待jiedai -借贷jiedai -街道jiedao -解冻jiedong -阶段jieduan -截断jieduan -揭发jiefa -借方jiefang -解放jiefang -街坊jiefang -结构jiegou -解雇jiegu -借故jiegu -结果jieguo -结合jiehe -结核jiehe -结婚jiehun -阶级jieji -接见jiejian -节俭jiejian -借鉴jiejian -结交jiejiao -姐姐jiejie -接近jiejin -竭尽jiejin -结晶jiejing -捷径jiejing -洁净jiejing -解救jiejiu -结局jieju -解决jiejue -孑孓jiejue -解开jiekai -揭开jiekai -解渴jieke -接口jiekou -借口jiekou -借款jiekuan -竭力jieli -接连jielian -揭露jielu -戒律jielu -结论jielun -解闷jiemen -结盟jiemeng -界面jiemian -节目jiemu -揭幕jiemu -接纳jiena -解聘jiepin -解剖jiepou -节气jieqi -接洽jieqia -截取jiequ -既而jier -节日jieri -介入jieru -解散jiesan -介绍jieshao -节省jiesheng -届时jieshi -结实jieshi -解释jieshi -揭示jieshi -解手jieshou -接受jieshou -接收jieshou -结束jieshu -解说jieshuo -结算jiesuan -解体jieti -阶梯jieti -接替jieti -接头jietou -街头jietou -解脱jietuo -结尾jiewei -解围jiewei -接吻jiewen -解析jiexi -界线jiexian -界限jiexian -揭晓jiexiao -戒严jieyan -结业jieye -介意jieyi -接应jieying -结余jieyu -节约jieyue -结帐jiezhang -接着jiezhao -节制jiezhi -介质jiezhi -戒指jiezhi -借支jiezhi -截止jiezhi -借助jiezhu -节奏jiezou -杰作jiezuo -激发jifa -技法jifa -讥讽jifeng -几个jige -及格jige -技工jigong -记功jigong -机构jigou -叽咕jigu -机关jiguan -籍贯jiguan -极光jiguang -激光jiguang -记过jiguo -极好jihao -记号jihao -集合jihe -几何jihe -稽核jihe -几乎jihu -激化jihua -计划jihua -饥荒jihuang -机会jihui -集会jihui -击毁jihui -忌讳jihui -积极jiji -机件jijian -计件jijian -急件jijian -击剑jijian -即将jijiang -计较jijiao -季节jijie -急进jijin -基金jijin -机警jijing -即景jijing -寂静jijing -急救jijiu -积聚jiju -急剧jiju -急遽jiju -寄居jiju -季刊jikan -即刻jike -疾苦jiku -击溃jikui -积累jilei -极力jili -吉利jili -激励jili -伎俩jilia -计量jiliang -寂寥jiliao -激烈jilie -吉林jilin -机灵jiling -激流jiliu -记录jilu -纪律jilu -纪录jilu -辑录jilu -击落jiluo -急忙jimang -机密jimi -寂寞jimo -计谋jimou -进jin -金jin -近jin -紧jin -斤jin -今jin -尽jin -仅jin -劲jin -浸jin -禁jin -津jin -筋jin -锦jin -晋jin -巾jin -襟jin -谨jin -靳jin -烬jin -卺jin -荩jin -堇jin -噤jin -馑jin -廑jin -妗jin -缙jin -瑾jin -槿jin -赆jin -觐jin -衿jin -缉拿jina -济南jinan -禁闭jinbi -锦标jinbiao -进步jinbu -浸沉jinchen -进程jincheng -进出jinchu -紧凑jincou -近代jindai -劲敌jindi -进度jindu -金额jine -机能jineng -技能jineng -进而jiner -进犯jinfan -经jing -精jing -京jing -径jing -井jing -静jing -竟jing -晶jing -净jing -境jing -镜jing -景jing -警jing -劲*jing -茎jing -敬jing -惊jing -睛jing -竞jing -荆jing -兢jing -鲸jing -粳jing -痉jing -靖jing -刭jing -儆jing -阱jing -菁jing -獍jing -憬jing -泾jing -迳jing -弪jing -婧jing -肼jing -胫jing -腈jing -旌jing -靓*jing -敬爱jingai -警报jingbao -警备jingbei -精兵jingbing -精采jingcai -精彩jingcai -警察jingcha -经常jingchang -精粹jingcui -静电jingdian -经典jingdian -惊动jingdong -精度jingdu -经费jingfei -精干jinggan -竟敢jinggan -警告jinggao -经过jingguo -净化jinghua -精华jinghua -经济jingji -竞技jingji -荆棘jingji -精简jingjian -境界jingjie -警戒jingjie -经久jingjiu -惊恐jingkong -经理jingli -经历jingli -精力jingli -敬礼jingli -精练jinglian -精良jingliang -经络jingluo -精美jingmei -精密jingmi -精明jingming -进攻jingong -敬佩jingpei -精辟jingpi -景气jingqi -惊奇jingqi -精巧jingqiao -精确jingque -竟然jingran -竞赛jingsai -景色jingse -经商jingshang -精神jingshen -经手jingshou -经受jingshou -精髓jingsui -静态jingtai -惊叹jingtan -晶体jingti -警惕jingti -精通jingtong -镜头jingtou -筋骨jingu -禁锢jingu -尽管jinguan -巾帼jinguo -经委jingwei -警卫jingwei -敬畏jingwei -景物jingwu -精细jingxi -京戏jingxi -惊险jingxian -景象jingxiang -经销jingxiao -经心jingxin -精心jingxin -惊心jingxin -惊醒jingxing -竞选jingxuan -惊讶jingya -经验jingyan -敬仰jingyang -经营jingying -晶莹jingying -经由jingyou -境遇jingyu -精湛jingzhan -竞争jingzheng -精制jingzhi -径直jingzhi -精致jingzhi -静止jingzhi -净值jingzhi -竟址jingzhi -净重jingzhong -镜子jingzi -静坐jingzuo -近海jinhai -今后jinhou -近乎jinhu -进化jinhua -几年jinian -记念jinian -纪念jinian -晋级jinji -紧急jinji -近郊jinjiao -紧紧jinjin -仅仅jinjin -进军jinjun -进口jinkou -尽快jinkuai -近况jinkuang -进来jinlai -近来jinlai -尽力jinli -尽量jinliang -斤两jinliang -禁令jinling -劲旅jinlu -紧密jinmi -近年jinnian -今年jinnian -金牌jinpai -紧迫jinpo -近期jinqi -近前jinqian -金钱jinqian -尽情jinqing -进去jinqu -进取jinqu -禁区jinqu -近日jinri -今日jinri -金融jinrong -进入jinru -浸入jinru -谨慎jinshen -晋升jinsheng -今是jinshi -尽是jinshi -近视jinshi -金属jinshu -近似jinsi -紧缩jinsuo -今天jintian -津贴jintie -尽头jintou -劲头jintou -浸透jintou -进退jintui -今晚jinwan -今昔jinxi -尽心jinxin -进行jinxing -进修jinxiu -锦秀jinxiu -谨严jinyan -紧要jinyao -进展jinzhan -紧张jinzhang -今朝jinzhao -紧着jinzhe -禁止jinzhi -尽职jinzhi -进驻jinzhu -金子jinzi -炯jiong -窘jiong -迥jiong -炅*jiong -扃jiong -窘迫jiongpo -迥然jiongran -击破jipo -急迫jipo -及其jiqi -极其jiqi -激起jiqi -机器jiqi -机枪jiqiang -技巧jiqiao -急切jiqie -激情jiqing -汲取jiqu -集权jiquan -既然jiran -己任jiren -继任jiren -即日jiri -吉日jiri -肌肉jirou -极少jishao -寄生jisheng -即是jishi -及时jishi -几时jishi -计时jishi -即时jishi -即使jishi -记事jishi -基石jishi -集市jishi -级数jishu -基数jishu -计数jishu -记述jishu -技术jishu -祭祀jisi -激素jisu -急速jisu -计算jisuan -机体jiti -集体jiti -肌体jiti -几天jitian -集团jituan -寄托jituo -就jiu -九jiu -旧jiu -究jiu -久jiu -救jiu -酒jiu -纠jiu -揪jiu -玖jiu -韭jiu -灸jiu -厩jiu -臼jiu -舅jiu -咎jiu -疚jiu -僦jiu -啾jiu -阄jiu -柩jiu -桕jiu -鸠jiu -鹫jiu -赳jiu -鬏jiu -就餐jiucan -纠察jiucha -纠缠jiuchan -就此jiuci -就地jiudi -就范jiufan -纠纷jiufen -纠葛jiuge -救国jiuguo -救护jiuhu -救火jiuhuo -纠集jiuji -鸠集jiuji -救济jiuji -救急jiuji -九江jiujiang -九届jiujie -就近jiujin -酒精jiujing -究竟jiujing -救命jiuming -救生jiusheng -就是jiushi -就事jiushi -救亡jiuwang -久违jiuwei -酒窝jiuwo -酒席jiuxi -救险jiuxian -揪心jiuxin -救星jiuxing -就绪jiuxu -就学jiuxue -久仰jiuyang -就要jiuyao -就业jiuye -久远jiuyuan -九月jiuyue -救灾jiuzai -纠正jiuzheng -就职jiuzhi -救治jiuzhi -九洲jiuzhou -救助jiuzhu -极为jiwei -纪委jiwei -极限jixian -迹象jixiang -吉祥jixiang -讥笑jixiao -机械jixie -记性jixing -急性jixing -畸形jixing -即兴jixing -吉凶jixiong -几许jixu -积蓄jixu -继续jixu -记叙jixu -急需jixu -集训jixun -积压jiya -羁押jiya -给养jiyang -机要jiyao -纪要jiyao -给以jiyi -记忆jiyi -技艺jiyi -基因jiyin -急用jiyong -基于jiyu -急于jiyu -机遇jiyu -给予jiyu -寄予jiyu -觊觎jiyu -纪元jiyuan -集约jiyue -记载jizai -及早jizao -急躁jizao -激增jizeng -记帐jizhang -记者jizhe -集镇jizhen -机制jizhi -及至jizhi -机智jizhi -集中jizhong -击中jizhong -记住jizhu -基准jizhun -集资jizi -经济核算jjhs -聚精会神jjhs -将计就计jjjj -戒骄戒躁jjjz -近几年来jjnl -竭尽全力jjql -节假日jjr -积极性jjx -经济效益jjxy -兢兢业业jjyy -精简整编jjzb -叽叽喳喳jjzz -艰苦奋斗jkfd -尽可能jkn -教科书jks -俱乐部jlb -交流电jld -吉林省jls -价廉物美jlwm -纪律性jlx -纪念碑jnb -几年来jnl -近年来jnl -纪念品jnp -济南市jns -吉普车jpc -坚强不屈jqbq -奖勤罚懒jqfl -机器人jqr -急起直追jqzz -截然不同jrbt -兼容性jrx -积少成多jscd -金山公司jsgs -集思广益jsgy -精神焕发jshf -计算机jsj -尽善尽美jsjm -集市贸易jsmy -介绍人jsr -就是说jss -计算所jss -江苏省jss -举世闻名jswm -介绍信jsx -技术员jsy -计算中心jszx -交通部jtb -家庭出身jtcs -惊天动地jtdd -具体地说jtds -晶体管jtg -交通工具jtgj -脚踏实地jtsd -具体说来jtsl -具ju -据ju -局ju -举ju -车*ju -句ju -聚ju -距ju -巨ju -居ju -锯ju -剧ju -矩ju -拒ju -柜*ju -桔*ju -鞠ju -拘ju -狙ju -疽ju -驹ju -菊ju -咀ju -沮ju -踞ju -俱ju -惧ju -炬ju -倨ju -讵ju -苣ju -苴ju -莒ju -掬ju -遽ju -屦ju -琚ju -枸*ju -椐ju -榘ju -榉ju -橘ju -犋ju -飓ju -钜ju -锔ju -窭ju -裾ju -趄ju -醵ju -踽ju -龃ju -雎ju -瞿*ju -鞫ju -卷juan -捐juan -鹃juan -娟juan -倦juan -眷juan -绢juan -俊*juan -鄄juan -狷juan -涓juan -桊juan -蠲juan -锩juan -镌juan -隽juan -卷进juanjin -捐款juankuan -眷恋juanlian -眷念juannian -捐躯juanqu -卷入juanru -眷属juanshu -捐献juanxian -卷烟juanyan -卷帙juanzhi -捐助juanzhu -卷宗juanzong -举办juban -具备jubei -剧本juben -巨变jubian -局部jubu -拘捕jubu -剧场juchang -据此juci -巨大juda -举动judong -居多juduo -决jue -觉jue -绝jue -角*jue -脚*jue -掘jue -嚼*jue -撅jue -攫jue -抉jue -倔jue -爵jue -诀jue -厥jue -劂jue -谲jue -矍jue -蕨jue -嗟*jue -噘jue -噱jue -崛jue -獗jue -孓jue -珏jue -桷jue -橛jue -爝jue -镢jue -蹶jue -觖jue -巨额jue -诀别juebie -决不juebu -绝不juebu -决策juece -觉察juecha -觉得juede -决定jueding -决断jueduan -绝对juedui -绝迹jueji -倔强juejiang -绝交juejiao -绝径juejing -绝境juejing -绝句jueju -决裂juelie -绝路juelu -绝密juemi -绝妙juemiao -崛起jueqi -诀窍jueqiao -决赛juesai -绝食jueshi -决死juesi -决算juesuan -绝望juewang -爵位juewei -觉悟juewu -决心juexin -觉醒juexing -决议jueyi -绝缘jueyuan -抉择jueze -决战juezhan -绝招juezhao -绝症juezheng -巨幅jufu -居功jugong -鞠躬jugong -句号juhao -聚合juhe -聚会juhui -聚集juji -巨匠jujiang -拘谨jujin -拒绝jujue -咀嚼jujue -距离juli -举例juli -剧烈julie -拘留juliu -局面jumian -居民jumin -剧目jumu -军jun -均jun -菌jun -君jun -龟*jun -钧jun -峻jun -俊jun -竣jun -浚jun -郡jun -骏jun -捃jun -皲jun -筠jun -麇jun -军操juncao -君臣junchen -均等jundeng -军队jundui -军法junfa -军阀junfa -军服junfu -军港jungang -军工jungong -竣工jungong -均衡junheng -军火junhuo -拘泥juni -军机junji -军纪junji -军舰junjian -俊杰junjie -军垦junken -军粮junliang -军令junling -骏马junma -军民junmin -军旗junqi -峻峭junqiao -俊俏junqiao -军区junqu -军权junquan -军人junren -军事junshi -军师junshi -军属junshu -军团juntuan -军委junwei -军衔junxian -军校junxiao -军械junxie -军心junxin -俊秀junxiu -军需junxu -军训junxun -军医junyi -军营junying -军用junyong -军邮junyou -均匀junyun -军长junzhang -军政junzheng -君主junzhu -军装junzhuang -君子junzi -俱全juquan -居然juran -遽然juran -沮丧jusang -局势jushi -举手jushou -拘束jushu -据说jushuo -具体juti -剧团jutuan -据悉juxi -局限juxian -居心juxin -举行juxing -矩形juxing -巨型juxing -具有juyou -据有juyou -剧院juyuan -局长juzhang -剧照juzhao -举止juzhi -居中juzhong -剧终juzhong -巨著juzhu -居住juzhu -句子juzi -节外生枝jwsz -惊心动魄jxdp -继续革命jxgm -机械化jxh -江西省jxs -谨小慎微jxsw -局限性jxx -教育部jyb -进一步jyb -家用电器jydq -教育方针jyfz -家喻户晓jyhx -加以解决jyjj -记忆力jyl -精益求精jyqj -教研室jys -见义勇为jyyw -旧中国jzg -建筑物jzw -可k -开k -看k -克k -孔k -科k -口k -空k -苦k -快k -考k -刻k -靠k -况k -块k -困k -宽k -矿k -抗k -卡k -卡ka -喀ka -咖ka -咯ka -佧ka -咔ka -胩ka -喀嚓kacha -卡车kache -咖啡kafei -开kai -凯kai -揩kai -楷kai -慨kai -剀kai -垲kai -蒈kai -忾kai -恺kai -铠kai -锎kai -锴kai -开办kaiban -开遍kaibian -开采kaicai -开场kaichang -开车kaiche -开除kaichu -开创kaichuang -开导kaidao -开刀kaidao -开动kaidong -开端kaiduan -开发kaifa -开放kaifang -开封kaifeng -开赴kaifu -凯歌kaige -开关kaiguan -开航kaihang -开户kaihu -开花kaihua -开怀kaihuai -开荒kaihuang -开会kaihui -开掘kaijue -开垦kaiken -开口kaikou -开矿kaikuang -开阔kaikuo -开朗kailang -开郎kailang -开路kailu -开明kaiming -楷模kaimo -开幕kaimu -开炮kaipao -开辟kaipi -开启kaiqi -开枪kaiqiang -开窍kaiqiao -开设kaishe -开始kaishi -开庭kaiting -开头kaitou -开脱kaituo -开拓kaituo -开外kaiwai -开销kaixiao -开心kaixin -凯旋kaixuan -开学kaixue -开颜kaiyan -开业kaiye -开战kaizhan -开展kaizhan -开张kaizhang -开支kaizhi -看kan -刊kan -坎kan -槛*kan -堪kan -勘kan -砍kan -嵌*kan -侃kan -莰kan -阚*kan -戡kan -龛kan -瞰kan -勘测kance -勘察kancha -看出kanchu -看待kandai -看到kandao -刊登kandeng -看法kanfa -砍伐kanfa -抗kang -康kang -炕kang -慷kang -糠kang -扛kang -亢kang -伉kang -闶kang -钪kang -亢奋kangfen -康复kangfu -抗衡kangheng -抗击kangji -亢进kangjin -抗拒kangju -伉俪kangli -抗日kangri -看管kanguan -抗议kangyi -看见kanjian -坎坷kanke -看来kanlai -看齐kanqi -刊头kantou -看望kanwang -刊物kanwu -勘误kanwu -看样kanyang -刊载kanzai -考kao -靠kao -拷kao -烤kao -尻kao -栲kao -犒kao -铐kao -拷贝kaobei -靠边kaobian -考查kaocha -考察kaocha -考核kaohe -靠近kaojin -考究kaojiu -靠拢kaolong -考虑kaolu -考勤kaoqin -靠山kaoshan -考试kaoshi -考题kaoti -考验kaoyan -考证kaozheng -卡片kapian -看不惯kbg -看不起kbq -刻不容缓kbrh -开诚布公kcbg -矿产资源kczy -扩大化kdh -可ke -克ke -科ke -刻ke -客ke -壳ke -颗ke -棵ke -柯ke -呵*ke -坷ke -苛ke -磕ke -咳ke -渴ke -课ke -嗑ke -岢ke -恪ke -溘ke -骒ke -缂ke -珂ke -轲ke -氪ke -瞌ke -钶ke -锞ke -稞ke -疴ke -窠ke -颏ke -蝌ke -髁ke -可爱keai -科班keban -课本keben -可比kebi -刻薄kebo -可不kebu -客车keche -课程kecheng -可耻kechi -可恶kee -可风kefeng -可否kefou -克服kefu -可观keguan -客观keguan -可贵kegui -可好kehao -可恨kehen -刻划kehua -刻画kehua -克己keji -客机keji -科技keji -可见kejian -科教kejiao -可敬kejing -窠臼kejiu -科举keju -可靠kekao -苛刻keke -可口kekou -克扣kekou -刻苦keku -克拉kela -克朗kelang -颗粒keli -可怜kelian -科目kemu -肯ken -啃ken -垦ken -恳ken -裉ken -肯定kending -可能keneng -坑keng -吭keng -铿keng -坑道kengdao -坑害kenghai -铿锵kengqiang -恳切kenqie -恳求kenqiu -垦殖kenzhi -可怕kepa -磕碰kepeng -科普kepu -客气keqi -可亲keqin -可取kequ -客人keren -客商keshang -可是keshi -科室keshi -课堂ketang -客套ketao -课题keti -客体keti -客厅keting -磕头ketou -可望kewang -渴望kewang -可喜kexi -可惜kexi -可行kexing -科学kexue -科研keyan -可以keyi -可疑keyi -刻意keyi -科员keyuan -科长kezhang -可知kezhi -克制kezhi -狂风暴雨kfby -克己奉公kjfg -科技司kjs -苦口婆心kkpx -昆明市kms -可能性knx -孔kong -空kong -控kong -恐kong -倥kong -崆kong -箜kong -空白kongbai -恐怖kongbu -控拆kongchai -空洞kongdong -空额konge -空乏kongfa -控告konggao -空喊konghan -恐吓konghe -空话konghua -恐慌konghuang -空间kongjian -空降kongjiang -恐惧kongju -空军kongjun -空旷kongkuang -恐龙konglong -空虑konglu -恐怕kongpa -空气kongqi -空前kongqian -孔雀kongque -控诉kongsu -空谈kongtan -空头kongtou -空文kongwen -空隙kongxi -空闲kongxian -空想kongxiang -空虚kongxu -空运kongyun -控制kongzhi -空中kongzhong -口kou -扣kou -抠kou -寇kou -芤kou -蔻kou -叩kou -眍kou -筘kou -口岸kouan -叩拜koubai -口才koucai -扣除kouchu -口传kouchuan -口服koufu -口供kougong -口号kouhao -口红kouhong -口角koujiao -口径koujing -口诀koujue -口令kouling -扣留kouliu -口气kouqi -口腔kouqiang -口哨koushao -口试koushi -口述koushu -口头koutou -叩头koutou -口信kouxin -扣押kouya -口语kouyu -看起来kql -口若悬河krxh -口是心非ksxf -苦ku -库ku -枯ku -酷ku -哭ku -窟ku -裤ku -刳ku -堀ku -喾ku -绔ku -骷ku -跨kua -夸kua -垮kua -挎kua -胯kua -侉kua -跨步kuabu -夸大kuada -跨度kuadu -会*kuai -快kuai -块kuai -筷kuai -侩kuai -蒯kuai -郐kuai -哙kuai -狯kuai -浍*kuai -脍kuai -会计kuaiji -快乐kuaile -快速kuaisu -宽kuan -款kuan -髋kuan -宽敞kuanchang -宽绰kuanchuo -宽大kuanda -宽待kuandai -款待kuandai -宽度kuandu -况kuang -矿kuang -狂kuang -框kuang -匡kuang -筐kuang -眶kuang -旷kuang -诓kuang -诳kuang -邝kuang -圹kuang -夼kuang -哐kuang -纩kuang -贶kuang -矿藏kuangcang -矿产kuangchan -狂风kuangfeng -矿工kuanggong -旷工kuanggong -矿井kuangjing -框框kuangkuang -哐啷kuanglang -况且kuangqie -矿区kuangqu -矿泉kuangquan -狂热kuangre -矿山kuangshan -矿石kuangshi -框图kuangtu -宽广kuanguang -狂妄kuangwang -矿物kuangwu -旷野kuangye -宽宏kuanhong -宽厚kuanhou -宽阔kuankuo -宽容kuanrong -款式kuanshi -宽恕kuanshu -款项kuanxiang -宽心kuanxin -宽裕kuanyu -垮台kuatai -跨越kuayue -夸张kuazhang -裤衩kucha -库存kucun -哭喊kuhan -奎kui -溃kui -馈kui -亏kui -盔kui -岿kui -窥kui -葵kui -魁kui -傀kui -愧kui -馗kui -匮kui -夔kui -隗kui -蒉kui -揆kui -喹kui -喟kui -悝kui -愦kui -逵kui -暌kui -睽kui -聩kui -蝰kui -篑kui -跬kui -亏本kuiben -窥测kuice -亏待kuidai -愧疚kuijiu -亏空kuikong -亏损kuisun -魁梧kuiwu -溃疡kuiyang -枯竭kujie -库仑kulun -苦闷kumen -枯木kumu -困kun -昆kun -坤kun -捆kun -悃kun -阃kun -琨kun -锟kun -醌kun -鲲kun -髡kun -苦难kunan -苦恼kunao -困厄kune -困乏kunfa -困惑kunhuo -困境kunjing -困苦kunku -昆明kunming -困难kunnan -扩kuo -括kuo -适*kuo -阔kuo -廓kuo -栝*kuo -蛞kuo -阔别kuobie -扩充kuochong -阔绰kuochuo -扩大kuoda -括号kuohao -扩建kuojian -阔气kuoqi -扩展kuozhan -扩张kuozhang -哭泣kuqi -酷暑kushu -苦头kutou -苦维kuwei -枯萎kuwei -酷刑kuxing -苦于kuyu -枯燥kuzao -可想而知kxez -科学家kxj -科学技术kxjs -可行性kxx -科学院kxy -科研部kyb -开源节流kyjl -看样子kyz -了l -来l -量l -理l -路l -里l -论l -两l -利l -领l -流l -力l -立l -料l -连l -老l -六l -轮l -类l -列l -拉la -落*la -啦la -蜡la -腊la -蓝la -垃la -喇la -辣la -剌la -邋la -旯la -砬la -瘌la -喇叭laba -来lai -赖lai -莱lai -崃lai -徕lai -涞lai -濑lai -赉lai -睐lai -铼lai -癞lai -籁lai -来宾laibin -来到laidao -来犯laifan -来访laifang -来函laihan -来回laihui -来历laili -来临lailin -赖皮laipi -来日lairi -来势laishi -来头laitou -来往laiwang -来信laixin -来源laiyuan -来者laizhe -来自laizi -癞子laizi -辣椒lajiao -拉拢lalong -喇嘛lama -腊梅lamei -兰lan -烂lan -蓝lan -览lan -栏lan -婪lan -拦lan -篮lan -阑lan -澜lan -谰lan -揽lan -懒lan -缆lan -滥lan -岚lan -漤lan -榄lan -斓lan -罱lan -镧lan -褴lan -蓝本lanben -懒怠landai -滥调landiao -懒惰landuo -浪lang -朗lang -郎lang -狼lang -琅lang -榔lang -廊lang -莨lang -蒗lang -啷lang -阆lang -锒lang -稂lang -螂lang -栏杆langan -狼狈langbei -浪潮langchao -浪荡langdang -朗读langdu -浪费langfei -狼藉langji -浪漫langman -朗诵langsong -郎中langzhong -兰花lanhua -拦截lanjie -烂漫lanman -懒散lansan -蓝色lanse -缆绳lansheng -烂熟lanshu -蓝天lantian -蓝图lantu -阑尾lanwei -拦腰lanyao -滥用lanyong -兰州lanzhou -老lao -劳lao -落*lao -牢lao -涝lao -捞lao -络*lao -佬lao -姥lao -酪lao -烙lao -潦*lao -唠lao -崂lao -栳lao -铑lao -铹lao -痨lao -耢lao -醪lao -老板laoban -老伴laoban -老本laoben -劳动laodong -牢固laogu -老汉laohan -老化laohua -牢记laoji -劳驾laojia -牢靠laokao -劳苦laoku -牢牢laolao -劳累laolei -劳力laoli -老练laolian -牢笼laolong -劳模laomo -老年laonian -老人laoren -牢骚laosao -老少laoshao -老是laoshi -老实laoshi -老师laoshi -老乡laoxiang -老爷laoye -烙印laoyin -劳支laozhi -劳资laozi -劳作laozuo -腊月layue -狼狈不堪lbbk -力不从心lbcx -来不及lbj -来不了lbl -了不起lbq -劳动保险ldbx -来得及ldj -劳动量ldl -劳动力ldl -灵丹妙药ldmy -拉丁美洲ldmz -劳动者ldz -劳动致富ldzf -了le -乐le -勒le -肋le -仂le -叻le -泐le -鳓le -乐观leguan -类lei -雷lei -累lei -勒*lei -垒lei -泪lei -镭lei -蕾lei -磊lei -儡lei -擂lei -肋lei -羸lei -诔lei -嘞lei -嫘lei -缧lei -檑lei -耒lei -酹lei -类别leibie -类次leici -雷达leida -雷管leiguan -泪痕leihen -泪花leihua -累积leiji -累计leiji -累进leijin -磊落leiluo -累年leinian -类似leisi -擂台leitai -雷同leitong -类推leitui -类型leixing -雷雨leiyu -累月leiyue -累赘leizhui -勒令leling -冷leng -棱leng -楞leng -塄leng -愣leng -冷藏lengcang -冷淡lengdan -冷宫lenggong -棱角lengjiao -冷静lengjing -冷落lengluo -冷门lengmen -冷漠lengmo -冷暖lengnuan -冷僻lengpi -冷气lengqi -冷却lengque -冷水lengshui -冷遇lengyu -乐趣lequ -勒索lesuo -乐意leyi -乐园leyuan -两个文明lgwm -拉关系lgx -联合国lhg -联合会lhh -两回事lhs -联合体lht -理li -里li -利li -力li -立li -离li -例li -历li -粒li -厘li -礼li -李li -隶li -黎li -璃li -励li -犁li -梨li -丽li -厉li -篱li -狸li -漓li -鲤li -莉li -荔li -吏li -栗li -砾li -傈li -俐li -痢li -沥li -哩li -鬲*li -俪li -俚li -郦li -坜li -苈li -莅li -蓠li -藜li -呖li -唳li -喱li -猁li -悝*li -溧li -澧li -逦li -娌li -嫠li -骊li -缡li -枥li -栎li -轹li -戾li -砺li -詈li -罹li -锂li -鹂li -疠li -疬li -蛎li -蜊li -蠡li -笠li -篥li -粝li -醴li -跞li -雳li -鲡li -鳢li -黧li -俩lia -连lian -联lian -练lian -炼lian -脸lian -链lian -莲lian -镰lian -廉lian -怜lian -涟lian -帘lian -敛lian -恋lian -蔹lian -奁lian -潋lian -濂lian -琏lian -楝lian -殓lian -臁lian -裢lian -裣lian -蠊lian -鲢lian -立案lian -恋爱lianai -联邦lianbang -练兵lianbing -联播lianbo -练达lianda -连队liandui -量liang -两liang -粮liang -良liang -亮liang -梁liang -凉liang -辆liang -粱liang -晾liang -谅liang -墚liang -莨*liang -椋liang -踉liang -靓liang -魉liang -炼钢liangang -两半liangban -量变liangbian -两边liangbian -两便liangbian -两侧liangce -两次liangci -两地liangdi -两点liangdian -量度liangdu -良方liangfang -两广liangguang -良好lianghao -两极liangji -良机liangji -谅解liangjie -量具liangju -凉快liangkuai -两立liangli -两面liangmian -练功liangong -两栖liangqi -两讫liangqi -两全liangquan -粮食liangshi -两手liangshou -凉爽liangshuang -亮堂liangtang -两条liangtiao -两头liangtou -连贯lianguan -联贯lianguan -亮相liangxiang -良心liangxin -两性liangxing -量刑liangxing -两样liangyang -粮油liangyou -良缘liangyuan -粮站liangzhan -两者liangzhe -两重liangzhong -良种liangzhong -量子liangzi -联合lianhe -联欢lianhuan -廉价lianjia -联结lianjie -连接lianjie -联接lianjie -廉洁lianjie -联军lianjun -连累lianlei -联络lianluo -连忙lianmang -联盟lianmeng -怜悯lianmin -连年liannian -脸谱lianpu -连日lianri -炼乳lianru -联赛liansai -脸色lianse -连锁liansuo -练武lianwu -联系lianxi -练习lianxi -怜惜lianxi -联想lianxiang -连续lianxu -涟漪lianyi -联姻lianyin -联营lianying -炼油lianyou -联运lianyun -连载lianzai -了*liao -料liao -疗liao -辽liao -僚liao -撩liao -聊liao -燎liao -寥liao -潦liao -撂liao -镣liao -廖liao -蓼liao -尥liao -嘹liao -獠liao -寮liao -缭liao -钌liao -鹩liao -撩拨liaobo -潦草liaocao -疗程liaocheng -料到liaodao -潦倒liaodao -料定liaoding -了结liaojie -了解liaojie -辽阔liaokuo -料理liaoli -寥寥liaoliao -寥落liaoluo -辽宁liaoning -了却liaoque -了事liaoshi -聊天liaotian -料想liaoxiang -疗养liaoyang -礼拜libai -利弊libi -里边libian -理财licai -理睬licai -立场lichang -里程licheng -历程licheng -立春lichun -历次lici -历代lidai -理当lidang -立冬lidong -列lie -裂lie -烈lie -劣lie -猎lie -冽lie -埒lie -捩lie -咧lie -洌lie -趔lie -躐lie -鬣lie -裂变liebian -列车lieche -列出liechu -列岛liedao -裂缝liefeng -列国lieguo -烈火liehuo -劣迹lieji -列举lieju -裂开liekai -裂口liekou -列宁liening -猎奇lieqi -列强lieqiang -猎取liequ -烈日lieri -列入lieru -劣绅lieshen -烈士lieshi -劣势lieshi -烈属lieshu -裂纹liewen -列席liexi -烈性liexing -立法lifa -立方lifang -礼服lifu -立功ligong -利害lihai -厉害lihai -理化lihua -礼花lihua -理会lihui -离婚lihun -立即liji -理解lijie -礼节lijie -历届lijie -力矩liju -离开likai -理科like -立刻like -理亏likui -历来lilai -历历lili -力量liliang -利率lilu -理论lilun -立论lilun -礼貌limao -里面limian -利民limin -黎民limin -黎明liming -林lin -磷lin -临lin -邻lin -淋lin -麟lin -琳lin -霖lin -鳞lin -凛lin -赁lin -吝lin -蔺lin -啉lin -嶙lin -廪lin -懔lin -遴lin -檩lin -辚lin -膦lin -瞵lin -粼lin -躏lin -淋巴linba -临别linbie -淋病linbing -林场linchang -临床linchuang -临到lindao -领ling -另ling -零ling -令ling -灵ling -岭ling -铃ling -龄ling -凌ling -棱*ling -陵ling -拎ling -玲ling -菱ling -伶ling -羚ling -酃ling -苓ling -呤ling -囹ling -泠ling -绫ling -柃ling -棂ling -瓴ling -聆ling -蛉ling -翎ling -鲮ling -令爱lingai -凌晨lingchen -灵丹lingdan -领导lingdao -领地lingdi -零点lingdian -领队lingdui -灵感linggan -领海linghai -领航linghang -领会linghui -灵魂linghun -灵活linghuo -灵机lingji -零件lingjian -领教lingjiao -灵杰lingjie -领空lingkong -凌空lingkong -玲珑linglong -零乱lingluan -凌乱lingluan -领略linglue -灵敏lingmin -陵墓lingmu -灵巧lingqiao -领取lingqu -令人lingren -凌辱lingru -零散lingsan -领事lingshi -领受lingshou -领司lingsi -零碎lingsui -灵堂lingtang -零头lingtou -领土lingtu -磷光linguang -另外lingwai -领悟lingwu -领先lingxian -领衔lingxian -零星lingxing -领袖lingxiu -另选lingxuan -灵验lingyan -领域lingyu -令尊lingzun -磷火linhuo -历年linian -临界linjie -临近linjin -邻近linjin -邻里linli -淋漓linli -凛冽linlie -临摹linmo -里弄linong -鳞伤linshang -临时linshi -临死linsi -吝惜linxi -临行linxing -林业linye -临战linzhan -临终linzhong -礼炮lipao -李鹏lipeng -礼品lipin -力气liqi -离奇liqi -力求liqiu -立秋liqiu -历任liren -例如liru -利润lirun -离散lisan -理事lishi -历史lishi -隶属lishu -礼堂litang -立体liti -例题liti -力图litu -流liu -六liu -留liu -刘liu -硫liu -柳liu -陆*liu -馏liu -瘤liu -溜liu -琉liu -榴liu -碌*liu -浏liu -遛liu -骝liu -绺liu -旒liu -熘liu -锍liu -镏liu -鹨liu -鎏liu -留步liubu -流产liuchan -流畅liuchang -流程liucheng -流传liuchuan -流窜liucuan -流动liudong -流毒liudu -流放liufang -六届liujie -浏览liulan -流利liuli -留恋liulian -流露liulu -流落liuluo -流氓liumang -留念liunian -流失liushi -流逝liushi -流体liuti -流通liutong -流亡liuwang -流泻liuxie -留心liuxin -流行liuxing -流星liuxing -留学liuxue -流血liuxue -流言liuyan -留言liuyan -留洋liuyang -留影liuying -留用liuyong -流域liuyu -六月liuyue -流转liuzhuan -例外liwai -礼物liwu -利息lixi -立夏lixia -理想lixiang -立新lixin -离心lixin -理性lixing -力行lixing -厉行lixing -离休lixiu -立意liyi -利益liyi -离异liyi -利用liyong -理由liyou -力争lizheng -立正lizheng -理智lizhi -立志lizhi -离职lizhi -例子lizi -粒子lizi -立足lizu -屡见不鲜ljbx -两极分化ljfh -逻辑设计ljsj -逻辑思维ljsw -逻辑性ljx -灵机一动ljyd -落落大方lldf -拦路虎llh -来龙去脉llqm -零零碎碎llss -来来往往llww -联绵不断lmbd -灵敏度lmd -辽宁省lns -列宁主义lnzy -龙long -垄long -弄*long -笼long -隆long -聋long -咙long -窿long -拢long -陇long -垅long -茏long -泷long -珑long -栊long -胧long -砻long -癃long -隆冬longdong -垄断longduan -隆隆longlong -笼络longluo -笼统longtong -笼罩longzhao -隆重longzhong -漏lou -露*lou -楼lou -娄lou -搂lou -篓lou -陋lou -偻lou -蒌lou -喽lou -嵝lou -镂lou -瘘lou -耧lou -蝼lou -髅lou -漏洞loudong -漏斗loudou -镂空loukong -漏网louwang -来日方长lrfc -来人来函lrlh -了如指掌lrzz -理所当然lsdr -连锁反应lsfy -领事馆lsg -理事会lsh -力所能及lsnj -拉萨市lss -流水线lsx -良师益友lsyy -路lu -六*lu -率lu -露lu -绿lu -炉lu -律lu -虑lu -滤lu -陆lu -氯lu -鲁lu -铝lu -录lu -旅lu -卢lu -吕lu -芦lu -颅lu -庐lu -掳lu -卤lu -虏lu -麓lu -碌lu -赂lu -鹿lu -潞lu -禄lu -戮lu -驴lu -侣lu -履lu -屡lu -缕lu -垆lu -蓼*lu -撸lu -噜lu -闾lu -泸lu -渌lu -漉lu -逯lu -璐lu -栌lu -榈lu -橹lu -轳lu -辂lu -辘lu -氇lu -胪lu -膂lu -镥lu -稆lu -鸬lu -鹭lu -褛lu -簏lu -舻lu -鲈lu -卵luan -乱luan -峦luan -挛luan -孪luan -滦luan -脔luan -娈luan -栾luan -鸾luan -銮luan -卵巢luanchao -乱伦luanlun -乱子luanzi -旅伴luban -路标lubiao -路程lucheng -旅程lucheng -露出luchu -屡次luci -陆地ludi -露底ludi -旅店ludian -略lue -掠lue -锊lue -掠夺lueduo -旅费lufei -露骨lugu -旅馆luguan -路过luguo -绿化luhua -炉火luhuo -路径lujing -路局luju -陆军lujun -旅客luke -履历luli -率领luling -鲁莽lumang -露面lumian -论lun -轮lun -伦lun -抡lun -仑lun -沦lun -纶lun -囵lun -论处lunchu -轮船lunchuan -论点lundian -论调lundiao -伦敦lundun -轮换lunhuan -论据lunju -轮廓lunkuo -论理lunli -伦理lunli -轮流lunliu -论述lunshu -轮胎luntai -论坛luntan -沦为lunwei -论文lunwen -沦陷lunxian -轮训lunxun -论战lunzhan -论正lunzheng -论证lunzheng -轮轴lunzhou -论著lunzhu -落luo -罗luo -螺luo -洛luo -络luo -逻luo -咯*luo -烙*luo -萝luo -锣luo -箩luo -骡luo -裸luo -骆luo -倮luo -蠃luo -荦luo -捋luo -摞luo -猡luo -泺luo -漯luo -珞luo -椤luo -脶luo -硌*luo -镙luo -瘰luo -雒luo -萝卜luobu -落成luocheng -螺钉luoding -罗汉luohan -落后luohou -落户luohu -逻辑luoji -落空luokong -落款luokuan -箩筐luokuang -罗列luolie -罗马luoma -螺母luomu -罗盘luopan -落泊luopo -落实luoshi -螺栓luoshuan -裸体luoti -骆驼luotuo -罗网luowang -螺纹luowen -落伍luowu -落选luoxuan -螺旋luoxuan -络绎luoyi -录取luqu -路人luren -绿色luse -庐山lushan -旅社lushe -律师lushi -露天lutian -路途lutu -旅途lutu -路线luxian -率先luxian -录像luxiang -旅行luxing -履行luxing -陆续luxu -录音luyin -绿荫luyin -录用luyong -旅游luyou -绿洲luzhou -露珠luzhu -路子luzi -炉子luzi -另行安排lxap -例行公事lxgs -联系人lxr -留学生lxs -另行通知lxtz -林业部lyb -老一辈lyb -另一方面lyfm -劳逸结合lyjh -利用率lyl -老一套lyt -留有余地lyyd -来者不拒lzbj -立足点lzd -老中青lzq -理直气壮lzqz -兰州市lzs -两重性lzx -面m -命m -们m -民m -毛m -没m -米m -明m -马m -么m -每m -门m -名m -磨m -美m -密m -苗m -满m -亩m -目m -呒m -马ma -么*ma -麻ma -吗ma -妈ma -骂ma -嘛ma -码ma -摩*ma -抹*ma -玛ma -蚂ma -唛ma -犸ma -嬷ma -杩ma -蟆ma -马鞍maan -麻痹mabi -马达mada -麻烦mafan -麻纺mafang -马虎mahu -麦mai -脉mai -卖mai -买mai -埋mai -迈mai -劢mai -荬mai -霾mai -买办maiban -脉搏maibo -迈步maibu -埋藏maicang -脉冲maichong -脉动maidong -埋伏maifu -卖国maiguo -脉络mailuo -买卖maimai -卖命maiming -埋没maimo -卖弄mainong -埋头maitou -卖淫maiyin -埋怨maiyuan -埋葬maizang -买帐maizhang -卖座maizuo -马力mali -麻利mali -马路malu -妈妈mama -麻木mamu -满man -慢man -曼man -漫man -蔓man -瞒man -馒man -蛮man -谩man -墁man -幔man -缦man -熳man -镘man -颟man -螨man -鳗man -鞔man -漫长manchang -忙mang -芒mang -盲mang -茫mang -氓mang -莽mang -邙mang -漭mang -硭mang -蟒mang -忙碌manglu -莽莽mangmang -盲目mangmu -茫然mangran -盲人mangren -忙于mangyu -莽原mangyuan -蛮横manheng -漫画manhua -满怀manhuai -谩骂manma -满目manmu -满腔manqiang -蔓延manyan -满意manyi -满载manzai -满足manzu -毛mao -矛mao -冒mao -貌mao -贸mao -帽mao -猫mao -茅mao -锚mao -铆mao -卯mao -茂mao -袤mao -茆mao -峁mao -泖mao -瑁mao -昴mao -牦mao -耄mao -旄mao -懋mao -瞀mao -蟊mao -髦mao -毛病maobing -毛糙maocao -冒充maochong -铆钉maoding -矛盾maodun -冒犯maofan -毛纺maofang -冒号maohao -冒尖maojian -冒进maojin -茅坑maokeng -毛利maoli -冒昧maomei -茂密maomi -冒牌maopai -毛坯maopi -贸然maoran -茂盛maosheng -冒失maoshi -矛头maotou -冒险maoxian -贸易maoyi -冒雨maoyu -毛重maozhong -帽子maozi -马上mashang -马桶matong -码头matou -马戏maxi -麻醉mazui -免不了mbl -明辨是非mbsf -满不在乎mbzh -默不作声mbzs -满城风雨mcfy -目的地mdd -目瞪口呆mdkd -描淡写mdx -么me -麽me -秘而不宣mebx -没mei -每mei -美mei -煤mei -霉mei -酶mei -梅mei -妹mei -眉mei -玫mei -枚mei -媒mei -镁mei -昧mei -寐mei -媚mei -糜*mei -谜*mei -莓mei -嵋mei -猸mei -浼mei -湄mei -楣mei -镅mei -鹛mei -袂mei -魅mei -每次meici -每当meidang -美德meide -没法meifa -每逢meifeng -每个meige -美观meiguan -玫瑰meigui -美国meiguo -美好meihao -美化meihua -媒介meijie -眉睫meijie -枚举meiju -煤矿meikuang -霉烂meilan -魅力meili -美丽meili -美满meiman -眉毛meimao -美貌meimao -妹妹meimei -美妙meimiao -眉目meimu -每年meinian -煤气meiqi -每人meiren -每日meiri -美容meirong -眉梢meishao -每时meishi -美术meishu -媒妁meishuo -煤炭meitan -每天meitian -煤田meitian -美学meixue -没有meiyou -煤油meiyou -美元meiyuan -每月meiyue -没治meizhi -每周meizhou -们men -门men -闷men -扪men -焖men -懑men -钔men -门房menfang -孟meng -猛meng -蒙meng -盟meng -梦meng -萌meng -锰meng -氓*meng -檬meng -勐meng -甍meng -瞢meng -懵meng -朦meng -礞meng -虻meng -蜢meng -蠓meng -艋meng -艨meng -蒙蔽mengbi -萌发mengfa -蒙古menggu -盟国mengguo -梦幻menghuan -蒙混menghun -梦见mengjian -猛进mengjin -梦境mengjing -猛烈menglie -蒙胧menglong -蒙昧mengmei -猛然mengran -萌生mengsheng -猛士mengshi -蒙受mengshou -梦想mengxiang -梦乡mengxiang -猛醒mengxing -萌芽mengya -盟友mengyou -盟约mengyue -猛增mengzeng -门户menhu -门路menlu -门牌menpai -门票menpiao -闷气menqi -门诊menzhen -名副其实mfqs -眉飞色舞mfsw -没关系mgx -蒙古族mgz -蒙混过关mhgg -米mi -密mi -迷mi -蜜mi -秘mi -眯mi -醚mi -靡mi -糜mi -谜mi -弥mi -觅mi -泌mi -幂mi -芈mi -谧mi -蘼mi -咪mi -嘧mi -猕mi -汨mi -宓mi -弭mi -脒mi -祢mi -敉mi -糸mi -縻mi -麋mi -面mian -棉mian -免mian -绵mian -眠mian -冕mian -勉mian -娩mian -缅mian -沔mian -渑mian -湎mian -腼mian -眄mian -面部mianbu -免除mianchu -免得miande -面对miandui -面额miane -棉花mianhua -缅怀mianhuai -面积mianji -面具mianju -面孔miankong -勉励mianli -面临mianlin -面貌mianmao -面面mianmian -绵绵mianmian -面目mianmu -面庞mianpang -面前mianqian -勉强mianqiang -面容mianrong -面色mianse -棉纱miansha -面授mianshou -免税mianshui -面谈miantan -面向mianxiang -免刑mianxing -棉絮mianxu -绵延mianyan -面议mianyi -免疫mianyi -面罩mianzhao -免职mianzhi -面子mianzi -苗miao -秒miao -描miao -庙miao -妙miao -瞄miao -藐miao -渺miao -喵miao -邈miao -缈miao -缪miao -杪miao -淼miao -眇miao -鹋miao -秒表miaobiao -描绘miaohui -妙龄miaoling -渺茫miaomang -描摹miaomo -藐视miaoshi -描述miaoshu -苗条miaotiao -苗头miaotou -描写miaoxie -瞄准miaozhun -弥补mibu -谜底midi -密度midu -灭mie -蔑mie -乜*mie -咩mie -蠛mie -篾mie -灭火miehuo -灭迹mieji -灭绝miejue -灭口miekou -蔑视mieshi -灭亡miewang -密封mifeng -蜜蜂mifeng -眯缝mifeng -迷航mihang -迷糊mihu -迷惑mihuo -密集miji -密件mijian -迷津mijin -秘诀mijue -糜烂milan -迷恋milian -密令miling -迷路milu -密码mima -迷漫miman -弥漫miman -秘密mimi -汨汨mimi -谜面mimian -密谋mimou -民min -敏min -抿min -皿min -悯min -闽min -苠min -岷min -闵min -泯min -缗min -玟min -珉min -愍min -黾min -鳘min -民办minban -民兵minbing -民法minfa -民愤minfen -民风minfeng -命ming -明ming -名ming -鸣ming -螟ming -盟*ming -铭ming -冥ming -茗ming -溟ming -暝ming -瞑ming -酩ming -敏感mingan -明白mingbai -名册mingce -名称mingcheng -明处mingchu -名次mingci -名词mingci -名单mingdan -明灯mingdeng -民歌minge -名额minge -名贵minggui -铭记mingji -名家mingjia -铭刻mingke -明快mingkuai -明朗minglang -名利mingli -明亮mingliang -明了mingliao -命令mingling -名流mingliu -明码mingma -明媚mingmei -明明mingming -名目mingmu -明年mingnian -名牌mingpai -名片mingpian -名气mingqi -明确mingque -明人mingren -名人mingren -名胜mingsheng -名声mingsheng -名堂mingtang -明天mingtian -名望mingwang -明文mingwen -明细mingxi -明显mingxian -鸣谢mingxie -明星mingxing -名言mingyan -名义mingyi -名誉mingyu -命运mingyun -明知mingzhi -明智mingzhi -明珠mingzhu -名著mingzhu -名字mingzi -民航minhang -民间minjian -敏捷minjie -民警minjing -民情minqing -敏锐minrui -民事minshi -民心minxin -民意minyi -民用minyong -民运minyun -民政minzheng -民众minzhong -民主minzhu -民族minzu -密切miqie -迷人miren -迷失mishi -秘书mishu -密探mitan -迷途mitu -谬miu -谬论miulun -谬误miuwu -迷惘miwang -迷雾miwu -迷信mixin -密友miyou -谜语miyu -蜜月miyue -马克思mks -眉开眼笑mkyx -马列主义mlzy -满面春风mmcf -马马虎虎mmhh -面面俱到mmjd -莫名其妙mmqm -默默无闻mmww -明目张胆mmzd -无*mo -磨mo -没*mo -万*mo -末mo -模mo -膜mo -摸mo -墨mo -摩mo -脉*mo -莫mo -抹mo -冒*mo -默mo -貉*mo -嘿*mo -摹mo -蘑mo -魔mo -沫mo -漠mo -寞mo -陌mo -谟mo -茉mo -蓦mo -馍mo -嫫mo -殁mo -镆mo -秣mo -瘼mo -耱mo -貊mo -貘mo -默哀moai -莫不mobu -磨擦moca -摩擦moca -磨蹭moceng -莫大moda -磨刀modao -摩登modeng -摸底modi -模范mofan -模仿mofang -摹仿mofang -莫非mofei -魔鬼mogui -模糊mohu -墨迹moji -模块mokuai -磨砺moli -磨练molian -末了moliao -末路molu -没落moluo -磨灭momie -默默momo -磨难monan -模拟moni -摹拟moni -末期moqi -默契moqi -默然moran -漠然moran -默认moren -末日mori -莫如moru -抹杀mosha -抹煞mosha -末梢moshao -陌生mosheng -模式moshi -没收moshou -魔术moshu -磨损mosun -摸索mosuo -模特mote -摩托motuo -某mou -谋mou -牟mou -侔mou -哞mou -缪*mou -眸mou -蛑mou -蝥mou -鍪mou -某地moudi -某个mouge -谋害mouhai -谋划mouhua -某军moujun -牟利mouli -谋略moulue -谋求mouqiu -牟取mouqu -谋杀mousha -谋生mousheng -某些mouxie -末尾mowei -默写moxie -模型moxing -默许moxu -模样moyang -魔掌mozhang -模子mozi -妙趣横生mqhs -门市部msb -名胜古迹msgj -妙手回春mshc -莫斯科msk -没什么msm -每时每刻msmk -秘书长msz -没事找事mszs -摩托车mtc -埋头工作mtgz -埋头苦干mtkg -亩mu -目mu -木mu -母mu -墓mu -模*mu -幕mu -牧mu -姆mu -穆mu -姥*mu -牟*mu -拇mu -牡mu -暮mu -募mu -慕mu -睦mu -仫mu -坶mu -苜mu -沐mu -毪mu -钼mu -母爱muai -墓碑mubei -目标mubiao -木材mucai -牧草mucao -目测muce -牧场muchang -目次muci -牡丹mudan -目的mudi -牧歌muge -目光muguang -幕后muhou -目击muji -募集muji -木刻muke -木料muliao -幕僚muliao -目录mulu -牧民mumin -木讷mune -木偶muou -目前muqian -母亲muqin -牧区muqu -木然muran -暮色muse -牧师mushi -目送musong -牧童mutong -牧业muye -沐浴muyu -民意测验mycy -贸易市场mysc -贸易协定myxd -民政部mzb -美中不足mzbz -毛泽东mzd -满载而归mzeg -明知故犯mzgf -毛织品mzp -目中无人mzwr -毛主席mzx -年n -能n -内n -那n -农n -你n -南n -难n -呢n -女n -泥n -哪n -拿n -念n -牛n -宁n -脑n -粘n -尼n -纳n -嗯n -那na -南na -哪na -拿na -纳na -呢*na -钠na -呐na -娜na -捺na -肭na -镎na -衲na -那边nabian -纳粹nacui -哪儿naer -那个nage -哪个nage -呐喊nahan -哪会nahui -耐nai -哪*nai -奶nai -乃nai -氖nai -奈nai -鼐nai -艿nai -萘nai -柰nai -耐烦naifan -奈何naihe -耐久naijiu -耐劳nailao -奶奶nainai -耐心naixin -耐性naixing -耐用naiyong -奶油naiyou -乃至naizhi -那里nali -哪里nali -那么name -南nan -难nan -男nan -喃nan -囝nan -囡nan -楠nan -腩nan -蝻nan -赧nan -难办nanban -南北nanbei -南边nanbian -难产nanchan -南昌nanchang -难处nanchu -难道nandao -难得nande -难点nandian -难度nandu -哪能naneng -南方nanfang -南非nanfei -难分nanfen -南风nanfeng -囊nang -攮nang -囔nang -馕nang -曩nang -囊括nangkuo -难怪nanguai -难关nanguan -南国nanguo -难过nanguo -南海nanhai -南货nanhuo -南极nanji -难解nanjie -南京nanjing -难看nankan -难堪nankan -南面nanmian -难免nanmian -难民nanmin -南宁nanning -男女nannu -赧然nanran -男人nanren -难色nanse -难事nanshi -难受nanshou -难说nanshuo -难题nanti -难听nanting -难为nanwei -男性nanxing -南亚nanya -南洋nanyang -难以nanyi -难友nanyou -难于nanyu -脑nao -闹nao -努*nao -挠nao -恼nao -淖nao -孬nao -垴nao -呶nao -猱nao -瑙nao -硇nao -铙nao -蛲nao -脑袋naodai -脑海naohai -恼火naohuo -脑筋naojin -闹剧naoju -闹事naoshi -哪怕napa -纳入naru -那时nashi -拿手nashou -纳税nashui -那些naxie -哪些naxie -纳新naxin -那样nayang -哪样nayang -那种nazhong -年产量ncl -农产品ncp -南昌市ncs -难道说nds -呢ne -哪*ne -呐*ne -讷ne -内nei -那*nei -哪*nei -馁nei -内部neibu -内存neicun -内地neidi -内阁neige -内涵neihan -内行neihang -内奸neijian -内疚neijiu -内科neike -内乱neiluan -内幕neimu -内勤neiqin -内容neirong -内外neiwai -内销neixiao -内心neixin -内因neiyin -内应neiying -内在neizai -嫩nen -恁nen -能neng -能动nengdong -能否nengfou -能干nenggan -能够nenggou -能力nengli -能量nengliang -能耐nengnai -能人nengren -能手nengshou -能源nengyuan -能者nengzhe -农副产品nfcp -年富力强nflq -能工巧匠ngqj -你ni -泥ni -尼ni -呢*ni -逆ni -拟ni -尿ni -妮ni -霓ni -倪ni -匿ni -腻ni -溺ni -伲ni -坭ni -猊ni -怩ni -昵ni -旎ni -祢*ni -慝ni -睨ni -铌ni -鲵ni -年nian -念nian -粘nian -蔫nian -拈nian -碾nian -撵nian -捻nian -酿nian -廿nian -埝nian -辇nian -黏nian -鲇nian -鲶nian -年初nianchu -年代niandai -念叨niandao -年底niandi -年度niandu -年份nianfen -娘niang -年华nianhua -年画nianhua -年级nianji -年纪nianji -年鉴nianjian -年来nianlai -年利nianli -年历nianli -拈量nianliang -年龄nianling -年迈nianmai -年年niannian -年青nianqing -年轻nianqing -年岁niansui -年头niantou -念头niantou -年限nianxian -年月nianyue -酿造nianzao -年终nianzhong -尿niao -鸟niao -溺*niao -茑niao -嬲niao -脲niao -袅niao -鸟瞰niaokan -逆差nicha -你处nichu -你的nide -拟定niding -拟订niding -镍nie -啮nie -涅nie -捏nie -聂nie -孽nie -镊nie -乜nie -陧nie -蘖nie -嗫nie -颞nie -臬nie -蹑nie -捏造niezao -腻烦nifan -泥浆nijiang -逆境nijing -泥坑nikeng -逆流niliu -你们nimen -您nin -宁ning -凝ning -拧ning -柠ning -狞ning -泞ning -佞ning -苎ning -咛ning -甯ning -聍ning -凝固ninggu -凝结ningjie -宁静ningjing -凝聚ningju -宁可ningke -宁肯ningken -宁日ningri -凝视ningshi -凝望ningwang -宁夏ningxia -宁愿ningyuan -泥泞nining -泥塑nisu -牛niu -扭niu -钮niu -纽niu -拗*niu -狃niu -忸niu -妞niu -纽带niudai -牛犊niudu -纽扣niukou -纽约niuyue -扭转niuzhuan -腻味niwei -你我niwo -拟议niyi -泥沼nizhao -逆转nizhuan -难解难分njnf -南京市njs -南极洲njz -扭亏为盈nkwy -脑力劳动nlld -年老体弱nltr -内蒙古nmg -农贸市场nmsc -那么些nmx -那么样nmy -念念不忘nnbw -难能可贵nnkg -南宁市nns -农nong -弄nong -浓nong -脓nong -侬nong -哝nong -脓包nongbao -农村nongcun -浓度nongdu -农妇nongfu -浓厚nonghou -农会nonghui -农活nonghuo -农具nongju -农历nongli -农林nonglin -农忙nongmang -农民nongmin -弄清nongqing -农时nongshi -农药nongyao -农业nongye -农艺nongyi -浓郁nongyu -耨nou -年轻化nqh -年轻人nqr -那时候nsh -能说会道nshd -南斯拉夫nslf -能上能下nsnx -逆水行舟nsxz -农田水利ntsl -女nu -奴nu -努nu -怒nu -弩nu -胬nu -孥nu -驽nu -恧nu -钕nu -衄nu -暖nuan -暖和nuanhe -暖流nuanliu -暖气nuanqi -奴婢nubi -奴才nucai -虐nue -虐待nuedai -虐疾nueji -女儿nuer -女工nugong -怒吼nuhou -奴化nuhua -怒火nuhuo -努力nuli -奴隶nuli -诺nuo -娜*nuo -挪nuo -懦nuo -糯nuo -傩nuo -搦nuo -喏nuo -锘nuo -挪用nuoyong -奴仆nupu -女人nuren -女色nuse -女士nushi -女性nuxing -女婿nuxu -女子nuzi -能文能武nwnw -弄虚作假nxzj -农作物nzw -你争我夺nzwd -欧o -偶o -哦o -鸥o -殴o -藕o -呕o -沤o -讴o -噢o -怄o -瓯o -耦o -偶然性orx -区*ou -欧ou -偶ou -鸥ou -殴ou -藕ou -呕ou -沤ou -讴ou -怄ou -瓯ou -耦ou -殴打ouda -偶尔ouer -讴歌ouge -偶合ouhe -耦合ouhe -欧姆oumu -怄气ouqi -偶然ouran -藕色ouse -偶数oushu -呕吐outu -欧阳ouyang -欧洲ouzhou -批p -平p -判p -配p -片p -派p -破p -排p -品p -皮p -喷p -盘p -偏p -评p -怕p -培p -普p -贫p -跑p -炮p -怕pa -派pa -爬pa -帕pa -扒*pa -耙*pa -啪pa -趴pa -琶pa -葩pa -杷pa -钯*pa -筢pa -派pai -排pai -拍pai -牌pai -迫*pai -哌pai -徘pai -湃pai -俳pai -蒎pai -排版paiban -拍板paiban -排比paibi -派别paibie -排场paichang -排斥paichi -排除paichu -排队paidui -牌号paihao -徘徊paihuai -排挤paiji -牌价paijia -排列pailie -拍卖paimai -派遣paiqian -排球paiqiu -派生paisheng -派头paitou -排外paiwai -排泄paixie -排演paiyan -牌照paizhao -判pan -盘pan -叛pan -番*pan -潘pan -攀pan -磐pan -盼pan -畔pan -胖pan -拚*pan -爿pan -泮pan -袢pan -襻pan -蟠pan -蹒pan -叛变panbian -判别panbie -盘缠panchan -盘存pancun -叛党pandang -攀登pandeng -盘点pandian -判定panding -判断panduan -攀附panfu -旁pang -膀*pang -磅*pang -乓pang -庞pang -耪pang -胖pang -彷pang -滂pang -逄pang -螃pang -旁边pangbian -庞大pangda -盘亘pangen -旁观pangguan -旁听pangting -旁通pangtong -滂沱pangtuo -庞杂pangza -盘踞panju -判决panjue -叛乱panluan -判明panming -叛逆panni -盘算pansuan -蟠桃pantao -叛徒pantu -盼望panwang -判刑panxing -盘旋panxuan -跑pao -炮pao -刨pao -抛pao -泡pao -咆pao -袍pao -匏pao -狍pao -庖pao -脬pao -疱pao -炮兵paobing -跑步paobu -炮弹paodan -跑道paodao -抛光paoguang -炮火paohuo -炮击paoji -抛锚paomao -泡沫paomo -抛弃paoqi -炮手paoshou -炮台paotai -炮艇paoting -咆哮paoxiao -泡影paoying -炮仗paozhang -炮制paozhi -怕死pasi -疲惫不堪pbbk -迫不急待pbjd -破除迷信pcmx -平等互利pdhl -配pei -培pei -陪pei -胚pei -呸pei -裴pei -赔pei -佩pei -沛pei -辔pei -帔pei -旆pei -锫pei -醅pei -霈pei -陪伴peiban -配备peibei -赔本peiben -赔偿peichang -陪衬peichen -配方peifang -佩服peifu -配合peihe -配给peiji -配件peijian -配角peijiao -赔款peikuan -赔礼peili -配偶peiou -陪审peishen -陪送peisong -胚胎peitai -配套peitao -陪同peitong -培训peixun -培养peiyang -配音peiyin -培育peiyu -配乐peiyue -陪葬peizang -配制peizhi -配置peizhi -培植peizhi -喷pen -盆pen -湓pen -盆地pendi -碰peng -棚peng -蓬peng -朋peng -捧peng -膨peng -砰peng -抨peng -烹peng -澎peng -彭peng -硼peng -篷peng -鹏peng -堋peng -嘭peng -怦peng -蟛peng -碰杯pengbei -碰壁pengbi -蓬勃pengbo -捧场pengchang -抨击pengji -蓬莱penglai -蓬乱pengluan -澎湃pengpai -烹饪pengren -硼砂pengsha -蓬松pengsong -烹调pengtiao -朋友pengyou -膨胀pengzhang -喷溅penjian -盆景penjing -喷射penshe -喷嚏penti -平方公里pfgl -平分秋色pfqs -批pi -皮pi -坏*pi -否*pi -辟*pi -坯pi -脾pi -疲pi -砒pi -霹pi -披pi -劈pi -琵pi -毗pi -啤pi -匹pi -痞pi -僻pi -屁pi -譬pi -丕pi -仳pi -陂*pi -陴pi -邳pi -郫pi -圮pi -埤*pi -鼙pi -芘pi -擗pi -吡*pi -噼pi -庀pi -淠pi -媲pi -纰pi -枇pi -甓pi -睥pi -罴pi -铍pi -癖pi -裨*pi -疋pi -蚍pi -蜱pi -貔pi -片pian -偏pian -便*pian -篇pian -骗pian -扁*pian -谝pian -骈pian -缏*pian -犏pian -胼pian -翩pian -蹁pian -偏差piancha -片断pianduan -片段pianduan -偏废pianfei -篇幅pianfu -偏激pianji -偏见pianjian -骗局pianju -片刻pianke -偏离pianli -片面pianmian -偏旁pianpang -偏僻pianpi -偏颇pianpo -骗取pianqu -骗人pianren -骗术pianshu -偏袒piantan -翩跹pianxian -偏向pianxiang -偏移pianyi -便宜pianyi -篇章pianzhang -骗子pianzi -票piao -漂piao -朴*piao -飘piao -瓢piao -剽piao -莩*piao -嘌piao -嫖piao -骠*piao -缥piao -殍piao -瞟piao -螵piao -漂泊piaobo -票房piaofang -漂浮piaofu -票价piaojia -票据piaoju -漂亮piaoliang -漂流piaoliu -飘流piaoliu -飘落piaoluo -票面piaomian -飘渺piaomiao -飘泊piaopo -剽窃piaoqie -飘然piaoran -飘散piaosan -飘扬piaoyang -飘游piaoyou -疲惫pibei -批驳pibo -撇pie -瞥pie -丿pie -苤pie -氕pie -批发pifa -批复pifu -皮肤pifu -皮革pige -屁股pigu -疲倦pijuan -疲劳pilao -纰漏pilou -披露pilu -品pin -贫pin -频pin -拼pin -苹pin -聘pin -拚pin -姘pin -嫔pin -榀pin -牝pin -颦pin -品尝pinchang -频传pinchuan -拼凑pincou -频带pindai -频道pindao -品德pinde -贫乏pinfa -频繁pinfan -平ping -评ping -瓶ping -凭ping -苹ping -冯*ping -乒ping -坪ping -萍ping -屏ping -俜ping -娉ping -枰ping -鲆ping -平安pingan -评比pingbi -屏蔽pingbi -平常pingchang -平川pingchuan -平淡pingdan -平等pingdeng -平地pingdi -平定pingding -评定pingding -品格pinge -平反pingfan -平凡pingfan -平方pingfang -平分pingfen -评分pingfen -评功pinggong -平衡pingheng -评级pingji -平价pingjia -评价pingjia -评奖pingjiang -凭借pingjie -平静pingjing -平均pingjun -平空pingkong -凭空pingkong -评理pingli -评论pinglun -平面pingmian -平民pingmin -屏幕pingmu -评判pingpan -乒乓pingpang -平平pingping -平壤pingrang -平日pingri -平时pingshi -平手pingshou -评说pingshuo -平素pingsu -平坦pingtan -乒坛pingtan -平稳pingwen -平息pingxi -萍乡pingxiang -平行pingxing -平易pingyi -评议pingyi -平庸pingyong -平原pingyuan -平仄pingze -屏障pingzhang -凭着pingzhe -平整pingzheng -凭证pingzheng -评注pingzhu -贫寒pinhan -品级pinji -贫困pinkun -频率pinlu -品貌pinmao -拼命pinming -品名pinming -品评pinping -聘请pinqing -贫穷pinqiong -聘任pinren -聘书pinshu -拼写pinxie -品行pinxing -品性pinxing -拼音pinyin -品质pinzhi -品种pinzhong -批判pipan -匹配pipei -批评piping -脾气piqi -譬如piru -疲软piruan -批示pishi -脾胃piwei -脾性pixing -辟谣piyao -批语piyu -批阅piyue -批注pizhu -批准pizhun -平均数pjs -披荆斩棘pjzj -评论员ply -跑马观花pmgh -破po -迫po -坡po -泼po -繁*po -朴*po -泊*po -颇po -婆po -魄po -粕po -叵po -陂*po -鄱po -泺*po -珀po -攴po -钋po -钷po -钹*po -皤po -笸po -破案poan -破产pochan -破除pochu -坡度podu -泼妇pofu -破格poge -迫害pohai -破坏pohuai -破获pohuo -迫近pojin -破旧pojiu -泼辣pola -破烂polan -魄力poli -破例poli -破裂polie -破灭pomie -迫切poqie -迫使poshi -破碎posui -破损posun -破土potu -剖pou -裒pou -掊pou -剖解poujie -剖析pouxi -破绽pozhan -蓬蓬勃勃ppbb -普普通通pptt -旁若无人prwr -普通话pth -抛头露面ptlm -普pu -谱pu -扑pu -埔pu -铺pu -暴*pu -葡pu -朴pu -蒲pu -堡*pu -脯*pu -仆pu -莆pu -菩pu -圃pu -浦pu -曝pu -瀑pu -匍pu -噗pu -溥pu -濮pu -璞pu -氆pu -镤pu -镨pu -蹼pu -普遍pubian -普查pucha -扑哧puchi -扑打puda -铺盖pugai -普及puji -铺平puping -仆人puren -菩萨pusa -铺设pushe -朴实pushi -朴素pusu -葡萄putao -普通putong -扑通putong -铺位puwei -谱写puxie -普选puxuan -铺张puzhang -普照puzhao -朴直puzhi -平易近人pyjr -拼音字母pyzm -铺张浪费pzlf -起q -前q -其q -去q -气q -全q -期q -群q -情q -区q -强q -切q -取q -七q -求q -清q -确q -权q -且q -青q -亲爱的qad -情报所qbs -千百万qbw -千变万化qbwh -取长补短qcbd -千锤百炼qcbl -恰到好处qdhc -全党全军和全国qdqg -取而代之qedz -轻而易举qeyj -千方百计qfbj -清规戒律qgjl -勤工俭学qgjx -旗鼓相当qgxd -轻工业qgy -轻工业部qgyb -勤工助学qgzx -权衡利弊qhlb -骑虎难下qhnx -青海省qhs -青红皂白qhzb -起qi -其qi -气qi -期qi -七qi -器qi -齐qi -奇qi -汽qi -企qi -漆qi -欺qi -旗qi -畦qi -启qi -弃qi -歧qi -稽*qi -缉*qi -栖qi -戚qi -妻qi -凄qi -柒qi -沏qi -棋qi -崎qi -脐qi -祈qi -祁qi -骑qi -岂qi -乞qi -契qi -砌qi -迄qi -泣qi -讫qi -亟*qi -亓qi -俟qi -圻qi -芑qi -芪qi -荠*qi -萁qi -萋qi -葺qi -蕲qi -嘁qi -屺qi -岐qi -岖*qi -汔qi -淇qi -骐qi -绮qi -琪qi -琦qi -杞qi -桤qi -槭qi -耆qi -欹qi -祺qi -憩qi -碛qi -颀qi -蛴qi -蜞qi -綦qi -綮qi -蹊qi -鳍qi -麒qi -卡*qia -恰qia -掐qia -洽qia -伽*qia -葜qia -袷*qia -髂qia -恰当qiadang -恰好qiahao -前qian -千qian -钱qian -浅qian -签qian -迁qian -铅qian -潜qian -牵qian -钳qian -纤*qian -谴qian -扦qian -钎qian -仟qian -谦qian -乾qian -黔qian -遣qian -堑qian -嵌qian -欠qian -歉qian -倩qian -佥qian -阡qian -芊qian -芡qian -茜qian -荨qian -掮qian -岍qian -悭qian -慊qian -骞qian -搴qian -褰qian -缱qian -椠qian -犍*qian -肷qian -愆qian -钤qian -虔qian -箬qian -箝qian -前辈qianbei -前边qianbian -浅薄qianbo -钱财qiancai -欠产qianchan -前程qiancheng -签到qiandao -前敌qiandi -签订qianding -签发qianfa -遣返qianfan -前方qianfang -强qiang -将*qiang -枪qiang -抢qiang -墙qiang -腔qiang -呛qiang -羌qiang -蔷qiang -戕qiang -嫱qiang -樯qiang -戗qiang -炝qiang -锖qiang -锵qiang -镪qiang -襁qiang -蜣qiang -羟qiang -跄qiang -墙壁qiangbi -枪毙qiangbi -强辩qiangbian -强大qiangda -枪弹qiangdan -强盗qiangdao -强调qiangdiao -腔调qiangdiao -强度qiangdu -抢夺qiangduo -强攻qianggong -强国qiangguo -强化qianghua -强加qiangjia -强奸qiangjian -抢劫qiangjie -强劲qiangjin -抢救qiangjiu -枪决qiangjue -强烈qianglie -强迫qiangpo -强权qiangquan -强弱qiangruo -枪杀qiangsha -强盛qiangsheng -千古qiangu -牵挂qiangua -蔷薇qiangwei -抢险qiangxian -强行qiangxing -强硬qiangying -强占qiangzhan -强者qiangzhe -强制qiangzhi -枪支qiangzhi -强壮qiangzhuang -前后qianhou -前进qianjin -前景qianjing -迁就qianjiu -歉疚qianjiu -迁居qianju -乾坤qiankun -千里qianli -前例qianli -潜力qianli -牵连qianlian -前列qianlie -浅陋qianlou -前面qianmian -签名qianming -前年qiannian -前期qianqi -千秋qianqiu -前驱qianqu -欠缺qianque -前人qianren -前任qianren -纤弱qianruo -前哨qianshao -牵涉qianshe -歉收qianshou -签署qianshu -遣送qiansong -前提qianti -前天qiantian -欠条qiantiao -前途qiantu -千瓦qianwa -千万qianwan -前往qianwang -前夕qianxi -纤细qianxi -前线qianxian -浅显qianxian -谦虚qianxu -谦逊qianxun -前言qianyan -前沿qianyan -前夜qianye -歉意qianyi -迁移qianyi -牵引qianyin -潜在qianzai -谴责qianze -前者qianzhe -签证qianzheng -牵制qianzhi -钳制qianzhi -签字qianzi -前奏qianzou -桥qiao -瞧qiao -壳*qiao -巧qiao -敲qiao -乔qiao -蕉qiao -橇qiao -锹qiao -悄qiao -侨qiao -鞘qiao -撬qiao -翘qiao -峭qiao -俏qiao -窍qiao -雀*qiao -劁qiao -诮qiao -谯qiao -荞qiao -峤*qiao -愀qiao -憔qiao -缲*qiao -樵qiao -硗qiao -跷qiao -鞒qiao -侨胞qiaobao -桥墩qiaodun -巧计qiaoji -瞧见qiaojian -侨居qiaoju -桥梁qiaoliang -窍门qiaomen -巧妙qiaomiao -桥牌qiaopai -乔迁qiaoqian -悄然qiaoran -侨务qiaowu -敲诈qiaozha -恰似qiasi -洽谈qiatan -岂不qibu -起步qibu -器材qicai -奇才qicai -凄惨qican -起草qicao -汽车qiche -骑车qiche -启程qicheng -起初qichu -凄楚qichu -其次qici -期待qidai -脐带qidai -岂但qidan -启迪qidi -起点qidian -启动qidong -气度qidu -切qie -且qie -砌*qie -茄qie -怯qie -窃qie -伽*qie -郄qie -惬qie -慊*qie -妾qie -挈qie -锲qie -箧qie -窃案qiean -切断qieduan -切合qiehe -窃据qieju -窃取qiequ -怯弱qieruo -切身qieshen -切实qieshi -切题qieti -窃听qieting -切削qiexiao -惬意qieyi -启发qifa -起飞qifei -岂非qifei -气愤qifen -气氛qifen -欺负qifu -气概qigai -乞丐qigai -岂敢qigan -气功qigong -奇怪qiguai -器官qiguan -旗号qihao -漆黑qihei -气候qihou -期货qihuo -契机qiji -奇迹qiji -期间qijian -起见qijian -器件qijian -七届qijie -迄今qijin -起来qilai -凄凉qiliang -欺凌qiling -气流qiliu -歧路qilu -起码qima -骑马qima -启蒙qimeng -奇妙qimiao -器皿qimin -亲qin -侵qin -勤qin -秦qin -钦qin -琴qin -芹qin -擒qin -禽qin -寝qin -沁qin -芩qin -揿qin -吣qin -嗪qin -噙qin -廑*qin -溱qin -檎qin -锓qin -矜*qin -覃qin -螓qin -衾qin -亲爱qinai -亲笔qinbi -岂能qineng -侵犯qinfan -勤奋qinfen -情qing -清qing -青qing -轻qing -倾qing -请qing -亲*qing -庆qing -氢qing -晴qing -卿qing -擎qing -氰qing -顷qing -苘qing -圊qing -檠qing -磬qing -蜻qing -罄qing -箐qing -綮*qing -謦qing -鲭qing -黥qing -清白qingbai -青白qingbai -情报qingbao -情操qingcao -青草qingcao -清查qingcha -清除qingchu -清楚qingchu -青春qingchun -青翠qingcui -清单qingdan -倾倒qingdao -清点qingdian -情调qingdiao -轻浮qingfu -青工qinggong -青海qinghai -庆贺qinghe -清华qinghua -情怀qinghuai -清还qinghuan -请假qingjia -请柬qingjian -请教qingjiao -情节qingjie -清洁qingjie -情景qingjing -顷刻qingke -晴空qingkong -轻快qingkuai -情况qingkuang -青睐qinglai -晴朗qinglang -情理qingli -清理qingli -轻率qinglu -轻蔑qingmie -青年qingnian -氢气qingqi -轻巧qingqiao -请求qingqiu -情趣qingqu -青山qingshan -请示qingshi -清爽qingshuang -青松qingsong -轻松qingsong -倾诉qingsu -青天qingtian -晴天qingtian -倾听qingting -倾吐qingtu -请问qingwen -倾向qingxiang -倾销qingxiao -情形qingxing -清醒qingxing -情绪qingxu -情谊qingyi -轻易qingyi -轻盈qingying -情愿qingyuan -请愿qingyuan -请战qingzhan -轻重qingzhong -倾注qingzhu -庆祝qingzhu -请罪qingzui -侵害qinhai -勤俭qinjian -亲近qinjin -亲眷qinjuan -勤快qinkuai -勤劳qinlao -亲历qinli -亲临qinlin -侵略qinlue -亲密qinmi -勤勉qinmian -钦佩qinpei -亲戚qinqi -亲切qinqie -亲热qinre -亲人qinren -侵入qinru -亲身qinshen -侵蚀qinshi -寝室qinshi -亲手qinshou -亲属qinshu -侵吞qintun -勤务qinwu -亲信qinxin -亲眼qinyan -亲友qinyou -侵占qinzhan -亲自qinzi -穷qiong -琼qiong -邛qiong -茕qiong -穹qiong -蛩qiong -筇qiong -跫qiong -銎qiong -穷国qiongguo -穷苦qiongku -穷困qiongkun -穹隆qionglong -穷期qiongqi -穷人qiongren -穷途qiongtu -气派qipai -欺骗qipian -气魄qipo -乞求qiqiu -崎岖qiqu -齐全qiquan -凄然qiran -起色qise -气色qise -其实qishi -起始qishi -启事qishi -气势qishi -启示qishi -歧视qishi -奇数qishu -汽水qishui -起诉qisu -其他qita -其它qita -奇特qite -气体qiti -汽艇qiting -企图qitu -歧途qitu -求qiu -球qiu -秋qiu -丘qiu -仇*qiu -龟*qiu -邱qiu -囚qiu -酋qiu -泅qiu -俅qiu -巯qiu -犰qiu -湫qiu -逑qiu -遒qiu -楸qiu -赇qiu -虬qiu -蚯qiu -蝤qiu -裘qiu -糗qiu -鳅qiu -鼽qiu -秋播qiubo -球场qiuchang -囚犯qiufan -秋风qiufeng -秋季qiuji -求教qiujiao -囚禁qiujin -求救qiujiu -丘陵qiuling -秋千qiuqian -求情qiuqing -求全qiuquan -秋色qiuse -求实qiushi -秋收qiushou -秋天qiutian -求学qiuxue -求战qiuzhan -求证qiuzheng -求知qiuzhi -求助qiuzhu -期望qiwang -气味qiwei -气温qiwen -奇闻qiwen -欺侮qiwu -气息qixi -栖息qixi -起先qixian -期限qixian -气象qixiang -器械qixie -齐心qixin -气压qiya -欺压qiya -气焰qiyan -企业qiye -起义qiyi -歧义qiyi -起因qiyin -启用qiyong -汽油qiyou -其余qiyu -起源qiyuan -七月qiyue -契约qiyue -欺诈qizha -气质qizhi -旗帜qizhi -其中qizhong -器重qizhong -旗子qizi -妻子qizi -勤俭建国qjjg -勤俭节约qjjy -迄今为止qjwz -取决于qjy -千钧一发qjyf -旗开得胜qkds -全力以赴qlyf -勤劳致富qlzf -千里之行qlzx -亲密无间qmwj -青年人qnr -千篇一律qpyl -清清楚楚qqcc -勤勤恳恳qqkk -切切实实qqss -确确实实qqss -恰恰相反qqxf -求全责备qqzb -恰如其分qrqf -欺人之谈qrzt -七手八脚qsbj -全神贯注qsgz -全世界qsj -切实可行qskx -切身利益qsly -青少年qsn -前所未闻qsww -前所未有qswy -气势汹汹qsxx -齐头并进qtbj -奇谈怪论qtgl -千头万绪qtwx -前提下qtx -去qu -区qu -取qu -曲qu -且*qu -渠qu -屈qu -趋qu -驱qu -趣qu -蛆qu -躯qu -娶qu -龋qu -戌*qu -诎qu -劬qu -苣*qu -蕖qu -蘧qu -岖qu -衢qu -阒qu -璩qu -觑qu -氍qu -朐qu -祛qu -磲qu -鸲qu -癯qu -蛐qu -蠼qu -麴qu -瞿qu -黢qu -全quan -权quan -圈quan -劝quan -泉quan -醛quan -颧quan -痊quan -拳quan -犬quan -券quan -诠quan -荃quan -悛quan -绻quan -辁quan -畎quan -铨quan -蜷quan -筌quan -鬈quan -全部quanbu -全党quandang -劝导quandao -蜷伏quanfu -劝告quangao -全国quanguo -权衡quanheng -全会quanhui -拳击quanji -劝解quanjie -全局quanju -全军quanjun -全力quanli -权利quanli -权力quanli -全貌quanmao -全面quanmian -劝勉quanmian -全民quanmin -全能quanneng -全年quannian -全盘quanpan -全拼quanpin -全球quanqiu -蜷曲quanqu -全权quanquan -全然quanran -全胜quansheng -权术quanshu -泉水quanshui -劝说quanshuo -圈套quantao -全体quanti -拳头quantou -权威quanwei -劝慰quanwei -全文quanwen -全县quanxian -权限quanxian -全校quanxiao -权益quanyi -权宜quanyi -劝诱quanyou -痊愈quanyu -劝止quanzhi -劝阻quanzu -区别qubie -屈才qucai -驱除quchu -取代qudai -渠道qudao -取得qude -取缔qudi -曲调qudiao -驱动qudong -确que -却que -缺que -炔que -瘸que -鹊que -榷que -雀que -阕que -阙que -悫que -确保quebao -缺点quedian -确定queding -缺乏quefa -缺口quekou -确立queli -确切queqie -确认queren -缺少queshao -缺省quesheng -确实queshi -缺席quexi -缺陷quexian -确信quexin -确凿quezao -瘸子quezi -区分qufen -屈服qufu -躯干qugan -区划quhua -曲解qujie -取经qujing -取决qujue -躯壳quke -取乐qule -群qun -裙qun -逡qun -裙带qundai -群岛qundao -去年qunian -群众qunzhong -区区ququ -屈辱quru -驱散qusan -取舍qushe -取胜qusheng -去世qushi -驱使qushi -趋势qushi -躯体quti -区位quwei -区委quwei -趣味quwei -区县quxian -去向quxiang -趋向quxiang -取消quxiao -取信quxin -曲艺quyi -区域quyu -区长quzhang -曲折quzhe -屈指quzhi -驱逐quzhu -曲子quzi -奇形怪状qxgz -全心全意qxqy -气象台qxt -气象万千qxwq -齐心协力qxxl -岂有此理qycl -前因后果qyhg -情有可原qyky -强有力qyl -求之不得qzbd -取之不尽qzbj -轻重缓急qzhj -气壮山河qzsh -千真万确qzwq -人r -如r -日r -认r -入r -任r -热r -然r -容r -让r -润r -弱r -燃r -染r -壤r -绕r -仁r -溶r -刃r -仍r -然ran -燃ran -染ran -冉ran -苒ran -蚺ran -髯ran -燃点randian -然而raner -让rang -壤rang -嚷rang -瓤rang -攘rang -禳rang -穰rang -让步rangbu -让位rangwei -让贤rangxian -然后ranhou -燃料ranliao -染料ranliao -冉冉ranran -燃烧ranshao -绕rao -扰rao -饶rao -荛rao -娆rao -桡rao -扰乱raoluan -如此而已rcey -人才济济rcjj -热re -若*re -惹re -热爱reai -热潮rechao -热忱rechen -热诚recheng -热带redai -热火rehuo -热量reliang -热烈relie -人ren -认ren -任ren -仁ren -刃ren -忍ren -壬ren -韧ren -妊ren -纫ren -仞ren -荏ren -葚ren -饪ren -轫ren -稔ren -衽ren -热闹renao -人才rencai -人次renci -仁慈renci -认错rencuo -人大renda -韧带rendai -人道rendao -认得rende -认定rending -人防renfang -仍reng -扔reng -扔掉rengdiao -人格renge -仍旧rengjiu -人工rengong -认购rengou -仍然rengran -任何renhe -人家renjia -人间renjian -人杰renjie -认可renke -人口renkou -人类renlei -人力renli -人们renmen -任免renmian -人民renmin -任命renming -忍耐rennai -任凭renping -任期renqi -认清renqing -人权renquan -荏苒renran -忍让renrang -人人renren -人参renshen -人生rensheng -人事renshi -人士renshi -认识renshi -人手renshou -忍受renshou -认输renshu -忍痛rentong -人为renwei -认为renwei -人物renwu -任务renwu -人心renxin -忍心renxin -人选renxuan -任意renyi -仁义renyi -任用renyong -人员renyuan -认帐renzhang -认真renzhen -人质renzhi -任职renzhi -认罪renzui -认作renzuo -热切reqie -热情reqing -惹事reshi -热线rexian -热心rexin -热血rexue -人工合成rghc -热火朝天rhct -如虎添翼rhty -日ri -日报ribao -日本riben -日产richan -日常richang -日程richeng -日光riguang -日后rihou -日记riji -日久rijiu -日历rili -日落riluo -日内rinei -日期riqi -日夜riye -日益riyi -日用riyong -日照rizhao -日中rizhong -日子rizi -软件包rjb -人杰地灵rjdl -人尽其才rjqc -如饥似渴rjsk -日久天长rjtc -任劳任怨rlry -热泪盈眶rlyk -人民币rmb -人民代表大会rmdh -人民日报rmrb -燃眉之急rmzj -容rong -溶rong -荣rong -熔rong -融rong -绒rong -戎rong -茸rong -蓉rong -冗rong -嵘rong -狨rong -榕rong -肜rong -蝾rong -熔点rongdian -容光rongguang -融合ronghe -溶化ronghua -熔化ronghua -融化ronghua -融会ronghui -荣获ronghuo -容积rongji -溶解rongjie -容量rongliang -戎马rongma -容貌rongmao -容纳rongna -融洽rongqia -容忍rongren -荣辱rongru -容身rongshen -绒线rongxian -荣幸rongxing -容许rongxu -荣耀rongyao -溶液rongye -容易rongyi -荣誉rongyu -溶质rongzhi -肉rou -揉rou -柔rou -糅rou -蹂rou -鞣rou -柔和rouhe -肉麻rouma -柔软rouruan -肉体routi -任人为贤rrwx -日日夜夜rryy -人生观rsg -认识论rsl -惹事生非rssf -如上所述rsss -如ru -入ru -儒ru -乳ru -茹ru -蠕ru -孺ru -辱ru -汝ru -褥ru -蓐ru -薷ru -嚅ru -洳ru -溽ru -濡ru -缛ru -铷ru -襦ru -颥ru -软ruan -阮ruan -朊ruan -软骨ruangu -软件ruanjian -软禁ruanjin -软盘ruanpan -如常ruchang -如此ruci -入党rudang -蠕动rudong -乳房rufang -如果ruguo -如何ruhe -瑞rui -锐rui -蕊rui -芮rui -蕤rui -枘rui -睿rui -蚋rui -锐利ruili -瑞雪ruixue -锐意ruiyi -儒家rujia -如今rujin -辱骂ruma -入门rumen -入迷rumi -润run -闰run -润滑runhua -弱ruo -若ruo -偌ruo -弱点ruodian -若干ruogan -若是ruoshi -弱小ruoxiao -如期ruqi -入侵ruqin -如若ruruo -儒生rusheng -入手rushou -如同rutong -如下ruxia -入选ruxuan -如意ruyi -如愿ruyuan -入帐ruzhang -人武部rwb -若无其事rwqs -人言可畏rykw -日用品ryp -若有所思ryss -人之长情rzcq -是s -上s -时s -生s -说s -社s -深s -水s -所s -三s -十s -使s -事s -数s -四s -实s -少s -式s -山s -手s -撒sa -萨sa -洒sa -卅sa -仨sa -挲sa -脎sa -飒sa -撒谎sahuang -塞sai -思*sai -赛sai -腮sai -鳃sai -噻sai -赛车saiche -塞子saizi -撒娇sajiao -三san -散san -叁san -伞san -馓san -毵san -糁san -散步sanbu -散布sanbu -散发sanfa -三废sanfei -桑sang -丧sang -嗓sang -搡sang -磉sang -颡sang -丧命sangming -丧失sangshi -三国sanguo -三好sanhao -散会sanhui -三角sanjiao -三届sanjie -散失sanshi -散文sanwen -三月sanyue -扫sao -梢*sao -搔sao -骚sao -嫂sao -埽sao -缫sao -缲sao -臊sao -瘙sao -鳋sao -扫除saochu -扫荡saodang -扫地saodi -骚动saodong -骚乱saoluan -扫描saomiao -扫墓saomu -骚扰saorao -瘙痒saoyang -扫帚saozhou -洒脱satuo -说不定sbd -舍不得sbd -说不过去sbgq -说不来sbl -数不胜数sbss -素不相识sbxs -身不由己sbyj -上层建筑scjz -生产力scl -生产率scl -水产品scp -四川省scs -市场调节sctj -市场信息scxx -生动活泼sdhp -山东省sds -水电站sdz -色se -塞*se -瑟se -涩se -啬se -铯se -穑se -视而不见sebj -色彩secai -色调sediao -色盲semang -森sen -僧seng -僧侣senglu -森林senlin -森严senyan -色情seqing -瑟瑟sese -十二月sey -色泽seze -司法部sfb -赏罚分明sffm -说服力sfl -手风琴sfq -三番五次sfwc -四个现代化sgxh -手工业sgy -沙sha -杀sha -砂sha -啥sha -纱sha -莎sha -刹sha -傻sha -煞sha -杉sha -厦*sha -唼sha -嗄*sha -挲*sha -歃sha -铩sha -痧sha -裟sha -霎sha -鲨sha -煞白shabai -刹车shache -煞车shache -沙发shafa -傻瓜shagua -沙皇shahuang -色*shai -筛shai -晒shai -晒台shaitai -砂烬shajin -沙龙shalong -沙漠shamo -山shan -单*shan -闪shan -善shan -珊shan -扇shan -陕shan -掸*shan -苫shan -杉shan -删shan -煽shan -衫shan -擅shan -赡shan -膳shan -汕shan -缮shan -栅*shan -剡shan -讪shan -鄯shan -埏shan -芟shan -潸shan -姗shan -嬗shan -骟shan -膻shan -禅*shan -钐shan -疝shan -蟮shan -舢shan -跚shan -鳝shan -刹那shana -山坳shanao -陕北shanbei -擅长shanchang -删除shanchu -山川shanchuan -山地shandi -闪电shandian -扇动shandong -煽动shandong -山东shandong -山峰shanfeng -上shang -商shang -伤shang -尚shang -汤*shang -墒shang -赏shang -晌shang -裳shang -垧shang -绱shang -殇shang -熵shang -觞shang -删改shangai -山岗shangang -山冈shangang -上班shangban -上报shangbao -上边shangbian -商标shangbiao -上部shangbu -上策shangce -上层shangceng -商场shangchang -上次shangci -赏赐shangci -上当shangdang -上等shangdeng -上帝shangdi -商店shangdian -上调shangdiao -商定shangding -上访shangfang -伤感shanggan -上告shanggao -赏光shangguang -上海shanghai -伤害shanghai -商行shanghang -上级shangji -上集shangji -上进shangjin -上空shangkong -上来shanglai -商量shangliang -上流shangliu -上门shangmen -上面shangmian -上年shangnian -山沟shangou -商品shangpin -商洽shangqia -上前shangqian -尚且shangqie -上去shangqu -商榷shangque -商人shangren -上任shangren -上山shangshan -上升shangsheng -赏识shangshi -上述shangshu -上司shangsi -上诉shangsu -商谈shangtan -商讨shangtao -闪光shanguang -上文shangwen -上午shangwu -商务shangwu -上下shangxia -上限shangxian -伤心shangxin -上旬shangxun -上演shangyan -商业shangye -商议shangyi -上映shangying -上游shangyou -上涨shangzhang -上阵shangzhen -山河shanhe -善后shanhou -删节shanjie -善良shanliang -山林shanlin -山岭shanling -山脉shanmai -杉木shanmu -山区shanqu -扇区shanqu -山水shanshui -闪烁shanshuo -山头shantou -山西shanxi -陕西shanxi -赡养shanyang -闪耀shanyao -善意shanyi -善于shanyu -善战shanzhan -擅自shanzi -少shao -烧shao -稍shao -绍shao -召*shao -哨shao -梢shao -鞘*shao -捎shao -芍shao -勺shao -韶shao -邵shao -劭shao -苕shao -潲shao -杓*shao -蛸shao -筲shao -艄shao -哨兵shaobing -艄公shaogong -烧毁shaohui -少见shaojian -哨卡shaoka -少量shaoliang -少年shaonian -少女shaonu -烧伤shaoshang -少数shaoshu -哨所shaosuo -稍微shaowei -少许shaoxu -稍许shaoxu -少爷shaoye -少有shaoyou -少于shaoyu -少壮shaozhuang -沙哑shaya -砂眼shayan -傻子shazi -社she -设she -射she -摄she -舌she -折*she -涉she -舍she -蛇she -奢she -赊she -赦she -慑she -厍she -佘she -摺*she -猞she -滠she -歙she -畲she -麝she -设备shebei -射程shecheng -奢侈shechi -舍得shede -设法shefa -慑服shefu -赊购shegou -奢华shehua -社会shehui -社稷sheji -涉及sheji -设计sheji -射击sheji -舍己sheji -社交shejiao -设立sheli -涉猎shelie -社论shelun -深shen -身shen -神shen -什*shen -伸shen -参*shen -甚shen -渗shen -沈shen -肾shen -审shen -申shen -慎shen -砷shen -呻shen -娠shen -绅shen -婶shen -诜shen -谂shen -莘shen -葚*shen -哂shen -渖shen -椹shen -胂shen -矧shen -蜃shen -深奥shenao -申报shenbao -身边shenbian -申辩shenbian -身材shencai -审查shencha -深沉shenchen -深处shenchu -审处shenchu -审定shending -深度shendu -甚而shener -身分shenfen -身份shenfen -生sheng -胜sheng -声sheng -省sheng -升sheng -盛sheng -绳sheng -剩sheng -圣sheng -牲sheng -乘*sheng -甥sheng -嵊sheng -渑*sheng -晟sheng -眚sheng -笙sheng -生财shengcai -生产shengchan -生成shengcheng -牲畜shengchu -生存shengcun -盛大shengda -省得shengde -胜地shengdi -盛典shengdian -声调shengdiao -生动shengdong -省份shengfen -胜负shengfu -省府shengfu -生根shenggen -升华shenghua -省会shenghui -盛会shenghui -生活shenghuo -生机shengji -生计shengji -升级shengji -圣洁shengjie -圣经shengjing -盛开shengkai -牲口shengkou -盛况shengkuang -生理shengli -胜利shengli -省力shengli -省略shenglue -生命shengming -声明shengming -盛名shengming -生怕shengpa -生僻shengpi -生平shengping -升旗shengqi -生前shengqian -升迁shengqian -盛情shengqing -生趣shengqu -省去shengqu -胜任shengren -生日shengri -省事shengshi -盛事shengshi -声势shengshi -生疏shengshu -生死shengsi -胜似shengsi -胜诉shengsu -绳索shengsuo -生态shengtai -声讨shengtao -声望shengwang -省委shengwei -生物shengwu -生息shengxi -剩下shengxia -盛夏shengxia -圣贤shengxian -生效shengxiao -生肖shengxiao -盛行shengxing -生涯shengya -生意shengyi -声音shengyin -生于shengyu -生育shengyu -胜于shengyu -声誉shengyu -剩余shengyu -声援shengyuan -生长shengzhang -省长shengzhang -声张shengzhang -胜仗shengzhang -生殖shengzhi -圣旨shengzhi -盛装shengzhuang -审核shenhe -深厚shenhou -深化shenhua -神话shenhua -甚或shenhuo -审计shenji -神经shenjing -深刻shenke -审理shenli -什么shenme -审美shenmei -神秘shenmi -申明shenming -审判shenpan -身旁shenpang -审批shenpi -神气shenqi -神奇shenqi -深浅shenqian -深切shenqie -深情shenqing -申请shenqing -身躯shenqu -深入shenru -渗入shenru -神圣shensheng -身世shenshi -绅士shenshi -伸手shenshou -申述shenshu -神速shensu -申诉shensu -伸缩shensuo -神态shentai -身体shenti -神通shentong -渗透shentou -审问shenwen -神仙shenxian -审讯shenxun -沈阳shenyang -审议shenyi -呻吟shenyin -身影shenying -深远shenyuan -申冤shenyuan -审阅shenyue -深造shenzao -伸张shenzhang -深圳shenzhen -甚至shenzhi -深重shenzhong -慎重shenzhong -神州shenzhou -舍弃sheqi -赊欠sheqian -设施sheshi -社团shetuan -奢望shewang -射线shexian -涉嫌shexian -设想shexiang -赊销shexiao -设宴sheyan -摄影sheying -社员sheyuan -社长shezhang -设置shezhi -涉足shezu -社会公德shgd -是shi -时shi -十shi -使shi -事shi -实shi -式shi -识shi -世shi -试shi -石shi -什shi -示shi -市shi -史shi -师shi -始shi -施shi -士shi -势shi -湿shi -适shi -食shi -失shi -视shi -室shi -氏shi -似*shi -蚀shi -诗shi -释shi -殖*shi -拾shi -饰shi -驶shi -匙*shi -狮shi -尸shi -虱shi -矢shi -屎shi -柿shi -拭shi -誓shi -逝shi -嗜shi -噬shi -仕shi -侍shi -恃shi -嘘*shi -峙*shi -谥shi -埘shi -莳shi -蓍shi -弑shi -轼shi -贳shi -炻shi -铈shi -螫shi -舐shi -筮shi -酾shi -豕shi -鲥shi -鲺shi -失败shibai -势必shibi -事变shibian -师表shibiao -识别shibie -失策shice -史册shice -视察shicha -时常shichang -失常shichang -市场shichang -时辰shichen -失传shichuan -侍从shicong -时代shidai -世代shidai -适当shidang -是的shide -实地shidi -试点shidian -失调shidiao -失掉shidiao -事端shiduan -拾掇shiduo -时而shier -示范shifan -师范shifan -施放shifang -释放shifang -是非shifei -时分shifen -十分shifen -侍奉shifeng -是否shifou -师傅shifu -实干shigan -是个shige -诗歌shige -施工shigong -事故shigu -世故shigu -尸骨shigu -使馆shiguan -时光shiguang -嗜好shihao -适合shihe -时候shihou -事后shihou -侍候shihou -使唤shihuan -实惠shihui -失火shihuo -时机shiji -事迹shiji -实际shiji -世纪shiji -试剂shiji -史籍shiji -施加shijia -市价shijia -时间shijian -事件shijian -世间shijian -实践shijian -视角shijiao -市郊shijiao -使节shijie -十届shijie -世界shijie -使劲shijin -市井shijing -时局shiju -视觉shijue -时刻shike -石刻shike -市侩shikuai -实况shikuang -事理shili -实力shili -事例shili -势利shili -失利shili -势力shili -视力shili -示例shili -失恋shilian -适量shiliang -矢量shiliang -拾零shiling -失灵shiling -适龄shiling -时髦shimao -失密shimi -市民shimin -使命shiming -市内shinei -室内shinei -诗篇shipian -食品shipin -视频shipin -识破shipo -时期shiqi -事前shiqian -失窃shiqie -事情shiqing -实情shiqing -时区shiqu -时取shiqu -失去shiqu -市区shiqu -诗人shiren -市容shirong -湿润shirun -示弱shiruo -失散shisan -失色shise -施舍shishe -师生shisheng -失声shisheng -时时shishi -时事shishi -适时shishi -事实shishi -失事shishi -实施shishi -失实shishi -逝世shishi -史诗shishi -失势shishi -誓师shishi -尸首shishou -失守shishou -实数shishu -施属shishu -世俗shisu -失算shisuan -事态shitai -试探shitan -食堂shitang -实体shiti -尸体shiti -石头shitou -势头shitou -师团shituan -十万shiwan -失望shiwang -市委shiwei -示威shiwei -时务shiwu -事物shiwu -事务shiwu -实物shiwu -食物shiwu -饰物shiwu -失误shiwu -实习shixi -事先shixian -视线shixian -实现shixian -试想shixiang -事项shixiang -实效shixiao -试销shixiao -失信shixin -实行shixing -试行shixing -施行shixing -失修shixiu -实学shixue -史学shixue -实验shiyan -试验shiyan -食言shiyan -誓言shiyan -式样shiyang -事业shiye -实业shiye -失业shiye -视野shiye -时宜shiyi -事宜shiyi -示意shiyi -诗意shiyi -适宜shiyi -释疑shiyi -适应shiying -使用shiyong -实用shiyong -试用shiyong -适用shiyong -事由shiyou -石油shiyou -誓由shiyou -适于shiyu -誓愿shiyuan -十月shiyue -失约shiyue -实在shizai -实战shizhan -施展shizhan -市长shizhang -师长shizhang -使者shizhe -侍者shizhe -失真shizhen -市镇shizhen -市政shizheng -试制shizhi -实质shizhi -市制shizhi -食指shizhi -失职shizhi -适中shizhong -示众shizhong -始终shizhong -时装shizhuang -师资shizi -十足shizu -实足shizu -失足shizu -始祖shizu -手shou -受shou -收shou -首shou -守shou -熟*shou -授shou -寿shou -兽shou -售shou -瘦shou -狩shou -绶shou -艏shou -守备shoubei -手表shoubiao -收兵shoubing -收藏shoucang -手册shouce -首倡shouchang -寿辰shouchen -收成shoucheng -首创shouchuang -首次shouci -收存shoucun -寿诞shoudan -受到shoudao -守敌shoudi -首度shoudu -首都shoudu -手段shouduan -守法shoufa -首犯shoufan -收复shoufu -首府shoufu -手感shougan -手稿shougao -收割shouge -收购shougou -受害shouhai -守候shouhou -守护shouhu -收回shouhui -受贿shouhui -收获shouhuo -收集shouji -售价shoujia -受奖shoujiang -授奖shoujiang -手脚shoujiao -收缴shoujiao -首届shoujie -守旧shoujiu -收据shouju -授课shouke -受理shouli -收敛shoulian -首领shouling -收留shouliu -收录shoulu -收买shoumai -授命shouming -寿命shouming -首脑shounao -首批shoupi -授权shouquan -收容shourong -收入shouru -手软shouruan -瘦弱shouruo -首饰shoushi -手术shoushu -收缩shousuo -收条shoutiao -收听shouting -收尾shouwei -首尾shouwei -首先shouxian -首相shouxiang -瘦小shouxiao -收效shouxiao -手续shouxu -瘦削shouxue -收养shouyang -首要shouyao -受益shouyi -收益shouyi -兽医shouyi -受用shouyong -授予shouyu -守则shouze -首长shouzhang -收支shouzhi -生活上shs -上海市shs -数shu -书shu -树shu -属shu -术shu -输shu -述shu -熟shu -束shu -鼠shu -疏shu -殊shu -舒shu -蔬shu -薯shu -叔shu -署shu -枢shu -梳shu -抒shu -淑shu -赎shu -孰shu -暑shu -曙shu -蜀shu -黍shu -戍shu -竖shu -墅shu -庶shu -漱shu -恕shu -俞*shu -丨shu -倏shu -塾shu -菽shu -摅shu -沭shu -澍shu -姝shu -纾shu -毹shu -腧shu -殳shu -秫shu -刷shua -耍shua -唰shua -衰shuai -帅shuai -摔shuai -甩shuai -蟀shuai -衰败shuaibai -摔打shuaida -摔交shuaijiao -衰竭shuaijie -衰老shuailao -衰弱shuairuo -衰退shuaitui -衰亡shuaiwang -耍赖shualai -栓shuan -拴shuan -闩shuan -涮shuan -双shuang -霜shuang -爽shuang -泷*shuang -孀shuang -双边shuangbian -双方shuangfang -爽口shuangkou -爽快shuangkuai -爽朗shuanglang -双拼shuangpin -双重shuangzhong -耍弄shuanong -刷洗shuaxi -刷新shuaxin -书报shubao -书本shuben -蔬菜shucai -舒畅shuchang -输出shuchu -树丛shucong -疏导shudao -书店shudian -数额shue -抒发shufa -书法shufa -舒服shufu -束缚shufu -曙光shuguang -蜀汉shuhan -疏忽shuhu -倏忽shuhu -书画shuhua -水shui -说*shui -谁shui -睡shui -税shui -水稻shuidao -水电shuidian -水分shuifen -水果shuiguo -水火shuihuo -水晶shuijing -水库shuiku -水利shuili -水流shuiliu -睡眠shuimian -水平shuiping -税收shuishou -税务shuiwu -水下shuixia -水性shuixing -水源shuiyuan -水灾shuizai -谁知shuizhi -书记shuji -书籍shuji -暑假shujia -数据shuju -书刊shukan -数理shuli -树立shuli -竖立shuli -熟练shulian -数量shuliang -数列shulie -疏漏shulou -数落shuluo -数码shuma -书面shumian -庶民shumin -数目shumu -书目shumu -树木shumu -顺shun -吮shun -瞬shun -舜shun -顺便shunbian -顺差shuncha -顺次shunci -顺从shuncong -顺当shundang -顺道shundao -顺风shunfeng -枢纽shuniu -顺利shunli -顺路shunlu -瞬时shunshi -顺势shunshi -顺心shunxin -顺序shunxu -顺应shunying -顺着shunzhuo -说shuo -数*shuo -硕shuo -朔shuo -烁shuo -蒴shuo -搠shuo -妁shuo -槊shuo -铄shuo -说到shuodao -说道shuodao -说动shuodong -说法shuofa -说服shuofu -硕果shuoguo -说话shuohua -说教shuojiao -说明shuoming -说情shuoqing -硕士shuoshi -述评shuping -署期shuqi -暑期shuqi -抒情shuqing -熟人shuren -输入shuru -疏散shusan -属实shushi -熟识shushi -舒适shushi -束手shushou -叔叔shushu -数说shushuo -述说shushuo -输送shusong -疏松shusong -舒坦shutan -疏通shutong -熟悉shuxi -属相shuxiang -舒心shuxin -书信shuxin -属性shuxing -数学shuxue -属于shuyu -术语shuyu -疏远shuyuan -舒展shuzhan -数值shuzhi -树脂shuzhi -梳妆shuzhuang -数字shuzi -赎罪shuzui -售货员shy -社会主义shzy -四si -思si -死si -斯si -丝si -似si -司si -饲si -食*si -私si -厕*si -撕si -嘶si -肆si -寺si -嗣si -伺si -巳si -厮si -俟*si -兕si -厶si -咝si -汜si -泗si -澌si -姒si -驷si -缌si -祀si -锶si -鸶si -耜si -蛳si -笥si -死板siban -四边sibian -死别sibie -思潮sichao -丝绸sichou -四处sichu -四川sichuan -死党sidang -死敌sidi -司法sifa -四方sifang -四海sihai -丝毫sihao -嗣后sihou -似乎sihu -四化sihua -死缓sihuan -撕毁sihui -死活sihuo -四季siji -司机siji -私交sijiao -四届sijie -思考sikao -私利sili -私了siliao -司令siling -思路silu -四面simian -思念sinian -私念sinian -死去siqu -私人siren -死伤sishang -私事sishi -死尸sishi -死水sishui -思索sisuo -四体siti -私吞situn -死亡siwang -思维siwei -斯文siwen -私下sixia -思想sixiang -四项sixiang -死心sixin -私心sixin -肆行sixing -死刑sixing -私有siyou -私欲siyu -寺院siyuan -四月siyue -死者sizhe -四周sizhou -私自sizi -死罪sizui -拾金不昧sjbm -身经百战sjbz -书记处sjc -世界观sjg -舍己救人sjjr -数据库sjk -省军区sjq -杀鸡取蛋sjqd -实际上sjs -设计所sjs -试金石sjs -舍己为人sjwr -设计院sjy -随机应变sjyb -十进制sjz -石家庄sjz -适可而止skez -数理化slh -收录机slj -十六进制sljz -三令五申slws -司令员sly -四面八方smbf -手忙脚乱smjl -生命力sml -说明书sms -什么样smy -深谋远虑smyl -数目字smz -松song -送song -宋song -颂song -耸song -怂song -讼song -诵song -凇song -菘song -崧song -嵩song -忪song -悚song -淞song -竦song -松绑songbang -送别songbie -松弛songchi -松动songdong -颂歌songge -松劲songjin -松快songkuai -耸立songli -送礼songli -松散songsan -松涛songtao -松懈songxie -颂扬songyang -怂恿songyong -送葬songzang -送终songzhong -搜sou -艘sou -擞sou -嗽sou -叟sou -薮sou -嗖sou -嗾sou -馊sou -溲sou -飕sou -瞍sou -锼sou -螋sou -搜查soucha -搜集souji -搜索sousuo -搜寻souxun -售票处spc -食品工业spgy -水平线spx -生气勃勃sqbb -诗情画意sqhy -盛气凌人sqlr -山穷水尽sqsj -十全十美sqsm -首屈一指sqyz -四人帮srb -损人利己srlj -深入浅出srqc -似是而非ssef -时时刻刻sskk -姗姗来迟sslc -实事求是ssqs -事实上sss -随时随地sssd -善始善终sssz -顺水推舟sstz -四通公司stgs -四通集团stjt -身体力行stlx -生态平衡stph -素su -速su -苏su -塑su -缩su -俗su -诉su -宿su -肃su -酥su -粟su -僳su -溯su -夙su -谡su -蔌su -嗉su -愫su -涑su -簌su -觫su -稣su -算suan -酸suan -蒜suan -狻suan -酸楚suanchu -算法suanfa -算计suanji -算了suanle -算盘suanpan -算术suanshu -酸疼suanteng -酸痛suantong -素材sucai -速成sucheng -苏丹sudan -速度sudu -俗话suhua -随sui -穗sui -碎sui -虽sui -岁sui -尿*sui -隋sui -绥sui -髓sui -遂sui -隧sui -祟sui -谇sui -荽sui -濉sui -邃sui -燧sui -眭sui -睢sui -随笔suibi -随便suibian -随处suichu -随从suicong -随地suidi -随和suihe -随后suihou -随机suiji -随即suiji -虽然suiran -随身suishen -随时suishi -随手suishou -岁数suishu -虽说suishuo -随同suitong -随心suixin -随行suixing -随意suiyi -遂意suiyi -岁月suiyue -虽则suize -随着suizhe -诉苦suku -苏联sulian -塑料suliao -速率sulu -素描sumiao -肃穆sumu -损sun -孙sun -笋sun -荪sun -狲sun -飧sun -榫sun -隼sun -损害sunhai -损耗sunhao -损坏sunhuai -损伤sunshang -损失sunshi -孙子sunzi -所suo -缩suo -锁suo -索suo -莎*suo -蓑suo -梭suo -唆suo -琐suo -唢suo -嗦suo -嗍suo -娑suo -桫suo -挲*suo -睃suo -羧suo -所得suode -缩短suoduan -缩减suojian -锁链suolian -所能suoneng -索取suoqu -唆使suoshi -所属suoshu -琐碎suosui -所为suowei -所谓suowei -缩小suoxiao -缩写suoxie -琐屑suoxie -索性suoxing -所以suoyi -索引suoyin -缩影suoying -所有suoyou -所在suozai -所长suozhang -所至suozhi -梭子suozi -肃清suqing -苏区suqu -宿舍sushe -素数sushu -诉说sushuo -诉讼susong -速效suxiao -速写suxie -苏醒suxing -素养suyang -宿营suying -溯源suyuan -宿愿suyuan -夙愿suyuan -塑造suzao -速战suzhan -素质suzhi -苏州suzhou -苏维埃swa -税务局swj -手舞足蹈swzd -少先队sxd -身心健康sxjk -思想上sxs -山西省sxs -陕西省sxs -顺息万变sxwb -所向无敌sxwd -思想性sxx -商业部syb -说一不二sybe -收音机syj -使用价值syjz -所有权syq -沈阳市sys -实用性syx -十一月syy -所有制syz -私有制syz -时至今日szjr -三中全会szqh -始终如一szry -深圳四通szst -所作所为szsw -甚至于szy -他t -同t -它t -提t -题t -体t -图t -天t -头t -通t -条t -特t -土t -团t -统t -台t -她t -太t -套t -铁t -他ta -它ta -她ta -塔ta -踏ta -塌ta -獭ta -挞ta -蹋ta -拓*ta -嗒*ta -闼ta -溻ta -漯*ta -遢ta -榻ta -沓ta -铊ta -趿ta -鳎ta -踏步tabu -他的tade -它的tade -她的tade -塌方tafang -台tai -太tai -态tai -胎tai -抬tai -泰tai -苔tai -酞tai -汰tai -邰tai -薹tai -呔*tai -骀*tai -肽tai -炱tai -钛tai -跆tai -鲐tai -台北taibei -台词taici -态度taidu -台风taifeng -台阶taijie -太平taiping -泰然tairan -泰山taishan -态势taishi -太太taitai -抬头taitou -台湾taiwan -太阳taiyang -太原taiyuan -天安门tam -他们tamen -它们tamen -她们tamen -谈tan -碳tan -探tan -炭tan -弹*tan -坦tan -贪tan -滩tan -坍tan -摊tan -瘫tan -坛tan -檀tan -痰tan -潭tan -谭tan -毯tan -袒tan -叹tan -郯tan -澹tan -昙tan -忐tan -钽tan -锬tan -镡*tan -坦白tanbai -探测tance -探访tanfang -谈锋tanfeng -叹服tanfu -堂tang -糖tang -唐tang -塘tang -汤tang -搪tang -棠tang -膛tang -倘tang -躺tang -淌tang -趟tang -烫tang -傥tang -帑tang -溏tang -瑭tang -樘tang -铴tang -镗tang -耥tang -螗tang -螳tang -羰tang -醣tang -倘不tangbu -搪瓷tangci -弹弓tangong -倘若tangruo -搪塞tangsai -烫伤tangshang -堂堂tangtang -唐突tangtu -弹劾tanhe -袒护tanhu -谈话tanhua -瘫痪tanhuan -探究tanjiu -坦克tanke -贪婪tanlan -坦率tanlu -谈论tanlun -摊派tanpai -谈判tanpan -叹气tanqi -探亲tanqin -弹琴tanqin -坦然tanran -探索tansuo -探讨tantao -谈天tantian -探听tanting -贪图tantu -谈吐tantu -滩涂tantu -探望tanwang -探问tanwen -贪污tanwu -叹息tanxi -探险tanxian -谈心tanxin -弹性tanxing -探询tanxun -贪赃tanzang -套tao -讨tao -逃tao -陶tao -萄tao -桃tao -掏tao -涛tao -滔tao -绦tao -淘tao -鼗tao -叨*tao -啕tao -洮tao -韬tao -焘tao -饕tao -逃奔taoben -逃避taobi -逃兵taobing -逃窜taocuan -逃遁taodun -讨伐taofa -讨饭taofan -套购taogou -讨好taohao -讨还taohuan -讨价taojia -桃李taoli -韬略taolue -讨论taolun -逃命taoming -逃难taonan -逃跑taopao -淘气taoqi -逃生taosheng -淘汰taotai -滔滔taotao -逃脱taotuo -逃亡taowang -讨厌taoyan -陶冶taoye -桃子taozi -逃走taozou -陶醉taozui -踏青taqing -他人taren -踏实tashi -他说tashuo -他乡taxiang -挑拨离间tblj -台北市tbs -贪便宜tby -统筹兼顾tcjg -铁道部tdb -土地改革tdgg -同等学历tdxl -特te -忒te -忑te -慝*te -铽te -特别tebie -特产techan -特长techang -特出techu -特此teci -特大teda -特等tedeng -特地tedi -特点tedian -特定teding -特级teji -特技teji -特急teji -特将tejiang -特刊tekan -特快tekuai -特例teli -腾teng -疼teng -藤teng -誊teng -滕teng -疼爱tengai -腾达tengda -誊写tengxie -特派tepai -特区tequ -特权tequan -托儿所tes -特色tese -特使teshi -特殊teshu -特为tewei -特务tewu -特效texiao -特写texie -特性texing -特邀teyao -特意teyi -特有teyou -特约teyue -特征tezheng -特制tezhi -特种tezhong -突飞猛进tfmj -铁饭碗tfw -同甘共苦tggk -提货单thd -谈何容易thry -提ti -题ti -体ti -替ti -梯ti -惕ti -剔ti -踢ti -锑ti -蹄ti -啼ti -嚏ti -涕ti -剃ti -屉ti -倜ti -荑*ti -悌ti -逖ti -绨*ti -缇ti -鹈ti -裼ti -醍ti -天tian -田tian -添tian -填tian -甜tian -佃*tian -恬tian -舔tian -腆tian -掭tian -忝tian -阗tian -殄tian -畋tian -填报tianbao -天边tianbian -填表tianbiao -填补tianbu -天才tiancai -天长tianchang -填充tianchong -天地tiandi -田地tiandi -天鹅tiane -天府tianfu -天赋tianfu -天机tianji -天际tianji -添加tianjia -天津tianjin -恬静tianjing -天空tiankong -填空tiankong -天理tianli -天良tianliang -天亮tianliang -甜美tianmei -甜蜜tianmi -天明tianming -天平tianping -天气tianqi -天桥tianqiao -天然tianran -天壤tianrang -天色tianse -天上tianshang -天生tiansheng -天使tianshi -天堂tiantang -天体tianti -天天tiantian -甜头tiantou -天文tianwen -天下tianxia -天险tianxian -天仙tianxian -天性tianxing -天涯tianya -田野tianye -天真tianzhen -天职tianzhi -添置tianzhi -天资tianzi -条tiao -调*tiao -跳tiao -挑tiao -迢tiao -眺tiao -佻tiao -苕*tiao -祧tiao -窕tiao -蜩tiao -笤tiao -粜tiao -龆tiao -鲦tiao -髫tiao -挑拔tiaoba -跳动tiaodong -挑动tiaodong -挑逗tiaodou -跳高tiaogao -调和tiaohe -调剂tiaoji -条件tiaojian -调解tiaojie -调节tiaojie -条款tiaokuan -调理tiaoli -条理tiaoli -条例tiaoli -条令tiaoling -调配tiaopei -挑剔tiaoti -调停tiaoting -条文tiaowen -跳舞tiaowu -调戏tiaoxi -挑衅tiaoxin -挑选tiaoxuan -条约tiaoyue -挑战tiaozhan -调整tiaozheng -条子tiaozi -提拨tibo -题材ticai -体裁ticai -体操ticao -体察ticha -提倡tichang -提成ticheng -提出tichu -剔除tichu -题词tici -替代tidai -梯队tidui -铁tie -贴tie -帖tie -萜tie -餮tie -贴补tiebu -铁道tiedao -贴近tiejin -铁路tielu -贴切tieqie -贴身tieshen -铁证tiezheng -提法tifa -提防tifang -提纲tigang -提高tigao -体格tige -提供tigong -替换tihuan -体会tihui -提货tihuo -体积tiji -提价tijia -体力tili -体例tili -提炼tilian -体谅tiliang -体面timian -提名timing -题名timing -题目timu -听ting -停ting -庭ting -挺ting -廷ting -厅ting -烃ting -汀ting -亭ting -艇ting -莛ting -葶ting -婷ting -梃ting -町*ting -铤ting -蜓ting -霆ting -挺拔tingba -停办tingban -停泊tingbo -停产tingchan -听从tingcong -停顿tingdun -停工tinggong -挺括tinggua -听候tinghou -听话tinghua -停火tinghuo -听见tingjian -厅局tingju -听觉tingjue -停留tingliu -听凭tingping -听取tingqu -听任tingren -听说tingshuo -听信tingxin -厅长tingzhang -停止tingzhi -停职tingzhi -停滞tingzhi -听众tingzhong -提起tiqi -提前tiqian -提取tiqu -提升tisheng -提示tishi -体坛titan -体贴titie -提问tiwen -体温tiwen -体系tixi -体现tixian -体型tixing -提醒tixing -体验tiyan -提要tiyao -提议tiyi -体育tiyu -体制tizhi -体质tizhi -题字tizi -统计表tjb -条件反射tjfs -讨价还价tjhj -天津市tjs -条件下tjx -讨论会tlh -拖拉机tlj -他们的tmd -同盟会tmh -天南地北tndb -同tong -通tong -统tong -铜tong -痛tong -筒tong -童tong -桶tong -侗*tong -恫*tong -桐tong -酮tong -瞳tong -彤tong -捅tong -佟tong -仝tong -垌*tong -茼tong -嗵tong -峒*tong -恸tong -潼tong -砼tong -同伴tongban -同胞tongbao -通报tongbao -同辈tongbei -通病tongbing -同步tongbu -通常tongchang -通称tongcheng -统称tongcheng -痛斥tongchi -统筹tongchou -痛楚tongchu -同窗tongchuang -同道tongdao -通道tongdao -同等tongdeng -通电tongdian -通牒tongdie -通读tongdu -通告tonggao -统购tonggou -通过tongguo -通航tonghang -痛恨tonghen -同化tonghua -通话tonghua -童话tonghua -痛悔tonghui -通婚tonghun -统计tongji -通辑tongji -痛击tongji -同居tongju -痛苦tongku -痛哭tongku -痛快tongkuai -同僚tongliao -通令tongling -同盟tongmeng -同年tongnian -童年tongnian -同期tongqi -通气tongqi -同情tongqing -通融tongrong -同上tongshang -通商tongshang -同时tongshi -同事tongshi -统属tongshu -统帅tongshuai -通顺tongshun -通俗tongsu -通往tongwang -痛恶tongwu -痛惜tongxi -统辖tongxia -通向tongxiang -同乡tongxiang -统销tongxiao -通宵tongxiao -通晓tongxiao -同心tongxin -痛心tongxin -通信tongxin -同行tongxing -通行tongxing -同性tongxing -同学tongxue -通讯tongxun -同样tongyang -统一tongyi -同意tongyi -通用tongyong -通邮tongyou -统战tongzhan -同志tongzhi -统治tongzhi -通知tongzhi -头tou -投tou -透tou -偷tou -钭tou -骰tou -投案touan -头版touban -投奔touben -投标toubiao -投产touchan -透彻touche -头等toudeng -投放toufang -投机touji -投靠toukao -投篮toulan -偷懒toulan -头颅toulu -透露toulu -头面toumian -透明touming -头目toumu -头脑tounao -投票toupiao -透气touqi -投入touru -投身toushen -透视toushi -头痛toutong -偷闲touxian -投降touxiang -头绪touxu -投影touying -投掷touzhi -头子touzi -投资touzi -突破口tpk -太平洋tpy -通情达理tqdl -天气预报tqyb -突然袭击trxj -妥善处理tscl -通俗读物tsdw -挺身而出tsec -图书馆tsg -滔滔不绝ttbj -痛痛快快ttkk -团体赛tts -踏踏实实ttss -图tu -土tu -突tu -途tu -徒tu -凸tu -涂tu -吐tu -兔tu -屠tu -秃tu -堍tu -荼tu -菟tu -钍tu -酴tu -团tuan -湍tuan -抟tuan -彖tuan -疃tuan -图案tuan -湍急tuanji -团结tuanjie -团聚tuanju -湍流tuanliu -团体tuanti -团员tuanyuan -团圆tuanyuan -团长tuanzhang -突变tubian -图表tubiao -土产tuchan -突出tuchu -土地tudi -徒弟tudi -土匪tufei -土改tugai -涂改tugai -图画tuhua -土话tuhua -推tui -退tui -腿tui -颓tui -蜕tui -褪tui -忒*tui -煺tui -蜕变tuibian -退步tuibu -推测tuice -推迟tuichi -推崇tuichong -退出tuichu -推导tuidao -推动tuidong -推断tuiduan -推翻tuifan -颓废tuifei -推广tuiguang -退化tuihua -蜕化tuihua -退回tuihui -推荐tuijian -推进tuijin -推举tuiju -推开tuikai -推理tuili -推论tuilun -推敲tuiqiao -推却tuique -退却tuique -推让tuirang -退让tuirang -颓丧tuisang -退色tuise -推算tuisuan -退缩tuisuo -颓唐tuitang -推托tuituo -退伍tuiwu -推向tuixiang -推销tuixiao -推卸tuixie -推行tuixing -退休tuixiu -退学tuixue -推移tuiyi -退职tuizhi -突击tuji -图解tujie -途径tujing -徒劳tulao -图例tuli -吐露tulu -囤*tun -褪*tun -吞tun -屯tun -臀tun -氽tun -饨tun -暾tun -豚tun -吞并tunbing -吞没tunmo -吞吐tuntu -脱tuo -拖tuo -托tuo -妥tuo -椭tuo -舵*tuo -魄*tuo -鸵tuo -陀tuo -驮tuo -驼tuo -拓tuo -唾tuo -乇tuo -佗tuo -坨tuo -庹tuo -沱tuo -柝tuo -柁*tuo -橐tuo -砣tuo -铊*tuo -箨tuo -酡tuo -跎tuo -鼍tuo -驼背tuobei -拓补tuobu -脱出tuochu -妥当tuodang -脱轨tuogui -拓荒tuohuang -脱节tuojie -拖拉tuola -脱离tuoli -唾骂tuoma -唾弃tuoqi -妥善tuoshan -脱身tuoshen -妥协tuoxie -拖延tuoyan -唾液tuoye -图片tupian -突破tupo -突起tuqi -突然turan -徒然turan -土壤turang -屠杀tusha -徒手tushou -图书tushu -吐痰tutan -突围tuwei -突兀tuwu -图象tuxiang -图像tuxiang -图形tuxing -徒刑tuxing -图章tuzhang -图纸tuzhi -途中tuzhong -土著tuzhu -秃子tuzi -贪污盗窃twdq -台湾省tws -贪污受贿twsh -提心吊胆txdd -通讯社txs -同心同德txtd -同心协力txxl -推心置腹txzf -体育场tyc -体育锻炼tydl -体育馆tyg -腾云驾雾tyjw -太阳能tyn -太原市tys -天衣无缝tywf -通用性tyx -体育运动tyyd -团支部tzb -停滞不前tzbq -同志们tzm -天灾人祸tzrh -听之任之tzrz -通知书tzs -为w -我w -无w -问w -外w -五w -位w -物w -委w -完w -温w -万w -文w -往w -武w -务w -王w -围w -误w -晚w -瓦wa -挖wa -凹*wa -哇wa -蛙wa -洼wa -娃wa -袜wa -佤wa -娲wa -腽wa -外wai -歪wai -外币waibi -外边waibian -外表waibiao -外宾waibin -外部waibu -外传waichuan -外存waicun -外地waidi -外调waidiao -歪风waifeng -外观waiguan -外国waiguo -外行waihang -外汇waihui -外加waijia -外交waijiao -外界waijie -外景waijing -外科waike -外快waikuai -外流wailiu -外貌waimao -外贸waimao -外面waimian -外勤waiqin -歪曲waiqu -外商waishang -外伤waishang -外设waishe -外省waisheng -外甥waisheng -外事waishi -外围waiwei -外文waiwen -外线waixian -外销waixiao -歪斜waixie -外延waiyan -外因waiyin -外语waiyu -外援waiyuan -外在waizai -外债waizhai -外资waizi -瓦解wajie -挖掘wajue -挖苦waku -瓦砾wali -完wan -万wan -晚wan -弯wan -碗wan -顽wan -湾wan -挽wan -玩wan -蔓*wan -娩*wan -豌wan -丸wan -烷wan -皖wan -惋wan -宛wan -婉wan -腕wan -剜wan -芄wan -莞*wan -菀wan -纨wan -绾wan -琬wan -脘wan -畹wan -蜿wan -万般wanban -晚报wanbao -完备wanbei -完毕wanbi -完成wancheng -万代wandai -顽敌wandi -万吨wandun -万恶wane -万分wanfen -往wang -王wang -望wang -网wang -忘wang -妄wang -亡wang -旺wang -芒*wang -汪wang -枉wang -罔wang -尢wang -惘wang -辋wang -魍wang -往常wangchang -王朝wangchao -忘掉wangdiao -妄动wangdong -枉法wangfa -往返wangfan -枉费wangfei -往复wangfu -王国wangguo -亡国wangguo -往后wanghou -忘怀wanghuai -忘记wangji -旺季wangji -往来wanglai -网络wangluo -亡命wangming -往年wangnian -完工wangong -忘却wangque -枉然wangran -惘然wangran -往日wangri -旺盛wangsheng -往事wangshi -妄图wangtu -万古wangu -顽固wangu -往往wangwang -汪汪wangwang -忘我wangwo -往昔wangxi -妄想wangxiang -汪洋wangyang -望远wangyuan -王子wangzi -完好wanhao -晚会wanhui -挽回wanhui -晚婚wanhun -晚间wanjian -完结wanjie -挽救wanjiu -玩具wanju -顽抗wankang -完了wanle -挽力wanli -弯路wanlu -完美wanmei -万能wanneng -万年wannian -晚年wannian -玩弄wannong -晚期wanqi -顽强wanqiang -弯曲wanqu -完全wanquan -完善wanshan -晚上wanshang -玩赏wanshang -万事wanshi -万世wanshi -玩耍wanshua -万岁wansui -万万wanwan -万物wanwu -晚霞wanxia -万象wanxiang -玩笑wanxiao -万幸wanxing -婉言wanyan -万一wanyi -万元wanyuan -完整wanzheng -顽症wanzheng -万众wanzhong -宛转wanzhuan -瓦斯wasi -瓦特wate -娃娃wawa -外部设备wbsb -微不足道wbzd -无产阶级wcjj -微处理机wclj -无产者wcz -为wei -位wei -委wei -围wei -维wei -唯wei -卫wei -微wei -伟wei -未wei -威wei -危wei -尾wei -谓wei -喂wei -味wei -胃wei -魏wei -伪wei -遗*wei -违wei -韦wei -畏wei -纬wei -巍wei -桅wei -惟wei -潍wei -苇wei -萎wei -蔚wei -渭wei -尉wei -慰wei -偎wei -诿wei -隈wei -隗*wei -圩*wei -葳wei -薇wei -囗wei -帏wei -帷wei -崴wei -嵬wei -猥wei -猬wei -闱wei -沩wei -洧wei -涠wei -逶wei -娓wei -玮wei -韪wei -軎wei -炜wei -煨wei -痿wei -艉wei -鲔wei -尾巴weiba -违背weibei -未必weibi -威逼weibi -微波weibo -微薄weibo -未曾weiceng -未尝weichang -维持weichi -为此weici -伟大weida -味道weidao -纬度weidu -唯独weidu -巍峨weie -违法weifa -违反weifan -违犯weifan -威风weifeng -桅杆weigan -微观weiguan -危害weihai -为何weihe -维护weihu -危及weiji -微机weiji -危机weiji -危急weiji -围歼weijian -围剿weijiao -慰藉weijie -违禁weijin -未经weijing -畏惧weiju -违抗weikang -未可weike -唯恐weikong -惟恐weikong -胃口weikou -未来weilai -慰劳weilao -为了weile -威力weili -委靡weimi -未免weimian -微妙weimiao -帷幕weimu -危难weinan -畏难weinan -未能weineng -委派weipai -为期weiqi -畏怯weiqie -委曲weiqu -委屈weiqu -未然weiran -巍然weiran -围绕weirao -伟人weiren -委任weiren -微弱weiruo -威慑weishe -为生weisheng -卫生weisheng -尾声weisheng -卫士weishi -威势weishi -为首weishou -为数weishu -尾随weisui -未遂weisui -畏缩weisuo -萎缩weisuo -猥琐weisuo -委托weituo -委婉weiwan -危亡weiwang -巍巍weiwei -慰问weiwen -唯物weiwu -威武weiwu -微细weixi -威吓weixia -危险weixian -微小weixiao -微笑weixiao -威协weixie -威胁weixie -猥亵weixie -维新weixin -唯心weixin -违心weixin -威信weixin -微型weixing -卫星weixing -维修weixiu -威严weiyan -伟业weiye -唯一weiyi -位移weiyi -位于weiyu -谓语weiyu -委员weiyuan -为止weizhi -位置weizhi -未知weizhi -为重weizhong -为主weizhu -伪装weizhuang -问wen -温wen -文wen -稳wen -纹wen -闻wen -蚊wen -瘟wen -吻wen -紊wen -刎wen -阌wen -汶wen -璺wen -雯wen -文本wenben -瘟病wenbing -稳步wenbu -问答wenda -稳定wending -温度wendu -嗡weng -翁weng -瓮weng -蓊weng -蕹weng -稳固wengu -问好wenhao -温和wenhe -吻合wenhe -文化wenhua -文件wenjian -稳健wenjian -问津wenjin -文静wenjing -文具wenju -文科wenke -文盲wenmang -文明wenming -闻名wenming -温暖wennuan -文凭wenping -文人wenren -温柔wenrou -问世wenshi -文坛wentan -问题wenti -文体wenti -稳妥wentuo -文物wenwu -文献wenxian -文选wenxuan -文学wenxue -问讯wenxun -闻讯wenxun -文艺wenyi -瘟疫wenyi -文娱wenyu -文摘wenzhai -文章wenzhang -稳重wenzhong -文字wenzi -问罪wenzui -望而生畏wesw -闻风而动wfed -违法乱纪wflj -歪风邪气wfxq -温故知新wgzx -文化部whb -文汇报whb -文化馆whg -文化宫whg -武汉市whs -五湖四海whsh -忘乎所以whsy -问寒问暖whwn -文化娱乐whyl -玩忽职守whzs -外交部wjb -无纪律wjl -五讲四美wjsm -无拘无束wjws -无可奉告wkfg -无可非议wkfy -无可奈何wknh -乌鲁木齐wlmq -无理取闹wlqn -无论如何wlrh -物美价廉wmjl -误码率wml -文明礼貌wmlm -无名英雄wmyx -无能为力wnwl -我wo -握wo -窝wo -蜗wo -涡wo -沃wo -挝wo -卧wo -斡wo -倭wo -莴wo -喔wo -幄wo -渥wo -肟wo -硪wo -龌wo -窝藏wocang -卧床wochuang -我党wodang -卧倒wodao -我的wode -窝工wogong -我国woguo -我军wojun -我们women -窝囊wonang -我省wosheng -我校woxiao -为期不远wqby -无穷无尽wqwj -误入歧途wrqt -卫生部wsb -纹丝不动wsbd -万事大吉wsdj -万事俱备wsjb -为什么wsm -无所谓wsw -为所欲为wsyw -无所作为wszw -无wu -五wu -物wu -武wu -务wu -误wu -伍wu -舞wu -污wu -悟wu -雾wu -午wu -恶*wu -屋wu -乌wu -吴wu -亡*wu -诬wu -钨wu -巫wu -呜wu -芜wu -梧wu -吾wu -毋wu -捂wu -侮wu -坞wu -戊wu -晤wu -勿wu -兀wu -仵wu -阢wu -邬wu -圬wu -芴wu -唔wu -庑wu -怃wu -忤wu -浯wu -寤wu -迕wu -妩wu -婺wu -骛wu -杌wu -牾wu -於*wu -焐wu -鹉wu -鹜wu -痦wu -蜈wu -鋈wu -鼯wu -吾辈wubei -无比wubi -五笔wubi -务必wubi -舞弊wubi -无边wubian -无不wubu -五彩wucai -误差wucha -无常wuchang -无偿wuchang -舞场wuchang -武昌wuchang -无耻wuchi -无从wucong -武打wuda -舞蹈wudao -无敌wudi -舞动wudong -武斗wudou -武断wuduan -无法wufa -无妨wufang -无非wufei -武功wugong -污垢wugou -无故wugu -无关wuguan -五官wuguan -武官wuguan -无害wuhai -诬害wuhai -武汉wuhan -无何wuhe -乌黑wuhei -五湖wuhu -呜呼wuhu -误会wuhui -舞会wuhui -污秽wuhui -无及wuji -无机wuji -物价wujia -无间wujian -物件wujian -误解wujie -五届wujie -五金wujin -无愧wukui -无赖wulai -诬赖wulai -无理wuli -物理wuli -无礼wuli -物力wuli -武力wuli -无聊wuliao -无虑wulu -无论wulun -污蔑wumie -诬蔑wumie -无奈wunai -无能wuneng -毋宁wuning -务农wunong -物品wupin -无期wuqi -五七wuqi -武器wuqi -无情wuqing -无穷wuqiong -舞曲wuqu -无权wuquan -污染wuran -无任wuren -污辱wuru -侮辱wuru -物色wuse -无上wushang -误伤wushang -无声wusheng -午时wushi -务使wushi -无视wushi -误事wushi -务实wushi -无数wushu -武术wushu -无双wushuang -午睡wushui -五四wusi -无私wusi -舞台wutai -无题wuti -物体wuti -舞厅wuting -无为wuwei -无谓wuwei -无物wuwu -无暇wuxia -无限wuxian -诬陷wuxian -无效wuxiao -五星wuxing -午休wuxiu -无须wuxu -无需wuxu -务虚wuxu -午夜wuye -五一wuyi -无益wuyi -无疑wuyi -无垠wuyin -无用wuyong -毋庸wuyong -无余wuyu -无缘wuyuan -五月wuyue -物证wuzheng -无知wuzhi -物质wuzhi -武装wuzhuang -物资wuzi -兀自wuzi -误字wuzi -无罪wuzui -无微不至wwbz -唯物论wwl -卧薪尝胆wxcd -无线电wxd -微型机wxj -唯心论wxl -问心无愧wxwk -委员会wyh -无缘无故wywg -委员长wyz -误字率wzl -无足轻重wzqz -未知数wzs -完整无缺wzwq -学x -下x -行x -小x -线x -性x -新x -些x -想x -心x -向x -相x -系x -席x -现x -西x -修x -象x -先x -形x -心安理得xald -西安市xas -西半球xbq -相比之下xbzx -宣传部xcb -新陈代谢xcdx -新产品xcp -畜产品xcp -西城区xcq -喜出望外xcww -相对而言xdey -现代化xdh -想当然xdr -相对误差xdwc -先睹为快xdwk -形而上学xesx -显而易见xeyj -西方国家xfgj -消费品xfp -想方设法xfsf -先发制人xfzr -兴高采烈xgcl -新华社xhs -新华书店xhsd -系xi -席xi -西xi -习xi -细xi -吸xi -析xi -喜xi -洗xi -铣xi -稀xi -戏xi -隙xi -希xi -息xi -袭xi -锡xi -烯xi -牺xi -悉xi -惜xi -溪xi -腊*xi -栖*xi -昔xi -熙xi -硒xi -矽xi -晰xi -嘻xi -膝xi -夕xi -熄xi -汐xi -犀xi -檄xi -媳xi -僖xi -兮xi -隰xi -郗xi -茜*xi -菥xi -葸xi -蓰xi -奚xi -唏xi -徙xi -饩xi -阋xi -浠xi -淅xi -屣xi -嬉xi -玺xi -樨xi -曦xi -觋xi -欷xi -歙*xi -熹xi -禊xi -禧xi -皙xi -穸xi -裼*xi -蜥xi -螅xi -蟋xi -舄xi -舾xi -羲xi -粞xi -翕xi -醯xi -蹊*xi -鼷xi -下xia -夏xia -吓xia -狭xia -霞xia -唬*xia -瞎xia -虾xia -匣xia -辖xia -暇xia -峡xia -侠xia -厦xia -呷xia -狎xia -遐xia -瑕xia -柙xia -硖xia -瘕*xia -罅xia -黠xia -狭隘xiaai -下班xiaban -下辈xiabei -下边xiabian -下策xiace -下层xiaceng -下场xiachang -下沉xiachen -下次xiaci -瑕疵xiaci -下达xiada -吓倒xiadao -下等xiadeng -下毒xiadu -下发xiafa -下放xiafang -峡谷xiagu -霞光xiaguang -瞎话xiahua -喜爱xiai -下级xiaji -下集xiaji -夏季xiaji -下降xiajiang -侠客xiake -下来xialai -下联xialian -夏粮xialiang -下列xialie -下令xialing -下流xialiu -下落xialuo -下马xiama -厦门xiamen -下面xiamian -线xian -现xian -先xian -县xian -限xian -见*xian -显xian -鲜xian -献xian -险xian -陷xian -宪xian -纤xian -洗*xian -掀xian -弦xian -铣*xian -腺xian -锨xian -仙xian -咸xian -贤xian -衔xian -舷xian -闲xian -涎xian -嫌xian -馅xian -羡xian -冼xian -苋xian -莶xian -藓xian -岘xian -猃xian -暹xian -娴xian -氙xian -燹xian -祆xian -鹇xian -痫xian -蚬xian -筅xian -籼xian -酰xian -跣xian -跹xian -霰xian -西安xian -献宝xianbao -先辈xianbei -现场xianchang -现成xiancheng -县城xiancheng -献丑xianchou -献词xianci -现存xiancun -现代xiandai -先导xiandao -显得xiande -险地xiandi -限定xianding -限度xiandu -线段xianduan -限额xiane -险恶xiane -宪法xianfa -先锋xianfeng -险峰xianfeng -想xiang -向xiang -相xiang -象xiang -响xiang -项xiang -箱xiang -乡xiang -降*xiang -香xiang -像xiang -详xiang -橡xiang -享xiang -湘xiang -厢xiang -镶xiang -襄xiang -翔xiang -祥xiang -巷xiang -芗xiang -葙xiang -饷xiang -庠xiang -骧xiang -缃xiang -蟓xiang -鲞xiang -飨xiang -相爱xiangai -相比xiangbi -想必xiangbi -相差xiangcha -相称xiangcheng -相处xiangchu -相传xiangchuan -乡村xiangcun -相当xiangdang -向导xiangdao -相等xiangdeng -相对xiangdui -想法xiangfa -相反xiangfan -相仿xiangfang -相干xianggan -香港xianggang -相隔xiangge -相关xiangguan -相好xianghao -相互xianghu -相继xiangji -相加xiangjia -相见xiangjian -相减xiangjian -相交xiangjiao -橡胶xiangjiao -相近xiangjin -详尽xiangjin -巷口xiangkou -向来xianglai -相连xianglian -向量xiangliang -响亮xiangliang -相貌xiangmao -项目xiangmu -想念xiangnian -相片xiangpian -想起xiangqi -详情xiangqing -向上xiangshang -相声xiangsheng -响声xiangsheng -相识xiangshi -翔实xiangshi -享受xiangshou -相思xiangsi -相似xiangsi -香甜xiangtian -相同xiangtong -相投xiangtou -显贵xiangui -向往xiangwang -详细xiangxi -向下xiangxia -乡下xiangxia -象限xiangxian -想象xiangxiang -相信xiangxin -香烟xiangyan -相依xiangyi -相宜xiangyi -相应xiangying -相映xiangying -响应xiangying -享用xiangyong -相遇xiangyu -相约xiangyue -乡镇xiangzhen -象征xiangzheng -箱子xiangzi -陷害xianhai -显赫xianhe -鲜红xianhong -先后xianhou -鲜花xianhua -献花xianhua -闲话xianhua -贤惠xianhui -献计xianji -献技xianji -显见xianjian -衔接xianjie -先进xianjin -现金xianjin -险境xianjing -陷阱xianjing -现款xiankuan -现况xiankuang -先例xianli -献礼xianli -先烈xianlie -线路xianlu -显露xianlu -鲜美xianmei -鲜明xianming -贤明xianming -显目xianmu -羡慕xianmu -贤能xianneng -先期xianqi -掀起xianqi -限期xianqi -嫌弃xianqi -先前xianqian -先遣xianqian -险情xianqing -先驱xianqu -显然xianran -贤人xianren -闲人xianren -现任xianren -陷入xianru -闲散xiansan -献身xianshen -先生xiansheng -先是xianshi -现实xianshi -显示xianshi -娴熟xianshu -线索xiansuo -闲谈xiantan -险滩xiantan -先天xiantian -线条xiantiao -县委xianwei -纤维xianwei -显现xianxian -现象xianxiang -现行xianxing -鲜血xianxue -显眼xianyan -鲜艳xianyan -显要xianyao -险要xianyao -显耀xianyao -现役xianyi -嫌疑xianyi -现有xianyou -限于xianyu -闲杂xianza -现在xianzai -县长xianzhang -宪章xianzhang -限制xianzhi -先知xianzhi -闲置xianzhi -闲职xianzhi -显著xianzhu -现状xianzhuang -险阻xianzu -小xiao -消xiao -削xiao -效xiao -笑xiao -校xiao -销xiao -硝xiao -萧xiao -肖xiao -孝xiao -霄xiao -哮xiao -嚣xiao -宵xiao -淆xiao -晓xiao -啸xiao -哓xiao -崤xiao -潇xiao -逍xiao -骁xiao -绡xiao -枭xiao -枵xiao -蛸*xiao -筱xiao -箫xiao -魈xiao -小报xiaobao -小辈xiaobei -笑柄xiaobing -消沉xiaochen -消除xiaochu -消毒xiaodu -效法xiaofa -小贩xiaofan -消防xiaofang -消费xiaofei -校风xiaofeng -小鬼xiaogui -效果xiaoguo -小孩xiaohai -消耗xiaohao -消化xiaohua -笑话xiaohua -小惠xiaohui -销毁xiaohui -销魂xiaohun -消极xiaoji -削减xiaojian -小结xiaojie -小姐xiaojie -孝敬xiaojing -校刊xiaokan -小康xiaokang -效劳xiaolao -效力xiaoli -销路xiaolu -效率xiaolu -消灭xiaomie -消磨xiaomo -效能xiaoneng -消气xiaoqi -消遣xiaoqian -笑容xiaorong -削弱xiaoruo -潇洒xiaosa -校舍xiaoshe -小时xiaoshi -消失xiaoshi -消逝xiaoshi -消瘦xiaoshou -销售xiaoshou -小数xiaoshu -小说xiaoshuo -萧条xiaotiao -消息xiaoxi -肖像xiaoxiang -小心xiaoxin -枭雄xiaoxiong -小学xiaoxue -效验xiaoyan -逍遥xiaoyao -效益xiaoyi -效应xiaoying -校友xiaoyou -小于xiaoyu -校园xiaoyuan -销赃xiaozang -校长xiaozhang -嚣张xiaozhang -效忠xiaozhong -小组xiaozu -下情xiaqing -下去xiaqu -辖区xiaqu -下手xiashou -夏收xiashou -下属xiashu -下水xiashui -下台xiatai -夏天xiatian -下文xiawen -下午xiawu -下限xiaxian -下乡xiaxiang -遐想xiaxiang -狭义xiayi -下游xiayou -狭窄xiazhai -夏至xiazhi -夏种xiazhong -喜报xibao -细胞xibao -西北xibei -西边xibian -稀薄xibo -锡箔xibo -西餐xican -洗涤xidi -吸毒xidu -些xie -解*xie -写xie -斜xie -谢xie -协xie -械xie -叶*xie -血*xie -卸xie -屑xie -鞋xie -歇xie -邪xie -胁xie -蟹xie -泄xie -泻xie -契*xie -楔xie -蝎xie -挟xie -携xie -谐xie -懈xie -偕xie -亵xie -勰xie -燮xie -薤xie -撷xie -獬xie -廨xie -渫xie -瀣xie -邂xie -绁xie -缬xie -榭xie -榍xie -颉*xie -躞xie -写出xiechu -协从xiecong -携带xiedai -邪道xiedao -协调xiediao -协定xieding -亵渎xiedu -邪恶xiee -协和xiehe -谐和xiehe -协会xiehui -谢绝xiejue -协力xieli -泄漏xielou -邪路xielu -泄露xielu -泄密xiemi -邪念xienian -胁迫xiepo -邪气xieqi -协商xieshang -写生xiesheng -携手xieshou -邪说xieshuo -协同xietong -歇息xiexi -谢谢xiexie -协议xieyi -谐音xieyin -协约xieyue -写照xiezhao -协助xiezhu -鞋子xiezi -写作xiezuo -协作xiezuo -西方xifang -西风xifeng -西服xifu -吸附xifu -媳妇xifu -习惯xiguan -西汉xihan -稀罕xihan -希罕xihan -喜欢xihuan -袭击xiji -细节xijie -洗劫xijie -喜剧xiju -戏剧xiju -席卷xijuan -细菌xijun -犀利xili -系列xilie -奚落xiluo -熄灭ximie -新xin -心xin -信xin -锌xin -芯xin -辛xin -寻*xin -欣xin -薪xin -忻xin -衅xin -囟xin -馨xin -昕xin -歆xin -镡*xin -鑫xin -心爱xinai -西南xinan -新春xinchun -信贷xindai -心得xinde -心烦xinfan -心服xinfu -信服xinfu -行xing -性xing -形xing -型xing -星xing -兴xing -省*xing -醒xing -姓xing -幸xing -腥xing -猩xing -惺xing -刑xing -邢xing -杏xing -陉xing -荇xing -荥xing -擤xing -饧xing -悻xing -硎xing -心甘xingan -兴办xingban -性别xingbie -姓别xingbie -刑场xingchang -星辰xingchen -形成xingcheng -行程xingcheng -行动xingdong -幸而xinger -刑法xingfa -刑罚xingfa -兴奋xingfen -幸福xingfu -性格xingge -幸好xinghao -型号xinghao -行贿xinghui -星火xinghuo -性急xingji -形迹xingji -兴建xingjian -行径xingjing -行军xingjun -星空xingkong -幸亏xingkui -行李xingli -行旅xinglu -幸免xingmian -性命xingming -姓名xingming -醒目xingmu -性能xingneng -行期xingqi -兴起xingqi -星期xingqi -性情xingqing -星球xingqiu -兴趣xingqu -形容xingrong -行商xingshang -兴盛xingsheng -行使xingshi -行事xingshi -行驶xingshi -形式xingshi -幸事xingshi -刑事xingshi -形势xingshi -姓氏xingshi -行署xingshu -兴衰xingshuai -形态xingtai -形体xingti -兴亡xingwang -兴旺xingwang -行为xingwei -行文xingwen -醒悟xingwu -形象xingxiang -行销xingxiao -星星xingxing -行凶xingxiong -兴修xingxiu -行业xingye -星夜xingye -幸运xingyun -行政xingzheng -性质xingzhi -兴致xingzhi -形状xingzhuang -行走xingzou -信号xinhao -心狠xinhen -心慌xinhuang -信汇xinhui -细腻xini -西宁xining -心急xinji -信件xinjian -新疆xinjiang -新近xinjin -新居xinju -心坎xinkan -辛苦xinku -信赖xinlai -辛劳xinlao -心理xinli -心里xinli -心灵xinling -心目xinmu -信念xinnian -戏弄xinong -新奇xinqi -辛勤xinqin -心情xinqing -新区xinqu -新人xinren -信任xinren -欣赏xinshang -新生xinsheng -心声xinsheng -新事xinshi -新式xinshi -新书xinshu -薪水xinshui -心酸xinsuan -辛酸xinsuan -心疼xinteng -心田xintian -心跳xintiao -心头xintou -欣慰xinwei -新闻xinwen -心细xinxi -信息xinxi -欣喜xinxi -新鲜xinxian -心想xinxiang -信箱xinxiang -馨香xinxiang -信心xinxin -新型xinxing -新星xinxing -新兴xinxing -心虚xinxu -心血xinxue -信仰xinyang -心意xinyi -新异xinyi -新颖xinying -信用xinyong -新余xinyu -信誉xinyu -心愿xinyuan -心脏xinzang -新址xinzhi -心中xinzhong -雄xiong -胸xiong -兄xiong -凶xiong -熊xiong -匈xiong -汹xiong -芎xiong -雄辩xiongbian -雄兵xiongbing -凶残xiongcan -兄弟xiongdi -凶恶xionge -雄关xiongguan -凶狠xionghen -雄厚xionghou -胸怀xionghuai -雄健xiongjian -胸口xiongkou -熊猫xiongmao -凶猛xiongmeng -匈奴xiongnu -凶器xiongqi -凶杀xiongsha -雄师xiongshi -凶手xiongshou -胸膛xiongtang -雄伟xiongwei -雄心xiongxin -汹涌xiongyong -雄壮xiongzhuang -雄姿xiongzi -西欧xiou -习气xiqi -吸气xiqi -喜气xiqi -稀奇xiqi -希奇xiqi -喜庆xiqing -吸取xiqu -戏曲xiqu -昔日xiri -牺牲xisheng -西式xishi -喜事xishi -稀释xishi -吸收xishou -系数xishu -洗刷xishua -吸吮xishun -习俗xisu -习题xiti -西天xitian -系统xitong -修xiu -锈xiu -休xiu -袖xiu -秀xiu -朽xiu -宿*xiu -臭*xiu -羞xiu -嗅xiu -绣xiu -咻xiu -岫xiu -馐xiu -庥xiu -溴xiu -鸺xiu -貅xiu -髹xiu -修补xiubu -秀才xiucai -羞耻xiuchi -修辞xiuci -修订xiuding -修复xiufu -修改xiugai -修建xiujian -修剪xiujian -嗅觉xiujue -休克xiuke -羞愧xiukui -修理xiuli -秀丽xiuli -秀气xiuqi -羞辱xiuru -羞涩xiuse -修饰xiushi -休息xiuxi -休想xiuxiang -修养xiuyang -休养xiuyang -修造xiuzao -袖章xiuzhang -袖珍xiuzhen -修正xiuzheng -修筑xiuzhu -希望xiwang -席位xiwei -细微xiwei -西文xiwen -檄文xiwen -细小xixiao -细心xixin -悉心xixin -喜讯xixun -吸烟xiyan -西洋xiyang -西医xiyi -吸引xiyin -希有xiyou -戏院xiyuan -喜悦xiyue -西藏xizang -洗澡xizao -细则xize -细致xizhi -习作xizuo -下基层xjc -现阶段xjd -新技术xjs -献计献策xjxc -先见之明xjzm -兴利除弊xlcb -系列化xlh -稀里糊涂xlht -狭路相逢xlxf -畜牧业xmy -心满意足xmyz -西宁市xns -小朋友xpy -向前看xqk -喜气洋洋xqyy -先人后己xrhj -兴师动众xsdz -销售额xse -刑事犯罪xsfz -小时候xsh -新时期xsq -新生事物xssw -形式主义xszy -相提并论xtbl -续xu -许xu -须xu -需xu -序xu -虚xu -絮xu -畜xu -叙xu -蓄xu -绪xu -徐xu -墟xu -戌xu -嘘xu -酗xu -旭xu -恤xu -婿xu -吁*xu -诩xu -勖xu -圩xu -蓿xu -洫xu -浒*xu -溆xu -顼xu -栩xu -煦xu -砉*xu -盱xu -胥xu -糈xu -醑xu -选xuan -旋xuan -宣xuan -悬xuan -玄xuan -券*xuan -轩xuan -喧xuan -癣xuan -眩xuan -绚xuan -儇xuan -谖xuan -萱xuan -揎xuan -泫xuan -渲xuan -漩xuan -璇xuan -楦xuan -暄xuan -炫xuan -煊xuan -碹xuan -铉xuan -镟xuan -痃xuan -悬案xuanan -轩昂xuanang -选拔xuanba -宣布xuanbu -选材xuancai -选场xuanchang -宣称xuancheng -宣传xuanchuan -选定xuanding -宣读xuandu -宣告xuangao -选购xuangou -悬挂xuangua -玄乎xuanhu -喧哗xuanhua -选集xuanji -宣讲xuanjiang -选举xuanju -绚烂xuanlan -绚丽xuanli -选录xuanlu -旋律xuanlu -选民xuanmin -喧闹xuannao -悬念xuannian -选派xuanpai -宣判xuanpan -选配xuanpei -选票xuanpiao -选区xuanqu -选取xuanqu -喧嚷xuanrang -宣誓xuanshi -选手xuanshou -悬殊xuanshu -旋涡xuanwo -玄虚xuanxu -悬崖xuanya -宣言xuanyan -宣扬xuanyang -炫耀xuanyao -选用xuanyong -选择xuanze -宣战xuanzhan -选种xuanzhong -旋转xuanzhuan -许多xuduo -学xue -血xue -削*xue -雪xue -穴xue -靴xue -薛xue -谑xue -噱*xue -泶xue -踅xue -鳕xue -学报xuebao -学部xuebu -学潮xuechao -学费xuefei -学风xuefeng -学府xuefu -血汗xuehan -学好xuehao -学会xuehui -学籍xueji -血迹xueji -学科xueke -血泪xuelei -学历xueli -学龄xueling -学年xuenian -学派xuepai -学期xueqi -血肉xuerou -学生xuesheng -学时xueshi -学识xueshi -学士xueshi -学术xueshu -血书xueshu -学说xueshuo -血统xuetong -学徒xuetu -学位xuewei -学问xuewen -学习xuexi -血洗xuexi -学校xuexiao -血压xueya -学业xueye -血液xueye -学友xueyou -学员xueyuan -学院xueyuan -血晕xueyun -血战xuezhan -学者xuezhe -学制xuezhi -虚构xugou -序号xuhao -蓄积xuji -虚假xujia -叙旧xujiu -许可xuke -序列xulie -绪论xulun -虚名xuming -序幕xumu -畜牧xumu -训xun -旬xun -迅xun -讯xun -寻xun -循xun -巡xun -荤*xun -浚*xun -勋xun -熏xun -询xun -驯xun -殉xun -汛xun -逊xun -巽xun -郇*xun -埙xun -荀xun -蕈xun -薰xun -峋xun -徇xun -獯xun -恂xun -洵xun -浔xun -曛xun -窨*xun -醺xun -鲟xun -巡捕xunbu -巡查xuncha -寻常xunchang -驯服xunfu -殉国xunguo -巡航xunhang -循环xunhuan -巡回xunhui -虚拟xuni -寻机xunji -巡警xunjing -勋爵xunjue -训练xunlian -巡逻xunluo -迅猛xunmeng -寻求xunqiu -逊色xunse -巡视xunshi -徇私xunsi -迅速xunsu -熏陶xuntao -许诺xunuo -讯问xunwen -询问xunwen -寻衅xunxin -循序xunxu -勋章xunzhang -寻找xunzhao -殉职xunzhi -寻址xunzhi -需求xuqiu -序曲xuqu -虚荣xurong -虚弱xuruo -虚设xushe -叙事xushi -虚实xushi -序数xushu -虚数xushu -叙述xushu -叙说xushuo -虚伪xuwei -虚心xuxin -序言xuyan -需要xuyao -须臾xuyu -许愿xuyuan -须知xuzhi -宣武区xwq -信息处理xxcl -循序见进xxjj -辛辛苦苦xxkk -信息量xxl -熙熙攘攘xxrr -小学生xxs -欣欣向荣xxxr -小心翼翼xxyy -下一步xyb -胸有成竹xycz -洗衣机xyj -小意思xys -习以为常xywc -新颖性xyx -兴致勃勃xzbb -新中国xzg -行政区域xzqy -雪中送炭xzst -心中无数xzws -选择性xzx -心中有数xzys -行之有效xzyx -一y -有y -用y -要y -以y -于y -也y -样y -义y -与y -由y -压y -员y -月y -意y -又y -运y -原y -油y -验y -压ya -亚ya -呀ya -牙ya -芽ya -雅ya -蚜ya -鸭ya -匹*ya -押ya -鸦ya -丫ya -崖ya -衙ya -涯ya -哑ya -讶ya -伢ya -垭ya -揠ya -岈ya -迓ya -娅ya -琊ya -桠ya -氩ya -砑ya -睚ya -痖ya -哑巴yaba -牙齿yachi -压倒yadao -压服yafu -牙关yaguan -雅观yaguan -压价yajia -押金yajin -亚军yajun -压力yali -验yan -研yan -严yan -眼yan -言yan -盐yan -演yan -岩yan -沿yan -烟yan -延yan -掩yan -宴yan -炎yan -颜yan -燕yan -衍yan -铅*yan -焉yan -咽yan -阉yan -淹yan -蜒yan -阎yan -奄yan -艳yan -堰yan -厌yan -砚yan -雁yan -唁yan -彦yan -焰yan -谚yan -殷*yan -厣yan -赝yan -剡*yan -俨yan -偃yan -兖yan -谳yan -阽*yan -郾yan -鄢yan -芫*yan -菸yan -崦yan -恹yan -闫yan -阏yan -湮yan -滟yan -妍yan -嫣yan -琰yan -檐yan -晏yan -胭yan -腌*yan -焱yan -罨yan -筵yan -酽yan -魇yan -餍yan -鼹yan -沿岸yanan -严办yanban -掩蔽yanbi -演变yanbian -烟草yancao -延长yanchang -演唱yanchang -严惩yancheng -延迟yanchi -演出yanchu -唁电yandian -严冬yandong -厌恶yane -厌烦yanfan -样yang -养yang -氧yang -扬yang -洋yang -阳yang -羊yang -秧yang -央yang -杨yang -仰yang -殃yang -鸯yang -佯yang -疡yang -痒yang -漾yang -徉yang -怏yang -泱yang -炀yang -烊yang -恙yang -蛘yang -鞅yang -掩盖yangai -样板yangban -样本yangben -洋财yangcai -养成yangcheng -沿革yange -严格yange -阳光yangguang -洋行yanghang -养护yanghu -氧化yanghua -养料yangliao -杨柳yangliu -仰面yangmian -殃民yangmin -仰慕yangmu -样品yangpin -洋气yangqi -扬弃yangqi -央求yangqiu -养伤yangshang -样式yangshi -阳台yangtai -眼光yanguang -仰望yangwang -洋务yangwu -洋相yangxiang -扬言yangyan -样样yangyang -洋溢yangyi -养育yangyu -养殖yangzhi -样子yangzi -沿海yanhai -严寒yanhan -眼红yanhong -咽喉yanhou -掩护yanhu -眼花yanhua -延缓yanhuan -宴会yanhui -焰火yanhuo -演讲yanjiang -眼界yanjie -严禁yanjin -严谨yanjin -眼镜yanjing -眼睛yanjing -研究yanjiu -严峻yanjun -眼看yankan -严酷yanku -眼眶yankuang -眼泪yanlei -眼力yanli -严厉yanli -艳丽yanli -眼帘yanlian -眼亮yanliang -言路yanlu -沿路yanlu -言论yanlun -掩埋yanmai -严密yanmi -严明yanming -烟幕yanmu -延年yannian -延期yanqi -眼前yanqian -宴请yanqing -俨然yanran -炎热yanre -眼色yanse -颜色yanse -延伸yanshen -岩石yanshi -演示yanshi -掩饰yanshi -验收yanshou -严守yanshou -延寿yanshou -演说yanshuo -严肃yansu -演算yansuan -言谈yantan -研讨yantao -沿途yantu -阎王yanwang -延误yanwu -烟雾yanwu -宴席yanxi -筵席yanxi -演习yanxi -沿袭yanxi -眼下yanxia -沿线yanxian -言行yanxing -严刑yanxing -延续yanxu -艳阳yanyang -演义yanyi -演绎yanyi -掩映yanying -沿用yanyong -言语yanyu -演员yanyuan -厌战yanzhan -沿着yanzhe -验证yanzheng -研制yanzhi -严重yanzhong -演奏yanzou -要yao -药yao -约*yao -摇yao -腰yao -咬yao -邀yao -耀yao -陶*yao -侥*yao -疟yao -妖yao -瑶yao -尧yao -遥yao -窑yao -谣yao -姚yao -舀yao -钥*yao -夭yao -爻yao -吆yao -崾yao -徭yao -幺yao -珧yao -杳yao -轺yao -曜yao -肴yao -铫*yao -鹞yao -窈yao -繇yao -鳐yao -摇摆yaobai -腰包yaobao -要不yaobu -谣传yaochuan -要得yaode -要点yaodian -摇动yaodong -窑洞yaodong -遥感yaogan -妖怪yaoguai -要害yaohai -摇撼yaohan -摇晃yaohuang -要件yaojian -要紧yaojin -摇控yaokong -遥控yaokong -摇篮yaolan -要领yaoling -要么yaome -妖魔yaomo -要目yaomu -邀请yaoqing -要求yaoqiu -要塞yaosai -要是yaoshi -钥匙yaoshi -要素yaosu -窈窕yaotiao -摇头yaotou -要闻yaowen -药物yaowu -要挟yaoxie -耀眼yaoyan -谣言yaoyan -妖艳yaoyan -夭折yaozhe -要职yaozhi -鸦片yapian -压迫yapo -压强yaqiang -压缩yasuo -雅兴yaxing -压仰yayang -压抑yayi -压榨yazha -压制yazhi -雅致yazhi -亚洲yazhou -鸭子yazi -雅座yazuo -要不得ybd -一般的说ybds -一部分ybf -要不然ybr -要不是ybs -一般说来ybsl -要不要yby -一辈子ybz -一把抓ybz -用不着ybz -扬长避短ycbd -由此可见yckj -银川市ycs -与此同时ycts -有偿转让yczr -邮电部ydb -有道德ydd -邮电局ydj -一刀切ydq -运动员ydy -印度洋ydy -因地制宜ydzy -也ye -业ye -页ye -叶ye -液ye -夜ye -野ye -爷ye -冶ye -邪*ye -哗*ye -咽*ye -椰ye -噎ye -耶ye -掖ye -曳ye -腋ye -拽*ye -靥ye -谒ye -邺ye -揶ye -晔ye -烨ye -铘ye -夜餐yecan -野餐yecan -野火yehuo -业绩yeji -夜间yejian -冶金yejin -夜里yeli -冶练yelian -野蛮yeman -夜幕yemu -夜色yese -也是yeshi -夜市yeshi -野兽yeshou -液体yeti -野外yewai -夜晚yewan -业务yewu -夜校yexiao -野心yexin -野性yexing -也许yexu -幼儿园yey -爷爷yeye -野营yeying -业余yeyu -野战yezhan -叶子yezi -一方面yfm -一分为二yfwe -阳奉阴违yfyw -一概而论ygel -一国两制yglz -有根有据ygyj -严格要求ygyq -有何特长yhtc -银行帐号yhzh -炎黄子孙yhzs -一yi -以yi -义yi -意yi -已yi -移yi -医yi -议yi -依yi -易yi -乙yi -艺yi -益yi -异yi -宜yi -仪yi -亿yi -遗yi -伊yi -役yi -衣yi -疑yi -亦yi -谊yi -翼yi -译yi -抑yi -忆yi -疫yi -壹yi -揖yi -铱yi -颐yi -夷yi -胰yi -沂yi -姨yi -彝yi -椅yi -蚁yi -倚yi -矣yi -邑yi -屹yi -臆yi -逸yi -肄yi -裔yi -毅yi -溢yi -诣yi -翌yi -绎yi -刈yi -劓yi -仡*yi -佚yi -佾yi -诒yi -圯yi -埸yi -懿yi -苡yi -荑yi -薏yi -弈yi -奕yi -挹yi -弋yi -呓yi -咦yi -咿yi -嗌*yi -噫yi -峄yi -嶷yi -猗yi -饴yi -怿yi -怡yi -悒yi -漪yi -迤yi -驿yi -缢yi -殪yi -轶yi -贻yi -欹*yi -旖yi -熠yi -眙yi -钇yi -镒yi -镱yi -痍yi -瘗yi -癔yi -翊yi -蜴yi -舣yi -羿yi -翳yi -酏yi -黟yi -议案yian -疑案yian -一半yiban -一般yiban -一斑yiban -一边yibian -以便yibian -仪表yibiao -一并yibing -异步yibu -遗产yichan -异常yichang -议程yicheng -益处yichu -遗传yichuan -一次yici -依次yici -依从yicong -一代yidai -一带yidai -一旦yidan -一点yidian -一定yiding -议定yiding -移动yidong -一度yidu -遗毒yidu -一端yiduan -臆断yiduan -亿吨yidun -一发yifa -依法yifa -义愤yifen -衣服yifu -依附yifu -一概yigai -一个yige -一共yigong -议购yigou -已故yigu -一贯yiguan -异国yiguo -遗憾yihan -遗恨yihen -以后yihou -异化yihua -议会yihui -疑惑yihuo -以及yiji -异己yiji -遗迹yiji -议价yijia -意见yijian -移交yijiao -一届yijie -一经yijing -已经yijing -意境yijing -依旧yijiu -一举yiju -依据yiju -移居yiju -议决yijue -依靠yikao -倚靠yikao -一刻yike -医科yike -一块yikuai -以来yilai -依赖yilai -一览yilan -一例yili -毅力yili -屹立yili -一连yilian -意料yiliao -医疗yiliao -遗留yiliu -遗漏yilou -一律yilu -疑虑yilu -议论yilun -一面yimian -以免yimian -疫苗yimiao -移民yimin -因yin -引yin -阴yin -印yin -音yin -银yin -烟*yin -隐yin -饮yin -荫yin -茵yin -殷yin -姻yin -吟yin -淫yin -寅yin -尹yin -胤yin -鄞yin -圻*yin -垠yin -堙yin -茚yin -吲yin -喑yin -狺yin -夤yin -洇yin -湮*yin -氤yin -铟yin -瘾yin -窨yin -蚓yin -霪yin -龈yin -疑难yinan -阴暗yinan -隐蔽yinbi -音标yinbiao -隐藏yincang -阴沉yinchen -银川yinchuan -因此yinci -引导yindao -音调yindiao -印度yindu -引渡yindu -以内yinei -因而yiner -印发yinfa -音符yinfu -应ying -影ying -硬ying -营ying -英ying -映ying -迎ying -樱ying -婴ying -鹰ying -缨ying -莹ying -萤ying -荧ying -蝇ying -赢ying -盈ying -颖ying -嬴ying -郢ying -茔ying -荥*ying -莺ying -萦ying -蓥ying -撄ying -嘤ying -膺ying -滢ying -潆ying -瀛ying -瑛ying -璎ying -楹ying -媵ying -鹦ying -瘿ying -颍ying -罂ying -英镑yingbang -硬币yingbi -应变yingbian -映衬yingchen -应酬yingchou -迎春yingchun -应当yingdang -赢得yingde -婴儿yinger -营房yingfang -迎风yingfeng -应付yingfu -应该yinggai -英国yingguo -樱花yinghua -英魂yinghun -应急yingji -硬件yingjian -迎接yingjie -应届yingjie -英杰yingjie -营救yingjiu -英俊yingjun -盈亏yingkui -赢利yingli -盈利yingli -英烈yinglie -迎面yingmian -英明yingming -硬盘yingpan -影片yingpian -硬拼yingpin -影射yingshe -映射yingshe -樱桃yingtao -迎头yingtou -因果yinguo -影响yingxiang -硬性yingxing -英雄yingxiong -营养yingyang -应邀yingyao -营业yingye -应用yingyong -英勇yingyong -应有yingyou -英语yingyu -盈余yingyu -营造yingzao -应战yingzhan -迎战yingzhan -映照yingzhao -应征yingzheng -影子yingzi -英姿yingzi -银行yinhang -引号yinhao -殷红yinhong -隐患yinhuan -淫秽yinhui -阴魂yinhun -意念yinian -姨娘yiniang -阴极yinji -印鉴yinjian -引进yinjin -引力yinli -阴历yinli -阴凉yinliang -引路yinlu -隐瞒yinman -阴谋yinmou -银幕yinmu -隐慝yinni -银牌yinpai -引起yinqi -殷切yinqie -殷勤yinqin -引擎yinqing -引人yinren -饮食yinshi -印刷yinshua -饮水yinshui -因素yinsu -阴天yintian -引退yintui -因为yinwei -淫威yinwei -阴险yinxian -印象yinxiang -音响yinxiang -音信yinxin -因循yinxun -引言yinyan -阴影yinying -引用yinyong -引诱yinyou -阴雨yinyu -姻缘yinyuan -隐约yinyue -音乐yinyue -引证yinzheng -印证yinzheng -一片yipian -一瞥yipie -一起yiqi -一齐yiqi -义气yiqi -意气yiqi -仪器yiqi -遗弃yiqi -以前yiqian -一切yiqie -依然yiran -亦然yiran -毅然yiran -艺人yiren -宜人yiren -遗容yirong -以上yishang -一生yisheng -医生yisheng -一时yishi -一事yishi -意识yishi -议事yishi -逸事yishi -仪式yishi -医师yishi -医士yishi -遗失yishi -一手yishou -遗书yishu -艺术yishu -意思yisi -一体yiti -议题yiti -遗体yiti -一天yitian -一同yitong -异同yitong -一头yitou -意图yitu -疑团yituan -以外yiwai -意外yiwai -亿万yiwan -以往yiwang -遗忘yiwang -以为yiwei -意味yiwei -意文yiwen -疑问yiwen -译文yiwen -一无yiwu -义务yiwu -遗物yiwu -医务yiwu -贻误yiwu -一下yixia -以下yixia -一线yixian -一向yixiang -一项yixiang -意向yixiang -遗像yixiang -一些yixie -一心yixin -疑心yixin -异性yixing -医学yixue -一言yiyan -义演yiyan -遗言yiyan -一样yiyang -医药yiyao -意义yiyi -异议yiyi -义勇yiyong -易于yiyu -议员yiyuan -意愿yiyuan -医院yiyuan -亿元yiyuan -遗愿yiyuan -疑云yiyun -一再yizai -一早yizao -臆造yizao -依仗yizhang -仪仗yizhang -一朝yizhao -衣着yizhao -依照yizhao -一阵yizhen -一直yizhi -一致yizhi -以至yizhi -以致yizhi -意志yizhi -抑制yizhi -医治yizhi -抑止yizhi -移植yizhi -遗址yizhi -一种yizhong -遗嘱yizhu -研究会yjh -有纪律yjl -研究生yjs -研究所yjs -研究室yjs -养精畜锐yjxr -研究员yjy -拥军优属yjys -一技之长yjzc -一口气ykq -一览表ylb -以理服人ylfr -阅览室yls -有理想ylx -有利于yly -越来越yly -有目共睹ymgd -一目了然ymlr -有没有ymy -云南省yns -育*yo -哟yo -唷yo -用yong -勇yong -永yong -拥yong -涌yong -蛹yong -庸yong -佣yong -臃yong -痈yong -雍yong -踊yong -咏yong -泳yong -恿yong -俑yong -壅yong -墉yong -喁yong -慵yong -邕yong -镛yong -甬yong -鳙yong -饔yong -拥抱yongbao -永别yongbie -永不yongbu -用处yongchu -用度yongdu -用法yongfa -用费yongfei -勇敢yonggan -用功yonggong -永恒yongheng -用户yonghu -拥护yonghu -拥挤yongji -永久yongjiu -用具yongju -永诀yongjue -用力yongli -庸碌yonglu -勇猛yongmeng -用品yongpin -勇气yongqi -勇士yongshi -庸俗yongsu -咏叹yongtan -用途yongtu -涌现yongxian -用心yongxin -用意yongyi -拥有yongyou -用于yongyu -勇于yongyu -永远yongyuan -踊跃yongyue -有you -由you -又you -油you -右you -友you -优you -幼you -游you -尤you -诱you -犹you -幽you -悠you -忧you -邮you -铀you -酉you -佑you -釉you -卣you -攸you -侑you -莠you -莜you -莸you -尢*you -呦you -囿you -宥you -柚you -猷you -牖you -铕you -疣you -蚰you -蚴you -蝣you -蝤*you -繇*you -鱿you -黝you -鼬you -有碍youai -友爱youai -幽暗youan -友邦youbang -右边youbian -忧愁youchou -由此youci -有错youcuo -有待youdai -优待youdai -诱导youdao -有的youde -优等youdeng -有点youdian -邮电youdian -优点youdian -诱发youfa -有功yougong -有关youguan -有害youhai -友好youhao -优化youhua -油画youhua -幽会youhui -优惠youhui -诱惑youhuo -有机youji -游击youji -有劲youjin -幽静youjing -悠久youjiu -邮局youju -由来youlai -游览youlan -有劳youlao -有利youli -有力youli -游离youli -优良youliang -优劣youlie -幽灵youling -忧虑youlu -优美youmei -幼苗youmiao -有名youming -幽默youmo -右派youpai -诱骗youpian -邮票youpiao -尤其youqi -油漆youqi -友情youqing -右倾youqing -有趣youqu -油然youran -犹如youru -有色youse -优胜yousheng -有时youshi -有事youshi -有失youshi -优势youshi -有数youshu -油水youshui -有所yousuo -有望youwang -有为youwei -游戏youxi -有限youxian -优先youxian -悠闲youxian -有效youxiao -幼小youxiao -有些youxie -有心youxin -游行youxing -优秀youxiu -幽雅youya -悠扬youyang -又要youyao -有益youyi -优异youyi -友谊youyi -有用youyong -游泳youyong -有余youyu -由于youyu -犹豫youyu -忧郁youyu -悠远youyuan -优越youyue -有着youzhe -邮政youzheng -优质youzhi -幼稚youzhi -由衷youzhong -邮资youzi -有求必应yqby -以权谋私yqms -有气无力yqwl -迎刃而解yrej -因人而异yrey -与人为善yrws -引人注目yrzm -意识到ysd -艺术家ysj -因势利导ysld -印刷体yst -意识形态ysxt -衣食住行yszx -以身作则yszz -研讨会yth -一条龙ytl -一条心ytx -有条有理ytyl -于yu -与yu -育yu -鱼yu -雨yu -玉yu -余yu -遇yu -预yu -域yu -语yu -愈yu -渔yu -予yu -羽yu -愚yu -御yu -谷*yu -欲yu -宇yu -蔚*yu -尉*yu -迂yu -淤yu -盂yu -榆yu -虞yu -舆yu -俞yu -逾yu -愉yu -渝yu -隅yu -娱yu -屿yu -禹yu -芋yu -郁yu -吁yu -喻yu -峪yu -狱yu -誉yu -浴yu -寓yu -裕yu -豫yu -驭yu -粥*yu -禺yu -毓yu -伛yu -俣yu -谀yu -谕yu -萸yu -菀*yu -蓣yu -揄yu -圄yu -圉yu -嵛yu -狳yu -饫yu -馀yu -庾yu -阈yu -鬻yu -妪yu -妤yu -纡yu -瑜yu -昱yu -觎yu -腴yu -腧*yu -欤yu -於yu -煜yu -熨yu -燠yu -聿yu -钰yu -鹆yu -鹬yu -瘐yu -瘀yu -窬yu -窳yu -蜮yu -蝓yu -竽yu -臾yu -舁yu -雩yu -龉yu -员yuan -原yuan -圆yuan -源yuan -元yuan -远yuan -愿yuan -院yuan -缘yuan -援yuan -园yuan -怨yuan -鸳yuan -渊yuan -冤yuan -垣yuan -袁yuan -辕yuan -猿yuan -苑yuan -垸yuan -塬yuan -芫yuan -掾yuan -圜*yuan -沅yuan -媛yuan -瑗yuan -橼yuan -爰yuan -眢yuan -鸢yuan -螈yuan -箢yuan -鼋yuan -原本yuanben -渊博yuanbo -冤仇yuanchou -远大yuanda -元旦yuandan -园地yuandi -园丁yuanding -远东yuandong -远方yuanfang -缘分yuanfen -原告yuangao -原故yuangu -缘故yuangu -圆滑yuanhua -原籍yuanji -冤家yuanjia -元件yuanjian -远见yuanjian -远近yuanjin -远景yuanjing -援救yuanjiu -原来yuanlai -原理yuanli -原谅yuanliang -原料yuanliao -远虑yuanlu -圆满yuanman -远谋yuanmou -远期yuanqi -冤屈yuanqu -源泉yuanquan -原始yuanshi -远视yuanshi -元首yuanshou -元帅yuanshuai -元素yuansu -援外yuanwai -愿望yuanwang -冤枉yuanwang -原先yuanxian -远销yuanxiao -元宵yuanxiao -院校yuanxiao -原形yuanxing -怨言yuanyan -原野yuanye -愿意yuanyi -园艺yuanyi -原因yuanyin -援引yuanyin -原有yuanyou -缘由yuanyou -远游yuanyou -远远yuanyuan -渊源yuanyuan -元月yuanyue -原则yuanze -院长yuanzhang -远征yuanzheng -援助yuanzhu -原子yuanzi -院子yuanzi -预报yubao -预备yubei -愚笨yuben -余步yubu -预测yuce -愚蠢yuchun -遇到yudao -预定yuding -预订yuding -余毒yudu -月yue -说*yue -越yue -约yue -乐*yue -跃yue -曰yue -阅yue -钥yue -岳yue -粤yue -悦yue -龠yue -瀹yue -栎*yue -樾yue -刖yue -钺yue -月报yuebao -月初yuechu -月底yuedi -约定yueding -月度yuedu -阅读yuedu -乐队yuedui -约法yuefa -月份yuefen -月光yueguang -越轨yuegui -约会yuehui -越界yuejie -跃进yuejin -越境yuejing -阅览yuelan -阅历yueli -月亮yueliang -月末yuemo -约莫yuemo -越南yuenan -乐谱yuepu -乐器yueqi -月球yueqiu -乐曲yuequ -月色yuese -越是yueshi -约束yueshu -月台yuetai -乐团yuetuan -约有yueyou -乐章yuezhang -预防yufang -预风yufeng -预付yufu -预感yugan -预告yugao -预购yugou -遇害yuhai -宇航yuhang -与会yuhui -迂回yuhui -雨季yuji -预计yuji -遇见yujian -预见yujian -语句yuju -豫剧yuju -愉快yukuai -娱乐yule -鱼雷yulei -预料yuliao -雨露yulu -舆论yulun -愚昧yumei -育苗yumiao -预谋yumou -运yun -员*yun -云yun -匀yun -均*yun -允yun -孕yun -耘yun -郧yun -陨yun -蕴yun -酝yun -晕yun -韵yun -郓yun -芸yun -狁yun -恽yun -愠yun -纭yun -韫yun -殒yun -昀yun -氲yun -熨yun -遇难yunan -云彩yuncai -蕴藏yuncang -匀称yuncheng -运动yundong -熨斗yundou -云海yunhai -运河yunhe -韵律yunlu -陨落yunluo -云南yunnan -酝酿yunnian -允诺yunnuo -愚弄yunong -运气yunqi -运输yunshu -运算yunsuan -云梯yunti -运往yunwang -韵味yunwei -云雾yunwu -云霞yunxia -运行yunxing -允许yunxu -运用yunyong -孕育yunyu -运载yunzai -运转yunzhuan -与其yuqi -语气yuqi -预期yuqi -预审yushen -于是yushi -预示yushi -预售yushou -雨水yushui -预算yusuan -欲望yuwang -语文yuwen -预习yuxi -预先yuxian -遇险yuxian -预想yuxiang -预言yuyan -语言yuyan -寓言yuyan -预演yuyan -予以yuyi -寓于yuyu -愉悦yuyue -预兆yuzhao -预支yuzhi -宇宙yuzhou -有文化ywh -业务联系ywlx -意味着ywz -有限公司yxgs -一系列yxl -有效期yxq -医学院yxy -一心一意yxyy -游泳池yyc -营业额yye -夜以继日yyjr -应用科学yykx -一言堂yyt -引以为戒yywj -优越性yyx -营业员yyy -隐隐约约yyyy -运用自如yyzr -拥政爱民yzam -原子能yzn -已知数yzs -有助于yzy -言之有理yzyl -在z -这z -主z -中z -种z -着z -争z -战z -作z -正z -之z -制z -重z -组z -治z -只z -子z -自z -质z -指z -杂za -扎*za -咱za -匝za -砸za -咋za -咂za -在zai -再zai -载zai -栽zai -灾zai -仔*zai -哉zai -宰zai -崽zai -甾zai -再版zaiban -再不zaibu -在场zaichang -再度zaidu -宰割zaige -灾害zaihai -再好zaihao -在乎zaihu -灾荒zaihuang -再会zaihui -灾祸zaihuo -再见zaijian -在理zaili -灾民zaimin -灾难zainan -栽培zaipei -再起zaiqi -灾情zaiqing -灾区zaiqu -再三zaisan -在世zaishi -再说zaishuo -载体zaiti -在下zaixia -再现zaixian -宰相zaixiang -在意zaiyi -在于zaiyu -再造zaizao -再则zaize -在职zaizhi -再植zaizhi -杂技zaji -杂粮zaliang -杂乱zaluan -赞zan -咱zan -暂zan -攒zan -拶zan -瓒zan -昝zan -簪zan -糌zan -趱zan -錾zan -赞成zancheng -暂定zanding -藏*zang -脏zang -葬zang -赃zang -奘zang -驵zang -臧zang -赞歌zange -赃款zangkuan -葬送zangsong -赃物zangwu -藏族zangzu -杂念zanian -赞美zanmei -咱们zanmen -暂且zanqie -暂缺zanque -赞赏zanshang -暂时zanshi -赞颂zansong -赞叹zantan -暂停zanting -赞同zantong -暂行zanxing -赞扬zanyang -暂用zanyong -赞助zanzhu -造zao -早zao -遭zao -燥zao -凿zao -糟zao -枣zao -皂zao -藻zao -澡zao -蚤zao -躁zao -噪zao -灶zao -唣zao -早晨zaochen -造成zaocheng -凿穿zaochuan -造次zaoci -造词zaoci -遭到zaodao -早稻zaodao -造反zaofan -早饭zaofan -造福zaofu -糟糕zaogao -造化zaohua -造价zaojia -造就zaojiu -造林zaolin -早年zaonian -糟粕zaopo -早期zaoqi -早日zaori -早上zaoshang -遭受zaoshou -早衰zaoshuai -糟蹋zaota -早晚zaowan -造型zaoxing -遭殃zaoyang -造谣zaoyao -造诣zaoyi -早已zaoyi -噪音zaoyin -遭遇zaoyu -造字zaozi -杂谈zatan -杂文zawen -杂质zazhi -杂志zazhi -资本主义zbzy -资产阶级zcjj -增长率zcl -总参谋部zcmb -真才实学zcsx -自动化zdh -自动检测zdjc -自动检索zdjs -自动控制zdkz -主动权zdq -招待所zds -总的说来zdsl -主动性zdx -则ze -择ze -责ze -侧*ze -泽ze -咋*ze -仄ze -赜ze -啧ze -帻ze -迮ze -昃ze -笮ze -箦ze -舴ze -责备zebei -责成zecheng -责罚zefa -责怪zeguai -贼zei -责令zeling -责骂zema -怎zen -谮zen -增zeng -曾zeng -综*zeng -憎zeng -赠zeng -缯zeng -甑zeng -罾zeng -锃zeng -增补zengbu -增产zengchan -增长zengchang -增大zengda -增订zengding -增多zengduo -增高zenggao -憎恨zenghen -增加zengjia -增减zengjian -增进zengjin -增量zengliang -赠品zengpin -增强zengqiang -增删zengshan -增设zengshe -赠送zengsong -增添zengtian -赠言zengyan -增益zengyi -增援zengyuan -怎么zenme -怎奈zennai -怎样zenyang -责任zeren -责问zewen -总而言之zeyz -争分夺秒zfdm -针锋相对zfxd -自负盈亏zfyk -中关村zgc -自告奋勇zgfy -中国共产党zggd -总工会zgh -中国特色的zgtd -中国银行zgyh -自古以来zgyl -中国政府zgzf -中共中央zgzy -查*zha -扎zha -炸zha -闸zha -铡zha -轧zha -渣zha -蜡*zha -喳zha -札zha -眨zha -栅zha -榨zha -咋*zha -乍zha -诈zha -柞*zha -揸zha -吒zha -咤zha -哳zha -喋*zha -楂*zha -砟zha -痄zha -蚱zha -齄zha -炸弹zhadan -扎根zhagen -炸毁zhahui -寨zhai -侧*zhai -择*zhai -摘zhai -窄zhai -斋zhai -翟*zhai -祭*zhai -宅zhai -债zhai -砦zhai -瘵zhai -摘录zhailu -债权zhaiquan -债务zhaiwu -窄小zhaixiao -摘要zhaiyao -札记zhaji -战zhan -展zhan -站zhan -占zhan -粘*zhan -颤*zhan -瞻zhan -毡zhan -詹zhan -沾zhan -盏zhan -斩zhan -辗zhan -崭zhan -蘸zhan -栈zhan -湛zhan -绽zhan -谵zhan -搌zhan -旃zhan -战败zhanbai -战报zhanbao -战备zhanbei -战场zhanchang -展翅zhanchi -展出zhanchu -战地zhandi -战斗zhandou -战犯zhanfan -长*zhang -张zhang -章zhang -掌zhang -仗zhang -障zhang -胀zhang -涨zhang -账zhang -樟zhang -彰zhang -漳zhang -杖zhang -丈zhang -帐zhang -瘴zhang -仉zhang -鄣zhang -幛zhang -嶂zhang -獐zhang -嫜zhang -璋zhang -蟑zhang -障碍zhangai -站岗zhangang -长辈zhangbei -章程zhangcheng -长大zhangda -战歌zhange -章法zhangfa -帐房zhangfang -丈夫zhangfu -掌管zhangguan -帐号zhanghao -章节zhangjie -帐目zhangmu -战功zhangong -掌权zhangquan -张贴zhangtie -战鼓zhangu -沾光zhanguang -战国zhanguo -战果zhanguo -张望zhangwang -掌握zhangwo -张扬zhangyang -战壕zhanhao -战后zhanhou -战机zhanji -战绩zhanji -战局zhanju -占据zhanju -展开zhankai -战况zhankuang -展览zhanlan -占领zhanling -战略zhanlue -战马zhanma -展品zhanpin -战区zhanqu -沾染zhanran -战胜zhansheng -战时zhanshi -战事zhanshi -战士zhanshi -展示zhanshi -战术zhanshu -展望zhanwang -战线zhanxian -展现zhanxian -展销zhanxiao -崭新zhanxin -瞻仰zhanyang -战役zhanyi -占用zhanyong -占有zhanyou -战友zhanyou -站长zhanzhang -战争zhanzheng -着*zhao -照zhao -找zhao -招zhao -朝*zhao -召zhao -赵zhao -爪zhao -罩zhao -沼zhao -兆zhao -嘲*zhao -昭zhao -肇zhao -诏zhao -啁*zhao -棹zhao -钊zhao -笊zhao -照办zhaoban -照搬zhaoban -招标zhaobiao -照常zhaochang -照抄zhaochao -招待zhaodai -照发zhaofa -招工zhaogong -照顾zhaogu -招呼zhaohu -召唤zhaohuan -照会zhaohui -着急zhaoji -招集zhaoji -召集zhaoji -招架zhaojia -召开zhaokai -招考zhaokao -招揽zhaolan -着力zhaoli -照例zhaoli -照料zhaoliao -着落zhaoluo -着迷zhaomi -照明zhaoming -招聘zhaopin -朝气zhaoqi -招惹zhaore -照射zhaoshe -招生zhaosheng -着手zhaoshou -招手zhaoshou -招收zhaoshou -招贴zhaotie -朝夕zhaoxi -朝霞zhaoxia -着想zhaoxiang -照相zhaoxiang -昭雪zhaoxue -找寻zhaoxun -着眼zhaoyan -照样zhaoyang -照耀zhaoyao -照应zhaoying -招展zhaozhan -招致zhaozhi -着重zhaozhong -照着zhaozhuo -诈骗zhapian -榨取zhaqu -诈取zhaqu -扎实zhashi -炸药zhayao -渣滓zhazi -这zhe -着zhe -者zhe -折zhe -哲zhe -浙zhe -遮zhe -蛰zhe -辙zhe -锗zhe -蔗zhe -谪zhe -摺zhe -柘zhe -辄zhe -磔zhe -鹧zhe -褶zhe -蜇zhe -赭zhe -这般zheban -这边zhebian -这次zheci -遮挡zhedang -这点zhedian -折叠zhedie -折服zhefu -遮盖zhegai -这个zhege -折合zhehe -浙江zhejiang -折旧zhejiu -折扣zhekou -这里zheli -哲理zheli -这么zheme -折磨zhemo -真zhen -针zhen -阵zhen -镇zhen -振zhen -震zhen -珍zhen -诊zhen -斟zhen -甄zhen -砧zhen -臻zhen -贞zhen -侦zhen -枕zhen -疹zhen -圳zhen -蓁zhen -浈zhen -溱*zhen -缜zhen -桢zhen -椹*zhen -榛zhen -轸zhen -赈zhen -胗zhen -朕zhen -祯zhen -畛zhen -稹zhen -鸩zhen -箴zhen -珍爱zhenai -珍宝zhenbao -针砭zhenbian -珍藏zhencang -贞操zhencao -侦察zhencha -真诚zhencheng -震荡zhendang -阵地zhendi -真谛zhendi -震动zhendong -诊断zhenduan -针对zhendui -振奋zhenfen -争zheng -正zheng -政zheng -整zheng -证zheng -征zheng -蒸zheng -症zheng -丁*zheng -郑zheng -挣zheng -睁zheng -狰zheng -怔zheng -拯zheng -帧zheng -诤zheng -峥zheng -徵zheng -钲zheng -铮zheng -筝zheng -争霸zhengba -整备zhengbei -正比zhengbi -政变zhengbian -争辩zhengbian -整编zhengbian -征兵zhengbing -政策zhengce -正常zhengchang -争吵zhengchao -征程zhengcheng -争持zhengchi -正大zhengda -正当zhengdang -政党zhengdang -整党zhengdang -正道zhengdao -争端zhengduan -整顿zhengdun -争夺zhengduo -蒸发zhengfa -政法zhengfa -正反zhengfan -整风zhengfeng -政府zhengfu -征服zhengfu -整改zhenggai -整个zhengge -征购zhenggou -争光zhengguang -正规zhenggui -正轨zhenggui -正好zhenghao -政绩zhengji -征集zhengji -证件zhengjian -政见zhengjian -整洁zhengjie -政局zhengju -证据zhengju -正理zhengli -整理zhengli -正梁zhengliang -政令zhengling -争论zhenglun -政论zhenglun -正面zhengmian -争鸣zhengming -证明zhengming -正派zhengpai -征聘zhengpin -争气zhengqi -正气zhengqi -蒸气zhengqi -整齐zhengqi -正巧zhengqiao -征求zhengqiu -争取zhengqu -政权zhengquan -正确zhengque -证人zhengren -正是zhengshi -正式zhengshi -正视zhengshi -证实zhengshi -征收zhengshou -整数zhengshu -证书zhengshu -征税zhengshui -整套zhengtao -正题zhengti -政体zhengti -整体zhengti -整天zhengtian -征调zhengtiao -正统zhengtong -征途zhengtu -珍贵zhengui -政委zhengwei -正文zhengwen -征文zhengwen -政务zhengwu -争先zhengxian -政协zhengxie -整形zhengxing -整修zhengxiu -征询zhengxun -争艳zhengyan -正业zhengye -正义zhengyi -争议zhengyi -征用zhengyong -正月zhengyue -正在zhengzai -挣扎zhengzha -整整zhengzheng -正直zhengzhi -政治zhengzhi -争执zhengzhi -正中zhengzhong -郑重zhengzhong -郑州zhengzhou -症状zhengzhuang -正宗zhengzong -震撼zhenhan -侦缉zhenji -真假zhenjia -阵脚zhenjiao -贞节zhenjie -贞洁zhenjie -镇静zhenjing -震惊zhenjing -真空zhenkong -真理zhenli -诊疗zhenliao -珍品zhenpin -珍奇zhenqi -真切zhenqie -真情zhenqing -真确zhenque -真人zhenren -阵容zhenrong -真是zhenshi -真实zhenshi -阵势zhenshi -珍视zhenshi -侦探zhentan -阵亡zhenwang -珍惜zhenxi -阵线zhenxian -真相zhenxiang -振兴zhenxing -镇压zhenya -阵阵zhenzhen -真正zhenzheng -真知zhenzhi -真挚zhenzhi -珍重zhenzhong -珍珠zhenzhu -斟酌zhenzhuo -振作zhenzuo -这是zheshi -这时zheshi -折腾zheteng -这些zhexie -哲学zhexue -遮掩zheyan -这样zheyang -这种zhezhong -折中zhezhong -之zhi -制zhi -治zhi -只zhi -质zhi -指zhi -直zhi -支zhi -织zhi -止zhi -至zhi -置zhi -志zhi -值zhi -知zhi -识*zhi -执zhi -职zhi -植zhi -纸zhi -致zhi -枝zhi -殖zhi -脂zhi -智zhi -氏*zhi -肢zhi -秩zhi -址zhi -滞zhi -汁zhi -芝zhi -吱zhi -蜘zhi -侄zhi -趾zhi -旨zhi -挚zhi -掷zhi -帜zhi -峙zhi -稚zhi -炙zhi -痔zhi -窒zhi -卮zhi -陟zhi -郅zhi -埴zhi -芷zhi -摭zhi -帙zhi -徵*zhi -忮zhi -彘zhi -咫zhi -骘zhi -栉zhi -枳zhi -栀zhi -桎zhi -轵zhi -轾zhi -贽zhi -胝zhi -膣zhi -祉zhi -祗zhi -黹zhi -雉zhi -鸷zhi -痣zhi -蛭zhi -絷zhi -酯zhi -跖zhi -踬zhi -踯zhi -豸zhi -觯zhi -治安zhian -值班zhiban -植保zhibao -置备zhibei -质变zhibian -指标zhibiao -职别zhibie -支部zhibu -制裁zhicai -支撑zhicheng -职称zhicheng -支持zhichi -指出zhichu -支出zhichu -至此zhici -值此zhici -直达zhida -只当zhidang -直到zhidao -指导zhidao -知道zhidao -只得zhide -值得zhide -质地zhidi -指点zhidian -制定zhiding -指定zhiding -制订zhiding -制度zhidu -支队zhidui -至多zhiduo -知法zhifa -执法zhifa -制服zhifu -支付zhifu -职工zhigong -只顾zhigu -只管zhiguan -直观zhiguan -治国zhiguo -只好zhihao -之后zhihou -指挥zhihui -智慧zhihui -知己zhiji -指甲zhijia -之间zhijian -只见zhijian -指教zhijiao -直接zhijie -枝节zhijie -至今zhijin -直经zhijing -直径zhijing -止境zhijing -致敬zhijing -知觉zhijue -治理zhili -致力zhili -智力zhili -质量zhiliang -治疗zhiliao -指令zhiling -直流zhiliu -支流zhiliu -殖民zhimin -致命zhiming -指明zhiming -知名zhiming -智谋zhimou -指南zhinan -智囊zhinang -之内zhinei -只能zhineng -职能zhineng -智能zhineng -只怕zhipa -指派zhipai -支配zhipei -支票zhipiao -制品zhipin -志气zhiqi -之前zhiqian -支前zhiqian -值勤zhiqin -执勤zhiqin -知情zhiqing -知青zhiqing -智取zhiqu -志趣zhiqu -知趣zhiqu -职权zhiquan -值日zhiri -治丧zhisang -之上zhishang -直上zhishang -至上zhishang -至少zhishao -制胜zhisheng -之声zhisheng -只是zhishi -指使zhishi -支使zhishi -致使zhishi -知事zhishi -指示zhishi -知识zhishi -指数zhishu -支书zhishu -直属zhishu -植树zhishu -直爽zhishuang -治水zhishui -直说zhishuo -致死zhisi -之外zhiwai -指望zhiwang -职位zhiwei -质问zhiwen -植物zhiwu -职务zhiwu -窒息zhixi -之下zhixia -直线zhixian -指向zhixiang -志向zhixiang -知心zhixin -执行zhixing -只许zhixu -秩序zhixu -直言zhiyan -只要zhiyao -职业zhiye -致意zhiyi -旨意zhiyi -质疑zhiyi -指引zhiyin -知音zhiyin -只有zhiyou -至于zhiyu -置于zhiyu -智育zhiyu -职员zhiyuan -支援zhiyuan -志愿zhiyuan -制约zhiyue -制造zhizao -指责zhize -职责zhize -纸张zhizhang -职掌zhizhang -执照zhizhao -指正zhizheng -执政zhizheng -制止zhizhi -直至zhizhi -之中zhizhong -支助zhizhu -支柱zhizhu -知足zhizu -制作zhizuo -走后门zhm -中华民国zhmg -中华民族zhmz -中zhong -种zhong -重zhong -众zhong -钟zhong -终zhong -忠zhong -肿zhong -仲zhong -盅zhong -衷zhong -冢zhong -忪*zhong -锺zhong -螽zhong -舯zhong -踵zhong -钟爱zhongai -重办zhongban -重兵zhongbing -中部zhongbu -仲裁zhongcai -中层zhongceng -衷肠zhongchang -忠诚zhongcheng -重大zhongda -重担zhongdan -中等zhongdeng -种地zhongdi -重地zhongdi -重点zhongdian -终点zhongdian -中东zhongdong -中断zhongduan -终端zhongduan -中队zhongdui -众多zhongduo -重犯zhongfan -忠告zhonggao -中共zhonggong -中国zhongguo -忠厚zhonghou -中华zhonghua -中级zhongji -终极zhongji -重价zhongjia -中间zhongjian -中坚zhongjian -中奖zhongjiang -终结zhongjie -终究zhongjiu -终久zhongjiu -终局zhongju -中肯zhongken -种类zhonglei -中立zhongli -重量zhongliang -终了zhongliao -中流zhongliu -肿瘤zhongliu -中美zhongmei -众目zhongmu -中年zhongnian -终年zhongnian -中秋zhongqiu -重任zhongren -中日zhongri -终日zhongri -中伤zhongshang -重赏zhongshang -终身zhongshen -终生zhongsheng -重视zhongshi -忠实zhongshi -中枢zhongshu -众说zhongshuo -中苏zhongsu -终天zhongtian -中途zhongtu -重托zhongtuo -中外zhongwai -重围zhongwei -中文zhongwen -中午zhongwu -中西zhongxi -中心zhongxin -忠心zhongxin -衷心zhongxin -中性zhongxing -中学zhongxue -中旬zhongxun -忠言zhongyan -中央zhongyang -中药zhongyao -重要zhongyao -中医zhongyi -重用zhongyong -中庸zhongyong -中游zhongyou -终于zhongyu -忠于zhongyu -忠贞zhongzhen -中止zhongzhi -种植zhongzhi -终止zhongzhi -种种zhongzhong -中专zhongzhuan -种族zhongzu -轴zhou -周zhou -洲zhou -州zhou -皱zhou -骤zhou -舟zhou -诌zhou -粥zhou -肘zhou -帚zhou -咒zhou -宙zhou -昼zhou -荮zhou -啁zhou -妯zhou -纣zhou -绉zhou -胄zhou -碡zhou -籀zhou -繇*zhou -酎zhou -周到zhoudao -咒骂zhouma -周密zhoumi -周末zhoumo -周期zhouqi -周全zhouquan -周围zhouwei -周旋zhouxuan -昼夜zhouye -周折zhouzhe -周知zhouzhi -周转zhouzhuan -总后勤部zhqb -中华人民共和国zhrg -主zhu -注zhu -著zhu -住zhu -助zhu -猪zhu -铸zhu -属*zhu -株zhu -筑zhu -柱zhu -术*zhu -驻zhu -逐zhu -祝zhu -竹zhu -贮zhu -珠zhu -朱zhu -诸zhu -蛛zhu -诛zhu -烛zhu -煮zhu -拄zhu -瞩zhu -嘱zhu -蛀zhu -伫zhu -侏zhu -邾zhu -茱zhu -洙zhu -渚zhu -潴zhu -杼zhu -槠zhu -橥zhu -炷zhu -铢zhu -疰zhu -瘃zhu -褚*zhu -竺zhu -箸zhu -舳zhu -翥zhu -躅zhu -麈zhu -抓zhua -挝*zhua -抓好zhuahao -转*zhuai -曳*zhuai -拽zhuai -抓紧zhuajin -转zhuan -专zhuan -传*zhuan -砖zhuan -撰zhuan -赚zhuan -篆zhuan -啭zhuan -馔zhuan -沌*zhuan -颛zhuan -转变zhuanbian -转播zhuanbo -专长zhuanchang -专程zhuancheng -转达zhuanda -转发zhuanfa -装zhuang -状zhuang -壮zhuang -庄zhuang -撞zhuang -幢*zhuang -桩zhuang -妆zhuang -僮zhuang -奘*zhuang -转告zhuangao -装扮zhuangban -装备zhuangbei -壮大zhuangda -装订zhuangding -壮观zhuangguan -装甲zhuangjia -庄稼zhuangjia -庄嫁zhuangjia -壮举zhuangju -状况zhuangkuang -壮阔zhuangkuo -壮丽zhuangli -壮烈zhuanglie -装配zhuangpei -装饰zhuangshi -状态zhuangtai -装卸zhuangxie -庄严zhuangyan -庄园zhuangyuan -装运zhuangyun -装置zhuangzhi -壮志zhuangzhi -庄重zhuangzhong -转化zhuanhua -转换zhuanhuan -转给zhuanji -专家zhuanjia -专科zhuanke -专利zhuanli -专门zhuanmen -转让zhuanrang -专题zhuanti -转向zhuanxiang -专心zhuanxin -转眼zhuanyan -专业zhuanye -转移zhuanyi -专员zhuanyuan -转载zhuanzai -转折zhuanzhe -转正zhuanzheng -专政zhuanzheng -专制zhuanzhi -专职zhuanzhi -专注zhuanzhu -专著zhuanzhu -主办zhuban -逐步zhubu -贮藏zhucang -注册zhuce -助长zhuchang -主持zhuchi -主次zhuci -主导zhudao -注定zhuding -主动zhudong -主队zhudui -主犯zhufan -住房zhufang -祝福zhufu -嘱咐zhufu -逐个zhuge -主攻zhugong -助工zhugong -主管zhuguan -主观zhuguan -追zhui -锥zhui -椎zhui -赘zhui -坠zhui -缀zhui -惴zhui -骓zhui -缒zhui -追捕zhuibu -追查zhuicha -追悼zhuidao -追赶zhuigan -坠毁zhuihui -追加zhuijia -追究zhuijiu -追求zhuiqiu -追认zhuiren -追溯zhuisu -追随zhuisui -追问zhuiwen -追逐zhuizhu -追踪zhuizong -主机zhuji -主见zhujian -逐渐zhujian -主将zhujiang -主讲zhujiang -主教zhujiao -主角zhujiao -注解zhujie -祝酒zhujiu -主力zhuli -助理zhuli -株连zhulian -主粮zhuliang -主流zhuliu -驻留zhuliu -著名zhuming -主谋zhumou -注目zhumu -瞩目zhumu -准zhun -屯*zhun -谆zhun -肫zhun -窀zhun -准备zhunbei -逐年zhunian -准确zhunque -准绳zhunsheng -准时zhunshi -准许zhunxu -准则zhunze -着*zhuo -著*zhuo -捉zhuo -桌zhuo -缴*zhuo -拙zhuo -卓zhuo -琢zhuo -茁zhuo -酌zhuo -啄zhuo -灼zhuo -浊zhuo -倬zhuo -诼zhuo -擢zhuo -浞zhuo -涿zhuo -濯zhuo -棹*zhuo -焯zhuo -禚zhuo -斫zhuo -镯zhuo -拙劣zhuolie -琢磨zhuomo -捉弄zhuonong -酌情zhuoqing -卓越zhuoyue -茁壮zhuozhuang -主权zhuquan -主人zhuren -主任zhuren -诸如zhuru -注色zhuse -注视zhushi -柱石zhushi -注释zhushi -助手zhushou -主送zhusong -住宿zhusu -珠算zhusuan -主题zhuti -主体zhuti -逐条zhutiao -嘱托zhutuo -诸位zhuwei -主席zhuxi -注销zhuxiao -主要zhuyao -逐一zhuyi -主义zhuyi -主意zhuyi -注意zhuyi -祝愿zhuyuan -逐月zhuyue -主宰zhuzai -铸造zhuzao -驻扎zhuzha -住宅zhuzhai -主张zhuzhang -住址zhuzhi -注重zhuzhong -著作zhuzuo -子zi -自zi -资zi -字zi -紫zi -仔zi -籽zi -姿zi -吱*zi -兹zi -咨zi -滋zi -淄zi -孜zi -滓zi -渍zi -谘zi -茈*zi -呲*zi -嵫zi -姊zi -孳zi -缁zi -梓zi -辎zi -赀zi -恣zi -眦zi -锱zi -秭zi -耔zi -笫zi -粢zi -趑zi -觜zi -訾zi -龇zi -鲻zi -髭zi -自爱ziai -自白zibai -自卑zibei -资本ziben -资产zichan -滋长zichang -自称zicheng -自传zichuan -自从zicong -子弟zidi -字典zidian -自动zidong -自发zifa -自费zifei -自封zifeng -自负zifu -字符zifu -资格zige -字根zigen -自豪zihao -自给ziji -自己ziji -字迹ziji -字节zijie -资金zijin -自救zijiu -自居ziju -自觉zijue -字库ziku -自夸zikua -自理zili -资历zili -资料ziliao -自满ziman -自勉zimian -字母zimu -字幕zimu -子女zinu -自强ziqiang -自然ziran -滋润zirun -自杀zisha -自身zishen -姿势zishi -自述zishu -自私zisi -姿态zitai -字体ziti -字帖zitie -自卫ziwei -滋味ziwei -自问ziwen -自我ziwo -仔细zixi -自信zixin -自修zixiu -自叙zixu -自选zixuan -自学zixue -咨询zixun -滋养ziyang -自由ziyou -自愿ziyuan -资源ziyuan -自找zizhao -自治zizhi -自重zizhong -资助zizhu -自尊zizun -直截了当zjld -浙江省zjs -这就是说zjss -中纪委zjw -再接再厉zjzl -中联部zlb -专利法zlf -质量管理zlgl -自力更生zlgs -展览会zlh -智力开发zlkf -专利权zlq -知名人士zmrs -这么些zmx -这么样zmy -怎么样zmy -总zong -纵zong -宗zong -综zong -棕zong -鬃zong -踪zong -偬zong -枞zong -腙zong -粽zong -总部zongbu -总裁zongcai -总参zongcan -总队zongdui -总额zonge -总纲zonggang -总共zonggong -纵贯zongguan -总和zonghe -综合zonghe -纵横zongheng -总后zonghou -总计zongji -踪迹zongji -宗教zongjiao -总结zongjie -总局zongju -总括zongkuo -总理zongli -总论zonglun -宗派zongpai -纵情zongqing -纵深zongshen -总是zongshi -纵使zongshi -总数zongshu -总算zongsuan -总体zongti -总统zongtong -总务zongwu -踪影zongying -总帐zongzhang -总政zongzheng -总之zongzhi -宗旨zongzhi -走zou -邹zou -奏zou -揍zou -诹zou -陬zou -鄹zou -驺zou -鲰zou -走访zoufang -邹虹zouhong -走私zousi -奏效zouxiao -酌情处理zqcl -中青年zqn -朝气蓬勃zqpb -准确无误zqww -正确性zqx -诸如此类zrcl -责任感zrg -自然界zrj -主人翁zrw -责任心zrx -责任制zrz -再生产zsc -自上而下zsex -知识分子zsfz -这时候zsh -知识化zsh -株式会社zshs -总书记zsj -装饰品zsp -综上所述zsss -之所以zsy -自始至终zszz -众所周知zszz -座谈会zth -组zu -族zu -足zu -阻zu -祖zu -租zu -卒zu -诅zu -俎zu -菹zu -镞zu -阻碍zuai -钻zuan -赚*zuan -纂zuan -攥zuan -缵zuan -躜zuan -钻研zuanyan -组成zucheng -阻挡zudang -组阁zuge -足够zugou -祖国zuguo -组合zuhe -最zui -罪zui -嘴zui -堆*zui -咀*zui -醉zui -蕞zui -最初zuichu -最大zuida -最低zuidi -罪恶zuie -罪犯zuifan -最高zuigao -罪过zuiguo -最好zuihao -最后zuihou -最坏zuihuai -最佳zuijia -最近zuijin -嘴脸zuilian -罪名zuiming -罪孽zuinie -罪人zuiren -最先zuixian -最小zuixiao -最新zuixin -醉心zuixin -罪行zuixing -罪责zuize -罪证zuizheng -最终zuizhong -罪状zuizhuang -阻击zuji -租界zujie -租借zujie -阻拦zulan -阻力zuli -租赁zulin -尊zun -遵zun -撙zun -樽zun -鳟zun -阻挠zunao -遵从zuncong -尊贵zungui -尊敬zunjing -遵守zunshou -遵循zunxun -尊严zunyan -遵照zunzhao -尊重zunzhong -作zuo -做zuo -左zuo -座zuo -坐zuo -昨zuo -撮*zuo -凿*zuo -搓*zuo -琢*zuo -佐zuo -柞zuo -阼zuo -唑zuo -嘬zuo -怍zuo -胙zuo -祚zuo -笮*zuo -作案zuoan -作弊zuobi -左边zuobian -坐标zuobiao -做到zuodao -作法zuofa -做法zuofa -作废zuofei -作风zuofeng -做工zuogong -作怪zuoguai -做好zuohao -作家zuojia -作客zuoke -作乐zuole -作乱zuoluan -坐落zuoluo -左派zuopai -作品zuopin -左倾zuoqing -做人zuoren -昨日zuori -做事zuoshi -坐视zuoshi -座谈zuotan -昨天zuotian -昨晚zuowan -作为zuowei -座位zuowei -坐位zuowei -作文zuowen -作物zuowu -作业zuoye -昨夜zuoye -作用zuoyong -左右zuoyou -作战zuozhan -作者zuozhe -作证zuozheng -作主zuozhu -做主zuozhu -做作zuozuo -足球zuqiu -阻塞zuse -祖师zushi -祖先zuxian -组长zuzhang -组织zuzhi -阻止zuzhi -祖宗zuzong -中外合资zwhz -责无旁贷zwpd -中宣部zxb -自行车zxc -自下而上zxes -忠心耿耿zxgg -展销会zxh -照相机zxj -争先恐后zxkh -中学生zxs -主席团zxt -中小学zxx -自信心zxx -中央办公厅zybt -着眼点zyd -专业对口zydk -中央电视台zydt -中央各部委zygw -专业化zyh -专业户zyh -中央军委zyjw -座右铭zym -中央全会zyqh -中央人民广播电台zyrt -主要人员zyry -专业人员zyry -中央书记处zysc -中央委员会zywh -中央委员zywy -重要性zyx -主要原因zyyy -中央政治局zyzj -专业知识zyzs -中组部zzb -组织部zzb -政治部zzb -政治处zzc -转折点zzd -置之度外zzdw -政治局zzj -自治区zzq -蒸蒸日上zzrs -组织上zzs -郑州市zzs -组织性zzx -自尊心zzx -赵紫阳zzy -总政治部zzzb -喷码pm -优喷yp -科技kj -比洋by -公司gs -有限公司yxgz -股份公司gfgs -企业qy -标准bz -喷码机pmj -电线dx -电缆dl -电线电缆dxdl -电力电缆dldl -绝缘jy -绝缘层jyc -导体dt -导线dx -电力dl -通信tx -控制电缆kzdl -补偿电缆bcdl -屏蔽电缆pbdl -高温电缆gwdl -计算机电缆jsjdl -信号电缆xhdl -同轴电缆tzdl -耐火电缆nhdl -船用电缆cydl -铝合金电缆lhjdl -单股dg -多股dg -连接lj -电路dl -电器dq -型号xh -铜t -铝l -铅包qb -铝包qb -聚氯乙烯jlyx -电磁线dcx -北京市bj -东城区dcq -西城区xcq -崇文区cwq -宣武区xwq -朝阳区zyq -海淀区hdq -丰台区ftq -房山区fsq -通州区tzq -顺义区syq -昌平区cpq -大兴区txq -怀柔区hrq -平谷区pgq -门头沟区mtgq -石景山区sjsq -天津市tjs -和平区hpq -河东区hdq -河西区hxq -南开区nkq -河北区hbq -红桥区hqq -塘沽区tgq -汉沽区hgq -大港区tgq -东丽区dlq -西青区xqq -北辰区bcq -津南区jnq -武清区wqq -宝坻区bdq -河北省hbs -辛集市xjs -藁城市gcs -晋州市jzs -新乐市xls -鹿泉市lqs -唐山市tss -遵化市zhs -安市as -邯郸市hds -武安市was -邢台市xts -南宫市ngs -沙河市shs -保定市bds -涿州市zzs -定州市dzs -安国市ags -承德市cds -沧州市czs -泊头市bts -任丘市rqs -黄骅市hhs -河间市hjs -廊坊市lfs -霸州市bzs -三河市shs -衡水市hss -冀州市jzs -深州市szs -石家庄市sjzs -张家口市zjks -高碑店市gbds -秦皇岛市qhds -山西省sxs -太原市tys -古交市gjs -大同市dts -阳泉市yqs -长治市czs -潞城市lcs -晋城市jcs -高平市gps -朔州市szs -晋中市jzs -介休市jxs -运城市ycs -河津市hjs -永济市sjs -忻州市xzs -原平市yps -临汾市lfs -侯马市hms -霍州市hzs -吕梁市lls -孝义市xys -汾阳市fys -内蒙古自治区nmg -包头市bts -乌海市whs -赤峰市cfs -通辽市tls -根河市ghs -丰镇市fzs -辽宁省LNS -沈阳市sys -新民市xms -大连市dls -庄河市zhs -鞍山市ass -海城市hcs -抚顺市fss -本溪市bxs -丹东市dds -东港市dgs -凤城市fcs -锦州市jzs -凌海市lhs -北宁市bns -营口市yks -盖州市gzs -阜新市fxs -辽阳市lys -灯塔市dts -盘锦市pjs -铁岭市tls -开原市kys -朝阳市zys -凌源市lys -北票市bps -兴城市xcs -大石桥市dsqs -瓦房店市wfds -普兰店市plds -调兵山市dbss -葫芦岛市hlds -吉林省jls -长春市ccs -九台市jts -榆树市yss -德惠市dhs -吉林市jls -舒兰市sls -桦甸市hds -蛟河市jhs -磐石市pss -四平市sps -双辽市sls -辽源市lys -通化市ths -集安市jas -白山市bss -临江市ljs -松原市sys -白城市bcs -大安市das -洮南市tns -延吉市yjs -图们市tms -敦化市ghs -龙井市ljs -珲春市hcs -和龙市hls -公主岭市gzls -梅河口市mhks -黑龙江省hljs -阿城市acs -尚志市szs -双城市scs -五常市wcs -讷河市nhs -鹤岗市hgs -鸡西市jxs -密山市mss -虎林市hls -大庆市dqs -伊春市ycs -铁力市tls -宁安市nas -海林市hls -穆棱市mls -同江市tjs -富锦市fjs -黑河市hhs -北安市bas -绥化市shs -安达市ads -肇东市zds -海伦市hls -七台河市qths -双鸭山市syss -牡丹江市mdjs -佳木斯市jmss -绥芬河市sfhs -哈尔滨市hebs -齐齐哈尔市qqhes -五大连池市wdlcs -上海市shs -黄浦区hpq -卢湾区lwq -徐汇区xhq -长宁区cnq -静安区jaq -普陀区ptq -闸北区zbq -虹口区hkq -杨浦区ypq -宝山区bsq -闵行区mxq -嘉定区jdq -松江区sjq -金山区jsq -青浦区qpq -南汇区nhq -奉贤区fxq -崇明县浦东新区cmxpdxq -江苏省jss -南京市njs -无锡市wxs -江阴市jys -宜兴市yxs -徐州市xzs -邳州市pzs -新沂市xys -常州市czs -金坛市jts -溧阳市lys -苏州市szs -常熟市css -太仓市dcs -昆山市hss -吴江市wjs -南通市nns -如皋市rgs -通州市tzs -海门市hms -启东市qds -淮安市has -盐城市ycs -东台市dts -大丰市dfs -扬州市yzs -高邮市gys -江都市jds -仪征市yzs -镇江市zjs -丹阳市dys -扬中市yzs -句容市jrs -泰州市dzs -泰兴市dxs -姜堰市jys -靖江市jjs -兴化市xhs -宿迁市sqs -连云港市lygs -张家港市zjgs -浙江省zjs -杭州市hzs -建德市jds -富阳市fys -临安市las -宁波市nbx -余姚市yys -慈溪市cxs -奉化市fhs -温州市wzs -瑞安市ras -乐清市lqs -嘉兴市jxs -海宁市hns -平湖市phs -桐乡市txs -湖州市hzs -绍兴市sxs -诸暨市zjs -上虞市sys -嵊州市szs -金华市jhs -兰溪市lxs -义乌市yws -东阳市dys -永康市yks -衢州市qzs -江山市jss -舟山市zss -台州市tzs -临海市lhs -丽水市lss -龙泉市lqs -安徽省ahs -合肥市hfs -芜湖市whs -蚌埠市bbs -淮南市hns -淮北市hbs -铜陵市tls -安庆市aqs -桐城市tcs -黄山市hss -滁州市czs -天长市dcs -明光市mgs -阜阳市fys -界首市jss -宿州市szs -巢湖市chs -六安市las -亳州市hzs -池州市czs -宣城市ycs -宁国市ngs -马鞍山市mass -福建省fjs -福州市fjs -福清市fqs -长乐市cls -厦门市xms -莆田市pts -三明市sms -永安市yas -泉州市qzs -石狮市sss -晋江市jjs -南安市nas -漳州市zzs -龙海市lhs -南平市nps -建瓯市jos -邵武市sws -建阳市jys -龙岩市lys -漳平市zps -宁德市nds -福安市fas -福鼎市fds -武夷山市wyss -江西省jxs -南昌市ncs -乐平市lps -萍乡市pxs -九江市jjs -瑞昌市rcs -新余市xys -鹰潭市yts -贵溪市gxs -赣州市gzs -瑞金市rjs -南康市nks -吉安市jas -宜春市ycs -丰城市fcs -樟树市zss -高安市gas -抚州市fzs -上饶市srs -德兴市dxs -井冈山市jgss -景德镇市jdzs -山东省sds -济南市jns -章丘市zqs -青岛市qds -胶南市jns -胶州市jzs -平度市pds -莱西市lxs -即墨市jms -淄博市zbs -枣庄市zzs -滕州市tzs -烟台市yts -龙口市lks -莱阳市lys -莱州市lzs -招远市zys -蓬莱市pls -栖霞市qxs -海阳市hys -潍坊市wfs -青州市qzs -诸城市zcs -寿光市sgs -安丘市aqs -高密市gms -昌邑市cys -济宁市jns -曲阜市qfs -兖州市yzs -邹城市zcs -泰安市tas -新泰市xts -肥城市fcs -威海市whs -乳山市rss -文登市wds -荣成市rcs -日照市rzs -莱芜市lws -临沂市lys -德州市dzs -乐陵市lls -禹城市ycs -聊城市lcs -临清市lqs -滨州市bzs -菏泽市hzs -河南省hns -郑州市zzs -巩义市gys -新郑市xzs -新密市xms -登封市dfs -荥阳市xys -开封市kfs -洛阳市lys -偃师市yss -汝州市rzs -舞钢市wgs -安阳市ays -林州市lzs -新乡市xxs -卫辉市whs -辉县市hxs -焦作市jzs -沁阳市qys -孟州市mzs -濮阳市pys -许昌市xcs -禹州市yzs -长葛市cgs -漯河市lhs -义马市yms -灵宝市lbs -南阳市nys -邓州市dzs -商丘市sqs -永城市ycs -信阳市xys -周口市zks -项城市dcs -济源市jys -三门峡市smxs -平顶山市pdss -驻马店市zmds -湖北省hbs -武汉市whs -黄石市hss -大冶市dys -十堰市sys -荆州市jzs -洪湖市hhs -石首市sss -松滋市szs -宜昌市ycs -宜都市yds -当阳市dys -枝江市jjs -襄樊市xfs -枣阳市zys -宜城市ycs -鄂州市ezs -荆门市jms -钟祥市zxs -孝感市xgs -应城市ycs -安陆市als -汉川市hcs -黄冈市hgs -麻城市mcs -武穴市wxs -咸宁市xns -赤壁市cbs -随州市szs -广水市gss -仙桃市xts -天门市tms -潜江市qjs -恩施市ess -利川市lcs -丹江口市djks -老河口市lhks -神农架林区snjlq -湖南省hns -长沙市css -浏阳市lys -株洲市zzs -醴陵市lls -湘潭市xts -湘乡市xxs -韶山市sss -衡阳市hys -耒阳市lys -常宁市cns -邵阳市sys -武冈市wgs -岳阳市yys -临湘市lxs -汨罗市mls -常德市cds -津市市jss -益阳市yys -沅江市yjs -郴州市czs -资兴市zxs -永州市yzs -怀化市hhs -洪江市hjs -娄底市lds -涟源市lys -吉首市jss -冷水江市lsjs -张家界市zjjs -广东省gds -广州市gzs -从化市chs -增城市zcs -深圳市szs -珠海市zhs -汕头市sts -韶关市sgs -乐昌市lcs -南雄市nxs -佛山市fss -江门市jms -台山市tss -开平市kps -鹤山市hss -恩平市eps -湛江市zjs -廉江市ljs -雷州市lzs -吴川市wcs -茂名市mms -西昌市xcs -峨眉山市emss -都江堰市djys -攀枝花市pzhs -贵州省gzs -贵阳市gys -清镇市qzs -遵义市zys -赤水市css -仁怀市rhs -安顺市ass -毕节市bjs -兴义市xys -凯里市kls -都匀市dys -福泉市fqs -六盘水市lpss -六枝特区lztq -万山特区wstq -云南省yns -昆明市kms -安宁市ans -曲靖市qjs -宣威市xws -玉溪市yxs -保山市bss -昭通市zts -丽江市ljs -思茅市sms -临沧市lqs -个旧市gjs -开远市kys -景洪市jhs -楚雄市cxs -大理市dls -潞西市lxs -瑞丽市rls -西藏自治区xzzzq -拉萨市lss -陕西省sxs -西安市xas -铜川市tcs -宝鸡市bjs -咸阳市xys -渭南市wns -韩城市hcs -华阴市hys -延安市yas -汉中市azs -榆林市yls -安康市aks -商洛市sls -甘肃省gss -兰州市lzs -金昌市jcs -白银市bys -天水市tss -武威市wws -张掖市zys -平凉市pls -酒泉市jqs -玉门市yms -敦煌市dhs -庆阳市qys -定西市dxs -陇南市lns -临夏市lxs -合作市hzs -嘉峪关市jygs -青海省qhs -西宁市xns -德令哈市dlhs -格尔木市gems -宁夏回族自治区nxhzzzq -银川市ycs -灵武市lws -吴忠市wzs -固原市gys -中卫市zws -石嘴山市szss -青铜峡市qtxs -新疆维吾尔自治区xjwwezzq -喀什市kss -昌吉市cjs -阜康市fks -米泉市mqs -博乐市bls -伊宁市yns -奎屯市kts -塔城市tcs -乌苏市wss -石河子市shzs -阿拉尔市ales -五家渠市wjqs -吐鲁番市tlfs -阿克苏市akss -阿图什市atss -库尔勒市kels -阿勒泰市alts -乌鲁木齐市wlmqs -克拉玛依市klmys -图木舒克市tmsks -香港特别行政区 -中西区zxq -东区dq -观塘区gtq -南区nq -湾仔区wzq -离岛区ldq -葵青区kqq -北区bq -西贡区xgq -沙田区stq -屯门区tmq -大埔区dpq -荃湾区qwq -元朗区ylq -九龙城区jtcq -油尖旺区yjwq -深水埗区ssbq -黄大仙区hdxq -台湾省tws -台北市tbs -高雄市gxs -基隆市jls -台中市tzs -台南市tns -新竹市xzs -嘉义市jys -板桥市bqs -宜兰市yls -竹北市zbs -桃园市tys -苗栗市mls -丰原市fys -彰化市zhs -南投市nts -太保市tbs -斗六市dls -新营市xys -凤山市fss -屏东市pds -台东市tds -花莲市hls -马公市mgs \ No newline at end of file diff --git a/YN_utf8.txt b/YN_utf8.txt index a847c21..c0c1eb5 100644 --- a/YN_utf8.txt +++ b/YN_utf8.txt @@ -1,21061 +1,21061 @@ -Šsw -šsw -Žzw -žzw -Œce -œce -aÀ -aÁ -aẢ -aà -aẠ -aÄ -aÅ -aeÆ -a -asá -afà -arả -axã -ajạ -awă -aaâ -aeă -äa -åa -aaâ -aa -Äa -Åa -Æae -AFÀ -ASÁ -ARẢ -AXà -AJẠ -AÄ -AÅ -AEÆ -AA -eÉ -eÈ -eẺ -eẼ -eẸ -eÊ -eË -esé -efè -erẻ -exẽ -ejẹ -eeê -ESÉ -EFÈ -ERẺ -EXẼ -EJẸ -EEÊ -eeÊ -EË -DDĐ -ddđ -ddĐ -íis -ìif -ỉir -ĩix -ịij -ÌIF -ÍIS -ỈIR -ĨIX -ỊIj -IIÎ -iÌ -iÍ -iỈ -iĨ -ij -iÎ -iÏ -nÑ -osó -ofò -orỏ -oxõ -ojọ -owơ -ooô -OSÓ -OFÒ -ORỎ -OXÕ -OJỌ -OWƠ -OEÒ -OOÔ -ooÔ -OÖ -ooÖ -oÓ -oÒ -oỎ -oÕ -oỌ -oƠ -oÒ -oÔ -usú -ufù -urủ -uxũ -ujụ -uwư -USÚ -UFÙ -URỦ -UXŨ -UJỤ -UWƯ -ÜU -ÛU -uÚ -uÙ -uỦ -uŨ -uỤ -uƯ -uÜ -uÛ -YFỲ -YSÝ -YRỶ -YXỸ -YJỴ -yỲ -yÝ -yỶ -yỸ -yỴ -yfỳ -ysý -yrỷ -yxỹ -ỵyj -安a -按a -爱a -阿a -暗a -啊a -埃a -碍a -凹a -奥a -岸a -矮a -案a -俺a -挨a -唉a -昂a -氨a -胺a -哎a -吖a -嗄a -腌a -锕a -安徽省ahs -爱ai -埃ai -碍ai -矮ai -挨ai -唉ai -哎ai -哀ai -皑ai -癌ai -蔼ai -艾ai -隘ai -呆*ai -捱ai -嗳ai -嗌ai -嫒ai -瑷ai -暧ai -砹ai -锿ai -霭ai -安an -按an -暗an -岸an -案an -俺an -氨an -胺an -鞍an -谙an -埯an -揞an -犴an -庵an -桉an -铵an -鹌an -黯an -昂ang -肮ang -盎ang -安徽anhui -凹ao -奥ao -敖ao -熬ao -翱ao -袄ao -傲ao -懊ao -澳ao -嚣*ao -坳ao -拗ao -嗷ao -岙ao -廒ao -遨ao -媪ao -骜ao -獒ao -聱ao -螯ao -鏊ao -鳌ao -鏖ao -不b -部b -本b -表b -把b -变b -比b -并b -别b -百b -报b -保b -病b -北b -被b -步b -边b -八b -办b -布b -把ba -八ba -吧ba -巴ba -拔ba -霸ba -罢ba -爸ba -坝ba -芭ba -捌ba -扒ba -叭ba -笆ba -疤ba -跋ba -靶ba -耙ba -茇ba -菝ba -岜ba -灞ba -钯ba -粑ba -鲅ba -魃ba -百bai -白bai -败bai -摆bai -伯*bai -柏bai -佰bai -拜bai -稗bai -捭bai -掰bai -办ban -半ban -板ban -班ban -般ban -版ban -拌ban -搬ban -斑ban -扳ban -伴ban -颁ban -扮ban -瓣ban -绊ban -阪ban -坂ban -钣ban -瘢ban -癍ban -舨ban -帮bang -棒bang -邦bang -榜bang -梆bang -膀bang -绑bang -磅bang -蚌bang -镑bang -傍bang -谤bang -蒡bang -浜bang -报bao -保bao -包bao -剥bao -薄bao -胞bao -暴bao -宝bao -饱bao -抱bao -爆bao -炮*bao -堡bao -刨*bao -苞bao -褒bao -雹bao -豹bao -鲍bao -曝*bao -瀑*bao -葆bao -孢bao -煲bao -鸨bao -褓bao -趵bao -龅bao -北bei -被bei -倍bei -备bei -背bei -辈bei -贝bei -杯bei -卑bei -臂*bei -悲bei -碑bei -钡bei -狈bei -惫bei -焙bei -孛bei -陂bei -邶bei -埤bei -萆bei -蓓bei -呗bei -悖bei -碚bei -鹎bei -褙bei -鐾bei -鞴bei -本ben -奔ben -苯ben -笨ben -夯*ben -畚ben -坌ben -贲ben -锛ben -本报benbao -奔波benbo -本部benbu -本厂benchang -奔驰benchi -本地bendi -奔放benfang -泵beng -崩beng -蚌*beng -绷beng -甭beng -蹦beng -迸beng -嘣beng -甏beng -比bi -必bi -避bi -闭bi -辟bi -笔bi -壁bi -臂bi -毕bi -彼bi -逼bi -币bi -鼻bi -蔽bi -秘*bi -鄙bi -碧bi -蓖bi -毙bi -毖bi -庇bi -痹bi -敝bi -弊bi -陛bi -拂*bi -泌*bi -匕bi -俾bi -埤*bi -芘*bi -荜bi -荸bi -萆*bi -薜bi -吡bi -哔bi -狴bi -庳bi -愎bi -滗bi -濞bi -弼bi -妣bi -婢bi -嬖bi -璧bi -贲*bi -睥*bi -畀bi -铋bi -秕bi -裨bi -筚bi -箅bi -篦bi -舭bi -襞bi -跸bi -髀bi -变bian -边bian -便bian -编bian -遍bian -辩bian -扁bian -辨bian -鞭bian -贬bian -卞bian -辫bian -匾bian -弁bian -苄bian -忭bian -汴bian -缏bian -飚bian -煸bian -砭bian -碥bian -窆bian -褊bian -蝙bian -笾bian -鳊bian -表biao -标biao -彪biao -膘biao -勺*biao -婊biao -骠biao -杓biao -飑biao -飙biao -镖biao -镳biao -瘭biao -裱biao -鳔biao -髟biao -别bie -鳖bie -憋bie -瘪bie -蹩bie -宾bin -彬bin -斌bin -濒bin -滨bin -摈bin -傧bin -豳bin -缤bin -玢bin -槟bin -殡bin -膑bin -镔bin -髌bin -鬓bin -并bing -病bing -兵bing -柄bing -冰bing -丙bing -饼bing -秉bing -炳bing -屏*bing -禀bing -邴bing -摒bing -槟*bing -波bo -播bo -剥*bo -伯bo -拨bo -薄*bo -博bo -勃bo -驳bo -玻bo -泊bo -柏*bo -卜*bo -菠bo -钵bo -搏bo -铂bo -箔bo -帛bo -舶bo -脖bo -膊bo -渤bo -魄*bo -孛*bo -亳bo -啵bo -饽bo -檗bo -掰*bo -擘bo -礴bo -钹bo -鹁bo -簸bo -趵*bo -跛bo -踣bo -不bu -部bu -步bu -布bu -补bu -捕bu -埔*bu -卜bu -堡*bu -哺bu -埠bu -簿bu -怖bu -卟bu -逋bu -瓿bu -晡bu -钚bu -钸bu -醭bu -不安buan -不比bubi -不必bubi -不变bubian -不便bubian -步兵bubing -步步bubu -不曾buceng -补偿buchang -不啻buchi -补充buchong -不错bucuo -不大buda -不待budai -不但budan -不当budang -不得bude -不等budeng -步调budiao -不动budong -不断buduan -不对budui -部队budui -不法bufa -补发bufa -步伐bufa -不凡bufan -不妨bufang -不分bufen -部分bufen -不服bufu -不符bufu -不该bugai -不敢bugan -不甘bugan -布告bugao -不够bugou -不顾bugu -不管buguan -不过buguo -不会buhui -补给buji -部件bujian -不借bujie -不尽bujin -不仅bujin -不禁bujin -布景bujing -不久bujiu -补救bujiu -布局buju -不堪bukan -不可buke -不快bukuai -不愧bukui -不理buli -不利buli -不良buliang -不料buliao -步履bulu -不论bulun -部落buluo -不满buman -部门bumen -不免bumian -不能buneng -不怕bupa -补品bupin -不平buping -步枪buqiang -不屈buqu -不然buran -不如buru -不少bushao -不是bushi -不识bushi -部首bushou -部属bushu -部署bushu -补贴butie -不同butong -不妥butuo -部位buwei -部委buwei -不问buwen -不惜buxi -补习buxi -部下buxia -不行buxing -不幸buxing -步行buxing -不朽buxiu -不许buxu -哺养buyang -不要buyao -不宜buyi -不用buyong -哺育buyu -不在buzai -部长buzhang -不振buzhen -不只buzhi -不止buzhi -不知buzhi -不致buzhi -布置buzhi -步骤buzhou -补助buzhu -捕捉buzhuo -步子buzi -不足buzu -博物馆bwg -产c -成c -出c -长c -从c -此c -常c -处c -车c -场c -传c -采c -层c -厂c -才c -次c -虫c -除c -查c -差c -擦ca -拆*ca -嚓ca -礤ca -采cai -才cai -材cai -菜cai -财cai -裁cai -彩cai -猜cai -睬cai -踩cai -蔡cai -参can -残can -蚕can -灿can -餐can -惭can -惨can -孱can -骖can -璨can -粲can -黪can -惨案canan -惨白canbai -残暴canbao -惨怛canda -残废canfei -藏cang -仓cang -苍cang -舱cang -沧cang -苍白cangbai -仓促cangcu -仓库cangku -苍老canglao -苍茫cangmang -藏匿cangni -苍穹cangqiong -沧桑cangsang -苍天cangtian -参观canguan -残骸canhai -残疾canji -参加canjia -参见canjian -残局canju -惨剧canju -参军canjun -参看cankan -参考cankao -残酷canku -惭愧cankui -灿烂canlan -参谋canmou -残缺canque -残忍canren -孱弱canruo -残杀cansha -残生cansheng -蚕食canshi -参数canshu -惨痛cantong -参与canyu -残余canyu -残月canyue -参阅canyue -参赞canzan -惨遭canzao -参战canzhan -参照canzhao -参政canzheng -惨重canzhong -草cao -槽cao -操cao -糙cao -曹cao -嘈cao -漕cao -螬cao -艚cao -草案caoan -草稿caogao -槽糕caogao -操劳caolao -操练caolian -草率caolu -草木caomu -草拟caoni -草签caoqian -操心caoxin -草原caoyuan -嘈杂caoza -操纵caozong -操作caozuo -差不多cbd -成本核算cbhs -出版社cbs -层出不穷ccbq -从长计议ccjy -存储器ccq -长春市ccs -成都市cds -测ce -策ce -侧ce -册ce -厕ce -恻ce -测定ceding -策动cedong -策反cefan -策划cehua -测量celiang -策略celue -侧面cemian -参*cen -岑cen -涔cen -涔涔cencen -层ceng -曾*ceng -蹭ceng -层层cengceng -层次cengci -曾经cengjing -测试ceshi -厕所cesuo -测验ceyan -侧重cezhong -出发点cfd -充分发挥cffh -唱高调cgd -从古到今cgdj -查cha -差cha -插cha -察cha -茶cha -叉cha -茬cha -碴cha -搽cha -岔cha -诧cha -刹*cha -喳*cha -嚓*cha -猹cha -馇cha -汊cha -姹cha -杈cha -楂cha -槎cha -檫cha -锸cha -镲cha -衩cha -查办chaban -差别chabie -差错chacuo -差点chadian -查对chadui -差额chae -查访chafang -察访chafang -查封chafeng -查获chahuo -差*chai -柴chai -拆chai -豺chai -侪chai -钗chai -瘥chai -虿chai -拆穿chaichuan -豺狼chailang -拆散chaisan -差使chaishi -拆卸chaixie -柴油chaiyou -差价chajia -差距chaju -察觉chajue -查看chakan -察看chakan -查考chakao -查明chaming -产chan -单*chan -铲chan -阐chan -搀chan -掺chan -蝉chan -馋chan -谗chan -缠chan -颤chan -冁chan -谄chan -蒇chan -廛chan -忏chan -潺chan -澶chan -孱*chan -羼chan -婵chan -骣chan -觇chan -禅chan -镡chan -蟾chan -躔chan -铲除chanchu -产地chandi -阐发chanfa -搀扶chanfu -长chang -常chang -场chang -厂chang -唱chang -肠chang -昌chang -倡chang -偿chang -畅chang -猖chang -尝chang -敞chang -裳*chang -倘*chang -伥chang -鬯chang -苌chang -菖chang -徜chang -怅chang -惝chang -阊chang -娼chang -嫦chang -昶chang -氅chang -鲳chang -长安changan -常常changchang -长城changcheng -长春changchun -畅达changda -倡导changdao -长度changdu -长短changduan -唱歌changge -常规changgui -长河changhe -场合changhe -偿还changhuan -厂家changjia -常见changjian -长江changjiang -长久changjiu -猖獗changjue -长空changkong -畅快changkuai -猖狂changkuang -场面changmian -长眠changmian -长年changnian -长篇changpian -长期changqi -长驱changqu -常任changren -长沙changsha -厂商changshang -常识changshi -尝试changshi -长寿changshou -常数changshu -场所changsuo -畅谈changtan -长途changtu -怅惘changwang -常委changwei -倘未changwei -常温changwen -常务changwu -畅想changxiang -畅销changxiao -倡议changyi -畅饮changyin -常用changyong -常有changyou -畅游changyou -长远changyuan -厂长changzhang -长征changzheng -厂址changzhi -常驻changzhu -婵娟chanjuan -蝉联chanlian -产量chanliang -缠绵chanmian -阐明chanming -产品chanpin -产权chanquan -缠绕chanrao -产生chansheng -禅师chanshi -阐述chanshu -产物chanwu -产销chanxiao -产业chanye -产值chanzhi -朝chao -超chao -潮chao -巢chao -抄chao -钞chao -嘲chao -吵chao -炒chao -绰*chao -剿*chao -怊chao -晁chao -焯*chao -耖chao -抄报chaobao -超产chaochan -超出chaochu -朝代chaodai -超额chaoe -嘲讽chaofeng -超过chaoguo -朝晖chaohui -超级chaoji -吵架chaojia -潮解chaojie -潮流chaoliu -抄录chaolu -吵闹chaonao -嘲弄chaonong -潮湿chaoshi -潮水chaoshui -抄送chaosong -超脱chaotuo -抄袭chaoxi -朝鲜chaoxian -嘲笑chaoxiao -巢穴chaoxue -朝阳chaoyang -朝野chaoye -超越chaoyue -超支chaozhi -查清chaqing -插曲chaqu -插入charu -查哨chashao -插手chashou -查收chashou -插图chatu -查问chawen -查询chaxun -茶叶chaye -差异chayi -查阅chayue -查证chazheng -岔子chazi -插足chazu -车che -彻che -尺*che -撤che -扯che -掣che -澈che -坼che -砗che -彻底chedi -车祸chehuo -车间chejian -车辆cheliang -陈chen -沉chen -称chen -衬chen -尘chen -臣chen -晨chen -沈*chen -郴chen -辰chen -忱chen -趁chen -伧chen -谌chen -谶chen -抻chen -嗔chen -宸chen -琛chen -榇chen -碜chen -龀chen -尘埃chenai -沉淀chendian -陈腐chenfu -沉浮chenfu -成cheng -程cheng -称cheng -城cheng -承cheng -乘cheng -呈cheng -盛*cheng -撑cheng -诚cheng -橙cheng -惩cheng -澄cheng -逞cheng -骋cheng -秤cheng -丞cheng -埕cheng -噌cheng -枨cheng -柽cheng -塍cheng -瞠cheng -铖cheng -铛cheng -裎cheng -蛏cheng -酲cheng -成败chengbai -承办chengban -惩办chengban -呈报chengbao -承包chengbao -成本chengben -成材chengcai -惩处chengchu -乘除chengchu -承担chengdan -承当chengdang -成都chengdu -程度chengdu -乘法chengfa -惩罚chengfa -成功chenggong -成规chenggui -成果chengguo -称号chenghao -称呼chenghu -成绩chengji -乘机chengji -成家chengjia -成见chengjian -成交chengjiao -承接chengjie -惩戒chengjie -成就chengjiu -乘客chengke -诚恳chengken -成立chengli -乘凉chengliang -成名chengming -成年chengnian -成批chengpi -成品chengpin -诚朴chengpu -逞强chengqiang -澄清chengqing -城区chengqu -成全chengquan -诚然chengran -成人chengren -承认chengren -成色chengse -成事chengshi -诚实chengshi -城市chengshi -承受chengshou -成熟chengshu -成为chengwei -称谓chengwei -成文chengwen -呈现chengxian -呈献chengxian -城乡chengxiang -成效chengxiao -称心chengxin -诚心chengxin -程序chengxu -乘虚chengxu -撑腰chengyao -诚意chengyi -成语chengyu -成员chengyuan -称赞chengzan -成长chengzhang -城镇chengzhen -称职chengzhi -诚挚chengzhi -趁机chenji -沉积chenji -陈迹chenji -沉浸chenjin -沉静chenjing -陈旧chenjiu -陈列chenlie -沉沦chenlun -沉闷chenmen -沉湎chenmian -沉默chenmo -沉溺chenni -陈设chenshe -陈述chenshu -陈说chenshuo -沉思chensi -沉痛chentong -衬托chentuo -沉吟chenyin -衬映chenying -趁早chenzao -沉重chenzhong -沉着chenzhuo -车皮chepi -扯皮chepi -撤退chetui -撤消chexiao -车站chezhan -撤职chezhi -持chi -尺chi -齿chi -吃chi -赤chi -池chi -迟chi -翅chi -斥chi -耻chi -痴chi -匙chi -弛chi -驰chi -侈chi -炽chi -傺chi -坻chi -墀chi -茌chi -叱chi -哧chi -啻chi -嗤chi -彳chi -饬chi -媸chi -敕chi -眵chi -鸱chi -瘛chi -褫chi -蚩chi -螭chi -笞chi -篪chi -豉chi -踟chi -魑chi -翅膀chibang -赤诚chicheng -驰骋chicheng -尺寸chicun -迟到chidao -赤道chidao -尺度chidu -迟钝chidun -吃喝chihe -迟缓chihuan -吃紧chijin -吃惊chijing -持久chijiu -吃苦chiku -吃亏chikui -吃力chili -炽烈chilie -齿轮chilun -持平chiping -痴情chiqing -炽热chire -耻辱chiru -池塘chitang -耻笑chixiao -赤心chixin -痴心chixin -迟疑chiyi -迟早chizao -斥责chize -叱咤chizha -持重chizhong -吃重chizhong -赤字chizi -催化剂chj -种*chong -虫chong -重*chong -充chong -冲chong -崇chong -涌*chong -宠chong -茺chong -忡chong -憧chong -铳chong -舂chong -艟chong -宠爱chongai -崇拜chongbai -充斥chongchi -冲刺chongci -冲淡chongdan -充当chongdang -重叠chongdie -冲动chongdong -宠儿chonger -充分chongfen -冲锋chongfeng -重复chongfu -崇高chonggao -重合chonghe -重婚chonghun -冲击chongji -重建chongjian -崇敬chongjing -憧憬chongjing -充满chongman -充沛chongpei -冲破chongpo -重庆chongqing -崇尚chongshang -重申chongshen -充实chongshi -冲刷chongshua -冲天chongtian -冲突chongtu -重温chongwen -冲洗chongxi -重新chongxin -重演chongyan -重印chongyin -充裕chongyu -充足chongzu -抽chou -仇chou -臭chou -酬chou -畴chou -踌chou -稠chou -愁chou -筹chou -绸chou -瞅chou -丑chou -俦chou -帱chou -惆chou -瘳chou -雠chou -筹办chouban -筹备choubei -惆怅chouchang -抽搐chouchu -踌躇chouchu -筹措choucuo -抽调choudiao -丑恶choue -仇恨chouhen -丑化chouhua -筹划chouhua -筹集chouji -筹建choujian -酬金choujin -抽空choukong -酬劳choulao -丑陋choulou -筹码chouma -稠密choumi -筹谋choumou -愁容chourong -抽象chouxiang -酬谢chouxie -抽噎chouye -出chu -处chu -除chu -初chu -础chu -触chu -楚chu -锄chu -储chu -畜*chu -橱chu -厨chu -躇chu -雏chu -滁chu -矗chu -搐chu -亍chu -刍chu -怵chu -憷chu -绌chu -杵chu -楮chu -樗chu -褚chu -蜍chu -蹰chu -黜chu -揣chuai -搋chuai -啜chuai -嘬*chuai -膪chuai -踹chuai -揣度chuaidu -揣摩chuaimo -传chuan -船chuan -穿chuan -串chuan -川chuan -椽chuan -喘chuan -舛chuan -遄chuan -巛chuan -氚chuan -钏chuan -舡chuan -传遍chuanbian -传标chuanbiao -传播chuanbo -船舶chuanbo -船埠chuanbu -穿插chuancha -传达chuanda -传单chuandan -传导chuandao -传递chuandi -床chuang -创chuang -窗chuang -闯chuang -疮chuang -幢chuang -怆chuang -创办chuangban -闯荡chuangdang -窗户chuanghu -创见chuangjian -创建chuangjian -闯劲chuangjin -创举chuangju -窗口chuangkou -创立chuangli -窗帘chuanglian -创始chuangshi -创新chuangxin -创业chuangye -创造chuangzao -创作chuangzuo -串联chuanlian -喘气chuanqi -传奇chuanqi -传染chuanran -传授chuanshou -传输chuanshu -传述chuanshu -传说chuanshuo -传送chuansong -传统chuantong -串通chuantong -喘息chuanxi -传讯chuanxun -传扬chuanyang -传阅chuanyue -传真chuanzhen -船只chuanzhi -穿着chuanzhuo -出版chuban -出榜chubang -储备chubei -出兵chubing -初步chubu -储藏chucang -出差chucha -出产chuchan -出场chuchang -出厂chuchang -处处chuchu -橱窗chuchuang -初次chuci -储存chucun -初等chudeng -出动chudong -触动chudong -出发chufa -触发chufa -除法chufa -处罚chufa -触犯chufan -出访chufang -除非chufei -处分chufen -出轨chugui -出海chuhai -吹chui -垂chui -锤chui -椎*chui -炊chui -捶chui -陲chui -棰chui -槌chui -吹棒chuibang -吹风chuifeng -吹拂chuifu -锤炼chuilian -吹牛chuiniu -垂青chuiqing -垂涎chuixian -吹嘘chuixu -垂直chuizhi -初级chuji -出击chuji -出界chujie -出境chujing -处境chujing -处决chujue -触觉chujue -除开chukai -出口chukou -出来chulai -除了chule -出力chuli -处理chuli -矗立chuli -初恋chulian -出笼chulong -出路chulu -出马chuma -出卖chumai -出面chumian -出名chuming -除名chuming -出没chumo -春chun -纯chun -醇chun -椿chun -唇chun -淳chun -蠢chun -莼chun -鹑chun -蝽chun -出纳chuna -春播chunbo -纯粹chuncui -纯度chundu -春分chunfen -春风chunfeng -春耕chungeng -春光chunguang -醇厚chunhou -春辉chunhui -春季chunji -春节chunjie -纯洁chunjie -纯净chunjing -纯利chunli -纯朴chunpu -春秋chunqiu -春色chunse -春笋chunsun -春天chuntian -处女chunu -触怒chunu -春意chunyi -纯真chunzhen -纯正chunzheng -戳chuo -绰chuo -啜*chuo -辍chuo -踔chuo -龊chuo -戳穿chuochuan -绰号chuohao -啜泣chuoqi -出品chupin -出奇chuqi -初期chuqi -出勤chuqin -出去chuqu -出让churang -出任churen -出入churu -出色chuse -出身chushen -出神chushen -出生chusheng -畜生chusheng -出事chushi -出世chushi -处世chushi -厨师chushi -出售chushou -处所chusuo -出庭chuting -锄头chutou -出土chutu -出外chuwai -除外chuwai -出席chuxi -出息chuxi -除夕chuxi -出现chuxian -初小chuxiao -雏形chuxing -储蓄chuxu -刍议chuyi -处于chuyu -初战chuzhan -处长chuzhang -出诊chuzhen -出征chuzheng -处置chuzhi -初中chuzhong -出租chuzu -此ci -次ci -刺ci -磁ci -雌ci -词ci -茨ci -疵ci -辞ci -慈ci -瓷ci -赐ci -伺*ci -兹*ci -茈ci -呲ci -祠ci -鹚ci -糍ci -慈爱ciai -辞别cibie -磁场cichang -磁带cidai -磁道cidao -此地cidi -词典cidian -辞典cidian -刺耳cier -词根cigen -刺骨cigu -此后cihou -词汇cihui -刺激ciji -赐教cijiao -此刻cike -刺客cike -词类cilei -辞令ciling -磁盘cipan -次品cipin -辞去ciqu -刺杀cisha -此时cishi -次数cishu -辞书cishu -词素cisu -祠堂citang -辞退citui -此外ciwai -慈祥cixiang -辞行cixing -词性cixing -雌雄cixiong -次序cixu -词序cixu -刺眼ciyan -次要ciyao -词语ciyu -赐予ciyu -此致cizhi -辞职cizhi -词缀cizhui -词组cizu -超级大国cjdg -参考书cks -参考消息ckxx -参考资料ckzl -触类旁通clpt -藏龙卧虎clwh -参谋长cmc -聪明才智cmcz -出谋划策cmhc -从难从严cncy -从cong -丛cong -聪cong -葱cong -囱cong -匆cong -苁cong -淙cong -骢cong -琮cong -璁cong -从此congci -匆匆congcong -匆促congcu -从而conger -从犯congfan -聪慧conghui -从来conglai -丛林conglin -匆忙congmang -聪明congming -从前congqian -从容congrong -从事congshi -丛书congshu -从速congsu -从新congxin -从严congyan -聪颖congying -葱郁congyu -从中congzhong -凑cou -楱cou -辏cou -腠cou -凑合couhe -凑巧couqiao -成品率cpl -成千上万cqsw -从容不迫crbp -承认错误crcw -趁热打铁crdt -措手不及csbj -出生率csl -长沙市css -炊事员csy -彻头彻尾ctcw -垂头丧气ctsq -粗cu -促cu -醋cu -簇cu -卒*cu -蔟cu -徂cu -猝cu -殂cu -酢cu -蹙cu -蹴cu -篡cuan -蹿cuan -窜cuan -攒*cuan -汆cuan -撺cuan -爨cuan -镩cuan -篡夺cuanduo -窜犯cuanfan -篡改cuangai -篡权cuanquan -粗暴cubao -粗糙cucao -粗犷cuguang -催cui -脆cui -淬cui -粹cui -摧cui -衰*cui -崔cui -瘁cui -翠cui -萃cui -啐cui -悴cui -璀cui -榱cui -毳cui -隹cui -摧残cuican -脆弱cuiruo -促进cujin -存cun -村cun -寸cun -蹲*cun -忖cun -皴cun -存储cunchu -存档cundang -存放cunfang -存款cunkuan -村落cunluo -存亡cunwang -存在cunzai -村镇cunzhen -村庄cunzhuang -村子cunzi -错cuo -措cuo -撮cuo -磋cuo -搓cuo -挫cuo -厝cuo -嵯cuo -脞cuo -锉cuo -矬cuo -痤cuo -瘥*cuo -鹾cuo -蹉cuo -错案cuoan -挫败cuobai -错处cuochu -措辞cuoci -错怪cuoguai -错过cuoguo -撮合cuohe -错觉cuojue -磋商cuoshang -挫伤cuoshang -措施cuoshi -错误cuowu -挫折cuozhe -错综cuozong -粗浅cuqian -促使cushi -粗俗cusu -粗心cuxin -粗壮cuzhuang -常委会cwh -崇文区cwq -常务委员会cwwh -乘务员cwy -诚心诚意cxcy -程序控制cxkz -程序设计cxsj -长远利益cyly -朝阳区cyq -财政部czb -错综复杂czfz -操之过急czgj -出租汽车czqc -此之外czw -财政危机czwj -创造性czx -操作系统czxt -操作员czy -持之以恒czyh -的d -大d -地d -动d -到d -对d -度d -多d -电d -党d -得d -定d -等d -斗d -当d -队d -都d -点d -代d -道d -大da -打da -达da -答da -搭da -塔*da -瘩da -耷da -哒da -嗒da -怛da -妲da -沓*da -疸da -褡da -笪da -靼da -鞑da -答案daan -打败dabai -大办daban -大半daban -打扮daban -答辩dabian -大伯dabo -大部dabu -达成dacheng -大胆dadan -搭档dadang -大道dadao -达到dadao -打倒dadao -大地dadi -大敌dadi -大抵dadi -打断daduan -大队dadui -大多daduo -大凡dafan -大夫dafu -大幅dafu -答复dafu -大概dagai -大纲dagang -大国daguo -大海dahai -大好dahao -大河dahe -大亨daheng -大会dahui -大*dai -代dai -带dai -待dai -袋dai -戴dai -呆dai -歹dai -傣dai -殆dai -贷dai -逮dai -怠dai -埭dai -甙dai -呔dai -岱dai -迨dai -骀dai -绐dai -玳dai -黛dai -呆板daiban -代表daibiao -逮捕daibu -逮逋daibu -代词daici -带动daidong -怠工daigong -代价daijia -贷款daikuan -带来dailai -代理daili -带领dailing -带路dailu -黛绿dailu -代码daima -怠慢daiman -待命daiming -代数daishu -代替daiti -带头daitou -歹徒daitu -待遇daiyu -呆滞daizhi -呆子daizi -打击daji -大家dajia -打搅dajiao -大街dajie -大捷dajie -打劫dajie -搭救dajiu -大局daju -答卷dajuan -打开dakai -耷拉dala -大力dali -大连dalian -大量daliang -打量daliang -大陆dalu -大略dalue -大妈dama -单dan -但dan -弹dan -担dan -石*dan -蛋dan -淡dan -胆dan -氮dan -丹dan -旦dan -耽dan -郸dan -掸dan -惮dan -诞dan -儋dan -萏dan -啖dan -澹*dan -殚dan -赕dan -眈dan -疸dan -瘅dan -聃dan -箪dan -大脑danao -担保danbao -单薄danbao -淡薄danbao -单产danchan -诞辰danchen -单纯danchun -单词danci -担当dandang -单调dandiao -单独dandu -单方danfang -担负danfu -党dang -当dang -档dang -挡dang -荡dang -谠dang -凼dang -菪dang -宕dang -砀dang -裆dang -单干dangan -胆敢dangan -档案dangan -当场dangchang -当初dangchu -当代dangdai -当地dangdi -单个dange -耽搁dange -党风dangfeng -党纲danggang -党纪dangji -党籍dangji -当即dangji -当家dangjia -当今dangjin -当局dangju -当量dangliang -当面dangmian -党内dangnei -当年dangnian -党派dangpai -当铺dangpu -当前dangqian -当然dangran -当日dangri -当时dangshi -当天dangtian -当头dangtou -党团dangtuan -当晚dangwan -党委dangwei -当先dangxian -党校dangxiao -当心dangxin -党性dangxing -荡漾dangyang -党员dangyuan -当月dangyue -党章dangzhang -当真dangzhen -党政dangzheng -当政dangzheng -当中dangzhong -当众dangzhong -当做dangzuo -单价danjia -担架danjia -胆量danliang -胆略danlue -淡漠danmo -胆怯danqie -丹青danqing -担任danren -单身danshen -诞生dansheng -但是danshi -胆识danshi -单体danti -丹田dantian -单位danwei -耽误danwu -单项danxiang -胆小danxiao -担心danxin -淡雅danya -弹药danyao -单一danyi -单元danyuan -但愿danyuan -单质danzhi -担子danzi -掸子danzi -单字danzi -到dao -道dao -导dao -刀dao -倒dao -稻dao -岛dao -捣dao -盗dao -蹈dao -祷dao -悼dao -叨dao -帱*dao -忉dao -氘dao -焘*dao -纛dao -倒闭daobi -到处daochu -悼词daoci -到达daoda -导弹daodan -道德daode -到底daodi -倒戈daoge -捣鬼daogui -捣毁daohui -到来daolai -到了daole -道理daoli -倒立daoli -道路daolu -捣乱daoluan -倒霉daomei -叨念daonian -道歉daoqian -刀枪daoqiang -盗窃daoqie -到时daoshi -导师daoshi -倒数daoshu -导体daoti -倒退daotui -导演daoyan -道义daoyi -盗用daoyong -岛屿daoyu -导致daozhi -大批dapi -大破dapo -打破dapo -大气daqi -大庆daqing -打扰darao -打扫dasao -大厦dasha -搭讪dashan -大赦dashe -大使dashi -大事dashi -大师dashi -大势dashi -大肆dasi -打算dasuan -大体dati -大厅dating -打听dating -大同datong -大小daxiao -大写daxie -答谢daxie -大选daxuan -大学daxue -大业daye -达因dayin -打印dayin -答应daying -大于dayu -大院dayuan -大约dayue -打仗dazhang -大致dazhi -大众dazhong -打字dazi -代办处dbc -得不偿失dbcs -大部分dbf -电报挂号dbgh -大不了dbl -大步流星dblx -对不起dbq -代表团dbt -电冰箱dbx -东城区dcq -到此为止dcwz -独创性dcx -调查研究dcyj -打成一片dcyp -打电话ddh -电动机ddj -对得起ddq -大多数dds -的de -得de -地*de -德de -底*de -锝de -得逞decheng -的当dedang -得当dedang -得到dedao -得分defen -德国deguo -得奖dejiang -得救dejiu -得了dele -得力deli -等deng -灯deng -登deng -邓deng -澄*deng -蹬deng -瞪deng -凳deng -噔deng -嶝deng -戥deng -磴deng -镫deng -簦deng -登场dengchang -等待dengdai -等到dengdao -灯光dengguang -等候denghou -等级dengji -登记dengji -等价dengjia -灯具dengju -登门dengmen -灯谜dengmi -登攀dengpan -登山dengshan -灯塔dengta -登台dengtai -等同dengtong -等闲dengxian -等于dengyu -登载dengzai -得胜desheng -得失deshi -得体deti -德行dexing -得以deyi -得意deyi -德育deyu -得志dezhi -得知dezhi -得罪dezui -大幅度dfd -多方面dfm -单方面dfm -电风扇dfs -大规模dgm -多功能dgn -大公无私dgws -帝国主义dgzy -电话号码dhhm -电化教育dhjy -大会堂dht -的*di -地di -第di -低di -敌di -底di -提*di -帝di -抵di -滴di -弟di -递di -堤di -迪di -笛di -狄di -涤di -翟di -嫡di -蒂di -缔di -氐di -籴di -诋di -谛di -邸di -坻*di -荻di -嘀di -娣di -绨di -柢di -棣di -觌di -砥di -碲di -睇di -镝di -羝di -骶di -嗲dia -电dian -点dian -垫dian -典dian -店dian -颠dian -淀dian -掂dian -滇dian -碘dian -靛dian -佃dian -甸dian -惦dian -奠dian -殿dian -阽dian -坫dian -巅dian -玷dian -钿dian -癜dian -癫dian -簟dian -踮dian -电报dianbao -点播dianbo -电场dianchang -电车dianche -电池dianchi -电传dianchuan -颠倒diandao -电灯diandeng -点滴diandi -奠定dianding -电动diandong -典范dianfan -淀粉dianfen -垫付dianfu -颠覆dianfu -电感diangan -典故diangu -电荷dianhe -电弧dianhu -电话dianhua -电汇dianhui -电机dianji -电极dianji -奠基dianji -惦记dianji -典籍dianji -点将dianjiang -电解dianjie -殿军dianjun -癫狂diankuang -电缆dianlan -电力dianli -电离dianli -典礼dianli -电流dianliu -电路dianlu -电脑diannao -电能dianneng -店铺dianpu -电气dianqi -电器dianqi -点燃dianran -电容dianrong -电扇dianshan -电视dianshi -电台diantai -电梯dianti -点头diantou -电网dianwang -电位dianwei -玷污dianwu -殿下dianxia -电线dianxian -癫痫dianxian -电信dianxin -典型dianxing -电讯dianxun -电压dianya -电影dianying -店员dianyuan -点阵dianzhen -点缀dianzhui -电子dianzi -点子dianzi -电阻dianzu -调diao -掉diao -吊diao -鸟*diao -碉diao -叼diao -雕diao -凋diao -刁diao -钓diao -铞diao -铫diao -貂diao -鲷diao -碉堡diaobao -凋敝diaobi -调查diaocha -吊车diaoche -调动diaodong -调度diaodu -钓饵diaoer -调换diaohuan -掉换diaohuan -雕刻diaoke -调令diaoling -刁难diaonan -调遣diaoqian -调任diaoren -雕塑diaosu -吊唁diaoyan -调用diaoyong -钓鱼diaoyu -调子diaozi -第八diba -地板diban -地步dibu -低沉dichen -抵触dichu -抵达dida -地带didai -低档didang -抵挡didang -地道didao -弟弟didi -地点didian -地段diduan -敌对didui -迭die -跌die -爹die -碟die -蝶die -谍die -叠die -垤die -堞die -揲die -喋die -牒die -瓞die -耋die -踮*die -蹀die -鲽die -迭起dieqi -第二dier -地方difang -低估digu -敌国diguo -帝国diguo -敌后dihou -诋毁dihui -低级diji -递加dijia -递减dijian -地窖dijiao -递交dijiao -缔交dijiao -缔结dijie -第九dijiu -敌军dijun -抵抗dikang -地牢dilao -地理dili -低劣dilie -第六diliu -低落diluo -地貌dimao -地面dimian -抵命diming -定ding -顶ding -钉ding -丁ding -订ding -盯ding -叮ding -鼎ding -锭ding -仃ding -啶ding -玎ding -腚ding -碇ding -町ding -铤*ding -疔ding -耵ding -酊ding -定案dingan -定产dingchan -丁当dingdang -顶点dingdian -定夺dingduo -定额dinge -顶峰dingfeng -顶锋dingfeng -定购dinggou -订购dinggou -订户dinghu -定货dinghuo -订货dinghuo -定价dingjia -定局dingju -定居dingju -定理dingli -订立dingli -鼎立dingli -定量dingliang -定律dinglu -定期dingqi -定然dingran -盯梢dingshao -定时dingshi -顶替dingti -定性dingxing -定型dingxing -定义dingyi -定语dingyu -定员dingyuan -订阅dingyue -订正dingzheng -叮嘱dingzhu -顶撞dingzhuang -钉子dingzi -嫡派dipai -地盘dipan -第七diqi -嫡亲diqin -敌情diqing -地球diqiu -地区diqu -的确dique -敌人diren -第三disan -地势dishi -第十dishi -滴水dishui -第四disi -地铁ditie -地图ditu -丢diu -铥diu -丢掉diudiao -丢脸diulian -丢失diushi -地位diwei -敌伪diwei -第五diwu -嫡系dixi -底细dixi -地下dixia -低下dixia -底下dixia -地形dixing -弟兄dixiong -第一diyi -敌意diyi -地域diyu -抵御diyu -缔造dizao -递增dizeng -地震dizhen -敌阵dizhen -地质dizhi -地址dizhi -抵制dizhi -底子dizi -弟子dizi -党纪国法djgf -当机立断djld -多劳多得dldd -大力发展dlfz -大力加强dljq -大力开展dlkz -独立自主dlzz -多面手dms -对内搞活dngh -多年来dnl -东南亚dny -动dong -东dong -冬dong -懂dong -洞dong -冻dong -董dong -栋dong -侗dong -恫dong -垌dong -咚dong -岽dong -峒dong -氡dong -胨dong -胴dong -硐dong -鸫dong -东北dongbei -东边dongbian -东部dongbu -洞察dongcha -动词dongci -动荡dongdang -懂得dongde -东方dongfang -东风dongfeng -动工donggong -东海donghai -恫吓donghe -动机dongji -冬季dongji -东家dongjia -冻结dongjie -动静dongjing -东京dongjing -动力dongli -动量dongliang -栋梁dongliang -动乱dongluan -动脉dongmai -东南dongnan -东欧dongou -动人dongren -动身dongshen -董事dongshi -动手dongshou -动态dongtai -冬天dongtian -动听dongting -动物dongwu -东西dongxi -洞悉dongxi -动向dongxiang -动心dongxin -东亚dongya -东洋dongyang -动摇dongyao -动用dongyong -动员dongyuan -动辄dongzhe -动作dongzuo -斗dou -都*dou -豆dou -读*dou -兜dou -抖dou -陡dou -逗dou -痘dou -蔸dou -窦dou -蚪dou -篼dou -兜风doufeng -逗号douhao -逗留douliu -斗室doushi -兜售doushou -斗争douzheng -斗志douzhi -斗智douzhi -抖嘴douzui -打破常规dpcg -地平线dpx -电器化dqh -待人接物drjw -第三产业dscy -第十二届dsej -大使馆dsg -到时候dsh -电视机dsj -多少年dsn -大失所望dssw -电视台dst -低三下四dsxs -第十一届dsyj -大踏步dtb -到头来dtl -大体上dts -大同小异dtxy -度du -都du -毒du -独du -读du -渡du -杜du -堵du -镀du -顿du -督du -犊du -睹du -赌du -肚du -妒du -芏du -嘟du -渎du -椟du -牍du -蠹du -笃du -髑du -黩du -断duan -端duan -段duan -短duan -锻duan -缎duan -椴duan -煅duan -簖duan -短波duanbo -短处duanchu -短促duancu -断定duanding -短短duanduan -断交duanjiao -断绝duanjue -锻练duanlian -锻炼duanlian -短路duanlu -段落duanluo -短评duanping -短期duanqi -短缺duanque -断然duanran -煅烧duanshao -断送duansong -短途duantu -端午duanwu -端详duanxiang -短小duanxiao -断言duanyan -端阳duanyang -短语duanyu -短暂duanzan -端正duanzheng -端庄duanzhuang -读报dubao -读本duben -赌博dubo -独裁ducai -毒草ducao -独唱duchang -独创duchuang -督促ducu -毒打duda -独到dudao -度过duguo -毒害duhai -毒化duhua -都会duhui -对dui -队dui -堆dui -敦*dui -兑dui -怼dui -憝dui -碓dui -对比duibi -队部duibu -对策duice -对称duichen -对此duici -对待duidai -对等duideng -对调duidiao -对方duifang -对付duifu -对话duihua -兑换duihuan -对讲duijiang -对抗duikang -对口duikou -对垒duilei -对立duili -对联duilian -队列duilie -对流duiliu -对面duimian -对内duinei -对偶duiou -对手duishou -对数duishu -对外duiwai -队伍duiwu -兑现duixian -对象duixiang -对应duiying -对于duiyu -队员duiyuan -堆栈duizhan -队长duizhang -对照duizhao -对证duizheng -对质duizhi -对峙duizhi -对准duizhun -镀金dujin -杜绝dujue -渡口dukou -都来dulai -独立duli -度量duliang -盾dun -吨dun -顿dun -蹲dun -敦dun -墩dun -囤dun -钝dun -遁dun -沌dun -炖dun -砘dun -礅dun -盹dun -镦dun -趸dun -蹲点dundian -顿号dunhao -囤积dunji -遁迹dunji -钝角dunjiao -顿时dunshi -敦实dunshi -多duo -度*duo -夺duo -朵duo -掇duo -哆duo -垛duo -躲duo -跺duo -舵duo -剁duo -惰duo -堕duo -驮*duo -咄duo -哚duo -沲duo -缍duo -柁duo -铎duo -裰duo -踱duo -多半duoban -躲避duobi -多变duobian -多边duobian -躲藏duocang -多次duoci -夺得duode -多端duoduan -多方duofang -躲开duokai -多亏duokui -夺魁duokui -堕落duoluo -多么duome -夺目duomu -多年duonian -多情duoqing -夺取duoqu -多少duoshao -多事duoshi -掇拾duoshi -舵手duoshou -多数duoshu -多谢duoxie -多心duoxin -惰性duoxing -多样duoyang -多余duoyu -多种duozhong -肚皮dupi -毒品dupin -毒气duqi -读取duqu -度日duri -读入duru -堵塞duse -毒蛇dushe -都是dushi -毒手dushou -读数dushu -读书dushu -毒素dusu -独特dute -读物duwu -毒药duyao -独占duzhan -读者duzhe -毒汁duzhi -渎职duzhi -赌注duzhu -杜撰duzhuan -独自duzi -党委会dwh -对外开放dwkf -敌我矛盾dwmd -对外贸易dwmy -大无畏dww -动物园dwy -当务之急dwzj -邓小平dxp -大学生dxs -大显身手dxss -大西洋dxy -大跃进dyj -打印机dyj -大有可为dykw -待业青年dyqn -掉以轻心dyqx -电影院dyy -大洋洲dyz -大有作为dyzw -党支部dzb -多种多样dzdy -党政机关dzjg -多种经营dzjy -断章取义dzqy -大自然dzr -德智体dzt -电子学dzx -党中央dzy -而e -二e -尔e -儿e -恶e -额e -恩e -俄e -耳e -饵e -蛾e -饿e -峨e -鹅e -讹e -娥e -厄e -扼e -遏e -鄂e -噩e -谔e -垩e -苊e -莪e -萼e -呃e -愕e -屙e -婀e -轭e -腭e -锇e -锷e -鹗e -颚e -鳄e -恶霸eba -恶毒edu -恶感egan -恶棍egun -噩耗ehao -恶化ehua -诶ei -二极管ejg -二进制ejz -恶劣elie -鹅毛emao -噩梦emeng -恶魔emo -耳目一新emyx -恩en -蒽en -摁en -恩爱enai -恩赐enci -恩典endian -恩惠enhui -恩情enqing -而er -二er -尔er -儿er -耳er -饵er -洱er -贰er -佴er -迩er -珥er -铒er -鸸er -鲕er -耳朵erduo -儿歌erge -耳光erguang -而后erhou -尔后erhou -二届erjie -而今erjin -而况erkuang -而且erqie -而是ershi -儿童ertong -儿戏erxi -而已eryi -耳语eryu -二月eryue -儿子erzi -扼杀esha -额外ewai -扼腕ewan -额外负担ewfd -恶习exi -恶心exin -恶性exing -恶性循环exxh -扼要eyao -厄运eyun -讹诈ezha -遏止ezhi -分f -发f -方f -法f -反f -放f -复f -风f -防f -非f -服f -肥f -副f -粉f -府f -夫f -负f -封f -富f -翻f -发fa -法fa -阀fa -乏fa -伐fa -罚fa -筏fa -珐fa -垡fa -砝fa -发报fabao -法宝fabao -发表fabiao -发布fabu -发财facai -发愁fachou -发出fachu -发达fada -发电fadian -法典fadian -法定fading -发动fadong -发放fafang -发奋fafen -发愤fafen -法官faguan -法规fagui -法国faguo -发慌fahuang -发挥fahui -发火fahuo -发给faji -发迹faji -法纪faji -发家fajia -发奖fajiang -发酵fajiao -罚金fajin -发觉fajue -发掘fajue -罚款fakuan -发狂fakuang -法郎falang -法令faling -法律falu -发落faluo -发明faming -反fan -翻fan -范fan -犯fan -饭fan -繁fan -泛fan -番fan -凡fan -烦fan -返fan -藩fan -帆fan -樊fan -矾fan -钒fan -贩fan -蕃fan -蘩fan -幡fan -梵fan -燔fan -畈fan -蹯fan -翻版fanban -反比fanbi -反驳fanbo -帆布fanbu -反常fanchang -范畴fanchou -犯愁fanchou -帆船fanchuan -饭店fandian -反动fandong -翻动fandong -反对fandui -繁多fanduo -反而faner -反复fanfu -方fang -放fang -防fang -访fang -房fang -纺fang -仿fang -妨fang -芳fang -肪fang -坊fang -邡fang -彷*fang -枋fang -钫fang -舫fang -鲂fang -妨碍fangai -方案fangan -反感fangan -防备fangbei -方便fangbian -防潮fangchao -方程fangcheng -放大fangda -放荡fangdang -防盗fangdao -方法fangfa -防范fangfan -防风fangfeng -防腐fangfu -仿佛fangfu -妨害fanghai -防护fanghu -防火fanghuo -放假fangjia -房间fangjian -方面fangmian -放牧fangmu -返工fangong -反攻fangong -放屁fangpi -放弃fangqi -防区fangqu -放任fangren -放哨fangshao -放射fangshe -方式fangshi -防守fangshou -放肆fangsi -放松fangsong -仿宋fangsong -翻滚fangun -方位fangwei -防卫fangwei -访问fangwen -房屋fangwu -放下fangxia -防线fangxian -方向fangxiang -芳香fangxiang -仿效fangxiao -放心fangxin -放行fangxing -方言fangyan -防疫fangyi -防御fangyu -仿造fangzao -仿照fangzhao -方针fangzhen -仿真fangzhen -防治fangzhi -仿制fangzhi -放置fangzhi -防止fangzhi -纺织fangzhi -房子fangzi -放纵fangzong -房租fangzu -番号fanhao -繁华fanhua -反悔fanhui -返回fanhui -反击fanji -反抗fankang -反馈fankui -泛滥fanlan -范例fanli -凡例fanli -翻脸fanlian -贩卖fanmai -繁忙fanmang -烦闷fanmen -反面fanmian -反目fanmu -烦恼fannao -反叛fanpan -犯人fanren -繁荣fanrong -反射fanshe -翻身fanshen -繁盛fansheng -凡是fanshi -凡事fanshi -繁琐fansuo -烦琐fansuo -翻腾fanteng -繁体fanti -饭桶fantong -发怒fanu -饭碗fanwan -范围fanwei -反问fanwen -反响fanxiang -返销fanxiao -反省fanxing -翻修fanxiu -繁衍fanyan -翻译fanyi -翻印fanyin -反应fanying -反映fanying -繁育fanyu -翻越fanyue -翻阅fanyue -贩运fanyun -繁杂fanza -烦燥fanzao -反正fanzheng -反之fanzhi -繁殖fanzhi -繁重fanzhong -贩子fanzi -犯罪fanzui -发起faqi -法权faquan -发射fashe -发生fasheng -发誓fashi -发售fashou -法庭fating -发现faxian -发泄faxie -发行faxing -发言fayan -发扬fayang -法医fayi -发育fayu -发源fayuan -法院fayuan -法则faze -发展fazhan -法制fazhi -法治fazhi -发作fazuo -奋不顾身fbgs -分崩离析fblx -副产品fcp -发电机fdj -发动机fdj -反动派fdp -分道扬镳fdyb -非fei -肥fei -飞fei -费fei -废fei -肺fei -沸fei -菲fei -匪fei -啡fei -诽fei -吠fei -芾fei -狒fei -悱fei -淝fei -妃fei -绯fei -榧fei -腓fei -斐fei -扉fei -镄fei -痱fei -蜚fei -篚fei -翡fei -霏fei -鲱fei -匪帮feibang -诽谤feibang -飞奔feiben -非常feichang -飞驰feichi -废除feichu -非但feidan -非得feide -沸点feidian -非法feifa -非凡feifan -肺腑feifu -绯红feihong -废话feihua -飞机feiji -飞溅feijian -费解feijie -费劲feijin -飞快feikuai -费力feili -肥料feiliao -废料feiliao -肥胖feipang -废品feipin -废弃feiqi -费神feishen -废水feishui -飞速feisu -沸腾feiteng -匪徒feitu -肥沃feiwo -废物feiwu -飞舞feiwu -飞翔feixiang -费心feixin -飞行feixing -废墟feixu -飞扬feiyang -扉页feiye -非议feiyi -费用feiyong -飞跃feiyue -肥皂feizao -飞涨feizhang -废止feizhi -非洲feizhou -妃子feizi -分fen -粉fen -奋fen -份fen -粪fen -纷fen -芬fen -愤fen -酚fen -吩fen -氛fen -坟fen -焚fen -汾fen -忿fen -偾fen -瀵fen -玢*fen -棼fen -鲼fen -鼢fen -分贝fenbei -分辩fenbian -分辨fenbian -粪便fenbian -分别fenbie -分部fenbu -分布fenbu -分册fence -分寸fencun -分担fendan -分得fende -分店fendian -奋斗fendou -分队fendui -分发fenfa -奋发fenfa -纷纷fenfen -吩咐fenfu -风feng -封feng -蜂feng -丰feng -缝feng -峰feng -锋feng -疯feng -奉feng -枫feng -烽feng -逢feng -冯feng -讽feng -凤feng -俸feng -酆feng -葑feng -唪feng -沣feng -砜feng -风暴fengbao -丰碑fengbei -封闭fengbi -风波fengbo -丰产fengchan -奉承fengcheng -讽刺fengci -封存fengcun -风度fengdu -分割fenge -分隔fenge -风发fengfa -风帆fengfan -丰富fengfu -奉告fenggao -风格fengge -奉公fenggong -风光fengguang -风寒fenghan -奉还fenghuan -凤凰fenghuang -烽火fenghuo -封建fengjian -风景fengjing -疯狂fengkuang -风浪fenglang -风力fengli -风流fengliu -丰满fengman -锋芒fengmang -风貌fengmao -奉命fengming -丰年fengnian -分工fengong -奉陪fengpei -风气fengqi -风情fengqing -风趣fengqu -奉劝fengquan -缝纫fengren -风骚fengsao -风沙fengsha -风尚fengshang -风声fengsheng -丰盛fengsheng -丰收fengshou -风霜fengshuang -风水fengshui -丰硕fengshuo -奉祀fengsi -风俗fengsu -封锁fengsuo -疯瘫fengtan -封条fengtiao -风头fengtou -分管fenguan -风味fengwei -缝隙fengxi -风险fengxian -奉献fengxian -风向fengxiang -风行fengxing -奉行fengxing -蜂拥fengyong -风云fengyun -风韵fengyun -风灾fengzai -疯子fengzi -风姿fengzi -分号fenhao -分毫fenhao -分红fenhong -粉红fenhong -分化fenhua -分会fenhui -焚毁fenhui -分级fenji -分解fenjie -分界fenjie -奋进fenjin -分居fenju -分开fenkai -愤慨fenkai -分类fenlei -分离fenli -奋力fenli -分量fenliang -分裂fenlie -纷乱fenluan -分娩fenmian -分秒fenmiao -分明fenming -粉末fenmo -坟墓fenmu -愤怒fennu -分派fenpai -分配fenpei -分批fenpi -分期fenqi -分歧fenqi -奋起fenqi -分清fenqing -分区fenqu -分散fensan -焚烧fenshao -分数fenshu -分说fenshuo -粉碎fensui -分摊fentan -粪土fentu -分外fenwai -氛围fenwei -分析fenxi -奋勇fenyong -分赃fenzang -奋战fenzhan -分支fenzhi -分子fenzi -分组fenzu -丰富多采ffdc -奋发图强fftq -反过来说fgls -反革命fgm -福建省fjs -封建主义fjzy -翻来覆去flfq -法律顾问flgw -分秒必争fmbz -发明创造fmcz -否fou -缶fou -否定fouding -否决foujue -否认fouren -否则fouze -费品率fpl -废寝忘食fqws -缝纫机frj -分水岭fsl -翻天复地ftfd -丰台区ftq -非同小可ftxk -繁体字ftz -复fu -服fu -副fu -府fu -夫fu -负fu -富fu -附fu -福fu -伏fu -符fu -幅fu -腐fu -浮fu -辅fu -付fu -腹fu -妇fu -孵fu -覆fu -扶fu -辐fu -傅fu -佛fu -缚fu -父fu -弗fu -甫fu -肤fu -氟fu -敷fu -拂fu -俘fu -涪fu -袱fu -抚fu -俯fu -釜fu -斧fu -脯fu -腑fu -赴fu -赋fu -阜fu -讣fu -咐fu -匐fu -凫fu -郛fu -芙fu -芾*fu -苻fu -茯fu -莩fu -菔fu -拊fu -呋fu -幞fu -怫fu -滏fu -艴fu -孚fu -驸fu -绂fu -绋fu -桴fu -赙fu -祓fu -砩fu -黻fu -黼fu -罘fu -稃fu -馥fu -蚨fu -蜉fu -蝠fu -蝮fu -麸fu -趺fu -跗fu -鲋fu -鳆fu -腐败fubai -复辟fubi -复查fucha -浮沉fuchen -扶持fuchi -付出fuchu -副词fuci -服从fucong -附带fudai -负担fudan -辅导fudao -浮雕fudiao -浮动fudong -幅度fudu -复发fufa -伏法fufa -夫妇fufu -覆盖fugai -讣告fugao -富贵fugui -符号fuhao -附和fuhe -符合fuhe -负荷fuhe -腐化fuhua -浮华fuhua -复活fuhuo -俘获fuhuo -伏击fuji -附加fujia -附件fujian -福建fujian -佛教fujiao -附近fujin -副刊fukan -俯瞰fukan -浮夸fukua -付款fukuan -腐烂fulan -福利fuli -浮力fuli -富丽fuli -妇联fulian -附录fulu -俘虏fulu -覆灭fumie -覆没fumo -父母fumu -富农funong -妇女funu -扶贫fupin -服气fuqi -福气fuqi -夫妻fuqi -付讫fuqi -肤浅fuqian -富强fuqiang -父亲fuqin -富饶furao -夫人furen -芙蓉furong -妇孺furu -负伤fushang -辐射fushe -复试fushi -腐蚀fushi -俯视fushi -副手fushou -复数fushu -负数fushu -附属fushu -富庶fushu -赋税fushui -伏特fute -覆亡fuwang -富翁fuweng -服务fuwu -复习fuxi -浮现fuxian -赋闲fuxian -浮想fuxiang -腐朽fuxiu -抚恤fuxu -敷衍fuyan -扶养fuyang -抚养fuyang -俯仰fuyang -副业fuye -服役fuyi -复印fuyin -富有fuyou -赋有fuyou -赋于fuyu -抚育fuyu -富裕fuyu -赋予fuyu -复员fuyuan -复原fuyuan -负约fuyue -复杂fuza -负载fuzai -附则fuze -负责fuze -负债fuzhai -付帐fuzhang -复制fuzhi -扶植fuzhi -附中fuzhong -福州fuzhou -抚州fuzhou -附注fuzhu -辅助fuzhu -扶助fuzhu -服装fuzhuang -附着fuzhuo -富足fuzu -辅佐fuzuo -服务部fwb -服务态度fwtd -服务员fwy -方兴未艾fxwa -奋勇当先fydx -翻一番fyf -风言风语fyfy -发扬光大fygd -复印机fyj -发言人fyr -风雨同舟fytz -房租费fzf -副总理fzl -纺织品fzp -福州市fzs -反作用fzy -副作用fzy -负责制fzz -发展中国家fzzj -个g -国g -工g -过g -高g -干g -关g -各g -革g -公g -根g -更g -改g -管g -光g -广g -果g -格g -共g -搞g -夹*ga -噶ga -嘎ga -胳*ga -尬ga -尕ga -尜ga -旮ga -钆ga -公安部gab -改gai -该gai -盖gai -概gai -钙gai -溉gai -芥*gai -丐gai -陔gai -垓gai -戤gai -赅gai -改变gaibian -改编gaibian -该当gaidang -改道gaidao -改动gaidong -改革gaige -改观gaiguan -改过gaiguo -改悔gaihui -改建gaijian -改进gaijin -概况gaikuang -概括gaikuo -改良gailiang -概率gailu -概论gailun -概貌gaimao -概念gainian -改期gaiqi -改善gaishan -概述gaishu -概叹gaitan -改天gaitian -改选gaixuan -概要gaiyao -改造gaizao -改正gaizheng -改装gaizhuang -改组gaizu -公安局gaj -干gan -杆gan -感gan -敢gan -赶gan -甘gan -肝gan -秆gan -柑gan -竿gan -赣gan -乾*gan -坩gan -苷gan -尴gan -擀gan -泔gan -淦gan -澉gan -绀gan -橄gan -旰gan -矸gan -疳gan -酐gan -干部ganbu -感触ganchu -干脆gancui -敢当gandang -甘当gandang -感到gandao -感动gandong -感恩ganen -刚gang -钢gang -缸gang -纲gang -岗gang -港gang -杠gang -冈gang -肛gang -扛*gang -戆gang -罡gang -筻gang -尴尬ganga -港澳gangao -刚才gangcai -钢材gangcai -刚刚ganggang -刚好ganghao -港口gangkou -纲领gangling -岗哨gangshao -钢铁gangtie -港湾gangwan -岗位gangwei -港务gangwu -刚要gangyao -纲要gangyao -刚毅gangyi -干旱ganhan -感化ganhua -干活ganhuo -肝火ganhuo -感激ganji -干劲ganjin -赶紧ganjin -干净ganjing -感觉ganjue -感慨gankai -甘苦ganku -赶快gankuai -赶忙ganmang -感冒ganmao -感情ganqing -感染ganran -干扰ganrao -干涉ganshe -干事ganshi -感受ganshou -甘肃gansu -感叹gantan -干线ganxian -感想ganxiang -敢想ganxiang -感谢ganxie -甘心ganxin -感性ganxing -感应ganying -敢于ganyu -干预ganyu -甘愿ganyuan -干燥ganzao -感召ganzhao -赣州ganzhou -敢做ganzuo -高gao -搞gao -告gao -稿gao -膏gao -篙gao -皋gao -羔gao -糕gao -镐gao -睾gao -诰gao -郜gao -藁gao -缟gao -槔gao -槁gao -杲gao -锆gao -高矮gaoai -高昂gaoang -告别gaobie -高产gaochan -高超gaochao -高潮gaochao -告成gaocheng -告辞gaoci -高大gaoda -高档gaodang -高等gaodeng -高地gaodi -高低gaodi -糕点gaodian -高度gaodu -告发gaofa -高峰gaofeng -高高gaogao -高歌gaoge -高贵gaogui -高喊gaohan -搞好gaohao -高呼gaohu -搞坏gaohuai -高级gaoji -告急gaoji -高价gaojia -高见gaojian -稿件gaojian -告捷gaojie -告诫gaojie -高龄gaoling -高楼gaolou -告密gaomi -高明gaoming -高能gaoneng -高攀gaopan -高频gaopin -高强gaoqiang -高山gaoshan -高尚gaoshang -高深gaoshen -告示gaoshi -高耸gaosong -高速gaosu -告诉gaosu -高温gaowen -高小gaoxiao -高校gaoxiao -高兴gaoxing -膏药gaoyao -高原gaoyuan -高涨gaozhang -高招gaozhao -高中gaozhong -告终gaozhong -告状gaozhuang -稿子gaozi -港澳同胞gatb -怪不得gbd -各部门gbm -各部委gbw -供不应求gbyq -故步自封gbzf -共产党gcd -共产党员gcdy -工程师gcs -顾此失彼gcsb -贯彻执行gczx -共产主义gczy -各地方gdf -各大军区gdjq -广东省gds -高档商品gdsp -各单位gdw -高等院校gdyx -固定资产gdzc -个ge -各ge -革ge -合*ge -格ge -割ge -歌ge -隔ge -盖*ge -哥ge -铬ge -阁ge -戈ge -葛ge -搁ge -鸽ge -胳ge -疙ge -蛤ge -咯*ge -屹*ge -鬲ge -仡ge -哿ge -圪ge -塥ge -嗝ge -纥*ge -搿ge -膈ge -硌ge -镉ge -袼ge -颌*ge -虼ge -舸ge -骼ge -隔壁gebi -戈壁gebi -个别gebie -歌唱gechang -各处gechu -革除gechu -疙瘩geda -各地gedi -格调gediao -隔断geduan -个个gege -各个gege -各国geguo -隔阂gehe -歌喉gehou -各级geji -各界gejie -格局geju -割据geju -隔绝gejue -各类gelei -隔离geli -割裂gelie -格律gelu -革命geming -隔膜gemo -给gei -根gen -跟gen -亘gen -茛gen -哏gen -艮gen -根本genben -根除genchu -根底gendi -更geng -耕geng -颈geng -庚geng -羹geng -埂geng -耿geng -梗geng -哽geng -赓geng -绠geng -鲠geng -耕地gengdi -更迭gengdie -更动gengdong -更多gengduo -更改genggai -梗概genggai -更高genggao -更换genghuan -更加gengjia -更为gengwei -颈项gengxiang -更新gengxin -哽咽gengyan -耕耘gengyun -更正gengzheng -耿直gengzhi -梗直gengzhi -耕种gengzhong -梗阻gengzu -耕作gengzuo -根基genji -根据genju -跟前genqian -跟随gensui -根源genyuan -根治genzhi -跟着genzhuo -根子genzi -跟踪genzong -搁浅geqian -歌曲gequ -个人geren -格式geshi -歌颂gesong -个体geti -格外gewai -各位gewei -歌舞gewu -阁下gexia -各项gexiang -革新gexin -个性gexing -格言geyan -各样geyang -歌咏geyong -搁置gezhi -各种gezhong -各族gezu -国防部gfb -各方面gfm -格格不入ggbr -归根到底ggdd -恭恭敬敬ggjj -滚瓜烂熟ggls -歌功颂德ggsd -共和国ghg -各行各业ghgy -干劲冲天gjct -各级党委gjdw -各级领导gjld -国家利益gjly -国计民生gjms -工具书gjs -各尽所能gjsn -国库券gkq -工矿企业gkqy -孤陋寡闻glgw -规律性glx -国民党gmd -革命化gmh -革命家gmj -国民经济gmjj -购买力gml -光明磊落gmll -光明日报gmrb -顾名思义gmsy -冠冕堂皇gmth -刮目相看gmxk -光明正大gmzd -工农兵gnb -国内外gnw -工农业gny -工gong -公gong -共gong -供gong -功gong -攻gong -红*gong -巩gong -贡gong -汞gong -宫gong -恭gong -龚gong -躬gong -弓gong -拱gong -珙gong -肱gong -蚣gong -觥gong -公安gongan -公报gongbao -工本gongben -公布gongbu -公差gongcha -公拆gongchai -工厂gongchang -功臣gongchen -工程gongcheng -共处gongchu -供词gongci -共存gongcun -公道gongdao -公德gongde -功德gongde -工地gongdi -公敌gongdi -宫殿gongdian -攻读gongdu -公费gongfei -公愤gongfen -工夫gongfu -功夫gongfu -公告gonggao -公共gonggong -巩固gonggu -公关gongguan -公害gonghai -公函gonghan -共和gonghe -工会gonghui -供给gongji -共计gongji -攻击gongji -功绩gongji -公家gongjia -公斤gongjin -恭敬gongjing -工具gongju -公开gongkai -功课gongke -公款gongkuan -功劳gonglao -公理gongli -公里gongli -公历gongli -公路gonglu -功率gonglu -公民gongmin -共鸣gongming -公墓gongmu -功能gongneng -工农gongnong -公判gongpan -公平gongping -公仆gongpu -供求gongqiu -工区gongqu -公然gongran -工人gongren -公认gongren -供认gongren -工伤gongshang -公社gongshe -公审gongshen -工时gongshi -公事gongshi -共事gongshi -公式gongshi -公署gongshu -公司gongsi -公私gongsi -公诉gongsu -宫廷gongting -共同gongtong -恭维gongwei -公文gongwen -公物gongwu -公务gongwu -恭喜gongxi -贡献gongxian -工效gongxiao -功效gongxiao -供销gongxiao -共性gongxing -工序gongxu -共需gongxu -功勋gongxun -供养gongyang -工业gongye -工艺gongyi -供应gongying -公用gongyong -共有gongyou -公元gongyuan -公园gongyuan -公约gongyue -公允gongyun -公债gongzhai -公章gongzhang -共振gongzhen -工整gongzheng -公正gongzheng -公证gongzheng -供职gongzhi -公众gongzhong -工资gongzi -工作gongzuo -够gou -构gou -沟gou -句*gou -狗gou -钩gou -勾gou -购gou -苟gou -垢gou -佝gou -诟gou -岣gou -遘gou -媾gou -缑gou -枸gou -觏gou -彀gou -笱gou -篝gou -鞲gou -构成goucheng -勾搭gouda -勾当goudang -媾和gouhe -沟壑gouhe -构件goujian -勾结goujie -购买goumai -苟且gouqie -构思gousi -沟通goutong -勾通goutong -构陷gouxian -勾销gouxiao -购销gouxiao -勾引gouyin -构造gouzao -购置gouzhi -钩子gouzi -国庆节gqj -共青团gqt -光荣榜grb -根深蒂固gsdg -瓜熟蒂落gsdl -公使馆gsg -各式各样gsgy -甘肃省gss -工商业gsy -个体户gth -改头换面gthm -高谈阔论gtkl -鼓gu -固gu -古gu -骨gu -故gu -顾gu -股gu -谷gu -估gu -雇gu -孤gu -姑gu -贾*gu -辜gu -菇gu -咕gu -箍gu -沽gu -蛊gu -嘏gu -诂gu -菰gu -呱gu -崮gu -汩gu -梏gu -轱gu -牯gu -牿gu -臌gu -毂gu -瞽gu -罟gu -钴gu -锢gu -鸪gu -鹄*gu -痼gu -蛄gu -酤gu -觚gu -鲴gu -鹘gu -挂gua -刮gua -瓜gua -括*gua -剐gua -寡gua -褂gua -卦gua -诖gua -呱gua -栝gua -胍gua -鸹gua -瓜分guafen -瓜葛guage -挂号guahao -怪guai -乖guai -拐guai -乖舛guaichuan -乖戾guaili -乖僻guaipi -乖巧guaiqiao -怪物guaiwu -怪异guaiyi -拐杖guaizhang -挂名guaming -关guan -管guan -观guan -官guan -灌guan -贯guan -惯guan -冠guan -馆guan -罐guan -棺guan -纶*guan -倌guan -莞guan -掼guan -涫guan -盥guan -鹳guan -矜guan -鳏guan -关闭guanbi -观测guance -观察guancha -贯彻guanche -贯穿guanchuan -管道guandao -官邸guandi -观点guandian -官方guanfang -光guang -广guang -逛guang -咣guang -犷guang -桄guang -胱guang -灌溉guangai -光标guangbiao -广播guangbo -广博guangbo -光彩guangcai -广场guangchang -光大guangda -广大guangda -广东guangdong -广度guangdu -广泛guangfan -广告guanggao -光顾guanggu -光滑guanghua -光辉guanghui -光景guangjing -广阔guangkuo -光芒guangmang -广袤guangmao -光明guangming -光盘guangpan -光谱guangpu -光荣guangrong -观光guanguang -广西guangxi -光线guangxian -广义guangyi -光阴guangyin -光涌guangyong -广州guangzhou -关怀guanhuai -挂念guanian -管家guanjia -关键guanjian -管教guanjiao -关节guanjie -冠军guanjun -关卡guanka -观看guankan -关口guankou -管理guanli -贯例guanli -惯例guanli -官吏guanli -关联guanlian -官僚guanliao -观摩guanmo -灌木guanmu -官能guanneng -观念guannian -关切guanqie -观赏guanshang -管事guanshi -管束guanshu -灌输guanshu -关税guanshui -官司guansi -贯通guantong -关头guantou -观望guanwang -关系guanxi -管辖guanxia -官衔guanxian -关心guanxin -惯性guanxing -关押guanya -惯用guanyong -关于guanyu -官员guanyuan -观战guanzhan -关照guanzhao -管制guanzhi -观止guanzhi -观众guanzhong -关注guanzhu -贯注guanzhu -馆子guanzi -挂失guashi -挂帅guashuai -鼓吹guchui -故此guci -古代gudai -孤单gudan -故地gudi -古典gudian -固定guding -鼓动gudong -股东gudong -古董gudong -孤独gudu -咕嘟gudu -孤儿guer -股份gufen -辜负gufu -骨干gugan -雇工gugong -故宫gugong -古怪guguai -蛊惑guhuo -规gui -贵gui -归gui -硅gui -鬼gui -轨gui -龟gui -桂gui -瑰gui -圭gui -闺gui -诡gui -癸gui -柜gui -跪gui -刽gui -傀*gui -炔*gui -匦gui -刿gui -庋gui -宄gui -妫gui -桧gui -炅gui -晷gui -皈gui -簋gui -鲑gui -鳜gui -诡辩guibian -贵宾guibin -归并guibing -规程guicheng -归档guidang -轨道guidao -规定guiding -归队guidui -规范guifan -规格guige -归公guigong -归功guigong -桂冠guiguan -归国guiguo -规划guihua -鬼话guihua -归还guihuan -诡计guiji -轨迹guiji -贵贱guijian -归咎guijiu -规矩guiju -瑰丽guili -鬼脸guilian -龟裂guilie -规律guilu -诡秘guimi -规模guimo -归纳guina -闺女guinu -规劝guiquan -贵人guiren -归属guishu -龟缩guisuo -柜台guitai -闺秀guixiu -归于guiyu -规则guize -规章guizhang -贵重guizhong -贵州guizhou -鬼子guizi -贵族guizu -归罪guizui -顾及guji -估计guji -古迹guji -顾忌guji -估价gujia -古今gujin -古旧gujiu -故旧gujiu -故居guju -顾客guke -孤苦guku -古老gulao -孤立guli -鼓励guli -估量guliang -顾虑gulu -估摸gumo -滚gun -辊gun -棍gun -衮gun -绲gun -磙gun -鲧gun -滚动gundong -姑娘guniang -雇农gunong -滚烫guntang -棍子gunzi -国guo -过guo -果guo -锅guo -郭guo -涡*guo -裹guo -馘guo -埚guo -掴guo -呙guo -帼guo -崞guo -猓guo -椁guo -虢guo -聒guo -蜾guo -蝈guo -过半guoban -国策guoce -国产guochan -过程guocheng -过错guocuo -过度guodu -过渡guodu -果断guoduan -国法guofa -国防guofang -过分guofen -果腹guofu -果敢guogan -国歌guoge -过关guoguan -过后guohou -国会guohui -国际guoji -国籍guoji -国家guojia -国界guojie -国境guojing -国库guoku -过来guolai -过量guoliang -过虑guolu -锅炉guolu -国民guomin -过目guomu -果木guomu -国难guonan -国内guonei -果皮guopi -果品guopin -国旗guoqi -过期guoqi -国情guoqing -国庆guoqing -过去guoqu -果然guoran -过少guoshao -过甚guoshen -过剩guosheng -过时guoshi -国事guoshi -过失guoshi -果实guoshi -过头guotou -国外guowai -国王guowang -过问guowen -国务guowu -过细guoxi -国药guoyao -国营guoying -过硬guoying -过于guoyu -果园guoyuan -果真guozhen -锅子guozi -顾盼gupan -孤僻gupi -股票gupiao -骨气guqi -姑且guqie -顾全guquan -固然guran -古人guren -骨肉gurou -故事gushi -股市gushi -固守gushou -估算gusuan -固体guti -骨头gutou -故土gutu -顾问guwen -古文guwen -谷物guwu -鼓舞guwu -姑息guxi -故乡guxiang -故意guyi -雇佣guyong -固有guyou -雇员guyuan -鼓掌guzhang -故障guzhang -固执guzhi -拐弯抹角gwmj -国务委员gwwy -国务院gwy -改邪归正gxgz -更新换代gxhd -各行其事gxqs -感性认识gxrs -广西壮族gxzz -工业化gyh -工艺流程gylc -工艺美术gyms -工业品gyp -工艺品gyp -贵阳市gys -公有制gyz -各种各样gzgy -工资级别gzjb -各族人民gzrm -工作上gzs -广州市gzs -贵州省gzs -各自为政gzwz -高瞻远瞩gzyz -高瞻远嘱gzyz -工作者gzz -和h -会h -后h -化h -好h -合h -还h -活h -很h -回h -号h -毫h -花h -或h -海h -话h -红h -火h -黄h -害h -哈ha -蛤*ha -虾*ha -铪ha -哈达hada -还hai -海hai -害hai -孩hai -骸hai -氦hai -亥hai -骇hai -嘿*hai -咳*hai -嗨hai -胲hai -醢hai -海岸haian -海拔haiba -海报haibao -害虫haichong -害处haichu -海岛haidao -海港haigang -海关haiguan -还好haihao -海疆haijiang -海军haijun -海浪hailang -海绵haimian -害怕haipa -海上haishang -还是haishi -海外haiwai -海湾haiwan -海峡haixia -海啸haixiao -害羞haixiu -海洋haiyang -还要haiyao -还有haiyou -海域haiyu -海员haiyuan -孩子haizi -含han -焊han -旱han -喊han -汉han -寒han -汗han -函han -韩han -酣han -憨han -邯han -涵han -罕han -翰han -撼han -捍han -憾han -悍han -邗han -菡han -撖han -阚han -瀚han -晗han -焓han -顸han -颔han -蚶han -鼾han -寒潮hanchao -寒带handai -行*hang -航hang -夯hang -杭hang -吭*hang -巷*hang -沆hang -绗hang -珩hang -颃hang -航标hangbiao -航程hangcheng -航船hangchuan -行当hangdang -航道hangdao -航海hanghai -行家hangjia -行距hangju -航空hangkong -行列hanglie -航路hanglu -航模hangmo -函购hangou -行情hangqing -航天hangtian -航线hangxian -航向hangxiang -航行hangxing -航运hangyun -杭州hangzhou -含糊hanhu -含混hanhun -旱季hanji -函件hanjian -罕见hanjian -汉奸hanjian -喊叫hanjiao -焊接hanjie -寒冷hanleng -翰林hanlin -寒流hanliu -函授hanshou -函数hanshu -酣睡hanshui -寒酸hansuan -捍卫hanwei -含蓄hanxu -寒暄hanxuan -涵养hanyang -含义hanyi -涵义hanyi -汉语hanyu -含冤hanyuan -旱灾hanzai -汉字hanzi -汉族hanzu -好hao -号hao -毫hao -耗hao -豪hao -郝hao -浩hao -镐*hao -壕hao -嚎hao -貉*hao -蒿hao -薅hao -嗥hao -嚆hao -濠hao -灏hao -昊hao -皓hao -颢hao -蚝hao -好比haobi -毫不haobu -号称haocheng -好处haochu -浩大haoda -好歹haodai -浩荡haodang -好的haode -浩繁haofan -耗费haofei -好感haogan -好汉haohan -豪华haohua -好坏haohuai -号角haojiao -耗竭haojie -豪杰haojie -浩劫haojie -好看haokan -毫厘haoli -号令haoling -号码haoma -豪迈haomai -毫毛haomao -毫米haomi -浩淼haomiao -好奇haoqi -豪强haoqiang -豪情haoqing -好人haoren -豪绅haoshen -毫升haosheng -好事haoshi -豪爽haoshuang -好似haosi -耗损haosun -号啕haotao -好听haoting -好玩haowan -毫无haowu -好象haoxiang -好些haoxie -好样haoyang -好意haoyi -号召haozhao -好转haozhuan -汇编程序hbcx -货币回笼hbhl -货币流通hblt -河北省hbs -湖北省hbs -汇编语言hbyy -或多或少hdhs -海淀区hdq -和he -合he -河he -何he -核he -赫he -荷he -褐he -喝he -贺he -呵he -禾he -吓*he -盒he -菏he -貉he -阂he -涸he -鹤he -诃he -劾he -壑he -嗬he -阖he -纥he -曷he -盍he -颌he -蚵he -翮he -和蔼heai -哈尔滨heb -合办heban -荷包hebao -河北hebei -何必hebi -合并hebing -哈尔滨市hebs -何不hebu -喝彩hecai -合唱hechang -何尝hechang -合成hecheng -呵斥hechi -何处hechu -河川hechuan -河床hechuang -贺词heci -何等hedeng -贺电hedian -核定heding -核对hedui -合法hefa -何妨hefang -合肥hefei -合格hege -和好hehao -赫赫hehe -合乎hehu -合伙hehuo -黑hei -嘿hei -黑暗heian -黑白heibai -黑帮heibang -嘿嘿heihei -黑人heiren -黑色heise -黑市heishi -黑夜heiye -合计heji -核计heji -和解hejie -合金hejin -何苦heku -何况hekuang -合理heli -合力heli -合流heliu -河流heliu -合谋hemou -和睦hemu -很hen -狠hen -痕hen -恨hen -河南henan -狠毒hendu -很多henduo -河内henei -行*heng -横heng -衡heng -恒heng -哼heng -亨heng -蘅heng -珩*heng -桁heng -横财hengcai -哼哧hengchi -横幅hengfu -横亘henggen -横贯hengguan -横祸henghuo -横加hengjia -衡量hengliang -横蛮hengman -横批hengpi -衡器hengqi -横扫hengsao -横竖hengshu -恒心hengxin -横行hengxing -恒星hengxing -很好henhao -贺年henian -痕迹henji -很快henkuai -狠心henxin -狠抓henzhua -和平heping -和气heqi -河渠hequ -赫然heran -河山heshan -和尚heshang -合适heshi -核实heshi -合算hesuan -核算hesuan -河滩hetan -合同hetong -贺喜hexi -和谐hexie -核心hexin -贺信hexin -和煦hexu -何以heyi -合影heying -合营heying -核准hezhun -合资hezi -赫兹hezi -合作hezuo -合法权益hfqy -合肥市hfs -宏观世界hgsj -化公为私hgws -好高务远hgwy -核工业部hgyb -海关总署hgzs -后顾之忧hgzy -呼和浩特hhht -轰轰烈烈hhll -换句话说hjhs -黄金时代hjsd -环境卫生hjws -后继有人hjyr -海枯石烂hksl -合理化hlh -糊里糊涂hlht -黑龙江hlj -汗流浃背hljb -汗马功劳hmgl -海南岛hnd -河南省hns -湖南省hns -红hong -洪hong -轰hong -烘hong -哄hong -虹hong -鸿hong -宏hong -弘hong -黉hong -訇hong -讧hong -荭hong -蕻hong -薨hong -闳hong -泓hong -红尘hongchen -轰动hongdong -洪都hongdu -洪峰hongfeng -鸿沟honggou -宏观hongguan -红光hongguang -红花honghua -红军hongjun -红利hongli -洪亮hongliang -轰隆honglong -弘论honglun -鸿毛hongmao -轰鸣hongming -哄骗hongpian -红旗hongqi -红人hongren -红色hongse -洪水hongshui -哄抬hongtai -宏图hongtu -宏伟hongwei -红星hongxing -弘扬hongyang -鸿运hongyun -红晕hongyun -轰炸hongzha -后hou -候hou -厚hou -侯hou -喉hou -猴hou -吼hou -堠hou -後hou -逅hou -瘊hou -篌hou -糇hou -鲎hou -骺hou -后备houbei -后辈houbei -后边houbian -厚薄houbo -候补houbu -后尘houchen -后代houdai -厚道houdao -厚度houdu -后盾houdun -后方houfang -后果houguo -后患houhuan -后悔houhui -后记houji -后进houjin -后劲houjin -后来houlai -喉咙houlong -后门houmen -后面houmian -后期houqi -后勤houqin -后人houren -喉舌houshe -厚实houshi -后嗣housi -后台houtai -后天houtian -后退houtui -后续houxu -候选houxuan -后裔houyi -后缀houzhui -和平共处hpgc -黄埔江hpj -后勤部hqb -何去何从hqhc -合情合理hqhl -好容易hry -好事多磨hsdm -胡思乱想hslx -航天工业部htgb -昏头昏脑hthn -欢天喜地htxd -和*hu -护hu -互hu -湖hu -呼hu -户hu -弧hu -乎hu -胡hu -糊hu -虎hu -忽hu -核*hu -瑚hu -戏*hu -壶hu -葫hu -蝴hu -狐hu -唬hu -沪hu -冱hu -唿hu -囫hu -岵hu -猢hu -怙hu -惚hu -浒hu -滹hu -琥hu -槲hu -轷hu -觳hu -烀hu -煳hu -戽hu -扈hu -祜hu -瓠hu -鹄hu -鹕hu -鹱hu -笏hu -醐hu -斛hu -化hua -花hua -话hua -划hua -滑hua -华hua -画hua -哗hua -猾hua -豁*hua -骅hua -桦hua -砉hua -铧hua -画报huabao -华北huabei -哗变huabian -话柄huabing -划拨huabo -划策huace -画册huace -华东huadong -花朵huaduo -花儿huaer -化肥huafei -花费huafei -划分huafen -化工huagong -华贵huagui -化合huahe -花卉huahui -坏huai -怀huai -划*huai -淮huai -槐huai -徊huai -踝huai -怀抱huaibao -淮北huaibei -坏处huaichu -怀古huaigu -淮海huaihai -怀恨huaihen -怀旧huaijiu -淮南huainan -怀念huainian -坏人huairen -坏事huaishi -怀疑huaiyi -怀着huaizhe -滑稽huaji -画家huajia -话剧huaju -哗啦huala -画廊hualang -华丽huali -画面huamian -化名huaming -还*huan -环huan -换huan -欢huan -缓huan -患huan -幻huan -焕huan -桓huan -唤huan -痪huan -豢huan -涣huan -宦huan -郇huan -奂huan -萑huan -擐huan -圜huan -獾huan -洹huan -浣huan -漶huan -寰huan -逭huan -缳huan -锾huan -鲩huan -鬟huan -华南huanan -欢畅huanchang -缓冲huanchong -幻灯huandeng -欢度huandu -焕发huanfa -黄huang -簧huang -荒huang -皇huang -慌huang -蝗huang -磺huang -凰huang -惶huang -煌huang -晃huang -幌huang -恍huang -谎huang -隍huang -徨huang -湟huang -潢huang -遑huang -璜huang -肓huang -癀huang -蟥huang -篁huang -鳇huang -磺胺huangan -皇朝huangchao -荒诞huangdan -晃荡huangdang -皇帝huangdi -荒废huangfei -黄海huanghai -黄河huanghe -恍惚huanghu -谎话huanghua -黄昏huanghun -黄金huangjin -皇历huangli -荒凉huangliang -荒乱huangluan -慌乱huangluan -慌忙huangmang -荒谬huangmiu -恍然huangran -黄色huangse -黄山huangshan -皇上huangshang -荒唐huangtang -环顾huangu -宦官huanguan -谎言huangyan -慌张huangzhang -幌子huangzi -缓和huanhe -欢呼huanhu -环环huanhuan -滑腻huani -花鸟huaniao -还给huanji -缓急huanji -还价huanjia -环节huanjie -环境huanjing -幻境huanjing -幻景huanjing -欢聚huanju -幻觉huanjue -欢乐huanle -缓慢huanman -患难huannan -唤起huanqi -缓期huanqi -欢庆huanqing -环球huanqiu -寰球huanqiu -换取huanqu -环绕huanrao -涣散huansan -欢声huansheng -环视huanshi -欢送huansong -换算huansuan -欢腾huanteng -欢喜huanxi -幻想huanxiang -欢笑huanxiao -欢心huanxin -欢欣huanxin -环行huanxing -缓刑huanxing -唤醒huanxing -幻影huanying -欢迎huanying -寰宇huanyu -还原huanyuan -患者huanzhe -滑坡huapo -花腔huaqiang -华侨huaqiao -划清huaqing -花圈huaquan -划拳huaquan -哗然huaran -华人huaren -花色huase -化身huashen -化石huashi -划算huasuan -话题huati -滑头huatou -花纹huawen -华夏huaxia -化纤huaxian -画像huaxiang -花絮huaxu -化学huaxue -画押huaya -化验huayan -花样huayang -华裔huayi -话音huayin -话语huayu -花园huayuan -画展huazhan -花招huazhao -华中huazhong -化装huazhuang -化妆huazhuang -湖北hubei -胡扯huche -弧度hudu -忽而huer -呼喊huhan -呼号huhao -呼唤huhuan -互惠huhui -会hui -回hui -灰hui -挥hui -辉hui -汇hui -毁hui -慧hui -恢hui -绘hui -惠hui -徽hui -溃*hui -堕*hui -徊*hui -蛔hui -悔hui -卉hui -晦hui -贿hui -秽hui -烩hui -讳hui -诲hui -诙hui -茴hui -荟hui -蕙hui -咴hui -哕hui -喙hui -隳hui -洄hui -浍hui -彗hui -缋hui -珲hui -桧*hui -晖hui -恚hui -虺hui -蟪hui -麾hui -灰暗huian -回报huibao -汇报huibao -回避huibi -汇编huibian -会场huichang -回潮huichao -灰尘huichen -回春huichun -荟萃huicui -回答huida -回荡huidang -回电huidian -汇兑huidui -挥发huifa -汇费huifei -会风huifeng -回复huifu -恢复huifu -悔改huigai -回顾huigu -惠顾huigu -悔过huiguo -会合huihe -回合huihe -汇合huihe -悔恨huihen -恢弘huihong -会话huihua -回话huihua -绘画huihua -毁坏huihuai -辉煌huihuang -挥霍huihuo -会集huiji -回击huiji -汇集huiji -回家huijia -会见huijian -会聚huiju -汇聚huiju -回扣huikou -汇款huikuan -回来huilai -回笼huilong -汇率huilu -贿赂huilu -会面huimian -毁灭huimie -回民huimin -汇票huipiao -回去huiqu -挥洒huisa -灰色huise -晦涩huise -回收huishou -回首huishou -会谈huitan -会堂huitang -会同huitong -回头huitou -回味huiwei -会晤huiwu -挥舞huiwu -悔悟huiwu -麾下huixia -回想huixiang -回响huixiang -诙谐huixie -灰心huixin -彗星huixing -会演huiyan -汇演huiyan -会议huiyi -回忆huiyi -回音huiyin -辉映huiying -会员huiyuan -会战huizhan -徽章huizhang -会诊huizhen -绘制huizhi -回转huizhuan -汇总huizong -回族huizu -户籍huji -呼叫hujiao -户口hukou -虎口hukou -护理huli -互利huli -护林hulin -呼噜hulu -胡乱huluan -忽略hulue -互勉humian -混hun -浑hun -荤hun -昏hun -婚hun -魂hun -诨hun -馄hun -阍hun -溷hun -湖南hunan -胡闹hunao -昏沉hunchen -混合hunhe -浑厚hunhou -昏黄hunhuang -混迹hunji -婚礼hunli -混乱hunluan -糊弄hunong -婚配hunpei -混入hunru -浑身hunshen -混同huntong -混淆hunxiao -婚姻hunyin -昏庸hunyong -混杂hunza -混帐hunzhang -混浊hunzhuo -浑浊hunzhuo -和*huo -活huo -或huo -火huo -货huo -获huo -伙huo -霍huo -豁huo -惑huo -祸huo -劐huo -藿huo -攉huo -嚯huo -夥huo -钬huo -锪huo -镬huo -耠huo -蠖huo -火把huoba -伙伴huoban -火暴huobao -货币huobi -火柴huochai -火车huoche -豁达huoda -获得huode -霍地huodi -活动huodong -伙房huofang -祸根huogen -祸害huohai -火候huohou -火化huohua -火花huohua -祸患huohuan -活活huohuo -伙计huoji -火箭huojian -火警huojing -火炬huoju -火坑huokeng -活力huoli -霍乱huoluan -活泼huopo -获取huoqu -豁然huoran -货色huose -火山huoshan -获胜huosheng -或是huoshi -伙食huoshi -祸首huoshou -伙同huotong -货物huowu -获悉huoxi -火线huoxian -活现huoxian -或许huoxu -火药huoyao -活页huoye -活跃huoyue -货运huoyun -火灾huozai -火葬huozang -或则huoze -或者huozhe -获准huozhun -湖泊hupo -忽然huran -呼声husheng -护士hushi -忽视hushi -湖水hushui -胡说hushuo -护送husong -胡同hutong -互通hutong -户头hutou -糊涂hutu -护卫huwei -呼吸huxi -互相huxiang -呼啸huxiao -虎穴huxue -护养huyang -呼应huying -呼吁huyu -护照huzhao -互助huzhu -毫无疑问hwyw -互相爱护hxah -横行霸道hxbd -互相帮助hxbz -欢欣鼓舞hxgw -候选人hxr -合作化hzh -杭州市hzs -化整为零hzwl -级j -就j -进j -加j -经j -家j -结j -阶j -间j -件j -及j -解j -较j -机j -军j -接j -教j -极j -九j -见j -基本国策jbgc -基本上jbs -据不完全统计jbwj -饥不择食jbzs -坚持不懈jcbx -集成电路jcdl -基础上jcs -绝大部分jdbf -坚定不移jdby -绝大多数jdds -鉴定会jdh -绝对化jdh -经得起jdq -见多识广jdsg -精打细算jdxs -接二连三jels -解放后jfh -解放军jfj -解放军报jfjb -解放前jfq -仅供参考jgck -机构改革jggg -坚固耐用jgny -襟怀坦白jhtb -计划性jhx -级ji -及ji -机ji -极ji -几ji -积ji -给ji -基ji -其*ji -记ji -己ji -期*ji -系*ji -革*ji -计ji -集ji -即ji -际ji -季ji -激ji -济ji -技ji -击ji -继ji -急ji -剂ji -既ji -纪ji -寄ji -挤ji -鸡ji -迹ji -绩ji -齐*ji -奇*ji -吉ji -脊ji -辑ji -籍ji -疾ji -肌ji -棘ji -畸ji -圾ji -稽ji -箕ji -饥ji -讥ji -姬ji -缉ji -汲ji -嫉ji -蓟ji -冀ji -伎ji -祭ji -悸ji -寂ji -忌ji -妓ji -藉ji -丌ji -亟ji -乩ji -剞ji -佶ji -偈ji -诘ji -墼ji -芨ji -芰ji -荠ji -蒺ji -蕺ji -掎ji -叽ji -咭ji -哜ji -唧ji -岌ji -嵴ji -洎ji -屐ji -骥ji -畿ji -玑ji -楫ji -殛ji -戟ji -戢ji -赍ji -觊ji -犄ji -齑ji -矶ji -羁ji -嵇ji -稷ji -瘠ji -虮ji -笈ji -笄ji -暨ji -跻ji -跽ji -霁ji -鲚ji -鲫ji -髻ji -麂ji -加jia -家jia -架jia -价jia -甲jia -夹jia -假jia -钾jia -贾jia -稼jia -驾jia -嘉jia -枷jia -佳jia -荚jia -颊jia -嫁jia -茄*jia -挟*jia -嘏*jia -伽jia -郏jia -葭jia -岬jia -浃jia -迦jia -珈jia -戛jia -胛jia -恝jia -铗jia -镓jia -痂jia -瘕jia -袷jia -蛱jia -笳jia -袈jia -跏jia -加班jiaban -甲板jiaban -加倍jiabei -甲虫jiachong -家畜jiachu -家当jiadang -家底jiadi -假定jiading -加法jiafa -家访jiafang -价格jiage -加工jiagong -佳话jiahua -家伙jiahuo -加急jiaji -嘉奖jiajiang -家教jiajiao -嫁接jiajie -佳节jiajie -假借jiajie -加紧jiajin -家境jiajing -家具jiaju -加剧jiaju -加快jiakuai -加仑jialun -加码jiama -假冒jiamao -家门jiamen -加密jiami -加冕jiamian -价目jiamu -间jian -件jian -见jian -建jian -坚jian -减jian -检jian -践jian -尖jian -简jian -碱jian -剪jian -艰jian -渐jian -肩jian -键jian -健jian -柬jian -鉴jian -剑jian -歼jian -监jian -兼jian -浅*jian -奸jian -箭jian -茧jian -舰jian -俭jian -笺jian -煎jian -缄jian -硷jian -拣jian -捡jian -荐jian -槛jian -贱jian -饯jian -溅jian -涧jian -僭jian -谏jian -谫jian -菅jian -蒹jian -搛jian -囝*jian -湔jian -蹇jian -謇jian -缣jian -枧jian -楗jian -戋jian -戬jian -牮jian -犍jian -毽jian -腱jian -睑jian -锏jian -鹣jian -裥jian -笕jian -翦jian -趼jian -踺jian -鲣jian -鞯jian -吉安jian -煎熬jianao -简报jianbao -渐变jianbian -简便jianbian -简编jianbian -鉴别jianbie -兼并jianbing -尖兵jianbing -剪裁jiancai -剪彩jiancai -检测jiance -检查jiancha -检察jiancha -监察jiancha -减产jianchan -建成jiancheng -简称jiancheng -坚持jianchi -简单jiandan -建党jiandang -减低jiandi -检点jiandian -间谍jiandie -坚定jianding -鉴定jianding -监督jiandu -间断jianduan -尖端jianduan -简短jianduan -舰队jiandui -健儿jianer -减法jianfa -肩负jianfu -将jiang -降jiang -讲jiang -强*jiang -江jiang -浆jiang -蒋jiang -奖jiang -疆jiang -僵jiang -姜jiang -桨jiang -匠jiang -酱jiang -茳jiang -洚jiang -绛jiang -缰jiang -犟jiang -礓jiang -耩jiang -糨jiang -豇jiang -奖杯jiangbei -疆场jiangchang -奖惩jiangcheng -僵持jiangchi -降低jiangdi -间隔jiange -讲稿jianggao -江湖jianghu -僵化jianghua -讲话jianghua -降级jiangji -降价jiangjia -讲解jiangjie -疆界jiangjie -将近jiangjin -奖金jiangjin -讲究jiangjiu -僵局jiangju -将军jiangjun -讲课jiangke -将来jianglai -讲理jiangli -奖励jiangli -降临jianglin -将领jiangling -降落jiangluo -江南jiangnan -奖品jiangpin -讲评jiangping -奖券jiangquan -江山jiangshan -讲师jiangshi -僵尸jiangshi -讲授jiangshou -讲述jiangshu -降水jiangshui -江苏jiangsu -讲台jiangtai -讲坛jiangtan -疆土jiangtu -坚固jiangu -兼顾jiangu -监管jianguan -建国jianguo -降温jiangwen -江西jiangxi -讲习jiangxi -匠心jiangxin -讲学jiangxue -讲演jiangyan -将要jiangyao -讲义jiangyi -僵硬jiangying -奖章jiangzhang -讲座jiangzuo -监护jianhu -简化jianhua -间或jianhuo -奸计jianji -歼击jianji -剪辑jianji -减价jianjia -渐渐jianjian -健将jianjiang -建交jianjiao -间接jianjie -见解jianjie -简介jianjie -简洁jianjie -简捷jianjie -渐进jianjin -监禁jianjin -检举jianju -艰巨jianju -坚决jianjue -健康jiankang -尖刻jianke -坚苦jianku -艰苦jianku -监牢jianlao -建立jianli -尖利jianli -简历jianli -简练jianlian -简陋jianlou -简略jianlue -健美jianmei -减免jianmian -歼灭jianmie -简明jianming -缄默jianmo -艰难jiannan -键盘jianpan -简拼jianpin -简朴jianpu -俭朴jianpu -坚强jianqiang -减轻jianqing -健全jianquan -兼任jianren -坚韧jianren -兼容jianrong -尖锐jianrui -减弱jianruo -艰涩jianse -鉴赏jianshang -减少jianshao -建设jianshe -艰深jianshen -见识jianshi -坚实jianshi -监视jianshi -建树jianshu -减速jiansu -检索jiansuo -践踏jianta -健谈jiantan -检讨jiantao -简体jianti -舰艇jianting -减退jiantui -健忘jianwang -间文jianwen -见闻jianwen -间隙jianxi -奸细jianxi -艰险jianxian -见效jianxiao -间歇jianxie -简写jianxie -坚信jianxin -艰辛jianxin -减刑jianxing -检修jianxiu -简讯jianxun -检验jianyan -简要jianyao -建议jianyi -坚毅jianyi -简易jianyi -奸淫jianyin -坚硬jianying -剪影jianying -鉴于jianyu -监狱jianyu -减员jianyuan -检阅jianyue -建造jianzao -简则jianze -坚贞jianzhen -监制jianzhi -简直jianzhi -兼职jianzhi -建筑jianzhu -简装jianzhuang -健壮jianzhuang -较jiao -教jiao -交jiao -角jiao -叫jiao -脚jiao -胶jiao -浇jiao -焦jiao -觉*jiao -校*jiao -搅jiao -酵jiao -郊jiao -铰jiao -窖jiao -椒jiao -礁jiao -骄jiao -娇jiao -嚼jiao -矫jiao -侥jiao -狡jiao -饺jiao -缴jiao -绞jiao -剿jiao -轿jiao -佼jiao -僬jiao -艽jiao -茭jiao -挢jiao -噍jiao -峤jiao -徼jiao -湫*jiao -姣jiao -敫jiao -皎jiao -鹪jiao -蛟jiao -醮jiao -跤jiao -鲛jiao -骄傲jiaoao -搅拌jiaoban -狡辩jiaobian -教材jiaocai -交叉jiaocha -教程jiaocheng -交错jiaocuo -较大jiaoda -交代jiaodai -交淡jiaodan -教导jiaodao -交点jiaodian -焦点jiaodian -校订jiaoding -角度jiaodu -校对jiaodui -较多jiaoduo -焦耳jiaoer -交锋jiaofeng -交付jiaofu -浇灌jiaoguan -娇贵jiaogui -叫喊jiaohan -较好jiaohao -叫好jiaohao -狡猾jiaohua -交换jiaohuan -叫唤jiaohuan -教诲jiaohui -缴获jiaohuo -交际jiaoji -矫健jiaojian -交接jiaojie -交界jiaojie -叫苦jiaoku -较快jiaokuai -教练jiaolian -较量jiaoliang -交流jiaoliu -搅乱jiaoluan -角落jiaoluo -叫骂jiaoma -剿灭jiaomie -酵母jiaomu -交纳jiaona -缴纳jiaona -娇嫩jiaonen -交配jiaopei -骄气jiaoqi -交情jiaoqing -郊区jiaoqu -叫嚷jiaorang -角色jiaose -交涉jiaoshe -教师jiaoshi -教授jiaoshou -教唆jiaosuo -脚踏jiaota -交谈jiaotan -教堂jiaotang -交替jiaoti -教条jiaotiao -交通jiaotong -郊外jiaowai -交往jiaowang -较为jiaowei -狡黠jiaoxia -叫嚣jiaoxiao -侥幸jiaoxing -绞刑jiaoxing -教学jiaoxue -教训jiaoxun -教养jiaoyang -骄阳jiaoyang -教益jiaoyi -交易jiaoyi -交谊jiaoyi -教育jiaoyu -教员jiaoyuan -狡诈jiaozha -校正jiaozheng -脚注jiaozhu -角逐jiaozhu -浇铸jiaozhu -校准jiaozhun -焦灼jiaozhuo -娇纵jiaozong -叫做jiaozuo -家谱jiapu -假期jiaqi -价钱jiaqian -加强jiaqiang -假日jiari -加入jiaru -假如jiaru -假若jiaruo -加上jiashang -假设jiashe -加深jiashen -假使jiashi -架势jiashi -驾驶jiashi -家属jiashu -假说jiashuo -加速jiasu -枷锁jiasuo -家庭jiating -家乡jiaxiang -假想jiaxiang -家业jiaye -加以jiayi -佳音jiayin -家用jiayong -加油jiayou -家园jiayuan -夹杂jiaza -加载jiazai -家长jiazhang -价值jiazhi -加重jiazhong -假装jiazhuang -嫁妆jiazhuang -架子jiazi -家族jiazu -击败jibai -羁绊jiban -几倍jibei -基本jiben -击毙jibi -级别jibie -疾病jibing -计策jice -基层jiceng -稽查jicha -机场jichang -集成jicheng -继承jicheng -计酬jichou -基础jichu -机床jichuang -几次jici -急促jicu -积存jicun -寄存jicun -极大jida -亟待jidai -激荡jidang -记得jide -基地jidi -机电jidian -极点jidian -基调jidiao -机动jidong -激动jidong -极度jidu -几度jidu -即度jidu -季度jidu -基督jidu -嫉妒jidu -忌妒jidu -极端jiduan -结jie -阶jie -解jie -接jie -节jie -家*jie -界jie -截jie -介jie -借jie -价*jie -届jie -街jie -揭jie -洁jie -杰jie -竭jie -皆jie -秸jie -劫jie -桔jie -捷jie -睫jie -姐jie -戒jie -藉jie -芥jie -疥jie -诫jie -楷*jie -偈*jie -讦jie -诘*jie -拮jie -喈jie -嗟jie -婕jie -孑jie -桀jie -碣jie -疖jie -颉jie -蚧jie -羯jie -鲒jie -骱jie -饥饿jie -结案jiean -洁白jiebai -接班jieban -捷报jiebao -戒备jiebei -结彩jiecai -节操jiecao -阶层jieceng -劫持jiechi -杰出jiechu -解除jiechu -接触jiechu -戒除jiechu -揭穿jiechuan -结存jiecun -解答jieda -接待jiedai -借贷jiedai -街道jiedao -解冻jiedong -阶段jieduan -截断jieduan -揭发jiefa -借方jiefang -解放jiefang -街坊jiefang -结构jiegou -解雇jiegu -借故jiegu -结果jieguo -结合jiehe -结核jiehe -结婚jiehun -阶级jieji -接见jiejian -节俭jiejian -借鉴jiejian -结交jiejiao -姐姐jiejie -接近jiejin -竭尽jiejin -结晶jiejing -捷径jiejing -洁净jiejing -解救jiejiu -结局jieju -解决jiejue -孑孓jiejue -解开jiekai -揭开jiekai -解渴jieke -接口jiekou -借口jiekou -借款jiekuan -竭力jieli -接连jielian -揭露jielu -戒律jielu -结论jielun -解闷jiemen -结盟jiemeng -界面jiemian -节目jiemu -揭幕jiemu -接纳jiena -解聘jiepin -解剖jiepou -节气jieqi -接洽jieqia -截取jiequ -既而jier -节日jieri -介入jieru -解散jiesan -介绍jieshao -节省jiesheng -届时jieshi -结实jieshi -解释jieshi -揭示jieshi -解手jieshou -接受jieshou -接收jieshou -结束jieshu -解说jieshuo -结算jiesuan -解体jieti -阶梯jieti -接替jieti -接头jietou -街头jietou -解脱jietuo -结尾jiewei -解围jiewei -接吻jiewen -解析jiexi -界线jiexian -界限jiexian -揭晓jiexiao -戒严jieyan -结业jieye -介意jieyi -接应jieying -结余jieyu -节约jieyue -结帐jiezhang -接着jiezhao -节制jiezhi -介质jiezhi -戒指jiezhi -借支jiezhi -截止jiezhi -借助jiezhu -节奏jiezou -杰作jiezuo -激发jifa -技法jifa -讥讽jifeng -几个jige -及格jige -技工jigong -记功jigong -机构jigou -叽咕jigu -机关jiguan -籍贯jiguan -极光jiguang -激光jiguang -记过jiguo -极好jihao -记号jihao -集合jihe -几何jihe -稽核jihe -几乎jihu -激化jihua -计划jihua -饥荒jihuang -机会jihui -集会jihui -击毁jihui -忌讳jihui -积极jiji -机件jijian -计件jijian -急件jijian -击剑jijian -即将jijiang -计较jijiao -季节jijie -急进jijin -基金jijin -机警jijing -即景jijing -寂静jijing -急救jijiu -积聚jiju -急剧jiju -急遽jiju -寄居jiju -季刊jikan -即刻jike -疾苦jiku -击溃jikui -积累jilei -极力jili -吉利jili -激励jili -伎俩jilia -计量jiliang -寂寥jiliao -激烈jilie -吉林jilin -机灵jiling -激流jiliu -记录jilu -纪律jilu -纪录jilu -辑录jilu -击落jiluo -急忙jimang -机密jimi -寂寞jimo -计谋jimou -进jin -金jin -近jin -紧jin -斤jin -今jin -尽jin -仅jin -劲jin -浸jin -禁jin -津jin -筋jin -锦jin -晋jin -巾jin -襟jin -谨jin -靳jin -烬jin -卺jin -荩jin -堇jin -噤jin -馑jin -廑jin -妗jin -缙jin -瑾jin -槿jin -赆jin -觐jin -衿jin -缉拿jina -济南jinan -禁闭jinbi -锦标jinbiao -进步jinbu -浸沉jinchen -进程jincheng -进出jinchu -紧凑jincou -近代jindai -劲敌jindi -进度jindu -金额jine -机能jineng -技能jineng -进而jiner -进犯jinfan -经jing -精jing -京jing -径jing -井jing -静jing -竟jing -晶jing -净jing -境jing -镜jing -景jing -警jing -劲*jing -茎jing -敬jing -惊jing -睛jing -竞jing -荆jing -兢jing -鲸jing -粳jing -痉jing -靖jing -刭jing -儆jing -阱jing -菁jing -獍jing -憬jing -泾jing -迳jing -弪jing -婧jing -肼jing -胫jing -腈jing -旌jing -靓*jing -敬爱jingai -警报jingbao -警备jingbei -精兵jingbing -精采jingcai -精彩jingcai -警察jingcha -经常jingchang -精粹jingcui -静电jingdian -经典jingdian -惊动jingdong -精度jingdu -经费jingfei -精干jinggan -竟敢jinggan -警告jinggao -经过jingguo -净化jinghua -精华jinghua -经济jingji -竞技jingji -荆棘jingji -精简jingjian -境界jingjie -警戒jingjie -经久jingjiu -惊恐jingkong -经理jingli -经历jingli -精力jingli -敬礼jingli -精练jinglian -精良jingliang -经络jingluo -精美jingmei -精密jingmi -精明jingming -进攻jingong -敬佩jingpei -精辟jingpi -景气jingqi -惊奇jingqi -精巧jingqiao -精确jingque -竟然jingran -竞赛jingsai -景色jingse -经商jingshang -精神jingshen -经手jingshou -经受jingshou -精髓jingsui -静态jingtai -惊叹jingtan -晶体jingti -警惕jingti -精通jingtong -镜头jingtou -筋骨jingu -禁锢jingu -尽管jinguan -巾帼jinguo -经委jingwei -警卫jingwei -敬畏jingwei -景物jingwu -精细jingxi -京戏jingxi -惊险jingxian -景象jingxiang -经销jingxiao -经心jingxin -精心jingxin -惊心jingxin -惊醒jingxing -竞选jingxuan -惊讶jingya -经验jingyan -敬仰jingyang -经营jingying -晶莹jingying -经由jingyou -境遇jingyu -精湛jingzhan -竞争jingzheng -精制jingzhi -径直jingzhi -精致jingzhi -静止jingzhi -净值jingzhi -竟址jingzhi -净重jingzhong -镜子jingzi -静坐jingzuo -近海jinhai -今后jinhou -近乎jinhu -进化jinhua -几年jinian -记念jinian -纪念jinian -晋级jinji -紧急jinji -近郊jinjiao -紧紧jinjin -仅仅jinjin -进军jinjun -进口jinkou -尽快jinkuai -近况jinkuang -进来jinlai -近来jinlai -尽力jinli -尽量jinliang -斤两jinliang -禁令jinling -劲旅jinlu -紧密jinmi -近年jinnian -今年jinnian -金牌jinpai -紧迫jinpo -近期jinqi -近前jinqian -金钱jinqian -尽情jinqing -进去jinqu -进取jinqu -禁区jinqu -近日jinri -今日jinri -金融jinrong -进入jinru -浸入jinru -谨慎jinshen -晋升jinsheng -今是jinshi -尽是jinshi -近视jinshi -金属jinshu -近似jinsi -紧缩jinsuo -今天jintian -津贴jintie -尽头jintou -劲头jintou -浸透jintou -进退jintui -今晚jinwan -今昔jinxi -尽心jinxin -进行jinxing -进修jinxiu -锦秀jinxiu -谨严jinyan -紧要jinyao -进展jinzhan -紧张jinzhang -今朝jinzhao -紧着jinzhe -禁止jinzhi -尽职jinzhi -进驻jinzhu -金子jinzi -炯jiong -窘jiong -迥jiong -炅*jiong -扃jiong -窘迫jiongpo -迥然jiongran -击破jipo -急迫jipo -及其jiqi -极其jiqi -激起jiqi -机器jiqi -机枪jiqiang -技巧jiqiao -急切jiqie -激情jiqing -汲取jiqu -集权jiquan -既然jiran -己任jiren -继任jiren -即日jiri -吉日jiri -肌肉jirou -极少jishao -寄生jisheng -即是jishi -及时jishi -几时jishi -计时jishi -即时jishi -即使jishi -记事jishi -基石jishi -集市jishi -级数jishu -基数jishu -计数jishu -记述jishu -技术jishu -祭祀jisi -激素jisu -急速jisu -计算jisuan -机体jiti -集体jiti -肌体jiti -几天jitian -集团jituan -寄托jituo -就jiu -九jiu -旧jiu -究jiu -久jiu -救jiu -酒jiu -纠jiu -揪jiu -玖jiu -韭jiu -灸jiu -厩jiu -臼jiu -舅jiu -咎jiu -疚jiu -僦jiu -啾jiu -阄jiu -柩jiu -桕jiu -鸠jiu -鹫jiu -赳jiu -鬏jiu -就餐jiucan -纠察jiucha -纠缠jiuchan -就此jiuci -就地jiudi -就范jiufan -纠纷jiufen -纠葛jiuge -救国jiuguo -救护jiuhu -救火jiuhuo -纠集jiuji -鸠集jiuji -救济jiuji -救急jiuji -九江jiujiang -九届jiujie -就近jiujin -酒精jiujing -究竟jiujing -救命jiuming -救生jiusheng -就是jiushi -就事jiushi -救亡jiuwang -久违jiuwei -酒窝jiuwo -酒席jiuxi -救险jiuxian -揪心jiuxin -救星jiuxing -就绪jiuxu -就学jiuxue -久仰jiuyang -就要jiuyao -就业jiuye -久远jiuyuan -九月jiuyue -救灾jiuzai -纠正jiuzheng -就职jiuzhi -救治jiuzhi -九洲jiuzhou -救助jiuzhu -极为jiwei -纪委jiwei -极限jixian -迹象jixiang -吉祥jixiang -讥笑jixiao -机械jixie -记性jixing -急性jixing -畸形jixing -即兴jixing -吉凶jixiong -几许jixu -积蓄jixu -继续jixu -记叙jixu -急需jixu -集训jixun -积压jiya -羁押jiya -给养jiyang -机要jiyao -纪要jiyao -给以jiyi -记忆jiyi -技艺jiyi -基因jiyin -急用jiyong -基于jiyu -急于jiyu -机遇jiyu -给予jiyu -寄予jiyu -觊觎jiyu -纪元jiyuan -集约jiyue -记载jizai -及早jizao -急躁jizao -激增jizeng -记帐jizhang -记者jizhe -集镇jizhen -机制jizhi -及至jizhi -机智jizhi -集中jizhong -击中jizhong -记住jizhu -基准jizhun -集资jizi -经济核算jjhs -聚精会神jjhs -将计就计jjjj -戒骄戒躁jjjz -近几年来jjnl -竭尽全力jjql -节假日jjr -积极性jjx -经济效益jjxy -兢兢业业jjyy -精简整编jjzb -叽叽喳喳jjzz -艰苦奋斗jkfd -尽可能jkn -教科书jks -俱乐部jlb -交流电jld -吉林省jls -价廉物美jlwm -纪律性jlx -纪念碑jnb -几年来jnl -近年来jnl -纪念品jnp -济南市jns -吉普车jpc -坚强不屈jqbq -奖勤罚懒jqfl -机器人jqr -急起直追jqzz -截然不同jrbt -兼容性jrx -积少成多jscd -金山公司jsgs -集思广益jsgy -精神焕发jshf -计算机jsj -尽善尽美jsjm -集市贸易jsmy -介绍人jsr -就是说jss -计算所jss -江苏省jss -举世闻名jswm -介绍信jsx -技术员jsy -计算中心jszx -交通部jtb -家庭出身jtcs -惊天动地jtdd -具体地说jtds -晶体管jtg -交通工具jtgj -脚踏实地jtsd -具体说来jtsl -具ju -据ju -局ju -举ju -车*ju -句ju -聚ju -距ju -巨ju -居ju -锯ju -剧ju -矩ju -拒ju -柜*ju -桔*ju -鞠ju -拘ju -狙ju -疽ju -驹ju -菊ju -咀ju -沮ju -踞ju -俱ju -惧ju -炬ju -倨ju -讵ju -苣ju -苴ju -莒ju -掬ju -遽ju -屦ju -琚ju -枸*ju -椐ju -榘ju -榉ju -橘ju -犋ju -飓ju -钜ju -锔ju -窭ju -裾ju -趄ju -醵ju -踽ju -龃ju -雎ju -瞿*ju -鞫ju -卷juan -捐juan -鹃juan -娟juan -倦juan -眷juan -绢juan -俊*juan -鄄juan -狷juan -涓juan -桊juan -蠲juan -锩juan -镌juan -隽juan -卷进juanjin -捐款juankuan -眷恋juanlian -眷念juannian -捐躯juanqu -卷入juanru -眷属juanshu -捐献juanxian -卷烟juanyan -卷帙juanzhi -捐助juanzhu -卷宗juanzong -举办juban -具备jubei -剧本juben -巨变jubian -局部jubu -拘捕jubu -剧场juchang -据此juci -巨大juda -举动judong -居多juduo -决jue -觉jue -绝jue -角*jue -脚*jue -掘jue -嚼*jue -撅jue -攫jue -抉jue -倔jue -爵jue -诀jue -厥jue -劂jue -谲jue -矍jue -蕨jue -嗟*jue -噘jue -噱jue -崛jue -獗jue -孓jue -珏jue -桷jue -橛jue -爝jue -镢jue -蹶jue -觖jue -巨额jue -诀别juebie -决不juebu -绝不juebu -决策juece -觉察juecha -觉得juede -决定jueding -决断jueduan -绝对juedui -绝迹jueji -倔强juejiang -绝交juejiao -绝径juejing -绝境juejing -绝句jueju -决裂juelie -绝路juelu -绝密juemi -绝妙juemiao -崛起jueqi -诀窍jueqiao -决赛juesai -绝食jueshi -决死juesi -决算juesuan -绝望juewang -爵位juewei -觉悟juewu -决心juexin -觉醒juexing -决议jueyi -绝缘jueyuan -抉择jueze -决战juezhan -绝招juezhao -绝症juezheng -巨幅jufu -居功jugong -鞠躬jugong -句号juhao -聚合juhe -聚会juhui -聚集juji -巨匠jujiang -拘谨jujin -拒绝jujue -咀嚼jujue -距离juli -举例juli -剧烈julie -拘留juliu -局面jumian -居民jumin -剧目jumu -军jun -均jun -菌jun -君jun -龟*jun -钧jun -峻jun -俊jun -竣jun -浚jun -郡jun -骏jun -捃jun -皲jun -筠jun -麇jun -军操juncao -君臣junchen -均等jundeng -军队jundui -军法junfa -军阀junfa -军服junfu -军港jungang -军工jungong -竣工jungong -均衡junheng -军火junhuo -拘泥juni -军机junji -军纪junji -军舰junjian -俊杰junjie -军垦junken -军粮junliang -军令junling -骏马junma -军民junmin -军旗junqi -峻峭junqiao -俊俏junqiao -军区junqu -军权junquan -军人junren -军事junshi -军师junshi -军属junshu -军团juntuan -军委junwei -军衔junxian -军校junxiao -军械junxie -军心junxin -俊秀junxiu -军需junxu -军训junxun -军医junyi -军营junying -军用junyong -军邮junyou -均匀junyun -军长junzhang -军政junzheng -君主junzhu -军装junzhuang -君子junzi -俱全juquan -居然juran -遽然juran -沮丧jusang -局势jushi -举手jushou -拘束jushu -据说jushuo -具体juti -剧团jutuan -据悉juxi -局限juxian -居心juxin -举行juxing -矩形juxing -巨型juxing -具有juyou -据有juyou -剧院juyuan -局长juzhang -剧照juzhao -举止juzhi -居中juzhong -剧终juzhong -巨著juzhu -居住juzhu -句子juzi -节外生枝jwsz -惊心动魄jxdp -继续革命jxgm -机械化jxh -江西省jxs -谨小慎微jxsw -局限性jxx -教育部jyb -进一步jyb -家用电器jydq -教育方针jyfz -家喻户晓jyhx -加以解决jyjj -记忆力jyl -精益求精jyqj -教研室jys -见义勇为jyyw -旧中国jzg -建筑物jzw -可k -开k -看k -克k -孔k -科k -口k -空k -苦k -快k -考k -刻k -靠k -况k -块k -困k -宽k -矿k -抗k -卡k -卡ka -喀ka -咖ka -咯ka -佧ka -咔ka -胩ka -喀嚓kacha -卡车kache -咖啡kafei -开kai -凯kai -揩kai -楷kai -慨kai -剀kai -垲kai -蒈kai -忾kai -恺kai -铠kai -锎kai -锴kai -开办kaiban -开遍kaibian -开采kaicai -开场kaichang -开车kaiche -开除kaichu -开创kaichuang -开导kaidao -开刀kaidao -开动kaidong -开端kaiduan -开发kaifa -开放kaifang -开封kaifeng -开赴kaifu -凯歌kaige -开关kaiguan -开航kaihang -开户kaihu -开花kaihua -开怀kaihuai -开荒kaihuang -开会kaihui -开掘kaijue -开垦kaiken -开口kaikou -开矿kaikuang -开阔kaikuo -开朗kailang -开郎kailang -开路kailu -开明kaiming -楷模kaimo -开幕kaimu -开炮kaipao -开辟kaipi -开启kaiqi -开枪kaiqiang -开窍kaiqiao -开设kaishe -开始kaishi -开庭kaiting -开头kaitou -开脱kaituo -开拓kaituo -开外kaiwai -开销kaixiao -开心kaixin -凯旋kaixuan -开学kaixue -开颜kaiyan -开业kaiye -开战kaizhan -开展kaizhan -开张kaizhang -开支kaizhi -看kan -刊kan -坎kan -槛*kan -堪kan -勘kan -砍kan -嵌*kan -侃kan -莰kan -阚*kan -戡kan -龛kan -瞰kan -勘测kance -勘察kancha -看出kanchu -看待kandai -看到kandao -刊登kandeng -看法kanfa -砍伐kanfa -抗kang -康kang -炕kang -慷kang -糠kang -扛kang -亢kang -伉kang -闶kang -钪kang -亢奋kangfen -康复kangfu -抗衡kangheng -抗击kangji -亢进kangjin -抗拒kangju -伉俪kangli -抗日kangri -看管kanguan -抗议kangyi -看见kanjian -坎坷kanke -看来kanlai -看齐kanqi -刊头kantou -看望kanwang -刊物kanwu -勘误kanwu -看样kanyang -刊载kanzai -考kao -靠kao -拷kao -烤kao -尻kao -栲kao -犒kao -铐kao -拷贝kaobei -靠边kaobian -考查kaocha -考察kaocha -考核kaohe -靠近kaojin -考究kaojiu -靠拢kaolong -考虑kaolu -考勤kaoqin -靠山kaoshan -考试kaoshi -考题kaoti -考验kaoyan -考证kaozheng -卡片kapian -看不惯kbg -看不起kbq -刻不容缓kbrh -开诚布公kcbg -矿产资源kczy -扩大化kdh -可ke -克ke -科ke -刻ke -客ke -壳ke -颗ke -棵ke -柯ke -呵*ke -坷ke -苛ke -磕ke -咳ke -渴ke -课ke -嗑ke -岢ke -恪ke -溘ke -骒ke -缂ke -珂ke -轲ke -氪ke -瞌ke -钶ke -锞ke -稞ke -疴ke -窠ke -颏ke -蝌ke -髁ke -可爱keai -科班keban -课本keben -可比kebi -刻薄kebo -可不kebu -客车keche -课程kecheng -可耻kechi -可恶kee -可风kefeng -可否kefou -克服kefu -可观keguan -客观keguan -可贵kegui -可好kehao -可恨kehen -刻划kehua -刻画kehua -克己keji -客机keji -科技keji -可见kejian -科教kejiao -可敬kejing -窠臼kejiu -科举keju -可靠kekao -苛刻keke -可口kekou -克扣kekou -刻苦keku -克拉kela -克朗kelang -颗粒keli -可怜kelian -科目kemu -肯ken -啃ken -垦ken -恳ken -裉ken -肯定kending -可能keneng -坑keng -吭keng -铿keng -坑道kengdao -坑害kenghai -铿锵kengqiang -恳切kenqie -恳求kenqiu -垦殖kenzhi -可怕kepa -磕碰kepeng -科普kepu -客气keqi -可亲keqin -可取kequ -客人keren -客商keshang -可是keshi -科室keshi -课堂ketang -客套ketao -课题keti -客体keti -客厅keting -磕头ketou -可望kewang -渴望kewang -可喜kexi -可惜kexi -可行kexing -科学kexue -科研keyan -可以keyi -可疑keyi -刻意keyi -科员keyuan -科长kezhang -可知kezhi -克制kezhi -狂风暴雨kfby -克己奉公kjfg -科技司kjs -苦口婆心kkpx -昆明市kms -可能性knx -孔kong -空kong -控kong -恐kong -倥kong -崆kong -箜kong -空白kongbai -恐怖kongbu -控拆kongchai -空洞kongdong -空额konge -空乏kongfa -控告konggao -空喊konghan -恐吓konghe -空话konghua -恐慌konghuang -空间kongjian -空降kongjiang -恐惧kongju -空军kongjun -空旷kongkuang -恐龙konglong -空虑konglu -恐怕kongpa -空气kongqi -空前kongqian -孔雀kongque -控诉kongsu -空谈kongtan -空头kongtou -空文kongwen -空隙kongxi -空闲kongxian -空想kongxiang -空虚kongxu -空运kongyun -控制kongzhi -空中kongzhong -口kou -扣kou -抠kou -寇kou -芤kou -蔻kou -叩kou -眍kou -筘kou -口岸kouan -叩拜koubai -口才koucai -扣除kouchu -口传kouchuan -口服koufu -口供kougong -口号kouhao -口红kouhong -口角koujiao -口径koujing -口诀koujue -口令kouling -扣留kouliu -口气kouqi -口腔kouqiang -口哨koushao -口试koushi -口述koushu -口头koutou -叩头koutou -口信kouxin -扣押kouya -口语kouyu -看起来kql -口若悬河krxh -口是心非ksxf -苦ku -库ku -枯ku -酷ku -哭ku -窟ku -裤ku -刳ku -堀ku -喾ku -绔ku -骷ku -跨kua -夸kua -垮kua -挎kua -胯kua -侉kua -跨步kuabu -夸大kuada -跨度kuadu -会*kuai -快kuai -块kuai -筷kuai -侩kuai -蒯kuai -郐kuai -哙kuai -狯kuai -浍*kuai -脍kuai -会计kuaiji -快乐kuaile -快速kuaisu -宽kuan -款kuan -髋kuan -宽敞kuanchang -宽绰kuanchuo -宽大kuanda -宽待kuandai -款待kuandai -宽度kuandu -况kuang -矿kuang -狂kuang -框kuang -匡kuang -筐kuang -眶kuang -旷kuang -诓kuang -诳kuang -邝kuang -圹kuang -夼kuang -哐kuang -纩kuang -贶kuang -矿藏kuangcang -矿产kuangchan -狂风kuangfeng -矿工kuanggong -旷工kuanggong -矿井kuangjing -框框kuangkuang -哐啷kuanglang -况且kuangqie -矿区kuangqu -矿泉kuangquan -狂热kuangre -矿山kuangshan -矿石kuangshi -框图kuangtu -宽广kuanguang -狂妄kuangwang -矿物kuangwu -旷野kuangye -宽宏kuanhong -宽厚kuanhou -宽阔kuankuo -宽容kuanrong -款式kuanshi -宽恕kuanshu -款项kuanxiang -宽心kuanxin -宽裕kuanyu -垮台kuatai -跨越kuayue -夸张kuazhang -裤衩kucha -库存kucun -哭喊kuhan -奎kui -溃kui -馈kui -亏kui -盔kui -岿kui -窥kui -葵kui -魁kui -傀kui -愧kui -馗kui -匮kui -夔kui -隗kui -蒉kui -揆kui -喹kui -喟kui -悝kui -愦kui -逵kui -暌kui -睽kui -聩kui -蝰kui -篑kui -跬kui -亏本kuiben -窥测kuice -亏待kuidai -愧疚kuijiu -亏空kuikong -亏损kuisun -魁梧kuiwu -溃疡kuiyang -枯竭kujie -库仑kulun -苦闷kumen -枯木kumu -困kun -昆kun -坤kun -捆kun -悃kun -阃kun -琨kun -锟kun -醌kun -鲲kun -髡kun -苦难kunan -苦恼kunao -困厄kune -困乏kunfa -困惑kunhuo -困境kunjing -困苦kunku -昆明kunming -困难kunnan -扩kuo -括kuo -适*kuo -阔kuo -廓kuo -栝*kuo -蛞kuo -阔别kuobie -扩充kuochong -阔绰kuochuo -扩大kuoda -括号kuohao -扩建kuojian -阔气kuoqi -扩展kuozhan -扩张kuozhang -哭泣kuqi -酷暑kushu -苦头kutou -苦维kuwei -枯萎kuwei -酷刑kuxing -苦于kuyu -枯燥kuzao -可想而知kxez -科学家kxj -科学技术kxjs -可行性kxx -科学院kxy -科研部kyb -开源节流kyjl -看样子kyz -了l -来l -量l -理l -路l -里l -论l -两l -利l -领l -流l -力l -立l -料l -连l -老l -六l -轮l -类l -列l -拉la -落*la -啦la -蜡la -腊la -蓝la -垃la -喇la -辣la -剌la -邋la -旯la -砬la -瘌la -喇叭laba -来lai -赖lai -莱lai -崃lai -徕lai -涞lai -濑lai -赉lai -睐lai -铼lai -癞lai -籁lai -来宾laibin -来到laidao -来犯laifan -来访laifang -来函laihan -来回laihui -来历laili -来临lailin -赖皮laipi -来日lairi -来势laishi -来头laitou -来往laiwang -来信laixin -来源laiyuan -来者laizhe -来自laizi -癞子laizi -辣椒lajiao -拉拢lalong -喇嘛lama -腊梅lamei -兰lan -烂lan -蓝lan -览lan -栏lan -婪lan -拦lan -篮lan -阑lan -澜lan -谰lan -揽lan -懒lan -缆lan -滥lan -岚lan -漤lan -榄lan -斓lan -罱lan -镧lan -褴lan -蓝本lanben -懒怠landai -滥调landiao -懒惰landuo -浪lang -朗lang -郎lang -狼lang -琅lang -榔lang -廊lang -莨lang -蒗lang -啷lang -阆lang -锒lang -稂lang -螂lang -栏杆langan -狼狈langbei -浪潮langchao -浪荡langdang -朗读langdu -浪费langfei -狼藉langji -浪漫langman -朗诵langsong -郎中langzhong -兰花lanhua -拦截lanjie -烂漫lanman -懒散lansan -蓝色lanse -缆绳lansheng -烂熟lanshu -蓝天lantian -蓝图lantu -阑尾lanwei -拦腰lanyao -滥用lanyong -兰州lanzhou -老lao -劳lao -落*lao -牢lao -涝lao -捞lao -络*lao -佬lao -姥lao -酪lao -烙lao -潦*lao -唠lao -崂lao -栳lao -铑lao -铹lao -痨lao -耢lao -醪lao -老板laoban -老伴laoban -老本laoben -劳动laodong -牢固laogu -老汉laohan -老化laohua -牢记laoji -劳驾laojia -牢靠laokao -劳苦laoku -牢牢laolao -劳累laolei -劳力laoli -老练laolian -牢笼laolong -劳模laomo -老年laonian -老人laoren -牢骚laosao -老少laoshao -老是laoshi -老实laoshi -老师laoshi -老乡laoxiang -老爷laoye -烙印laoyin -劳支laozhi -劳资laozi -劳作laozuo -腊月layue -狼狈不堪lbbk -力不从心lbcx -来不及lbj -来不了lbl -了不起lbq -劳动保险ldbx -来得及ldj -劳动量ldl -劳动力ldl -灵丹妙药ldmy -拉丁美洲ldmz -劳动者ldz -劳动致富ldzf -了le -乐le -勒le -肋le -仂le -叻le -泐le -鳓le -乐观leguan -类lei -雷lei -累lei -勒*lei -垒lei -泪lei -镭lei -蕾lei -磊lei -儡lei -擂lei -肋lei -羸lei -诔lei -嘞lei -嫘lei -缧lei -檑lei -耒lei -酹lei -类别leibie -类次leici -雷达leida -雷管leiguan -泪痕leihen -泪花leihua -累积leiji -累计leiji -累进leijin -磊落leiluo -累年leinian -类似leisi -擂台leitai -雷同leitong -类推leitui -类型leixing -雷雨leiyu -累月leiyue -累赘leizhui -勒令leling -冷leng -棱leng -楞leng -塄leng -愣leng -冷藏lengcang -冷淡lengdan -冷宫lenggong -棱角lengjiao -冷静lengjing -冷落lengluo -冷门lengmen -冷漠lengmo -冷暖lengnuan -冷僻lengpi -冷气lengqi -冷却lengque -冷水lengshui -冷遇lengyu -乐趣lequ -勒索lesuo -乐意leyi -乐园leyuan -两个文明lgwm -拉关系lgx -联合国lhg -联合会lhh -两回事lhs -联合体lht -理li -里li -利li -力li -立li -离li -例li -历li -粒li -厘li -礼li -李li -隶li -黎li -璃li -励li -犁li -梨li -丽li -厉li -篱li -狸li -漓li -鲤li -莉li -荔li -吏li -栗li -砾li -傈li -俐li -痢li -沥li -哩li -鬲*li -俪li -俚li -郦li -坜li -苈li -莅li -蓠li -藜li -呖li -唳li -喱li -猁li -悝*li -溧li -澧li -逦li -娌li -嫠li -骊li -缡li -枥li -栎li -轹li -戾li -砺li -詈li -罹li -锂li -鹂li -疠li -疬li -蛎li -蜊li -蠡li -笠li -篥li -粝li -醴li -跞li -雳li -鲡li -鳢li -黧li -俩lia -连lian -联lian -练lian -炼lian -脸lian -链lian -莲lian -镰lian -廉lian -怜lian -涟lian -帘lian -敛lian -恋lian -蔹lian -奁lian -潋lian -濂lian -琏lian -楝lian -殓lian -臁lian -裢lian -裣lian -蠊lian -鲢lian -立案lian -恋爱lianai -联邦lianbang -练兵lianbing -联播lianbo -练达lianda -连队liandui -量liang -两liang -粮liang -良liang -亮liang -梁liang -凉liang -辆liang -粱liang -晾liang -谅liang -墚liang -莨*liang -椋liang -踉liang -靓liang -魉liang -炼钢liangang -两半liangban -量变liangbian -两边liangbian -两便liangbian -两侧liangce -两次liangci -两地liangdi -两点liangdian -量度liangdu -良方liangfang -两广liangguang -良好lianghao -两极liangji -良机liangji -谅解liangjie -量具liangju -凉快liangkuai -两立liangli -两面liangmian -练功liangong -两栖liangqi -两讫liangqi -两全liangquan -粮食liangshi -两手liangshou -凉爽liangshuang -亮堂liangtang -两条liangtiao -两头liangtou -连贯lianguan -联贯lianguan -亮相liangxiang -良心liangxin -两性liangxing -量刑liangxing -两样liangyang -粮油liangyou -良缘liangyuan -粮站liangzhan -两者liangzhe -两重liangzhong -良种liangzhong -量子liangzi -联合lianhe -联欢lianhuan -廉价lianjia -联结lianjie -连接lianjie -联接lianjie -廉洁lianjie -联军lianjun -连累lianlei -联络lianluo -连忙lianmang -联盟lianmeng -怜悯lianmin -连年liannian -脸谱lianpu -连日lianri -炼乳lianru -联赛liansai -脸色lianse -连锁liansuo -练武lianwu -联系lianxi -练习lianxi -怜惜lianxi -联想lianxiang -连续lianxu -涟漪lianyi -联姻lianyin -联营lianying -炼油lianyou -联运lianyun -连载lianzai -了*liao -料liao -疗liao -辽liao -僚liao -撩liao -聊liao -燎liao -寥liao -潦liao -撂liao -镣liao -廖liao -蓼liao -尥liao -嘹liao -獠liao -寮liao -缭liao -钌liao -鹩liao -撩拨liaobo -潦草liaocao -疗程liaocheng -料到liaodao -潦倒liaodao -料定liaoding -了结liaojie -了解liaojie -辽阔liaokuo -料理liaoli -寥寥liaoliao -寥落liaoluo -辽宁liaoning -了却liaoque -了事liaoshi -聊天liaotian -料想liaoxiang -疗养liaoyang -礼拜libai -利弊libi -里边libian -理财licai -理睬licai -立场lichang -里程licheng -历程licheng -立春lichun -历次lici -历代lidai -理当lidang -立冬lidong -列lie -裂lie -烈lie -劣lie -猎lie -冽lie -埒lie -捩lie -咧lie -洌lie -趔lie -躐lie -鬣lie -裂变liebian -列车lieche -列出liechu -列岛liedao -裂缝liefeng -列国lieguo -烈火liehuo -劣迹lieji -列举lieju -裂开liekai -裂口liekou -列宁liening -猎奇lieqi -列强lieqiang -猎取liequ -烈日lieri -列入lieru -劣绅lieshen -烈士lieshi -劣势lieshi -烈属lieshu -裂纹liewen -列席liexi -烈性liexing -立法lifa -立方lifang -礼服lifu -立功ligong -利害lihai -厉害lihai -理化lihua -礼花lihua -理会lihui -离婚lihun -立即liji -理解lijie -礼节lijie -历届lijie -力矩liju -离开likai -理科like -立刻like -理亏likui -历来lilai -历历lili -力量liliang -利率lilu -理论lilun -立论lilun -礼貌limao -里面limian -利民limin -黎民limin -黎明liming -林lin -磷lin -临lin -邻lin -淋lin -麟lin -琳lin -霖lin -鳞lin -凛lin -赁lin -吝lin -蔺lin -啉lin -嶙lin -廪lin -懔lin -遴lin -檩lin -辚lin -膦lin -瞵lin -粼lin -躏lin -淋巴linba -临别linbie -淋病linbing -林场linchang -临床linchuang -临到lindao -领ling -另ling -零ling -令ling -灵ling -岭ling -铃ling -龄ling -凌ling -棱*ling -陵ling -拎ling -玲ling -菱ling -伶ling -羚ling -酃ling -苓ling -呤ling -囹ling -泠ling -绫ling -柃ling -棂ling -瓴ling -聆ling -蛉ling -翎ling -鲮ling -令爱lingai -凌晨lingchen -灵丹lingdan -领导lingdao -领地lingdi -零点lingdian -领队lingdui -灵感linggan -领海linghai -领航linghang -领会linghui -灵魂linghun -灵活linghuo -灵机lingji -零件lingjian -领教lingjiao -灵杰lingjie -领空lingkong -凌空lingkong -玲珑linglong -零乱lingluan -凌乱lingluan -领略linglue -灵敏lingmin -陵墓lingmu -灵巧lingqiao -领取lingqu -令人lingren -凌辱lingru -零散lingsan -领事lingshi -领受lingshou -领司lingsi -零碎lingsui -灵堂lingtang -零头lingtou -领土lingtu -磷光linguang -另外lingwai -领悟lingwu -领先lingxian -领衔lingxian -零星lingxing -领袖lingxiu -另选lingxuan -灵验lingyan -领域lingyu -令尊lingzun -磷火linhuo -历年linian -临界linjie -临近linjin -邻近linjin -邻里linli -淋漓linli -凛冽linlie -临摹linmo -里弄linong -鳞伤linshang -临时linshi -临死linsi -吝惜linxi -临行linxing -林业linye -临战linzhan -临终linzhong -礼炮lipao -李鹏lipeng -礼品lipin -力气liqi -离奇liqi -力求liqiu -立秋liqiu -历任liren -例如liru -利润lirun -离散lisan -理事lishi -历史lishi -隶属lishu -礼堂litang -立体liti -例题liti -力图litu -流liu -六liu -留liu -刘liu -硫liu -柳liu -陆*liu -馏liu -瘤liu -溜liu -琉liu -榴liu -碌*liu -浏liu -遛liu -骝liu -绺liu -旒liu -熘liu -锍liu -镏liu -鹨liu -鎏liu -留步liubu -流产liuchan -流畅liuchang -流程liucheng -流传liuchuan -流窜liucuan -流动liudong -流毒liudu -流放liufang -六届liujie -浏览liulan -流利liuli -留恋liulian -流露liulu -流落liuluo -流氓liumang -留念liunian -流失liushi -流逝liushi -流体liuti -流通liutong -流亡liuwang -流泻liuxie -留心liuxin -流行liuxing -流星liuxing -留学liuxue -流血liuxue -流言liuyan -留言liuyan -留洋liuyang -留影liuying -留用liuyong -流域liuyu -六月liuyue -流转liuzhuan -例外liwai -礼物liwu -利息lixi -立夏lixia -理想lixiang -立新lixin -离心lixin -理性lixing -力行lixing -厉行lixing -离休lixiu -立意liyi -利益liyi -离异liyi -利用liyong -理由liyou -力争lizheng -立正lizheng -理智lizhi -立志lizhi -离职lizhi -例子lizi -粒子lizi -立足lizu -屡见不鲜ljbx -两极分化ljfh -逻辑设计ljsj -逻辑思维ljsw -逻辑性ljx -灵机一动ljyd -落落大方lldf -拦路虎llh -来龙去脉llqm -零零碎碎llss -来来往往llww -联绵不断lmbd -灵敏度lmd -辽宁省lns -列宁主义lnzy -龙long -垄long -弄*long -笼long -隆long -聋long -咙long -窿long -拢long -陇long -垅long -茏long -泷long -珑long -栊long -胧long -砻long -癃long -隆冬longdong -垄断longduan -隆隆longlong -笼络longluo -笼统longtong -笼罩longzhao -隆重longzhong -漏lou -露*lou -楼lou -娄lou -搂lou -篓lou -陋lou -偻lou -蒌lou -喽lou -嵝lou -镂lou -瘘lou -耧lou -蝼lou -髅lou -漏洞loudong -漏斗loudou -镂空loukong -漏网louwang -来日方长lrfc -来人来函lrlh -了如指掌lrzz -理所当然lsdr -连锁反应lsfy -领事馆lsg -理事会lsh -力所能及lsnj -拉萨市lss -流水线lsx -良师益友lsyy -路lu -六*lu -率lu -露lu -绿lu -炉lu -律lu -虑lu -滤lu -陆lu -氯lu -鲁lu -铝lu -录lu -旅lu -卢lu -吕lu -芦lu -颅lu -庐lu -掳lu -卤lu -虏lu -麓lu -碌lu -赂lu -鹿lu -潞lu -禄lu -戮lu -驴lu -侣lu -履lu -屡lu -缕lu -垆lu -蓼*lu -撸lu -噜lu -闾lu -泸lu -渌lu -漉lu -逯lu -璐lu -栌lu -榈lu -橹lu -轳lu -辂lu -辘lu -氇lu -胪lu -膂lu -镥lu -稆lu -鸬lu -鹭lu -褛lu -簏lu -舻lu -鲈lu -卵luan -乱luan -峦luan -挛luan -孪luan -滦luan -脔luan -娈luan -栾luan -鸾luan -銮luan -卵巢luanchao -乱伦luanlun -乱子luanzi -旅伴luban -路标lubiao -路程lucheng -旅程lucheng -露出luchu -屡次luci -陆地ludi -露底ludi -旅店ludian -略lue -掠lue -锊lue -掠夺lueduo -旅费lufei -露骨lugu -旅馆luguan -路过luguo -绿化luhua -炉火luhuo -路径lujing -路局luju -陆军lujun -旅客luke -履历luli -率领luling -鲁莽lumang -露面lumian -论lun -轮lun -伦lun -抡lun -仑lun -沦lun -纶lun -囵lun -论处lunchu -轮船lunchuan -论点lundian -论调lundiao -伦敦lundun -轮换lunhuan -论据lunju -轮廓lunkuo -论理lunli -伦理lunli -轮流lunliu -论述lunshu -轮胎luntai -论坛luntan -沦为lunwei -论文lunwen -沦陷lunxian -轮训lunxun -论战lunzhan -论正lunzheng -论证lunzheng -轮轴lunzhou -论著lunzhu -落luo -罗luo -螺luo -洛luo -络luo -逻luo -咯*luo -烙*luo -萝luo -锣luo -箩luo -骡luo -裸luo -骆luo -倮luo -蠃luo -荦luo -捋luo -摞luo -猡luo -泺luo -漯luo -珞luo -椤luo -脶luo -硌*luo -镙luo -瘰luo -雒luo -萝卜luobu -落成luocheng -螺钉luoding -罗汉luohan -落后luohou -落户luohu -逻辑luoji -落空luokong -落款luokuan -箩筐luokuang -罗列luolie -罗马luoma -螺母luomu -罗盘luopan -落泊luopo -落实luoshi -螺栓luoshuan -裸体luoti -骆驼luotuo -罗网luowang -螺纹luowen -落伍luowu -落选luoxuan -螺旋luoxuan -络绎luoyi -录取luqu -路人luren -绿色luse -庐山lushan -旅社lushe -律师lushi -露天lutian -路途lutu -旅途lutu -路线luxian -率先luxian -录像luxiang -旅行luxing -履行luxing -陆续luxu -录音luyin -绿荫luyin -录用luyong -旅游luyou -绿洲luzhou -露珠luzhu -路子luzi -炉子luzi -另行安排lxap -例行公事lxgs -联系人lxr -留学生lxs -另行通知lxtz -林业部lyb -老一辈lyb -另一方面lyfm -劳逸结合lyjh -利用率lyl -老一套lyt -留有余地lyyd -来者不拒lzbj -立足点lzd -老中青lzq -理直气壮lzqz -兰州市lzs -两重性lzx -面m -命m -们m -民m -毛m -没m -米m -明m -马m -么m -每m -门m -名m -磨m -美m -密m -苗m -满m -亩m -目m -呒m -马ma -么*ma -麻ma -吗ma -妈ma -骂ma -嘛ma -码ma -摩*ma -抹*ma -玛ma -蚂ma -唛ma -犸ma -嬷ma -杩ma -蟆ma -马鞍maan -麻痹mabi -马达mada -麻烦mafan -麻纺mafang -马虎mahu -麦mai -脉mai -卖mai -买mai -埋mai -迈mai -劢mai -荬mai -霾mai -买办maiban -脉搏maibo -迈步maibu -埋藏maicang -脉冲maichong -脉动maidong -埋伏maifu -卖国maiguo -脉络mailuo -买卖maimai -卖命maiming -埋没maimo -卖弄mainong -埋头maitou -卖淫maiyin -埋怨maiyuan -埋葬maizang -买帐maizhang -卖座maizuo -马力mali -麻利mali -马路malu -妈妈mama -麻木mamu -满man -慢man -曼man -漫man -蔓man -瞒man -馒man -蛮man -谩man -墁man -幔man -缦man -熳man -镘man -颟man -螨man -鳗man -鞔man -漫长manchang -忙mang -芒mang -盲mang -茫mang -氓mang -莽mang -邙mang -漭mang -硭mang -蟒mang -忙碌manglu -莽莽mangmang -盲目mangmu -茫然mangran -盲人mangren -忙于mangyu -莽原mangyuan -蛮横manheng -漫画manhua -满怀manhuai -谩骂manma -满目manmu -满腔manqiang -蔓延manyan -满意manyi -满载manzai -满足manzu -毛mao -矛mao -冒mao -貌mao -贸mao -帽mao -猫mao -茅mao -锚mao -铆mao -卯mao -茂mao -袤mao -茆mao -峁mao -泖mao -瑁mao -昴mao -牦mao -耄mao -旄mao -懋mao -瞀mao -蟊mao -髦mao -毛病maobing -毛糙maocao -冒充maochong -铆钉maoding -矛盾maodun -冒犯maofan -毛纺maofang -冒号maohao -冒尖maojian -冒进maojin -茅坑maokeng -毛利maoli -冒昧maomei -茂密maomi -冒牌maopai -毛坯maopi -贸然maoran -茂盛maosheng -冒失maoshi -矛头maotou -冒险maoxian -贸易maoyi -冒雨maoyu -毛重maozhong -帽子maozi -马上mashang -马桶matong -码头matou -马戏maxi -麻醉mazui -免不了mbl -明辨是非mbsf -满不在乎mbzh -默不作声mbzs -满城风雨mcfy -目的地mdd -目瞪口呆mdkd -描淡写mdx -么me -麽me -秘而不宣mebx -没mei -每mei -美mei -煤mei -霉mei -酶mei -梅mei -妹mei -眉mei -玫mei -枚mei -媒mei -镁mei -昧mei -寐mei -媚mei -糜*mei -谜*mei -莓mei -嵋mei -猸mei -浼mei -湄mei -楣mei -镅mei -鹛mei -袂mei -魅mei -每次meici -每当meidang -美德meide -没法meifa -每逢meifeng -每个meige -美观meiguan -玫瑰meigui -美国meiguo -美好meihao -美化meihua -媒介meijie -眉睫meijie -枚举meiju -煤矿meikuang -霉烂meilan -魅力meili -美丽meili -美满meiman -眉毛meimao -美貌meimao -妹妹meimei -美妙meimiao -眉目meimu -每年meinian -煤气meiqi -每人meiren -每日meiri -美容meirong -眉梢meishao -每时meishi -美术meishu -媒妁meishuo -煤炭meitan -每天meitian -煤田meitian -美学meixue -没有meiyou -煤油meiyou -美元meiyuan -每月meiyue -没治meizhi -每周meizhou -们men -门men -闷men -扪men -焖men -懑men -钔men -门房menfang -孟meng -猛meng -蒙meng -盟meng -梦meng -萌meng -锰meng -氓*meng -檬meng -勐meng -甍meng -瞢meng -懵meng -朦meng -礞meng -虻meng -蜢meng -蠓meng -艋meng -艨meng -蒙蔽mengbi -萌发mengfa -蒙古menggu -盟国mengguo -梦幻menghuan -蒙混menghun -梦见mengjian -猛进mengjin -梦境mengjing -猛烈menglie -蒙胧menglong -蒙昧mengmei -猛然mengran -萌生mengsheng -猛士mengshi -蒙受mengshou -梦想mengxiang -梦乡mengxiang -猛醒mengxing -萌芽mengya -盟友mengyou -盟约mengyue -猛增mengzeng -门户menhu -门路menlu -门牌menpai -门票menpiao -闷气menqi -门诊menzhen -名副其实mfqs -眉飞色舞mfsw -没关系mgx -蒙古族mgz -蒙混过关mhgg -米mi -密mi -迷mi -蜜mi -秘mi -眯mi -醚mi -靡mi -糜mi -谜mi -弥mi -觅mi -泌mi -幂mi -芈mi -谧mi -蘼mi -咪mi -嘧mi -猕mi -汨mi -宓mi -弭mi -脒mi -祢mi -敉mi -糸mi -縻mi -麋mi -面mian -棉mian -免mian -绵mian -眠mian -冕mian -勉mian -娩mian -缅mian -沔mian -渑mian -湎mian -腼mian -眄mian -面部mianbu -免除mianchu -免得miande -面对miandui -面额miane -棉花mianhua -缅怀mianhuai -面积mianji -面具mianju -面孔miankong -勉励mianli -面临mianlin -面貌mianmao -面面mianmian -绵绵mianmian -面目mianmu -面庞mianpang -面前mianqian -勉强mianqiang -面容mianrong -面色mianse -棉纱miansha -面授mianshou -免税mianshui -面谈miantan -面向mianxiang -免刑mianxing -棉絮mianxu -绵延mianyan -面议mianyi -免疫mianyi -面罩mianzhao -免职mianzhi -面子mianzi -苗miao -秒miao -描miao -庙miao -妙miao -瞄miao -藐miao -渺miao -喵miao -邈miao -缈miao -缪miao -杪miao -淼miao -眇miao -鹋miao -秒表miaobiao -描绘miaohui -妙龄miaoling -渺茫miaomang -描摹miaomo -藐视miaoshi -描述miaoshu -苗条miaotiao -苗头miaotou -描写miaoxie -瞄准miaozhun -弥补mibu -谜底midi -密度midu -灭mie -蔑mie -乜*mie -咩mie -蠛mie -篾mie -灭火miehuo -灭迹mieji -灭绝miejue -灭口miekou -蔑视mieshi -灭亡miewang -密封mifeng -蜜蜂mifeng -眯缝mifeng -迷航mihang -迷糊mihu -迷惑mihuo -密集miji -密件mijian -迷津mijin -秘诀mijue -糜烂milan -迷恋milian -密令miling -迷路milu -密码mima -迷漫miman -弥漫miman -秘密mimi -汨汨mimi -谜面mimian -密谋mimou -民min -敏min -抿min -皿min -悯min -闽min -苠min -岷min -闵min -泯min -缗min -玟min -珉min -愍min -黾min -鳘min -民办minban -民兵minbing -民法minfa -民愤minfen -民风minfeng -命ming -明ming -名ming -鸣ming -螟ming -盟*ming -铭ming -冥ming -茗ming -溟ming -暝ming -瞑ming -酩ming -敏感mingan -明白mingbai -名册mingce -名称mingcheng -明处mingchu -名次mingci -名词mingci -名单mingdan -明灯mingdeng -民歌minge -名额minge -名贵minggui -铭记mingji -名家mingjia -铭刻mingke -明快mingkuai -明朗minglang -名利mingli -明亮mingliang -明了mingliao -命令mingling -名流mingliu -明码mingma -明媚mingmei -明明mingming -名目mingmu -明年mingnian -名牌mingpai -名片mingpian -名气mingqi -明确mingque -明人mingren -名人mingren -名胜mingsheng -名声mingsheng -名堂mingtang -明天mingtian -名望mingwang -明文mingwen -明细mingxi -明显mingxian -鸣谢mingxie -明星mingxing -名言mingyan -名义mingyi -名誉mingyu -命运mingyun -明知mingzhi -明智mingzhi -明珠mingzhu -名著mingzhu -名字mingzi -民航minhang -民间minjian -敏捷minjie -民警minjing -民情minqing -敏锐minrui -民事minshi -民心minxin -民意minyi -民用minyong -民运minyun -民政minzheng -民众minzhong -民主minzhu -民族minzu -密切miqie -迷人miren -迷失mishi -秘书mishu -密探mitan -迷途mitu -谬miu -谬论miulun -谬误miuwu -迷惘miwang -迷雾miwu -迷信mixin -密友miyou -谜语miyu -蜜月miyue -马克思mks -眉开眼笑mkyx -马列主义mlzy -满面春风mmcf -马马虎虎mmhh -面面俱到mmjd -莫名其妙mmqm -默默无闻mmww -明目张胆mmzd -无*mo -磨mo -没*mo -万*mo -末mo -模mo -膜mo -摸mo -墨mo -摩mo -脉*mo -莫mo -抹mo -冒*mo -默mo -貉*mo -嘿*mo -摹mo -蘑mo -魔mo -沫mo -漠mo -寞mo -陌mo -谟mo -茉mo -蓦mo -馍mo -嫫mo -殁mo -镆mo -秣mo -瘼mo -耱mo -貊mo -貘mo -默哀moai -莫不mobu -磨擦moca -摩擦moca -磨蹭moceng -莫大moda -磨刀modao -摩登modeng -摸底modi -模范mofan -模仿mofang -摹仿mofang -莫非mofei -魔鬼mogui -模糊mohu -墨迹moji -模块mokuai -磨砺moli -磨练molian -末了moliao -末路molu -没落moluo -磨灭momie -默默momo -磨难monan -模拟moni -摹拟moni -末期moqi -默契moqi -默然moran -漠然moran -默认moren -末日mori -莫如moru -抹杀mosha -抹煞mosha -末梢moshao -陌生mosheng -模式moshi -没收moshou -魔术moshu -磨损mosun -摸索mosuo -模特mote -摩托motuo -某mou -谋mou -牟mou -侔mou -哞mou -缪*mou -眸mou -蛑mou -蝥mou -鍪mou -某地moudi -某个mouge -谋害mouhai -谋划mouhua -某军moujun -牟利mouli -谋略moulue -谋求mouqiu -牟取mouqu -谋杀mousha -谋生mousheng -某些mouxie -末尾mowei -默写moxie -模型moxing -默许moxu -模样moyang -魔掌mozhang -模子mozi -妙趣横生mqhs -门市部msb -名胜古迹msgj -妙手回春mshc -莫斯科msk -没什么msm -每时每刻msmk -秘书长msz -没事找事mszs -摩托车mtc -埋头工作mtgz -埋头苦干mtkg -亩mu -目mu -木mu -母mu -墓mu -模*mu -幕mu -牧mu -姆mu -穆mu -姥*mu -牟*mu -拇mu -牡mu -暮mu -募mu -慕mu -睦mu -仫mu -坶mu -苜mu -沐mu -毪mu -钼mu -母爱muai -墓碑mubei -目标mubiao -木材mucai -牧草mucao -目测muce -牧场muchang -目次muci -牡丹mudan -目的mudi -牧歌muge -目光muguang -幕后muhou -目击muji -募集muji -木刻muke -木料muliao -幕僚muliao -目录mulu -牧民mumin -木讷mune -木偶muou -目前muqian -母亲muqin -牧区muqu -木然muran -暮色muse -牧师mushi -目送musong -牧童mutong -牧业muye -沐浴muyu -民意测验mycy -贸易市场mysc -贸易协定myxd -民政部mzb -美中不足mzbz -毛泽东mzd -满载而归mzeg -明知故犯mzgf -毛织品mzp -目中无人mzwr -毛主席mzx -年n -能n -内n -那n -农n -你n -南n -难n -呢n -女n -泥n -哪n -拿n -念n -牛n -宁n -脑n -粘n -尼n -纳n -嗯n -那na -南na -哪na -拿na -纳na -呢*na -钠na -呐na -娜na -捺na -肭na -镎na -衲na -那边nabian -纳粹nacui -哪儿naer -那个nage -哪个nage -呐喊nahan -哪会nahui -耐nai -哪*nai -奶nai -乃nai -氖nai -奈nai -鼐nai -艿nai -萘nai -柰nai -耐烦naifan -奈何naihe -耐久naijiu -耐劳nailao -奶奶nainai -耐心naixin -耐性naixing -耐用naiyong -奶油naiyou -乃至naizhi -那里nali -哪里nali -那么name -南nan -难nan -男nan -喃nan -囝nan -囡nan -楠nan -腩nan -蝻nan -赧nan -难办nanban -南北nanbei -南边nanbian -难产nanchan -南昌nanchang -难处nanchu -难道nandao -难得nande -难点nandian -难度nandu -哪能naneng -南方nanfang -南非nanfei -难分nanfen -南风nanfeng -囊nang -攮nang -囔nang -馕nang -曩nang -囊括nangkuo -难怪nanguai -难关nanguan -南国nanguo -难过nanguo -南海nanhai -南货nanhuo -南极nanji -难解nanjie -南京nanjing -难看nankan -难堪nankan -南面nanmian -难免nanmian -难民nanmin -南宁nanning -男女nannu -赧然nanran -男人nanren -难色nanse -难事nanshi -难受nanshou -难说nanshuo -难题nanti -难听nanting -难为nanwei -男性nanxing -南亚nanya -南洋nanyang -难以nanyi -难友nanyou -难于nanyu -脑nao -闹nao -努*nao -挠nao -恼nao -淖nao -孬nao -垴nao -呶nao -猱nao -瑙nao -硇nao -铙nao -蛲nao -脑袋naodai -脑海naohai -恼火naohuo -脑筋naojin -闹剧naoju -闹事naoshi -哪怕napa -纳入naru -那时nashi -拿手nashou -纳税nashui -那些naxie -哪些naxie -纳新naxin -那样nayang -哪样nayang -那种nazhong -年产量ncl -农产品ncp -南昌市ncs -难道说nds -呢ne -哪*ne -呐*ne -讷ne -内nei -那*nei -哪*nei -馁nei -内部neibu -内存neicun -内地neidi -内阁neige -内涵neihan -内行neihang -内奸neijian -内疚neijiu -内科neike -内乱neiluan -内幕neimu -内勤neiqin -内容neirong -内外neiwai -内销neixiao -内心neixin -内因neiyin -内应neiying -内在neizai -嫩nen -恁nen -能neng -能动nengdong -能否nengfou -能干nenggan -能够nenggou -能力nengli -能量nengliang -能耐nengnai -能人nengren -能手nengshou -能源nengyuan -能者nengzhe -农副产品nfcp -年富力强nflq -能工巧匠ngqj -你ni -泥ni -尼ni -呢*ni -逆ni -拟ni -尿ni -妮ni -霓ni -倪ni -匿ni -腻ni -溺ni -伲ni -坭ni -猊ni -怩ni -昵ni -旎ni -祢*ni -慝ni -睨ni -铌ni -鲵ni -年nian -念nian -粘nian -蔫nian -拈nian -碾nian -撵nian -捻nian -酿nian -廿nian -埝nian -辇nian -黏nian -鲇nian -鲶nian -年初nianchu -年代niandai -念叨niandao -年底niandi -年度niandu -年份nianfen -娘niang -年华nianhua -年画nianhua -年级nianji -年纪nianji -年鉴nianjian -年来nianlai -年利nianli -年历nianli -拈量nianliang -年龄nianling -年迈nianmai -年年niannian -年青nianqing -年轻nianqing -年岁niansui -年头niantou -念头niantou -年限nianxian -年月nianyue -酿造nianzao -年终nianzhong -尿niao -鸟niao -溺*niao -茑niao -嬲niao -脲niao -袅niao -鸟瞰niaokan -逆差nicha -你处nichu -你的nide -拟定niding -拟订niding -镍nie -啮nie -涅nie -捏nie -聂nie -孽nie -镊nie -乜nie -陧nie -蘖nie -嗫nie -颞nie -臬nie -蹑nie -捏造niezao -腻烦nifan -泥浆nijiang -逆境nijing -泥坑nikeng -逆流niliu -你们nimen -您nin -宁ning -凝ning -拧ning -柠ning -狞ning -泞ning -佞ning -苎ning -咛ning -甯ning -聍ning -凝固ninggu -凝结ningjie -宁静ningjing -凝聚ningju -宁可ningke -宁肯ningken -宁日ningri -凝视ningshi -凝望ningwang -宁夏ningxia -宁愿ningyuan -泥泞nining -泥塑nisu -牛niu -扭niu -钮niu -纽niu -拗*niu -狃niu -忸niu -妞niu -纽带niudai -牛犊niudu -纽扣niukou -纽约niuyue -扭转niuzhuan -腻味niwei -你我niwo -拟议niyi -泥沼nizhao -逆转nizhuan -难解难分njnf -南京市njs -南极洲njz -扭亏为盈nkwy -脑力劳动nlld -年老体弱nltr -内蒙古nmg -农贸市场nmsc -那么些nmx -那么样nmy -念念不忘nnbw -难能可贵nnkg -南宁市nns -农nong -弄nong -浓nong -脓nong -侬nong -哝nong -脓包nongbao -农村nongcun -浓度nongdu -农妇nongfu -浓厚nonghou -农会nonghui -农活nonghuo -农具nongju -农历nongli -农林nonglin -农忙nongmang -农民nongmin -弄清nongqing -农时nongshi -农药nongyao -农业nongye -农艺nongyi -浓郁nongyu -耨nou -年轻化nqh -年轻人nqr -那时候nsh -能说会道nshd -南斯拉夫nslf -能上能下nsnx -逆水行舟nsxz -农田水利ntsl -女nu -奴nu -努nu -怒nu -弩nu -胬nu -孥nu -驽nu -恧nu -钕nu -衄nu -暖nuan -暖和nuanhe -暖流nuanliu -暖气nuanqi -奴婢nubi -奴才nucai -虐nue -虐待nuedai -虐疾nueji -女儿nuer -女工nugong -怒吼nuhou -奴化nuhua -怒火nuhuo -努力nuli -奴隶nuli -诺nuo -娜*nuo -挪nuo -懦nuo -糯nuo -傩nuo -搦nuo -喏nuo -锘nuo -挪用nuoyong -奴仆nupu -女人nuren -女色nuse -女士nushi -女性nuxing -女婿nuxu -女子nuzi -能文能武nwnw -弄虚作假nxzj -农作物nzw -你争我夺nzwd -欧o -偶o -哦o -鸥o -殴o -藕o -呕o -沤o -讴o -噢o -怄o -瓯o -耦o -偶然性orx -区*ou -欧ou -偶ou -鸥ou -殴ou -藕ou -呕ou -沤ou -讴ou -怄ou -瓯ou -耦ou -殴打ouda -偶尔ouer -讴歌ouge -偶合ouhe -耦合ouhe -欧姆oumu -怄气ouqi -偶然ouran -藕色ouse -偶数oushu -呕吐outu -欧阳ouyang -欧洲ouzhou -批p -平p -判p -配p -片p -派p -破p -排p -品p -皮p -喷p -盘p -偏p -评p -怕p -培p -普p -贫p -跑p -炮p -怕pa -派pa -爬pa -帕pa -扒*pa -耙*pa -啪pa -趴pa -琶pa -葩pa -杷pa -钯*pa -筢pa -派pai -排pai -拍pai -牌pai -迫*pai -哌pai -徘pai -湃pai -俳pai -蒎pai -排版paiban -拍板paiban -排比paibi -派别paibie -排场paichang -排斥paichi -排除paichu -排队paidui -牌号paihao -徘徊paihuai -排挤paiji -牌价paijia -排列pailie -拍卖paimai -派遣paiqian -排球paiqiu -派生paisheng -派头paitou -排外paiwai -排泄paixie -排演paiyan -牌照paizhao -判pan -盘pan -叛pan -番*pan -潘pan -攀pan -磐pan -盼pan -畔pan -胖pan -拚*pan -爿pan -泮pan -袢pan -襻pan -蟠pan -蹒pan -叛变panbian -判别panbie -盘缠panchan -盘存pancun -叛党pandang -攀登pandeng -盘点pandian -判定panding -判断panduan -攀附panfu -旁pang -膀*pang -磅*pang -乓pang -庞pang -耪pang -胖pang -彷pang -滂pang -逄pang -螃pang -旁边pangbian -庞大pangda -盘亘pangen -旁观pangguan -旁听pangting -旁通pangtong -滂沱pangtuo -庞杂pangza -盘踞panju -判决panjue -叛乱panluan -判明panming -叛逆panni -盘算pansuan -蟠桃pantao -叛徒pantu -盼望panwang -判刑panxing -盘旋panxuan -跑pao -炮pao -刨pao -抛pao -泡pao -咆pao -袍pao -匏pao -狍pao -庖pao -脬pao -疱pao -炮兵paobing -跑步paobu -炮弹paodan -跑道paodao -抛光paoguang -炮火paohuo -炮击paoji -抛锚paomao -泡沫paomo -抛弃paoqi -炮手paoshou -炮台paotai -炮艇paoting -咆哮paoxiao -泡影paoying -炮仗paozhang -炮制paozhi -怕死pasi -疲惫不堪pbbk -迫不急待pbjd -破除迷信pcmx -平等互利pdhl -配pei -培pei -陪pei -胚pei -呸pei -裴pei -赔pei -佩pei -沛pei -辔pei -帔pei -旆pei -锫pei -醅pei -霈pei -陪伴peiban -配备peibei -赔本peiben -赔偿peichang -陪衬peichen -配方peifang -佩服peifu -配合peihe -配给peiji -配件peijian -配角peijiao -赔款peikuan -赔礼peili -配偶peiou -陪审peishen -陪送peisong -胚胎peitai -配套peitao -陪同peitong -培训peixun -培养peiyang -配音peiyin -培育peiyu -配乐peiyue -陪葬peizang -配制peizhi -配置peizhi -培植peizhi -喷pen -盆pen -湓pen -盆地pendi -碰peng -棚peng -蓬peng -朋peng -捧peng -膨peng -砰peng -抨peng -烹peng -澎peng -彭peng -硼peng -篷peng -鹏peng -堋peng -嘭peng -怦peng -蟛peng -碰杯pengbei -碰壁pengbi -蓬勃pengbo -捧场pengchang -抨击pengji -蓬莱penglai -蓬乱pengluan -澎湃pengpai -烹饪pengren -硼砂pengsha -蓬松pengsong -烹调pengtiao -朋友pengyou -膨胀pengzhang -喷溅penjian -盆景penjing -喷射penshe -喷嚏penti -平方公里pfgl -平分秋色pfqs -批pi -皮pi -坏*pi -否*pi -辟*pi -坯pi -脾pi -疲pi -砒pi -霹pi -披pi -劈pi -琵pi -毗pi -啤pi -匹pi -痞pi -僻pi -屁pi -譬pi -丕pi -仳pi -陂*pi -陴pi -邳pi -郫pi -圮pi -埤*pi -鼙pi -芘pi -擗pi -吡*pi -噼pi -庀pi -淠pi -媲pi -纰pi -枇pi -甓pi -睥pi -罴pi -铍pi -癖pi -裨*pi -疋pi -蚍pi -蜱pi -貔pi -片pian -偏pian -便*pian -篇pian -骗pian -扁*pian -谝pian -骈pian -缏*pian -犏pian -胼pian -翩pian -蹁pian -偏差piancha -片断pianduan -片段pianduan -偏废pianfei -篇幅pianfu -偏激pianji -偏见pianjian -骗局pianju -片刻pianke -偏离pianli -片面pianmian -偏旁pianpang -偏僻pianpi -偏颇pianpo -骗取pianqu -骗人pianren -骗术pianshu -偏袒piantan -翩跹pianxian -偏向pianxiang -偏移pianyi -便宜pianyi -篇章pianzhang -骗子pianzi -票piao -漂piao -朴*piao -飘piao -瓢piao -剽piao -莩*piao -嘌piao -嫖piao -骠*piao -缥piao -殍piao -瞟piao -螵piao -漂泊piaobo -票房piaofang -漂浮piaofu -票价piaojia -票据piaoju -漂亮piaoliang -漂流piaoliu -飘流piaoliu -飘落piaoluo -票面piaomian -飘渺piaomiao -飘泊piaopo -剽窃piaoqie -飘然piaoran -飘散piaosan -飘扬piaoyang -飘游piaoyou -疲惫pibei -批驳pibo -撇pie -瞥pie -丿pie -苤pie -氕pie -批发pifa -批复pifu -皮肤pifu -皮革pige -屁股pigu -疲倦pijuan -疲劳pilao -纰漏pilou -披露pilu -品pin -贫pin -频pin -拼pin -苹pin -聘pin -拚pin -姘pin -嫔pin -榀pin -牝pin -颦pin -品尝pinchang -频传pinchuan -拼凑pincou -频带pindai -频道pindao -品德pinde -贫乏pinfa -频繁pinfan -平ping -评ping -瓶ping -凭ping -苹ping -冯*ping -乒ping -坪ping -萍ping -屏ping -俜ping -娉ping -枰ping -鲆ping -平安pingan -评比pingbi -屏蔽pingbi -平常pingchang -平川pingchuan -平淡pingdan -平等pingdeng -平地pingdi -平定pingding -评定pingding -品格pinge -平反pingfan -平凡pingfan -平方pingfang -平分pingfen -评分pingfen -评功pinggong -平衡pingheng -评级pingji -平价pingjia -评价pingjia -评奖pingjiang -凭借pingjie -平静pingjing -平均pingjun -平空pingkong -凭空pingkong -评理pingli -评论pinglun -平面pingmian -平民pingmin -屏幕pingmu -评判pingpan -乒乓pingpang -平平pingping -平壤pingrang -平日pingri -平时pingshi -平手pingshou -评说pingshuo -平素pingsu -平坦pingtan -乒坛pingtan -平稳pingwen -平息pingxi -萍乡pingxiang -平行pingxing -平易pingyi -评议pingyi -平庸pingyong -平原pingyuan -平仄pingze -屏障pingzhang -凭着pingzhe -平整pingzheng -凭证pingzheng -评注pingzhu -贫寒pinhan -品级pinji -贫困pinkun -频率pinlu -品貌pinmao -拼命pinming -品名pinming -品评pinping -聘请pinqing -贫穷pinqiong -聘任pinren -聘书pinshu -拼写pinxie -品行pinxing -品性pinxing -拼音pinyin -品质pinzhi -品种pinzhong -批判pipan -匹配pipei -批评piping -脾气piqi -譬如piru -疲软piruan -批示pishi -脾胃piwei -脾性pixing -辟谣piyao -批语piyu -批阅piyue -批注pizhu -批准pizhun -平均数pjs -披荆斩棘pjzj -评论员ply -跑马观花pmgh -破po -迫po -坡po -泼po -繁*po -朴*po -泊*po -颇po -婆po -魄po -粕po -叵po -陂*po -鄱po -泺*po -珀po -攴po -钋po -钷po -钹*po -皤po -笸po -破案poan -破产pochan -破除pochu -坡度podu -泼妇pofu -破格poge -迫害pohai -破坏pohuai -破获pohuo -迫近pojin -破旧pojiu -泼辣pola -破烂polan -魄力poli -破例poli -破裂polie -破灭pomie -迫切poqie -迫使poshi -破碎posui -破损posun -破土potu -剖pou -裒pou -掊pou -剖解poujie -剖析pouxi -破绽pozhan -蓬蓬勃勃ppbb -普普通通pptt -旁若无人prwr -普通话pth -抛头露面ptlm -普pu -谱pu -扑pu -埔pu -铺pu -暴*pu -葡pu -朴pu -蒲pu -堡*pu -脯*pu -仆pu -莆pu -菩pu -圃pu -浦pu -曝pu -瀑pu -匍pu -噗pu -溥pu -濮pu -璞pu -氆pu -镤pu -镨pu -蹼pu -普遍pubian -普查pucha -扑哧puchi -扑打puda -铺盖pugai -普及puji -铺平puping -仆人puren -菩萨pusa -铺设pushe -朴实pushi -朴素pusu -葡萄putao -普通putong -扑通putong -铺位puwei -谱写puxie -普选puxuan -铺张puzhang -普照puzhao -朴直puzhi -平易近人pyjr -拼音字母pyzm -铺张浪费pzlf -起q -前q -其q -去q -气q -全q -期q -群q -情q -区q -强q -切q -取q -七q -求q -清q -确q -权q -且q -青q -亲爱的qad -情报所qbs -千百万qbw -千变万化qbwh -取长补短qcbd -千锤百炼qcbl -恰到好处qdhc -全党全军和全国qdqg -取而代之qedz -轻而易举qeyj -千方百计qfbj -清规戒律qgjl -勤工俭学qgjx -旗鼓相当qgxd -轻工业qgy -轻工业部qgyb -勤工助学qgzx -权衡利弊qhlb -骑虎难下qhnx -青海省qhs -青红皂白qhzb -起qi -其qi -气qi -期qi -七qi -器qi -齐qi -奇qi -汽qi -企qi -漆qi -欺qi -旗qi -畦qi -启qi -弃qi -歧qi -稽*qi -缉*qi -栖qi -戚qi -妻qi -凄qi -柒qi -沏qi -棋qi -崎qi -脐qi -祈qi -祁qi -骑qi -岂qi -乞qi -契qi -砌qi -迄qi -泣qi -讫qi -亟*qi -亓qi -俟qi -圻qi -芑qi -芪qi -荠*qi -萁qi -萋qi -葺qi -蕲qi -嘁qi -屺qi -岐qi -岖*qi -汔qi -淇qi -骐qi -绮qi -琪qi -琦qi -杞qi -桤qi -槭qi -耆qi -欹qi -祺qi -憩qi -碛qi -颀qi -蛴qi -蜞qi -綦qi -綮qi -蹊qi -鳍qi -麒qi -卡*qia -恰qia -掐qia -洽qia -伽*qia -葜qia -袷*qia -髂qia -恰当qiadang -恰好qiahao -前qian -千qian -钱qian -浅qian -签qian -迁qian -铅qian -潜qian -牵qian -钳qian -纤*qian -谴qian -扦qian -钎qian -仟qian -谦qian -乾qian -黔qian -遣qian -堑qian -嵌qian -欠qian -歉qian -倩qian -佥qian -阡qian -芊qian -芡qian -茜qian -荨qian -掮qian -岍qian -悭qian -慊qian -骞qian -搴qian -褰qian -缱qian -椠qian -犍*qian -肷qian -愆qian -钤qian -虔qian -箬qian -箝qian -前辈qianbei -前边qianbian -浅薄qianbo -钱财qiancai -欠产qianchan -前程qiancheng -签到qiandao -前敌qiandi -签订qianding -签发qianfa -遣返qianfan -前方qianfang -强qiang -将*qiang -枪qiang -抢qiang -墙qiang -腔qiang -呛qiang -羌qiang -蔷qiang -戕qiang -嫱qiang -樯qiang -戗qiang -炝qiang -锖qiang -锵qiang -镪qiang -襁qiang -蜣qiang -羟qiang -跄qiang -墙壁qiangbi -枪毙qiangbi -强辩qiangbian -强大qiangda -枪弹qiangdan -强盗qiangdao -强调qiangdiao -腔调qiangdiao -强度qiangdu -抢夺qiangduo -强攻qianggong -强国qiangguo -强化qianghua -强加qiangjia -强奸qiangjian -抢劫qiangjie -强劲qiangjin -抢救qiangjiu -枪决qiangjue -强烈qianglie -强迫qiangpo -强权qiangquan -强弱qiangruo -枪杀qiangsha -强盛qiangsheng -千古qiangu -牵挂qiangua -蔷薇qiangwei -抢险qiangxian -强行qiangxing -强硬qiangying -强占qiangzhan -强者qiangzhe -强制qiangzhi -枪支qiangzhi -强壮qiangzhuang -前后qianhou -前进qianjin -前景qianjing -迁就qianjiu -歉疚qianjiu -迁居qianju -乾坤qiankun -千里qianli -前例qianli -潜力qianli -牵连qianlian -前列qianlie -浅陋qianlou -前面qianmian -签名qianming -前年qiannian -前期qianqi -千秋qianqiu -前驱qianqu -欠缺qianque -前人qianren -前任qianren -纤弱qianruo -前哨qianshao -牵涉qianshe -歉收qianshou -签署qianshu -遣送qiansong -前提qianti -前天qiantian -欠条qiantiao -前途qiantu -千瓦qianwa -千万qianwan -前往qianwang -前夕qianxi -纤细qianxi -前线qianxian -浅显qianxian -谦虚qianxu -谦逊qianxun -前言qianyan -前沿qianyan -前夜qianye -歉意qianyi -迁移qianyi -牵引qianyin -潜在qianzai -谴责qianze -前者qianzhe -签证qianzheng -牵制qianzhi -钳制qianzhi -签字qianzi -前奏qianzou -桥qiao -瞧qiao -壳*qiao -巧qiao -敲qiao -乔qiao -蕉qiao -橇qiao -锹qiao -悄qiao -侨qiao -鞘qiao -撬qiao -翘qiao -峭qiao -俏qiao -窍qiao -雀*qiao -劁qiao -诮qiao -谯qiao -荞qiao -峤*qiao -愀qiao -憔qiao -缲*qiao -樵qiao -硗qiao -跷qiao -鞒qiao -侨胞qiaobao -桥墩qiaodun -巧计qiaoji -瞧见qiaojian -侨居qiaoju -桥梁qiaoliang -窍门qiaomen -巧妙qiaomiao -桥牌qiaopai -乔迁qiaoqian -悄然qiaoran -侨务qiaowu -敲诈qiaozha -恰似qiasi -洽谈qiatan -岂不qibu -起步qibu -器材qicai -奇才qicai -凄惨qican -起草qicao -汽车qiche -骑车qiche -启程qicheng -起初qichu -凄楚qichu -其次qici -期待qidai -脐带qidai -岂但qidan -启迪qidi -起点qidian -启动qidong -气度qidu -切qie -且qie -砌*qie -茄qie -怯qie -窃qie -伽*qie -郄qie -惬qie -慊*qie -妾qie -挈qie -锲qie -箧qie -窃案qiean -切断qieduan -切合qiehe -窃据qieju -窃取qiequ -怯弱qieruo -切身qieshen -切实qieshi -切题qieti -窃听qieting -切削qiexiao -惬意qieyi -启发qifa -起飞qifei -岂非qifei -气愤qifen -气氛qifen -欺负qifu -气概qigai -乞丐qigai -岂敢qigan -气功qigong -奇怪qiguai -器官qiguan -旗号qihao -漆黑qihei -气候qihou -期货qihuo -契机qiji -奇迹qiji -期间qijian -起见qijian -器件qijian -七届qijie -迄今qijin -起来qilai -凄凉qiliang -欺凌qiling -气流qiliu -歧路qilu -起码qima -骑马qima -启蒙qimeng -奇妙qimiao -器皿qimin -亲qin -侵qin -勤qin -秦qin -钦qin -琴qin -芹qin -擒qin -禽qin -寝qin -沁qin -芩qin -揿qin -吣qin -嗪qin -噙qin -廑*qin -溱qin -檎qin -锓qin -矜*qin -覃qin -螓qin -衾qin -亲爱qinai -亲笔qinbi -岂能qineng -侵犯qinfan -勤奋qinfen -情qing -清qing -青qing -轻qing -倾qing -请qing -亲*qing -庆qing -氢qing -晴qing -卿qing -擎qing -氰qing -顷qing -苘qing -圊qing -檠qing -磬qing -蜻qing -罄qing -箐qing -綮*qing -謦qing -鲭qing -黥qing -清白qingbai -青白qingbai -情报qingbao -情操qingcao -青草qingcao -清查qingcha -清除qingchu -清楚qingchu -青春qingchun -青翠qingcui -清单qingdan -倾倒qingdao -清点qingdian -情调qingdiao -轻浮qingfu -青工qinggong -青海qinghai -庆贺qinghe -清华qinghua -情怀qinghuai -清还qinghuan -请假qingjia -请柬qingjian -请教qingjiao -情节qingjie -清洁qingjie -情景qingjing -顷刻qingke -晴空qingkong -轻快qingkuai -情况qingkuang -青睐qinglai -晴朗qinglang -情理qingli -清理qingli -轻率qinglu -轻蔑qingmie -青年qingnian -氢气qingqi -轻巧qingqiao -请求qingqiu -情趣qingqu -青山qingshan -请示qingshi -清爽qingshuang -青松qingsong -轻松qingsong -倾诉qingsu -青天qingtian -晴天qingtian -倾听qingting -倾吐qingtu -请问qingwen -倾向qingxiang -倾销qingxiao -情形qingxing -清醒qingxing -情绪qingxu -情谊qingyi -轻易qingyi -轻盈qingying -情愿qingyuan -请愿qingyuan -请战qingzhan -轻重qingzhong -倾注qingzhu -庆祝qingzhu -请罪qingzui -侵害qinhai -勤俭qinjian -亲近qinjin -亲眷qinjuan -勤快qinkuai -勤劳qinlao -亲历qinli -亲临qinlin -侵略qinlue -亲密qinmi -勤勉qinmian -钦佩qinpei -亲戚qinqi -亲切qinqie -亲热qinre -亲人qinren -侵入qinru -亲身qinshen -侵蚀qinshi -寝室qinshi -亲手qinshou -亲属qinshu -侵吞qintun -勤务qinwu -亲信qinxin -亲眼qinyan -亲友qinyou -侵占qinzhan -亲自qinzi -穷qiong -琼qiong -邛qiong -茕qiong -穹qiong -蛩qiong -筇qiong -跫qiong -銎qiong -穷国qiongguo -穷苦qiongku -穷困qiongkun -穹隆qionglong -穷期qiongqi -穷人qiongren -穷途qiongtu -气派qipai -欺骗qipian -气魄qipo -乞求qiqiu -崎岖qiqu -齐全qiquan -凄然qiran -起色qise -气色qise -其实qishi -起始qishi -启事qishi -气势qishi -启示qishi -歧视qishi -奇数qishu -汽水qishui -起诉qisu -其他qita -其它qita -奇特qite -气体qiti -汽艇qiting -企图qitu -歧途qitu -求qiu -球qiu -秋qiu -丘qiu -仇*qiu -龟*qiu -邱qiu -囚qiu -酋qiu -泅qiu -俅qiu -巯qiu -犰qiu -湫qiu -逑qiu -遒qiu -楸qiu -赇qiu -虬qiu -蚯qiu -蝤qiu -裘qiu -糗qiu -鳅qiu -鼽qiu -秋播qiubo -球场qiuchang -囚犯qiufan -秋风qiufeng -秋季qiuji -求教qiujiao -囚禁qiujin -求救qiujiu -丘陵qiuling -秋千qiuqian -求情qiuqing -求全qiuquan -秋色qiuse -求实qiushi -秋收qiushou -秋天qiutian -求学qiuxue -求战qiuzhan -求证qiuzheng -求知qiuzhi -求助qiuzhu -期望qiwang -气味qiwei -气温qiwen -奇闻qiwen -欺侮qiwu -气息qixi -栖息qixi -起先qixian -期限qixian -气象qixiang -器械qixie -齐心qixin -气压qiya -欺压qiya -气焰qiyan -企业qiye -起义qiyi -歧义qiyi -起因qiyin -启用qiyong -汽油qiyou -其余qiyu -起源qiyuan -七月qiyue -契约qiyue -欺诈qizha -气质qizhi -旗帜qizhi -其中qizhong -器重qizhong -旗子qizi -妻子qizi -勤俭建国qjjg -勤俭节约qjjy -迄今为止qjwz -取决于qjy -千钧一发qjyf -旗开得胜qkds -全力以赴qlyf -勤劳致富qlzf -千里之行qlzx -亲密无间qmwj -青年人qnr -千篇一律qpyl -清清楚楚qqcc -勤勤恳恳qqkk -切切实实qqss -确确实实qqss -恰恰相反qqxf -求全责备qqzb -恰如其分qrqf -欺人之谈qrzt -七手八脚qsbj -全神贯注qsgz -全世界qsj -切实可行qskx -切身利益qsly -青少年qsn -前所未闻qsww -前所未有qswy -气势汹汹qsxx -齐头并进qtbj -奇谈怪论qtgl -千头万绪qtwx -前提下qtx -去qu -区qu -取qu -曲qu -且*qu -渠qu -屈qu -趋qu -驱qu -趣qu -蛆qu -躯qu -娶qu -龋qu -戌*qu -诎qu -劬qu -苣*qu -蕖qu -蘧qu -岖qu -衢qu -阒qu -璩qu -觑qu -氍qu -朐qu -祛qu -磲qu -鸲qu -癯qu -蛐qu -蠼qu -麴qu -瞿qu -黢qu -全quan -权quan -圈quan -劝quan -泉quan -醛quan -颧quan -痊quan -拳quan -犬quan -券quan -诠quan -荃quan -悛quan -绻quan -辁quan -畎quan -铨quan -蜷quan -筌quan -鬈quan -全部quanbu -全党quandang -劝导quandao -蜷伏quanfu -劝告quangao -全国quanguo -权衡quanheng -全会quanhui -拳击quanji -劝解quanjie -全局quanju -全军quanjun -全力quanli -权利quanli -权力quanli -全貌quanmao -全面quanmian -劝勉quanmian -全民quanmin -全能quanneng -全年quannian -全盘quanpan -全拼quanpin -全球quanqiu -蜷曲quanqu -全权quanquan -全然quanran -全胜quansheng -权术quanshu -泉水quanshui -劝说quanshuo -圈套quantao -全体quanti -拳头quantou -权威quanwei -劝慰quanwei -全文quanwen -全县quanxian -权限quanxian -全校quanxiao -权益quanyi -权宜quanyi -劝诱quanyou -痊愈quanyu -劝止quanzhi -劝阻quanzu -区别qubie -屈才qucai -驱除quchu -取代qudai -渠道qudao -取得qude -取缔qudi -曲调qudiao -驱动qudong -确que -却que -缺que -炔que -瘸que -鹊que -榷que -雀que -阕que -阙que -悫que -确保quebao -缺点quedian -确定queding -缺乏quefa -缺口quekou -确立queli -确切queqie -确认queren -缺少queshao -缺省quesheng -确实queshi -缺席quexi -缺陷quexian -确信quexin -确凿quezao -瘸子quezi -区分qufen -屈服qufu -躯干qugan -区划quhua -曲解qujie -取经qujing -取决qujue -躯壳quke -取乐qule -群qun -裙qun -逡qun -裙带qundai -群岛qundao -去年qunian -群众qunzhong -区区ququ -屈辱quru -驱散qusan -取舍qushe -取胜qusheng -去世qushi -驱使qushi -趋势qushi -躯体quti -区位quwei -区委quwei -趣味quwei -区县quxian -去向quxiang -趋向quxiang -取消quxiao -取信quxin -曲艺quyi -区域quyu -区长quzhang -曲折quzhe -屈指quzhi -驱逐quzhu -曲子quzi -奇形怪状qxgz -全心全意qxqy -气象台qxt -气象万千qxwq -齐心协力qxxl -岂有此理qycl -前因后果qyhg -情有可原qyky -强有力qyl -求之不得qzbd -取之不尽qzbj -轻重缓急qzhj -气壮山河qzsh -千真万确qzwq -人r -如r -日r -认r -入r -任r -热r -然r -容r -让r -润r -弱r -燃r -染r -壤r -绕r -仁r -溶r -刃r -仍r -然ran -燃ran -染ran -冉ran -苒ran -蚺ran -髯ran -燃点randian -然而raner -让rang -壤rang -嚷rang -瓤rang -攘rang -禳rang -穰rang -让步rangbu -让位rangwei -让贤rangxian -然后ranhou -燃料ranliao -染料ranliao -冉冉ranran -燃烧ranshao -绕rao -扰rao -饶rao -荛rao -娆rao -桡rao -扰乱raoluan -如此而已rcey -人才济济rcjj -热re -若*re -惹re -热爱reai -热潮rechao -热忱rechen -热诚recheng -热带redai -热火rehuo -热量reliang -热烈relie -人ren -认ren -任ren -仁ren -刃ren -忍ren -壬ren -韧ren -妊ren -纫ren -仞ren -荏ren -葚ren -饪ren -轫ren -稔ren -衽ren -热闹renao -人才rencai -人次renci -仁慈renci -认错rencuo -人大renda -韧带rendai -人道rendao -认得rende -认定rending -人防renfang -仍reng -扔reng -扔掉rengdiao -人格renge -仍旧rengjiu -人工rengong -认购rengou -仍然rengran -任何renhe -人家renjia -人间renjian -人杰renjie -认可renke -人口renkou -人类renlei -人力renli -人们renmen -任免renmian -人民renmin -任命renming -忍耐rennai -任凭renping -任期renqi -认清renqing -人权renquan -荏苒renran -忍让renrang -人人renren -人参renshen -人生rensheng -人事renshi -人士renshi -认识renshi -人手renshou -忍受renshou -认输renshu -忍痛rentong -人为renwei -认为renwei -人物renwu -任务renwu -人心renxin -忍心renxin -人选renxuan -任意renyi -仁义renyi -任用renyong -人员renyuan -认帐renzhang -认真renzhen -人质renzhi -任职renzhi -认罪renzui -认作renzuo -热切reqie -热情reqing -惹事reshi -热线rexian -热心rexin -热血rexue -人工合成rghc -热火朝天rhct -如虎添翼rhty -日ri -日报ribao -日本riben -日产richan -日常richang -日程richeng -日光riguang -日后rihou -日记riji -日久rijiu -日历rili -日落riluo -日内rinei -日期riqi -日夜riye -日益riyi -日用riyong -日照rizhao -日中rizhong -日子rizi -软件包rjb -人杰地灵rjdl -人尽其才rjqc -如饥似渴rjsk -日久天长rjtc -任劳任怨rlry -热泪盈眶rlyk -人民币rmb -人民代表大会rmdh -人民日报rmrb -燃眉之急rmzj -容rong -溶rong -荣rong -熔rong -融rong -绒rong -戎rong -茸rong -蓉rong -冗rong -嵘rong -狨rong -榕rong -肜rong -蝾rong -熔点rongdian -容光rongguang -融合ronghe -溶化ronghua -熔化ronghua -融化ronghua -融会ronghui -荣获ronghuo -容积rongji -溶解rongjie -容量rongliang -戎马rongma -容貌rongmao -容纳rongna -融洽rongqia -容忍rongren -荣辱rongru -容身rongshen -绒线rongxian -荣幸rongxing -容许rongxu -荣耀rongyao -溶液rongye -容易rongyi -荣誉rongyu -溶质rongzhi -肉rou -揉rou -柔rou -糅rou -蹂rou -鞣rou -柔和rouhe -肉麻rouma -柔软rouruan -肉体routi -任人为贤rrwx -日日夜夜rryy -人生观rsg -认识论rsl -惹事生非rssf -如上所述rsss -如ru -入ru -儒ru -乳ru -茹ru -蠕ru -孺ru -辱ru -汝ru -褥ru -蓐ru -薷ru -嚅ru -洳ru -溽ru -濡ru -缛ru -铷ru -襦ru -颥ru -软ruan -阮ruan -朊ruan -软骨ruangu -软件ruanjian -软禁ruanjin -软盘ruanpan -如常ruchang -如此ruci -入党rudang -蠕动rudong -乳房rufang -如果ruguo -如何ruhe -瑞rui -锐rui -蕊rui -芮rui -蕤rui -枘rui -睿rui -蚋rui -锐利ruili -瑞雪ruixue -锐意ruiyi -儒家rujia -如今rujin -辱骂ruma -入门rumen -入迷rumi -润run -闰run -润滑runhua -弱ruo -若ruo -偌ruo -弱点ruodian -若干ruogan -若是ruoshi -弱小ruoxiao -如期ruqi -入侵ruqin -如若ruruo -儒生rusheng -入手rushou -如同rutong -如下ruxia -入选ruxuan -如意ruyi -如愿ruyuan -入帐ruzhang -人武部rwb -若无其事rwqs -人言可畏rykw -日用品ryp -若有所思ryss -人之长情rzcq -是s -上s -时s -生s -说s -社s -深s -水s -所s -三s -十s -使s -事s -数s -四s -实s -少s -式s -山s -手s -撒sa -萨sa -洒sa -卅sa -仨sa -挲sa -脎sa -飒sa -撒谎sahuang -塞sai -思*sai -赛sai -腮sai -鳃sai -噻sai -赛车saiche -塞子saizi -撒娇sajiao -三san -散san -叁san -伞san -馓san -毵san -糁san -散步sanbu -散布sanbu -散发sanfa -三废sanfei -桑sang -丧sang -嗓sang -搡sang -磉sang -颡sang -丧命sangming -丧失sangshi -三国sanguo -三好sanhao -散会sanhui -三角sanjiao -三届sanjie -散失sanshi -散文sanwen -三月sanyue -扫sao -梢*sao -搔sao -骚sao -嫂sao -埽sao -缫sao -缲sao -臊sao -瘙sao -鳋sao -扫除saochu -扫荡saodang -扫地saodi -骚动saodong -骚乱saoluan -扫描saomiao -扫墓saomu -骚扰saorao -瘙痒saoyang -扫帚saozhou -洒脱satuo -说不定sbd -舍不得sbd -说不过去sbgq -说不来sbl -数不胜数sbss -素不相识sbxs -身不由己sbyj -上层建筑scjz -生产力scl -生产率scl -水产品scp -四川省scs -市场调节sctj -市场信息scxx -生动活泼sdhp -山东省sds -水电站sdz -色se -塞*se -瑟se -涩se -啬se -铯se -穑se -视而不见sebj -色彩secai -色调sediao -色盲semang -森sen -僧seng -僧侣senglu -森林senlin -森严senyan -色情seqing -瑟瑟sese -十二月sey -色泽seze -司法部sfb -赏罚分明sffm -说服力sfl -手风琴sfq -三番五次sfwc -四个现代化sgxh -手工业sgy -沙sha -杀sha -砂sha -啥sha -纱sha -莎sha -刹sha -傻sha -煞sha -杉sha -厦*sha -唼sha -嗄*sha -挲*sha -歃sha -铩sha -痧sha -裟sha -霎sha -鲨sha -煞白shabai -刹车shache -煞车shache -沙发shafa -傻瓜shagua -沙皇shahuang -色*shai -筛shai -晒shai -晒台shaitai -砂烬shajin -沙龙shalong -沙漠shamo -山shan -单*shan -闪shan -善shan -珊shan -扇shan -陕shan -掸*shan -苫shan -杉shan -删shan -煽shan -衫shan -擅shan -赡shan -膳shan -汕shan -缮shan -栅*shan -剡shan -讪shan -鄯shan -埏shan -芟shan -潸shan -姗shan -嬗shan -骟shan -膻shan -禅*shan -钐shan -疝shan -蟮shan -舢shan -跚shan -鳝shan -刹那shana -山坳shanao -陕北shanbei -擅长shanchang -删除shanchu -山川shanchuan -山地shandi -闪电shandian -扇动shandong -煽动shandong -山东shandong -山峰shanfeng -上shang -商shang -伤shang -尚shang -汤*shang -墒shang -赏shang -晌shang -裳shang -垧shang -绱shang -殇shang -熵shang -觞shang -删改shangai -山岗shangang -山冈shangang -上班shangban -上报shangbao -上边shangbian -商标shangbiao -上部shangbu -上策shangce -上层shangceng -商场shangchang -上次shangci -赏赐shangci -上当shangdang -上等shangdeng -上帝shangdi -商店shangdian -上调shangdiao -商定shangding -上访shangfang -伤感shanggan -上告shanggao -赏光shangguang -上海shanghai -伤害shanghai -商行shanghang -上级shangji -上集shangji -上进shangjin -上空shangkong -上来shanglai -商量shangliang -上流shangliu -上门shangmen -上面shangmian -上年shangnian -山沟shangou -商品shangpin -商洽shangqia -上前shangqian -尚且shangqie -上去shangqu -商榷shangque -商人shangren -上任shangren -上山shangshan -上升shangsheng -赏识shangshi -上述shangshu -上司shangsi -上诉shangsu -商谈shangtan -商讨shangtao -闪光shanguang -上文shangwen -上午shangwu -商务shangwu -上下shangxia -上限shangxian -伤心shangxin -上旬shangxun -上演shangyan -商业shangye -商议shangyi -上映shangying -上游shangyou -上涨shangzhang -上阵shangzhen -山河shanhe -善后shanhou -删节shanjie -善良shanliang -山林shanlin -山岭shanling -山脉shanmai -杉木shanmu -山区shanqu -扇区shanqu -山水shanshui -闪烁shanshuo -山头shantou -山西shanxi -陕西shanxi -赡养shanyang -闪耀shanyao -善意shanyi -善于shanyu -善战shanzhan -擅自shanzi -少shao -烧shao -稍shao -绍shao -召*shao -哨shao -梢shao -鞘*shao -捎shao -芍shao -勺shao -韶shao -邵shao -劭shao -苕shao -潲shao -杓*shao -蛸shao -筲shao -艄shao -哨兵shaobing -艄公shaogong -烧毁shaohui -少见shaojian -哨卡shaoka -少量shaoliang -少年shaonian -少女shaonu -烧伤shaoshang -少数shaoshu -哨所shaosuo -稍微shaowei -少许shaoxu -稍许shaoxu -少爷shaoye -少有shaoyou -少于shaoyu -少壮shaozhuang -沙哑shaya -砂眼shayan -傻子shazi -社she -设she -射she -摄she -舌she -折*she -涉she -舍she -蛇she -奢she -赊she -赦she -慑she -厍she -佘she -摺*she -猞she -滠she -歙she -畲she -麝she -设备shebei -射程shecheng -奢侈shechi -舍得shede -设法shefa -慑服shefu -赊购shegou -奢华shehua -社会shehui -社稷sheji -涉及sheji -设计sheji -射击sheji -舍己sheji -社交shejiao -设立sheli -涉猎shelie -社论shelun -深shen -身shen -神shen -什*shen -伸shen -参*shen -甚shen -渗shen -沈shen -肾shen -审shen -申shen -慎shen -砷shen -呻shen -娠shen -绅shen -婶shen -诜shen -谂shen -莘shen -葚*shen -哂shen -渖shen -椹shen -胂shen -矧shen -蜃shen -深奥shenao -申报shenbao -身边shenbian -申辩shenbian -身材shencai -审查shencha -深沉shenchen -深处shenchu -审处shenchu -审定shending -深度shendu -甚而shener -身分shenfen -身份shenfen -生sheng -胜sheng -声sheng -省sheng -升sheng -盛sheng -绳sheng -剩sheng -圣sheng -牲sheng -乘*sheng -甥sheng -嵊sheng -渑*sheng -晟sheng -眚sheng -笙sheng -生财shengcai -生产shengchan -生成shengcheng -牲畜shengchu -生存shengcun -盛大shengda -省得shengde -胜地shengdi -盛典shengdian -声调shengdiao -生动shengdong -省份shengfen -胜负shengfu -省府shengfu -生根shenggen -升华shenghua -省会shenghui -盛会shenghui -生活shenghuo -生机shengji -生计shengji -升级shengji -圣洁shengjie -圣经shengjing -盛开shengkai -牲口shengkou -盛况shengkuang -生理shengli -胜利shengli -省力shengli -省略shenglue -生命shengming -声明shengming -盛名shengming -生怕shengpa -生僻shengpi -生平shengping -升旗shengqi -生前shengqian -升迁shengqian -盛情shengqing -生趣shengqu -省去shengqu -胜任shengren -生日shengri -省事shengshi -盛事shengshi -声势shengshi -生疏shengshu -生死shengsi -胜似shengsi -胜诉shengsu -绳索shengsuo -生态shengtai -声讨shengtao -声望shengwang -省委shengwei -生物shengwu -生息shengxi -剩下shengxia -盛夏shengxia -圣贤shengxian -生效shengxiao -生肖shengxiao -盛行shengxing -生涯shengya -生意shengyi -声音shengyin -生于shengyu -生育shengyu -胜于shengyu -声誉shengyu -剩余shengyu -声援shengyuan -生长shengzhang -省长shengzhang -声张shengzhang -胜仗shengzhang -生殖shengzhi -圣旨shengzhi -盛装shengzhuang -审核shenhe -深厚shenhou -深化shenhua -神话shenhua -甚或shenhuo -审计shenji -神经shenjing -深刻shenke -审理shenli -什么shenme -审美shenmei -神秘shenmi -申明shenming -审判shenpan -身旁shenpang -审批shenpi -神气shenqi -神奇shenqi -深浅shenqian -深切shenqie -深情shenqing -申请shenqing -身躯shenqu -深入shenru -渗入shenru -神圣shensheng -身世shenshi -绅士shenshi -伸手shenshou -申述shenshu -神速shensu -申诉shensu -伸缩shensuo -神态shentai -身体shenti -神通shentong -渗透shentou -审问shenwen -神仙shenxian -审讯shenxun -沈阳shenyang -审议shenyi -呻吟shenyin -身影shenying -深远shenyuan -申冤shenyuan -审阅shenyue -深造shenzao -伸张shenzhang -深圳shenzhen -甚至shenzhi -深重shenzhong -慎重shenzhong -神州shenzhou -舍弃sheqi -赊欠sheqian -设施sheshi -社团shetuan -奢望shewang -射线shexian -涉嫌shexian -设想shexiang -赊销shexiao -设宴sheyan -摄影sheying -社员sheyuan -社长shezhang -设置shezhi -涉足shezu -社会公德shgd -是shi -时shi -十shi -使shi -事shi -实shi -式shi -识shi -世shi -试shi -石shi -什shi -示shi -市shi -史shi -师shi -始shi -施shi -士shi -势shi -湿shi -适shi -食shi -失shi -视shi -室shi -氏shi -似*shi -蚀shi -诗shi -释shi -殖*shi -拾shi -饰shi -驶shi -匙*shi -狮shi -尸shi -虱shi -矢shi -屎shi -柿shi -拭shi -誓shi -逝shi -嗜shi -噬shi -仕shi -侍shi -恃shi -嘘*shi -峙*shi -谥shi -埘shi -莳shi -蓍shi -弑shi -轼shi -贳shi -炻shi -铈shi -螫shi -舐shi -筮shi -酾shi -豕shi -鲥shi -鲺shi -失败shibai -势必shibi -事变shibian -师表shibiao -识别shibie -失策shice -史册shice -视察shicha -时常shichang -失常shichang -市场shichang -时辰shichen -失传shichuan -侍从shicong -时代shidai -世代shidai -适当shidang -是的shide -实地shidi -试点shidian -失调shidiao -失掉shidiao -事端shiduan -拾掇shiduo -时而shier -示范shifan -师范shifan -施放shifang -释放shifang -是非shifei -时分shifen -十分shifen -侍奉shifeng -是否shifou -师傅shifu -实干shigan -是个shige -诗歌shige -施工shigong -事故shigu -世故shigu -尸骨shigu -使馆shiguan -时光shiguang -嗜好shihao -适合shihe -时候shihou -事后shihou -侍候shihou -使唤shihuan -实惠shihui -失火shihuo -时机shiji -事迹shiji -实际shiji -世纪shiji -试剂shiji -史籍shiji -施加shijia -市价shijia -时间shijian -事件shijian -世间shijian -实践shijian -视角shijiao -市郊shijiao -使节shijie -十届shijie -世界shijie -使劲shijin -市井shijing -时局shiju -视觉shijue -时刻shike -石刻shike -市侩shikuai -实况shikuang -事理shili -实力shili -事例shili -势利shili -失利shili -势力shili -视力shili -示例shili -失恋shilian -适量shiliang -矢量shiliang -拾零shiling -失灵shiling -适龄shiling -时髦shimao -失密shimi -市民shimin -使命shiming -市内shinei -室内shinei -诗篇shipian -食品shipin -视频shipin -识破shipo -时期shiqi -事前shiqian -失窃shiqie -事情shiqing -实情shiqing -时区shiqu -时取shiqu -失去shiqu -市区shiqu -诗人shiren -市容shirong -湿润shirun -示弱shiruo -失散shisan -失色shise -施舍shishe -师生shisheng -失声shisheng -时时shishi -时事shishi -适时shishi -事实shishi -失事shishi -实施shishi -失实shishi -逝世shishi -史诗shishi -失势shishi -誓师shishi -尸首shishou -失守shishou -实数shishu -施属shishu -世俗shisu -失算shisuan -事态shitai -试探shitan -食堂shitang -实体shiti -尸体shiti -石头shitou -势头shitou -师团shituan -十万shiwan -失望shiwang -市委shiwei -示威shiwei -时务shiwu -事物shiwu -事务shiwu -实物shiwu -食物shiwu -饰物shiwu -失误shiwu -实习shixi -事先shixian -视线shixian -实现shixian -试想shixiang -事项shixiang -实效shixiao -试销shixiao -失信shixin -实行shixing -试行shixing -施行shixing -失修shixiu -实学shixue -史学shixue -实验shiyan -试验shiyan -食言shiyan -誓言shiyan -式样shiyang -事业shiye -实业shiye -失业shiye -视野shiye -时宜shiyi -事宜shiyi -示意shiyi -诗意shiyi -适宜shiyi -释疑shiyi -适应shiying -使用shiyong -实用shiyong -试用shiyong -适用shiyong -事由shiyou -石油shiyou -誓由shiyou -适于shiyu -誓愿shiyuan -十月shiyue -失约shiyue -实在shizai -实战shizhan -施展shizhan -市长shizhang -师长shizhang -使者shizhe -侍者shizhe -失真shizhen -市镇shizhen -市政shizheng -试制shizhi -实质shizhi -市制shizhi -食指shizhi -失职shizhi -适中shizhong -示众shizhong -始终shizhong -时装shizhuang -师资shizi -十足shizu -实足shizu -失足shizu -始祖shizu -手shou -受shou -收shou -首shou -守shou -熟*shou -授shou -寿shou -兽shou -售shou -瘦shou -狩shou -绶shou -艏shou -守备shoubei -手表shoubiao -收兵shoubing -收藏shoucang -手册shouce -首倡shouchang -寿辰shouchen -收成shoucheng -首创shouchuang -首次shouci -收存shoucun -寿诞shoudan -受到shoudao -守敌shoudi -首度shoudu -首都shoudu -手段shouduan -守法shoufa -首犯shoufan -收复shoufu -首府shoufu -手感shougan -手稿shougao -收割shouge -收购shougou -受害shouhai -守候shouhou -守护shouhu -收回shouhui -受贿shouhui -收获shouhuo -收集shouji -售价shoujia -受奖shoujiang -授奖shoujiang -手脚shoujiao -收缴shoujiao -首届shoujie -守旧shoujiu -收据shouju -授课shouke -受理shouli -收敛shoulian -首领shouling -收留shouliu -收录shoulu -收买shoumai -授命shouming -寿命shouming -首脑shounao -首批shoupi -授权shouquan -收容shourong -收入shouru -手软shouruan -瘦弱shouruo -首饰shoushi -手术shoushu -收缩shousuo -收条shoutiao -收听shouting -收尾shouwei -首尾shouwei -首先shouxian -首相shouxiang -瘦小shouxiao -收效shouxiao -手续shouxu -瘦削shouxue -收养shouyang -首要shouyao -受益shouyi -收益shouyi -兽医shouyi -受用shouyong -授予shouyu -守则shouze -首长shouzhang -收支shouzhi -生活上shs -上海市shs -数shu -书shu -树shu -属shu -术shu -输shu -述shu -熟shu -束shu -鼠shu -疏shu -殊shu -舒shu -蔬shu -薯shu -叔shu -署shu -枢shu -梳shu -抒shu -淑shu -赎shu -孰shu -暑shu -曙shu -蜀shu -黍shu -戍shu -竖shu -墅shu -庶shu -漱shu -恕shu -俞*shu -丨shu -倏shu -塾shu -菽shu -摅shu -沭shu -澍shu -姝shu -纾shu -毹shu -腧shu -殳shu -秫shu -刷shua -耍shua -唰shua -衰shuai -帅shuai -摔shuai -甩shuai -蟀shuai -衰败shuaibai -摔打shuaida -摔交shuaijiao -衰竭shuaijie -衰老shuailao -衰弱shuairuo -衰退shuaitui -衰亡shuaiwang -耍赖shualai -栓shuan -拴shuan -闩shuan -涮shuan -双shuang -霜shuang -爽shuang -泷*shuang -孀shuang -双边shuangbian -双方shuangfang -爽口shuangkou -爽快shuangkuai -爽朗shuanglang -双拼shuangpin -双重shuangzhong -耍弄shuanong -刷洗shuaxi -刷新shuaxin -书报shubao -书本shuben -蔬菜shucai -舒畅shuchang -输出shuchu -树丛shucong -疏导shudao -书店shudian -数额shue -抒发shufa -书法shufa -舒服shufu -束缚shufu -曙光shuguang -蜀汉shuhan -疏忽shuhu -倏忽shuhu -书画shuhua -水shui -说*shui -谁shui -睡shui -税shui -水稻shuidao -水电shuidian -水分shuifen -水果shuiguo -水火shuihuo -水晶shuijing -水库shuiku -水利shuili -水流shuiliu -睡眠shuimian -水平shuiping -税收shuishou -税务shuiwu -水下shuixia -水性shuixing -水源shuiyuan -水灾shuizai -谁知shuizhi -书记shuji -书籍shuji -暑假shujia -数据shuju -书刊shukan -数理shuli -树立shuli -竖立shuli -熟练shulian -数量shuliang -数列shulie -疏漏shulou -数落shuluo -数码shuma -书面shumian -庶民shumin -数目shumu -书目shumu -树木shumu -顺shun -吮shun -瞬shun -舜shun -顺便shunbian -顺差shuncha -顺次shunci -顺从shuncong -顺当shundang -顺道shundao -顺风shunfeng -枢纽shuniu -顺利shunli -顺路shunlu -瞬时shunshi -顺势shunshi -顺心shunxin -顺序shunxu -顺应shunying -顺着shunzhuo -说shuo -数*shuo -硕shuo -朔shuo -烁shuo -蒴shuo -搠shuo -妁shuo -槊shuo -铄shuo -说到shuodao -说道shuodao -说动shuodong -说法shuofa -说服shuofu -硕果shuoguo -说话shuohua -说教shuojiao -说明shuoming -说情shuoqing -硕士shuoshi -述评shuping -署期shuqi -暑期shuqi -抒情shuqing -熟人shuren -输入shuru -疏散shusan -属实shushi -熟识shushi -舒适shushi -束手shushou -叔叔shushu -数说shushuo -述说shushuo -输送shusong -疏松shusong -舒坦shutan -疏通shutong -熟悉shuxi -属相shuxiang -舒心shuxin -书信shuxin -属性shuxing -数学shuxue -属于shuyu -术语shuyu -疏远shuyuan -舒展shuzhan -数值shuzhi -树脂shuzhi -梳妆shuzhuang -数字shuzi -赎罪shuzui -售货员shy -社会主义shzy -四si -思si -死si -斯si -丝si -似si -司si -饲si -食*si -私si -厕*si -撕si -嘶si -肆si -寺si -嗣si -伺si -巳si -厮si -俟*si -兕si -厶si -咝si -汜si -泗si -澌si -姒si -驷si -缌si -祀si -锶si -鸶si -耜si -蛳si -笥si -死板siban -四边sibian -死别sibie -思潮sichao -丝绸sichou -四处sichu -四川sichuan -死党sidang -死敌sidi -司法sifa -四方sifang -四海sihai -丝毫sihao -嗣后sihou -似乎sihu -四化sihua -死缓sihuan -撕毁sihui -死活sihuo -四季siji -司机siji -私交sijiao -四届sijie -思考sikao -私利sili -私了siliao -司令siling -思路silu -四面simian -思念sinian -私念sinian -死去siqu -私人siren -死伤sishang -私事sishi -死尸sishi -死水sishui -思索sisuo -四体siti -私吞situn -死亡siwang -思维siwei -斯文siwen -私下sixia -思想sixiang -四项sixiang -死心sixin -私心sixin -肆行sixing -死刑sixing -私有siyou -私欲siyu -寺院siyuan -四月siyue -死者sizhe -四周sizhou -私自sizi -死罪sizui -拾金不昧sjbm -身经百战sjbz -书记处sjc -世界观sjg -舍己救人sjjr -数据库sjk -省军区sjq -杀鸡取蛋sjqd -实际上sjs -设计所sjs -试金石sjs -舍己为人sjwr -设计院sjy -随机应变sjyb -十进制sjz -石家庄sjz -适可而止skez -数理化slh -收录机slj -十六进制sljz -三令五申slws -司令员sly -四面八方smbf -手忙脚乱smjl -生命力sml -说明书sms -什么样smy -深谋远虑smyl -数目字smz -松song -送song -宋song -颂song -耸song -怂song -讼song -诵song -凇song -菘song -崧song -嵩song -忪song -悚song -淞song -竦song -松绑songbang -送别songbie -松弛songchi -松动songdong -颂歌songge -松劲songjin -松快songkuai -耸立songli -送礼songli -松散songsan -松涛songtao -松懈songxie -颂扬songyang -怂恿songyong -送葬songzang -送终songzhong -搜sou -艘sou -擞sou -嗽sou -叟sou -薮sou -嗖sou -嗾sou -馊sou -溲sou -飕sou -瞍sou -锼sou -螋sou -搜查soucha -搜集souji -搜索sousuo -搜寻souxun -售票处spc -食品工业spgy -水平线spx -生气勃勃sqbb -诗情画意sqhy -盛气凌人sqlr -山穷水尽sqsj -十全十美sqsm -首屈一指sqyz -四人帮srb -损人利己srlj -深入浅出srqc -似是而非ssef -时时刻刻sskk -姗姗来迟sslc -实事求是ssqs -事实上sss -随时随地sssd -善始善终sssz -顺水推舟sstz -四通公司stgs -四通集团stjt -身体力行stlx -生态平衡stph -素su -速su -苏su -塑su -缩su -俗su -诉su -宿su -肃su -酥su -粟su -僳su -溯su -夙su -谡su -蔌su -嗉su -愫su -涑su -簌su -觫su -稣su -算suan -酸suan -蒜suan -狻suan -酸楚suanchu -算法suanfa -算计suanji -算了suanle -算盘suanpan -算术suanshu -酸疼suanteng -酸痛suantong -素材sucai -速成sucheng -苏丹sudan -速度sudu -俗话suhua -随sui -穗sui -碎sui -虽sui -岁sui -尿*sui -隋sui -绥sui -髓sui -遂sui -隧sui -祟sui -谇sui -荽sui -濉sui -邃sui -燧sui -眭sui -睢sui -随笔suibi -随便suibian -随处suichu -随从suicong -随地suidi -随和suihe -随后suihou -随机suiji -随即suiji -虽然suiran -随身suishen -随时suishi -随手suishou -岁数suishu -虽说suishuo -随同suitong -随心suixin -随行suixing -随意suiyi -遂意suiyi -岁月suiyue -虽则suize -随着suizhe -诉苦suku -苏联sulian -塑料suliao -速率sulu -素描sumiao -肃穆sumu -损sun -孙sun -笋sun -荪sun -狲sun -飧sun -榫sun -隼sun -损害sunhai -损耗sunhao -损坏sunhuai -损伤sunshang -损失sunshi -孙子sunzi -所suo -缩suo -锁suo -索suo -莎*suo -蓑suo -梭suo -唆suo -琐suo -唢suo -嗦suo -嗍suo -娑suo -桫suo -挲*suo -睃suo -羧suo -所得suode -缩短suoduan -缩减suojian -锁链suolian -所能suoneng -索取suoqu -唆使suoshi -所属suoshu -琐碎suosui -所为suowei -所谓suowei -缩小suoxiao -缩写suoxie -琐屑suoxie -索性suoxing -所以suoyi -索引suoyin -缩影suoying -所有suoyou -所在suozai -所长suozhang -所至suozhi -梭子suozi -肃清suqing -苏区suqu -宿舍sushe -素数sushu -诉说sushuo -诉讼susong -速效suxiao -速写suxie -苏醒suxing -素养suyang -宿营suying -溯源suyuan -宿愿suyuan -夙愿suyuan -塑造suzao -速战suzhan -素质suzhi -苏州suzhou -苏维埃swa -税务局swj -手舞足蹈swzd -少先队sxd -身心健康sxjk -思想上sxs -山西省sxs -陕西省sxs -顺息万变sxwb -所向无敌sxwd -思想性sxx -商业部syb -说一不二sybe -收音机syj -使用价值syjz -所有权syq -沈阳市sys -实用性syx -十一月syy -所有制syz -私有制syz -时至今日szjr -三中全会szqh -始终如一szry -深圳四通szst -所作所为szsw -甚至于szy -他t -同t -它t -提t -题t -体t -图t -天t -头t -通t -条t -特t -土t -团t -统t -台t -她t -太t -套t -铁t -他ta -它ta -她ta -塔ta -踏ta -塌ta -獭ta -挞ta -蹋ta -拓*ta -嗒*ta -闼ta -溻ta -漯*ta -遢ta -榻ta -沓ta -铊ta -趿ta -鳎ta -踏步tabu -他的tade -它的tade -她的tade -塌方tafang -台tai -太tai -态tai -胎tai -抬tai -泰tai -苔tai -酞tai -汰tai -邰tai -薹tai -呔*tai -骀*tai -肽tai -炱tai -钛tai -跆tai -鲐tai -台北taibei -台词taici -态度taidu -台风taifeng -台阶taijie -太平taiping -泰然tairan -泰山taishan -态势taishi -太太taitai -抬头taitou -台湾taiwan -太阳taiyang -太原taiyuan -天安门tam -他们tamen -它们tamen -她们tamen -谈tan -碳tan -探tan -炭tan -弹*tan -坦tan -贪tan -滩tan -坍tan -摊tan -瘫tan -坛tan -檀tan -痰tan -潭tan -谭tan -毯tan -袒tan -叹tan -郯tan -澹tan -昙tan -忐tan -钽tan -锬tan -镡*tan -坦白tanbai -探测tance -探访tanfang -谈锋tanfeng -叹服tanfu -堂tang -糖tang -唐tang -塘tang -汤tang -搪tang -棠tang -膛tang -倘tang -躺tang -淌tang -趟tang -烫tang -傥tang -帑tang -溏tang -瑭tang -樘tang -铴tang -镗tang -耥tang -螗tang -螳tang -羰tang -醣tang -倘不tangbu -搪瓷tangci -弹弓tangong -倘若tangruo -搪塞tangsai -烫伤tangshang -堂堂tangtang -唐突tangtu -弹劾tanhe -袒护tanhu -谈话tanhua -瘫痪tanhuan -探究tanjiu -坦克tanke -贪婪tanlan -坦率tanlu -谈论tanlun -摊派tanpai -谈判tanpan -叹气tanqi -探亲tanqin -弹琴tanqin -坦然tanran -探索tansuo -探讨tantao -谈天tantian -探听tanting -贪图tantu -谈吐tantu -滩涂tantu -探望tanwang -探问tanwen -贪污tanwu -叹息tanxi -探险tanxian -谈心tanxin -弹性tanxing -探询tanxun -贪赃tanzang -套tao -讨tao -逃tao -陶tao -萄tao -桃tao -掏tao -涛tao -滔tao -绦tao -淘tao -鼗tao -叨*tao -啕tao -洮tao -韬tao -焘tao -饕tao -逃奔taoben -逃避taobi -逃兵taobing -逃窜taocuan -逃遁taodun -讨伐taofa -讨饭taofan -套购taogou -讨好taohao -讨还taohuan -讨价taojia -桃李taoli -韬略taolue -讨论taolun -逃命taoming -逃难taonan -逃跑taopao -淘气taoqi -逃生taosheng -淘汰taotai -滔滔taotao -逃脱taotuo -逃亡taowang -讨厌taoyan -陶冶taoye -桃子taozi -逃走taozou -陶醉taozui -踏青taqing -他人taren -踏实tashi -他说tashuo -他乡taxiang -挑拨离间tblj -台北市tbs -贪便宜tby -统筹兼顾tcjg -铁道部tdb -土地改革tdgg -同等学历tdxl -特te -忒te -忑te -慝*te -铽te -特别tebie -特产techan -特长techang -特出techu -特此teci -特大teda -特等tedeng -特地tedi -特点tedian -特定teding -特级teji -特技teji -特急teji -特将tejiang -特刊tekan -特快tekuai -特例teli -腾teng -疼teng -藤teng -誊teng -滕teng -疼爱tengai -腾达tengda -誊写tengxie -特派tepai -特区tequ -特权tequan -托儿所tes -特色tese -特使teshi -特殊teshu -特为tewei -特务tewu -特效texiao -特写texie -特性texing -特邀teyao -特意teyi -特有teyou -特约teyue -特征tezheng -特制tezhi -特种tezhong -突飞猛进tfmj -铁饭碗tfw -同甘共苦tggk -提货单thd -谈何容易thry -提ti -题ti -体ti -替ti -梯ti -惕ti -剔ti -踢ti -锑ti -蹄ti -啼ti -嚏ti -涕ti -剃ti -屉ti -倜ti -荑*ti -悌ti -逖ti -绨*ti -缇ti -鹈ti -裼ti -醍ti -天tian -田tian -添tian -填tian -甜tian -佃*tian -恬tian -舔tian -腆tian -掭tian -忝tian -阗tian -殄tian -畋tian -填报tianbao -天边tianbian -填表tianbiao -填补tianbu -天才tiancai -天长tianchang -填充tianchong -天地tiandi -田地tiandi -天鹅tiane -天府tianfu -天赋tianfu -天机tianji -天际tianji -添加tianjia -天津tianjin -恬静tianjing -天空tiankong -填空tiankong -天理tianli -天良tianliang -天亮tianliang -甜美tianmei -甜蜜tianmi -天明tianming -天平tianping -天气tianqi -天桥tianqiao -天然tianran -天壤tianrang -天色tianse -天上tianshang -天生tiansheng -天使tianshi -天堂tiantang -天体tianti -天天tiantian -甜头tiantou -天文tianwen -天下tianxia -天险tianxian -天仙tianxian -天性tianxing -天涯tianya -田野tianye -天真tianzhen -天职tianzhi -添置tianzhi -天资tianzi -条tiao -调*tiao -跳tiao -挑tiao -迢tiao -眺tiao -佻tiao -苕*tiao -祧tiao -窕tiao -蜩tiao -笤tiao -粜tiao -龆tiao -鲦tiao -髫tiao -挑拔tiaoba -跳动tiaodong -挑动tiaodong -挑逗tiaodou -跳高tiaogao -调和tiaohe -调剂tiaoji -条件tiaojian -调解tiaojie -调节tiaojie -条款tiaokuan -调理tiaoli -条理tiaoli -条例tiaoli -条令tiaoling -调配tiaopei -挑剔tiaoti -调停tiaoting -条文tiaowen -跳舞tiaowu -调戏tiaoxi -挑衅tiaoxin -挑选tiaoxuan -条约tiaoyue -挑战tiaozhan -调整tiaozheng -条子tiaozi -提拨tibo -题材ticai -体裁ticai -体操ticao -体察ticha -提倡tichang -提成ticheng -提出tichu -剔除tichu -题词tici -替代tidai -梯队tidui -铁tie -贴tie -帖tie -萜tie -餮tie -贴补tiebu -铁道tiedao -贴近tiejin -铁路tielu -贴切tieqie -贴身tieshen -铁证tiezheng -提法tifa -提防tifang -提纲tigang -提高tigao -体格tige -提供tigong -替换tihuan -体会tihui -提货tihuo -体积tiji -提价tijia -体力tili -体例tili -提炼tilian -体谅tiliang -体面timian -提名timing -题名timing -题目timu -听ting -停ting -庭ting -挺ting -廷ting -厅ting -烃ting -汀ting -亭ting -艇ting -莛ting -葶ting -婷ting -梃ting -町*ting -铤ting -蜓ting -霆ting -挺拔tingba -停办tingban -停泊tingbo -停产tingchan -听从tingcong -停顿tingdun -停工tinggong -挺括tinggua -听候tinghou -听话tinghua -停火tinghuo -听见tingjian -厅局tingju -听觉tingjue -停留tingliu -听凭tingping -听取tingqu -听任tingren -听说tingshuo -听信tingxin -厅长tingzhang -停止tingzhi -停职tingzhi -停滞tingzhi -听众tingzhong -提起tiqi -提前tiqian -提取tiqu -提升tisheng -提示tishi -体坛titan -体贴titie -提问tiwen -体温tiwen -体系tixi -体现tixian -体型tixing -提醒tixing -体验tiyan -提要tiyao -提议tiyi -体育tiyu -体制tizhi -体质tizhi -题字tizi -统计表tjb -条件反射tjfs -讨价还价tjhj -天津市tjs -条件下tjx -讨论会tlh -拖拉机tlj -他们的tmd -同盟会tmh -天南地北tndb -同tong -通tong -统tong -铜tong -痛tong -筒tong -童tong -桶tong -侗*tong -恫*tong -桐tong -酮tong -瞳tong -彤tong -捅tong -佟tong -仝tong -垌*tong -茼tong -嗵tong -峒*tong -恸tong -潼tong -砼tong -同伴tongban -同胞tongbao -通报tongbao -同辈tongbei -通病tongbing -同步tongbu -通常tongchang -通称tongcheng -统称tongcheng -痛斥tongchi -统筹tongchou -痛楚tongchu -同窗tongchuang -同道tongdao -通道tongdao -同等tongdeng -通电tongdian -通牒tongdie -通读tongdu -通告tonggao -统购tonggou -通过tongguo -通航tonghang -痛恨tonghen -同化tonghua -通话tonghua -童话tonghua -痛悔tonghui -通婚tonghun -统计tongji -通辑tongji -痛击tongji -同居tongju -痛苦tongku -痛哭tongku -痛快tongkuai -同僚tongliao -通令tongling -同盟tongmeng -同年tongnian -童年tongnian -同期tongqi -通气tongqi -同情tongqing -通融tongrong -同上tongshang -通商tongshang -同时tongshi -同事tongshi -统属tongshu -统帅tongshuai -通顺tongshun -通俗tongsu -通往tongwang -痛恶tongwu -痛惜tongxi -统辖tongxia -通向tongxiang -同乡tongxiang -统销tongxiao -通宵tongxiao -通晓tongxiao -同心tongxin -痛心tongxin -通信tongxin -同行tongxing -通行tongxing -同性tongxing -同学tongxue -通讯tongxun -同样tongyang -统一tongyi -同意tongyi -通用tongyong -通邮tongyou -统战tongzhan -同志tongzhi -统治tongzhi -通知tongzhi -头tou -投tou -透tou -偷tou -钭tou -骰tou -投案touan -头版touban -投奔touben -投标toubiao -投产touchan -透彻touche -头等toudeng -投放toufang -投机touji -投靠toukao -投篮toulan -偷懒toulan -头颅toulu -透露toulu -头面toumian -透明touming -头目toumu -头脑tounao -投票toupiao -透气touqi -投入touru -投身toushen -透视toushi -头痛toutong -偷闲touxian -投降touxiang -头绪touxu -投影touying -投掷touzhi -头子touzi -投资touzi -突破口tpk -太平洋tpy -通情达理tqdl -天气预报tqyb -突然袭击trxj -妥善处理tscl -通俗读物tsdw -挺身而出tsec -图书馆tsg -滔滔不绝ttbj -痛痛快快ttkk -团体赛tts -踏踏实实ttss -图tu -土tu -突tu -途tu -徒tu -凸tu -涂tu -吐tu -兔tu -屠tu -秃tu -堍tu -荼tu -菟tu -钍tu -酴tu -团tuan -湍tuan -抟tuan -彖tuan -疃tuan -图案tuan -湍急tuanji -团结tuanjie -团聚tuanju -湍流tuanliu -团体tuanti -团员tuanyuan -团圆tuanyuan -团长tuanzhang -突变tubian -图表tubiao -土产tuchan -突出tuchu -土地tudi -徒弟tudi -土匪tufei -土改tugai -涂改tugai -图画tuhua -土话tuhua -推tui -退tui -腿tui -颓tui -蜕tui -褪tui -忒*tui -煺tui -蜕变tuibian -退步tuibu -推测tuice -推迟tuichi -推崇tuichong -退出tuichu -推导tuidao -推动tuidong -推断tuiduan -推翻tuifan -颓废tuifei -推广tuiguang -退化tuihua -蜕化tuihua -退回tuihui -推荐tuijian -推进tuijin -推举tuiju -推开tuikai -推理tuili -推论tuilun -推敲tuiqiao -推却tuique -退却tuique -推让tuirang -退让tuirang -颓丧tuisang -退色tuise -推算tuisuan -退缩tuisuo -颓唐tuitang -推托tuituo -退伍tuiwu -推向tuixiang -推销tuixiao -推卸tuixie -推行tuixing -退休tuixiu -退学tuixue -推移tuiyi -退职tuizhi -突击tuji -图解tujie -途径tujing -徒劳tulao -图例tuli -吐露tulu -囤*tun -褪*tun -吞tun -屯tun -臀tun -氽tun -饨tun -暾tun -豚tun -吞并tunbing -吞没tunmo -吞吐tuntu -脱tuo -拖tuo -托tuo -妥tuo -椭tuo -舵*tuo -魄*tuo -鸵tuo -陀tuo -驮tuo -驼tuo -拓tuo -唾tuo -乇tuo -佗tuo -坨tuo -庹tuo -沱tuo -柝tuo -柁*tuo -橐tuo -砣tuo -铊*tuo -箨tuo -酡tuo -跎tuo -鼍tuo -驼背tuobei -拓补tuobu -脱出tuochu -妥当tuodang -脱轨tuogui -拓荒tuohuang -脱节tuojie -拖拉tuola -脱离tuoli -唾骂tuoma -唾弃tuoqi -妥善tuoshan -脱身tuoshen -妥协tuoxie -拖延tuoyan -唾液tuoye -图片tupian -突破tupo -突起tuqi -突然turan -徒然turan -土壤turang -屠杀tusha -徒手tushou -图书tushu -吐痰tutan -突围tuwei -突兀tuwu -图象tuxiang -图像tuxiang -图形tuxing -徒刑tuxing -图章tuzhang -图纸tuzhi -途中tuzhong -土著tuzhu -秃子tuzi -贪污盗窃twdq -台湾省tws -贪污受贿twsh -提心吊胆txdd -通讯社txs -同心同德txtd -同心协力txxl -推心置腹txzf -体育场tyc -体育锻炼tydl -体育馆tyg -腾云驾雾tyjw -太阳能tyn -太原市tys -天衣无缝tywf -通用性tyx -体育运动tyyd -团支部tzb -停滞不前tzbq -同志们tzm -天灾人祸tzrh -听之任之tzrz -通知书tzs -为w -我w -无w -问w -外w -五w -位w -物w -委w -完w -温w -万w -文w -往w -武w -务w -王w -围w -误w -晚w -瓦wa -挖wa -凹*wa -哇wa -蛙wa -洼wa -娃wa -袜wa -佤wa -娲wa -腽wa -外wai -歪wai -外币waibi -外边waibian -外表waibiao -外宾waibin -外部waibu -外传waichuan -外存waicun -外地waidi -外调waidiao -歪风waifeng -外观waiguan -外国waiguo -外行waihang -外汇waihui -外加waijia -外交waijiao -外界waijie -外景waijing -外科waike -外快waikuai -外流wailiu -外貌waimao -外贸waimao -外面waimian -外勤waiqin -歪曲waiqu -外商waishang -外伤waishang -外设waishe -外省waisheng -外甥waisheng -外事waishi -外围waiwei -外文waiwen -外线waixian -外销waixiao -歪斜waixie -外延waiyan -外因waiyin -外语waiyu -外援waiyuan -外在waizai -外债waizhai -外资waizi -瓦解wajie -挖掘wajue -挖苦waku -瓦砾wali -完wan -万wan -晚wan -弯wan -碗wan -顽wan -湾wan -挽wan -玩wan -蔓*wan -娩*wan -豌wan -丸wan -烷wan -皖wan -惋wan -宛wan -婉wan -腕wan -剜wan -芄wan -莞*wan -菀wan -纨wan -绾wan -琬wan -脘wan -畹wan -蜿wan -万般wanban -晚报wanbao -完备wanbei -完毕wanbi -完成wancheng -万代wandai -顽敌wandi -万吨wandun -万恶wane -万分wanfen -往wang -王wang -望wang -网wang -忘wang -妄wang -亡wang -旺wang -芒*wang -汪wang -枉wang -罔wang -尢wang -惘wang -辋wang -魍wang -往常wangchang -王朝wangchao -忘掉wangdiao -妄动wangdong -枉法wangfa -往返wangfan -枉费wangfei -往复wangfu -王国wangguo -亡国wangguo -往后wanghou -忘怀wanghuai -忘记wangji -旺季wangji -往来wanglai -网络wangluo -亡命wangming -往年wangnian -完工wangong -忘却wangque -枉然wangran -惘然wangran -往日wangri -旺盛wangsheng -往事wangshi -妄图wangtu -万古wangu -顽固wangu -往往wangwang -汪汪wangwang -忘我wangwo -往昔wangxi -妄想wangxiang -汪洋wangyang -望远wangyuan -王子wangzi -完好wanhao -晚会wanhui -挽回wanhui -晚婚wanhun -晚间wanjian -完结wanjie -挽救wanjiu -玩具wanju -顽抗wankang -完了wanle -挽力wanli -弯路wanlu -完美wanmei -万能wanneng -万年wannian -晚年wannian -玩弄wannong -晚期wanqi -顽强wanqiang -弯曲wanqu -完全wanquan -完善wanshan -晚上wanshang -玩赏wanshang -万事wanshi -万世wanshi -玩耍wanshua -万岁wansui -万万wanwan -万物wanwu -晚霞wanxia -万象wanxiang -玩笑wanxiao -万幸wanxing -婉言wanyan -万一wanyi -万元wanyuan -完整wanzheng -顽症wanzheng -万众wanzhong -宛转wanzhuan -瓦斯wasi -瓦特wate -娃娃wawa -外部设备wbsb -微不足道wbzd -无产阶级wcjj -微处理机wclj -无产者wcz -为wei -位wei -委wei -围wei -维wei -唯wei -卫wei -微wei -伟wei -未wei -威wei -危wei -尾wei -谓wei -喂wei -味wei -胃wei -魏wei -伪wei -遗*wei -违wei -韦wei -畏wei -纬wei -巍wei -桅wei -惟wei -潍wei -苇wei -萎wei -蔚wei -渭wei -尉wei -慰wei -偎wei -诿wei -隈wei -隗*wei -圩*wei -葳wei -薇wei -囗wei -帏wei -帷wei -崴wei -嵬wei -猥wei -猬wei -闱wei -沩wei -洧wei -涠wei -逶wei -娓wei -玮wei -韪wei -軎wei -炜wei -煨wei -痿wei -艉wei -鲔wei -尾巴weiba -违背weibei -未必weibi -威逼weibi -微波weibo -微薄weibo -未曾weiceng -未尝weichang -维持weichi -为此weici -伟大weida -味道weidao -纬度weidu -唯独weidu -巍峨weie -违法weifa -违反weifan -违犯weifan -威风weifeng -桅杆weigan -微观weiguan -危害weihai -为何weihe -维护weihu -危及weiji -微机weiji -危机weiji -危急weiji -围歼weijian -围剿weijiao -慰藉weijie -违禁weijin -未经weijing -畏惧weiju -违抗weikang -未可weike -唯恐weikong -惟恐weikong -胃口weikou -未来weilai -慰劳weilao -为了weile -威力weili -委靡weimi -未免weimian -微妙weimiao -帷幕weimu -危难weinan -畏难weinan -未能weineng -委派weipai -为期weiqi -畏怯weiqie -委曲weiqu -委屈weiqu -未然weiran -巍然weiran -围绕weirao -伟人weiren -委任weiren -微弱weiruo -威慑weishe -为生weisheng -卫生weisheng -尾声weisheng -卫士weishi -威势weishi -为首weishou -为数weishu -尾随weisui -未遂weisui -畏缩weisuo -萎缩weisuo -猥琐weisuo -委托weituo -委婉weiwan -危亡weiwang -巍巍weiwei -慰问weiwen -唯物weiwu -威武weiwu -微细weixi -威吓weixia -危险weixian -微小weixiao -微笑weixiao -威协weixie -威胁weixie -猥亵weixie -维新weixin -唯心weixin -违心weixin -威信weixin -微型weixing -卫星weixing -维修weixiu -威严weiyan -伟业weiye -唯一weiyi -位移weiyi -位于weiyu -谓语weiyu -委员weiyuan -为止weizhi -位置weizhi -未知weizhi -为重weizhong -为主weizhu -伪装weizhuang -问wen -温wen -文wen -稳wen -纹wen -闻wen -蚊wen -瘟wen -吻wen -紊wen -刎wen -阌wen -汶wen -璺wen -雯wen -文本wenben -瘟病wenbing -稳步wenbu -问答wenda -稳定wending -温度wendu -嗡weng -翁weng -瓮weng -蓊weng -蕹weng -稳固wengu -问好wenhao -温和wenhe -吻合wenhe -文化wenhua -文件wenjian -稳健wenjian -问津wenjin -文静wenjing -文具wenju -文科wenke -文盲wenmang -文明wenming -闻名wenming -温暖wennuan -文凭wenping -文人wenren -温柔wenrou -问世wenshi -文坛wentan -问题wenti -文体wenti -稳妥wentuo -文物wenwu -文献wenxian -文选wenxuan -文学wenxue -问讯wenxun -闻讯wenxun -文艺wenyi -瘟疫wenyi -文娱wenyu -文摘wenzhai -文章wenzhang -稳重wenzhong -文字wenzi -问罪wenzui -望而生畏wesw -闻风而动wfed -违法乱纪wflj -歪风邪气wfxq -温故知新wgzx -文化部whb -文汇报whb -文化馆whg -文化宫whg -武汉市whs -五湖四海whsh -忘乎所以whsy -问寒问暖whwn -文化娱乐whyl -玩忽职守whzs -外交部wjb -无纪律wjl -五讲四美wjsm -无拘无束wjws -无可奉告wkfg -无可非议wkfy -无可奈何wknh -乌鲁木齐wlmq -无理取闹wlqn -无论如何wlrh -物美价廉wmjl -误码率wml -文明礼貌wmlm -无名英雄wmyx -无能为力wnwl -我wo -握wo -窝wo -蜗wo -涡wo -沃wo -挝wo -卧wo -斡wo -倭wo -莴wo -喔wo -幄wo -渥wo -肟wo -硪wo -龌wo -窝藏wocang -卧床wochuang -我党wodang -卧倒wodao -我的wode -窝工wogong -我国woguo -我军wojun -我们women -窝囊wonang -我省wosheng -我校woxiao -为期不远wqby -无穷无尽wqwj -误入歧途wrqt -卫生部wsb -纹丝不动wsbd -万事大吉wsdj -万事俱备wsjb -为什么wsm -无所谓wsw -为所欲为wsyw -无所作为wszw -无wu -五wu -物wu -武wu -务wu -误wu -伍wu -舞wu -污wu -悟wu -雾wu -午wu -恶*wu -屋wu -乌wu -吴wu -亡*wu -诬wu -钨wu -巫wu -呜wu -芜wu -梧wu -吾wu -毋wu -捂wu -侮wu -坞wu -戊wu -晤wu -勿wu -兀wu -仵wu -阢wu -邬wu -圬wu -芴wu -唔wu -庑wu -怃wu -忤wu -浯wu -寤wu -迕wu -妩wu -婺wu -骛wu -杌wu -牾wu -於*wu -焐wu -鹉wu -鹜wu -痦wu -蜈wu -鋈wu -鼯wu -吾辈wubei -无比wubi -五笔wubi -务必wubi -舞弊wubi -无边wubian -无不wubu -五彩wucai -误差wucha -无常wuchang -无偿wuchang -舞场wuchang -武昌wuchang -无耻wuchi -无从wucong -武打wuda -舞蹈wudao -无敌wudi -舞动wudong -武斗wudou -武断wuduan -无法wufa -无妨wufang -无非wufei -武功wugong -污垢wugou -无故wugu -无关wuguan -五官wuguan -武官wuguan -无害wuhai -诬害wuhai -武汉wuhan -无何wuhe -乌黑wuhei -五湖wuhu -呜呼wuhu -误会wuhui -舞会wuhui -污秽wuhui -无及wuji -无机wuji -物价wujia -无间wujian -物件wujian -误解wujie -五届wujie -五金wujin -无愧wukui -无赖wulai -诬赖wulai -无理wuli -物理wuli -无礼wuli -物力wuli -武力wuli -无聊wuliao -无虑wulu -无论wulun -污蔑wumie -诬蔑wumie -无奈wunai -无能wuneng -毋宁wuning -务农wunong -物品wupin -无期wuqi -五七wuqi -武器wuqi -无情wuqing -无穷wuqiong -舞曲wuqu -无权wuquan -污染wuran -无任wuren -污辱wuru -侮辱wuru -物色wuse -无上wushang -误伤wushang -无声wusheng -午时wushi -务使wushi -无视wushi -误事wushi -务实wushi -无数wushu -武术wushu -无双wushuang -午睡wushui -五四wusi -无私wusi -舞台wutai -无题wuti -物体wuti -舞厅wuting -无为wuwei -无谓wuwei -无物wuwu -无暇wuxia -无限wuxian -诬陷wuxian -无效wuxiao -五星wuxing -午休wuxiu -无须wuxu -无需wuxu -务虚wuxu -午夜wuye -五一wuyi -无益wuyi -无疑wuyi -无垠wuyin -无用wuyong -毋庸wuyong -无余wuyu -无缘wuyuan -五月wuyue -物证wuzheng -无知wuzhi -物质wuzhi -武装wuzhuang -物资wuzi -兀自wuzi -误字wuzi -无罪wuzui -无微不至wwbz -唯物论wwl -卧薪尝胆wxcd -无线电wxd -微型机wxj -唯心论wxl -问心无愧wxwk -委员会wyh -无缘无故wywg -委员长wyz -误字率wzl -无足轻重wzqz -未知数wzs -完整无缺wzwq -学x -下x -行x -小x -线x -性x -新x -些x -想x -心x -向x -相x -系x -席x -现x -西x -修x -象x -先x -形x -心安理得xald -西安市xas -西半球xbq -相比之下xbzx -宣传部xcb -新陈代谢xcdx -新产品xcp -畜产品xcp -西城区xcq -喜出望外xcww -相对而言xdey -现代化xdh -想当然xdr -相对误差xdwc -先睹为快xdwk -形而上学xesx -显而易见xeyj -西方国家xfgj -消费品xfp -想方设法xfsf -先发制人xfzr -兴高采烈xgcl -新华社xhs -新华书店xhsd -系xi -席xi -西xi -习xi -细xi -吸xi -析xi -喜xi -洗xi -铣xi -稀xi -戏xi -隙xi -希xi -息xi -袭xi -锡xi -烯xi -牺xi -悉xi -惜xi -溪xi -腊*xi -栖*xi -昔xi -熙xi -硒xi -矽xi -晰xi -嘻xi -膝xi -夕xi -熄xi -汐xi -犀xi -檄xi -媳xi -僖xi -兮xi -隰xi -郗xi -茜*xi -菥xi -葸xi -蓰xi -奚xi -唏xi -徙xi -饩xi -阋xi -浠xi -淅xi -屣xi -嬉xi -玺xi -樨xi -曦xi -觋xi -欷xi -歙*xi -熹xi -禊xi -禧xi -皙xi -穸xi -裼*xi -蜥xi -螅xi -蟋xi -舄xi -舾xi -羲xi -粞xi -翕xi -醯xi -蹊*xi -鼷xi -下xia -夏xia -吓xia -狭xia -霞xia -唬*xia -瞎xia -虾xia -匣xia -辖xia -暇xia -峡xia -侠xia -厦xia -呷xia -狎xia -遐xia -瑕xia -柙xia -硖xia -瘕*xia -罅xia -黠xia -狭隘xiaai -下班xiaban -下辈xiabei -下边xiabian -下策xiace -下层xiaceng -下场xiachang -下沉xiachen -下次xiaci -瑕疵xiaci -下达xiada -吓倒xiadao -下等xiadeng -下毒xiadu -下发xiafa -下放xiafang -峡谷xiagu -霞光xiaguang -瞎话xiahua -喜爱xiai -下级xiaji -下集xiaji -夏季xiaji -下降xiajiang -侠客xiake -下来xialai -下联xialian -夏粮xialiang -下列xialie -下令xialing -下流xialiu -下落xialuo -下马xiama -厦门xiamen -下面xiamian -线xian -现xian -先xian -县xian -限xian -见*xian -显xian -鲜xian -献xian -险xian -陷xian -宪xian -纤xian -洗*xian -掀xian -弦xian -铣*xian -腺xian -锨xian -仙xian -咸xian -贤xian -衔xian -舷xian -闲xian -涎xian -嫌xian -馅xian -羡xian -冼xian -苋xian -莶xian -藓xian -岘xian -猃xian -暹xian -娴xian -氙xian -燹xian -祆xian -鹇xian -痫xian -蚬xian -筅xian -籼xian -酰xian -跣xian -跹xian -霰xian -西安xian -献宝xianbao -先辈xianbei -现场xianchang -现成xiancheng -县城xiancheng -献丑xianchou -献词xianci -现存xiancun -现代xiandai -先导xiandao -显得xiande -险地xiandi -限定xianding -限度xiandu -线段xianduan -限额xiane -险恶xiane -宪法xianfa -先锋xianfeng -险峰xianfeng -想xiang -向xiang -相xiang -象xiang -响xiang -项xiang -箱xiang -乡xiang -降*xiang -香xiang -像xiang -详xiang -橡xiang -享xiang -湘xiang -厢xiang -镶xiang -襄xiang -翔xiang -祥xiang -巷xiang -芗xiang -葙xiang -饷xiang -庠xiang -骧xiang -缃xiang -蟓xiang -鲞xiang -飨xiang -相爱xiangai -相比xiangbi -想必xiangbi -相差xiangcha -相称xiangcheng -相处xiangchu -相传xiangchuan -乡村xiangcun -相当xiangdang -向导xiangdao -相等xiangdeng -相对xiangdui -想法xiangfa -相反xiangfan -相仿xiangfang -相干xianggan -香港xianggang -相隔xiangge -相关xiangguan -相好xianghao -相互xianghu -相继xiangji -相加xiangjia -相见xiangjian -相减xiangjian -相交xiangjiao -橡胶xiangjiao -相近xiangjin -详尽xiangjin -巷口xiangkou -向来xianglai -相连xianglian -向量xiangliang -响亮xiangliang -相貌xiangmao -项目xiangmu -想念xiangnian -相片xiangpian -想起xiangqi -详情xiangqing -向上xiangshang -相声xiangsheng -响声xiangsheng -相识xiangshi -翔实xiangshi -享受xiangshou -相思xiangsi -相似xiangsi -香甜xiangtian -相同xiangtong -相投xiangtou -显贵xiangui -向往xiangwang -详细xiangxi -向下xiangxia -乡下xiangxia -象限xiangxian -想象xiangxiang -相信xiangxin -香烟xiangyan -相依xiangyi -相宜xiangyi -相应xiangying -相映xiangying -响应xiangying -享用xiangyong -相遇xiangyu -相约xiangyue -乡镇xiangzhen -象征xiangzheng -箱子xiangzi -陷害xianhai -显赫xianhe -鲜红xianhong -先后xianhou -鲜花xianhua -献花xianhua -闲话xianhua -贤惠xianhui -献计xianji -献技xianji -显见xianjian -衔接xianjie -先进xianjin -现金xianjin -险境xianjing -陷阱xianjing -现款xiankuan -现况xiankuang -先例xianli -献礼xianli -先烈xianlie -线路xianlu -显露xianlu -鲜美xianmei -鲜明xianming -贤明xianming -显目xianmu -羡慕xianmu -贤能xianneng -先期xianqi -掀起xianqi -限期xianqi -嫌弃xianqi -先前xianqian -先遣xianqian -险情xianqing -先驱xianqu -显然xianran -贤人xianren -闲人xianren -现任xianren -陷入xianru -闲散xiansan -献身xianshen -先生xiansheng -先是xianshi -现实xianshi -显示xianshi -娴熟xianshu -线索xiansuo -闲谈xiantan -险滩xiantan -先天xiantian -线条xiantiao -县委xianwei -纤维xianwei -显现xianxian -现象xianxiang -现行xianxing -鲜血xianxue -显眼xianyan -鲜艳xianyan -显要xianyao -险要xianyao -显耀xianyao -现役xianyi -嫌疑xianyi -现有xianyou -限于xianyu -闲杂xianza -现在xianzai -县长xianzhang -宪章xianzhang -限制xianzhi -先知xianzhi -闲置xianzhi -闲职xianzhi -显著xianzhu -现状xianzhuang -险阻xianzu -小xiao -消xiao -削xiao -效xiao -笑xiao -校xiao -销xiao -硝xiao -萧xiao -肖xiao -孝xiao -霄xiao -哮xiao -嚣xiao -宵xiao -淆xiao -晓xiao -啸xiao -哓xiao -崤xiao -潇xiao -逍xiao -骁xiao -绡xiao -枭xiao -枵xiao -蛸*xiao -筱xiao -箫xiao -魈xiao -小报xiaobao -小辈xiaobei -笑柄xiaobing -消沉xiaochen -消除xiaochu -消毒xiaodu -效法xiaofa -小贩xiaofan -消防xiaofang -消费xiaofei -校风xiaofeng -小鬼xiaogui -效果xiaoguo -小孩xiaohai -消耗xiaohao -消化xiaohua -笑话xiaohua -小惠xiaohui -销毁xiaohui -销魂xiaohun -消极xiaoji -削减xiaojian -小结xiaojie -小姐xiaojie -孝敬xiaojing -校刊xiaokan -小康xiaokang -效劳xiaolao -效力xiaoli -销路xiaolu -效率xiaolu -消灭xiaomie -消磨xiaomo -效能xiaoneng -消气xiaoqi -消遣xiaoqian -笑容xiaorong -削弱xiaoruo -潇洒xiaosa -校舍xiaoshe -小时xiaoshi -消失xiaoshi -消逝xiaoshi -消瘦xiaoshou -销售xiaoshou -小数xiaoshu -小说xiaoshuo -萧条xiaotiao -消息xiaoxi -肖像xiaoxiang -小心xiaoxin -枭雄xiaoxiong -小学xiaoxue -效验xiaoyan -逍遥xiaoyao -效益xiaoyi -效应xiaoying -校友xiaoyou -小于xiaoyu -校园xiaoyuan -销赃xiaozang -校长xiaozhang -嚣张xiaozhang -效忠xiaozhong -小组xiaozu -下情xiaqing -下去xiaqu -辖区xiaqu -下手xiashou -夏收xiashou -下属xiashu -下水xiashui -下台xiatai -夏天xiatian -下文xiawen -下午xiawu -下限xiaxian -下乡xiaxiang -遐想xiaxiang -狭义xiayi -下游xiayou -狭窄xiazhai -夏至xiazhi -夏种xiazhong -喜报xibao -细胞xibao -西北xibei -西边xibian -稀薄xibo -锡箔xibo -西餐xican -洗涤xidi -吸毒xidu -些xie -解*xie -写xie -斜xie -谢xie -协xie -械xie -叶*xie -血*xie -卸xie -屑xie -鞋xie -歇xie -邪xie -胁xie -蟹xie -泄xie -泻xie -契*xie -楔xie -蝎xie -挟xie -携xie -谐xie -懈xie -偕xie -亵xie -勰xie -燮xie -薤xie -撷xie -獬xie -廨xie -渫xie -瀣xie -邂xie -绁xie -缬xie -榭xie -榍xie -颉*xie -躞xie -写出xiechu -协从xiecong -携带xiedai -邪道xiedao -协调xiediao -协定xieding -亵渎xiedu -邪恶xiee -协和xiehe -谐和xiehe -协会xiehui -谢绝xiejue -协力xieli -泄漏xielou -邪路xielu -泄露xielu -泄密xiemi -邪念xienian -胁迫xiepo -邪气xieqi -协商xieshang -写生xiesheng -携手xieshou -邪说xieshuo -协同xietong -歇息xiexi -谢谢xiexie -协议xieyi -谐音xieyin -协约xieyue -写照xiezhao -协助xiezhu -鞋子xiezi -写作xiezuo -协作xiezuo -西方xifang -西风xifeng -西服xifu -吸附xifu -媳妇xifu -习惯xiguan -西汉xihan -稀罕xihan -希罕xihan -喜欢xihuan -袭击xiji -细节xijie -洗劫xijie -喜剧xiju -戏剧xiju -席卷xijuan -细菌xijun -犀利xili -系列xilie -奚落xiluo -熄灭ximie -新xin -心xin -信xin -锌xin -芯xin -辛xin -寻*xin -欣xin -薪xin -忻xin -衅xin -囟xin -馨xin -昕xin -歆xin -镡*xin -鑫xin -心爱xinai -西南xinan -新春xinchun -信贷xindai -心得xinde -心烦xinfan -心服xinfu -信服xinfu -行xing -性xing -形xing -型xing -星xing -兴xing -省*xing -醒xing -姓xing -幸xing -腥xing -猩xing -惺xing -刑xing -邢xing -杏xing -陉xing -荇xing -荥xing -擤xing -饧xing -悻xing -硎xing -心甘xingan -兴办xingban -性别xingbie -姓别xingbie -刑场xingchang -星辰xingchen -形成xingcheng -行程xingcheng -行动xingdong -幸而xinger -刑法xingfa -刑罚xingfa -兴奋xingfen -幸福xingfu -性格xingge -幸好xinghao -型号xinghao -行贿xinghui -星火xinghuo -性急xingji -形迹xingji -兴建xingjian -行径xingjing -行军xingjun -星空xingkong -幸亏xingkui -行李xingli -行旅xinglu -幸免xingmian -性命xingming -姓名xingming -醒目xingmu -性能xingneng -行期xingqi -兴起xingqi -星期xingqi -性情xingqing -星球xingqiu -兴趣xingqu -形容xingrong -行商xingshang -兴盛xingsheng -行使xingshi -行事xingshi -行驶xingshi -形式xingshi -幸事xingshi -刑事xingshi -形势xingshi -姓氏xingshi -行署xingshu -兴衰xingshuai -形态xingtai -形体xingti -兴亡xingwang -兴旺xingwang -行为xingwei -行文xingwen -醒悟xingwu -形象xingxiang -行销xingxiao -星星xingxing -行凶xingxiong -兴修xingxiu -行业xingye -星夜xingye -幸运xingyun -行政xingzheng -性质xingzhi -兴致xingzhi -形状xingzhuang -行走xingzou -信号xinhao -心狠xinhen -心慌xinhuang -信汇xinhui -细腻xini -西宁xining -心急xinji -信件xinjian -新疆xinjiang -新近xinjin -新居xinju -心坎xinkan -辛苦xinku -信赖xinlai -辛劳xinlao -心理xinli -心里xinli -心灵xinling -心目xinmu -信念xinnian -戏弄xinong -新奇xinqi -辛勤xinqin -心情xinqing -新区xinqu -新人xinren -信任xinren -欣赏xinshang -新生xinsheng -心声xinsheng -新事xinshi -新式xinshi -新书xinshu -薪水xinshui -心酸xinsuan -辛酸xinsuan -心疼xinteng -心田xintian -心跳xintiao -心头xintou -欣慰xinwei -新闻xinwen -心细xinxi -信息xinxi -欣喜xinxi -新鲜xinxian -心想xinxiang -信箱xinxiang -馨香xinxiang -信心xinxin -新型xinxing -新星xinxing -新兴xinxing -心虚xinxu -心血xinxue -信仰xinyang -心意xinyi -新异xinyi -新颖xinying -信用xinyong -新余xinyu -信誉xinyu -心愿xinyuan -心脏xinzang -新址xinzhi -心中xinzhong -雄xiong -胸xiong -兄xiong -凶xiong -熊xiong -匈xiong -汹xiong -芎xiong -雄辩xiongbian -雄兵xiongbing -凶残xiongcan -兄弟xiongdi -凶恶xionge -雄关xiongguan -凶狠xionghen -雄厚xionghou -胸怀xionghuai -雄健xiongjian -胸口xiongkou -熊猫xiongmao -凶猛xiongmeng -匈奴xiongnu -凶器xiongqi -凶杀xiongsha -雄师xiongshi -凶手xiongshou -胸膛xiongtang -雄伟xiongwei -雄心xiongxin -汹涌xiongyong -雄壮xiongzhuang -雄姿xiongzi -西欧xiou -习气xiqi -吸气xiqi -喜气xiqi -稀奇xiqi -希奇xiqi -喜庆xiqing -吸取xiqu -戏曲xiqu -昔日xiri -牺牲xisheng -西式xishi -喜事xishi -稀释xishi -吸收xishou -系数xishu -洗刷xishua -吸吮xishun -习俗xisu -习题xiti -西天xitian -系统xitong -修xiu -锈xiu -休xiu -袖xiu -秀xiu -朽xiu -宿*xiu -臭*xiu -羞xiu -嗅xiu -绣xiu -咻xiu -岫xiu -馐xiu -庥xiu -溴xiu -鸺xiu -貅xiu -髹xiu -修补xiubu -秀才xiucai -羞耻xiuchi -修辞xiuci -修订xiuding -修复xiufu -修改xiugai -修建xiujian -修剪xiujian -嗅觉xiujue -休克xiuke -羞愧xiukui -修理xiuli -秀丽xiuli -秀气xiuqi -羞辱xiuru -羞涩xiuse -修饰xiushi -休息xiuxi -休想xiuxiang -修养xiuyang -休养xiuyang -修造xiuzao -袖章xiuzhang -袖珍xiuzhen -修正xiuzheng -修筑xiuzhu -希望xiwang -席位xiwei -细微xiwei -西文xiwen -檄文xiwen -细小xixiao -细心xixin -悉心xixin -喜讯xixun -吸烟xiyan -西洋xiyang -西医xiyi -吸引xiyin -希有xiyou -戏院xiyuan -喜悦xiyue -西藏xizang -洗澡xizao -细则xize -细致xizhi -习作xizuo -下基层xjc -现阶段xjd -新技术xjs -献计献策xjxc -先见之明xjzm -兴利除弊xlcb -系列化xlh -稀里糊涂xlht -狭路相逢xlxf -畜牧业xmy -心满意足xmyz -西宁市xns -小朋友xpy -向前看xqk -喜气洋洋xqyy -先人后己xrhj -兴师动众xsdz -销售额xse -刑事犯罪xsfz -小时候xsh -新时期xsq -新生事物xssw -形式主义xszy -相提并论xtbl -续xu -许xu -须xu -需xu -序xu -虚xu -絮xu -畜xu -叙xu -蓄xu -绪xu -徐xu -墟xu -戌xu -嘘xu -酗xu -旭xu -恤xu -婿xu -吁*xu -诩xu -勖xu -圩xu -蓿xu -洫xu -浒*xu -溆xu -顼xu -栩xu -煦xu -砉*xu -盱xu -胥xu -糈xu -醑xu -选xuan -旋xuan -宣xuan -悬xuan -玄xuan -券*xuan -轩xuan -喧xuan -癣xuan -眩xuan -绚xuan -儇xuan -谖xuan -萱xuan -揎xuan -泫xuan -渲xuan -漩xuan -璇xuan -楦xuan -暄xuan -炫xuan -煊xuan -碹xuan -铉xuan -镟xuan -痃xuan -悬案xuanan -轩昂xuanang -选拔xuanba -宣布xuanbu -选材xuancai -选场xuanchang -宣称xuancheng -宣传xuanchuan -选定xuanding -宣读xuandu -宣告xuangao -选购xuangou -悬挂xuangua -玄乎xuanhu -喧哗xuanhua -选集xuanji -宣讲xuanjiang -选举xuanju -绚烂xuanlan -绚丽xuanli -选录xuanlu -旋律xuanlu -选民xuanmin -喧闹xuannao -悬念xuannian -选派xuanpai -宣判xuanpan -选配xuanpei -选票xuanpiao -选区xuanqu -选取xuanqu -喧嚷xuanrang -宣誓xuanshi -选手xuanshou -悬殊xuanshu -旋涡xuanwo -玄虚xuanxu -悬崖xuanya -宣言xuanyan -宣扬xuanyang -炫耀xuanyao -选用xuanyong -选择xuanze -宣战xuanzhan -选种xuanzhong -旋转xuanzhuan -许多xuduo -学xue -血xue -削*xue -雪xue -穴xue -靴xue -薛xue -谑xue -噱*xue -泶xue -踅xue -鳕xue -学报xuebao -学部xuebu -学潮xuechao -学费xuefei -学风xuefeng -学府xuefu -血汗xuehan -学好xuehao -学会xuehui -学籍xueji -血迹xueji -学科xueke -血泪xuelei -学历xueli -学龄xueling -学年xuenian -学派xuepai -学期xueqi -血肉xuerou -学生xuesheng -学时xueshi -学识xueshi -学士xueshi -学术xueshu -血书xueshu -学说xueshuo -血统xuetong -学徒xuetu -学位xuewei -学问xuewen -学习xuexi -血洗xuexi -学校xuexiao -血压xueya -学业xueye -血液xueye -学友xueyou -学员xueyuan -学院xueyuan -血晕xueyun -血战xuezhan -学者xuezhe -学制xuezhi -虚构xugou -序号xuhao -蓄积xuji -虚假xujia -叙旧xujiu -许可xuke -序列xulie -绪论xulun -虚名xuming -序幕xumu -畜牧xumu -训xun -旬xun -迅xun -讯xun -寻xun -循xun -巡xun -荤*xun -浚*xun -勋xun -熏xun -询xun -驯xun -殉xun -汛xun -逊xun -巽xun -郇*xun -埙xun -荀xun -蕈xun -薰xun -峋xun -徇xun -獯xun -恂xun -洵xun -浔xun -曛xun -窨*xun -醺xun -鲟xun -巡捕xunbu -巡查xuncha -寻常xunchang -驯服xunfu -殉国xunguo -巡航xunhang -循环xunhuan -巡回xunhui -虚拟xuni -寻机xunji -巡警xunjing -勋爵xunjue -训练xunlian -巡逻xunluo -迅猛xunmeng -寻求xunqiu -逊色xunse -巡视xunshi -徇私xunsi -迅速xunsu -熏陶xuntao -许诺xunuo -讯问xunwen -询问xunwen -寻衅xunxin -循序xunxu -勋章xunzhang -寻找xunzhao -殉职xunzhi -寻址xunzhi -需求xuqiu -序曲xuqu -虚荣xurong -虚弱xuruo -虚设xushe -叙事xushi -虚实xushi -序数xushu -虚数xushu -叙述xushu -叙说xushuo -虚伪xuwei -虚心xuxin -序言xuyan -需要xuyao -须臾xuyu -许愿xuyuan -须知xuzhi -宣武区xwq -信息处理xxcl -循序见进xxjj -辛辛苦苦xxkk -信息量xxl -熙熙攘攘xxrr -小学生xxs -欣欣向荣xxxr -小心翼翼xxyy -下一步xyb -胸有成竹xycz -洗衣机xyj -小意思xys -习以为常xywc -新颖性xyx -兴致勃勃xzbb -新中国xzg -行政区域xzqy -雪中送炭xzst -心中无数xzws -选择性xzx -心中有数xzys -行之有效xzyx -一y -有y -用y -要y -以y -于y -也y -样y -义y -与y -由y -压y -员y -月y -意y -又y -运y -原y -油y -验y -压ya -亚ya -呀ya -牙ya -芽ya -雅ya -蚜ya -鸭ya -匹*ya -押ya -鸦ya -丫ya -崖ya -衙ya -涯ya -哑ya -讶ya -伢ya -垭ya -揠ya -岈ya -迓ya -娅ya -琊ya -桠ya -氩ya -砑ya -睚ya -痖ya -哑巴yaba -牙齿yachi -压倒yadao -压服yafu -牙关yaguan -雅观yaguan -压价yajia -押金yajin -亚军yajun -压力yali -验yan -研yan -严yan -眼yan -言yan -盐yan -演yan -岩yan -沿yan -烟yan -延yan -掩yan -宴yan -炎yan -颜yan -燕yan -衍yan -铅*yan -焉yan -咽yan -阉yan -淹yan -蜒yan -阎yan -奄yan -艳yan -堰yan -厌yan -砚yan -雁yan -唁yan -彦yan -焰yan -谚yan -殷*yan -厣yan -赝yan -剡*yan -俨yan -偃yan -兖yan -谳yan -阽*yan -郾yan -鄢yan -芫*yan -菸yan -崦yan -恹yan -闫yan -阏yan -湮yan -滟yan -妍yan -嫣yan -琰yan -檐yan -晏yan -胭yan -腌*yan -焱yan -罨yan -筵yan -酽yan -魇yan -餍yan -鼹yan -沿岸yanan -严办yanban -掩蔽yanbi -演变yanbian -烟草yancao -延长yanchang -演唱yanchang -严惩yancheng -延迟yanchi -演出yanchu -唁电yandian -严冬yandong -厌恶yane -厌烦yanfan -样yang -养yang -氧yang -扬yang -洋yang -阳yang -羊yang -秧yang -央yang -杨yang -仰yang -殃yang -鸯yang -佯yang -疡yang -痒yang -漾yang -徉yang -怏yang -泱yang -炀yang -烊yang -恙yang -蛘yang -鞅yang -掩盖yangai -样板yangban -样本yangben -洋财yangcai -养成yangcheng -沿革yange -严格yange -阳光yangguang -洋行yanghang -养护yanghu -氧化yanghua -养料yangliao -杨柳yangliu -仰面yangmian -殃民yangmin -仰慕yangmu -样品yangpin -洋气yangqi -扬弃yangqi -央求yangqiu -养伤yangshang -样式yangshi -阳台yangtai -眼光yanguang -仰望yangwang -洋务yangwu -洋相yangxiang -扬言yangyan -样样yangyang -洋溢yangyi -养育yangyu -养殖yangzhi -样子yangzi -沿海yanhai -严寒yanhan -眼红yanhong -咽喉yanhou -掩护yanhu -眼花yanhua -延缓yanhuan -宴会yanhui -焰火yanhuo -演讲yanjiang -眼界yanjie -严禁yanjin -严谨yanjin -眼镜yanjing -眼睛yanjing -研究yanjiu -严峻yanjun -眼看yankan -严酷yanku -眼眶yankuang -眼泪yanlei -眼力yanli -严厉yanli -艳丽yanli -眼帘yanlian -眼亮yanliang -言路yanlu -沿路yanlu -言论yanlun -掩埋yanmai -严密yanmi -严明yanming -烟幕yanmu -延年yannian -延期yanqi -眼前yanqian -宴请yanqing -俨然yanran -炎热yanre -眼色yanse -颜色yanse -延伸yanshen -岩石yanshi -演示yanshi -掩饰yanshi -验收yanshou -严守yanshou -延寿yanshou -演说yanshuo -严肃yansu -演算yansuan -言谈yantan -研讨yantao -沿途yantu -阎王yanwang -延误yanwu -烟雾yanwu -宴席yanxi -筵席yanxi -演习yanxi -沿袭yanxi -眼下yanxia -沿线yanxian -言行yanxing -严刑yanxing -延续yanxu -艳阳yanyang -演义yanyi -演绎yanyi -掩映yanying -沿用yanyong -言语yanyu -演员yanyuan -厌战yanzhan -沿着yanzhe -验证yanzheng -研制yanzhi -严重yanzhong -演奏yanzou -要yao -药yao -约*yao -摇yao -腰yao -咬yao -邀yao -耀yao -陶*yao -侥*yao -疟yao -妖yao -瑶yao -尧yao -遥yao -窑yao -谣yao -姚yao -舀yao -钥*yao -夭yao -爻yao -吆yao -崾yao -徭yao -幺yao -珧yao -杳yao -轺yao -曜yao -肴yao -铫*yao -鹞yao -窈yao -繇yao -鳐yao -摇摆yaobai -腰包yaobao -要不yaobu -谣传yaochuan -要得yaode -要点yaodian -摇动yaodong -窑洞yaodong -遥感yaogan -妖怪yaoguai -要害yaohai -摇撼yaohan -摇晃yaohuang -要件yaojian -要紧yaojin -摇控yaokong -遥控yaokong -摇篮yaolan -要领yaoling -要么yaome -妖魔yaomo -要目yaomu -邀请yaoqing -要求yaoqiu -要塞yaosai -要是yaoshi -钥匙yaoshi -要素yaosu -窈窕yaotiao -摇头yaotou -要闻yaowen -药物yaowu -要挟yaoxie -耀眼yaoyan -谣言yaoyan -妖艳yaoyan -夭折yaozhe -要职yaozhi -鸦片yapian -压迫yapo -压强yaqiang -压缩yasuo -雅兴yaxing -压仰yayang -压抑yayi -压榨yazha -压制yazhi -雅致yazhi -亚洲yazhou -鸭子yazi -雅座yazuo -要不得ybd -一般的说ybds -一部分ybf -要不然ybr -要不是ybs -一般说来ybsl -要不要yby -一辈子ybz -一把抓ybz -用不着ybz -扬长避短ycbd -由此可见yckj -银川市ycs -与此同时ycts -有偿转让yczr -邮电部ydb -有道德ydd -邮电局ydj -一刀切ydq -运动员ydy -印度洋ydy -因地制宜ydzy -也ye -业ye -页ye -叶ye -液ye -夜ye -野ye -爷ye -冶ye -邪*ye -哗*ye -咽*ye -椰ye -噎ye -耶ye -掖ye -曳ye -腋ye -拽*ye -靥ye -谒ye -邺ye -揶ye -晔ye -烨ye -铘ye -夜餐yecan -野餐yecan -野火yehuo -业绩yeji -夜间yejian -冶金yejin -夜里yeli -冶练yelian -野蛮yeman -夜幕yemu -夜色yese -也是yeshi -夜市yeshi -野兽yeshou -液体yeti -野外yewai -夜晚yewan -业务yewu -夜校yexiao -野心yexin -野性yexing -也许yexu -幼儿园yey -爷爷yeye -野营yeying -业余yeyu -野战yezhan -叶子yezi -一方面yfm -一分为二yfwe -阳奉阴违yfyw -一概而论ygel -一国两制yglz -有根有据ygyj -严格要求ygyq -有何特长yhtc -银行帐号yhzh -炎黄子孙yhzs -一yi -以yi -义yi -意yi -已yi -移yi -医yi -议yi -依yi -易yi -乙yi -艺yi -益yi -异yi -宜yi -仪yi -亿yi -遗yi -伊yi -役yi -衣yi -疑yi -亦yi -谊yi -翼yi -译yi -抑yi -忆yi -疫yi -壹yi -揖yi -铱yi -颐yi -夷yi -胰yi -沂yi -姨yi -彝yi -椅yi -蚁yi -倚yi -矣yi -邑yi -屹yi -臆yi -逸yi -肄yi -裔yi -毅yi -溢yi -诣yi -翌yi -绎yi -刈yi -劓yi -仡*yi -佚yi -佾yi -诒yi -圯yi -埸yi -懿yi -苡yi -荑yi -薏yi -弈yi -奕yi -挹yi -弋yi -呓yi -咦yi -咿yi -嗌*yi -噫yi -峄yi -嶷yi -猗yi -饴yi -怿yi -怡yi -悒yi -漪yi -迤yi -驿yi -缢yi -殪yi -轶yi -贻yi -欹*yi -旖yi -熠yi -眙yi -钇yi -镒yi -镱yi -痍yi -瘗yi -癔yi -翊yi -蜴yi -舣yi -羿yi -翳yi -酏yi -黟yi -议案yian -疑案yian -一半yiban -一般yiban -一斑yiban -一边yibian -以便yibian -仪表yibiao -一并yibing -异步yibu -遗产yichan -异常yichang -议程yicheng -益处yichu -遗传yichuan -一次yici -依次yici -依从yicong -一代yidai -一带yidai -一旦yidan -一点yidian -一定yiding -议定yiding -移动yidong -一度yidu -遗毒yidu -一端yiduan -臆断yiduan -亿吨yidun -一发yifa -依法yifa -义愤yifen -衣服yifu -依附yifu -一概yigai -一个yige -一共yigong -议购yigou -已故yigu -一贯yiguan -异国yiguo -遗憾yihan -遗恨yihen -以后yihou -异化yihua -议会yihui -疑惑yihuo -以及yiji -异己yiji -遗迹yiji -议价yijia -意见yijian -移交yijiao -一届yijie -一经yijing -已经yijing -意境yijing -依旧yijiu -一举yiju -依据yiju -移居yiju -议决yijue -依靠yikao -倚靠yikao -一刻yike -医科yike -一块yikuai -以来yilai -依赖yilai -一览yilan -一例yili -毅力yili -屹立yili -一连yilian -意料yiliao -医疗yiliao -遗留yiliu -遗漏yilou -一律yilu -疑虑yilu -议论yilun -一面yimian -以免yimian -疫苗yimiao -移民yimin -因yin -引yin -阴yin -印yin -音yin -银yin -烟*yin -隐yin -饮yin -荫yin -茵yin -殷yin -姻yin -吟yin -淫yin -寅yin -尹yin -胤yin -鄞yin -圻*yin -垠yin -堙yin -茚yin -吲yin -喑yin -狺yin -夤yin -洇yin -湮*yin -氤yin -铟yin -瘾yin -窨yin -蚓yin -霪yin -龈yin -疑难yinan -阴暗yinan -隐蔽yinbi -音标yinbiao -隐藏yincang -阴沉yinchen -银川yinchuan -因此yinci -引导yindao -音调yindiao -印度yindu -引渡yindu -以内yinei -因而yiner -印发yinfa -音符yinfu -应ying -影ying -硬ying -营ying -英ying -映ying -迎ying -樱ying -婴ying -鹰ying -缨ying -莹ying -萤ying -荧ying -蝇ying -赢ying -盈ying -颖ying -嬴ying -郢ying -茔ying -荥*ying -莺ying -萦ying -蓥ying -撄ying -嘤ying -膺ying -滢ying -潆ying -瀛ying -瑛ying -璎ying -楹ying -媵ying -鹦ying -瘿ying -颍ying -罂ying -英镑yingbang -硬币yingbi -应变yingbian -映衬yingchen -应酬yingchou -迎春yingchun -应当yingdang -赢得yingde -婴儿yinger -营房yingfang -迎风yingfeng -应付yingfu -应该yinggai -英国yingguo -樱花yinghua -英魂yinghun -应急yingji -硬件yingjian -迎接yingjie -应届yingjie -英杰yingjie -营救yingjiu -英俊yingjun -盈亏yingkui -赢利yingli -盈利yingli -英烈yinglie -迎面yingmian -英明yingming -硬盘yingpan -影片yingpian -硬拼yingpin -影射yingshe -映射yingshe -樱桃yingtao -迎头yingtou -因果yinguo -影响yingxiang -硬性yingxing -英雄yingxiong -营养yingyang -应邀yingyao -营业yingye -应用yingyong -英勇yingyong -应有yingyou -英语yingyu -盈余yingyu -营造yingzao -应战yingzhan -迎战yingzhan -映照yingzhao -应征yingzheng -影子yingzi -英姿yingzi -银行yinhang -引号yinhao -殷红yinhong -隐患yinhuan -淫秽yinhui -阴魂yinhun -意念yinian -姨娘yiniang -阴极yinji -印鉴yinjian -引进yinjin -引力yinli -阴历yinli -阴凉yinliang -引路yinlu -隐瞒yinman -阴谋yinmou -银幕yinmu -隐慝yinni -银牌yinpai -引起yinqi -殷切yinqie -殷勤yinqin -引擎yinqing -引人yinren -饮食yinshi -印刷yinshua -饮水yinshui -因素yinsu -阴天yintian -引退yintui -因为yinwei -淫威yinwei -阴险yinxian -印象yinxiang -音响yinxiang -音信yinxin -因循yinxun -引言yinyan -阴影yinying -引用yinyong -引诱yinyou -阴雨yinyu -姻缘yinyuan -隐约yinyue -音乐yinyue -引证yinzheng -印证yinzheng -一片yipian -一瞥yipie -一起yiqi -一齐yiqi -义气yiqi -意气yiqi -仪器yiqi -遗弃yiqi -以前yiqian -一切yiqie -依然yiran -亦然yiran -毅然yiran -艺人yiren -宜人yiren -遗容yirong -以上yishang -一生yisheng -医生yisheng -一时yishi -一事yishi -意识yishi -议事yishi -逸事yishi -仪式yishi -医师yishi -医士yishi -遗失yishi -一手yishou -遗书yishu -艺术yishu -意思yisi -一体yiti -议题yiti -遗体yiti -一天yitian -一同yitong -异同yitong -一头yitou -意图yitu -疑团yituan -以外yiwai -意外yiwai -亿万yiwan -以往yiwang -遗忘yiwang -以为yiwei -意味yiwei -意文yiwen -疑问yiwen -译文yiwen -一无yiwu -义务yiwu -遗物yiwu -医务yiwu -贻误yiwu -一下yixia -以下yixia -一线yixian -一向yixiang -一项yixiang -意向yixiang -遗像yixiang -一些yixie -一心yixin -疑心yixin -异性yixing -医学yixue -一言yiyan -义演yiyan -遗言yiyan -一样yiyang -医药yiyao -意义yiyi -异议yiyi -义勇yiyong -易于yiyu -议员yiyuan -意愿yiyuan -医院yiyuan -亿元yiyuan -遗愿yiyuan -疑云yiyun -一再yizai -一早yizao -臆造yizao -依仗yizhang -仪仗yizhang -一朝yizhao -衣着yizhao -依照yizhao -一阵yizhen -一直yizhi -一致yizhi -以至yizhi -以致yizhi -意志yizhi -抑制yizhi -医治yizhi -抑止yizhi -移植yizhi -遗址yizhi -一种yizhong -遗嘱yizhu -研究会yjh -有纪律yjl -研究生yjs -研究所yjs -研究室yjs -养精畜锐yjxr -研究员yjy -拥军优属yjys -一技之长yjzc -一口气ykq -一览表ylb -以理服人ylfr -阅览室yls -有理想ylx -有利于yly -越来越yly -有目共睹ymgd -一目了然ymlr -有没有ymy -云南省yns -育*yo -哟yo -唷yo -用yong -勇yong -永yong -拥yong -涌yong -蛹yong -庸yong -佣yong -臃yong -痈yong -雍yong -踊yong -咏yong -泳yong -恿yong -俑yong -壅yong -墉yong -喁yong -慵yong -邕yong -镛yong -甬yong -鳙yong -饔yong -拥抱yongbao -永别yongbie -永不yongbu -用处yongchu -用度yongdu -用法yongfa -用费yongfei -勇敢yonggan -用功yonggong -永恒yongheng -用户yonghu -拥护yonghu -拥挤yongji -永久yongjiu -用具yongju -永诀yongjue -用力yongli -庸碌yonglu -勇猛yongmeng -用品yongpin -勇气yongqi -勇士yongshi -庸俗yongsu -咏叹yongtan -用途yongtu -涌现yongxian -用心yongxin -用意yongyi -拥有yongyou -用于yongyu -勇于yongyu -永远yongyuan -踊跃yongyue -有you -由you -又you -油you -右you -友you -优you -幼you -游you -尤you -诱you -犹you -幽you -悠you -忧you -邮you -铀you -酉you -佑you -釉you -卣you -攸you -侑you -莠you -莜you -莸you -尢*you -呦you -囿you -宥you -柚you -猷you -牖you -铕you -疣you -蚰you -蚴you -蝣you -蝤*you -繇*you -鱿you -黝you -鼬you -有碍youai -友爱youai -幽暗youan -友邦youbang -右边youbian -忧愁youchou -由此youci -有错youcuo -有待youdai -优待youdai -诱导youdao -有的youde -优等youdeng -有点youdian -邮电youdian -优点youdian -诱发youfa -有功yougong -有关youguan -有害youhai -友好youhao -优化youhua -油画youhua -幽会youhui -优惠youhui -诱惑youhuo -有机youji -游击youji -有劲youjin -幽静youjing -悠久youjiu -邮局youju -由来youlai -游览youlan -有劳youlao -有利youli -有力youli -游离youli -优良youliang -优劣youlie -幽灵youling -忧虑youlu -优美youmei -幼苗youmiao -有名youming -幽默youmo -右派youpai -诱骗youpian -邮票youpiao -尤其youqi -油漆youqi -友情youqing -右倾youqing -有趣youqu -油然youran -犹如youru -有色youse -优胜yousheng -有时youshi -有事youshi -有失youshi -优势youshi -有数youshu -油水youshui -有所yousuo -有望youwang -有为youwei -游戏youxi -有限youxian -优先youxian -悠闲youxian -有效youxiao -幼小youxiao -有些youxie -有心youxin -游行youxing -优秀youxiu -幽雅youya -悠扬youyang -又要youyao -有益youyi -优异youyi -友谊youyi -有用youyong -游泳youyong -有余youyu -由于youyu -犹豫youyu -忧郁youyu -悠远youyuan -优越youyue -有着youzhe -邮政youzheng -优质youzhi -幼稚youzhi -由衷youzhong -邮资youzi -有求必应yqby -以权谋私yqms -有气无力yqwl -迎刃而解yrej -因人而异yrey -与人为善yrws -引人注目yrzm -意识到ysd -艺术家ysj -因势利导ysld -印刷体yst -意识形态ysxt -衣食住行yszx -以身作则yszz -研讨会yth -一条龙ytl -一条心ytx -有条有理ytyl -于yu -与yu -育yu -鱼yu -雨yu -玉yu -余yu -遇yu -预yu -域yu -语yu -愈yu -渔yu -予yu -羽yu -愚yu -御yu -谷*yu -欲yu -宇yu -蔚*yu -尉*yu -迂yu -淤yu -盂yu -榆yu -虞yu -舆yu -俞yu -逾yu -愉yu -渝yu -隅yu -娱yu -屿yu -禹yu -芋yu -郁yu -吁yu -喻yu -峪yu -狱yu -誉yu -浴yu -寓yu -裕yu -豫yu -驭yu -粥*yu -禺yu -毓yu -伛yu -俣yu -谀yu -谕yu -萸yu -菀*yu -蓣yu -揄yu -圄yu -圉yu -嵛yu -狳yu -饫yu -馀yu -庾yu -阈yu -鬻yu -妪yu -妤yu -纡yu -瑜yu -昱yu -觎yu -腴yu -腧*yu -欤yu -於yu -煜yu -熨yu -燠yu -聿yu -钰yu -鹆yu -鹬yu -瘐yu -瘀yu -窬yu -窳yu -蜮yu -蝓yu -竽yu -臾yu -舁yu -雩yu -龉yu -员yuan -原yuan -圆yuan -源yuan -元yuan -远yuan -愿yuan -院yuan -缘yuan -援yuan -园yuan -怨yuan -鸳yuan -渊yuan -冤yuan -垣yuan -袁yuan -辕yuan -猿yuan -苑yuan -垸yuan -塬yuan -芫yuan -掾yuan -圜*yuan -沅yuan -媛yuan -瑗yuan -橼yuan -爰yuan -眢yuan -鸢yuan -螈yuan -箢yuan -鼋yuan -原本yuanben -渊博yuanbo -冤仇yuanchou -远大yuanda -元旦yuandan -园地yuandi -园丁yuanding -远东yuandong -远方yuanfang -缘分yuanfen -原告yuangao -原故yuangu -缘故yuangu -圆滑yuanhua -原籍yuanji -冤家yuanjia -元件yuanjian -远见yuanjian -远近yuanjin -远景yuanjing -援救yuanjiu -原来yuanlai -原理yuanli -原谅yuanliang -原料yuanliao -远虑yuanlu -圆满yuanman -远谋yuanmou -远期yuanqi -冤屈yuanqu -源泉yuanquan -原始yuanshi -远视yuanshi -元首yuanshou -元帅yuanshuai -元素yuansu -援外yuanwai -愿望yuanwang -冤枉yuanwang -原先yuanxian -远销yuanxiao -元宵yuanxiao -院校yuanxiao -原形yuanxing -怨言yuanyan -原野yuanye -愿意yuanyi -园艺yuanyi -原因yuanyin -援引yuanyin -原有yuanyou -缘由yuanyou -远游yuanyou -远远yuanyuan -渊源yuanyuan -元月yuanyue -原则yuanze -院长yuanzhang -远征yuanzheng -援助yuanzhu -原子yuanzi -院子yuanzi -预报yubao -预备yubei -愚笨yuben -余步yubu -预测yuce -愚蠢yuchun -遇到yudao -预定yuding -预订yuding -余毒yudu -月yue -说*yue -越yue -约yue -乐*yue -跃yue -曰yue -阅yue -钥yue -岳yue -粤yue -悦yue -龠yue -瀹yue -栎*yue -樾yue -刖yue -钺yue -月报yuebao -月初yuechu -月底yuedi -约定yueding -月度yuedu -阅读yuedu -乐队yuedui -约法yuefa -月份yuefen -月光yueguang -越轨yuegui -约会yuehui -越界yuejie -跃进yuejin -越境yuejing -阅览yuelan -阅历yueli -月亮yueliang -月末yuemo -约莫yuemo -越南yuenan -乐谱yuepu -乐器yueqi -月球yueqiu -乐曲yuequ -月色yuese -越是yueshi -约束yueshu -月台yuetai -乐团yuetuan -约有yueyou -乐章yuezhang -预防yufang -预风yufeng -预付yufu -预感yugan -预告yugao -预购yugou -遇害yuhai -宇航yuhang -与会yuhui -迂回yuhui -雨季yuji -预计yuji -遇见yujian -预见yujian -语句yuju -豫剧yuju -愉快yukuai -娱乐yule -鱼雷yulei -预料yuliao -雨露yulu -舆论yulun -愚昧yumei -育苗yumiao -预谋yumou -运yun -员*yun -云yun -匀yun -均*yun -允yun -孕yun -耘yun -郧yun -陨yun -蕴yun -酝yun -晕yun -韵yun -郓yun -芸yun -狁yun -恽yun -愠yun -纭yun -韫yun -殒yun -昀yun -氲yun -熨yun -遇难yunan -云彩yuncai -蕴藏yuncang -匀称yuncheng -运动yundong -熨斗yundou -云海yunhai -运河yunhe -韵律yunlu -陨落yunluo -云南yunnan -酝酿yunnian -允诺yunnuo -愚弄yunong -运气yunqi -运输yunshu -运算yunsuan -云梯yunti -运往yunwang -韵味yunwei -云雾yunwu -云霞yunxia -运行yunxing -允许yunxu -运用yunyong -孕育yunyu -运载yunzai -运转yunzhuan -与其yuqi -语气yuqi -预期yuqi -预审yushen -于是yushi -预示yushi -预售yushou -雨水yushui -预算yusuan -欲望yuwang -语文yuwen -预习yuxi -预先yuxian -遇险yuxian -预想yuxiang -预言yuyan -语言yuyan -寓言yuyan -预演yuyan -予以yuyi -寓于yuyu -愉悦yuyue -预兆yuzhao -预支yuzhi -宇宙yuzhou -有文化ywh -业务联系ywlx -意味着ywz -有限公司yxgs -一系列yxl -有效期yxq -医学院yxy -一心一意yxyy -游泳池yyc -营业额yye -夜以继日yyjr -应用科学yykx -一言堂yyt -引以为戒yywj -优越性yyx -营业员yyy -隐隐约约yyyy -运用自如yyzr -拥政爱民yzam -原子能yzn -已知数yzs -有助于yzy -言之有理yzyl -在z -这z -主z -中z -种z -着z -争z -战z -作z -正z -之z -制z -重z -组z -治z -只z -子z -自z -质z -指z -杂za -扎*za -咱za -匝za -砸za -咋za -咂za -在zai -再zai -载zai -栽zai -灾zai -仔*zai -哉zai -宰zai -崽zai -甾zai -再版zaiban -再不zaibu -在场zaichang -再度zaidu -宰割zaige -灾害zaihai -再好zaihao -在乎zaihu -灾荒zaihuang -再会zaihui -灾祸zaihuo -再见zaijian -在理zaili -灾民zaimin -灾难zainan -栽培zaipei -再起zaiqi -灾情zaiqing -灾区zaiqu -再三zaisan -在世zaishi -再说zaishuo -载体zaiti -在下zaixia -再现zaixian -宰相zaixiang -在意zaiyi -在于zaiyu -再造zaizao -再则zaize -在职zaizhi -再植zaizhi -杂技zaji -杂粮zaliang -杂乱zaluan -赞zan -咱zan -暂zan -攒zan -拶zan -瓒zan -昝zan -簪zan -糌zan -趱zan -錾zan -赞成zancheng -暂定zanding -藏*zang -脏zang -葬zang -赃zang -奘zang -驵zang -臧zang -赞歌zange -赃款zangkuan -葬送zangsong -赃物zangwu -藏族zangzu -杂念zanian -赞美zanmei -咱们zanmen -暂且zanqie -暂缺zanque -赞赏zanshang -暂时zanshi -赞颂zansong -赞叹zantan -暂停zanting -赞同zantong -暂行zanxing -赞扬zanyang -暂用zanyong -赞助zanzhu -造zao -早zao -遭zao -燥zao -凿zao -糟zao -枣zao -皂zao -藻zao -澡zao -蚤zao -躁zao -噪zao -灶zao -唣zao -早晨zaochen -造成zaocheng -凿穿zaochuan -造次zaoci -造词zaoci -遭到zaodao -早稻zaodao -造反zaofan -早饭zaofan -造福zaofu -糟糕zaogao -造化zaohua -造价zaojia -造就zaojiu -造林zaolin -早年zaonian -糟粕zaopo -早期zaoqi -早日zaori -早上zaoshang -遭受zaoshou -早衰zaoshuai -糟蹋zaota -早晚zaowan -造型zaoxing -遭殃zaoyang -造谣zaoyao -造诣zaoyi -早已zaoyi -噪音zaoyin -遭遇zaoyu -造字zaozi -杂谈zatan -杂文zawen -杂质zazhi -杂志zazhi -资本主义zbzy -资产阶级zcjj -增长率zcl -总参谋部zcmb -真才实学zcsx -自动化zdh -自动检测zdjc -自动检索zdjs -自动控制zdkz -主动权zdq -招待所zds -总的说来zdsl -主动性zdx -则ze -择ze -责ze -侧*ze -泽ze -咋*ze -仄ze -赜ze -啧ze -帻ze -迮ze -昃ze -笮ze -箦ze -舴ze -责备zebei -责成zecheng -责罚zefa -责怪zeguai -贼zei -责令zeling -责骂zema -怎zen -谮zen -增zeng -曾zeng -综*zeng -憎zeng -赠zeng -缯zeng -甑zeng -罾zeng -锃zeng -增补zengbu -增产zengchan -增长zengchang -增大zengda -增订zengding -增多zengduo -增高zenggao -憎恨zenghen -增加zengjia -增减zengjian -增进zengjin -增量zengliang -赠品zengpin -增强zengqiang -增删zengshan -增设zengshe -赠送zengsong -增添zengtian -赠言zengyan -增益zengyi -增援zengyuan -怎么zenme -怎奈zennai -怎样zenyang -责任zeren -责问zewen -总而言之zeyz -争分夺秒zfdm -针锋相对zfxd -自负盈亏zfyk -中关村zgc -自告奋勇zgfy -中国共产党zggd -总工会zgh -中国特色的zgtd -中国银行zgyh -自古以来zgyl -中国政府zgzf -中共中央zgzy -查*zha -扎zha -炸zha -闸zha -铡zha -轧zha -渣zha -蜡*zha -喳zha -札zha -眨zha -栅zha -榨zha -咋*zha -乍zha -诈zha -柞*zha -揸zha -吒zha -咤zha -哳zha -喋*zha -楂*zha -砟zha -痄zha -蚱zha -齄zha -炸弹zhadan -扎根zhagen -炸毁zhahui -寨zhai -侧*zhai -择*zhai -摘zhai -窄zhai -斋zhai -翟*zhai -祭*zhai -宅zhai -债zhai -砦zhai -瘵zhai -摘录zhailu -债权zhaiquan -债务zhaiwu -窄小zhaixiao -摘要zhaiyao -札记zhaji -战zhan -展zhan -站zhan -占zhan -粘*zhan -颤*zhan -瞻zhan -毡zhan -詹zhan -沾zhan -盏zhan -斩zhan -辗zhan -崭zhan -蘸zhan -栈zhan -湛zhan -绽zhan -谵zhan -搌zhan -旃zhan -战败zhanbai -战报zhanbao -战备zhanbei -战场zhanchang -展翅zhanchi -展出zhanchu -战地zhandi -战斗zhandou -战犯zhanfan -长*zhang -张zhang -章zhang -掌zhang -仗zhang -障zhang -胀zhang -涨zhang -账zhang -樟zhang -彰zhang -漳zhang -杖zhang -丈zhang -帐zhang -瘴zhang -仉zhang -鄣zhang -幛zhang -嶂zhang -獐zhang -嫜zhang -璋zhang -蟑zhang -障碍zhangai -站岗zhangang -长辈zhangbei -章程zhangcheng -长大zhangda -战歌zhange -章法zhangfa -帐房zhangfang -丈夫zhangfu -掌管zhangguan -帐号zhanghao -章节zhangjie -帐目zhangmu -战功zhangong -掌权zhangquan -张贴zhangtie -战鼓zhangu -沾光zhanguang -战国zhanguo -战果zhanguo -张望zhangwang -掌握zhangwo -张扬zhangyang -战壕zhanhao -战后zhanhou -战机zhanji -战绩zhanji -战局zhanju -占据zhanju -展开zhankai -战况zhankuang -展览zhanlan -占领zhanling -战略zhanlue -战马zhanma -展品zhanpin -战区zhanqu -沾染zhanran -战胜zhansheng -战时zhanshi -战事zhanshi -战士zhanshi -展示zhanshi -战术zhanshu -展望zhanwang -战线zhanxian -展现zhanxian -展销zhanxiao -崭新zhanxin -瞻仰zhanyang -战役zhanyi -占用zhanyong -占有zhanyou -战友zhanyou -站长zhanzhang -战争zhanzheng -着*zhao -照zhao -找zhao -招zhao -朝*zhao -召zhao -赵zhao -爪zhao -罩zhao -沼zhao -兆zhao -嘲*zhao -昭zhao -肇zhao -诏zhao -啁*zhao -棹zhao -钊zhao -笊zhao -照办zhaoban -照搬zhaoban -招标zhaobiao -照常zhaochang -照抄zhaochao -招待zhaodai -照发zhaofa -招工zhaogong -照顾zhaogu -招呼zhaohu -召唤zhaohuan -照会zhaohui -着急zhaoji -招集zhaoji -召集zhaoji -招架zhaojia -召开zhaokai -招考zhaokao -招揽zhaolan -着力zhaoli -照例zhaoli -照料zhaoliao -着落zhaoluo -着迷zhaomi -照明zhaoming -招聘zhaopin -朝气zhaoqi -招惹zhaore -照射zhaoshe -招生zhaosheng -着手zhaoshou -招手zhaoshou -招收zhaoshou -招贴zhaotie -朝夕zhaoxi -朝霞zhaoxia -着想zhaoxiang -照相zhaoxiang -昭雪zhaoxue -找寻zhaoxun -着眼zhaoyan -照样zhaoyang -照耀zhaoyao -照应zhaoying -招展zhaozhan -招致zhaozhi -着重zhaozhong -照着zhaozhuo -诈骗zhapian -榨取zhaqu -诈取zhaqu -扎实zhashi -炸药zhayao -渣滓zhazi -这zhe -着zhe -者zhe -折zhe -哲zhe -浙zhe -遮zhe -蛰zhe -辙zhe -锗zhe -蔗zhe -谪zhe -摺zhe -柘zhe -辄zhe -磔zhe -鹧zhe -褶zhe -蜇zhe -赭zhe -这般zheban -这边zhebian -这次zheci -遮挡zhedang -这点zhedian -折叠zhedie -折服zhefu -遮盖zhegai -这个zhege -折合zhehe -浙江zhejiang -折旧zhejiu -折扣zhekou -这里zheli -哲理zheli -这么zheme -折磨zhemo -真zhen -针zhen -阵zhen -镇zhen -振zhen -震zhen -珍zhen -诊zhen -斟zhen -甄zhen -砧zhen -臻zhen -贞zhen -侦zhen -枕zhen -疹zhen -圳zhen -蓁zhen -浈zhen -溱*zhen -缜zhen -桢zhen -椹*zhen -榛zhen -轸zhen -赈zhen -胗zhen -朕zhen -祯zhen -畛zhen -稹zhen -鸩zhen -箴zhen -珍爱zhenai -珍宝zhenbao -针砭zhenbian -珍藏zhencang -贞操zhencao -侦察zhencha -真诚zhencheng -震荡zhendang -阵地zhendi -真谛zhendi -震动zhendong -诊断zhenduan -针对zhendui -振奋zhenfen -争zheng -正zheng -政zheng -整zheng -证zheng -征zheng -蒸zheng -症zheng -丁*zheng -郑zheng -挣zheng -睁zheng -狰zheng -怔zheng -拯zheng -帧zheng -诤zheng -峥zheng -徵zheng -钲zheng -铮zheng -筝zheng -争霸zhengba -整备zhengbei -正比zhengbi -政变zhengbian -争辩zhengbian -整编zhengbian -征兵zhengbing -政策zhengce -正常zhengchang -争吵zhengchao -征程zhengcheng -争持zhengchi -正大zhengda -正当zhengdang -政党zhengdang -整党zhengdang -正道zhengdao -争端zhengduan -整顿zhengdun -争夺zhengduo -蒸发zhengfa -政法zhengfa -正反zhengfan -整风zhengfeng -政府zhengfu -征服zhengfu -整改zhenggai -整个zhengge -征购zhenggou -争光zhengguang -正规zhenggui -正轨zhenggui -正好zhenghao -政绩zhengji -征集zhengji -证件zhengjian -政见zhengjian -整洁zhengjie -政局zhengju -证据zhengju -正理zhengli -整理zhengli -正梁zhengliang -政令zhengling -争论zhenglun -政论zhenglun -正面zhengmian -争鸣zhengming -证明zhengming -正派zhengpai -征聘zhengpin -争气zhengqi -正气zhengqi -蒸气zhengqi -整齐zhengqi -正巧zhengqiao -征求zhengqiu -争取zhengqu -政权zhengquan -正确zhengque -证人zhengren -正是zhengshi -正式zhengshi -正视zhengshi -证实zhengshi -征收zhengshou -整数zhengshu -证书zhengshu -征税zhengshui -整套zhengtao -正题zhengti -政体zhengti -整体zhengti -整天zhengtian -征调zhengtiao -正统zhengtong -征途zhengtu -珍贵zhengui -政委zhengwei -正文zhengwen -征文zhengwen -政务zhengwu -争先zhengxian -政协zhengxie -整形zhengxing -整修zhengxiu -征询zhengxun -争艳zhengyan -正业zhengye -正义zhengyi -争议zhengyi -征用zhengyong -正月zhengyue -正在zhengzai -挣扎zhengzha -整整zhengzheng -正直zhengzhi -政治zhengzhi -争执zhengzhi -正中zhengzhong -郑重zhengzhong -郑州zhengzhou -症状zhengzhuang -正宗zhengzong -震撼zhenhan -侦缉zhenji -真假zhenjia -阵脚zhenjiao -贞节zhenjie -贞洁zhenjie -镇静zhenjing -震惊zhenjing -真空zhenkong -真理zhenli -诊疗zhenliao -珍品zhenpin -珍奇zhenqi -真切zhenqie -真情zhenqing -真确zhenque -真人zhenren -阵容zhenrong -真是zhenshi -真实zhenshi -阵势zhenshi -珍视zhenshi -侦探zhentan -阵亡zhenwang -珍惜zhenxi -阵线zhenxian -真相zhenxiang -振兴zhenxing -镇压zhenya -阵阵zhenzhen -真正zhenzheng -真知zhenzhi -真挚zhenzhi -珍重zhenzhong -珍珠zhenzhu -斟酌zhenzhuo -振作zhenzuo -这是zheshi -这时zheshi -折腾zheteng -这些zhexie -哲学zhexue -遮掩zheyan -这样zheyang -这种zhezhong -折中zhezhong -之zhi -制zhi -治zhi -只zhi -质zhi -指zhi -直zhi -支zhi -织zhi -止zhi -至zhi -置zhi -志zhi -值zhi -知zhi -识*zhi -执zhi -职zhi -植zhi -纸zhi -致zhi -枝zhi -殖zhi -脂zhi -智zhi -氏*zhi -肢zhi -秩zhi -址zhi -滞zhi -汁zhi -芝zhi -吱zhi -蜘zhi -侄zhi -趾zhi -旨zhi -挚zhi -掷zhi -帜zhi -峙zhi -稚zhi -炙zhi -痔zhi -窒zhi -卮zhi -陟zhi -郅zhi -埴zhi -芷zhi -摭zhi -帙zhi -徵*zhi -忮zhi -彘zhi -咫zhi -骘zhi -栉zhi -枳zhi -栀zhi -桎zhi -轵zhi -轾zhi -贽zhi -胝zhi -膣zhi -祉zhi -祗zhi -黹zhi -雉zhi -鸷zhi -痣zhi -蛭zhi -絷zhi -酯zhi -跖zhi -踬zhi -踯zhi -豸zhi -觯zhi -治安zhian -值班zhiban -植保zhibao -置备zhibei -质变zhibian -指标zhibiao -职别zhibie -支部zhibu -制裁zhicai -支撑zhicheng -职称zhicheng -支持zhichi -指出zhichu -支出zhichu -至此zhici -值此zhici -直达zhida -只当zhidang -直到zhidao -指导zhidao -知道zhidao -只得zhide -值得zhide -质地zhidi -指点zhidian -制定zhiding -指定zhiding -制订zhiding -制度zhidu -支队zhidui -至多zhiduo -知法zhifa -执法zhifa -制服zhifu -支付zhifu -职工zhigong -只顾zhigu -只管zhiguan -直观zhiguan -治国zhiguo -只好zhihao -之后zhihou -指挥zhihui -智慧zhihui -知己zhiji -指甲zhijia -之间zhijian -只见zhijian -指教zhijiao -直接zhijie -枝节zhijie -至今zhijin -直经zhijing -直径zhijing -止境zhijing -致敬zhijing -知觉zhijue -治理zhili -致力zhili -智力zhili -质量zhiliang -治疗zhiliao -指令zhiling -直流zhiliu -支流zhiliu -殖民zhimin -致命zhiming -指明zhiming -知名zhiming -智谋zhimou -指南zhinan -智囊zhinang -之内zhinei -只能zhineng -职能zhineng -智能zhineng -只怕zhipa -指派zhipai -支配zhipei -支票zhipiao -制品zhipin -志气zhiqi -之前zhiqian -支前zhiqian -值勤zhiqin -执勤zhiqin -知情zhiqing -知青zhiqing -智取zhiqu -志趣zhiqu -知趣zhiqu -职权zhiquan -值日zhiri -治丧zhisang -之上zhishang -直上zhishang -至上zhishang -至少zhishao -制胜zhisheng -之声zhisheng -只是zhishi -指使zhishi -支使zhishi -致使zhishi -知事zhishi -指示zhishi -知识zhishi -指数zhishu -支书zhishu -直属zhishu -植树zhishu -直爽zhishuang -治水zhishui -直说zhishuo -致死zhisi -之外zhiwai -指望zhiwang -职位zhiwei -质问zhiwen -植物zhiwu -职务zhiwu -窒息zhixi -之下zhixia -直线zhixian -指向zhixiang -志向zhixiang -知心zhixin -执行zhixing -只许zhixu -秩序zhixu -直言zhiyan -只要zhiyao -职业zhiye -致意zhiyi -旨意zhiyi -质疑zhiyi -指引zhiyin -知音zhiyin -只有zhiyou -至于zhiyu -置于zhiyu -智育zhiyu -职员zhiyuan -支援zhiyuan -志愿zhiyuan -制约zhiyue -制造zhizao -指责zhize -职责zhize -纸张zhizhang -职掌zhizhang -执照zhizhao -指正zhizheng -执政zhizheng -制止zhizhi -直至zhizhi -之中zhizhong -支助zhizhu -支柱zhizhu -知足zhizu -制作zhizuo -走后门zhm -中华民国zhmg -中华民族zhmz -中zhong -种zhong -重zhong -众zhong -钟zhong -终zhong -忠zhong -肿zhong -仲zhong -盅zhong -衷zhong -冢zhong -忪*zhong -锺zhong -螽zhong -舯zhong -踵zhong -钟爱zhongai -重办zhongban -重兵zhongbing -中部zhongbu -仲裁zhongcai -中层zhongceng -衷肠zhongchang -忠诚zhongcheng -重大zhongda -重担zhongdan -中等zhongdeng -种地zhongdi -重地zhongdi -重点zhongdian -终点zhongdian -中东zhongdong -中断zhongduan -终端zhongduan -中队zhongdui -众多zhongduo -重犯zhongfan -忠告zhonggao -中共zhonggong -中国zhongguo -忠厚zhonghou -中华zhonghua -中级zhongji -终极zhongji -重价zhongjia -中间zhongjian -中坚zhongjian -中奖zhongjiang -终结zhongjie -终究zhongjiu -终久zhongjiu -终局zhongju -中肯zhongken -种类zhonglei -中立zhongli -重量zhongliang -终了zhongliao -中流zhongliu -肿瘤zhongliu -中美zhongmei -众目zhongmu -中年zhongnian -终年zhongnian -中秋zhongqiu -重任zhongren -中日zhongri -终日zhongri -中伤zhongshang -重赏zhongshang -终身zhongshen -终生zhongsheng -重视zhongshi -忠实zhongshi -中枢zhongshu -众说zhongshuo -中苏zhongsu -终天zhongtian -中途zhongtu -重托zhongtuo -中外zhongwai -重围zhongwei -中文zhongwen -中午zhongwu -中西zhongxi -中心zhongxin -忠心zhongxin -衷心zhongxin -中性zhongxing -中学zhongxue -中旬zhongxun -忠言zhongyan -中央zhongyang -中药zhongyao -重要zhongyao -中医zhongyi -重用zhongyong -中庸zhongyong -中游zhongyou -终于zhongyu -忠于zhongyu -忠贞zhongzhen -中止zhongzhi -种植zhongzhi -终止zhongzhi -种种zhongzhong -中专zhongzhuan -种族zhongzu -轴zhou -周zhou -洲zhou -州zhou -皱zhou -骤zhou -舟zhou -诌zhou -粥zhou -肘zhou -帚zhou -咒zhou -宙zhou -昼zhou -荮zhou -啁zhou -妯zhou -纣zhou -绉zhou -胄zhou -碡zhou -籀zhou -繇*zhou -酎zhou -周到zhoudao -咒骂zhouma -周密zhoumi -周末zhoumo -周期zhouqi -周全zhouquan -周围zhouwei -周旋zhouxuan -昼夜zhouye -周折zhouzhe -周知zhouzhi -周转zhouzhuan -总后勤部zhqb -中华人民共和国zhrg -主zhu -注zhu -著zhu -住zhu -助zhu -猪zhu -铸zhu -属*zhu -株zhu -筑zhu -柱zhu -术*zhu -驻zhu -逐zhu -祝zhu -竹zhu -贮zhu -珠zhu -朱zhu -诸zhu -蛛zhu -诛zhu -烛zhu -煮zhu -拄zhu -瞩zhu -嘱zhu -蛀zhu -伫zhu -侏zhu -邾zhu -茱zhu -洙zhu -渚zhu -潴zhu -杼zhu -槠zhu -橥zhu -炷zhu -铢zhu -疰zhu -瘃zhu -褚*zhu -竺zhu -箸zhu -舳zhu -翥zhu -躅zhu -麈zhu -抓zhua -挝*zhua -抓好zhuahao -转*zhuai -曳*zhuai -拽zhuai -抓紧zhuajin -转zhuan -专zhuan -传*zhuan -砖zhuan -撰zhuan -赚zhuan -篆zhuan -啭zhuan -馔zhuan -沌*zhuan -颛zhuan -转变zhuanbian -转播zhuanbo -专长zhuanchang -专程zhuancheng -转达zhuanda -转发zhuanfa -装zhuang -状zhuang -壮zhuang -庄zhuang -撞zhuang -幢*zhuang -桩zhuang -妆zhuang -僮zhuang -奘*zhuang -转告zhuangao -装扮zhuangban -装备zhuangbei -壮大zhuangda -装订zhuangding -壮观zhuangguan -装甲zhuangjia -庄稼zhuangjia -庄嫁zhuangjia -壮举zhuangju -状况zhuangkuang -壮阔zhuangkuo -壮丽zhuangli -壮烈zhuanglie -装配zhuangpei -装饰zhuangshi -状态zhuangtai -装卸zhuangxie -庄严zhuangyan -庄园zhuangyuan -装运zhuangyun -装置zhuangzhi -壮志zhuangzhi -庄重zhuangzhong -转化zhuanhua -转换zhuanhuan -转给zhuanji -专家zhuanjia -专科zhuanke -专利zhuanli -专门zhuanmen -转让zhuanrang -专题zhuanti -转向zhuanxiang -专心zhuanxin -转眼zhuanyan -专业zhuanye -转移zhuanyi -专员zhuanyuan -转载zhuanzai -转折zhuanzhe -转正zhuanzheng -专政zhuanzheng -专制zhuanzhi -专职zhuanzhi -专注zhuanzhu -专著zhuanzhu -主办zhuban -逐步zhubu -贮藏zhucang -注册zhuce -助长zhuchang -主持zhuchi -主次zhuci -主导zhudao -注定zhuding -主动zhudong -主队zhudui -主犯zhufan -住房zhufang -祝福zhufu -嘱咐zhufu -逐个zhuge -主攻zhugong -助工zhugong -主管zhuguan -主观zhuguan -追zhui -锥zhui -椎zhui -赘zhui -坠zhui -缀zhui -惴zhui -骓zhui -缒zhui -追捕zhuibu -追查zhuicha -追悼zhuidao -追赶zhuigan -坠毁zhuihui -追加zhuijia -追究zhuijiu -追求zhuiqiu -追认zhuiren -追溯zhuisu -追随zhuisui -追问zhuiwen -追逐zhuizhu -追踪zhuizong -主机zhuji -主见zhujian -逐渐zhujian -主将zhujiang -主讲zhujiang -主教zhujiao -主角zhujiao -注解zhujie -祝酒zhujiu -主力zhuli -助理zhuli -株连zhulian -主粮zhuliang -主流zhuliu -驻留zhuliu -著名zhuming -主谋zhumou -注目zhumu -瞩目zhumu -准zhun -屯*zhun -谆zhun -肫zhun -窀zhun -准备zhunbei -逐年zhunian -准确zhunque -准绳zhunsheng -准时zhunshi -准许zhunxu -准则zhunze -着*zhuo -著*zhuo -捉zhuo -桌zhuo -缴*zhuo -拙zhuo -卓zhuo -琢zhuo -茁zhuo -酌zhuo -啄zhuo -灼zhuo -浊zhuo -倬zhuo -诼zhuo -擢zhuo -浞zhuo -涿zhuo -濯zhuo -棹*zhuo -焯zhuo -禚zhuo -斫zhuo -镯zhuo -拙劣zhuolie -琢磨zhuomo -捉弄zhuonong -酌情zhuoqing -卓越zhuoyue -茁壮zhuozhuang -主权zhuquan -主人zhuren -主任zhuren -诸如zhuru -注色zhuse -注视zhushi -柱石zhushi -注释zhushi -助手zhushou -主送zhusong -住宿zhusu -珠算zhusuan -主题zhuti -主体zhuti -逐条zhutiao -嘱托zhutuo -诸位zhuwei -主席zhuxi -注销zhuxiao -主要zhuyao -逐一zhuyi -主义zhuyi -主意zhuyi -注意zhuyi -祝愿zhuyuan -逐月zhuyue -主宰zhuzai -铸造zhuzao -驻扎zhuzha -住宅zhuzhai -主张zhuzhang -住址zhuzhi -注重zhuzhong -著作zhuzuo -子zi -自zi -资zi -字zi -紫zi -仔zi -籽zi -姿zi -吱*zi -兹zi -咨zi -滋zi -淄zi -孜zi -滓zi -渍zi -谘zi -茈*zi -呲*zi -嵫zi -姊zi -孳zi -缁zi -梓zi -辎zi -赀zi -恣zi -眦zi -锱zi -秭zi -耔zi -笫zi -粢zi -趑zi -觜zi -訾zi -龇zi -鲻zi -髭zi -自爱ziai -自白zibai -自卑zibei -资本ziben -资产zichan -滋长zichang -自称zicheng -自传zichuan -自从zicong -子弟zidi -字典zidian -自动zidong -自发zifa -自费zifei -自封zifeng -自负zifu -字符zifu -资格zige -字根zigen -自豪zihao -自给ziji -自己ziji -字迹ziji -字节zijie -资金zijin -自救zijiu -自居ziju -自觉zijue -字库ziku -自夸zikua -自理zili -资历zili -资料ziliao -自满ziman -自勉zimian -字母zimu -字幕zimu -子女zinu -自强ziqiang -自然ziran -滋润zirun -自杀zisha -自身zishen -姿势zishi -自述zishu -自私zisi -姿态zitai -字体ziti -字帖zitie -自卫ziwei -滋味ziwei -自问ziwen -自我ziwo -仔细zixi -自信zixin -自修zixiu -自叙zixu -自选zixuan -自学zixue -咨询zixun -滋养ziyang -自由ziyou -自愿ziyuan -资源ziyuan -自找zizhao -自治zizhi -自重zizhong -资助zizhu -自尊zizun -直截了当zjld -浙江省zjs -这就是说zjss -中纪委zjw -再接再厉zjzl -中联部zlb -专利法zlf -质量管理zlgl -自力更生zlgs -展览会zlh -智力开发zlkf -专利权zlq -知名人士zmrs -这么些zmx -这么样zmy -怎么样zmy -总zong -纵zong -宗zong -综zong -棕zong -鬃zong -踪zong -偬zong -枞zong -腙zong -粽zong -总部zongbu -总裁zongcai -总参zongcan -总队zongdui -总额zonge -总纲zonggang -总共zonggong -纵贯zongguan -总和zonghe -综合zonghe -纵横zongheng -总后zonghou -总计zongji -踪迹zongji -宗教zongjiao -总结zongjie -总局zongju -总括zongkuo -总理zongli -总论zonglun -宗派zongpai -纵情zongqing -纵深zongshen -总是zongshi -纵使zongshi -总数zongshu -总算zongsuan -总体zongti -总统zongtong -总务zongwu -踪影zongying -总帐zongzhang -总政zongzheng -总之zongzhi -宗旨zongzhi -走zou -邹zou -奏zou -揍zou -诹zou -陬zou -鄹zou -驺zou -鲰zou -走访zoufang -邹虹zouhong -走私zousi -奏效zouxiao -酌情处理zqcl -中青年zqn -朝气蓬勃zqpb -准确无误zqww -正确性zqx -诸如此类zrcl -责任感zrg -自然界zrj -主人翁zrw -责任心zrx -责任制zrz -再生产zsc -自上而下zsex -知识分子zsfz -这时候zsh -知识化zsh -株式会社zshs -总书记zsj -装饰品zsp -综上所述zsss -之所以zsy -自始至终zszz -众所周知zszz -座谈会zth -组zu -族zu -足zu -阻zu -祖zu -租zu -卒zu -诅zu -俎zu -菹zu -镞zu -阻碍zuai -钻zuan -赚*zuan -纂zuan -攥zuan -缵zuan -躜zuan -钻研zuanyan -组成zucheng -阻挡zudang -组阁zuge -足够zugou -祖国zuguo -组合zuhe -最zui -罪zui -嘴zui -堆*zui -咀*zui -醉zui -蕞zui -最初zuichu -最大zuida -最低zuidi -罪恶zuie -罪犯zuifan -最高zuigao -罪过zuiguo -最好zuihao -最后zuihou -最坏zuihuai -最佳zuijia -最近zuijin -嘴脸zuilian -罪名zuiming -罪孽zuinie -罪人zuiren -最先zuixian -最小zuixiao -最新zuixin -醉心zuixin -罪行zuixing -罪责zuize -罪证zuizheng -最终zuizhong -罪状zuizhuang -阻击zuji -租界zujie -租借zujie -阻拦zulan -阻力zuli -租赁zulin -尊zun -遵zun -撙zun -樽zun -鳟zun -阻挠zunao -遵从zuncong -尊贵zungui -尊敬zunjing -遵守zunshou -遵循zunxun -尊严zunyan -遵照zunzhao -尊重zunzhong -作zuo -做zuo -左zuo -座zuo -坐zuo -昨zuo -撮*zuo -凿*zuo -搓*zuo -琢*zuo -佐zuo -柞zuo -阼zuo -唑zuo -嘬zuo -怍zuo -胙zuo -祚zuo -笮*zuo -作案zuoan -作弊zuobi -左边zuobian -坐标zuobiao -做到zuodao -作法zuofa -做法zuofa -作废zuofei -作风zuofeng -做工zuogong -作怪zuoguai -做好zuohao -作家zuojia -作客zuoke -作乐zuole -作乱zuoluan -坐落zuoluo -左派zuopai -作品zuopin -左倾zuoqing -做人zuoren -昨日zuori -做事zuoshi -坐视zuoshi -座谈zuotan -昨天zuotian -昨晚zuowan -作为zuowei -座位zuowei -坐位zuowei -作文zuowen -作物zuowu -作业zuoye -昨夜zuoye -作用zuoyong -左右zuoyou -作战zuozhan -作者zuozhe -作证zuozheng -作主zuozhu -做主zuozhu -做作zuozuo -足球zuqiu -阻塞zuse -祖师zushi -祖先zuxian -组长zuzhang -组织zuzhi -阻止zuzhi -祖宗zuzong -中外合资zwhz -责无旁贷zwpd -中宣部zxb -自行车zxc -自下而上zxes -忠心耿耿zxgg -展销会zxh -照相机zxj -争先恐后zxkh -中学生zxs -主席团zxt -中小学zxx -自信心zxx -中央办公厅zybt -着眼点zyd -专业对口zydk -中央电视台zydt -中央各部委zygw -专业化zyh -专业户zyh -中央军委zyjw -座右铭zym -中央全会zyqh -中央人民广播电台zyrt -主要人员zyry -专业人员zyry -中央书记处zysc -中央委员会zywh -中央委员zywy -重要性zyx -主要原因zyyy -中央政治局zyzj -专业知识zyzs -中组部zzb -组织部zzb -政治部zzb -政治处zzc -转折点zzd -置之度外zzdw -政治局zzj -自治区zzq -蒸蒸日上zzrs -组织上zzs -郑州市zzs -组织性zzx -自尊心zzx -赵紫阳zzy -总政治部zzzb -喷码pm -优喷yp -科技kj -比洋by -公司gs -威诺巴赫wnbh -有限公司yxgz -股份公司gfgs -企业qy -标准bz -喷码机pmj -电线dx -电缆dl -电线电缆dxdl -电力电缆dldl -绝缘jy -绝缘层jyc -导体dt -导线dx -电力dl -通信tx -控制电缆kzdl -补偿电缆bcdl -屏蔽电缆pbdl -高温电缆gwdl -计算机电缆jsjdl -信号电缆xhdl -同轴电缆tzdl -耐火电缆nhdl -船用电缆cydl -铝合金电缆lhjdl -单股dg -多股dg -连接lj -电路dl -电器dq -型号xh -铜t -铝l -铅包qb -铝包qb -聚氯乙烯jlyx -电磁线dcx -北京市bj -东城区dcq -西城区xcq -崇文区cwq -宣武区xwq -朝阳区zyq -海淀区hdq -丰台区ftq -房山区fsq -通州区tzq -顺义区syq -昌平区cpq -大兴区txq -怀柔区hrq -平谷区pgq -门头沟区mtgq -石景山区sjsq -天津市tjs -和平区hpq -河东区hdq -河西区hxq -南开区nkq -河北区hbq -红桥区hqq -塘沽区tgq -汉沽区hgq -大港区tgq -东丽区dlq -西青区xqq -北辰区bcq -津南区jnq -武清区wqq -宝坻区bdq -河北省hbs -辛集市xjs -藁城市gcs -晋州市jzs -新乐市xls -鹿泉市lqs -唐山市tss -遵化市zhs -安市as -邯郸市hds -武安市was -邢台市xts -南宫市ngs -沙河市shs -保定市bds -涿州市zzs -定州市dzs -安国市ags -承德市cds -沧州市czs -泊头市bts -任丘市rqs -黄骅市hhs -河间市hjs -廊坊市lfs -霸州市bzs -三河市shs -衡水市hss -冀州市jzs -深州市szs -石家庄市sjzs -张家口市zjks -高碑店市gbds -秦皇岛市qhds -山西省sxs -太原市tys -古交市gjs -大同市dts -阳泉市yqs -长治市czs -潞城市lcs -晋城市jcs -高平市gps -朔州市szs -晋中市jzs -介休市jxs -运城市ycs -河津市hjs -永济市sjs -忻州市xzs -原平市yps -临汾市lfs -侯马市hms -霍州市hzs -吕梁市lls -孝义市xys -汾阳市fys -内蒙古自治区nmg -包头市bts -乌海市whs -赤峰市cfs -通辽市tls -根河市ghs -丰镇市fzs -辽宁省LNS -沈阳市sys -新民市xms -大连市dls -庄河市zhs -鞍山市ass -海城市hcs -抚顺市fss -本溪市bxs -丹东市dds -东港市dgs -凤城市fcs -锦州市jzs -凌海市lhs -北宁市bns -营口市yks -盖州市gzs -阜新市fxs -辽阳市lys -灯塔市dts -盘锦市pjs -铁岭市tls -开原市kys -朝阳市zys -凌源市lys -北票市bps -兴城市xcs -大石桥市dsqs -瓦房店市wfds -普兰店市plds -调兵山市dbss -葫芦岛市hlds -吉林省jls -长春市ccs -九台市jts -榆树市yss -德惠市dhs -吉林市jls -舒兰市sls -桦甸市hds -蛟河市jhs -磐石市pss -四平市sps -双辽市sls -辽源市lys -通化市ths -集安市jas -白山市bss -临江市ljs -松原市sys -白城市bcs -大安市das -洮南市tns -延吉市yjs -图们市tms -敦化市ghs -龙井市ljs -珲春市hcs -和龙市hls -公主岭市gzls -梅河口市mhks -黑龙江省hljs -阿城市acs -尚志市szs -双城市scs -五常市wcs -讷河市nhs -鹤岗市hgs -鸡西市jxs -密山市mss -虎林市hls -大庆市dqs -伊春市ycs -铁力市tls -宁安市nas -海林市hls -穆棱市mls -同江市tjs -富锦市fjs -黑河市hhs -北安市bas -绥化市shs -安达市ads -肇东市zds -海伦市hls -七台河市qths -双鸭山市syss -牡丹江市mdjs -佳木斯市jmss -绥芬河市sfhs -哈尔滨市hebs -齐齐哈尔市qqhes -五大连池市wdlcs -上海市shs -黄浦区hpq -卢湾区lwq -徐汇区xhq -长宁区cnq -静安区jaq -普陀区ptq -闸北区zbq -虹口区hkq -杨浦区ypq -宝山区bsq -闵行区mxq -嘉定区jdq -松江区sjq -金山区jsq -青浦区qpq -南汇区nhq -奉贤区fxq -崇明县浦东新区cmxpdxq -江苏省jss -南京市njs -无锡市wxs -江阴市jys -宜兴市yxs -徐州市xzs -邳州市pzs -新沂市xys -常州市czs -金坛市jts -溧阳市lys -苏州市szs -常熟市css -太仓市dcs -昆山市hss -吴江市wjs -南通市nns -如皋市rgs -通州市tzs -海门市hms -启东市qds -淮安市has -盐城市ycs -东台市dts -大丰市dfs -扬州市yzs -高邮市gys -江都市jds -仪征市yzs -镇江市zjs -丹阳市dys -扬中市yzs -句容市jrs -泰州市dzs -泰兴市dxs -姜堰市jys -靖江市jjs -兴化市xhs -宿迁市sqs -连云港市lygs -张家港市zjgs -浙江省zjs -杭州市hzs -建德市jds -富阳市fys -临安市las -宁波市nbx -余姚市yys -慈溪市cxs -奉化市fhs -温州市wzs -瑞安市ras -乐清市lqs -嘉兴市jxs -海宁市hns -平湖市phs -桐乡市txs -湖州市hzs -绍兴市sxs -诸暨市zjs -上虞市sys -嵊州市szs -金华市jhs -兰溪市lxs -义乌市yws -东阳市dys -永康市yks -衢州市qzs -江山市jss -舟山市zss -台州市tzs -临海市lhs -丽水市lss -龙泉市lqs -安徽省ahs -合肥市hfs -芜湖市whs -蚌埠市bbs -淮南市hns -淮北市hbs -铜陵市tls -安庆市aqs -桐城市tcs -黄山市hss -滁州市czs -天长市dcs -明光市mgs -阜阳市fys -界首市jss -宿州市szs -巢湖市chs -六安市las -亳州市hzs -池州市czs -宣城市ycs -宁国市ngs -马鞍山市mass -福建省fjs -福州市fjs -福清市fqs -长乐市cls -厦门市xms -莆田市pts -三明市sms -永安市yas -泉州市qzs -石狮市sss -晋江市jjs -南安市nas -漳州市zzs -龙海市lhs -南平市nps -建瓯市jos -邵武市sws -建阳市jys -龙岩市lys -漳平市zps -宁德市nds -福安市fas -福鼎市fds -武夷山市wyss -江西省jxs -南昌市ncs -乐平市lps -萍乡市pxs -九江市jjs -瑞昌市rcs -新余市xys -鹰潭市yts -贵溪市gxs -赣州市gzs -瑞金市rjs -南康市nks -吉安市jas -宜春市ycs -丰城市fcs -樟树市zss -高安市gas -抚州市fzs -上饶市srs -德兴市dxs -井冈山市jgss -景德镇市jdzs -山东省sds -济南市jns -章丘市zqs -青岛市qds -胶南市jns -胶州市jzs -平度市pds -莱西市lxs -即墨市jms -淄博市zbs -枣庄市zzs -滕州市tzs -烟台市yts -龙口市lks -莱阳市lys -莱州市lzs -招远市zys -蓬莱市pls -栖霞市qxs -海阳市hys -潍坊市wfs -青州市qzs -诸城市zcs -寿光市sgs -安丘市aqs -高密市gms -昌邑市cys -济宁市jns -曲阜市qfs -兖州市yzs -邹城市zcs -泰安市tas -新泰市xts -肥城市fcs -威海市whs -乳山市rss -文登市wds -荣成市rcs -日照市rzs -莱芜市lws -临沂市lys -德州市dzs -乐陵市lls -禹城市ycs -聊城市lcs -临清市lqs -滨州市bzs -菏泽市hzs -河南省hns -郑州市zzs -巩义市gys -新郑市xzs -新密市xms -登封市dfs -荥阳市xys -开封市kfs -洛阳市lys -偃师市yss -汝州市rzs -舞钢市wgs -安阳市ays -林州市lzs -新乡市xxs -卫辉市whs -辉县市hxs -焦作市jzs -沁阳市qys -孟州市mzs -濮阳市pys -许昌市xcs -禹州市yzs -长葛市cgs -漯河市lhs -义马市yms -灵宝市lbs -南阳市nys -邓州市dzs -商丘市sqs -永城市ycs -信阳市xys -周口市zks -项城市dcs -济源市jys -三门峡市smxs -平顶山市pdss -驻马店市zmds -湖北省hbs -武汉市whs -黄石市hss -大冶市dys -十堰市sys -荆州市jzs -洪湖市hhs -石首市sss -松滋市szs -宜昌市ycs -宜都市yds -当阳市dys -枝江市jjs -襄樊市xfs -枣阳市zys -宜城市ycs -鄂州市ezs -荆门市jms -钟祥市zxs -孝感市xgs -应城市ycs -安陆市als -汉川市hcs -黄冈市hgs -麻城市mcs -武穴市wxs -咸宁市xns -赤壁市cbs -随州市szs -广水市gss -仙桃市xts -天门市tms -潜江市qjs -恩施市ess -利川市lcs -丹江口市djks -老河口市lhks -神农架林区snjlq -湖南省hns -长沙市css -浏阳市lys -株洲市zzs -醴陵市lls -湘潭市xts -湘乡市xxs -韶山市sss -衡阳市hys -耒阳市lys -常宁市cns -邵阳市sys -武冈市wgs -岳阳市yys -临湘市lxs -汨罗市mls -常德市cds -津市市jss -益阳市yys -沅江市yjs -郴州市czs -资兴市zxs -永州市yzs -怀化市hhs -洪江市hjs -娄底市lds -涟源市lys -吉首市jss -冷水江市lsjs -张家界市zjjs -广东省gds -广州市gzs -从化市chs -增城市zcs -深圳市szs -珠海市zhs -汕头市sts -韶关市sgs -乐昌市lcs -南雄市nxs -佛山市fss -江门市jms -台山市tss -开平市kps -鹤山市hss -恩平市eps -湛江市zjs -廉江市ljs -雷州市lzs -吴川市wcs -茂名市mms -西昌市xcs -峨眉山市emss -都江堰市djys -攀枝花市pzhs -贵州省gzs -贵阳市gys -清镇市qzs -遵义市zys -赤水市css -仁怀市rhs -安顺市ass -毕节市bjs -兴义市xys -凯里市kls -都匀市dys -福泉市fqs -六盘水市lpss -六枝特区lztq -万山特区wstq -云南省yns -昆明市kms -安宁市ans -曲靖市qjs -宣威市xws -玉溪市yxs -保山市bss -昭通市zts -丽江市ljs -思茅市sms -临沧市lqs -个旧市gjs -开远市kys -景洪市jhs -楚雄市cxs -大理市dls -潞西市lxs -瑞丽市rls -西藏自治区xzzzq -拉萨市lss -陕西省sxs -西安市xas -铜川市tcs -宝鸡市bjs -咸阳市xys -渭南市wns -韩城市hcs -华阴市hys -延安市yas -汉中市azs -榆林市yls -安康市aks -商洛市sls -甘肃省gss -兰州市lzs -金昌市jcs -白银市bys -天水市tss -武威市wws -张掖市zys -平凉市pls -酒泉市jqs -玉门市yms -敦煌市dhs -庆阳市qys -定西市dxs -陇南市lns -临夏市lxs -合作市hzs -嘉峪关市jygs -青海省qhs -西宁市xns -德令哈市dlhs -格尔木市gems -宁夏回族自治区nxhzzzq -银川市ycs -灵武市lws -吴忠市wzs -固原市gys -中卫市zws -石嘴山市szss -青铜峡市qtxs -新疆维吾尔自治区xjwwezzq -喀什市kss -昌吉市cjs -阜康市fks -米泉市mqs -博乐市bls -伊宁市yns -奎屯市kts -塔城市tcs -乌苏市wss -石河子市shzs -阿拉尔市ales -五家渠市wjqs -吐鲁番市tlfs -阿克苏市akss -阿图什市atss -库尔勒市kels -阿勒泰市alts -乌鲁木齐市wlmqs -克拉玛依市klmys -图木舒克市tmsks -香港特别行政区 -中西区zxq -东区dq -观塘区gtq -南区nq -湾仔区wzq -离岛区ldq -葵青区kqq -北区bq -西贡区xgq -沙田区stq -屯门区tmq -大埔区dpq -荃湾区qwq -元朗区ylq -九龙城区jtcq -油尖旺区yjwq -深水埗区ssbq -黄大仙区hdxq -台湾省tws -台北市tbs -高雄市gxs -基隆市jls -台中市tzs -台南市tns -新竹市xzs -嘉义市jys -板桥市bqs -宜兰市yls -竹北市zbs -桃园市tys -苗栗市mls -丰原市fys -彰化市zhs -南投市nts -太保市tbs -斗六市dls -新营市xys -凤山市fss -屏东市pds -台东市tds -花莲市hls -马公市mgs +Šsw +šsw +Žzw +žzw +Œce +œce +aÀ +aÁ +aẢ +aà +aẠ +aÄ +aÅ +aeÆ +a +asá +afà +arả +axã +ajạ +awă +aaâ +aeă +äa +åa +aaâ +aa +Äa +Åa +Æae +AFÀ +ASÁ +ARẢ +AXà +AJẠ +AÄ +AÅ +AEÆ +AA +eÉ +eÈ +eẺ +eẼ +eẸ +eÊ +eË +esé +efè +erẻ +exẽ +ejẹ +eeê +ESÉ +EFÈ +ERẺ +EXẼ +EJẸ +EEÊ +eeÊ +EË +DDĐ +ddđ +ddĐ +íis +ìif +ỉir +ĩix +ịij +ÌIF +ÍIS +ỈIR +ĨIX +ỊIj +IIÎ +iÌ +iÍ +iỈ +iĨ +ij +iÎ +iÏ +nÑ +osó +ofò +orỏ +oxõ +ojọ +owơ +ooô +OSÓ +OFÒ +ORỎ +OXÕ +OJỌ +OWƠ +OEÒ +OOÔ +ooÔ +OÖ +ooÖ +oÓ +oÒ +oỎ +oÕ +oỌ +oƠ +oÒ +oÔ +usú +ufù +urủ +uxũ +ujụ +uwư +USÚ +UFÙ +URỦ +UXŨ +UJỤ +UWƯ +ÜU +ÛU +uÚ +uÙ +uỦ +uŨ +uỤ +uƯ +uÜ +uÛ +YFỲ +YSÝ +YRỶ +YXỸ +YJỴ +yỲ +yÝ +yỶ +yỸ +yỴ +yfỳ +ysý +yrỷ +yxỹ +ỵyj +安a +按a +爱a +阿a +暗a +啊a +埃a +碍a +凹a +奥a +岸a +矮a +案a +俺a +挨a +唉a +昂a +氨a +胺a +哎a +吖a +嗄a +腌a +锕a +安徽省ahs +爱ai +埃ai +碍ai +矮ai +挨ai +唉ai +哎ai +哀ai +皑ai +癌ai +蔼ai +艾ai +隘ai +呆*ai +捱ai +嗳ai +嗌ai +嫒ai +瑷ai +暧ai +砹ai +锿ai +霭ai +安an +按an +暗an +岸an +案an +俺an +氨an +胺an +鞍an +谙an +埯an +揞an +犴an +庵an +桉an +铵an +鹌an +黯an +昂ang +肮ang +盎ang +安徽anhui +凹ao +奥ao +敖ao +熬ao +翱ao +袄ao +傲ao +懊ao +澳ao +嚣*ao +坳ao +拗ao +嗷ao +岙ao +廒ao +遨ao +媪ao +骜ao +獒ao +聱ao +螯ao +鏊ao +鳌ao +鏖ao +不b +部b +本b +表b +把b +变b +比b +并b +别b +百b +报b +保b +病b +北b +被b +步b +边b +八b +办b +布b +把ba +八ba +吧ba +巴ba +拔ba +霸ba +罢ba +爸ba +坝ba +芭ba +捌ba +扒ba +叭ba +笆ba +疤ba +跋ba +靶ba +耙ba +茇ba +菝ba +岜ba +灞ba +钯ba +粑ba +鲅ba +魃ba +百bai +白bai +败bai +摆bai +伯*bai +柏bai +佰bai +拜bai +稗bai +捭bai +掰bai +办ban +半ban +板ban +班ban +般ban +版ban +拌ban +搬ban +斑ban +扳ban +伴ban +颁ban +扮ban +瓣ban +绊ban +阪ban +坂ban +钣ban +瘢ban +癍ban +舨ban +帮bang +棒bang +邦bang +榜bang +梆bang +膀bang +绑bang +磅bang +蚌bang +镑bang +傍bang +谤bang +蒡bang +浜bang +报bao +保bao +包bao +剥bao +薄bao +胞bao +暴bao +宝bao +饱bao +抱bao +爆bao +炮*bao +堡bao +刨*bao +苞bao +褒bao +雹bao +豹bao +鲍bao +曝*bao +瀑*bao +葆bao +孢bao +煲bao +鸨bao +褓bao +趵bao +龅bao +北bei +被bei +倍bei +备bei +背bei +辈bei +贝bei +杯bei +卑bei +臂*bei +悲bei +碑bei +钡bei +狈bei +惫bei +焙bei +孛bei +陂bei +邶bei +埤bei +萆bei +蓓bei +呗bei +悖bei +碚bei +鹎bei +褙bei +鐾bei +鞴bei +本ben +奔ben +苯ben +笨ben +夯*ben +畚ben +坌ben +贲ben +锛ben +本报benbao +奔波benbo +本部benbu +本厂benchang +奔驰benchi +本地bendi +奔放benfang +泵beng +崩beng +蚌*beng +绷beng +甭beng +蹦beng +迸beng +嘣beng +甏beng +比bi +必bi +避bi +闭bi +辟bi +笔bi +壁bi +臂bi +毕bi +彼bi +逼bi +币bi +鼻bi +蔽bi +秘*bi +鄙bi +碧bi +蓖bi +毙bi +毖bi +庇bi +痹bi +敝bi +弊bi +陛bi +拂*bi +泌*bi +匕bi +俾bi +埤*bi +芘*bi +荜bi +荸bi +萆*bi +薜bi +吡bi +哔bi +狴bi +庳bi +愎bi +滗bi +濞bi +弼bi +妣bi +婢bi +嬖bi +璧bi +贲*bi +睥*bi +畀bi +铋bi +秕bi +裨bi +筚bi +箅bi +篦bi +舭bi +襞bi +跸bi +髀bi +变bian +边bian +便bian +编bian +遍bian +辩bian +扁bian +辨bian +鞭bian +贬bian +卞bian +辫bian +匾bian +弁bian +苄bian +忭bian +汴bian +缏bian +飚bian +煸bian +砭bian +碥bian +窆bian +褊bian +蝙bian +笾bian +鳊bian +表biao +标biao +彪biao +膘biao +勺*biao +婊biao +骠biao +杓biao +飑biao +飙biao +镖biao +镳biao +瘭biao +裱biao +鳔biao +髟biao +别bie +鳖bie +憋bie +瘪bie +蹩bie +宾bin +彬bin +斌bin +濒bin +滨bin +摈bin +傧bin +豳bin +缤bin +玢bin +槟bin +殡bin +膑bin +镔bin +髌bin +鬓bin +并bing +病bing +兵bing +柄bing +冰bing +丙bing +饼bing +秉bing +炳bing +屏*bing +禀bing +邴bing +摒bing +槟*bing +波bo +播bo +剥*bo +伯bo +拨bo +薄*bo +博bo +勃bo +驳bo +玻bo +泊bo +柏*bo +卜*bo +菠bo +钵bo +搏bo +铂bo +箔bo +帛bo +舶bo +脖bo +膊bo +渤bo +魄*bo +孛*bo +亳bo +啵bo +饽bo +檗bo +掰*bo +擘bo +礴bo +钹bo +鹁bo +簸bo +趵*bo +跛bo +踣bo +不bu +部bu +步bu +布bu +补bu +捕bu +埔*bu +卜bu +堡*bu +哺bu +埠bu +簿bu +怖bu +卟bu +逋bu +瓿bu +晡bu +钚bu +钸bu +醭bu +不安buan +不比bubi +不必bubi +不变bubian +不便bubian +步兵bubing +步步bubu +不曾buceng +补偿buchang +不啻buchi +补充buchong +不错bucuo +不大buda +不待budai +不但budan +不当budang +不得bude +不等budeng +步调budiao +不动budong +不断buduan +不对budui +部队budui +不法bufa +补发bufa +步伐bufa +不凡bufan +不妨bufang +不分bufen +部分bufen +不服bufu +不符bufu +不该bugai +不敢bugan +不甘bugan +布告bugao +不够bugou +不顾bugu +不管buguan +不过buguo +不会buhui +补给buji +部件bujian +不借bujie +不尽bujin +不仅bujin +不禁bujin +布景bujing +不久bujiu +补救bujiu +布局buju +不堪bukan +不可buke +不快bukuai +不愧bukui +不理buli +不利buli +不良buliang +不料buliao +步履bulu +不论bulun +部落buluo +不满buman +部门bumen +不免bumian +不能buneng +不怕bupa +补品bupin +不平buping +步枪buqiang +不屈buqu +不然buran +不如buru +不少bushao +不是bushi +不识bushi +部首bushou +部属bushu +部署bushu +补贴butie +不同butong +不妥butuo +部位buwei +部委buwei +不问buwen +不惜buxi +补习buxi +部下buxia +不行buxing +不幸buxing +步行buxing +不朽buxiu +不许buxu +哺养buyang +不要buyao +不宜buyi +不用buyong +哺育buyu +不在buzai +部长buzhang +不振buzhen +不只buzhi +不止buzhi +不知buzhi +不致buzhi +布置buzhi +步骤buzhou +补助buzhu +捕捉buzhuo +步子buzi +不足buzu +博物馆bwg +产c +成c +出c +长c +从c +此c +常c +处c +车c +场c +传c +采c +层c +厂c +才c +次c +虫c +除c +查c +差c +擦ca +拆*ca +嚓ca +礤ca +采cai +才cai +材cai +菜cai +财cai +裁cai +彩cai +猜cai +睬cai +踩cai +蔡cai +参can +残can +蚕can +灿can +餐can +惭can +惨can +孱can +骖can +璨can +粲can +黪can +惨案canan +惨白canbai +残暴canbao +惨怛canda +残废canfei +藏cang +仓cang +苍cang +舱cang +沧cang +苍白cangbai +仓促cangcu +仓库cangku +苍老canglao +苍茫cangmang +藏匿cangni +苍穹cangqiong +沧桑cangsang +苍天cangtian +参观canguan +残骸canhai +残疾canji +参加canjia +参见canjian +残局canju +惨剧canju +参军canjun +参看cankan +参考cankao +残酷canku +惭愧cankui +灿烂canlan +参谋canmou +残缺canque +残忍canren +孱弱canruo +残杀cansha +残生cansheng +蚕食canshi +参数canshu +惨痛cantong +参与canyu +残余canyu +残月canyue +参阅canyue +参赞canzan +惨遭canzao +参战canzhan +参照canzhao +参政canzheng +惨重canzhong +草cao +槽cao +操cao +糙cao +曹cao +嘈cao +漕cao +螬cao +艚cao +草案caoan +草稿caogao +槽糕caogao +操劳caolao +操练caolian +草率caolu +草木caomu +草拟caoni +草签caoqian +操心caoxin +草原caoyuan +嘈杂caoza +操纵caozong +操作caozuo +差不多cbd +成本核算cbhs +出版社cbs +层出不穷ccbq +从长计议ccjy +存储器ccq +长春市ccs +成都市cds +测ce +策ce +侧ce +册ce +厕ce +恻ce +测定ceding +策动cedong +策反cefan +策划cehua +测量celiang +策略celue +侧面cemian +参*cen +岑cen +涔cen +涔涔cencen +层ceng +曾*ceng +蹭ceng +层层cengceng +层次cengci +曾经cengjing +测试ceshi +厕所cesuo +测验ceyan +侧重cezhong +出发点cfd +充分发挥cffh +唱高调cgd +从古到今cgdj +查cha +差cha +插cha +察cha +茶cha +叉cha +茬cha +碴cha +搽cha +岔cha +诧cha +刹*cha +喳*cha +嚓*cha +猹cha +馇cha +汊cha +姹cha +杈cha +楂cha +槎cha +檫cha +锸cha +镲cha +衩cha +查办chaban +差别chabie +差错chacuo +差点chadian +查对chadui +差额chae +查访chafang +察访chafang +查封chafeng +查获chahuo +差*chai +柴chai +拆chai +豺chai +侪chai +钗chai +瘥chai +虿chai +拆穿chaichuan +豺狼chailang +拆散chaisan +差使chaishi +拆卸chaixie +柴油chaiyou +差价chajia +差距chaju +察觉chajue +查看chakan +察看chakan +查考chakao +查明chaming +产chan +单*chan +铲chan +阐chan +搀chan +掺chan +蝉chan +馋chan +谗chan +缠chan +颤chan +冁chan +谄chan +蒇chan +廛chan +忏chan +潺chan +澶chan +孱*chan +羼chan +婵chan +骣chan +觇chan +禅chan +镡chan +蟾chan +躔chan +铲除chanchu +产地chandi +阐发chanfa +搀扶chanfu +长chang +常chang +场chang +厂chang +唱chang +肠chang +昌chang +倡chang +偿chang +畅chang +猖chang +尝chang +敞chang +裳*chang +倘*chang +伥chang +鬯chang +苌chang +菖chang +徜chang +怅chang +惝chang +阊chang +娼chang +嫦chang +昶chang +氅chang +鲳chang +长安changan +常常changchang +长城changcheng +长春changchun +畅达changda +倡导changdao +长度changdu +长短changduan +唱歌changge +常规changgui +长河changhe +场合changhe +偿还changhuan +厂家changjia +常见changjian +长江changjiang +长久changjiu +猖獗changjue +长空changkong +畅快changkuai +猖狂changkuang +场面changmian +长眠changmian +长年changnian +长篇changpian +长期changqi +长驱changqu +常任changren +长沙changsha +厂商changshang +常识changshi +尝试changshi +长寿changshou +常数changshu +场所changsuo +畅谈changtan +长途changtu +怅惘changwang +常委changwei +倘未changwei +常温changwen +常务changwu +畅想changxiang +畅销changxiao +倡议changyi +畅饮changyin +常用changyong +常有changyou +畅游changyou +长远changyuan +厂长changzhang +长征changzheng +厂址changzhi +常驻changzhu +婵娟chanjuan +蝉联chanlian +产量chanliang +缠绵chanmian +阐明chanming +产品chanpin +产权chanquan +缠绕chanrao +产生chansheng +禅师chanshi +阐述chanshu +产物chanwu +产销chanxiao +产业chanye +产值chanzhi +朝chao +超chao +潮chao +巢chao +抄chao +钞chao +嘲chao +吵chao +炒chao +绰*chao +剿*chao +怊chao +晁chao +焯*chao +耖chao +抄报chaobao +超产chaochan +超出chaochu +朝代chaodai +超额chaoe +嘲讽chaofeng +超过chaoguo +朝晖chaohui +超级chaoji +吵架chaojia +潮解chaojie +潮流chaoliu +抄录chaolu +吵闹chaonao +嘲弄chaonong +潮湿chaoshi +潮水chaoshui +抄送chaosong +超脱chaotuo +抄袭chaoxi +朝鲜chaoxian +嘲笑chaoxiao +巢穴chaoxue +朝阳chaoyang +朝野chaoye +超越chaoyue +超支chaozhi +查清chaqing +插曲chaqu +插入charu +查哨chashao +插手chashou +查收chashou +插图chatu +查问chawen +查询chaxun +茶叶chaye +差异chayi +查阅chayue +查证chazheng +岔子chazi +插足chazu +车che +彻che +尺*che +撤che +扯che +掣che +澈che +坼che +砗che +彻底chedi +车祸chehuo +车间chejian +车辆cheliang +陈chen +沉chen +称chen +衬chen +尘chen +臣chen +晨chen +沈*chen +郴chen +辰chen +忱chen +趁chen +伧chen +谌chen +谶chen +抻chen +嗔chen +宸chen +琛chen +榇chen +碜chen +龀chen +尘埃chenai +沉淀chendian +陈腐chenfu +沉浮chenfu +成cheng +程cheng +称cheng +城cheng +承cheng +乘cheng +呈cheng +盛*cheng +撑cheng +诚cheng +橙cheng +惩cheng +澄cheng +逞cheng +骋cheng +秤cheng +丞cheng +埕cheng +噌cheng +枨cheng +柽cheng +塍cheng +瞠cheng +铖cheng +铛cheng +裎cheng +蛏cheng +酲cheng +成败chengbai +承办chengban +惩办chengban +呈报chengbao +承包chengbao +成本chengben +成材chengcai +惩处chengchu +乘除chengchu +承担chengdan +承当chengdang +成都chengdu +程度chengdu +乘法chengfa +惩罚chengfa +成功chenggong +成规chenggui +成果chengguo +称号chenghao +称呼chenghu +成绩chengji +乘机chengji +成家chengjia +成见chengjian +成交chengjiao +承接chengjie +惩戒chengjie +成就chengjiu +乘客chengke +诚恳chengken +成立chengli +乘凉chengliang +成名chengming +成年chengnian +成批chengpi +成品chengpin +诚朴chengpu +逞强chengqiang +澄清chengqing +城区chengqu +成全chengquan +诚然chengran +成人chengren +承认chengren +成色chengse +成事chengshi +诚实chengshi +城市chengshi +承受chengshou +成熟chengshu +成为chengwei +称谓chengwei +成文chengwen +呈现chengxian +呈献chengxian +城乡chengxiang +成效chengxiao +称心chengxin +诚心chengxin +程序chengxu +乘虚chengxu +撑腰chengyao +诚意chengyi +成语chengyu +成员chengyuan +称赞chengzan +成长chengzhang +城镇chengzhen +称职chengzhi +诚挚chengzhi +趁机chenji +沉积chenji +陈迹chenji +沉浸chenjin +沉静chenjing +陈旧chenjiu +陈列chenlie +沉沦chenlun +沉闷chenmen +沉湎chenmian +沉默chenmo +沉溺chenni +陈设chenshe +陈述chenshu +陈说chenshuo +沉思chensi +沉痛chentong +衬托chentuo +沉吟chenyin +衬映chenying +趁早chenzao +沉重chenzhong +沉着chenzhuo +车皮chepi +扯皮chepi +撤退chetui +撤消chexiao +车站chezhan +撤职chezhi +持chi +尺chi +齿chi +吃chi +赤chi +池chi +迟chi +翅chi +斥chi +耻chi +痴chi +匙chi +弛chi +驰chi +侈chi +炽chi +傺chi +坻chi +墀chi +茌chi +叱chi +哧chi +啻chi +嗤chi +彳chi +饬chi +媸chi +敕chi +眵chi +鸱chi +瘛chi +褫chi +蚩chi +螭chi +笞chi +篪chi +豉chi +踟chi +魑chi +翅膀chibang +赤诚chicheng +驰骋chicheng +尺寸chicun +迟到chidao +赤道chidao +尺度chidu +迟钝chidun +吃喝chihe +迟缓chihuan +吃紧chijin +吃惊chijing +持久chijiu +吃苦chiku +吃亏chikui +吃力chili +炽烈chilie +齿轮chilun +持平chiping +痴情chiqing +炽热chire +耻辱chiru +池塘chitang +耻笑chixiao +赤心chixin +痴心chixin +迟疑chiyi +迟早chizao +斥责chize +叱咤chizha +持重chizhong +吃重chizhong +赤字chizi +催化剂chj +种*chong +虫chong +重*chong +充chong +冲chong +崇chong +涌*chong +宠chong +茺chong +忡chong +憧chong +铳chong +舂chong +艟chong +宠爱chongai +崇拜chongbai +充斥chongchi +冲刺chongci +冲淡chongdan +充当chongdang +重叠chongdie +冲动chongdong +宠儿chonger +充分chongfen +冲锋chongfeng +重复chongfu +崇高chonggao +重合chonghe +重婚chonghun +冲击chongji +重建chongjian +崇敬chongjing +憧憬chongjing +充满chongman +充沛chongpei +冲破chongpo +重庆chongqing +崇尚chongshang +重申chongshen +充实chongshi +冲刷chongshua +冲天chongtian +冲突chongtu +重温chongwen +冲洗chongxi +重新chongxin +重演chongyan +重印chongyin +充裕chongyu +充足chongzu +抽chou +仇chou +臭chou +酬chou +畴chou +踌chou +稠chou +愁chou +筹chou +绸chou +瞅chou +丑chou +俦chou +帱chou +惆chou +瘳chou +雠chou +筹办chouban +筹备choubei +惆怅chouchang +抽搐chouchu +踌躇chouchu +筹措choucuo +抽调choudiao +丑恶choue +仇恨chouhen +丑化chouhua +筹划chouhua +筹集chouji +筹建choujian +酬金choujin +抽空choukong +酬劳choulao +丑陋choulou +筹码chouma +稠密choumi +筹谋choumou +愁容chourong +抽象chouxiang +酬谢chouxie +抽噎chouye +出chu +处chu +除chu +初chu +础chu +触chu +楚chu +锄chu +储chu +畜*chu +橱chu +厨chu +躇chu +雏chu +滁chu +矗chu +搐chu +亍chu +刍chu +怵chu +憷chu +绌chu +杵chu +楮chu +樗chu +褚chu +蜍chu +蹰chu +黜chu +揣chuai +搋chuai +啜chuai +嘬*chuai +膪chuai +踹chuai +揣度chuaidu +揣摩chuaimo +传chuan +船chuan +穿chuan +串chuan +川chuan +椽chuan +喘chuan +舛chuan +遄chuan +巛chuan +氚chuan +钏chuan +舡chuan +传遍chuanbian +传标chuanbiao +传播chuanbo +船舶chuanbo +船埠chuanbu +穿插chuancha +传达chuanda +传单chuandan +传导chuandao +传递chuandi +床chuang +创chuang +窗chuang +闯chuang +疮chuang +幢chuang +怆chuang +创办chuangban +闯荡chuangdang +窗户chuanghu +创见chuangjian +创建chuangjian +闯劲chuangjin +创举chuangju +窗口chuangkou +创立chuangli +窗帘chuanglian +创始chuangshi +创新chuangxin +创业chuangye +创造chuangzao +创作chuangzuo +串联chuanlian +喘气chuanqi +传奇chuanqi +传染chuanran +传授chuanshou +传输chuanshu +传述chuanshu +传说chuanshuo +传送chuansong +传统chuantong +串通chuantong +喘息chuanxi +传讯chuanxun +传扬chuanyang +传阅chuanyue +传真chuanzhen +船只chuanzhi +穿着chuanzhuo +出版chuban +出榜chubang +储备chubei +出兵chubing +初步chubu +储藏chucang +出差chucha +出产chuchan +出场chuchang +出厂chuchang +处处chuchu +橱窗chuchuang +初次chuci +储存chucun +初等chudeng +出动chudong +触动chudong +出发chufa +触发chufa +除法chufa +处罚chufa +触犯chufan +出访chufang +除非chufei +处分chufen +出轨chugui +出海chuhai +吹chui +垂chui +锤chui +椎*chui +炊chui +捶chui +陲chui +棰chui +槌chui +吹棒chuibang +吹风chuifeng +吹拂chuifu +锤炼chuilian +吹牛chuiniu +垂青chuiqing +垂涎chuixian +吹嘘chuixu +垂直chuizhi +初级chuji +出击chuji +出界chujie +出境chujing +处境chujing +处决chujue +触觉chujue +除开chukai +出口chukou +出来chulai +除了chule +出力chuli +处理chuli +矗立chuli +初恋chulian +出笼chulong +出路chulu +出马chuma +出卖chumai +出面chumian +出名chuming +除名chuming +出没chumo +春chun +纯chun +醇chun +椿chun +唇chun +淳chun +蠢chun +莼chun +鹑chun +蝽chun +出纳chuna +春播chunbo +纯粹chuncui +纯度chundu +春分chunfen +春风chunfeng +春耕chungeng +春光chunguang +醇厚chunhou +春辉chunhui +春季chunji +春节chunjie +纯洁chunjie +纯净chunjing +纯利chunli +纯朴chunpu +春秋chunqiu +春色chunse +春笋chunsun +春天chuntian +处女chunu +触怒chunu +春意chunyi +纯真chunzhen +纯正chunzheng +戳chuo +绰chuo +啜*chuo +辍chuo +踔chuo +龊chuo +戳穿chuochuan +绰号chuohao +啜泣chuoqi +出品chupin +出奇chuqi +初期chuqi +出勤chuqin +出去chuqu +出让churang +出任churen +出入churu +出色chuse +出身chushen +出神chushen +出生chusheng +畜生chusheng +出事chushi +出世chushi +处世chushi +厨师chushi +出售chushou +处所chusuo +出庭chuting +锄头chutou +出土chutu +出外chuwai +除外chuwai +出席chuxi +出息chuxi +除夕chuxi +出现chuxian +初小chuxiao +雏形chuxing +储蓄chuxu +刍议chuyi +处于chuyu +初战chuzhan +处长chuzhang +出诊chuzhen +出征chuzheng +处置chuzhi +初中chuzhong +出租chuzu +此ci +次ci +刺ci +磁ci +雌ci +词ci +茨ci +疵ci +辞ci +慈ci +瓷ci +赐ci +伺*ci +兹*ci +茈ci +呲ci +祠ci +鹚ci +糍ci +慈爱ciai +辞别cibie +磁场cichang +磁带cidai +磁道cidao +此地cidi +词典cidian +辞典cidian +刺耳cier +词根cigen +刺骨cigu +此后cihou +词汇cihui +刺激ciji +赐教cijiao +此刻cike +刺客cike +词类cilei +辞令ciling +磁盘cipan +次品cipin +辞去ciqu +刺杀cisha +此时cishi +次数cishu +辞书cishu +词素cisu +祠堂citang +辞退citui +此外ciwai +慈祥cixiang +辞行cixing +词性cixing +雌雄cixiong +次序cixu +词序cixu +刺眼ciyan +次要ciyao +词语ciyu +赐予ciyu +此致cizhi +辞职cizhi +词缀cizhui +词组cizu +超级大国cjdg +参考书cks +参考消息ckxx +参考资料ckzl +触类旁通clpt +藏龙卧虎clwh +参谋长cmc +聪明才智cmcz +出谋划策cmhc +从难从严cncy +从cong +丛cong +聪cong +葱cong +囱cong +匆cong +苁cong +淙cong +骢cong +琮cong +璁cong +从此congci +匆匆congcong +匆促congcu +从而conger +从犯congfan +聪慧conghui +从来conglai +丛林conglin +匆忙congmang +聪明congming +从前congqian +从容congrong +从事congshi +丛书congshu +从速congsu +从新congxin +从严congyan +聪颖congying +葱郁congyu +从中congzhong +凑cou +楱cou +辏cou +腠cou +凑合couhe +凑巧couqiao +成品率cpl +成千上万cqsw +从容不迫crbp +承认错误crcw +趁热打铁crdt +措手不及csbj +出生率csl +长沙市css +炊事员csy +彻头彻尾ctcw +垂头丧气ctsq +粗cu +促cu +醋cu +簇cu +卒*cu +蔟cu +徂cu +猝cu +殂cu +酢cu +蹙cu +蹴cu +篡cuan +蹿cuan +窜cuan +攒*cuan +汆cuan +撺cuan +爨cuan +镩cuan +篡夺cuanduo +窜犯cuanfan +篡改cuangai +篡权cuanquan +粗暴cubao +粗糙cucao +粗犷cuguang +催cui +脆cui +淬cui +粹cui +摧cui +衰*cui +崔cui +瘁cui +翠cui +萃cui +啐cui +悴cui +璀cui +榱cui +毳cui +隹cui +摧残cuican +脆弱cuiruo +促进cujin +存cun +村cun +寸cun +蹲*cun +忖cun +皴cun +存储cunchu +存档cundang +存放cunfang +存款cunkuan +村落cunluo +存亡cunwang +存在cunzai +村镇cunzhen +村庄cunzhuang +村子cunzi +错cuo +措cuo +撮cuo +磋cuo +搓cuo +挫cuo +厝cuo +嵯cuo +脞cuo +锉cuo +矬cuo +痤cuo +瘥*cuo +鹾cuo +蹉cuo +错案cuoan +挫败cuobai +错处cuochu +措辞cuoci +错怪cuoguai +错过cuoguo +撮合cuohe +错觉cuojue +磋商cuoshang +挫伤cuoshang +措施cuoshi +错误cuowu +挫折cuozhe +错综cuozong +粗浅cuqian +促使cushi +粗俗cusu +粗心cuxin +粗壮cuzhuang +常委会cwh +崇文区cwq +常务委员会cwwh +乘务员cwy +诚心诚意cxcy +程序控制cxkz +程序设计cxsj +长远利益cyly +朝阳区cyq +财政部czb +错综复杂czfz +操之过急czgj +出租汽车czqc +此之外czw +财政危机czwj +创造性czx +操作系统czxt +操作员czy +持之以恒czyh +的d +大d +地d +动d +到d +对d +度d +多d +电d +党d +得d +定d +等d +斗d +当d +队d +都d +点d +代d +道d +大da +打da +达da +答da +搭da +塔*da +瘩da +耷da +哒da +嗒da +怛da +妲da +沓*da +疸da +褡da +笪da +靼da +鞑da +答案daan +打败dabai +大办daban +大半daban +打扮daban +答辩dabian +大伯dabo +大部dabu +达成dacheng +大胆dadan +搭档dadang +大道dadao +达到dadao +打倒dadao +大地dadi +大敌dadi +大抵dadi +打断daduan +大队dadui +大多daduo +大凡dafan +大夫dafu +大幅dafu +答复dafu +大概dagai +大纲dagang +大国daguo +大海dahai +大好dahao +大河dahe +大亨daheng +大会dahui +大*dai +代dai +带dai +待dai +袋dai +戴dai +呆dai +歹dai +傣dai +殆dai +贷dai +逮dai +怠dai +埭dai +甙dai +呔dai +岱dai +迨dai +骀dai +绐dai +玳dai +黛dai +呆板daiban +代表daibiao +逮捕daibu +逮逋daibu +代词daici +带动daidong +怠工daigong +代价daijia +贷款daikuan +带来dailai +代理daili +带领dailing +带路dailu +黛绿dailu +代码daima +怠慢daiman +待命daiming +代数daishu +代替daiti +带头daitou +歹徒daitu +待遇daiyu +呆滞daizhi +呆子daizi +打击daji +大家dajia +打搅dajiao +大街dajie +大捷dajie +打劫dajie +搭救dajiu +大局daju +答卷dajuan +打开dakai +耷拉dala +大力dali +大连dalian +大量daliang +打量daliang +大陆dalu +大略dalue +大妈dama +单dan +但dan +弹dan +担dan +石*dan +蛋dan +淡dan +胆dan +氮dan +丹dan +旦dan +耽dan +郸dan +掸dan +惮dan +诞dan +儋dan +萏dan +啖dan +澹*dan +殚dan +赕dan +眈dan +疸dan +瘅dan +聃dan +箪dan +大脑danao +担保danbao +单薄danbao +淡薄danbao +单产danchan +诞辰danchen +单纯danchun +单词danci +担当dandang +单调dandiao +单独dandu +单方danfang +担负danfu +党dang +当dang +档dang +挡dang +荡dang +谠dang +凼dang +菪dang +宕dang +砀dang +裆dang +单干dangan +胆敢dangan +档案dangan +当场dangchang +当初dangchu +当代dangdai +当地dangdi +单个dange +耽搁dange +党风dangfeng +党纲danggang +党纪dangji +党籍dangji +当即dangji +当家dangjia +当今dangjin +当局dangju +当量dangliang +当面dangmian +党内dangnei +当年dangnian +党派dangpai +当铺dangpu +当前dangqian +当然dangran +当日dangri +当时dangshi +当天dangtian +当头dangtou +党团dangtuan +当晚dangwan +党委dangwei +当先dangxian +党校dangxiao +当心dangxin +党性dangxing +荡漾dangyang +党员dangyuan +当月dangyue +党章dangzhang +当真dangzhen +党政dangzheng +当政dangzheng +当中dangzhong +当众dangzhong +当做dangzuo +单价danjia +担架danjia +胆量danliang +胆略danlue +淡漠danmo +胆怯danqie +丹青danqing +担任danren +单身danshen +诞生dansheng +但是danshi +胆识danshi +单体danti +丹田dantian +单位danwei +耽误danwu +单项danxiang +胆小danxiao +担心danxin +淡雅danya +弹药danyao +单一danyi +单元danyuan +但愿danyuan +单质danzhi +担子danzi +掸子danzi +单字danzi +到dao +道dao +导dao +刀dao +倒dao +稻dao +岛dao +捣dao +盗dao +蹈dao +祷dao +悼dao +叨dao +帱*dao +忉dao +氘dao +焘*dao +纛dao +倒闭daobi +到处daochu +悼词daoci +到达daoda +导弹daodan +道德daode +到底daodi +倒戈daoge +捣鬼daogui +捣毁daohui +到来daolai +到了daole +道理daoli +倒立daoli +道路daolu +捣乱daoluan +倒霉daomei +叨念daonian +道歉daoqian +刀枪daoqiang +盗窃daoqie +到时daoshi +导师daoshi +倒数daoshu +导体daoti +倒退daotui +导演daoyan +道义daoyi +盗用daoyong +岛屿daoyu +导致daozhi +大批dapi +大破dapo +打破dapo +大气daqi +大庆daqing +打扰darao +打扫dasao +大厦dasha +搭讪dashan +大赦dashe +大使dashi +大事dashi +大师dashi +大势dashi +大肆dasi +打算dasuan +大体dati +大厅dating +打听dating +大同datong +大小daxiao +大写daxie +答谢daxie +大选daxuan +大学daxue +大业daye +达因dayin +打印dayin +答应daying +大于dayu +大院dayuan +大约dayue +打仗dazhang +大致dazhi +大众dazhong +打字dazi +代办处dbc +得不偿失dbcs +大部分dbf +电报挂号dbgh +大不了dbl +大步流星dblx +对不起dbq +代表团dbt +电冰箱dbx +东城区dcq +到此为止dcwz +独创性dcx +调查研究dcyj +打成一片dcyp +打电话ddh +电动机ddj +对得起ddq +大多数dds +的de +得de +地*de +德de +底*de +锝de +得逞decheng +的当dedang +得当dedang +得到dedao +得分defen +德国deguo +得奖dejiang +得救dejiu +得了dele +得力deli +等deng +灯deng +登deng +邓deng +澄*deng +蹬deng +瞪deng +凳deng +噔deng +嶝deng +戥deng +磴deng +镫deng +簦deng +登场dengchang +等待dengdai +等到dengdao +灯光dengguang +等候denghou +等级dengji +登记dengji +等价dengjia +灯具dengju +登门dengmen +灯谜dengmi +登攀dengpan +登山dengshan +灯塔dengta +登台dengtai +等同dengtong +等闲dengxian +等于dengyu +登载dengzai +得胜desheng +得失deshi +得体deti +德行dexing +得以deyi +得意deyi +德育deyu +得志dezhi +得知dezhi +得罪dezui +大幅度dfd +多方面dfm +单方面dfm +电风扇dfs +大规模dgm +多功能dgn +大公无私dgws +帝国主义dgzy +电话号码dhhm +电化教育dhjy +大会堂dht +的*di +地di +第di +低di +敌di +底di +提*di +帝di +抵di +滴di +弟di +递di +堤di +迪di +笛di +狄di +涤di +翟di +嫡di +蒂di +缔di +氐di +籴di +诋di +谛di +邸di +坻*di +荻di +嘀di +娣di +绨di +柢di +棣di +觌di +砥di +碲di +睇di +镝di +羝di +骶di +嗲dia +电dian +点dian +垫dian +典dian +店dian +颠dian +淀dian +掂dian +滇dian +碘dian +靛dian +佃dian +甸dian +惦dian +奠dian +殿dian +阽dian +坫dian +巅dian +玷dian +钿dian +癜dian +癫dian +簟dian +踮dian +电报dianbao +点播dianbo +电场dianchang +电车dianche +电池dianchi +电传dianchuan +颠倒diandao +电灯diandeng +点滴diandi +奠定dianding +电动diandong +典范dianfan +淀粉dianfen +垫付dianfu +颠覆dianfu +电感diangan +典故diangu +电荷dianhe +电弧dianhu +电话dianhua +电汇dianhui +电机dianji +电极dianji +奠基dianji +惦记dianji +典籍dianji +点将dianjiang +电解dianjie +殿军dianjun +癫狂diankuang +电缆dianlan +电力dianli +电离dianli +典礼dianli +电流dianliu +电路dianlu +电脑diannao +电能dianneng +店铺dianpu +电气dianqi +电器dianqi +点燃dianran +电容dianrong +电扇dianshan +电视dianshi +电台diantai +电梯dianti +点头diantou +电网dianwang +电位dianwei +玷污dianwu +殿下dianxia +电线dianxian +癫痫dianxian +电信dianxin +典型dianxing +电讯dianxun +电压dianya +电影dianying +店员dianyuan +点阵dianzhen +点缀dianzhui +电子dianzi +点子dianzi +电阻dianzu +调diao +掉diao +吊diao +鸟*diao +碉diao +叼diao +雕diao +凋diao +刁diao +钓diao +铞diao +铫diao +貂diao +鲷diao +碉堡diaobao +凋敝diaobi +调查diaocha +吊车diaoche +调动diaodong +调度diaodu +钓饵diaoer +调换diaohuan +掉换diaohuan +雕刻diaoke +调令diaoling +刁难diaonan +调遣diaoqian +调任diaoren +雕塑diaosu +吊唁diaoyan +调用diaoyong +钓鱼diaoyu +调子diaozi +第八diba +地板diban +地步dibu +低沉dichen +抵触dichu +抵达dida +地带didai +低档didang +抵挡didang +地道didao +弟弟didi +地点didian +地段diduan +敌对didui +迭die +跌die +爹die +碟die +蝶die +谍die +叠die +垤die +堞die +揲die +喋die +牒die +瓞die +耋die +踮*die +蹀die +鲽die +迭起dieqi +第二dier +地方difang +低估digu +敌国diguo +帝国diguo +敌后dihou +诋毁dihui +低级diji +递加dijia +递减dijian +地窖dijiao +递交dijiao +缔交dijiao +缔结dijie +第九dijiu +敌军dijun +抵抗dikang +地牢dilao +地理dili +低劣dilie +第六diliu +低落diluo +地貌dimao +地面dimian +抵命diming +定ding +顶ding +钉ding +丁ding +订ding +盯ding +叮ding +鼎ding +锭ding +仃ding +啶ding +玎ding +腚ding +碇ding +町ding +铤*ding +疔ding +耵ding +酊ding +定案dingan +定产dingchan +丁当dingdang +顶点dingdian +定夺dingduo +定额dinge +顶峰dingfeng +顶锋dingfeng +定购dinggou +订购dinggou +订户dinghu +定货dinghuo +订货dinghuo +定价dingjia +定局dingju +定居dingju +定理dingli +订立dingli +鼎立dingli +定量dingliang +定律dinglu +定期dingqi +定然dingran +盯梢dingshao +定时dingshi +顶替dingti +定性dingxing +定型dingxing +定义dingyi +定语dingyu +定员dingyuan +订阅dingyue +订正dingzheng +叮嘱dingzhu +顶撞dingzhuang +钉子dingzi +嫡派dipai +地盘dipan +第七diqi +嫡亲diqin +敌情diqing +地球diqiu +地区diqu +的确dique +敌人diren +第三disan +地势dishi +第十dishi +滴水dishui +第四disi +地铁ditie +地图ditu +丢diu +铥diu +丢掉diudiao +丢脸diulian +丢失diushi +地位diwei +敌伪diwei +第五diwu +嫡系dixi +底细dixi +地下dixia +低下dixia +底下dixia +地形dixing +弟兄dixiong +第一diyi +敌意diyi +地域diyu +抵御diyu +缔造dizao +递增dizeng +地震dizhen +敌阵dizhen +地质dizhi +地址dizhi +抵制dizhi +底子dizi +弟子dizi +党纪国法djgf +当机立断djld +多劳多得dldd +大力发展dlfz +大力加强dljq +大力开展dlkz +独立自主dlzz +多面手dms +对内搞活dngh +多年来dnl +东南亚dny +动dong +东dong +冬dong +懂dong +洞dong +冻dong +董dong +栋dong +侗dong +恫dong +垌dong +咚dong +岽dong +峒dong +氡dong +胨dong +胴dong +硐dong +鸫dong +东北dongbei +东边dongbian +东部dongbu +洞察dongcha +动词dongci +动荡dongdang +懂得dongde +东方dongfang +东风dongfeng +动工donggong +东海donghai +恫吓donghe +动机dongji +冬季dongji +东家dongjia +冻结dongjie +动静dongjing +东京dongjing +动力dongli +动量dongliang +栋梁dongliang +动乱dongluan +动脉dongmai +东南dongnan +东欧dongou +动人dongren +动身dongshen +董事dongshi +动手dongshou +动态dongtai +冬天dongtian +动听dongting +动物dongwu +东西dongxi +洞悉dongxi +动向dongxiang +动心dongxin +东亚dongya +东洋dongyang +动摇dongyao +动用dongyong +动员dongyuan +动辄dongzhe +动作dongzuo +斗dou +都*dou +豆dou +读*dou +兜dou +抖dou +陡dou +逗dou +痘dou +蔸dou +窦dou +蚪dou +篼dou +兜风doufeng +逗号douhao +逗留douliu +斗室doushi +兜售doushou +斗争douzheng +斗志douzhi +斗智douzhi +抖嘴douzui +打破常规dpcg +地平线dpx +电器化dqh +待人接物drjw +第三产业dscy +第十二届dsej +大使馆dsg +到时候dsh +电视机dsj +多少年dsn +大失所望dssw +电视台dst +低三下四dsxs +第十一届dsyj +大踏步dtb +到头来dtl +大体上dts +大同小异dtxy +度du +都du +毒du +独du +读du +渡du +杜du +堵du +镀du +顿du +督du +犊du +睹du +赌du +肚du +妒du +芏du +嘟du +渎du +椟du +牍du +蠹du +笃du +髑du +黩du +断duan +端duan +段duan +短duan +锻duan +缎duan +椴duan +煅duan +簖duan +短波duanbo +短处duanchu +短促duancu +断定duanding +短短duanduan +断交duanjiao +断绝duanjue +锻练duanlian +锻炼duanlian +短路duanlu +段落duanluo +短评duanping +短期duanqi +短缺duanque +断然duanran +煅烧duanshao +断送duansong +短途duantu +端午duanwu +端详duanxiang +短小duanxiao +断言duanyan +端阳duanyang +短语duanyu +短暂duanzan +端正duanzheng +端庄duanzhuang +读报dubao +读本duben +赌博dubo +独裁ducai +毒草ducao +独唱duchang +独创duchuang +督促ducu +毒打duda +独到dudao +度过duguo +毒害duhai +毒化duhua +都会duhui +对dui +队dui +堆dui +敦*dui +兑dui +怼dui +憝dui +碓dui +对比duibi +队部duibu +对策duice +对称duichen +对此duici +对待duidai +对等duideng +对调duidiao +对方duifang +对付duifu +对话duihua +兑换duihuan +对讲duijiang +对抗duikang +对口duikou +对垒duilei +对立duili +对联duilian +队列duilie +对流duiliu +对面duimian +对内duinei +对偶duiou +对手duishou +对数duishu +对外duiwai +队伍duiwu +兑现duixian +对象duixiang +对应duiying +对于duiyu +队员duiyuan +堆栈duizhan +队长duizhang +对照duizhao +对证duizheng +对质duizhi +对峙duizhi +对准duizhun +镀金dujin +杜绝dujue +渡口dukou +都来dulai +独立duli +度量duliang +盾dun +吨dun +顿dun +蹲dun +敦dun +墩dun +囤dun +钝dun +遁dun +沌dun +炖dun +砘dun +礅dun +盹dun +镦dun +趸dun +蹲点dundian +顿号dunhao +囤积dunji +遁迹dunji +钝角dunjiao +顿时dunshi +敦实dunshi +多duo +度*duo +夺duo +朵duo +掇duo +哆duo +垛duo +躲duo +跺duo +舵duo +剁duo +惰duo +堕duo +驮*duo +咄duo +哚duo +沲duo +缍duo +柁duo +铎duo +裰duo +踱duo +多半duoban +躲避duobi +多变duobian +多边duobian +躲藏duocang +多次duoci +夺得duode +多端duoduan +多方duofang +躲开duokai +多亏duokui +夺魁duokui +堕落duoluo +多么duome +夺目duomu +多年duonian +多情duoqing +夺取duoqu +多少duoshao +多事duoshi +掇拾duoshi +舵手duoshou +多数duoshu +多谢duoxie +多心duoxin +惰性duoxing +多样duoyang +多余duoyu +多种duozhong +肚皮dupi +毒品dupin +毒气duqi +读取duqu +度日duri +读入duru +堵塞duse +毒蛇dushe +都是dushi +毒手dushou +读数dushu +读书dushu +毒素dusu +独特dute +读物duwu +毒药duyao +独占duzhan +读者duzhe +毒汁duzhi +渎职duzhi +赌注duzhu +杜撰duzhuan +独自duzi +党委会dwh +对外开放dwkf +敌我矛盾dwmd +对外贸易dwmy +大无畏dww +动物园dwy +当务之急dwzj +邓小平dxp +大学生dxs +大显身手dxss +大西洋dxy +大跃进dyj +打印机dyj +大有可为dykw +待业青年dyqn +掉以轻心dyqx +电影院dyy +大洋洲dyz +大有作为dyzw +党支部dzb +多种多样dzdy +党政机关dzjg +多种经营dzjy +断章取义dzqy +大自然dzr +德智体dzt +电子学dzx +党中央dzy +而e +二e +尔e +儿e +恶e +额e +恩e +俄e +耳e +饵e +蛾e +饿e +峨e +鹅e +讹e +娥e +厄e +扼e +遏e +鄂e +噩e +谔e +垩e +苊e +莪e +萼e +呃e +愕e +屙e +婀e +轭e +腭e +锇e +锷e +鹗e +颚e +鳄e +恶霸eba +恶毒edu +恶感egan +恶棍egun +噩耗ehao +恶化ehua +诶ei +二极管ejg +二进制ejz +恶劣elie +鹅毛emao +噩梦emeng +恶魔emo +耳目一新emyx +恩en +蒽en +摁en +恩爱enai +恩赐enci +恩典endian +恩惠enhui +恩情enqing +而er +二er +尔er +儿er +耳er +饵er +洱er +贰er +佴er +迩er +珥er +铒er +鸸er +鲕er +耳朵erduo +儿歌erge +耳光erguang +而后erhou +尔后erhou +二届erjie +而今erjin +而况erkuang +而且erqie +而是ershi +儿童ertong +儿戏erxi +而已eryi +耳语eryu +二月eryue +儿子erzi +扼杀esha +额外ewai +扼腕ewan +额外负担ewfd +恶习exi +恶心exin +恶性exing +恶性循环exxh +扼要eyao +厄运eyun +讹诈ezha +遏止ezhi +分f +发f +方f +法f +反f +放f +复f +风f +防f +非f +服f +肥f +副f +粉f +府f +夫f +负f +封f +富f +翻f +发fa +法fa +阀fa +乏fa +伐fa +罚fa +筏fa +珐fa +垡fa +砝fa +发报fabao +法宝fabao +发表fabiao +发布fabu +发财facai +发愁fachou +发出fachu +发达fada +发电fadian +法典fadian +法定fading +发动fadong +发放fafang +发奋fafen +发愤fafen +法官faguan +法规fagui +法国faguo +发慌fahuang +发挥fahui +发火fahuo +发给faji +发迹faji +法纪faji +发家fajia +发奖fajiang +发酵fajiao +罚金fajin +发觉fajue +发掘fajue +罚款fakuan +发狂fakuang +法郎falang +法令faling +法律falu +发落faluo +发明faming +反fan +翻fan +范fan +犯fan +饭fan +繁fan +泛fan +番fan +凡fan +烦fan +返fan +藩fan +帆fan +樊fan +矾fan +钒fan +贩fan +蕃fan +蘩fan +幡fan +梵fan +燔fan +畈fan +蹯fan +翻版fanban +反比fanbi +反驳fanbo +帆布fanbu +反常fanchang +范畴fanchou +犯愁fanchou +帆船fanchuan +饭店fandian +反动fandong +翻动fandong +反对fandui +繁多fanduo +反而faner +反复fanfu +方fang +放fang +防fang +访fang +房fang +纺fang +仿fang +妨fang +芳fang +肪fang +坊fang +邡fang +彷*fang +枋fang +钫fang +舫fang +鲂fang +妨碍fangai +方案fangan +反感fangan +防备fangbei +方便fangbian +防潮fangchao +方程fangcheng +放大fangda +放荡fangdang +防盗fangdao +方法fangfa +防范fangfan +防风fangfeng +防腐fangfu +仿佛fangfu +妨害fanghai +防护fanghu +防火fanghuo +放假fangjia +房间fangjian +方面fangmian +放牧fangmu +返工fangong +反攻fangong +放屁fangpi +放弃fangqi +防区fangqu +放任fangren +放哨fangshao +放射fangshe +方式fangshi +防守fangshou +放肆fangsi +放松fangsong +仿宋fangsong +翻滚fangun +方位fangwei +防卫fangwei +访问fangwen +房屋fangwu +放下fangxia +防线fangxian +方向fangxiang +芳香fangxiang +仿效fangxiao +放心fangxin +放行fangxing +方言fangyan +防疫fangyi +防御fangyu +仿造fangzao +仿照fangzhao +方针fangzhen +仿真fangzhen +防治fangzhi +仿制fangzhi +放置fangzhi +防止fangzhi +纺织fangzhi +房子fangzi +放纵fangzong +房租fangzu +番号fanhao +繁华fanhua +反悔fanhui +返回fanhui +反击fanji +反抗fankang +反馈fankui +泛滥fanlan +范例fanli +凡例fanli +翻脸fanlian +贩卖fanmai +繁忙fanmang +烦闷fanmen +反面fanmian +反目fanmu +烦恼fannao +反叛fanpan +犯人fanren +繁荣fanrong +反射fanshe +翻身fanshen +繁盛fansheng +凡是fanshi +凡事fanshi +繁琐fansuo +烦琐fansuo +翻腾fanteng +繁体fanti +饭桶fantong +发怒fanu +饭碗fanwan +范围fanwei +反问fanwen +反响fanxiang +返销fanxiao +反省fanxing +翻修fanxiu +繁衍fanyan +翻译fanyi +翻印fanyin +反应fanying +反映fanying +繁育fanyu +翻越fanyue +翻阅fanyue +贩运fanyun +繁杂fanza +烦燥fanzao +反正fanzheng +反之fanzhi +繁殖fanzhi +繁重fanzhong +贩子fanzi +犯罪fanzui +发起faqi +法权faquan +发射fashe +发生fasheng +发誓fashi +发售fashou +法庭fating +发现faxian +发泄faxie +发行faxing +发言fayan +发扬fayang +法医fayi +发育fayu +发源fayuan +法院fayuan +法则faze +发展fazhan +法制fazhi +法治fazhi +发作fazuo +奋不顾身fbgs +分崩离析fblx +副产品fcp +发电机fdj +发动机fdj +反动派fdp +分道扬镳fdyb +非fei +肥fei +飞fei +费fei +废fei +肺fei +沸fei +菲fei +匪fei +啡fei +诽fei +吠fei +芾fei +狒fei +悱fei +淝fei +妃fei +绯fei +榧fei +腓fei +斐fei +扉fei +镄fei +痱fei +蜚fei +篚fei +翡fei +霏fei +鲱fei +匪帮feibang +诽谤feibang +飞奔feiben +非常feichang +飞驰feichi +废除feichu +非但feidan +非得feide +沸点feidian +非法feifa +非凡feifan +肺腑feifu +绯红feihong +废话feihua +飞机feiji +飞溅feijian +费解feijie +费劲feijin +飞快feikuai +费力feili +肥料feiliao +废料feiliao +肥胖feipang +废品feipin +废弃feiqi +费神feishen +废水feishui +飞速feisu +沸腾feiteng +匪徒feitu +肥沃feiwo +废物feiwu +飞舞feiwu +飞翔feixiang +费心feixin +飞行feixing +废墟feixu +飞扬feiyang +扉页feiye +非议feiyi +费用feiyong +飞跃feiyue +肥皂feizao +飞涨feizhang +废止feizhi +非洲feizhou +妃子feizi +分fen +粉fen +奋fen +份fen +粪fen +纷fen +芬fen +愤fen +酚fen +吩fen +氛fen +坟fen +焚fen +汾fen +忿fen +偾fen +瀵fen +玢*fen +棼fen +鲼fen +鼢fen +分贝fenbei +分辩fenbian +分辨fenbian +粪便fenbian +分别fenbie +分部fenbu +分布fenbu +分册fence +分寸fencun +分担fendan +分得fende +分店fendian +奋斗fendou +分队fendui +分发fenfa +奋发fenfa +纷纷fenfen +吩咐fenfu +风feng +封feng +蜂feng +丰feng +缝feng +峰feng +锋feng +疯feng +奉feng +枫feng +烽feng +逢feng +冯feng +讽feng +凤feng +俸feng +酆feng +葑feng +唪feng +沣feng +砜feng +风暴fengbao +丰碑fengbei +封闭fengbi +风波fengbo +丰产fengchan +奉承fengcheng +讽刺fengci +封存fengcun +风度fengdu +分割fenge +分隔fenge +风发fengfa +风帆fengfan +丰富fengfu +奉告fenggao +风格fengge +奉公fenggong +风光fengguang +风寒fenghan +奉还fenghuan +凤凰fenghuang +烽火fenghuo +封建fengjian +风景fengjing +疯狂fengkuang +风浪fenglang +风力fengli +风流fengliu +丰满fengman +锋芒fengmang +风貌fengmao +奉命fengming +丰年fengnian +分工fengong +奉陪fengpei +风气fengqi +风情fengqing +风趣fengqu +奉劝fengquan +缝纫fengren +风骚fengsao +风沙fengsha +风尚fengshang +风声fengsheng +丰盛fengsheng +丰收fengshou +风霜fengshuang +风水fengshui +丰硕fengshuo +奉祀fengsi +风俗fengsu +封锁fengsuo +疯瘫fengtan +封条fengtiao +风头fengtou +分管fenguan +风味fengwei +缝隙fengxi +风险fengxian +奉献fengxian +风向fengxiang +风行fengxing +奉行fengxing +蜂拥fengyong +风云fengyun +风韵fengyun +风灾fengzai +疯子fengzi +风姿fengzi +分号fenhao +分毫fenhao +分红fenhong +粉红fenhong +分化fenhua +分会fenhui +焚毁fenhui +分级fenji +分解fenjie +分界fenjie +奋进fenjin +分居fenju +分开fenkai +愤慨fenkai +分类fenlei +分离fenli +奋力fenli +分量fenliang +分裂fenlie +纷乱fenluan +分娩fenmian +分秒fenmiao +分明fenming +粉末fenmo +坟墓fenmu +愤怒fennu +分派fenpai +分配fenpei +分批fenpi +分期fenqi +分歧fenqi +奋起fenqi +分清fenqing +分区fenqu +分散fensan +焚烧fenshao +分数fenshu +分说fenshuo +粉碎fensui +分摊fentan +粪土fentu +分外fenwai +氛围fenwei +分析fenxi +奋勇fenyong +分赃fenzang +奋战fenzhan +分支fenzhi +分子fenzi +分组fenzu +丰富多采ffdc +奋发图强fftq +反过来说fgls +反革命fgm +福建省fjs +封建主义fjzy +翻来覆去flfq +法律顾问flgw +分秒必争fmbz +发明创造fmcz +否fou +缶fou +否定fouding +否决foujue +否认fouren +否则fouze +费品率fpl +废寝忘食fqws +缝纫机frj +分水岭fsl +翻天复地ftfd +丰台区ftq +非同小可ftxk +繁体字ftz +复fu +服fu +副fu +府fu +夫fu +负fu +富fu +附fu +福fu +伏fu +符fu +幅fu +腐fu +浮fu +辅fu +付fu +腹fu +妇fu +孵fu +覆fu +扶fu +辐fu +傅fu +佛fu +缚fu +父fu +弗fu +甫fu +肤fu +氟fu +敷fu +拂fu +俘fu +涪fu +袱fu +抚fu +俯fu +釜fu +斧fu +脯fu +腑fu +赴fu +赋fu +阜fu +讣fu +咐fu +匐fu +凫fu +郛fu +芙fu +芾*fu +苻fu +茯fu +莩fu +菔fu +拊fu +呋fu +幞fu +怫fu +滏fu +艴fu +孚fu +驸fu +绂fu +绋fu +桴fu +赙fu +祓fu +砩fu +黻fu +黼fu +罘fu +稃fu +馥fu +蚨fu +蜉fu +蝠fu +蝮fu +麸fu +趺fu +跗fu +鲋fu +鳆fu +腐败fubai +复辟fubi +复查fucha +浮沉fuchen +扶持fuchi +付出fuchu +副词fuci +服从fucong +附带fudai +负担fudan +辅导fudao +浮雕fudiao +浮动fudong +幅度fudu +复发fufa +伏法fufa +夫妇fufu +覆盖fugai +讣告fugao +富贵fugui +符号fuhao +附和fuhe +符合fuhe +负荷fuhe +腐化fuhua +浮华fuhua +复活fuhuo +俘获fuhuo +伏击fuji +附加fujia +附件fujian +福建fujian +佛教fujiao +附近fujin +副刊fukan +俯瞰fukan +浮夸fukua +付款fukuan +腐烂fulan +福利fuli +浮力fuli +富丽fuli +妇联fulian +附录fulu +俘虏fulu +覆灭fumie +覆没fumo +父母fumu +富农funong +妇女funu +扶贫fupin +服气fuqi +福气fuqi +夫妻fuqi +付讫fuqi +肤浅fuqian +富强fuqiang +父亲fuqin +富饶furao +夫人furen +芙蓉furong +妇孺furu +负伤fushang +辐射fushe +复试fushi +腐蚀fushi +俯视fushi +副手fushou +复数fushu +负数fushu +附属fushu +富庶fushu +赋税fushui +伏特fute +覆亡fuwang +富翁fuweng +服务fuwu +复习fuxi +浮现fuxian +赋闲fuxian +浮想fuxiang +腐朽fuxiu +抚恤fuxu +敷衍fuyan +扶养fuyang +抚养fuyang +俯仰fuyang +副业fuye +服役fuyi +复印fuyin +富有fuyou +赋有fuyou +赋于fuyu +抚育fuyu +富裕fuyu +赋予fuyu +复员fuyuan +复原fuyuan +负约fuyue +复杂fuza +负载fuzai +附则fuze +负责fuze +负债fuzhai +付帐fuzhang +复制fuzhi +扶植fuzhi +附中fuzhong +福州fuzhou +抚州fuzhou +附注fuzhu +辅助fuzhu +扶助fuzhu +服装fuzhuang +附着fuzhuo +富足fuzu +辅佐fuzuo +服务部fwb +服务态度fwtd +服务员fwy +方兴未艾fxwa +奋勇当先fydx +翻一番fyf +风言风语fyfy +发扬光大fygd +复印机fyj +发言人fyr +风雨同舟fytz +房租费fzf +副总理fzl +纺织品fzp +福州市fzs +反作用fzy +副作用fzy +负责制fzz +发展中国家fzzj +个g +国g +工g +过g +高g +干g +关g +各g +革g +公g +根g +更g +改g +管g +光g +广g +果g +格g +共g +搞g +夹*ga +噶ga +嘎ga +胳*ga +尬ga +尕ga +尜ga +旮ga +钆ga +公安部gab +改gai +该gai +盖gai +概gai +钙gai +溉gai +芥*gai +丐gai +陔gai +垓gai +戤gai +赅gai +改变gaibian +改编gaibian +该当gaidang +改道gaidao +改动gaidong +改革gaige +改观gaiguan +改过gaiguo +改悔gaihui +改建gaijian +改进gaijin +概况gaikuang +概括gaikuo +改良gailiang +概率gailu +概论gailun +概貌gaimao +概念gainian +改期gaiqi +改善gaishan +概述gaishu +概叹gaitan +改天gaitian +改选gaixuan +概要gaiyao +改造gaizao +改正gaizheng +改装gaizhuang +改组gaizu +公安局gaj +干gan +杆gan +感gan +敢gan +赶gan +甘gan +肝gan +秆gan +柑gan +竿gan +赣gan +乾*gan +坩gan +苷gan +尴gan +擀gan +泔gan +淦gan +澉gan +绀gan +橄gan +旰gan +矸gan +疳gan +酐gan +干部ganbu +感触ganchu +干脆gancui +敢当gandang +甘当gandang +感到gandao +感动gandong +感恩ganen +刚gang +钢gang +缸gang +纲gang +岗gang +港gang +杠gang +冈gang +肛gang +扛*gang +戆gang +罡gang +筻gang +尴尬ganga +港澳gangao +刚才gangcai +钢材gangcai +刚刚ganggang +刚好ganghao +港口gangkou +纲领gangling +岗哨gangshao +钢铁gangtie +港湾gangwan +岗位gangwei +港务gangwu +刚要gangyao +纲要gangyao +刚毅gangyi +干旱ganhan +感化ganhua +干活ganhuo +肝火ganhuo +感激ganji +干劲ganjin +赶紧ganjin +干净ganjing +感觉ganjue +感慨gankai +甘苦ganku +赶快gankuai +赶忙ganmang +感冒ganmao +感情ganqing +感染ganran +干扰ganrao +干涉ganshe +干事ganshi +感受ganshou +甘肃gansu +感叹gantan +干线ganxian +感想ganxiang +敢想ganxiang +感谢ganxie +甘心ganxin +感性ganxing +感应ganying +敢于ganyu +干预ganyu +甘愿ganyuan +干燥ganzao +感召ganzhao +赣州ganzhou +敢做ganzuo +高gao +搞gao +告gao +稿gao +膏gao +篙gao +皋gao +羔gao +糕gao +镐gao +睾gao +诰gao +郜gao +藁gao +缟gao +槔gao +槁gao +杲gao +锆gao +高矮gaoai +高昂gaoang +告别gaobie +高产gaochan +高超gaochao +高潮gaochao +告成gaocheng +告辞gaoci +高大gaoda +高档gaodang +高等gaodeng +高地gaodi +高低gaodi +糕点gaodian +高度gaodu +告发gaofa +高峰gaofeng +高高gaogao +高歌gaoge +高贵gaogui +高喊gaohan +搞好gaohao +高呼gaohu +搞坏gaohuai +高级gaoji +告急gaoji +高价gaojia +高见gaojian +稿件gaojian +告捷gaojie +告诫gaojie +高龄gaoling +高楼gaolou +告密gaomi +高明gaoming +高能gaoneng +高攀gaopan +高频gaopin +高强gaoqiang +高山gaoshan +高尚gaoshang +高深gaoshen +告示gaoshi +高耸gaosong +高速gaosu +告诉gaosu +高温gaowen +高小gaoxiao +高校gaoxiao +高兴gaoxing +膏药gaoyao +高原gaoyuan +高涨gaozhang +高招gaozhao +高中gaozhong +告终gaozhong +告状gaozhuang +稿子gaozi +港澳同胞gatb +怪不得gbd +各部门gbm +各部委gbw +供不应求gbyq +故步自封gbzf +共产党gcd +共产党员gcdy +工程师gcs +顾此失彼gcsb +贯彻执行gczx +共产主义gczy +各地方gdf +各大军区gdjq +广东省gds +高档商品gdsp +各单位gdw +高等院校gdyx +固定资产gdzc +个ge +各ge +革ge +合*ge +格ge +割ge +歌ge +隔ge +盖*ge +哥ge +铬ge +阁ge +戈ge +葛ge +搁ge +鸽ge +胳ge +疙ge +蛤ge +咯*ge +屹*ge +鬲ge +仡ge +哿ge +圪ge +塥ge +嗝ge +纥*ge +搿ge +膈ge +硌ge +镉ge +袼ge +颌*ge +虼ge +舸ge +骼ge +隔壁gebi +戈壁gebi +个别gebie +歌唱gechang +各处gechu +革除gechu +疙瘩geda +各地gedi +格调gediao +隔断geduan +个个gege +各个gege +各国geguo +隔阂gehe +歌喉gehou +各级geji +各界gejie +格局geju +割据geju +隔绝gejue +各类gelei +隔离geli +割裂gelie +格律gelu +革命geming +隔膜gemo +给gei +根gen +跟gen +亘gen +茛gen +哏gen +艮gen +根本genben +根除genchu +根底gendi +更geng +耕geng +颈geng +庚geng +羹geng +埂geng +耿geng +梗geng +哽geng +赓geng +绠geng +鲠geng +耕地gengdi +更迭gengdie +更动gengdong +更多gengduo +更改genggai +梗概genggai +更高genggao +更换genghuan +更加gengjia +更为gengwei +颈项gengxiang +更新gengxin +哽咽gengyan +耕耘gengyun +更正gengzheng +耿直gengzhi +梗直gengzhi +耕种gengzhong +梗阻gengzu +耕作gengzuo +根基genji +根据genju +跟前genqian +跟随gensui +根源genyuan +根治genzhi +跟着genzhuo +根子genzi +跟踪genzong +搁浅geqian +歌曲gequ +个人geren +格式geshi +歌颂gesong +个体geti +格外gewai +各位gewei +歌舞gewu +阁下gexia +各项gexiang +革新gexin +个性gexing +格言geyan +各样geyang +歌咏geyong +搁置gezhi +各种gezhong +各族gezu +国防部gfb +各方面gfm +格格不入ggbr +归根到底ggdd +恭恭敬敬ggjj +滚瓜烂熟ggls +歌功颂德ggsd +共和国ghg +各行各业ghgy +干劲冲天gjct +各级党委gjdw +各级领导gjld +国家利益gjly +国计民生gjms +工具书gjs +各尽所能gjsn +国库券gkq +工矿企业gkqy +孤陋寡闻glgw +规律性glx +国民党gmd +革命化gmh +革命家gmj +国民经济gmjj +购买力gml +光明磊落gmll +光明日报gmrb +顾名思义gmsy +冠冕堂皇gmth +刮目相看gmxk +光明正大gmzd +工农兵gnb +国内外gnw +工农业gny +工gong +公gong +共gong +供gong +功gong +攻gong +红*gong +巩gong +贡gong +汞gong +宫gong +恭gong +龚gong +躬gong +弓gong +拱gong +珙gong +肱gong +蚣gong +觥gong +公安gongan +公报gongbao +工本gongben +公布gongbu +公差gongcha +公拆gongchai +工厂gongchang +功臣gongchen +工程gongcheng +共处gongchu +供词gongci +共存gongcun +公道gongdao +公德gongde +功德gongde +工地gongdi +公敌gongdi +宫殿gongdian +攻读gongdu +公费gongfei +公愤gongfen +工夫gongfu +功夫gongfu +公告gonggao +公共gonggong +巩固gonggu +公关gongguan +公害gonghai +公函gonghan +共和gonghe +工会gonghui +供给gongji +共计gongji +攻击gongji +功绩gongji +公家gongjia +公斤gongjin +恭敬gongjing +工具gongju +公开gongkai +功课gongke +公款gongkuan +功劳gonglao +公理gongli +公里gongli +公历gongli +公路gonglu +功率gonglu +公民gongmin +共鸣gongming +公墓gongmu +功能gongneng +工农gongnong +公判gongpan +公平gongping +公仆gongpu +供求gongqiu +工区gongqu +公然gongran +工人gongren +公认gongren +供认gongren +工伤gongshang +公社gongshe +公审gongshen +工时gongshi +公事gongshi +共事gongshi +公式gongshi +公署gongshu +公司gongsi +公私gongsi +公诉gongsu +宫廷gongting +共同gongtong +恭维gongwei +公文gongwen +公物gongwu +公务gongwu +恭喜gongxi +贡献gongxian +工效gongxiao +功效gongxiao +供销gongxiao +共性gongxing +工序gongxu +共需gongxu +功勋gongxun +供养gongyang +工业gongye +工艺gongyi +供应gongying +公用gongyong +共有gongyou +公元gongyuan +公园gongyuan +公约gongyue +公允gongyun +公债gongzhai +公章gongzhang +共振gongzhen +工整gongzheng +公正gongzheng +公证gongzheng +供职gongzhi +公众gongzhong +工资gongzi +工作gongzuo +够gou +构gou +沟gou +句*gou +狗gou +钩gou +勾gou +购gou +苟gou +垢gou +佝gou +诟gou +岣gou +遘gou +媾gou +缑gou +枸gou +觏gou +彀gou +笱gou +篝gou +鞲gou +构成goucheng +勾搭gouda +勾当goudang +媾和gouhe +沟壑gouhe +构件goujian +勾结goujie +购买goumai +苟且gouqie +构思gousi +沟通goutong +勾通goutong +构陷gouxian +勾销gouxiao +购销gouxiao +勾引gouyin +构造gouzao +购置gouzhi +钩子gouzi +国庆节gqj +共青团gqt +光荣榜grb +根深蒂固gsdg +瓜熟蒂落gsdl +公使馆gsg +各式各样gsgy +甘肃省gss +工商业gsy +个体户gth +改头换面gthm +高谈阔论gtkl +鼓gu +固gu +古gu +骨gu +故gu +顾gu +股gu +谷gu +估gu +雇gu +孤gu +姑gu +贾*gu +辜gu +菇gu +咕gu +箍gu +沽gu +蛊gu +嘏gu +诂gu +菰gu +呱gu +崮gu +汩gu +梏gu +轱gu +牯gu +牿gu +臌gu +毂gu +瞽gu +罟gu +钴gu +锢gu +鸪gu +鹄*gu +痼gu +蛄gu +酤gu +觚gu +鲴gu +鹘gu +挂gua +刮gua +瓜gua +括*gua +剐gua +寡gua +褂gua +卦gua +诖gua +呱gua +栝gua +胍gua +鸹gua +瓜分guafen +瓜葛guage +挂号guahao +怪guai +乖guai +拐guai +乖舛guaichuan +乖戾guaili +乖僻guaipi +乖巧guaiqiao +怪物guaiwu +怪异guaiyi +拐杖guaizhang +挂名guaming +关guan +管guan +观guan +官guan +灌guan +贯guan +惯guan +冠guan +馆guan +罐guan +棺guan +纶*guan +倌guan +莞guan +掼guan +涫guan +盥guan +鹳guan +矜guan +鳏guan +关闭guanbi +观测guance +观察guancha +贯彻guanche +贯穿guanchuan +管道guandao +官邸guandi +观点guandian +官方guanfang +光guang +广guang +逛guang +咣guang +犷guang +桄guang +胱guang +灌溉guangai +光标guangbiao +广播guangbo +广博guangbo +光彩guangcai +广场guangchang +光大guangda +广大guangda +广东guangdong +广度guangdu +广泛guangfan +广告guanggao +光顾guanggu +光滑guanghua +光辉guanghui +光景guangjing +广阔guangkuo +光芒guangmang +广袤guangmao +光明guangming +光盘guangpan +光谱guangpu +光荣guangrong +观光guanguang +广西guangxi +光线guangxian +广义guangyi +光阴guangyin +光涌guangyong +广州guangzhou +关怀guanhuai +挂念guanian +管家guanjia +关键guanjian +管教guanjiao +关节guanjie +冠军guanjun +关卡guanka +观看guankan +关口guankou +管理guanli +贯例guanli +惯例guanli +官吏guanli +关联guanlian +官僚guanliao +观摩guanmo +灌木guanmu +官能guanneng +观念guannian +关切guanqie +观赏guanshang +管事guanshi +管束guanshu +灌输guanshu +关税guanshui +官司guansi +贯通guantong +关头guantou +观望guanwang +关系guanxi +管辖guanxia +官衔guanxian +关心guanxin +惯性guanxing +关押guanya +惯用guanyong +关于guanyu +官员guanyuan +观战guanzhan +关照guanzhao +管制guanzhi +观止guanzhi +观众guanzhong +关注guanzhu +贯注guanzhu +馆子guanzi +挂失guashi +挂帅guashuai +鼓吹guchui +故此guci +古代gudai +孤单gudan +故地gudi +古典gudian +固定guding +鼓动gudong +股东gudong +古董gudong +孤独gudu +咕嘟gudu +孤儿guer +股份gufen +辜负gufu +骨干gugan +雇工gugong +故宫gugong +古怪guguai +蛊惑guhuo +规gui +贵gui +归gui +硅gui +鬼gui +轨gui +龟gui +桂gui +瑰gui +圭gui +闺gui +诡gui +癸gui +柜gui +跪gui +刽gui +傀*gui +炔*gui +匦gui +刿gui +庋gui +宄gui +妫gui +桧gui +炅gui +晷gui +皈gui +簋gui +鲑gui +鳜gui +诡辩guibian +贵宾guibin +归并guibing +规程guicheng +归档guidang +轨道guidao +规定guiding +归队guidui +规范guifan +规格guige +归公guigong +归功guigong +桂冠guiguan +归国guiguo +规划guihua +鬼话guihua +归还guihuan +诡计guiji +轨迹guiji +贵贱guijian +归咎guijiu +规矩guiju +瑰丽guili +鬼脸guilian +龟裂guilie +规律guilu +诡秘guimi +规模guimo +归纳guina +闺女guinu +规劝guiquan +贵人guiren +归属guishu +龟缩guisuo +柜台guitai +闺秀guixiu +归于guiyu +规则guize +规章guizhang +贵重guizhong +贵州guizhou +鬼子guizi +贵族guizu +归罪guizui +顾及guji +估计guji +古迹guji +顾忌guji +估价gujia +古今gujin +古旧gujiu +故旧gujiu +故居guju +顾客guke +孤苦guku +古老gulao +孤立guli +鼓励guli +估量guliang +顾虑gulu +估摸gumo +滚gun +辊gun +棍gun +衮gun +绲gun +磙gun +鲧gun +滚动gundong +姑娘guniang +雇农gunong +滚烫guntang +棍子gunzi +国guo +过guo +果guo +锅guo +郭guo +涡*guo +裹guo +馘guo +埚guo +掴guo +呙guo +帼guo +崞guo +猓guo +椁guo +虢guo +聒guo +蜾guo +蝈guo +过半guoban +国策guoce +国产guochan +过程guocheng +过错guocuo +过度guodu +过渡guodu +果断guoduan +国法guofa +国防guofang +过分guofen +果腹guofu +果敢guogan +国歌guoge +过关guoguan +过后guohou +国会guohui +国际guoji +国籍guoji +国家guojia +国界guojie +国境guojing +国库guoku +过来guolai +过量guoliang +过虑guolu +锅炉guolu +国民guomin +过目guomu +果木guomu +国难guonan +国内guonei +果皮guopi +果品guopin +国旗guoqi +过期guoqi +国情guoqing +国庆guoqing +过去guoqu +果然guoran +过少guoshao +过甚guoshen +过剩guosheng +过时guoshi +国事guoshi +过失guoshi +果实guoshi +过头guotou +国外guowai +国王guowang +过问guowen +国务guowu +过细guoxi +国药guoyao +国营guoying +过硬guoying +过于guoyu +果园guoyuan +果真guozhen +锅子guozi +顾盼gupan +孤僻gupi +股票gupiao +骨气guqi +姑且guqie +顾全guquan +固然guran +古人guren +骨肉gurou +故事gushi +股市gushi +固守gushou +估算gusuan +固体guti +骨头gutou +故土gutu +顾问guwen +古文guwen +谷物guwu +鼓舞guwu +姑息guxi +故乡guxiang +故意guyi +雇佣guyong +固有guyou +雇员guyuan +鼓掌guzhang +故障guzhang +固执guzhi +拐弯抹角gwmj +国务委员gwwy +国务院gwy +改邪归正gxgz +更新换代gxhd +各行其事gxqs +感性认识gxrs +广西壮族gxzz +工业化gyh +工艺流程gylc +工艺美术gyms +工业品gyp +工艺品gyp +贵阳市gys +公有制gyz +各种各样gzgy +工资级别gzjb +各族人民gzrm +工作上gzs +广州市gzs +贵州省gzs +各自为政gzwz +高瞻远瞩gzyz +高瞻远嘱gzyz +工作者gzz +和h +会h +后h +化h +好h +合h +还h +活h +很h +回h +号h +毫h +花h +或h +海h +话h +红h +火h +黄h +害h +哈ha +蛤*ha +虾*ha +铪ha +哈达hada +还hai +海hai +害hai +孩hai +骸hai +氦hai +亥hai +骇hai +嘿*hai +咳*hai +嗨hai +胲hai +醢hai +海岸haian +海拔haiba +海报haibao +害虫haichong +害处haichu +海岛haidao +海港haigang +海关haiguan +还好haihao +海疆haijiang +海军haijun +海浪hailang +海绵haimian +害怕haipa +海上haishang +还是haishi +海外haiwai +海湾haiwan +海峡haixia +海啸haixiao +害羞haixiu +海洋haiyang +还要haiyao +还有haiyou +海域haiyu +海员haiyuan +孩子haizi +含han +焊han +旱han +喊han +汉han +寒han +汗han +函han +韩han +酣han +憨han +邯han +涵han +罕han +翰han +撼han +捍han +憾han +悍han +邗han +菡han +撖han +阚han +瀚han +晗han +焓han +顸han +颔han +蚶han +鼾han +寒潮hanchao +寒带handai +行*hang +航hang +夯hang +杭hang +吭*hang +巷*hang +沆hang +绗hang +珩hang +颃hang +航标hangbiao +航程hangcheng +航船hangchuan +行当hangdang +航道hangdao +航海hanghai +行家hangjia +行距hangju +航空hangkong +行列hanglie +航路hanglu +航模hangmo +函购hangou +行情hangqing +航天hangtian +航线hangxian +航向hangxiang +航行hangxing +航运hangyun +杭州hangzhou +含糊hanhu +含混hanhun +旱季hanji +函件hanjian +罕见hanjian +汉奸hanjian +喊叫hanjiao +焊接hanjie +寒冷hanleng +翰林hanlin +寒流hanliu +函授hanshou +函数hanshu +酣睡hanshui +寒酸hansuan +捍卫hanwei +含蓄hanxu +寒暄hanxuan +涵养hanyang +含义hanyi +涵义hanyi +汉语hanyu +含冤hanyuan +旱灾hanzai +汉字hanzi +汉族hanzu +好hao +号hao +毫hao +耗hao +豪hao +郝hao +浩hao +镐*hao +壕hao +嚎hao +貉*hao +蒿hao +薅hao +嗥hao +嚆hao +濠hao +灏hao +昊hao +皓hao +颢hao +蚝hao +好比haobi +毫不haobu +号称haocheng +好处haochu +浩大haoda +好歹haodai +浩荡haodang +好的haode +浩繁haofan +耗费haofei +好感haogan +好汉haohan +豪华haohua +好坏haohuai +号角haojiao +耗竭haojie +豪杰haojie +浩劫haojie +好看haokan +毫厘haoli +号令haoling +号码haoma +豪迈haomai +毫毛haomao +毫米haomi +浩淼haomiao +好奇haoqi +豪强haoqiang +豪情haoqing +好人haoren +豪绅haoshen +毫升haosheng +好事haoshi +豪爽haoshuang +好似haosi +耗损haosun +号啕haotao +好听haoting +好玩haowan +毫无haowu +好象haoxiang +好些haoxie +好样haoyang +好意haoyi +号召haozhao +好转haozhuan +汇编程序hbcx +货币回笼hbhl +货币流通hblt +河北省hbs +湖北省hbs +汇编语言hbyy +或多或少hdhs +海淀区hdq +和he +合he +河he +何he +核he +赫he +荷he +褐he +喝he +贺he +呵he +禾he +吓*he +盒he +菏he +貉he +阂he +涸he +鹤he +诃he +劾he +壑he +嗬he +阖he +纥he +曷he +盍he +颌he +蚵he +翮he +和蔼heai +哈尔滨heb +合办heban +荷包hebao +河北hebei +何必hebi +合并hebing +哈尔滨市hebs +何不hebu +喝彩hecai +合唱hechang +何尝hechang +合成hecheng +呵斥hechi +何处hechu +河川hechuan +河床hechuang +贺词heci +何等hedeng +贺电hedian +核定heding +核对hedui +合法hefa +何妨hefang +合肥hefei +合格hege +和好hehao +赫赫hehe +合乎hehu +合伙hehuo +黑hei +嘿hei +黑暗heian +黑白heibai +黑帮heibang +嘿嘿heihei +黑人heiren +黑色heise +黑市heishi +黑夜heiye +合计heji +核计heji +和解hejie +合金hejin +何苦heku +何况hekuang +合理heli +合力heli +合流heliu +河流heliu +合谋hemou +和睦hemu +很hen +狠hen +痕hen +恨hen +河南henan +狠毒hendu +很多henduo +河内henei +行*heng +横heng +衡heng +恒heng +哼heng +亨heng +蘅heng +珩*heng +桁heng +横财hengcai +哼哧hengchi +横幅hengfu +横亘henggen +横贯hengguan +横祸henghuo +横加hengjia +衡量hengliang +横蛮hengman +横批hengpi +衡器hengqi +横扫hengsao +横竖hengshu +恒心hengxin +横行hengxing +恒星hengxing +很好henhao +贺年henian +痕迹henji +很快henkuai +狠心henxin +狠抓henzhua +和平heping +和气heqi +河渠hequ +赫然heran +河山heshan +和尚heshang +合适heshi +核实heshi +合算hesuan +核算hesuan +河滩hetan +合同hetong +贺喜hexi +和谐hexie +核心hexin +贺信hexin +和煦hexu +何以heyi +合影heying +合营heying +核准hezhun +合资hezi +赫兹hezi +合作hezuo +合法权益hfqy +合肥市hfs +宏观世界hgsj +化公为私hgws +好高务远hgwy +核工业部hgyb +海关总署hgzs +后顾之忧hgzy +呼和浩特hhht +轰轰烈烈hhll +换句话说hjhs +黄金时代hjsd +环境卫生hjws +后继有人hjyr +海枯石烂hksl +合理化hlh +糊里糊涂hlht +黑龙江hlj +汗流浃背hljb +汗马功劳hmgl +海南岛hnd +河南省hns +湖南省hns +红hong +洪hong +轰hong +烘hong +哄hong +虹hong +鸿hong +宏hong +弘hong +黉hong +訇hong +讧hong +荭hong +蕻hong +薨hong +闳hong +泓hong +红尘hongchen +轰动hongdong +洪都hongdu +洪峰hongfeng +鸿沟honggou +宏观hongguan +红光hongguang +红花honghua +红军hongjun +红利hongli +洪亮hongliang +轰隆honglong +弘论honglun +鸿毛hongmao +轰鸣hongming +哄骗hongpian +红旗hongqi +红人hongren +红色hongse +洪水hongshui +哄抬hongtai +宏图hongtu +宏伟hongwei +红星hongxing +弘扬hongyang +鸿运hongyun +红晕hongyun +轰炸hongzha +后hou +候hou +厚hou +侯hou +喉hou +猴hou +吼hou +堠hou +後hou +逅hou +瘊hou +篌hou +糇hou +鲎hou +骺hou +后备houbei +后辈houbei +后边houbian +厚薄houbo +候补houbu +后尘houchen +后代houdai +厚道houdao +厚度houdu +后盾houdun +后方houfang +后果houguo +后患houhuan +后悔houhui +后记houji +后进houjin +后劲houjin +后来houlai +喉咙houlong +后门houmen +后面houmian +后期houqi +后勤houqin +后人houren +喉舌houshe +厚实houshi +后嗣housi +后台houtai +后天houtian +后退houtui +后续houxu +候选houxuan +后裔houyi +后缀houzhui +和平共处hpgc +黄埔江hpj +后勤部hqb +何去何从hqhc +合情合理hqhl +好容易hry +好事多磨hsdm +胡思乱想hslx +航天工业部htgb +昏头昏脑hthn +欢天喜地htxd +和*hu +护hu +互hu +湖hu +呼hu +户hu +弧hu +乎hu +胡hu +糊hu +虎hu +忽hu +核*hu +瑚hu +戏*hu +壶hu +葫hu +蝴hu +狐hu +唬hu +沪hu +冱hu +唿hu +囫hu +岵hu +猢hu +怙hu +惚hu +浒hu +滹hu +琥hu +槲hu +轷hu +觳hu +烀hu +煳hu +戽hu +扈hu +祜hu +瓠hu +鹄hu +鹕hu +鹱hu +笏hu +醐hu +斛hu +化hua +花hua +话hua +划hua +滑hua +华hua +画hua +哗hua +猾hua +豁*hua +骅hua +桦hua +砉hua +铧hua +画报huabao +华北huabei +哗变huabian +话柄huabing +划拨huabo +划策huace +画册huace +华东huadong +花朵huaduo +花儿huaer +化肥huafei +花费huafei +划分huafen +化工huagong +华贵huagui +化合huahe +花卉huahui +坏huai +怀huai +划*huai +淮huai +槐huai +徊huai +踝huai +怀抱huaibao +淮北huaibei +坏处huaichu +怀古huaigu +淮海huaihai +怀恨huaihen +怀旧huaijiu +淮南huainan +怀念huainian +坏人huairen +坏事huaishi +怀疑huaiyi +怀着huaizhe +滑稽huaji +画家huajia +话剧huaju +哗啦huala +画廊hualang +华丽huali +画面huamian +化名huaming +还*huan +环huan +换huan +欢huan +缓huan +患huan +幻huan +焕huan +桓huan +唤huan +痪huan +豢huan +涣huan +宦huan +郇huan +奂huan +萑huan +擐huan +圜huan +獾huan +洹huan +浣huan +漶huan +寰huan +逭huan +缳huan +锾huan +鲩huan +鬟huan +华南huanan +欢畅huanchang +缓冲huanchong +幻灯huandeng +欢度huandu +焕发huanfa +黄huang +簧huang +荒huang +皇huang +慌huang +蝗huang +磺huang +凰huang +惶huang +煌huang +晃huang +幌huang +恍huang +谎huang +隍huang +徨huang +湟huang +潢huang +遑huang +璜huang +肓huang +癀huang +蟥huang +篁huang +鳇huang +磺胺huangan +皇朝huangchao +荒诞huangdan +晃荡huangdang +皇帝huangdi +荒废huangfei +黄海huanghai +黄河huanghe +恍惚huanghu +谎话huanghua +黄昏huanghun +黄金huangjin +皇历huangli +荒凉huangliang +荒乱huangluan +慌乱huangluan +慌忙huangmang +荒谬huangmiu +恍然huangran +黄色huangse +黄山huangshan +皇上huangshang +荒唐huangtang +环顾huangu +宦官huanguan +谎言huangyan +慌张huangzhang +幌子huangzi +缓和huanhe +欢呼huanhu +环环huanhuan +滑腻huani +花鸟huaniao +还给huanji +缓急huanji +还价huanjia +环节huanjie +环境huanjing +幻境huanjing +幻景huanjing +欢聚huanju +幻觉huanjue +欢乐huanle +缓慢huanman +患难huannan +唤起huanqi +缓期huanqi +欢庆huanqing +环球huanqiu +寰球huanqiu +换取huanqu +环绕huanrao +涣散huansan +欢声huansheng +环视huanshi +欢送huansong +换算huansuan +欢腾huanteng +欢喜huanxi +幻想huanxiang +欢笑huanxiao +欢心huanxin +欢欣huanxin +环行huanxing +缓刑huanxing +唤醒huanxing +幻影huanying +欢迎huanying +寰宇huanyu +还原huanyuan +患者huanzhe +滑坡huapo +花腔huaqiang +华侨huaqiao +划清huaqing +花圈huaquan +划拳huaquan +哗然huaran +华人huaren +花色huase +化身huashen +化石huashi +划算huasuan +话题huati +滑头huatou +花纹huawen +华夏huaxia +化纤huaxian +画像huaxiang +花絮huaxu +化学huaxue +画押huaya +化验huayan +花样huayang +华裔huayi +话音huayin +话语huayu +花园huayuan +画展huazhan +花招huazhao +华中huazhong +化装huazhuang +化妆huazhuang +湖北hubei +胡扯huche +弧度hudu +忽而huer +呼喊huhan +呼号huhao +呼唤huhuan +互惠huhui +会hui +回hui +灰hui +挥hui +辉hui +汇hui +毁hui +慧hui +恢hui +绘hui +惠hui +徽hui +溃*hui +堕*hui +徊*hui +蛔hui +悔hui +卉hui +晦hui +贿hui +秽hui +烩hui +讳hui +诲hui +诙hui +茴hui +荟hui +蕙hui +咴hui +哕hui +喙hui +隳hui +洄hui +浍hui +彗hui +缋hui +珲hui +桧*hui +晖hui +恚hui +虺hui +蟪hui +麾hui +灰暗huian +回报huibao +汇报huibao +回避huibi +汇编huibian +会场huichang +回潮huichao +灰尘huichen +回春huichun +荟萃huicui +回答huida +回荡huidang +回电huidian +汇兑huidui +挥发huifa +汇费huifei +会风huifeng +回复huifu +恢复huifu +悔改huigai +回顾huigu +惠顾huigu +悔过huiguo +会合huihe +回合huihe +汇合huihe +悔恨huihen +恢弘huihong +会话huihua +回话huihua +绘画huihua +毁坏huihuai +辉煌huihuang +挥霍huihuo +会集huiji +回击huiji +汇集huiji +回家huijia +会见huijian +会聚huiju +汇聚huiju +回扣huikou +汇款huikuan +回来huilai +回笼huilong +汇率huilu +贿赂huilu +会面huimian +毁灭huimie +回民huimin +汇票huipiao +回去huiqu +挥洒huisa +灰色huise +晦涩huise +回收huishou +回首huishou +会谈huitan +会堂huitang +会同huitong +回头huitou +回味huiwei +会晤huiwu +挥舞huiwu +悔悟huiwu +麾下huixia +回想huixiang +回响huixiang +诙谐huixie +灰心huixin +彗星huixing +会演huiyan +汇演huiyan +会议huiyi +回忆huiyi +回音huiyin +辉映huiying +会员huiyuan +会战huizhan +徽章huizhang +会诊huizhen +绘制huizhi +回转huizhuan +汇总huizong +回族huizu +户籍huji +呼叫hujiao +户口hukou +虎口hukou +护理huli +互利huli +护林hulin +呼噜hulu +胡乱huluan +忽略hulue +互勉humian +混hun +浑hun +荤hun +昏hun +婚hun +魂hun +诨hun +馄hun +阍hun +溷hun +湖南hunan +胡闹hunao +昏沉hunchen +混合hunhe +浑厚hunhou +昏黄hunhuang +混迹hunji +婚礼hunli +混乱hunluan +糊弄hunong +婚配hunpei +混入hunru +浑身hunshen +混同huntong +混淆hunxiao +婚姻hunyin +昏庸hunyong +混杂hunza +混帐hunzhang +混浊hunzhuo +浑浊hunzhuo +和*huo +活huo +或huo +火huo +货huo +获huo +伙huo +霍huo +豁huo +惑huo +祸huo +劐huo +藿huo +攉huo +嚯huo +夥huo +钬huo +锪huo +镬huo +耠huo +蠖huo +火把huoba +伙伴huoban +火暴huobao +货币huobi +火柴huochai +火车huoche +豁达huoda +获得huode +霍地huodi +活动huodong +伙房huofang +祸根huogen +祸害huohai +火候huohou +火化huohua +火花huohua +祸患huohuan +活活huohuo +伙计huoji +火箭huojian +火警huojing +火炬huoju +火坑huokeng +活力huoli +霍乱huoluan +活泼huopo +获取huoqu +豁然huoran +货色huose +火山huoshan +获胜huosheng +或是huoshi +伙食huoshi +祸首huoshou +伙同huotong +货物huowu +获悉huoxi +火线huoxian +活现huoxian +或许huoxu +火药huoyao +活页huoye +活跃huoyue +货运huoyun +火灾huozai +火葬huozang +或则huoze +或者huozhe +获准huozhun +湖泊hupo +忽然huran +呼声husheng +护士hushi +忽视hushi +湖水hushui +胡说hushuo +护送husong +胡同hutong +互通hutong +户头hutou +糊涂hutu +护卫huwei +呼吸huxi +互相huxiang +呼啸huxiao +虎穴huxue +护养huyang +呼应huying +呼吁huyu +护照huzhao +互助huzhu +毫无疑问hwyw +互相爱护hxah +横行霸道hxbd +互相帮助hxbz +欢欣鼓舞hxgw +候选人hxr +合作化hzh +杭州市hzs +化整为零hzwl +级j +就j +进j +加j +经j +家j +结j +阶j +间j +件j +及j +解j +较j +机j +军j +接j +教j +极j +九j +见j +基本国策jbgc +基本上jbs +据不完全统计jbwj +饥不择食jbzs +坚持不懈jcbx +集成电路jcdl +基础上jcs +绝大部分jdbf +坚定不移jdby +绝大多数jdds +鉴定会jdh +绝对化jdh +经得起jdq +见多识广jdsg +精打细算jdxs +接二连三jels +解放后jfh +解放军jfj +解放军报jfjb +解放前jfq +仅供参考jgck +机构改革jggg +坚固耐用jgny +襟怀坦白jhtb +计划性jhx +级ji +及ji +机ji +极ji +几ji +积ji +给ji +基ji +其*ji +记ji +己ji +期*ji +系*ji +革*ji +计ji +集ji +即ji +际ji +季ji +激ji +济ji +技ji +击ji +继ji +急ji +剂ji +既ji +纪ji +寄ji +挤ji +鸡ji +迹ji +绩ji +齐*ji +奇*ji +吉ji +脊ji +辑ji +籍ji +疾ji +肌ji +棘ji +畸ji +圾ji +稽ji +箕ji +饥ji +讥ji +姬ji +缉ji +汲ji +嫉ji +蓟ji +冀ji +伎ji +祭ji +悸ji +寂ji +忌ji +妓ji +藉ji +丌ji +亟ji +乩ji +剞ji +佶ji +偈ji +诘ji +墼ji +芨ji +芰ji +荠ji +蒺ji +蕺ji +掎ji +叽ji +咭ji +哜ji +唧ji +岌ji +嵴ji +洎ji +屐ji +骥ji +畿ji +玑ji +楫ji +殛ji +戟ji +戢ji +赍ji +觊ji +犄ji +齑ji +矶ji +羁ji +嵇ji +稷ji +瘠ji +虮ji +笈ji +笄ji +暨ji +跻ji +跽ji +霁ji +鲚ji +鲫ji +髻ji +麂ji +加jia +家jia +架jia +价jia +甲jia +夹jia +假jia +钾jia +贾jia +稼jia +驾jia +嘉jia +枷jia +佳jia +荚jia +颊jia +嫁jia +茄*jia +挟*jia +嘏*jia +伽jia +郏jia +葭jia +岬jia +浃jia +迦jia +珈jia +戛jia +胛jia +恝jia +铗jia +镓jia +痂jia +瘕jia +袷jia +蛱jia +笳jia +袈jia +跏jia +加班jiaban +甲板jiaban +加倍jiabei +甲虫jiachong +家畜jiachu +家当jiadang +家底jiadi +假定jiading +加法jiafa +家访jiafang +价格jiage +加工jiagong +佳话jiahua +家伙jiahuo +加急jiaji +嘉奖jiajiang +家教jiajiao +嫁接jiajie +佳节jiajie +假借jiajie +加紧jiajin +家境jiajing +家具jiaju +加剧jiaju +加快jiakuai +加仑jialun +加码jiama +假冒jiamao +家门jiamen +加密jiami +加冕jiamian +价目jiamu +间jian +件jian +见jian +建jian +坚jian +减jian +检jian +践jian +尖jian +简jian +碱jian +剪jian +艰jian +渐jian +肩jian +键jian +健jian +柬jian +鉴jian +剑jian +歼jian +监jian +兼jian +浅*jian +奸jian +箭jian +茧jian +舰jian +俭jian +笺jian +煎jian +缄jian +硷jian +拣jian +捡jian +荐jian +槛jian +贱jian +饯jian +溅jian +涧jian +僭jian +谏jian +谫jian +菅jian +蒹jian +搛jian +囝*jian +湔jian +蹇jian +謇jian +缣jian +枧jian +楗jian +戋jian +戬jian +牮jian +犍jian +毽jian +腱jian +睑jian +锏jian +鹣jian +裥jian +笕jian +翦jian +趼jian +踺jian +鲣jian +鞯jian +吉安jian +煎熬jianao +简报jianbao +渐变jianbian +简便jianbian +简编jianbian +鉴别jianbie +兼并jianbing +尖兵jianbing +剪裁jiancai +剪彩jiancai +检测jiance +检查jiancha +检察jiancha +监察jiancha +减产jianchan +建成jiancheng +简称jiancheng +坚持jianchi +简单jiandan +建党jiandang +减低jiandi +检点jiandian +间谍jiandie +坚定jianding +鉴定jianding +监督jiandu +间断jianduan +尖端jianduan +简短jianduan +舰队jiandui +健儿jianer +减法jianfa +肩负jianfu +将jiang +降jiang +讲jiang +强*jiang +江jiang +浆jiang +蒋jiang +奖jiang +疆jiang +僵jiang +姜jiang +桨jiang +匠jiang +酱jiang +茳jiang +洚jiang +绛jiang +缰jiang +犟jiang +礓jiang +耩jiang +糨jiang +豇jiang +奖杯jiangbei +疆场jiangchang +奖惩jiangcheng +僵持jiangchi +降低jiangdi +间隔jiange +讲稿jianggao +江湖jianghu +僵化jianghua +讲话jianghua +降级jiangji +降价jiangjia +讲解jiangjie +疆界jiangjie +将近jiangjin +奖金jiangjin +讲究jiangjiu +僵局jiangju +将军jiangjun +讲课jiangke +将来jianglai +讲理jiangli +奖励jiangli +降临jianglin +将领jiangling +降落jiangluo +江南jiangnan +奖品jiangpin +讲评jiangping +奖券jiangquan +江山jiangshan +讲师jiangshi +僵尸jiangshi +讲授jiangshou +讲述jiangshu +降水jiangshui +江苏jiangsu +讲台jiangtai +讲坛jiangtan +疆土jiangtu +坚固jiangu +兼顾jiangu +监管jianguan +建国jianguo +降温jiangwen +江西jiangxi +讲习jiangxi +匠心jiangxin +讲学jiangxue +讲演jiangyan +将要jiangyao +讲义jiangyi +僵硬jiangying +奖章jiangzhang +讲座jiangzuo +监护jianhu +简化jianhua +间或jianhuo +奸计jianji +歼击jianji +剪辑jianji +减价jianjia +渐渐jianjian +健将jianjiang +建交jianjiao +间接jianjie +见解jianjie +简介jianjie +简洁jianjie +简捷jianjie +渐进jianjin +监禁jianjin +检举jianju +艰巨jianju +坚决jianjue +健康jiankang +尖刻jianke +坚苦jianku +艰苦jianku +监牢jianlao +建立jianli +尖利jianli +简历jianli +简练jianlian +简陋jianlou +简略jianlue +健美jianmei +减免jianmian +歼灭jianmie +简明jianming +缄默jianmo +艰难jiannan +键盘jianpan +简拼jianpin +简朴jianpu +俭朴jianpu +坚强jianqiang +减轻jianqing +健全jianquan +兼任jianren +坚韧jianren +兼容jianrong +尖锐jianrui +减弱jianruo +艰涩jianse +鉴赏jianshang +减少jianshao +建设jianshe +艰深jianshen +见识jianshi +坚实jianshi +监视jianshi +建树jianshu +减速jiansu +检索jiansuo +践踏jianta +健谈jiantan +检讨jiantao +简体jianti +舰艇jianting +减退jiantui +健忘jianwang +间文jianwen +见闻jianwen +间隙jianxi +奸细jianxi +艰险jianxian +见效jianxiao +间歇jianxie +简写jianxie +坚信jianxin +艰辛jianxin +减刑jianxing +检修jianxiu +简讯jianxun +检验jianyan +简要jianyao +建议jianyi +坚毅jianyi +简易jianyi +奸淫jianyin +坚硬jianying +剪影jianying +鉴于jianyu +监狱jianyu +减员jianyuan +检阅jianyue +建造jianzao +简则jianze +坚贞jianzhen +监制jianzhi +简直jianzhi +兼职jianzhi +建筑jianzhu +简装jianzhuang +健壮jianzhuang +较jiao +教jiao +交jiao +角jiao +叫jiao +脚jiao +胶jiao +浇jiao +焦jiao +觉*jiao +校*jiao +搅jiao +酵jiao +郊jiao +铰jiao +窖jiao +椒jiao +礁jiao +骄jiao +娇jiao +嚼jiao +矫jiao +侥jiao +狡jiao +饺jiao +缴jiao +绞jiao +剿jiao +轿jiao +佼jiao +僬jiao +艽jiao +茭jiao +挢jiao +噍jiao +峤jiao +徼jiao +湫*jiao +姣jiao +敫jiao +皎jiao +鹪jiao +蛟jiao +醮jiao +跤jiao +鲛jiao +骄傲jiaoao +搅拌jiaoban +狡辩jiaobian +教材jiaocai +交叉jiaocha +教程jiaocheng +交错jiaocuo +较大jiaoda +交代jiaodai +交淡jiaodan +教导jiaodao +交点jiaodian +焦点jiaodian +校订jiaoding +角度jiaodu +校对jiaodui +较多jiaoduo +焦耳jiaoer +交锋jiaofeng +交付jiaofu +浇灌jiaoguan +娇贵jiaogui +叫喊jiaohan +较好jiaohao +叫好jiaohao +狡猾jiaohua +交换jiaohuan +叫唤jiaohuan +教诲jiaohui +缴获jiaohuo +交际jiaoji +矫健jiaojian +交接jiaojie +交界jiaojie +叫苦jiaoku +较快jiaokuai +教练jiaolian +较量jiaoliang +交流jiaoliu +搅乱jiaoluan +角落jiaoluo +叫骂jiaoma +剿灭jiaomie +酵母jiaomu +交纳jiaona +缴纳jiaona +娇嫩jiaonen +交配jiaopei +骄气jiaoqi +交情jiaoqing +郊区jiaoqu +叫嚷jiaorang +角色jiaose +交涉jiaoshe +教师jiaoshi +教授jiaoshou +教唆jiaosuo +脚踏jiaota +交谈jiaotan +教堂jiaotang +交替jiaoti +教条jiaotiao +交通jiaotong +郊外jiaowai +交往jiaowang +较为jiaowei +狡黠jiaoxia +叫嚣jiaoxiao +侥幸jiaoxing +绞刑jiaoxing +教学jiaoxue +教训jiaoxun +教养jiaoyang +骄阳jiaoyang +教益jiaoyi +交易jiaoyi +交谊jiaoyi +教育jiaoyu +教员jiaoyuan +狡诈jiaozha +校正jiaozheng +脚注jiaozhu +角逐jiaozhu +浇铸jiaozhu +校准jiaozhun +焦灼jiaozhuo +娇纵jiaozong +叫做jiaozuo +家谱jiapu +假期jiaqi +价钱jiaqian +加强jiaqiang +假日jiari +加入jiaru +假如jiaru +假若jiaruo +加上jiashang +假设jiashe +加深jiashen +假使jiashi +架势jiashi +驾驶jiashi +家属jiashu +假说jiashuo +加速jiasu +枷锁jiasuo +家庭jiating +家乡jiaxiang +假想jiaxiang +家业jiaye +加以jiayi +佳音jiayin +家用jiayong +加油jiayou +家园jiayuan +夹杂jiaza +加载jiazai +家长jiazhang +价值jiazhi +加重jiazhong +假装jiazhuang +嫁妆jiazhuang +架子jiazi +家族jiazu +击败jibai +羁绊jiban +几倍jibei +基本jiben +击毙jibi +级别jibie +疾病jibing +计策jice +基层jiceng +稽查jicha +机场jichang +集成jicheng +继承jicheng +计酬jichou +基础jichu +机床jichuang +几次jici +急促jicu +积存jicun +寄存jicun +极大jida +亟待jidai +激荡jidang +记得jide +基地jidi +机电jidian +极点jidian +基调jidiao +机动jidong +激动jidong +极度jidu +几度jidu +即度jidu +季度jidu +基督jidu +嫉妒jidu +忌妒jidu +极端jiduan +结jie +阶jie +解jie +接jie +节jie +家*jie +界jie +截jie +介jie +借jie +价*jie +届jie +街jie +揭jie +洁jie +杰jie +竭jie +皆jie +秸jie +劫jie +桔jie +捷jie +睫jie +姐jie +戒jie +藉jie +芥jie +疥jie +诫jie +楷*jie +偈*jie +讦jie +诘*jie +拮jie +喈jie +嗟jie +婕jie +孑jie +桀jie +碣jie +疖jie +颉jie +蚧jie +羯jie +鲒jie +骱jie +饥饿jie +结案jiean +洁白jiebai +接班jieban +捷报jiebao +戒备jiebei +结彩jiecai +节操jiecao +阶层jieceng +劫持jiechi +杰出jiechu +解除jiechu +接触jiechu +戒除jiechu +揭穿jiechuan +结存jiecun +解答jieda +接待jiedai +借贷jiedai +街道jiedao +解冻jiedong +阶段jieduan +截断jieduan +揭发jiefa +借方jiefang +解放jiefang +街坊jiefang +结构jiegou +解雇jiegu +借故jiegu +结果jieguo +结合jiehe +结核jiehe +结婚jiehun +阶级jieji +接见jiejian +节俭jiejian +借鉴jiejian +结交jiejiao +姐姐jiejie +接近jiejin +竭尽jiejin +结晶jiejing +捷径jiejing +洁净jiejing +解救jiejiu +结局jieju +解决jiejue +孑孓jiejue +解开jiekai +揭开jiekai +解渴jieke +接口jiekou +借口jiekou +借款jiekuan +竭力jieli +接连jielian +揭露jielu +戒律jielu +结论jielun +解闷jiemen +结盟jiemeng +界面jiemian +节目jiemu +揭幕jiemu +接纳jiena +解聘jiepin +解剖jiepou +节气jieqi +接洽jieqia +截取jiequ +既而jier +节日jieri +介入jieru +解散jiesan +介绍jieshao +节省jiesheng +届时jieshi +结实jieshi +解释jieshi +揭示jieshi +解手jieshou +接受jieshou +接收jieshou +结束jieshu +解说jieshuo +结算jiesuan +解体jieti +阶梯jieti +接替jieti +接头jietou +街头jietou +解脱jietuo +结尾jiewei +解围jiewei +接吻jiewen +解析jiexi +界线jiexian +界限jiexian +揭晓jiexiao +戒严jieyan +结业jieye +介意jieyi +接应jieying +结余jieyu +节约jieyue +结帐jiezhang +接着jiezhao +节制jiezhi +介质jiezhi +戒指jiezhi +借支jiezhi +截止jiezhi +借助jiezhu +节奏jiezou +杰作jiezuo +激发jifa +技法jifa +讥讽jifeng +几个jige +及格jige +技工jigong +记功jigong +机构jigou +叽咕jigu +机关jiguan +籍贯jiguan +极光jiguang +激光jiguang +记过jiguo +极好jihao +记号jihao +集合jihe +几何jihe +稽核jihe +几乎jihu +激化jihua +计划jihua +饥荒jihuang +机会jihui +集会jihui +击毁jihui +忌讳jihui +积极jiji +机件jijian +计件jijian +急件jijian +击剑jijian +即将jijiang +计较jijiao +季节jijie +急进jijin +基金jijin +机警jijing +即景jijing +寂静jijing +急救jijiu +积聚jiju +急剧jiju +急遽jiju +寄居jiju +季刊jikan +即刻jike +疾苦jiku +击溃jikui +积累jilei +极力jili +吉利jili +激励jili +伎俩jilia +计量jiliang +寂寥jiliao +激烈jilie +吉林jilin +机灵jiling +激流jiliu +记录jilu +纪律jilu +纪录jilu +辑录jilu +击落jiluo +急忙jimang +机密jimi +寂寞jimo +计谋jimou +进jin +金jin +近jin +紧jin +斤jin +今jin +尽jin +仅jin +劲jin +浸jin +禁jin +津jin +筋jin +锦jin +晋jin +巾jin +襟jin +谨jin +靳jin +烬jin +卺jin +荩jin +堇jin +噤jin +馑jin +廑jin +妗jin +缙jin +瑾jin +槿jin +赆jin +觐jin +衿jin +缉拿jina +济南jinan +禁闭jinbi +锦标jinbiao +进步jinbu +浸沉jinchen +进程jincheng +进出jinchu +紧凑jincou +近代jindai +劲敌jindi +进度jindu +金额jine +机能jineng +技能jineng +进而jiner +进犯jinfan +经jing +精jing +京jing +径jing +井jing +静jing +竟jing +晶jing +净jing +境jing +镜jing +景jing +警jing +劲*jing +茎jing +敬jing +惊jing +睛jing +竞jing +荆jing +兢jing +鲸jing +粳jing +痉jing +靖jing +刭jing +儆jing +阱jing +菁jing +獍jing +憬jing +泾jing +迳jing +弪jing +婧jing +肼jing +胫jing +腈jing +旌jing +靓*jing +敬爱jingai +警报jingbao +警备jingbei +精兵jingbing +精采jingcai +精彩jingcai +警察jingcha +经常jingchang +精粹jingcui +静电jingdian +经典jingdian +惊动jingdong +精度jingdu +经费jingfei +精干jinggan +竟敢jinggan +警告jinggao +经过jingguo +净化jinghua +精华jinghua +经济jingji +竞技jingji +荆棘jingji +精简jingjian +境界jingjie +警戒jingjie +经久jingjiu +惊恐jingkong +经理jingli +经历jingli +精力jingli +敬礼jingli +精练jinglian +精良jingliang +经络jingluo +精美jingmei +精密jingmi +精明jingming +进攻jingong +敬佩jingpei +精辟jingpi +景气jingqi +惊奇jingqi +精巧jingqiao +精确jingque +竟然jingran +竞赛jingsai +景色jingse +经商jingshang +精神jingshen +经手jingshou +经受jingshou +精髓jingsui +静态jingtai +惊叹jingtan +晶体jingti +警惕jingti +精通jingtong +镜头jingtou +筋骨jingu +禁锢jingu +尽管jinguan +巾帼jinguo +经委jingwei +警卫jingwei +敬畏jingwei +景物jingwu +精细jingxi +京戏jingxi +惊险jingxian +景象jingxiang +经销jingxiao +经心jingxin +精心jingxin +惊心jingxin +惊醒jingxing +竞选jingxuan +惊讶jingya +经验jingyan +敬仰jingyang +经营jingying +晶莹jingying +经由jingyou +境遇jingyu +精湛jingzhan +竞争jingzheng +精制jingzhi +径直jingzhi +精致jingzhi +静止jingzhi +净值jingzhi +竟址jingzhi +净重jingzhong +镜子jingzi +静坐jingzuo +近海jinhai +今后jinhou +近乎jinhu +进化jinhua +几年jinian +记念jinian +纪念jinian +晋级jinji +紧急jinji +近郊jinjiao +紧紧jinjin +仅仅jinjin +进军jinjun +进口jinkou +尽快jinkuai +近况jinkuang +进来jinlai +近来jinlai +尽力jinli +尽量jinliang +斤两jinliang +禁令jinling +劲旅jinlu +紧密jinmi +近年jinnian +今年jinnian +金牌jinpai +紧迫jinpo +近期jinqi +近前jinqian +金钱jinqian +尽情jinqing +进去jinqu +进取jinqu +禁区jinqu +近日jinri +今日jinri +金融jinrong +进入jinru +浸入jinru +谨慎jinshen +晋升jinsheng +今是jinshi +尽是jinshi +近视jinshi +金属jinshu +近似jinsi +紧缩jinsuo +今天jintian +津贴jintie +尽头jintou +劲头jintou +浸透jintou +进退jintui +今晚jinwan +今昔jinxi +尽心jinxin +进行jinxing +进修jinxiu +锦秀jinxiu +谨严jinyan +紧要jinyao +进展jinzhan +紧张jinzhang +今朝jinzhao +紧着jinzhe +禁止jinzhi +尽职jinzhi +进驻jinzhu +金子jinzi +炯jiong +窘jiong +迥jiong +炅*jiong +扃jiong +窘迫jiongpo +迥然jiongran +击破jipo +急迫jipo +及其jiqi +极其jiqi +激起jiqi +机器jiqi +机枪jiqiang +技巧jiqiao +急切jiqie +激情jiqing +汲取jiqu +集权jiquan +既然jiran +己任jiren +继任jiren +即日jiri +吉日jiri +肌肉jirou +极少jishao +寄生jisheng +即是jishi +及时jishi +几时jishi +计时jishi +即时jishi +即使jishi +记事jishi +基石jishi +集市jishi +级数jishu +基数jishu +计数jishu +记述jishu +技术jishu +祭祀jisi +激素jisu +急速jisu +计算jisuan +机体jiti +集体jiti +肌体jiti +几天jitian +集团jituan +寄托jituo +就jiu +九jiu +旧jiu +究jiu +久jiu +救jiu +酒jiu +纠jiu +揪jiu +玖jiu +韭jiu +灸jiu +厩jiu +臼jiu +舅jiu +咎jiu +疚jiu +僦jiu +啾jiu +阄jiu +柩jiu +桕jiu +鸠jiu +鹫jiu +赳jiu +鬏jiu +就餐jiucan +纠察jiucha +纠缠jiuchan +就此jiuci +就地jiudi +就范jiufan +纠纷jiufen +纠葛jiuge +救国jiuguo +救护jiuhu +救火jiuhuo +纠集jiuji +鸠集jiuji +救济jiuji +救急jiuji +九江jiujiang +九届jiujie +就近jiujin +酒精jiujing +究竟jiujing +救命jiuming +救生jiusheng +就是jiushi +就事jiushi +救亡jiuwang +久违jiuwei +酒窝jiuwo +酒席jiuxi +救险jiuxian +揪心jiuxin +救星jiuxing +就绪jiuxu +就学jiuxue +久仰jiuyang +就要jiuyao +就业jiuye +久远jiuyuan +九月jiuyue +救灾jiuzai +纠正jiuzheng +就职jiuzhi +救治jiuzhi +九洲jiuzhou +救助jiuzhu +极为jiwei +纪委jiwei +极限jixian +迹象jixiang +吉祥jixiang +讥笑jixiao +机械jixie +记性jixing +急性jixing +畸形jixing +即兴jixing +吉凶jixiong +几许jixu +积蓄jixu +继续jixu +记叙jixu +急需jixu +集训jixun +积压jiya +羁押jiya +给养jiyang +机要jiyao +纪要jiyao +给以jiyi +记忆jiyi +技艺jiyi +基因jiyin +急用jiyong +基于jiyu +急于jiyu +机遇jiyu +给予jiyu +寄予jiyu +觊觎jiyu +纪元jiyuan +集约jiyue +记载jizai +及早jizao +急躁jizao +激增jizeng +记帐jizhang +记者jizhe +集镇jizhen +机制jizhi +及至jizhi +机智jizhi +集中jizhong +击中jizhong +记住jizhu +基准jizhun +集资jizi +经济核算jjhs +聚精会神jjhs +将计就计jjjj +戒骄戒躁jjjz +近几年来jjnl +竭尽全力jjql +节假日jjr +积极性jjx +经济效益jjxy +兢兢业业jjyy +精简整编jjzb +叽叽喳喳jjzz +艰苦奋斗jkfd +尽可能jkn +教科书jks +俱乐部jlb +交流电jld +吉林省jls +价廉物美jlwm +纪律性jlx +纪念碑jnb +几年来jnl +近年来jnl +纪念品jnp +济南市jns +吉普车jpc +坚强不屈jqbq +奖勤罚懒jqfl +机器人jqr +急起直追jqzz +截然不同jrbt +兼容性jrx +积少成多jscd +金山公司jsgs +集思广益jsgy +精神焕发jshf +计算机jsj +尽善尽美jsjm +集市贸易jsmy +介绍人jsr +就是说jss +计算所jss +江苏省jss +举世闻名jswm +介绍信jsx +技术员jsy +计算中心jszx +交通部jtb +家庭出身jtcs +惊天动地jtdd +具体地说jtds +晶体管jtg +交通工具jtgj +脚踏实地jtsd +具体说来jtsl +具ju +据ju +局ju +举ju +车*ju +句ju +聚ju +距ju +巨ju +居ju +锯ju +剧ju +矩ju +拒ju +柜*ju +桔*ju +鞠ju +拘ju +狙ju +疽ju +驹ju +菊ju +咀ju +沮ju +踞ju +俱ju +惧ju +炬ju +倨ju +讵ju +苣ju +苴ju +莒ju +掬ju +遽ju +屦ju +琚ju +枸*ju +椐ju +榘ju +榉ju +橘ju +犋ju +飓ju +钜ju +锔ju +窭ju +裾ju +趄ju +醵ju +踽ju +龃ju +雎ju +瞿*ju +鞫ju +卷juan +捐juan +鹃juan +娟juan +倦juan +眷juan +绢juan +俊*juan +鄄juan +狷juan +涓juan +桊juan +蠲juan +锩juan +镌juan +隽juan +卷进juanjin +捐款juankuan +眷恋juanlian +眷念juannian +捐躯juanqu +卷入juanru +眷属juanshu +捐献juanxian +卷烟juanyan +卷帙juanzhi +捐助juanzhu +卷宗juanzong +举办juban +具备jubei +剧本juben +巨变jubian +局部jubu +拘捕jubu +剧场juchang +据此juci +巨大juda +举动judong +居多juduo +决jue +觉jue +绝jue +角*jue +脚*jue +掘jue +嚼*jue +撅jue +攫jue +抉jue +倔jue +爵jue +诀jue +厥jue +劂jue +谲jue +矍jue +蕨jue +嗟*jue +噘jue +噱jue +崛jue +獗jue +孓jue +珏jue +桷jue +橛jue +爝jue +镢jue +蹶jue +觖jue +巨额jue +诀别juebie +决不juebu +绝不juebu +决策juece +觉察juecha +觉得juede +决定jueding +决断jueduan +绝对juedui +绝迹jueji +倔强juejiang +绝交juejiao +绝径juejing +绝境juejing +绝句jueju +决裂juelie +绝路juelu +绝密juemi +绝妙juemiao +崛起jueqi +诀窍jueqiao +决赛juesai +绝食jueshi +决死juesi +决算juesuan +绝望juewang +爵位juewei +觉悟juewu +决心juexin +觉醒juexing +决议jueyi +绝缘jueyuan +抉择jueze +决战juezhan +绝招juezhao +绝症juezheng +巨幅jufu +居功jugong +鞠躬jugong +句号juhao +聚合juhe +聚会juhui +聚集juji +巨匠jujiang +拘谨jujin +拒绝jujue +咀嚼jujue +距离juli +举例juli +剧烈julie +拘留juliu +局面jumian +居民jumin +剧目jumu +军jun +均jun +菌jun +君jun +龟*jun +钧jun +峻jun +俊jun +竣jun +浚jun +郡jun +骏jun +捃jun +皲jun +筠jun +麇jun +军操juncao +君臣junchen +均等jundeng +军队jundui +军法junfa +军阀junfa +军服junfu +军港jungang +军工jungong +竣工jungong +均衡junheng +军火junhuo +拘泥juni +军机junji +军纪junji +军舰junjian +俊杰junjie +军垦junken +军粮junliang +军令junling +骏马junma +军民junmin +军旗junqi +峻峭junqiao +俊俏junqiao +军区junqu +军权junquan +军人junren +军事junshi +军师junshi +军属junshu +军团juntuan +军委junwei +军衔junxian +军校junxiao +军械junxie +军心junxin +俊秀junxiu +军需junxu +军训junxun +军医junyi +军营junying +军用junyong +军邮junyou +均匀junyun +军长junzhang +军政junzheng +君主junzhu +军装junzhuang +君子junzi +俱全juquan +居然juran +遽然juran +沮丧jusang +局势jushi +举手jushou +拘束jushu +据说jushuo +具体juti +剧团jutuan +据悉juxi +局限juxian +居心juxin +举行juxing +矩形juxing +巨型juxing +具有juyou +据有juyou +剧院juyuan +局长juzhang +剧照juzhao +举止juzhi +居中juzhong +剧终juzhong +巨著juzhu +居住juzhu +句子juzi +节外生枝jwsz +惊心动魄jxdp +继续革命jxgm +机械化jxh +江西省jxs +谨小慎微jxsw +局限性jxx +教育部jyb +进一步jyb +家用电器jydq +教育方针jyfz +家喻户晓jyhx +加以解决jyjj +记忆力jyl +精益求精jyqj +教研室jys +见义勇为jyyw +旧中国jzg +建筑物jzw +可k +开k +看k +克k +孔k +科k +口k +空k +苦k +快k +考k +刻k +靠k +况k +块k +困k +宽k +矿k +抗k +卡k +卡ka +喀ka +咖ka +咯ka +佧ka +咔ka +胩ka +喀嚓kacha +卡车kache +咖啡kafei +开kai +凯kai +揩kai +楷kai +慨kai +剀kai +垲kai +蒈kai +忾kai +恺kai +铠kai +锎kai +锴kai +开办kaiban +开遍kaibian +开采kaicai +开场kaichang +开车kaiche +开除kaichu +开创kaichuang +开导kaidao +开刀kaidao +开动kaidong +开端kaiduan +开发kaifa +开放kaifang +开封kaifeng +开赴kaifu +凯歌kaige +开关kaiguan +开航kaihang +开户kaihu +开花kaihua +开怀kaihuai +开荒kaihuang +开会kaihui +开掘kaijue +开垦kaiken +开口kaikou +开矿kaikuang +开阔kaikuo +开朗kailang +开郎kailang +开路kailu +开明kaiming +楷模kaimo +开幕kaimu +开炮kaipao +开辟kaipi +开启kaiqi +开枪kaiqiang +开窍kaiqiao +开设kaishe +开始kaishi +开庭kaiting +开头kaitou +开脱kaituo +开拓kaituo +开外kaiwai +开销kaixiao +开心kaixin +凯旋kaixuan +开学kaixue +开颜kaiyan +开业kaiye +开战kaizhan +开展kaizhan +开张kaizhang +开支kaizhi +看kan +刊kan +坎kan +槛*kan +堪kan +勘kan +砍kan +嵌*kan +侃kan +莰kan +阚*kan +戡kan +龛kan +瞰kan +勘测kance +勘察kancha +看出kanchu +看待kandai +看到kandao +刊登kandeng +看法kanfa +砍伐kanfa +抗kang +康kang +炕kang +慷kang +糠kang +扛kang +亢kang +伉kang +闶kang +钪kang +亢奋kangfen +康复kangfu +抗衡kangheng +抗击kangji +亢进kangjin +抗拒kangju +伉俪kangli +抗日kangri +看管kanguan +抗议kangyi +看见kanjian +坎坷kanke +看来kanlai +看齐kanqi +刊头kantou +看望kanwang +刊物kanwu +勘误kanwu +看样kanyang +刊载kanzai +考kao +靠kao +拷kao +烤kao +尻kao +栲kao +犒kao +铐kao +拷贝kaobei +靠边kaobian +考查kaocha +考察kaocha +考核kaohe +靠近kaojin +考究kaojiu +靠拢kaolong +考虑kaolu +考勤kaoqin +靠山kaoshan +考试kaoshi +考题kaoti +考验kaoyan +考证kaozheng +卡片kapian +看不惯kbg +看不起kbq +刻不容缓kbrh +开诚布公kcbg +矿产资源kczy +扩大化kdh +可ke +克ke +科ke +刻ke +客ke +壳ke +颗ke +棵ke +柯ke +呵*ke +坷ke +苛ke +磕ke +咳ke +渴ke +课ke +嗑ke +岢ke +恪ke +溘ke +骒ke +缂ke +珂ke +轲ke +氪ke +瞌ke +钶ke +锞ke +稞ke +疴ke +窠ke +颏ke +蝌ke +髁ke +可爱keai +科班keban +课本keben +可比kebi +刻薄kebo +可不kebu +客车keche +课程kecheng +可耻kechi +可恶kee +可风kefeng +可否kefou +克服kefu +可观keguan +客观keguan +可贵kegui +可好kehao +可恨kehen +刻划kehua +刻画kehua +克己keji +客机keji +科技keji +可见kejian +科教kejiao +可敬kejing +窠臼kejiu +科举keju +可靠kekao +苛刻keke +可口kekou +克扣kekou +刻苦keku +克拉kela +克朗kelang +颗粒keli +可怜kelian +科目kemu +肯ken +啃ken +垦ken +恳ken +裉ken +肯定kending +可能keneng +坑keng +吭keng +铿keng +坑道kengdao +坑害kenghai +铿锵kengqiang +恳切kenqie +恳求kenqiu +垦殖kenzhi +可怕kepa +磕碰kepeng +科普kepu +客气keqi +可亲keqin +可取kequ +客人keren +客商keshang +可是keshi +科室keshi +课堂ketang +客套ketao +课题keti +客体keti +客厅keting +磕头ketou +可望kewang +渴望kewang +可喜kexi +可惜kexi +可行kexing +科学kexue +科研keyan +可以keyi +可疑keyi +刻意keyi +科员keyuan +科长kezhang +可知kezhi +克制kezhi +狂风暴雨kfby +克己奉公kjfg +科技司kjs +苦口婆心kkpx +昆明市kms +可能性knx +孔kong +空kong +控kong +恐kong +倥kong +崆kong +箜kong +空白kongbai +恐怖kongbu +控拆kongchai +空洞kongdong +空额konge +空乏kongfa +控告konggao +空喊konghan +恐吓konghe +空话konghua +恐慌konghuang +空间kongjian +空降kongjiang +恐惧kongju +空军kongjun +空旷kongkuang +恐龙konglong +空虑konglu +恐怕kongpa +空气kongqi +空前kongqian +孔雀kongque +控诉kongsu +空谈kongtan +空头kongtou +空文kongwen +空隙kongxi +空闲kongxian +空想kongxiang +空虚kongxu +空运kongyun +控制kongzhi +空中kongzhong +口kou +扣kou +抠kou +寇kou +芤kou +蔻kou +叩kou +眍kou +筘kou +口岸kouan +叩拜koubai +口才koucai +扣除kouchu +口传kouchuan +口服koufu +口供kougong +口号kouhao +口红kouhong +口角koujiao +口径koujing +口诀koujue +口令kouling +扣留kouliu +口气kouqi +口腔kouqiang +口哨koushao +口试koushi +口述koushu +口头koutou +叩头koutou +口信kouxin +扣押kouya +口语kouyu +看起来kql +口若悬河krxh +口是心非ksxf +苦ku +库ku +枯ku +酷ku +哭ku +窟ku +裤ku +刳ku +堀ku +喾ku +绔ku +骷ku +跨kua +夸kua +垮kua +挎kua +胯kua +侉kua +跨步kuabu +夸大kuada +跨度kuadu +会*kuai +快kuai +块kuai +筷kuai +侩kuai +蒯kuai +郐kuai +哙kuai +狯kuai +浍*kuai +脍kuai +会计kuaiji +快乐kuaile +快速kuaisu +宽kuan +款kuan +髋kuan +宽敞kuanchang +宽绰kuanchuo +宽大kuanda +宽待kuandai +款待kuandai +宽度kuandu +况kuang +矿kuang +狂kuang +框kuang +匡kuang +筐kuang +眶kuang +旷kuang +诓kuang +诳kuang +邝kuang +圹kuang +夼kuang +哐kuang +纩kuang +贶kuang +矿藏kuangcang +矿产kuangchan +狂风kuangfeng +矿工kuanggong +旷工kuanggong +矿井kuangjing +框框kuangkuang +哐啷kuanglang +况且kuangqie +矿区kuangqu +矿泉kuangquan +狂热kuangre +矿山kuangshan +矿石kuangshi +框图kuangtu +宽广kuanguang +狂妄kuangwang +矿物kuangwu +旷野kuangye +宽宏kuanhong +宽厚kuanhou +宽阔kuankuo +宽容kuanrong +款式kuanshi +宽恕kuanshu +款项kuanxiang +宽心kuanxin +宽裕kuanyu +垮台kuatai +跨越kuayue +夸张kuazhang +裤衩kucha +库存kucun +哭喊kuhan +奎kui +溃kui +馈kui +亏kui +盔kui +岿kui +窥kui +葵kui +魁kui +傀kui +愧kui +馗kui +匮kui +夔kui +隗kui +蒉kui +揆kui +喹kui +喟kui +悝kui +愦kui +逵kui +暌kui +睽kui +聩kui +蝰kui +篑kui +跬kui +亏本kuiben +窥测kuice +亏待kuidai +愧疚kuijiu +亏空kuikong +亏损kuisun +魁梧kuiwu +溃疡kuiyang +枯竭kujie +库仑kulun +苦闷kumen +枯木kumu +困kun +昆kun +坤kun +捆kun +悃kun +阃kun +琨kun +锟kun +醌kun +鲲kun +髡kun +苦难kunan +苦恼kunao +困厄kune +困乏kunfa +困惑kunhuo +困境kunjing +困苦kunku +昆明kunming +困难kunnan +扩kuo +括kuo +适*kuo +阔kuo +廓kuo +栝*kuo +蛞kuo +阔别kuobie +扩充kuochong +阔绰kuochuo +扩大kuoda +括号kuohao +扩建kuojian +阔气kuoqi +扩展kuozhan +扩张kuozhang +哭泣kuqi +酷暑kushu +苦头kutou +苦维kuwei +枯萎kuwei +酷刑kuxing +苦于kuyu +枯燥kuzao +可想而知kxez +科学家kxj +科学技术kxjs +可行性kxx +科学院kxy +科研部kyb +开源节流kyjl +看样子kyz +了l +来l +量l +理l +路l +里l +论l +两l +利l +领l +流l +力l +立l +料l +连l +老l +六l +轮l +类l +列l +拉la +落*la +啦la +蜡la +腊la +蓝la +垃la +喇la +辣la +剌la +邋la +旯la +砬la +瘌la +喇叭laba +来lai +赖lai +莱lai +崃lai +徕lai +涞lai +濑lai +赉lai +睐lai +铼lai +癞lai +籁lai +来宾laibin +来到laidao +来犯laifan +来访laifang +来函laihan +来回laihui +来历laili +来临lailin +赖皮laipi +来日lairi +来势laishi +来头laitou +来往laiwang +来信laixin +来源laiyuan +来者laizhe +来自laizi +癞子laizi +辣椒lajiao +拉拢lalong +喇嘛lama +腊梅lamei +兰lan +烂lan +蓝lan +览lan +栏lan +婪lan +拦lan +篮lan +阑lan +澜lan +谰lan +揽lan +懒lan +缆lan +滥lan +岚lan +漤lan +榄lan +斓lan +罱lan +镧lan +褴lan +蓝本lanben +懒怠landai +滥调landiao +懒惰landuo +浪lang +朗lang +郎lang +狼lang +琅lang +榔lang +廊lang +莨lang +蒗lang +啷lang +阆lang +锒lang +稂lang +螂lang +栏杆langan +狼狈langbei +浪潮langchao +浪荡langdang +朗读langdu +浪费langfei +狼藉langji +浪漫langman +朗诵langsong +郎中langzhong +兰花lanhua +拦截lanjie +烂漫lanman +懒散lansan +蓝色lanse +缆绳lansheng +烂熟lanshu +蓝天lantian +蓝图lantu +阑尾lanwei +拦腰lanyao +滥用lanyong +兰州lanzhou +老lao +劳lao +落*lao +牢lao +涝lao +捞lao +络*lao +佬lao +姥lao +酪lao +烙lao +潦*lao +唠lao +崂lao +栳lao +铑lao +铹lao +痨lao +耢lao +醪lao +老板laoban +老伴laoban +老本laoben +劳动laodong +牢固laogu +老汉laohan +老化laohua +牢记laoji +劳驾laojia +牢靠laokao +劳苦laoku +牢牢laolao +劳累laolei +劳力laoli +老练laolian +牢笼laolong +劳模laomo +老年laonian +老人laoren +牢骚laosao +老少laoshao +老是laoshi +老实laoshi +老师laoshi +老乡laoxiang +老爷laoye +烙印laoyin +劳支laozhi +劳资laozi +劳作laozuo +腊月layue +狼狈不堪lbbk +力不从心lbcx +来不及lbj +来不了lbl +了不起lbq +劳动保险ldbx +来得及ldj +劳动量ldl +劳动力ldl +灵丹妙药ldmy +拉丁美洲ldmz +劳动者ldz +劳动致富ldzf +了le +乐le +勒le +肋le +仂le +叻le +泐le +鳓le +乐观leguan +类lei +雷lei +累lei +勒*lei +垒lei +泪lei +镭lei +蕾lei +磊lei +儡lei +擂lei +肋lei +羸lei +诔lei +嘞lei +嫘lei +缧lei +檑lei +耒lei +酹lei +类别leibie +类次leici +雷达leida +雷管leiguan +泪痕leihen +泪花leihua +累积leiji +累计leiji +累进leijin +磊落leiluo +累年leinian +类似leisi +擂台leitai +雷同leitong +类推leitui +类型leixing +雷雨leiyu +累月leiyue +累赘leizhui +勒令leling +冷leng +棱leng +楞leng +塄leng +愣leng +冷藏lengcang +冷淡lengdan +冷宫lenggong +棱角lengjiao +冷静lengjing +冷落lengluo +冷门lengmen +冷漠lengmo +冷暖lengnuan +冷僻lengpi +冷气lengqi +冷却lengque +冷水lengshui +冷遇lengyu +乐趣lequ +勒索lesuo +乐意leyi +乐园leyuan +两个文明lgwm +拉关系lgx +联合国lhg +联合会lhh +两回事lhs +联合体lht +理li +里li +利li +力li +立li +离li +例li +历li +粒li +厘li +礼li +李li +隶li +黎li +璃li +励li +犁li +梨li +丽li +厉li +篱li +狸li +漓li +鲤li +莉li +荔li +吏li +栗li +砾li +傈li +俐li +痢li +沥li +哩li +鬲*li +俪li +俚li +郦li +坜li +苈li +莅li +蓠li +藜li +呖li +唳li +喱li +猁li +悝*li +溧li +澧li +逦li +娌li +嫠li +骊li +缡li +枥li +栎li +轹li +戾li +砺li +詈li +罹li +锂li +鹂li +疠li +疬li +蛎li +蜊li +蠡li +笠li +篥li +粝li +醴li +跞li +雳li +鲡li +鳢li +黧li +俩lia +连lian +联lian +练lian +炼lian +脸lian +链lian +莲lian +镰lian +廉lian +怜lian +涟lian +帘lian +敛lian +恋lian +蔹lian +奁lian +潋lian +濂lian +琏lian +楝lian +殓lian +臁lian +裢lian +裣lian +蠊lian +鲢lian +立案lian +恋爱lianai +联邦lianbang +练兵lianbing +联播lianbo +练达lianda +连队liandui +量liang +两liang +粮liang +良liang +亮liang +梁liang +凉liang +辆liang +粱liang +晾liang +谅liang +墚liang +莨*liang +椋liang +踉liang +靓liang +魉liang +炼钢liangang +两半liangban +量变liangbian +两边liangbian +两便liangbian +两侧liangce +两次liangci +两地liangdi +两点liangdian +量度liangdu +良方liangfang +两广liangguang +良好lianghao +两极liangji +良机liangji +谅解liangjie +量具liangju +凉快liangkuai +两立liangli +两面liangmian +练功liangong +两栖liangqi +两讫liangqi +两全liangquan +粮食liangshi +两手liangshou +凉爽liangshuang +亮堂liangtang +两条liangtiao +两头liangtou +连贯lianguan +联贯lianguan +亮相liangxiang +良心liangxin +两性liangxing +量刑liangxing +两样liangyang +粮油liangyou +良缘liangyuan +粮站liangzhan +两者liangzhe +两重liangzhong +良种liangzhong +量子liangzi +联合lianhe +联欢lianhuan +廉价lianjia +联结lianjie +连接lianjie +联接lianjie +廉洁lianjie +联军lianjun +连累lianlei +联络lianluo +连忙lianmang +联盟lianmeng +怜悯lianmin +连年liannian +脸谱lianpu +连日lianri +炼乳lianru +联赛liansai +脸色lianse +连锁liansuo +练武lianwu +联系lianxi +练习lianxi +怜惜lianxi +联想lianxiang +连续lianxu +涟漪lianyi +联姻lianyin +联营lianying +炼油lianyou +联运lianyun +连载lianzai +了*liao +料liao +疗liao +辽liao +僚liao +撩liao +聊liao +燎liao +寥liao +潦liao +撂liao +镣liao +廖liao +蓼liao +尥liao +嘹liao +獠liao +寮liao +缭liao +钌liao +鹩liao +撩拨liaobo +潦草liaocao +疗程liaocheng +料到liaodao +潦倒liaodao +料定liaoding +了结liaojie +了解liaojie +辽阔liaokuo +料理liaoli +寥寥liaoliao +寥落liaoluo +辽宁liaoning +了却liaoque +了事liaoshi +聊天liaotian +料想liaoxiang +疗养liaoyang +礼拜libai +利弊libi +里边libian +理财licai +理睬licai +立场lichang +里程licheng +历程licheng +立春lichun +历次lici +历代lidai +理当lidang +立冬lidong +列lie +裂lie +烈lie +劣lie +猎lie +冽lie +埒lie +捩lie +咧lie +洌lie +趔lie +躐lie +鬣lie +裂变liebian +列车lieche +列出liechu +列岛liedao +裂缝liefeng +列国lieguo +烈火liehuo +劣迹lieji +列举lieju +裂开liekai +裂口liekou +列宁liening +猎奇lieqi +列强lieqiang +猎取liequ +烈日lieri +列入lieru +劣绅lieshen +烈士lieshi +劣势lieshi +烈属lieshu +裂纹liewen +列席liexi +烈性liexing +立法lifa +立方lifang +礼服lifu +立功ligong +利害lihai +厉害lihai +理化lihua +礼花lihua +理会lihui +离婚lihun +立即liji +理解lijie +礼节lijie +历届lijie +力矩liju +离开likai +理科like +立刻like +理亏likui +历来lilai +历历lili +力量liliang +利率lilu +理论lilun +立论lilun +礼貌limao +里面limian +利民limin +黎民limin +黎明liming +林lin +磷lin +临lin +邻lin +淋lin +麟lin +琳lin +霖lin +鳞lin +凛lin +赁lin +吝lin +蔺lin +啉lin +嶙lin +廪lin +懔lin +遴lin +檩lin +辚lin +膦lin +瞵lin +粼lin +躏lin +淋巴linba +临别linbie +淋病linbing +林场linchang +临床linchuang +临到lindao +领ling +另ling +零ling +令ling +灵ling +岭ling +铃ling +龄ling +凌ling +棱*ling +陵ling +拎ling +玲ling +菱ling +伶ling +羚ling +酃ling +苓ling +呤ling +囹ling +泠ling +绫ling +柃ling +棂ling +瓴ling +聆ling +蛉ling +翎ling +鲮ling +令爱lingai +凌晨lingchen +灵丹lingdan +领导lingdao +领地lingdi +零点lingdian +领队lingdui +灵感linggan +领海linghai +领航linghang +领会linghui +灵魂linghun +灵活linghuo +灵机lingji +零件lingjian +领教lingjiao +灵杰lingjie +领空lingkong +凌空lingkong +玲珑linglong +零乱lingluan +凌乱lingluan +领略linglue +灵敏lingmin +陵墓lingmu +灵巧lingqiao +领取lingqu +令人lingren +凌辱lingru +零散lingsan +领事lingshi +领受lingshou +领司lingsi +零碎lingsui +灵堂lingtang +零头lingtou +领土lingtu +磷光linguang +另外lingwai +领悟lingwu +领先lingxian +领衔lingxian +零星lingxing +领袖lingxiu +另选lingxuan +灵验lingyan +领域lingyu +令尊lingzun +磷火linhuo +历年linian +临界linjie +临近linjin +邻近linjin +邻里linli +淋漓linli +凛冽linlie +临摹linmo +里弄linong +鳞伤linshang +临时linshi +临死linsi +吝惜linxi +临行linxing +林业linye +临战linzhan +临终linzhong +礼炮lipao +李鹏lipeng +礼品lipin +力气liqi +离奇liqi +力求liqiu +立秋liqiu +历任liren +例如liru +利润lirun +离散lisan +理事lishi +历史lishi +隶属lishu +礼堂litang +立体liti +例题liti +力图litu +流liu +六liu +留liu +刘liu +硫liu +柳liu +陆*liu +馏liu +瘤liu +溜liu +琉liu +榴liu +碌*liu +浏liu +遛liu +骝liu +绺liu +旒liu +熘liu +锍liu +镏liu +鹨liu +鎏liu +留步liubu +流产liuchan +流畅liuchang +流程liucheng +流传liuchuan +流窜liucuan +流动liudong +流毒liudu +流放liufang +六届liujie +浏览liulan +流利liuli +留恋liulian +流露liulu +流落liuluo +流氓liumang +留念liunian +流失liushi +流逝liushi +流体liuti +流通liutong +流亡liuwang +流泻liuxie +留心liuxin +流行liuxing +流星liuxing +留学liuxue +流血liuxue +流言liuyan +留言liuyan +留洋liuyang +留影liuying +留用liuyong +流域liuyu +六月liuyue +流转liuzhuan +例外liwai +礼物liwu +利息lixi +立夏lixia +理想lixiang +立新lixin +离心lixin +理性lixing +力行lixing +厉行lixing +离休lixiu +立意liyi +利益liyi +离异liyi +利用liyong +理由liyou +力争lizheng +立正lizheng +理智lizhi +立志lizhi +离职lizhi +例子lizi +粒子lizi +立足lizu +屡见不鲜ljbx +两极分化ljfh +逻辑设计ljsj +逻辑思维ljsw +逻辑性ljx +灵机一动ljyd +落落大方lldf +拦路虎llh +来龙去脉llqm +零零碎碎llss +来来往往llww +联绵不断lmbd +灵敏度lmd +辽宁省lns +列宁主义lnzy +龙long +垄long +弄*long +笼long +隆long +聋long +咙long +窿long +拢long +陇long +垅long +茏long +泷long +珑long +栊long +胧long +砻long +癃long +隆冬longdong +垄断longduan +隆隆longlong +笼络longluo +笼统longtong +笼罩longzhao +隆重longzhong +漏lou +露*lou +楼lou +娄lou +搂lou +篓lou +陋lou +偻lou +蒌lou +喽lou +嵝lou +镂lou +瘘lou +耧lou +蝼lou +髅lou +漏洞loudong +漏斗loudou +镂空loukong +漏网louwang +来日方长lrfc +来人来函lrlh +了如指掌lrzz +理所当然lsdr +连锁反应lsfy +领事馆lsg +理事会lsh +力所能及lsnj +拉萨市lss +流水线lsx +良师益友lsyy +路lu +六*lu +率lu +露lu +绿lu +炉lu +律lu +虑lu +滤lu +陆lu +氯lu +鲁lu +铝lu +录lu +旅lu +卢lu +吕lu +芦lu +颅lu +庐lu +掳lu +卤lu +虏lu +麓lu +碌lu +赂lu +鹿lu +潞lu +禄lu +戮lu +驴lu +侣lu +履lu +屡lu +缕lu +垆lu +蓼*lu +撸lu +噜lu +闾lu +泸lu +渌lu +漉lu +逯lu +璐lu +栌lu +榈lu +橹lu +轳lu +辂lu +辘lu +氇lu +胪lu +膂lu +镥lu +稆lu +鸬lu +鹭lu +褛lu +簏lu +舻lu +鲈lu +卵luan +乱luan +峦luan +挛luan +孪luan +滦luan +脔luan +娈luan +栾luan +鸾luan +銮luan +卵巢luanchao +乱伦luanlun +乱子luanzi +旅伴luban +路标lubiao +路程lucheng +旅程lucheng +露出luchu +屡次luci +陆地ludi +露底ludi +旅店ludian +略lue +掠lue +锊lue +掠夺lueduo +旅费lufei +露骨lugu +旅馆luguan +路过luguo +绿化luhua +炉火luhuo +路径lujing +路局luju +陆军lujun +旅客luke +履历luli +率领luling +鲁莽lumang +露面lumian +论lun +轮lun +伦lun +抡lun +仑lun +沦lun +纶lun +囵lun +论处lunchu +轮船lunchuan +论点lundian +论调lundiao +伦敦lundun +轮换lunhuan +论据lunju +轮廓lunkuo +论理lunli +伦理lunli +轮流lunliu +论述lunshu +轮胎luntai +论坛luntan +沦为lunwei +论文lunwen +沦陷lunxian +轮训lunxun +论战lunzhan +论正lunzheng +论证lunzheng +轮轴lunzhou +论著lunzhu +落luo +罗luo +螺luo +洛luo +络luo +逻luo +咯*luo +烙*luo +萝luo +锣luo +箩luo +骡luo +裸luo +骆luo +倮luo +蠃luo +荦luo +捋luo +摞luo +猡luo +泺luo +漯luo +珞luo +椤luo +脶luo +硌*luo +镙luo +瘰luo +雒luo +萝卜luobu +落成luocheng +螺钉luoding +罗汉luohan +落后luohou +落户luohu +逻辑luoji +落空luokong +落款luokuan +箩筐luokuang +罗列luolie +罗马luoma +螺母luomu +罗盘luopan +落泊luopo +落实luoshi +螺栓luoshuan +裸体luoti +骆驼luotuo +罗网luowang +螺纹luowen +落伍luowu +落选luoxuan +螺旋luoxuan +络绎luoyi +录取luqu +路人luren +绿色luse +庐山lushan +旅社lushe +律师lushi +露天lutian +路途lutu +旅途lutu +路线luxian +率先luxian +录像luxiang +旅行luxing +履行luxing +陆续luxu +录音luyin +绿荫luyin +录用luyong +旅游luyou +绿洲luzhou +露珠luzhu +路子luzi +炉子luzi +另行安排lxap +例行公事lxgs +联系人lxr +留学生lxs +另行通知lxtz +林业部lyb +老一辈lyb +另一方面lyfm +劳逸结合lyjh +利用率lyl +老一套lyt +留有余地lyyd +来者不拒lzbj +立足点lzd +老中青lzq +理直气壮lzqz +兰州市lzs +两重性lzx +面m +命m +们m +民m +毛m +没m +米m +明m +马m +么m +每m +门m +名m +磨m +美m +密m +苗m +满m +亩m +目m +呒m +马ma +么*ma +麻ma +吗ma +妈ma +骂ma +嘛ma +码ma +摩*ma +抹*ma +玛ma +蚂ma +唛ma +犸ma +嬷ma +杩ma +蟆ma +马鞍maan +麻痹mabi +马达mada +麻烦mafan +麻纺mafang +马虎mahu +麦mai +脉mai +卖mai +买mai +埋mai +迈mai +劢mai +荬mai +霾mai +买办maiban +脉搏maibo +迈步maibu +埋藏maicang +脉冲maichong +脉动maidong +埋伏maifu +卖国maiguo +脉络mailuo +买卖maimai +卖命maiming +埋没maimo +卖弄mainong +埋头maitou +卖淫maiyin +埋怨maiyuan +埋葬maizang +买帐maizhang +卖座maizuo +马力mali +麻利mali +马路malu +妈妈mama +麻木mamu +满man +慢man +曼man +漫man +蔓man +瞒man +馒man +蛮man +谩man +墁man +幔man +缦man +熳man +镘man +颟man +螨man +鳗man +鞔man +漫长manchang +忙mang +芒mang +盲mang +茫mang +氓mang +莽mang +邙mang +漭mang +硭mang +蟒mang +忙碌manglu +莽莽mangmang +盲目mangmu +茫然mangran +盲人mangren +忙于mangyu +莽原mangyuan +蛮横manheng +漫画manhua +满怀manhuai +谩骂manma +满目manmu +满腔manqiang +蔓延manyan +满意manyi +满载manzai +满足manzu +毛mao +矛mao +冒mao +貌mao +贸mao +帽mao +猫mao +茅mao +锚mao +铆mao +卯mao +茂mao +袤mao +茆mao +峁mao +泖mao +瑁mao +昴mao +牦mao +耄mao +旄mao +懋mao +瞀mao +蟊mao +髦mao +毛病maobing +毛糙maocao +冒充maochong +铆钉maoding +矛盾maodun +冒犯maofan +毛纺maofang +冒号maohao +冒尖maojian +冒进maojin +茅坑maokeng +毛利maoli +冒昧maomei +茂密maomi +冒牌maopai +毛坯maopi +贸然maoran +茂盛maosheng +冒失maoshi +矛头maotou +冒险maoxian +贸易maoyi +冒雨maoyu +毛重maozhong +帽子maozi +马上mashang +马桶matong +码头matou +马戏maxi +麻醉mazui +免不了mbl +明辨是非mbsf +满不在乎mbzh +默不作声mbzs +满城风雨mcfy +目的地mdd +目瞪口呆mdkd +描淡写mdx +么me +麽me +秘而不宣mebx +没mei +每mei +美mei +煤mei +霉mei +酶mei +梅mei +妹mei +眉mei +玫mei +枚mei +媒mei +镁mei +昧mei +寐mei +媚mei +糜*mei +谜*mei +莓mei +嵋mei +猸mei +浼mei +湄mei +楣mei +镅mei +鹛mei +袂mei +魅mei +每次meici +每当meidang +美德meide +没法meifa +每逢meifeng +每个meige +美观meiguan +玫瑰meigui +美国meiguo +美好meihao +美化meihua +媒介meijie +眉睫meijie +枚举meiju +煤矿meikuang +霉烂meilan +魅力meili +美丽meili +美满meiman +眉毛meimao +美貌meimao +妹妹meimei +美妙meimiao +眉目meimu +每年meinian +煤气meiqi +每人meiren +每日meiri +美容meirong +眉梢meishao +每时meishi +美术meishu +媒妁meishuo +煤炭meitan +每天meitian +煤田meitian +美学meixue +没有meiyou +煤油meiyou +美元meiyuan +每月meiyue +没治meizhi +每周meizhou +们men +门men +闷men +扪men +焖men +懑men +钔men +门房menfang +孟meng +猛meng +蒙meng +盟meng +梦meng +萌meng +锰meng +氓*meng +檬meng +勐meng +甍meng +瞢meng +懵meng +朦meng +礞meng +虻meng +蜢meng +蠓meng +艋meng +艨meng +蒙蔽mengbi +萌发mengfa +蒙古menggu +盟国mengguo +梦幻menghuan +蒙混menghun +梦见mengjian +猛进mengjin +梦境mengjing +猛烈menglie +蒙胧menglong +蒙昧mengmei +猛然mengran +萌生mengsheng +猛士mengshi +蒙受mengshou +梦想mengxiang +梦乡mengxiang +猛醒mengxing +萌芽mengya +盟友mengyou +盟约mengyue +猛增mengzeng +门户menhu +门路menlu +门牌menpai +门票menpiao +闷气menqi +门诊menzhen +名副其实mfqs +眉飞色舞mfsw +没关系mgx +蒙古族mgz +蒙混过关mhgg +米mi +密mi +迷mi +蜜mi +秘mi +眯mi +醚mi +靡mi +糜mi +谜mi +弥mi +觅mi +泌mi +幂mi +芈mi +谧mi +蘼mi +咪mi +嘧mi +猕mi +汨mi +宓mi +弭mi +脒mi +祢mi +敉mi +糸mi +縻mi +麋mi +面mian +棉mian +免mian +绵mian +眠mian +冕mian +勉mian +娩mian +缅mian +沔mian +渑mian +湎mian +腼mian +眄mian +面部mianbu +免除mianchu +免得miande +面对miandui +面额miane +棉花mianhua +缅怀mianhuai +面积mianji +面具mianju +面孔miankong +勉励mianli +面临mianlin +面貌mianmao +面面mianmian +绵绵mianmian +面目mianmu +面庞mianpang +面前mianqian +勉强mianqiang +面容mianrong +面色mianse +棉纱miansha +面授mianshou +免税mianshui +面谈miantan +面向mianxiang +免刑mianxing +棉絮mianxu +绵延mianyan +面议mianyi +免疫mianyi +面罩mianzhao +免职mianzhi +面子mianzi +苗miao +秒miao +描miao +庙miao +妙miao +瞄miao +藐miao +渺miao +喵miao +邈miao +缈miao +缪miao +杪miao +淼miao +眇miao +鹋miao +秒表miaobiao +描绘miaohui +妙龄miaoling +渺茫miaomang +描摹miaomo +藐视miaoshi +描述miaoshu +苗条miaotiao +苗头miaotou +描写miaoxie +瞄准miaozhun +弥补mibu +谜底midi +密度midu +灭mie +蔑mie +乜*mie +咩mie +蠛mie +篾mie +灭火miehuo +灭迹mieji +灭绝miejue +灭口miekou +蔑视mieshi +灭亡miewang +密封mifeng +蜜蜂mifeng +眯缝mifeng +迷航mihang +迷糊mihu +迷惑mihuo +密集miji +密件mijian +迷津mijin +秘诀mijue +糜烂milan +迷恋milian +密令miling +迷路milu +密码mima +迷漫miman +弥漫miman +秘密mimi +汨汨mimi +谜面mimian +密谋mimou +民min +敏min +抿min +皿min +悯min +闽min +苠min +岷min +闵min +泯min +缗min +玟min +珉min +愍min +黾min +鳘min +民办minban +民兵minbing +民法minfa +民愤minfen +民风minfeng +命ming +明ming +名ming +鸣ming +螟ming +盟*ming +铭ming +冥ming +茗ming +溟ming +暝ming +瞑ming +酩ming +敏感mingan +明白mingbai +名册mingce +名称mingcheng +明处mingchu +名次mingci +名词mingci +名单mingdan +明灯mingdeng +民歌minge +名额minge +名贵minggui +铭记mingji +名家mingjia +铭刻mingke +明快mingkuai +明朗minglang +名利mingli +明亮mingliang +明了mingliao +命令mingling +名流mingliu +明码mingma +明媚mingmei +明明mingming +名目mingmu +明年mingnian +名牌mingpai +名片mingpian +名气mingqi +明确mingque +明人mingren +名人mingren +名胜mingsheng +名声mingsheng +名堂mingtang +明天mingtian +名望mingwang +明文mingwen +明细mingxi +明显mingxian +鸣谢mingxie +明星mingxing +名言mingyan +名义mingyi +名誉mingyu +命运mingyun +明知mingzhi +明智mingzhi +明珠mingzhu +名著mingzhu +名字mingzi +民航minhang +民间minjian +敏捷minjie +民警minjing +民情minqing +敏锐minrui +民事minshi +民心minxin +民意minyi +民用minyong +民运minyun +民政minzheng +民众minzhong +民主minzhu +民族minzu +密切miqie +迷人miren +迷失mishi +秘书mishu +密探mitan +迷途mitu +谬miu +谬论miulun +谬误miuwu +迷惘miwang +迷雾miwu +迷信mixin +密友miyou +谜语miyu +蜜月miyue +马克思mks +眉开眼笑mkyx +马列主义mlzy +满面春风mmcf +马马虎虎mmhh +面面俱到mmjd +莫名其妙mmqm +默默无闻mmww +明目张胆mmzd +无*mo +磨mo +没*mo +万*mo +末mo +模mo +膜mo +摸mo +墨mo +摩mo +脉*mo +莫mo +抹mo +冒*mo +默mo +貉*mo +嘿*mo +摹mo +蘑mo +魔mo +沫mo +漠mo +寞mo +陌mo +谟mo +茉mo +蓦mo +馍mo +嫫mo +殁mo +镆mo +秣mo +瘼mo +耱mo +貊mo +貘mo +默哀moai +莫不mobu +磨擦moca +摩擦moca +磨蹭moceng +莫大moda +磨刀modao +摩登modeng +摸底modi +模范mofan +模仿mofang +摹仿mofang +莫非mofei +魔鬼mogui +模糊mohu +墨迹moji +模块mokuai +磨砺moli +磨练molian +末了moliao +末路molu +没落moluo +磨灭momie +默默momo +磨难monan +模拟moni +摹拟moni +末期moqi +默契moqi +默然moran +漠然moran +默认moren +末日mori +莫如moru +抹杀mosha +抹煞mosha +末梢moshao +陌生mosheng +模式moshi +没收moshou +魔术moshu +磨损mosun +摸索mosuo +模特mote +摩托motuo +某mou +谋mou +牟mou +侔mou +哞mou +缪*mou +眸mou +蛑mou +蝥mou +鍪mou +某地moudi +某个mouge +谋害mouhai +谋划mouhua +某军moujun +牟利mouli +谋略moulue +谋求mouqiu +牟取mouqu +谋杀mousha +谋生mousheng +某些mouxie +末尾mowei +默写moxie +模型moxing +默许moxu +模样moyang +魔掌mozhang +模子mozi +妙趣横生mqhs +门市部msb +名胜古迹msgj +妙手回春mshc +莫斯科msk +没什么msm +每时每刻msmk +秘书长msz +没事找事mszs +摩托车mtc +埋头工作mtgz +埋头苦干mtkg +亩mu +目mu +木mu +母mu +墓mu +模*mu +幕mu +牧mu +姆mu +穆mu +姥*mu +牟*mu +拇mu +牡mu +暮mu +募mu +慕mu +睦mu +仫mu +坶mu +苜mu +沐mu +毪mu +钼mu +母爱muai +墓碑mubei +目标mubiao +木材mucai +牧草mucao +目测muce +牧场muchang +目次muci +牡丹mudan +目的mudi +牧歌muge +目光muguang +幕后muhou +目击muji +募集muji +木刻muke +木料muliao +幕僚muliao +目录mulu +牧民mumin +木讷mune +木偶muou +目前muqian +母亲muqin +牧区muqu +木然muran +暮色muse +牧师mushi +目送musong +牧童mutong +牧业muye +沐浴muyu +民意测验mycy +贸易市场mysc +贸易协定myxd +民政部mzb +美中不足mzbz +毛泽东mzd +满载而归mzeg +明知故犯mzgf +毛织品mzp +目中无人mzwr +毛主席mzx +年n +能n +内n +那n +农n +你n +南n +难n +呢n +女n +泥n +哪n +拿n +念n +牛n +宁n +脑n +粘n +尼n +纳n +嗯n +那na +南na +哪na +拿na +纳na +呢*na +钠na +呐na +娜na +捺na +肭na +镎na +衲na +那边nabian +纳粹nacui +哪儿naer +那个nage +哪个nage +呐喊nahan +哪会nahui +耐nai +哪*nai +奶nai +乃nai +氖nai +奈nai +鼐nai +艿nai +萘nai +柰nai +耐烦naifan +奈何naihe +耐久naijiu +耐劳nailao +奶奶nainai +耐心naixin +耐性naixing +耐用naiyong +奶油naiyou +乃至naizhi +那里nali +哪里nali +那么name +南nan +难nan +男nan +喃nan +囝nan +囡nan +楠nan +腩nan +蝻nan +赧nan +难办nanban +南北nanbei +南边nanbian +难产nanchan +南昌nanchang +难处nanchu +难道nandao +难得nande +难点nandian +难度nandu +哪能naneng +南方nanfang +南非nanfei +难分nanfen +南风nanfeng +囊nang +攮nang +囔nang +馕nang +曩nang +囊括nangkuo +难怪nanguai +难关nanguan +南国nanguo +难过nanguo +南海nanhai +南货nanhuo +南极nanji +难解nanjie +南京nanjing +难看nankan +难堪nankan +南面nanmian +难免nanmian +难民nanmin +南宁nanning +男女nannu +赧然nanran +男人nanren +难色nanse +难事nanshi +难受nanshou +难说nanshuo +难题nanti +难听nanting +难为nanwei +男性nanxing +南亚nanya +南洋nanyang +难以nanyi +难友nanyou +难于nanyu +脑nao +闹nao +努*nao +挠nao +恼nao +淖nao +孬nao +垴nao +呶nao +猱nao +瑙nao +硇nao +铙nao +蛲nao +脑袋naodai +脑海naohai +恼火naohuo +脑筋naojin +闹剧naoju +闹事naoshi +哪怕napa +纳入naru +那时nashi +拿手nashou +纳税nashui +那些naxie +哪些naxie +纳新naxin +那样nayang +哪样nayang +那种nazhong +年产量ncl +农产品ncp +南昌市ncs +难道说nds +呢ne +哪*ne +呐*ne +讷ne +内nei +那*nei +哪*nei +馁nei +内部neibu +内存neicun +内地neidi +内阁neige +内涵neihan +内行neihang +内奸neijian +内疚neijiu +内科neike +内乱neiluan +内幕neimu +内勤neiqin +内容neirong +内外neiwai +内销neixiao +内心neixin +内因neiyin +内应neiying +内在neizai +嫩nen +恁nen +能neng +能动nengdong +能否nengfou +能干nenggan +能够nenggou +能力nengli +能量nengliang +能耐nengnai +能人nengren +能手nengshou +能源nengyuan +能者nengzhe +农副产品nfcp +年富力强nflq +能工巧匠ngqj +你ni +泥ni +尼ni +呢*ni +逆ni +拟ni +尿ni +妮ni +霓ni +倪ni +匿ni +腻ni +溺ni +伲ni +坭ni +猊ni +怩ni +昵ni +旎ni +祢*ni +慝ni +睨ni +铌ni +鲵ni +年nian +念nian +粘nian +蔫nian +拈nian +碾nian +撵nian +捻nian +酿nian +廿nian +埝nian +辇nian +黏nian +鲇nian +鲶nian +年初nianchu +年代niandai +念叨niandao +年底niandi +年度niandu +年份nianfen +娘niang +年华nianhua +年画nianhua +年级nianji +年纪nianji +年鉴nianjian +年来nianlai +年利nianli +年历nianli +拈量nianliang +年龄nianling +年迈nianmai +年年niannian +年青nianqing +年轻nianqing +年岁niansui +年头niantou +念头niantou +年限nianxian +年月nianyue +酿造nianzao +年终nianzhong +尿niao +鸟niao +溺*niao +茑niao +嬲niao +脲niao +袅niao +鸟瞰niaokan +逆差nicha +你处nichu +你的nide +拟定niding +拟订niding +镍nie +啮nie +涅nie +捏nie +聂nie +孽nie +镊nie +乜nie +陧nie +蘖nie +嗫nie +颞nie +臬nie +蹑nie +捏造niezao +腻烦nifan +泥浆nijiang +逆境nijing +泥坑nikeng +逆流niliu +你们nimen +您nin +宁ning +凝ning +拧ning +柠ning +狞ning +泞ning +佞ning +苎ning +咛ning +甯ning +聍ning +凝固ninggu +凝结ningjie +宁静ningjing +凝聚ningju +宁可ningke +宁肯ningken +宁日ningri +凝视ningshi +凝望ningwang +宁夏ningxia +宁愿ningyuan +泥泞nining +泥塑nisu +牛niu +扭niu +钮niu +纽niu +拗*niu +狃niu +忸niu +妞niu +纽带niudai +牛犊niudu +纽扣niukou +纽约niuyue +扭转niuzhuan +腻味niwei +你我niwo +拟议niyi +泥沼nizhao +逆转nizhuan +难解难分njnf +南京市njs +南极洲njz +扭亏为盈nkwy +脑力劳动nlld +年老体弱nltr +内蒙古nmg +农贸市场nmsc +那么些nmx +那么样nmy +念念不忘nnbw +难能可贵nnkg +南宁市nns +农nong +弄nong +浓nong +脓nong +侬nong +哝nong +脓包nongbao +农村nongcun +浓度nongdu +农妇nongfu +浓厚nonghou +农会nonghui +农活nonghuo +农具nongju +农历nongli +农林nonglin +农忙nongmang +农民nongmin +弄清nongqing +农时nongshi +农药nongyao +农业nongye +农艺nongyi +浓郁nongyu +耨nou +年轻化nqh +年轻人nqr +那时候nsh +能说会道nshd +南斯拉夫nslf +能上能下nsnx +逆水行舟nsxz +农田水利ntsl +女nu +奴nu +努nu +怒nu +弩nu +胬nu +孥nu +驽nu +恧nu +钕nu +衄nu +暖nuan +暖和nuanhe +暖流nuanliu +暖气nuanqi +奴婢nubi +奴才nucai +虐nue +虐待nuedai +虐疾nueji +女儿nuer +女工nugong +怒吼nuhou +奴化nuhua +怒火nuhuo +努力nuli +奴隶nuli +诺nuo +娜*nuo +挪nuo +懦nuo +糯nuo +傩nuo +搦nuo +喏nuo +锘nuo +挪用nuoyong +奴仆nupu +女人nuren +女色nuse +女士nushi +女性nuxing +女婿nuxu +女子nuzi +能文能武nwnw +弄虚作假nxzj +农作物nzw +你争我夺nzwd +欧o +偶o +哦o +鸥o +殴o +藕o +呕o +沤o +讴o +噢o +怄o +瓯o +耦o +偶然性orx +区*ou +欧ou +偶ou +鸥ou +殴ou +藕ou +呕ou +沤ou +讴ou +怄ou +瓯ou +耦ou +殴打ouda +偶尔ouer +讴歌ouge +偶合ouhe +耦合ouhe +欧姆oumu +怄气ouqi +偶然ouran +藕色ouse +偶数oushu +呕吐outu +欧阳ouyang +欧洲ouzhou +批p +平p +判p +配p +片p +派p +破p +排p +品p +皮p +喷p +盘p +偏p +评p +怕p +培p +普p +贫p +跑p +炮p +怕pa +派pa +爬pa +帕pa +扒*pa +耙*pa +啪pa +趴pa +琶pa +葩pa +杷pa +钯*pa +筢pa +派pai +排pai +拍pai +牌pai +迫*pai +哌pai +徘pai +湃pai +俳pai +蒎pai +排版paiban +拍板paiban +排比paibi +派别paibie +排场paichang +排斥paichi +排除paichu +排队paidui +牌号paihao +徘徊paihuai +排挤paiji +牌价paijia +排列pailie +拍卖paimai +派遣paiqian +排球paiqiu +派生paisheng +派头paitou +排外paiwai +排泄paixie +排演paiyan +牌照paizhao +判pan +盘pan +叛pan +番*pan +潘pan +攀pan +磐pan +盼pan +畔pan +胖pan +拚*pan +爿pan +泮pan +袢pan +襻pan +蟠pan +蹒pan +叛变panbian +判别panbie +盘缠panchan +盘存pancun +叛党pandang +攀登pandeng +盘点pandian +判定panding +判断panduan +攀附panfu +旁pang +膀*pang +磅*pang +乓pang +庞pang +耪pang +胖pang +彷pang +滂pang +逄pang +螃pang +旁边pangbian +庞大pangda +盘亘pangen +旁观pangguan +旁听pangting +旁通pangtong +滂沱pangtuo +庞杂pangza +盘踞panju +判决panjue +叛乱panluan +判明panming +叛逆panni +盘算pansuan +蟠桃pantao +叛徒pantu +盼望panwang +判刑panxing +盘旋panxuan +跑pao +炮pao +刨pao +抛pao +泡pao +咆pao +袍pao +匏pao +狍pao +庖pao +脬pao +疱pao +炮兵paobing +跑步paobu +炮弹paodan +跑道paodao +抛光paoguang +炮火paohuo +炮击paoji +抛锚paomao +泡沫paomo +抛弃paoqi +炮手paoshou +炮台paotai +炮艇paoting +咆哮paoxiao +泡影paoying +炮仗paozhang +炮制paozhi +怕死pasi +疲惫不堪pbbk +迫不急待pbjd +破除迷信pcmx +平等互利pdhl +配pei +培pei +陪pei +胚pei +呸pei +裴pei +赔pei +佩pei +沛pei +辔pei +帔pei +旆pei +锫pei +醅pei +霈pei +陪伴peiban +配备peibei +赔本peiben +赔偿peichang +陪衬peichen +配方peifang +佩服peifu +配合peihe +配给peiji +配件peijian +配角peijiao +赔款peikuan +赔礼peili +配偶peiou +陪审peishen +陪送peisong +胚胎peitai +配套peitao +陪同peitong +培训peixun +培养peiyang +配音peiyin +培育peiyu +配乐peiyue +陪葬peizang +配制peizhi +配置peizhi +培植peizhi +喷pen +盆pen +湓pen +盆地pendi +碰peng +棚peng +蓬peng +朋peng +捧peng +膨peng +砰peng +抨peng +烹peng +澎peng +彭peng +硼peng +篷peng +鹏peng +堋peng +嘭peng +怦peng +蟛peng +碰杯pengbei +碰壁pengbi +蓬勃pengbo +捧场pengchang +抨击pengji +蓬莱penglai +蓬乱pengluan +澎湃pengpai +烹饪pengren +硼砂pengsha +蓬松pengsong +烹调pengtiao +朋友pengyou +膨胀pengzhang +喷溅penjian +盆景penjing +喷射penshe +喷嚏penti +平方公里pfgl +平分秋色pfqs +批pi +皮pi +坏*pi +否*pi +辟*pi +坯pi +脾pi +疲pi +砒pi +霹pi +披pi +劈pi +琵pi +毗pi +啤pi +匹pi +痞pi +僻pi +屁pi +譬pi +丕pi +仳pi +陂*pi +陴pi +邳pi +郫pi +圮pi +埤*pi +鼙pi +芘pi +擗pi +吡*pi +噼pi +庀pi +淠pi +媲pi +纰pi +枇pi +甓pi +睥pi +罴pi +铍pi +癖pi +裨*pi +疋pi +蚍pi +蜱pi +貔pi +片pian +偏pian +便*pian +篇pian +骗pian +扁*pian +谝pian +骈pian +缏*pian +犏pian +胼pian +翩pian +蹁pian +偏差piancha +片断pianduan +片段pianduan +偏废pianfei +篇幅pianfu +偏激pianji +偏见pianjian +骗局pianju +片刻pianke +偏离pianli +片面pianmian +偏旁pianpang +偏僻pianpi +偏颇pianpo +骗取pianqu +骗人pianren +骗术pianshu +偏袒piantan +翩跹pianxian +偏向pianxiang +偏移pianyi +便宜pianyi +篇章pianzhang +骗子pianzi +票piao +漂piao +朴*piao +飘piao +瓢piao +剽piao +莩*piao +嘌piao +嫖piao +骠*piao +缥piao +殍piao +瞟piao +螵piao +漂泊piaobo +票房piaofang +漂浮piaofu +票价piaojia +票据piaoju +漂亮piaoliang +漂流piaoliu +飘流piaoliu +飘落piaoluo +票面piaomian +飘渺piaomiao +飘泊piaopo +剽窃piaoqie +飘然piaoran +飘散piaosan +飘扬piaoyang +飘游piaoyou +疲惫pibei +批驳pibo +撇pie +瞥pie +丿pie +苤pie +氕pie +批发pifa +批复pifu +皮肤pifu +皮革pige +屁股pigu +疲倦pijuan +疲劳pilao +纰漏pilou +披露pilu +品pin +贫pin +频pin +拼pin +苹pin +聘pin +拚pin +姘pin +嫔pin +榀pin +牝pin +颦pin +品尝pinchang +频传pinchuan +拼凑pincou +频带pindai +频道pindao +品德pinde +贫乏pinfa +频繁pinfan +平ping +评ping +瓶ping +凭ping +苹ping +冯*ping +乒ping +坪ping +萍ping +屏ping +俜ping +娉ping +枰ping +鲆ping +平安pingan +评比pingbi +屏蔽pingbi +平常pingchang +平川pingchuan +平淡pingdan +平等pingdeng +平地pingdi +平定pingding +评定pingding +品格pinge +平反pingfan +平凡pingfan +平方pingfang +平分pingfen +评分pingfen +评功pinggong +平衡pingheng +评级pingji +平价pingjia +评价pingjia +评奖pingjiang +凭借pingjie +平静pingjing +平均pingjun +平空pingkong +凭空pingkong +评理pingli +评论pinglun +平面pingmian +平民pingmin +屏幕pingmu +评判pingpan +乒乓pingpang +平平pingping +平壤pingrang +平日pingri +平时pingshi +平手pingshou +评说pingshuo +平素pingsu +平坦pingtan +乒坛pingtan +平稳pingwen +平息pingxi +萍乡pingxiang +平行pingxing +平易pingyi +评议pingyi +平庸pingyong +平原pingyuan +平仄pingze +屏障pingzhang +凭着pingzhe +平整pingzheng +凭证pingzheng +评注pingzhu +贫寒pinhan +品级pinji +贫困pinkun +频率pinlu +品貌pinmao +拼命pinming +品名pinming +品评pinping +聘请pinqing +贫穷pinqiong +聘任pinren +聘书pinshu +拼写pinxie +品行pinxing +品性pinxing +拼音pinyin +品质pinzhi +品种pinzhong +批判pipan +匹配pipei +批评piping +脾气piqi +譬如piru +疲软piruan +批示pishi +脾胃piwei +脾性pixing +辟谣piyao +批语piyu +批阅piyue +批注pizhu +批准pizhun +平均数pjs +披荆斩棘pjzj +评论员ply +跑马观花pmgh +破po +迫po +坡po +泼po +繁*po +朴*po +泊*po +颇po +婆po +魄po +粕po +叵po +陂*po +鄱po +泺*po +珀po +攴po +钋po +钷po +钹*po +皤po +笸po +破案poan +破产pochan +破除pochu +坡度podu +泼妇pofu +破格poge +迫害pohai +破坏pohuai +破获pohuo +迫近pojin +破旧pojiu +泼辣pola +破烂polan +魄力poli +破例poli +破裂polie +破灭pomie +迫切poqie +迫使poshi +破碎posui +破损posun +破土potu +剖pou +裒pou +掊pou +剖解poujie +剖析pouxi +破绽pozhan +蓬蓬勃勃ppbb +普普通通pptt +旁若无人prwr +普通话pth +抛头露面ptlm +普pu +谱pu +扑pu +埔pu +铺pu +暴*pu +葡pu +朴pu +蒲pu +堡*pu +脯*pu +仆pu +莆pu +菩pu +圃pu +浦pu +曝pu +瀑pu +匍pu +噗pu +溥pu +濮pu +璞pu +氆pu +镤pu +镨pu +蹼pu +普遍pubian +普查pucha +扑哧puchi +扑打puda +铺盖pugai +普及puji +铺平puping +仆人puren +菩萨pusa +铺设pushe +朴实pushi +朴素pusu +葡萄putao +普通putong +扑通putong +铺位puwei +谱写puxie +普选puxuan +铺张puzhang +普照puzhao +朴直puzhi +平易近人pyjr +拼音字母pyzm +铺张浪费pzlf +起q +前q +其q +去q +气q +全q +期q +群q +情q +区q +强q +切q +取q +七q +求q +清q +确q +权q +且q +青q +亲爱的qad +情报所qbs +千百万qbw +千变万化qbwh +取长补短qcbd +千锤百炼qcbl +恰到好处qdhc +全党全军和全国qdqg +取而代之qedz +轻而易举qeyj +千方百计qfbj +清规戒律qgjl +勤工俭学qgjx +旗鼓相当qgxd +轻工业qgy +轻工业部qgyb +勤工助学qgzx +权衡利弊qhlb +骑虎难下qhnx +青海省qhs +青红皂白qhzb +起qi +其qi +气qi +期qi +七qi +器qi +齐qi +奇qi +汽qi +企qi +漆qi +欺qi +旗qi +畦qi +启qi +弃qi +歧qi +稽*qi +缉*qi +栖qi +戚qi +妻qi +凄qi +柒qi +沏qi +棋qi +崎qi +脐qi +祈qi +祁qi +骑qi +岂qi +乞qi +契qi +砌qi +迄qi +泣qi +讫qi +亟*qi +亓qi +俟qi +圻qi +芑qi +芪qi +荠*qi +萁qi +萋qi +葺qi +蕲qi +嘁qi +屺qi +岐qi +岖*qi +汔qi +淇qi +骐qi +绮qi +琪qi +琦qi +杞qi +桤qi +槭qi +耆qi +欹qi +祺qi +憩qi +碛qi +颀qi +蛴qi +蜞qi +綦qi +綮qi +蹊qi +鳍qi +麒qi +卡*qia +恰qia +掐qia +洽qia +伽*qia +葜qia +袷*qia +髂qia +恰当qiadang +恰好qiahao +前qian +千qian +钱qian +浅qian +签qian +迁qian +铅qian +潜qian +牵qian +钳qian +纤*qian +谴qian +扦qian +钎qian +仟qian +谦qian +乾qian +黔qian +遣qian +堑qian +嵌qian +欠qian +歉qian +倩qian +佥qian +阡qian +芊qian +芡qian +茜qian +荨qian +掮qian +岍qian +悭qian +慊qian +骞qian +搴qian +褰qian +缱qian +椠qian +犍*qian +肷qian +愆qian +钤qian +虔qian +箬qian +箝qian +前辈qianbei +前边qianbian +浅薄qianbo +钱财qiancai +欠产qianchan +前程qiancheng +签到qiandao +前敌qiandi +签订qianding +签发qianfa +遣返qianfan +前方qianfang +强qiang +将*qiang +枪qiang +抢qiang +墙qiang +腔qiang +呛qiang +羌qiang +蔷qiang +戕qiang +嫱qiang +樯qiang +戗qiang +炝qiang +锖qiang +锵qiang +镪qiang +襁qiang +蜣qiang +羟qiang +跄qiang +墙壁qiangbi +枪毙qiangbi +强辩qiangbian +强大qiangda +枪弹qiangdan +强盗qiangdao +强调qiangdiao +腔调qiangdiao +强度qiangdu +抢夺qiangduo +强攻qianggong +强国qiangguo +强化qianghua +强加qiangjia +强奸qiangjian +抢劫qiangjie +强劲qiangjin +抢救qiangjiu +枪决qiangjue +强烈qianglie +强迫qiangpo +强权qiangquan +强弱qiangruo +枪杀qiangsha +强盛qiangsheng +千古qiangu +牵挂qiangua +蔷薇qiangwei +抢险qiangxian +强行qiangxing +强硬qiangying +强占qiangzhan +强者qiangzhe +强制qiangzhi +枪支qiangzhi +强壮qiangzhuang +前后qianhou +前进qianjin +前景qianjing +迁就qianjiu +歉疚qianjiu +迁居qianju +乾坤qiankun +千里qianli +前例qianli +潜力qianli +牵连qianlian +前列qianlie +浅陋qianlou +前面qianmian +签名qianming +前年qiannian +前期qianqi +千秋qianqiu +前驱qianqu +欠缺qianque +前人qianren +前任qianren +纤弱qianruo +前哨qianshao +牵涉qianshe +歉收qianshou +签署qianshu +遣送qiansong +前提qianti +前天qiantian +欠条qiantiao +前途qiantu +千瓦qianwa +千万qianwan +前往qianwang +前夕qianxi +纤细qianxi +前线qianxian +浅显qianxian +谦虚qianxu +谦逊qianxun +前言qianyan +前沿qianyan +前夜qianye +歉意qianyi +迁移qianyi +牵引qianyin +潜在qianzai +谴责qianze +前者qianzhe +签证qianzheng +牵制qianzhi +钳制qianzhi +签字qianzi +前奏qianzou +桥qiao +瞧qiao +壳*qiao +巧qiao +敲qiao +乔qiao +蕉qiao +橇qiao +锹qiao +悄qiao +侨qiao +鞘qiao +撬qiao +翘qiao +峭qiao +俏qiao +窍qiao +雀*qiao +劁qiao +诮qiao +谯qiao +荞qiao +峤*qiao +愀qiao +憔qiao +缲*qiao +樵qiao +硗qiao +跷qiao +鞒qiao +侨胞qiaobao +桥墩qiaodun +巧计qiaoji +瞧见qiaojian +侨居qiaoju +桥梁qiaoliang +窍门qiaomen +巧妙qiaomiao +桥牌qiaopai +乔迁qiaoqian +悄然qiaoran +侨务qiaowu +敲诈qiaozha +恰似qiasi +洽谈qiatan +岂不qibu +起步qibu +器材qicai +奇才qicai +凄惨qican +起草qicao +汽车qiche +骑车qiche +启程qicheng +起初qichu +凄楚qichu +其次qici +期待qidai +脐带qidai +岂但qidan +启迪qidi +起点qidian +启动qidong +气度qidu +切qie +且qie +砌*qie +茄qie +怯qie +窃qie +伽*qie +郄qie +惬qie +慊*qie +妾qie +挈qie +锲qie +箧qie +窃案qiean +切断qieduan +切合qiehe +窃据qieju +窃取qiequ +怯弱qieruo +切身qieshen +切实qieshi +切题qieti +窃听qieting +切削qiexiao +惬意qieyi +启发qifa +起飞qifei +岂非qifei +气愤qifen +气氛qifen +欺负qifu +气概qigai +乞丐qigai +岂敢qigan +气功qigong +奇怪qiguai +器官qiguan +旗号qihao +漆黑qihei +气候qihou +期货qihuo +契机qiji +奇迹qiji +期间qijian +起见qijian +器件qijian +七届qijie +迄今qijin +起来qilai +凄凉qiliang +欺凌qiling +气流qiliu +歧路qilu +起码qima +骑马qima +启蒙qimeng +奇妙qimiao +器皿qimin +亲qin +侵qin +勤qin +秦qin +钦qin +琴qin +芹qin +擒qin +禽qin +寝qin +沁qin +芩qin +揿qin +吣qin +嗪qin +噙qin +廑*qin +溱qin +檎qin +锓qin +矜*qin +覃qin +螓qin +衾qin +亲爱qinai +亲笔qinbi +岂能qineng +侵犯qinfan +勤奋qinfen +情qing +清qing +青qing +轻qing +倾qing +请qing +亲*qing +庆qing +氢qing +晴qing +卿qing +擎qing +氰qing +顷qing +苘qing +圊qing +檠qing +磬qing +蜻qing +罄qing +箐qing +綮*qing +謦qing +鲭qing +黥qing +清白qingbai +青白qingbai +情报qingbao +情操qingcao +青草qingcao +清查qingcha +清除qingchu +清楚qingchu +青春qingchun +青翠qingcui +清单qingdan +倾倒qingdao +清点qingdian +情调qingdiao +轻浮qingfu +青工qinggong +青海qinghai +庆贺qinghe +清华qinghua +情怀qinghuai +清还qinghuan +请假qingjia +请柬qingjian +请教qingjiao +情节qingjie +清洁qingjie +情景qingjing +顷刻qingke +晴空qingkong +轻快qingkuai +情况qingkuang +青睐qinglai +晴朗qinglang +情理qingli +清理qingli +轻率qinglu +轻蔑qingmie +青年qingnian +氢气qingqi +轻巧qingqiao +请求qingqiu +情趣qingqu +青山qingshan +请示qingshi +清爽qingshuang +青松qingsong +轻松qingsong +倾诉qingsu +青天qingtian +晴天qingtian +倾听qingting +倾吐qingtu +请问qingwen +倾向qingxiang +倾销qingxiao +情形qingxing +清醒qingxing +情绪qingxu +情谊qingyi +轻易qingyi +轻盈qingying +情愿qingyuan +请愿qingyuan +请战qingzhan +轻重qingzhong +倾注qingzhu +庆祝qingzhu +请罪qingzui +侵害qinhai +勤俭qinjian +亲近qinjin +亲眷qinjuan +勤快qinkuai +勤劳qinlao +亲历qinli +亲临qinlin +侵略qinlue +亲密qinmi +勤勉qinmian +钦佩qinpei +亲戚qinqi +亲切qinqie +亲热qinre +亲人qinren +侵入qinru +亲身qinshen +侵蚀qinshi +寝室qinshi +亲手qinshou +亲属qinshu +侵吞qintun +勤务qinwu +亲信qinxin +亲眼qinyan +亲友qinyou +侵占qinzhan +亲自qinzi +穷qiong +琼qiong +邛qiong +茕qiong +穹qiong +蛩qiong +筇qiong +跫qiong +銎qiong +穷国qiongguo +穷苦qiongku +穷困qiongkun +穹隆qionglong +穷期qiongqi +穷人qiongren +穷途qiongtu +气派qipai +欺骗qipian +气魄qipo +乞求qiqiu +崎岖qiqu +齐全qiquan +凄然qiran +起色qise +气色qise +其实qishi +起始qishi +启事qishi +气势qishi +启示qishi +歧视qishi +奇数qishu +汽水qishui +起诉qisu +其他qita +其它qita +奇特qite +气体qiti +汽艇qiting +企图qitu +歧途qitu +求qiu +球qiu +秋qiu +丘qiu +仇*qiu +龟*qiu +邱qiu +囚qiu +酋qiu +泅qiu +俅qiu +巯qiu +犰qiu +湫qiu +逑qiu +遒qiu +楸qiu +赇qiu +虬qiu +蚯qiu +蝤qiu +裘qiu +糗qiu +鳅qiu +鼽qiu +秋播qiubo +球场qiuchang +囚犯qiufan +秋风qiufeng +秋季qiuji +求教qiujiao +囚禁qiujin +求救qiujiu +丘陵qiuling +秋千qiuqian +求情qiuqing +求全qiuquan +秋色qiuse +求实qiushi +秋收qiushou +秋天qiutian +求学qiuxue +求战qiuzhan +求证qiuzheng +求知qiuzhi +求助qiuzhu +期望qiwang +气味qiwei +气温qiwen +奇闻qiwen +欺侮qiwu +气息qixi +栖息qixi +起先qixian +期限qixian +气象qixiang +器械qixie +齐心qixin +气压qiya +欺压qiya +气焰qiyan +企业qiye +起义qiyi +歧义qiyi +起因qiyin +启用qiyong +汽油qiyou +其余qiyu +起源qiyuan +七月qiyue +契约qiyue +欺诈qizha +气质qizhi +旗帜qizhi +其中qizhong +器重qizhong +旗子qizi +妻子qizi +勤俭建国qjjg +勤俭节约qjjy +迄今为止qjwz +取决于qjy +千钧一发qjyf +旗开得胜qkds +全力以赴qlyf +勤劳致富qlzf +千里之行qlzx +亲密无间qmwj +青年人qnr +千篇一律qpyl +清清楚楚qqcc +勤勤恳恳qqkk +切切实实qqss +确确实实qqss +恰恰相反qqxf +求全责备qqzb +恰如其分qrqf +欺人之谈qrzt +七手八脚qsbj +全神贯注qsgz +全世界qsj +切实可行qskx +切身利益qsly +青少年qsn +前所未闻qsww +前所未有qswy +气势汹汹qsxx +齐头并进qtbj +奇谈怪论qtgl +千头万绪qtwx +前提下qtx +去qu +区qu +取qu +曲qu +且*qu +渠qu +屈qu +趋qu +驱qu +趣qu +蛆qu +躯qu +娶qu +龋qu +戌*qu +诎qu +劬qu +苣*qu +蕖qu +蘧qu +岖qu +衢qu +阒qu +璩qu +觑qu +氍qu +朐qu +祛qu +磲qu +鸲qu +癯qu +蛐qu +蠼qu +麴qu +瞿qu +黢qu +全quan +权quan +圈quan +劝quan +泉quan +醛quan +颧quan +痊quan +拳quan +犬quan +券quan +诠quan +荃quan +悛quan +绻quan +辁quan +畎quan +铨quan +蜷quan +筌quan +鬈quan +全部quanbu +全党quandang +劝导quandao +蜷伏quanfu +劝告quangao +全国quanguo +权衡quanheng +全会quanhui +拳击quanji +劝解quanjie +全局quanju +全军quanjun +全力quanli +权利quanli +权力quanli +全貌quanmao +全面quanmian +劝勉quanmian +全民quanmin +全能quanneng +全年quannian +全盘quanpan +全拼quanpin +全球quanqiu +蜷曲quanqu +全权quanquan +全然quanran +全胜quansheng +权术quanshu +泉水quanshui +劝说quanshuo +圈套quantao +全体quanti +拳头quantou +权威quanwei +劝慰quanwei +全文quanwen +全县quanxian +权限quanxian +全校quanxiao +权益quanyi +权宜quanyi +劝诱quanyou +痊愈quanyu +劝止quanzhi +劝阻quanzu +区别qubie +屈才qucai +驱除quchu +取代qudai +渠道qudao +取得qude +取缔qudi +曲调qudiao +驱动qudong +确que +却que +缺que +炔que +瘸que +鹊que +榷que +雀que +阕que +阙que +悫que +确保quebao +缺点quedian +确定queding +缺乏quefa +缺口quekou +确立queli +确切queqie +确认queren +缺少queshao +缺省quesheng +确实queshi +缺席quexi +缺陷quexian +确信quexin +确凿quezao +瘸子quezi +区分qufen +屈服qufu +躯干qugan +区划quhua +曲解qujie +取经qujing +取决qujue +躯壳quke +取乐qule +群qun +裙qun +逡qun +裙带qundai +群岛qundao +去年qunian +群众qunzhong +区区ququ +屈辱quru +驱散qusan +取舍qushe +取胜qusheng +去世qushi +驱使qushi +趋势qushi +躯体quti +区位quwei +区委quwei +趣味quwei +区县quxian +去向quxiang +趋向quxiang +取消quxiao +取信quxin +曲艺quyi +区域quyu +区长quzhang +曲折quzhe +屈指quzhi +驱逐quzhu +曲子quzi +奇形怪状qxgz +全心全意qxqy +气象台qxt +气象万千qxwq +齐心协力qxxl +岂有此理qycl +前因后果qyhg +情有可原qyky +强有力qyl +求之不得qzbd +取之不尽qzbj +轻重缓急qzhj +气壮山河qzsh +千真万确qzwq +人r +如r +日r +认r +入r +任r +热r +然r +容r +让r +润r +弱r +燃r +染r +壤r +绕r +仁r +溶r +刃r +仍r +然ran +燃ran +染ran +冉ran +苒ran +蚺ran +髯ran +燃点randian +然而raner +让rang +壤rang +嚷rang +瓤rang +攘rang +禳rang +穰rang +让步rangbu +让位rangwei +让贤rangxian +然后ranhou +燃料ranliao +染料ranliao +冉冉ranran +燃烧ranshao +绕rao +扰rao +饶rao +荛rao +娆rao +桡rao +扰乱raoluan +如此而已rcey +人才济济rcjj +热re +若*re +惹re +热爱reai +热潮rechao +热忱rechen +热诚recheng +热带redai +热火rehuo +热量reliang +热烈relie +人ren +认ren +任ren +仁ren +刃ren +忍ren +壬ren +韧ren +妊ren +纫ren +仞ren +荏ren +葚ren +饪ren +轫ren +稔ren +衽ren +热闹renao +人才rencai +人次renci +仁慈renci +认错rencuo +人大renda +韧带rendai +人道rendao +认得rende +认定rending +人防renfang +仍reng +扔reng +扔掉rengdiao +人格renge +仍旧rengjiu +人工rengong +认购rengou +仍然rengran +任何renhe +人家renjia +人间renjian +人杰renjie +认可renke +人口renkou +人类renlei +人力renli +人们renmen +任免renmian +人民renmin +任命renming +忍耐rennai +任凭renping +任期renqi +认清renqing +人权renquan +荏苒renran +忍让renrang +人人renren +人参renshen +人生rensheng +人事renshi +人士renshi +认识renshi +人手renshou +忍受renshou +认输renshu +忍痛rentong +人为renwei +认为renwei +人物renwu +任务renwu +人心renxin +忍心renxin +人选renxuan +任意renyi +仁义renyi +任用renyong +人员renyuan +认帐renzhang +认真renzhen +人质renzhi +任职renzhi +认罪renzui +认作renzuo +热切reqie +热情reqing +惹事reshi +热线rexian +热心rexin +热血rexue +人工合成rghc +热火朝天rhct +如虎添翼rhty +日ri +日报ribao +日本riben +日产richan +日常richang +日程richeng +日光riguang +日后rihou +日记riji +日久rijiu +日历rili +日落riluo +日内rinei +日期riqi +日夜riye +日益riyi +日用riyong +日照rizhao +日中rizhong +日子rizi +软件包rjb +人杰地灵rjdl +人尽其才rjqc +如饥似渴rjsk +日久天长rjtc +任劳任怨rlry +热泪盈眶rlyk +人民币rmb +人民代表大会rmdh +人民日报rmrb +燃眉之急rmzj +容rong +溶rong +荣rong +熔rong +融rong +绒rong +戎rong +茸rong +蓉rong +冗rong +嵘rong +狨rong +榕rong +肜rong +蝾rong +熔点rongdian +容光rongguang +融合ronghe +溶化ronghua +熔化ronghua +融化ronghua +融会ronghui +荣获ronghuo +容积rongji +溶解rongjie +容量rongliang +戎马rongma +容貌rongmao +容纳rongna +融洽rongqia +容忍rongren +荣辱rongru +容身rongshen +绒线rongxian +荣幸rongxing +容许rongxu +荣耀rongyao +溶液rongye +容易rongyi +荣誉rongyu +溶质rongzhi +肉rou +揉rou +柔rou +糅rou +蹂rou +鞣rou +柔和rouhe +肉麻rouma +柔软rouruan +肉体routi +任人为贤rrwx +日日夜夜rryy +人生观rsg +认识论rsl +惹事生非rssf +如上所述rsss +如ru +入ru +儒ru +乳ru +茹ru +蠕ru +孺ru +辱ru +汝ru +褥ru +蓐ru +薷ru +嚅ru +洳ru +溽ru +濡ru +缛ru +铷ru +襦ru +颥ru +软ruan +阮ruan +朊ruan +软骨ruangu +软件ruanjian +软禁ruanjin +软盘ruanpan +如常ruchang +如此ruci +入党rudang +蠕动rudong +乳房rufang +如果ruguo +如何ruhe +瑞rui +锐rui +蕊rui +芮rui +蕤rui +枘rui +睿rui +蚋rui +锐利ruili +瑞雪ruixue +锐意ruiyi +儒家rujia +如今rujin +辱骂ruma +入门rumen +入迷rumi +润run +闰run +润滑runhua +弱ruo +若ruo +偌ruo +弱点ruodian +若干ruogan +若是ruoshi +弱小ruoxiao +如期ruqi +入侵ruqin +如若ruruo +儒生rusheng +入手rushou +如同rutong +如下ruxia +入选ruxuan +如意ruyi +如愿ruyuan +入帐ruzhang +人武部rwb +若无其事rwqs +人言可畏rykw +日用品ryp +若有所思ryss +人之长情rzcq +是s +上s +时s +生s +说s +社s +深s +水s +所s +三s +十s +使s +事s +数s +四s +实s +少s +式s +山s +手s +撒sa +萨sa +洒sa +卅sa +仨sa +挲sa +脎sa +飒sa +撒谎sahuang +塞sai +思*sai +赛sai +腮sai +鳃sai +噻sai +赛车saiche +塞子saizi +撒娇sajiao +三san +散san +叁san +伞san +馓san +毵san +糁san +散步sanbu +散布sanbu +散发sanfa +三废sanfei +桑sang +丧sang +嗓sang +搡sang +磉sang +颡sang +丧命sangming +丧失sangshi +三国sanguo +三好sanhao +散会sanhui +三角sanjiao +三届sanjie +散失sanshi +散文sanwen +三月sanyue +扫sao +梢*sao +搔sao +骚sao +嫂sao +埽sao +缫sao +缲sao +臊sao +瘙sao +鳋sao +扫除saochu +扫荡saodang +扫地saodi +骚动saodong +骚乱saoluan +扫描saomiao +扫墓saomu +骚扰saorao +瘙痒saoyang +扫帚saozhou +洒脱satuo +说不定sbd +舍不得sbd +说不过去sbgq +说不来sbl +数不胜数sbss +素不相识sbxs +身不由己sbyj +上层建筑scjz +生产力scl +生产率scl +水产品scp +四川省scs +市场调节sctj +市场信息scxx +生动活泼sdhp +山东省sds +水电站sdz +色se +塞*se +瑟se +涩se +啬se +铯se +穑se +视而不见sebj +色彩secai +色调sediao +色盲semang +森sen +僧seng +僧侣senglu +森林senlin +森严senyan +色情seqing +瑟瑟sese +十二月sey +色泽seze +司法部sfb +赏罚分明sffm +说服力sfl +手风琴sfq +三番五次sfwc +四个现代化sgxh +手工业sgy +沙sha +杀sha +砂sha +啥sha +纱sha +莎sha +刹sha +傻sha +煞sha +杉sha +厦*sha +唼sha +嗄*sha +挲*sha +歃sha +铩sha +痧sha +裟sha +霎sha +鲨sha +煞白shabai +刹车shache +煞车shache +沙发shafa +傻瓜shagua +沙皇shahuang +色*shai +筛shai +晒shai +晒台shaitai +砂烬shajin +沙龙shalong +沙漠shamo +山shan +单*shan +闪shan +善shan +珊shan +扇shan +陕shan +掸*shan +苫shan +杉shan +删shan +煽shan +衫shan +擅shan +赡shan +膳shan +汕shan +缮shan +栅*shan +剡shan +讪shan +鄯shan +埏shan +芟shan +潸shan +姗shan +嬗shan +骟shan +膻shan +禅*shan +钐shan +疝shan +蟮shan +舢shan +跚shan +鳝shan +刹那shana +山坳shanao +陕北shanbei +擅长shanchang +删除shanchu +山川shanchuan +山地shandi +闪电shandian +扇动shandong +煽动shandong +山东shandong +山峰shanfeng +上shang +商shang +伤shang +尚shang +汤*shang +墒shang +赏shang +晌shang +裳shang +垧shang +绱shang +殇shang +熵shang +觞shang +删改shangai +山岗shangang +山冈shangang +上班shangban +上报shangbao +上边shangbian +商标shangbiao +上部shangbu +上策shangce +上层shangceng +商场shangchang +上次shangci +赏赐shangci +上当shangdang +上等shangdeng +上帝shangdi +商店shangdian +上调shangdiao +商定shangding +上访shangfang +伤感shanggan +上告shanggao +赏光shangguang +上海shanghai +伤害shanghai +商行shanghang +上级shangji +上集shangji +上进shangjin +上空shangkong +上来shanglai +商量shangliang +上流shangliu +上门shangmen +上面shangmian +上年shangnian +山沟shangou +商品shangpin +商洽shangqia +上前shangqian +尚且shangqie +上去shangqu +商榷shangque +商人shangren +上任shangren +上山shangshan +上升shangsheng +赏识shangshi +上述shangshu +上司shangsi +上诉shangsu +商谈shangtan +商讨shangtao +闪光shanguang +上文shangwen +上午shangwu +商务shangwu +上下shangxia +上限shangxian +伤心shangxin +上旬shangxun +上演shangyan +商业shangye +商议shangyi +上映shangying +上游shangyou +上涨shangzhang +上阵shangzhen +山河shanhe +善后shanhou +删节shanjie +善良shanliang +山林shanlin +山岭shanling +山脉shanmai +杉木shanmu +山区shanqu +扇区shanqu +山水shanshui +闪烁shanshuo +山头shantou +山西shanxi +陕西shanxi +赡养shanyang +闪耀shanyao +善意shanyi +善于shanyu +善战shanzhan +擅自shanzi +少shao +烧shao +稍shao +绍shao +召*shao +哨shao +梢shao +鞘*shao +捎shao +芍shao +勺shao +韶shao +邵shao +劭shao +苕shao +潲shao +杓*shao +蛸shao +筲shao +艄shao +哨兵shaobing +艄公shaogong +烧毁shaohui +少见shaojian +哨卡shaoka +少量shaoliang +少年shaonian +少女shaonu +烧伤shaoshang +少数shaoshu +哨所shaosuo +稍微shaowei +少许shaoxu +稍许shaoxu +少爷shaoye +少有shaoyou +少于shaoyu +少壮shaozhuang +沙哑shaya +砂眼shayan +傻子shazi +社she +设she +射she +摄she +舌she +折*she +涉she +舍she +蛇she +奢she +赊she +赦she +慑she +厍she +佘she +摺*she +猞she +滠she +歙she +畲she +麝she +设备shebei +射程shecheng +奢侈shechi +舍得shede +设法shefa +慑服shefu +赊购shegou +奢华shehua +社会shehui +社稷sheji +涉及sheji +设计sheji +射击sheji +舍己sheji +社交shejiao +设立sheli +涉猎shelie +社论shelun +深shen +身shen +神shen +什*shen +伸shen +参*shen +甚shen +渗shen +沈shen +肾shen +审shen +申shen +慎shen +砷shen +呻shen +娠shen +绅shen +婶shen +诜shen +谂shen +莘shen +葚*shen +哂shen +渖shen +椹shen +胂shen +矧shen +蜃shen +深奥shenao +申报shenbao +身边shenbian +申辩shenbian +身材shencai +审查shencha +深沉shenchen +深处shenchu +审处shenchu +审定shending +深度shendu +甚而shener +身分shenfen +身份shenfen +生sheng +胜sheng +声sheng +省sheng +升sheng +盛sheng +绳sheng +剩sheng +圣sheng +牲sheng +乘*sheng +甥sheng +嵊sheng +渑*sheng +晟sheng +眚sheng +笙sheng +生财shengcai +生产shengchan +生成shengcheng +牲畜shengchu +生存shengcun +盛大shengda +省得shengde +胜地shengdi +盛典shengdian +声调shengdiao +生动shengdong +省份shengfen +胜负shengfu +省府shengfu +生根shenggen +升华shenghua +省会shenghui +盛会shenghui +生活shenghuo +生机shengji +生计shengji +升级shengji +圣洁shengjie +圣经shengjing +盛开shengkai +牲口shengkou +盛况shengkuang +生理shengli +胜利shengli +省力shengli +省略shenglue +生命shengming +声明shengming +盛名shengming +生怕shengpa +生僻shengpi +生平shengping +升旗shengqi +生前shengqian +升迁shengqian +盛情shengqing +生趣shengqu +省去shengqu +胜任shengren +生日shengri +省事shengshi +盛事shengshi +声势shengshi +生疏shengshu +生死shengsi +胜似shengsi +胜诉shengsu +绳索shengsuo +生态shengtai +声讨shengtao +声望shengwang +省委shengwei +生物shengwu +生息shengxi +剩下shengxia +盛夏shengxia +圣贤shengxian +生效shengxiao +生肖shengxiao +盛行shengxing +生涯shengya +生意shengyi +声音shengyin +生于shengyu +生育shengyu +胜于shengyu +声誉shengyu +剩余shengyu +声援shengyuan +生长shengzhang +省长shengzhang +声张shengzhang +胜仗shengzhang +生殖shengzhi +圣旨shengzhi +盛装shengzhuang +审核shenhe +深厚shenhou +深化shenhua +神话shenhua +甚或shenhuo +审计shenji +神经shenjing +深刻shenke +审理shenli +什么shenme +审美shenmei +神秘shenmi +申明shenming +审判shenpan +身旁shenpang +审批shenpi +神气shenqi +神奇shenqi +深浅shenqian +深切shenqie +深情shenqing +申请shenqing +身躯shenqu +深入shenru +渗入shenru +神圣shensheng +身世shenshi +绅士shenshi +伸手shenshou +申述shenshu +神速shensu +申诉shensu +伸缩shensuo +神态shentai +身体shenti +神通shentong +渗透shentou +审问shenwen +神仙shenxian +审讯shenxun +沈阳shenyang +审议shenyi +呻吟shenyin +身影shenying +深远shenyuan +申冤shenyuan +审阅shenyue +深造shenzao +伸张shenzhang +深圳shenzhen +甚至shenzhi +深重shenzhong +慎重shenzhong +神州shenzhou +舍弃sheqi +赊欠sheqian +设施sheshi +社团shetuan +奢望shewang +射线shexian +涉嫌shexian +设想shexiang +赊销shexiao +设宴sheyan +摄影sheying +社员sheyuan +社长shezhang +设置shezhi +涉足shezu +社会公德shgd +是shi +时shi +十shi +使shi +事shi +实shi +式shi +识shi +世shi +试shi +石shi +什shi +示shi +市shi +史shi +师shi +始shi +施shi +士shi +势shi +湿shi +适shi +食shi +失shi +视shi +室shi +氏shi +似*shi +蚀shi +诗shi +释shi +殖*shi +拾shi +饰shi +驶shi +匙*shi +狮shi +尸shi +虱shi +矢shi +屎shi +柿shi +拭shi +誓shi +逝shi +嗜shi +噬shi +仕shi +侍shi +恃shi +嘘*shi +峙*shi +谥shi +埘shi +莳shi +蓍shi +弑shi +轼shi +贳shi +炻shi +铈shi +螫shi +舐shi +筮shi +酾shi +豕shi +鲥shi +鲺shi +失败shibai +势必shibi +事变shibian +师表shibiao +识别shibie +失策shice +史册shice +视察shicha +时常shichang +失常shichang +市场shichang +时辰shichen +失传shichuan +侍从shicong +时代shidai +世代shidai +适当shidang +是的shide +实地shidi +试点shidian +失调shidiao +失掉shidiao +事端shiduan +拾掇shiduo +时而shier +示范shifan +师范shifan +施放shifang +释放shifang +是非shifei +时分shifen +十分shifen +侍奉shifeng +是否shifou +师傅shifu +实干shigan +是个shige +诗歌shige +施工shigong +事故shigu +世故shigu +尸骨shigu +使馆shiguan +时光shiguang +嗜好shihao +适合shihe +时候shihou +事后shihou +侍候shihou +使唤shihuan +实惠shihui +失火shihuo +时机shiji +事迹shiji +实际shiji +世纪shiji +试剂shiji +史籍shiji +施加shijia +市价shijia +时间shijian +事件shijian +世间shijian +实践shijian +视角shijiao +市郊shijiao +使节shijie +十届shijie +世界shijie +使劲shijin +市井shijing +时局shiju +视觉shijue +时刻shike +石刻shike +市侩shikuai +实况shikuang +事理shili +实力shili +事例shili +势利shili +失利shili +势力shili +视力shili +示例shili +失恋shilian +适量shiliang +矢量shiliang +拾零shiling +失灵shiling +适龄shiling +时髦shimao +失密shimi +市民shimin +使命shiming +市内shinei +室内shinei +诗篇shipian +食品shipin +视频shipin +识破shipo +时期shiqi +事前shiqian +失窃shiqie +事情shiqing +实情shiqing +时区shiqu +时取shiqu +失去shiqu +市区shiqu +诗人shiren +市容shirong +湿润shirun +示弱shiruo +失散shisan +失色shise +施舍shishe +师生shisheng +失声shisheng +时时shishi +时事shishi +适时shishi +事实shishi +失事shishi +实施shishi +失实shishi +逝世shishi +史诗shishi +失势shishi +誓师shishi +尸首shishou +失守shishou +实数shishu +施属shishu +世俗shisu +失算shisuan +事态shitai +试探shitan +食堂shitang +实体shiti +尸体shiti +石头shitou +势头shitou +师团shituan +十万shiwan +失望shiwang +市委shiwei +示威shiwei +时务shiwu +事物shiwu +事务shiwu +实物shiwu +食物shiwu +饰物shiwu +失误shiwu +实习shixi +事先shixian +视线shixian +实现shixian +试想shixiang +事项shixiang +实效shixiao +试销shixiao +失信shixin +实行shixing +试行shixing +施行shixing +失修shixiu +实学shixue +史学shixue +实验shiyan +试验shiyan +食言shiyan +誓言shiyan +式样shiyang +事业shiye +实业shiye +失业shiye +视野shiye +时宜shiyi +事宜shiyi +示意shiyi +诗意shiyi +适宜shiyi +释疑shiyi +适应shiying +使用shiyong +实用shiyong +试用shiyong +适用shiyong +事由shiyou +石油shiyou +誓由shiyou +适于shiyu +誓愿shiyuan +十月shiyue +失约shiyue +实在shizai +实战shizhan +施展shizhan +市长shizhang +师长shizhang +使者shizhe +侍者shizhe +失真shizhen +市镇shizhen +市政shizheng +试制shizhi +实质shizhi +市制shizhi +食指shizhi +失职shizhi +适中shizhong +示众shizhong +始终shizhong +时装shizhuang +师资shizi +十足shizu +实足shizu +失足shizu +始祖shizu +手shou +受shou +收shou +首shou +守shou +熟*shou +授shou +寿shou +兽shou +售shou +瘦shou +狩shou +绶shou +艏shou +守备shoubei +手表shoubiao +收兵shoubing +收藏shoucang +手册shouce +首倡shouchang +寿辰shouchen +收成shoucheng +首创shouchuang +首次shouci +收存shoucun +寿诞shoudan +受到shoudao +守敌shoudi +首度shoudu +首都shoudu +手段shouduan +守法shoufa +首犯shoufan +收复shoufu +首府shoufu +手感shougan +手稿shougao +收割shouge +收购shougou +受害shouhai +守候shouhou +守护shouhu +收回shouhui +受贿shouhui +收获shouhuo +收集shouji +售价shoujia +受奖shoujiang +授奖shoujiang +手脚shoujiao +收缴shoujiao +首届shoujie +守旧shoujiu +收据shouju +授课shouke +受理shouli +收敛shoulian +首领shouling +收留shouliu +收录shoulu +收买shoumai +授命shouming +寿命shouming +首脑shounao +首批shoupi +授权shouquan +收容shourong +收入shouru +手软shouruan +瘦弱shouruo +首饰shoushi +手术shoushu +收缩shousuo +收条shoutiao +收听shouting +收尾shouwei +首尾shouwei +首先shouxian +首相shouxiang +瘦小shouxiao +收效shouxiao +手续shouxu +瘦削shouxue +收养shouyang +首要shouyao +受益shouyi +收益shouyi +兽医shouyi +受用shouyong +授予shouyu +守则shouze +首长shouzhang +收支shouzhi +生活上shs +上海市shs +数shu +书shu +树shu +属shu +术shu +输shu +述shu +熟shu +束shu +鼠shu +疏shu +殊shu +舒shu +蔬shu +薯shu +叔shu +署shu +枢shu +梳shu +抒shu +淑shu +赎shu +孰shu +暑shu +曙shu +蜀shu +黍shu +戍shu +竖shu +墅shu +庶shu +漱shu +恕shu +俞*shu +丨shu +倏shu +塾shu +菽shu +摅shu +沭shu +澍shu +姝shu +纾shu +毹shu +腧shu +殳shu +秫shu +刷shua +耍shua +唰shua +衰shuai +帅shuai +摔shuai +甩shuai +蟀shuai +衰败shuaibai +摔打shuaida +摔交shuaijiao +衰竭shuaijie +衰老shuailao +衰弱shuairuo +衰退shuaitui +衰亡shuaiwang +耍赖shualai +栓shuan +拴shuan +闩shuan +涮shuan +双shuang +霜shuang +爽shuang +泷*shuang +孀shuang +双边shuangbian +双方shuangfang +爽口shuangkou +爽快shuangkuai +爽朗shuanglang +双拼shuangpin +双重shuangzhong +耍弄shuanong +刷洗shuaxi +刷新shuaxin +书报shubao +书本shuben +蔬菜shucai +舒畅shuchang +输出shuchu +树丛shucong +疏导shudao +书店shudian +数额shue +抒发shufa +书法shufa +舒服shufu +束缚shufu +曙光shuguang +蜀汉shuhan +疏忽shuhu +倏忽shuhu +书画shuhua +水shui +说*shui +谁shui +睡shui +税shui +水稻shuidao +水电shuidian +水分shuifen +水果shuiguo +水火shuihuo +水晶shuijing +水库shuiku +水利shuili +水流shuiliu +睡眠shuimian +水平shuiping +税收shuishou +税务shuiwu +水下shuixia +水性shuixing +水源shuiyuan +水灾shuizai +谁知shuizhi +书记shuji +书籍shuji +暑假shujia +数据shuju +书刊shukan +数理shuli +树立shuli +竖立shuli +熟练shulian +数量shuliang +数列shulie +疏漏shulou +数落shuluo +数码shuma +书面shumian +庶民shumin +数目shumu +书目shumu +树木shumu +顺shun +吮shun +瞬shun +舜shun +顺便shunbian +顺差shuncha +顺次shunci +顺从shuncong +顺当shundang +顺道shundao +顺风shunfeng +枢纽shuniu +顺利shunli +顺路shunlu +瞬时shunshi +顺势shunshi +顺心shunxin +顺序shunxu +顺应shunying +顺着shunzhuo +说shuo +数*shuo +硕shuo +朔shuo +烁shuo +蒴shuo +搠shuo +妁shuo +槊shuo +铄shuo +说到shuodao +说道shuodao +说动shuodong +说法shuofa +说服shuofu +硕果shuoguo +说话shuohua +说教shuojiao +说明shuoming +说情shuoqing +硕士shuoshi +述评shuping +署期shuqi +暑期shuqi +抒情shuqing +熟人shuren +输入shuru +疏散shusan +属实shushi +熟识shushi +舒适shushi +束手shushou +叔叔shushu +数说shushuo +述说shushuo +输送shusong +疏松shusong +舒坦shutan +疏通shutong +熟悉shuxi +属相shuxiang +舒心shuxin +书信shuxin +属性shuxing +数学shuxue +属于shuyu +术语shuyu +疏远shuyuan +舒展shuzhan +数值shuzhi +树脂shuzhi +梳妆shuzhuang +数字shuzi +赎罪shuzui +售货员shy +社会主义shzy +四si +思si +死si +斯si +丝si +似si +司si +饲si +食*si +私si +厕*si +撕si +嘶si +肆si +寺si +嗣si +伺si +巳si +厮si +俟*si +兕si +厶si +咝si +汜si +泗si +澌si +姒si +驷si +缌si +祀si +锶si +鸶si +耜si +蛳si +笥si +死板siban +四边sibian +死别sibie +思潮sichao +丝绸sichou +四处sichu +四川sichuan +死党sidang +死敌sidi +司法sifa +四方sifang +四海sihai +丝毫sihao +嗣后sihou +似乎sihu +四化sihua +死缓sihuan +撕毁sihui +死活sihuo +四季siji +司机siji +私交sijiao +四届sijie +思考sikao +私利sili +私了siliao +司令siling +思路silu +四面simian +思念sinian +私念sinian +死去siqu +私人siren +死伤sishang +私事sishi +死尸sishi +死水sishui +思索sisuo +四体siti +私吞situn +死亡siwang +思维siwei +斯文siwen +私下sixia +思想sixiang +四项sixiang +死心sixin +私心sixin +肆行sixing +死刑sixing +私有siyou +私欲siyu +寺院siyuan +四月siyue +死者sizhe +四周sizhou +私自sizi +死罪sizui +拾金不昧sjbm +身经百战sjbz +书记处sjc +世界观sjg +舍己救人sjjr +数据库sjk +省军区sjq +杀鸡取蛋sjqd +实际上sjs +设计所sjs +试金石sjs +舍己为人sjwr +设计院sjy +随机应变sjyb +十进制sjz +石家庄sjz +适可而止skez +数理化slh +收录机slj +十六进制sljz +三令五申slws +司令员sly +四面八方smbf +手忙脚乱smjl +生命力sml +说明书sms +什么样smy +深谋远虑smyl +数目字smz +松song +送song +宋song +颂song +耸song +怂song +讼song +诵song +凇song +菘song +崧song +嵩song +忪song +悚song +淞song +竦song +松绑songbang +送别songbie +松弛songchi +松动songdong +颂歌songge +松劲songjin +松快songkuai +耸立songli +送礼songli +松散songsan +松涛songtao +松懈songxie +颂扬songyang +怂恿songyong +送葬songzang +送终songzhong +搜sou +艘sou +擞sou +嗽sou +叟sou +薮sou +嗖sou +嗾sou +馊sou +溲sou +飕sou +瞍sou +锼sou +螋sou +搜查soucha +搜集souji +搜索sousuo +搜寻souxun +售票处spc +食品工业spgy +水平线spx +生气勃勃sqbb +诗情画意sqhy +盛气凌人sqlr +山穷水尽sqsj +十全十美sqsm +首屈一指sqyz +四人帮srb +损人利己srlj +深入浅出srqc +似是而非ssef +时时刻刻sskk +姗姗来迟sslc +实事求是ssqs +事实上sss +随时随地sssd +善始善终sssz +顺水推舟sstz +四通公司stgs +四通集团stjt +身体力行stlx +生态平衡stph +素su +速su +苏su +塑su +缩su +俗su +诉su +宿su +肃su +酥su +粟su +僳su +溯su +夙su +谡su +蔌su +嗉su +愫su +涑su +簌su +觫su +稣su +算suan +酸suan +蒜suan +狻suan +酸楚suanchu +算法suanfa +算计suanji +算了suanle +算盘suanpan +算术suanshu +酸疼suanteng +酸痛suantong +素材sucai +速成sucheng +苏丹sudan +速度sudu +俗话suhua +随sui +穗sui +碎sui +虽sui +岁sui +尿*sui +隋sui +绥sui +髓sui +遂sui +隧sui +祟sui +谇sui +荽sui +濉sui +邃sui +燧sui +眭sui +睢sui +随笔suibi +随便suibian +随处suichu +随从suicong +随地suidi +随和suihe +随后suihou +随机suiji +随即suiji +虽然suiran +随身suishen +随时suishi +随手suishou +岁数suishu +虽说suishuo +随同suitong +随心suixin +随行suixing +随意suiyi +遂意suiyi +岁月suiyue +虽则suize +随着suizhe +诉苦suku +苏联sulian +塑料suliao +速率sulu +素描sumiao +肃穆sumu +损sun +孙sun +笋sun +荪sun +狲sun +飧sun +榫sun +隼sun +损害sunhai +损耗sunhao +损坏sunhuai +损伤sunshang +损失sunshi +孙子sunzi +所suo +缩suo +锁suo +索suo +莎*suo +蓑suo +梭suo +唆suo +琐suo +唢suo +嗦suo +嗍suo +娑suo +桫suo +挲*suo +睃suo +羧suo +所得suode +缩短suoduan +缩减suojian +锁链suolian +所能suoneng +索取suoqu +唆使suoshi +所属suoshu +琐碎suosui +所为suowei +所谓suowei +缩小suoxiao +缩写suoxie +琐屑suoxie +索性suoxing +所以suoyi +索引suoyin +缩影suoying +所有suoyou +所在suozai +所长suozhang +所至suozhi +梭子suozi +肃清suqing +苏区suqu +宿舍sushe +素数sushu +诉说sushuo +诉讼susong +速效suxiao +速写suxie +苏醒suxing +素养suyang +宿营suying +溯源suyuan +宿愿suyuan +夙愿suyuan +塑造suzao +速战suzhan +素质suzhi +苏州suzhou +苏维埃swa +税务局swj +手舞足蹈swzd +少先队sxd +身心健康sxjk +思想上sxs +山西省sxs +陕西省sxs +顺息万变sxwb +所向无敌sxwd +思想性sxx +商业部syb +说一不二sybe +收音机syj +使用价值syjz +所有权syq +沈阳市sys +实用性syx +十一月syy +所有制syz +私有制syz +时至今日szjr +三中全会szqh +始终如一szry +深圳四通szst +所作所为szsw +甚至于szy +他t +同t +它t +提t +题t +体t +图t +天t +头t +通t +条t +特t +土t +团t +统t +台t +她t +太t +套t +铁t +他ta +它ta +她ta +塔ta +踏ta +塌ta +獭ta +挞ta +蹋ta +拓*ta +嗒*ta +闼ta +溻ta +漯*ta +遢ta +榻ta +沓ta +铊ta +趿ta +鳎ta +踏步tabu +他的tade +它的tade +她的tade +塌方tafang +台tai +太tai +态tai +胎tai +抬tai +泰tai +苔tai +酞tai +汰tai +邰tai +薹tai +呔*tai +骀*tai +肽tai +炱tai +钛tai +跆tai +鲐tai +台北taibei +台词taici +态度taidu +台风taifeng +台阶taijie +太平taiping +泰然tairan +泰山taishan +态势taishi +太太taitai +抬头taitou +台湾taiwan +太阳taiyang +太原taiyuan +天安门tam +他们tamen +它们tamen +她们tamen +谈tan +碳tan +探tan +炭tan +弹*tan +坦tan +贪tan +滩tan +坍tan +摊tan +瘫tan +坛tan +檀tan +痰tan +潭tan +谭tan +毯tan +袒tan +叹tan +郯tan +澹tan +昙tan +忐tan +钽tan +锬tan +镡*tan +坦白tanbai +探测tance +探访tanfang +谈锋tanfeng +叹服tanfu +堂tang +糖tang +唐tang +塘tang +汤tang +搪tang +棠tang +膛tang +倘tang +躺tang +淌tang +趟tang +烫tang +傥tang +帑tang +溏tang +瑭tang +樘tang +铴tang +镗tang +耥tang +螗tang +螳tang +羰tang +醣tang +倘不tangbu +搪瓷tangci +弹弓tangong +倘若tangruo +搪塞tangsai +烫伤tangshang +堂堂tangtang +唐突tangtu +弹劾tanhe +袒护tanhu +谈话tanhua +瘫痪tanhuan +探究tanjiu +坦克tanke +贪婪tanlan +坦率tanlu +谈论tanlun +摊派tanpai +谈判tanpan +叹气tanqi +探亲tanqin +弹琴tanqin +坦然tanran +探索tansuo +探讨tantao +谈天tantian +探听tanting +贪图tantu +谈吐tantu +滩涂tantu +探望tanwang +探问tanwen +贪污tanwu +叹息tanxi +探险tanxian +谈心tanxin +弹性tanxing +探询tanxun +贪赃tanzang +套tao +讨tao +逃tao +陶tao +萄tao +桃tao +掏tao +涛tao +滔tao +绦tao +淘tao +鼗tao +叨*tao +啕tao +洮tao +韬tao +焘tao +饕tao +逃奔taoben +逃避taobi +逃兵taobing +逃窜taocuan +逃遁taodun +讨伐taofa +讨饭taofan +套购taogou +讨好taohao +讨还taohuan +讨价taojia +桃李taoli +韬略taolue +讨论taolun +逃命taoming +逃难taonan +逃跑taopao +淘气taoqi +逃生taosheng +淘汰taotai +滔滔taotao +逃脱taotuo +逃亡taowang +讨厌taoyan +陶冶taoye +桃子taozi +逃走taozou +陶醉taozui +踏青taqing +他人taren +踏实tashi +他说tashuo +他乡taxiang +挑拨离间tblj +台北市tbs +贪便宜tby +统筹兼顾tcjg +铁道部tdb +土地改革tdgg +同等学历tdxl +特te +忒te +忑te +慝*te +铽te +特别tebie +特产techan +特长techang +特出techu +特此teci +特大teda +特等tedeng +特地tedi +特点tedian +特定teding +特级teji +特技teji +特急teji +特将tejiang +特刊tekan +特快tekuai +特例teli +腾teng +疼teng +藤teng +誊teng +滕teng +疼爱tengai +腾达tengda +誊写tengxie +特派tepai +特区tequ +特权tequan +托儿所tes +特色tese +特使teshi +特殊teshu +特为tewei +特务tewu +特效texiao +特写texie +特性texing +特邀teyao +特意teyi +特有teyou +特约teyue +特征tezheng +特制tezhi +特种tezhong +突飞猛进tfmj +铁饭碗tfw +同甘共苦tggk +提货单thd +谈何容易thry +提ti +题ti +体ti +替ti +梯ti +惕ti +剔ti +踢ti +锑ti +蹄ti +啼ti +嚏ti +涕ti +剃ti +屉ti +倜ti +荑*ti +悌ti +逖ti +绨*ti +缇ti +鹈ti +裼ti +醍ti +天tian +田tian +添tian +填tian +甜tian +佃*tian +恬tian +舔tian +腆tian +掭tian +忝tian +阗tian +殄tian +畋tian +填报tianbao +天边tianbian +填表tianbiao +填补tianbu +天才tiancai +天长tianchang +填充tianchong +天地tiandi +田地tiandi +天鹅tiane +天府tianfu +天赋tianfu +天机tianji +天际tianji +添加tianjia +天津tianjin +恬静tianjing +天空tiankong +填空tiankong +天理tianli +天良tianliang +天亮tianliang +甜美tianmei +甜蜜tianmi +天明tianming +天平tianping +天气tianqi +天桥tianqiao +天然tianran +天壤tianrang +天色tianse +天上tianshang +天生tiansheng +天使tianshi +天堂tiantang +天体tianti +天天tiantian +甜头tiantou +天文tianwen +天下tianxia +天险tianxian +天仙tianxian +天性tianxing +天涯tianya +田野tianye +天真tianzhen +天职tianzhi +添置tianzhi +天资tianzi +条tiao +调*tiao +跳tiao +挑tiao +迢tiao +眺tiao +佻tiao +苕*tiao +祧tiao +窕tiao +蜩tiao +笤tiao +粜tiao +龆tiao +鲦tiao +髫tiao +挑拔tiaoba +跳动tiaodong +挑动tiaodong +挑逗tiaodou +跳高tiaogao +调和tiaohe +调剂tiaoji +条件tiaojian +调解tiaojie +调节tiaojie +条款tiaokuan +调理tiaoli +条理tiaoli +条例tiaoli +条令tiaoling +调配tiaopei +挑剔tiaoti +调停tiaoting +条文tiaowen +跳舞tiaowu +调戏tiaoxi +挑衅tiaoxin +挑选tiaoxuan +条约tiaoyue +挑战tiaozhan +调整tiaozheng +条子tiaozi +提拨tibo +题材ticai +体裁ticai +体操ticao +体察ticha +提倡tichang +提成ticheng +提出tichu +剔除tichu +题词tici +替代tidai +梯队tidui +铁tie +贴tie +帖tie +萜tie +餮tie +贴补tiebu +铁道tiedao +贴近tiejin +铁路tielu +贴切tieqie +贴身tieshen +铁证tiezheng +提法tifa +提防tifang +提纲tigang +提高tigao +体格tige +提供tigong +替换tihuan +体会tihui +提货tihuo +体积tiji +提价tijia +体力tili +体例tili +提炼tilian +体谅tiliang +体面timian +提名timing +题名timing +题目timu +听ting +停ting +庭ting +挺ting +廷ting +厅ting +烃ting +汀ting +亭ting +艇ting +莛ting +葶ting +婷ting +梃ting +町*ting +铤ting +蜓ting +霆ting +挺拔tingba +停办tingban +停泊tingbo +停产tingchan +听从tingcong +停顿tingdun +停工tinggong +挺括tinggua +听候tinghou +听话tinghua +停火tinghuo +听见tingjian +厅局tingju +听觉tingjue +停留tingliu +听凭tingping +听取tingqu +听任tingren +听说tingshuo +听信tingxin +厅长tingzhang +停止tingzhi +停职tingzhi +停滞tingzhi +听众tingzhong +提起tiqi +提前tiqian +提取tiqu +提升tisheng +提示tishi +体坛titan +体贴titie +提问tiwen +体温tiwen +体系tixi +体现tixian +体型tixing +提醒tixing +体验tiyan +提要tiyao +提议tiyi +体育tiyu +体制tizhi +体质tizhi +题字tizi +统计表tjb +条件反射tjfs +讨价还价tjhj +天津市tjs +条件下tjx +讨论会tlh +拖拉机tlj +他们的tmd +同盟会tmh +天南地北tndb +同tong +通tong +统tong +铜tong +痛tong +筒tong +童tong +桶tong +侗*tong +恫*tong +桐tong +酮tong +瞳tong +彤tong +捅tong +佟tong +仝tong +垌*tong +茼tong +嗵tong +峒*tong +恸tong +潼tong +砼tong +同伴tongban +同胞tongbao +通报tongbao +同辈tongbei +通病tongbing +同步tongbu +通常tongchang +通称tongcheng +统称tongcheng +痛斥tongchi +统筹tongchou +痛楚tongchu +同窗tongchuang +同道tongdao +通道tongdao +同等tongdeng +通电tongdian +通牒tongdie +通读tongdu +通告tonggao +统购tonggou +通过tongguo +通航tonghang +痛恨tonghen +同化tonghua +通话tonghua +童话tonghua +痛悔tonghui +通婚tonghun +统计tongji +通辑tongji +痛击tongji +同居tongju +痛苦tongku +痛哭tongku +痛快tongkuai +同僚tongliao +通令tongling +同盟tongmeng +同年tongnian +童年tongnian +同期tongqi +通气tongqi +同情tongqing +通融tongrong +同上tongshang +通商tongshang +同时tongshi +同事tongshi +统属tongshu +统帅tongshuai +通顺tongshun +通俗tongsu +通往tongwang +痛恶tongwu +痛惜tongxi +统辖tongxia +通向tongxiang +同乡tongxiang +统销tongxiao +通宵tongxiao +通晓tongxiao +同心tongxin +痛心tongxin +通信tongxin +同行tongxing +通行tongxing +同性tongxing +同学tongxue +通讯tongxun +同样tongyang +统一tongyi +同意tongyi +通用tongyong +通邮tongyou +统战tongzhan +同志tongzhi +统治tongzhi +通知tongzhi +头tou +投tou +透tou +偷tou +钭tou +骰tou +投案touan +头版touban +投奔touben +投标toubiao +投产touchan +透彻touche +头等toudeng +投放toufang +投机touji +投靠toukao +投篮toulan +偷懒toulan +头颅toulu +透露toulu +头面toumian +透明touming +头目toumu +头脑tounao +投票toupiao +透气touqi +投入touru +投身toushen +透视toushi +头痛toutong +偷闲touxian +投降touxiang +头绪touxu +投影touying +投掷touzhi +头子touzi +投资touzi +突破口tpk +太平洋tpy +通情达理tqdl +天气预报tqyb +突然袭击trxj +妥善处理tscl +通俗读物tsdw +挺身而出tsec +图书馆tsg +滔滔不绝ttbj +痛痛快快ttkk +团体赛tts +踏踏实实ttss +图tu +土tu +突tu +途tu +徒tu +凸tu +涂tu +吐tu +兔tu +屠tu +秃tu +堍tu +荼tu +菟tu +钍tu +酴tu +团tuan +湍tuan +抟tuan +彖tuan +疃tuan +图案tuan +湍急tuanji +团结tuanjie +团聚tuanju +湍流tuanliu +团体tuanti +团员tuanyuan +团圆tuanyuan +团长tuanzhang +突变tubian +图表tubiao +土产tuchan +突出tuchu +土地tudi +徒弟tudi +土匪tufei +土改tugai +涂改tugai +图画tuhua +土话tuhua +推tui +退tui +腿tui +颓tui +蜕tui +褪tui +忒*tui +煺tui +蜕变tuibian +退步tuibu +推测tuice +推迟tuichi +推崇tuichong +退出tuichu +推导tuidao +推动tuidong +推断tuiduan +推翻tuifan +颓废tuifei +推广tuiguang +退化tuihua +蜕化tuihua +退回tuihui +推荐tuijian +推进tuijin +推举tuiju +推开tuikai +推理tuili +推论tuilun +推敲tuiqiao +推却tuique +退却tuique +推让tuirang +退让tuirang +颓丧tuisang +退色tuise +推算tuisuan +退缩tuisuo +颓唐tuitang +推托tuituo +退伍tuiwu +推向tuixiang +推销tuixiao +推卸tuixie +推行tuixing +退休tuixiu +退学tuixue +推移tuiyi +退职tuizhi +突击tuji +图解tujie +途径tujing +徒劳tulao +图例tuli +吐露tulu +囤*tun +褪*tun +吞tun +屯tun +臀tun +氽tun +饨tun +暾tun +豚tun +吞并tunbing +吞没tunmo +吞吐tuntu +脱tuo +拖tuo +托tuo +妥tuo +椭tuo +舵*tuo +魄*tuo +鸵tuo +陀tuo +驮tuo +驼tuo +拓tuo +唾tuo +乇tuo +佗tuo +坨tuo +庹tuo +沱tuo +柝tuo +柁*tuo +橐tuo +砣tuo +铊*tuo +箨tuo +酡tuo +跎tuo +鼍tuo +驼背tuobei +拓补tuobu +脱出tuochu +妥当tuodang +脱轨tuogui +拓荒tuohuang +脱节tuojie +拖拉tuola +脱离tuoli +唾骂tuoma +唾弃tuoqi +妥善tuoshan +脱身tuoshen +妥协tuoxie +拖延tuoyan +唾液tuoye +图片tupian +突破tupo +突起tuqi +突然turan +徒然turan +土壤turang +屠杀tusha +徒手tushou +图书tushu +吐痰tutan +突围tuwei +突兀tuwu +图象tuxiang +图像tuxiang +图形tuxing +徒刑tuxing +图章tuzhang +图纸tuzhi +途中tuzhong +土著tuzhu +秃子tuzi +贪污盗窃twdq +台湾省tws +贪污受贿twsh +提心吊胆txdd +通讯社txs +同心同德txtd +同心协力txxl +推心置腹txzf +体育场tyc +体育锻炼tydl +体育馆tyg +腾云驾雾tyjw +太阳能tyn +太原市tys +天衣无缝tywf +通用性tyx +体育运动tyyd +团支部tzb +停滞不前tzbq +同志们tzm +天灾人祸tzrh +听之任之tzrz +通知书tzs +为w +我w +无w +问w +外w +五w +位w +物w +委w +完w +温w +万w +文w +往w +武w +务w +王w +围w +误w +晚w +瓦wa +挖wa +凹*wa +哇wa +蛙wa +洼wa +娃wa +袜wa +佤wa +娲wa +腽wa +外wai +歪wai +外币waibi +外边waibian +外表waibiao +外宾waibin +外部waibu +外传waichuan +外存waicun +外地waidi +外调waidiao +歪风waifeng +外观waiguan +外国waiguo +外行waihang +外汇waihui +外加waijia +外交waijiao +外界waijie +外景waijing +外科waike +外快waikuai +外流wailiu +外貌waimao +外贸waimao +外面waimian +外勤waiqin +歪曲waiqu +外商waishang +外伤waishang +外设waishe +外省waisheng +外甥waisheng +外事waishi +外围waiwei +外文waiwen +外线waixian +外销waixiao +歪斜waixie +外延waiyan +外因waiyin +外语waiyu +外援waiyuan +外在waizai +外债waizhai +外资waizi +瓦解wajie +挖掘wajue +挖苦waku +瓦砾wali +完wan +万wan +晚wan +弯wan +碗wan +顽wan +湾wan +挽wan +玩wan +蔓*wan +娩*wan +豌wan +丸wan +烷wan +皖wan +惋wan +宛wan +婉wan +腕wan +剜wan +芄wan +莞*wan +菀wan +纨wan +绾wan +琬wan +脘wan +畹wan +蜿wan +万般wanban +晚报wanbao +完备wanbei +完毕wanbi +完成wancheng +万代wandai +顽敌wandi +万吨wandun +万恶wane +万分wanfen +往wang +王wang +望wang +网wang +忘wang +妄wang +亡wang +旺wang +芒*wang +汪wang +枉wang +罔wang +尢wang +惘wang +辋wang +魍wang +往常wangchang +王朝wangchao +忘掉wangdiao +妄动wangdong +枉法wangfa +往返wangfan +枉费wangfei +往复wangfu +王国wangguo +亡国wangguo +往后wanghou +忘怀wanghuai +忘记wangji +旺季wangji +往来wanglai +网络wangluo +亡命wangming +往年wangnian +完工wangong +忘却wangque +枉然wangran +惘然wangran +往日wangri +旺盛wangsheng +往事wangshi +妄图wangtu +万古wangu +顽固wangu +往往wangwang +汪汪wangwang +忘我wangwo +往昔wangxi +妄想wangxiang +汪洋wangyang +望远wangyuan +王子wangzi +完好wanhao +晚会wanhui +挽回wanhui +晚婚wanhun +晚间wanjian +完结wanjie +挽救wanjiu +玩具wanju +顽抗wankang +完了wanle +挽力wanli +弯路wanlu +完美wanmei +万能wanneng +万年wannian +晚年wannian +玩弄wannong +晚期wanqi +顽强wanqiang +弯曲wanqu +完全wanquan +完善wanshan +晚上wanshang +玩赏wanshang +万事wanshi +万世wanshi +玩耍wanshua +万岁wansui +万万wanwan +万物wanwu +晚霞wanxia +万象wanxiang +玩笑wanxiao +万幸wanxing +婉言wanyan +万一wanyi +万元wanyuan +完整wanzheng +顽症wanzheng +万众wanzhong +宛转wanzhuan +瓦斯wasi +瓦特wate +娃娃wawa +外部设备wbsb +微不足道wbzd +无产阶级wcjj +微处理机wclj +无产者wcz +为wei +位wei +委wei +围wei +维wei +唯wei +卫wei +微wei +伟wei +未wei +威wei +危wei +尾wei +谓wei +喂wei +味wei +胃wei +魏wei +伪wei +遗*wei +违wei +韦wei +畏wei +纬wei +巍wei +桅wei +惟wei +潍wei +苇wei +萎wei +蔚wei +渭wei +尉wei +慰wei +偎wei +诿wei +隈wei +隗*wei +圩*wei +葳wei +薇wei +囗wei +帏wei +帷wei +崴wei +嵬wei +猥wei +猬wei +闱wei +沩wei +洧wei +涠wei +逶wei +娓wei +玮wei +韪wei +軎wei +炜wei +煨wei +痿wei +艉wei +鲔wei +尾巴weiba +违背weibei +未必weibi +威逼weibi +微波weibo +微薄weibo +未曾weiceng +未尝weichang +维持weichi +为此weici +伟大weida +味道weidao +纬度weidu +唯独weidu +巍峨weie +违法weifa +违反weifan +违犯weifan +威风weifeng +桅杆weigan +微观weiguan +危害weihai +为何weihe +维护weihu +危及weiji +微机weiji +危机weiji +危急weiji +围歼weijian +围剿weijiao +慰藉weijie +违禁weijin +未经weijing +畏惧weiju +违抗weikang +未可weike +唯恐weikong +惟恐weikong +胃口weikou +未来weilai +慰劳weilao +为了weile +威力weili +委靡weimi +未免weimian +微妙weimiao +帷幕weimu +危难weinan +畏难weinan +未能weineng +委派weipai +为期weiqi +畏怯weiqie +委曲weiqu +委屈weiqu +未然weiran +巍然weiran +围绕weirao +伟人weiren +委任weiren +微弱weiruo +威慑weishe +为生weisheng +卫生weisheng +尾声weisheng +卫士weishi +威势weishi +为首weishou +为数weishu +尾随weisui +未遂weisui +畏缩weisuo +萎缩weisuo +猥琐weisuo +委托weituo +委婉weiwan +危亡weiwang +巍巍weiwei +慰问weiwen +唯物weiwu +威武weiwu +微细weixi +威吓weixia +危险weixian +微小weixiao +微笑weixiao +威协weixie +威胁weixie +猥亵weixie +维新weixin +唯心weixin +违心weixin +威信weixin +微型weixing +卫星weixing +维修weixiu +威严weiyan +伟业weiye +唯一weiyi +位移weiyi +位于weiyu +谓语weiyu +委员weiyuan +为止weizhi +位置weizhi +未知weizhi +为重weizhong +为主weizhu +伪装weizhuang +问wen +温wen +文wen +稳wen +纹wen +闻wen +蚊wen +瘟wen +吻wen +紊wen +刎wen +阌wen +汶wen +璺wen +雯wen +文本wenben +瘟病wenbing +稳步wenbu +问答wenda +稳定wending +温度wendu +嗡weng +翁weng +瓮weng +蓊weng +蕹weng +稳固wengu +问好wenhao +温和wenhe +吻合wenhe +文化wenhua +文件wenjian +稳健wenjian +问津wenjin +文静wenjing +文具wenju +文科wenke +文盲wenmang +文明wenming +闻名wenming +温暖wennuan +文凭wenping +文人wenren +温柔wenrou +问世wenshi +文坛wentan +问题wenti +文体wenti +稳妥wentuo +文物wenwu +文献wenxian +文选wenxuan +文学wenxue +问讯wenxun +闻讯wenxun +文艺wenyi +瘟疫wenyi +文娱wenyu +文摘wenzhai +文章wenzhang +稳重wenzhong +文字wenzi +问罪wenzui +望而生畏wesw +闻风而动wfed +违法乱纪wflj +歪风邪气wfxq +温故知新wgzx +文化部whb +文汇报whb +文化馆whg +文化宫whg +武汉市whs +五湖四海whsh +忘乎所以whsy +问寒问暖whwn +文化娱乐whyl +玩忽职守whzs +外交部wjb +无纪律wjl +五讲四美wjsm +无拘无束wjws +无可奉告wkfg +无可非议wkfy +无可奈何wknh +乌鲁木齐wlmq +无理取闹wlqn +无论如何wlrh +物美价廉wmjl +误码率wml +文明礼貌wmlm +无名英雄wmyx +无能为力wnwl +我wo +握wo +窝wo +蜗wo +涡wo +沃wo +挝wo +卧wo +斡wo +倭wo +莴wo +喔wo +幄wo +渥wo +肟wo +硪wo +龌wo +窝藏wocang +卧床wochuang +我党wodang +卧倒wodao +我的wode +窝工wogong +我国woguo +我军wojun +我们women +窝囊wonang +我省wosheng +我校woxiao +为期不远wqby +无穷无尽wqwj +误入歧途wrqt +卫生部wsb +纹丝不动wsbd +万事大吉wsdj +万事俱备wsjb +为什么wsm +无所谓wsw +为所欲为wsyw +无所作为wszw +无wu +五wu +物wu +武wu +务wu +误wu +伍wu +舞wu +污wu +悟wu +雾wu +午wu +恶*wu +屋wu +乌wu +吴wu +亡*wu +诬wu +钨wu +巫wu +呜wu +芜wu +梧wu +吾wu +毋wu +捂wu +侮wu +坞wu +戊wu +晤wu +勿wu +兀wu +仵wu +阢wu +邬wu +圬wu +芴wu +唔wu +庑wu +怃wu +忤wu +浯wu +寤wu +迕wu +妩wu +婺wu +骛wu +杌wu +牾wu +於*wu +焐wu +鹉wu +鹜wu +痦wu +蜈wu +鋈wu +鼯wu +吾辈wubei +无比wubi +五笔wubi +务必wubi +舞弊wubi +无边wubian +无不wubu +五彩wucai +误差wucha +无常wuchang +无偿wuchang +舞场wuchang +武昌wuchang +无耻wuchi +无从wucong +武打wuda +舞蹈wudao +无敌wudi +舞动wudong +武斗wudou +武断wuduan +无法wufa +无妨wufang +无非wufei +武功wugong +污垢wugou +无故wugu +无关wuguan +五官wuguan +武官wuguan +无害wuhai +诬害wuhai +武汉wuhan +无何wuhe +乌黑wuhei +五湖wuhu +呜呼wuhu +误会wuhui +舞会wuhui +污秽wuhui +无及wuji +无机wuji +物价wujia +无间wujian +物件wujian +误解wujie +五届wujie +五金wujin +无愧wukui +无赖wulai +诬赖wulai +无理wuli +物理wuli +无礼wuli +物力wuli +武力wuli +无聊wuliao +无虑wulu +无论wulun +污蔑wumie +诬蔑wumie +无奈wunai +无能wuneng +毋宁wuning +务农wunong +物品wupin +无期wuqi +五七wuqi +武器wuqi +无情wuqing +无穷wuqiong +舞曲wuqu +无权wuquan +污染wuran +无任wuren +污辱wuru +侮辱wuru +物色wuse +无上wushang +误伤wushang +无声wusheng +午时wushi +务使wushi +无视wushi +误事wushi +务实wushi +无数wushu +武术wushu +无双wushuang +午睡wushui +五四wusi +无私wusi +舞台wutai +无题wuti +物体wuti +舞厅wuting +无为wuwei +无谓wuwei +无物wuwu +无暇wuxia +无限wuxian +诬陷wuxian +无效wuxiao +五星wuxing +午休wuxiu +无须wuxu +无需wuxu +务虚wuxu +午夜wuye +五一wuyi +无益wuyi +无疑wuyi +无垠wuyin +无用wuyong +毋庸wuyong +无余wuyu +无缘wuyuan +五月wuyue +物证wuzheng +无知wuzhi +物质wuzhi +武装wuzhuang +物资wuzi +兀自wuzi +误字wuzi +无罪wuzui +无微不至wwbz +唯物论wwl +卧薪尝胆wxcd +无线电wxd +微型机wxj +唯心论wxl +问心无愧wxwk +委员会wyh +无缘无故wywg +委员长wyz +误字率wzl +无足轻重wzqz +未知数wzs +完整无缺wzwq +学x +下x +行x +小x +线x +性x +新x +些x +想x +心x +向x +相x +系x +席x +现x +西x +修x +象x +先x +形x +心安理得xald +西安市xas +西半球xbq +相比之下xbzx +宣传部xcb +新陈代谢xcdx +新产品xcp +畜产品xcp +西城区xcq +喜出望外xcww +相对而言xdey +现代化xdh +想当然xdr +相对误差xdwc +先睹为快xdwk +形而上学xesx +显而易见xeyj +西方国家xfgj +消费品xfp +想方设法xfsf +先发制人xfzr +兴高采烈xgcl +新华社xhs +新华书店xhsd +系xi +席xi +西xi +习xi +细xi +吸xi +析xi +喜xi +洗xi +铣xi +稀xi +戏xi +隙xi +希xi +息xi +袭xi +锡xi +烯xi +牺xi +悉xi +惜xi +溪xi +腊*xi +栖*xi +昔xi +熙xi +硒xi +矽xi +晰xi +嘻xi +膝xi +夕xi +熄xi +汐xi +犀xi +檄xi +媳xi +僖xi +兮xi +隰xi +郗xi +茜*xi +菥xi +葸xi +蓰xi +奚xi +唏xi +徙xi +饩xi +阋xi +浠xi +淅xi +屣xi +嬉xi +玺xi +樨xi +曦xi +觋xi +欷xi +歙*xi +熹xi +禊xi +禧xi +皙xi +穸xi +裼*xi +蜥xi +螅xi +蟋xi +舄xi +舾xi +羲xi +粞xi +翕xi +醯xi +蹊*xi +鼷xi +下xia +夏xia +吓xia +狭xia +霞xia +唬*xia +瞎xia +虾xia +匣xia +辖xia +暇xia +峡xia +侠xia +厦xia +呷xia +狎xia +遐xia +瑕xia +柙xia +硖xia +瘕*xia +罅xia +黠xia +狭隘xiaai +下班xiaban +下辈xiabei +下边xiabian +下策xiace +下层xiaceng +下场xiachang +下沉xiachen +下次xiaci +瑕疵xiaci +下达xiada +吓倒xiadao +下等xiadeng +下毒xiadu +下发xiafa +下放xiafang +峡谷xiagu +霞光xiaguang +瞎话xiahua +喜爱xiai +下级xiaji +下集xiaji +夏季xiaji +下降xiajiang +侠客xiake +下来xialai +下联xialian +夏粮xialiang +下列xialie +下令xialing +下流xialiu +下落xialuo +下马xiama +厦门xiamen +下面xiamian +线xian +现xian +先xian +县xian +限xian +见*xian +显xian +鲜xian +献xian +险xian +陷xian +宪xian +纤xian +洗*xian +掀xian +弦xian +铣*xian +腺xian +锨xian +仙xian +咸xian +贤xian +衔xian +舷xian +闲xian +涎xian +嫌xian +馅xian +羡xian +冼xian +苋xian +莶xian +藓xian +岘xian +猃xian +暹xian +娴xian +氙xian +燹xian +祆xian +鹇xian +痫xian +蚬xian +筅xian +籼xian +酰xian +跣xian +跹xian +霰xian +西安xian +献宝xianbao +先辈xianbei +现场xianchang +现成xiancheng +县城xiancheng +献丑xianchou +献词xianci +现存xiancun +现代xiandai +先导xiandao +显得xiande +险地xiandi +限定xianding +限度xiandu +线段xianduan +限额xiane +险恶xiane +宪法xianfa +先锋xianfeng +险峰xianfeng +想xiang +向xiang +相xiang +象xiang +响xiang +项xiang +箱xiang +乡xiang +降*xiang +香xiang +像xiang +详xiang +橡xiang +享xiang +湘xiang +厢xiang +镶xiang +襄xiang +翔xiang +祥xiang +巷xiang +芗xiang +葙xiang +饷xiang +庠xiang +骧xiang +缃xiang +蟓xiang +鲞xiang +飨xiang +相爱xiangai +相比xiangbi +想必xiangbi +相差xiangcha +相称xiangcheng +相处xiangchu +相传xiangchuan +乡村xiangcun +相当xiangdang +向导xiangdao +相等xiangdeng +相对xiangdui +想法xiangfa +相反xiangfan +相仿xiangfang +相干xianggan +香港xianggang +相隔xiangge +相关xiangguan +相好xianghao +相互xianghu +相继xiangji +相加xiangjia +相见xiangjian +相减xiangjian +相交xiangjiao +橡胶xiangjiao +相近xiangjin +详尽xiangjin +巷口xiangkou +向来xianglai +相连xianglian +向量xiangliang +响亮xiangliang +相貌xiangmao +项目xiangmu +想念xiangnian +相片xiangpian +想起xiangqi +详情xiangqing +向上xiangshang +相声xiangsheng +响声xiangsheng +相识xiangshi +翔实xiangshi +享受xiangshou +相思xiangsi +相似xiangsi +香甜xiangtian +相同xiangtong +相投xiangtou +显贵xiangui +向往xiangwang +详细xiangxi +向下xiangxia +乡下xiangxia +象限xiangxian +想象xiangxiang +相信xiangxin +香烟xiangyan +相依xiangyi +相宜xiangyi +相应xiangying +相映xiangying +响应xiangying +享用xiangyong +相遇xiangyu +相约xiangyue +乡镇xiangzhen +象征xiangzheng +箱子xiangzi +陷害xianhai +显赫xianhe +鲜红xianhong +先后xianhou +鲜花xianhua +献花xianhua +闲话xianhua +贤惠xianhui +献计xianji +献技xianji +显见xianjian +衔接xianjie +先进xianjin +现金xianjin +险境xianjing +陷阱xianjing +现款xiankuan +现况xiankuang +先例xianli +献礼xianli +先烈xianlie +线路xianlu +显露xianlu +鲜美xianmei +鲜明xianming +贤明xianming +显目xianmu +羡慕xianmu +贤能xianneng +先期xianqi +掀起xianqi +限期xianqi +嫌弃xianqi +先前xianqian +先遣xianqian +险情xianqing +先驱xianqu +显然xianran +贤人xianren +闲人xianren +现任xianren +陷入xianru +闲散xiansan +献身xianshen +先生xiansheng +先是xianshi +现实xianshi +显示xianshi +娴熟xianshu +线索xiansuo +闲谈xiantan +险滩xiantan +先天xiantian +线条xiantiao +县委xianwei +纤维xianwei +显现xianxian +现象xianxiang +现行xianxing +鲜血xianxue +显眼xianyan +鲜艳xianyan +显要xianyao +险要xianyao +显耀xianyao +现役xianyi +嫌疑xianyi +现有xianyou +限于xianyu +闲杂xianza +现在xianzai +县长xianzhang +宪章xianzhang +限制xianzhi +先知xianzhi +闲置xianzhi +闲职xianzhi +显著xianzhu +现状xianzhuang +险阻xianzu +小xiao +消xiao +削xiao +效xiao +笑xiao +校xiao +销xiao +硝xiao +萧xiao +肖xiao +孝xiao +霄xiao +哮xiao +嚣xiao +宵xiao +淆xiao +晓xiao +啸xiao +哓xiao +崤xiao +潇xiao +逍xiao +骁xiao +绡xiao +枭xiao +枵xiao +蛸*xiao +筱xiao +箫xiao +魈xiao +小报xiaobao +小辈xiaobei +笑柄xiaobing +消沉xiaochen +消除xiaochu +消毒xiaodu +效法xiaofa +小贩xiaofan +消防xiaofang +消费xiaofei +校风xiaofeng +小鬼xiaogui +效果xiaoguo +小孩xiaohai +消耗xiaohao +消化xiaohua +笑话xiaohua +小惠xiaohui +销毁xiaohui +销魂xiaohun +消极xiaoji +削减xiaojian +小结xiaojie +小姐xiaojie +孝敬xiaojing +校刊xiaokan +小康xiaokang +效劳xiaolao +效力xiaoli +销路xiaolu +效率xiaolu +消灭xiaomie +消磨xiaomo +效能xiaoneng +消气xiaoqi +消遣xiaoqian +笑容xiaorong +削弱xiaoruo +潇洒xiaosa +校舍xiaoshe +小时xiaoshi +消失xiaoshi +消逝xiaoshi +消瘦xiaoshou +销售xiaoshou +小数xiaoshu +小说xiaoshuo +萧条xiaotiao +消息xiaoxi +肖像xiaoxiang +小心xiaoxin +枭雄xiaoxiong +小学xiaoxue +效验xiaoyan +逍遥xiaoyao +效益xiaoyi +效应xiaoying +校友xiaoyou +小于xiaoyu +校园xiaoyuan +销赃xiaozang +校长xiaozhang +嚣张xiaozhang +效忠xiaozhong +小组xiaozu +下情xiaqing +下去xiaqu +辖区xiaqu +下手xiashou +夏收xiashou +下属xiashu +下水xiashui +下台xiatai +夏天xiatian +下文xiawen +下午xiawu +下限xiaxian +下乡xiaxiang +遐想xiaxiang +狭义xiayi +下游xiayou +狭窄xiazhai +夏至xiazhi +夏种xiazhong +喜报xibao +细胞xibao +西北xibei +西边xibian +稀薄xibo +锡箔xibo +西餐xican +洗涤xidi +吸毒xidu +些xie +解*xie +写xie +斜xie +谢xie +协xie +械xie +叶*xie +血*xie +卸xie +屑xie +鞋xie +歇xie +邪xie +胁xie +蟹xie +泄xie +泻xie +契*xie +楔xie +蝎xie +挟xie +携xie +谐xie +懈xie +偕xie +亵xie +勰xie +燮xie +薤xie +撷xie +獬xie +廨xie +渫xie +瀣xie +邂xie +绁xie +缬xie +榭xie +榍xie +颉*xie +躞xie +写出xiechu +协从xiecong +携带xiedai +邪道xiedao +协调xiediao +协定xieding +亵渎xiedu +邪恶xiee +协和xiehe +谐和xiehe +协会xiehui +谢绝xiejue +协力xieli +泄漏xielou +邪路xielu +泄露xielu +泄密xiemi +邪念xienian +胁迫xiepo +邪气xieqi +协商xieshang +写生xiesheng +携手xieshou +邪说xieshuo +协同xietong +歇息xiexi +谢谢xiexie +协议xieyi +谐音xieyin +协约xieyue +写照xiezhao +协助xiezhu +鞋子xiezi +写作xiezuo +协作xiezuo +西方xifang +西风xifeng +西服xifu +吸附xifu +媳妇xifu +习惯xiguan +西汉xihan +稀罕xihan +希罕xihan +喜欢xihuan +袭击xiji +细节xijie +洗劫xijie +喜剧xiju +戏剧xiju +席卷xijuan +细菌xijun +犀利xili +系列xilie +奚落xiluo +熄灭ximie +新xin +心xin +信xin +锌xin +芯xin +辛xin +寻*xin +欣xin +薪xin +忻xin +衅xin +囟xin +馨xin +昕xin +歆xin +镡*xin +鑫xin +心爱xinai +西南xinan +新春xinchun +信贷xindai +心得xinde +心烦xinfan +心服xinfu +信服xinfu +行xing +性xing +形xing +型xing +星xing +兴xing +省*xing +醒xing +姓xing +幸xing +腥xing +猩xing +惺xing +刑xing +邢xing +杏xing +陉xing +荇xing +荥xing +擤xing +饧xing +悻xing +硎xing +心甘xingan +兴办xingban +性别xingbie +姓别xingbie +刑场xingchang +星辰xingchen +形成xingcheng +行程xingcheng +行动xingdong +幸而xinger +刑法xingfa +刑罚xingfa +兴奋xingfen +幸福xingfu +性格xingge +幸好xinghao +型号xinghao +行贿xinghui +星火xinghuo +性急xingji +形迹xingji +兴建xingjian +行径xingjing +行军xingjun +星空xingkong +幸亏xingkui +行李xingli +行旅xinglu +幸免xingmian +性命xingming +姓名xingming +醒目xingmu +性能xingneng +行期xingqi +兴起xingqi +星期xingqi +性情xingqing +星球xingqiu +兴趣xingqu +形容xingrong +行商xingshang +兴盛xingsheng +行使xingshi +行事xingshi +行驶xingshi +形式xingshi +幸事xingshi +刑事xingshi +形势xingshi +姓氏xingshi +行署xingshu +兴衰xingshuai +形态xingtai +形体xingti +兴亡xingwang +兴旺xingwang +行为xingwei +行文xingwen +醒悟xingwu +形象xingxiang +行销xingxiao +星星xingxing +行凶xingxiong +兴修xingxiu +行业xingye +星夜xingye +幸运xingyun +行政xingzheng +性质xingzhi +兴致xingzhi +形状xingzhuang +行走xingzou +信号xinhao +心狠xinhen +心慌xinhuang +信汇xinhui +细腻xini +西宁xining +心急xinji +信件xinjian +新疆xinjiang +新近xinjin +新居xinju +心坎xinkan +辛苦xinku +信赖xinlai +辛劳xinlao +心理xinli +心里xinli +心灵xinling +心目xinmu +信念xinnian +戏弄xinong +新奇xinqi +辛勤xinqin +心情xinqing +新区xinqu +新人xinren +信任xinren +欣赏xinshang +新生xinsheng +心声xinsheng +新事xinshi +新式xinshi +新书xinshu +薪水xinshui +心酸xinsuan +辛酸xinsuan +心疼xinteng +心田xintian +心跳xintiao +心头xintou +欣慰xinwei +新闻xinwen +心细xinxi +信息xinxi +欣喜xinxi +新鲜xinxian +心想xinxiang +信箱xinxiang +馨香xinxiang +信心xinxin +新型xinxing +新星xinxing +新兴xinxing +心虚xinxu +心血xinxue +信仰xinyang +心意xinyi +新异xinyi +新颖xinying +信用xinyong +新余xinyu +信誉xinyu +心愿xinyuan +心脏xinzang +新址xinzhi +心中xinzhong +雄xiong +胸xiong +兄xiong +凶xiong +熊xiong +匈xiong +汹xiong +芎xiong +雄辩xiongbian +雄兵xiongbing +凶残xiongcan +兄弟xiongdi +凶恶xionge +雄关xiongguan +凶狠xionghen +雄厚xionghou +胸怀xionghuai +雄健xiongjian +胸口xiongkou +熊猫xiongmao +凶猛xiongmeng +匈奴xiongnu +凶器xiongqi +凶杀xiongsha +雄师xiongshi +凶手xiongshou +胸膛xiongtang +雄伟xiongwei +雄心xiongxin +汹涌xiongyong +雄壮xiongzhuang +雄姿xiongzi +西欧xiou +习气xiqi +吸气xiqi +喜气xiqi +稀奇xiqi +希奇xiqi +喜庆xiqing +吸取xiqu +戏曲xiqu +昔日xiri +牺牲xisheng +西式xishi +喜事xishi +稀释xishi +吸收xishou +系数xishu +洗刷xishua +吸吮xishun +习俗xisu +习题xiti +西天xitian +系统xitong +修xiu +锈xiu +休xiu +袖xiu +秀xiu +朽xiu +宿*xiu +臭*xiu +羞xiu +嗅xiu +绣xiu +咻xiu +岫xiu +馐xiu +庥xiu +溴xiu +鸺xiu +貅xiu +髹xiu +修补xiubu +秀才xiucai +羞耻xiuchi +修辞xiuci +修订xiuding +修复xiufu +修改xiugai +修建xiujian +修剪xiujian +嗅觉xiujue +休克xiuke +羞愧xiukui +修理xiuli +秀丽xiuli +秀气xiuqi +羞辱xiuru +羞涩xiuse +修饰xiushi +休息xiuxi +休想xiuxiang +修养xiuyang +休养xiuyang +修造xiuzao +袖章xiuzhang +袖珍xiuzhen +修正xiuzheng +修筑xiuzhu +希望xiwang +席位xiwei +细微xiwei +西文xiwen +檄文xiwen +细小xixiao +细心xixin +悉心xixin +喜讯xixun +吸烟xiyan +西洋xiyang +西医xiyi +吸引xiyin +希有xiyou +戏院xiyuan +喜悦xiyue +西藏xizang +洗澡xizao +细则xize +细致xizhi +习作xizuo +下基层xjc +现阶段xjd +新技术xjs +献计献策xjxc +先见之明xjzm +兴利除弊xlcb +系列化xlh +稀里糊涂xlht +狭路相逢xlxf +畜牧业xmy +心满意足xmyz +西宁市xns +小朋友xpy +向前看xqk +喜气洋洋xqyy +先人后己xrhj +兴师动众xsdz +销售额xse +刑事犯罪xsfz +小时候xsh +新时期xsq +新生事物xssw +形式主义xszy +相提并论xtbl +续xu +许xu +须xu +需xu +序xu +虚xu +絮xu +畜xu +叙xu +蓄xu +绪xu +徐xu +墟xu +戌xu +嘘xu +酗xu +旭xu +恤xu +婿xu +吁*xu +诩xu +勖xu +圩xu +蓿xu +洫xu +浒*xu +溆xu +顼xu +栩xu +煦xu +砉*xu +盱xu +胥xu +糈xu +醑xu +选xuan +旋xuan +宣xuan +悬xuan +玄xuan +券*xuan +轩xuan +喧xuan +癣xuan +眩xuan +绚xuan +儇xuan +谖xuan +萱xuan +揎xuan +泫xuan +渲xuan +漩xuan +璇xuan +楦xuan +暄xuan +炫xuan +煊xuan +碹xuan +铉xuan +镟xuan +痃xuan +悬案xuanan +轩昂xuanang +选拔xuanba +宣布xuanbu +选材xuancai +选场xuanchang +宣称xuancheng +宣传xuanchuan +选定xuanding +宣读xuandu +宣告xuangao +选购xuangou +悬挂xuangua +玄乎xuanhu +喧哗xuanhua +选集xuanji +宣讲xuanjiang +选举xuanju +绚烂xuanlan +绚丽xuanli +选录xuanlu +旋律xuanlu +选民xuanmin +喧闹xuannao +悬念xuannian +选派xuanpai +宣判xuanpan +选配xuanpei +选票xuanpiao +选区xuanqu +选取xuanqu +喧嚷xuanrang +宣誓xuanshi +选手xuanshou +悬殊xuanshu +旋涡xuanwo +玄虚xuanxu +悬崖xuanya +宣言xuanyan +宣扬xuanyang +炫耀xuanyao +选用xuanyong +选择xuanze +宣战xuanzhan +选种xuanzhong +旋转xuanzhuan +许多xuduo +学xue +血xue +削*xue +雪xue +穴xue +靴xue +薛xue +谑xue +噱*xue +泶xue +踅xue +鳕xue +学报xuebao +学部xuebu +学潮xuechao +学费xuefei +学风xuefeng +学府xuefu +血汗xuehan +学好xuehao +学会xuehui +学籍xueji +血迹xueji +学科xueke +血泪xuelei +学历xueli +学龄xueling +学年xuenian +学派xuepai +学期xueqi +血肉xuerou +学生xuesheng +学时xueshi +学识xueshi +学士xueshi +学术xueshu +血书xueshu +学说xueshuo +血统xuetong +学徒xuetu +学位xuewei +学问xuewen +学习xuexi +血洗xuexi +学校xuexiao +血压xueya +学业xueye +血液xueye +学友xueyou +学员xueyuan +学院xueyuan +血晕xueyun +血战xuezhan +学者xuezhe +学制xuezhi +虚构xugou +序号xuhao +蓄积xuji +虚假xujia +叙旧xujiu +许可xuke +序列xulie +绪论xulun +虚名xuming +序幕xumu +畜牧xumu +训xun +旬xun +迅xun +讯xun +寻xun +循xun +巡xun +荤*xun +浚*xun +勋xun +熏xun +询xun +驯xun +殉xun +汛xun +逊xun +巽xun +郇*xun +埙xun +荀xun +蕈xun +薰xun +峋xun +徇xun +獯xun +恂xun +洵xun +浔xun +曛xun +窨*xun +醺xun +鲟xun +巡捕xunbu +巡查xuncha +寻常xunchang +驯服xunfu +殉国xunguo +巡航xunhang +循环xunhuan +巡回xunhui +虚拟xuni +寻机xunji +巡警xunjing +勋爵xunjue +训练xunlian +巡逻xunluo +迅猛xunmeng +寻求xunqiu +逊色xunse +巡视xunshi +徇私xunsi +迅速xunsu +熏陶xuntao +许诺xunuo +讯问xunwen +询问xunwen +寻衅xunxin +循序xunxu +勋章xunzhang +寻找xunzhao +殉职xunzhi +寻址xunzhi +需求xuqiu +序曲xuqu +虚荣xurong +虚弱xuruo +虚设xushe +叙事xushi +虚实xushi +序数xushu +虚数xushu +叙述xushu +叙说xushuo +虚伪xuwei +虚心xuxin +序言xuyan +需要xuyao +须臾xuyu +许愿xuyuan +须知xuzhi +宣武区xwq +信息处理xxcl +循序见进xxjj +辛辛苦苦xxkk +信息量xxl +熙熙攘攘xxrr +小学生xxs +欣欣向荣xxxr +小心翼翼xxyy +下一步xyb +胸有成竹xycz +洗衣机xyj +小意思xys +习以为常xywc +新颖性xyx +兴致勃勃xzbb +新中国xzg +行政区域xzqy +雪中送炭xzst +心中无数xzws +选择性xzx +心中有数xzys +行之有效xzyx +一y +有y +用y +要y +以y +于y +也y +样y +义y +与y +由y +压y +员y +月y +意y +又y +运y +原y +油y +验y +压ya +亚ya +呀ya +牙ya +芽ya +雅ya +蚜ya +鸭ya +匹*ya +押ya +鸦ya +丫ya +崖ya +衙ya +涯ya +哑ya +讶ya +伢ya +垭ya +揠ya +岈ya +迓ya +娅ya +琊ya +桠ya +氩ya +砑ya +睚ya +痖ya +哑巴yaba +牙齿yachi +压倒yadao +压服yafu +牙关yaguan +雅观yaguan +压价yajia +押金yajin +亚军yajun +压力yali +验yan +研yan +严yan +眼yan +言yan +盐yan +演yan +岩yan +沿yan +烟yan +延yan +掩yan +宴yan +炎yan +颜yan +燕yan +衍yan +铅*yan +焉yan +咽yan +阉yan +淹yan +蜒yan +阎yan +奄yan +艳yan +堰yan +厌yan +砚yan +雁yan +唁yan +彦yan +焰yan +谚yan +殷*yan +厣yan +赝yan +剡*yan +俨yan +偃yan +兖yan +谳yan +阽*yan +郾yan +鄢yan +芫*yan +菸yan +崦yan +恹yan +闫yan +阏yan +湮yan +滟yan +妍yan +嫣yan +琰yan +檐yan +晏yan +胭yan +腌*yan +焱yan +罨yan +筵yan +酽yan +魇yan +餍yan +鼹yan +沿岸yanan +严办yanban +掩蔽yanbi +演变yanbian +烟草yancao +延长yanchang +演唱yanchang +严惩yancheng +延迟yanchi +演出yanchu +唁电yandian +严冬yandong +厌恶yane +厌烦yanfan +样yang +养yang +氧yang +扬yang +洋yang +阳yang +羊yang +秧yang +央yang +杨yang +仰yang +殃yang +鸯yang +佯yang +疡yang +痒yang +漾yang +徉yang +怏yang +泱yang +炀yang +烊yang +恙yang +蛘yang +鞅yang +掩盖yangai +样板yangban +样本yangben +洋财yangcai +养成yangcheng +沿革yange +严格yange +阳光yangguang +洋行yanghang +养护yanghu +氧化yanghua +养料yangliao +杨柳yangliu +仰面yangmian +殃民yangmin +仰慕yangmu +样品yangpin +洋气yangqi +扬弃yangqi +央求yangqiu +养伤yangshang +样式yangshi +阳台yangtai +眼光yanguang +仰望yangwang +洋务yangwu +洋相yangxiang +扬言yangyan +样样yangyang +洋溢yangyi +养育yangyu +养殖yangzhi +样子yangzi +沿海yanhai +严寒yanhan +眼红yanhong +咽喉yanhou +掩护yanhu +眼花yanhua +延缓yanhuan +宴会yanhui +焰火yanhuo +演讲yanjiang +眼界yanjie +严禁yanjin +严谨yanjin +眼镜yanjing +眼睛yanjing +研究yanjiu +严峻yanjun +眼看yankan +严酷yanku +眼眶yankuang +眼泪yanlei +眼力yanli +严厉yanli +艳丽yanli +眼帘yanlian +眼亮yanliang +言路yanlu +沿路yanlu +言论yanlun +掩埋yanmai +严密yanmi +严明yanming +烟幕yanmu +延年yannian +延期yanqi +眼前yanqian +宴请yanqing +俨然yanran +炎热yanre +眼色yanse +颜色yanse +延伸yanshen +岩石yanshi +演示yanshi +掩饰yanshi +验收yanshou +严守yanshou +延寿yanshou +演说yanshuo +严肃yansu +演算yansuan +言谈yantan +研讨yantao +沿途yantu +阎王yanwang +延误yanwu +烟雾yanwu +宴席yanxi +筵席yanxi +演习yanxi +沿袭yanxi +眼下yanxia +沿线yanxian +言行yanxing +严刑yanxing +延续yanxu +艳阳yanyang +演义yanyi +演绎yanyi +掩映yanying +沿用yanyong +言语yanyu +演员yanyuan +厌战yanzhan +沿着yanzhe +验证yanzheng +研制yanzhi +严重yanzhong +演奏yanzou +要yao +药yao +约*yao +摇yao +腰yao +咬yao +邀yao +耀yao +陶*yao +侥*yao +疟yao +妖yao +瑶yao +尧yao +遥yao +窑yao +谣yao +姚yao +舀yao +钥*yao +夭yao +爻yao +吆yao +崾yao +徭yao +幺yao +珧yao +杳yao +轺yao +曜yao +肴yao +铫*yao +鹞yao +窈yao +繇yao +鳐yao +摇摆yaobai +腰包yaobao +要不yaobu +谣传yaochuan +要得yaode +要点yaodian +摇动yaodong +窑洞yaodong +遥感yaogan +妖怪yaoguai +要害yaohai +摇撼yaohan +摇晃yaohuang +要件yaojian +要紧yaojin +摇控yaokong +遥控yaokong +摇篮yaolan +要领yaoling +要么yaome +妖魔yaomo +要目yaomu +邀请yaoqing +要求yaoqiu +要塞yaosai +要是yaoshi +钥匙yaoshi +要素yaosu +窈窕yaotiao +摇头yaotou +要闻yaowen +药物yaowu +要挟yaoxie +耀眼yaoyan +谣言yaoyan +妖艳yaoyan +夭折yaozhe +要职yaozhi +鸦片yapian +压迫yapo +压强yaqiang +压缩yasuo +雅兴yaxing +压仰yayang +压抑yayi +压榨yazha +压制yazhi +雅致yazhi +亚洲yazhou +鸭子yazi +雅座yazuo +要不得ybd +一般的说ybds +一部分ybf +要不然ybr +要不是ybs +一般说来ybsl +要不要yby +一辈子ybz +一把抓ybz +用不着ybz +扬长避短ycbd +由此可见yckj +银川市ycs +与此同时ycts +有偿转让yczr +邮电部ydb +有道德ydd +邮电局ydj +一刀切ydq +运动员ydy +印度洋ydy +因地制宜ydzy +也ye +业ye +页ye +叶ye +液ye +夜ye +野ye +爷ye +冶ye +邪*ye +哗*ye +咽*ye +椰ye +噎ye +耶ye +掖ye +曳ye +腋ye +拽*ye +靥ye +谒ye +邺ye +揶ye +晔ye +烨ye +铘ye +夜餐yecan +野餐yecan +野火yehuo +业绩yeji +夜间yejian +冶金yejin +夜里yeli +冶练yelian +野蛮yeman +夜幕yemu +夜色yese +也是yeshi +夜市yeshi +野兽yeshou +液体yeti +野外yewai +夜晚yewan +业务yewu +夜校yexiao +野心yexin +野性yexing +也许yexu +幼儿园yey +爷爷yeye +野营yeying +业余yeyu +野战yezhan +叶子yezi +一方面yfm +一分为二yfwe +阳奉阴违yfyw +一概而论ygel +一国两制yglz +有根有据ygyj +严格要求ygyq +有何特长yhtc +银行帐号yhzh +炎黄子孙yhzs +一yi +以yi +义yi +意yi +已yi +移yi +医yi +议yi +依yi +易yi +乙yi +艺yi +益yi +异yi +宜yi +仪yi +亿yi +遗yi +伊yi +役yi +衣yi +疑yi +亦yi +谊yi +翼yi +译yi +抑yi +忆yi +疫yi +壹yi +揖yi +铱yi +颐yi +夷yi +胰yi +沂yi +姨yi +彝yi +椅yi +蚁yi +倚yi +矣yi +邑yi +屹yi +臆yi +逸yi +肄yi +裔yi +毅yi +溢yi +诣yi +翌yi +绎yi +刈yi +劓yi +仡*yi +佚yi +佾yi +诒yi +圯yi +埸yi +懿yi +苡yi +荑yi +薏yi +弈yi +奕yi +挹yi +弋yi +呓yi +咦yi +咿yi +嗌*yi +噫yi +峄yi +嶷yi +猗yi +饴yi +怿yi +怡yi +悒yi +漪yi +迤yi +驿yi +缢yi +殪yi +轶yi +贻yi +欹*yi +旖yi +熠yi +眙yi +钇yi +镒yi +镱yi +痍yi +瘗yi +癔yi +翊yi +蜴yi +舣yi +羿yi +翳yi +酏yi +黟yi +议案yian +疑案yian +一半yiban +一般yiban +一斑yiban +一边yibian +以便yibian +仪表yibiao +一并yibing +异步yibu +遗产yichan +异常yichang +议程yicheng +益处yichu +遗传yichuan +一次yici +依次yici +依从yicong +一代yidai +一带yidai +一旦yidan +一点yidian +一定yiding +议定yiding +移动yidong +一度yidu +遗毒yidu +一端yiduan +臆断yiduan +亿吨yidun +一发yifa +依法yifa +义愤yifen +衣服yifu +依附yifu +一概yigai +一个yige +一共yigong +议购yigou +已故yigu +一贯yiguan +异国yiguo +遗憾yihan +遗恨yihen +以后yihou +异化yihua +议会yihui +疑惑yihuo +以及yiji +异己yiji +遗迹yiji +议价yijia +意见yijian +移交yijiao +一届yijie +一经yijing +已经yijing +意境yijing +依旧yijiu +一举yiju +依据yiju +移居yiju +议决yijue +依靠yikao +倚靠yikao +一刻yike +医科yike +一块yikuai +以来yilai +依赖yilai +一览yilan +一例yili +毅力yili +屹立yili +一连yilian +意料yiliao +医疗yiliao +遗留yiliu +遗漏yilou +一律yilu +疑虑yilu +议论yilun +一面yimian +以免yimian +疫苗yimiao +移民yimin +因yin +引yin +阴yin +印yin +音yin +银yin +烟*yin +隐yin +饮yin +荫yin +茵yin +殷yin +姻yin +吟yin +淫yin +寅yin +尹yin +胤yin +鄞yin +圻*yin +垠yin +堙yin +茚yin +吲yin +喑yin +狺yin +夤yin +洇yin +湮*yin +氤yin +铟yin +瘾yin +窨yin +蚓yin +霪yin +龈yin +疑难yinan +阴暗yinan +隐蔽yinbi +音标yinbiao +隐藏yincang +阴沉yinchen +银川yinchuan +因此yinci +引导yindao +音调yindiao +印度yindu +引渡yindu +以内yinei +因而yiner +印发yinfa +音符yinfu +应ying +影ying +硬ying +营ying +英ying +映ying +迎ying +樱ying +婴ying +鹰ying +缨ying +莹ying +萤ying +荧ying +蝇ying +赢ying +盈ying +颖ying +嬴ying +郢ying +茔ying +荥*ying +莺ying +萦ying +蓥ying +撄ying +嘤ying +膺ying +滢ying +潆ying +瀛ying +瑛ying +璎ying +楹ying +媵ying +鹦ying +瘿ying +颍ying +罂ying +英镑yingbang +硬币yingbi +应变yingbian +映衬yingchen +应酬yingchou +迎春yingchun +应当yingdang +赢得yingde +婴儿yinger +营房yingfang +迎风yingfeng +应付yingfu +应该yinggai +英国yingguo +樱花yinghua +英魂yinghun +应急yingji +硬件yingjian +迎接yingjie +应届yingjie +英杰yingjie +营救yingjiu +英俊yingjun +盈亏yingkui +赢利yingli +盈利yingli +英烈yinglie +迎面yingmian +英明yingming +硬盘yingpan +影片yingpian +硬拼yingpin +影射yingshe +映射yingshe +樱桃yingtao +迎头yingtou +因果yinguo +影响yingxiang +硬性yingxing +英雄yingxiong +营养yingyang +应邀yingyao +营业yingye +应用yingyong +英勇yingyong +应有yingyou +英语yingyu +盈余yingyu +营造yingzao +应战yingzhan +迎战yingzhan +映照yingzhao +应征yingzheng +影子yingzi +英姿yingzi +银行yinhang +引号yinhao +殷红yinhong +隐患yinhuan +淫秽yinhui +阴魂yinhun +意念yinian +姨娘yiniang +阴极yinji +印鉴yinjian +引进yinjin +引力yinli +阴历yinli +阴凉yinliang +引路yinlu +隐瞒yinman +阴谋yinmou +银幕yinmu +隐慝yinni +银牌yinpai +引起yinqi +殷切yinqie +殷勤yinqin +引擎yinqing +引人yinren +饮食yinshi +印刷yinshua +饮水yinshui +因素yinsu +阴天yintian +引退yintui +因为yinwei +淫威yinwei +阴险yinxian +印象yinxiang +音响yinxiang +音信yinxin +因循yinxun +引言yinyan +阴影yinying +引用yinyong +引诱yinyou +阴雨yinyu +姻缘yinyuan +隐约yinyue +音乐yinyue +引证yinzheng +印证yinzheng +一片yipian +一瞥yipie +一起yiqi +一齐yiqi +义气yiqi +意气yiqi +仪器yiqi +遗弃yiqi +以前yiqian +一切yiqie +依然yiran +亦然yiran +毅然yiran +艺人yiren +宜人yiren +遗容yirong +以上yishang +一生yisheng +医生yisheng +一时yishi +一事yishi +意识yishi +议事yishi +逸事yishi +仪式yishi +医师yishi +医士yishi +遗失yishi +一手yishou +遗书yishu +艺术yishu +意思yisi +一体yiti +议题yiti +遗体yiti +一天yitian +一同yitong +异同yitong +一头yitou +意图yitu +疑团yituan +以外yiwai +意外yiwai +亿万yiwan +以往yiwang +遗忘yiwang +以为yiwei +意味yiwei +意文yiwen +疑问yiwen +译文yiwen +一无yiwu +义务yiwu +遗物yiwu +医务yiwu +贻误yiwu +一下yixia +以下yixia +一线yixian +一向yixiang +一项yixiang +意向yixiang +遗像yixiang +一些yixie +一心yixin +疑心yixin +异性yixing +医学yixue +一言yiyan +义演yiyan +遗言yiyan +一样yiyang +医药yiyao +意义yiyi +异议yiyi +义勇yiyong +易于yiyu +议员yiyuan +意愿yiyuan +医院yiyuan +亿元yiyuan +遗愿yiyuan +疑云yiyun +一再yizai +一早yizao +臆造yizao +依仗yizhang +仪仗yizhang +一朝yizhao +衣着yizhao +依照yizhao +一阵yizhen +一直yizhi +一致yizhi +以至yizhi +以致yizhi +意志yizhi +抑制yizhi +医治yizhi +抑止yizhi +移植yizhi +遗址yizhi +一种yizhong +遗嘱yizhu +研究会yjh +有纪律yjl +研究生yjs +研究所yjs +研究室yjs +养精畜锐yjxr +研究员yjy +拥军优属yjys +一技之长yjzc +一口气ykq +一览表ylb +以理服人ylfr +阅览室yls +有理想ylx +有利于yly +越来越yly +有目共睹ymgd +一目了然ymlr +有没有ymy +云南省yns +育*yo +哟yo +唷yo +用yong +勇yong +永yong +拥yong +涌yong +蛹yong +庸yong +佣yong +臃yong +痈yong +雍yong +踊yong +咏yong +泳yong +恿yong +俑yong +壅yong +墉yong +喁yong +慵yong +邕yong +镛yong +甬yong +鳙yong +饔yong +拥抱yongbao +永别yongbie +永不yongbu +用处yongchu +用度yongdu +用法yongfa +用费yongfei +勇敢yonggan +用功yonggong +永恒yongheng +用户yonghu +拥护yonghu +拥挤yongji +永久yongjiu +用具yongju +永诀yongjue +用力yongli +庸碌yonglu +勇猛yongmeng +用品yongpin +勇气yongqi +勇士yongshi +庸俗yongsu +咏叹yongtan +用途yongtu +涌现yongxian +用心yongxin +用意yongyi +拥有yongyou +用于yongyu +勇于yongyu +永远yongyuan +踊跃yongyue +有you +由you +又you +油you +右you +友you +优you +幼you +游you +尤you +诱you +犹you +幽you +悠you +忧you +邮you +铀you +酉you +佑you +釉you +卣you +攸you +侑you +莠you +莜you +莸you +尢*you +呦you +囿you +宥you +柚you +猷you +牖you +铕you +疣you +蚰you +蚴you +蝣you +蝤*you +繇*you +鱿you +黝you +鼬you +有碍youai +友爱youai +幽暗youan +友邦youbang +右边youbian +忧愁youchou +由此youci +有错youcuo +有待youdai +优待youdai +诱导youdao +有的youde +优等youdeng +有点youdian +邮电youdian +优点youdian +诱发youfa +有功yougong +有关youguan +有害youhai +友好youhao +优化youhua +油画youhua +幽会youhui +优惠youhui +诱惑youhuo +有机youji +游击youji +有劲youjin +幽静youjing +悠久youjiu +邮局youju +由来youlai +游览youlan +有劳youlao +有利youli +有力youli +游离youli +优良youliang +优劣youlie +幽灵youling +忧虑youlu +优美youmei +幼苗youmiao +有名youming +幽默youmo +右派youpai +诱骗youpian +邮票youpiao +尤其youqi +油漆youqi +友情youqing +右倾youqing +有趣youqu +油然youran +犹如youru +有色youse +优胜yousheng +有时youshi +有事youshi +有失youshi +优势youshi +有数youshu +油水youshui +有所yousuo +有望youwang +有为youwei +游戏youxi +有限youxian +优先youxian +悠闲youxian +有效youxiao +幼小youxiao +有些youxie +有心youxin +游行youxing +优秀youxiu +幽雅youya +悠扬youyang +又要youyao +有益youyi +优异youyi +友谊youyi +有用youyong +游泳youyong +有余youyu +由于youyu +犹豫youyu +忧郁youyu +悠远youyuan +优越youyue +有着youzhe +邮政youzheng +优质youzhi +幼稚youzhi +由衷youzhong +邮资youzi +有求必应yqby +以权谋私yqms +有气无力yqwl +迎刃而解yrej +因人而异yrey +与人为善yrws +引人注目yrzm +意识到ysd +艺术家ysj +因势利导ysld +印刷体yst +意识形态ysxt +衣食住行yszx +以身作则yszz +研讨会yth +一条龙ytl +一条心ytx +有条有理ytyl +于yu +与yu +育yu +鱼yu +雨yu +玉yu +余yu +遇yu +预yu +域yu +语yu +愈yu +渔yu +予yu +羽yu +愚yu +御yu +谷*yu +欲yu +宇yu +蔚*yu +尉*yu +迂yu +淤yu +盂yu +榆yu +虞yu +舆yu +俞yu +逾yu +愉yu +渝yu +隅yu +娱yu +屿yu +禹yu +芋yu +郁yu +吁yu +喻yu +峪yu +狱yu +誉yu +浴yu +寓yu +裕yu +豫yu +驭yu +粥*yu +禺yu +毓yu +伛yu +俣yu +谀yu +谕yu +萸yu +菀*yu +蓣yu +揄yu +圄yu +圉yu +嵛yu +狳yu +饫yu +馀yu +庾yu +阈yu +鬻yu +妪yu +妤yu +纡yu +瑜yu +昱yu +觎yu +腴yu +腧*yu +欤yu +於yu +煜yu +熨yu +燠yu +聿yu +钰yu +鹆yu +鹬yu +瘐yu +瘀yu +窬yu +窳yu +蜮yu +蝓yu +竽yu +臾yu +舁yu +雩yu +龉yu +员yuan +原yuan +圆yuan +源yuan +元yuan +远yuan +愿yuan +院yuan +缘yuan +援yuan +园yuan +怨yuan +鸳yuan +渊yuan +冤yuan +垣yuan +袁yuan +辕yuan +猿yuan +苑yuan +垸yuan +塬yuan +芫yuan +掾yuan +圜*yuan +沅yuan +媛yuan +瑗yuan +橼yuan +爰yuan +眢yuan +鸢yuan +螈yuan +箢yuan +鼋yuan +原本yuanben +渊博yuanbo +冤仇yuanchou +远大yuanda +元旦yuandan +园地yuandi +园丁yuanding +远东yuandong +远方yuanfang +缘分yuanfen +原告yuangao +原故yuangu +缘故yuangu +圆滑yuanhua +原籍yuanji +冤家yuanjia +元件yuanjian +远见yuanjian +远近yuanjin +远景yuanjing +援救yuanjiu +原来yuanlai +原理yuanli +原谅yuanliang +原料yuanliao +远虑yuanlu +圆满yuanman +远谋yuanmou +远期yuanqi +冤屈yuanqu +源泉yuanquan +原始yuanshi +远视yuanshi +元首yuanshou +元帅yuanshuai +元素yuansu +援外yuanwai +愿望yuanwang +冤枉yuanwang +原先yuanxian +远销yuanxiao +元宵yuanxiao +院校yuanxiao +原形yuanxing +怨言yuanyan +原野yuanye +愿意yuanyi +园艺yuanyi +原因yuanyin +援引yuanyin +原有yuanyou +缘由yuanyou +远游yuanyou +远远yuanyuan +渊源yuanyuan +元月yuanyue +原则yuanze +院长yuanzhang +远征yuanzheng +援助yuanzhu +原子yuanzi +院子yuanzi +预报yubao +预备yubei +愚笨yuben +余步yubu +预测yuce +愚蠢yuchun +遇到yudao +预定yuding +预订yuding +余毒yudu +月yue +说*yue +越yue +约yue +乐*yue +跃yue +曰yue +阅yue +钥yue +岳yue +粤yue +悦yue +龠yue +瀹yue +栎*yue +樾yue +刖yue +钺yue +月报yuebao +月初yuechu +月底yuedi +约定yueding +月度yuedu +阅读yuedu +乐队yuedui +约法yuefa +月份yuefen +月光yueguang +越轨yuegui +约会yuehui +越界yuejie +跃进yuejin +越境yuejing +阅览yuelan +阅历yueli +月亮yueliang +月末yuemo +约莫yuemo +越南yuenan +乐谱yuepu +乐器yueqi +月球yueqiu +乐曲yuequ +月色yuese +越是yueshi +约束yueshu +月台yuetai +乐团yuetuan +约有yueyou +乐章yuezhang +预防yufang +预风yufeng +预付yufu +预感yugan +预告yugao +预购yugou +遇害yuhai +宇航yuhang +与会yuhui +迂回yuhui +雨季yuji +预计yuji +遇见yujian +预见yujian +语句yuju +豫剧yuju +愉快yukuai +娱乐yule +鱼雷yulei +预料yuliao +雨露yulu +舆论yulun +愚昧yumei +育苗yumiao +预谋yumou +运yun +员*yun +云yun +匀yun +均*yun +允yun +孕yun +耘yun +郧yun +陨yun +蕴yun +酝yun +晕yun +韵yun +郓yun +芸yun +狁yun +恽yun +愠yun +纭yun +韫yun +殒yun +昀yun +氲yun +熨yun +遇难yunan +云彩yuncai +蕴藏yuncang +匀称yuncheng +运动yundong +熨斗yundou +云海yunhai +运河yunhe +韵律yunlu +陨落yunluo +云南yunnan +酝酿yunnian +允诺yunnuo +愚弄yunong +运气yunqi +运输yunshu +运算yunsuan +云梯yunti +运往yunwang +韵味yunwei +云雾yunwu +云霞yunxia +运行yunxing +允许yunxu +运用yunyong +孕育yunyu +运载yunzai +运转yunzhuan +与其yuqi +语气yuqi +预期yuqi +预审yushen +于是yushi +预示yushi +预售yushou +雨水yushui +预算yusuan +欲望yuwang +语文yuwen +预习yuxi +预先yuxian +遇险yuxian +预想yuxiang +预言yuyan +语言yuyan +寓言yuyan +预演yuyan +予以yuyi +寓于yuyu +愉悦yuyue +预兆yuzhao +预支yuzhi +宇宙yuzhou +有文化ywh +业务联系ywlx +意味着ywz +有限公司yxgs +一系列yxl +有效期yxq +医学院yxy +一心一意yxyy +游泳池yyc +营业额yye +夜以继日yyjr +应用科学yykx +一言堂yyt +引以为戒yywj +优越性yyx +营业员yyy +隐隐约约yyyy +运用自如yyzr +拥政爱民yzam +原子能yzn +已知数yzs +有助于yzy +言之有理yzyl +在z +这z +主z +中z +种z +着z +争z +战z +作z +正z +之z +制z +重z +组z +治z +只z +子z +自z +质z +指z +杂za +扎*za +咱za +匝za +砸za +咋za +咂za +在zai +再zai +载zai +栽zai +灾zai +仔*zai +哉zai +宰zai +崽zai +甾zai +再版zaiban +再不zaibu +在场zaichang +再度zaidu +宰割zaige +灾害zaihai +再好zaihao +在乎zaihu +灾荒zaihuang +再会zaihui +灾祸zaihuo +再见zaijian +在理zaili +灾民zaimin +灾难zainan +栽培zaipei +再起zaiqi +灾情zaiqing +灾区zaiqu +再三zaisan +在世zaishi +再说zaishuo +载体zaiti +在下zaixia +再现zaixian +宰相zaixiang +在意zaiyi +在于zaiyu +再造zaizao +再则zaize +在职zaizhi +再植zaizhi +杂技zaji +杂粮zaliang +杂乱zaluan +赞zan +咱zan +暂zan +攒zan +拶zan +瓒zan +昝zan +簪zan +糌zan +趱zan +錾zan +赞成zancheng +暂定zanding +藏*zang +脏zang +葬zang +赃zang +奘zang +驵zang +臧zang +赞歌zange +赃款zangkuan +葬送zangsong +赃物zangwu +藏族zangzu +杂念zanian +赞美zanmei +咱们zanmen +暂且zanqie +暂缺zanque +赞赏zanshang +暂时zanshi +赞颂zansong +赞叹zantan +暂停zanting +赞同zantong +暂行zanxing +赞扬zanyang +暂用zanyong +赞助zanzhu +造zao +早zao +遭zao +燥zao +凿zao +糟zao +枣zao +皂zao +藻zao +澡zao +蚤zao +躁zao +噪zao +灶zao +唣zao +早晨zaochen +造成zaocheng +凿穿zaochuan +造次zaoci +造词zaoci +遭到zaodao +早稻zaodao +造反zaofan +早饭zaofan +造福zaofu +糟糕zaogao +造化zaohua +造价zaojia +造就zaojiu +造林zaolin +早年zaonian +糟粕zaopo +早期zaoqi +早日zaori +早上zaoshang +遭受zaoshou +早衰zaoshuai +糟蹋zaota +早晚zaowan +造型zaoxing +遭殃zaoyang +造谣zaoyao +造诣zaoyi +早已zaoyi +噪音zaoyin +遭遇zaoyu +造字zaozi +杂谈zatan +杂文zawen +杂质zazhi +杂志zazhi +资本主义zbzy +资产阶级zcjj +增长率zcl +总参谋部zcmb +真才实学zcsx +自动化zdh +自动检测zdjc +自动检索zdjs +自动控制zdkz +主动权zdq +招待所zds +总的说来zdsl +主动性zdx +则ze +择ze +责ze +侧*ze +泽ze +咋*ze +仄ze +赜ze +啧ze +帻ze +迮ze +昃ze +笮ze +箦ze +舴ze +责备zebei +责成zecheng +责罚zefa +责怪zeguai +贼zei +责令zeling +责骂zema +怎zen +谮zen +增zeng +曾zeng +综*zeng +憎zeng +赠zeng +缯zeng +甑zeng +罾zeng +锃zeng +增补zengbu +增产zengchan +增长zengchang +增大zengda +增订zengding +增多zengduo +增高zenggao +憎恨zenghen +增加zengjia +增减zengjian +增进zengjin +增量zengliang +赠品zengpin +增强zengqiang +增删zengshan +增设zengshe +赠送zengsong +增添zengtian +赠言zengyan +增益zengyi +增援zengyuan +怎么zenme +怎奈zennai +怎样zenyang +责任zeren +责问zewen +总而言之zeyz +争分夺秒zfdm +针锋相对zfxd +自负盈亏zfyk +中关村zgc +自告奋勇zgfy +中国共产党zggd +总工会zgh +中国特色的zgtd +中国银行zgyh +自古以来zgyl +中国政府zgzf +中共中央zgzy +查*zha +扎zha +炸zha +闸zha +铡zha +轧zha +渣zha +蜡*zha +喳zha +札zha +眨zha +栅zha +榨zha +咋*zha +乍zha +诈zha +柞*zha +揸zha +吒zha +咤zha +哳zha +喋*zha +楂*zha +砟zha +痄zha +蚱zha +齄zha +炸弹zhadan +扎根zhagen +炸毁zhahui +寨zhai +侧*zhai +择*zhai +摘zhai +窄zhai +斋zhai +翟*zhai +祭*zhai +宅zhai +债zhai +砦zhai +瘵zhai +摘录zhailu +债权zhaiquan +债务zhaiwu +窄小zhaixiao +摘要zhaiyao +札记zhaji +战zhan +展zhan +站zhan +占zhan +粘*zhan +颤*zhan +瞻zhan +毡zhan +詹zhan +沾zhan +盏zhan +斩zhan +辗zhan +崭zhan +蘸zhan +栈zhan +湛zhan +绽zhan +谵zhan +搌zhan +旃zhan +战败zhanbai +战报zhanbao +战备zhanbei +战场zhanchang +展翅zhanchi +展出zhanchu +战地zhandi +战斗zhandou +战犯zhanfan +长*zhang +张zhang +章zhang +掌zhang +仗zhang +障zhang +胀zhang +涨zhang +账zhang +樟zhang +彰zhang +漳zhang +杖zhang +丈zhang +帐zhang +瘴zhang +仉zhang +鄣zhang +幛zhang +嶂zhang +獐zhang +嫜zhang +璋zhang +蟑zhang +障碍zhangai +站岗zhangang +长辈zhangbei +章程zhangcheng +长大zhangda +战歌zhange +章法zhangfa +帐房zhangfang +丈夫zhangfu +掌管zhangguan +帐号zhanghao +章节zhangjie +帐目zhangmu +战功zhangong +掌权zhangquan +张贴zhangtie +战鼓zhangu +沾光zhanguang +战国zhanguo +战果zhanguo +张望zhangwang +掌握zhangwo +张扬zhangyang +战壕zhanhao +战后zhanhou +战机zhanji +战绩zhanji +战局zhanju +占据zhanju +展开zhankai +战况zhankuang +展览zhanlan +占领zhanling +战略zhanlue +战马zhanma +展品zhanpin +战区zhanqu +沾染zhanran +战胜zhansheng +战时zhanshi +战事zhanshi +战士zhanshi +展示zhanshi +战术zhanshu +展望zhanwang +战线zhanxian +展现zhanxian +展销zhanxiao +崭新zhanxin +瞻仰zhanyang +战役zhanyi +占用zhanyong +占有zhanyou +战友zhanyou +站长zhanzhang +战争zhanzheng +着*zhao +照zhao +找zhao +招zhao +朝*zhao +召zhao +赵zhao +爪zhao +罩zhao +沼zhao +兆zhao +嘲*zhao +昭zhao +肇zhao +诏zhao +啁*zhao +棹zhao +钊zhao +笊zhao +照办zhaoban +照搬zhaoban +招标zhaobiao +照常zhaochang +照抄zhaochao +招待zhaodai +照发zhaofa +招工zhaogong +照顾zhaogu +招呼zhaohu +召唤zhaohuan +照会zhaohui +着急zhaoji +招集zhaoji +召集zhaoji +招架zhaojia +召开zhaokai +招考zhaokao +招揽zhaolan +着力zhaoli +照例zhaoli +照料zhaoliao +着落zhaoluo +着迷zhaomi +照明zhaoming +招聘zhaopin +朝气zhaoqi +招惹zhaore +照射zhaoshe +招生zhaosheng +着手zhaoshou +招手zhaoshou +招收zhaoshou +招贴zhaotie +朝夕zhaoxi +朝霞zhaoxia +着想zhaoxiang +照相zhaoxiang +昭雪zhaoxue +找寻zhaoxun +着眼zhaoyan +照样zhaoyang +照耀zhaoyao +照应zhaoying +招展zhaozhan +招致zhaozhi +着重zhaozhong +照着zhaozhuo +诈骗zhapian +榨取zhaqu +诈取zhaqu +扎实zhashi +炸药zhayao +渣滓zhazi +这zhe +着zhe +者zhe +折zhe +哲zhe +浙zhe +遮zhe +蛰zhe +辙zhe +锗zhe +蔗zhe +谪zhe +摺zhe +柘zhe +辄zhe +磔zhe +鹧zhe +褶zhe +蜇zhe +赭zhe +这般zheban +这边zhebian +这次zheci +遮挡zhedang +这点zhedian +折叠zhedie +折服zhefu +遮盖zhegai +这个zhege +折合zhehe +浙江zhejiang +折旧zhejiu +折扣zhekou +这里zheli +哲理zheli +这么zheme +折磨zhemo +真zhen +针zhen +阵zhen +镇zhen +振zhen +震zhen +珍zhen +诊zhen +斟zhen +甄zhen +砧zhen +臻zhen +贞zhen +侦zhen +枕zhen +疹zhen +圳zhen +蓁zhen +浈zhen +溱*zhen +缜zhen +桢zhen +椹*zhen +榛zhen +轸zhen +赈zhen +胗zhen +朕zhen +祯zhen +畛zhen +稹zhen +鸩zhen +箴zhen +珍爱zhenai +珍宝zhenbao +针砭zhenbian +珍藏zhencang +贞操zhencao +侦察zhencha +真诚zhencheng +震荡zhendang +阵地zhendi +真谛zhendi +震动zhendong +诊断zhenduan +针对zhendui +振奋zhenfen +争zheng +正zheng +政zheng +整zheng +证zheng +征zheng +蒸zheng +症zheng +丁*zheng +郑zheng +挣zheng +睁zheng +狰zheng +怔zheng +拯zheng +帧zheng +诤zheng +峥zheng +徵zheng +钲zheng +铮zheng +筝zheng +争霸zhengba +整备zhengbei +正比zhengbi +政变zhengbian +争辩zhengbian +整编zhengbian +征兵zhengbing +政策zhengce +正常zhengchang +争吵zhengchao +征程zhengcheng +争持zhengchi +正大zhengda +正当zhengdang +政党zhengdang +整党zhengdang +正道zhengdao +争端zhengduan +整顿zhengdun +争夺zhengduo +蒸发zhengfa +政法zhengfa +正反zhengfan +整风zhengfeng +政府zhengfu +征服zhengfu +整改zhenggai +整个zhengge +征购zhenggou +争光zhengguang +正规zhenggui +正轨zhenggui +正好zhenghao +政绩zhengji +征集zhengji +证件zhengjian +政见zhengjian +整洁zhengjie +政局zhengju +证据zhengju +正理zhengli +整理zhengli +正梁zhengliang +政令zhengling +争论zhenglun +政论zhenglun +正面zhengmian +争鸣zhengming +证明zhengming +正派zhengpai +征聘zhengpin +争气zhengqi +正气zhengqi +蒸气zhengqi +整齐zhengqi +正巧zhengqiao +征求zhengqiu +争取zhengqu +政权zhengquan +正确zhengque +证人zhengren +正是zhengshi +正式zhengshi +正视zhengshi +证实zhengshi +征收zhengshou +整数zhengshu +证书zhengshu +征税zhengshui +整套zhengtao +正题zhengti +政体zhengti +整体zhengti +整天zhengtian +征调zhengtiao +正统zhengtong +征途zhengtu +珍贵zhengui +政委zhengwei +正文zhengwen +征文zhengwen +政务zhengwu +争先zhengxian +政协zhengxie +整形zhengxing +整修zhengxiu +征询zhengxun +争艳zhengyan +正业zhengye +正义zhengyi +争议zhengyi +征用zhengyong +正月zhengyue +正在zhengzai +挣扎zhengzha +整整zhengzheng +正直zhengzhi +政治zhengzhi +争执zhengzhi +正中zhengzhong +郑重zhengzhong +郑州zhengzhou +症状zhengzhuang +正宗zhengzong +震撼zhenhan +侦缉zhenji +真假zhenjia +阵脚zhenjiao +贞节zhenjie +贞洁zhenjie +镇静zhenjing +震惊zhenjing +真空zhenkong +真理zhenli +诊疗zhenliao +珍品zhenpin +珍奇zhenqi +真切zhenqie +真情zhenqing +真确zhenque +真人zhenren +阵容zhenrong +真是zhenshi +真实zhenshi +阵势zhenshi +珍视zhenshi +侦探zhentan +阵亡zhenwang +珍惜zhenxi +阵线zhenxian +真相zhenxiang +振兴zhenxing +镇压zhenya +阵阵zhenzhen +真正zhenzheng +真知zhenzhi +真挚zhenzhi +珍重zhenzhong +珍珠zhenzhu +斟酌zhenzhuo +振作zhenzuo +这是zheshi +这时zheshi +折腾zheteng +这些zhexie +哲学zhexue +遮掩zheyan +这样zheyang +这种zhezhong +折中zhezhong +之zhi +制zhi +治zhi +只zhi +质zhi +指zhi +直zhi +支zhi +织zhi +止zhi +至zhi +置zhi +志zhi +值zhi +知zhi +识*zhi +执zhi +职zhi +植zhi +纸zhi +致zhi +枝zhi +殖zhi +脂zhi +智zhi +氏*zhi +肢zhi +秩zhi +址zhi +滞zhi +汁zhi +芝zhi +吱zhi +蜘zhi +侄zhi +趾zhi +旨zhi +挚zhi +掷zhi +帜zhi +峙zhi +稚zhi +炙zhi +痔zhi +窒zhi +卮zhi +陟zhi +郅zhi +埴zhi +芷zhi +摭zhi +帙zhi +徵*zhi +忮zhi +彘zhi +咫zhi +骘zhi +栉zhi +枳zhi +栀zhi +桎zhi +轵zhi +轾zhi +贽zhi +胝zhi +膣zhi +祉zhi +祗zhi +黹zhi +雉zhi +鸷zhi +痣zhi +蛭zhi +絷zhi +酯zhi +跖zhi +踬zhi +踯zhi +豸zhi +觯zhi +治安zhian +值班zhiban +植保zhibao +置备zhibei +质变zhibian +指标zhibiao +职别zhibie +支部zhibu +制裁zhicai +支撑zhicheng +职称zhicheng +支持zhichi +指出zhichu +支出zhichu +至此zhici +值此zhici +直达zhida +只当zhidang +直到zhidao +指导zhidao +知道zhidao +只得zhide +值得zhide +质地zhidi +指点zhidian +制定zhiding +指定zhiding +制订zhiding +制度zhidu +支队zhidui +至多zhiduo +知法zhifa +执法zhifa +制服zhifu +支付zhifu +职工zhigong +只顾zhigu +只管zhiguan +直观zhiguan +治国zhiguo +只好zhihao +之后zhihou +指挥zhihui +智慧zhihui +知己zhiji +指甲zhijia +之间zhijian +只见zhijian +指教zhijiao +直接zhijie +枝节zhijie +至今zhijin +直经zhijing +直径zhijing +止境zhijing +致敬zhijing +知觉zhijue +治理zhili +致力zhili +智力zhili +质量zhiliang +治疗zhiliao +指令zhiling +直流zhiliu +支流zhiliu +殖民zhimin +致命zhiming +指明zhiming +知名zhiming +智谋zhimou +指南zhinan +智囊zhinang +之内zhinei +只能zhineng +职能zhineng +智能zhineng +只怕zhipa +指派zhipai +支配zhipei +支票zhipiao +制品zhipin +志气zhiqi +之前zhiqian +支前zhiqian +值勤zhiqin +执勤zhiqin +知情zhiqing +知青zhiqing +智取zhiqu +志趣zhiqu +知趣zhiqu +职权zhiquan +值日zhiri +治丧zhisang +之上zhishang +直上zhishang +至上zhishang +至少zhishao +制胜zhisheng +之声zhisheng +只是zhishi +指使zhishi +支使zhishi +致使zhishi +知事zhishi +指示zhishi +知识zhishi +指数zhishu +支书zhishu +直属zhishu +植树zhishu +直爽zhishuang +治水zhishui +直说zhishuo +致死zhisi +之外zhiwai +指望zhiwang +职位zhiwei +质问zhiwen +植物zhiwu +职务zhiwu +窒息zhixi +之下zhixia +直线zhixian +指向zhixiang +志向zhixiang +知心zhixin +执行zhixing +只许zhixu +秩序zhixu +直言zhiyan +只要zhiyao +职业zhiye +致意zhiyi +旨意zhiyi +质疑zhiyi +指引zhiyin +知音zhiyin +只有zhiyou +至于zhiyu +置于zhiyu +智育zhiyu +职员zhiyuan +支援zhiyuan +志愿zhiyuan +制约zhiyue +制造zhizao +指责zhize +职责zhize +纸张zhizhang +职掌zhizhang +执照zhizhao +指正zhizheng +执政zhizheng +制止zhizhi +直至zhizhi +之中zhizhong +支助zhizhu +支柱zhizhu +知足zhizu +制作zhizuo +走后门zhm +中华民国zhmg +中华民族zhmz +中zhong +种zhong +重zhong +众zhong +钟zhong +终zhong +忠zhong +肿zhong +仲zhong +盅zhong +衷zhong +冢zhong +忪*zhong +锺zhong +螽zhong +舯zhong +踵zhong +钟爱zhongai +重办zhongban +重兵zhongbing +中部zhongbu +仲裁zhongcai +中层zhongceng +衷肠zhongchang +忠诚zhongcheng +重大zhongda +重担zhongdan +中等zhongdeng +种地zhongdi +重地zhongdi +重点zhongdian +终点zhongdian +中东zhongdong +中断zhongduan +终端zhongduan +中队zhongdui +众多zhongduo +重犯zhongfan +忠告zhonggao +中共zhonggong +中国zhongguo +忠厚zhonghou +中华zhonghua +中级zhongji +终极zhongji +重价zhongjia +中间zhongjian +中坚zhongjian +中奖zhongjiang +终结zhongjie +终究zhongjiu +终久zhongjiu +终局zhongju +中肯zhongken +种类zhonglei +中立zhongli +重量zhongliang +终了zhongliao +中流zhongliu +肿瘤zhongliu +中美zhongmei +众目zhongmu +中年zhongnian +终年zhongnian +中秋zhongqiu +重任zhongren +中日zhongri +终日zhongri +中伤zhongshang +重赏zhongshang +终身zhongshen +终生zhongsheng +重视zhongshi +忠实zhongshi +中枢zhongshu +众说zhongshuo +中苏zhongsu +终天zhongtian +中途zhongtu +重托zhongtuo +中外zhongwai +重围zhongwei +中文zhongwen +中午zhongwu +中西zhongxi +中心zhongxin +忠心zhongxin +衷心zhongxin +中性zhongxing +中学zhongxue +中旬zhongxun +忠言zhongyan +中央zhongyang +中药zhongyao +重要zhongyao +中医zhongyi +重用zhongyong +中庸zhongyong +中游zhongyou +终于zhongyu +忠于zhongyu +忠贞zhongzhen +中止zhongzhi +种植zhongzhi +终止zhongzhi +种种zhongzhong +中专zhongzhuan +种族zhongzu +轴zhou +周zhou +洲zhou +州zhou +皱zhou +骤zhou +舟zhou +诌zhou +粥zhou +肘zhou +帚zhou +咒zhou +宙zhou +昼zhou +荮zhou +啁zhou +妯zhou +纣zhou +绉zhou +胄zhou +碡zhou +籀zhou +繇*zhou +酎zhou +周到zhoudao +咒骂zhouma +周密zhoumi +周末zhoumo +周期zhouqi +周全zhouquan +周围zhouwei +周旋zhouxuan +昼夜zhouye +周折zhouzhe +周知zhouzhi +周转zhouzhuan +总后勤部zhqb +中华人民共和国zhrg +主zhu +注zhu +著zhu +住zhu +助zhu +猪zhu +铸zhu +属*zhu +株zhu +筑zhu +柱zhu +术*zhu +驻zhu +逐zhu +祝zhu +竹zhu +贮zhu +珠zhu +朱zhu +诸zhu +蛛zhu +诛zhu +烛zhu +煮zhu +拄zhu +瞩zhu +嘱zhu +蛀zhu +伫zhu +侏zhu +邾zhu +茱zhu +洙zhu +渚zhu +潴zhu +杼zhu +槠zhu +橥zhu +炷zhu +铢zhu +疰zhu +瘃zhu +褚*zhu +竺zhu +箸zhu +舳zhu +翥zhu +躅zhu +麈zhu +抓zhua +挝*zhua +抓好zhuahao +转*zhuai +曳*zhuai +拽zhuai +抓紧zhuajin +转zhuan +专zhuan +传*zhuan +砖zhuan +撰zhuan +赚zhuan +篆zhuan +啭zhuan +馔zhuan +沌*zhuan +颛zhuan +转变zhuanbian +转播zhuanbo +专长zhuanchang +专程zhuancheng +转达zhuanda +转发zhuanfa +装zhuang +状zhuang +壮zhuang +庄zhuang +撞zhuang +幢*zhuang +桩zhuang +妆zhuang +僮zhuang +奘*zhuang +转告zhuangao +装扮zhuangban +装备zhuangbei +壮大zhuangda +装订zhuangding +壮观zhuangguan +装甲zhuangjia +庄稼zhuangjia +庄嫁zhuangjia +壮举zhuangju +状况zhuangkuang +壮阔zhuangkuo +壮丽zhuangli +壮烈zhuanglie +装配zhuangpei +装饰zhuangshi +状态zhuangtai +装卸zhuangxie +庄严zhuangyan +庄园zhuangyuan +装运zhuangyun +装置zhuangzhi +壮志zhuangzhi +庄重zhuangzhong +转化zhuanhua +转换zhuanhuan +转给zhuanji +专家zhuanjia +专科zhuanke +专利zhuanli +专门zhuanmen +转让zhuanrang +专题zhuanti +转向zhuanxiang +专心zhuanxin +转眼zhuanyan +专业zhuanye +转移zhuanyi +专员zhuanyuan +转载zhuanzai +转折zhuanzhe +转正zhuanzheng +专政zhuanzheng +专制zhuanzhi +专职zhuanzhi +专注zhuanzhu +专著zhuanzhu +主办zhuban +逐步zhubu +贮藏zhucang +注册zhuce +助长zhuchang +主持zhuchi +主次zhuci +主导zhudao +注定zhuding +主动zhudong +主队zhudui +主犯zhufan +住房zhufang +祝福zhufu +嘱咐zhufu +逐个zhuge +主攻zhugong +助工zhugong +主管zhuguan +主观zhuguan +追zhui +锥zhui +椎zhui +赘zhui +坠zhui +缀zhui +惴zhui +骓zhui +缒zhui +追捕zhuibu +追查zhuicha +追悼zhuidao +追赶zhuigan +坠毁zhuihui +追加zhuijia +追究zhuijiu +追求zhuiqiu +追认zhuiren +追溯zhuisu +追随zhuisui +追问zhuiwen +追逐zhuizhu +追踪zhuizong +主机zhuji +主见zhujian +逐渐zhujian +主将zhujiang +主讲zhujiang +主教zhujiao +主角zhujiao +注解zhujie +祝酒zhujiu +主力zhuli +助理zhuli +株连zhulian +主粮zhuliang +主流zhuliu +驻留zhuliu +著名zhuming +主谋zhumou +注目zhumu +瞩目zhumu +准zhun +屯*zhun +谆zhun +肫zhun +窀zhun +准备zhunbei +逐年zhunian +准确zhunque +准绳zhunsheng +准时zhunshi +准许zhunxu +准则zhunze +着*zhuo +著*zhuo +捉zhuo +桌zhuo +缴*zhuo +拙zhuo +卓zhuo +琢zhuo +茁zhuo +酌zhuo +啄zhuo +灼zhuo +浊zhuo +倬zhuo +诼zhuo +擢zhuo +浞zhuo +涿zhuo +濯zhuo +棹*zhuo +焯zhuo +禚zhuo +斫zhuo +镯zhuo +拙劣zhuolie +琢磨zhuomo +捉弄zhuonong +酌情zhuoqing +卓越zhuoyue +茁壮zhuozhuang +主权zhuquan +主人zhuren +主任zhuren +诸如zhuru +注色zhuse +注视zhushi +柱石zhushi +注释zhushi +助手zhushou +主送zhusong +住宿zhusu +珠算zhusuan +主题zhuti +主体zhuti +逐条zhutiao +嘱托zhutuo +诸位zhuwei +主席zhuxi +注销zhuxiao +主要zhuyao +逐一zhuyi +主义zhuyi +主意zhuyi +注意zhuyi +祝愿zhuyuan +逐月zhuyue +主宰zhuzai +铸造zhuzao +驻扎zhuzha +住宅zhuzhai +主张zhuzhang +住址zhuzhi +注重zhuzhong +著作zhuzuo +子zi +自zi +资zi +字zi +紫zi +仔zi +籽zi +姿zi +吱*zi +兹zi +咨zi +滋zi +淄zi +孜zi +滓zi +渍zi +谘zi +茈*zi +呲*zi +嵫zi +姊zi +孳zi +缁zi +梓zi +辎zi +赀zi +恣zi +眦zi +锱zi +秭zi +耔zi +笫zi +粢zi +趑zi +觜zi +訾zi +龇zi +鲻zi +髭zi +自爱ziai +自白zibai +自卑zibei +资本ziben +资产zichan +滋长zichang +自称zicheng +自传zichuan +自从zicong +子弟zidi +字典zidian +自动zidong +自发zifa +自费zifei +自封zifeng +自负zifu +字符zifu +资格zige +字根zigen +自豪zihao +自给ziji +自己ziji +字迹ziji +字节zijie +资金zijin +自救zijiu +自居ziju +自觉zijue +字库ziku +自夸zikua +自理zili +资历zili +资料ziliao +自满ziman +自勉zimian +字母zimu +字幕zimu +子女zinu +自强ziqiang +自然ziran +滋润zirun +自杀zisha +自身zishen +姿势zishi +自述zishu +自私zisi +姿态zitai +字体ziti +字帖zitie +自卫ziwei +滋味ziwei +自问ziwen +自我ziwo +仔细zixi +自信zixin +自修zixiu +自叙zixu +自选zixuan +自学zixue +咨询zixun +滋养ziyang +自由ziyou +自愿ziyuan +资源ziyuan +自找zizhao +自治zizhi +自重zizhong +资助zizhu +自尊zizun +直截了当zjld +浙江省zjs +这就是说zjss +中纪委zjw +再接再厉zjzl +中联部zlb +专利法zlf +质量管理zlgl +自力更生zlgs +展览会zlh +智力开发zlkf +专利权zlq +知名人士zmrs +这么些zmx +这么样zmy +怎么样zmy +总zong +纵zong +宗zong +综zong +棕zong +鬃zong +踪zong +偬zong +枞zong +腙zong +粽zong +总部zongbu +总裁zongcai +总参zongcan +总队zongdui +总额zonge +总纲zonggang +总共zonggong +纵贯zongguan +总和zonghe +综合zonghe +纵横zongheng +总后zonghou +总计zongji +踪迹zongji +宗教zongjiao +总结zongjie +总局zongju +总括zongkuo +总理zongli +总论zonglun +宗派zongpai +纵情zongqing +纵深zongshen +总是zongshi +纵使zongshi +总数zongshu +总算zongsuan +总体zongti +总统zongtong +总务zongwu +踪影zongying +总帐zongzhang +总政zongzheng +总之zongzhi +宗旨zongzhi +走zou +邹zou +奏zou +揍zou +诹zou +陬zou +鄹zou +驺zou +鲰zou +走访zoufang +邹虹zouhong +走私zousi +奏效zouxiao +酌情处理zqcl +中青年zqn +朝气蓬勃zqpb +准确无误zqww +正确性zqx +诸如此类zrcl +责任感zrg +自然界zrj +主人翁zrw +责任心zrx +责任制zrz +再生产zsc +自上而下zsex +知识分子zsfz +这时候zsh +知识化zsh +株式会社zshs +总书记zsj +装饰品zsp +综上所述zsss +之所以zsy +自始至终zszz +众所周知zszz +座谈会zth +组zu +族zu +足zu +阻zu +祖zu +租zu +卒zu +诅zu +俎zu +菹zu +镞zu +阻碍zuai +钻zuan +赚*zuan +纂zuan +攥zuan +缵zuan +躜zuan +钻研zuanyan +组成zucheng +阻挡zudang +组阁zuge +足够zugou +祖国zuguo +组合zuhe +最zui +罪zui +嘴zui +堆*zui +咀*zui +醉zui +蕞zui +最初zuichu +最大zuida +最低zuidi +罪恶zuie +罪犯zuifan +最高zuigao +罪过zuiguo +最好zuihao +最后zuihou +最坏zuihuai +最佳zuijia +最近zuijin +嘴脸zuilian +罪名zuiming +罪孽zuinie +罪人zuiren +最先zuixian +最小zuixiao +最新zuixin +醉心zuixin +罪行zuixing +罪责zuize +罪证zuizheng +最终zuizhong +罪状zuizhuang +阻击zuji +租界zujie +租借zujie +阻拦zulan +阻力zuli +租赁zulin +尊zun +遵zun +撙zun +樽zun +鳟zun +阻挠zunao +遵从zuncong +尊贵zungui +尊敬zunjing +遵守zunshou +遵循zunxun +尊严zunyan +遵照zunzhao +尊重zunzhong +作zuo +做zuo +左zuo +座zuo +坐zuo +昨zuo +撮*zuo +凿*zuo +搓*zuo +琢*zuo +佐zuo +柞zuo +阼zuo +唑zuo +嘬zuo +怍zuo +胙zuo +祚zuo +笮*zuo +作案zuoan +作弊zuobi +左边zuobian +坐标zuobiao +做到zuodao +作法zuofa +做法zuofa +作废zuofei +作风zuofeng +做工zuogong +作怪zuoguai +做好zuohao +作家zuojia +作客zuoke +作乐zuole +作乱zuoluan +坐落zuoluo +左派zuopai +作品zuopin +左倾zuoqing +做人zuoren +昨日zuori +做事zuoshi +坐视zuoshi +座谈zuotan +昨天zuotian +昨晚zuowan +作为zuowei +座位zuowei +坐位zuowei +作文zuowen +作物zuowu +作业zuoye +昨夜zuoye +作用zuoyong +左右zuoyou +作战zuozhan +作者zuozhe +作证zuozheng +作主zuozhu +做主zuozhu +做作zuozuo +足球zuqiu +阻塞zuse +祖师zushi +祖先zuxian +组长zuzhang +组织zuzhi +阻止zuzhi +祖宗zuzong +中外合资zwhz +责无旁贷zwpd +中宣部zxb +自行车zxc +自下而上zxes +忠心耿耿zxgg +展销会zxh +照相机zxj +争先恐后zxkh +中学生zxs +主席团zxt +中小学zxx +自信心zxx +中央办公厅zybt +着眼点zyd +专业对口zydk +中央电视台zydt +中央各部委zygw +专业化zyh +专业户zyh +中央军委zyjw +座右铭zym +中央全会zyqh +中央人民广播电台zyrt +主要人员zyry +专业人员zyry +中央书记处zysc +中央委员会zywh +中央委员zywy +重要性zyx +主要原因zyyy +中央政治局zyzj +专业知识zyzs +中组部zzb +组织部zzb +政治部zzb +政治处zzc +转折点zzd +置之度外zzdw +政治局zzj +自治区zzq +蒸蒸日上zzrs +组织上zzs +郑州市zzs +组织性zzx +自尊心zzx +赵紫阳zzy +总政治部zzzb +喷码pm +优喷yp +科技kj +比洋by +公司gs +威诺巴赫wnbh +有限公司yxgz +股份公司gfgs +企业qy +标准bz +喷码机pmj +电线dx +电缆dl +电线电缆dxdl +电力电缆dldl +绝缘jy +绝缘层jyc +导体dt +导线dx +电力dl +通信tx +控制电缆kzdl +补偿电缆bcdl +屏蔽电缆pbdl +高温电缆gwdl +计算机电缆jsjdl +信号电缆xhdl +同轴电缆tzdl +耐火电缆nhdl +船用电缆cydl +铝合金电缆lhjdl +单股dg +多股dg +连接lj +电路dl +电器dq +型号xh +铜t +铝l +铅包qb +铝包qb +聚氯乙烯jlyx +电磁线dcx +北京市bj +东城区dcq +西城区xcq +崇文区cwq +宣武区xwq +朝阳区zyq +海淀区hdq +丰台区ftq +房山区fsq +通州区tzq +顺义区syq +昌平区cpq +大兴区txq +怀柔区hrq +平谷区pgq +门头沟区mtgq +石景山区sjsq +天津市tjs +和平区hpq +河东区hdq +河西区hxq +南开区nkq +河北区hbq +红桥区hqq +塘沽区tgq +汉沽区hgq +大港区tgq +东丽区dlq +西青区xqq +北辰区bcq +津南区jnq +武清区wqq +宝坻区bdq +河北省hbs +辛集市xjs +藁城市gcs +晋州市jzs +新乐市xls +鹿泉市lqs +唐山市tss +遵化市zhs +安市as +邯郸市hds +武安市was +邢台市xts +南宫市ngs +沙河市shs +保定市bds +涿州市zzs +定州市dzs +安国市ags +承德市cds +沧州市czs +泊头市bts +任丘市rqs +黄骅市hhs +河间市hjs +廊坊市lfs +霸州市bzs +三河市shs +衡水市hss +冀州市jzs +深州市szs +石家庄市sjzs +张家口市zjks +高碑店市gbds +秦皇岛市qhds +山西省sxs +太原市tys +古交市gjs +大同市dts +阳泉市yqs +长治市czs +潞城市lcs +晋城市jcs +高平市gps +朔州市szs +晋中市jzs +介休市jxs +运城市ycs +河津市hjs +永济市sjs +忻州市xzs +原平市yps +临汾市lfs +侯马市hms +霍州市hzs +吕梁市lls +孝义市xys +汾阳市fys +内蒙古自治区nmg +包头市bts +乌海市whs +赤峰市cfs +通辽市tls +根河市ghs +丰镇市fzs +辽宁省LNS +沈阳市sys +新民市xms +大连市dls +庄河市zhs +鞍山市ass +海城市hcs +抚顺市fss +本溪市bxs +丹东市dds +东港市dgs +凤城市fcs +锦州市jzs +凌海市lhs +北宁市bns +营口市yks +盖州市gzs +阜新市fxs +辽阳市lys +灯塔市dts +盘锦市pjs +铁岭市tls +开原市kys +朝阳市zys +凌源市lys +北票市bps +兴城市xcs +大石桥市dsqs +瓦房店市wfds +普兰店市plds +调兵山市dbss +葫芦岛市hlds +吉林省jls +长春市ccs +九台市jts +榆树市yss +德惠市dhs +吉林市jls +舒兰市sls +桦甸市hds +蛟河市jhs +磐石市pss +四平市sps +双辽市sls +辽源市lys +通化市ths +集安市jas +白山市bss +临江市ljs +松原市sys +白城市bcs +大安市das +洮南市tns +延吉市yjs +图们市tms +敦化市ghs +龙井市ljs +珲春市hcs +和龙市hls +公主岭市gzls +梅河口市mhks +黑龙江省hljs +阿城市acs +尚志市szs +双城市scs +五常市wcs +讷河市nhs +鹤岗市hgs +鸡西市jxs +密山市mss +虎林市hls +大庆市dqs +伊春市ycs +铁力市tls +宁安市nas +海林市hls +穆棱市mls +同江市tjs +富锦市fjs +黑河市hhs +北安市bas +绥化市shs +安达市ads +肇东市zds +海伦市hls +七台河市qths +双鸭山市syss +牡丹江市mdjs +佳木斯市jmss +绥芬河市sfhs +哈尔滨市hebs +齐齐哈尔市qqhes +五大连池市wdlcs +上海市shs +黄浦区hpq +卢湾区lwq +徐汇区xhq +长宁区cnq +静安区jaq +普陀区ptq +闸北区zbq +虹口区hkq +杨浦区ypq +宝山区bsq +闵行区mxq +嘉定区jdq +松江区sjq +金山区jsq +青浦区qpq +南汇区nhq +奉贤区fxq +崇明县浦东新区cmxpdxq +江苏省jss +南京市njs +无锡市wxs +江阴市jys +宜兴市yxs +徐州市xzs +邳州市pzs +新沂市xys +常州市czs +金坛市jts +溧阳市lys +苏州市szs +常熟市css +太仓市dcs +昆山市hss +吴江市wjs +南通市nns +如皋市rgs +通州市tzs +海门市hms +启东市qds +淮安市has +盐城市ycs +东台市dts +大丰市dfs +扬州市yzs +高邮市gys +江都市jds +仪征市yzs +镇江市zjs +丹阳市dys +扬中市yzs +句容市jrs +泰州市dzs +泰兴市dxs +姜堰市jys +靖江市jjs +兴化市xhs +宿迁市sqs +连云港市lygs +张家港市zjgs +浙江省zjs +杭州市hzs +建德市jds +富阳市fys +临安市las +宁波市nbx +余姚市yys +慈溪市cxs +奉化市fhs +温州市wzs +瑞安市ras +乐清市lqs +嘉兴市jxs +海宁市hns +平湖市phs +桐乡市txs +湖州市hzs +绍兴市sxs +诸暨市zjs +上虞市sys +嵊州市szs +金华市jhs +兰溪市lxs +义乌市yws +东阳市dys +永康市yks +衢州市qzs +江山市jss +舟山市zss +台州市tzs +临海市lhs +丽水市lss +龙泉市lqs +安徽省ahs +合肥市hfs +芜湖市whs +蚌埠市bbs +淮南市hns +淮北市hbs +铜陵市tls +安庆市aqs +桐城市tcs +黄山市hss +滁州市czs +天长市dcs +明光市mgs +阜阳市fys +界首市jss +宿州市szs +巢湖市chs +六安市las +亳州市hzs +池州市czs +宣城市ycs +宁国市ngs +马鞍山市mass +福建省fjs +福州市fjs +福清市fqs +长乐市cls +厦门市xms +莆田市pts +三明市sms +永安市yas +泉州市qzs +石狮市sss +晋江市jjs +南安市nas +漳州市zzs +龙海市lhs +南平市nps +建瓯市jos +邵武市sws +建阳市jys +龙岩市lys +漳平市zps +宁德市nds +福安市fas +福鼎市fds +武夷山市wyss +江西省jxs +南昌市ncs +乐平市lps +萍乡市pxs +九江市jjs +瑞昌市rcs +新余市xys +鹰潭市yts +贵溪市gxs +赣州市gzs +瑞金市rjs +南康市nks +吉安市jas +宜春市ycs +丰城市fcs +樟树市zss +高安市gas +抚州市fzs +上饶市srs +德兴市dxs +井冈山市jgss +景德镇市jdzs +山东省sds +济南市jns +章丘市zqs +青岛市qds +胶南市jns +胶州市jzs +平度市pds +莱西市lxs +即墨市jms +淄博市zbs +枣庄市zzs +滕州市tzs +烟台市yts +龙口市lks +莱阳市lys +莱州市lzs +招远市zys +蓬莱市pls +栖霞市qxs +海阳市hys +潍坊市wfs +青州市qzs +诸城市zcs +寿光市sgs +安丘市aqs +高密市gms +昌邑市cys +济宁市jns +曲阜市qfs +兖州市yzs +邹城市zcs +泰安市tas +新泰市xts +肥城市fcs +威海市whs +乳山市rss +文登市wds +荣成市rcs +日照市rzs +莱芜市lws +临沂市lys +德州市dzs +乐陵市lls +禹城市ycs +聊城市lcs +临清市lqs +滨州市bzs +菏泽市hzs +河南省hns +郑州市zzs +巩义市gys +新郑市xzs +新密市xms +登封市dfs +荥阳市xys +开封市kfs +洛阳市lys +偃师市yss +汝州市rzs +舞钢市wgs +安阳市ays +林州市lzs +新乡市xxs +卫辉市whs +辉县市hxs +焦作市jzs +沁阳市qys +孟州市mzs +濮阳市pys +许昌市xcs +禹州市yzs +长葛市cgs +漯河市lhs +义马市yms +灵宝市lbs +南阳市nys +邓州市dzs +商丘市sqs +永城市ycs +信阳市xys +周口市zks +项城市dcs +济源市jys +三门峡市smxs +平顶山市pdss +驻马店市zmds +湖北省hbs +武汉市whs +黄石市hss +大冶市dys +十堰市sys +荆州市jzs +洪湖市hhs +石首市sss +松滋市szs +宜昌市ycs +宜都市yds +当阳市dys +枝江市jjs +襄樊市xfs +枣阳市zys +宜城市ycs +鄂州市ezs +荆门市jms +钟祥市zxs +孝感市xgs +应城市ycs +安陆市als +汉川市hcs +黄冈市hgs +麻城市mcs +武穴市wxs +咸宁市xns +赤壁市cbs +随州市szs +广水市gss +仙桃市xts +天门市tms +潜江市qjs +恩施市ess +利川市lcs +丹江口市djks +老河口市lhks +神农架林区snjlq +湖南省hns +长沙市css +浏阳市lys +株洲市zzs +醴陵市lls +湘潭市xts +湘乡市xxs +韶山市sss +衡阳市hys +耒阳市lys +常宁市cns +邵阳市sys +武冈市wgs +岳阳市yys +临湘市lxs +汨罗市mls +常德市cds +津市市jss +益阳市yys +沅江市yjs +郴州市czs +资兴市zxs +永州市yzs +怀化市hhs +洪江市hjs +娄底市lds +涟源市lys +吉首市jss +冷水江市lsjs +张家界市zjjs +广东省gds +广州市gzs +从化市chs +增城市zcs +深圳市szs +珠海市zhs +汕头市sts +韶关市sgs +乐昌市lcs +南雄市nxs +佛山市fss +江门市jms +台山市tss +开平市kps +鹤山市hss +恩平市eps +湛江市zjs +廉江市ljs +雷州市lzs +吴川市wcs +茂名市mms +西昌市xcs +峨眉山市emss +都江堰市djys +攀枝花市pzhs +贵州省gzs +贵阳市gys +清镇市qzs +遵义市zys +赤水市css +仁怀市rhs +安顺市ass +毕节市bjs +兴义市xys +凯里市kls +都匀市dys +福泉市fqs +六盘水市lpss +六枝特区lztq +万山特区wstq +云南省yns +昆明市kms +安宁市ans +曲靖市qjs +宣威市xws +玉溪市yxs +保山市bss +昭通市zts +丽江市ljs +思茅市sms +临沧市lqs +个旧市gjs +开远市kys +景洪市jhs +楚雄市cxs +大理市dls +潞西市lxs +瑞丽市rls +西藏自治区xzzzq +拉萨市lss +陕西省sxs +西安市xas +铜川市tcs +宝鸡市bjs +咸阳市xys +渭南市wns +韩城市hcs +华阴市hys +延安市yas +汉中市azs +榆林市yls +安康市aks +商洛市sls +甘肃省gss +兰州市lzs +金昌市jcs +白银市bys +天水市tss +武威市wws +张掖市zys +平凉市pls +酒泉市jqs +玉门市yms +敦煌市dhs +庆阳市qys +定西市dxs +陇南市lns +临夏市lxs +合作市hzs +嘉峪关市jygs +青海省qhs +西宁市xns +德令哈市dlhs +格尔木市gems +宁夏回族自治区nxhzzzq +银川市ycs +灵武市lws +吴忠市wzs +固原市gys +中卫市zws +石嘴山市szss +青铜峡市qtxs +新疆维吾尔自治区xjwwezzq +喀什市kss +昌吉市cjs +阜康市fks +米泉市mqs +博乐市bls +伊宁市yns +奎屯市kts +塔城市tcs +乌苏市wss +石河子市shzs +阿拉尔市ales +五家渠市wjqs +吐鲁番市tlfs +阿克苏市akss +阿图什市atss +库尔勒市kels +阿勒泰市alts +乌鲁木齐市wlmqs +克拉玛依市klmys +图木舒克市tmsks +香港特别行政区 +中西区zxq +东区dq +观塘区gtq +南区nq +湾仔区wzq +离岛区ldq +葵青区kqq +北区bq +西贡区xgq +沙田区stq +屯门区tmq +大埔区dpq +荃湾区qwq +元朗区ylq +九龙城区jtcq +油尖旺区yjwq +深水埗区ssbq +黄大仙区hdxq +台湾省tws +台北市tbs +高雄市gxs +基隆市jls +台中市tzs +台南市tns +新竹市xzs +嘉义市jys +板桥市bqs +宜兰市yls +竹北市zbs +桃园市tys +苗栗市mls +丰原市fys +彰化市zhs +南投市nts +太保市tbs +斗六市dls +新营市xys +凤山市fss +屏东市pds +台东市tds +花莲市hls +马公市mgs diff --git a/ZkEdit.cpp b/ZkEdit.cpp index 2d1ff38..0cb88d6 100644 --- a/ZkEdit.cpp +++ b/ZkEdit.cpp @@ -1,265 +1,265 @@ -#include "ZkEdit.h" -#include "ui_zkedit.h" -#include "SysPara.h" -#include -#include - -ZkEdit::ZkEdit(QWidget *parent) : - QWidget(parent), - ui(new Ui::ZkEdit) -{ - ui->setupUi(this); - fileDialog = 0; - openedFileName = ""; - newFileAppending = false; - connect(ui->widgetPic,SIGNAL(picWidgetModify(int ,int )),this,SLOT(enableSaveButton(int ,int ))); - connect(ui->checkBoxPicExpand,SIGNAL(clicked(bool)),this,SLOT(oncheckboxExpandClicked(bool))); - connect(ui->checkBoxTrimPic,SIGNAL(clicked(bool)),this,SLOT(oncheckboxTrimPicClicked(bool))); - ui->pushButtonSave->setEnabled(false); - forcePicWidgetSize = false; -#ifdef MYSAVEFILEDLG - dialogSaveFile =new DialogSaveFile(0); -#endif - -} - -ZkEdit::~ZkEdit() -{ - delete ui; -#ifdef MYSAVEFILEDLG - if(dialogSaveFile) delete dialogSaveFile; -#endif - if(fileDialog) - delete fileDialog; - -} - -void ZkEdit::oncheckboxExpandClicked(bool) -{ - ui->checkBoxTrimPic->setCheckState(Qt::Unchecked); -} - -void ZkEdit::oncheckboxTrimPicClicked(bool) -{ - ui->checkBoxPicExpand->setCheckState(Qt::Unchecked); -} - -void ZkEdit::checkNewFileAppending(){ - if(newFileAppending){ - ui->widgetPic->initWidget(ui->spinBoxWidthPoint->value(),ui->spinBoxHeightPoint->value()); - openedFileName = ""; - } - newFileAppending = false; -} - -void ZkEdit::onSave_File_reject(){ - checkNewFileAppending(); -} - -bool ZkEdit::maybeSave(){ - if(!ui->widgetPic->isModified()) - return true; - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("图片已经改变,是否保存?")); - QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - - msgBox.exec(); - - if (msgBox.clickedButton() == saveButton) { - newFileAppending = true; - on_pushButtonSave_clicked(); - return false; - } else if (msgBox.clickedButton() == cancleSaveButton) { - return true; - } - else - return false; - - return true; -} - -void ZkEdit::on_pushButtonNew_pressed(){ - if(maybeSave()){ - ui->widgetPic->initWidget(ui->spinBoxWidthPoint->value(),ui->spinBoxHeightPoint->value()); - openedFileName = ""; - } -} - -void ZkEdit::enableSaveButton(int w,int h){ - ui->pushButtonSave->setEnabled(true); - ui->spinBoxHeightPoint->setValue(h); - ui->spinBoxWidthPoint->setValue(w); -} - -void ZkEdit::on_pushButtonEnlarge_pressed() -{ - ui->widgetPic->enlargeDisplay(); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); -} - -void ZkEdit::on_pushButtonReduce_pressed() -{ - ui->widgetPic->reduceDisplay(); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); -} - -void ZkEdit::on_pushButtonUp_pressed() -{ - //ui->widgetPic->currPositionMove(0,-1); - ui->widgetPic->currPositionMove(0,-1,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); -} - -void ZkEdit::on_pushButtonLeft_pressed() -{ - //ui->widgetPic->currPositionMove(-1,0); - ui->widgetPic->currPositionMove(-1,0,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); -} - -void ZkEdit::on_pushButtonEnsure_pressed() -{ - ui->widgetPic->ensureCurrPos(); -} - -void ZkEdit::on_pushButtonRight_pressed() -{ - //ui->widgetPic->currPositionMove(1,0); - ui->widgetPic->currPositionMove(1,0,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); -} - -void ZkEdit::on_pushButtonDown_pressed() -{ - //ui->widgetPic->currPositionMove(0,1); - ui->widgetPic->currPositionMove(0,1,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); -} - -void ZkEdit::on_pushButtonSaveAs_clicked() -{ -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->setTitleTxt(tr("图片另存为...")); - dialogSaveFile->refreshListView(2); - dialogSaveFile->setEnterFileName(""); - dialogSaveFile->show(); -#else - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR),QString("Picture files (*.jpg )")); -#endif - -} -void ZkEdit::onSaveASFile(QString fileName,bool Flag){// use for dialogSaveFile class - // filename= fileName ; - if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) - fileName = QFileInfo(fileName).baseName()+ ".jpg"; - - ui->widgetPic->saveImage(fileName); - ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(fileName); - - checkNewFileAppending(); - -} - -void ZkEdit::onSaveAS_FIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - QString fileName = files[i]; - if( // !fileName.endsWith(".gif",Qt::CaseInsensitive) - //&& !fileName.endsWith(".jpeg",Qt::CaseInsensitive) - // && - !fileName.endsWith(".jpg",Qt::CaseInsensitive) - //&& !fileName.endsWith(".png",Qt::CaseInsensitive) - //&& !fileName.endsWith(".bmp",Qt::CaseInsensitive) - ) - fileName += ".jpg"; - - ui->widgetPic->saveImage(fileName); - ui->pushButtonSave->setEnabled(false); - openedFileName = fileName; - ui->labelFileName->setText(fileName); - } - checkNewFileAppending(); -} - -void ZkEdit::on_pushButtonOpen_clicked() -{ - forcePicWidgetSize = false; - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); - fileDialog->showFileDialog(tr("打开文件"),QString(DOC_ROOT_DIR), - QString("Picture files ( *.jpeg *.bmp *.gif *.png *jpg)")); -} - - -void ZkEdit::onOpenFIle_select(){ - QStringList files = fileDialog->selectedFiles(); - for(int i = 0;i < files.size(); i++){ - QString fileName = files.value(i); - ui->widgetPic->loadImage(fileName,forcePicWidgetSize); - openedFileName = fileName; - ui->labelFileName->setText(fileName); - ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); - ui->spinBoxHeightPoint->setValue(ui->widgetPic->getHeight()); - ui->spinBoxWidthPoint->setValue(ui->widgetPic->getWidth()); - } -} - -void ZkEdit::on_pushButtonSave_clicked() -{ - if(!openedFileName.isEmpty()){ - ui->widgetPic->saveImage(openedFileName); - ui->pushButtonSave->setEnabled(false); - } - else { - #ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->setTitleTxt(tr("图片保存为...")); - dialogSaveFile->refreshListView(2); - dialogSaveFile->setEnterFileName(""); - dialogSaveFile->show(); - #else - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); - fileDialog->showFileDialog(tr("保存"),QString(DOC_ROOT_DIR),QString("Picture files ( *.jpg )")); - #endif - } -} - -void ZkEdit::on_pushButtonImport_clicked() -{ - forcePicWidgetSize = true; - if(fileDialog) - delete fileDialog; - fileDialog = new MyFileDialog(0); - disconnect(fileDialog,SIGNAL(accepted()),0,0); - connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); - fileDialog->showFileDialog(tr("导入文件"),QString(DOC_ROOT_DIR),QString("Picture files (*.png *.jpeg *.jpg *.gif *.bmp)")); -} - -void ZkEdit::keyPressEvent(QKeyEvent *e) -{ - switch(e->key()) - { - case Qt::Key_Return:on_pushButtonEnsure_pressed();break; - case Qt::Key_Up: on_pushButtonUp_pressed();break; - case Qt::Key_Left: on_pushButtonLeft_pressed();break; - case Qt::Key_Right:on_pushButtonRight_pressed();break; - case Qt::Key_Down:on_pushButtonDown_pressed();break; - } -} - +#include "ZkEdit.h" +#include "ui_zkedit.h" +#include "SysPara.h" +#include +#include + +ZkEdit::ZkEdit(QWidget *parent) : + QWidget(parent), + ui(new Ui::ZkEdit) +{ + ui->setupUi(this); + fileDialog = 0; + openedFileName = ""; + newFileAppending = false; + connect(ui->widgetPic,SIGNAL(picWidgetModify(int ,int )),this,SLOT(enableSaveButton(int ,int ))); + connect(ui->checkBoxPicExpand,SIGNAL(clicked(bool)),this,SLOT(oncheckboxExpandClicked(bool))); + connect(ui->checkBoxTrimPic,SIGNAL(clicked(bool)),this,SLOT(oncheckboxTrimPicClicked(bool))); + ui->pushButtonSave->setEnabled(false); + forcePicWidgetSize = false; +#ifdef MYSAVEFILEDLG + dialogSaveFile =new DialogSaveFile(0); +#endif + +} + +ZkEdit::~ZkEdit() +{ + delete ui; +#ifdef MYSAVEFILEDLG + if(dialogSaveFile) delete dialogSaveFile; +#endif + if(fileDialog) + delete fileDialog; + +} + +void ZkEdit::oncheckboxExpandClicked(bool) +{ + ui->checkBoxTrimPic->setCheckState(Qt::Unchecked); +} + +void ZkEdit::oncheckboxTrimPicClicked(bool) +{ + ui->checkBoxPicExpand->setCheckState(Qt::Unchecked); +} + +void ZkEdit::checkNewFileAppending(){ + if(newFileAppending){ + ui->widgetPic->initWidget(ui->spinBoxWidthPoint->value(),ui->spinBoxHeightPoint->value()); + openedFileName = ""; + } + newFileAppending = false; +} + +void ZkEdit::onSave_File_reject(){ + checkNewFileAppending(); +} + +bool ZkEdit::maybeSave(){ + if(!ui->widgetPic->isModified()) + return true; + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("图片已经改变,是否保存?")); + QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + + msgBox.exec(); + + if (msgBox.clickedButton() == saveButton) { + newFileAppending = true; + on_pushButtonSave_clicked(); + return false; + } else if (msgBox.clickedButton() == cancleSaveButton) { + return true; + } + else + return false; + + return true; +} + +void ZkEdit::on_pushButtonNew_pressed(){ + if(maybeSave()){ + ui->widgetPic->initWidget(ui->spinBoxWidthPoint->value(),ui->spinBoxHeightPoint->value()); + openedFileName = ""; + } +} + +void ZkEdit::enableSaveButton(int w,int h){ + ui->pushButtonSave->setEnabled(true); + ui->spinBoxHeightPoint->setValue(h); + ui->spinBoxWidthPoint->setValue(w); +} + +void ZkEdit::on_pushButtonEnlarge_pressed() +{ + ui->widgetPic->enlargeDisplay(); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); +} + +void ZkEdit::on_pushButtonReduce_pressed() +{ + ui->widgetPic->reduceDisplay(); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); +} + +void ZkEdit::on_pushButtonUp_pressed() +{ + //ui->widgetPic->currPositionMove(0,-1); + ui->widgetPic->currPositionMove(0,-1,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); +} + +void ZkEdit::on_pushButtonLeft_pressed() +{ + //ui->widgetPic->currPositionMove(-1,0); + ui->widgetPic->currPositionMove(-1,0,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); +} + +void ZkEdit::on_pushButtonEnsure_pressed() +{ + ui->widgetPic->ensureCurrPos(); +} + +void ZkEdit::on_pushButtonRight_pressed() +{ + //ui->widgetPic->currPositionMove(1,0); + ui->widgetPic->currPositionMove(1,0,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); +} + +void ZkEdit::on_pushButtonDown_pressed() +{ + //ui->widgetPic->currPositionMove(0,1); + ui->widgetPic->currPositionMove(0,1,0,ui->checkBoxTrimPic->isChecked(),ui->checkBoxPicExpand->isChecked()); +} + +void ZkEdit::on_pushButtonSaveAs_clicked() +{ +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->setTitleTxt(tr("图片另存为...")); + dialogSaveFile->refreshListView(2); + dialogSaveFile->setEnterFileName(""); + dialogSaveFile->show(); +#else + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + fileDialog->showFileDialog(tr("另存为"),QString(DOC_ROOT_DIR),QString("Picture files (*.jpg )")); +#endif + +} +void ZkEdit::onSaveASFile(QString fileName,bool Flag){// use for dialogSaveFile class + // filename= fileName ; + if( !fileName.endsWith(".jpg",Qt::CaseInsensitive) ) + fileName = QFileInfo(fileName).baseName()+ ".jpg"; + + ui->widgetPic->saveImage(fileName); + ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(fileName); + + checkNewFileAppending(); + +} + +void ZkEdit::onSaveAS_FIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + QString fileName = files[i]; + if( // !fileName.endsWith(".gif",Qt::CaseInsensitive) + //&& !fileName.endsWith(".jpeg",Qt::CaseInsensitive) + // && + !fileName.endsWith(".jpg",Qt::CaseInsensitive) + //&& !fileName.endsWith(".png",Qt::CaseInsensitive) + //&& !fileName.endsWith(".bmp",Qt::CaseInsensitive) + ) + fileName += ".jpg"; + + ui->widgetPic->saveImage(fileName); + ui->pushButtonSave->setEnabled(false); + openedFileName = fileName; + ui->labelFileName->setText(fileName); + } + checkNewFileAppending(); +} + +void ZkEdit::on_pushButtonOpen_clicked() +{ + forcePicWidgetSize = false; + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); + fileDialog->showFileDialog(tr("打开文件"),QString(DOC_ROOT_DIR), + QString("Picture files ( *.jpeg *.bmp *.gif *.png *jpg)")); +} + + +void ZkEdit::onOpenFIle_select(){ + QStringList files = fileDialog->selectedFiles(); + for(int i = 0;i < files.size(); i++){ + QString fileName = files.value(i); + ui->widgetPic->loadImage(fileName,forcePicWidgetSize); + openedFileName = fileName; + ui->labelFileName->setText(fileName); + ui->labelScaleLeval->setText(tr("放大倍数:%1").arg(ui->widgetPic->getScaleValue())); + ui->spinBoxHeightPoint->setValue(ui->widgetPic->getHeight()); + ui->spinBoxWidthPoint->setValue(ui->widgetPic->getWidth()); + } +} + +void ZkEdit::on_pushButtonSave_clicked() +{ + if(!openedFileName.isEmpty()){ + ui->widgetPic->saveImage(openedFileName); + ui->pushButtonSave->setEnabled(false); + } + else { + #ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->setTitleTxt(tr("图片保存为...")); + dialogSaveFile->refreshListView(2); + dialogSaveFile->setEnterFileName(""); + dialogSaveFile->show(); + #else + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(rejected()),this,SLOT(onSave_File_reject())); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onSaveAS_FIle_select())); + fileDialog->showFileDialog(tr("保存"),QString(DOC_ROOT_DIR),QString("Picture files ( *.jpg )")); + #endif + } +} + +void ZkEdit::on_pushButtonImport_clicked() +{ + forcePicWidgetSize = true; + if(fileDialog) + delete fileDialog; + fileDialog = new MyFileDialog(0); + disconnect(fileDialog,SIGNAL(accepted()),0,0); + connect(fileDialog,SIGNAL(accepted()),this,SLOT(onOpenFIle_select())); + fileDialog->showFileDialog(tr("导入文件"),QString(DOC_ROOT_DIR),QString("Picture files (*.png *.jpeg *.jpg *.gif *.bmp)")); +} + +void ZkEdit::keyPressEvent(QKeyEvent *e) +{ + switch(e->key()) + { + case Qt::Key_Return:on_pushButtonEnsure_pressed();break; + case Qt::Key_Up: on_pushButtonUp_pressed();break; + case Qt::Key_Left: on_pushButtonLeft_pressed();break; + case Qt::Key_Right:on_pushButtonRight_pressed();break; + case Qt::Key_Down:on_pushButtonDown_pressed();break; + } +} + diff --git a/ZkEdit.h b/ZkEdit.h index 3f683f9..d945876 100644 --- a/ZkEdit.h +++ b/ZkEdit.h @@ -1,73 +1,73 @@ -#ifndef ZKEDIT_H -#define ZKEDIT_H - -#include -#include -#include -#include -#include "MyFileDialog.h" -#include "DialogSaveFile.h" -#include "myinclude.h" -namespace Ui { -class ZkEdit; -} - -#define MAX_PIC_HEIGHT 40 -#define MAX_PIC_WIDTH 100 -class ZkEdit : public QWidget -{ - Q_OBJECT - -public: - explicit ZkEdit(QWidget *parent = 0); - ~ZkEdit(); - -protected slots: - void onSaveASFile(QString fileName, bool Flag); -private slots: - void on_pushButtonNew_pressed(); - - void on_pushButtonEnlarge_pressed(); - - void on_pushButtonReduce_pressed(); - - void on_pushButtonUp_pressed(); - - void on_pushButtonLeft_pressed(); - - void on_pushButtonEnsure_pressed(); - - void on_pushButtonRight_pressed(); - - void on_pushButtonDown_pressed(); - - void on_pushButtonSaveAs_clicked(); - void onSaveAS_FIle_select(); - void onSave_File_reject(); - void on_pushButtonOpen_clicked(); - void onOpenFIle_select(); - void on_pushButtonSave_clicked(); - - void enableSaveButton(int w,int h); - - void on_pushButtonImport_clicked(); - void oncheckboxExpandClicked(bool); - void oncheckboxTrimPicClicked(bool); - -private: - Ui::ZkEdit *ui; - MyFileDialog *fileDialog; - QString openedFileName; - bool newFileAppending; - void checkNewFileAppending(); - bool maybeSave(); - bool forcePicWidgetSize; - void keyPressEvent(QKeyEvent *e); -#ifdef MYSAVEFILEDLG - DialogSaveFile *dialogSaveFile; -#endif -}; - -#endif -// ZKEDIT_H - +#ifndef ZKEDIT_H +#define ZKEDIT_H + +#include +#include +#include +#include +#include "MyFileDialog.h" +#include "DialogSaveFile.h" +#include "myinclude.h" +namespace Ui { +class ZkEdit; +} + +#define MAX_PIC_HEIGHT 40 +#define MAX_PIC_WIDTH 100 +class ZkEdit : public QWidget +{ + Q_OBJECT + +public: + explicit ZkEdit(QWidget *parent = 0); + ~ZkEdit(); + +protected slots: + void onSaveASFile(QString fileName, bool Flag); +private slots: + void on_pushButtonNew_pressed(); + + void on_pushButtonEnlarge_pressed(); + + void on_pushButtonReduce_pressed(); + + void on_pushButtonUp_pressed(); + + void on_pushButtonLeft_pressed(); + + void on_pushButtonEnsure_pressed(); + + void on_pushButtonRight_pressed(); + + void on_pushButtonDown_pressed(); + + void on_pushButtonSaveAs_clicked(); + void onSaveAS_FIle_select(); + void onSave_File_reject(); + void on_pushButtonOpen_clicked(); + void onOpenFIle_select(); + void on_pushButtonSave_clicked(); + + void enableSaveButton(int w,int h); + + void on_pushButtonImport_clicked(); + void oncheckboxExpandClicked(bool); + void oncheckboxTrimPicClicked(bool); + +private: + Ui::ZkEdit *ui; + MyFileDialog *fileDialog; + QString openedFileName; + bool newFileAppending; + void checkNewFileAppending(); + bool maybeSave(); + bool forcePicWidgetSize; + void keyPressEvent(QKeyEvent *e); +#ifdef MYSAVEFILEDLG + DialogSaveFile *dialogSaveFile; +#endif +}; + +#endif +// ZKEDIT_H + diff --git a/arm_build b/arm_build index 9d508be..a6d3e66 100644 --- a/arm_build +++ b/arm_build @@ -1,3 +1,3 @@ -/usr/local/Trolltech/QtEmbedded-4.6.3-arm/bin/qmake -project -#echo "TRANSLATIONS = chinese.ts english.ts" >> QtUI.pro -/usr/local/Trolltech/QtEmbedded-4.6.3-arm/bin/qmake +/usr/local/Trolltech/QtEmbedded-4.6.3-arm/bin/qmake -project +#echo "TRANSLATIONS = chinese.ts english.ts" >> QtUI.pro +/usr/local/Trolltech/QtEmbedded-4.6.3-arm/bin/qmake diff --git a/buge_record.txt b/buge_record.txt index a80461c..12e1348 100644 --- a/buge_record.txt +++ b/buge_record.txt @@ -1,228 +1,228 @@ - -2017.9.16:为兼容am335x,添加新的pwm控制方式 - -2017.8.30:调整FPGA通信异常判别阀值,减少误判提示 - -备忘内容:主板的型号与软件版本 -`define JETV3 // EP4F15 V3板子 -`define JETV32 // EP3C10 V4板子 -`define JETV23 // V23板子 EP3C25 - -2017.8.29:显示字库文件检验码,字库可导出U盘。(完成) - -2017.8.27 支持多段长度顺序打印 - 设置 数组 保存: 计数器1起始值,结束值,重复次数 - 还在考虑设计方案。 -2017.8.26 支持145KHz晶振 - 版本日期: 2017.8.26 23:25 - -2017.8.26 增加自动清洗功能分3个步骤 - 版本日期: 2017.8.25 20:10(左右) -2017.8.21 解决清洗会关供墨阀问题 - 版本日期: 2017.8.21 15:36 - - -2017.8.19 测试内容:卷间隔打印 -1. ARM文件更新为:QtUI (2017-8-18 21:37:08) -2. FPGA有两个版本,分别测试一下,看哪个版本能用 - 测试1:刷FPGA文件 cheap_Jet3V2(0726-1).pof (No52) - 测试2:刷FPGA文件 cheap_Jet3V2(A87T-3).pof (No53) - -2017.7.18 -1. FPGA与QtUI都要更新 -2. QtUI可通过U盘升级 -3. FPGA文件(A87T.pof)请通过FPGA的下载线更新 - -A87T.pof 测试结果 位置不固定,但长度正确 - -A87T-1.pof 等测试 - -20160729: 发现打开历史记录会死机问题,原因待查。但执行删除历史记录后,可避免再次死机。 -20160723: 增加电眼复位功能。 与电眼清零不同,复位时,计数不清零,而是等于预设的当前值。 -20160718: 参考日立方案,优化打印效果 -20160715: 增加了 0/00 字符 -20160717: 修改了12点阵纯变量时的点阵数 -20160630: 修正粘度测量时间错误问题 - -20151218 增加开机次数和开机时间显示功能 -20151210 修正点阵方式下变量数大于8时,出现死机现象 -20151210 修正文本方式垂直点阵数不正确问题。单行可以了,多行则还会出现多余空行。 -20151206 粘度低报警问题 -20151204 开机默认打开:高压故障关回收槽功能 -20151204 主界面增加逆清洗按钮 -20151204 进一步细分晶振搜索电压步进值 - - -20151127 修正二维码图案的下一行显示不全问题 -20151121 高压故障自动关闭回收槽 -20151119 增加打开文件,自动自动清零选项 -20151110 增加外部电眼自动清零且计数器2加1 -20151109 新增计数1和计数器2单独立即清零 版本号 No42 -20151017 二维码变量任意位置显示问题 -20151015 二维码变量可显示 -20151012 增加DataMatrix二维码功能 - -20151001 by20150127 -20150210 关闭主界面温度报警显示; 最新字库为20150210字库 -20150209 新增:温度、直径等部分特殊字符(需要升级字库) -20150207 修改界面显示:墨水泄漏改为墨水缸满 -20150207 开机时,喷头温度延时30分钟报警 -20150127 新增同步方式下,电眼立即清零功能(ARM与FPGA一起更新No.28) -20150124 修正原有“变量周”计算错误 -20150119 修正产品脉冲输出延时问题 -20150118 修正双计数器出现不同步问题 -20150114 修正超慢打印时,喷印延时数据溢出错误 -20150111 修改管材,电缆的时间方式喷印间隔(取值6~9999999ms),与旧版本不完全兼容。 -20150109 测试二维码喷印 -20141211 点阵方式9X6字库改为9X7 -20141211 修正插入某些图案出现多余点问题 -20141208 开发新版电脑编字软件 -20141127 完善了喷嘴逆清洗功能 -20141116 测试了AB双相同步器功能(未应用) -20141110 测试了自动开机循环功能(未应用) -20141106 增加了压力调整和高压重置的限制 -20141101 修正毫米脉冲数大时速度显示问题 -20141029 调整部分默认参数 -20141023 修正英文版本翻译不全 -20141017 FPGA修正同步方式利用电眼信号触发清0问题 -20141009 修正超速对话框与参数保存对话框冲突问题 -20141008 - 1. 修正上一版本中存在的图形方式下,输入变量没有变绿底问题。打印时计数器显示正常。 - 2. 注意测试的内容:系统参数是否还会出现丢失现象 -20140915 - * 修正了不同字体混编时,通过回车符上移光标问题。 -20140909 - * 机箱温度显示 -20140830 - * 修正点击权限按钮时出现信息显示行数错误问题 -20140731 - * 限制电眼误触发; 时间触发的行末到行首问题已修正. -201400707 - * 解决下位灯影响粘度泵工作问题 - -20140628 - * 修正shift键影响中文输入问题 - * 计数器立即清零 - * 不同步走米功能修正:选择时不同步走米时,不受故障和停止键影响; 不选择时,由打印和停止键控制计米器 - -20140620 - * 最大可编辑信息长度为3100列 - * 墨水或溶剂空超过3小时,自动关机 - * 1/8电压调整 - * 整列电压调整 -20140620 - * 修正点阵模式部分中文符号不能输入问题 - * 修正回收故障动作不正常问题 -20140609 - * 部分中文加粗显示 -20140608 - * 部分变量加粗显示 -20140606 - * 部分字符加粗显示 -20140528 - * 新增不打印走米选择项 -20140527 - * 修正一处同步打印触发错误(FPGA) -20140526 - * 增加立即清零按钮,不需等待上一米打印完成,也可以直接打印新行。 --测试中,未完成。 - * ARM与FPGA均需要升级. -20140523 - * 修正回收故障恢复异常 -20140523 - * 修正文件不能删除问题(A3.05) -20140506 - * 更换3.14字库 -2014/5/5 - *修正默认参数异常问题 -2014/4/28 - *修正泄压阀由FPGA控制控制时,不动作问题.(仅需FPGA) - *计数器清0测试完成。 - -2014/4/26 - * 解决计数复位不正确;泄压阀由FPGA控制(需改变电阻连接) - -20140423 - * 修正V4板泄压阀工作异常,由FPGA处理; 修正计数器复位异常(0有时不打印情况); FPGA 需要升级 -20140418 - * 修正V4板主泵状态异常。 -20140417 - * 修正预览出现显示不全问题.修正暂停按钮英文拼写错误。 -20140415 - * 修正英文版翻译不全问题. -20140411 - * 修正喷嘴逆清洗存在的黑屏问题; 修正V4版回收故障显示错误(FPGA需要升级) -20140410 - * 优化系统界面字体,新增英文版本,要升级字库。 -20140407 - * 实现:点阵模式下变量可加粗 -20140328 - * 点距微调加到独立参数设置;解决删除图片存在的问题 -20140327 - * 更新版本号为A304:增加独立参数设置 -20140326 - *修正图案上下倒置问题。 -20140319 - *增加超速不打印设置选项。 -20140318 - *更正字库编辑不能正常切换问题。 -20140317 - *更正不打印走米提示信息。 -20140316 - *修正不打印走米暂停逻辑。 - -20140315 - * 修正高压包最大容差为50 - * 新增同步方式下,不打印走米(测试) -20140314 - * 修正交替打印字宽问题 - * 修正平字方编码错误 -20140312 - * 修正交替打印字高减半问题 - * 修正电机动作方式,改脉冲式 - * A3.03/Fx.1.3 No.7 -20140311 - * 完善键盘部分字符不能显示问题 - * 完善编辑状态下的键盘操作 - * 修正电机动作方式 - * 修正自然计数米界面显示 - -20140310 - * 修正变量(计数器)放置在信息最末尾时,出现保存后不能编辑的问题 - * 修正交替打印时,光栅高度显示值不正确问题 - * 修正交替打印与显示不一致问题 - * 版本标识:A3.03/Fx.1.3 No.6 -20140309 - ** 注意A3.03必须与Fx.1.3配套使用 ** - * 交替打印功能移到FPGA实现,ARM软件也作相应修改 - * 交替打印信息按正常方式编辑,变量使用无特殊要求! - * 新增版本信息记录界面 - * 修正文本-点阵界面切换存在的问题 - * 修正点阵界面下开机不能自动加载文件的问题 - * 修正字库编辑功能无法开启 - * 修正字库倒置问题 - * 完善了插入图案功能,点阵编辑界面也支持JPG、BMP等图片格式 -20140308 - * 版本号改为A3.03,识别码变更 - * 修正变量显示位置不正确问题 -20140307 - * 解决文本编辑方式平方不正常问题 -20140306 - * 两种编辑方式切换改为人工切换,在[系统设置]中进行设置 -20140305 - * 打印不完报警 -20140304 - * 修改完善12点阵和16点阵的文本字库 -20140301 - * 整合两种编辑方式(点阵方式与文件方式) -20140228 - * 修改完善英文点阵字库 -20140226 - * 解决晶振电压调整出现的问题 -20140221 - * 文本方式编字,增加了以下主要功能: - * FPGA控制主墨泵 - * FPGA控制电机 - * 回收故障关墨线 - * 交替打印 - * 自然数计米 - * 开喷头盖,相位故障仍能走米 + +2017.9.16:为兼容am335x,添加新的pwm控制方式 + +2017.8.30:调整FPGA通信异常判别阀值,减少误判提示 + +备忘内容:主板的型号与软件版本 +`define JETV3 // EP4F15 V3板子 +`define JETV32 // EP3C10 V4板子 +`define JETV23 // V23板子 EP3C25 + +2017.8.29:显示字库文件检验码,字库可导出U盘。(完成) + +2017.8.27 支持多段长度顺序打印 + 设置 数组 保存: 计数器1起始值,结束值,重复次数 + 还在考虑设计方案。 +2017.8.26 支持145KHz晶振 + 版本日期: 2017.8.26 23:25 + +2017.8.26 增加自动清洗功能分3个步骤 + 版本日期: 2017.8.25 20:10(左右) +2017.8.21 解决清洗会关供墨阀问题 + 版本日期: 2017.8.21 15:36 + + +2017.8.19 测试内容:卷间隔打印 +1. ARM文件更新为:QtUI (2017-8-18 21:37:08) +2. FPGA有两个版本,分别测试一下,看哪个版本能用 + 测试1:刷FPGA文件 cheap_Jet3V2(0726-1).pof (No52) + 测试2:刷FPGA文件 cheap_Jet3V2(A87T-3).pof (No53) + +2017.7.18 +1. FPGA与QtUI都要更新 +2. QtUI可通过U盘升级 +3. FPGA文件(A87T.pof)请通过FPGA的下载线更新 + +A87T.pof 测试结果 位置不固定,但长度正确 + +A87T-1.pof 等测试 + +20160729: 发现打开历史记录会死机问题,原因待查。但执行删除历史记录后,可避免再次死机。 +20160723: 增加电眼复位功能。 与电眼清零不同,复位时,计数不清零,而是等于预设的当前值。 +20160718: 参考日立方案,优化打印效果 +20160715: 增加了 0/00 字符 +20160717: 修改了12点阵纯变量时的点阵数 +20160630: 修正粘度测量时间错误问题 + +20151218 增加开机次数和开机时间显示功能 +20151210 修正点阵方式下变量数大于8时,出现死机现象 +20151210 修正文本方式垂直点阵数不正确问题。单行可以了,多行则还会出现多余空行。 +20151206 粘度低报警问题 +20151204 开机默认打开:高压故障关回收槽功能 +20151204 主界面增加逆清洗按钮 +20151204 进一步细分晶振搜索电压步进值 + + +20151127 修正二维码图案的下一行显示不全问题 +20151121 高压故障自动关闭回收槽 +20151119 增加打开文件,自动自动清零选项 +20151110 增加外部电眼自动清零且计数器2加1 +20151109 新增计数1和计数器2单独立即清零 版本号 No42 +20151017 二维码变量任意位置显示问题 +20151015 二维码变量可显示 +20151012 增加DataMatrix二维码功能 + +20151001 by20150127 +20150210 关闭主界面温度报警显示; 最新字库为20150210字库 +20150209 新增:温度、直径等部分特殊字符(需要升级字库) +20150207 修改界面显示:墨水泄漏改为墨水缸满 +20150207 开机时,喷头温度延时30分钟报警 +20150127 新增同步方式下,电眼立即清零功能(ARM与FPGA一起更新No.28) +20150124 修正原有“变量周”计算错误 +20150119 修正产品脉冲输出延时问题 +20150118 修正双计数器出现不同步问题 +20150114 修正超慢打印时,喷印延时数据溢出错误 +20150111 修改管材,电缆的时间方式喷印间隔(取值6~9999999ms),与旧版本不完全兼容。 +20150109 测试二维码喷印 +20141211 点阵方式9X6字库改为9X7 +20141211 修正插入某些图案出现多余点问题 +20141208 开发新版电脑编字软件 +20141127 完善了喷嘴逆清洗功能 +20141116 测试了AB双相同步器功能(未应用) +20141110 测试了自动开机循环功能(未应用) +20141106 增加了压力调整和高压重置的限制 +20141101 修正毫米脉冲数大时速度显示问题 +20141029 调整部分默认参数 +20141023 修正英文版本翻译不全 +20141017 FPGA修正同步方式利用电眼信号触发清0问题 +20141009 修正超速对话框与参数保存对话框冲突问题 +20141008 + 1. 修正上一版本中存在的图形方式下,输入变量没有变绿底问题。打印时计数器显示正常。 + 2. 注意测试的内容:系统参数是否还会出现丢失现象 +20140915 + * 修正了不同字体混编时,通过回车符上移光标问题。 +20140909 + * 机箱温度显示 +20140830 + * 修正点击权限按钮时出现信息显示行数错误问题 +20140731 + * 限制电眼误触发; 时间触发的行末到行首问题已修正. +201400707 + * 解决下位灯影响粘度泵工作问题 + +20140628 + * 修正shift键影响中文输入问题 + * 计数器立即清零 + * 不同步走米功能修正:选择时不同步走米时,不受故障和停止键影响; 不选择时,由打印和停止键控制计米器 + +20140620 + * 最大可编辑信息长度为3100列 + * 墨水或溶剂空超过3小时,自动关机 + * 1/8电压调整 + * 整列电压调整 +20140620 + * 修正点阵模式部分中文符号不能输入问题 + * 修正回收故障动作不正常问题 +20140609 + * 部分中文加粗显示 +20140608 + * 部分变量加粗显示 +20140606 + * 部分字符加粗显示 +20140528 + * 新增不打印走米选择项 +20140527 + * 修正一处同步打印触发错误(FPGA) +20140526 + * 增加立即清零按钮,不需等待上一米打印完成,也可以直接打印新行。 --测试中,未完成。 + * ARM与FPGA均需要升级. +20140523 + * 修正回收故障恢复异常 +20140523 + * 修正文件不能删除问题(A3.05) +20140506 + * 更换3.14字库 +2014/5/5 + *修正默认参数异常问题 +2014/4/28 + *修正泄压阀由FPGA控制控制时,不动作问题.(仅需FPGA) + *计数器清0测试完成。 + +2014/4/26 + * 解决计数复位不正确;泄压阀由FPGA控制(需改变电阻连接) + +20140423 + * 修正V4板泄压阀工作异常,由FPGA处理; 修正计数器复位异常(0有时不打印情况); FPGA 需要升级 +20140418 + * 修正V4板主泵状态异常。 +20140417 + * 修正预览出现显示不全问题.修正暂停按钮英文拼写错误。 +20140415 + * 修正英文版翻译不全问题. +20140411 + * 修正喷嘴逆清洗存在的黑屏问题; 修正V4版回收故障显示错误(FPGA需要升级) +20140410 + * 优化系统界面字体,新增英文版本,要升级字库。 +20140407 + * 实现:点阵模式下变量可加粗 +20140328 + * 点距微调加到独立参数设置;解决删除图片存在的问题 +20140327 + * 更新版本号为A304:增加独立参数设置 +20140326 + *修正图案上下倒置问题。 +20140319 + *增加超速不打印设置选项。 +20140318 + *更正字库编辑不能正常切换问题。 +20140317 + *更正不打印走米提示信息。 +20140316 + *修正不打印走米暂停逻辑。 + +20140315 + * 修正高压包最大容差为50 + * 新增同步方式下,不打印走米(测试) +20140314 + * 修正交替打印字宽问题 + * 修正平字方编码错误 +20140312 + * 修正交替打印字高减半问题 + * 修正电机动作方式,改脉冲式 + * A3.03/Fx.1.3 No.7 +20140311 + * 完善键盘部分字符不能显示问题 + * 完善编辑状态下的键盘操作 + * 修正电机动作方式 + * 修正自然计数米界面显示 + +20140310 + * 修正变量(计数器)放置在信息最末尾时,出现保存后不能编辑的问题 + * 修正交替打印时,光栅高度显示值不正确问题 + * 修正交替打印与显示不一致问题 + * 版本标识:A3.03/Fx.1.3 No.6 +20140309 + ** 注意A3.03必须与Fx.1.3配套使用 ** + * 交替打印功能移到FPGA实现,ARM软件也作相应修改 + * 交替打印信息按正常方式编辑,变量使用无特殊要求! + * 新增版本信息记录界面 + * 修正文本-点阵界面切换存在的问题 + * 修正点阵界面下开机不能自动加载文件的问题 + * 修正字库编辑功能无法开启 + * 修正字库倒置问题 + * 完善了插入图案功能,点阵编辑界面也支持JPG、BMP等图片格式 +20140308 + * 版本号改为A3.03,识别码变更 + * 修正变量显示位置不正确问题 +20140307 + * 解决文本编辑方式平方不正常问题 +20140306 + * 两种编辑方式切换改为人工切换,在[系统设置]中进行设置 +20140305 + * 打印不完报警 +20140304 + * 修改完善12点阵和16点阵的文本字库 +20140301 + * 整合两种编辑方式(点阵方式与文件方式) +20140228 + * 修改完善英文点阵字库 +20140226 + * 解决晶振电压调整出现的问题 +20140221 + * 文本方式编字,增加了以下主要功能: + * FPGA控制主墨泵 + * FPGA控制电机 + * 回收故障关墨线 + * 交替打印 + * 自然数计米 + * 开喷头盖,相位故障仍能走米 diff --git a/buge_record1.txt b/buge_record1.txt deleted file mode 100644 index bb0186f..0000000 --- a/buge_record1.txt +++ /dev/null @@ -1,175 +0,0 @@ - - -20151127 修正二维码图案的下一行显示不全问题 -20151121 高压故障自动关闭回收槽 -20151119 增加打开文件,自动自动清零选项 -20151110 增加外部电眼自动清零且计数器2加1 -20151109 新增计数1和计数器2单独立即清零 版本号 No42 -20151017 二维码变量任意位置显示问题 -20151015 二维码变量可显示 -20151012 增加DataMatrix二维码功能 - -20151001 by20150127 -20150210 关闭主界面温度报警显示; 最新字库为20150210字库 -20150209 新增:温度、直径等部分特殊字符(需要升级字库) -20150207 修改界面显示:墨水泄漏改为墨水缸满 -20150207 开机时,喷头温度延时30分钟报警 -20150127 新增同步方式下,电眼立即清零功能(ARM与FPGA一起更新No.28) -20150124 修正原有“变量周”计算错误 -20150119 修正产品脉冲输出延时问题 -20150118 修正双计数器出现不同步问题 -20150114 修正超慢打印时,喷印延时数据溢出错误 -20150111 修改管材,电缆的时间方式喷印间隔(取值6~9999999ms),与旧版本不完全兼容。 -20150109 测试二维码喷印 -20141211 点阵方式9X6字库改为9X7 -20141211 修正插入某些图案出现多余点问题 -20141208 开发新版电脑编字软件 -20141127 完善了喷嘴逆清洗功能 -20141116 测试了AB双相同步器功能(未应用) -20141110 测试了自动开机循环功能(未应用) -20141106 增加了压力调整和高压重置的限制 -20141101 修正毫米脉冲数大时速度显示问题 -20141029 调整部分默认参数 -20141023 修正英文版本翻译不全 -20141017 FPGA修正同步方式利用电眼信号触发清0问题 -20141009 修正超速对话框与参数保存对话框冲突问题 -20141008 - 1. 修正上一版本中存在的图形方式下,输入变量没有变绿底问题。打印时计数器显示正常。 - 2. 注意测试的内容:系统参数是否还会出现丢失现象 -20140915 - * 修正了不同字体混编时,通过回车符上移光标问题。 -20140909 - * 机箱温度显示 -20140830 - * 修正点击权限按钮时出现信息显示行数错误问题 -20140731 - * 限制电眼误触发; 时间触发的行末到行首问题已修正. -201400707 - * 解决下位灯影响粘度泵工作问题 - -20140628 - * 修正shift键影响中文输入问题 - * 计数器立即清零 - * 不同步走米功能修正:选择时不同步走米时,不受故障和停止键影响; 不选择时,由打印和停止键控制计米器 - -20140620 - * 最大可编辑信息长度为3100列 - * 墨水或溶剂空超过3小时,自动关机 - * 1/8电压调整 - * 整列电压调整 -20140620 - * 修正点阵模式部分中文符号不能输入问题 - * 修正回收故障动作不正常问题 -20140609 - * 部分中文加粗显示 -20140608 - * 部分变量加粗显示 -20140606 - * 部分字符加粗显示 -20140528 - * 新增不打印走米选择项 -20140527 - * 修正一处同步打印触发错误(FPGA) -20140526 - * 增加立即清零按钮,不需等待上一米打印完成,也可以直接打印新行。 --测试中,未完成。 - * ARM与FPGA均需要升级. -20140523 - * 修正回收故障恢复异常 -20140523 - * 修正文件不能删除问题(A3.05) -20140506 - * 更换3.14字库 -2014/5/5 - *修正默认参数异常问题 -2014/4/28 - *修正泄压阀由FPGA控制控制时,不动作问题.(仅需FPGA) - *计数器清0测试完成。 - -2014/4/26 - * 解决计数复位不正确;泄压阀由FPGA控制(需改变电阻连接) - -20140423 - * 修正V4板泄压阀工作异常,由FPGA处理; 修正计数器复位异常(0有时不打印情况); FPGA 需要升级 -20140418 - * 修正V4板主泵状态异常。 -20140417 - * 修正预览出现显示不全问题.修正暂停按钮英文拼写错误。 -20140415 - * 修正英文版翻译不全问题. -20140411 - * 修正喷嘴逆清洗存在的黑屏问题; 修正V4版回收故障显示错误(FPGA需要升级) -20140410 - * 优化系统界面字体,新增英文版本,要升级字库。 -20140407 - * 实现:点阵模式下变量可加粗 -20140328 - * 点距微调加到独立参数设置;解决删除图片存在的问题 -20140327 - * 更新版本号为A304:增加独立参数设置 -20140326 - *修正图案上下倒置问题。 -20140319 - *增加超速不打印设置选项。 -20140318 - *更正字库编辑不能正常切换问题。 -20140317 - *更正不打印走米提示信息。 -20140316 - *修正不打印走米暂停逻辑。 - -20140315 - * 修正高压包最大容差为50 - * 新增同步方式下,不打印走米(测试) -20140314 - * 修正交替打印字宽问题 - * 修正平字方编码错误 -20140312 - * 修正交替打印字高减半问题 - * 修正电机动作方式,改脉冲式 - * A3.03/Fx.1.3 No.7 -20140311 - * 完善键盘部分字符不能显示问题 - * 完善编辑状态下的键盘操作 - * 修正电机动作方式 - * 修正自然计数米界面显示 - -20140310 - * 修正变量(计数器)放置在信息最末尾时,出现保存后不能编辑的问题 - * 修正交替打印时,光栅高度显示值不正确问题 - * 修正交替打印与显示不一致问题 - * 版本标识:A3.03/Fx.1.3 No.6 -20140309 - ** 注意A3.03必须与Fx.1.3配套使用 ** - * 交替打印功能移到FPGA实现,ARM软件也作相应修改 - * 交替打印信息按正常方式编辑,变量使用无特殊要求! - * 新增版本信息记录界面 - * 修正文本-点阵界面切换存在的问题 - * 修正点阵界面下开机不能自动加载文件的问题 - * 修正字库编辑功能无法开启 - * 修正字库倒置问题 - * 完善了插入图案功能,点阵编辑界面也支持JPG、BMP等图片格式 -20140308 - * 版本号改为A3.03,识别码变更 - * 修正变量显示位置不正确问题 -20140307 - * 解决文本编辑方式平方不正常问题 -20140306 - * 两种编辑方式切换改为人工切换,在[系统设置]中进行设置 -20140305 - * 打印不完报警 -20140304 - * 修改完善12点阵和16点阵的文本字库 -20140301 - * 整合两种编辑方式(点阵方式与文件方式) -20140228 - * 修改完善英文点阵字库 -20140226 - * 解决晶振电压调整出现的问题 -20140221 - * 文本方式编字,增加了以下主要功能: - * FPGA控制主墨泵 - * FPGA控制电机 - * 回收故障关墨线 - * 交替打印 - * 自然数计米 - * 开喷头盖,相位故障仍能走米 diff --git a/clear_svn.bat b/clear_svn.bat index e745021..bea742e 100644 --- a/clear_svn.bat +++ b/clear_svn.bat @@ -1,3 +1,3 @@ -.svn\sqlite3 .svn\wc.db; -select * from work_queue; +.svn\sqlite3 .svn\wc.db; +select * from work_queue; delete from work_queue; \ No newline at end of file diff --git a/close.svg b/close.svg index e8505ba..de3741c 100644 --- a/close.svg +++ b/close.svg @@ -1,16 +1,16 @@ - - - 关闭 - - - - - - - - - - - - + + + 关闭 + + + + + + + + + + + + \ No newline at end of file diff --git a/conf/addrset.txt b/conf/addrset.txt index 7c400b2..e292a45 100644 --- a/conf/addrset.txt +++ b/conf/addrset.txt @@ -1,17 +1,17 @@ -A680,256 -A780,384 -A900,512 -AB00,640 -BC00,3200 -CD00,1024 -BC00,320 -BE00,320 -B500,9216 -B200,9216 -B800,240 -B900,320 -BA00,400 -C000,256 -e000,4096 -F,39995 -12,23976 +A680,256 +A780,384 +A900,512 +AB00,640 +BC00,3200 +CD00,1024 +BC00,320 +BE00,320 +B500,9216 +B200,9216 +B800,240 +B900,320 +BA00,400 +C000,256 +e000,4096 +F,39995 +12,23976 diff --git a/conf/config.ini b/conf/config.ini index 34ad14d..a2ff1d9 100644 --- a/conf/config.ini +++ b/conf/config.ini @@ -1,12 +1,12 @@ -[logging] -fileName=/home/plg/loginfo/ -minLevel=DEBUG -bufferSize=0 -maxSize=200000 -maxBackups=20 -;timestampFormat=dd.MM.yyyy hh:mm:ss.zzz -timestampFormat=yyyy-MM-dd hh:mm:ss.zzz -;msgFormat={timestamp} {typeNr} {type} {msg} -;msgFormat={timestamp} {typeNr} {type} {thread} {msg} -msgFormat={timestamp} {typeNr} {type} {function} @{line} {msg} - +[logging] +fileName=/home/plg/loginfo/ +minLevel=DEBUG +bufferSize=0 +maxSize=200000 +maxBackups=20 +;timestampFormat=dd.MM.yyyy hh:mm:ss.zzz +timestampFormat=yyyy-MM-dd hh:mm:ss.zzz +;msgFormat={timestamp} {typeNr} {type} {msg} +;msgFormat={timestamp} {typeNr} {type} {thread} {msg} +msgFormat={timestamp} {typeNr} {type} {function} @{line} {msg} + diff --git a/conf/fast_128k_7dot_dac.txt b/conf/fast_128k_7dot_dac.txt index 4538bc5..adaa7bd 100644 --- a/conf/fast_128k_7dot_dac.txt +++ b/conf/fast_128k_7dot_dac.txt @@ -1,128 +1,128 @@ -0,0,0,0,0,0,0,0,0 -900,0,0,0,0,0,0,0,0 -0,1050,0,0,0,0,0,0,0 -920,1240,0,0,0,0,0,0,0 -0,0,1240,0,0,0,0,0,0 -940,0,1350,0,0,0,0,0,0 -0,1050,1400,0,0,0,0,0,0 -950,1280,1460,0,0,0,0,0,0 -0,0,0,1380,0,0,0,0,0 -920,0,0,1510,0,0,0,0,0 -0,1050,0,1510,0,0,0,0,0 -950,1280,0,1600,0,0,0,0,0 -0,0,1220,1600,0,0,0,0,0 -940,0,1380,1600,0,0,0,0,0 -0,1050,1400,1600,0,0,0,0,0 -950,1290,1490,1630,0,0,0,0,0 -0,0,0,0,1550,0,0,0,0 -950,0,0,0,1670,0,0,0,0 -0,1050,0,0,1700,0,0,0,0 -950,1280,0,0,1730,0,0,0,0 -0,0,1240,0,1730,0,0,0,0 -940,0,1400,1,1600,0,0,0,0 -0,1050,1400,1,1600,0,0,0,0 -930,1280,1480,1,1600,0,0,0,0 -0,0,0,5460,1600,0,0,0,0 -950,0,0,5626,1620,0,0,0,0 -0,1070,0,5626,1620,0,0,0,0 -940,1280,0,5696,1620,0,0,0,0 -0,0,1260,5706,1620,0,0,0,0 -950,0,1400,5746,1620,0,0,0,0 -0,1070,1440,5746,1620,0,0,0,0 -950,1290,1480,5746,1620,0,0,0,0 -0,0,0,0,0,1700,0,0,0 -940,0,0,0,0,1830,0,0,0 -0,1050,0,0,0,1840,0,0,0 -940,1260,0,0,0,1760,0,0,0 -0,0,1240,0,0,1880,0,0,0 -940,0,1380,0,1,1780,0,0,0 -0,1060,1400,0,1,1780,0,0,0 -940,1260,1440,0,1,1780,0,0,0 -0,0,0,1400,1,1780,0,0,0 -940,0,0,1500,1,1780,0,0,0 -0,1060,0,1540,1,1780,0,0,0 -940,1280,0,1600,1,1780,0,0,0 -0,0,1240,1600,1,1780,0,0,0 -940,0,1400,1640,1,1780,0,0,0 -0,1060,1430,1640,1,1780,0,0,0 -940,1260,1480,1660,1,1780,0,0,0 -0,0,0,0,5646,1780,0,0,0 -940,0,0,0,5796,1800,0,0,0 -0,1060,0,0,5796,1800,0,0,0 -940,1260,0,0,5856,1800,0,0,0 -0,0,1240,0,5856,1800,0,0,0 -940,0,1400,0,5866,1800,0,0,0 -0,1060,1420,0,5866,1800,0,0,0 -940,1280,1480,0,5876,1800,0,0,0 -0,0,0,1390,5876,1800,0,0,0 -940,0,0,1540,5896,1800,0,0,0 -0,1050,0,1540,5896,1800,0,0,0 -940,1260,0,1660,5916,1800,0,0,0 -0,0,1240,1660,5916,1800,0,0,0 -950,0,1400,1670,5926,1800,0,0,0 -0,1060,1420,1670,5926,1800,0,0,0 -950,1260,1460,1670,5926,1800,0,0,0 -0,0,0,0,0,0,1830,0,0 -930,0,0,0,0,0,1830,0,0 -0,1050,0,0,0,0,1950,0,0 -940,1280,0,0,0,0,1980,0,0 -0,0,1240,0,0,0,1980,0,0 -940,0,1380,0,0,0,2000,0,0 -0,1060,1420,0,0,0,2000,0,0 -940,1260,1440,0,0,0,2000,0,0 -0,0,0,1390,0,0,2000,0,0 -940,0,0,1530,0,0,2000,0,0 -0,1060,0,1540,0,0,2000,0,0 -940,1260,0,1600,0,1,1870,0,0 -0,0,1240,1620,0,0,2000,0,0 -940,0,1410,1620,0,1,1900,0,0 -0,1060,1420,1620,0,1,1900,0,0 -940,1260,1460,1640,0,1,1900,0,0 -0,0,0,0,1570,1,1900,0,0 -950,0,0,0,1700,1,1900,0,0 -0,1060,0,0,1710,1,1900,0,0 -940,1280,0,0,1750,1,1900,0,0 -0,0,1260,0,1750,1,1900,0,0 -940,0,1400,0,1770,1,1900,0,0 -0,1060,1420,0,1770,1,1900,0,0 -950,1280,1480,0,1810,1,1900,0,0 -0,0,0,1400,1800,1,1910,0,0 -950,0,0,1560,1830,1,1920,0,0 -0,1060,0,1580,1830,1,1920,0,0 -940,1280,0,1630,1830,1,1920,0,0 -0,0,1260,1630,1830,1,1920,0,0 -950,0,1420,1650,1840,1,1920,0,0 -0,1070,1430,1650,1840,1,1920,0,0 -950,1280,1480,1680,1850,1,1920,0,0 -0,0,0,0,0,5776,1930,0,0 -940,0,0,0,0,5896,1930,0,0 -0,1070,0,0,1,5816,1930,0,0 -950,1280,0,0,1,5836,1930,0,0 -0,0,1240,0,1,5836,1930,0,0 -950,0,1380,0,1,5836,1930,0,0 -0,1070,1420,0,1,5836,1930,0,0 -950,1280,1480,0,1,5836,1930,0,0 -0,0,0,1480,1,5876,1930,0,0 -940,0,0,1550,1,5876,1930,0,0 -0,1070,0,1550,1,5876,1930,0,0 -940,1280,0,1620,1,5876,1930,0,0 -0,0,1240,1620,1,5876,1930,0,0 -940,0,1380,1620,1,5876,1930,0,0 -0,1070,1440,1660,1,5876,1930,0,0 -950,1290,1490,1680,1,1780,2080,0,0 -0,0,0,0,5656,5876,1930,0,0 -950,0,0,1,5676,5876,1930,0,0 -0,1070,0,1,5676,5876,1930,0,0 -940,1280,0,1,1580,6036,1930,0,0 -0,0,1240,1,1580,6036,1930,0,0 -940,0,1400,1,1580,6036,1930,0,0 -0,1060,1440,1,1580,6036,1930,0,0 -950,1280,1480,0,1780,6056,1930,0,0 -0,0,0,1420,1790,6056,1930,0,0 -950,0,1,1400,1770,6056,1930,0,0 -0,1070,1,1400,1770,6056,1930,0,0 -950,1280,0,1630,1850,6091,1940,0,0 -0,0,1290,1650,1850,6091,1940,0,0 -950,0,1400,1670,1850,6091,1940,0,0 -0,1100,1460,1670,1850,6091,1940,0,0 +0,0,0,0,0,0,0,0,0 +900,0,0,0,0,0,0,0,0 +0,1050,0,0,0,0,0,0,0 +920,1240,0,0,0,0,0,0,0 +0,0,1240,0,0,0,0,0,0 +940,0,1350,0,0,0,0,0,0 +0,1050,1400,0,0,0,0,0,0 +950,1280,1460,0,0,0,0,0,0 +0,0,0,1380,0,0,0,0,0 +920,0,0,1510,0,0,0,0,0 +0,1050,0,1510,0,0,0,0,0 +950,1280,0,1600,0,0,0,0,0 +0,0,1220,1600,0,0,0,0,0 +940,0,1380,1600,0,0,0,0,0 +0,1050,1400,1600,0,0,0,0,0 +950,1290,1490,1630,0,0,0,0,0 +0,0,0,0,1550,0,0,0,0 +950,0,0,0,1670,0,0,0,0 +0,1050,0,0,1700,0,0,0,0 +950,1280,0,0,1730,0,0,0,0 +0,0,1240,0,1730,0,0,0,0 +940,0,1400,1,1600,0,0,0,0 +0,1050,1400,1,1600,0,0,0,0 +930,1280,1480,1,1600,0,0,0,0 +0,0,0,5460,1600,0,0,0,0 +950,0,0,5626,1620,0,0,0,0 +0,1070,0,5626,1620,0,0,0,0 +940,1280,0,5696,1620,0,0,0,0 +0,0,1260,5706,1620,0,0,0,0 +950,0,1400,5746,1620,0,0,0,0 +0,1070,1440,5746,1620,0,0,0,0 +950,1290,1480,5746,1620,0,0,0,0 +0,0,0,0,0,1700,0,0,0 +940,0,0,0,0,1830,0,0,0 +0,1050,0,0,0,1840,0,0,0 +940,1260,0,0,0,1760,0,0,0 +0,0,1240,0,0,1880,0,0,0 +940,0,1380,0,1,1780,0,0,0 +0,1060,1400,0,1,1780,0,0,0 +940,1260,1440,0,1,1780,0,0,0 +0,0,0,1400,1,1780,0,0,0 +940,0,0,1500,1,1780,0,0,0 +0,1060,0,1540,1,1780,0,0,0 +940,1280,0,1600,1,1780,0,0,0 +0,0,1240,1600,1,1780,0,0,0 +940,0,1400,1640,1,1780,0,0,0 +0,1060,1430,1640,1,1780,0,0,0 +940,1260,1480,1660,1,1780,0,0,0 +0,0,0,0,5646,1780,0,0,0 +940,0,0,0,5796,1800,0,0,0 +0,1060,0,0,5796,1800,0,0,0 +940,1260,0,0,5856,1800,0,0,0 +0,0,1240,0,5856,1800,0,0,0 +940,0,1400,0,5866,1800,0,0,0 +0,1060,1420,0,5866,1800,0,0,0 +940,1280,1480,0,5876,1800,0,0,0 +0,0,0,1390,5876,1800,0,0,0 +940,0,0,1540,5896,1800,0,0,0 +0,1050,0,1540,5896,1800,0,0,0 +940,1260,0,1660,5916,1800,0,0,0 +0,0,1240,1660,5916,1800,0,0,0 +950,0,1400,1670,5926,1800,0,0,0 +0,1060,1420,1670,5926,1800,0,0,0 +950,1260,1460,1670,5926,1800,0,0,0 +0,0,0,0,0,0,1830,0,0 +930,0,0,0,0,0,1830,0,0 +0,1050,0,0,0,0,1950,0,0 +940,1280,0,0,0,0,1980,0,0 +0,0,1240,0,0,0,1980,0,0 +940,0,1380,0,0,0,2000,0,0 +0,1060,1420,0,0,0,2000,0,0 +940,1260,1440,0,0,0,2000,0,0 +0,0,0,1390,0,0,2000,0,0 +940,0,0,1530,0,0,2000,0,0 +0,1060,0,1540,0,0,2000,0,0 +940,1260,0,1600,0,1,1870,0,0 +0,0,1240,1620,0,0,2000,0,0 +940,0,1410,1620,0,1,1900,0,0 +0,1060,1420,1620,0,1,1900,0,0 +940,1260,1460,1640,0,1,1900,0,0 +0,0,0,0,1570,1,1900,0,0 +950,0,0,0,1700,1,1900,0,0 +0,1060,0,0,1710,1,1900,0,0 +940,1280,0,0,1750,1,1900,0,0 +0,0,1260,0,1750,1,1900,0,0 +940,0,1400,0,1770,1,1900,0,0 +0,1060,1420,0,1770,1,1900,0,0 +950,1280,1480,0,1810,1,1900,0,0 +0,0,0,1400,1800,1,1910,0,0 +950,0,0,1560,1830,1,1920,0,0 +0,1060,0,1580,1830,1,1920,0,0 +940,1280,0,1630,1830,1,1920,0,0 +0,0,1260,1630,1830,1,1920,0,0 +950,0,1420,1650,1840,1,1920,0,0 +0,1070,1430,1650,1840,1,1920,0,0 +950,1280,1480,1680,1850,1,1920,0,0 +0,0,0,0,0,5776,1930,0,0 +940,0,0,0,0,5896,1930,0,0 +0,1070,0,0,1,5816,1930,0,0 +950,1280,0,0,1,5836,1930,0,0 +0,0,1240,0,1,5836,1930,0,0 +950,0,1380,0,1,5836,1930,0,0 +0,1070,1420,0,1,5836,1930,0,0 +950,1280,1480,0,1,5836,1930,0,0 +0,0,0,1480,1,5876,1930,0,0 +940,0,0,1550,1,5876,1930,0,0 +0,1070,0,1550,1,5876,1930,0,0 +940,1280,0,1620,1,5876,1930,0,0 +0,0,1240,1620,1,5876,1930,0,0 +940,0,1380,1620,1,5876,1930,0,0 +0,1070,1440,1660,1,5876,1930,0,0 +950,1290,1490,1680,1,1780,2080,0,0 +0,0,0,0,5656,5876,1930,0,0 +950,0,0,1,5676,5876,1930,0,0 +0,1070,0,1,5676,5876,1930,0,0 +940,1280,0,1,1580,6036,1930,0,0 +0,0,1240,1,1580,6036,1930,0,0 +940,0,1400,1,1580,6036,1930,0,0 +0,1060,1440,1,1580,6036,1930,0,0 +950,1280,1480,0,1780,6056,1930,0,0 +0,0,0,1420,1790,6056,1930,0,0 +950,0,1,1400,1770,6056,1930,0,0 +0,1070,1,1400,1770,6056,1930,0,0 +950,1280,0,1630,1850,6091,1940,0,0 +0,0,1290,1650,1850,6091,1940,0,0 +950,0,1400,1670,1850,6091,1940,0,0 +0,1100,1460,1670,1850,6091,1940,0,0 960,1320,1570,1760,1980,1,1940,0,0 \ No newline at end of file diff --git a/conf/fast_128k_9dot_dac.txt b/conf/fast_128k_9dot_dac.txt index 32bab75..f689f95 100644 --- a/conf/fast_128k_9dot_dac.txt +++ b/conf/fast_128k_9dot_dac.txt @@ -1,512 +1,512 @@ -0,0,0,0,0,0,0,0,0 -950,0,0,0,0,0,0,0,0 -0,1070,0,0,0,0,0,0,0 -970,1300,0,0,0,0,0,0,0 -0,0,1240,0,0,0,0,0,0 -970,0,1410,0,0,0,0,0,0 -0,1090,1450,0,0,0,0,0,0 -970,1320,1500,0,0,0,0,0,0 -0,0,0,1440,0,0,0,0,0 -970,0,0,1540,0,0,0,0,0 -0,1090,0,1560,0,0,0,0,0 -970,1320,0,1630,0,0,0,0,0 -0,0,1250,1630,0,0,0,0,0 -970,0,1430,1660,0,0,0,0,0 -0,1090,1460,1660,0,0,0,0,0 -990,1340,1540,1700,0,0,0,0,0 -0,0,0,0,1580,0,0,0,0 -970,0,0,0,1700,0,0,0,0 -0,1090,0,0,1700,0,0,0,0 -970,1320,0,0,1770,0,0,0,0 -0,0,1300,0,1770,0,0,0,0 -970,0,1430,0,1770,0,0,0,0 -0,1090,1460,0,1800,0,0,0,0 -990,1340,1540,0,1830,0,0,0,0 -0,0,0,1440,1830,0,0,0,0 -970,0,0,1560,1830,0,0,0,0 -0,1090,0,1590,1830,0,0,0,0 -990,1340,0,1650,1840,0,0,0,0 -0,0,1300,1680,1840,0,0,0,0 -990,0,1440,1680,1840,0,0,0,0 -0,1120,1480,1680,1840,0,0,0,0 -990,1340,1540,1720,1860,0,0,0,0 -0,0,0,0,0,1720,0,0,0 -970,0,0,0,0,1860,0,0,0 -0,1090,0,0,0,1860,0,0,0 -990,1340,0,0,0,1900,0,0,0 -0,0,1300,0,0,1900,0,0,0 -990,0,1430,0,0,1900,0,0,0 -0,1090,1460,0,0,1920,0,0,0 -990,1340,1540,0,0,1920,0,0,0 -0,0,0,1440,0,1920,0,0,0 -990,0,0,1600,0,1940,0,0,0 -0,1120,0,1600,0,1940,0,0,0 -990,1320,0,1660,0,1940,0,0,0 -0,0,1260,1660,0,1960,0,0,0 -990,0,1460,1700,0,1960,0,0,0 -0,1120,1480,1700,0,1980,0,0,0 -990,1340,1540,1720,0,1980,0,0,0 -0,0,0,0,1570,1980,0,0,0 -990,0,0,0,1710,2010,0,0,0 -0,1120,0,0,1730,2010,0,0,0 -990,1340,0,0,1800,2010,0,0,0 -0,0,1260,0,1780,2010,0,0,0 -990,0,1460,0,1820,2010,0,0,0 -0,1120,1500,0,1830,2010,0,0,0 -990,1340,1540,0,1850,2020,0,0,0 -0,0,0,1480,1880,2020,0,0,0 -990,0,0,1600,1880,2020,0,0,0 -0,1120,0,1620,1880,2020,0,0,0 -990,1340,0,1670,1880,2020,0,0,0 -0,0,1280,1670,1880,2020,0,0,0 -990,0,1440,1710,5976,1820,0,0,0 -0,1120,1500,1740,5976,1820,0,0,0 -990,1340,1540,1740,5976,1820,0,0,0 -0,0,0,0,0,0,1820,0,0 -970,0,0,0,0,0,1960,0,0 -0,1120,0,0,0,0,1980,0,0 -990,1320,0,0,0,0,2020,0,0 -0,0,1260,0,0,0,2020,0,0 -990,0,1440,0,0,0,2060,0,0 -0,1120,1500,0,0,0,2060,0,0 -990,1340,1540,0,0,0,2060,0,0 -0,0,0,1480,0,0,2060,0,0 -990,0,0,1580,0,0,2080,0,0 -0,1120,0,1620,0,0,2080,0,0 -990,1320,0,1680,0,0,2080,0,0 -0,0,1260,1680,0,0,2080,0,0 -990,0,1480,1700,0,0,2100,0,0 -0,1120,1500,1700,0,0,2100,0,0 -990,1340,1540,1720,0,0,2100,0,0 -0,0,0,0,1700,1,1940,0,0 -990,0,0,0,1740,1,1940,0,0 -0,1120,0,0,1760,1,1940,0,0 -990,1320,0,0,1780,1,1940,0,0 -0,0,1320,0,1800,1,1940,0,0 -990,0,1480,0,1830,1,1940,0,0 -0,1120,1500,0,1840,1,1940,0,0 -990,1340,1540,0,1860,1,1940,0,0 -0,0,0,1440,1860,1,1940,0,0 -990,0,0,1580,1860,1,1940,0,0 -0,1120,0,1600,1860,1,1940,0,0 -990,1320,0,1660,1860,1,1940,0,0 -0,0,1240,1660,1860,1,1940,0,0 -990,1,1320,1660,1860,1,1940,0,0 -0,1120,1500,1660,1860,1,1940,0,0 -990,1340,1540,1660,1860,1,1940,0,0 -0,0,0,0,0,5776,1940,0,0 -990,0,0,0,0,5956,1940,0,0 -0,1120,0,0,0,5956,1940,0,0 -990,1320,0,0,0,5996,1940,0,0 -0,0,1240,0,0,5996,1940,0,0 -990,0,1440,0,0,5996,1940,0,0 -0,1120,1500,0,0,5996,1940,0,0 -990,1340,1540,0,0,5996,1940,0,0 -0,0,0,1440,0,5996,1940,0,0 -990,0,0,1600,0,5996,1940,0,0 -0,1120,0,1630,0,5996,1940,0,0 -990,1320,0,1650,0,5996,1940,0,0 -0,0,1240,1660,0,5996,1940,0,0 -990,0,1460,1660,0,5996,1940,0,0 -0,1120,1500,1680,0,5996,1940,0,0 -990,1340,1540,1680,0,5996,1940,0,0 -0,0,0,0,5656,5876,1940,0,0 -990,0,0,0,5676,5876,1940,0,0 -0,1120,0,0,5676,5876,1940,0,0 -990,1320,0,1,1580,6036,1940,0,0 -0,0,1240,1,1580,6036,1940,0,0 -990,0,1460,1,1580,6036,1940,0,0 -0,1120,1500,1,1580,6036,1940,0,0 -990,1340,1540,1,1600,6036,1940,0,0 -0,0,0,1420,1800,6056,1940,0,0 -990,0,1,1400,1700,6065,1940,0,0 -0,1120,1,1460,1700,6065,1940,0,0 -990,1320,1,1500,1700,6065,1940,0,0 -0,0,1320,1660,1860,6091,1940,0,0 -990,0,1400,1680,1860,6091,1940,0,0 -0,1120,1480,1680,1880,6091,1940,0,0 -990,1340,1540,1680,1880,6091,1940,0,0 -0,0,0,0,0,0,0,2000,0 -990,0,0,0,0,0,0,2000,0 -0,1120,0,0,0,0,0,2000,0 -990,1320,0,0,0,0,0,2000,0 -0,0,1240,0,0,0,0,2000,0 -990,0,1440,0,0,0,0,2180,0 -0,1120,1500,0,0,0,0,2180,0 -990,1340,1540,0,0,0,0,2180,0 -0,0,0,1400,0,0,0,2180,0 -990,0,0,1560,0,0,0,2180,0 -0,1120,0,1600,0,0,0,2180,0 -990,1320,0,1660,0,0,0,2180,0 -0,0,1240,1680,0,0,0,2180,0 -990,0,1440,1680,0,0,0,2200,0 -0,1120,1500,1680,0,0,0,2200,0 -990,1340,1540,1700,0,0,0,2200,0 -0,0,0,0,1600,0,0,2200,0 -990,0,0,0,1720,0,0,2200,0 -0,1120,0,0,1720,0,0,2200,0 -990,1320,0,0,1740,0,0,2200,0 -0,0,1240,0,1760,0,0,2200,0 -990,0,1480,0,1780,0,0,2200,0 -0,1120,1500,0,1780,0,1,2040,0 -990,1340,1540,0,1820,0,1,2040,0 -0,0,0,1420,1840,0,1,2040,0 -990,0,0,1560,1860,0,1,2040,0 -0,1120,0,1600,1880,0,1,2040,0 -990,1320,0,1620,1900,0,1,2040,0 -0,0,1240,1660,1900,0,1,2040,0 -990,0,1440,1680,1900,0,1,2040,0 -0,1120,1500,1700,1900,0,1,2040,0 -990,1340,1540,1720,1900,0,1,2040,0 -0,0,0,0,0,1720,1,2040,0 -990,0,0,0,0,1880,1,2040,0 -0,1120,0,0,0,1880,1,2040,0 -990,1320,0,0,0,1900,1,2040,0 -0,0,1240,0,0,1900,1,2040,0 -990,0,1480,0,0,1900,1,2040,0 -0,1120,1500,0,0,1900,1,2040,0 -990,1340,1540,0,0,1900,1,2040,0 -0,0,0,1400,0,1980,1,2040,0 -990,0,0,1600,0,1980,1,2040,0 -0,1120,0,1600,0,1980,1,2040,0 -990,1320,0,1660,0,1980,1,2040,0 -0,0,1260,1660,0,1980,1,2040,0 -990,0,1440,1700,0,1980,1,2040,0 -0,1120,1500,1700,0,1980,1,2040,0 -990,1340,1540,1720,0,1980,1,2040,0 -0,0,0,0,1600,2040,1,2040,0 -990,0,0,0,1740,2040,1,2080,0 -0,1120,0,0,1800,2040,1,2080,0 -990,1320,0,0,1800,2040,1,2080,0 -0,0,1260,0,1800,2040,1,2080,0 -990,0,1440,0,1880,2040,1,2080,0 -0,1120,1500,0,1880,2040,1,2080,0 -990,1340,1540,0,1880,2040,1,2080,0 -0,0,0,1440,1880,2040,1,2080,0 -990,0,0,1620,1880,2040,1,2080,0 -0,1120,0,1640,1880,2040,1,2080,0 -990,1320,0,1660,1880,2040,1,2080,0 -0,0,1260,1680,1880,2040,1,2080,0 -990,0,1460,1680,1880,2040,1,2080,0 -0,1120,1500,1680,1880,2040,1,2080,0 -990,1340,1540,1680,1880,2040,1,2080,0 -0,0,0,0,0,0,5900,2080,0 -990,0,0,0,0,0,6040,2080,0 -0,1120,0,0,0,0,6040,2080,0 -990,1320,0,0,0,0,6040,2080,0 -0,0,1260,0,0,0,6040,2080,0 -990,0,1440,0,0,0,6040,2080,0 -0,1120,1500,0,0,0,6040,2080,0 -990,1340,1540,0,0,0,6040,2080,0 -0,0,0,1440,0,0,6040,2080,0 -990,0,0,1580,0,1,5960,2120,0 -0,1120,0,1600,0,1,5960,2120,0 -990,1320,0,1640,0,1,5960,2120,0 -0,0,1260,1660,0,1,5960,2120,0 -990,0,1440,1660,0,1,6020,2120,0 -0,1120,1500,1700,0,1,6020,2120,0 -990,1340,1540,1720,0,1,6020,2120,0 -0,0,0,0,1600,1,6020,2120,0 -990,0,0,0,1740,1,6020,2120,0 -0,1120,0,0,1760,1,6020,2120,0 -990,1320,0,0,1800,1,6020,2120,0 -0,0,1260,0,1800,1,6020,2120,0 -990,0,1440,0,1800,1,6020,2120,0 -0,1120,1500,0,1800,1,6020,2120,0 -990,1340,1540,0,1800,1,6020,2120,0 -0,0,0,1400,1820,1,6020,2120,0 -990,0,0,1560,1860,1,6020,2120,0 -0,1120,0,1580,1860,1,6020,2120,0 -990,1320,0,1620,1860,1,6020,2120,0 -0,0,1260,1660,1860,1,6020,2120,0 -990,0,1440,5800,1860,1,6020,2120,0 -0,1120,1500,5800,1860,1,6020,2120,0 -990,1340,1540,5820,1860,1,6020,2120,0 -0,0,0,0,0,5790,6020,2120,0 -990,0,0,0,0,5860,6020,2120,0 -0,1120,0,0,0,5880,6020,2120,0 -990,1320,0,0,0,5900,6020,2120,0 -0,0,1260,0,0,5920,6020,2120,0 -990,0,1440,0,0,5940,6020,2120,0 -0,1120,1500,0,0,5960,6020,2120,0 -990,1340,1540,0,0,5980,6020,2120,0 -0,0,0,1380,1,5840,6020,2120,0 -990,0,0,1540,1,5840,6020,2120,0 -0,1120,0,1560,1,5840,6020,2120,0 -990,1320,0,1580,1,5840,6020,2120,0 -0,0,1260,1660,1,5840,6020,2120,0 -990,0,1420,1660,1,5840,6020,2120,0 -0,1120,1500,1700,1,5840,6020,2120,0 -990,1340,1540,1720,1,5840,6020,2120,0 -0,0,0,0,5600,5840,6020,2120,0 -990,0,0,1,5680,5900,6060,2120,0 -0,1120,0,1,5680,5900,6060,2120,0 -990,1320,0,1,5680,5900,6060,2120,0 -0,0,1260,1,5680,5900,6060,2120,0 -990,0,1440,1,5680,5900,6060,2120,0 -0,1120,1500,1,5680,5900,6060,2120,0 -990,1340,1540,1,5680,5900,6060,2120,0 -0,0,0,5520,5760,5900,6060,2120,0 -990,0,0,5640,5780,5900,6100,2120,0 -0,1120,0,5680,5780,5900,6100,2120,0 -990,1320,0,5680,5780,5900,6100,2120,0 -0,0,5430,5680,5780,5900,6100,2120,0 -990,1,5460,5680,5780,5900,6100,2120,0 -0,5216,5460,5680,5780,5900,6100,2120,0 -990,1360,1640,1860,2020,2180,1,2100,0 -0,0,0,0,0,0,0,0,2100 -990,0,0,0,0,0,0,0,2100 -0,1120,0,0,0,0,0,0,2220 -990,1320,0,0,0,0,0,0,2260 -0,0,1260,0,0,0,0,0,2260 -990,0,1440,0,0,0,0,0,2300 -0,1120,1500,0,0,0,0,0,2300 -990,1340,1540,0,0,0,0,0,2300 -0,0,0,1420,0,0,0,0,2300 -990,0,0,1580,0,0,0,0,2300 -0,1120,0,1600,0,0,0,0,2300 -990,1320,0,1660,0,0,0,1,2200 -0,0,1260,1660,0,0,0,1,2200 -990,0,1440,1680,0,0,0,1,2200 -0,1120,1500,1700,0,0,0,1,2200 -990,1340,1540,1720,0,0,0,1,2200 -0,0,0,0,1480,0,0,1,2200 -990,0,0,0,1740,0,0,1,2200 -0,1120,0,0,1760,0,0,1,2200 -990,1320,0,0,1780,0,0,1,2200 -0,0,1260,0,1800,0,0,1,2200 -990,0,1440,0,1820,0,0,1,2200 -0,1120,1500,0,1840,0,0,1,2200 -990,1340,1540,0,1860,0,0,1,2200 -0,0,0,1440,1860,0,0,1,2200 -990,0,0,1620,1880,0,0,1,2200 -0,1120,0,1620,1880,0,0,1,2200 -990,1320,0,1660,1880,0,0,1,2200 -0,0,1260,1680,1880,0,0,1,2200 -990,0,1460,1700,1880,0,0,1,2200 -0,1120,1500,1720,1880,0,0,1,2200 -990,1340,1540,1740,1880,0,0,1,2200 -0,0,0,0,0,1740,0,1,2200 -990,0,0,0,0,1860,0,1,2200 -0,1120,0,0,0,1860,0,1,2200 -990,1320,0,0,0,1880,0,1,2200 -0,0,1260,0,0,1880,0,1,2200 -990,0,1440,0,0,1960,0,1,2200 -0,1120,1500,0,0,1960,0,1,2200 -990,1340,1540,0,0,1960,0,1,2200 -0,0,0,1440,0,1960,0,1,2200 -990,0,0,1580,0,1980,0,1,2200 -0,1120,0,1600,0,1980,0,1,2200 -990,1320,0,1660,0,1980,0,1,2200 -0,0,1260,1660,0,1980,0,1,2200 -990,0,1440,1680,0,2020,0,1,2200 -0,1120,1500,1700,0,2020,0,1,2200 -990,1340,1540,1720,0,2020,0,1,2200 -0,0,0,0,1580,2040,0,1,2200 -990,0,0,0,5820,1860,0,1,2200 -0,1120,0,0,5860,1860,0,1,2200 -990,1320,0,0,5880,1860,0,1,2200 -0,0,1260,0,5900,1860,0,1,2200 -990,0,1440,0,5920,1860,0,1,2200 -0,1120,1500,0,5920,1860,0,1,2200 -990,1340,1540,0,5920,1860,0,1,2200 -0,0,0,1400,5940,1860,0,1,2200 -990,0,0,1600,5940,1860,0,1,2200 -0,1120,0,1620,5940,1860,0,1,2200 -990,1320,0,1640,5940,1860,0,1,2200 -0,0,1260,1660,5960,1860,0,1,2200 -990,0,1420,1680,5960,1860,0,1,2200 -0,1120,1500,1700,5960,1860,0,1,2200 -990,1340,1540,1720,5960,1860,0,1,2200 -0,0,0,0,0,0,1880,1,2200 -990,0,0,0,0,0,2020,1,2200 -0,1120,0,0,0,0,2020,1,2200 -990,1320,0,0,0,0,2060,1,2200 -0,0,1260,0,0,0,2060,1,2200 -990,0,1440,0,0,0,2080,1,2200 -0,1120,1500,0,0,0,2080,1,2200 -990,1340,1540,0,0,0,2080,1,2200 -0,0,0,1440,0,0,2080,1,2200 -990,0,0,1580,0,0,2080,1,2200 -0,1120,0,1620,0,0,2080,1,2200 -990,1320,0,1640,0,0,2080,1,2200 -0,0,1260,1660,0,0,2080,1,2200 -990,0,1440,1680,0,0,2120,1,2200 -0,1120,1500,1700,0,0,2120,1,2200 -990,1340,1540,1720,0,0,2120,1,2200 -0,0,0,0,1600,0,2120,1,2200 -990,0,0,0,1800,0,2160,1,2200 -0,1120,0,0,1820,0,2160,1,2200 -990,1320,0,0,1860,0,2160,1,2200 -0,0,1260,0,1860,0,2160,1,2200 -990,0,1460,0,1860,0,2160,1,2200 -0,1120,1500,0,1860,0,2160,1,2200 -990,1340,1540,0,1860,0,2160,1,2200 -0,0,0,1420,1860,0,2160,1,2200 -990,0,0,1580,1860,1,2000,1,2200 -0,1120,0,1600,1860,1,2000,1,2200 -990,1320,0,1660,1860,1,2000,1,2200 -0,0,1260,1660,1860,1,2000,1,2200 -990,0,1460,1700,1900,1,2000,1,2200 -0,1120,1500,1760,1900,1,2000,1,2200 -990,1340,1540,1780,1900,1,2000,1,2200 -0,0,0,0,0,5840,2000,1,2200 -990,0,0,0,1,5870,2000,1,2200 -0,1120,0,0,1,5870,2000,1,2200 -990,1320,0,0,1,5870,2000,1,2220 -0,0,1260,0,1,5870,2000,1,2220 -990,0,1480,0,1,5880,2000,1,2220 -0,1120,1500,0,1,5880,2000,1,2220 -990,1340,1540,0,1,5900,2000,1,2220 -0,0,0,1440,1,5900,2000,1,2220 -990,0,0,1600,1,5900,2000,1,2220 -0,1120,0,1600,1,5900,2000,1,2220 -990,1340,0,1660,1,5920,2000,1,2220 -0,0,1260,1660,1,5920,2000,1,2220 -990,0,1480,1700,1,5920,2000,1,2220 -0,1120,1500,1720,1,5920,2000,1,2220 -990,1340,1540,1740,1,5920,2000,1,2220 -0,0,0,0,5680,5920,2000,1,2220 -990,0,0,1,5700,5920,2000,1,2220 -0,1120,0,1,5700,5920,2000,1,2220 -990,1320,0,1,5700,5920,2000,1,2220 -0,0,1260,1,5700,5920,2000,1,2220 -990,0,1480,1,5700,5920,2000,1,2220 -0,1120,1500,1,5700,5920,2000,1,2220 -990,1340,1540,1,5740,5920,2000,1,2220 -0,0,0,5500,5740,5920,2000,1,2220 -990,0,1,5560,5780,5920,2000,1,2220 -0,1120,1,5560,5780,5920,2000,1,2220 -990,1320,1,5580,5780,5920,2000,1,2220 -0,0,5360,5580,5780,5920,2000,1,2220 -990,1,5420,5620,5780,5960,2020,1,2240 -0,5126,5460,5620,5780,5960,2020,1,2240 -990,5420,5460,5640,5820,5980,2020,1,2240 -0,0,0,0,0,0,0,6080,2260 -990,0,0,0,0,0,1,6100,2240 -0,1120,0,0,0,0,1,6100,2240 -990,1320,0,0,0,0,1,6120,2240 -0,0,1260,0,0,0,1,6120,2240 -990,0,1440,0,0,0,1,6120,2240 -0,1120,1500,0,0,0,1,6120,2240 -990,1340,1540,0,0,0,1,6120,2240 -0,0,0,1440,0,0,1,6120,2240 -990,0,0,1620,0,0,1,6120,2240 -0,1120,0,1620,0,0,1,6120,2240 -990,1320,0,1660,0,0,1,6120,2240 -0,0,1260,1660,0,0,1,6120,2240 -990,0,1440,1680,0,0,1,6120,2240 -0,1120,1500,1700,0,0,1,6120,2240 -990,1340,1540,1740,0,0,1,6120,2240 -0,0,0,0,1600,0,1,6120,2240 -990,0,0,0,1740,0,1,6120,2240 -0,1120,0,0,1760,0,1,6120,2240 -990,1320,0,0,1800,0,1,6120,2240 -0,0,1260,0,1800,0,1,6120,2240 -990,0,1460,0,1840,0,1,6120,2240 -0,1120,1500,0,1860,0,1,6120,2240 -990,1340,1540,0,1880,0,1,6140,2240 -0,0,0,1440,1880,0,1,6140,2240 -990,0,0,1600,1880,0,1,6140,2240 -0,1120,0,1620,1880,0,1,6140,2240 -990,1320,0,1660,1880,0,1,6140,2240 -0,0,1260,1660,1880,0,1,6140,2240 -990,0,1460,1700,1900,0,1,6140,2240 -0,1120,1500,1700,1900,0,1,6140,2240 -990,1340,1540,1710,1900,0,1,6140,2240 -0,0,0,0,0,1720,1,6140,2240 -990,0,0,0,0,1920,1,6140,2240 -0,1120,0,0,0,1920,1,6140,2240 -990,1340,0,0,0,1940,1,6140,2240 -0,0,1260,0,0,1940,1,6140,2240 -990,0,1440,0,0,2000,1,6140,2240 -0,1120,1500,0,0,2000,1,6140,2240 -990,1340,1540,0,0,2020,1,6140,2240 -0,0,0,1440,0,2020,1,6140,2240 -990,0,0,1600,0,2020,1,6140,2240 -0,1120,0,1620,0,2020,1,6140,2240 -990,1320,0,1660,0,2020,1,6140,2240 -0,0,1260,1660,0,2020,1,6140,2240 -990,0,1440,1700,0,2020,1,6140,2240 -0,1120,1500,1700,0,2020,1,6140,2240 -990,1340,1540,1740,0,2020,1,6140,2240 -0,0,0,0,1560,2020,1,6140,2240 -990,0,0,0,1700,2020,1,6140,2240 -0,1120,0,0,1720,2020,1,6140,2240 -990,1340,0,0,1780,2020,1,6140,2240 -0,0,1260,0,1780,2020,1,6140,2240 -990,0,1440,0,1820,2020,1,6140,2240 -0,1120,1500,0,1820,2020,1,6140,2240 -990,1340,1540,1,1660,2020,1,6140,2240 -0,0,0,5540,5786,1800,1,6140,2240 -990,0,1,5560,5776,1820,1,6200,2240 -0,1120,1,5560,5776,1820,1,6200,2240 -990,1320,1,5560,5776,1840,1,6200,2240 -0,0,5356,5570,5776,1840,1,6200,2240 -990,1,5396,5600,5786,1840,1,6200,2240 -0,5200,5435,5600,5786,1840,1,6200,2240 -990,5390,5435,5600,5786,1840,1,6200,2240 -0,0,0,0,0,0,10076,10286,2180 -990,0,0,0,0,1,5971,6220,2240 -0,1120,0,0,0,1,5971,6220,2240 -990,1320,0,0,0,1,5971,6220,2240 -0,0,1260,0,0,1,5971,6220,2240 -990,0,1440,0,0,1,5989,6220,2240 -0,1120,1500,0,0,1,5989,6220,2240 -990,1340,1540,0,0,1,5999,6220,2240 -0,0,0,1440,0,1,5999,6220,2240 -990,0,0,1580,0,1,5999,6220,2240 -0,1120,0,1600,0,1,5999,6220,2240 -990,1320,0,1660,0,1,6011,6220,2240 -0,0,1260,1660,0,1,6011,6220,2240 -990,0,1440,1680,0,1,6011,6220,2240 -0,1120,1500,1700,0,1,6011,6220,2240 -990,1340,1540,1740,0,1,6019,6220,2240 -0,0,0,0,1600,1,6019,6220,2240 -990,0,0,0,1780,1,6019,6220,2240 -0,1120,0,0,1780,1,6019,6220,2240 -990,1320,0,0,1820,1,6019,6220,2240 -0,0,1260,0,1820,1,6019,6220,2240 -990,0,1440,0,1820,1,6019,6220,2240 -0,1120,1500,0,1820,1,6019,6220,2240 -990,1340,1540,0,1860,1,6019,6220,2240 -0,0,0,1400,1860,1,6019,6220,2240 -990,0,0,1600,1860,1,6019,6220,2240 -0,1120,0,1600,1860,1,6019,6220,2240 -990,1340,0,1640,1860,1,6029,6220,2240 -0,0,1260,1660,1860,1,6029,6220,2240 -990,0,1440,1700,1860,1,6029,6220,2240 -0,1120,1480,1700,1860,1,6029,6220,2240 -990,1350,1570,1720,1920,1,6029,6220,2240 -0,0,0,0,0,9920,6029,6220,2240 -990,0,0,0,1,5810,6029,6220,2240 -0,1120,0,0,1,5810,6029,6220,2240 -990,1340,0,0,1,5820,6029,6220,2240 -0,0,1260,0,1,5820,6029,6220,2240 -990,0,1440,0,1,5820,6029,6220,2240 -0,1120,1500,0,1,5820,6029,6220,2240 -990,1340,1540,0,1,5840,6029,6220,2240 -0,0,0,1440,1,5820,6029,6220,2240 -990,0,0,1600,1,5820,6029,6220,2240 -0,1120,0,1600,1,5820,6029,6220,2240 -990,1320,0,1660,1,5820,6029,6220,2240 -0,0,1260,1660,1,5820,6029,6220,2240 -990,0,1440,1680,1,5820,6029,6220,2240 -0,1120,1500,1700,1,5820,6029,6220,2240 -990,1340,1540,1720,1,5820,6029,6220,2240 -0,0,0,0,5580,5820,6029,6220,2240 -990,0,0,1,5620,5820,6029,6220,2240 -0,1120,0,1,5620,5820,6029,6220,2240 -990,1320,0,1,5640,5820,6029,6220,2240 -0,0,1260,1,5640,5820,6029,6220,2240 -990,0,1440,1,5640,5820,6029,6220,2240 -0,1120,1500,1,5640,5820,6029,6220,2240 -990,1340,1540,1,5660,5820,6029,6220,2240 -0,0,0,5400,5660,5820,6029,6220,2240 -990,0,1,5460,5660,5820,6029,6220,2240 -0,1120,1,5460,5660,5820,6029,6220,2240 -990,1340,1,5460,5660,5820,6029,6220,2240 -0,0,0,5460,5660,5820,6029,6220,2240 -990,0,1,5460,5660,5820,6029,6220,2240 -0,1120,1,5460,5660,5820,6029,6220,2240 +0,0,0,0,0,0,0,0,0 +950,0,0,0,0,0,0,0,0 +0,1070,0,0,0,0,0,0,0 +970,1300,0,0,0,0,0,0,0 +0,0,1240,0,0,0,0,0,0 +970,0,1410,0,0,0,0,0,0 +0,1090,1450,0,0,0,0,0,0 +970,1320,1500,0,0,0,0,0,0 +0,0,0,1440,0,0,0,0,0 +970,0,0,1540,0,0,0,0,0 +0,1090,0,1560,0,0,0,0,0 +970,1320,0,1630,0,0,0,0,0 +0,0,1250,1630,0,0,0,0,0 +970,0,1430,1660,0,0,0,0,0 +0,1090,1460,1660,0,0,0,0,0 +990,1340,1540,1700,0,0,0,0,0 +0,0,0,0,1580,0,0,0,0 +970,0,0,0,1700,0,0,0,0 +0,1090,0,0,1700,0,0,0,0 +970,1320,0,0,1770,0,0,0,0 +0,0,1300,0,1770,0,0,0,0 +970,0,1430,0,1770,0,0,0,0 +0,1090,1460,0,1800,0,0,0,0 +990,1340,1540,0,1830,0,0,0,0 +0,0,0,1440,1830,0,0,0,0 +970,0,0,1560,1830,0,0,0,0 +0,1090,0,1590,1830,0,0,0,0 +990,1340,0,1650,1840,0,0,0,0 +0,0,1300,1680,1840,0,0,0,0 +990,0,1440,1680,1840,0,0,0,0 +0,1120,1480,1680,1840,0,0,0,0 +990,1340,1540,1720,1860,0,0,0,0 +0,0,0,0,0,1720,0,0,0 +970,0,0,0,0,1860,0,0,0 +0,1090,0,0,0,1860,0,0,0 +990,1340,0,0,0,1900,0,0,0 +0,0,1300,0,0,1900,0,0,0 +990,0,1430,0,0,1900,0,0,0 +0,1090,1460,0,0,1920,0,0,0 +990,1340,1540,0,0,1920,0,0,0 +0,0,0,1440,0,1920,0,0,0 +990,0,0,1600,0,1940,0,0,0 +0,1120,0,1600,0,1940,0,0,0 +990,1320,0,1660,0,1940,0,0,0 +0,0,1260,1660,0,1960,0,0,0 +990,0,1460,1700,0,1960,0,0,0 +0,1120,1480,1700,0,1980,0,0,0 +990,1340,1540,1720,0,1980,0,0,0 +0,0,0,0,1570,1980,0,0,0 +990,0,0,0,1710,2010,0,0,0 +0,1120,0,0,1730,2010,0,0,0 +990,1340,0,0,1800,2010,0,0,0 +0,0,1260,0,1780,2010,0,0,0 +990,0,1460,0,1820,2010,0,0,0 +0,1120,1500,0,1830,2010,0,0,0 +990,1340,1540,0,1850,2020,0,0,0 +0,0,0,1480,1880,2020,0,0,0 +990,0,0,1600,1880,2020,0,0,0 +0,1120,0,1620,1880,2020,0,0,0 +990,1340,0,1670,1880,2020,0,0,0 +0,0,1280,1670,1880,2020,0,0,0 +990,0,1440,1710,5976,1820,0,0,0 +0,1120,1500,1740,5976,1820,0,0,0 +990,1340,1540,1740,5976,1820,0,0,0 +0,0,0,0,0,0,1820,0,0 +970,0,0,0,0,0,1960,0,0 +0,1120,0,0,0,0,1980,0,0 +990,1320,0,0,0,0,2020,0,0 +0,0,1260,0,0,0,2020,0,0 +990,0,1440,0,0,0,2060,0,0 +0,1120,1500,0,0,0,2060,0,0 +990,1340,1540,0,0,0,2060,0,0 +0,0,0,1480,0,0,2060,0,0 +990,0,0,1580,0,0,2080,0,0 +0,1120,0,1620,0,0,2080,0,0 +990,1320,0,1680,0,0,2080,0,0 +0,0,1260,1680,0,0,2080,0,0 +990,0,1480,1700,0,0,2100,0,0 +0,1120,1500,1700,0,0,2100,0,0 +990,1340,1540,1720,0,0,2100,0,0 +0,0,0,0,1700,1,1940,0,0 +990,0,0,0,1740,1,1940,0,0 +0,1120,0,0,1760,1,1940,0,0 +990,1320,0,0,1780,1,1940,0,0 +0,0,1320,0,1800,1,1940,0,0 +990,0,1480,0,1830,1,1940,0,0 +0,1120,1500,0,1840,1,1940,0,0 +990,1340,1540,0,1860,1,1940,0,0 +0,0,0,1440,1860,1,1940,0,0 +990,0,0,1580,1860,1,1940,0,0 +0,1120,0,1600,1860,1,1940,0,0 +990,1320,0,1660,1860,1,1940,0,0 +0,0,1240,1660,1860,1,1940,0,0 +990,1,1320,1660,1860,1,1940,0,0 +0,1120,1500,1660,1860,1,1940,0,0 +990,1340,1540,1660,1860,1,1940,0,0 +0,0,0,0,0,5776,1940,0,0 +990,0,0,0,0,5956,1940,0,0 +0,1120,0,0,0,5956,1940,0,0 +990,1320,0,0,0,5996,1940,0,0 +0,0,1240,0,0,5996,1940,0,0 +990,0,1440,0,0,5996,1940,0,0 +0,1120,1500,0,0,5996,1940,0,0 +990,1340,1540,0,0,5996,1940,0,0 +0,0,0,1440,0,5996,1940,0,0 +990,0,0,1600,0,5996,1940,0,0 +0,1120,0,1630,0,5996,1940,0,0 +990,1320,0,1650,0,5996,1940,0,0 +0,0,1240,1660,0,5996,1940,0,0 +990,0,1460,1660,0,5996,1940,0,0 +0,1120,1500,1680,0,5996,1940,0,0 +990,1340,1540,1680,0,5996,1940,0,0 +0,0,0,0,5656,5876,1940,0,0 +990,0,0,0,5676,5876,1940,0,0 +0,1120,0,0,5676,5876,1940,0,0 +990,1320,0,1,1580,6036,1940,0,0 +0,0,1240,1,1580,6036,1940,0,0 +990,0,1460,1,1580,6036,1940,0,0 +0,1120,1500,1,1580,6036,1940,0,0 +990,1340,1540,1,1600,6036,1940,0,0 +0,0,0,1420,1800,6056,1940,0,0 +990,0,1,1400,1700,6065,1940,0,0 +0,1120,1,1460,1700,6065,1940,0,0 +990,1320,1,1500,1700,6065,1940,0,0 +0,0,1320,1660,1860,6091,1940,0,0 +990,0,1400,1680,1860,6091,1940,0,0 +0,1120,1480,1680,1880,6091,1940,0,0 +990,1340,1540,1680,1880,6091,1940,0,0 +0,0,0,0,0,0,0,2000,0 +990,0,0,0,0,0,0,2000,0 +0,1120,0,0,0,0,0,2000,0 +990,1320,0,0,0,0,0,2000,0 +0,0,1240,0,0,0,0,2000,0 +990,0,1440,0,0,0,0,2180,0 +0,1120,1500,0,0,0,0,2180,0 +990,1340,1540,0,0,0,0,2180,0 +0,0,0,1400,0,0,0,2180,0 +990,0,0,1560,0,0,0,2180,0 +0,1120,0,1600,0,0,0,2180,0 +990,1320,0,1660,0,0,0,2180,0 +0,0,1240,1680,0,0,0,2180,0 +990,0,1440,1680,0,0,0,2200,0 +0,1120,1500,1680,0,0,0,2200,0 +990,1340,1540,1700,0,0,0,2200,0 +0,0,0,0,1600,0,0,2200,0 +990,0,0,0,1720,0,0,2200,0 +0,1120,0,0,1720,0,0,2200,0 +990,1320,0,0,1740,0,0,2200,0 +0,0,1240,0,1760,0,0,2200,0 +990,0,1480,0,1780,0,0,2200,0 +0,1120,1500,0,1780,0,1,2040,0 +990,1340,1540,0,1820,0,1,2040,0 +0,0,0,1420,1840,0,1,2040,0 +990,0,0,1560,1860,0,1,2040,0 +0,1120,0,1600,1880,0,1,2040,0 +990,1320,0,1620,1900,0,1,2040,0 +0,0,1240,1660,1900,0,1,2040,0 +990,0,1440,1680,1900,0,1,2040,0 +0,1120,1500,1700,1900,0,1,2040,0 +990,1340,1540,1720,1900,0,1,2040,0 +0,0,0,0,0,1720,1,2040,0 +990,0,0,0,0,1880,1,2040,0 +0,1120,0,0,0,1880,1,2040,0 +990,1320,0,0,0,1900,1,2040,0 +0,0,1240,0,0,1900,1,2040,0 +990,0,1480,0,0,1900,1,2040,0 +0,1120,1500,0,0,1900,1,2040,0 +990,1340,1540,0,0,1900,1,2040,0 +0,0,0,1400,0,1980,1,2040,0 +990,0,0,1600,0,1980,1,2040,0 +0,1120,0,1600,0,1980,1,2040,0 +990,1320,0,1660,0,1980,1,2040,0 +0,0,1260,1660,0,1980,1,2040,0 +990,0,1440,1700,0,1980,1,2040,0 +0,1120,1500,1700,0,1980,1,2040,0 +990,1340,1540,1720,0,1980,1,2040,0 +0,0,0,0,1600,2040,1,2040,0 +990,0,0,0,1740,2040,1,2080,0 +0,1120,0,0,1800,2040,1,2080,0 +990,1320,0,0,1800,2040,1,2080,0 +0,0,1260,0,1800,2040,1,2080,0 +990,0,1440,0,1880,2040,1,2080,0 +0,1120,1500,0,1880,2040,1,2080,0 +990,1340,1540,0,1880,2040,1,2080,0 +0,0,0,1440,1880,2040,1,2080,0 +990,0,0,1620,1880,2040,1,2080,0 +0,1120,0,1640,1880,2040,1,2080,0 +990,1320,0,1660,1880,2040,1,2080,0 +0,0,1260,1680,1880,2040,1,2080,0 +990,0,1460,1680,1880,2040,1,2080,0 +0,1120,1500,1680,1880,2040,1,2080,0 +990,1340,1540,1680,1880,2040,1,2080,0 +0,0,0,0,0,0,5900,2080,0 +990,0,0,0,0,0,6040,2080,0 +0,1120,0,0,0,0,6040,2080,0 +990,1320,0,0,0,0,6040,2080,0 +0,0,1260,0,0,0,6040,2080,0 +990,0,1440,0,0,0,6040,2080,0 +0,1120,1500,0,0,0,6040,2080,0 +990,1340,1540,0,0,0,6040,2080,0 +0,0,0,1440,0,0,6040,2080,0 +990,0,0,1580,0,1,5960,2120,0 +0,1120,0,1600,0,1,5960,2120,0 +990,1320,0,1640,0,1,5960,2120,0 +0,0,1260,1660,0,1,5960,2120,0 +990,0,1440,1660,0,1,6020,2120,0 +0,1120,1500,1700,0,1,6020,2120,0 +990,1340,1540,1720,0,1,6020,2120,0 +0,0,0,0,1600,1,6020,2120,0 +990,0,0,0,1740,1,6020,2120,0 +0,1120,0,0,1760,1,6020,2120,0 +990,1320,0,0,1800,1,6020,2120,0 +0,0,1260,0,1800,1,6020,2120,0 +990,0,1440,0,1800,1,6020,2120,0 +0,1120,1500,0,1800,1,6020,2120,0 +990,1340,1540,0,1800,1,6020,2120,0 +0,0,0,1400,1820,1,6020,2120,0 +990,0,0,1560,1860,1,6020,2120,0 +0,1120,0,1580,1860,1,6020,2120,0 +990,1320,0,1620,1860,1,6020,2120,0 +0,0,1260,1660,1860,1,6020,2120,0 +990,0,1440,5800,1860,1,6020,2120,0 +0,1120,1500,5800,1860,1,6020,2120,0 +990,1340,1540,5820,1860,1,6020,2120,0 +0,0,0,0,0,5790,6020,2120,0 +990,0,0,0,0,5860,6020,2120,0 +0,1120,0,0,0,5880,6020,2120,0 +990,1320,0,0,0,5900,6020,2120,0 +0,0,1260,0,0,5920,6020,2120,0 +990,0,1440,0,0,5940,6020,2120,0 +0,1120,1500,0,0,5960,6020,2120,0 +990,1340,1540,0,0,5980,6020,2120,0 +0,0,0,1380,1,5840,6020,2120,0 +990,0,0,1540,1,5840,6020,2120,0 +0,1120,0,1560,1,5840,6020,2120,0 +990,1320,0,1580,1,5840,6020,2120,0 +0,0,1260,1660,1,5840,6020,2120,0 +990,0,1420,1660,1,5840,6020,2120,0 +0,1120,1500,1700,1,5840,6020,2120,0 +990,1340,1540,1720,1,5840,6020,2120,0 +0,0,0,0,5600,5840,6020,2120,0 +990,0,0,1,5680,5900,6060,2120,0 +0,1120,0,1,5680,5900,6060,2120,0 +990,1320,0,1,5680,5900,6060,2120,0 +0,0,1260,1,5680,5900,6060,2120,0 +990,0,1440,1,5680,5900,6060,2120,0 +0,1120,1500,1,5680,5900,6060,2120,0 +990,1340,1540,1,5680,5900,6060,2120,0 +0,0,0,5520,5760,5900,6060,2120,0 +990,0,0,5640,5780,5900,6100,2120,0 +0,1120,0,5680,5780,5900,6100,2120,0 +990,1320,0,5680,5780,5900,6100,2120,0 +0,0,5430,5680,5780,5900,6100,2120,0 +990,1,5460,5680,5780,5900,6100,2120,0 +0,5216,5460,5680,5780,5900,6100,2120,0 +990,1360,1640,1860,2020,2180,1,2100,0 +0,0,0,0,0,0,0,0,2100 +990,0,0,0,0,0,0,0,2100 +0,1120,0,0,0,0,0,0,2220 +990,1320,0,0,0,0,0,0,2260 +0,0,1260,0,0,0,0,0,2260 +990,0,1440,0,0,0,0,0,2300 +0,1120,1500,0,0,0,0,0,2300 +990,1340,1540,0,0,0,0,0,2300 +0,0,0,1420,0,0,0,0,2300 +990,0,0,1580,0,0,0,0,2300 +0,1120,0,1600,0,0,0,0,2300 +990,1320,0,1660,0,0,0,1,2200 +0,0,1260,1660,0,0,0,1,2200 +990,0,1440,1680,0,0,0,1,2200 +0,1120,1500,1700,0,0,0,1,2200 +990,1340,1540,1720,0,0,0,1,2200 +0,0,0,0,1480,0,0,1,2200 +990,0,0,0,1740,0,0,1,2200 +0,1120,0,0,1760,0,0,1,2200 +990,1320,0,0,1780,0,0,1,2200 +0,0,1260,0,1800,0,0,1,2200 +990,0,1440,0,1820,0,0,1,2200 +0,1120,1500,0,1840,0,0,1,2200 +990,1340,1540,0,1860,0,0,1,2200 +0,0,0,1440,1860,0,0,1,2200 +990,0,0,1620,1880,0,0,1,2200 +0,1120,0,1620,1880,0,0,1,2200 +990,1320,0,1660,1880,0,0,1,2200 +0,0,1260,1680,1880,0,0,1,2200 +990,0,1460,1700,1880,0,0,1,2200 +0,1120,1500,1720,1880,0,0,1,2200 +990,1340,1540,1740,1880,0,0,1,2200 +0,0,0,0,0,1740,0,1,2200 +990,0,0,0,0,1860,0,1,2200 +0,1120,0,0,0,1860,0,1,2200 +990,1320,0,0,0,1880,0,1,2200 +0,0,1260,0,0,1880,0,1,2200 +990,0,1440,0,0,1960,0,1,2200 +0,1120,1500,0,0,1960,0,1,2200 +990,1340,1540,0,0,1960,0,1,2200 +0,0,0,1440,0,1960,0,1,2200 +990,0,0,1580,0,1980,0,1,2200 +0,1120,0,1600,0,1980,0,1,2200 +990,1320,0,1660,0,1980,0,1,2200 +0,0,1260,1660,0,1980,0,1,2200 +990,0,1440,1680,0,2020,0,1,2200 +0,1120,1500,1700,0,2020,0,1,2200 +990,1340,1540,1720,0,2020,0,1,2200 +0,0,0,0,1580,2040,0,1,2200 +990,0,0,0,5820,1860,0,1,2200 +0,1120,0,0,5860,1860,0,1,2200 +990,1320,0,0,5880,1860,0,1,2200 +0,0,1260,0,5900,1860,0,1,2200 +990,0,1440,0,5920,1860,0,1,2200 +0,1120,1500,0,5920,1860,0,1,2200 +990,1340,1540,0,5920,1860,0,1,2200 +0,0,0,1400,5940,1860,0,1,2200 +990,0,0,1600,5940,1860,0,1,2200 +0,1120,0,1620,5940,1860,0,1,2200 +990,1320,0,1640,5940,1860,0,1,2200 +0,0,1260,1660,5960,1860,0,1,2200 +990,0,1420,1680,5960,1860,0,1,2200 +0,1120,1500,1700,5960,1860,0,1,2200 +990,1340,1540,1720,5960,1860,0,1,2200 +0,0,0,0,0,0,1880,1,2200 +990,0,0,0,0,0,2020,1,2200 +0,1120,0,0,0,0,2020,1,2200 +990,1320,0,0,0,0,2060,1,2200 +0,0,1260,0,0,0,2060,1,2200 +990,0,1440,0,0,0,2080,1,2200 +0,1120,1500,0,0,0,2080,1,2200 +990,1340,1540,0,0,0,2080,1,2200 +0,0,0,1440,0,0,2080,1,2200 +990,0,0,1580,0,0,2080,1,2200 +0,1120,0,1620,0,0,2080,1,2200 +990,1320,0,1640,0,0,2080,1,2200 +0,0,1260,1660,0,0,2080,1,2200 +990,0,1440,1680,0,0,2120,1,2200 +0,1120,1500,1700,0,0,2120,1,2200 +990,1340,1540,1720,0,0,2120,1,2200 +0,0,0,0,1600,0,2120,1,2200 +990,0,0,0,1800,0,2160,1,2200 +0,1120,0,0,1820,0,2160,1,2200 +990,1320,0,0,1860,0,2160,1,2200 +0,0,1260,0,1860,0,2160,1,2200 +990,0,1460,0,1860,0,2160,1,2200 +0,1120,1500,0,1860,0,2160,1,2200 +990,1340,1540,0,1860,0,2160,1,2200 +0,0,0,1420,1860,0,2160,1,2200 +990,0,0,1580,1860,1,2000,1,2200 +0,1120,0,1600,1860,1,2000,1,2200 +990,1320,0,1660,1860,1,2000,1,2200 +0,0,1260,1660,1860,1,2000,1,2200 +990,0,1460,1700,1900,1,2000,1,2200 +0,1120,1500,1760,1900,1,2000,1,2200 +990,1340,1540,1780,1900,1,2000,1,2200 +0,0,0,0,0,5840,2000,1,2200 +990,0,0,0,1,5870,2000,1,2200 +0,1120,0,0,1,5870,2000,1,2200 +990,1320,0,0,1,5870,2000,1,2220 +0,0,1260,0,1,5870,2000,1,2220 +990,0,1480,0,1,5880,2000,1,2220 +0,1120,1500,0,1,5880,2000,1,2220 +990,1340,1540,0,1,5900,2000,1,2220 +0,0,0,1440,1,5900,2000,1,2220 +990,0,0,1600,1,5900,2000,1,2220 +0,1120,0,1600,1,5900,2000,1,2220 +990,1340,0,1660,1,5920,2000,1,2220 +0,0,1260,1660,1,5920,2000,1,2220 +990,0,1480,1700,1,5920,2000,1,2220 +0,1120,1500,1720,1,5920,2000,1,2220 +990,1340,1540,1740,1,5920,2000,1,2220 +0,0,0,0,5680,5920,2000,1,2220 +990,0,0,1,5700,5920,2000,1,2220 +0,1120,0,1,5700,5920,2000,1,2220 +990,1320,0,1,5700,5920,2000,1,2220 +0,0,1260,1,5700,5920,2000,1,2220 +990,0,1480,1,5700,5920,2000,1,2220 +0,1120,1500,1,5700,5920,2000,1,2220 +990,1340,1540,1,5740,5920,2000,1,2220 +0,0,0,5500,5740,5920,2000,1,2220 +990,0,1,5560,5780,5920,2000,1,2220 +0,1120,1,5560,5780,5920,2000,1,2220 +990,1320,1,5580,5780,5920,2000,1,2220 +0,0,5360,5580,5780,5920,2000,1,2220 +990,1,5420,5620,5780,5960,2020,1,2240 +0,5126,5460,5620,5780,5960,2020,1,2240 +990,5420,5460,5640,5820,5980,2020,1,2240 +0,0,0,0,0,0,0,6080,2260 +990,0,0,0,0,0,1,6100,2240 +0,1120,0,0,0,0,1,6100,2240 +990,1320,0,0,0,0,1,6120,2240 +0,0,1260,0,0,0,1,6120,2240 +990,0,1440,0,0,0,1,6120,2240 +0,1120,1500,0,0,0,1,6120,2240 +990,1340,1540,0,0,0,1,6120,2240 +0,0,0,1440,0,0,1,6120,2240 +990,0,0,1620,0,0,1,6120,2240 +0,1120,0,1620,0,0,1,6120,2240 +990,1320,0,1660,0,0,1,6120,2240 +0,0,1260,1660,0,0,1,6120,2240 +990,0,1440,1680,0,0,1,6120,2240 +0,1120,1500,1700,0,0,1,6120,2240 +990,1340,1540,1740,0,0,1,6120,2240 +0,0,0,0,1600,0,1,6120,2240 +990,0,0,0,1740,0,1,6120,2240 +0,1120,0,0,1760,0,1,6120,2240 +990,1320,0,0,1800,0,1,6120,2240 +0,0,1260,0,1800,0,1,6120,2240 +990,0,1460,0,1840,0,1,6120,2240 +0,1120,1500,0,1860,0,1,6120,2240 +990,1340,1540,0,1880,0,1,6140,2240 +0,0,0,1440,1880,0,1,6140,2240 +990,0,0,1600,1880,0,1,6140,2240 +0,1120,0,1620,1880,0,1,6140,2240 +990,1320,0,1660,1880,0,1,6140,2240 +0,0,1260,1660,1880,0,1,6140,2240 +990,0,1460,1700,1900,0,1,6140,2240 +0,1120,1500,1700,1900,0,1,6140,2240 +990,1340,1540,1710,1900,0,1,6140,2240 +0,0,0,0,0,1720,1,6140,2240 +990,0,0,0,0,1920,1,6140,2240 +0,1120,0,0,0,1920,1,6140,2240 +990,1340,0,0,0,1940,1,6140,2240 +0,0,1260,0,0,1940,1,6140,2240 +990,0,1440,0,0,2000,1,6140,2240 +0,1120,1500,0,0,2000,1,6140,2240 +990,1340,1540,0,0,2020,1,6140,2240 +0,0,0,1440,0,2020,1,6140,2240 +990,0,0,1600,0,2020,1,6140,2240 +0,1120,0,1620,0,2020,1,6140,2240 +990,1320,0,1660,0,2020,1,6140,2240 +0,0,1260,1660,0,2020,1,6140,2240 +990,0,1440,1700,0,2020,1,6140,2240 +0,1120,1500,1700,0,2020,1,6140,2240 +990,1340,1540,1740,0,2020,1,6140,2240 +0,0,0,0,1560,2020,1,6140,2240 +990,0,0,0,1700,2020,1,6140,2240 +0,1120,0,0,1720,2020,1,6140,2240 +990,1340,0,0,1780,2020,1,6140,2240 +0,0,1260,0,1780,2020,1,6140,2240 +990,0,1440,0,1820,2020,1,6140,2240 +0,1120,1500,0,1820,2020,1,6140,2240 +990,1340,1540,1,1660,2020,1,6140,2240 +0,0,0,5540,5786,1800,1,6140,2240 +990,0,1,5560,5776,1820,1,6200,2240 +0,1120,1,5560,5776,1820,1,6200,2240 +990,1320,1,5560,5776,1840,1,6200,2240 +0,0,5356,5570,5776,1840,1,6200,2240 +990,1,5396,5600,5786,1840,1,6200,2240 +0,5200,5435,5600,5786,1840,1,6200,2240 +990,5390,5435,5600,5786,1840,1,6200,2240 +0,0,0,0,0,0,10076,10286,2180 +990,0,0,0,0,1,5971,6220,2240 +0,1120,0,0,0,1,5971,6220,2240 +990,1320,0,0,0,1,5971,6220,2240 +0,0,1260,0,0,1,5971,6220,2240 +990,0,1440,0,0,1,5989,6220,2240 +0,1120,1500,0,0,1,5989,6220,2240 +990,1340,1540,0,0,1,5999,6220,2240 +0,0,0,1440,0,1,5999,6220,2240 +990,0,0,1580,0,1,5999,6220,2240 +0,1120,0,1600,0,1,5999,6220,2240 +990,1320,0,1660,0,1,6011,6220,2240 +0,0,1260,1660,0,1,6011,6220,2240 +990,0,1440,1680,0,1,6011,6220,2240 +0,1120,1500,1700,0,1,6011,6220,2240 +990,1340,1540,1740,0,1,6019,6220,2240 +0,0,0,0,1600,1,6019,6220,2240 +990,0,0,0,1780,1,6019,6220,2240 +0,1120,0,0,1780,1,6019,6220,2240 +990,1320,0,0,1820,1,6019,6220,2240 +0,0,1260,0,1820,1,6019,6220,2240 +990,0,1440,0,1820,1,6019,6220,2240 +0,1120,1500,0,1820,1,6019,6220,2240 +990,1340,1540,0,1860,1,6019,6220,2240 +0,0,0,1400,1860,1,6019,6220,2240 +990,0,0,1600,1860,1,6019,6220,2240 +0,1120,0,1600,1860,1,6019,6220,2240 +990,1340,0,1640,1860,1,6029,6220,2240 +0,0,1260,1660,1860,1,6029,6220,2240 +990,0,1440,1700,1860,1,6029,6220,2240 +0,1120,1480,1700,1860,1,6029,6220,2240 +990,1350,1570,1720,1920,1,6029,6220,2240 +0,0,0,0,0,9920,6029,6220,2240 +990,0,0,0,1,5810,6029,6220,2240 +0,1120,0,0,1,5810,6029,6220,2240 +990,1340,0,0,1,5820,6029,6220,2240 +0,0,1260,0,1,5820,6029,6220,2240 +990,0,1440,0,1,5820,6029,6220,2240 +0,1120,1500,0,1,5820,6029,6220,2240 +990,1340,1540,0,1,5840,6029,6220,2240 +0,0,0,1440,1,5820,6029,6220,2240 +990,0,0,1600,1,5820,6029,6220,2240 +0,1120,0,1600,1,5820,6029,6220,2240 +990,1320,0,1660,1,5820,6029,6220,2240 +0,0,1260,1660,1,5820,6029,6220,2240 +990,0,1440,1680,1,5820,6029,6220,2240 +0,1120,1500,1700,1,5820,6029,6220,2240 +990,1340,1540,1720,1,5820,6029,6220,2240 +0,0,0,0,5580,5820,6029,6220,2240 +990,0,0,1,5620,5820,6029,6220,2240 +0,1120,0,1,5620,5820,6029,6220,2240 +990,1320,0,1,5640,5820,6029,6220,2240 +0,0,1260,1,5640,5820,6029,6220,2240 +990,0,1440,1,5640,5820,6029,6220,2240 +0,1120,1500,1,5640,5820,6029,6220,2240 +990,1340,1540,1,5660,5820,6029,6220,2240 +0,0,0,5400,5660,5820,6029,6220,2240 +990,0,1,5460,5660,5820,6029,6220,2240 +0,1120,1,5460,5660,5820,6029,6220,2240 +990,1340,1,5460,5660,5820,6029,6220,2240 +0,0,0,5460,5660,5820,6029,6220,2240 +990,0,1,5460,5660,5820,6029,6220,2240 +0,1120,1,5460,5660,5820,6029,6220,2240 1020,1400,1660,1860,2060,2240,2350,1,2250 \ No newline at end of file diff --git a/conf/normal_128k_7dot_dac.txt b/conf/normal_128k_7dot_dac.txt index 6e75b41..bada3d8 100644 --- a/conf/normal_128k_7dot_dac.txt +++ b/conf/normal_128k_7dot_dac.txt @@ -1,128 +1,128 @@ -0,0,0,0,0,0,0,0,0 -970,0,0,0,0,0,0,0,0 -0,1115,0,0,0,0,0,0,0 -5066,1180,0,0,0,0,0,0,0 -0,0,1245,0,0,0,0,0,0 -970,1,1310,0,0,0,0,0,0 -0,5211,1340,0,0,0,0,0,0 -5086,5296,1340,0,0,0,0,0,0 -0,0,0,1385,0,0,0,0,0 -970,1,0,1430,0,0,0,0,0 -0,1120,1,1450,0,0,0,0,0 -5076,1200,1,1460,0,0,0,0,0 -0,0,5356,1490,0,0,0,0,0 -980,1,5416,1490,0,0,0,0,0 -0,5256,5456,1480,0,0,0,0,0 -5086,5316,5456,1480,0,0,0,0,0 -0,0,0,0,1535,0,0,0,0 -980,1,0,0,1560,0,0,0,0 -0,1140,1,0,1580,0,0,0,0 -5076,1200,1,0,1580,0,0,0,0 -0,0,1275,1,1585,0,0,0,0 -980,1,1310,1,1585,0,0,0,0 -0,5246,1360,1,1585,0,0,0,0 -5076,5296,1360,1,1620,0,0,0,0 -0,0,0,5521,1645,0,0,0,0 -980,1,0,5546,1635,0,0,0,0 -0,1140,1,5566,1635,0,0,0,0 -5076,1200,1,5576,1635,0,0,0,0 -0,0,5406,5626,1635,0,0,0,0 -980,1,5436,5616,1635,0,0,0,0 -0,5276,5476,5596,1635,0,0,0,0 -5086,5316,5456,5596,1635,0,0,0,0 -0,0,0,0,0,1680,0,0,0 -980,1,0,0,0,1700,0,0,0 -0,1130,1,0,0,1700,0,0,0 -5076,1200,1,0,0,1720,0,0,0 -0,0,1280,1,0,1720,0,0,0 -980,1,1315,1,0,1720,0,0,0 -0,5236,1360,1,0,1740,0,0,0 -5086,5296,1360,1,0,1750,0,0,0 -0,0,0,1430,1,1750,0,0,0 -980,1,0,1460,1,1750,0,0,0 -0,1140,1,1470,1,1750,0,0,0 -5076,1200,1,1480,1,1750,0,0,0 -0,0,5396,1500,1,1760,0,0,0 -980,1,5426,1510,1,1760,0,0,0 -0,5256,5456,1510,1,1760,0,0,0 -5076,5316,5456,1510,1,1770,0,0,0 -0,0,0,0,5666,1780,0,0,0 -980,1,0,0,5676,1780,0,0,0 -0,1130,1,0,5686,1780,0,0,0 -5076,1200,1,0,5696,1780,0,0,0 -0,0,1290,1,5716,1780,0,0,0 -980,1,1330,1,5756,1780,0,0,0 -0,5236,1360,1,5756,1780,0,0,0 -5076,5296,1360,1,5756,1780,0,0,0 -0,0,0,5526,5746,1780,0,0,0 -980,1,0,5556,5756,1780,0,0,0 -0,1130,1,5586,5756,1780,0,0,0 -5076,1200,1,5586,5756,1780,0,0,0 -0,0,5386,5601,5756,1780,0,0,0 -980,1,5436,5601,5756,1780,0,0,0 -0,5246,5466,5601,5756,1780,0,0,0 -5086,5306,5476,5601,5756,1780,0,0,0 -0,0,0,0,0,0,1810,0,0 -980,1,0,0,0,0,1810,0,0 -0,1130,1,0,0,0,1840,0,0 -5076,1200,1,0,0,0,1840,0,0 -0,0,1290,1,0,0,1850,0,0 -980,1,1330,1,0,0,1850,0,0 -0,5231,1360,1,0,0,1850,0,0 -5076,5296,1360,1,0,0,1850,0,0 -0,0,0,1410,1,0,1850,0,0 -980,1,0,1440,1,0,1860,0,0 -0,1135,1,1470,1,0,1860,0,0 -5076,1200,1,1480,1,0,1870,0,0 -0,0,5381,1505,1,0,1870,0,0 -980,1,5416,1510,1,0,1870,0,0 -0,5236,5456,1510,1,0,1870,0,0 -5086,5296,5456,1510,1,0,1880,0,0 -0,0,0,0,1550,1,1880,0,0 -980,1,0,0,1570,1,1880,0,0 -0,1130,1,0,1590,1,1880,0,0 -5076,1200,1,0,1610,1,1890,0,0 -0,0,1300,1,1620,1,1890,0,0 -980,1,1330,1,1620,1,1890,0,0 -0,5236,1360,1,1630,1,1890,0,0 -5076,5296,1360,1,1640,1,1890,0,0 -0,0,0,5506,1640,1,1900,0,0 -980,1,0,5546,1640,1,1900,0,0 -0,1135,1,5556,1640,1,1900,0,0 -5076,1200,1,5556,1640,1,1900,0,0 -0,0,5386,5596,1640,1,1900,0,0 -980,1,5436,5606,1650,1,1910,0,0 -0,5226,5456,5606,1650,1,1910,0,0 -5086,5306,5466,5606,1650,1,1910,0,0 -0,0,0,0,0,5791,1910,0,0 -980,1,0,0,0,5816,1910,0,0 -0,1130,1,0,0,5816,1910,0,0 -5076,1200,1,0,0,5816,1910,0,0 -0,0,1290,1,0,5816,1910,0,0 -990,1,1320,1,0,5816,1910,0,0 -0,5226,1360,1,0,5836,1910,0,0 -5086,5306,1360,1,0,5836,1910,0,0 -0,0,0,1420,1,5846,1910,0,0 -980,1,0,1450,1,5846,1910,0,0 -0,1130,1,1450,1,5846,1910,0,0 -5076,1200,1,1480,1,5866,1910,0,0 -0,0,5386,1480,1,5866,1910,0,0 -980,1,5426,1510,1,5876,1920,0,0 -0,5236,5476,1510,1,5886,1920,0,0 -5086,5306,5456,1510,1,5886,1920,0,0 -0,0,0,0,5641,5886,1920,0,0 -980,1,0,0,5646,5886,1920,0,0 -0,1130,1,0,5676,5886,1920,0,0 -5076,1200,1,0,5696,5886,1920,0,0 -0,0,1290,1,5706,5896,1920,0,0 -980,1,1310,1,5706,5896,1920,0,0 -0,5226,1350,1,5706,5896,1920,0,0 -5086,5306,1350,1,5706,5896,1920,0,0 -0,0,0,5506,5736,5896,1920,0,0 -980,1,0,5526,5736,5896,1920,0,0 -0,1130,1,5546,5736,5896,1920,0,0 -5076,1200,1,5546,5736,5896,1920,0,0 -0,0,5386,5586,5736,5896,1920,0,0 -980,1,5406,5586,5736,5896,1920,0,0 -0,5226,5456,5606,5756,5896,1920,0,0 +0,0,0,0,0,0,0,0,0 +970,0,0,0,0,0,0,0,0 +0,1115,0,0,0,0,0,0,0 +5066,1180,0,0,0,0,0,0,0 +0,0,1245,0,0,0,0,0,0 +970,1,1310,0,0,0,0,0,0 +0,5211,1340,0,0,0,0,0,0 +5086,5296,1340,0,0,0,0,0,0 +0,0,0,1385,0,0,0,0,0 +970,1,0,1430,0,0,0,0,0 +0,1120,1,1450,0,0,0,0,0 +5076,1200,1,1460,0,0,0,0,0 +0,0,5356,1490,0,0,0,0,0 +980,1,5416,1490,0,0,0,0,0 +0,5256,5456,1480,0,0,0,0,0 +5086,5316,5456,1480,0,0,0,0,0 +0,0,0,0,1535,0,0,0,0 +980,1,0,0,1560,0,0,0,0 +0,1140,1,0,1580,0,0,0,0 +5076,1200,1,0,1580,0,0,0,0 +0,0,1275,1,1585,0,0,0,0 +980,1,1310,1,1585,0,0,0,0 +0,5246,1360,1,1585,0,0,0,0 +5076,5296,1360,1,1620,0,0,0,0 +0,0,0,5521,1645,0,0,0,0 +980,1,0,5546,1635,0,0,0,0 +0,1140,1,5566,1635,0,0,0,0 +5076,1200,1,5576,1635,0,0,0,0 +0,0,5406,5626,1635,0,0,0,0 +980,1,5436,5616,1635,0,0,0,0 +0,5276,5476,5596,1635,0,0,0,0 +5086,5316,5456,5596,1635,0,0,0,0 +0,0,0,0,0,1680,0,0,0 +980,1,0,0,0,1700,0,0,0 +0,1130,1,0,0,1700,0,0,0 +5076,1200,1,0,0,1720,0,0,0 +0,0,1280,1,0,1720,0,0,0 +980,1,1315,1,0,1720,0,0,0 +0,5236,1360,1,0,1740,0,0,0 +5086,5296,1360,1,0,1750,0,0,0 +0,0,0,1430,1,1750,0,0,0 +980,1,0,1460,1,1750,0,0,0 +0,1140,1,1470,1,1750,0,0,0 +5076,1200,1,1480,1,1750,0,0,0 +0,0,5396,1500,1,1760,0,0,0 +980,1,5426,1510,1,1760,0,0,0 +0,5256,5456,1510,1,1760,0,0,0 +5076,5316,5456,1510,1,1770,0,0,0 +0,0,0,0,5666,1780,0,0,0 +980,1,0,0,5676,1780,0,0,0 +0,1130,1,0,5686,1780,0,0,0 +5076,1200,1,0,5696,1780,0,0,0 +0,0,1290,1,5716,1780,0,0,0 +980,1,1330,1,5756,1780,0,0,0 +0,5236,1360,1,5756,1780,0,0,0 +5076,5296,1360,1,5756,1780,0,0,0 +0,0,0,5526,5746,1780,0,0,0 +980,1,0,5556,5756,1780,0,0,0 +0,1130,1,5586,5756,1780,0,0,0 +5076,1200,1,5586,5756,1780,0,0,0 +0,0,5386,5601,5756,1780,0,0,0 +980,1,5436,5601,5756,1780,0,0,0 +0,5246,5466,5601,5756,1780,0,0,0 +5086,5306,5476,5601,5756,1780,0,0,0 +0,0,0,0,0,0,1810,0,0 +980,1,0,0,0,0,1810,0,0 +0,1130,1,0,0,0,1840,0,0 +5076,1200,1,0,0,0,1840,0,0 +0,0,1290,1,0,0,1850,0,0 +980,1,1330,1,0,0,1850,0,0 +0,5231,1360,1,0,0,1850,0,0 +5076,5296,1360,1,0,0,1850,0,0 +0,0,0,1410,1,0,1850,0,0 +980,1,0,1440,1,0,1860,0,0 +0,1135,1,1470,1,0,1860,0,0 +5076,1200,1,1480,1,0,1870,0,0 +0,0,5381,1505,1,0,1870,0,0 +980,1,5416,1510,1,0,1870,0,0 +0,5236,5456,1510,1,0,1870,0,0 +5086,5296,5456,1510,1,0,1880,0,0 +0,0,0,0,1550,1,1880,0,0 +980,1,0,0,1570,1,1880,0,0 +0,1130,1,0,1590,1,1880,0,0 +5076,1200,1,0,1610,1,1890,0,0 +0,0,1300,1,1620,1,1890,0,0 +980,1,1330,1,1620,1,1890,0,0 +0,5236,1360,1,1630,1,1890,0,0 +5076,5296,1360,1,1640,1,1890,0,0 +0,0,0,5506,1640,1,1900,0,0 +980,1,0,5546,1640,1,1900,0,0 +0,1135,1,5556,1640,1,1900,0,0 +5076,1200,1,5556,1640,1,1900,0,0 +0,0,5386,5596,1640,1,1900,0,0 +980,1,5436,5606,1650,1,1910,0,0 +0,5226,5456,5606,1650,1,1910,0,0 +5086,5306,5466,5606,1650,1,1910,0,0 +0,0,0,0,0,5791,1910,0,0 +980,1,0,0,0,5816,1910,0,0 +0,1130,1,0,0,5816,1910,0,0 +5076,1200,1,0,0,5816,1910,0,0 +0,0,1290,1,0,5816,1910,0,0 +990,1,1320,1,0,5816,1910,0,0 +0,5226,1360,1,0,5836,1910,0,0 +5086,5306,1360,1,0,5836,1910,0,0 +0,0,0,1420,1,5846,1910,0,0 +980,1,0,1450,1,5846,1910,0,0 +0,1130,1,1450,1,5846,1910,0,0 +5076,1200,1,1480,1,5866,1910,0,0 +0,0,5386,1480,1,5866,1910,0,0 +980,1,5426,1510,1,5876,1920,0,0 +0,5236,5476,1510,1,5886,1920,0,0 +5086,5306,5456,1510,1,5886,1920,0,0 +0,0,0,0,5641,5886,1920,0,0 +980,1,0,0,5646,5886,1920,0,0 +0,1130,1,0,5676,5886,1920,0,0 +5076,1200,1,0,5696,5886,1920,0,0 +0,0,1290,1,5706,5896,1920,0,0 +980,1,1310,1,5706,5896,1920,0,0 +0,5226,1350,1,5706,5896,1920,0,0 +5086,5306,1350,1,5706,5896,1920,0,0 +0,0,0,5506,5736,5896,1920,0,0 +980,1,0,5526,5736,5896,1920,0,0 +0,1130,1,5546,5736,5896,1920,0,0 +5076,1200,1,5546,5736,5896,1920,0,0 +0,0,5386,5586,5736,5896,1920,0,0 +980,1,5406,5586,5736,5896,1920,0,0 +0,5226,5456,5606,5756,5896,1920,0,0 5096,5316,5456,5606,5756,5906,1940,0,0 \ No newline at end of file diff --git a/conf/normal_128k_9dot_dac.txt b/conf/normal_128k_9dot_dac.txt index 5de4d39..9d4869c 100644 --- a/conf/normal_128k_9dot_dac.txt +++ b/conf/normal_128k_9dot_dac.txt @@ -1,512 +1,512 @@ -0,0,0,0,0,0,0,0,0 -960,0,0,0,0,0,0,0,0 -0,1100,0,0,0,0,0,0,0 -980,1280,0,0,0,0,0,0,0 -0,0,1250,0,0,0,0,0,0 -980,0,1390,0,0,0,0,0,0 -0,1130,1440,0,0,0,0,0,0 -980,1320,1480,0,0,0,0,0,0 -0,0,0,1400,0,0,0,0,0 -980,0,0,1510,0,0,0,0,0 -0,1130,0,1530,0,0,0,0,0 -980,1320,0,1580,0,0,0,0,0 -0,0,1260,1580,0,0,0,0,0 -980,1,1300,1580,0,0,0,0,0 -0,5246,5446,1460,0,0,0,0,0 -5076,5296,5446,1460,0,0,0,0,0 -0,0,0,0,1520,0,0,0,0 -980,0,0,0,1620,0,0,0,0 -0,1130,0,0,1640,0,0,0,0 -980,1320,0,0,1690,0,0,0,0 -0,0,1280,0,1680,0,0,0,0 -1000,0,1430,1,1570,0,0,0,0 -0,1090,1460,1,1570,0,0,0,0 -990,1340,1540,1,1580,0,0,0,0 -0,0,0,5496,1600,0,0,0,0 -970,0,1,5546,1600,0,0,0,0 -0,1140,1,5546,1600,0,0,0,0 -1000,1320,1,5546,1600,0,0,0,0 -0,0,5346,5566,1600,0,0,0,0 -1000,1,5416,5586,1600,0,0,0,0 -0,5226,5446,5586,1600,0,0,0,0 -5076,5286,5446,5586,1600,0,0,0,0 -0,0,0,0,0,1640,0,0,0 -980,0,0,0,0,1760,0,0,0 -0,1130,0,0,0,1780,0,0,0 -980,1320,0,0,1,1680,0,0,0 -0,0,1280,0,0,1800,0,0,0 -980,0,1420,0,1,1680,0,0,0 -0,1130,1460,0,1,1680,0,0,0 -1000,1320,1480,0,1,1680,0,0,0 -0,0,0,1380,1,1680,0,0,0 -980,0,0,1540,1,1700,0,0,0 -0,1130,0,1580,1,1700,0,0,0 -1000,1320,0,1620,1,1700,0,0,0 -0,0,5346,1480,1,1700,0,0,0 -980,1,5386,1480,1,1700,0,0,0 -0,5246,5446,1480,1,1700,0,0,0 -5076,5296,5446,1480,1,1700,0,0,0 -0,0,0,0,5616,1740,0,0,0 -980,0,0,1,5636,1740,0,0,0 -0,1130,0,1,5646,1740,0,0,0 -1000,1320,0,1,5656,1740,0,0,0 -0,0,1280,1,5666,1740,0,0,0 -980,0,1420,1,5676,1740,0,0,0 -0,1130,1460,1,5676,1740,0,0,0 -1000,1320,1480,1,5676,1740,0,0,0 -0,0,0,5498,5726,1740,0,0,0 -980,0,1,5526,5706,1740,0,0,0 -0,1130,1,5526,5706,1740,0,0,0 -1000,1320,1,5526,5706,1740,0,0,0 -0,0,5356,5576,5706,1740,0,0,0 -980,1,5406,5576,5726,1740,0,0,0 -0,5216,5416,5576,5726,1740,0,0,0 -5076,5296,5446,5576,5726,1740,0,0,0 -0,0,0,0,0,0,1760,0,0 -980,0,0,0,0,1,1780,0,0 -0,1130,0,0,0,1,1790,0,0 -1000,1320,0,0,0,1,1800,0,0 -0,0,1280,0,0,1,1800,0,0 -980,0,1420,0,0,1,1820,0,0 -0,1130,1460,0,0,1,1820,0,0 -1000,1320,1480,0,0,1,1820,0,0 -0,0,0,1400,0,1,1820,0,0 -980,0,0,1540,0,1,1820,0,0 -0,1130,0,1560,0,1,1820,0,0 -1000,1320,0,1610,0,1,1830,0,0 -0,0,1280,1620,0,1,1830,0,0 -980,1,5386,1480,0,1,1840,0,0 -0,5246,5446,1480,0,1,1840,0,0 -5076,5296,5446,1480,0,1,1840,0,0 -0,0,0,0,1540,1,1860,0,0 -980,0,0,0,1690,1,1840,0,0 -0,1130,0,0,1700,1,1840,0,0 -1000,1320,0,0,1730,1,1840,0,0 -0,0,1280,0,1730,1,1850,0,0 -980,0,1420,1,1580,1,1850,0,0 -0,1130,1460,1,1580,1,1850,0,0 -1000,1320,1480,1,1580,1,1850,0,0 -0,0,0,5486,1600,1,1850,0,0 -980,0,1,5516,1610,1,1850,0,0 -0,1130,1,5526,1610,1,1850,0,0 -1000,1320,1,5546,1610,1,1850,0,0 -0,0,5326,5586,1610,1,1850,0,0 -980,1,5396,5596,1630,1,1850,0,0 -0,5246,5446,5596,1630,1,1850,0,0 -5076,5296,5446,5596,1630,1,1850,0,0 -0,0,0,0,0,5776,1880,0,0 -980,0,0,0,1,5796,1880,0,0 -0,1130,0,0,1,5796,1880,0,0 -1000,1320,0,0,1,5796,1880,0,0 -0,0,1280,0,1,5796,1880,0,0 -980,0,1430,0,1,5796,1880,0,0 -0,1130,1470,0,1,5796,1880,0,0 -1000,1320,1490,0,1,5796,1880,0,0 -0,0,0,1400,1,5796,1880,0,0 -980,0,0,1600,1,5796,1880,0,0 -0,1130,0,1620,1,5806,1880,0,0 -1000,1320,0,1640,1,5816,1880,0,0 -0,0,1290,1660,1,5816,1880,0,0 -980,1,5396,1500,1,5826,1890,0,0 -0,5246,5446,1500,1,5826,1890,0,0 -5076,5296,5446,1500,1,5826,1890,0,0 -0,0,0,0,5616,5846,1890,0,0 -980,0,0,1,5646,5866,1900,0,0 -0,1130,0,1,5656,5866,1900,0,0 -1000,1320,0,1,5666,5866,1900,0,0 -0,0,1280,1,5666,5866,1900,0,0 -980,0,1430,1,5686,5876,1900,0,0 -0,1120,1470,1,5696,5876,1900,0,0 -1000,1320,1490,1,5706,5876,1900,0,0 -0,0,0,5466,5706,5876,1900,0,0 -980,0,1,5536,5746,5896,1900,0,0 -0,1130,1,5546,5746,5896,1900,0,0 -1000,1320,1,5566,5746,5896,1900,0,0 -0,0,5366,5596,5746,5896,1900,0,0 -980,1,5396,5596,5746,5896,1900,0,0 -0,5206,5446,5596,5746,5896,1900,0,0 -5076,5296,5446,5596,5746,5896,1900,0,0 -0,0,0,0,0,0,0,1920,0 -980,0,0,0,0,0,1,1920,0 -0,1130,0,0,0,0,1,1930,0 -1000,1320,0,0,0,0,1,1940,0 -0,0,1280,0,0,0,1,1940,0 -980,0,1410,0,0,0,1,1940,0 -0,1130,1460,0,0,0,1,1940,0 -1000,1320,1490,0,0,0,1,1940,0 -0,0,0,1390,0,0,1,1940,0 -980,0,0,1540,0,0,1,1950,0 -0,1130,0,1560,0,0,1,1950,0 -1000,1320,0,1600,0,0,1,1950,0 -0,0,1280,1620,0,0,1,1960,0 -980,1,5386,1480,0,0,1,1960,0 -0,5246,5446,1480,0,0,1,1960,0 -5076,5296,5446,1480,0,0,1,1960,0 -0,0,0,0,1540,0,1,1960,0 -980,0,0,1,1540,0,1,1960,0 -0,1130,0,1,1550,0,1,1960,0 -1000,1320,0,1,1560,0,1,1960,0 -0,0,1280,1,1580,0,1,1960,0 -980,0,1420,1,1590,0,1,1960,0 -0,1130,1460,1,1600,0,1,1960,0 -1000,1320,1490,1,1620,0,1,1960,0 -0,0,0,5496,1640,0,1,1960,0 -980,0,1,5516,1620,0,1,1960,0 -0,1130,1,5526,1620,0,1,1960,0 -1000,1320,1,5526,1620,0,1,1960,0 -0,0,5246,5536,1620,0,1,1960,0 -980,1,5386,5596,1620,0,1,1970,0 -0,5206,5446,5596,1620,0,1,1970,0 -5076,5296,5446,5596,1620,0,1,1970,0 -0,0,0,0,0,1660,1,1970,0 -980,0,0,0,1,1700,1,1980,0 -0,1130,0,0,1,1700,1,1980,0 -1000,1320,0,0,1,1700,1,1980,0 -0,0,1280,0,1,1710,1,1980,0 -980,0,1430,0,1,1720,1,1980,0 -0,1130,1470,0,1,1720,1,1980,0 -1000,1320,1490,0,1,1720,1,1980,0 -0,0,0,1420,1,1720,1,1980,0 -980,0,1,1430,1,1720,1,1980,0 -0,1130,1,1460,1,1720,1,1980,0 -1000,1320,1,1480,1,1720,1,1980,0 -0,0,5356,1480,1,1720,1,1980,0 -990,1,5386,1480,1,1730,1,1990,0 -0,5246,5446,1480,1,1730,1,1990,0 -5076,5296,5446,1480,1,1730,1,1990,0 -0,0,0,0,5616,1750,1,1990,0 -980,0,0,1,5636,1760,1,1990,0 -0,1130,0,1,5646,1760,1,1990,0 -1000,1320,0,1,5666,1760,1,1990,0 -0,0,1280,1,5666,1760,1,1990,0 -980,0,1430,1,5666,1760,1,1990,0 -0,1130,1470,1,5666,1760,1,1990,0 -1000,1320,1490,1,5696,1780,1,1990,0 -0,0,0,5496,5706,1770,1,1990,0 -980,0,1,5516,5706,1780,1,2020,0 -0,1130,1,5526,5716,1780,1,2020,0 -1000,1320,1,5546,5726,1780,1,2020,0 -0,0,5356,5546,5726,1780,1,2020,0 -980,1,5396,5596,5746,1780,1,2020,0 -0,5206,5446,5596,5746,1780,1,2020,0 -5076,5296,5446,5596,5746,1780,1,2020,0 -0,0,0,0,0,0,5896,2020,0 -980,0,0,0,0,1,5886,2020,0 -0,1120,0,0,0,1,5896,2020,0 -1000,1320,0,0,0,1,5896,2020,0 -0,0,1280,0,0,1,5896,2020,0 -980,0,1430,0,0,1,5946,2020,0 -0,1130,1470,0,0,1,5946,2020,0 -1000,1320,1490,0,0,1,5956,2020,0 -0,0,0,1400,0,1,5946,2020,0 -980,0,1,1430,0,1,5956,2030,0 -0,1140,1,1450,0,1,5956,2030,0 -1000,1320,1,1460,0,1,5956,2030,0 -0,0,5366,1480,0,1,5956,2030,0 -980,1,5386,1480,0,1,5956,2030,0 -0,5246,5446,1480,0,1,5956,2030,0 -5076,5296,5446,1480,0,1,5956,2030,0 -0,0,0,0,1580,1,5956,2030,0 -980,0,0,1,1590,1,5976,2050,0 -0,1140,0,1,1600,1,5976,2050,0 -1000,1320,0,1,1600,1,5976,2050,0 -0,0,1300,1,1600,1,5976,2050,0 -980,0,1440,1,1610,1,5976,2050,0 -0,1140,1480,1,1620,1,5976,2050,0 -1000,1330,1500,1,1620,1,5976,2050,0 -0,0,0,5496,1620,1,5976,2050,0 -980,0,1,5526,1620,1,5996,2050,0 -0,1140,1,5546,1630,1,5996,2050,0 -1000,1330,1,5546,1630,1,5996,2050,0 -0,0,5346,5586,1630,1,5996,2050,0 -980,1,5386,5596,1630,1,5996,2050,0 -0,5246,5446,5596,1630,1,5996,2050,0 -5076,5296,5446,5596,1630,1,5996,2050,0 -0,0,0,0,0,5766,6006,2050,0 -980,0,0,0,1,5806,6006,2050,0 -0,1140,0,0,1,5806,6006,2050,0 -1000,1320,0,0,1,5816,6006,2050,0 -0,0,1280,0,1,5806,6006,2050,0 -980,0,1440,0,1,5816,6006,2050,0 -0,1140,1480,0,1,5826,6006,2050,0 -1000,1320,1490,0,1,5826,6006,2050,0 -0,0,0,1430,1,5826,6006,2050,0 -980,0,1,1450,1,5826,6006,2050,0 -0,1140,1,1460,1,5836,6006,2050,0 -1000,1320,1,1480,1,5846,6006,2050,0 -0,0,5366,1500,1,5846,6006,2050,0 -980,1,5406,1500,1,5866,6026,2050,0 -0,5246,5446,1500,1,5866,6026,2050,0 -5076,5296,5446,1500,1,5866,6026,2050,0 -0,0,0,0,5626,5886,6026,2050,0 -980,0,0,1,5676,5886,6026,2050,0 -0,1140,0,1,5676,5886,6026,2050,0 -1000,1320,0,1,5696,5886,6026,2050,0 -0,0,1290,1,5696,5886,6026,2050,0 -980,0,1440,1,5696,5896,6026,2050,0 -0,1140,1480,1,5696,5896,6026,2050,0 -1000,1320,1500,1,5716,5896,6026,2050,0 -0,0,0,5466,5716,5896,6026,2050,0 -980,0,1,5516,5726,5896,6026,2050,0 -0,1140,1,5526,5726,5896,6026,2050,0 -1000,1320,1,5566,5726,5896,6026,2050,0 -0,0,5356,5566,5726,5896,6026,2050,0 -980,1,5376,5566,5726,5896,6026,2050,0 -0,5246,5446,5566,5726,5896,6026,2050,0 -5076,5296,5446,5566,5726,5896,6026,2050,0 -0,0,0,0,0,0,0,0,2040 -980,0,0,0,0,0,0,1,2050 -0,1130,0,0,0,0,0,1,2060 -1000,1320,0,0,0,0,0,1,2070 -0,0,1280,0,0,0,0,1,2070 -980,0,1420,0,0,0,0,1,2070 -0,1130,1470,0,0,0,0,1,2070 -1000,1320,1490,0,0,0,0,1,2070 -0,0,0,1400,0,0,0,1,2070 -980,0,0,1530,0,0,0,1,2080 -0,1130,0,1570,0,0,0,1,2080 -1000,1320,0,1610,0,0,0,1,2090 -0,0,1280,1630,0,0,0,1,2080 -980,1,5386,1480,0,0,0,1,2090 -0,5246,5446,1480,0,0,0,1,2090 -5076,5296,5446,1490,0,0,0,1,2090 -0,0,0,0,1530,0,0,1,2090 -980,0,0,1,1550,0,0,1,2090 -0,1130,0,1,1560,0,0,1,2090 -1000,1320,0,1,1580,0,0,1,2090 -0,0,1280,1,1580,0,0,1,2090 -980,0,1430,1,1580,0,0,1,2090 -0,1130,1470,1,1590,0,0,1,2090 -1000,1320,1490,1,1600,0,0,1,2090 -0,0,0,5496,1620,0,0,1,2090 -980,0,1,5536,1620,0,0,1,2100 -0,1130,1,5546,1620,0,0,1,2100 -1000,1320,1,5566,1620,0,0,1,2100 -0,0,5366,5586,1620,0,0,1,2100 -980,1,5376,5566,1620,0,0,1,2100 -0,5246,5446,5566,1620,0,0,1,2100 -5096,5296,5446,5566,1620,0,0,1,2100 -0,0,0,0,0,1660,0,1,2100 -980,0,0,0,1,1670,0,1,2100 -0,1130,0,0,1,1680,0,1,2100 -1000,1320,0,0,1,1700,0,1,2100 -0,0,1280,0,1,1700,0,1,2100 -980,0,1430,0,1,1710,0,1,2110 -0,1130,1470,0,1,1720,0,1,2110 -1000,1320,1490,0,1,1730,0,1,2110 -0,0,0,1400,1,1720,0,1,2110 -980,0,1,1420,1,1720,0,1,2110 -0,1130,1,1440,1,1720,0,1,2110 -1000,1320,1,1460,1,1730,0,1,2110 -0,0,5346,1460,1,1730,0,1,2110 -980,1,5386,1480,1,1740,0,1,2120 -0,5246,5446,1480,1,1740,0,1,2120 -5076,5296,5446,1500,1,1740,0,1,2120 -0,0,0,0,5616,1740,0,1,2120 -980,0,0,1,5626,1750,0,1,2120 -0,1130,0,1,5636,1750,0,1,2120 -1000,1320,0,1,5656,1750,0,1,2120 -0,0,1280,1,5666,1750,0,1,2120 -980,0,1440,1,5666,1750,0,1,2120 -0,1130,1480,1,5666,1750,0,1,2120 -1000,1320,1490,1,5686,1750,0,1,2120 -0,0,0,5486,5726,1750,0,1,2120 -980,0,1,5496,5726,1750,0,1,2130 -0,1140,1,5526,5726,1750,0,1,2130 -1000,1320,1,5546,5726,1760,0,1,2130 -0,0,5356,5576,5726,1760,0,1,2130 -980,1,5376,5566,5726,1760,0,1,2130 -0,5246,5446,5566,5726,1760,0,1,2130 -5076,5296,5446,5566,5726,1760,0,1,2130 -0,0,0,0,0,0,1810,1,2130 -980,0,0,0,0,1,1820,1,2130 -0,1130,0,0,0,1,1820,1,2130 -1000,1320,0,0,0,1,1830,1,2130 -0,0,1280,0,0,1,1830,1,2130 -980,0,1430,0,0,1,1830,1,2130 -0,1130,1470,0,0,1,1830,1,2130 -1000,1320,1490,0,0,1,1830,1,2130 -0,0,0,1400,0,1,1830,1,2130 -980,0,1,1420,0,1,1850,1,2130 -0,1130,1,1440,0,1,1850,1,2130 -1000,1320,1,1460,0,1,1850,1,2130 -0,0,5346,1460,0,1,1850,1,2130 -980,1,5386,1480,0,1,1860,1,2130 -0,5246,5446,1480,0,1,1860,1,2130 -5076,5296,5446,1500,0,1,1870,1,2130 -0,0,0,0,1530,1,1860,1,2130 -980,0,0,1,1560,1,1870,1,2130 -0,1130,0,1,1570,1,1870,1,2130 -1000,1320,0,1,1580,1,1870,1,2130 -0,0,1280,1,1580,1,1870,1,2130 -980,0,1430,1,1600,1,1880,1,2140 -0,1130,1470,1,1610,1,1880,1,2140 -1000,1320,1490,1,1610,1,1880,1,2140 -0,0,0,5486,1620,1,1880,1,2140 -980,0,1,5516,1620,1,1890,1,2140 -0,1130,1,5536,1620,1,1890,1,2140 -1000,1320,1,5566,1620,1,1890,1,2140 -0,0,5366,5586,1620,1,1890,1,2140 -980,1,5376,5566,1630,1,1900,1,2140 -0,5246,5466,5566,1630,1,1900,1,2140 -5076,5296,5446,5566,1630,1,1900,1,2140 -0,0,0,0,0,5376,1900,1,2140 -980,0,0,0,1,5776,1900,1,2150 -0,1130,0,0,1,5796,1900,1,2150 -1000,1320,0,0,1,5796,1900,1,2150 -0,0,1280,0,1,5796,1900,1,2150 -980,0,1440,0,1,5796,1900,1,2150 -0,1130,1480,0,1,5806,1900,1,2150 -1000,1320,1500,0,1,5806,1900,1,2150 -0,0,0,1430,1,5806,1900,1,2150 -980,0,1,1450,1,5806,1910,1,2160 -0,1130,1,1460,1,5806,1910,1,2160 -1000,1320,1,1470,1,5816,1910,1,2160 -0,0,5346,1480,1,5816,1910,1,2160 -980,1,5386,1480,1,5816,1910,1,2160 -0,5246,5446,1480,1,5816,1910,1,2160 -5076,5296,5446,1500,1,5816,1910,1,2160 -0,0,0,0,5586,5836,1910,1,2160 -980,0,0,1,5626,5836,1910,1,2160 -0,1140,0,1,5636,5836,1910,1,2160 -1000,1320,0,1,5646,5836,1910,1,2160 -0,0,1290,1,5646,5836,1910,1,2160 -980,0,1430,1,5646,5836,1910,1,2160 -0,1140,1480,1,5656,5836,1910,1,2160 -1000,1320,1500,1,5686,5836,1910,1,2160 -0,0,0,5446,5686,5836,1910,1,2160 -980,0,1,5516,5716,5856,1920,1,2160 -0,1140,1,5536,5716,5856,1920,1,2160 -1000,1320,1,5566,5726,5856,1920,1,2160 -0,0,5366,5586,5736,5856,1920,1,2160 -980,1,5376,5566,5726,5856,1930,1,2170 -0,5246,5446,5566,5726,5856,1930,1,2170 -5076,5296,5446,5566,5726,5856,1930,1,2170 -0,0,0,0,0,0,0,6046,2170 -980,0,0,0,0,0,1,6076,2180 -0,1130,0,0,0,0,1,6086,2180 -1000,1320,0,0,0,0,1,6086,2180 -0,0,1280,0,0,0,1,6086,2180 -980,0,1420,0,0,0,1,6086,2180 -0,1130,1470,0,0,0,1,6086,2180 -1000,1320,1490,0,0,0,1,6086,2180 -0,0,0,1400,0,0,1,6086,2180 -980,0,1,1420,0,0,1,6086,2180 -0,1130,1,1440,0,0,1,6086,2180 -1000,1320,1,1460,0,0,1,6086,2180 -0,0,5346,1460,0,0,1,6086,2180 -980,1,5386,1480,0,0,1,6096,2180 -0,5246,5446,1480,0,0,1,6096,2180 -5076,5296,5446,1500,0,0,1,6096,2180 -0,0,0,0,1540,0,1,6096,2180 -980,0,0,1,1570,0,1,6106,2180 -0,1130,0,1,1580,0,1,6106,2180 -1000,1320,0,1,1600,0,1,6106,2180 -0,0,1280,1,1600,0,1,6106,2180 -980,0,1430,1,1600,0,1,6106,2180 -0,1130,1470,1,1600,0,1,6106,2180 -1000,1320,1490,1,1610,0,1,6106,2180 -0,0,0,5486,1610,0,1,6106,2180 -980,0,1,5526,1620,0,1,6106,2180 -0,1130,1,5546,1620,0,1,6106,2180 -1000,1320,1,5546,1630,0,1,6106,2180 -0,0,5346,5586,1630,0,1,6106,2180 -980,1,5376,5566,1630,0,1,6116,2180 -0,5246,5446,5566,1630,0,1,6116,2180 -5076,5296,5446,5566,1630,0,1,6116,2180 -0,0,0,0,0,1700,1,6116,2180 -980,0,0,0,1,1720,1,6116,2180 -0,1130,0,0,1,1730,1,6116,2180 -1000,1320,0,0,1,1730,1,6116,2180 -0,0,1280,0,1,1730,1,6116,2180 -980,0,1430,0,1,1740,1,6116,2180 -0,1130,1470,0,1,1740,1,6116,2180 -1000,1320,1490,0,1,1740,1,6116,2180 -0,0,0,1430,1,1740,1,6116,2180 -980,0,1,1430,1,1740,1,6116,2180 -0,1130,1,1450,1,1740,1,6116,2180 -1000,1320,1,1460,1,1740,1,6116,2180 -0,0,5366,1470,1,1740,1,6116,2180 -980,1,5386,1480,1,1750,1,6116,2180 -0,5246,5446,1480,1,1750,1,6116,2180 -5076,5296,5446,1500,1,1750,1,6116,2180 -0,0,0,0,5616,1750,1,6116,2180 -980,0,0,1,5616,1770,1,6126,2190 -0,1130,0,1,5636,1770,1,6126,2190 -1000,1320,0,1,5646,1770,1,6126,2190 -0,0,1280,1,5646,1770,1,6126,2190 -980,0,1430,1,5646,1770,1,6126,2190 -0,1130,1480,1,5666,1770,1,6126,2190 -1000,1320,1500,1,5686,1770,1,6126,2190 -0,0,0,5446,5686,1770,1,6126,2190 -980,0,1,5516,5716,1770,1,6126,2190 -0,1130,1,5536,5726,1770,1,6126,2190 -1000,1320,1,5566,5726,1770,1,6126,2190 -0,0,5366,5586,5736,1770,1,6126,2190 -980,1,5376,5566,5726,1780,1,6136,2190 -0,5246,5446,5566,5726,1780,1,6136,2190 -5076,5296,5446,5566,5726,1780,1,6136,2190 -0,0,0,0,0,0,5886,6136,2190 -980,0,0,0,0,1,5906,6156,2190 -0,1130,0,0,0,1,5916,6156,2190 -1000,1320,0,0,0,1,5936,6156,2190 -0,0,1280,0,0,1,5916,6156,2190 -980,0,1430,0,0,1,5946,6176,2190 -0,1130,1470,0,0,1,5956,6176,2190 -1000,1320,1490,0,0,1,5956,6176,2190 -0,0,0,1420,0,1,5966,6176,2190 -980,0,1,1430,0,1,5966,6166,2190 -0,1130,1,1450,0,1,5966,6166,2190 -1000,1320,1,1460,0,1,5966,6166,2190 -0,0,5366,1470,0,1,5966,6166,2190 -980,1,5376,1480,0,1,5966,6166,2190 -0,5246,5446,1480,0,1,5966,6166,2190 -5076,5296,5446,1500,0,1,5966,6166,2190 -0,0,0,0,1580,1,5966,6166,2190 -980,0,0,1,1600,1,5976,6166,2190 -0,1130,0,1,1600,1,5976,6166,2190 -1000,1320,0,1,1600,1,5976,6166,2190 -0,0,1280,1,1600,1,5976,6166,2190 -980,0,1430,1,1600,1,5976,6166,2190 -0,1130,1480,1,1600,1,5976,6166,2190 -1000,1320,1490,1,1610,1,5976,6166,2190 -0,0,0,5446,1620,1,5976,6166,2190 -980,0,1,5526,1620,1,5986,6166,2190 -0,1130,1,5546,1620,1,5986,6166,2190 -1000,1320,1,5546,1630,1,5986,6166,2190 -0,0,5346,5566,1630,1,5986,6166,2190 -980,1,5376,5566,1630,1,5986,6166,2190 -0,5246,5446,5566,1630,1,5986,6166,2190 -5076,5296,5446,5566,1630,1,5986,6166,2190 -0,0,0,0,0,9876,10080,10240,2160 -980,0,0,0,1,5776,6016,6166,2190 -0,1130,0,0,1,5786,6016,6166,2190 -1000,1320,0,0,1,5796,6016,6166,2190 -0,0,1280,0,1,5786,6016,6166,2190 -980,0,1440,0,1,5796,6016,6166,2190 -0,1130,1480,0,1,5796,6016,6166,2190 -1000,1320,1490,0,1,5796,6016,6166,2190 -0,0,0,1430,1,5796,6016,6166,2190 -980,0,1,1430,1,5796,6016,6166,2190 -0,1130,1,1450,1,5796,6016,6166,2190 -1000,1320,1,1460,1,5796,6016,6166,2190 -0,0,5366,1470,1,5816,6016,6166,2190 -980,1,5376,1480,1,5826,6016,6166,2200 -0,5246,5446,1480,1,5836,6016,6166,2200 -5076,5296,5446,1500,1,5836,6016,6166,2200 -0,0,0,0,9736,5836,6016,6166,2200 -980,0,0,1,9736,5846,6016,6166,2200 -0,1130,0,1,9736,5846,6016,6166,2200 -1000,1320,0,1,9736,5846,6016,6166,2200 -0,0,1290,1,9736,5846,6016,6166,2200 -980,0,1440,1,9756,5846,6016,6166,2200 -0,1130,1480,1,9756,5846,6016,6166,2200 -1000,1320,1500,1,9756,5846,6016,6166,2200 -0,0,0,9586,1,5746,5986,6146,2200 -980,0,1,9576,5666,5866,6016,6166,2210 -0,1130,1,9586,5666,5866,6016,6166,2210 -1000,1320,1,9596,5666,5866,6016,6166,2210 -0,0,9486,1,5626,5846,6016,6166,2210 -980,1,5386,5566,5726,5866,6016,6166,2210 -0,5246,1,5436,5666,5856,6006,6166,2210 +0,0,0,0,0,0,0,0,0 +960,0,0,0,0,0,0,0,0 +0,1100,0,0,0,0,0,0,0 +980,1280,0,0,0,0,0,0,0 +0,0,1250,0,0,0,0,0,0 +980,0,1390,0,0,0,0,0,0 +0,1130,1440,0,0,0,0,0,0 +980,1320,1480,0,0,0,0,0,0 +0,0,0,1400,0,0,0,0,0 +980,0,0,1510,0,0,0,0,0 +0,1130,0,1530,0,0,0,0,0 +980,1320,0,1580,0,0,0,0,0 +0,0,1260,1580,0,0,0,0,0 +980,1,1300,1580,0,0,0,0,0 +0,5246,5446,1460,0,0,0,0,0 +5076,5296,5446,1460,0,0,0,0,0 +0,0,0,0,1520,0,0,0,0 +980,0,0,0,1620,0,0,0,0 +0,1130,0,0,1640,0,0,0,0 +980,1320,0,0,1690,0,0,0,0 +0,0,1280,0,1680,0,0,0,0 +1000,0,1430,1,1570,0,0,0,0 +0,1090,1460,1,1570,0,0,0,0 +990,1340,1540,1,1580,0,0,0,0 +0,0,0,5496,1600,0,0,0,0 +970,0,1,5546,1600,0,0,0,0 +0,1140,1,5546,1600,0,0,0,0 +1000,1320,1,5546,1600,0,0,0,0 +0,0,5346,5566,1600,0,0,0,0 +1000,1,5416,5586,1600,0,0,0,0 +0,5226,5446,5586,1600,0,0,0,0 +5076,5286,5446,5586,1600,0,0,0,0 +0,0,0,0,0,1640,0,0,0 +980,0,0,0,0,1760,0,0,0 +0,1130,0,0,0,1780,0,0,0 +980,1320,0,0,1,1680,0,0,0 +0,0,1280,0,0,1800,0,0,0 +980,0,1420,0,1,1680,0,0,0 +0,1130,1460,0,1,1680,0,0,0 +1000,1320,1480,0,1,1680,0,0,0 +0,0,0,1380,1,1680,0,0,0 +980,0,0,1540,1,1700,0,0,0 +0,1130,0,1580,1,1700,0,0,0 +1000,1320,0,1620,1,1700,0,0,0 +0,0,5346,1480,1,1700,0,0,0 +980,1,5386,1480,1,1700,0,0,0 +0,5246,5446,1480,1,1700,0,0,0 +5076,5296,5446,1480,1,1700,0,0,0 +0,0,0,0,5616,1740,0,0,0 +980,0,0,1,5636,1740,0,0,0 +0,1130,0,1,5646,1740,0,0,0 +1000,1320,0,1,5656,1740,0,0,0 +0,0,1280,1,5666,1740,0,0,0 +980,0,1420,1,5676,1740,0,0,0 +0,1130,1460,1,5676,1740,0,0,0 +1000,1320,1480,1,5676,1740,0,0,0 +0,0,0,5498,5726,1740,0,0,0 +980,0,1,5526,5706,1740,0,0,0 +0,1130,1,5526,5706,1740,0,0,0 +1000,1320,1,5526,5706,1740,0,0,0 +0,0,5356,5576,5706,1740,0,0,0 +980,1,5406,5576,5726,1740,0,0,0 +0,5216,5416,5576,5726,1740,0,0,0 +5076,5296,5446,5576,5726,1740,0,0,0 +0,0,0,0,0,0,1760,0,0 +980,0,0,0,0,1,1780,0,0 +0,1130,0,0,0,1,1790,0,0 +1000,1320,0,0,0,1,1800,0,0 +0,0,1280,0,0,1,1800,0,0 +980,0,1420,0,0,1,1820,0,0 +0,1130,1460,0,0,1,1820,0,0 +1000,1320,1480,0,0,1,1820,0,0 +0,0,0,1400,0,1,1820,0,0 +980,0,0,1540,0,1,1820,0,0 +0,1130,0,1560,0,1,1820,0,0 +1000,1320,0,1610,0,1,1830,0,0 +0,0,1280,1620,0,1,1830,0,0 +980,1,5386,1480,0,1,1840,0,0 +0,5246,5446,1480,0,1,1840,0,0 +5076,5296,5446,1480,0,1,1840,0,0 +0,0,0,0,1540,1,1860,0,0 +980,0,0,0,1690,1,1840,0,0 +0,1130,0,0,1700,1,1840,0,0 +1000,1320,0,0,1730,1,1840,0,0 +0,0,1280,0,1730,1,1850,0,0 +980,0,1420,1,1580,1,1850,0,0 +0,1130,1460,1,1580,1,1850,0,0 +1000,1320,1480,1,1580,1,1850,0,0 +0,0,0,5486,1600,1,1850,0,0 +980,0,1,5516,1610,1,1850,0,0 +0,1130,1,5526,1610,1,1850,0,0 +1000,1320,1,5546,1610,1,1850,0,0 +0,0,5326,5586,1610,1,1850,0,0 +980,1,5396,5596,1630,1,1850,0,0 +0,5246,5446,5596,1630,1,1850,0,0 +5076,5296,5446,5596,1630,1,1850,0,0 +0,0,0,0,0,5776,1880,0,0 +980,0,0,0,1,5796,1880,0,0 +0,1130,0,0,1,5796,1880,0,0 +1000,1320,0,0,1,5796,1880,0,0 +0,0,1280,0,1,5796,1880,0,0 +980,0,1430,0,1,5796,1880,0,0 +0,1130,1470,0,1,5796,1880,0,0 +1000,1320,1490,0,1,5796,1880,0,0 +0,0,0,1400,1,5796,1880,0,0 +980,0,0,1600,1,5796,1880,0,0 +0,1130,0,1620,1,5806,1880,0,0 +1000,1320,0,1640,1,5816,1880,0,0 +0,0,1290,1660,1,5816,1880,0,0 +980,1,5396,1500,1,5826,1890,0,0 +0,5246,5446,1500,1,5826,1890,0,0 +5076,5296,5446,1500,1,5826,1890,0,0 +0,0,0,0,5616,5846,1890,0,0 +980,0,0,1,5646,5866,1900,0,0 +0,1130,0,1,5656,5866,1900,0,0 +1000,1320,0,1,5666,5866,1900,0,0 +0,0,1280,1,5666,5866,1900,0,0 +980,0,1430,1,5686,5876,1900,0,0 +0,1120,1470,1,5696,5876,1900,0,0 +1000,1320,1490,1,5706,5876,1900,0,0 +0,0,0,5466,5706,5876,1900,0,0 +980,0,1,5536,5746,5896,1900,0,0 +0,1130,1,5546,5746,5896,1900,0,0 +1000,1320,1,5566,5746,5896,1900,0,0 +0,0,5366,5596,5746,5896,1900,0,0 +980,1,5396,5596,5746,5896,1900,0,0 +0,5206,5446,5596,5746,5896,1900,0,0 +5076,5296,5446,5596,5746,5896,1900,0,0 +0,0,0,0,0,0,0,1920,0 +980,0,0,0,0,0,1,1920,0 +0,1130,0,0,0,0,1,1930,0 +1000,1320,0,0,0,0,1,1940,0 +0,0,1280,0,0,0,1,1940,0 +980,0,1410,0,0,0,1,1940,0 +0,1130,1460,0,0,0,1,1940,0 +1000,1320,1490,0,0,0,1,1940,0 +0,0,0,1390,0,0,1,1940,0 +980,0,0,1540,0,0,1,1950,0 +0,1130,0,1560,0,0,1,1950,0 +1000,1320,0,1600,0,0,1,1950,0 +0,0,1280,1620,0,0,1,1960,0 +980,1,5386,1480,0,0,1,1960,0 +0,5246,5446,1480,0,0,1,1960,0 +5076,5296,5446,1480,0,0,1,1960,0 +0,0,0,0,1540,0,1,1960,0 +980,0,0,1,1540,0,1,1960,0 +0,1130,0,1,1550,0,1,1960,0 +1000,1320,0,1,1560,0,1,1960,0 +0,0,1280,1,1580,0,1,1960,0 +980,0,1420,1,1590,0,1,1960,0 +0,1130,1460,1,1600,0,1,1960,0 +1000,1320,1490,1,1620,0,1,1960,0 +0,0,0,5496,1640,0,1,1960,0 +980,0,1,5516,1620,0,1,1960,0 +0,1130,1,5526,1620,0,1,1960,0 +1000,1320,1,5526,1620,0,1,1960,0 +0,0,5246,5536,1620,0,1,1960,0 +980,1,5386,5596,1620,0,1,1970,0 +0,5206,5446,5596,1620,0,1,1970,0 +5076,5296,5446,5596,1620,0,1,1970,0 +0,0,0,0,0,1660,1,1970,0 +980,0,0,0,1,1700,1,1980,0 +0,1130,0,0,1,1700,1,1980,0 +1000,1320,0,0,1,1700,1,1980,0 +0,0,1280,0,1,1710,1,1980,0 +980,0,1430,0,1,1720,1,1980,0 +0,1130,1470,0,1,1720,1,1980,0 +1000,1320,1490,0,1,1720,1,1980,0 +0,0,0,1420,1,1720,1,1980,0 +980,0,1,1430,1,1720,1,1980,0 +0,1130,1,1460,1,1720,1,1980,0 +1000,1320,1,1480,1,1720,1,1980,0 +0,0,5356,1480,1,1720,1,1980,0 +990,1,5386,1480,1,1730,1,1990,0 +0,5246,5446,1480,1,1730,1,1990,0 +5076,5296,5446,1480,1,1730,1,1990,0 +0,0,0,0,5616,1750,1,1990,0 +980,0,0,1,5636,1760,1,1990,0 +0,1130,0,1,5646,1760,1,1990,0 +1000,1320,0,1,5666,1760,1,1990,0 +0,0,1280,1,5666,1760,1,1990,0 +980,0,1430,1,5666,1760,1,1990,0 +0,1130,1470,1,5666,1760,1,1990,0 +1000,1320,1490,1,5696,1780,1,1990,0 +0,0,0,5496,5706,1770,1,1990,0 +980,0,1,5516,5706,1780,1,2020,0 +0,1130,1,5526,5716,1780,1,2020,0 +1000,1320,1,5546,5726,1780,1,2020,0 +0,0,5356,5546,5726,1780,1,2020,0 +980,1,5396,5596,5746,1780,1,2020,0 +0,5206,5446,5596,5746,1780,1,2020,0 +5076,5296,5446,5596,5746,1780,1,2020,0 +0,0,0,0,0,0,5896,2020,0 +980,0,0,0,0,1,5886,2020,0 +0,1120,0,0,0,1,5896,2020,0 +1000,1320,0,0,0,1,5896,2020,0 +0,0,1280,0,0,1,5896,2020,0 +980,0,1430,0,0,1,5946,2020,0 +0,1130,1470,0,0,1,5946,2020,0 +1000,1320,1490,0,0,1,5956,2020,0 +0,0,0,1400,0,1,5946,2020,0 +980,0,1,1430,0,1,5956,2030,0 +0,1140,1,1450,0,1,5956,2030,0 +1000,1320,1,1460,0,1,5956,2030,0 +0,0,5366,1480,0,1,5956,2030,0 +980,1,5386,1480,0,1,5956,2030,0 +0,5246,5446,1480,0,1,5956,2030,0 +5076,5296,5446,1480,0,1,5956,2030,0 +0,0,0,0,1580,1,5956,2030,0 +980,0,0,1,1590,1,5976,2050,0 +0,1140,0,1,1600,1,5976,2050,0 +1000,1320,0,1,1600,1,5976,2050,0 +0,0,1300,1,1600,1,5976,2050,0 +980,0,1440,1,1610,1,5976,2050,0 +0,1140,1480,1,1620,1,5976,2050,0 +1000,1330,1500,1,1620,1,5976,2050,0 +0,0,0,5496,1620,1,5976,2050,0 +980,0,1,5526,1620,1,5996,2050,0 +0,1140,1,5546,1630,1,5996,2050,0 +1000,1330,1,5546,1630,1,5996,2050,0 +0,0,5346,5586,1630,1,5996,2050,0 +980,1,5386,5596,1630,1,5996,2050,0 +0,5246,5446,5596,1630,1,5996,2050,0 +5076,5296,5446,5596,1630,1,5996,2050,0 +0,0,0,0,0,5766,6006,2050,0 +980,0,0,0,1,5806,6006,2050,0 +0,1140,0,0,1,5806,6006,2050,0 +1000,1320,0,0,1,5816,6006,2050,0 +0,0,1280,0,1,5806,6006,2050,0 +980,0,1440,0,1,5816,6006,2050,0 +0,1140,1480,0,1,5826,6006,2050,0 +1000,1320,1490,0,1,5826,6006,2050,0 +0,0,0,1430,1,5826,6006,2050,0 +980,0,1,1450,1,5826,6006,2050,0 +0,1140,1,1460,1,5836,6006,2050,0 +1000,1320,1,1480,1,5846,6006,2050,0 +0,0,5366,1500,1,5846,6006,2050,0 +980,1,5406,1500,1,5866,6026,2050,0 +0,5246,5446,1500,1,5866,6026,2050,0 +5076,5296,5446,1500,1,5866,6026,2050,0 +0,0,0,0,5626,5886,6026,2050,0 +980,0,0,1,5676,5886,6026,2050,0 +0,1140,0,1,5676,5886,6026,2050,0 +1000,1320,0,1,5696,5886,6026,2050,0 +0,0,1290,1,5696,5886,6026,2050,0 +980,0,1440,1,5696,5896,6026,2050,0 +0,1140,1480,1,5696,5896,6026,2050,0 +1000,1320,1500,1,5716,5896,6026,2050,0 +0,0,0,5466,5716,5896,6026,2050,0 +980,0,1,5516,5726,5896,6026,2050,0 +0,1140,1,5526,5726,5896,6026,2050,0 +1000,1320,1,5566,5726,5896,6026,2050,0 +0,0,5356,5566,5726,5896,6026,2050,0 +980,1,5376,5566,5726,5896,6026,2050,0 +0,5246,5446,5566,5726,5896,6026,2050,0 +5076,5296,5446,5566,5726,5896,6026,2050,0 +0,0,0,0,0,0,0,0,2040 +980,0,0,0,0,0,0,1,2050 +0,1130,0,0,0,0,0,1,2060 +1000,1320,0,0,0,0,0,1,2070 +0,0,1280,0,0,0,0,1,2070 +980,0,1420,0,0,0,0,1,2070 +0,1130,1470,0,0,0,0,1,2070 +1000,1320,1490,0,0,0,0,1,2070 +0,0,0,1400,0,0,0,1,2070 +980,0,0,1530,0,0,0,1,2080 +0,1130,0,1570,0,0,0,1,2080 +1000,1320,0,1610,0,0,0,1,2090 +0,0,1280,1630,0,0,0,1,2080 +980,1,5386,1480,0,0,0,1,2090 +0,5246,5446,1480,0,0,0,1,2090 +5076,5296,5446,1490,0,0,0,1,2090 +0,0,0,0,1530,0,0,1,2090 +980,0,0,1,1550,0,0,1,2090 +0,1130,0,1,1560,0,0,1,2090 +1000,1320,0,1,1580,0,0,1,2090 +0,0,1280,1,1580,0,0,1,2090 +980,0,1430,1,1580,0,0,1,2090 +0,1130,1470,1,1590,0,0,1,2090 +1000,1320,1490,1,1600,0,0,1,2090 +0,0,0,5496,1620,0,0,1,2090 +980,0,1,5536,1620,0,0,1,2100 +0,1130,1,5546,1620,0,0,1,2100 +1000,1320,1,5566,1620,0,0,1,2100 +0,0,5366,5586,1620,0,0,1,2100 +980,1,5376,5566,1620,0,0,1,2100 +0,5246,5446,5566,1620,0,0,1,2100 +5096,5296,5446,5566,1620,0,0,1,2100 +0,0,0,0,0,1660,0,1,2100 +980,0,0,0,1,1670,0,1,2100 +0,1130,0,0,1,1680,0,1,2100 +1000,1320,0,0,1,1700,0,1,2100 +0,0,1280,0,1,1700,0,1,2100 +980,0,1430,0,1,1710,0,1,2110 +0,1130,1470,0,1,1720,0,1,2110 +1000,1320,1490,0,1,1730,0,1,2110 +0,0,0,1400,1,1720,0,1,2110 +980,0,1,1420,1,1720,0,1,2110 +0,1130,1,1440,1,1720,0,1,2110 +1000,1320,1,1460,1,1730,0,1,2110 +0,0,5346,1460,1,1730,0,1,2110 +980,1,5386,1480,1,1740,0,1,2120 +0,5246,5446,1480,1,1740,0,1,2120 +5076,5296,5446,1500,1,1740,0,1,2120 +0,0,0,0,5616,1740,0,1,2120 +980,0,0,1,5626,1750,0,1,2120 +0,1130,0,1,5636,1750,0,1,2120 +1000,1320,0,1,5656,1750,0,1,2120 +0,0,1280,1,5666,1750,0,1,2120 +980,0,1440,1,5666,1750,0,1,2120 +0,1130,1480,1,5666,1750,0,1,2120 +1000,1320,1490,1,5686,1750,0,1,2120 +0,0,0,5486,5726,1750,0,1,2120 +980,0,1,5496,5726,1750,0,1,2130 +0,1140,1,5526,5726,1750,0,1,2130 +1000,1320,1,5546,5726,1760,0,1,2130 +0,0,5356,5576,5726,1760,0,1,2130 +980,1,5376,5566,5726,1760,0,1,2130 +0,5246,5446,5566,5726,1760,0,1,2130 +5076,5296,5446,5566,5726,1760,0,1,2130 +0,0,0,0,0,0,1810,1,2130 +980,0,0,0,0,1,1820,1,2130 +0,1130,0,0,0,1,1820,1,2130 +1000,1320,0,0,0,1,1830,1,2130 +0,0,1280,0,0,1,1830,1,2130 +980,0,1430,0,0,1,1830,1,2130 +0,1130,1470,0,0,1,1830,1,2130 +1000,1320,1490,0,0,1,1830,1,2130 +0,0,0,1400,0,1,1830,1,2130 +980,0,1,1420,0,1,1850,1,2130 +0,1130,1,1440,0,1,1850,1,2130 +1000,1320,1,1460,0,1,1850,1,2130 +0,0,5346,1460,0,1,1850,1,2130 +980,1,5386,1480,0,1,1860,1,2130 +0,5246,5446,1480,0,1,1860,1,2130 +5076,5296,5446,1500,0,1,1870,1,2130 +0,0,0,0,1530,1,1860,1,2130 +980,0,0,1,1560,1,1870,1,2130 +0,1130,0,1,1570,1,1870,1,2130 +1000,1320,0,1,1580,1,1870,1,2130 +0,0,1280,1,1580,1,1870,1,2130 +980,0,1430,1,1600,1,1880,1,2140 +0,1130,1470,1,1610,1,1880,1,2140 +1000,1320,1490,1,1610,1,1880,1,2140 +0,0,0,5486,1620,1,1880,1,2140 +980,0,1,5516,1620,1,1890,1,2140 +0,1130,1,5536,1620,1,1890,1,2140 +1000,1320,1,5566,1620,1,1890,1,2140 +0,0,5366,5586,1620,1,1890,1,2140 +980,1,5376,5566,1630,1,1900,1,2140 +0,5246,5466,5566,1630,1,1900,1,2140 +5076,5296,5446,5566,1630,1,1900,1,2140 +0,0,0,0,0,5376,1900,1,2140 +980,0,0,0,1,5776,1900,1,2150 +0,1130,0,0,1,5796,1900,1,2150 +1000,1320,0,0,1,5796,1900,1,2150 +0,0,1280,0,1,5796,1900,1,2150 +980,0,1440,0,1,5796,1900,1,2150 +0,1130,1480,0,1,5806,1900,1,2150 +1000,1320,1500,0,1,5806,1900,1,2150 +0,0,0,1430,1,5806,1900,1,2150 +980,0,1,1450,1,5806,1910,1,2160 +0,1130,1,1460,1,5806,1910,1,2160 +1000,1320,1,1470,1,5816,1910,1,2160 +0,0,5346,1480,1,5816,1910,1,2160 +980,1,5386,1480,1,5816,1910,1,2160 +0,5246,5446,1480,1,5816,1910,1,2160 +5076,5296,5446,1500,1,5816,1910,1,2160 +0,0,0,0,5586,5836,1910,1,2160 +980,0,0,1,5626,5836,1910,1,2160 +0,1140,0,1,5636,5836,1910,1,2160 +1000,1320,0,1,5646,5836,1910,1,2160 +0,0,1290,1,5646,5836,1910,1,2160 +980,0,1430,1,5646,5836,1910,1,2160 +0,1140,1480,1,5656,5836,1910,1,2160 +1000,1320,1500,1,5686,5836,1910,1,2160 +0,0,0,5446,5686,5836,1910,1,2160 +980,0,1,5516,5716,5856,1920,1,2160 +0,1140,1,5536,5716,5856,1920,1,2160 +1000,1320,1,5566,5726,5856,1920,1,2160 +0,0,5366,5586,5736,5856,1920,1,2160 +980,1,5376,5566,5726,5856,1930,1,2170 +0,5246,5446,5566,5726,5856,1930,1,2170 +5076,5296,5446,5566,5726,5856,1930,1,2170 +0,0,0,0,0,0,0,6046,2170 +980,0,0,0,0,0,1,6076,2180 +0,1130,0,0,0,0,1,6086,2180 +1000,1320,0,0,0,0,1,6086,2180 +0,0,1280,0,0,0,1,6086,2180 +980,0,1420,0,0,0,1,6086,2180 +0,1130,1470,0,0,0,1,6086,2180 +1000,1320,1490,0,0,0,1,6086,2180 +0,0,0,1400,0,0,1,6086,2180 +980,0,1,1420,0,0,1,6086,2180 +0,1130,1,1440,0,0,1,6086,2180 +1000,1320,1,1460,0,0,1,6086,2180 +0,0,5346,1460,0,0,1,6086,2180 +980,1,5386,1480,0,0,1,6096,2180 +0,5246,5446,1480,0,0,1,6096,2180 +5076,5296,5446,1500,0,0,1,6096,2180 +0,0,0,0,1540,0,1,6096,2180 +980,0,0,1,1570,0,1,6106,2180 +0,1130,0,1,1580,0,1,6106,2180 +1000,1320,0,1,1600,0,1,6106,2180 +0,0,1280,1,1600,0,1,6106,2180 +980,0,1430,1,1600,0,1,6106,2180 +0,1130,1470,1,1600,0,1,6106,2180 +1000,1320,1490,1,1610,0,1,6106,2180 +0,0,0,5486,1610,0,1,6106,2180 +980,0,1,5526,1620,0,1,6106,2180 +0,1130,1,5546,1620,0,1,6106,2180 +1000,1320,1,5546,1630,0,1,6106,2180 +0,0,5346,5586,1630,0,1,6106,2180 +980,1,5376,5566,1630,0,1,6116,2180 +0,5246,5446,5566,1630,0,1,6116,2180 +5076,5296,5446,5566,1630,0,1,6116,2180 +0,0,0,0,0,1700,1,6116,2180 +980,0,0,0,1,1720,1,6116,2180 +0,1130,0,0,1,1730,1,6116,2180 +1000,1320,0,0,1,1730,1,6116,2180 +0,0,1280,0,1,1730,1,6116,2180 +980,0,1430,0,1,1740,1,6116,2180 +0,1130,1470,0,1,1740,1,6116,2180 +1000,1320,1490,0,1,1740,1,6116,2180 +0,0,0,1430,1,1740,1,6116,2180 +980,0,1,1430,1,1740,1,6116,2180 +0,1130,1,1450,1,1740,1,6116,2180 +1000,1320,1,1460,1,1740,1,6116,2180 +0,0,5366,1470,1,1740,1,6116,2180 +980,1,5386,1480,1,1750,1,6116,2180 +0,5246,5446,1480,1,1750,1,6116,2180 +5076,5296,5446,1500,1,1750,1,6116,2180 +0,0,0,0,5616,1750,1,6116,2180 +980,0,0,1,5616,1770,1,6126,2190 +0,1130,0,1,5636,1770,1,6126,2190 +1000,1320,0,1,5646,1770,1,6126,2190 +0,0,1280,1,5646,1770,1,6126,2190 +980,0,1430,1,5646,1770,1,6126,2190 +0,1130,1480,1,5666,1770,1,6126,2190 +1000,1320,1500,1,5686,1770,1,6126,2190 +0,0,0,5446,5686,1770,1,6126,2190 +980,0,1,5516,5716,1770,1,6126,2190 +0,1130,1,5536,5726,1770,1,6126,2190 +1000,1320,1,5566,5726,1770,1,6126,2190 +0,0,5366,5586,5736,1770,1,6126,2190 +980,1,5376,5566,5726,1780,1,6136,2190 +0,5246,5446,5566,5726,1780,1,6136,2190 +5076,5296,5446,5566,5726,1780,1,6136,2190 +0,0,0,0,0,0,5886,6136,2190 +980,0,0,0,0,1,5906,6156,2190 +0,1130,0,0,0,1,5916,6156,2190 +1000,1320,0,0,0,1,5936,6156,2190 +0,0,1280,0,0,1,5916,6156,2190 +980,0,1430,0,0,1,5946,6176,2190 +0,1130,1470,0,0,1,5956,6176,2190 +1000,1320,1490,0,0,1,5956,6176,2190 +0,0,0,1420,0,1,5966,6176,2190 +980,0,1,1430,0,1,5966,6166,2190 +0,1130,1,1450,0,1,5966,6166,2190 +1000,1320,1,1460,0,1,5966,6166,2190 +0,0,5366,1470,0,1,5966,6166,2190 +980,1,5376,1480,0,1,5966,6166,2190 +0,5246,5446,1480,0,1,5966,6166,2190 +5076,5296,5446,1500,0,1,5966,6166,2190 +0,0,0,0,1580,1,5966,6166,2190 +980,0,0,1,1600,1,5976,6166,2190 +0,1130,0,1,1600,1,5976,6166,2190 +1000,1320,0,1,1600,1,5976,6166,2190 +0,0,1280,1,1600,1,5976,6166,2190 +980,0,1430,1,1600,1,5976,6166,2190 +0,1130,1480,1,1600,1,5976,6166,2190 +1000,1320,1490,1,1610,1,5976,6166,2190 +0,0,0,5446,1620,1,5976,6166,2190 +980,0,1,5526,1620,1,5986,6166,2190 +0,1130,1,5546,1620,1,5986,6166,2190 +1000,1320,1,5546,1630,1,5986,6166,2190 +0,0,5346,5566,1630,1,5986,6166,2190 +980,1,5376,5566,1630,1,5986,6166,2190 +0,5246,5446,5566,1630,1,5986,6166,2190 +5076,5296,5446,5566,1630,1,5986,6166,2190 +0,0,0,0,0,9876,10080,10240,2160 +980,0,0,0,1,5776,6016,6166,2190 +0,1130,0,0,1,5786,6016,6166,2190 +1000,1320,0,0,1,5796,6016,6166,2190 +0,0,1280,0,1,5786,6016,6166,2190 +980,0,1440,0,1,5796,6016,6166,2190 +0,1130,1480,0,1,5796,6016,6166,2190 +1000,1320,1490,0,1,5796,6016,6166,2190 +0,0,0,1430,1,5796,6016,6166,2190 +980,0,1,1430,1,5796,6016,6166,2190 +0,1130,1,1450,1,5796,6016,6166,2190 +1000,1320,1,1460,1,5796,6016,6166,2190 +0,0,5366,1470,1,5816,6016,6166,2190 +980,1,5376,1480,1,5826,6016,6166,2200 +0,5246,5446,1480,1,5836,6016,6166,2200 +5076,5296,5446,1500,1,5836,6016,6166,2200 +0,0,0,0,9736,5836,6016,6166,2200 +980,0,0,1,9736,5846,6016,6166,2200 +0,1130,0,1,9736,5846,6016,6166,2200 +1000,1320,0,1,9736,5846,6016,6166,2200 +0,0,1290,1,9736,5846,6016,6166,2200 +980,0,1440,1,9756,5846,6016,6166,2200 +0,1130,1480,1,9756,5846,6016,6166,2200 +1000,1320,1500,1,9756,5846,6016,6166,2200 +0,0,0,9586,1,5746,5986,6146,2200 +980,0,1,9576,5666,5866,6016,6166,2210 +0,1130,1,9586,5666,5866,6016,6166,2210 +1000,1320,1,9596,5666,5866,6016,6166,2210 +0,0,9486,1,5626,5846,6016,6166,2210 +980,1,5386,5566,5726,5866,6016,6166,2210 +0,5246,1,5436,5666,5856,6006,6166,2210 5100,5300,5450,5600,5750,5900,6050,6200,2200 \ No newline at end of file diff --git a/config b/config index 64280b8..4eab550 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ -[core] - repositoryformatversion = 0 - filemode = false - bare = true - symlinks = false - ignorecase = true +[core] + repositoryformatversion = 0 + filemode = false + bare = true + symlinks = false + ignorecase = true diff --git a/dacdisplayandedit.ui b/dacdisplayandedit.ui index 2d64f38..67434d3 100644 --- a/dacdisplayandedit.ui +++ b/dacdisplayandedit.ui @@ -1,272 +1,272 @@ - - - DacDisplayAndEdit - - - - 0 - 0 - 600 - 143 - - - - Qt::StrongFocus - - - Form - - - - - 10 - 0 - 471 - 111 - - - - - 6 - - - - - 0 - - - 1 - - - - - - 40 - 0 - - - - 10 - - - Qt::AlignCenter - - - - - - - 07 - - - Qt::AlignCenter - - - - - - - 02 - - - Qt::AlignCenter - - - - - - - - 40 - 0 - - - - 20 - - - Qt::AlignCenter - - - - - - - 06 - - - Qt::AlignCenter - - - - - - - 09 - - - Qt::AlignCenter - - - - - - - 03 - - - Qt::AlignCenter - - - - - - - 01 - - - Qt::AlignCenter - - - - - - - 04 - - - Qt::AlignCenter - - - - - - - 05 - - - Qt::AlignCenter - - - - - - - 00 - - - Qt::AlignCenter - - - - - - - 08 - - - Qt::AlignCenter - - - - - - - - 40 - 0 - - - - 30 - - - Qt::AlignCenter - - - - - - - - 40 - 0 - - - - 00 - - - Qt::AlignCenter - - - - - - - 墨点 - - - Qt::AlignCenter - - - - - - - - - - - 10 - 110 - 571 - 20 - - - - 点距电压系数调整,该参数仅代表电压比例关系,不是电压实际值。 - - - - - - 490 - 20 - 91 - 91 - - - - - - - - 0 - 40 - - - - 默认值 - - - - - - - - 0 - 40 - - - - 编辑 - - - - - - - - - + + + DacDisplayAndEdit + + + + 0 + 0 + 600 + 143 + + + + Qt::StrongFocus + + + Form + + + + + 10 + 0 + 471 + 111 + + + + + 6 + + + + + 0 + + + 1 + + + + + + 40 + 0 + + + + 10 + + + Qt::AlignCenter + + + + + + + 07 + + + Qt::AlignCenter + + + + + + + 02 + + + Qt::AlignCenter + + + + + + + + 40 + 0 + + + + 20 + + + Qt::AlignCenter + + + + + + + 06 + + + Qt::AlignCenter + + + + + + + 09 + + + Qt::AlignCenter + + + + + + + 03 + + + Qt::AlignCenter + + + + + + + 01 + + + Qt::AlignCenter + + + + + + + 04 + + + Qt::AlignCenter + + + + + + + 05 + + + Qt::AlignCenter + + + + + + + 00 + + + Qt::AlignCenter + + + + + + + 08 + + + Qt::AlignCenter + + + + + + + + 40 + 0 + + + + 30 + + + Qt::AlignCenter + + + + + + + + 40 + 0 + + + + 00 + + + Qt::AlignCenter + + + + + + + 墨点 + + + Qt::AlignCenter + + + + + + + + + + + 10 + 110 + 571 + 20 + + + + 点距电压系数调整,该参数仅代表电压比例关系,不是电压实际值。 + + + + + + 490 + 20 + 91 + 91 + + + + + + + + 0 + 40 + + + + 默认值 + + + + + + + + 0 + 40 + + + + 编辑 + + + + + + + + + diff --git a/dbredis.cpp b/dbredis.cpp index 3313ceb..624f563 100644 --- a/dbredis.cpp +++ b/dbredis.cpp @@ -1,159 +1,159 @@ -#include "dbredis.h" -#include - -QSqlDatabase DBRedis::m_DataBase; -QString DBRedis::m_ConnectName = "dbredis"; -bool DBRedis::m_HasInit = false; - - -DBRedis::DBRedis() -{ - -} - -DBRedis::~DBRedis() -{ - if (m_DataBase.isOpen()) - { - m_DataBase.close(); - } -} - -int DBRedis::deleteExpiredEntries() -{ - int res = init(); - if (res) - { - return res; - } - - qint64 currentTimestamp = QDateTime::currentDateTime().toSecsSinceEpoch(); - QSqlQuery query(m_DataBase); - query.prepare("DELETE FROM data_store WHERE expiry > 0 AND expiry < :currentTimestamp"); - query.bindValue(":currentTimestamp", currentTimestamp); - - if (!query.exec()) - { - qDebug() << "Error deleting expired entries:" << query.lastError().text(); - return 1; - } - return 0; -} - - - -int DBRedis::setData(const QString & key, const QString & value, uint32_t expiry) -{ - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("SELECT COUNT(*) FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error checking existing key"; - return 1; - } - int count = 0; - while (query.next()) - { - count += query.value(0).toInt(); - } - if (count > 0) - { - query.prepare("UPDATE data_store SET value = :value, expiry = :expiry WHERE key = :key"); - query.bindValue(":value", value); - query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); - query.bindValue(":key", key); - } - else - { - query.prepare("INSERT INTO data_store (key, value, expiry) VALUES (:key, :value, :expiry)"); - query.bindValue(":key", key); - query.bindValue(":value", value); - query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); - } - if (!query.exec()) - { - qDebug() << "Error setting value:" << query.lastError().text(); - return 1; - } - return 0; -} - -int DBRedis::getData(const QString & key, QString & value) -{ - value.clear(); - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("SELECT value FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error getting value:" << query.lastError().text(); - return 1; - } - if (!query.next()) - { - qDebug() << "Error getting value:" << query.lastError().text(); - return 2; - } - value = query.value(0).toString(); - return 0; -} - -int DBRedis::deleteData(const QString & key) -{ - int res = deleteExpiredEntries(); - if (res) - { - return res; - } - - QSqlQuery query(m_DataBase); - query.prepare("DELETE FROM data_store WHERE key = :key"); - query.bindValue(":key", key); - if (!query.exec()) - { - qDebug() << "Error deleting value:" << query.lastError().text(); - return 1; - } - return 0; -} - -int DBRedis::init() -{ - if (m_HasInit) - { - return 0; - } - m_DataBase = QSqlDatabase::addDatabase("QSQLITE", m_ConnectName); -// m_DataBase.setDatabaseName("dbredis.db"); - m_DataBase.setDatabaseName("/home/plg/conf/sysPara.db"); - if (m_DataBase.open()) - { - QString table = "CREATE TABLE IF NOT EXISTS data_store(key TEXT, value TEXT, expiry INTEGER)"; - QSqlQuery query(QSqlDatabase::database(m_ConnectName)); - if (!query.exec(table.toUtf8())) - { - qDebug() << "Error deleting value:" << query.lastError().text(); - return 1; - } - } - else - { - qDebug() << "Error db open fail"; - return 3; - } - m_HasInit = true; - return 0; -} +#include "dbredis.h" +#include + +QSqlDatabase DBRedis::m_DataBase; +QString DBRedis::m_ConnectName = "dbredis"; +bool DBRedis::m_HasInit = false; + + +DBRedis::DBRedis() +{ + +} + +DBRedis::~DBRedis() +{ + if (m_DataBase.isOpen()) + { + m_DataBase.close(); + } +} + +int DBRedis::deleteExpiredEntries() +{ + int res = init(); + if (res) + { + return res; + } + + qint64 currentTimestamp = QDateTime::currentDateTime().toSecsSinceEpoch(); + QSqlQuery query(m_DataBase); + query.prepare("DELETE FROM data_store WHERE expiry > 0 AND expiry < :currentTimestamp"); + query.bindValue(":currentTimestamp", currentTimestamp); + + if (!query.exec()) + { + qDebug() << "Error deleting expired entries:" << query.lastError().text(); + return 1; + } + return 0; +} + + + +int DBRedis::setData(const QString & key, const QString & value, uint32_t expiry) +{ + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("SELECT COUNT(*) FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error checking existing key"; + return 1; + } + int count = 0; + while (query.next()) + { + count += query.value(0).toInt(); + } + if (count > 0) + { + query.prepare("UPDATE data_store SET value = :value, expiry = :expiry WHERE key = :key"); + query.bindValue(":value", value); + query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); + query.bindValue(":key", key); + } + else + { + query.prepare("INSERT INTO data_store (key, value, expiry) VALUES (:key, :value, :expiry)"); + query.bindValue(":key", key); + query.bindValue(":value", value); + query.bindValue(":expiry", expiry > 0 ? QDateTime::currentDateTime().toSecsSinceEpoch() + expiry : 0); + } + if (!query.exec()) + { + qDebug() << "Error setting value:" << query.lastError().text(); + return 1; + } + return 0; +} + +int DBRedis::getData(const QString & key, QString & value) +{ + value.clear(); + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("SELECT value FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error getting value:" << query.lastError().text(); + return 1; + } + if (!query.next()) + { + qDebug() << "Error getting value:" << query.lastError().text(); + return 2; + } + value = query.value(0).toString(); + return 0; +} + +int DBRedis::deleteData(const QString & key) +{ + int res = deleteExpiredEntries(); + if (res) + { + return res; + } + + QSqlQuery query(m_DataBase); + query.prepare("DELETE FROM data_store WHERE key = :key"); + query.bindValue(":key", key); + if (!query.exec()) + { + qDebug() << "Error deleting value:" << query.lastError().text(); + return 1; + } + return 0; +} + +int DBRedis::init() +{ + if (m_HasInit) + { + return 0; + } + m_DataBase = QSqlDatabase::addDatabase("QSQLITE", m_ConnectName); +// m_DataBase.setDatabaseName("dbredis.db"); + m_DataBase.setDatabaseName("/home/plg/conf/sysPara.db"); + if (m_DataBase.open()) + { + QString table = "CREATE TABLE IF NOT EXISTS data_store(key TEXT, value TEXT, expiry INTEGER)"; + QSqlQuery query(QSqlDatabase::database(m_ConnectName)); + if (!query.exec(table.toUtf8())) + { + qDebug() << "Error deleting value:" << query.lastError().text(); + return 1; + } + } + else + { + qDebug() << "Error db open fail"; + return 3; + } + m_HasInit = true; + return 0; +} diff --git a/dbredis.h b/dbredis.h index 6a7c89a..4fc50bc 100644 --- a/dbredis.h +++ b/dbredis.h @@ -1,80 +1,80 @@ -#ifndef __DBREDIS_H -#define __DBREDIS_H - -#include - - -class DBRedis -{ -public: - DBRedis(); - ~DBRedis(); - /*** - * @描述 : 设定值 - * @入参 : key 键 - value 值 - expiry 单位为秒 默认为 0 - 0 为永不过期 - 其他值必须大于0 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int setData(const QString&key, const QString&value, uint32_t expiry = 0); - - - - /*** - * @描述 : 获取值 - * @入参 : key 键 - * @输出 : value 值 - * @返回 : 0 成功 - 1 数据库错误 - 2 不存在该数据或已过期 - 3 数据库错误 - */ - static int getData(const QString&key, QString&value); - - - /*** - * @描述 : 删除值 - * @入参 : key 键 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int deleteData(const QString&key); -private: - static QSqlDatabase m_DataBase; - static QString m_ConnectName; - static bool m_HasInit; -private: - /*** - * @描述 : 初始化 - * @入参 : 无 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int init(); - - - /*** - * @描述 : 删除过期的条目 - * @入参 : 无 - * @输出 : 无 - * @返回 : 0 成功 - 1 数据库错误 - 3 数据库错误 - */ - static int deleteExpiredEntries(); -}; - - - -#endif // !__DBREDIS_H - - +#ifndef __DBREDIS_H +#define __DBREDIS_H + +#include + + +class DBRedis +{ +public: + DBRedis(); + ~DBRedis(); + /*** + * @描述 : 设定值 + * @入参 : key 键 + value 值 + expiry 单位为秒 默认为 0 + 0 为永不过期 + 其他值必须大于0 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int setData(const QString&key, const QString&value, uint32_t expiry = 0); + + + + /*** + * @描述 : 获取值 + * @入参 : key 键 + * @输出 : value 值 + * @返回 : 0 成功 + 1 数据库错误 + 2 不存在该数据或已过期 + 3 数据库错误 + */ + static int getData(const QString&key, QString&value); + + + /*** + * @描述 : 删除值 + * @入参 : key 键 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int deleteData(const QString&key); +private: + static QSqlDatabase m_DataBase; + static QString m_ConnectName; + static bool m_HasInit; +private: + /*** + * @描述 : 初始化 + * @入参 : 无 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int init(); + + + /*** + * @描述 : 删除过期的条目 + * @入参 : 无 + * @输出 : 无 + * @返回 : 0 成功 + 1 数据库错误 + 3 数据库错误 + */ + static int deleteExpiredEntries(); +}; + + + +#endif // !__DBREDIS_H + + diff --git a/description b/description index 498b267..893e5ca 100644 --- a/description +++ b/description @@ -1 +1 @@ -Unnamed repository; edit this file 'description' to name the repository. +Unnamed repository; edit this file 'description' to name the repository. diff --git a/dialogAuthorizationPrint.ui b/dialogAuthorizationPrint.ui index 79e9c1b..7e92830 100644 --- a/dialogAuthorizationPrint.ui +++ b/dialogAuthorizationPrint.ui @@ -1,93 +1,93 @@ - - - DialogAuthorizationPrint - - - - 0 - 0 - 445 - 123 - - - - Qt::StrongFocus - - - Dialog - - - - - 210 - 80 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 20 - 421 - 51 - - - - - - - 打印密码: - - - - - - - - - - - - - buttonBox - accepted() - DialogAuthorizationPrint - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogAuthorizationPrint - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogAuthorizationPrint + + + + 0 + 0 + 445 + 123 + + + + Qt::StrongFocus + + + Dialog + + + + + 210 + 80 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 20 + 421 + 51 + + + + + + + 打印密码: + + + + + + + + + + + + + buttonBox + accepted() + DialogAuthorizationPrint + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogAuthorizationPrint + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogauthorization.ui b/dialogauthorization.ui index 78e6bf1..1ec55d9 100644 --- a/dialogauthorization.ui +++ b/dialogauthorization.ui @@ -1,93 +1,93 @@ - - - DialogAuthorization - - - - 0 - 0 - 445 - 123 - - - - Qt::StrongFocus - - - Dialog - - - - - 210 - 80 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 20 - 421 - 51 - - - - - - - 授权密码: - - - - - - - - - - - - - buttonBox - accepted() - DialogAuthorization - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogAuthorization - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogAuthorization + + + + 0 + 0 + 445 + 123 + + + + Qt::StrongFocus + + + Dialog + + + + + 210 + 80 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 20 + 421 + 51 + + + + + + + 授权密码: + + + + + + + + + + + + + buttonBox + accepted() + DialogAuthorization + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogAuthorization + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogcycleprint.cpp b/dialogcycleprint.cpp index 8628feb..40fcd1e 100644 --- a/dialogcycleprint.cpp +++ b/dialogcycleprint.cpp @@ -1,163 +1,163 @@ -#include "dialogcycleprint.h" -#include "ui_dialogcycleprint.h" -#include - -DialogCycleprint::DialogCycleprint(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogCycleprint) -{ - ui->setupUi(this); -} - -DialogCycleprint::~DialogCycleprint() -{ - delete ui; -} - - -void DialogCycleprint::getSpinboxValue(CycleprintArg &t_arg) -{ - t_arg.area_end1 = ui->spinBoxarea1->value(); - t_arg.area_end2 = ui->spinBoxarea2->value(); - t_arg.area_end3 = ui->spinBoxarea3->value(); - t_arg.area_end4 = ui->spinBoxarea4->value(); - t_arg.area_end5 = ui->spinBoxarea5->value(); - t_arg.area_end6 = ui->spinBoxarea6->value(); - - t_arg.cycle_time1 = ui->spinBoxcycletime1->value(); - t_arg.cycle_time2 = ui->spinBoxcycletime2->value(); - t_arg.cycle_time3 = ui->spinBoxcycletime3->value(); - t_arg.cycle_time4 = ui->spinBoxcycletime4->value(); - t_arg.cycle_time5 = ui->spinBoxcycletime5->value(); - t_arg.cycle_time6 = ui->spinBoxcycletime6->value(); -} - -void DialogCycleprint::SetSpinboxValue(CycleprintArg &t_arg) -{ - ui->spinBoxarea1->setValue(t_arg.area_end1); - ui->spinBoxarea2->setValue(t_arg.area_end2); - ui->spinBoxarea3->setValue(t_arg.area_end3); - ui->spinBoxarea4->setValue(t_arg.area_end4); - ui->spinBoxarea5->setValue(t_arg.area_end5); - ui->spinBoxarea6->setValue(t_arg.area_end6); - - ui->spinBoxcycletime1->setValue(t_arg.cycle_time1); - ui->spinBoxcycletime2->setValue(t_arg.cycle_time2); - ui->spinBoxcycletime3->setValue(t_arg.cycle_time3); - ui->spinBoxcycletime4->setValue(t_arg.cycle_time4); - ui->spinBoxcycletime5->setValue(t_arg.cycle_time5); - ui->spinBoxcycletime6->setValue(t_arg.cycle_time6); - -} - -void DialogCycleprint::update_save() -{ - save_arg.area_end3 = ui->spinBoxarea3->value(); - save_arg.cycle_time3 = ui->spinBoxcycletime3->value(); - save_arg.area_end4 = ui->spinBoxarea4->value(); - save_arg.cycle_time4 = ui->spinBoxcycletime4->value(); - save_arg.area_end5 = ui->spinBoxarea5->value(); - save_arg.cycle_time5 = ui->spinBoxcycletime5->value(); - save_arg.area_end6 = ui->spinBoxarea6->value(); - save_arg.cycle_time6 = ui->spinBoxcycletime6->value(); - -} - -void DialogCycleprint::set_spinBox_value(int area, int cycletime, int which_box) -{ - switch (which_box) { - - case 6: - ui->spinBoxarea6->setValue(ui->spinBoxarea5->value()); - ui->spinBoxcycletime6->setValue(ui->spinBoxcycletime5->value()); - case 5: - ui->spinBoxarea5->setValue(ui->spinBoxarea4->value()); - ui->spinBoxcycletime5->setValue(ui->spinBoxcycletime4->value()); - case 4: - ui->spinBoxarea4->setValue(ui->spinBoxarea3->value()); - ui->spinBoxcycletime4->setValue(ui->spinBoxcycletime3->value()); - case 3: - ui->spinBoxarea3->setValue(ui->spinBoxarea2->value()); - ui->spinBoxcycletime3->setValue(ui->spinBoxcycletime2->value()); - break; - default: - break; - } - ui->spinBoxarea2->setValue(area); - ui->spinBoxcycletime2->setValue(cycletime); -} - -void DialogCycleprint::on_spinBoxarea3_editingFinished() -{ - if(ui->spinBoxarea3->value() != save_arg.area_end3) - { - set_spinBox_value(ui->spinBoxarea3->value(), ui->spinBoxcycletime3->value(), 3); - update_save(); - } -} -void DialogCycleprint::on_spinBoxcycletime3_editingFinished() -{ - if(ui->spinBoxcycletime3->value() != save_arg.cycle_time3) - { - set_spinBox_value(ui->spinBoxarea3->value(), ui->spinBoxcycletime3->value(), 3); - update_save(); - } -} - -void DialogCycleprint::on_spinBoxarea4_editingFinished() -{ - if(ui->spinBoxarea4->value() != save_arg.area_end4) - { - set_spinBox_value(ui->spinBoxarea4->value(), ui->spinBoxcycletime4->value(), 4); - update_save(); - } -} -void DialogCycleprint::on_spinBoxcycletime4_editingFinished() -{ - if(ui->spinBoxcycletime4->value() != save_arg.cycle_time4) - { - set_spinBox_value(ui->spinBoxarea4->value(), ui->spinBoxcycletime4->value(), 4); - update_save(); - } -} - - -void DialogCycleprint::on_spinBoxarea5_editingFinished() -{ - if(ui->spinBoxarea5->value() != save_arg.area_end5) - { - set_spinBox_value(ui->spinBoxarea5->value(), ui->spinBoxcycletime5->value(), 5); - update_save(); - } -} -void DialogCycleprint::on_spinBoxcycletime5_editingFinished() -{ - if(ui->spinBoxcycletime5->value() != save_arg.cycle_time5) - { - set_spinBox_value(ui->spinBoxarea5->value(), ui->spinBoxcycletime5->value(), 5); - update_save(); - } -} - - -void DialogCycleprint::on_spinBoxarea6_editingFinished() -{ - if(ui->spinBoxarea6->value() != save_arg.area_end6) - { - set_spinBox_value(ui->spinBoxarea6->value(), ui->spinBoxcycletime6->value(), 6); - update_save(); - } -} -void DialogCycleprint::on_spinBoxcycletime6_editingFinished() -{ - if(ui->spinBoxcycletime6->value() != save_arg.cycle_time6) - { - set_spinBox_value(ui->spinBoxarea6->value(), ui->spinBoxcycletime6->value(), 6); - update_save(); - } -} - - - - - +#include "dialogcycleprint.h" +#include "ui_dialogcycleprint.h" +#include + +DialogCycleprint::DialogCycleprint(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogCycleprint) +{ + ui->setupUi(this); +} + +DialogCycleprint::~DialogCycleprint() +{ + delete ui; +} + + +void DialogCycleprint::getSpinboxValue(CycleprintArg &t_arg) +{ + t_arg.area_end1 = ui->spinBoxarea1->value(); + t_arg.area_end2 = ui->spinBoxarea2->value(); + t_arg.area_end3 = ui->spinBoxarea3->value(); + t_arg.area_end4 = ui->spinBoxarea4->value(); + t_arg.area_end5 = ui->spinBoxarea5->value(); + t_arg.area_end6 = ui->spinBoxarea6->value(); + + t_arg.cycle_time1 = ui->spinBoxcycletime1->value(); + t_arg.cycle_time2 = ui->spinBoxcycletime2->value(); + t_arg.cycle_time3 = ui->spinBoxcycletime3->value(); + t_arg.cycle_time4 = ui->spinBoxcycletime4->value(); + t_arg.cycle_time5 = ui->spinBoxcycletime5->value(); + t_arg.cycle_time6 = ui->spinBoxcycletime6->value(); +} + +void DialogCycleprint::SetSpinboxValue(CycleprintArg &t_arg) +{ + ui->spinBoxarea1->setValue(t_arg.area_end1); + ui->spinBoxarea2->setValue(t_arg.area_end2); + ui->spinBoxarea3->setValue(t_arg.area_end3); + ui->spinBoxarea4->setValue(t_arg.area_end4); + ui->spinBoxarea5->setValue(t_arg.area_end5); + ui->spinBoxarea6->setValue(t_arg.area_end6); + + ui->spinBoxcycletime1->setValue(t_arg.cycle_time1); + ui->spinBoxcycletime2->setValue(t_arg.cycle_time2); + ui->spinBoxcycletime3->setValue(t_arg.cycle_time3); + ui->spinBoxcycletime4->setValue(t_arg.cycle_time4); + ui->spinBoxcycletime5->setValue(t_arg.cycle_time5); + ui->spinBoxcycletime6->setValue(t_arg.cycle_time6); + +} + +void DialogCycleprint::update_save() +{ + save_arg.area_end3 = ui->spinBoxarea3->value(); + save_arg.cycle_time3 = ui->spinBoxcycletime3->value(); + save_arg.area_end4 = ui->spinBoxarea4->value(); + save_arg.cycle_time4 = ui->spinBoxcycletime4->value(); + save_arg.area_end5 = ui->spinBoxarea5->value(); + save_arg.cycle_time5 = ui->spinBoxcycletime5->value(); + save_arg.area_end6 = ui->spinBoxarea6->value(); + save_arg.cycle_time6 = ui->spinBoxcycletime6->value(); + +} + +void DialogCycleprint::set_spinBox_value(int area, int cycletime, int which_box) +{ + switch (which_box) { + + case 6: + ui->spinBoxarea6->setValue(ui->spinBoxarea5->value()); + ui->spinBoxcycletime6->setValue(ui->spinBoxcycletime5->value()); + case 5: + ui->spinBoxarea5->setValue(ui->spinBoxarea4->value()); + ui->spinBoxcycletime5->setValue(ui->spinBoxcycletime4->value()); + case 4: + ui->spinBoxarea4->setValue(ui->spinBoxarea3->value()); + ui->spinBoxcycletime4->setValue(ui->spinBoxcycletime3->value()); + case 3: + ui->spinBoxarea3->setValue(ui->spinBoxarea2->value()); + ui->spinBoxcycletime3->setValue(ui->spinBoxcycletime2->value()); + break; + default: + break; + } + ui->spinBoxarea2->setValue(area); + ui->spinBoxcycletime2->setValue(cycletime); +} + +void DialogCycleprint::on_spinBoxarea3_editingFinished() +{ + if(ui->spinBoxarea3->value() != save_arg.area_end3) + { + set_spinBox_value(ui->spinBoxarea3->value(), ui->spinBoxcycletime3->value(), 3); + update_save(); + } +} +void DialogCycleprint::on_spinBoxcycletime3_editingFinished() +{ + if(ui->spinBoxcycletime3->value() != save_arg.cycle_time3) + { + set_spinBox_value(ui->spinBoxarea3->value(), ui->spinBoxcycletime3->value(), 3); + update_save(); + } +} + +void DialogCycleprint::on_spinBoxarea4_editingFinished() +{ + if(ui->spinBoxarea4->value() != save_arg.area_end4) + { + set_spinBox_value(ui->spinBoxarea4->value(), ui->spinBoxcycletime4->value(), 4); + update_save(); + } +} +void DialogCycleprint::on_spinBoxcycletime4_editingFinished() +{ + if(ui->spinBoxcycletime4->value() != save_arg.cycle_time4) + { + set_spinBox_value(ui->spinBoxarea4->value(), ui->spinBoxcycletime4->value(), 4); + update_save(); + } +} + + +void DialogCycleprint::on_spinBoxarea5_editingFinished() +{ + if(ui->spinBoxarea5->value() != save_arg.area_end5) + { + set_spinBox_value(ui->spinBoxarea5->value(), ui->spinBoxcycletime5->value(), 5); + update_save(); + } +} +void DialogCycleprint::on_spinBoxcycletime5_editingFinished() +{ + if(ui->spinBoxcycletime5->value() != save_arg.cycle_time5) + { + set_spinBox_value(ui->spinBoxarea5->value(), ui->spinBoxcycletime5->value(), 5); + update_save(); + } +} + + +void DialogCycleprint::on_spinBoxarea6_editingFinished() +{ + if(ui->spinBoxarea6->value() != save_arg.area_end6) + { + set_spinBox_value(ui->spinBoxarea6->value(), ui->spinBoxcycletime6->value(), 6); + update_save(); + } +} +void DialogCycleprint::on_spinBoxcycletime6_editingFinished() +{ + if(ui->spinBoxcycletime6->value() != save_arg.cycle_time6) + { + set_spinBox_value(ui->spinBoxarea6->value(), ui->spinBoxcycletime6->value(), 6); + update_save(); + } +} + + + + + diff --git a/dialogcycleprint.h b/dialogcycleprint.h index ba94cfc..096a432 100644 --- a/dialogcycleprint.h +++ b/dialogcycleprint.h @@ -1,64 +1,64 @@ -#ifndef DIALOGCYCLEPRINT_H -#define DIALOGCYCLEPRINT_H - -#include - -typedef struct { - int area_end1; - int area_end2; - int area_end3; - int area_end4; - int area_end5; - int area_end6; - - int cycle_time1; - int cycle_time2; - int cycle_time3; - int cycle_time4; - int cycle_time5; - int cycle_time6; - -}CycleprintArg; - - -namespace Ui { -class DialogCycleprint; -} - -class DialogCycleprint : public QDialog -{ - Q_OBJECT - -public: - explicit DialogCycleprint(QWidget *parent = 0); - - void getSpinboxValue(CycleprintArg &t_arg); - void SetSpinboxValue(CycleprintArg &t_arg); - void update_save(); - - ~DialogCycleprint(); - -private slots: - - void on_spinBoxarea3_editingFinished(); - void on_spinBoxcycletime3_editingFinished(); - - void on_spinBoxarea4_editingFinished(); - void on_spinBoxcycletime4_editingFinished(); - - void on_spinBoxarea5_editingFinished(); - void on_spinBoxcycletime5_editingFinished(); - - void on_spinBoxarea6_editingFinished(); - void on_spinBoxcycletime6_editingFinished(); - -private: - - void set_spinBox_value(int area, int cycletime, int which_box); - - CycleprintArg save_arg; - - Ui::DialogCycleprint *ui; -}; - -#endif // DIALOGCYCLEPRINT_H +#ifndef DIALOGCYCLEPRINT_H +#define DIALOGCYCLEPRINT_H + +#include + +typedef struct { + int area_end1; + int area_end2; + int area_end3; + int area_end4; + int area_end5; + int area_end6; + + int cycle_time1; + int cycle_time2; + int cycle_time3; + int cycle_time4; + int cycle_time5; + int cycle_time6; + +}CycleprintArg; + + +namespace Ui { +class DialogCycleprint; +} + +class DialogCycleprint : public QDialog +{ + Q_OBJECT + +public: + explicit DialogCycleprint(QWidget *parent = 0); + + void getSpinboxValue(CycleprintArg &t_arg); + void SetSpinboxValue(CycleprintArg &t_arg); + void update_save(); + + ~DialogCycleprint(); + +private slots: + + void on_spinBoxarea3_editingFinished(); + void on_spinBoxcycletime3_editingFinished(); + + void on_spinBoxarea4_editingFinished(); + void on_spinBoxcycletime4_editingFinished(); + + void on_spinBoxarea5_editingFinished(); + void on_spinBoxcycletime5_editingFinished(); + + void on_spinBoxarea6_editingFinished(); + void on_spinBoxcycletime6_editingFinished(); + +private: + + void set_spinBox_value(int area, int cycletime, int which_box); + + CycleprintArg save_arg; + + Ui::DialogCycleprint *ui; +}; + +#endif // DIALOGCYCLEPRINT_H diff --git a/dialogcycleprint.ui b/dialogcycleprint.ui index 27700b4..cc590e2 100644 --- a/dialogcycleprint.ui +++ b/dialogcycleprint.ui @@ -1,416 +1,416 @@ - - - DialogCycleprint - - - - 0 - 0 - 459 - 237 - - - - Dialog - - - - - 100 - 190 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 90 - 10 - 48 - 31 - - - - 999 - - - 80 - - - - - - 10 - 20 - 71 - 16 - - - - 1循环范围:0- - - - - - - 10 - 50 - 71 - 16 - - - - 1循环次数: - - - - - - 90 - 50 - 48 - 31 - - - - 999 - - - 3 - - - - - - 240 - 50 - 48 - 31 - - - - 999 - - - 3 - - - - - - 240 - 10 - 48 - 31 - - - - 999 - - - 80 - - - - - - 160 - 20 - 71 - 16 - - - - 2循环范围:0- - - - - - - 160 - 50 - 71 - 16 - - - - 2循环次数: - - - - - - 390 - 10 - 48 - 31 - - - - 999 - - - 80 - - - - - - 390 - 50 - 48 - 31 - - - - 999 - - - 3 - - - - - - 310 - 20 - 71 - 16 - - - - 3循环范围:0- - - - - - - 310 - 50 - 71 - 16 - - - - 3循环次数: - - - - - - 240 - 100 - 48 - 31 - - - - 999 - - - 80 - - - - - - 310 - 140 - 71 - 16 - - - - 6循环次数: - - - - - - 240 - 140 - 48 - 31 - - - - 999 - - - 3 - - - - - - 390 - 140 - 48 - 31 - - - - 999 - - - 3 - - - - - - 390 - 100 - 48 - 31 - - - - 999 - - - 80 - - - - - - 310 - 110 - 71 - 16 - - - - 6循环范围:0- - - - - - - 90 - 140 - 48 - 31 - - - - 999 - - - 3 - - - - - - 160 - 110 - 71 - 16 - - - - 5循环范围:0- - - - - - - 160 - 140 - 71 - 16 - - - - 5循环次数: - - - - - - 90 - 100 - 48 - 31 - - - - 999 - - - 80 - - - - - - 10 - 110 - 71 - 16 - - - - 4循环范围:0- - - - - - - 10 - 140 - 71 - 16 - - - - 4循环次数: - - - - - - - buttonBox - accepted() - DialogCycleprint - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogCycleprint - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogCycleprint + + + + 0 + 0 + 459 + 237 + + + + Dialog + + + + + 100 + 190 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 90 + 10 + 48 + 31 + + + + 999 + + + 80 + + + + + + 10 + 20 + 71 + 16 + + + + 1循环范围:0- + + + + + + 10 + 50 + 71 + 16 + + + + 1循环次数: + + + + + + 90 + 50 + 48 + 31 + + + + 999 + + + 3 + + + + + + 240 + 50 + 48 + 31 + + + + 999 + + + 3 + + + + + + 240 + 10 + 48 + 31 + + + + 999 + + + 80 + + + + + + 160 + 20 + 71 + 16 + + + + 2循环范围:0- + + + + + + 160 + 50 + 71 + 16 + + + + 2循环次数: + + + + + + 390 + 10 + 48 + 31 + + + + 999 + + + 80 + + + + + + 390 + 50 + 48 + 31 + + + + 999 + + + 3 + + + + + + 310 + 20 + 71 + 16 + + + + 3循环范围:0- + + + + + + 310 + 50 + 71 + 16 + + + + 3循环次数: + + + + + + 240 + 100 + 48 + 31 + + + + 999 + + + 80 + + + + + + 310 + 140 + 71 + 16 + + + + 6循环次数: + + + + + + 240 + 140 + 48 + 31 + + + + 999 + + + 3 + + + + + + 390 + 140 + 48 + 31 + + + + 999 + + + 3 + + + + + + 390 + 100 + 48 + 31 + + + + 999 + + + 80 + + + + + + 310 + 110 + 71 + 16 + + + + 6循环范围:0- + + + + + + 90 + 140 + 48 + 31 + + + + 999 + + + 3 + + + + + + 160 + 110 + 71 + 16 + + + + 5循环范围:0- + + + + + + 160 + 140 + 71 + 16 + + + + 5循环次数: + + + + + + 90 + 100 + 48 + 31 + + + + 999 + + + 80 + + + + + + 10 + 110 + 71 + 16 + + + + 4循环范围:0- + + + + + + 10 + 140 + 71 + 16 + + + + 4循环次数: + + + + + + + buttonBox + accepted() + DialogCycleprint + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogCycleprint + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogfileoperation.ui b/dialogfileoperation.ui index 92d5168..98e620c 100644 --- a/dialogfileoperation.ui +++ b/dialogfileoperation.ui @@ -1,350 +1,350 @@ - - - DialogFileOperation - - - - 0 - 0 - 757 - 314 - - - - Qt::StrongFocus - - - Dialog - - - - - 10 - 10 - 748 - 291 - - - - - 2 - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 100 - 16777215 - - - - - - - - 2 - - - - - 1 - - - 1 - - - - - Qt::LeftToRight - - - 本地文件 - - - - :/icon/localdisk.png:/icon/localdisk.png - - - true - - - - - - - Qt::LeftToRight - - - U盘文件 - - - - :/icon/udisk.png:/icon/udisk.png - - - - - - - - - 2 - - - - - - 0 - 37 - - - - - 0 - 37 - - - - 删除文件 - - - - :/icon/keydelete.png:/icon/keydelete.png - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 删除全部 - - - - :/icon/filedelete.png:/icon/filedelete.png - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 从U盘导入 - - - - :/icon/import.png:/icon/import.png - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 导出到U盘 - - - - :/icon/export.png:/icon/export.png - - - - - - - - - true - - - false - - - - - - - 0 - - - - - - 0 - 0 - - - - - 0 - 37 - - - - - 90 - 16777215 - - - - 插入 - - - - :/icon/insert.png:/icon/insert.png - - - - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - 打开文件 - - - - :/icon/fileoperation.png:/icon/fileoperation.png - - - - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - 上一个 - - - - :/icon/lastpage.png:/icon/lastpage.png - - - - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - 下一个 - - - - :/icon/nextpage.png:/icon/nextpage.png - - - - - - - - 0 - 0 - - - - - 90 - 16777215 - - - - 退出 - - - - :/icon/exit.png:/icon/exit.png - - - - - - - - - - - - - - - - - + + + DialogFileOperation + + + + 0 + 0 + 757 + 314 + + + + Qt::StrongFocus + + + Dialog + + + + + 10 + 10 + 748 + 291 + + + + + 2 + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 100 + 16777215 + + + + + + + + 2 + + + + + 1 + + + 1 + + + + + Qt::LeftToRight + + + 本地文件 + + + + :/icon/localdisk.png:/icon/localdisk.png + + + true + + + + + + + Qt::LeftToRight + + + U盘文件 + + + + :/icon/udisk.png:/icon/udisk.png + + + + + + + + + 2 + + + + + + 0 + 37 + + + + + 0 + 37 + + + + 删除文件 + + + + :/icon/keydelete.png:/icon/keydelete.png + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 删除全部 + + + + :/icon/filedelete.png:/icon/filedelete.png + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 从U盘导入 + + + + :/icon/import.png:/icon/import.png + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 导出到U盘 + + + + :/icon/export.png:/icon/export.png + + + + + + + + + true + + + false + + + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 37 + + + + + 90 + 16777215 + + + + 插入 + + + + :/icon/insert.png:/icon/insert.png + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + 打开文件 + + + + :/icon/fileoperation.png:/icon/fileoperation.png + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + 上一个 + + + + :/icon/lastpage.png:/icon/lastpage.png + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + 下一个 + + + + :/icon/nextpage.png:/icon/nextpage.png + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + 退出 + + + + :/icon/exit.png:/icon/exit.png + + + + + + + + + + + + + + + + + diff --git a/dialogfontsize.ui b/dialogfontsize.ui index db3f018..5b4dd04 100644 --- a/dialogfontsize.ui +++ b/dialogfontsize.ui @@ -1,283 +1,283 @@ - - - DialogFontSize - - - - 0 - 0 - 428 - 344 - - - - Qt::StrongFocus - - - Dialog - - - - - 110 - 290 - 291 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 17 - 10 - 401 - 154 - - - - - 12 - - - - - 21点(rf21) - - - - - - - 16点(中/英) - - - - - - - 7点(英) - - - - - - - 5点(英) - - - - - - - 12点(中/英) - - - - - - - 9点(中/英) - - - true - - - - - - - 24点(中/英) - - - - - - - true - - - - 0 - 0 - - - - 7点(孟加拉) - - - - - - - 32点 - - - - - - - 7点(rf7) - - - - - - - 12点(新罗马) - - - - - - - - true - - - - 40 - 230 - 321 - 31 - - - - 123456890ABCDEFGWXYZ - - - Qt::AlignCenter - - - true - - - - - - 70 - 270 - 311 - 20 - - - - - - - - - - - 30 - 300 - 89 - 25 - - - - 查字库标识 - - - - - - 20 - 169 - 261 - 41 - - - - - - - - 123 - 123 - - - - - 11 - 50 - false - - - - 左横 - - - - - - - - 0 - 0 - - - - - 178 - 16777215 - - - - - Ubuntu - 11 - 50 - false - false - - - - 右横 - - - - - - - - - - buttonBox - accepted() - DialogFontSize - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogFontSize - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogFontSize + + + + 0 + 0 + 428 + 344 + + + + Qt::StrongFocus + + + Dialog + + + + + 110 + 290 + 291 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 17 + 10 + 401 + 154 + + + + + 12 + + + + + 21点(rf21) + + + + + + + 16点(中/英) + + + + + + + 7点(英) + + + + + + + 5点(英) + + + + + + + 12点(中/英) + + + + + + + 9点(中/英) + + + true + + + + + + + 24点(中/英) + + + + + + + true + + + + 0 + 0 + + + + 7点(孟加拉) + + + + + + + 32点 + + + + + + + 7点(rf7) + + + + + + + 12点(新罗马) + + + + + + + + true + + + + 40 + 230 + 321 + 31 + + + + 123456890ABCDEFGWXYZ + + + Qt::AlignCenter + + + true + + + + + + 70 + 270 + 311 + 20 + + + + - + + + + + + 30 + 300 + 89 + 25 + + + + 查字库标识 + + + + + + 20 + 169 + 261 + 41 + + + + + + + + 123 + 123 + + + + + 11 + 50 + false + + + + 左横 + + + + + + + + 0 + 0 + + + + + 178 + 16777215 + + + + + Ubuntu + 11 + 50 + false + false + + + + 右横 + + + + + + + + + + buttonBox + accepted() + DialogFontSize + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogFontSize + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialoginputpasswd.ui b/dialoginputpasswd.ui index 8fc2e98..2f5ea44 100644 --- a/dialoginputpasswd.ui +++ b/dialoginputpasswd.ui @@ -1,91 +1,91 @@ - - - Dialoginputpasswd - - - - 0 - 0 - 384 - 112 - - - - Dialog - - - - - 30 - 70 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 20 - 20 - 62 - 49 - - - - 修改密码: - - - - - - 90 - 30 - 241 - 27 - - - - - - - - buttonBox - accepted() - Dialoginputpasswd - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialoginputpasswd - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + Dialoginputpasswd + + + + 0 + 0 + 384 + 112 + + + + Dialog + + + + + 30 + 70 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 20 + 62 + 49 + + + + 修改密码: + + + + + + 90 + 30 + 241 + 27 + + + + + + + + buttonBox + accepted() + Dialoginputpasswd + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialoginputpasswd + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialoginsertvari.ui b/dialoginsertvari.ui index 65edd76..ce9da3a 100644 --- a/dialoginsertvari.ui +++ b/dialoginsertvari.ui @@ -1,612 +1,612 @@ - - - DialogInsertVari - - - - 0 - 0 - 516 - 395 - - - - Qt::StrongFocus - - - Dialog - - - - 6 - - - - - - 0 - 0 - - - - 变量类型 - - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - 0 - 30 - - - - 生产日期 - - - - - - - - 0 - 30 - - - - 年 - - - - - - - - 0 - 30 - - - - 计数器1 - - - true - - - - - - - - 0 - 28 - - - - 计数器2 - - - - - - - - 0 - 30 - - - - 时 - - - - - - - - 0 - 28 - - - - 周 - - - - - - - - 0 - 28 - - - - 随机码1 - - - - - - - - 0 - 28 - - - - 月 - - - - - - - - 0 - 28 - - - - DataMatrix - - - - - - - - 0 - 28 - - - - QRCode - - - - - - - - 0 - 28 - - - - 有效日期 - - - - - - - - 0 - 28 - - - - Class - - - - - - - - 0 - 28 - - - - 秒 - - - - - - - - 0 - 28 - - - - 日 - - - - - - - - 0 - 28 - - - - 分 - - - - - - - - 0 - 28 - - - - BarCode128 - - - - - - - - 0 - 30 - - - - 计数器3 - - - - - - - 第XXX天 - - - - - - - 隐藏变量 - - - - - - - - - - - - - 0 - 0 - - - - 数字个数 - - - - 0 - - - 9 - - - 0 - - - - - 0 - - - 0 - - - - - - 0 - 30 - - - - 9个 - - - - - - - - 0 - 30 - - - - 11个 - - - - - - - - 0 - 30 - - - - 10个 - - - - - - - - 0 - 30 - - - - 2个 - - - - - - - - 0 - 30 - - - - 1个 - - - - - - - - 0 - 30 - - - - 3个 - - - - - - - - 0 - 30 - - - - 4个 - - - true - - - - - - - - 0 - 30 - - - - 5个 - - - - - - - - 0 - 30 - - - - 6个 - - - - - - - - 0 - 30 - - - - 7个 - - - - - - - - 0 - 30 - - - - 8个 - - - - - - - - 0 - 30 - - - - 12个 - - - - - - - - 0 - 30 - - - - 13个 - - - - - - - - 0 - 30 - - - - 14个 - - - - - - - - 0 - 30 - - - - 15个 - - - - - - - - - - :/80/image/expiryDate8.bmp - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - buttonBox - accepted() - DialogInsertVari - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogInsertVari - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogInsertVari + + + + 0 + 0 + 516 + 395 + + + + Qt::StrongFocus + + + Dialog + + + + 6 + + + + + + 0 + 0 + + + + 变量类型 + + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + + 0 + 30 + + + + 生产日期 + + + + + + + + 0 + 30 + + + + 年 + + + + + + + + 0 + 30 + + + + 计数器1 + + + true + + + + + + + + 0 + 28 + + + + 计数器2 + + + + + + + + 0 + 30 + + + + 时 + + + + + + + + 0 + 28 + + + + 周 + + + + + + + + 0 + 28 + + + + 随机码1 + + + + + + + + 0 + 28 + + + + 月 + + + + + + + + 0 + 28 + + + + DataMatrix + + + + + + + + 0 + 28 + + + + QRCode + + + + + + + + 0 + 28 + + + + 有效日期 + + + + + + + + 0 + 28 + + + + Class + + + + + + + + 0 + 28 + + + + 秒 + + + + + + + + 0 + 28 + + + + 日 + + + + + + + + 0 + 28 + + + + 分 + + + + + + + + 0 + 28 + + + + BarCode128 + + + + + + + + 0 + 30 + + + + 计数器3 + + + + + + + 第XXX天 + + + + + + + 隐藏变量 + + + + + + + + + + + + + 0 + 0 + + + + 数字个数 + + + + 0 + + + 9 + + + 0 + + + + + 0 + + + 0 + + + + + + 0 + 30 + + + + 9个 + + + + + + + + 0 + 30 + + + + 11个 + + + + + + + + 0 + 30 + + + + 10个 + + + + + + + + 0 + 30 + + + + 2个 + + + + + + + + 0 + 30 + + + + 1个 + + + + + + + + 0 + 30 + + + + 3个 + + + + + + + + 0 + 30 + + + + 4个 + + + true + + + + + + + + 0 + 30 + + + + 5个 + + + + + + + + 0 + 30 + + + + 6个 + + + + + + + + 0 + 30 + + + + 7个 + + + + + + + + 0 + 30 + + + + 8个 + + + + + + + + 0 + 30 + + + + 12个 + + + + + + + + 0 + 30 + + + + 13个 + + + + + + + + 0 + 30 + + + + 14个 + + + + + + + + 0 + 30 + + + + 15个 + + + + + + + + + + :/80/image/expiryDate8.bmp + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + + + buttonBox + accepted() + DialogInsertVari + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogInsertVari + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialoglinespace.ui b/dialoglinespace.ui index 4f7fec0..d9c8626 100644 --- a/dialoglinespace.ui +++ b/dialoglinespace.ui @@ -1,222 +1,222 @@ - - - DialogLineSpace - - - - 0 - 0 - 385 - 303 - - - - Dialog - - - - - 150 - 260 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 30 - 361 - 121 - - - - - - - 0个像素 - - - - - - - 1个像素 - - - - - - - 2个像素 - - - - - - - 3个像素 - - - - - - - 4个像素 - - - true - - - - - - - 5个像素 - - - - - - - 6个像素 - - - - - - - 7个像素 - - - - - - - - - 10 - 10 - 81 - 17 - - - - 行间距: - - - - - - 10 - 160 - 91 - 17 - - - - 字符间距: - - - - - - 10 - 180 - 361 - 89 - - - - - - - 0个像素 - - - true - - - - - - - 3个像素 - - - - - - - 2个像素 - - - - - - - 1个像素 - - - - - - - 4个像素 - - - - - - - 5个像素 - - - - - - - - - - buttonBox - accepted() - DialogLineSpace - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogLineSpace - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogLineSpace + + + + 0 + 0 + 385 + 303 + + + + Dialog + + + + + 150 + 260 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 30 + 361 + 121 + + + + + + + 0个像素 + + + + + + + 1个像素 + + + + + + + 2个像素 + + + + + + + 3个像素 + + + + + + + 4个像素 + + + true + + + + + + + 5个像素 + + + + + + + 6个像素 + + + + + + + 7个像素 + + + + + + + + + 10 + 10 + 81 + 17 + + + + 行间距: + + + + + + 10 + 160 + 91 + 17 + + + + 字符间距: + + + + + + 10 + 180 + 361 + 89 + + + + + + + 0个像素 + + + true + + + + + + + 3个像素 + + + + + + + 2个像素 + + + + + + + 1个像素 + + + + + + + 4个像素 + + + + + + + 5个像素 + + + + + + + + + + buttonBox + accepted() + DialogLineSpace + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogLineSpace + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogmodifypasswd.cpp b/dialogmodifypasswd.cpp index 4a1c18b..6c6b4f4 100644 --- a/dialogmodifypasswd.cpp +++ b/dialogmodifypasswd.cpp @@ -1,26 +1,26 @@ -#include "dialogmodifypasswd.h" -#include "ui_dialogmodifypasswd.h" - -Dialogmodifypasswd::Dialogmodifypasswd(QWidget *parent) : - QDialog(parent), - ui(new Ui::Dialogmodifypasswd) -{ - ui->setupUi(this); - this->setWindowTitle(tr("密码授权")); - this->setFixedSize(this->geometry().width(),this->geometry().height()); - ui->lineEdit->setEchoMode(QLineEdit::Password); // 密码不回显 -} - -Dialogmodifypasswd::~Dialogmodifypasswd() -{ - delete ui; -} - -QString Dialogmodifypasswd::getModPasswd(){ - return ui->lineEdit->text(); -} - -void Dialogmodifypasswd::clearAuth(){ - ui->lineEdit->setText(tr("")); - -} +#include "dialogmodifypasswd.h" +#include "ui_dialogmodifypasswd.h" + +Dialogmodifypasswd::Dialogmodifypasswd(QWidget *parent) : + QDialog(parent), + ui(new Ui::Dialogmodifypasswd) +{ + ui->setupUi(this); + this->setWindowTitle(tr("密码授权")); + this->setFixedSize(this->geometry().width(),this->geometry().height()); + ui->lineEdit->setEchoMode(QLineEdit::Password); // 密码不回显 +} + +Dialogmodifypasswd::~Dialogmodifypasswd() +{ + delete ui; +} + +QString Dialogmodifypasswd::getModPasswd(){ + return ui->lineEdit->text(); +} + +void Dialogmodifypasswd::clearAuth(){ + ui->lineEdit->setText(tr("")); + +} diff --git a/dialogmodifypasswd.h b/dialogmodifypasswd.h index 8621471..b788398 100644 --- a/dialogmodifypasswd.h +++ b/dialogmodifypasswd.h @@ -1,25 +1,25 @@ -#ifndef DIALOGMODIFYPASSWD_H -#define DIALOGMODIFYPASSWD_H - -#include - -namespace Ui { -class Dialogmodifypasswd; -} - -class Dialogmodifypasswd : public QDialog -{ - Q_OBJECT - -public: - - explicit Dialogmodifypasswd(QWidget *parent = 0); - ~Dialogmodifypasswd(); - - QString getModPasswd(); - void clearAuth(); -private: - Ui::Dialogmodifypasswd *ui; -}; - -#endif // DIALOGMODIFYPASSWD_H +#ifndef DIALOGMODIFYPASSWD_H +#define DIALOGMODIFYPASSWD_H + +#include + +namespace Ui { +class Dialogmodifypasswd; +} + +class Dialogmodifypasswd : public QDialog +{ + Q_OBJECT + +public: + + explicit Dialogmodifypasswd(QWidget *parent = 0); + ~Dialogmodifypasswd(); + + QString getModPasswd(); + void clearAuth(); +private: + Ui::Dialogmodifypasswd *ui; +}; + +#endif // DIALOGMODIFYPASSWD_H diff --git a/dialogmodifypasswd.ui b/dialogmodifypasswd.ui index a794616..4ee9602 100644 --- a/dialogmodifypasswd.ui +++ b/dialogmodifypasswd.ui @@ -1,91 +1,91 @@ - - - Dialogmodifypasswd - - - - 0 - 0 - 426 - 102 - - - - Dialog - - - - - 50 - 60 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 20 - 10 - 62 - 49 - - - - 修改密码: - - - - - - 90 - 20 - 281 - 27 - - - - - - - - buttonBox - accepted() - Dialogmodifypasswd - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialogmodifypasswd - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + Dialogmodifypasswd + + + + 0 + 0 + 426 + 102 + + + + Dialog + + + + + 50 + 60 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 10 + 62 + 49 + + + + 修改密码: + + + + + + 90 + 20 + 281 + 27 + + + + + + + + buttonBox + accepted() + Dialogmodifypasswd + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialogmodifypasswd + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogmoduleseletion.cpp b/dialogmoduleseletion.cpp index d183414..f8a608f 100644 --- a/dialogmoduleseletion.cpp +++ b/dialogmoduleseletion.cpp @@ -1,53 +1,53 @@ -#include "dialogmoduleseletion.h" -#include "ui_dialogmoduleseletion.h" - -DialogModuleSeletion::DialogModuleSeletion(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogModuleSeletion) -{ - ui->setupUi(this); - ui->checkBox_7->hide(); - ui->checkBox_8->hide(); - ui->checkBox_9->hide(); - ui->checkBox_10->hide(); -} - -DialogModuleSeletion::~DialogModuleSeletion() -{ - delete ui; -} - -int DialogModuleSeletion::getModuleType(){ - unsigned short type = 0x00; - if(ui->checkBox_1->isChecked()) type = 1; - if(ui->checkBox_2->isChecked()) type = type | 1<<1; - if(ui->checkBox_3->isChecked()) type = type | 1<<2; - if(ui->checkBox_4->isChecked()) type = type | 1<<3; - if(ui->checkBox_5->isChecked()) type = type | 1<<4; - if(ui->checkBox_6->isChecked()) type = type | 1<<5; - if(ui->checkBox_7->isChecked()) type = type | 1<<6; - if(ui->checkBox_8->isChecked()) type = type | 1<<7; - - return type; -} - -void DialogModuleSeletion::on_checkBox_1_clicked() -{ - ui->checkBox_2->setChecked(false); -} - -void DialogModuleSeletion::on_checkBox_2_clicked() -{ - ui->checkBox_1->setChecked(false); -} - -void DialogModuleSeletion::updateModuleTypeToUI(unsigned short type){ - ui->checkBox_1->setChecked(type & 1); - ui->checkBox_2->setChecked(type & 1<<1); - ui->checkBox_3->setChecked(type & 1<<2); - ui->checkBox_4->setChecked(type & 1<<3); - ui->checkBox_5->setChecked(type & 1<<4); - ui->checkBox_6->setChecked(type & 1<<5); - ui->checkBox_7->setChecked(type & 1<<6); - ui->checkBox_8->setChecked(type & 1<<7); -} +#include "dialogmoduleseletion.h" +#include "ui_dialogmoduleseletion.h" + +DialogModuleSeletion::DialogModuleSeletion(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogModuleSeletion) +{ + ui->setupUi(this); + ui->checkBox_7->hide(); + ui->checkBox_8->hide(); + ui->checkBox_9->hide(); + ui->checkBox_10->hide(); +} + +DialogModuleSeletion::~DialogModuleSeletion() +{ + delete ui; +} + +int DialogModuleSeletion::getModuleType(){ + unsigned short type = 0x00; + if(ui->checkBox_1->isChecked()) type = 1; + if(ui->checkBox_2->isChecked()) type = type | 1<<1; + if(ui->checkBox_3->isChecked()) type = type | 1<<2; + if(ui->checkBox_4->isChecked()) type = type | 1<<3; + if(ui->checkBox_5->isChecked()) type = type | 1<<4; + if(ui->checkBox_6->isChecked()) type = type | 1<<5; + if(ui->checkBox_7->isChecked()) type = type | 1<<6; + if(ui->checkBox_8->isChecked()) type = type | 1<<7; + + return type; +} + +void DialogModuleSeletion::on_checkBox_1_clicked() +{ + ui->checkBox_2->setChecked(false); +} + +void DialogModuleSeletion::on_checkBox_2_clicked() +{ + ui->checkBox_1->setChecked(false); +} + +void DialogModuleSeletion::updateModuleTypeToUI(unsigned short type){ + ui->checkBox_1->setChecked(type & 1); + ui->checkBox_2->setChecked(type & 1<<1); + ui->checkBox_3->setChecked(type & 1<<2); + ui->checkBox_4->setChecked(type & 1<<3); + ui->checkBox_5->setChecked(type & 1<<4); + ui->checkBox_6->setChecked(type & 1<<5); + ui->checkBox_7->setChecked(type & 1<<6); + ui->checkBox_8->setChecked(type & 1<<7); +} diff --git a/dialogmoduleseletion.h b/dialogmoduleseletion.h index f3eda04..4364e2f 100644 --- a/dialogmoduleseletion.h +++ b/dialogmoduleseletion.h @@ -1,31 +1,31 @@ -#ifndef DIALOGMODULESELETION_H -#define DIALOGMODULESELETION_H - -#include - -namespace Ui { -class DialogModuleSeletion; -} - -class DialogModuleSeletion : public QDialog -{ - Q_OBJECT - -public: - explicit DialogModuleSeletion(QWidget *parent = 0); - ~DialogModuleSeletion(); - int getModuleType(); - void updateModuleTypeToUI(unsigned short); - -private slots: - - - void on_checkBox_1_clicked(); - - void on_checkBox_2_clicked(); - -private: - Ui::DialogModuleSeletion *ui; -}; - -#endif // DIALOGMODULESELETION_H +#ifndef DIALOGMODULESELETION_H +#define DIALOGMODULESELETION_H + +#include + +namespace Ui { +class DialogModuleSeletion; +} + +class DialogModuleSeletion : public QDialog +{ + Q_OBJECT + +public: + explicit DialogModuleSeletion(QWidget *parent = 0); + ~DialogModuleSeletion(); + int getModuleType(); + void updateModuleTypeToUI(unsigned short); + +private slots: + + + void on_checkBox_1_clicked(); + + void on_checkBox_2_clicked(); + +private: + Ui::DialogModuleSeletion *ui; +}; + +#endif // DIALOGMODULESELETION_H diff --git a/dialogmoduleseletion.ui b/dialogmoduleseletion.ui index 992ebf9..ce8dd5e 100644 --- a/dialogmoduleseletion.ui +++ b/dialogmoduleseletion.ui @@ -1,150 +1,150 @@ - - - DialogModuleSeletion - - - - 0 - 0 - 470 - 344 - - - - Dialog - - - - - 70 - 290 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 40 - 30 - 381 - 241 - - - - - - - 小数点功能 - - - - - - - 隐藏功能 - - - - - - - 分段计米功能 - - - - - - - 跳米功能 - - - - - - - 持续加热 - - - - - - - 等差电压 - - - - - - - reserve - - - - - - - reserve - - - - - - - reserve - - - - - - - reserve - - - - - - - - - - buttonBox - accepted() - DialogModuleSeletion - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogModuleSeletion - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogModuleSeletion + + + + 0 + 0 + 470 + 344 + + + + Dialog + + + + + 70 + 290 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 40 + 30 + 381 + 241 + + + + + + + 小数点功能 + + + + + + + 隐藏功能 + + + + + + + 分段计米功能 + + + + + + + 跳米功能 + + + + + + + 持续加热 + + + + + + + 等差电压 + + + + + + + reserve + + + + + + + reserve + + + + + + + reserve + + + + + + + reserve + + + + + + + + + + buttonBox + accepted() + DialogModuleSeletion + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModuleSeletion + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dialogpointdistanceadjust.ui b/dialogpointdistanceadjust.ui index 0999316..3e07865 100644 --- a/dialogpointdistanceadjust.ui +++ b/dialogpointdistanceadjust.ui @@ -1,304 +1,304 @@ - - - DialogPointDistanceAdjust - - - - 0 - 0 - 555 - 194 - - - - Qt::StrongFocus - - - Dialog - - - - - 320 - 150 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 10 - 541 - 141 - - - - - 3 - - - 3 - - - - - - - 列首: - - - - - - - -99 - - - 3 - - - Qt::Horizontal - - - - - - - -99 - - - - - - - - - - - 列中: - - - - - - - -99 - - - 3 - - - Qt::Horizontal - - - - - - - -99 - - - - - - - - - - - 列尾: - - - - - - - -99 - - - 3 - - - Qt::Horizontal - - - - - - - -99 - - - - - - - - - - - 160 - 160 - 98 - 27 - - - - 重置 - - - - - - 30 - 160 - 98 - 27 - - - - 测试 - - - - - - - buttonBox - accepted() - DialogPointDistanceAdjust - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogPointDistanceAdjust - reject() - - - 316 - 260 - - - 286 - 274 - - - - - horizontalSliderLineHeadValue - valueChanged(int) - spinBoxLineHeadValue - setValue(int) - - - 266 - 33 - - - 518 - 33 - - - - - horizontalSliderLineCenterValue - valueChanged(int) - spinBoxLineCenterValue - setValue(int) - - - 266 - 80 - - - 518 - 80 - - - - - horizontalSliderLineEndValue - valueChanged(int) - spinBoxLineEndValue - setValue(int) - - - 266 - 127 - - - 518 - 127 - - - - - spinBoxLineHeadValue - valueChanged(int) - horizontalSliderLineHeadValue - setValue(int) - - - 518 - 33 - - - 266 - 33 - - - - - spinBoxLineCenterValue - valueChanged(int) - horizontalSliderLineCenterValue - setValue(int) - - - 518 - 80 - - - 266 - 80 - - - - - spinBoxLineEndValue - valueChanged(int) - horizontalSliderLineEndValue - setValue(int) - - - 518 - 127 - - - 266 - 127 - - - - - + + + DialogPointDistanceAdjust + + + + 0 + 0 + 555 + 194 + + + + Qt::StrongFocus + + + Dialog + + + + + 320 + 150 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 541 + 141 + + + + + 3 + + + 3 + + + + + + + 列首: + + + + + + + -99 + + + 3 + + + Qt::Horizontal + + + + + + + -99 + + + + + + + + + + + 列中: + + + + + + + -99 + + + 3 + + + Qt::Horizontal + + + + + + + -99 + + + + + + + + + + + 列尾: + + + + + + + -99 + + + 3 + + + Qt::Horizontal + + + + + + + -99 + + + + + + + + + + + 160 + 160 + 98 + 27 + + + + 重置 + + + + + + 30 + 160 + 98 + 27 + + + + 测试 + + + + + + + buttonBox + accepted() + DialogPointDistanceAdjust + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogPointDistanceAdjust + reject() + + + 316 + 260 + + + 286 + 274 + + + + + horizontalSliderLineHeadValue + valueChanged(int) + spinBoxLineHeadValue + setValue(int) + + + 266 + 33 + + + 518 + 33 + + + + + horizontalSliderLineCenterValue + valueChanged(int) + spinBoxLineCenterValue + setValue(int) + + + 266 + 80 + + + 518 + 80 + + + + + horizontalSliderLineEndValue + valueChanged(int) + spinBoxLineEndValue + setValue(int) + + + 266 + 127 + + + 518 + 127 + + + + + spinBoxLineHeadValue + valueChanged(int) + horizontalSliderLineHeadValue + setValue(int) + + + 518 + 33 + + + 266 + 33 + + + + + spinBoxLineCenterValue + valueChanged(int) + horizontalSliderLineCenterValue + setValue(int) + + + 518 + 80 + + + 266 + 80 + + + + + spinBoxLineEndValue + valueChanged(int) + horizontalSliderLineEndValue + setValue(int) + + + 518 + 127 + + + 266 + 127 + + + + + diff --git a/dialogsavefile.ui b/dialogsavefile.ui index 9d3214e..83da678 100644 --- a/dialogsavefile.ui +++ b/dialogsavefile.ui @@ -1,247 +1,247 @@ - - - DialogSaveFile - - - Qt::WindowModal - - - - 0 - 0 - 640 - 460 - - - - Qt::NoFocus - - - Dialog - - - Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhPreferNumbers - - - - - - 0 - - - - - 0 - - - - - - 100 - 16777215 - - - - Qt::LeftToRight - - - 本地文件 - - - - :/icon/localdisk.png:/icon/localdisk.png - - - true - - - - - - - - 120 - 16777215 - - - - Qt::LeftToRight - - - U盘文件 - - - - :/icon/udisk.png:/icon/udisk.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 0 - 0 - - - - - - - - 6 - - - 0 - - - - - 预览文件内容: - - - - - - - - 90 - 16777215 - - - - 上一个 - - - - :/icon/lastpage.png:/icon/lastpage.png - - - - - - - - 90 - 16777215 - - - - 下一个 - - - - :/icon/nextpage.png:/icon/nextpage.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - true - - - - 16777215 - 60 - - - - false - - - - - - - - - 请输入文件名: - - - - - - - - 0 - 30 - - - - - - - - - 90 - 16777215 - - - - 取消 - - - - :/icon/exit.png:/icon/exit.png - - - - - - - - 90 - 16777215 - - - - 保存 - - - - :/icon/filesave.png:/icon/filesave.png - - - - - - - - - - - - - - + + + DialogSaveFile + + + Qt::WindowModal + + + + 0 + 0 + 640 + 460 + + + + Qt::NoFocus + + + Dialog + + + Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhPreferNumbers + + + + + + 0 + + + + + 0 + + + + + + 100 + 16777215 + + + + Qt::LeftToRight + + + 本地文件 + + + + :/icon/localdisk.png:/icon/localdisk.png + + + true + + + + + + + + 120 + 16777215 + + + + Qt::LeftToRight + + + U盘文件 + + + + :/icon/udisk.png:/icon/udisk.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + + + + 6 + + + 0 + + + + + 预览文件内容: + + + + + + + + 90 + 16777215 + + + + 上一个 + + + + :/icon/lastpage.png:/icon/lastpage.png + + + + + + + + 90 + 16777215 + + + + 下一个 + + + + :/icon/nextpage.png:/icon/nextpage.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + 16777215 + 60 + + + + false + + + + + + + + + 请输入文件名: + + + + + + + + 0 + 30 + + + + + + + + + 90 + 16777215 + + + + 取消 + + + + :/icon/exit.png:/icon/exit.png + + + + + + + + 90 + 16777215 + + + + 保存 + + + + :/icon/filesave.png:/icon/filesave.png + + + + + + + + + + + + + + diff --git a/dialogshowcounter.cpp b/dialogshowcounter.cpp index 6a67988..594a275 100644 --- a/dialogshowcounter.cpp +++ b/dialogshowcounter.cpp @@ -1,120 +1,120 @@ -#include "dialogshowcounter.h" -#include "ui_dialogshowcounter.h" -#include - -DialogShowCounter::DialogShowCounter(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogShowCounter) -{ - ui->setupUi(this); - - cycle_flag = true; - cycleTimecount = 0; - savecnt1CurrValue = 0; - - dialogcycleprint = new DialogCycleprint(parent); - connect(dialogcycleprint,SIGNAL(accepted()),this,SLOT(ondialogcycleprintAccepted())); -// ui->CycleprintpushButton->hide(); - setWindowFlags(Qt::FramelessWindowHint); -} - -DialogShowCounter::~DialogShowCounter() -{ - delete ui; -} - -void DialogShowCounter::init_arg() -{ - dialogcycleprint->getSpinboxValue(cycleprintarg); - - dialogcycleprint->SetSpinboxValue(cycleprintarg); - -// qDebug()<<"[init_arg]cycleprintarg.area_end1="<lcdNumber->display(currCnt1Value); - - // 结束值 - ui->lcdCycleEndNumber->display(cn1EndValue); - - // 起始值 -// temp_str = QString::number(cn1StartValue); - ui->lcdCycleStartNumber->display(cn1StartValue); - - // 循环 - ui->lcdCycleTimeNumber->display(currGroupLoop + 1); - - // 剩余米数 - int remainValue = cn1EndValue - currCnt1Value; - ui->lcdLessNumber->display(remainValue); - -} - -void DialogShowCounter::setLCDframe() -{ - ui->lcdNumber->setDigitCount(4); - ui->lcdNumber->setMode(QLCDNumber::Dec); - ui->lcdNumber->setSegmentStyle(QLCDNumber::Flat); - QPalette lcdpat = ui->lcdNumber->palette(); - lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); - ui->lcdNumber->setPalette(lcdpat); - - ui->lcdCycleEndNumber->setDigitCount(4); - ui->lcdCycleEndNumber->setMode(QLCDNumber::Dec); - ui->lcdCycleEndNumber->setSegmentStyle(QLCDNumber::Flat); - lcdpat = ui->lcdCycleEndNumber->palette(); - lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); - ui->lcdCycleEndNumber->setPalette(lcdpat); - - ui->lcdCycleStartNumber->setDigitCount(4); - ui->lcdCycleStartNumber->setMode(QLCDNumber::Dec); - ui->lcdCycleStartNumber->setSegmentStyle(QLCDNumber::Flat); - lcdpat = ui->lcdCycleStartNumber->palette(); - lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); - ui->lcdCycleStartNumber->setPalette(lcdpat); - - ui->lcdCycleTimeNumber->setDigitCount(4); - ui->lcdCycleTimeNumber->setMode(QLCDNumber::Dec); - ui->lcdCycleTimeNumber->setSegmentStyle(QLCDNumber::Flat); - lcdpat = ui->lcdCycleTimeNumber->palette(); - lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); - ui->lcdCycleTimeNumber->setPalette(lcdpat); - - ui->lcdLessNumber->setDigitCount(4); - ui->lcdLessNumber->setMode(QLCDNumber::Dec); - ui->lcdLessNumber->setSegmentStyle(QLCDNumber::Flat); - lcdpat = ui->lcdLessNumber->palette(); - lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); - ui->lcdLessNumber->setPalette(lcdpat); - -} - -int DialogShowCounter::getResetMetreState(int &area_end) -{ - int t_reset; - t_reset = reset_meter; - reset_meter = false; - - //qDebug()<<"cycleprintarg.area_end1="<getSpinboxValue(cycleprintarg); -} - -void DialogShowCounter::on_CycleprintpushButton_clicked() -{ - dialogcycleprint->show(); -} +#include "dialogshowcounter.h" +#include "ui_dialogshowcounter.h" +#include + +DialogShowCounter::DialogShowCounter(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogShowCounter) +{ + ui->setupUi(this); + + cycle_flag = true; + cycleTimecount = 0; + savecnt1CurrValue = 0; + + dialogcycleprint = new DialogCycleprint(parent); + connect(dialogcycleprint,SIGNAL(accepted()),this,SLOT(ondialogcycleprintAccepted())); +// ui->CycleprintpushButton->hide(); + setWindowFlags(Qt::FramelessWindowHint); +} + +DialogShowCounter::~DialogShowCounter() +{ + delete ui; +} + +void DialogShowCounter::init_arg() +{ + dialogcycleprint->getSpinboxValue(cycleprintarg); + + dialogcycleprint->SetSpinboxValue(cycleprintarg); + +// qDebug()<<"[init_arg]cycleprintarg.area_end1="<lcdNumber->display(currCnt1Value); + + // 结束值 + ui->lcdCycleEndNumber->display(cn1EndValue); + + // 起始值 +// temp_str = QString::number(cn1StartValue); + ui->lcdCycleStartNumber->display(cn1StartValue); + + // 循环 + ui->lcdCycleTimeNumber->display(currGroupLoop + 1); + + // 剩余米数 + int remainValue = cn1EndValue - currCnt1Value; + ui->lcdLessNumber->display(remainValue); + +} + +void DialogShowCounter::setLCDframe() +{ + ui->lcdNumber->setDigitCount(4); + ui->lcdNumber->setMode(QLCDNumber::Dec); + ui->lcdNumber->setSegmentStyle(QLCDNumber::Flat); + QPalette lcdpat = ui->lcdNumber->palette(); + lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); + ui->lcdNumber->setPalette(lcdpat); + + ui->lcdCycleEndNumber->setDigitCount(4); + ui->lcdCycleEndNumber->setMode(QLCDNumber::Dec); + ui->lcdCycleEndNumber->setSegmentStyle(QLCDNumber::Flat); + lcdpat = ui->lcdCycleEndNumber->palette(); + lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); + ui->lcdCycleEndNumber->setPalette(lcdpat); + + ui->lcdCycleStartNumber->setDigitCount(4); + ui->lcdCycleStartNumber->setMode(QLCDNumber::Dec); + ui->lcdCycleStartNumber->setSegmentStyle(QLCDNumber::Flat); + lcdpat = ui->lcdCycleStartNumber->palette(); + lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); + ui->lcdCycleStartNumber->setPalette(lcdpat); + + ui->lcdCycleTimeNumber->setDigitCount(4); + ui->lcdCycleTimeNumber->setMode(QLCDNumber::Dec); + ui->lcdCycleTimeNumber->setSegmentStyle(QLCDNumber::Flat); + lcdpat = ui->lcdCycleTimeNumber->palette(); + lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); + ui->lcdCycleTimeNumber->setPalette(lcdpat); + + ui->lcdLessNumber->setDigitCount(4); + ui->lcdLessNumber->setMode(QLCDNumber::Dec); + ui->lcdLessNumber->setSegmentStyle(QLCDNumber::Flat); + lcdpat = ui->lcdLessNumber->palette(); + lcdpat.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); + ui->lcdLessNumber->setPalette(lcdpat); + +} + +int DialogShowCounter::getResetMetreState(int &area_end) +{ + int t_reset; + t_reset = reset_meter; + reset_meter = false; + + //qDebug()<<"cycleprintarg.area_end1="<getSpinboxValue(cycleprintarg); +} + +void DialogShowCounter::on_CycleprintpushButton_clicked() +{ + dialogcycleprint->show(); +} diff --git a/dialogshowcounter.h b/dialogshowcounter.h index 35a706c..a797cbe 100644 --- a/dialogshowcounter.h +++ b/dialogshowcounter.h @@ -1,53 +1,53 @@ -#ifndef DIALOGSHOWCOUNTER_H -#define DIALOGSHOWCOUNTER_H - -#include -#include -#include -#include "ParaSettingUI.h" - -#include "dialogcycleprint.h" - -namespace Ui { -class DialogShowCounter; -} - -class DialogShowCounter : public QDialog -{ - Q_OBJECT - -public: - void setLCDframe(void); - void refreshdate(int currCnt1Value, int cn1StartValue, int cn1EndValue,int currGroupIndex, int currGroupLoop/*当前循环次数*/); - int getResetMetreState(int &area_end); - void init_arg(); - - explicit DialogShowCounter(QWidget *parent = 0); - - DialogCycleprint *dialogcycleprint; - - CycleprintArg cycleprintarg; - - ~DialogShowCounter(); - -Q_SIGNALS: - void set_count_endvalue(int cycle_time,int area_end); - -private slots: - void on_pushButton_clicked(); - - void on_CycleprintpushButton_clicked(); - void ondialogcycleprintAccepted(); - -private: - Ui::DialogShowCounter *ui; - int lcd_number; - int reset_meter; - int cycleTimecount; - int savecnt1CurrValue; - int cycle_flag; -// QTimer *refresh_timer; - -}; - -#endif // DIALOGSHOWCOUNTER_H +#ifndef DIALOGSHOWCOUNTER_H +#define DIALOGSHOWCOUNTER_H + +#include +#include +#include +#include "ParaSettingUI.h" + +#include "dialogcycleprint.h" + +namespace Ui { +class DialogShowCounter; +} + +class DialogShowCounter : public QDialog +{ + Q_OBJECT + +public: + void setLCDframe(void); + void refreshdate(int currCnt1Value, int cn1StartValue, int cn1EndValue,int currGroupIndex, int currGroupLoop/*当前循环次数*/); + int getResetMetreState(int &area_end); + void init_arg(); + + explicit DialogShowCounter(QWidget *parent = 0); + + DialogCycleprint *dialogcycleprint; + + CycleprintArg cycleprintarg; + + ~DialogShowCounter(); + +Q_SIGNALS: + void set_count_endvalue(int cycle_time,int area_end); + +private slots: + void on_pushButton_clicked(); + + void on_CycleprintpushButton_clicked(); + void ondialogcycleprintAccepted(); + +private: + Ui::DialogShowCounter *ui; + int lcd_number; + int reset_meter; + int cycleTimecount; + int savecnt1CurrValue; + int cycle_flag; +// QTimer *refresh_timer; + +}; + +#endif // DIALOGSHOWCOUNTER_H diff --git a/dialogshowcounter.ui b/dialogshowcounter.ui index dfdff2c..a6b396a 100644 --- a/dialogshowcounter.ui +++ b/dialogshowcounter.ui @@ -1,279 +1,279 @@ - - - DialogShowCounter - - - - 0 - 0 - 640 - 480 - - - - Dialog - - - - - 290 - 440 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 160 - 20 - 471 - 411 - - - - 4 - - - - - - 170 - 0 - 61 - 21 - - - - 米标显示: - - - - - - 10 - 10 - 91 - 16 - - - - 目前循环范围: - - - - - - 40 - 30 - 101 - 61 - - - - 4 - - - - - - 140 - 70 - 16 - 16 - - - - 米 - - - - - - 10 - 190 - 91 - 16 - - - - 剩余米数: - - - - - - 140 - 300 - 16 - 16 - - - - 米 - - - - - - 0 - 210 - 141 - 111 - - - - 4 - - - - - - 0 - 340 - 141 - 91 - - - - 4 - - - - - - 0 - 320 - 91 - 16 - - - - 循环次数: - - - - - - 20 - 440 - 91 - 23 - - - - 立即重新计米 - - - - - - 140 - 150 - 16 - 16 - - - - 米 - - - - - - 40 - 110 - 101 - 61 - - - - 4 - - - - - - 10 - 70 - 31 - 16 - - - - 起始: - - - - - - 10 - 150 - 31 - 16 - - - - 结束: - - - lcdNumber - buttonBox - label - label_2 - lcdCycleStartNumber - label_3 - label_4 - label_5 - lcdLessNumber - lcdCycleTimeNumber - label_6 - pushButton - label_7 - lcdCycleEndNumber - label_8 - label_9 - - - - - buttonBox - accepted() - DialogShowCounter - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DialogShowCounter - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DialogShowCounter + + + + 0 + 0 + 640 + 480 + + + + Dialog + + + + + 290 + 440 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 160 + 20 + 471 + 411 + + + + 4 + + + + + + 170 + 0 + 61 + 21 + + + + 米标显示: + + + + + + 10 + 10 + 91 + 16 + + + + 目前循环范围: + + + + + + 40 + 30 + 101 + 61 + + + + 4 + + + + + + 140 + 70 + 16 + 16 + + + + 米 + + + + + + 10 + 190 + 91 + 16 + + + + 剩余米数: + + + + + + 140 + 300 + 16 + 16 + + + + 米 + + + + + + 0 + 210 + 141 + 111 + + + + 4 + + + + + + 0 + 340 + 141 + 91 + + + + 4 + + + + + + 0 + 320 + 91 + 16 + + + + 循环次数: + + + + + + 20 + 440 + 91 + 23 + + + + 立即重新计米 + + + + + + 140 + 150 + 16 + 16 + + + + 米 + + + + + + 40 + 110 + 101 + 61 + + + + 4 + + + + + + 10 + 70 + 31 + 16 + + + + 起始: + + + + + + 10 + 150 + 31 + 16 + + + + 结束: + + + lcdNumber + buttonBox + label + label_2 + lcdCycleStartNumber + label_3 + label_4 + label_5 + lcdLessNumber + lcdCycleTimeNumber + label_6 + pushButton + label_7 + lcdCycleEndNumber + label_8 + label_9 + + + + + buttonBox + accepted() + DialogShowCounter + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogShowCounter + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/digitalinput.ui b/digitalinput.ui index 42cda3b..a86ef20 100644 --- a/digitalinput.ui +++ b/digitalinput.ui @@ -1,447 +1,447 @@ - - - DigitalInput - - - - 0 - 0 - 216 - 231 - - - - - - - - - 255 - 255 - 255 - - - - - - - 202 - 201 - 201 - - - - - - - - - 255 - 255 - 255 - - - - - - - 202 - 201 - 201 - - - - - - - - - 202 - 201 - 201 - - - - - - - 202 - 201 - 201 - - - - - - - - Form - - - - - 0 - 0 - 215 - 230 - - - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 1 - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 9 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 3 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 8 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 退格 - - - - :/icon/keyleft.png:/icon/keyleft.png - - - - 12 - 16 - - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 1 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 4 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 0 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 5 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 7 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 2 - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - 6 - - - - - - - - - 0 - - - 0 - - - - - - 50 - 75 - - - - - 50 - 75 - - - - - - - - :/icon/keyup.png:/icon/keyup.png - - - - - - - - 50 - 75 - - - - - 50 - 75 - - - - - - - - :/icon/keydown.png:/icon/keydown.png - - - - - - - - 50 - 60 - - - - - 50 - 60 - - - - Qt::StrongFocus - - - 全选 - - - - - - - - - - - - - + + + DigitalInput + + + + 0 + 0 + 216 + 231 + + + + + + + + + 255 + 255 + 255 + + + + + + + 202 + 201 + 201 + + + + + + + + + 255 + 255 + 255 + + + + + + + 202 + 201 + 201 + + + + + + + + + 202 + 201 + 201 + + + + + + + 202 + 201 + 201 + + + + + + + + Form + + + + + 0 + 0 + 215 + 230 + + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 1 + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 9 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 3 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 8 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + - + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 退格 + + + + :/icon/keyleft.png:/icon/keyleft.png + + + + 12 + 16 + + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 1 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 4 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 0 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 5 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 7 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 2 + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + 6 + + + + + + + + + 0 + + + 0 + + + + + + 50 + 75 + + + + + 50 + 75 + + + + + + + + :/icon/keyup.png:/icon/keyup.png + + + + + + + + 50 + 75 + + + + + 50 + 75 + + + + + + + + :/icon/keydown.png:/icon/keydown.png + + + + + + + + 50 + 60 + + + + + 50 + 60 + + + + Qt::StrongFocus + + + 全选 + + + + + + + + + + + + + diff --git a/dlgQrCode.cpp b/dlgQrCode.cpp index 4265750..6e04df1 100644 --- a/dlgQrCode.cpp +++ b/dlgQrCode.cpp @@ -1,729 +1,729 @@ -#include "dlgQrCode.h" -#include "ui_dlgQrCode.h" - - -#include -#include -#include -#include - -#include -#include -#include "SysPara.h" -#include "InkJetPrinter.h" - -#define AUTOREF true - - -#include "Matrix/dm200.h" - -#define MDTFLAG 0xff00FF10 -#define QRFLAG 0xff00FF20 -#define BARFLAG 0xff00FF30 - -char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); - char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); - void Draw_MatrixToImg(unsigned char *buffer,QImage *pImg); - - extern InkJetPrinter *pInkJectPrinter; - //void MatrixEnCode(unsigned char *intext,int Size); - - static int casesensitive = 1; - static int eightbit = 0; - static int kanji = 0; - static int version = 0; - -static int margin = 1; - -static QRecLevel level = QR_ECLEVEL_L; - - -static int AutoCount=0; -static QImage img1; -static int InkColor=0; -static int QRCode_Level = 0; - -dlgQrCode::dlgQrCode(QWidget *parent) : - QDialog(parent), - ui(new Ui::dlgQrCode) -{ - ui->setupUi(this); - qrOption = new qrOption_t; - //ui->labQRImage->setText(""); - ui->labName->setText(""); - ui->labRECT->setText(""); - bcWidth=bcHeight=0; - counter =0; - scene = new QGraphicsScene; - connect(ui->lineEditIn,SIGNAL(editingFinished()),this,SLOT(onTextChanged())); - connect(ui->checkBoxAuto,SIGNAL(clicked(bool)),this,SLOT(onQRCodeAuto(bool))); - // img1 =0; - - connect(ui->comboBoxType, SIGNAL(currentIndexChanged(int)),this, SLOT(onComboBoxType(int))); - onComboBoxType(ui->comboBoxType->currentIndex()); - sysPara = NULL; - -#ifdef NETWORKQRCODE - // tcpserver 0506 hlp:四机赛瓦:tcp发送字符串生成二维码 - m_tcpServer = NULL; - initTcpServer(); - bool isNetQrCode = false; -#else - ui->btn_netQrCode->hide(); -#endif - -} - -dlgQrCode::~dlgQrCode() -{ - delete ui; - if(scene) - { - delete scene; - } -} - -enum { - O_HELP, - O_OUTPUT, - O_SIZE, - O_VERSION, - O_LEVEL, - O_MARGIN, - O_KANJI, - O_CASE, - O_8BIT, -}; - -static const struct option options[] = { - {"h", no_argument , NULL, O_HELP}, - {"o", required_argument, NULL, O_OUTPUT}, - {"l", required_argument, NULL, O_LEVEL}, - {"s", required_argument, NULL, O_SIZE}, - {"v", required_argument, NULL, O_VERSION}, - {"m", required_argument, NULL, O_MARGIN}, - {"k", no_argument , NULL, O_KANJI}, - {"c", no_argument , NULL, O_CASE}, - {"8", no_argument , NULL, O_8BIT}, - {NULL, 0, NULL, 0} -}; - -static QRcode *encode(const char *intext) -{ - QRencodeMode hint; - QRcode *code; - - if(kanji) { - hint = QR_MODE_KANJI; - } else { - hint = QR_MODE_8; - } - - if(eightbit) { - code = QRcode_encodeString8bit(intext, version, QR_ECLEVEL_L); - } else { - code = QRcode_encodeString(intext, version, (QRecLevel)QRCode_Level, hint, casesensitive); - } - - return code; -} - -static void qrencode(const char *intext,int Size) -{ - QRcode *qrcode; - //png_structp png_ptr; - //png_infop info_ptr; - unsigned char *row, *p, *q; - int x, y, xx, yy, bit; - int realwidth; - - qrcode = encode(intext); - if(qrcode == NULL) { - fprintf(stderr, "Failed to encode the input data.\n"); - exit(1); - } - - realwidth = (qrcode->width + margin * 2) * Size; - - row = (unsigned char *)malloc(realwidth); - // top margin - memset(row, 0x0, realwidth ); - QImage QRImage(realwidth, InkColor?realwidth:qrcode->width*Size ,QImage::Format_ARGB32 ); - QImage *img; - img = &QRImage; - if( AutoCount ) { - InkColor =0; - img->fill(0xff00ff00); // 0xff00ff01(DMT) 0xff00ff02(QR) 0xff00ff03(BAR) - } - else - img->fill(InkColor?0xff000000:0x00ffffff); - /* data */ - p = qrcode->data; - int ypos=InkColor?margin:0;//margin * Size; - int xpos=0; - - for(y=0; ywidth; y++) { - bit = 7; - bit = 7 - (margin * Size % 8); - xpos=margin * Size; - for(x=0; xwidth; x++) { - for(xx=0; xxsetPixel(xpos,ypos+yy,InkColor? 0x00ffffff:0xff000000); - } - } - xpos++; - } - p++; - bit--; - if(bit < 0) { - //q++; - bit = 7; - } - } - ypos+=Size; - } - img1 = img->copy(img->rect()); - if(AutoCount) img1.setPixel(0,ypos-1,QRFLAG); - - free(row); - QRcode_free(qrcode); -} - - void dlgQrCode::MatrixEnCode(unsigned char *intext,int Size) -{ - U16 sColumns, sRows; - U08 *Grid; - sColumns = sRows = 0; - Grid = 0; - short sizeType = ui->comboBox_DMType->currentIndex(); - Grid = iec16022ecc200((short*)&sColumns, (short*)&sRows, intext, &sizeType); - if(sizeType == -1) - { - QMessageBox::warning(0,tr("警告"),tr("输入内容超出选择DM码尺寸大小,请选择更大的尺寸!")); - return; - } - DataMatrixdDrawImg(Grid,sRows,sColumns,Size); -} - -void dlgQrCode::on_pushBtnClose_pressed(){ - - flagInsert = ui->checkBox->checkState()?1:0; - AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; - ui->checkBox->setChecked(0); - barCodeFlag = ui->barCodeCheckBox->checkState()?1:0; - - on_pushBtnPreView_pressed(); - emit onQRCodeCloseNow(); - this->close(); -} - - char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize) -{ - int Size=MSize; - int w = cColumns*Size; - int h = cRows*Size; - //qDebug()<fill( AutoCount?0xff00ff00:0x00ffffff); - /* data */ - int margin=0; - U08 *p = OutBuff; - int ypos=0;//margin * Size; - int xpos=0; - int x,y,xx,yy,bit; - for(y=0; ysetPixel(xpos,h-1-(ypos+yy),AutoCount?0xff000000:0xff000000); - } - } - xpos++; - } - p++; - bit--; - if(bit < 0) { - //q++; - bit = 7; - } - } - // xpos++; - for(xx=0; xxsetPixel(xpos,h-1-(ypos+yy),0x00ffffff); - } - xpos++; - } - - ypos+=Size; - - } - //img->save("Myqr.bmp"); - img1 = img->copy(img->rect()); - if(AutoCount) img1.setPixel(0,ypos-1,MDTFLAG); // 设置定位标志 - return 0; -} -void dlgQrCode::on_pushBtnPreView_pressed(){ - QString in; - InkColor = ui->comboBoxInkColor->currentIndex()?1:0; - AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; - - QString s1=ui->lineEditCNT->text(); - QString s2; - int len = s1.length(); - - - if(ui->checkBoxAutoCount->checkState()) { - - in = ui->lineEditIn->text() + ui->lineEditCNT->text() +ui->lineEditIn2->text();// "%04d" - - } - else in = ui->lineEditIn->text()+ui->lineEditIn2->text(); - if(flagCount==0) in=ui->lineEditIn->text(); - - ui->lineEdit->setText(in); - - if(in.isEmpty()) - { -// qDebug()<<"QRcode string isEmpty"; - return; - }QByteArray inUtf8 = in.toUtf8(); - char *intext =""; - intext = (char *)malloc(inUtf8.length()*2);//intext = (char *)malloc(in.length()*2); - memset(intext,0,sizeof(intext)); - memcpy(intext,inUtf8.data(),2*inUtf8.length());//memcpy(intext,in.toLocal8Bit().data(),2*in.length()); - - if(ui->comboBoxType->currentIndex()){ qrencode(intext,1); } - else { MatrixEnCode((unsigned char *)intext,1); } - - //if(pInkJectPrinter->modbus->modbus_up_QRCODE == 0) - { - ShowQRCode(&img1); - } - bcWidth = img1.width(); - bcHeight = img1.height(); - - ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height())); - if(!ui->checkBoxAutoCount->isChecked()) - { - ui->pushBtnSave->setEnabled(true); - } - else - { - ui->pushBtnSave->setEnabled(false); - } -} - -void dlgQrCode::onTextChanged(){ - //qDebug()<<"onTextChanged:"; - if(AutoRefresh){ - emit on_pushBtnPreView_pressed(); - } -} - -void dlgQrCode::ShowQRCode(QImage *img) -{ - scene->clear(); - int scale = 4; - int bcWidth= img->width(); - int bcHeight = img->height(); - scene->setSceneRect( 0,0,bcWidth*(scale),bcHeight*(scale)); - scene->setItemIndexMethod(QGraphicsScene::NoIndex); - QPixmap pixmap(QPixmap::fromImage(*img)); - pixmap = pixmap.scaledToHeight(bcHeight*(scale)); - //pixmap = pixmap.scaledToWidth(scale*bcWidth); - item = scene->addPixmap(pixmap); - /***************设置view的场景*****************************/ - ui->BarCodeView->setScene(scene); - ui->BarCodeView->setRenderHint(QPainter::Antialiasing); - ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); - ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); - //ui->graphicsView->resize(400,300); - ui->BarCodeView->setScene(scene);//设置view的场景 -} - -#ifdef NETWORKQRCODE -void dlgQrCode::initTcpServer() -{ - if (m_tcpServer == NULL) { - m_tcpServer = new TcpServer; - connect(m_tcpServer, SIGNAL(sig_dataReceived(quint64,QByteArray)), - this, SLOT(slt_handleMessage(quint64,QByteArray))); - } -} - -void dlgQrCode::noticeInsert() -{ - if (isNetQrCode) { - QMessageBox::StandardButton ret = QMessageBox::question( - this, tr("网络二维码"), - tr("启用网络二维码将清除当前编辑区中所有二维码(QR码、DM码、条形码),是否继续?"), - QMessageBox::Ok | QMessageBox::Cancel ); - if (ret == QMessageBox::Ok) { - ui->lineEditIn->setText("NetworkQR"); - ui->lineEditCNT->clear(); - ui->lineEditIn2->clear(); - // hlp 0506: 四机赛瓦:tcp发送字符串生成二维码; 启用外部通信 - // tcp开启18080端口 - if (m_tcpServer) m_tcpServer->start(18080); - - emit sig_clearAllQRCode(); // 通知主窗口清除二维码 - on_pushBtnClose_pressed(); - } else { - ui->comboBoxType->setEnabled(true);//类型 - if (m_tcpServer) m_tcpServer->stop(); - } - } else { - emit sig_clearAllQRCode(); // 通知主窗口清除二维码 - if (m_tcpServer) m_tcpServer->stop(); - } - return; -} -#endif - -void dlgQrCode::on_pushBtnSave_pressed(){ - //if(img1.width()<10) - // on_pushBtnPreView_pressed(); - - QString s1 = ui->lineEditIn->text(); - QString s2=""; - int len =s1.length()<10?s1.length():10; - for(int i=1;i='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z') ) - s2+= QString(c); - } - - s2 = (ui->comboBoxType->currentIndex()?"QR_":"DMT_")+s2.left(10)+".bmp"; - if(AutoCount) s2 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp"; - ui->labName->setText(s2); - - if(pInkJectPrinter->modbus->modbus_up_QRCODE == 1) - { -// qDebug()<<"save modbusQR"; - s2 = "modbusQR.bmp"; - this->pictureName=DOC_ROOT_DIR+s2; - img1.save(pictureName); - pInkJectPrinter->modbus->modbus_up_QRCODE = 0; - }else - { - this->pictureName=DOC_ROOT_DIR+s2; - //如果是自动计数不作保存 - if(AutoCount) - { - return; - } - img1.save(pictureName); - } - -} -QString dlgQrCode::getCounterText( int counter,int QRCntNum){ - QString s1=""; - //counter = qrOption->counter; - char mFormat[20]; - memset(mFormat,0,20); - if(QRCntNum>0) {snprintf(mFormat,20,"%%%02dd",QRCntNum); - if(QRCntNum==1) s1 = QString().asprintf(mFormat,counter%10); - else if(QRCntNum==2) s1 = QString().asprintf(mFormat,counter%100); - else if(QRCntNum==3) s1 = QString().asprintf(mFormat,counter%1000); - else if(QRCntNum==4) s1 = QString().asprintf(mFormat,counter%10000); - else if(QRCntNum==5) s1 = QString().asprintf(mFormat,counter%100000); - else if(QRCntNum==6) s1 = QString().asprintf(mFormat,counter%1000000); - else if(QRCntNum==7) s1 = QString().asprintf(mFormat,counter%10000000); - else if(QRCntNum==8) s1 = QString().asprintf(mFormat,counter%100000000); - else if(QRCntNum==9) s1 = QString().asprintf(mFormat,counter%1000000000); - else if(QRCntNum>=10) s1= QString().asprintf(mFormat,counter%10000000000); - //else s1 = QString().sprintf(mFormat,counter); - } - return s1; -} - -void dlgQrCode::SetOption(qrOption_t *qrOption){ - //memcpy( qrOption,qrOption0,sizeof(qrOption)); - QString s1=qrOption->text2; - ui->checkBoxAuto->setChecked(qrOption->AutoRefresh); - ui->checkBox->setChecked(0); - ui->lineEditIn2->setText(s1);//后缀 - ui->lineEditVarInc->setText(QString("%1").arg(qrOption->CntInc)); - //qDebug()<CntInc; - s1=getCounterText(qrOption->counter,qrOption->cntNum); - ui->lineEditCNT->setText(s1);//变量 - s1=qrOption->text; - ui->lineEditIn->setText(s1);//前缀 - ui->comboBoxInkColor->setCurrentIndex(qrOption->InkColor); - ui->checkBoxAutoCount->setChecked(qrOption->AutoCount);//z//计数器变量 - ui->checkBox->setChecked(flagInsert); - ui->barCodeCheckBox->setChecked(qrOption->barCodeFlag); - ui->comboBoxType->setCurrentIndex(qrOption->type); - QRCntNum = qrOption->cntNum; - if(qrOption->AutoCount) { - counter = qrOption->counter; - s1 = ui->lineEditIn->text()+ui->lineEditCNT->text()+ui->lineEditIn2->text(); - } - else s1 = ui->lineEditIn->text()+ui->lineEditIn2->text(); - - ui->lineEdit->setText(s1); - - if(s1.length()>10) s1 = "QR_"+s1.left(10)+".bmp"; - if(AutoCount) s1 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp"; - this->pictureName=DOC_ROOT_DIR+s1; - if(!qrOption->AutoRefresh) emit on_pushBtnPreView_pressed(); - //AutoRefresh = AUTOREF; - ui->pushBtnSave->setEnabled(false); - if(sysPara) - { - sysPara->para.isCheckInsertTime ? ui->checkBoxInsertTime->setChecked(true) : ui->checkBoxInsertTime->setChecked(false); - } -} - -void dlgQrCode::GetOption(qrOption_t *qrOption0){ - //qrOption = qrOption0; - if(qrOption0){ - qrOption0->width = img1.width(); - qrOption0->height = img1.height(); - //qrOption0->level = level; // ui->qrLevel->currentIndex()+1; - qrOption0->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; - qrOption0->AutoRefresh = AutoRefresh; - qrOption0->type = ui->comboBoxType->currentIndex(); - qrOption0->AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; - snprintf(qrOption0->text,sizeof(qrOption0->text),"%s",ui->lineEditIn->text().toLatin1().constData()); - snprintf(qrOption0->text2,sizeof(qrOption0->text2),"%s",ui->lineEditIn2->text().toLatin1().constData()); - snprintf(qrOption0->textCnt,sizeof(qrOption0->textCnt),"%s",ui->lineEditCNT->text().toLatin1().constData()); - qrOption0->cntNum =ui->lineEditCNT->text().length(); - //qDebug()<<"GetOption cntNum"<cntNum; - //bool ok; - qrOption0->counter = ui->lineEditCNT->text().toInt(0,10); - qrOption0->CntInc = ui->lineEditVarInc->text().toInt(0,10); - //qrOption->CntInc =11; - //qDebug()<<"TTTT"<CntInc)<<(qrOption0->counter)<<(qrOption0->cntNum); - ui->pushBtnSave->setEnabled(false); - if(sysPara) - { - sysPara->para.isCheckInsertTime = ui->checkBoxInsertTime->isChecked() ? true : false; - } - } -} - -int dlgQrCode::getDat(SysPara* sysPara,int varNum){ - - //TextToQRImg((QRvars_t *)&sysPara->print.QRvars[varNum]); - - int w= img1.width(); - int h= img1.height(); - if(varNum>1)varNum=0; - int wStart=sysPara->print.QRvars[varNum].startColPos; - int hStart= sysPara->print.QRvars[varNum].startRowPos; - //if(hStart)hStart-=1; - //qDebug()<<"wStart"<status.printDat; - for(int i = 0 ; i < w; i++) - { - unsigned char c=0,c1=0; - int j=0; - hStart= sysPara->print.QRvars[varNum].startRowPos; - c=sysPara->status.printDat[(wStart)*5+(hStart)/8]; - for( j = 0; j < h; j++) - { - QRgb rgb = img1.pixel(i,j); - if((rgb == 0xff000000)) c |= (1 << (hStart%8)); - else c &= ~(1 << (hStart%8)); - if(hStart%8==7) { - sysPara->status.printDat[(wStart)*5+(hStart)/8]=c; - c=sysPara->status.printDat[(wStart)*5+(hStart+1)/8]; - } - hStart++; - } - sysPara->status.printDat[(wStart)*5+(hStart)/8]=c; - wStart++; - if(sysPara->status.addSpace ) wStart++; //&& sysPara->print.QRvars[varNum].type==0 - } - return w; -} - - -#include "QDateTime" -void dlgQrCode::extSetText(QString text, bool flag) -{ - if(flag) - { - ui->comboBoxType->setCurrentIndex(1); - } - else{ - ui->comboBoxType->setCurrentIndex(0); - } - ui->lineEditIn->setText(text); - ui->lineEditIn2->setText(""); - ui->lineEditCNT->setText(""); - - pInkJectPrinter->modbus->modbus_up_QRCODE =1; - - emit on_pushBtnPreView_pressed(); - emit on_pushBtnSave_pressed(); -} - -QString dlgQrCode::TextToQRImg(qrOption_t *qrVar){ - QString in,s1,s2,s3; - - //snprintf(qrVar->text,sizeof(qrVar->text),"%s",ui->lineEditIn->text().toLatin1().constData()); - s1 = qrVar->text;//ui->lineEditIn->text(); - s2 = qrVar->text2; - s3 = getCounterText(qrVar->counter,qrVar->cntNum) ; - QRCntNum = qrVar->cntNum; - in = s1+s2; - - if(QRCntNum>0) { - in =s1+s3+s2; - } - - - // if(qrVar->TimeEn) - // in += " "+ QDateTime::currentDateTime().toString(tr("yy-MM-dd HH:mm:SS")); - counter = qrVar->counter; - if(in.isEmpty())in = ""; -#ifdef MYARMTEST - //qDebug()<<"txtToImg:"<type){ qrencode(intext,1); } - else { MatrixEnCode((unsigned char *)intext,1); } - //ShowQRCode(&img1); - free(intext); - qrVar->width = img1.width(); - qrVar->height = img1.height(); - //qrVar->startRowPos = qrVar->endRowPos-qrVar->height; - bcWidth = img1.width(); - bcHeight = img1.height(); - return in;// 返回文件名 -} - -void dlgQrCode::onQRCodeAuto(bool En){ - AutoRefresh = En; - //ui->pushBtnPreView->setEnabled(!En); -} - -void dlgQrCode::onComboBoxType(int type) -{ - if(type == 0) - { - ui->comboBox_DMType->setEnabled(true); - ui->comboBox_QRCodeLevel->setEnabled(false); - } - else - { - ui->comboBox_DMType->setEnabled(false); - ui->comboBox_QRCodeLevel->setEnabled(true); - } -} - -void dlgQrCode::setCntCheckBoxHide(bool hideEn){ - if(hideEn){ - ui->checkBoxAutoCount->setChecked(0); - ui->checkBoxAutoCount->hide(); - flagCount = 0; - ui->lineEditCNT->hide(); - ui->labelVarInc->hide(); - ui->lineEditVarInc->hide(); - ui->lineEditIn2->hide(); - ui->label_4->hide(); - ui->label_3->hide(); - } - else { - ui->checkBoxAutoCount->show(); - ui->lineEditCNT->show(); - ui->labelVarInc->show(); - ui->lineEditIn2->show(); - ui->label_4->show(); - ui->lineEditVarInc->show(); - ui->label_3->show(); - flagCount =1; - } -} - -void dlgQrCode::setSysPara(SysPara * sysPara) -{ - this->sysPara = sysPara; -} - -void dlgQrCode::on_comboBox_QRCodeLevel_currentIndexChanged(int index) -{ - QRCode_Level = ui->comboBox_QRCodeLevel->currentIndex(); -} - -#ifdef NETWORKQRCODE -void dlgQrCode::on_btn_netQrCode_clicked() -{ - if (ui->btn_netQrCode->text() == tr("插入网络二维码")) { - ui->btn_netQrCode->setText(tr("取消网络二维码")); - isNetQrCode = true; - } else { - ui->btn_netQrCode->setText(tr("插入网络二维码")); - isNetQrCode = false; - } - QString name = isNetQrCode? "networkQR.bmp" : ""; - ui->labName->setText(name); - // 使用外部通信,即认为是通过tcp更新,不可勾选自动刷新和计数器,条形码等功能 - ui->checkBoxAuto->setEnabled(!isNetQrCode); //自动更新 - ui->checkBoxAutoCount->setEnabled(!isNetQrCode);// 自动计数 - ui->barCodeCheckBox->setEnabled(!isNetQrCode);//条形码 - ui->comboBoxType->setEnabled(!isNetQrCode);//类型:只能使用QR 二维码 - ui->checkBoxInsertTime->setEnabled(!isNetQrCode); - ui->checkBoxAuto->setChecked(false); - ui->checkBoxAutoCount->setChecked(false); - ui->barCodeCheckBox->setChecked(false); - ui->comboBoxType->setCurrentIndex(1); - ui->checkBoxInsertTime->setChecked(false); - - noticeInsert(); - -} - -void dlgQrCode::slt_handleMessage(quint64 socketId, const QByteArray &data) -{ - Q_UNUSED(socketId) - if (!isNetQrCode) return; - QString dataStr = QString::fromUtf8(data); - - // 1. 更新界面输入框 - ui->lineEditIn->setText(dataStr); - ui->lineEditCNT->setText(""); - ui->lineEditIn2->setText(""); - ui->checkBox->setChecked(true); - flagInsert = 1; - - // 2. 生成新的二维码 - char *intext = (char *)malloc(data.size() + 1); - memcpy(intext, data.data(), data.size()); - intext[data.size()] = '\0'; // 结束符 - qrencode(intext, 1); // 生成到 img1 - free(intext); - - // 3. 保存文件 - QString fileName = "networkQR.bmp"; - this->pictureName = DOC_ROOT_DIR + fileName; - img1.save(pictureName); - - - // 5. 显示新的二维码到界面 - ShowQRCode(&img1); - - bcWidth = img1.width(); - bcHeight = img1.height(); - - ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height())); - - emit sig_updateNetworkQR(); -} -#endif +#include "dlgQrCode.h" +#include "ui_dlgQrCode.h" + + +#include +#include +#include +#include + +#include +#include +#include "SysPara.h" +#include "InkJetPrinter.h" + +#define AUTOREF true + + +#include "Matrix/dm200.h" + +#define MDTFLAG 0xff00FF10 +#define QRFLAG 0xff00FF20 +#define BARFLAG 0xff00FF30 + +char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); + char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize); + void Draw_MatrixToImg(unsigned char *buffer,QImage *pImg); + + extern InkJetPrinter *pInkJectPrinter; + //void MatrixEnCode(unsigned char *intext,int Size); + + static int casesensitive = 1; + static int eightbit = 0; + static int kanji = 0; + static int version = 0; + +static int margin = 1; + +static QRecLevel level = QR_ECLEVEL_L; + + +static int AutoCount=0; +static QImage img1; +static int InkColor=0; +static int QRCode_Level = 0; + +dlgQrCode::dlgQrCode(QWidget *parent) : + QDialog(parent), + ui(new Ui::dlgQrCode) +{ + ui->setupUi(this); + qrOption = new qrOption_t; + //ui->labQRImage->setText(""); + ui->labName->setText(""); + ui->labRECT->setText(""); + bcWidth=bcHeight=0; + counter =0; + scene = new QGraphicsScene; + connect(ui->lineEditIn,SIGNAL(editingFinished()),this,SLOT(onTextChanged())); + connect(ui->checkBoxAuto,SIGNAL(clicked(bool)),this,SLOT(onQRCodeAuto(bool))); + // img1 =0; + + connect(ui->comboBoxType, SIGNAL(currentIndexChanged(int)),this, SLOT(onComboBoxType(int))); + onComboBoxType(ui->comboBoxType->currentIndex()); + sysPara = NULL; + +#ifdef NETWORKQRCODE + // tcpserver 0506 hlp:四机赛瓦:tcp发送字符串生成二维码 + m_tcpServer = NULL; + initTcpServer(); + bool isNetQrCode = false; +#else + ui->btn_netQrCode->hide(); +#endif + +} + +dlgQrCode::~dlgQrCode() +{ + delete ui; + if(scene) + { + delete scene; + } +} + +enum { + O_HELP, + O_OUTPUT, + O_SIZE, + O_VERSION, + O_LEVEL, + O_MARGIN, + O_KANJI, + O_CASE, + O_8BIT, +}; + +static const struct option options[] = { + {"h", no_argument , NULL, O_HELP}, + {"o", required_argument, NULL, O_OUTPUT}, + {"l", required_argument, NULL, O_LEVEL}, + {"s", required_argument, NULL, O_SIZE}, + {"v", required_argument, NULL, O_VERSION}, + {"m", required_argument, NULL, O_MARGIN}, + {"k", no_argument , NULL, O_KANJI}, + {"c", no_argument , NULL, O_CASE}, + {"8", no_argument , NULL, O_8BIT}, + {NULL, 0, NULL, 0} +}; + +static QRcode *encode(const char *intext) +{ + QRencodeMode hint; + QRcode *code; + + if(kanji) { + hint = QR_MODE_KANJI; + } else { + hint = QR_MODE_8; + } + + if(eightbit) { + code = QRcode_encodeString8bit(intext, version, QR_ECLEVEL_L); + } else { + code = QRcode_encodeString(intext, version, (QRecLevel)QRCode_Level, hint, casesensitive); + } + + return code; +} + +static void qrencode(const char *intext,int Size) +{ + QRcode *qrcode; + //png_structp png_ptr; + //png_infop info_ptr; + unsigned char *row, *p, *q; + int x, y, xx, yy, bit; + int realwidth; + + qrcode = encode(intext); + if(qrcode == NULL) { + fprintf(stderr, "Failed to encode the input data.\n"); + exit(1); + } + + realwidth = (qrcode->width + margin * 2) * Size; + + row = (unsigned char *)malloc(realwidth); + // top margin + memset(row, 0x0, realwidth ); + QImage QRImage(realwidth, InkColor?realwidth:qrcode->width*Size ,QImage::Format_ARGB32 ); + QImage *img; + img = &QRImage; + if( AutoCount ) { + InkColor =0; + img->fill(0xff00ff00); // 0xff00ff01(DMT) 0xff00ff02(QR) 0xff00ff03(BAR) + } + else + img->fill(InkColor?0xff000000:0x00ffffff); + /* data */ + p = qrcode->data; + int ypos=InkColor?margin:0;//margin * Size; + int xpos=0; + + for(y=0; ywidth; y++) { + bit = 7; + bit = 7 - (margin * Size % 8); + xpos=margin * Size; + for(x=0; xwidth; x++) { + for(xx=0; xxsetPixel(xpos,ypos+yy,InkColor? 0x00ffffff:0xff000000); + } + } + xpos++; + } + p++; + bit--; + if(bit < 0) { + //q++; + bit = 7; + } + } + ypos+=Size; + } + img1 = img->copy(img->rect()); + if(AutoCount) img1.setPixel(0,ypos-1,QRFLAG); + + free(row); + QRcode_free(qrcode); +} + + void dlgQrCode::MatrixEnCode(unsigned char *intext,int Size) +{ + U16 sColumns, sRows; + U08 *Grid; + sColumns = sRows = 0; + Grid = 0; + short sizeType = ui->comboBox_DMType->currentIndex(); + Grid = iec16022ecc200((short*)&sColumns, (short*)&sRows, intext, &sizeType); + if(sizeType == -1) + { + QMessageBox::warning(0,tr("警告"),tr("输入内容超出选择DM码尺寸大小,请选择更大的尺寸!")); + return; + } + DataMatrixdDrawImg(Grid,sRows,sColumns,Size); +} + +void dlgQrCode::on_pushBtnClose_pressed(){ + + flagInsert = ui->checkBox->checkState()?1:0; + AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; + ui->checkBox->setChecked(0); + barCodeFlag = ui->barCodeCheckBox->checkState()?1:0; + + on_pushBtnPreView_pressed(); + emit onQRCodeCloseNow(); + this->close(); +} + + char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize) +{ + int Size=MSize; + int w = cColumns*Size; + int h = cRows*Size; + //qDebug()<fill( AutoCount?0xff00ff00:0x00ffffff); + /* data */ + int margin=0; + U08 *p = OutBuff; + int ypos=0;//margin * Size; + int xpos=0; + int x,y,xx,yy,bit; + for(y=0; ysetPixel(xpos,h-1-(ypos+yy),AutoCount?0xff000000:0xff000000); + } + } + xpos++; + } + p++; + bit--; + if(bit < 0) { + //q++; + bit = 7; + } + } + // xpos++; + for(xx=0; xxsetPixel(xpos,h-1-(ypos+yy),0x00ffffff); + } + xpos++; + } + + ypos+=Size; + + } + //img->save("Myqr.bmp"); + img1 = img->copy(img->rect()); + if(AutoCount) img1.setPixel(0,ypos-1,MDTFLAG); // 设置定位标志 + return 0; +} +void dlgQrCode::on_pushBtnPreView_pressed(){ + QString in; + InkColor = ui->comboBoxInkColor->currentIndex()?1:0; + AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; + + QString s1=ui->lineEditCNT->text(); + QString s2; + int len = s1.length(); + + + if(ui->checkBoxAutoCount->checkState()) { + + in = ui->lineEditIn->text() + ui->lineEditCNT->text() +ui->lineEditIn2->text();// "%04d" + + } + else in = ui->lineEditIn->text()+ui->lineEditIn2->text(); + if(flagCount==0) in=ui->lineEditIn->text(); + + ui->lineEdit->setText(in); + + if(in.isEmpty()) + { +// qDebug()<<"QRcode string isEmpty"; + return; + }QByteArray inUtf8 = in.toUtf8(); + char *intext =""; + intext = (char *)malloc(inUtf8.length()*2);//intext = (char *)malloc(in.length()*2); + memset(intext,0,sizeof(intext)); + memcpy(intext,inUtf8.data(),2*inUtf8.length());//memcpy(intext,in.toLocal8Bit().data(),2*in.length()); + + if(ui->comboBoxType->currentIndex()){ qrencode(intext,1); } + else { MatrixEnCode((unsigned char *)intext,1); } + + //if(pInkJectPrinter->modbus->modbus_up_QRCODE == 0) + { + ShowQRCode(&img1); + } + bcWidth = img1.width(); + bcHeight = img1.height(); + + ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height())); + if(!ui->checkBoxAutoCount->isChecked()) + { + ui->pushBtnSave->setEnabled(true); + } + else + { + ui->pushBtnSave->setEnabled(false); + } +} + +void dlgQrCode::onTextChanged(){ + //qDebug()<<"onTextChanged:"; + if(AutoRefresh){ + emit on_pushBtnPreView_pressed(); + } +} + +void dlgQrCode::ShowQRCode(QImage *img) +{ + scene->clear(); + int scale = 4; + int bcWidth= img->width(); + int bcHeight = img->height(); + scene->setSceneRect( 0,0,bcWidth*(scale),bcHeight*(scale)); + scene->setItemIndexMethod(QGraphicsScene::NoIndex); + QPixmap pixmap(QPixmap::fromImage(*img)); + pixmap = pixmap.scaledToHeight(bcHeight*(scale)); + //pixmap = pixmap.scaledToWidth(scale*bcWidth); + item = scene->addPixmap(pixmap); + /***************设置view的场景*****************************/ + ui->BarCodeView->setScene(scene); + ui->BarCodeView->setRenderHint(QPainter::Antialiasing); + ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground); + ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag); + //ui->graphicsView->resize(400,300); + ui->BarCodeView->setScene(scene);//设置view的场景 +} + +#ifdef NETWORKQRCODE +void dlgQrCode::initTcpServer() +{ + if (m_tcpServer == NULL) { + m_tcpServer = new TcpServer; + connect(m_tcpServer, SIGNAL(sig_dataReceived(quint64,QByteArray)), + this, SLOT(slt_handleMessage(quint64,QByteArray))); + } +} + +void dlgQrCode::noticeInsert() +{ + if (isNetQrCode) { + QMessageBox::StandardButton ret = QMessageBox::question( + this, tr("网络二维码"), + tr("启用网络二维码将清除当前编辑区中所有二维码(QR码、DM码、条形码),是否继续?"), + QMessageBox::Ok | QMessageBox::Cancel ); + if (ret == QMessageBox::Ok) { + ui->lineEditIn->setText("NetworkQR"); + ui->lineEditCNT->clear(); + ui->lineEditIn2->clear(); + // hlp 0506: 四机赛瓦:tcp发送字符串生成二维码; 启用外部通信 + // tcp开启18080端口 + if (m_tcpServer) m_tcpServer->start(18080); + + emit sig_clearAllQRCode(); // 通知主窗口清除二维码 + on_pushBtnClose_pressed(); + } else { + ui->comboBoxType->setEnabled(true);//类型 + if (m_tcpServer) m_tcpServer->stop(); + } + } else { + emit sig_clearAllQRCode(); // 通知主窗口清除二维码 + if (m_tcpServer) m_tcpServer->stop(); + } + return; +} +#endif + +void dlgQrCode::on_pushBtnSave_pressed(){ + //if(img1.width()<10) + // on_pushBtnPreView_pressed(); + + QString s1 = ui->lineEditIn->text(); + QString s2=""; + int len =s1.length()<10?s1.length():10; + for(int i=1;i='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z') ) + s2+= QString(c); + } + + s2 = (ui->comboBoxType->currentIndex()?"QR_":"DMT_")+s2.left(10)+".bmp"; + if(AutoCount) s2 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp"; + ui->labName->setText(s2); + + if(pInkJectPrinter->modbus->modbus_up_QRCODE == 1) + { +// qDebug()<<"save modbusQR"; + s2 = "modbusQR.bmp"; + this->pictureName=DOC_ROOT_DIR+s2; + img1.save(pictureName); + pInkJectPrinter->modbus->modbus_up_QRCODE = 0; + }else + { + this->pictureName=DOC_ROOT_DIR+s2; + //如果是自动计数不作保存 + if(AutoCount) + { + return; + } + img1.save(pictureName); + } + +} +QString dlgQrCode::getCounterText( int counter,int QRCntNum){ + QString s1=""; + //counter = qrOption->counter; + char mFormat[20]; + memset(mFormat,0,20); + if(QRCntNum>0) {snprintf(mFormat,20,"%%%02dd",QRCntNum); + if(QRCntNum==1) s1 = QString().asprintf(mFormat,counter%10); + else if(QRCntNum==2) s1 = QString().asprintf(mFormat,counter%100); + else if(QRCntNum==3) s1 = QString().asprintf(mFormat,counter%1000); + else if(QRCntNum==4) s1 = QString().asprintf(mFormat,counter%10000); + else if(QRCntNum==5) s1 = QString().asprintf(mFormat,counter%100000); + else if(QRCntNum==6) s1 = QString().asprintf(mFormat,counter%1000000); + else if(QRCntNum==7) s1 = QString().asprintf(mFormat,counter%10000000); + else if(QRCntNum==8) s1 = QString().asprintf(mFormat,counter%100000000); + else if(QRCntNum==9) s1 = QString().asprintf(mFormat,counter%1000000000); + else if(QRCntNum>=10) s1= QString().asprintf(mFormat,counter%10000000000); + //else s1 = QString().sprintf(mFormat,counter); + } + return s1; +} + +void dlgQrCode::SetOption(qrOption_t *qrOption){ + //memcpy( qrOption,qrOption0,sizeof(qrOption)); + QString s1=qrOption->text2; + ui->checkBoxAuto->setChecked(qrOption->AutoRefresh); + ui->checkBox->setChecked(0); + ui->lineEditIn2->setText(s1);//后缀 + ui->lineEditVarInc->setText(QString("%1").arg(qrOption->CntInc)); + //qDebug()<CntInc; + s1=getCounterText(qrOption->counter,qrOption->cntNum); + ui->lineEditCNT->setText(s1);//变量 + s1=qrOption->text; + ui->lineEditIn->setText(s1);//前缀 + ui->comboBoxInkColor->setCurrentIndex(qrOption->InkColor); + ui->checkBoxAutoCount->setChecked(qrOption->AutoCount);//z//计数器变量 + ui->checkBox->setChecked(flagInsert); + ui->barCodeCheckBox->setChecked(qrOption->barCodeFlag); + ui->comboBoxType->setCurrentIndex(qrOption->type); + QRCntNum = qrOption->cntNum; + if(qrOption->AutoCount) { + counter = qrOption->counter; + s1 = ui->lineEditIn->text()+ui->lineEditCNT->text()+ui->lineEditIn2->text(); + } + else s1 = ui->lineEditIn->text()+ui->lineEditIn2->text(); + + ui->lineEdit->setText(s1); + + if(s1.length()>10) s1 = "QR_"+s1.left(10)+".bmp"; + if(AutoCount) s1 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp"; + this->pictureName=DOC_ROOT_DIR+s1; + if(!qrOption->AutoRefresh) emit on_pushBtnPreView_pressed(); + //AutoRefresh = AUTOREF; + ui->pushBtnSave->setEnabled(false); + if(sysPara) + { + sysPara->para.isCheckInsertTime ? ui->checkBoxInsertTime->setChecked(true) : ui->checkBoxInsertTime->setChecked(false); + } +} + +void dlgQrCode::GetOption(qrOption_t *qrOption0){ + //qrOption = qrOption0; + if(qrOption0){ + qrOption0->width = img1.width(); + qrOption0->height = img1.height(); + //qrOption0->level = level; // ui->qrLevel->currentIndex()+1; + qrOption0->InkColor = ui->comboBoxInkColor->currentIndex()?1:0; + qrOption0->AutoRefresh = AutoRefresh; + qrOption0->type = ui->comboBoxType->currentIndex(); + qrOption0->AutoCount=(ui->checkBoxAutoCount->checkState())?1:0; + snprintf(qrOption0->text,sizeof(qrOption0->text),"%s",ui->lineEditIn->text().toLatin1().constData()); + snprintf(qrOption0->text2,sizeof(qrOption0->text2),"%s",ui->lineEditIn2->text().toLatin1().constData()); + snprintf(qrOption0->textCnt,sizeof(qrOption0->textCnt),"%s",ui->lineEditCNT->text().toLatin1().constData()); + qrOption0->cntNum =ui->lineEditCNT->text().length(); + //qDebug()<<"GetOption cntNum"<cntNum; + //bool ok; + qrOption0->counter = ui->lineEditCNT->text().toInt(0,10); + qrOption0->CntInc = ui->lineEditVarInc->text().toInt(0,10); + //qrOption->CntInc =11; + //qDebug()<<"TTTT"<CntInc)<<(qrOption0->counter)<<(qrOption0->cntNum); + ui->pushBtnSave->setEnabled(false); + if(sysPara) + { + sysPara->para.isCheckInsertTime = ui->checkBoxInsertTime->isChecked() ? true : false; + } + } +} + +int dlgQrCode::getDat(SysPara* sysPara,int varNum){ + + //TextToQRImg((QRvars_t *)&sysPara->print.QRvars[varNum]); + + int w= img1.width(); + int h= img1.height(); + if(varNum>1)varNum=0; + int wStart=sysPara->print.QRvars[varNum].startColPos; + int hStart= sysPara->print.QRvars[varNum].startRowPos; + //if(hStart)hStart-=1; + //qDebug()<<"wStart"<status.printDat; + for(int i = 0 ; i < w; i++) + { + unsigned char c=0,c1=0; + int j=0; + hStart= sysPara->print.QRvars[varNum].startRowPos; + c=sysPara->status.printDat[(wStart)*5+(hStart)/8]; + for( j = 0; j < h; j++) + { + QRgb rgb = img1.pixel(i,j); + if((rgb == 0xff000000)) c |= (1 << (hStart%8)); + else c &= ~(1 << (hStart%8)); + if(hStart%8==7) { + sysPara->status.printDat[(wStart)*5+(hStart)/8]=c; + c=sysPara->status.printDat[(wStart)*5+(hStart+1)/8]; + } + hStart++; + } + sysPara->status.printDat[(wStart)*5+(hStart)/8]=c; + wStart++; + if(sysPara->status.addSpace ) wStart++; //&& sysPara->print.QRvars[varNum].type==0 + } + return w; +} + + +#include "QDateTime" +void dlgQrCode::extSetText(QString text, bool flag) +{ + if(flag) + { + ui->comboBoxType->setCurrentIndex(1); + } + else{ + ui->comboBoxType->setCurrentIndex(0); + } + ui->lineEditIn->setText(text); + ui->lineEditIn2->setText(""); + ui->lineEditCNT->setText(""); + + pInkJectPrinter->modbus->modbus_up_QRCODE =1; + + emit on_pushBtnPreView_pressed(); + emit on_pushBtnSave_pressed(); +} + +QString dlgQrCode::TextToQRImg(qrOption_t *qrVar){ + QString in,s1,s2,s3; + + //snprintf(qrVar->text,sizeof(qrVar->text),"%s",ui->lineEditIn->text().toLatin1().constData()); + s1 = qrVar->text;//ui->lineEditIn->text(); + s2 = qrVar->text2; + s3 = getCounterText(qrVar->counter,qrVar->cntNum) ; + QRCntNum = qrVar->cntNum; + in = s1+s2; + + if(QRCntNum>0) { + in =s1+s3+s2; + } + + + // if(qrVar->TimeEn) + // in += " "+ QDateTime::currentDateTime().toString(tr("yy-MM-dd HH:mm:SS")); + counter = qrVar->counter; + if(in.isEmpty())in = ""; +#ifdef MYARMTEST + //qDebug()<<"txtToImg:"<type){ qrencode(intext,1); } + else { MatrixEnCode((unsigned char *)intext,1); } + //ShowQRCode(&img1); + free(intext); + qrVar->width = img1.width(); + qrVar->height = img1.height(); + //qrVar->startRowPos = qrVar->endRowPos-qrVar->height; + bcWidth = img1.width(); + bcHeight = img1.height(); + return in;// 返回文件名 +} + +void dlgQrCode::onQRCodeAuto(bool En){ + AutoRefresh = En; + //ui->pushBtnPreView->setEnabled(!En); +} + +void dlgQrCode::onComboBoxType(int type) +{ + if(type == 0) + { + ui->comboBox_DMType->setEnabled(true); + ui->comboBox_QRCodeLevel->setEnabled(false); + } + else + { + ui->comboBox_DMType->setEnabled(false); + ui->comboBox_QRCodeLevel->setEnabled(true); + } +} + +void dlgQrCode::setCntCheckBoxHide(bool hideEn){ + if(hideEn){ + ui->checkBoxAutoCount->setChecked(0); + ui->checkBoxAutoCount->hide(); + flagCount = 0; + ui->lineEditCNT->hide(); + ui->labelVarInc->hide(); + ui->lineEditVarInc->hide(); + ui->lineEditIn2->hide(); + ui->label_4->hide(); + ui->label_3->hide(); + } + else { + ui->checkBoxAutoCount->show(); + ui->lineEditCNT->show(); + ui->labelVarInc->show(); + ui->lineEditIn2->show(); + ui->label_4->show(); + ui->lineEditVarInc->show(); + ui->label_3->show(); + flagCount =1; + } +} + +void dlgQrCode::setSysPara(SysPara * sysPara) +{ + this->sysPara = sysPara; +} + +void dlgQrCode::on_comboBox_QRCodeLevel_currentIndexChanged(int index) +{ + QRCode_Level = ui->comboBox_QRCodeLevel->currentIndex(); +} + +#ifdef NETWORKQRCODE +void dlgQrCode::on_btn_netQrCode_clicked() +{ + if (ui->btn_netQrCode->text() == tr("插入网络二维码")) { + ui->btn_netQrCode->setText(tr("取消网络二维码")); + isNetQrCode = true; + } else { + ui->btn_netQrCode->setText(tr("插入网络二维码")); + isNetQrCode = false; + } + QString name = isNetQrCode? "networkQR.bmp" : ""; + ui->labName->setText(name); + // 使用外部通信,即认为是通过tcp更新,不可勾选自动刷新和计数器,条形码等功能 + ui->checkBoxAuto->setEnabled(!isNetQrCode); //自动更新 + ui->checkBoxAutoCount->setEnabled(!isNetQrCode);// 自动计数 + ui->barCodeCheckBox->setEnabled(!isNetQrCode);//条形码 + ui->comboBoxType->setEnabled(!isNetQrCode);//类型:只能使用QR 二维码 + ui->checkBoxInsertTime->setEnabled(!isNetQrCode); + ui->checkBoxAuto->setChecked(false); + ui->checkBoxAutoCount->setChecked(false); + ui->barCodeCheckBox->setChecked(false); + ui->comboBoxType->setCurrentIndex(1); + ui->checkBoxInsertTime->setChecked(false); + + noticeInsert(); + +} + +void dlgQrCode::slt_handleMessage(quint64 socketId, const QByteArray &data) +{ + Q_UNUSED(socketId) + if (!isNetQrCode) return; + QString dataStr = QString::fromUtf8(data); + + // 1. 更新界面输入框 + ui->lineEditIn->setText(dataStr); + ui->lineEditCNT->setText(""); + ui->lineEditIn2->setText(""); + ui->checkBox->setChecked(true); + flagInsert = 1; + + // 2. 生成新的二维码 + char *intext = (char *)malloc(data.size() + 1); + memcpy(intext, data.data(), data.size()); + intext[data.size()] = '\0'; // 结束符 + qrencode(intext, 1); // 生成到 img1 + free(intext); + + // 3. 保存文件 + QString fileName = "networkQR.bmp"; + this->pictureName = DOC_ROOT_DIR + fileName; + img1.save(pictureName); + + + // 5. 显示新的二维码到界面 + ShowQRCode(&img1); + + bcWidth = img1.width(); + bcHeight = img1.height(); + + ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height())); + + emit sig_updateNetworkQR(); +} +#endif diff --git a/dlgQrCode.h b/dlgQrCode.h index da17be4..b17bd0b 100644 --- a/dlgQrCode.h +++ b/dlgQrCode.h @@ -1,82 +1,82 @@ -#ifndef DLGQRCODE_H -#define DLGQRCODE_H - -#include -#include -#include "QtQREnCode/qrencode.h" -#include "QGraphicsScene" -#include "QGraphicsPixmapItem" -#include "SysPara.h" - -namespace Ui { - class dlgQrCode; -} - -class dlgQrCode : public QDialog -{ - Q_OBJECT - -public: - explicit dlgQrCode(QWidget *parent = 0); - ~dlgQrCode(); - //dlgQrCode(qrOption_t *qrOption); - - int bcWidth,bcHeight; - unsigned char flagInsert:1; - unsigned char flagCount:1; - unsigned char AutoCount11:1; - unsigned char barCodeFlag:1; //明码标志 - unsigned char NNNCC:5; - QString pictureName; - int QRCntNum; - void SetOption(qrOption_t *qrOption); - void GetOption(qrOption_t *qrOption); - void extSetText(QString text, bool flag = false); - QString TextToQRImg(qrOption_t *qrVar); - int getDat(SysPara * sysPara,int varNum); - unsigned long counter; - - void setCntCheckBoxHide(bool hideEn); - QString getCounterText( int counter,int QRCntNum); - void MatrixEnCode(unsigned char *intext,int Size); - void setSysPara(SysPara * sysPara); - -public slots: - void onTextChanged(); -signals: - void onQRCodeCloseNow(); - - void sig_clearAllQRCode(); - void sig_updateNetworkQR(); - -private slots: - void onQRCodeAuto(bool); - void on_pushBtnPreView_pressed(); - void on_pushBtnClose_pressed(); - void on_pushBtnSave_pressed(); - void onComboBoxType(int); - void on_comboBox_QRCodeLevel_currentIndexChanged(int index); - -#ifdef NETWORKQRCODE - void on_btn_netQrCode_clicked(); - void slt_handleMessage(quint64 socketId, const QByteArray &data); -#endif - -private: - void ShowQRCode(QImage *img); - QGraphicsScene *scene;//声明scene - QGraphicsPixmapItem *item;//声明item - qrOption_t *qrOption; - bool AutoRefresh; - Ui::dlgQrCode *ui; - SysPara * sysPara; - -#ifdef NETWORKQRCODE - TcpServer* m_tcpServer; - void initTcpServer(); - bool isNetQrCode = false; - void noticeInsert(); -#endif -}; - -#endif // DLGQRCODE_H +#ifndef DLGQRCODE_H +#define DLGQRCODE_H + +#include +#include +#include "QtQREnCode/qrencode.h" +#include "QGraphicsScene" +#include "QGraphicsPixmapItem" +#include "SysPara.h" + +namespace Ui { + class dlgQrCode; +} + +class dlgQrCode : public QDialog +{ + Q_OBJECT + +public: + explicit dlgQrCode(QWidget *parent = 0); + ~dlgQrCode(); + //dlgQrCode(qrOption_t *qrOption); + + int bcWidth,bcHeight; + unsigned char flagInsert:1; + unsigned char flagCount:1; + unsigned char AutoCount11:1; + unsigned char barCodeFlag:1; //明码标志 + unsigned char NNNCC:5; + QString pictureName; + int QRCntNum; + void SetOption(qrOption_t *qrOption); + void GetOption(qrOption_t *qrOption); + void extSetText(QString text, bool flag = false); + QString TextToQRImg(qrOption_t *qrVar); + int getDat(SysPara * sysPara,int varNum); + unsigned long counter; + + void setCntCheckBoxHide(bool hideEn); + QString getCounterText( int counter,int QRCntNum); + void MatrixEnCode(unsigned char *intext,int Size); + void setSysPara(SysPara * sysPara); + +public slots: + void onTextChanged(); +signals: + void onQRCodeCloseNow(); + + void sig_clearAllQRCode(); + void sig_updateNetworkQR(); + +private slots: + void onQRCodeAuto(bool); + void on_pushBtnPreView_pressed(); + void on_pushBtnClose_pressed(); + void on_pushBtnSave_pressed(); + void onComboBoxType(int); + void on_comboBox_QRCodeLevel_currentIndexChanged(int index); + +#ifdef NETWORKQRCODE + void on_btn_netQrCode_clicked(); + void slt_handleMessage(quint64 socketId, const QByteArray &data); +#endif + +private: + void ShowQRCode(QImage *img); + QGraphicsScene *scene;//声明scene + QGraphicsPixmapItem *item;//声明item + qrOption_t *qrOption; + bool AutoRefresh; + Ui::dlgQrCode *ui; + SysPara * sysPara; + +#ifdef NETWORKQRCODE + TcpServer* m_tcpServer; + void initTcpServer(); + bool isNetQrCode = false; + void noticeInsert(); +#endif +}; + +#endif // DLGQRCODE_H diff --git a/dlgQrCode.ui b/dlgQrCode.ui index 5b9544acc..e501620 100644 --- a/dlgQrCode.ui +++ b/dlgQrCode.ui @@ -1,390 +1,390 @@ - - - dlgQrCode - - - - 0 - 0 - 626 - 358 - - - - Qt::StrongFocus - - - Qt::NoContextMenu - - - Dialog - - - - :/icon/bypm.png:/icon/bypm.png - - - false - - - - - - - - - 0 - 0 - - - - 条形码 - - - - - - - - 16777215 - 600 - - - - - - - - - - - 正相打印 - - - - - 反相打印 - - - - - - - - 预览 - - - - - - - - 120 - 0 - - - - 返回 - - - - - - - 保存 - - - - - - - - DataMatrix - - - - - QRCode - - - - - - - - - - - 120 - 16777215 - - - - 变量增量 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 80 - 16777215 - - - - Qt::ImhDigitsOnly - - - 4 - - - - - - - - - - 16777215 - 25 - - - - 插入网络二维码 - - - - - - - - - - - TextLabel - - - - - - - 计数器(变量) - - - - - - - 自动刷新 - - - - - - - 插入文档 - - - - - - - - 120 - 0 - - - - - 160 - 16777215 - - - - TextLabel - - - - - - - - - DM码尺寸: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 默认 - - - - - 8 x 18 - - - - - 8 x 32 - - - - - 12 x 26 - - - - - 12 x 36 - - - - - 16 x 36 - - - - - 16 x 48 - - - - - - - - - 低级 - - - - - 中级 - - - - - 高级 - - - - - 超高级 - - - - - - - - - 0 - 0 - - - - 自动插入时间 - - - - - - - - - - - 信息前缀 - - - - - - - - - - 80 - 16777215 - - - - Qt::ImhDigitsOnly - - - 10 - - - - - - - 变量(初值) - - - - - - - 80 - - - - - - - 100 - - - - - - - - - 信息后缀 - - - - - - - - - - - false - - - 200 - - - true - - - - - - - - - - - - + + + dlgQrCode + + + + 0 + 0 + 626 + 358 + + + + Qt::StrongFocus + + + Qt::NoContextMenu + + + Dialog + + + + :/icon/bypm.png:/icon/bypm.png + + + false + + + + + + + + + 0 + 0 + + + + 条形码 + + + + + + + + 16777215 + 600 + + + + + + + + + + + 正相打印 + + + + + 反相打印 + + + + + + + + 预览 + + + + + + + + 120 + 0 + + + + 返回 + + + + + + + 保存 + + + + + + + + DataMatrix + + + + + QRCode + + + + + + + + + + + 120 + 16777215 + + + + 变量增量 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 80 + 16777215 + + + + Qt::ImhDigitsOnly + + + 4 + + + + + + + + + + 16777215 + 25 + + + + 插入网络二维码 + + + + + + + + + + + TextLabel + + + + + + + 计数器(变量) + + + + + + + 自动刷新 + + + + + + + 插入文档 + + + + + + + + 120 + 0 + + + + + 160 + 16777215 + + + + TextLabel + + + + + + + + + DM码尺寸: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 默认 + + + + + 8 x 18 + + + + + 8 x 32 + + + + + 12 x 26 + + + + + 12 x 36 + + + + + 16 x 36 + + + + + 16 x 48 + + + + + + + + + 低级 + + + + + 中级 + + + + + 高级 + + + + + 超高级 + + + + + + + + + 0 + 0 + + + + 自动插入时间 + + + + + + + + + + + 信息前缀 + + + + + + + + + + 80 + 16777215 + + + + Qt::ImhDigitsOnly + + + 10 + + + + + + + 变量(初值) + + + + + + + 80 + + + + + + + 100 + + + + + + + + + 信息后缀 + + + + + + + + + + + false + + + 200 + + + true + + + + + + + + + + + + diff --git a/dlgdrawinit.cpp b/dlgdrawinit.cpp index c9bef93..508ded0 100644 --- a/dlgdrawinit.cpp +++ b/dlgdrawinit.cpp @@ -1,37 +1,37 @@ -#include "dlgdrawinit.h" -#include "ui_dlgdrawinit.h" -#include "MyInputMethod.h" -dlgDrawInit::dlgDrawInit(QWidget *parent) : - QDialog(parent), - ui(new Ui::dlgDrawInit) -{ - ui->setupUi(this); -} - -dlgDrawInit::~dlgDrawInit() -{ - delete ui; -} - -int dlgDrawInit::getWidth(){ - return ui->spinBoxWidth->value(); -} - -int dlgDrawInit::getHeight(){ - return ui->spinBoxHeight->value(); -} - -int dlgDrawInit::setWidth(int w){ - ui->spinBoxWidth->setValue(w); - return w; -} -int dlgDrawInit::setHeight(int h){ - ui->spinBoxHeight->setValue(h); - return h; -} -void dlgDrawInit::on_pushButtonOK_pressed() -{ - -emit dlgDrawOK(); - -} +#include "dlgdrawinit.h" +#include "ui_dlgdrawinit.h" +#include "MyInputMethod.h" +dlgDrawInit::dlgDrawInit(QWidget *parent) : + QDialog(parent), + ui(new Ui::dlgDrawInit) +{ + ui->setupUi(this); +} + +dlgDrawInit::~dlgDrawInit() +{ + delete ui; +} + +int dlgDrawInit::getWidth(){ + return ui->spinBoxWidth->value(); +} + +int dlgDrawInit::getHeight(){ + return ui->spinBoxHeight->value(); +} + +int dlgDrawInit::setWidth(int w){ + ui->spinBoxWidth->setValue(w); + return w; +} +int dlgDrawInit::setHeight(int h){ + ui->spinBoxHeight->setValue(h); + return h; +} +void dlgDrawInit::on_pushButtonOK_pressed() +{ + +emit dlgDrawOK(); + +} diff --git a/dlgdrawinit.h b/dlgdrawinit.h index 90fa7c8..00c2d46 100644 --- a/dlgdrawinit.h +++ b/dlgdrawinit.h @@ -1,31 +1,31 @@ -#ifndef DLGDRAWINIT_H -#define DLGDRAWINIT_H -#include -#include -#include "MyInputMethod.h" - -namespace Ui { - class dlgDrawInit; -} - -class dlgDrawInit : public QDialog -{ - Q_OBJECT - -public: - explicit dlgDrawInit(QWidget *parent = 0); - ~dlgDrawInit(); - - int getWidth(); - int getHeight(); - int setWidth(int w); - int setHeight(int h); -public slots: - void on_pushButtonOK_pressed(); -Q_SIGNALS: - void dlgDrawOK(); -private: - Ui::dlgDrawInit *ui; -}; - -#endif // DLGDRAWINIT_H +#ifndef DLGDRAWINIT_H +#define DLGDRAWINIT_H +#include +#include +#include "MyInputMethod.h" + +namespace Ui { + class dlgDrawInit; +} + +class dlgDrawInit : public QDialog +{ + Q_OBJECT + +public: + explicit dlgDrawInit(QWidget *parent = 0); + ~dlgDrawInit(); + + int getWidth(); + int getHeight(); + int setWidth(int w); + int setHeight(int h); +public slots: + void on_pushButtonOK_pressed(); +Q_SIGNALS: + void dlgDrawOK(); +private: + Ui::dlgDrawInit *ui; +}; + +#endif // DLGDRAWINIT_H diff --git a/dlgdrawinit.ui b/dlgdrawinit.ui index b194894..3b826c1 100644 --- a/dlgdrawinit.ui +++ b/dlgdrawinit.ui @@ -1,73 +1,73 @@ - - - dlgDrawInit - - - - 0 - 0 - 318 - 186 - - - - Qt::StrongFocus - - - 图案参数设置 - - - - - 50 - 30 - 214 - 87 - - - - - - - - - - - - - 图案宽度(像素) - - - - - - - 图案高度(像素) - - - - - - - - - 180 - 130 - 80 - 35 - - - - - 0 - 35 - - - - 确定 - - - - - - + + + dlgDrawInit + + + + 0 + 0 + 318 + 186 + + + + Qt::StrongFocus + + + 图案参数设置 + + + + + 50 + 30 + 214 + 87 + + + + + + + + + + + + + 图案宽度(像素) + + + + + + + 图案高度(像素) + + + + + + + + + 180 + 130 + 80 + 35 + + + + + 0 + 35 + + + + 确定 + + + + + + diff --git a/dlginputaddr.cpp b/dlginputaddr.cpp index f5f2430..bac378e 100644 --- a/dlginputaddr.cpp +++ b/dlginputaddr.cpp @@ -1,823 +1,823 @@ -#include "dlginputaddr.h" -#include "ui_dlginputaddr.h" -#include -#include -#include -#include -#include -#include -#include -#include "qnamespace.h" -#include -#include -#include -#include -#include -#include -#include -// 修改超级密码,一周一变,增加校验码,且顺序改为 123C4DD -#define MAC_FILE_PATH "/home/plg/conf/mac.bin" - -DlgInputAddr::DlgInputAddr(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgInputAddr) -{ - ui->setupUi(this); - initTimer(); - connect(this,SIGNAL(changePowerCnt(QString )),ui->labPowerMinuteCnt,SLOT(setText(QString))); - connect(this,SIGNAL(changePrintCnt(QString )),ui->labPrintDotCnt,SLOT(setText(QString))); - curDate =QDate::currentDate(); - QDate curDate1; - curDate1.setDate(2017,11,13); - if(curDatelineEdit->setValidator(new QIntValidator(100000, 999999, this)); - ui->superNodeIp3->setValidator(new QIntValidator(1, 255, this)); - ui->superNodeIp2->setValidator(new QIntValidator(0, 255, this)); - ui->superNodeIp1->setValidator(new QIntValidator(0, 255, this)); - ui->superNodeIp0->setValidator(new QIntValidator(1, 255, this)); - - ui->edgeIp3->setValidator(new QIntValidator(1, 255, this)); - ui->edgeIp2->setValidator(new QIntValidator(0, 255, this)); - ui->edgeIp1->setValidator(new QIntValidator(0, 255, this)); - ui->edgeIp0->setValidator(new QIntValidator(1, 255, this)); - repairTimeLess = 0; - adjustSize(); - -} - - -DlgInputAddr::~DlgInputAddr() -{ - if (jd_timer) { - jd_timer->stop(); - jd_timer->deleteLater(); - jd_timer = nullptr; - } - delete ui; -} - -void DlgInputAddr::SetAddr() -{ - jd.addr = ui->lineEdit->text().toInt(0,10); - if(jd.addr < 100001 || jd.addr > 999999) jd.addr = 100001; - - //QStringList superNodeIpList = ui->superNodeIpEdit->text().split("."); - quint8 ip3 = ui->superNodeIp3->text().toInt(0,10); - quint8 ip2 = ui->superNodeIp2->text().toInt(0,10); - quint8 ip1 = ui->superNodeIp1->text().toInt(0,10); - quint8 ip0 = ui->superNodeIp0->text().toInt(0,10); - jd.superNodeIp = (ip3<<24) + (ip2<<16) + (ip1<<8) + ip0; - - ip3 = ui->edgeIp3->text().toInt(0,10); - ip2 = ui->edgeIp2->text().toInt(0,10); - ip1 = ui->edgeIp1->text().toInt(0,10); - ip0 = ui->edgeIp0->text().toInt(0,10); - jd.edgeIp = (ip3<<24) + (ip2<<16) + (ip1<<8) + ip0; - - SaveJm(); - SaveAddrBackup(); -} -void DlgInputAddr::vpnConnect() -{ - QStringList edgeArgList; - //QProcess edge - //edge -d n2n0 -c vernonbach -k encryptvb -a 10.0.0.11 -l xxx.xxx.xxx.xxx:1000 >/dev/null & - edgeArgList<<"-d"<<"n2n0"; - edgeArgList<<"-c"<<"vernonbach"; - edgeArgList<<"-k"<<"encryptvb"; - edgeArgList<<"-a"<>24)&0xFF).arg((jd.edgeIp>>16)&0xFF).arg((jd.edgeIp>>8)&0xFF).arg((jd.edgeIp)&0xFF); - edgeArgList<<"-l"<>24)&0xFF).arg((jd.superNodeIp>>16)&0xFF).arg((jd.superNodeIp>>8)&0xFF).arg((jd.superNodeIp)&0xFF); - edgeArgList<<">/dev/null &"; - QProcess::startDetached("edge",edgeArgList); -} - -QString DlgInputAddr::GetAddr() -{ - ReadJm(); - return ui->lineEdit->text(); -} - -void DlgInputAddr::SaveJm() -{ - QFile file("/lib/syst"); - if (file.isOpen()) { - file.close(); - } - jdDataRwLock.lockForWrite(); - if(!file.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - QMessageBox::warning(0,"警告",QString("无法打开文件 1") ); - } - else { - file.seek(0); - file.write((char *)&jd,(qint64)sizeof(jd)); - fsync(file.handle()); - file.close(); - } - jdDataRwLock.unlock(); -} - -void DlgInputAddr::ReadJm() -{ - QFile file("/lib/syst"); - QFile Macfile(MAC_FILE_PATH); - unsigned int addr; - - if(!Macfile.exists()) - { - if(!Macfile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") ); - } - } - - if(!file.exists()) - { - if(!file.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - QMessageBox::warning(0,"警告",QString("无法打开文件") ); - } - else { - file.close(); - ResetJm(); - show(); - } - } - else { - if (file.isOpen()) { - file.close(); - } - jdDataRwLock.lockForRead(); - if(!file.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - QMessageBox::warning(0,"警告",QString("无法打开文件") ); - } - else { - file.seek(0); - //file.read((char *)&jd.addr,(long long int)sizeof(jd)); - file.read((char *)&jd,(qint64)sizeof(jd)); - file.close(); - } -//////////////////// - if (Macfile.isOpen()) { - Macfile.close(); - } - //jdDataRwLock.lockForRead(); - if(!Macfile.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - //QMessageBox::warning(0,"警告",QString("无法打开文件") ); - } - else { - Macfile.seek(0); - //file.read((char *)&jd.addr,(long long int)sizeof(jd)); - Macfile.read((char *)&addr,(qint64)sizeof(addr)); - Macfile.close(); - } - - jdDataRwLock.unlock(); - } - if((jd.addr != addr) && (addr >= 100001 && addr <= 999999)){ - jd.addr = addr; - SaveJm(); - } - ui->lineEdit->setText(QString().sprintf("%06d",jd.addr) ); - ui->labPowerMax->setText(QString("%1").arg(jd.powerMinuteMax)); - ui->labPrintMax->setText(QString("%1").arg(jd.printMax)); - ui->labPowerMinuteCnt->setText(QString("%1").arg(jd.powerMinuteCnt)); - ui->labPrintDotCnt->setText(QString("%1").arg(jd.printCnt)); - ui->EditStartTime->setText(QString("%1").arg(jd.start)); - ui->EditEndTime->setText(QString("%1").arg(jd.end)); - - //qDebug()<<"jd.superNodeIp"<superNodeIp3->setText(QString::number((jd.superNodeIp>>24)&0xFF)); - ui->superNodeIp2->setText(QString::number((jd.superNodeIp>>16)&0xFF)); - ui->superNodeIp1->setText(QString::number((jd.superNodeIp>>8)&0xFF)); - ui->superNodeIp0->setText(QString::number((jd.superNodeIp)&0xFF)); - - ui->edgeIp3->setText(QString::number((jd.edgeIp>>24)&0xFF)); - ui->edgeIp2->setText(QString::number((jd.edgeIp>>16)&0xFF)); - ui->edgeIp1->setText(QString::number((jd.edgeIp>>8)&0xFF)); - ui->edgeIp0->setText(QString::number((jd.edgeIp)&0xFF)); - //ui->lineEditLanIP->setInputMask("119.23.201.56"); - -} - -void DlgInputAddr::setNodeIpAndPrivateIp(bool bNodeIpSetDone) -{ - ui->label->setVisible(bNodeIpSetDone); - ui->lineEdit->setEnabled(bNodeIpSetDone); - ui->lineEdit->setVisible(bNodeIpSetDone); - ui->label_2->setVisible(bNodeIpSetDone); - ui->EditStartTime->setEnabled(bNodeIpSetDone); - ui->EditStartTime->setVisible(bNodeIpSetDone); - ui->label_3->setVisible(bNodeIpSetDone); - ui->EditEndTime->setEnabled(bNodeIpSetDone); - ui->EditEndTime->setVisible(bNodeIpSetDone); - - ui->horizontalLayout->setEnabled(bNodeIpSetDone); - ui->labPowerMinuteCnt->setVisible(bNodeIpSetDone); - ui->labPowerMax->setVisible(bNodeIpSetDone); - ui->labPrintDotCnt->setVisible(bNodeIpSetDone); - ui->labPrintMax->setVisible(bNodeIpSetDone); - ui->line->setVisible(bNodeIpSetDone); - ui->line_2->setVisible(bNodeIpSetDone); - ui->line_3->setVisible(bNodeIpSetDone); - //adjustSize(); -} - -void DlgInputAddr::on_buttonBox_clicked(QAbstractButton *button) -{ - //QMessageBox::warning(0,"警告",QString("无法打开文件 3") ); - if(ui->buttonBox->button(QDialogButtonBox::Ok) == button) //判断按下的是否为"确定”按钮 - { - if(!ui->lineEdit->text().isEmpty()) //判断lineEdit是否为空,不为空返回0 - { - SetAddr(); - vpnConnect(); - emit changeMac(QString(" Mac:%1").arg(jd.addr)); - } - } - setNodeIpAndPrivateIp(true); - //else if(button == ui->buttonBox->button((QDialogButtonBox::Cancel))) - // ui->lineEdit->setText("001002"); -} -#define XXXX - -char DlgInputAddr::isEnabled()// check where is enable?10秒钟1次 -{ - char res=0; - static int cnt=0; - static char changTimeCnt=0; - - curDate =QDate::currentDate(); - unsigned int ndate = curDate.toString("yyyyMMdd").toInt(0,10); - - if(cnt<5) - { - cnt++; - if((jd.workout && jd.nDate<=jd.start) && ndate>=jd.start && ndate< jd.end ) - { - jd.nDate = ndate; - jd.workout =0; - SaveJm(); -// qDebug()<ndate ) { - res |=(1<<2); - if( jd.workout==0) - { - jd.nDate = ndate; - jd.workout =1; - SaveJm(); -// qDebug()<jd.end ) - { -// QString jdEnd = QString::number(jd.end); - -// QDateTime currentTime = QDateTime::currentDateTime(); -// QDateTime endTime = QDateTime::fromString(jdEnd, "yyyyMMdd"); -//// qDebug() << "currentTime.toTime_t()" << currentTime.toTime_t(); -//// qDebug() << "endTime.toTime_t(" << endTime.toTime_t(); - -// repairTimeLess = (endTime.toTime_t() - currentTime.toTime_t()) / (60*60); - -// emit printErrorStatus(QString(tr("Mac:%1维护时间剩余")+"%2").arg(jd.addr).arg(repairTimeLess)+tr("小时,喷码机将停止工作.请与供应商联系!"),2); - } - - //qDebug()<3) - { - changTimeCnt=0; - QTime time1= QTime::currentTime(); - //qDebug()<=jd.end); - else { - // jd.nDate = ndate; - // SaveJm(); - //qDebug()< -void adjustdate1(int year, int mon, int mday, int hour, int min, int sec) { - time_t t; - struct tm nowtime; - nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) - nowtime.tm_min = min; // Minutes.[0-59] - nowtime.tm_hour = hour; // Hours. [0-23] - nowtime.tm_mday = mday; // Day.[1-31] - nowtime.tm_mon = mon - 1; // Month. [0-11] - nowtime.tm_year = year - 1900; // Year- 1900. - nowtime.tm_isdst = -1; // DST.[-1/0/1] - t = mktime(&nowtime); - // qDebug()<start(10 * 1000); -} - -unsigned char DlgInputAddr::checkSupperJmOLD(QString str) -{ - QString s; - QDate curDate; - curDate =QDate::currentDate(); - s.sprintf("%04d%02d", curDate.year(),curDate.month()); - unsigned long m,n; - - - m= str.toLong(0,10); - n= mb_crc2(s,0xa001); - //qDebug()< -#include /*用到time函数和gmtime函数。*/ - -int getWeekNumber() -{ - int nweek = 0; - int wd = 0; - time_t t; /*声明time_t结构体 t 。*/ - struct tm *ptr; /*声明tm结构体指针。*/ - - time(&t); /*初始化time_t结构体t 。*/ - ptr = gmtime(&t); /*获得已初始化的tm结构体。*/ - nweek = ptr->tm_yday / 7 + 1; /*以1月1日那周为第1周。*/ - wd = ptr->tm_wday; /*算出今天是星期几。*/ - if (wd - ptr->tm_yday % 7 < 0)/*表示是新的一周。*/ - { - nweek++; - } - //printf("从1月1日算起今周是第 %d 周。\n", nweek); - - return nweek; -} -// 一时一变 -unsigned char DlgInputAddr::checkSupperInit(QString str) -{ - QString s; - QDate curDate; - curDate =QDate::currentDate(); - QTime curTime; - curTime = QTime::currentTime(); - s.sprintf("%04d%02d", curDate.year(), getWeekNumber()+curDate.day()+curTime.hour()); - unsigned long m,n; - - m= str.toLong(0,10); - n= mb_crc2(s,0xa061); - s.sprintf("%06ld",n*100+ (m%100)); - QString s2 =mb_crc8(s); - - if(mb_crc8(s) == str) - { - SetNewJm(enValidity(m,0xa061) ); - return 1; - } - return 0; -} - -// 一周一变 -unsigned char DlgInputAddr::checkSupperJm(QString str) -{ - QString s; - QDate curDate; - curDate =QDate::currentDate(); -// check crc - //s.sprintf("%04d%02d", curDate.year(), curDate.month()); - s.sprintf("%04d%02d", curDate.year(), getWeekNumber()); - unsigned long m,n; - - m= str.toLong(0,10); - n= mb_crc2(s,0xa001); - s.sprintf("%06ld",n*100+ (m%100)); - //qDebug()<>=1; - crc^=m; // - } - else crc>>=1; - } - } - return(crc ); -} - - -void DlgInputAddr::enCodeMsh(QString s) -{ - - -} - -void DlgInputAddr::SaveAddrBackup() -{ - QFile Macfile(MAC_FILE_PATH); - if (Macfile.isOpen()) { - Macfile.close(); - } - jdDataRwLock.lockForWrite(); - if(!Macfile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - //QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") ); - } - else { - Macfile.seek(0); - Macfile.write((char *)&jd,(qint64)sizeof(jd)); - fsync(Macfile.handle()); - Macfile.close(); - } - jdDataRwLock.unlock(); -} +#include "dlginputaddr.h" +#include "ui_dlginputaddr.h" +#include +#include +#include +#include +#include +#include +#include +#include "qnamespace.h" +#include +#include +#include +#include +#include +#include +#include +// 修改超级密码,一周一变,增加校验码,且顺序改为 123C4DD +#define MAC_FILE_PATH "/home/plg/conf/mac.bin" + +DlgInputAddr::DlgInputAddr(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgInputAddr) +{ + ui->setupUi(this); + initTimer(); + connect(this,SIGNAL(changePowerCnt(QString )),ui->labPowerMinuteCnt,SLOT(setText(QString))); + connect(this,SIGNAL(changePrintCnt(QString )),ui->labPrintDotCnt,SLOT(setText(QString))); + curDate =QDate::currentDate(); + QDate curDate1; + curDate1.setDate(2017,11,13); + if(curDatelineEdit->setValidator(new QIntValidator(100000, 999999, this)); + ui->superNodeIp3->setValidator(new QIntValidator(1, 255, this)); + ui->superNodeIp2->setValidator(new QIntValidator(0, 255, this)); + ui->superNodeIp1->setValidator(new QIntValidator(0, 255, this)); + ui->superNodeIp0->setValidator(new QIntValidator(1, 255, this)); + + ui->edgeIp3->setValidator(new QIntValidator(1, 255, this)); + ui->edgeIp2->setValidator(new QIntValidator(0, 255, this)); + ui->edgeIp1->setValidator(new QIntValidator(0, 255, this)); + ui->edgeIp0->setValidator(new QIntValidator(1, 255, this)); + repairTimeLess = 0; + adjustSize(); + +} + + +DlgInputAddr::~DlgInputAddr() +{ + if (jd_timer) { + jd_timer->stop(); + jd_timer->deleteLater(); + jd_timer = nullptr; + } + delete ui; +} + +void DlgInputAddr::SetAddr() +{ + jd.addr = ui->lineEdit->text().toInt(0,10); + if(jd.addr < 100001 || jd.addr > 999999) jd.addr = 100001; + + //QStringList superNodeIpList = ui->superNodeIpEdit->text().split("."); + quint8 ip3 = ui->superNodeIp3->text().toInt(0,10); + quint8 ip2 = ui->superNodeIp2->text().toInt(0,10); + quint8 ip1 = ui->superNodeIp1->text().toInt(0,10); + quint8 ip0 = ui->superNodeIp0->text().toInt(0,10); + jd.superNodeIp = (ip3<<24) + (ip2<<16) + (ip1<<8) + ip0; + + ip3 = ui->edgeIp3->text().toInt(0,10); + ip2 = ui->edgeIp2->text().toInt(0,10); + ip1 = ui->edgeIp1->text().toInt(0,10); + ip0 = ui->edgeIp0->text().toInt(0,10); + jd.edgeIp = (ip3<<24) + (ip2<<16) + (ip1<<8) + ip0; + + SaveJm(); + SaveAddrBackup(); +} +void DlgInputAddr::vpnConnect() +{ + QStringList edgeArgList; + //QProcess edge + //edge -d n2n0 -c vernonbach -k encryptvb -a 10.0.0.11 -l xxx.xxx.xxx.xxx:1000 >/dev/null & + edgeArgList<<"-d"<<"n2n0"; + edgeArgList<<"-c"<<"vernonbach"; + edgeArgList<<"-k"<<"encryptvb"; + edgeArgList<<"-a"<>24)&0xFF).arg((jd.edgeIp>>16)&0xFF).arg((jd.edgeIp>>8)&0xFF).arg((jd.edgeIp)&0xFF); + edgeArgList<<"-l"<>24)&0xFF).arg((jd.superNodeIp>>16)&0xFF).arg((jd.superNodeIp>>8)&0xFF).arg((jd.superNodeIp)&0xFF); + edgeArgList<<">/dev/null &"; + QProcess::startDetached("edge",edgeArgList); +} + +QString DlgInputAddr::GetAddr() +{ + ReadJm(); + return ui->lineEdit->text(); +} + +void DlgInputAddr::SaveJm() +{ + QFile file("/lib/syst"); + if (file.isOpen()) { + file.close(); + } + jdDataRwLock.lockForWrite(); + if(!file.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + QMessageBox::warning(0,"警告",QString("无法打开文件 1") ); + } + else { + file.seek(0); + file.write((char *)&jd,(qint64)sizeof(jd)); + fsync(file.handle()); + file.close(); + } + jdDataRwLock.unlock(); +} + +void DlgInputAddr::ReadJm() +{ + QFile file("/lib/syst"); + QFile Macfile(MAC_FILE_PATH); + unsigned int addr; + + if(!Macfile.exists()) + { + if(!Macfile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") ); + } + } + + if(!file.exists()) + { + if(!file.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + QMessageBox::warning(0,"警告",QString("无法打开文件") ); + } + else { + file.close(); + ResetJm(); + show(); + } + } + else { + if (file.isOpen()) { + file.close(); + } + jdDataRwLock.lockForRead(); + if(!file.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + QMessageBox::warning(0,"警告",QString("无法打开文件") ); + } + else { + file.seek(0); + //file.read((char *)&jd.addr,(long long int)sizeof(jd)); + file.read((char *)&jd,(qint64)sizeof(jd)); + file.close(); + } +//////////////////// + if (Macfile.isOpen()) { + Macfile.close(); + } + //jdDataRwLock.lockForRead(); + if(!Macfile.open(QIODevice::ReadOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + //QMessageBox::warning(0,"警告",QString("无法打开文件") ); + } + else { + Macfile.seek(0); + //file.read((char *)&jd.addr,(long long int)sizeof(jd)); + Macfile.read((char *)&addr,(qint64)sizeof(addr)); + Macfile.close(); + } + + jdDataRwLock.unlock(); + } + if((jd.addr != addr) && (addr >= 100001 && addr <= 999999)){ + jd.addr = addr; + SaveJm(); + } + ui->lineEdit->setText(QString().sprintf("%06d",jd.addr) ); + ui->labPowerMax->setText(QString("%1").arg(jd.powerMinuteMax)); + ui->labPrintMax->setText(QString("%1").arg(jd.printMax)); + ui->labPowerMinuteCnt->setText(QString("%1").arg(jd.powerMinuteCnt)); + ui->labPrintDotCnt->setText(QString("%1").arg(jd.printCnt)); + ui->EditStartTime->setText(QString("%1").arg(jd.start)); + ui->EditEndTime->setText(QString("%1").arg(jd.end)); + + //qDebug()<<"jd.superNodeIp"<superNodeIp3->setText(QString::number((jd.superNodeIp>>24)&0xFF)); + ui->superNodeIp2->setText(QString::number((jd.superNodeIp>>16)&0xFF)); + ui->superNodeIp1->setText(QString::number((jd.superNodeIp>>8)&0xFF)); + ui->superNodeIp0->setText(QString::number((jd.superNodeIp)&0xFF)); + + ui->edgeIp3->setText(QString::number((jd.edgeIp>>24)&0xFF)); + ui->edgeIp2->setText(QString::number((jd.edgeIp>>16)&0xFF)); + ui->edgeIp1->setText(QString::number((jd.edgeIp>>8)&0xFF)); + ui->edgeIp0->setText(QString::number((jd.edgeIp)&0xFF)); + //ui->lineEditLanIP->setInputMask("119.23.201.56"); + +} + +void DlgInputAddr::setNodeIpAndPrivateIp(bool bNodeIpSetDone) +{ + ui->label->setVisible(bNodeIpSetDone); + ui->lineEdit->setEnabled(bNodeIpSetDone); + ui->lineEdit->setVisible(bNodeIpSetDone); + ui->label_2->setVisible(bNodeIpSetDone); + ui->EditStartTime->setEnabled(bNodeIpSetDone); + ui->EditStartTime->setVisible(bNodeIpSetDone); + ui->label_3->setVisible(bNodeIpSetDone); + ui->EditEndTime->setEnabled(bNodeIpSetDone); + ui->EditEndTime->setVisible(bNodeIpSetDone); + + ui->horizontalLayout->setEnabled(bNodeIpSetDone); + ui->labPowerMinuteCnt->setVisible(bNodeIpSetDone); + ui->labPowerMax->setVisible(bNodeIpSetDone); + ui->labPrintDotCnt->setVisible(bNodeIpSetDone); + ui->labPrintMax->setVisible(bNodeIpSetDone); + ui->line->setVisible(bNodeIpSetDone); + ui->line_2->setVisible(bNodeIpSetDone); + ui->line_3->setVisible(bNodeIpSetDone); + //adjustSize(); +} + +void DlgInputAddr::on_buttonBox_clicked(QAbstractButton *button) +{ + //QMessageBox::warning(0,"警告",QString("无法打开文件 3") ); + if(ui->buttonBox->button(QDialogButtonBox::Ok) == button) //判断按下的是否为"确定”按钮 + { + if(!ui->lineEdit->text().isEmpty()) //判断lineEdit是否为空,不为空返回0 + { + SetAddr(); + vpnConnect(); + emit changeMac(QString(" Mac:%1").arg(jd.addr)); + } + } + setNodeIpAndPrivateIp(true); + //else if(button == ui->buttonBox->button((QDialogButtonBox::Cancel))) + // ui->lineEdit->setText("001002"); +} +#define XXXX + +char DlgInputAddr::isEnabled()// check where is enable?10秒钟1次 +{ + char res=0; + static int cnt=0; + static char changTimeCnt=0; + + curDate =QDate::currentDate(); + unsigned int ndate = curDate.toString("yyyyMMdd").toInt(0,10); + + if(cnt<5) + { + cnt++; + if((jd.workout && jd.nDate<=jd.start) && ndate>=jd.start && ndate< jd.end ) + { + jd.nDate = ndate; + jd.workout =0; + SaveJm(); +// qDebug()<ndate ) { + res |=(1<<2); + if( jd.workout==0) + { + jd.nDate = ndate; + jd.workout =1; + SaveJm(); +// qDebug()<jd.end ) + { +// QString jdEnd = QString::number(jd.end); + +// QDateTime currentTime = QDateTime::currentDateTime(); +// QDateTime endTime = QDateTime::fromString(jdEnd, "yyyyMMdd"); +//// qDebug() << "currentTime.toTime_t()" << currentTime.toTime_t(); +//// qDebug() << "endTime.toTime_t(" << endTime.toTime_t(); + +// repairTimeLess = (endTime.toTime_t() - currentTime.toTime_t()) / (60*60); + +// emit printErrorStatus(QString(tr("Mac:%1维护时间剩余")+"%2").arg(jd.addr).arg(repairTimeLess)+tr("小时,喷码机将停止工作.请与供应商联系!"),2); + } + + //qDebug()<3) + { + changTimeCnt=0; + QTime time1= QTime::currentTime(); + //qDebug()<=jd.end); + else { + // jd.nDate = ndate; + // SaveJm(); + //qDebug()< +void adjustdate1(int year, int mon, int mday, int hour, int min, int sec) { + time_t t; + struct tm nowtime; + nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second) + nowtime.tm_min = min; // Minutes.[0-59] + nowtime.tm_hour = hour; // Hours. [0-23] + nowtime.tm_mday = mday; // Day.[1-31] + nowtime.tm_mon = mon - 1; // Month. [0-11] + nowtime.tm_year = year - 1900; // Year- 1900. + nowtime.tm_isdst = -1; // DST.[-1/0/1] + t = mktime(&nowtime); + // qDebug()<start(10 * 1000); +} + +unsigned char DlgInputAddr::checkSupperJmOLD(QString str) +{ + QString s; + QDate curDate; + curDate =QDate::currentDate(); + s.sprintf("%04d%02d", curDate.year(),curDate.month()); + unsigned long m,n; + + + m= str.toLong(0,10); + n= mb_crc2(s,0xa001); + //qDebug()< +#include /*用到time函数和gmtime函数。*/ + +int getWeekNumber() +{ + int nweek = 0; + int wd = 0; + time_t t; /*声明time_t结构体 t 。*/ + struct tm *ptr; /*声明tm结构体指针。*/ + + time(&t); /*初始化time_t结构体t 。*/ + ptr = gmtime(&t); /*获得已初始化的tm结构体。*/ + nweek = ptr->tm_yday / 7 + 1; /*以1月1日那周为第1周。*/ + wd = ptr->tm_wday; /*算出今天是星期几。*/ + if (wd - ptr->tm_yday % 7 < 0)/*表示是新的一周。*/ + { + nweek++; + } + //printf("从1月1日算起今周是第 %d 周。\n", nweek); + + return nweek; +} +// 一时一变 +unsigned char DlgInputAddr::checkSupperInit(QString str) +{ + QString s; + QDate curDate; + curDate =QDate::currentDate(); + QTime curTime; + curTime = QTime::currentTime(); + s.sprintf("%04d%02d", curDate.year(), getWeekNumber()+curDate.day()+curTime.hour()); + unsigned long m,n; + + m= str.toLong(0,10); + n= mb_crc2(s,0xa061); + s.sprintf("%06ld",n*100+ (m%100)); + QString s2 =mb_crc8(s); + + if(mb_crc8(s) == str) + { + SetNewJm(enValidity(m,0xa061) ); + return 1; + } + return 0; +} + +// 一周一变 +unsigned char DlgInputAddr::checkSupperJm(QString str) +{ + QString s; + QDate curDate; + curDate =QDate::currentDate(); +// check crc + //s.sprintf("%04d%02d", curDate.year(), curDate.month()); + s.sprintf("%04d%02d", curDate.year(), getWeekNumber()); + unsigned long m,n; + + m= str.toLong(0,10); + n= mb_crc2(s,0xa001); + s.sprintf("%06ld",n*100+ (m%100)); + //qDebug()<>=1; + crc^=m; // + } + else crc>>=1; + } + } + return(crc ); +} + + +void DlgInputAddr::enCodeMsh(QString s) +{ + + +} + +void DlgInputAddr::SaveAddrBackup() +{ + QFile Macfile(MAC_FILE_PATH); + if (Macfile.isOpen()) { + Macfile.close(); + } + jdDataRwLock.lockForWrite(); + if(!Macfile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + //QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") ); + } + else { + Macfile.seek(0); + Macfile.write((char *)&jd,(qint64)sizeof(jd)); + fsync(Macfile.handle()); + Macfile.close(); + } + jdDataRwLock.unlock(); +} diff --git a/dlginputaddr.h b/dlginputaddr.h index c5ed4b3..f81a245 100644 --- a/dlginputaddr.h +++ b/dlginputaddr.h @@ -1,90 +1,90 @@ -#ifndef DLGINPUTADDR_H -#define DLGINPUTADDR_H -#include -#include "myinclude.h" -#include -#include -#include - -#include -#include -typedef struct { // 28B - unsigned int addr; - unsigned char enable; //1Byte - unsigned char validity; // 1Byte - unsigned char powerEn; // 1Byte - unsigned char printEn; // 1Byte - - unsigned int powerMinuteMax; - unsigned int powerMinuteCnt; - unsigned int printMax; - unsigned int printCnt; // printDot/1024 - - unsigned int start;// yyyymmdd - unsigned int end; // yyyymmdd - unsigned int nDate; - unsigned int workout; - unsigned int nc; - unsigned int superNodeIp; - unsigned int edgeIp; -}JMDATA; - -namespace Ui { - class DlgInputAddr; -} - -class DlgInputAddr : public QDialog -{ - Q_OBJECT - -public: - explicit DlgInputAddr(QWidget *parent = 0); - ~DlgInputAddr(); - - void SetAddr(); - QString GetAddr(); - void vpnConnect(); - void SaveJm(); - void ReadJm(); - void SaveAddrBackup(); - void workcnt(); - char isEnabled(); - void ResetJm(); - JMDATA jd; - void SetNewJm(unsigned int validity); - unsigned char checWhJmDate(QString s );// 日期维护 - unsigned char checWhJm(QString s );// 维护 - unsigned char checWhJmOLD(QString s );// 维护1 - unsigned char checkSupperJm(QString s );// 超级 - unsigned char checkSupperJmOLD(QString s );// 超级1 - void enCodeMsh(QString s );// 墨水 - unsigned char checkSysJm(QString str); - unsigned long mb_crc2(QString str, unsigned int x); - unsigned int mb_crc1(QString s, unsigned int m); - unsigned int enValidity(unsigned long m,unsigned int xx); - void CheckDate(); - unsigned char checkSupperInit(QString str); - void setNodeIpAndPrivateIp(bool bNodeIpSetDone); - unsigned int repairTimeLess; -private slots: - void on_buttonBox_clicked(QAbstractButton *button); - void setTime(int year, int mon, int mday, int hour, int min, int sec); - - void jd_timerHandler(); - -Q_SIGNALS: - void changePowerCnt(QString ); - void changePrintCnt(QString ); - void dateError(QString); - void printErrorStatus(QString,unsigned int); - void changeMac(QString); -private: - Ui::DlgInputAddr *ui; - QDate curDate; - QReadWriteLock jdDataRwLock; - - QTimer* jd_timer = nullptr; - void initTimer(); -}; - -#endif // DLGINPUTADDR_H +#ifndef DLGINPUTADDR_H +#define DLGINPUTADDR_H +#include +#include "myinclude.h" +#include +#include +#include + +#include +#include +typedef struct { // 28B + unsigned int addr; + unsigned char enable; //1Byte + unsigned char validity; // 1Byte + unsigned char powerEn; // 1Byte + unsigned char printEn; // 1Byte + + unsigned int powerMinuteMax; + unsigned int powerMinuteCnt; + unsigned int printMax; + unsigned int printCnt; // printDot/1024 + + unsigned int start;// yyyymmdd + unsigned int end; // yyyymmdd + unsigned int nDate; + unsigned int workout; + unsigned int nc; + unsigned int superNodeIp; + unsigned int edgeIp; +}JMDATA; + +namespace Ui { + class DlgInputAddr; +} + +class DlgInputAddr : public QDialog +{ + Q_OBJECT + +public: + explicit DlgInputAddr(QWidget *parent = 0); + ~DlgInputAddr(); + + void SetAddr(); + QString GetAddr(); + void vpnConnect(); + void SaveJm(); + void ReadJm(); + void SaveAddrBackup(); + void workcnt(); + char isEnabled(); + void ResetJm(); + JMDATA jd; + void SetNewJm(unsigned int validity); + unsigned char checWhJmDate(QString s );// 日期维护 + unsigned char checWhJm(QString s );// 维护 + unsigned char checWhJmOLD(QString s );// 维护1 + unsigned char checkSupperJm(QString s );// 超级 + unsigned char checkSupperJmOLD(QString s );// 超级1 + void enCodeMsh(QString s );// 墨水 + unsigned char checkSysJm(QString str); + unsigned long mb_crc2(QString str, unsigned int x); + unsigned int mb_crc1(QString s, unsigned int m); + unsigned int enValidity(unsigned long m,unsigned int xx); + void CheckDate(); + unsigned char checkSupperInit(QString str); + void setNodeIpAndPrivateIp(bool bNodeIpSetDone); + unsigned int repairTimeLess; +private slots: + void on_buttonBox_clicked(QAbstractButton *button); + void setTime(int year, int mon, int mday, int hour, int min, int sec); + + void jd_timerHandler(); + +Q_SIGNALS: + void changePowerCnt(QString ); + void changePrintCnt(QString ); + void dateError(QString); + void printErrorStatus(QString,unsigned int); + void changeMac(QString); +private: + Ui::DlgInputAddr *ui; + QDate curDate; + QReadWriteLock jdDataRwLock; + + QTimer* jd_timer = nullptr; + void initTimer(); +}; + +#endif // DLGINPUTADDR_H diff --git a/dlginputaddr.ui b/dlginputaddr.ui index d016f7f..1e2f7c3 100644 --- a/dlginputaddr.ui +++ b/dlginputaddr.ui @@ -1,290 +1,290 @@ - - - DlgInputAddr - - - - 0 - 0 - 319 - 297 - - - - Dialog - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Qt::ImhNone - - - 6 - - - - - - - 请输入6位机编号(前3位为经销商编号) - - - - - - - - - PowerOnCnt - - - - - - - Qt::Vertical - - - - - - - PrintDotCnt - - - - - - - Qt::Vertical - - - - - - - PowerMax - - - - - - - Qt::Vertical - - - - - - - PrintMax - - - - - - - - - - - 开始时间 - - - - - - - true - - - - - - - 结束时间 - - - - - - - true - - - - - - - - - SuperNodeIP: - - - - - - - edgeIP: - - - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - . - - - - - - - 3 - - - - - - - - - - - - - buttonBox - accepted() - DlgInputAddr - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DlgInputAddr - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DlgInputAddr + + + + 0 + 0 + 319 + 297 + + + + Dialog + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Qt::ImhNone + + + 6 + + + + + + + 请输入6位机编号(前3位为经销商编号) + + + + + + + + + PowerOnCnt + + + + + + + Qt::Vertical + + + + + + + PrintDotCnt + + + + + + + Qt::Vertical + + + + + + + PowerMax + + + + + + + Qt::Vertical + + + + + + + PrintMax + + + + + + + + + + + 开始时间 + + + + + + + true + + + + + + + 结束时间 + + + + + + + true + + + + + + + + + SuperNodeIP: + + + + + + + edgeIP: + + + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + . + + + + + + + 3 + + + + + + + + + + + + + buttonBox + accepted() + DlgInputAddr + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DlgInputAddr + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dlgmutilanguage.cpp b/dlgmutilanguage.cpp index a857f87..9cea14b 100644 --- a/dlgmutilanguage.cpp +++ b/dlgmutilanguage.cpp @@ -1,120 +1,120 @@ -#include "dlgmutilanguage.h" -#include "ui_dlgmutilanguage.h" -#include "InputMethod.h" -#include -#include - -DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgMutiLanguage) -{ - ui->setupUi(this); -// ui->listWidget->hide(); - connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage())); - LangIndex=INPUT_METHOD_TYPE_CHINESE; -} - -DlgMutiLanguage::~DlgMutiLanguage() -{ - delete ui; -} - -void DlgMutiLanguage::setCurrentLanguage(){ - - if(LangIndex==INPUT_METHOD_TYPE_ENGLISH) ui->radioButton_2->setChecked(true); - else if(LangIndex==INPUT_METHOD_TYPE_CHINESE) ui->radioButton->setChecked(true); - else if(LangIndex==INPUT_METHOD_TYPE_VIETNAM) ui->radioButton_3->setChecked(true); - //else if(LangIndex==INPUT_METHOD_TYPE_RUSSIAN) ui->radioButton_4->setChecked(true); - //else if(LangIndex==INPUT_METHOD_TYPE_JAPANESE) ui->radioButton_5->setChecked(true); - //else if(LangIndex==INPUT_METHOD_TYPE_KOREAN) ui->radioButton_6->setChecked(true); - else ui->radioButton->setChecked(true); - -} - -int DlgMutiLanguage::getCurrentLanguage(){ -// LangIndex = INPUT_METHOD_TYPE_CHINESE; -// if(ui->radioButton_2->isChecked()) { -// LangIndex = INPUT_METHOD_TYPE_ENGLISH; -// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面")); -// buf.append("English\r\n"); -// buf.append("WINPY_utf8.txt\r\n"); -// } -// else if(ui->radioButton_3->isChecked()) { -// LangIndex = INPUT_METHOD_TYPE_VIETNAM; -// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面")); -// buf.append("Vietnamese\r\n"); -// buf.append("YN_utf8.txt\r\n"); -// } -// /*else if(ui->radioButton->isChecked()) { - -// } -// else if(ui->radioButton->isChecked()) { - -// } -// else if(ui->radioButton->isChecked()) { - -// }*/ -// else { -// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面")); -// buf.append("Chinese\r\n"); -// buf.append("WINPY_utf8.txt\r\n"); -// } - return LangIndex; -} -void DlgMutiLanguage::SetNewLanguage(){ - - LangIndex = INPUT_METHOD_TYPE_CHINESE; - - QFile file("/home/plg/UseEn"); - - QByteArray buf; - buf.clear(); - - if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 - - - if(ui->radioButton_2->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_ENGLISH; - buf.append("English\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_3->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_VIETNAM; - buf.append("Turkish\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_4->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_SPANISH; - buf.append("Spanish\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_5->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_THAI; - buf.append("Thai\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_6->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_VIETNAM; - buf.append("Vietnamese\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_7->isChecked()) { - LangIndex = INPUT_METHOD_TYPE_Farsi; - buf.append("Farsi\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else if(ui->radioButton_korean->isChecked()){ - LangIndex = INPUT_METHOD_TYPE_KOREAN; - buf.append("korean\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - else { - buf.append("Chinese\r\n"); - buf.append("WINPY_utf8.txt\r\n"); - } - file.write(buf); - fsync(file.handle()); - file.close(); - - } -} +#include "dlgmutilanguage.h" +#include "ui_dlgmutilanguage.h" +#include "InputMethod.h" +#include +#include + +DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgMutiLanguage) +{ + ui->setupUi(this); +// ui->listWidget->hide(); + connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage())); + LangIndex=INPUT_METHOD_TYPE_CHINESE; +} + +DlgMutiLanguage::~DlgMutiLanguage() +{ + delete ui; +} + +void DlgMutiLanguage::setCurrentLanguage(){ + + if(LangIndex==INPUT_METHOD_TYPE_ENGLISH) ui->radioButton_2->setChecked(true); + else if(LangIndex==INPUT_METHOD_TYPE_CHINESE) ui->radioButton->setChecked(true); + else if(LangIndex==INPUT_METHOD_TYPE_VIETNAM) ui->radioButton_3->setChecked(true); + //else if(LangIndex==INPUT_METHOD_TYPE_RUSSIAN) ui->radioButton_4->setChecked(true); + //else if(LangIndex==INPUT_METHOD_TYPE_JAPANESE) ui->radioButton_5->setChecked(true); + //else if(LangIndex==INPUT_METHOD_TYPE_KOREAN) ui->radioButton_6->setChecked(true); + else ui->radioButton->setChecked(true); + +} + +int DlgMutiLanguage::getCurrentLanguage(){ +// LangIndex = INPUT_METHOD_TYPE_CHINESE; +// if(ui->radioButton_2->isChecked()) { +// LangIndex = INPUT_METHOD_TYPE_ENGLISH; +// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面")); +// buf.append("English\r\n"); +// buf.append("WINPY_utf8.txt\r\n"); +// } +// else if(ui->radioButton_3->isChecked()) { +// LangIndex = INPUT_METHOD_TYPE_VIETNAM; +// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面")); +// buf.append("Vietnamese\r\n"); +// buf.append("YN_utf8.txt\r\n"); +// } +// /*else if(ui->radioButton->isChecked()) { + +// } +// else if(ui->radioButton->isChecked()) { + +// } +// else if(ui->radioButton->isChecked()) { + +// }*/ +// else { +// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面")); +// buf.append("Chinese\r\n"); +// buf.append("WINPY_utf8.txt\r\n"); +// } + return LangIndex; +} +void DlgMutiLanguage::SetNewLanguage(){ + + LangIndex = INPUT_METHOD_TYPE_CHINESE; + + QFile file("/home/plg/UseEn"); + + QByteArray buf; + buf.clear(); + + if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 + + + if(ui->radioButton_2->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_ENGLISH; + buf.append("English\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_3->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_VIETNAM; + buf.append("Turkish\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_4->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_SPANISH; + buf.append("Spanish\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_5->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_THAI; + buf.append("Thai\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_6->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_VIETNAM; + buf.append("Vietnamese\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_7->isChecked()) { + LangIndex = INPUT_METHOD_TYPE_Farsi; + buf.append("Farsi\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else if(ui->radioButton_korean->isChecked()){ + LangIndex = INPUT_METHOD_TYPE_KOREAN; + buf.append("korean\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + else { + buf.append("Chinese\r\n"); + buf.append("WINPY_utf8.txt\r\n"); + } + file.write(buf); + fsync(file.handle()); + file.close(); + + } +} diff --git a/dlgmutilanguage.h b/dlgmutilanguage.h index 35abb4e..dd2e716 100644 --- a/dlgmutilanguage.h +++ b/dlgmutilanguage.h @@ -1,28 +1,28 @@ -#ifndef DLGMUTILANGUAGE_H -#define DLGMUTILANGUAGE_H - -#include - -namespace Ui { - class DlgMutiLanguage; -} - -class DlgMutiLanguage : public QDialog -{ - Q_OBJECT - -public: - explicit DlgMutiLanguage(QWidget *parent = 0); - ~DlgMutiLanguage(); - - void setCurrentLanguage(); - int getCurrentLanguage(); - int LangIndex; -public slots: - void SetNewLanguage(); -private: - Ui::DlgMutiLanguage *ui; - -}; - -#endif // DLGMUTILANGUAGE_H +#ifndef DLGMUTILANGUAGE_H +#define DLGMUTILANGUAGE_H + +#include + +namespace Ui { + class DlgMutiLanguage; +} + +class DlgMutiLanguage : public QDialog +{ + Q_OBJECT + +public: + explicit DlgMutiLanguage(QWidget *parent = 0); + ~DlgMutiLanguage(); + + void setCurrentLanguage(); + int getCurrentLanguage(); + int LangIndex; +public slots: + void SetNewLanguage(); +private: + Ui::DlgMutiLanguage *ui; + +}; + +#endif // DLGMUTILANGUAGE_H diff --git a/dlgmutilanguage.ui b/dlgmutilanguage.ui index 4921305..bdc50a8 100644 --- a/dlgmutilanguage.ui +++ b/dlgmutilanguage.ui @@ -1,161 +1,161 @@ - - - DlgMutiLanguage - - - - 0 - 0 - 376 - 328 - - - - 界面语言设置 - - - - :/icon/TEXT.PNG:/icon/TEXT.PNG - - - - - 110 - 280 - 221 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 20 - 250 - 331 - 20 - - - - (注意: 选择切换显示语言, 重启后才能生效) - - - - - - 61 - 20 - 251 - 191 - - - - - - - 中文 - - - - - - - 越南语 - - - - - - - true - - - 英语 - - - - - - - 波斯语 - - - - - - - true - - - 土耳其语 - - - - - - - 泰语 - - - - - - - 西班牙语 - - - - - - - 韩语 - - - - - - - - - - - - buttonBox - accepted() - DlgMutiLanguage - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - DlgMutiLanguage - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + DlgMutiLanguage + + + + 0 + 0 + 376 + 328 + + + + 界面语言设置 + + + + :/icon/TEXT.PNG:/icon/TEXT.PNG + + + + + 110 + 280 + 221 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 250 + 331 + 20 + + + + (注意: 选择切换显示语言, 重启后才能生效) + + + + + + 61 + 20 + 251 + 191 + + + + + + + 中文 + + + + + + + 越南语 + + + + + + + true + + + 英语 + + + + + + + 波斯语 + + + + + + + true + + + 土耳其语 + + + + + + + 泰语 + + + + + + + 西班牙语 + + + + + + + 韩语 + + + + + + + + + + + + buttonBox + accepted() + DlgMutiLanguage + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DlgMutiLanguage + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/dlgmywarring.cpp b/dlgmywarring.cpp index 56e8278..af7c2c1 100644 --- a/dlgmywarring.cpp +++ b/dlgmywarring.cpp @@ -1,35 +1,35 @@ -#include "dlgmywarring.h" -#include "ui_dlgmywarring.h" - -DlgMyWarring::DlgMyWarring(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgMyWarring) -{ - ui->setupUi(this); - connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(pushButtonPressed())); - QFont font; - font.setFamily("wenquanyi"); - font.setPixelSize(24); - ui->labelTitle->setFont(font); -} - -DlgMyWarring::~DlgMyWarring() -{ - delete ui; -} - -void DlgMyWarring::SetWarringText(QString txt){ - - ui->label->setText(txt); - -} - -void DlgMyWarring::SetTitleText(QString txt){ - - ui->labelTitle->setText(txt); - -} - -void DlgMyWarring::pushButtonPressed(){ - DlgMyWarring::hide(); -} +#include "dlgmywarring.h" +#include "ui_dlgmywarring.h" + +DlgMyWarring::DlgMyWarring(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgMyWarring) +{ + ui->setupUi(this); + connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(pushButtonPressed())); + QFont font; + font.setFamily("wenquanyi"); + font.setPixelSize(24); + ui->labelTitle->setFont(font); +} + +DlgMyWarring::~DlgMyWarring() +{ + delete ui; +} + +void DlgMyWarring::SetWarringText(QString txt){ + + ui->label->setText(txt); + +} + +void DlgMyWarring::SetTitleText(QString txt){ + + ui->labelTitle->setText(txt); + +} + +void DlgMyWarring::pushButtonPressed(){ + DlgMyWarring::hide(); +} diff --git a/dlgmywarring.h b/dlgmywarring.h index 9415bb5..98bd2c0 100644 --- a/dlgmywarring.h +++ b/dlgmywarring.h @@ -1,26 +1,26 @@ -#ifndef DLGMYWARRING_H -#define DLGMYWARRING_H - -#include - -namespace Ui { - class DlgMyWarring; -} - -class DlgMyWarring : public QDialog -{ - Q_OBJECT - -public: - explicit DlgMyWarring(QWidget *parent = 0); - ~DlgMyWarring(); - - void SetWarringText(QString txt); - void SetTitleText(QString txt); -public slots: - void pushButtonPressed(); -private: - Ui::DlgMyWarring *ui; -}; - -#endif // DLGMYWARRING_H +#ifndef DLGMYWARRING_H +#define DLGMYWARRING_H + +#include + +namespace Ui { + class DlgMyWarring; +} + +class DlgMyWarring : public QDialog +{ + Q_OBJECT + +public: + explicit DlgMyWarring(QWidget *parent = 0); + ~DlgMyWarring(); + + void SetWarringText(QString txt); + void SetTitleText(QString txt); +public slots: + void pushButtonPressed(); +private: + Ui::DlgMyWarring *ui; +}; + +#endif // DLGMYWARRING_H diff --git a/dlgmywarring.ui b/dlgmywarring.ui index baf08ae..4e457ef 100644 --- a/dlgmywarring.ui +++ b/dlgmywarring.ui @@ -1,166 +1,166 @@ - - - DlgMyWarring - - - - 0 - 0 - 464 - 213 - - - - 警告 - - - - :/icon/a9.ico:/icon/a9.ico - - - - - 20 - 40 - 431 - 111 - - - - - - - - - 0 - 85 - 255 - - - - - - - - - 0 - 85 - 255 - - - - - - - - - 150 - 147 - 140 - - - - - - - - - 12 - - - - 5 - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - true - - - 0 - - - - - - 310 - 170 - 93 - 27 - - - - 确定 - - - - - - 10 - 10 - 441 - 31 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 150 - 147 - 140 - - - - - - - - - 16 - - - - TextLabel - - - Qt::AlignCenter - - - true - - - - - - - - + + + DlgMyWarring + + + + 0 + 0 + 464 + 213 + + + + 警告 + + + + :/icon/a9.ico:/icon/a9.ico + + + + + 20 + 40 + 431 + 111 + + + + + + + + + 0 + 85 + 255 + + + + + + + + + 0 + 85 + 255 + + + + + + + + + 150 + 147 + 140 + + + + + + + + + 12 + + + + 5 + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + 0 + + + + + + 310 + 170 + 93 + 27 + + + + 确定 + + + + + + 10 + 10 + 441 + 31 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 150 + 147 + 140 + + + + + + + + + 16 + + + + TextLabel + + + Qt::AlignCenter + + + true + + + + + + + + diff --git a/dlgselectinputlanguage.cpp b/dlgselectinputlanguage.cpp index d2a2b48..a5c711c 100644 --- a/dlgselectinputlanguage.cpp +++ b/dlgselectinputlanguage.cpp @@ -1,33 +1,33 @@ -#include "dlgselectinputlanguage.h" -#include "ui_dlgselectinputlanguage.h" - -DlgSelectInputLanguage::DlgSelectInputLanguage(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgSelectInputLanguage) -{ - ui->setupUi(this); - selectIndex = 0; - connect(ui->radioButtonChinese,SIGNAL(clicked(bool)),this,SLOT(selectChanged1(bool))); - connect(ui->radioButtonEnglish,SIGNAL(clicked(bool)),this,SLOT(selectChanged2(bool))); - connect(ui->radioButtonVietnam,SIGNAL(clicked(bool)),this,SLOT(selectChanged3(bool))); - -} - -DlgSelectInputLanguage::~DlgSelectInputLanguage() -{ - delete ui; -} - -void DlgSelectInputLanguage::selectChanged1(bool ok){ - selectIndex=1; - hide(); -} -void DlgSelectInputLanguage::selectChanged2(bool ok){ - selectIndex=0; - hide(); -} - -void DlgSelectInputLanguage::selectChanged3(bool ok){ - selectIndex=2; - hide(); -} +#include "dlgselectinputlanguage.h" +#include "ui_dlgselectinputlanguage.h" + +DlgSelectInputLanguage::DlgSelectInputLanguage(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgSelectInputLanguage) +{ + ui->setupUi(this); + selectIndex = 0; + connect(ui->radioButtonChinese,SIGNAL(clicked(bool)),this,SLOT(selectChanged1(bool))); + connect(ui->radioButtonEnglish,SIGNAL(clicked(bool)),this,SLOT(selectChanged2(bool))); + connect(ui->radioButtonVietnam,SIGNAL(clicked(bool)),this,SLOT(selectChanged3(bool))); + +} + +DlgSelectInputLanguage::~DlgSelectInputLanguage() +{ + delete ui; +} + +void DlgSelectInputLanguage::selectChanged1(bool ok){ + selectIndex=1; + hide(); +} +void DlgSelectInputLanguage::selectChanged2(bool ok){ + selectIndex=0; + hide(); +} + +void DlgSelectInputLanguage::selectChanged3(bool ok){ + selectIndex=2; + hide(); +} diff --git a/dlgselectinputlanguage.h b/dlgselectinputlanguage.h index 787926f..900ea71 100644 --- a/dlgselectinputlanguage.h +++ b/dlgselectinputlanguage.h @@ -1,28 +1,28 @@ -#ifndef DLGSELECTINPUTLANGUAGE_H -#define DLGSELECTINPUTLANGUAGE_H - -#include - -namespace Ui { - class DlgSelectInputLanguage; -} - -class DlgSelectInputLanguage : public QDialog -{ - Q_OBJECT - -public: - explicit DlgSelectInputLanguage(QWidget *parent = 0); - ~DlgSelectInputLanguage(); - int selectIndex; - -public slots: - - void selectChanged1(bool ok); - void selectChanged2(bool ok); - void selectChanged3(bool ok); -private: - Ui::DlgSelectInputLanguage *ui; -}; - -#endif // DLGSELECTINPUTLANGUAGE_H +#ifndef DLGSELECTINPUTLANGUAGE_H +#define DLGSELECTINPUTLANGUAGE_H + +#include + +namespace Ui { + class DlgSelectInputLanguage; +} + +class DlgSelectInputLanguage : public QDialog +{ + Q_OBJECT + +public: + explicit DlgSelectInputLanguage(QWidget *parent = 0); + ~DlgSelectInputLanguage(); + int selectIndex; + +public slots: + + void selectChanged1(bool ok); + void selectChanged2(bool ok); + void selectChanged3(bool ok); +private: + Ui::DlgSelectInputLanguage *ui; +}; + +#endif // DLGSELECTINPUTLANGUAGE_H diff --git a/dlgselectinputlanguage.ui b/dlgselectinputlanguage.ui index 0d745d7..7c0bf99 100644 --- a/dlgselectinputlanguage.ui +++ b/dlgselectinputlanguage.ui @@ -1,55 +1,55 @@ - - - DlgSelectInputLanguage - - - - 0 - 0 - 291 - 162 - - - - Qt::StrongFocus - - - Dialog - - - - - 20 - 10 - 241 - 131 - - - - - - - 汉语(Chinese) - - - - - - - 英语(English) - - - - - - - 越南语(Vietnam) - - - - - - - - - + + + DlgSelectInputLanguage + + + + 0 + 0 + 291 + 162 + + + + Qt::StrongFocus + + + Dialog + + + + + 20 + 10 + 241 + 131 + + + + + + + 汉语(Chinese) + + + + + + + 英语(English) + + + + + + + 越南语(Vietnam) + + + + + + + + + diff --git a/dlgshowmsg.cpp b/dlgshowmsg.cpp index 5877490..63fa657 100644 --- a/dlgshowmsg.cpp +++ b/dlgshowmsg.cpp @@ -1,36 +1,36 @@ -#include "dlgshowmsg.h" -#include "ui_dlgshowmsg.h" - -DlgShowMsg::DlgShowMsg(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgShowMsg) -{ - - ui->setupUi(this); - this->setToolTip("警告"); - connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(OnpushButtonOKPressed())); - this->hide(); - -} - -DlgShowMsg::~DlgShowMsg() -{ - delete ui; -} - - -void DlgShowMsg::hideMsg() -{ - ui->label->setText(""); - this->hide(); -} - -void DlgShowMsg::showMsg(QString txt){ - ui->label->setText(txt); - this->show(); -} - -void DlgShowMsg::OnpushButtonOKPressed(){ - ui->label->setText(""); - this->hide(); -} +#include "dlgshowmsg.h" +#include "ui_dlgshowmsg.h" + +DlgShowMsg::DlgShowMsg(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgShowMsg) +{ + + ui->setupUi(this); + this->setToolTip("警告"); + connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(OnpushButtonOKPressed())); + this->hide(); + +} + +DlgShowMsg::~DlgShowMsg() +{ + delete ui; +} + + +void DlgShowMsg::hideMsg() +{ + ui->label->setText(""); + this->hide(); +} + +void DlgShowMsg::showMsg(QString txt){ + ui->label->setText(txt); + this->show(); +} + +void DlgShowMsg::OnpushButtonOKPressed(){ + ui->label->setText(""); + this->hide(); +} diff --git a/dlgshowmsg.h b/dlgshowmsg.h index ff63fc2..cc4f564 100644 --- a/dlgshowmsg.h +++ b/dlgshowmsg.h @@ -1,25 +1,25 @@ -#ifndef DLGSHOWMSG_H -#define DLGSHOWMSG_H - -#include - -namespace Ui { - class DlgShowMsg; -} - -class DlgShowMsg : public QDialog -{ - Q_OBJECT - -public: - explicit DlgShowMsg(QWidget *parent = 0); - ~DlgShowMsg(); - void showMsg(QString txt); - void hideMsg(); -private slots: - void OnpushButtonOKPressed(); -private: - Ui::DlgShowMsg *ui; -}; - -#endif // DLGSHOWMSG_H +#ifndef DLGSHOWMSG_H +#define DLGSHOWMSG_H + +#include + +namespace Ui { + class DlgShowMsg; +} + +class DlgShowMsg : public QDialog +{ + Q_OBJECT + +public: + explicit DlgShowMsg(QWidget *parent = 0); + ~DlgShowMsg(); + void showMsg(QString txt); + void hideMsg(); +private slots: + void OnpushButtonOKPressed(); +private: + Ui::DlgShowMsg *ui; +}; + +#endif // DLGSHOWMSG_H diff --git a/dlgshowmsg.ui b/dlgshowmsg.ui index 819880d..a65dc6b 100644 --- a/dlgshowmsg.ui +++ b/dlgshowmsg.ui @@ -1,68 +1,68 @@ - - - DlgShowMsg - - - - 0 - 0 - 298 - 91 - - - - 警告 - - - - - - - - - - - Qt::AlignCenter - - - - - - - 确定 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - + + + DlgShowMsg + + + + 0 + 0 + 298 + 91 + + + + 警告 + + + + + + + + + + + Qt::AlignCenter + + + + + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + diff --git a/dlgvarlength.cpp b/dlgvarlength.cpp index b8f9513..c2d70a4 100644 --- a/dlgvarlength.cpp +++ b/dlgvarlength.cpp @@ -1,44 +1,44 @@ -#include "dlgvarlength.h" -#include "ui_dlgvarlength.h" - -DlgVarLength::DlgVarLength(QWidget *parent) : - QDialog(parent), - ui(new Ui::DlgVarLength) -{ - ui->setupUi(this); - connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(pushButtonOK_Pressed())); - - -} - -DlgVarLength::~DlgVarLength() -{ - delete ui; -} -void DlgVarLength::applyUI(int len) -{ - int tmp=len/2; - ui->spinHeadLen->setMaximum( tmp); - ui->spinEndLen->setMaximum( tmp); - - ui->spinHeadLen->setValue(headLen); - ui->spinEndLen->setValue(endLen); - ui->spinVarLen->setValue(varLen); - ui->spinVarLen1->setValue(varLen1); - ui->checkVarEN->setChecked(varEn); - ui->pushButtonOK->setFocus(); - //ui->lab_AllLength ->setText(QString().sprintf("%0.1f",len)); - ui->lineEditAllLen ->setText(QString().sprintf("%d",len)); -} - -void DlgVarLength::pushButtonOK_Pressed() -{ - headLen = ui->spinHeadLen->value(); - endLen = ui->spinEndLen->value(); - varLen = ui->spinVarLen->value(); - varLen1 = ui->spinVarLen1->value(); - varEn = ui->checkVarEN->isChecked(); - emit on_set(); - this->hide(); - -} +#include "dlgvarlength.h" +#include "ui_dlgvarlength.h" + +DlgVarLength::DlgVarLength(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgVarLength) +{ + ui->setupUi(this); + connect(ui->pushButtonOK,SIGNAL(pressed()),this,SLOT(pushButtonOK_Pressed())); + + +} + +DlgVarLength::~DlgVarLength() +{ + delete ui; +} +void DlgVarLength::applyUI(int len) +{ + int tmp=len/2; + ui->spinHeadLen->setMaximum( tmp); + ui->spinEndLen->setMaximum( tmp); + + ui->spinHeadLen->setValue(headLen); + ui->spinEndLen->setValue(endLen); + ui->spinVarLen->setValue(varLen); + ui->spinVarLen1->setValue(varLen1); + ui->checkVarEN->setChecked(varEn); + ui->pushButtonOK->setFocus(); + //ui->lab_AllLength ->setText(QString().sprintf("%0.1f",len)); + ui->lineEditAllLen ->setText(QString().sprintf("%d",len)); +} + +void DlgVarLength::pushButtonOK_Pressed() +{ + headLen = ui->spinHeadLen->value(); + endLen = ui->spinEndLen->value(); + varLen = ui->spinVarLen->value(); + varLen1 = ui->spinVarLen1->value(); + varEn = ui->checkVarEN->isChecked(); + emit on_set(); + this->hide(); + +} diff --git a/dlgvarlength.h b/dlgvarlength.h index 28da5a2..66d1652 100644 --- a/dlgvarlength.h +++ b/dlgvarlength.h @@ -1,32 +1,32 @@ -#ifndef DLGVARLENGTH_H -#define DLGVARLENGTH_H - -#include - -namespace Ui { - class DlgVarLength; -} - -class DlgVarLength : public QDialog -{ - Q_OBJECT - -public: - explicit DlgVarLength(QWidget *parent = 0); - ~DlgVarLength(); - int headLen; - int endLen; - short varLen; - short varLen1; - bool varEn; - void applyUI(int len); - -public slots: - void pushButtonOK_Pressed(); -Q_SIGNALS: - void on_set(); -private: - Ui::DlgVarLength *ui; -}; - -#endif // DLGVARLENGTH_H +#ifndef DLGVARLENGTH_H +#define DLGVARLENGTH_H + +#include + +namespace Ui { + class DlgVarLength; +} + +class DlgVarLength : public QDialog +{ + Q_OBJECT + +public: + explicit DlgVarLength(QWidget *parent = 0); + ~DlgVarLength(); + int headLen; + int endLen; + short varLen; + short varLen1; + bool varEn; + void applyUI(int len); + +public slots: + void pushButtonOK_Pressed(); +Q_SIGNALS: + void on_set(); +private: + Ui::DlgVarLength *ui; +}; + +#endif // DLGVARLENGTH_H diff --git a/dlgvarlength.ui b/dlgvarlength.ui index d363408..de31cd5 100644 --- a/dlgvarlength.ui +++ b/dlgvarlength.ui @@ -1,202 +1,202 @@ - - - DlgVarLength - - - Qt::WindowModal - - - - 0 - 0 - 386 - 166 - - - - Qt::StrongFocus - - - 变长喷印参数 - - - - - - - - - 100 - 16777215 - - - - 头部长度(m) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 100 - 16777215 - - - - 尾部长度(m) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 100 - 16777215 - - - - 总长(m) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 9999 - - - - - - - 9999 - - - - - - - true - - - - 120 - 16777215 - - - - false - - - true - - - - - - - - 100 - 16777215 - - - - 调整长度(mm) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 60 - 0 - - - - -9999 - - - 9999 - - - - - - - - 100 - 16777215 - - - - 调整长度(mm) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 60 - 0 - - - - -9999 - - - 9999 - - - - - - - Qt::RightToLeft - - - 可变长度允许 - - - - - - - - 100 - 60 - - - - 确定 - - - true - - - - - - - - - - + + + DlgVarLength + + + Qt::WindowModal + + + + 0 + 0 + 386 + 166 + + + + Qt::StrongFocus + + + 变长喷印参数 + + + + + + + + + 100 + 16777215 + + + + 头部长度(m) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 16777215 + + + + 尾部长度(m) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 16777215 + + + + 总长(m) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 9999 + + + + + + + 9999 + + + + + + + true + + + + 120 + 16777215 + + + + false + + + true + + + + + + + + 100 + 16777215 + + + + 调整长度(mm) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 60 + 0 + + + + -9999 + + + 9999 + + + + + + + + 100 + 16777215 + + + + 调整长度(mm) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 60 + 0 + + + + -9999 + + + 9999 + + + + + + + Qt::RightToLeft + + + 可变长度允许 + + + + + + + + 100 + 60 + + + + 确定 + + + true + + + + + + + + + + diff --git a/docs/NozzleReverseClean.md b/docs/NozzleReverseClean.md index 6cdb36f..cccff84 100644 --- a/docs/NozzleReverseClean.md +++ b/docs/NozzleReverseClean.md @@ -1,130 +1,130 @@ -# 喷嘴逆清洗(Nozzle Reverse Cleaning)流程分析 - -本文档基于 `SystemSetting::on_pushButtonCleanUP_pressed()` 及相关函数(`onCleanUPNow()`、`timerHandler2()`)的源码,梳理“喷嘴逆清洗”的完整流程,说明在各个阶段哪些泵/阀被打开或关闭、状态标志及定时器行为。 - -## 总体说明 -- 入口:`on_pushButtonCleanUP_pressed()`(由用户按下“清洗”按钮触发)。 -- 流程依赖三个成员:`enCleanUpAppendFlag`(状态机标志),`timer2`(阶段定时器),`timerAuto`(用于齿轮泵自动控制的定时器)。 -- 清洗可由用户启动或停止(对话框确认)。 - -## 主要状态与定时器 -- `enCleanUpAppendFlag` 含义(函数中使用的值): - - 0:空闲 - - 1:进入手动模式并开始准备(短时等待) - - 2:正在开启回收槽(等待位置到位) - - 3:真正开始清洗(清洗中) - - 4:清洗完成,开始关闭回收槽并恢复 - - 5:停止清洗/强制收尾 - - 6:特殊停止/恢复 -- `timer2`:用于阶段切换的定时器(不同阶段设置不同延时)。 -- `timerAuto`:在齿轮泵(gearPump)情形下,用于短周期自动控制(间隔 100 ms)。 - -## 按下按钮后的流程(`on_pushButtonCleanUP_pressed()`) -1. 弹出对话框,提示“自动清洗时间约为一分钟,然后自动停止”,并显示“开始清洗 / 取消 / 停止清洗”选项。 -2. 若用户选择“开始清洗”执行以下动作: - - 保存当前 `isPumpValveControledByHand` 状态到 `r_PumpValveControledByHand` 并将 `sysPara->status.isPumpValveControledByHand` 设为 `true`(进入手动控制状态)。 - - 将一系列泵与阀置为“清洗安全/准备”状态: - - `controlCompressPump(false);` (关闭压缩泵) - - `controlCycleValve(true);` (开启循环阀) - - `controlInkValve(false);` (关闭墨阀) - - `controlInkValvePWM(false);` (禁用墨阀 PWM) - - `controlMainInkPump(false);` (关闭主墨泵) - - `controlMixValve(false);` (关闭混合阀) - - `controlReclaimPump(true, true);` (打开回收泵,第二参数 `true` 表示带某种模式/快速起动——与实现相关) - - `controlViscosityPump(false);` (关闭粘度泵) - - `controlReleaseValve(false);` (关闭释放阀) - - 如果启用了 `gearPumpEnable` 且 `flagOfReclaimPumEnable` 为真(齿轮泵版本): - - `controlCycleValve(true);` - - `controlViscosityPump(true);` - - `controlReclaimPump(true, false);`(打开回收泵,第二参数 `false`) - - 将 `para.gearPumpValue = 0;` 并调用 `WriteMoterPump()` 更新电机/泵设置 - - `controlInkValvePWM(false);` - - 将 `enCleanUpAppendFlag = 1`(进入准备阶段)。 - - 调用 `mainInkCtrl()`(主控恢复/切换函数,进入手动控制后的一些主流程)。 - - 启动 `timer2->start(2000);`(等待约 2 秒以便进入下一个阶段)。 - -3. 若用户选择“停止清洗”(对话框中为取消清洗按钮),会执行: - - `enCleanUpAppendFlag = 3;`(直接跳转到完成/结束阶段处理) - - 调用 `timerHandler2()` 立刻处理结束逻辑并返回。 - -## 清洗的执行阶段(由 `timer2` 驱动,见 `timerHandler2()`) -流程按 `enCleanUpAppendFlag` 值推进: - -- 当 `enCleanUpAppendFlag == 1`(准备完成): - - 停止 `timer2`。 - - 将状态置为 `2`(准备开启回收槽并监测位置)。 - - 根据回收槽当前位置 `sysPara->status.currReclaimTankPos` 决定动作: - - 若位置 < 45:调用 `controlReclaimTankOpen(1);`(开始打开回收槽,参数 1 表示动作/使能)。 - - 若位置 > 55:调用 `controlReclaimTankClose(1);`(开始关闭回收槽)。 - - 启动 `timer2->start(5500);`(等待 ~5.5 秒让回收槽动作完成)。 - -- 当 `enCleanUpAppendFlag == 2`(等待回收槽到位): - - 停止 `timer2`。 - - 将 `enCleanUpAppendFlag = 3`(准备开始真正的清洗)。 - - 调用 `controlReclaimTankOpen(0);`(停止回收槽驱动/微调参数 0,表示结束开启命令)。 - - 触发 `onCleanUPNow()`:进入清洗动作。 - -- `onCleanUPNow()`(真正开始清洗): - - 发出状态文本 `正在喷嘴逆清洗......`。 - - 若非齿轮泵特例(即 `!(gearPumpEnable && flagOfReclaimPumEnable)`)则执行: - - `controlCycleValve(true);`(确保循环阀打开) - - `controlViscosityPump(true);`(打开粘度泵) - - `controlReclaimPump(true, false);`(以普通模式打开回收泵) - - 启动 `timer2->start(60000);`(清洗计时约 60 秒,之后进入下一阶段)。 - -- 当 `enCleanUpAppendFlag == 3`(清洗结束进入收尾): - - 将 `enCleanUpAppendFlag = 4`。 - - 执行收尾动作: - - `controlCycleValve(false);`(关闭循环阀) - - `controlViscosityPump(false);`(关闭粘度泵) - - `controlReclaimTankClose(1);`(开始关闭回收槽) - - 设置 `sysPara->status.reclaimCloseCnt = 10;`(用于稍后延迟/重试逻辑) - - 停止 `timer2`,并 `timer2->start(8300);`(等待约 8.3 秒以完成回收槽关闭)。 - - 若为齿轮泵情形,启动 `timerAuto->start(100);`(开始短周期自动泵控制,用于慢速回退/调节)。 - -- 当 `enCleanUpAppendFlag == 4`(最终完成/恢复): - - 发出 `清洗完成` 状态;若 `currReclaimTankPos == 0` 则: - - 将 `enCleanUpAppendFlag = 0`(恢复空闲) - - 停止 `timer2`,并调用 `controlReclaimTankClose(0);`(结束回收槽关闭动作) - - 将 `sysPara->status.isPumpValveControledByHand = false;`(恢复手动控制标志) - - 若 `timerAuto` 活动则停止它。 - - 调用 `mainInkCtrl()` 恢复主控模式(回到自动/正常喷印控制)。 - -- 当 `enCleanUpAppendFlag == 5`(用户中止或异常收尾): - - 停止 `timer2`,将 `enCleanUpAppendFlag = 0`,调用 `controlReclaimTankClose(0);`,恢复 `isPumpValveControledByHand=false`,并调用 `mainInkCtrl()`。 - -- 当 `enCleanUpAppendFlag == 6`(另一种强制结束): - - 停止 `timer2`,将 `enCleanUpAppendFlag = 0`,并将 `isPumpValveControledByHand=false`。通常不触发 `mainInkCtrl()` 但恢复手动标志。 - -## 其他相关逻辑 -- 在 `updateSysStatusToUI()` 中也会检测当前位置:如果回收槽位置在 45~55 且 `enCleanUpAppendFlag==2`,会直接把 `enCleanUpAppendFlag` 置为 3 并调用 `onCleanUPNow()`(避免超时等待)。 -- 清洗过程会通过 `emit setRunStatus(...)` 与 `LogInfo::setRunStatusText(...)` 报告当前步骤进度。 - -## 时序概览(近似) -1. 用户点击“开始清洗” -> 进入手动(isPumpValveControledByHand = true),立即设置各泵阀为清洗准备状态,`enCleanUpAppendFlag=1`。 -2. 等待 ~2s(`timer2`)-> 切换到 `enCleanUpAppendFlag=2` 并根据位置 `controlReclaimTankOpen/Close(1)` -> 等待 ~5.5s。 -3. `enCleanUpAppendFlag=2` 到位后 -> `enCleanUpAppendFlag=3`,停止回收槽驱动(`controlReclaimTankOpen(0)`),调用 `onCleanUPNow()`。 -4. 真正清洗阶段:打开循环阀/粘度泵/回收泵(齿轮泵情形会略有不同),计时 ~60s(`timer2`)。 -5. 清洗结束 -> 关闭循环阀/粘度泵,关闭回收槽(`controlReclaimTankClose(1)`),等待 ~8.3s。 -6. 最终恢复:复位手动控制标志,停止 `timerAuto`(如有),调用 `mainInkCtrl()` 恢复正常打印控制。 - -## 关键函数调用清单(按先后出现) -- `controlCompressPump(false)` -- `controlCycleValve(true/false)` -- `controlInkValve(false)` -- `controlInkValvePWM(false)` -- `controlMainInkPump(false)` -- `controlMixValve(false)` -- `controlReclaimPump(true, true/false)` -- `controlViscosityPump(true/false)` -- `controlReleaseValve(false)` -- `controlReclaimTankOpen(1/0)` / `controlReclaimTankClose(1/0)` -- `mainInkCtrl()`(用于进入/退出手动控制后的主控恢复) - -## 注意事项与可能的改进点 -- `controlReclaimPump(true, true)` 与 `controlReclaimPump(true, false)` 两种调用方式的差异需参考 `devOp` 实现说明(表示不同启动模式或参数)。 -- 若存在异常中断(`enCleanUpAppendFlag` 被置为 5/6),代码会尽量关闭回收槽并恢复 `isPumpValveControledByHand`,但是否彻底恢复所有阀泵需在 `DevOp` 层确认。 -- 时间参数(2s、5.5s、60s、8.3s)为源码中硬编码值,若需更稳健的流程,建议改用位置/传感器反馈替代固定延时以提高鲁棒性。 - ---- -文档基于 `SystemSetting.cpp` 中相关函数分析整理,若需要我可以把上述时序画成流程图或补充 `DevOp` 层对应函数的实现说明。 +# 喷嘴逆清洗(Nozzle Reverse Cleaning)流程分析 + +本文档基于 `SystemSetting::on_pushButtonCleanUP_pressed()` 及相关函数(`onCleanUPNow()`、`timerHandler2()`)的源码,梳理“喷嘴逆清洗”的完整流程,说明在各个阶段哪些泵/阀被打开或关闭、状态标志及定时器行为。 + +## 总体说明 +- 入口:`on_pushButtonCleanUP_pressed()`(由用户按下“清洗”按钮触发)。 +- 流程依赖三个成员:`enCleanUpAppendFlag`(状态机标志),`timer2`(阶段定时器),`timerAuto`(用于齿轮泵自动控制的定时器)。 +- 清洗可由用户启动或停止(对话框确认)。 + +## 主要状态与定时器 +- `enCleanUpAppendFlag` 含义(函数中使用的值): + - 0:空闲 + - 1:进入手动模式并开始准备(短时等待) + - 2:正在开启回收槽(等待位置到位) + - 3:真正开始清洗(清洗中) + - 4:清洗完成,开始关闭回收槽并恢复 + - 5:停止清洗/强制收尾 + - 6:特殊停止/恢复 +- `timer2`:用于阶段切换的定时器(不同阶段设置不同延时)。 +- `timerAuto`:在齿轮泵(gearPump)情形下,用于短周期自动控制(间隔 100 ms)。 + +## 按下按钮后的流程(`on_pushButtonCleanUP_pressed()`) +1. 弹出对话框,提示“自动清洗时间约为一分钟,然后自动停止”,并显示“开始清洗 / 取消 / 停止清洗”选项。 +2. 若用户选择“开始清洗”执行以下动作: + - 保存当前 `isPumpValveControledByHand` 状态到 `r_PumpValveControledByHand` 并将 `sysPara->status.isPumpValveControledByHand` 设为 `true`(进入手动控制状态)。 + - 将一系列泵与阀置为“清洗安全/准备”状态: + - `controlCompressPump(false);` (关闭压缩泵) + - `controlCycleValve(true);` (开启循环阀) + - `controlInkValve(false);` (关闭墨阀) + - `controlInkValvePWM(false);` (禁用墨阀 PWM) + - `controlMainInkPump(false);` (关闭主墨泵) + - `controlMixValve(false);` (关闭混合阀) + - `controlReclaimPump(true, true);` (打开回收泵,第二参数 `true` 表示带某种模式/快速起动——与实现相关) + - `controlViscosityPump(false);` (关闭粘度泵) + - `controlReleaseValve(false);` (关闭释放阀) + - 如果启用了 `gearPumpEnable` 且 `flagOfReclaimPumEnable` 为真(齿轮泵版本): + - `controlCycleValve(true);` + - `controlViscosityPump(true);` + - `controlReclaimPump(true, false);`(打开回收泵,第二参数 `false`) + - 将 `para.gearPumpValue = 0;` 并调用 `WriteMoterPump()` 更新电机/泵设置 + - `controlInkValvePWM(false);` + - 将 `enCleanUpAppendFlag = 1`(进入准备阶段)。 + - 调用 `mainInkCtrl()`(主控恢复/切换函数,进入手动控制后的一些主流程)。 + - 启动 `timer2->start(2000);`(等待约 2 秒以便进入下一个阶段)。 + +3. 若用户选择“停止清洗”(对话框中为取消清洗按钮),会执行: + - `enCleanUpAppendFlag = 3;`(直接跳转到完成/结束阶段处理) + - 调用 `timerHandler2()` 立刻处理结束逻辑并返回。 + +## 清洗的执行阶段(由 `timer2` 驱动,见 `timerHandler2()`) +流程按 `enCleanUpAppendFlag` 值推进: + +- 当 `enCleanUpAppendFlag == 1`(准备完成): + - 停止 `timer2`。 + - 将状态置为 `2`(准备开启回收槽并监测位置)。 + - 根据回收槽当前位置 `sysPara->status.currReclaimTankPos` 决定动作: + - 若位置 < 45:调用 `controlReclaimTankOpen(1);`(开始打开回收槽,参数 1 表示动作/使能)。 + - 若位置 > 55:调用 `controlReclaimTankClose(1);`(开始关闭回收槽)。 + - 启动 `timer2->start(5500);`(等待 ~5.5 秒让回收槽动作完成)。 + +- 当 `enCleanUpAppendFlag == 2`(等待回收槽到位): + - 停止 `timer2`。 + - 将 `enCleanUpAppendFlag = 3`(准备开始真正的清洗)。 + - 调用 `controlReclaimTankOpen(0);`(停止回收槽驱动/微调参数 0,表示结束开启命令)。 + - 触发 `onCleanUPNow()`:进入清洗动作。 + +- `onCleanUPNow()`(真正开始清洗): + - 发出状态文本 `正在喷嘴逆清洗......`。 + - 若非齿轮泵特例(即 `!(gearPumpEnable && flagOfReclaimPumEnable)`)则执行: + - `controlCycleValve(true);`(确保循环阀打开) + - `controlViscosityPump(true);`(打开粘度泵) + - `controlReclaimPump(true, false);`(以普通模式打开回收泵) + - 启动 `timer2->start(60000);`(清洗计时约 60 秒,之后进入下一阶段)。 + +- 当 `enCleanUpAppendFlag == 3`(清洗结束进入收尾): + - 将 `enCleanUpAppendFlag = 4`。 + - 执行收尾动作: + - `controlCycleValve(false);`(关闭循环阀) + - `controlViscosityPump(false);`(关闭粘度泵) + - `controlReclaimTankClose(1);`(开始关闭回收槽) + - 设置 `sysPara->status.reclaimCloseCnt = 10;`(用于稍后延迟/重试逻辑) + - 停止 `timer2`,并 `timer2->start(8300);`(等待约 8.3 秒以完成回收槽关闭)。 + - 若为齿轮泵情形,启动 `timerAuto->start(100);`(开始短周期自动泵控制,用于慢速回退/调节)。 + +- 当 `enCleanUpAppendFlag == 4`(最终完成/恢复): + - 发出 `清洗完成` 状态;若 `currReclaimTankPos == 0` 则: + - 将 `enCleanUpAppendFlag = 0`(恢复空闲) + - 停止 `timer2`,并调用 `controlReclaimTankClose(0);`(结束回收槽关闭动作) + - 将 `sysPara->status.isPumpValveControledByHand = false;`(恢复手动控制标志) + - 若 `timerAuto` 活动则停止它。 + - 调用 `mainInkCtrl()` 恢复主控模式(回到自动/正常喷印控制)。 + +- 当 `enCleanUpAppendFlag == 5`(用户中止或异常收尾): + - 停止 `timer2`,将 `enCleanUpAppendFlag = 0`,调用 `controlReclaimTankClose(0);`,恢复 `isPumpValveControledByHand=false`,并调用 `mainInkCtrl()`。 + +- 当 `enCleanUpAppendFlag == 6`(另一种强制结束): + - 停止 `timer2`,将 `enCleanUpAppendFlag = 0`,并将 `isPumpValveControledByHand=false`。通常不触发 `mainInkCtrl()` 但恢复手动标志。 + +## 其他相关逻辑 +- 在 `updateSysStatusToUI()` 中也会检测当前位置:如果回收槽位置在 45~55 且 `enCleanUpAppendFlag==2`,会直接把 `enCleanUpAppendFlag` 置为 3 并调用 `onCleanUPNow()`(避免超时等待)。 +- 清洗过程会通过 `emit setRunStatus(...)` 与 `LogInfo::setRunStatusText(...)` 报告当前步骤进度。 + +## 时序概览(近似) +1. 用户点击“开始清洗” -> 进入手动(isPumpValveControledByHand = true),立即设置各泵阀为清洗准备状态,`enCleanUpAppendFlag=1`。 +2. 等待 ~2s(`timer2`)-> 切换到 `enCleanUpAppendFlag=2` 并根据位置 `controlReclaimTankOpen/Close(1)` -> 等待 ~5.5s。 +3. `enCleanUpAppendFlag=2` 到位后 -> `enCleanUpAppendFlag=3`,停止回收槽驱动(`controlReclaimTankOpen(0)`),调用 `onCleanUPNow()`。 +4. 真正清洗阶段:打开循环阀/粘度泵/回收泵(齿轮泵情形会略有不同),计时 ~60s(`timer2`)。 +5. 清洗结束 -> 关闭循环阀/粘度泵,关闭回收槽(`controlReclaimTankClose(1)`),等待 ~8.3s。 +6. 最终恢复:复位手动控制标志,停止 `timerAuto`(如有),调用 `mainInkCtrl()` 恢复正常打印控制。 + +## 关键函数调用清单(按先后出现) +- `controlCompressPump(false)` +- `controlCycleValve(true/false)` +- `controlInkValve(false)` +- `controlInkValvePWM(false)` +- `controlMainInkPump(false)` +- `controlMixValve(false)` +- `controlReclaimPump(true, true/false)` +- `controlViscosityPump(true/false)` +- `controlReleaseValve(false)` +- `controlReclaimTankOpen(1/0)` / `controlReclaimTankClose(1/0)` +- `mainInkCtrl()`(用于进入/退出手动控制后的主控恢复) + +## 注意事项与可能的改进点 +- `controlReclaimPump(true, true)` 与 `controlReclaimPump(true, false)` 两种调用方式的差异需参考 `devOp` 实现说明(表示不同启动模式或参数)。 +- 若存在异常中断(`enCleanUpAppendFlag` 被置为 5/6),代码会尽量关闭回收槽并恢复 `isPumpValveControledByHand`,但是否彻底恢复所有阀泵需在 `DevOp` 层确认。 +- 时间参数(2s、5.5s、60s、8.3s)为源码中硬编码值,若需更稳健的流程,建议改用位置/传感器反馈替代固定延时以提高鲁棒性。 + +--- +文档基于 `SystemSetting.cpp` 中相关函数分析整理,若需要我可以把上述时序画成流程图或补充 `DevOp` 层对应函数的实现说明。 diff --git a/docs/translation_audit.md b/docs/translation_audit.md index bf788cc..40f55d4 100644 --- a/docs/translation_audit.md +++ b/docs/translation_audit.md @@ -1,54 +1,54 @@ -**翻译覆盖审计报告** - -概要: -- 目标:找出项目中应使用 `tr()`(或 `QObject::tr()`)进行国际化处理但未被包装的用户可见字符串。 -- 说明:本报告基于静态搜索常见 UI 文本位置(`setWindowTitle`, `setText`, `QPushButton`, `QLabel`, `QMessageBox` 等)生成。由于静态分析有一定误报/漏报可能,后续建议人工逐条确认。 - -重要发现(优先级按文件列出,包含示例行范围): - -- `UpdateFPGA.cpp` — 多处未使用 `tr()`:界面标题、按钮、日志标签以及所有 `QMessageBox` 文本均为硬编码字符串,应国际化。 - - 示例(构造/显示文本):[UpdateFPGA.cpp](UpdateFPGA.cpp#L44-L89) - - 示例(消息框与对话):[UpdateFPGA.cpp](UpdateFPGA.cpp#L280-L396) - -- `InputMethod.cpp` — 大量键盘按键与语言名称直接用字符串设置(如 `setText("A")`, `setText("中文")`, 不使用 `tr()`)。这些是用户可见的文本,建议按语言情形处理或使用翻译条目。 - - 代表区间(字母/符号键):[InputMethod.cpp](InputMethod.cpp#L929-L987) - - 代表区间(中文字/候选键):[InputMethod.cpp](InputMethod.cpp#L1389-L1456) - -- `zkWidget.cpp` — 某些 `QMessageBox::warning`/`information` 使用了未翻译的字面串。 - - 示例: [zkWidget.cpp](zkWidget.cpp#L269-L299) - -- `dlginputaddr.cpp` — 若干 `QMessageBox::warning` 使用了硬编码中文字符串(未用 `tr()`)。 - - 示例: [dlginputaddr.cpp](dlginputaddr.cpp#L111-L152) - -- `main.cpp` — 载入翻译文件失败时使用了未包装的字符串。 - - 示例: [main.cpp](main.cpp#L169) - -- `LicenseManger/LicenseManger.cpp`, `dlgQrCode.cpp`, `TextEditOption*.cpp`, `PicWidget.cpp`, `DevOp.cpp`, `PrintSetting.cpp` 等文件中存在混合状况:多数 `QMessageBox` 已用 `tr()`,但也能查到若干未用 `tr()` 的调用(例如使用字面串作为参数或 QString 拼接中未对字面串进行 tr)。请重点人工核查这些文件的注释/被注释代码与少量硬编码文本。 - -扫描方式与样例线索(已检索的典型模式): -- `setWindowTitle("...")`、`m_Label->setText("...")`、`new QPushButton("...")`、`QMessageBox::information(..., "...")` 等调用中直接使用字符串文字。 -- 以上模式在静态搜索中返回了大量匹配,报告中仅列出高优先级或代表性位置,完整匹配可由检索日志复现。 - -建议与后续步骤: -- 将所有用户可见文本统一包装为 `tr("...")`。在非 QObject 派生的静态/全局上下文使用 `QObject::tr("...")`。 -- 对键盘/字符常量(例如单字符键标记 'A','B' 或符号)评估是否需要翻译:若这些是键盘标签或不可本地化字符(字母/符号),可以保留不翻译;若是语言名或提示性文本(例如 "English", "Arabic", "中文"),则应 `tr()`。 -- 优先级建议:先修 `UpdateFPGA.cpp`(类内几乎所有字符串均未翻译),然后按照文件影响范围(Main UI、设置对话、输入法)逐个处理。 -- 实施时建议: - - 使用搜索替换脚本辅助(例如在 IDE 中搜索 `setWindowTitle("` 并逐一人工确认替换为 `setWindowTitle(tr("..."))`),避免误改程序逻辑字符串。 - - 对已翻译的字符串生成并更新 `.ts` 文件(`lupdate` / `linguist` / `lrelease` 流程)。 - -附:需要重点人工复核的文件清单(按发现频率/重要性排序): -- UpdateFPGA.cpp — 完整类几乎未使用 `tr()`(必修) -- InputMethod.cpp — 键盘/候选字符(按需复核) -- zkWidget.cpp — 部分未翻译警告文本 -- dlginputaddr.cpp — 文件打开/错误提示未使用 `tr()` -- main.cpp — 翻译文件加载错误提示未用 `tr()` -- LicenseManger/LicenseManger.cpp — 部分 warn/err 未 tr -- dlgQrCode.cpp / TextEditOption.cpp / TextEditOption_backup.cpp — 存在未 tr 的提示与对话 -- PicWidget.cpp / DevOp.cpp / PrintSetting.cpp — 若干未 tr 的 QMessageBox 文本 - -如果你需要,我可以: -- 生成一份更详尽的逐行未包装字符串清单(包含每个匹配的具体行文本),或 -- 在创建分支后逐文件替换并提交 PR(我会先在单独分支修改并保留 review 注释)。 - -—— 翻译审计自动生成 +**翻译覆盖审计报告** + +概要: +- 目标:找出项目中应使用 `tr()`(或 `QObject::tr()`)进行国际化处理但未被包装的用户可见字符串。 +- 说明:本报告基于静态搜索常见 UI 文本位置(`setWindowTitle`, `setText`, `QPushButton`, `QLabel`, `QMessageBox` 等)生成。由于静态分析有一定误报/漏报可能,后续建议人工逐条确认。 + +重要发现(优先级按文件列出,包含示例行范围): + +- `UpdateFPGA.cpp` — 多处未使用 `tr()`:界面标题、按钮、日志标签以及所有 `QMessageBox` 文本均为硬编码字符串,应国际化。 + - 示例(构造/显示文本):[UpdateFPGA.cpp](UpdateFPGA.cpp#L44-L89) + - 示例(消息框与对话):[UpdateFPGA.cpp](UpdateFPGA.cpp#L280-L396) + +- `InputMethod.cpp` — 大量键盘按键与语言名称直接用字符串设置(如 `setText("A")`, `setText("中文")`, 不使用 `tr()`)。这些是用户可见的文本,建议按语言情形处理或使用翻译条目。 + - 代表区间(字母/符号键):[InputMethod.cpp](InputMethod.cpp#L929-L987) + - 代表区间(中文字/候选键):[InputMethod.cpp](InputMethod.cpp#L1389-L1456) + +- `zkWidget.cpp` — 某些 `QMessageBox::warning`/`information` 使用了未翻译的字面串。 + - 示例: [zkWidget.cpp](zkWidget.cpp#L269-L299) + +- `dlginputaddr.cpp` — 若干 `QMessageBox::warning` 使用了硬编码中文字符串(未用 `tr()`)。 + - 示例: [dlginputaddr.cpp](dlginputaddr.cpp#L111-L152) + +- `main.cpp` — 载入翻译文件失败时使用了未包装的字符串。 + - 示例: [main.cpp](main.cpp#L169) + +- `LicenseManger/LicenseManger.cpp`, `dlgQrCode.cpp`, `TextEditOption*.cpp`, `PicWidget.cpp`, `DevOp.cpp`, `PrintSetting.cpp` 等文件中存在混合状况:多数 `QMessageBox` 已用 `tr()`,但也能查到若干未用 `tr()` 的调用(例如使用字面串作为参数或 QString 拼接中未对字面串进行 tr)。请重点人工核查这些文件的注释/被注释代码与少量硬编码文本。 + +扫描方式与样例线索(已检索的典型模式): +- `setWindowTitle("...")`、`m_Label->setText("...")`、`new QPushButton("...")`、`QMessageBox::information(..., "...")` 等调用中直接使用字符串文字。 +- 以上模式在静态搜索中返回了大量匹配,报告中仅列出高优先级或代表性位置,完整匹配可由检索日志复现。 + +建议与后续步骤: +- 将所有用户可见文本统一包装为 `tr("...")`。在非 QObject 派生的静态/全局上下文使用 `QObject::tr("...")`。 +- 对键盘/字符常量(例如单字符键标记 'A','B' 或符号)评估是否需要翻译:若这些是键盘标签或不可本地化字符(字母/符号),可以保留不翻译;若是语言名或提示性文本(例如 "English", "Arabic", "中文"),则应 `tr()`。 +- 优先级建议:先修 `UpdateFPGA.cpp`(类内几乎所有字符串均未翻译),然后按照文件影响范围(Main UI、设置对话、输入法)逐个处理。 +- 实施时建议: + - 使用搜索替换脚本辅助(例如在 IDE 中搜索 `setWindowTitle("` 并逐一人工确认替换为 `setWindowTitle(tr("..."))`),避免误改程序逻辑字符串。 + - 对已翻译的字符串生成并更新 `.ts` 文件(`lupdate` / `linguist` / `lrelease` 流程)。 + +附:需要重点人工复核的文件清单(按发现频率/重要性排序): +- UpdateFPGA.cpp — 完整类几乎未使用 `tr()`(必修) +- InputMethod.cpp — 键盘/候选字符(按需复核) +- zkWidget.cpp — 部分未翻译警告文本 +- dlginputaddr.cpp — 文件打开/错误提示未使用 `tr()` +- main.cpp — 翻译文件加载错误提示未用 `tr()` +- LicenseManger/LicenseManger.cpp — 部分 warn/err 未 tr +- dlgQrCode.cpp / TextEditOption.cpp / TextEditOption_backup.cpp — 存在未 tr 的提示与对话 +- PicWidget.cpp / DevOp.cpp / PrintSetting.cpp — 若干未 tr 的 QMessageBox 文本 + +如果你需要,我可以: +- 生成一份更详尽的逐行未包装字符串清单(包含每个匹配的具体行文本),或 +- 在创建分支后逐文件替换并提交 PR(我会先在单独分支修改并保留 review 注释)。 + +—— 翻译审计自动生成 diff --git a/dump.cpp b/dump.cpp index a167595..18f9cab 100644 --- a/dump.cpp +++ b/dump.cpp @@ -1,106 +1,106 @@ -#define _GNU_SOURCE -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "dump.h" -#include - -extern QString gAppNameStr; - -static uintptr_t g_base_address = 0; - -static int find_base_address(struct dl_phdr_info *info, size_t size, void *data) -{ - (void)size; - (void)data; - if (info->dlpi_name == nullptr || info->dlpi_name[0] == '\0') { - g_base_address = info->dlpi_addr; - return 1; - } - return 0; -} - -static uintptr_t get_base_address() -{ - if (g_base_address == 0) { - dl_iterate_phdr(find_base_address, nullptr); - } - return g_base_address; -} - -void createStackTraceFile(const char *fileName, const char *appName) -{ - std::ofstream file(fileName); - if (!file.is_open()) { - std::cerr << "Error opening file: " << fileName << std::endl; - return; - } - - void *array[50]; - size_t size; - char **strings; - - size = backtrace(array, 50); - if (size == 0) { - std::cerr << "No stack frames obtained" << std::endl; - return; - } - - uintptr_t base_addr = get_base_address(); - - strings = backtrace_symbols(array, size); - file << "Stack trace info:\n"; - file << "Base address: 0x" << std::hex << base_addr << std::dec << "\n\n"; - - for (size_t i = 0; i < size; ++i) { - file << strings[i] << std::endl; - - uintptr_t addr = reinterpret_cast(array[i]); - uintptr_t offset = addr - base_addr; - - char cmd[512]; - snprintf(cmd, sizeof(cmd), "addr2line -e %s 0x%lx", appName, offset); - - FILE *fp = popen(cmd, "r"); - if (fp) { - char line[256]; - while (fgets(line, sizeof(line), fp)) { - file << " " << line; - } - pclose(fp); - } else { - std::cerr << "Failed to run addr2line command" << std::endl; - } - file << std::endl; - } - - free(strings); - file.close(); -} - -static void signalHandler(int signum) -{ - QString dumpFileName = QString("/home/plg/loginfo/dumpfile_%1.txt").arg(QDateTime::currentDateTime().toString("yyyy_MM_dd_hh_mm_ss")); - QString appName = gAppNameStr; - createStackTraceFile(dumpFileName.toUtf8().data(), appName.toUtf8().data()); - exit(signum); -} - -void installSignalHandlers() -{ - signal(SIGSEGV, signalHandler); - signal(SIGABRT, signalHandler); - signal(SIGILL, signalHandler); - signal(SIGFPE, signalHandler); +#define _GNU_SOURCE +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "dump.h" +#include + +extern QString gAppNameStr; + +static uintptr_t g_base_address = 0; + +static int find_base_address(struct dl_phdr_info *info, size_t size, void *data) +{ + (void)size; + (void)data; + if (info->dlpi_name == nullptr || info->dlpi_name[0] == '\0') { + g_base_address = info->dlpi_addr; + return 1; + } + return 0; +} + +static uintptr_t get_base_address() +{ + if (g_base_address == 0) { + dl_iterate_phdr(find_base_address, nullptr); + } + return g_base_address; +} + +void createStackTraceFile(const char *fileName, const char *appName) +{ + std::ofstream file(fileName); + if (!file.is_open()) { + std::cerr << "Error opening file: " << fileName << std::endl; + return; + } + + void *array[50]; + size_t size; + char **strings; + + size = backtrace(array, 50); + if (size == 0) { + std::cerr << "No stack frames obtained" << std::endl; + return; + } + + uintptr_t base_addr = get_base_address(); + + strings = backtrace_symbols(array, size); + file << "Stack trace info:\n"; + file << "Base address: 0x" << std::hex << base_addr << std::dec << "\n\n"; + + for (size_t i = 0; i < size; ++i) { + file << strings[i] << std::endl; + + uintptr_t addr = reinterpret_cast(array[i]); + uintptr_t offset = addr - base_addr; + + char cmd[512]; + snprintf(cmd, sizeof(cmd), "addr2line -e %s 0x%lx", appName, offset); + + FILE *fp = popen(cmd, "r"); + if (fp) { + char line[256]; + while (fgets(line, sizeof(line), fp)) { + file << " " << line; + } + pclose(fp); + } else { + std::cerr << "Failed to run addr2line command" << std::endl; + } + file << std::endl; + } + + free(strings); + file.close(); +} + +static void signalHandler(int signum) +{ + QString dumpFileName = QString("/home/plg/loginfo/dumpfile_%1.txt").arg(QDateTime::currentDateTime().toString("yyyy_MM_dd_hh_mm_ss")); + QString appName = gAppNameStr; + createStackTraceFile(dumpFileName.toUtf8().data(), appName.toUtf8().data()); + exit(signum); +} + +void installSignalHandlers() +{ + signal(SIGSEGV, signalHandler); + signal(SIGABRT, signalHandler); + signal(SIGILL, signalHandler); + signal(SIGFPE, signalHandler); } \ No newline at end of file diff --git a/dump.h b/dump.h index 3e6dc57..a383680 100644 --- a/dump.h +++ b/dump.h @@ -1,6 +1,6 @@ -#ifndef DUMP_H -#define DUMP_H - -void installSignalHandlers(); - +#ifndef DUMP_H +#define DUMP_H + +void installSignalHandlers(); + #endif // DUMP_H \ No newline at end of file diff --git a/hooks/applypatch-msg.sample b/hooks/applypatch-msg.sample index a5d7b84..f3d6673 100644 --- a/hooks/applypatch-msg.sample +++ b/hooks/applypatch-msg.sample @@ -1,15 +1,15 @@ -#!/bin/sh -# -# An example hook script to check the commit log message taken by -# applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. The hook is -# allowed to edit the commit message file. -# -# To enable this hook, rename this file to "applypatch-msg". - -. git-sh-setup -commitmsg="$(git rev-parse --git-path hooks/commit-msg)" -test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} -: +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/hooks/commit-msg.sample b/hooks/commit-msg.sample index b58d118..a06a8d6 100644 --- a/hooks/commit-msg.sample +++ b/hooks/commit-msg.sample @@ -1,24 +1,24 @@ -#!/bin/sh -# -# An example hook script to check the commit log message. -# Called by "git commit" with one argument, the name of the file -# that has the commit message. The hook should exit with non-zero -# status after issuing an appropriate message if it wants to stop the -# commit. The hook is allowed to edit the commit message file. -# -# To enable this hook, rename this file to "commit-msg". - -# Uncomment the below to add a Signed-off-by line to the message. -# Doing this in a hook is a bad idea in general, but the prepare-commit-msg -# hook is more suited to it. -# -# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" - -# This example catches duplicate Signed-off-by lines. - -test "" = "$(grep '^Signed-off-by: ' "$1" | - sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { - echo >&2 Duplicate Signed-off-by lines. - exit 1 -} +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/hooks/fsmonitor-watchman.sample b/hooks/fsmonitor-watchman.sample index ef94fa2..0eecd82 100644 --- a/hooks/fsmonitor-watchman.sample +++ b/hooks/fsmonitor-watchman.sample @@ -1,109 +1,109 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use IPC::Open2; - -# An example hook script to integrate Watchman -# (https://facebook.github.io/watchman/) with git to speed up detecting -# new and modified files. -# -# The hook is passed a version (currently 1) and a time in nanoseconds -# formatted as a string and outputs to stdout all files that have been -# modified since the given time. Paths must be relative to the root of -# the working tree and separated by a single NUL. -# -# To enable this hook, rename this file to "query-watchman" and set -# 'git config core.fsmonitor .git/hooks/query-watchman' -# -my ($version, $time) = @ARGV; - -# Check the hook interface version - -if ($version == 1) { - # convert nanoseconds to seconds - # subtract one second to make sure watchman will return all changes - $time = int ($time / 1000000000) - 1; -} else { - die "Unsupported query-fsmonitor hook version '$version'.\n" . - "Falling back to scanning...\n"; -} - -my $git_work_tree; -if ($^O =~ 'msys' || $^O =~ 'cygwin') { - $git_work_tree = Win32::GetCwd(); - $git_work_tree =~ tr/\\/\//; -} else { - require Cwd; - $git_work_tree = Cwd::cwd(); -} - -my $retry = 1; - -launch_watchman(); - -sub launch_watchman { - - my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') - or die "open2() failed: $!\n" . - "Falling back to scanning...\n"; - - # In the query expression below we're asking for names of files that - # changed since $time but were not transient (ie created after - # $time but no longer exist). - # - # To accomplish this, we're using the "since" generator to use the - # recency index to select candidate nodes and "fields" to limit the - # output to file names only. - - my $query = <<" END"; - ["query", "$git_work_tree", { - "since": $time, - "fields": ["name"] - }] - END - - print CHLD_IN $query; - close CHLD_IN; - my $response = do {local $/; }; - - die "Watchman: command returned no output.\n" . - "Falling back to scanning...\n" if $response eq ""; - die "Watchman: command returned invalid output: $response\n" . - "Falling back to scanning...\n" unless $response =~ /^\{/; - - my $json_pkg; - eval { - require JSON::XS; - $json_pkg = "JSON::XS"; - 1; - } or do { - require JSON::PP; - $json_pkg = "JSON::PP"; - }; - - my $o = $json_pkg->new->utf8->decode($response); - - if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) { - print STDERR "Adding '$git_work_tree' to watchman's watch list.\n"; - $retry--; - qx/watchman watch "$git_work_tree"/; - die "Failed to make watchman watch '$git_work_tree'.\n" . - "Falling back to scanning...\n" if $? != 0; - - # Watchman will always return all files on the first query so - # return the fast "everything is dirty" flag to git and do the - # Watchman query just to get it over with now so we won't pay - # the cost in git to look up each individual file. - print "/\0"; - eval { launch_watchman() }; - exit 0; - } - - die "Watchman: $o->{error}.\n" . - "Falling back to scanning...\n" if $o->{error}; - - binmode STDOUT, ":utf8"; - local $, = "\0"; - print @{$o->{files}}; -} +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 1) and a time in nanoseconds +# formatted as a string and outputs to stdout all files that have been +# modified since the given time. Paths must be relative to the root of +# the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $time) = @ARGV; + +# Check the hook interface version + +if ($version == 1) { + # convert nanoseconds to seconds + # subtract one second to make sure watchman will return all changes + $time = int ($time / 1000000000) - 1; +} else { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree; +if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $git_work_tree = Win32::GetCwd(); + $git_work_tree =~ tr/\\/\//; +} else { + require Cwd; + $git_work_tree = Cwd::cwd(); +} + +my $retry = 1; + +launch_watchman(); + +sub launch_watchman { + + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $time but were not transient (ie created after + # $time but no longer exist). + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. + + my $query = <<" END"; + ["query", "$git_work_tree", { + "since": $time, + "fields": ["name"] + }] + END + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + my $json_pkg; + eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; + } or do { + require JSON::PP; + $json_pkg = "JSON::PP"; + }; + + my $o = $json_pkg->new->utf8->decode($response); + + if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) { + print STDERR "Adding '$git_work_tree' to watchman's watch list.\n"; + $retry--; + qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + print "/\0"; + eval { launch_watchman() }; + exit 0; + } + + die "Watchman: $o->{error}.\n" . + "Falling back to scanning...\n" if $o->{error}; + + binmode STDOUT, ":utf8"; + local $, = "\0"; + print @{$o->{files}}; +} diff --git a/hooks/post-update.sample b/hooks/post-update.sample index ec17ec1..93e3036 100644 --- a/hooks/post-update.sample +++ b/hooks/post-update.sample @@ -1,8 +1,8 @@ -#!/bin/sh -# -# An example hook script to prepare a packed repository for use over -# dumb transports. -# -# To enable this hook, rename this file to "post-update". - -exec git update-server-info +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/hooks/pre-applypatch.sample b/hooks/pre-applypatch.sample index 4142082..dc0f048 100644 --- a/hooks/pre-applypatch.sample +++ b/hooks/pre-applypatch.sample @@ -1,14 +1,14 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed -# by applypatch from an e-mail message. -# -# The hook should exit with non-zero status after issuing an -# appropriate message if it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-applypatch". - -. git-sh-setup -precommit="$(git rev-parse --git-path hooks/pre-commit)" -test -x "$precommit" && exec "$precommit" ${1+"$@"} -: +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/hooks/pre-commit.sample b/hooks/pre-commit.sample index 6a75641..a95f725 100644 --- a/hooks/pre-commit.sample +++ b/hooks/pre-commit.sample @@ -1,49 +1,49 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. -# -# To enable this hook, rename this file to "pre-commit". - -if git rev-parse --verify HEAD >/dev/null 2>&1 -then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(git hash-object -t tree /dev/null) -fi - -# If you want to allow non-ASCII filenames set this variable to true. -allownonascii=$(git config --bool hooks.allownonascii) - -# Redirect output to stderr. -exec 1>&2 - -# Cross platform projects tend to avoid non-ASCII filenames; prevent -# them from being added to the repository. We exploit the fact that the -# printable range starts at the space character and ends with tilde. -if [ "$allownonascii" != "true" ] && - # Note that the use of brackets around a tr range is ok here, (it's - # even required, for portability to Solaris 10's /usr/bin/tr), since - # the square bracket bytes happen to fall in the designated range. - test $(git diff --cached --name-only --diff-filter=A -z $against | - LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 -then - cat <<\EOF -Error: Attempt to add a non-ASCII file name. - -This can cause problems if you want to work with people on other platforms. - -To be portable it is advisable to rename the file. - -If you know what you are doing you can disable this check using: - - git config hooks.allownonascii true -EOF - exit 1 -fi - -# If there are whitespace errors, print the offending file names and fail. -exec git diff-index --check --cached $against -- +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/hooks/pre-merge-commit.sample b/hooks/pre-merge-commit.sample index 399eab1..d30bc7a 100644 --- a/hooks/pre-merge-commit.sample +++ b/hooks/pre-merge-commit.sample @@ -1,13 +1,13 @@ -#!/bin/sh -# -# An example hook script to verify what is about to be committed. -# Called by "git merge" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message to -# stderr if it wants to stop the merge commit. -# -# To enable this hook, rename this file to "pre-merge-commit". - -. git-sh-setup -test -x "$GIT_DIR/hooks/pre-commit" && - exec "$GIT_DIR/hooks/pre-commit" -: +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff --git a/hooks/pre-push.sample b/hooks/pre-push.sample index 6187dbf..36d10cc 100644 --- a/hooks/pre-push.sample +++ b/hooks/pre-push.sample @@ -1,53 +1,53 @@ -#!/bin/sh - -# An example hook script to verify what is about to be pushed. Called by "git -# push" after it has checked the remote status, but before anything has been -# pushed. If this script exits with a non-zero status nothing will be pushed. -# -# This hook is called with the following parameters: -# -# $1 -- Name of the remote to which the push is being done -# $2 -- URL to which the push is being done -# -# If pushing without using a named remote those arguments will be equal. -# -# Information about the commits which are being pushed is supplied as lines to -# the standard input in the form: -# -# -# -# This sample shows how to prevent push of commits where the log message starts -# with "WIP" (work in progress). - -remote="$1" -url="$2" - -z40=0000000000000000000000000000000000000000 - -while read local_ref local_sha remote_ref remote_sha -do - if [ "$local_sha" = $z40 ] - then - # Handle delete - : - else - if [ "$remote_sha" = $z40 ] - then - # New branch, examine all commits - range="$local_sha" - else - # Update to existing branch, examine new commits - range="$remote_sha..$local_sha" - fi - - # Check for WIP commit - commit=`git rev-list -n 1 --grep '^WIP' "$range"` - if [ -n "$commit" ] - then - echo >&2 "Found WIP commit in $local_ref, not pushing" - exit 1 - fi - fi -done - -exit 0 +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/hooks/pre-rebase.sample b/hooks/pre-rebase.sample index 6cbef5c..070285c 100644 --- a/hooks/pre-rebase.sample +++ b/hooks/pre-rebase.sample @@ -1,169 +1,169 @@ -#!/bin/sh -# -# Copyright (c) 2006, 2008 Junio C Hamano -# -# The "pre-rebase" hook is run just before "git rebase" starts doing -# its job, and can prevent the command from running by exiting with -# non-zero status. -# -# The hook is called with the following parameters: -# -# $1 -- the upstream the series was forked from. -# $2 -- the branch being rebased (or empty when rebasing the current branch). -# -# This sample shows how to prevent topic branches that are already -# merged to 'next' branch from getting rebased, because allowing it -# would result in rebasing already published history. - -publish=next -basebranch="$1" -if test "$#" = 2 -then - topic="refs/heads/$2" -else - topic=`git symbolic-ref HEAD` || - exit 0 ;# we do not interrupt rebasing detached HEAD -fi - -case "$topic" in -refs/heads/??/*) - ;; -*) - exit 0 ;# we do not interrupt others. - ;; -esac - -# Now we are dealing with a topic branch being rebased -# on top of master. Is it OK to rebase it? - -# Does the topic really exist? -git show-ref -q "$topic" || { - echo >&2 "No such branch $topic" - exit 1 -} - -# Is topic fully merged to master? -not_in_master=`git rev-list --pretty=oneline ^master "$topic"` -if test -z "$not_in_master" -then - echo >&2 "$topic is fully merged to master; better remove it." - exit 1 ;# we could allow it, but there is no point. -fi - -# Is topic ever merged to next? If so you should not be rebasing it. -only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` -only_next_2=`git rev-list ^master ${publish} | sort` -if test "$only_next_1" = "$only_next_2" -then - not_in_topic=`git rev-list "^$topic" master` - if test -z "$not_in_topic" - then - echo >&2 "$topic is already up to date with master" - exit 1 ;# we could allow it, but there is no point. - else - exit 0 - fi -else - not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` - /usr/bin/perl -e ' - my $topic = $ARGV[0]; - my $msg = "* $topic has commits already merged to public branch:\n"; - my (%not_in_next) = map { - /^([0-9a-f]+) /; - ($1 => 1); - } split(/\n/, $ARGV[1]); - for my $elem (map { - /^([0-9a-f]+) (.*)$/; - [$1 => $2]; - } split(/\n/, $ARGV[2])) { - if (!exists $not_in_next{$elem->[0]}) { - if ($msg) { - print STDERR $msg; - undef $msg; - } - print STDERR " $elem->[1]\n"; - } - } - ' "$topic" "$not_in_next" "$not_in_master" - exit 1 -fi - -<<\DOC_END - -This sample hook safeguards topic branches that have been -published from being rewound. - -The workflow assumed here is: - - * Once a topic branch forks from "master", "master" is never - merged into it again (either directly or indirectly). - - * Once a topic branch is fully cooked and merged into "master", - it is deleted. If you need to build on top of it to correct - earlier mistakes, a new topic branch is created by forking at - the tip of the "master". This is not strictly necessary, but - it makes it easier to keep your history simple. - - * Whenever you need to test or publish your changes to topic - branches, merge them into "next" branch. - -The script, being an example, hardcodes the publish branch name -to be "next", but it is trivial to make it configurable via -$GIT_DIR/config mechanism. - -With this workflow, you would want to know: - -(1) ... if a topic branch has ever been merged to "next". Young - topic branches can have stupid mistakes you would rather - clean up before publishing, and things that have not been - merged into other branches can be easily rebased without - affecting other people. But once it is published, you would - not want to rewind it. - -(2) ... if a topic branch has been fully merged to "master". - Then you can delete it. More importantly, you should not - build on top of it -- other people may already want to - change things related to the topic as patches against your - "master", so if you need further changes, it is better to - fork the topic (perhaps with the same name) afresh from the - tip of "master". - -Let's look at this example: - - o---o---o---o---o---o---o---o---o---o "next" - / / / / - / a---a---b A / / - / / / / - / / c---c---c---c B / - / / / \ / - / / / b---b C \ / - / / / / \ / - ---o---o---o---o---o---o---o---o---o---o---o "master" - - -A, B and C are topic branches. - - * A has one fix since it was merged up to "next". - - * B has finished. It has been fully merged up to "master" and "next", - and is ready to be deleted. - - * C has not merged to "next" at all. - -We would want to allow C to be rebased, refuse A, and encourage -B to be deleted. - -To compute (1): - - git rev-list ^master ^topic next - git rev-list ^master next - - if these match, topic has not merged in next at all. - -To compute (2): - - git rev-list master..topic - - if this is empty, it is fully merged to "master". - -DOC_END +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/hooks/pre-receive.sample b/hooks/pre-receive.sample index a1fd29e..f9ae974 100644 --- a/hooks/pre-receive.sample +++ b/hooks/pre-receive.sample @@ -1,24 +1,24 @@ -#!/bin/sh -# -# An example hook script to make use of push options. -# The example simply echoes all push options that start with 'echoback=' -# and rejects all pushes when the "reject" push option is used. -# -# To enable this hook, rename this file to "pre-receive". - -if test -n "$GIT_PUSH_OPTION_COUNT" -then - i=0 - while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" - do - eval "value=\$GIT_PUSH_OPTION_$i" - case "$value" in - echoback=*) - echo "echo from the pre-receive-hook: ${value#*=}" >&2 - ;; - reject) - exit 1 - esac - i=$((i + 1)) - done -fi +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/hooks/prepare-commit-msg.sample b/hooks/prepare-commit-msg.sample index 10fa14c..831a4a8 100644 --- a/hooks/prepare-commit-msg.sample +++ b/hooks/prepare-commit-msg.sample @@ -1,42 +1,42 @@ -#!/bin/sh -# -# An example hook script to prepare the commit log message. -# Called by "git commit" with the name of the file that has the -# commit message, followed by the description of the commit -# message's source. The hook's purpose is to edit the commit -# message file. If the hook fails with a non-zero status, -# the commit is aborted. -# -# To enable this hook, rename this file to "prepare-commit-msg". - -# This hook includes three examples. The first one removes the -# "# Please enter the commit message..." help message. -# -# The second includes the output of "git diff --name-status -r" -# into the message, just before the "git status" output. It is -# commented because it doesn't cope with --amend or with squashed -# commits. -# -# The third example adds a Signed-off-by line to the message, that can -# still be edited. This is rarely a good idea. - -COMMIT_MSG_FILE=$1 -COMMIT_SOURCE=$2 -SHA1=$3 - -/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" - -# case "$COMMIT_SOURCE,$SHA1" in -# ,|template,) -# /usr/bin/perl -i.bak -pe ' -# print "\n" . `git diff --cached --name-status -r` -# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; -# *) ;; -# esac - -# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" -# if test -z "$COMMIT_SOURCE" -# then -# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" -# fi +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/hooks/update.sample b/hooks/update.sample index 80ba941..90a1063 100644 --- a/hooks/update.sample +++ b/hooks/update.sample @@ -1,128 +1,128 @@ -#!/bin/sh -# -# An example hook script to block unannotated tags from entering. -# Called by "git receive-pack" with arguments: refname sha1-old sha1-new -# -# To enable this hook, rename this file to "update". -# -# Config -# ------ -# hooks.allowunannotated -# This boolean sets whether unannotated tags will be allowed into the -# repository. By default they won't be. -# hooks.allowdeletetag -# This boolean sets whether deleting tags will be allowed in the -# repository. By default they won't be. -# hooks.allowmodifytag -# This boolean sets whether a tag may be modified after creation. By default -# it won't be. -# hooks.allowdeletebranch -# This boolean sets whether deleting branches will be allowed in the -# repository. By default they won't be. -# hooks.denycreatebranch -# This boolean sets whether remotely creating branches will be denied -# in the repository. By default this is allowed. -# - -# --- Command line -refname="$1" -oldrev="$2" -newrev="$3" - -# --- Safety check -if [ -z "$GIT_DIR" ]; then - echo "Don't run this script from the command line." >&2 - echo " (if you want, you could supply GIT_DIR then run" >&2 - echo " $0 )" >&2 - exit 1 -fi - -if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then - echo "usage: $0 " >&2 - exit 1 -fi - -# --- Config -allowunannotated=$(git config --bool hooks.allowunannotated) -allowdeletebranch=$(git config --bool hooks.allowdeletebranch) -denycreatebranch=$(git config --bool hooks.denycreatebranch) -allowdeletetag=$(git config --bool hooks.allowdeletetag) -allowmodifytag=$(git config --bool hooks.allowmodifytag) - -# check for no description -projectdesc=$(sed -e '1q' "$GIT_DIR/description") -case "$projectdesc" in -"Unnamed repository"* | "") - echo "*** Project description file hasn't been set" >&2 - exit 1 - ;; -esac - -# --- Check types -# if $newrev is 0000...0000, it's a commit to delete a ref. -zero="0000000000000000000000000000000000000000" -if [ "$newrev" = "$zero" ]; then - newrev_type=delete -else - newrev_type=$(git cat-file -t $newrev) -fi - -case "$refname","$newrev_type" in - refs/tags/*,commit) - # un-annotated tag - short_refname=${refname##refs/tags/} - if [ "$allowunannotated" != "true" ]; then - echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 - echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 - exit 1 - fi - ;; - refs/tags/*,delete) - # delete tag - if [ "$allowdeletetag" != "true" ]; then - echo "*** Deleting a tag is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/tags/*,tag) - # annotated tag - if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 - then - echo "*** Tag '$refname' already exists." >&2 - echo "*** Modifying a tag is not allowed in this repository." >&2 - exit 1 - fi - ;; - refs/heads/*,commit) - # branch - if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then - echo "*** Creating a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/heads/*,delete) - # delete branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - refs/remotes/*,commit) - # tracking branch - ;; - refs/remotes/*,delete) - # delete tracking branch - if [ "$allowdeletebranch" != "true" ]; then - echo "*** Deleting a tracking branch is not allowed in this repository" >&2 - exit 1 - fi - ;; - *) - # Anything else (is there anything else?) - echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 - exit 1 - ;; -esac - -# --- Finished -exit 0 +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/image.qrc b/image.qrc index 2208c67..46b0d2d 100644 --- a/image.qrc +++ b/image.qrc @@ -1,1019 +1,1019 @@ - - - image/ALARMGreen.PNG - image/ALARMRed.PNG - image/ALARMYellow.PNG - image/suctionON.png - image/jetOFF.png - image/jetON.png - image/suctionOFF.png - image/reset.png - image/Turkey_logo.png - icon/exportpdf.png - icon/fileopen.png - icon/filesave.png - icon/zoomin.png - icon/zoomout.png - icon/filenew.png - icon/textbold.png - icon/preview.png - icon/edit.png - icon/filesaveas.png - icon/font.png - icon/pauseprint.png - icon/startprint.png - icon/stopprint.png - icon/closereclaimtanl.png - icon/openreclaimtanl.png - icon/poweroff.png - icon/arrowdown.png - icon/arrowleft.png - icon/arrowright.png - icon/arrowup.png - icon/fileimport.png - icon/apply.png - icon/cleanup.png - icon/controlbyhand.png - icon/factorysetting.png - icon/searchsuitablevoltage.png - icon/time.png - icon/updatefont.png - icon/updatesoftware.png - icon/screenfix.png - icon/searchsuitablefrequency.png - icon/counter.png - icon/lockphase.png - icon/keybackspace.png - icon/keydown.png - icon/keyenter.png - icon/keyright.png - icon/keyshift.png - icon/keyup.png - icon/keyinput.png - icon/filedelete.png - icon/filedelete2.png - icon/keydelete.png - icon/keyend.png - icon/keyhide.png - icon/keyhome.png - icon/keyleft.png - icon/lastpage.png - icon/nextpage.png - icon/specialchar.png - icon/vari.png - icon/exit.png - icon/export.png - icon/fileoperation.png - icon/udisk.png - icon/import.png - icon/localdisk.png - icon/insert.png - icon/sure.png - icon/leftright.png - icon/updown.png - icon/pulse.png - icon/linespace.png - 0/image/digitalWidth1.bmp - 0/image/digitalWidth2.bmp - 0/image/digitalWidth3.bmp - 0/image/digitalWidth4.bmp - 0/image/digitalWidth5.bmp - 0/image/digitalWidth6.bmp - 0/image/digitalWidth7.bmp - 0/image/digitalWidth8.bmp - 1/image/digitalWidth1.bmp - 1/image/digitalWidth2.bmp - 1/image/digitalWidth3.bmp - 1/image/digitalWidth4.bmp - 1/image/digitalWidth5.bmp - 1/image/digitalWidth6.bmp - 1/image/digitalWidth7.bmp - 1/image/digitalWidth8.bmp - 2/image/digitalWidth1.bmp - 2/image/digitalWidth2.bmp - 2/image/digitalWidth3.bmp - 2/image/digitalWidth4.bmp - 2/image/digitalWidth5.bmp - 2/image/digitalWidth6.bmp - 2/image/digitalWidth7.bmp - 2/image/digitalWidth8.bmp - 3/image/digitalWidth1.bmp - 3/image/digitalWidth2.bmp - 3/image/digitalWidth3.bmp - 3/image/digitalWidth4.bmp - 3/image/digitalWidth5.bmp - 3/image/digitalWidth6.bmp - 3/image/digitalWidth7.bmp - 3/image/digitalWidth8.bmp - 4/image/digitalWidth1.bmp - 4/image/digitalWidth2.bmp - 4/image/digitalWidth3.bmp - 4/image/digitalWidth4.bmp - 4/image/digitalWidth5.bmp - 4/image/digitalWidth6.bmp - 4/image/digitalWidth7.bmp - 4/image/digitalWidth8.bmp - 5/image/digitalWidth1.bmp - 5/image/digitalWidth2.bmp - 5/image/digitalWidth3.bmp - 5/image/digitalWidth4.bmp - 5/image/digitalWidth5.bmp - 5/image/digitalWidth6.bmp - 5/image/digitalWidth7.bmp - 5/image/digitalWidth8.bmp - 6/image/digitalWidth1.bmp - 6/image/digitalWidth2.bmp - 6/image/digitalWidth3.bmp - 6/image/digitalWidth4.bmp - 6/image/digitalWidth5.bmp - 6/image/digitalWidth6.bmp - 6/image/digitalWidth7.bmp - 6/image/digitalWidth8.bmp - 7/image/digitalWidth1.bmp - 7/image/digitalWidth2.bmp - 7/image/digitalWidth3.bmp - 7/image/digitalWidth4.bmp - 7/image/digitalWidth5.bmp - 7/image/digitalWidth6.bmp - 7/image/digitalWidth7.bmp - 7/image/digitalWidth8.bmp - 8/image/digitalWidth1.bmp - 8/image/digitalWidth2.bmp - 8/image/digitalWidth3.bmp - 8/image/digitalWidth4.bmp - 8/image/digitalWidth5.bmp - 8/image/digitalWidth6.bmp - 8/image/digitalWidth7.bmp - 8/image/digitalWidth8.bmp - 13/image/digitalWidth1.bmp - 13/image/digitalWidth2.bmp - 13/image/digitalWidth3.bmp - 13/image/digitalWidth4.bmp - 13/image/digitalWidth5.bmp - 13/image/digitalWidth6.bmp - 13/image/digitalWidth7.bmp - 13/image/digitalWidth8.bmp - 0/image/digitalWidth175.bmp - 0/image/digitalWidth275.bmp - 0/image/digitalWidth375.bmp - 0/image/digitalWidth475.bmp - 0/image/digitalWidth575.bmp - 0/image/digitalWidth675.bmp - 0/image/digitalWidth775.bmp - 0/image/digitalWidth875.bmp - 1/image/digitalWidth175.bmp - 1/image/digitalWidth275.bmp - 1/image/digitalWidth375.bmp - 1/image/digitalWidth475.bmp - 1/image/digitalWidth575.bmp - 1/image/digitalWidth675.bmp - 1/image/digitalWidth775.bmp - 1/image/digitalWidth875.bmp - 2/image/digitalWidth175.bmp - 2/image/digitalWidth275.bmp - 2/image/digitalWidth375.bmp - 2/image/digitalWidth475.bmp - 2/image/digitalWidth575.bmp - 2/image/digitalWidth675.bmp - 2/image/digitalWidth775.bmp - 2/image/digitalWidth875.bmp - 3/image/digitalWidth175.bmp - 3/image/digitalWidth275.bmp - 3/image/digitalWidth375.bmp - 3/image/digitalWidth475.bmp - 3/image/digitalWidth575.bmp - 3/image/digitalWidth675.bmp - 3/image/digitalWidth775.bmp - 3/image/digitalWidth875.bmp - 4/image/digitalWidth175.bmp - 4/image/digitalWidth275.bmp - 4/image/digitalWidth375.bmp - 4/image/digitalWidth475.bmp - 4/image/digitalWidth575.bmp - 4/image/digitalWidth675.bmp - 4/image/digitalWidth775.bmp - 4/image/digitalWidth875.bmp - 5/image/digitalWidth175.bmp - 5/image/digitalWidth275.bmp - 5/image/digitalWidth375.bmp - 5/image/digitalWidth475.bmp - 5/image/digitalWidth575.bmp - 5/image/digitalWidth675.bmp - 5/image/digitalWidth775.bmp - 5/image/digitalWidth875.bmp - 6/image/digitalWidth175.bmp - 6/image/digitalWidth275.bmp - 6/image/digitalWidth375.bmp - 6/image/digitalWidth475.bmp - 6/image/digitalWidth575.bmp - 6/image/digitalWidth675.bmp - 6/image/digitalWidth775.bmp - 6/image/digitalWidth875.bmp - 7/image/digitalWidth175.bmp - 7/image/digitalWidth275.bmp - 7/image/digitalWidth375.bmp - 7/image/digitalWidth475.bmp - 7/image/digitalWidth575.bmp - 7/image/digitalWidth675.bmp - 7/image/digitalWidth775.bmp - 7/image/digitalWidth875.bmp - 8/image/digitalWidth175.bmp - 8/image/digitalWidth275.bmp - 8/image/digitalWidth375.bmp - 8/image/digitalWidth475.bmp - 8/image/digitalWidth575.bmp - 8/image/digitalWidth675.bmp - 8/image/digitalWidth775.bmp - 8/image/digitalWidth875.bmp - 13/image/digitalWidth175.bmp - 13/image/digitalWidth275.bmp - 13/image/digitalWidth375.bmp - 13/image/digitalWidth475.bmp - 13/image/digitalWidth575.bmp - 13/image/digitalWidth675.bmp - 13/image/digitalWidth775.bmp - 13/image/digitalWidth875.bmp - icon/startprint1.png - icon/startprint2.png - icon/stopprint1.png - icon/stopprint2.png - icon/pauseprint1.png - icon/pauseprint2.png - icon/TEXT.PNG - buge_record.txt - icon/Epauseprint.png - icon/Epauseprint1.png - icon/Epauseprint2.png - icon/Estartprint.png - icon/Estartprint1.png - icon/Estartprint2.png - icon/EstopPrint2.png - icon/BarCode1.png - icon/bypm.png - 11/image/BARV16.bmp - 11/image/BARV12.bmp - 9/image/DMTV32.bmp - 9/image/DMTV26.bmp - 9/image/DMTV24.bmp - 9/image/DMTV22.bmp - 9/image/DMTV20.bmp - 9/image/DMTV18.bmp - 9/image/DMTV16.bmp - 9/image/DMTV14.bmp - 9/image/DMTV12.bmp - 9/image/DMTV10.bmp - 10/image/QRV37.bmp - 10/image/QRV33.bmp - 10/image/QRV29.bmp - 10/image/QRV25.bmp - 10/image/QRV21.bmp - image/AH12.png - image/ZFKD.png - image/MIV12.png - icon/10008.ico - icon/a9.ico - image/AH13.png - image/MIV13.png - image/ZFKD2.png - 12/image/digitalWidth13.bmp - 12/image/digitalWidth1375.bmp - 12/image/digitalWidth16.bmp - 12/image/digitalWidth1675.bmp - 12/image/digitalWidth1575.bmp - 12/image/digitalWidth15.bmp - 12/image/digitalWidth1475.bmp - 12/image/digitalWidth14.bmp - 12/image/digitalWidth1275.bmp - 12/image/digitalWidth12.bmp - 12/image/digitalWidth1175.bmp - 12/image/digitalWidth11.bmp - 12/image/digitalWidth1075.bmp - 12/image/digitalWidth10.bmp - 12/image/digitalWidth975.bmp - 12/image/digitalWidth9.bmp - 12/image/digitalWidth475.bmp - 12/image/digitalWidth1.bmp - 12/image/digitalWidth875.bmp - 12/image/digitalWidth8.bmp - 12/image/digitalWidth775.bmp - 12/image/digitalWidth7.bmp - 12/image/digitalWidth675.bmp - 12/image/digitalWidth6.bmp - 12/image/digitalWidth575.bmp - 12/image/digitalWidth4.bmp - 12/image/digitalWidth375.bmp - 12/image/digitalWidth3.bmp - 12/image/digitalWidth275.bmp - 12/image/digitalWidth2.bmp - 12/image/digitalWidth5.bmp - 12/image/digitalWidth175.bmp - 40/image/digitalWidth875.bmp - 40/image/digitalWidth4.bmp - 40/image/digitalWidth375.bmp - 40/image/digitalWidth3.bmp - 40/image/digitalWidth275.bmp - 40/image/digitalWidth2.bmp - 40/image/digitalWidth175.bmp - 40/image/digitalWidth475.bmp - 40/image/digitalWidth5.bmp - 40/image/digitalWidth8.bmp - 40/image/digitalWidth775.bmp - 40/image/digitalWidth7.bmp - 40/image/digitalWidth675.bmp - 40/image/digitalWidth6.bmp - 40/image/digitalWidth575.bmp - 40/image/digitalWidth1.bmp - 41/image/digitalWidth1.bmp - 41/image/digitalWidth2.bmp - 41/image/digitalWidth3.bmp - 41/image/digitalWidth4.bmp - 41/image/digitalWidth5.bmp - 41/image/digitalWidth6.bmp - 41/image/digitalWidth7.bmp - 41/image/digitalWidth8.bmp - 41/image/digitalWidth175.bmp - 41/image/digitalWidth275.bmp - 41/image/digitalWidth375.bmp - 41/image/digitalWidth475.bmp - 41/image/digitalWidth575.bmp - 41/image/digitalWidth675.bmp - 41/image/digitalWidth775.bmp - 41/image/digitalWidth875.bmp - 42/image/digitalWidth1.bmp - 42/image/digitalWidth2.bmp - 42/image/digitalWidth3.bmp - 42/image/digitalWidth4.bmp - 42/image/digitalWidth5.bmp - 42/image/digitalWidth6.bmp - 42/image/digitalWidth7.bmp - 42/image/digitalWidth8.bmp - 42/image/digitalWidth175.bmp - 42/image/digitalWidth275.bmp - 42/image/digitalWidth375.bmp - 42/image/digitalWidth475.bmp - 42/image/digitalWidth575.bmp - 42/image/digitalWidth675.bmp - 42/image/digitalWidth775.bmp - 42/image/digitalWidth875.bmp - 43/image/digitalWidth1.bmp - 43/image/digitalWidth2.bmp - 43/image/digitalWidth3.bmp - 43/image/digitalWidth4.bmp - 43/image/digitalWidth5.bmp - 43/image/digitalWidth6.bmp - 43/image/digitalWidth7.bmp - 43/image/digitalWidth8.bmp - 43/image/digitalWidth175.bmp - 43/image/digitalWidth275.bmp - 43/image/digitalWidth375.bmp - 43/image/digitalWidth475.bmp - 43/image/digitalWidth575.bmp - 43/image/digitalWidth675.bmp - 43/image/digitalWidth775.bmp - 43/image/digitalWidth875.bmp - 44/image/digitalWidth1.bmp - 44/image/digitalWidth2.bmp - 44/image/digitalWidth3.bmp - 44/image/digitalWidth4.bmp - 44/image/digitalWidth5.bmp - 44/image/digitalWidth6.bmp - 44/image/digitalWidth7.bmp - 44/image/digitalWidth8.bmp - 44/image/digitalWidth175.bmp - 44/image/digitalWidth275.bmp - 44/image/digitalWidth375.bmp - 44/image/digitalWidth475.bmp - 44/image/digitalWidth575.bmp - 44/image/digitalWidth675.bmp - 44/image/digitalWidth775.bmp - 44/image/digitalWidth875.bmp - 45/image/digitalWidth1.bmp - 45/image/digitalWidth2.bmp - 45/image/digitalWidth3.bmp - 45/image/digitalWidth4.bmp - 45/image/digitalWidth5.bmp - 45/image/digitalWidth6.bmp - 45/image/digitalWidth7.bmp - 45/image/digitalWidth8.bmp - 45/image/digitalWidth175.bmp - 45/image/digitalWidth275.bmp - 45/image/digitalWidth375.bmp - 45/image/digitalWidth475.bmp - 45/image/digitalWidth575.bmp - 45/image/digitalWidth675.bmp - 45/image/digitalWidth775.bmp - 45/image/digitalWidth875.bmp - 46/image/digitalWidth1.bmp - 46/image/digitalWidth2.bmp - 46/image/digitalWidth3.bmp - 46/image/digitalWidth4.bmp - 46/image/digitalWidth5.bmp - 46/image/digitalWidth6.bmp - 46/image/digitalWidth7.bmp - 46/image/digitalWidth8.bmp - 46/image/digitalWidth175.bmp - 46/image/digitalWidth275.bmp - 46/image/digitalWidth375.bmp - 46/image/digitalWidth475.bmp - 46/image/digitalWidth575.bmp - 46/image/digitalWidth675.bmp - 46/image/digitalWidth775.bmp - 46/image/digitalWidth875.bmp - 47/image/digitalWidth1.bmp - 47/image/digitalWidth2.bmp - 47/image/digitalWidth3.bmp - 47/image/digitalWidth4.bmp - 47/image/digitalWidth5.bmp - 47/image/digitalWidth6.bmp - 47/image/digitalWidth7.bmp - 47/image/digitalWidth8.bmp - 47/image/digitalWidth175.bmp - 47/image/digitalWidth275.bmp - 47/image/digitalWidth375.bmp - 47/image/digitalWidth475.bmp - 47/image/digitalWidth575.bmp - 47/image/digitalWidth675.bmp - 47/image/digitalWidth775.bmp - 47/image/digitalWidth875.bmp - 48/image/digitalWidth1.bmp - 48/image/digitalWidth2.bmp - 48/image/digitalWidth3.bmp - 48/image/digitalWidth4.bmp - 48/image/digitalWidth5.bmp - 48/image/digitalWidth6.bmp - 48/image/digitalWidth7.bmp - 48/image/digitalWidth8.bmp - 48/image/digitalWidth175.bmp - 48/image/digitalWidth275.bmp - 48/image/digitalWidth375.bmp - 48/image/digitalWidth475.bmp - 48/image/digitalWidth575.bmp - 48/image/digitalWidth675.bmp - 48/image/digitalWidth775.bmp - 48/image/digitalWidth875.bmp - 20/image/digitalWidth1.bmp - 20/image/digitalWidth2.bmp - 20/image/digitalWidth3.bmp - 20/image/digitalWidth4.bmp - 20/image/digitalWidth5.bmp - 20/image/digitalWidth6.bmp - 20/image/digitalWidth7.bmp - 20/image/digitalWidth8.bmp - 20/image/digitalWidth175.bmp - 20/image/digitalWidth275.bmp - 20/image/digitalWidth375.bmp - 20/image/digitalWidth475.bmp - 20/image/digitalWidth575.bmp - 20/image/digitalWidth675.bmp - 20/image/digitalWidth775.bmp - 20/image/digitalWidth875.bmp - 21/image/digitalWidth1.bmp - 21/image/digitalWidth2.bmp - 21/image/digitalWidth3.bmp - 21/image/digitalWidth4.bmp - 21/image/digitalWidth5.bmp - 21/image/digitalWidth6.bmp - 21/image/digitalWidth7.bmp - 21/image/digitalWidth8.bmp - 21/image/digitalWidth175.bmp - 21/image/digitalWidth275.bmp - 21/image/digitalWidth375.bmp - 21/image/digitalWidth475.bmp - 21/image/digitalWidth575.bmp - 21/image/digitalWidth675.bmp - 21/image/digitalWidth775.bmp - 21/image/digitalWidth875.bmp - 22/image/digitalWidth1.bmp - 22/image/digitalWidth2.bmp - 22/image/digitalWidth3.bmp - 22/image/digitalWidth4.bmp - 22/image/digitalWidth5.bmp - 22/image/digitalWidth6.bmp - 22/image/digitalWidth7.bmp - 22/image/digitalWidth8.bmp - 22/image/digitalWidth175.bmp - 22/image/digitalWidth275.bmp - 22/image/digitalWidth375.bmp - 22/image/digitalWidth475.bmp - 22/image/digitalWidth575.bmp - 22/image/digitalWidth675.bmp - 22/image/digitalWidth775.bmp - 22/image/digitalWidth875.bmp - 23/image/digitalWidth1.bmp - 23/image/digitalWidth2.bmp - 23/image/digitalWidth3.bmp - 23/image/digitalWidth4.bmp - 23/image/digitalWidth5.bmp - 23/image/digitalWidth6.bmp - 23/image/digitalWidth7.bmp - 23/image/digitalWidth8.bmp - 23/image/digitalWidth175.bmp - 23/image/digitalWidth275.bmp - 23/image/digitalWidth375.bmp - 23/image/digitalWidth475.bmp - 23/image/digitalWidth575.bmp - 23/image/digitalWidth675.bmp - 23/image/digitalWidth775.bmp - 23/image/digitalWidth875.bmp - 24/image/digitalWidth1.bmp - 24/image/digitalWidth2.bmp - 24/image/digitalWidth3.bmp - 24/image/digitalWidth4.bmp - 24/image/digitalWidth5.bmp - 24/image/digitalWidth6.bmp - 24/image/digitalWidth7.bmp - 24/image/digitalWidth8.bmp - 24/image/digitalWidth175.bmp - 24/image/digitalWidth275.bmp - 24/image/digitalWidth375.bmp - 24/image/digitalWidth475.bmp - 24/image/digitalWidth575.bmp - 24/image/digitalWidth675.bmp - 24/image/digitalWidth775.bmp - 24/image/digitalWidth875.bmp - 25/image/digitalWidth1.bmp - 25/image/digitalWidth2.bmp - 25/image/digitalWidth3.bmp - 25/image/digitalWidth4.bmp - 25/image/digitalWidth5.bmp - 25/image/digitalWidth6.bmp - 25/image/digitalWidth7.bmp - 25/image/digitalWidth8.bmp - 25/image/digitalWidth175.bmp - 25/image/digitalWidth275.bmp - 25/image/digitalWidth375.bmp - 25/image/digitalWidth475.bmp - 25/image/digitalWidth575.bmp - 25/image/digitalWidth675.bmp - 25/image/digitalWidth775.bmp - 25/image/digitalWidth875.bmp - 26/image/digitalWidth1.bmp - 26/image/digitalWidth2.bmp - 26/image/digitalWidth3.bmp - 26/image/digitalWidth4.bmp - 26/image/digitalWidth5.bmp - 26/image/digitalWidth6.bmp - 26/image/digitalWidth7.bmp - 26/image/digitalWidth8.bmp - 26/image/digitalWidth175.bmp - 26/image/digitalWidth275.bmp - 26/image/digitalWidth375.bmp - 26/image/digitalWidth475.bmp - 26/image/digitalWidth575.bmp - 26/image/digitalWidth675.bmp - 26/image/digitalWidth775.bmp - 26/image/digitalWidth875.bmp - 27/image/digitalWidth1.bmp - 27/image/digitalWidth2.bmp - 27/image/digitalWidth3.bmp - 27/image/digitalWidth4.bmp - 27/image/digitalWidth5.bmp - 27/image/digitalWidth6.bmp - 27/image/digitalWidth7.bmp - 27/image/digitalWidth8.bmp - 27/image/digitalWidth175.bmp - 27/image/digitalWidth275.bmp - 27/image/digitalWidth375.bmp - 27/image/digitalWidth475.bmp - 27/image/digitalWidth575.bmp - 27/image/digitalWidth675.bmp - 27/image/digitalWidth775.bmp - 27/image/digitalWidth875.bmp - 28/image/digitalWidth1.bmp - 28/image/digitalWidth2.bmp - 28/image/digitalWidth3.bmp - 28/image/digitalWidth4.bmp - 28/image/digitalWidth5.bmp - 28/image/digitalWidth6.bmp - 28/image/digitalWidth7.bmp - 28/image/digitalWidth8.bmp - 28/image/digitalWidth175.bmp - 28/image/digitalWidth275.bmp - 28/image/digitalWidth375.bmp - 28/image/digitalWidth475.bmp - 28/image/digitalWidth575.bmp - 28/image/digitalWidth675.bmp - 28/image/digitalWidth775.bmp - 28/image/digitalWidth875.bmp - 11/image/BARV5.bmp - 11/image/BARV7.bmp - 11/image/BARV9.bmp - 11/image/BARV24.bmp - 11/image/BARV105.bmp - 11/image/BARV107.bmp - 11/image/BARV109.bmp - 11/image/BARV112.bmp - 11/image/BARV116.bmp - 11/image/BARV124.bmp - 11/image/BARV205.bmp - 11/image/BARV207.bmp - 11/image/BARV209.bmp - 11/image/BARV212.bmp - 11/image/BARV216.bmp - 11/image/BARV224.bmp - 80/image/digitalWidth8.bmp - 81/image/curDate875.bmp - 66/image/digitalWidth875.bmp - 66/image/digitalWidth8.bmp - 81/image/curDate8.bmp - 80/image/expiryDate8.bmp - 80/image/expiryDate875.bmp - 80/image/digitalWidth1.bmp - 80/image/digitalWidth175.bmp - 81/image/curDate1.bmp - 82/image/class1.bmp - 82/image/class91.bmp - 30/image/digitalWidth1.bmp - 30/image/digitalWidth2.bmp - 30/image/digitalWidth3.bmp - 30/image/digitalWidth4.bmp - 30/image/digitalWidth5.bmp - 30/image/digitalWidth6.bmp - 30/image/digitalWidth7.bmp - 30/image/digitalWidth8.bmp - 30/image/digitalWidth175.bmp - 30/image/digitalWidth275.bmp - 30/image/digitalWidth375.bmp - 30/image/digitalWidth475.bmp - 30/image/digitalWidth575.bmp - 30/image/digitalWidth675.bmp - 30/image/digitalWidth775.bmp - 30/image/digitalWidth875.bmp - 31/image/digitalWidth1.bmp - 31/image/digitalWidth2.bmp - 31/image/digitalWidth3.bmp - 31/image/digitalWidth4.bmp - 31/image/digitalWidth5.bmp - 31/image/digitalWidth6.bmp - 31/image/digitalWidth7.bmp - 31/image/digitalWidth8.bmp - 31/image/digitalWidth175.bmp - 31/image/digitalWidth275.bmp - 31/image/digitalWidth375.bmp - 31/image/digitalWidth475.bmp - 31/image/digitalWidth575.bmp - 31/image/digitalWidth675.bmp - 31/image/digitalWidth775.bmp - 31/image/digitalWidth875.bmp - 32/image/digitalWidth1.bmp - 32/image/digitalWidth2.bmp - 32/image/digitalWidth3.bmp - 32/image/digitalWidth4.bmp - 32/image/digitalWidth5.bmp - 32/image/digitalWidth6.bmp - 32/image/digitalWidth7.bmp - 32/image/digitalWidth8.bmp - 32/image/digitalWidth175.bmp - 32/image/digitalWidth275.bmp - 32/image/digitalWidth375.bmp - 32/image/digitalWidth475.bmp - 32/image/digitalWidth575.bmp - 32/image/digitalWidth675.bmp - 32/image/digitalWidth775.bmp - 32/image/digitalWidth875.bmp - 33/image/digitalWidth1.bmp - 33/image/digitalWidth2.bmp - 33/image/digitalWidth3.bmp - 33/image/digitalWidth4.bmp - 33/image/digitalWidth5.bmp - 33/image/digitalWidth6.bmp - 33/image/digitalWidth7.bmp - 33/image/digitalWidth8.bmp - 33/image/digitalWidth175.bmp - 33/image/digitalWidth275.bmp - 33/image/digitalWidth375.bmp - 33/image/digitalWidth475.bmp - 33/image/digitalWidth575.bmp - 33/image/digitalWidth675.bmp - 33/image/digitalWidth775.bmp - 33/image/digitalWidth875.bmp - 34/image/digitalWidth1.bmp - 34/image/digitalWidth2.bmp - 34/image/digitalWidth3.bmp - 34/image/digitalWidth4.bmp - 34/image/digitalWidth5.bmp - 34/image/digitalWidth6.bmp - 34/image/digitalWidth7.bmp - 34/image/digitalWidth8.bmp - 34/image/digitalWidth175.bmp - 34/image/digitalWidth275.bmp - 34/image/digitalWidth375.bmp - 34/image/digitalWidth475.bmp - 34/image/digitalWidth575.bmp - 34/image/digitalWidth675.bmp - 34/image/digitalWidth775.bmp - 34/image/digitalWidth875.bmp - 35/image/digitalWidth1.bmp - 35/image/digitalWidth2.bmp - 35/image/digitalWidth3.bmp - 35/image/digitalWidth4.bmp - 35/image/digitalWidth5.bmp - 35/image/digitalWidth6.bmp - 35/image/digitalWidth7.bmp - 35/image/digitalWidth8.bmp - 35/image/digitalWidth175.bmp - 35/image/digitalWidth275.bmp - 35/image/digitalWidth375.bmp - 35/image/digitalWidth475.bmp - 35/image/digitalWidth575.bmp - 35/image/digitalWidth675.bmp - 35/image/digitalWidth775.bmp - 35/image/digitalWidth875.bmp - 36/image/digitalWidth1.bmp - 36/image/digitalWidth2.bmp - 36/image/digitalWidth3.bmp - 36/image/digitalWidth4.bmp - 36/image/digitalWidth5.bmp - 36/image/digitalWidth6.bmp - 36/image/digitalWidth7.bmp - 36/image/digitalWidth8.bmp - 36/image/digitalWidth175.bmp - 36/image/digitalWidth275.bmp - 36/image/digitalWidth375.bmp - 36/image/digitalWidth475.bmp - 36/image/digitalWidth575.bmp - 36/image/digitalWidth675.bmp - 36/image/digitalWidth775.bmp - 36/image/digitalWidth875.bmp - 38/image/digitalWidth1.bmp - 38/image/digitalWidth2.bmp - 38/image/digitalWidth3.bmp - 38/image/digitalWidth4.bmp - 38/image/digitalWidth5.bmp - 38/image/digitalWidth6.bmp - 38/image/digitalWidth7.bmp - 38/image/digitalWidth8.bmp - 38/image/digitalWidth175.bmp - 38/image/digitalWidth275.bmp - 38/image/digitalWidth375.bmp - 38/image/digitalWidth475.bmp - 38/image/digitalWidth575.bmp - 38/image/digitalWidth675.bmp - 38/image/digitalWidth775.bmp - 38/image/digitalWidth875.bmp - 37/image/digitalWidth1.bmp - 37/image/digitalWidth2.bmp - 37/image/digitalWidth3.bmp - 37/image/digitalWidth4.bmp - 37/image/digitalWidth5.bmp - 37/image/digitalWidth6.bmp - 37/image/digitalWidth7.bmp - 37/image/digitalWidth8.bmp - 37/image/digitalWidth175.bmp - 37/image/digitalWidth275.bmp - 37/image/digitalWidth375.bmp - 37/image/digitalWidth475.bmp - 37/image/digitalWidth575.bmp - 37/image/digitalWidth675.bmp - 37/image/digitalWidth775.bmp - 37/image/digitalWidth875.bmp - 90/image/digitalWidth1.bmp - 90/image/digitalWidth8.bmp - 90/image/digitalWidth8.xcf - 90/image/digitalWidth8 (____).bmp - 90/image/digitalWidth88.bmp - 90/image/digitalWidth175.bmp - 90/image/expiryDate8.bmp - 90/image/expiryDate8_backup.bmp - 90/image/expiryDate875.bmp - 90/image/expiryDate875_backup.bmp - 91/image/curDate1.bmp - 91/image/curDate8.bmp - 91/image/curDate8_backup.bmp - 91/image/curDate875.bmp - 91/image/digitalWidth1.bmp - 91/image/digitalWidth8.bmp - 91/image/digitalWidth8.xcf - 91/image/digitalWidth8 (____).bmp - 91/image/digitalWidth88.bmp - 91/image/expiryDate8.bmp - 91/image/expiryDate875.bmp - 50/image/digitalWidth1.bmp - 50/image/digitalWidth2.bmp - 50/image/digitalWidth3.bmp - 50/image/digitalWidth4.bmp - 50/image/digitalWidth5.bmp - 50/image/digitalWidth6.bmp - 50/image/digitalWidth7.bmp - 50/image/digitalWidth8.bmp - 50/image/digitalWidth175.bmp - 50/image/digitalWidth275.bmp - 50/image/digitalWidth375.bmp - 50/image/digitalWidth475.bmp - 50/image/digitalWidth575.bmp - 50/image/digitalWidth675.bmp - 50/image/digitalWidth775.bmp - 50/image/digitalWidth875.bmp - 51/image/digitalWidth1.bmp - 51/image/digitalWidth2.bmp - 51/image/digitalWidth3.bmp - 51/image/digitalWidth4.bmp - 51/image/digitalWidth5.bmp - 51/image/digitalWidth6.bmp - 51/image/digitalWidth7.bmp - 51/image/digitalWidth8.bmp - 51/image/digitalWidth175.bmp - 51/image/digitalWidth275.bmp - 51/image/digitalWidth375.bmp - 51/image/digitalWidth475.bmp - 51/image/digitalWidth575.bmp - 51/image/digitalWidth675.bmp - 51/image/digitalWidth775.bmp - 51/image/digitalWidth875.bmp - 52/image/digitalWidth1.bmp - 52/image/digitalWidth2.bmp - 52/image/digitalWidth3.bmp - 52/image/digitalWidth4.bmp - 52/image/digitalWidth5.bmp - 52/image/digitalWidth6.bmp - 52/image/digitalWidth7.bmp - 52/image/digitalWidth8.bmp - 52/image/digitalWidth175.bmp - 52/image/digitalWidth275.bmp - 52/image/digitalWidth375.bmp - 52/image/digitalWidth475.bmp - 52/image/digitalWidth575.bmp - 52/image/digitalWidth675.bmp - 52/image/digitalWidth775.bmp - 52/image/digitalWidth875.bmp - 53/image/digitalWidth1.bmp - 53/image/digitalWidth2.bmp - 53/image/digitalWidth3.bmp - 53/image/digitalWidth4.bmp - 53/image/digitalWidth5.bmp - 53/image/digitalWidth6.bmp - 53/image/digitalWidth7.bmp - 53/image/digitalWidth8.bmp - 53/image/digitalWidth175.bmp - 53/image/digitalWidth275.bmp - 53/image/digitalWidth375.bmp - 53/image/digitalWidth475.bmp - 53/image/digitalWidth575.bmp - 53/image/digitalWidth675.bmp - 53/image/digitalWidth775.bmp - 53/image/digitalWidth875.bmp - 54/image/digitalWidth1.bmp - 54/image/digitalWidth2.bmp - 54/image/digitalWidth3.bmp - 54/image/digitalWidth4.bmp - 54/image/digitalWidth5.bmp - 54/image/digitalWidth6.bmp - 54/image/digitalWidth7.bmp - 54/image/digitalWidth8.bmp - 54/image/digitalWidth175.bmp - 54/image/digitalWidth275.bmp - 54/image/digitalWidth375.bmp - 54/image/digitalWidth475.bmp - 54/image/digitalWidth575.bmp - 54/image/digitalWidth675.bmp - 54/image/digitalWidth775.bmp - 54/image/digitalWidth875.bmp - 55/image/digitalWidth1.bmp - 55/image/digitalWidth2.bmp - 55/image/digitalWidth3.bmp - 55/image/digitalWidth4.bmp - 55/image/digitalWidth5.bmp - 55/image/digitalWidth6.bmp - 55/image/digitalWidth7.bmp - 55/image/digitalWidth8.bmp - 55/image/digitalWidth175.bmp - 55/image/digitalWidth275.bmp - 55/image/digitalWidth375.bmp - 55/image/digitalWidth475.bmp - 55/image/digitalWidth575.bmp - 55/image/digitalWidth675.bmp - 55/image/digitalWidth775.bmp - 55/image/digitalWidth875.bmp - 56/image/digitalWidth1.bmp - 56/image/digitalWidth2.bmp - 56/image/digitalWidth3.bmp - 56/image/digitalWidth4.bmp - 56/image/digitalWidth5.bmp - 56/image/digitalWidth6.bmp - 56/image/digitalWidth7.bmp - 56/image/digitalWidth8.bmp - 56/image/digitalWidth175.bmp - 56/image/digitalWidth275.bmp - 56/image/digitalWidth375.bmp - 56/image/digitalWidth475.bmp - 56/image/digitalWidth575.bmp - 56/image/digitalWidth675.bmp - 56/image/digitalWidth775.bmp - 56/image/digitalWidth875.bmp - 57/image/digitalWidth1.bmp - 57/image/digitalWidth2.bmp - 57/image/digitalWidth3.bmp - 57/image/digitalWidth4.bmp - 57/image/digitalWidth5.bmp - 57/image/digitalWidth6.bmp - 57/image/digitalWidth7.bmp - 57/image/digitalWidth8.bmp - 57/image/digitalWidth175.bmp - 57/image/digitalWidth275.bmp - 57/image/digitalWidth375.bmp - 57/image/digitalWidth475.bmp - 57/image/digitalWidth575.bmp - 57/image/digitalWidth675.bmp - 57/image/digitalWidth775.bmp - 57/image/digitalWidth875.bmp - 58/image/digitalWidth1.bmp - 58/image/digitalWidth2.bmp - 58/image/digitalWidth3.bmp - 58/image/digitalWidth4.bmp - 58/image/digitalWidth5.bmp - 58/image/digitalWidth6.bmp - 58/image/digitalWidth7.bmp - 58/image/digitalWidth8.bmp - 58/image/digitalWidth175.bmp - 58/image/digitalWidth275.bmp - 58/image/digitalWidth375.bmp - 58/image/digitalWidth475.bmp - 58/image/digitalWidth575.bmp - 58/image/digitalWidth675.bmp - 58/image/digitalWidth775.bmp - 58/image/digitalWidth875.bmp - 100/image/digitalWidth1.bmp - 100/image/digitalWidth8.bmp - 100/image/digitalWidth8.xcf - 100/image/digitalWidth8 (____).bmp - 100/image/digitalWidth88.bmp - 100/image/digitalWidth175.bmp - 100/image/expiryDate8.bmp - 100/image/expiryDate8_backup.bmp - 100/image/expiryDate875.bmp - 100/image/expiryDate875_backup.bmp - 101/image/curDate1.bmp - 101/image/curDate8.bmp - 101/image/curDate8_backup.bmp - 101/image/curDate875.bmp - 101/image/digitalWidth1.bmp - 101/image/digitalWidth8.bmp - 101/image/digitalWidth8.xcf - 101/image/digitalWidth8 (____).bmp - 101/image/digitalWidth88.bmp - 101/image/expiryDate8.bmp - 101/image/expiryDate875.bmp - icon/Estartprint3.png - icon/EstopPrint3.png - 14/image/digitalWidth1.bmp - 14/image/digitalWidth2.bmp - 14/image/digitalWidth3.bmp - 14/image/digitalWidth4.bmp - 14/image/digitalWidth5.bmp - 14/image/digitalWidth6.bmp - 14/image/digitalWidth7.bmp - 14/image/digitalWidth8.bmp - 14/image/digitalWidth175.bmp - 14/image/digitalWidth275.bmp - 14/image/digitalWidth375.bmp - 14/image/digitalWidth475.bmp - 14/image/digitalWidth575.bmp - 14/image/digitalWidth675.bmp - 14/image/digitalWidth775.bmp - 14/image/digitalWidth875.bmp - 15/image/digitalWidth1.bmp - 15/image/digitalWidth2.bmp - 15/image/digitalWidth3.bmp - 15/image/digitalWidth4.bmp - 15/image/digitalWidth5.bmp - 15/image/digitalWidth6.bmp - 15/image/digitalWidth7.bmp - 15/image/digitalWidth8.bmp - 15/image/digitalWidth175.bmp - 15/image/digitalWidth275.bmp - 15/image/digitalWidth375.bmp - 15/image/digitalWidth475.bmp - 15/image/digitalWidth575.bmp - 15/image/digitalWidth675.bmp - 15/image/digitalWidth775.bmp - 15/image/digitalWidth875.bmp - conf/config.ini - conf/VoltParaHi.bin - conf/VoltePara_No73.bin - TouchScreenConf/qtui_Capacitance - TouchScreenConf/calibrate_Capacitance - TouchScreenConf/calibrate_Resistance - TouchScreenConf/qtui_Resistance - image/keyboard3.png - image/keyboard2.png - image/keyboard1.png - image/arabicz.png - image/arabicl.png - image/arabicc.png - image/arabic2.png - conf/VoltDataStd21.bin - conf/VoltDataStd25.bin - conf/addrset.txt - conf/VoltDataStd32.bin - conf/fast_128k_7dot_dac.txt - conf/normal_128k_7dot_dac.txt - conf/fast_128k_9dot_dac.txt - conf/normal_128k_9dot_dac.txt - image/logo.png - close.svg - conf/VoltDataStd5Row5Dot.bin - conf/VoltDataStd4Row7Dot.bin - conf/VoltDataStd5R5DOf34Dot.bin - conf/VoltDataStd4R7DOf34Dot.bin - - + + + image/ALARMGreen.PNG + image/ALARMRed.PNG + image/ALARMYellow.PNG + image/suctionON.png + image/jetOFF.png + image/jetON.png + image/suctionOFF.png + image/reset.png + image/Turkey_logo.png + icon/exportpdf.png + icon/fileopen.png + icon/filesave.png + icon/zoomin.png + icon/zoomout.png + icon/filenew.png + icon/textbold.png + icon/preview.png + icon/edit.png + icon/filesaveas.png + icon/font.png + icon/pauseprint.png + icon/startprint.png + icon/stopprint.png + icon/closereclaimtanl.png + icon/openreclaimtanl.png + icon/poweroff.png + icon/arrowdown.png + icon/arrowleft.png + icon/arrowright.png + icon/arrowup.png + icon/fileimport.png + icon/apply.png + icon/cleanup.png + icon/controlbyhand.png + icon/factorysetting.png + icon/searchsuitablevoltage.png + icon/time.png + icon/updatefont.png + icon/updatesoftware.png + icon/screenfix.png + icon/searchsuitablefrequency.png + icon/counter.png + icon/lockphase.png + icon/keybackspace.png + icon/keydown.png + icon/keyenter.png + icon/keyright.png + icon/keyshift.png + icon/keyup.png + icon/keyinput.png + icon/filedelete.png + icon/filedelete2.png + icon/keydelete.png + icon/keyend.png + icon/keyhide.png + icon/keyhome.png + icon/keyleft.png + icon/lastpage.png + icon/nextpage.png + icon/specialchar.png + icon/vari.png + icon/exit.png + icon/export.png + icon/fileoperation.png + icon/udisk.png + icon/import.png + icon/localdisk.png + icon/insert.png + icon/sure.png + icon/leftright.png + icon/updown.png + icon/pulse.png + icon/linespace.png + 0/image/digitalWidth1.bmp + 0/image/digitalWidth2.bmp + 0/image/digitalWidth3.bmp + 0/image/digitalWidth4.bmp + 0/image/digitalWidth5.bmp + 0/image/digitalWidth6.bmp + 0/image/digitalWidth7.bmp + 0/image/digitalWidth8.bmp + 1/image/digitalWidth1.bmp + 1/image/digitalWidth2.bmp + 1/image/digitalWidth3.bmp + 1/image/digitalWidth4.bmp + 1/image/digitalWidth5.bmp + 1/image/digitalWidth6.bmp + 1/image/digitalWidth7.bmp + 1/image/digitalWidth8.bmp + 2/image/digitalWidth1.bmp + 2/image/digitalWidth2.bmp + 2/image/digitalWidth3.bmp + 2/image/digitalWidth4.bmp + 2/image/digitalWidth5.bmp + 2/image/digitalWidth6.bmp + 2/image/digitalWidth7.bmp + 2/image/digitalWidth8.bmp + 3/image/digitalWidth1.bmp + 3/image/digitalWidth2.bmp + 3/image/digitalWidth3.bmp + 3/image/digitalWidth4.bmp + 3/image/digitalWidth5.bmp + 3/image/digitalWidth6.bmp + 3/image/digitalWidth7.bmp + 3/image/digitalWidth8.bmp + 4/image/digitalWidth1.bmp + 4/image/digitalWidth2.bmp + 4/image/digitalWidth3.bmp + 4/image/digitalWidth4.bmp + 4/image/digitalWidth5.bmp + 4/image/digitalWidth6.bmp + 4/image/digitalWidth7.bmp + 4/image/digitalWidth8.bmp + 5/image/digitalWidth1.bmp + 5/image/digitalWidth2.bmp + 5/image/digitalWidth3.bmp + 5/image/digitalWidth4.bmp + 5/image/digitalWidth5.bmp + 5/image/digitalWidth6.bmp + 5/image/digitalWidth7.bmp + 5/image/digitalWidth8.bmp + 6/image/digitalWidth1.bmp + 6/image/digitalWidth2.bmp + 6/image/digitalWidth3.bmp + 6/image/digitalWidth4.bmp + 6/image/digitalWidth5.bmp + 6/image/digitalWidth6.bmp + 6/image/digitalWidth7.bmp + 6/image/digitalWidth8.bmp + 7/image/digitalWidth1.bmp + 7/image/digitalWidth2.bmp + 7/image/digitalWidth3.bmp + 7/image/digitalWidth4.bmp + 7/image/digitalWidth5.bmp + 7/image/digitalWidth6.bmp + 7/image/digitalWidth7.bmp + 7/image/digitalWidth8.bmp + 8/image/digitalWidth1.bmp + 8/image/digitalWidth2.bmp + 8/image/digitalWidth3.bmp + 8/image/digitalWidth4.bmp + 8/image/digitalWidth5.bmp + 8/image/digitalWidth6.bmp + 8/image/digitalWidth7.bmp + 8/image/digitalWidth8.bmp + 13/image/digitalWidth1.bmp + 13/image/digitalWidth2.bmp + 13/image/digitalWidth3.bmp + 13/image/digitalWidth4.bmp + 13/image/digitalWidth5.bmp + 13/image/digitalWidth6.bmp + 13/image/digitalWidth7.bmp + 13/image/digitalWidth8.bmp + 0/image/digitalWidth175.bmp + 0/image/digitalWidth275.bmp + 0/image/digitalWidth375.bmp + 0/image/digitalWidth475.bmp + 0/image/digitalWidth575.bmp + 0/image/digitalWidth675.bmp + 0/image/digitalWidth775.bmp + 0/image/digitalWidth875.bmp + 1/image/digitalWidth175.bmp + 1/image/digitalWidth275.bmp + 1/image/digitalWidth375.bmp + 1/image/digitalWidth475.bmp + 1/image/digitalWidth575.bmp + 1/image/digitalWidth675.bmp + 1/image/digitalWidth775.bmp + 1/image/digitalWidth875.bmp + 2/image/digitalWidth175.bmp + 2/image/digitalWidth275.bmp + 2/image/digitalWidth375.bmp + 2/image/digitalWidth475.bmp + 2/image/digitalWidth575.bmp + 2/image/digitalWidth675.bmp + 2/image/digitalWidth775.bmp + 2/image/digitalWidth875.bmp + 3/image/digitalWidth175.bmp + 3/image/digitalWidth275.bmp + 3/image/digitalWidth375.bmp + 3/image/digitalWidth475.bmp + 3/image/digitalWidth575.bmp + 3/image/digitalWidth675.bmp + 3/image/digitalWidth775.bmp + 3/image/digitalWidth875.bmp + 4/image/digitalWidth175.bmp + 4/image/digitalWidth275.bmp + 4/image/digitalWidth375.bmp + 4/image/digitalWidth475.bmp + 4/image/digitalWidth575.bmp + 4/image/digitalWidth675.bmp + 4/image/digitalWidth775.bmp + 4/image/digitalWidth875.bmp + 5/image/digitalWidth175.bmp + 5/image/digitalWidth275.bmp + 5/image/digitalWidth375.bmp + 5/image/digitalWidth475.bmp + 5/image/digitalWidth575.bmp + 5/image/digitalWidth675.bmp + 5/image/digitalWidth775.bmp + 5/image/digitalWidth875.bmp + 6/image/digitalWidth175.bmp + 6/image/digitalWidth275.bmp + 6/image/digitalWidth375.bmp + 6/image/digitalWidth475.bmp + 6/image/digitalWidth575.bmp + 6/image/digitalWidth675.bmp + 6/image/digitalWidth775.bmp + 6/image/digitalWidth875.bmp + 7/image/digitalWidth175.bmp + 7/image/digitalWidth275.bmp + 7/image/digitalWidth375.bmp + 7/image/digitalWidth475.bmp + 7/image/digitalWidth575.bmp + 7/image/digitalWidth675.bmp + 7/image/digitalWidth775.bmp + 7/image/digitalWidth875.bmp + 8/image/digitalWidth175.bmp + 8/image/digitalWidth275.bmp + 8/image/digitalWidth375.bmp + 8/image/digitalWidth475.bmp + 8/image/digitalWidth575.bmp + 8/image/digitalWidth675.bmp + 8/image/digitalWidth775.bmp + 8/image/digitalWidth875.bmp + 13/image/digitalWidth175.bmp + 13/image/digitalWidth275.bmp + 13/image/digitalWidth375.bmp + 13/image/digitalWidth475.bmp + 13/image/digitalWidth575.bmp + 13/image/digitalWidth675.bmp + 13/image/digitalWidth775.bmp + 13/image/digitalWidth875.bmp + icon/startprint1.png + icon/startprint2.png + icon/stopprint1.png + icon/stopprint2.png + icon/pauseprint1.png + icon/pauseprint2.png + icon/TEXT.PNG + buge_record.txt + icon/Epauseprint.png + icon/Epauseprint1.png + icon/Epauseprint2.png + icon/Estartprint.png + icon/Estartprint1.png + icon/Estartprint2.png + icon/EstopPrint2.png + icon/BarCode1.png + icon/bypm.png + 11/image/BARV16.bmp + 11/image/BARV12.bmp + 9/image/DMTV32.bmp + 9/image/DMTV26.bmp + 9/image/DMTV24.bmp + 9/image/DMTV22.bmp + 9/image/DMTV20.bmp + 9/image/DMTV18.bmp + 9/image/DMTV16.bmp + 9/image/DMTV14.bmp + 9/image/DMTV12.bmp + 9/image/DMTV10.bmp + 10/image/QRV37.bmp + 10/image/QRV33.bmp + 10/image/QRV29.bmp + 10/image/QRV25.bmp + 10/image/QRV21.bmp + image/AH12.png + image/ZFKD.png + image/MIV12.png + icon/10008.ico + icon/a9.ico + image/AH13.png + image/MIV13.png + image/ZFKD2.png + 12/image/digitalWidth13.bmp + 12/image/digitalWidth1375.bmp + 12/image/digitalWidth16.bmp + 12/image/digitalWidth1675.bmp + 12/image/digitalWidth1575.bmp + 12/image/digitalWidth15.bmp + 12/image/digitalWidth1475.bmp + 12/image/digitalWidth14.bmp + 12/image/digitalWidth1275.bmp + 12/image/digitalWidth12.bmp + 12/image/digitalWidth1175.bmp + 12/image/digitalWidth11.bmp + 12/image/digitalWidth1075.bmp + 12/image/digitalWidth10.bmp + 12/image/digitalWidth975.bmp + 12/image/digitalWidth9.bmp + 12/image/digitalWidth475.bmp + 12/image/digitalWidth1.bmp + 12/image/digitalWidth875.bmp + 12/image/digitalWidth8.bmp + 12/image/digitalWidth775.bmp + 12/image/digitalWidth7.bmp + 12/image/digitalWidth675.bmp + 12/image/digitalWidth6.bmp + 12/image/digitalWidth575.bmp + 12/image/digitalWidth4.bmp + 12/image/digitalWidth375.bmp + 12/image/digitalWidth3.bmp + 12/image/digitalWidth275.bmp + 12/image/digitalWidth2.bmp + 12/image/digitalWidth5.bmp + 12/image/digitalWidth175.bmp + 40/image/digitalWidth875.bmp + 40/image/digitalWidth4.bmp + 40/image/digitalWidth375.bmp + 40/image/digitalWidth3.bmp + 40/image/digitalWidth275.bmp + 40/image/digitalWidth2.bmp + 40/image/digitalWidth175.bmp + 40/image/digitalWidth475.bmp + 40/image/digitalWidth5.bmp + 40/image/digitalWidth8.bmp + 40/image/digitalWidth775.bmp + 40/image/digitalWidth7.bmp + 40/image/digitalWidth675.bmp + 40/image/digitalWidth6.bmp + 40/image/digitalWidth575.bmp + 40/image/digitalWidth1.bmp + 41/image/digitalWidth1.bmp + 41/image/digitalWidth2.bmp + 41/image/digitalWidth3.bmp + 41/image/digitalWidth4.bmp + 41/image/digitalWidth5.bmp + 41/image/digitalWidth6.bmp + 41/image/digitalWidth7.bmp + 41/image/digitalWidth8.bmp + 41/image/digitalWidth175.bmp + 41/image/digitalWidth275.bmp + 41/image/digitalWidth375.bmp + 41/image/digitalWidth475.bmp + 41/image/digitalWidth575.bmp + 41/image/digitalWidth675.bmp + 41/image/digitalWidth775.bmp + 41/image/digitalWidth875.bmp + 42/image/digitalWidth1.bmp + 42/image/digitalWidth2.bmp + 42/image/digitalWidth3.bmp + 42/image/digitalWidth4.bmp + 42/image/digitalWidth5.bmp + 42/image/digitalWidth6.bmp + 42/image/digitalWidth7.bmp + 42/image/digitalWidth8.bmp + 42/image/digitalWidth175.bmp + 42/image/digitalWidth275.bmp + 42/image/digitalWidth375.bmp + 42/image/digitalWidth475.bmp + 42/image/digitalWidth575.bmp + 42/image/digitalWidth675.bmp + 42/image/digitalWidth775.bmp + 42/image/digitalWidth875.bmp + 43/image/digitalWidth1.bmp + 43/image/digitalWidth2.bmp + 43/image/digitalWidth3.bmp + 43/image/digitalWidth4.bmp + 43/image/digitalWidth5.bmp + 43/image/digitalWidth6.bmp + 43/image/digitalWidth7.bmp + 43/image/digitalWidth8.bmp + 43/image/digitalWidth175.bmp + 43/image/digitalWidth275.bmp + 43/image/digitalWidth375.bmp + 43/image/digitalWidth475.bmp + 43/image/digitalWidth575.bmp + 43/image/digitalWidth675.bmp + 43/image/digitalWidth775.bmp + 43/image/digitalWidth875.bmp + 44/image/digitalWidth1.bmp + 44/image/digitalWidth2.bmp + 44/image/digitalWidth3.bmp + 44/image/digitalWidth4.bmp + 44/image/digitalWidth5.bmp + 44/image/digitalWidth6.bmp + 44/image/digitalWidth7.bmp + 44/image/digitalWidth8.bmp + 44/image/digitalWidth175.bmp + 44/image/digitalWidth275.bmp + 44/image/digitalWidth375.bmp + 44/image/digitalWidth475.bmp + 44/image/digitalWidth575.bmp + 44/image/digitalWidth675.bmp + 44/image/digitalWidth775.bmp + 44/image/digitalWidth875.bmp + 45/image/digitalWidth1.bmp + 45/image/digitalWidth2.bmp + 45/image/digitalWidth3.bmp + 45/image/digitalWidth4.bmp + 45/image/digitalWidth5.bmp + 45/image/digitalWidth6.bmp + 45/image/digitalWidth7.bmp + 45/image/digitalWidth8.bmp + 45/image/digitalWidth175.bmp + 45/image/digitalWidth275.bmp + 45/image/digitalWidth375.bmp + 45/image/digitalWidth475.bmp + 45/image/digitalWidth575.bmp + 45/image/digitalWidth675.bmp + 45/image/digitalWidth775.bmp + 45/image/digitalWidth875.bmp + 46/image/digitalWidth1.bmp + 46/image/digitalWidth2.bmp + 46/image/digitalWidth3.bmp + 46/image/digitalWidth4.bmp + 46/image/digitalWidth5.bmp + 46/image/digitalWidth6.bmp + 46/image/digitalWidth7.bmp + 46/image/digitalWidth8.bmp + 46/image/digitalWidth175.bmp + 46/image/digitalWidth275.bmp + 46/image/digitalWidth375.bmp + 46/image/digitalWidth475.bmp + 46/image/digitalWidth575.bmp + 46/image/digitalWidth675.bmp + 46/image/digitalWidth775.bmp + 46/image/digitalWidth875.bmp + 47/image/digitalWidth1.bmp + 47/image/digitalWidth2.bmp + 47/image/digitalWidth3.bmp + 47/image/digitalWidth4.bmp + 47/image/digitalWidth5.bmp + 47/image/digitalWidth6.bmp + 47/image/digitalWidth7.bmp + 47/image/digitalWidth8.bmp + 47/image/digitalWidth175.bmp + 47/image/digitalWidth275.bmp + 47/image/digitalWidth375.bmp + 47/image/digitalWidth475.bmp + 47/image/digitalWidth575.bmp + 47/image/digitalWidth675.bmp + 47/image/digitalWidth775.bmp + 47/image/digitalWidth875.bmp + 48/image/digitalWidth1.bmp + 48/image/digitalWidth2.bmp + 48/image/digitalWidth3.bmp + 48/image/digitalWidth4.bmp + 48/image/digitalWidth5.bmp + 48/image/digitalWidth6.bmp + 48/image/digitalWidth7.bmp + 48/image/digitalWidth8.bmp + 48/image/digitalWidth175.bmp + 48/image/digitalWidth275.bmp + 48/image/digitalWidth375.bmp + 48/image/digitalWidth475.bmp + 48/image/digitalWidth575.bmp + 48/image/digitalWidth675.bmp + 48/image/digitalWidth775.bmp + 48/image/digitalWidth875.bmp + 20/image/digitalWidth1.bmp + 20/image/digitalWidth2.bmp + 20/image/digitalWidth3.bmp + 20/image/digitalWidth4.bmp + 20/image/digitalWidth5.bmp + 20/image/digitalWidth6.bmp + 20/image/digitalWidth7.bmp + 20/image/digitalWidth8.bmp + 20/image/digitalWidth175.bmp + 20/image/digitalWidth275.bmp + 20/image/digitalWidth375.bmp + 20/image/digitalWidth475.bmp + 20/image/digitalWidth575.bmp + 20/image/digitalWidth675.bmp + 20/image/digitalWidth775.bmp + 20/image/digitalWidth875.bmp + 21/image/digitalWidth1.bmp + 21/image/digitalWidth2.bmp + 21/image/digitalWidth3.bmp + 21/image/digitalWidth4.bmp + 21/image/digitalWidth5.bmp + 21/image/digitalWidth6.bmp + 21/image/digitalWidth7.bmp + 21/image/digitalWidth8.bmp + 21/image/digitalWidth175.bmp + 21/image/digitalWidth275.bmp + 21/image/digitalWidth375.bmp + 21/image/digitalWidth475.bmp + 21/image/digitalWidth575.bmp + 21/image/digitalWidth675.bmp + 21/image/digitalWidth775.bmp + 21/image/digitalWidth875.bmp + 22/image/digitalWidth1.bmp + 22/image/digitalWidth2.bmp + 22/image/digitalWidth3.bmp + 22/image/digitalWidth4.bmp + 22/image/digitalWidth5.bmp + 22/image/digitalWidth6.bmp + 22/image/digitalWidth7.bmp + 22/image/digitalWidth8.bmp + 22/image/digitalWidth175.bmp + 22/image/digitalWidth275.bmp + 22/image/digitalWidth375.bmp + 22/image/digitalWidth475.bmp + 22/image/digitalWidth575.bmp + 22/image/digitalWidth675.bmp + 22/image/digitalWidth775.bmp + 22/image/digitalWidth875.bmp + 23/image/digitalWidth1.bmp + 23/image/digitalWidth2.bmp + 23/image/digitalWidth3.bmp + 23/image/digitalWidth4.bmp + 23/image/digitalWidth5.bmp + 23/image/digitalWidth6.bmp + 23/image/digitalWidth7.bmp + 23/image/digitalWidth8.bmp + 23/image/digitalWidth175.bmp + 23/image/digitalWidth275.bmp + 23/image/digitalWidth375.bmp + 23/image/digitalWidth475.bmp + 23/image/digitalWidth575.bmp + 23/image/digitalWidth675.bmp + 23/image/digitalWidth775.bmp + 23/image/digitalWidth875.bmp + 24/image/digitalWidth1.bmp + 24/image/digitalWidth2.bmp + 24/image/digitalWidth3.bmp + 24/image/digitalWidth4.bmp + 24/image/digitalWidth5.bmp + 24/image/digitalWidth6.bmp + 24/image/digitalWidth7.bmp + 24/image/digitalWidth8.bmp + 24/image/digitalWidth175.bmp + 24/image/digitalWidth275.bmp + 24/image/digitalWidth375.bmp + 24/image/digitalWidth475.bmp + 24/image/digitalWidth575.bmp + 24/image/digitalWidth675.bmp + 24/image/digitalWidth775.bmp + 24/image/digitalWidth875.bmp + 25/image/digitalWidth1.bmp + 25/image/digitalWidth2.bmp + 25/image/digitalWidth3.bmp + 25/image/digitalWidth4.bmp + 25/image/digitalWidth5.bmp + 25/image/digitalWidth6.bmp + 25/image/digitalWidth7.bmp + 25/image/digitalWidth8.bmp + 25/image/digitalWidth175.bmp + 25/image/digitalWidth275.bmp + 25/image/digitalWidth375.bmp + 25/image/digitalWidth475.bmp + 25/image/digitalWidth575.bmp + 25/image/digitalWidth675.bmp + 25/image/digitalWidth775.bmp + 25/image/digitalWidth875.bmp + 26/image/digitalWidth1.bmp + 26/image/digitalWidth2.bmp + 26/image/digitalWidth3.bmp + 26/image/digitalWidth4.bmp + 26/image/digitalWidth5.bmp + 26/image/digitalWidth6.bmp + 26/image/digitalWidth7.bmp + 26/image/digitalWidth8.bmp + 26/image/digitalWidth175.bmp + 26/image/digitalWidth275.bmp + 26/image/digitalWidth375.bmp + 26/image/digitalWidth475.bmp + 26/image/digitalWidth575.bmp + 26/image/digitalWidth675.bmp + 26/image/digitalWidth775.bmp + 26/image/digitalWidth875.bmp + 27/image/digitalWidth1.bmp + 27/image/digitalWidth2.bmp + 27/image/digitalWidth3.bmp + 27/image/digitalWidth4.bmp + 27/image/digitalWidth5.bmp + 27/image/digitalWidth6.bmp + 27/image/digitalWidth7.bmp + 27/image/digitalWidth8.bmp + 27/image/digitalWidth175.bmp + 27/image/digitalWidth275.bmp + 27/image/digitalWidth375.bmp + 27/image/digitalWidth475.bmp + 27/image/digitalWidth575.bmp + 27/image/digitalWidth675.bmp + 27/image/digitalWidth775.bmp + 27/image/digitalWidth875.bmp + 28/image/digitalWidth1.bmp + 28/image/digitalWidth2.bmp + 28/image/digitalWidth3.bmp + 28/image/digitalWidth4.bmp + 28/image/digitalWidth5.bmp + 28/image/digitalWidth6.bmp + 28/image/digitalWidth7.bmp + 28/image/digitalWidth8.bmp + 28/image/digitalWidth175.bmp + 28/image/digitalWidth275.bmp + 28/image/digitalWidth375.bmp + 28/image/digitalWidth475.bmp + 28/image/digitalWidth575.bmp + 28/image/digitalWidth675.bmp + 28/image/digitalWidth775.bmp + 28/image/digitalWidth875.bmp + 11/image/BARV5.bmp + 11/image/BARV7.bmp + 11/image/BARV9.bmp + 11/image/BARV24.bmp + 11/image/BARV105.bmp + 11/image/BARV107.bmp + 11/image/BARV109.bmp + 11/image/BARV112.bmp + 11/image/BARV116.bmp + 11/image/BARV124.bmp + 11/image/BARV205.bmp + 11/image/BARV207.bmp + 11/image/BARV209.bmp + 11/image/BARV212.bmp + 11/image/BARV216.bmp + 11/image/BARV224.bmp + 80/image/digitalWidth8.bmp + 81/image/curDate875.bmp + 66/image/digitalWidth875.bmp + 66/image/digitalWidth8.bmp + 81/image/curDate8.bmp + 80/image/expiryDate8.bmp + 80/image/expiryDate875.bmp + 80/image/digitalWidth1.bmp + 80/image/digitalWidth175.bmp + 81/image/curDate1.bmp + 82/image/class1.bmp + 82/image/class91.bmp + 30/image/digitalWidth1.bmp + 30/image/digitalWidth2.bmp + 30/image/digitalWidth3.bmp + 30/image/digitalWidth4.bmp + 30/image/digitalWidth5.bmp + 30/image/digitalWidth6.bmp + 30/image/digitalWidth7.bmp + 30/image/digitalWidth8.bmp + 30/image/digitalWidth175.bmp + 30/image/digitalWidth275.bmp + 30/image/digitalWidth375.bmp + 30/image/digitalWidth475.bmp + 30/image/digitalWidth575.bmp + 30/image/digitalWidth675.bmp + 30/image/digitalWidth775.bmp + 30/image/digitalWidth875.bmp + 31/image/digitalWidth1.bmp + 31/image/digitalWidth2.bmp + 31/image/digitalWidth3.bmp + 31/image/digitalWidth4.bmp + 31/image/digitalWidth5.bmp + 31/image/digitalWidth6.bmp + 31/image/digitalWidth7.bmp + 31/image/digitalWidth8.bmp + 31/image/digitalWidth175.bmp + 31/image/digitalWidth275.bmp + 31/image/digitalWidth375.bmp + 31/image/digitalWidth475.bmp + 31/image/digitalWidth575.bmp + 31/image/digitalWidth675.bmp + 31/image/digitalWidth775.bmp + 31/image/digitalWidth875.bmp + 32/image/digitalWidth1.bmp + 32/image/digitalWidth2.bmp + 32/image/digitalWidth3.bmp + 32/image/digitalWidth4.bmp + 32/image/digitalWidth5.bmp + 32/image/digitalWidth6.bmp + 32/image/digitalWidth7.bmp + 32/image/digitalWidth8.bmp + 32/image/digitalWidth175.bmp + 32/image/digitalWidth275.bmp + 32/image/digitalWidth375.bmp + 32/image/digitalWidth475.bmp + 32/image/digitalWidth575.bmp + 32/image/digitalWidth675.bmp + 32/image/digitalWidth775.bmp + 32/image/digitalWidth875.bmp + 33/image/digitalWidth1.bmp + 33/image/digitalWidth2.bmp + 33/image/digitalWidth3.bmp + 33/image/digitalWidth4.bmp + 33/image/digitalWidth5.bmp + 33/image/digitalWidth6.bmp + 33/image/digitalWidth7.bmp + 33/image/digitalWidth8.bmp + 33/image/digitalWidth175.bmp + 33/image/digitalWidth275.bmp + 33/image/digitalWidth375.bmp + 33/image/digitalWidth475.bmp + 33/image/digitalWidth575.bmp + 33/image/digitalWidth675.bmp + 33/image/digitalWidth775.bmp + 33/image/digitalWidth875.bmp + 34/image/digitalWidth1.bmp + 34/image/digitalWidth2.bmp + 34/image/digitalWidth3.bmp + 34/image/digitalWidth4.bmp + 34/image/digitalWidth5.bmp + 34/image/digitalWidth6.bmp + 34/image/digitalWidth7.bmp + 34/image/digitalWidth8.bmp + 34/image/digitalWidth175.bmp + 34/image/digitalWidth275.bmp + 34/image/digitalWidth375.bmp + 34/image/digitalWidth475.bmp + 34/image/digitalWidth575.bmp + 34/image/digitalWidth675.bmp + 34/image/digitalWidth775.bmp + 34/image/digitalWidth875.bmp + 35/image/digitalWidth1.bmp + 35/image/digitalWidth2.bmp + 35/image/digitalWidth3.bmp + 35/image/digitalWidth4.bmp + 35/image/digitalWidth5.bmp + 35/image/digitalWidth6.bmp + 35/image/digitalWidth7.bmp + 35/image/digitalWidth8.bmp + 35/image/digitalWidth175.bmp + 35/image/digitalWidth275.bmp + 35/image/digitalWidth375.bmp + 35/image/digitalWidth475.bmp + 35/image/digitalWidth575.bmp + 35/image/digitalWidth675.bmp + 35/image/digitalWidth775.bmp + 35/image/digitalWidth875.bmp + 36/image/digitalWidth1.bmp + 36/image/digitalWidth2.bmp + 36/image/digitalWidth3.bmp + 36/image/digitalWidth4.bmp + 36/image/digitalWidth5.bmp + 36/image/digitalWidth6.bmp + 36/image/digitalWidth7.bmp + 36/image/digitalWidth8.bmp + 36/image/digitalWidth175.bmp + 36/image/digitalWidth275.bmp + 36/image/digitalWidth375.bmp + 36/image/digitalWidth475.bmp + 36/image/digitalWidth575.bmp + 36/image/digitalWidth675.bmp + 36/image/digitalWidth775.bmp + 36/image/digitalWidth875.bmp + 38/image/digitalWidth1.bmp + 38/image/digitalWidth2.bmp + 38/image/digitalWidth3.bmp + 38/image/digitalWidth4.bmp + 38/image/digitalWidth5.bmp + 38/image/digitalWidth6.bmp + 38/image/digitalWidth7.bmp + 38/image/digitalWidth8.bmp + 38/image/digitalWidth175.bmp + 38/image/digitalWidth275.bmp + 38/image/digitalWidth375.bmp + 38/image/digitalWidth475.bmp + 38/image/digitalWidth575.bmp + 38/image/digitalWidth675.bmp + 38/image/digitalWidth775.bmp + 38/image/digitalWidth875.bmp + 37/image/digitalWidth1.bmp + 37/image/digitalWidth2.bmp + 37/image/digitalWidth3.bmp + 37/image/digitalWidth4.bmp + 37/image/digitalWidth5.bmp + 37/image/digitalWidth6.bmp + 37/image/digitalWidth7.bmp + 37/image/digitalWidth8.bmp + 37/image/digitalWidth175.bmp + 37/image/digitalWidth275.bmp + 37/image/digitalWidth375.bmp + 37/image/digitalWidth475.bmp + 37/image/digitalWidth575.bmp + 37/image/digitalWidth675.bmp + 37/image/digitalWidth775.bmp + 37/image/digitalWidth875.bmp + 90/image/digitalWidth1.bmp + 90/image/digitalWidth8.bmp + 90/image/digitalWidth8.xcf + 90/image/digitalWidth8 (____).bmp + 90/image/digitalWidth88.bmp + 90/image/digitalWidth175.bmp + 90/image/expiryDate8.bmp + 90/image/expiryDate8_backup.bmp + 90/image/expiryDate875.bmp + 90/image/expiryDate875_backup.bmp + 91/image/curDate1.bmp + 91/image/curDate8.bmp + 91/image/curDate8_backup.bmp + 91/image/curDate875.bmp + 91/image/digitalWidth1.bmp + 91/image/digitalWidth8.bmp + 91/image/digitalWidth8.xcf + 91/image/digitalWidth8 (____).bmp + 91/image/digitalWidth88.bmp + 91/image/expiryDate8.bmp + 91/image/expiryDate875.bmp + 50/image/digitalWidth1.bmp + 50/image/digitalWidth2.bmp + 50/image/digitalWidth3.bmp + 50/image/digitalWidth4.bmp + 50/image/digitalWidth5.bmp + 50/image/digitalWidth6.bmp + 50/image/digitalWidth7.bmp + 50/image/digitalWidth8.bmp + 50/image/digitalWidth175.bmp + 50/image/digitalWidth275.bmp + 50/image/digitalWidth375.bmp + 50/image/digitalWidth475.bmp + 50/image/digitalWidth575.bmp + 50/image/digitalWidth675.bmp + 50/image/digitalWidth775.bmp + 50/image/digitalWidth875.bmp + 51/image/digitalWidth1.bmp + 51/image/digitalWidth2.bmp + 51/image/digitalWidth3.bmp + 51/image/digitalWidth4.bmp + 51/image/digitalWidth5.bmp + 51/image/digitalWidth6.bmp + 51/image/digitalWidth7.bmp + 51/image/digitalWidth8.bmp + 51/image/digitalWidth175.bmp + 51/image/digitalWidth275.bmp + 51/image/digitalWidth375.bmp + 51/image/digitalWidth475.bmp + 51/image/digitalWidth575.bmp + 51/image/digitalWidth675.bmp + 51/image/digitalWidth775.bmp + 51/image/digitalWidth875.bmp + 52/image/digitalWidth1.bmp + 52/image/digitalWidth2.bmp + 52/image/digitalWidth3.bmp + 52/image/digitalWidth4.bmp + 52/image/digitalWidth5.bmp + 52/image/digitalWidth6.bmp + 52/image/digitalWidth7.bmp + 52/image/digitalWidth8.bmp + 52/image/digitalWidth175.bmp + 52/image/digitalWidth275.bmp + 52/image/digitalWidth375.bmp + 52/image/digitalWidth475.bmp + 52/image/digitalWidth575.bmp + 52/image/digitalWidth675.bmp + 52/image/digitalWidth775.bmp + 52/image/digitalWidth875.bmp + 53/image/digitalWidth1.bmp + 53/image/digitalWidth2.bmp + 53/image/digitalWidth3.bmp + 53/image/digitalWidth4.bmp + 53/image/digitalWidth5.bmp + 53/image/digitalWidth6.bmp + 53/image/digitalWidth7.bmp + 53/image/digitalWidth8.bmp + 53/image/digitalWidth175.bmp + 53/image/digitalWidth275.bmp + 53/image/digitalWidth375.bmp + 53/image/digitalWidth475.bmp + 53/image/digitalWidth575.bmp + 53/image/digitalWidth675.bmp + 53/image/digitalWidth775.bmp + 53/image/digitalWidth875.bmp + 54/image/digitalWidth1.bmp + 54/image/digitalWidth2.bmp + 54/image/digitalWidth3.bmp + 54/image/digitalWidth4.bmp + 54/image/digitalWidth5.bmp + 54/image/digitalWidth6.bmp + 54/image/digitalWidth7.bmp + 54/image/digitalWidth8.bmp + 54/image/digitalWidth175.bmp + 54/image/digitalWidth275.bmp + 54/image/digitalWidth375.bmp + 54/image/digitalWidth475.bmp + 54/image/digitalWidth575.bmp + 54/image/digitalWidth675.bmp + 54/image/digitalWidth775.bmp + 54/image/digitalWidth875.bmp + 55/image/digitalWidth1.bmp + 55/image/digitalWidth2.bmp + 55/image/digitalWidth3.bmp + 55/image/digitalWidth4.bmp + 55/image/digitalWidth5.bmp + 55/image/digitalWidth6.bmp + 55/image/digitalWidth7.bmp + 55/image/digitalWidth8.bmp + 55/image/digitalWidth175.bmp + 55/image/digitalWidth275.bmp + 55/image/digitalWidth375.bmp + 55/image/digitalWidth475.bmp + 55/image/digitalWidth575.bmp + 55/image/digitalWidth675.bmp + 55/image/digitalWidth775.bmp + 55/image/digitalWidth875.bmp + 56/image/digitalWidth1.bmp + 56/image/digitalWidth2.bmp + 56/image/digitalWidth3.bmp + 56/image/digitalWidth4.bmp + 56/image/digitalWidth5.bmp + 56/image/digitalWidth6.bmp + 56/image/digitalWidth7.bmp + 56/image/digitalWidth8.bmp + 56/image/digitalWidth175.bmp + 56/image/digitalWidth275.bmp + 56/image/digitalWidth375.bmp + 56/image/digitalWidth475.bmp + 56/image/digitalWidth575.bmp + 56/image/digitalWidth675.bmp + 56/image/digitalWidth775.bmp + 56/image/digitalWidth875.bmp + 57/image/digitalWidth1.bmp + 57/image/digitalWidth2.bmp + 57/image/digitalWidth3.bmp + 57/image/digitalWidth4.bmp + 57/image/digitalWidth5.bmp + 57/image/digitalWidth6.bmp + 57/image/digitalWidth7.bmp + 57/image/digitalWidth8.bmp + 57/image/digitalWidth175.bmp + 57/image/digitalWidth275.bmp + 57/image/digitalWidth375.bmp + 57/image/digitalWidth475.bmp + 57/image/digitalWidth575.bmp + 57/image/digitalWidth675.bmp + 57/image/digitalWidth775.bmp + 57/image/digitalWidth875.bmp + 58/image/digitalWidth1.bmp + 58/image/digitalWidth2.bmp + 58/image/digitalWidth3.bmp + 58/image/digitalWidth4.bmp + 58/image/digitalWidth5.bmp + 58/image/digitalWidth6.bmp + 58/image/digitalWidth7.bmp + 58/image/digitalWidth8.bmp + 58/image/digitalWidth175.bmp + 58/image/digitalWidth275.bmp + 58/image/digitalWidth375.bmp + 58/image/digitalWidth475.bmp + 58/image/digitalWidth575.bmp + 58/image/digitalWidth675.bmp + 58/image/digitalWidth775.bmp + 58/image/digitalWidth875.bmp + 100/image/digitalWidth1.bmp + 100/image/digitalWidth8.bmp + 100/image/digitalWidth8.xcf + 100/image/digitalWidth8 (____).bmp + 100/image/digitalWidth88.bmp + 100/image/digitalWidth175.bmp + 100/image/expiryDate8.bmp + 100/image/expiryDate8_backup.bmp + 100/image/expiryDate875.bmp + 100/image/expiryDate875_backup.bmp + 101/image/curDate1.bmp + 101/image/curDate8.bmp + 101/image/curDate8_backup.bmp + 101/image/curDate875.bmp + 101/image/digitalWidth1.bmp + 101/image/digitalWidth8.bmp + 101/image/digitalWidth8.xcf + 101/image/digitalWidth8 (____).bmp + 101/image/digitalWidth88.bmp + 101/image/expiryDate8.bmp + 101/image/expiryDate875.bmp + icon/Estartprint3.png + icon/EstopPrint3.png + 14/image/digitalWidth1.bmp + 14/image/digitalWidth2.bmp + 14/image/digitalWidth3.bmp + 14/image/digitalWidth4.bmp + 14/image/digitalWidth5.bmp + 14/image/digitalWidth6.bmp + 14/image/digitalWidth7.bmp + 14/image/digitalWidth8.bmp + 14/image/digitalWidth175.bmp + 14/image/digitalWidth275.bmp + 14/image/digitalWidth375.bmp + 14/image/digitalWidth475.bmp + 14/image/digitalWidth575.bmp + 14/image/digitalWidth675.bmp + 14/image/digitalWidth775.bmp + 14/image/digitalWidth875.bmp + 15/image/digitalWidth1.bmp + 15/image/digitalWidth2.bmp + 15/image/digitalWidth3.bmp + 15/image/digitalWidth4.bmp + 15/image/digitalWidth5.bmp + 15/image/digitalWidth6.bmp + 15/image/digitalWidth7.bmp + 15/image/digitalWidth8.bmp + 15/image/digitalWidth175.bmp + 15/image/digitalWidth275.bmp + 15/image/digitalWidth375.bmp + 15/image/digitalWidth475.bmp + 15/image/digitalWidth575.bmp + 15/image/digitalWidth675.bmp + 15/image/digitalWidth775.bmp + 15/image/digitalWidth875.bmp + conf/config.ini + conf/VoltParaHi.bin + conf/VoltePara_No73.bin + TouchScreenConf/qtui_Capacitance + TouchScreenConf/calibrate_Capacitance + TouchScreenConf/calibrate_Resistance + TouchScreenConf/qtui_Resistance + image/keyboard3.png + image/keyboard2.png + image/keyboard1.png + image/arabicz.png + image/arabicl.png + image/arabicc.png + image/arabic2.png + conf/VoltDataStd21.bin + conf/VoltDataStd25.bin + conf/addrset.txt + conf/VoltDataStd32.bin + conf/fast_128k_7dot_dac.txt + conf/normal_128k_7dot_dac.txt + conf/fast_128k_9dot_dac.txt + conf/normal_128k_9dot_dac.txt + image/logo.png + close.svg + conf/VoltDataStd5Row5Dot.bin + conf/VoltDataStd4Row7Dot.bin + conf/VoltDataStd5R5DOf34Dot.bin + conf/VoltDataStd4R7DOf34Dot.bin + + diff --git a/image/qtopia b/image/qtopia index a9acbb9..2217207 100644 --- a/image/qtopia +++ b/image/qtopia @@ -1,32 +1,32 @@ -#!/bin/sh - -export TSLIB_TSDEVICE=/dev/input/event0 -export TSLIB_CONFFILE=/usr/local/etc/ts.conf -export TSLIB_PLUGINDIR=/usr/local/lib/ts -export TSLIB_CALIBFILE=/etc/pointercal -export QTDIR=/opt/Qtopia -export QPEDIR=/opt/Qtopia -export PATH=$QTDIR/bin:$PATH -export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH - - -TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent -if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then - export QWS_MOUSE_PROTO="TPanel:/dev/input/event0 USB:/dev/input/mice" - if [ -e /etc/pointercal -a ! -s /etc/pointercal ] ; then - rm /etc/pointercal - fi -else - export QWS_MOUSE_PROTO="USB:/dev/input/mice" - >/etc/pointercal -fi -unset TS_INFO_FILE - -export QWS_KEYBOARD=TTY:/dev/tty1 -export KDEDIR=/opt/kde - -export HOME=/root - -exec /opt/Qtopia/bin/SunJet -qws -#exec $QPEDIR/bin/qpe 1>/dev/null 2>/dev/null - +#!/bin/sh + +export TSLIB_TSDEVICE=/dev/input/event0 +export TSLIB_CONFFILE=/usr/local/etc/ts.conf +export TSLIB_PLUGINDIR=/usr/local/lib/ts +export TSLIB_CALIBFILE=/etc/pointercal +export QTDIR=/opt/Qtopia +export QPEDIR=/opt/Qtopia +export PATH=$QTDIR/bin:$PATH +export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH + + +TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent +if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then + export QWS_MOUSE_PROTO="TPanel:/dev/input/event0 USB:/dev/input/mice" + if [ -e /etc/pointercal -a ! -s /etc/pointercal ] ; then + rm /etc/pointercal + fi +else + export QWS_MOUSE_PROTO="USB:/dev/input/mice" + >/etc/pointercal +fi +unset TS_INFO_FILE + +export QWS_KEYBOARD=TTY:/dev/tty1 +export KDEDIR=/opt/kde + +export HOME=/root + +exec /opt/Qtopia/bin/SunJet -qws +#exec $QPEDIR/bin/qpe 1>/dev/null 2>/dev/null + diff --git a/image/qtopia1 b/image/qtopia1 index a9acbb9..2217207 100644 --- a/image/qtopia1 +++ b/image/qtopia1 @@ -1,32 +1,32 @@ -#!/bin/sh - -export TSLIB_TSDEVICE=/dev/input/event0 -export TSLIB_CONFFILE=/usr/local/etc/ts.conf -export TSLIB_PLUGINDIR=/usr/local/lib/ts -export TSLIB_CALIBFILE=/etc/pointercal -export QTDIR=/opt/Qtopia -export QPEDIR=/opt/Qtopia -export PATH=$QTDIR/bin:$PATH -export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH - - -TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent -if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then - export QWS_MOUSE_PROTO="TPanel:/dev/input/event0 USB:/dev/input/mice" - if [ -e /etc/pointercal -a ! -s /etc/pointercal ] ; then - rm /etc/pointercal - fi -else - export QWS_MOUSE_PROTO="USB:/dev/input/mice" - >/etc/pointercal -fi -unset TS_INFO_FILE - -export QWS_KEYBOARD=TTY:/dev/tty1 -export KDEDIR=/opt/kde - -export HOME=/root - -exec /opt/Qtopia/bin/SunJet -qws -#exec $QPEDIR/bin/qpe 1>/dev/null 2>/dev/null - +#!/bin/sh + +export TSLIB_TSDEVICE=/dev/input/event0 +export TSLIB_CONFFILE=/usr/local/etc/ts.conf +export TSLIB_PLUGINDIR=/usr/local/lib/ts +export TSLIB_CALIBFILE=/etc/pointercal +export QTDIR=/opt/Qtopia +export QPEDIR=/opt/Qtopia +export PATH=$QTDIR/bin:$PATH +export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH + + +TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent +if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then + export QWS_MOUSE_PROTO="TPanel:/dev/input/event0 USB:/dev/input/mice" + if [ -e /etc/pointercal -a ! -s /etc/pointercal ] ; then + rm /etc/pointercal + fi +else + export QWS_MOUSE_PROTO="USB:/dev/input/mice" + >/etc/pointercal +fi +unset TS_INFO_FILE + +export QWS_KEYBOARD=TTY:/dev/tty1 +export KDEDIR=/opt/kde + +export HOME=/root + +exec /opt/Qtopia/bin/SunJet -qws +#exec $QPEDIR/bin/qpe 1>/dev/null 2>/dev/null + diff --git a/image/textEdit.html b/image/textEdit.html index 952d622..fe7fdad 100644 --- a/image/textEdit.html +++ b/image/textEdit.html @@ -1,5 +1,5 @@ - -QTextEdit Demonstration -

你好下 上,我时易r于

+ +QTextEdit Demonstration +

你好下 上,我时易r于

diff --git a/image/u2 b/image/u2 index 96015ba..04b95fc 100644 --- a/image/u2 +++ b/image/u2 @@ -1,5 +1,5 @@ -#!/bin/sh - -cp /udisk/asc.bin /opt/zk/. - - +#!/bin/sh + +cp /udisk/asc.bin /opt/zk/. + + diff --git a/image/update b/image/update index 7520c91..cee1c76 100644 --- a/image/update +++ b/image/update @@ -1,9 +1,9 @@ -#!/bin/sh - -mkdir /opt/mm - -cp /udisk/mm/* /opt/mm/. - -cp /udisk/qtopia /bin/qtopia -chmod +x /bin/qtopia - +#!/bin/sh + +mkdir /opt/mm + +cp /udisk/mm/* /opt/mm/. + +cp /udisk/qtopia /bin/qtopia +chmod +x /bin/qtopia + diff --git a/info/exclude b/info/exclude index a5196d1..f006809 100644 --- a/info/exclude +++ b/info/exclude @@ -1,6 +1,6 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/inkjetprinter.ui b/inkjetprinter.ui index 019231c..f6f84b1 100644 --- a/inkjetprinter.ui +++ b/inkjetprinter.ui @@ -17,7 +17,7 @@ - TabWidget + 压力测试 QTabBar::scroller @@ -2268,6 +2268,21 @@ background-color: rgb(186, 189, 182); + + + 压力测试 + + + + + 30 + 40 + 741 + 411 + + + + FpgaDebug diff --git a/insertspacenumdialog.ui b/insertspacenumdialog.ui index bb897fb..e7f8705 100644 --- a/insertspacenumdialog.ui +++ b/insertspacenumdialog.ui @@ -1,103 +1,103 @@ - - - InsertSpaceNumDialog - - - - 0 - 0 - 336 - 94 - - - - Qt::StrongFocus - - - 插入空格数 - - - - - 110 - 50 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 10 - 311 - 31 - - - - - - - 空格个数: - - - - - - - - 220 - 0 - - - - 1 - - - - - - - - - - buttonBox - accepted() - InsertSpaceNumDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - InsertSpaceNumDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + InsertSpaceNumDialog + + + + 0 + 0 + 336 + 94 + + + + Qt::StrongFocus + + + 插入空格数 + + + + + 110 + 50 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 311 + 31 + + + + + + + 空格个数: + + + + + + + + 220 + 0 + + + + 1 + + + + + + + + + + buttonBox + accepted() + InsertSpaceNumDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + InsertSpaceNumDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/loginfo.ui b/loginfo.ui index dd22dcf..56c45ea 100644 --- a/loginfo.ui +++ b/loginfo.ui @@ -1,299 +1,299 @@ - - - LogInfo - - - - 0 - 0 - 800 - 600 - - - - Qt::StrongFocus - - - Form - - - - - - - - 1 - - - - 当前状态 - - - - - - true - - - - - - - - 240 - 240 - 240 - - - - - - - - - 240 - 240 - 240 - - - - - - - - - 255 - 255 - 255 - - - - - - - - Qt::NoFocus - - - true - - - - - - - - - - 120 - 70 - - - - 清空当前状态 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 历史状态 - - - - - - true - - - - - - - - 240 - 240 - 240 - - - - - - - - - 240 - 240 - 240 - - - - - - - - - 255 - 255 - 255 - - - - - - - - Qt::NoFocus - - - true - - - - - - - - - TextLabel - - - - - - - - 0 - 70 - - - - 删除历史文件 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 70 - - - - 打开历史文件 - - - - - - - - 0 - 70 - - - - 导出日志到U盘 - - - - - - - - - - 版本信息 - - - - - - true - - - - - - - - 240 - 240 - 240 - - - - - - - - - 240 - 240 - 240 - - - - - - - - - 255 - 255 - 255 - - - - - - - - Qt::NoFocus - - - true - - - - - - - - - - - - - - + + + LogInfo + + + + 0 + 0 + 800 + 600 + + + + Qt::StrongFocus + + + Form + + + + + + + + 1 + + + + 当前状态 + + + + + + true + + + + + + + + 240 + 240 + 240 + + + + + + + + + 240 + 240 + 240 + + + + + + + + + 255 + 255 + 255 + + + + + + + + Qt::NoFocus + + + true + + + + + + + + + + 120 + 70 + + + + 清空当前状态 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 历史状态 + + + + + + true + + + + + + + + 240 + 240 + 240 + + + + + + + + + 240 + 240 + 240 + + + + + + + + + 255 + 255 + 255 + + + + + + + + Qt::NoFocus + + + true + + + + + + + + + TextLabel + + + + + + + + 0 + 70 + + + + 删除历史文件 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 70 + + + + 打开历史文件 + + + + + + + + 0 + 70 + + + + 导出日志到U盘 + + + + + + + + + + 版本信息 + + + + + + true + + + + + + + + 240 + 240 + 240 + + + + + + + + + 240 + 240 + 240 + + + + + + + + + 255 + 255 + 255 + + + + + + + + Qt::NoFocus + + + true + + + + + + + + + + + + + + diff --git a/logo_form.cpp b/logo_form.cpp index 1d00112..c4ab548 100644 --- a/logo_form.cpp +++ b/logo_form.cpp @@ -1,30 +1,30 @@ -#include "logo_form.h" -#include "ui_logo_form.h" -#include "InkJetPrinter.h" - -logo_Form::logo_Form(QWidget *parent) : - QWidget(parent), - ui(new Ui::logo_Form) -{ - ui->setupUi(this); - -#ifdef TURKEY_LOGO - ui->logo_label->setPixmap(QPixmap(QString::fromUtf8(":/image/Turkey_logo.png"))); - - show_timer = new QTimer(this); - connect(show_timer, SIGNAL(timeout()), this, SLOT(logo_timer_fun())); - show_timer->start(5000); -#endif -} - -logo_Form::~logo_Form() -{ - delete ui; -} -extern InkJetPrinter *pInkJectPrinter; - -void logo_Form::logo_timer_fun() -{ - show_timer->stop(); - pInkJectPrinter->show(); -} +#include "logo_form.h" +#include "ui_logo_form.h" +#include "InkJetPrinter.h" + +logo_Form::logo_Form(QWidget *parent) : + QWidget(parent), + ui(new Ui::logo_Form) +{ + ui->setupUi(this); + +#ifdef TURKEY_LOGO + ui->logo_label->setPixmap(QPixmap(QString::fromUtf8(":/image/Turkey_logo.png"))); + + show_timer = new QTimer(this); + connect(show_timer, SIGNAL(timeout()), this, SLOT(logo_timer_fun())); + show_timer->start(5000); +#endif +} + +logo_Form::~logo_Form() +{ + delete ui; +} +extern InkJetPrinter *pInkJectPrinter; + +void logo_Form::logo_timer_fun() +{ + show_timer->stop(); + pInkJectPrinter->show(); +} diff --git a/logo_form.h b/logo_form.h index c8c8999..2bc4677 100644 --- a/logo_form.h +++ b/logo_form.h @@ -1,26 +1,26 @@ -#ifndef LOGO_FORM_H -#define LOGO_FORM_H - -#include - -namespace Ui { -class logo_Form; -} - -class logo_Form : public QWidget -{ - Q_OBJECT - -public: - - explicit logo_Form(QWidget *parent = 0); - ~logo_Form(); -private slots: - void logo_timer_fun(); -private: - - QTimer *show_timer; - Ui::logo_Form *ui; -}; - -#endif // LOGO_FORM_H +#ifndef LOGO_FORM_H +#define LOGO_FORM_H + +#include + +namespace Ui { +class logo_Form; +} + +class logo_Form : public QWidget +{ + Q_OBJECT + +public: + + explicit logo_Form(QWidget *parent = 0); + ~logo_Form(); +private slots: + void logo_timer_fun(); +private: + + QTimer *show_timer; + Ui::logo_Form *ui; +}; + +#endif // LOGO_FORM_H diff --git a/logo_form.ui b/logo_form.ui index 8870667..c056c28 100644 --- a/logo_form.ui +++ b/logo_form.ui @@ -1,32 +1,32 @@ - - - logo_Form - - - - 0 - 0 - 640 - 480 - - - - Form - - - - - 0 - 0 - 640 - 480 - - - - - - - - - - + + + logo_Form + + + + 0 + 0 + 640 + 480 + + + + Form + + + + + 0 + 0 + 640 + 480 + + + + + + + + + + diff --git a/main.cpp b/main.cpp index 4a1ac0f..d7f9df0 100644 --- a/main.cpp +++ b/main.cpp @@ -1,256 +1,256 @@ -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include "InkJetPrinter.h" -#include "logo_form.h" -#include "MyInputMethod.h" -#include "mainwindow.h" -#include -#include -#include -#include -#include "myinclude.h" -#include "Public.h" -#include "Log/filelogger.h" -//#define SYS_CN - -#include "dump.h" - -QString gAppNameStr = ""; - -/* -1. WenQuanYiMH_12_50.qpf2 是由 Zfull-GB_12_50(Zpix.ttf)在PCMAKEQPF软件下生成的,它包含较完整的字体库 nono 20160302 - -2. 基于WenQuanYiCN编越南语,中文通用字库 -3. 基于WenQuanYiMicroHei编 普通版本字库 -#git commit -am "测试提交新数据" -#git push -#git clone xiongnie@119.23.201.56:/var/repo_dir/QtUI.git -#git pull xiongnie@119.23.201.56:/var/repo_dir/QtUI.git -#git remote add origin git@github.com:username/Hello-World.git -#git push origin master 将本地项目给提交到服务器中 -#----------------------------------------------------------- -#git pull 本地与服务器端同步 -#----------------------------------------------------------------- -#git push (远程仓库名) (分支名) 将本地分支推送到服务器上去。 -#git push origin serverfix:awesomebranch - - -git remote add origin xiongnie@119.23.201.56:/var/repo_dir/QRUIV53.git - - -### - - - */ - - - -InkJetPrinter *pInkJectPrinter; -MyInputMethod *myInputMethod; - -//#include -//#include -//#include - -void loadApplicationFonts(); - -int main(int argc, char *argv[]) -{ - - QString keyBoardType = Public::ReadKeyBoardUse(); - if(keyBoardType == "MultiLanguage") - qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); - - QApplication a(argc, argv); - gAppNameStr = QString::fromUtf8(argv[0]); - installSignalHandlers(); - - loadApplicationFonts(); - - QApplication::setStyle(QStyleFactory::create("Windows")); - QFont f = a.font(); - QString langurageFile; - QFile file(SYS_ROOT_DIR"UseEn"); - - if(file.exists()) - { - QString langurageType = Public::ReadLanguageName();//"";// - qDebug()<<"La:"<load(langurageFile)==false){ - translator->deleteLater(); - QMessageBox::critical(0,("错误"),("无法加载中文翻译文件") + langurageFile); - } - else { - QApplication::installTranslator(translator); - } - - myInputMethod = new MyInputMethod();//edit@02-07 - - // 配置日志 - QString configFileName = ":/conf/config.ini"; - QSettings* logSettings = new QSettings(configFileName, QSettings::IniFormat, &a); - logSettings->beginGroup("logging"); - FileLogger* logger = new FileLogger(logSettings, 10000, &a); - logger->installMsgHandler(); - - InkJetPrinter w; -#ifndef Q_OS_WIN32 - w.setWindowTitle(("比洋喷码")); - - //edit@11-28 - const QString style_main2="QTabBar::tab {height:65px;border-top-left-radius: 6px;border-top-right-radius: 6px;padding-left: 11px;padding-right: 11px;border: 2px solid #C4C4C3;} \ - QTabBar::tab:selected {background-color: rgb(255, 170, 127);height:70px;}\ - QTabBar::tab:!selected {margin-top: 5px;}\ - QTabBar::scroller{ width:80px;} \ - QRadioButton::indicator{ width: 24px; height: 24px; } \ - QCheckBox::indicator { width: 18px; height: 18px; } "; - - w.setStyleSheet(style_main2); - //w.showFullScreen(); /*保证全屏,看不到系统标题*/ -#endif - if (QSysInfo::buildCpuArchitecture().contains("x86")) { - qDebug() << "Running in Debug mode"; - w.show(); - } else { - qDebug() << "Running in Release mode"; - w.showFullScreen(); - } - -// w.show(); - - pInkJectPrinter = &w; - return a.exec(); -} - -void loadApplicationFonts() { - QStringList fontPaths = { - "/usr/lib/fonts/YaHeiBold-5pt-6.bdf", - "/usr/lib/fonts/YaHeiBold-7pt-8.bdf", - "/usr/lib/fonts/YaHeiBold-9pt-10.bdf", - "/usr/lib/fonts/YaHeiBold-12pt-13.bdf", - "/usr/lib/fonts/YaHeiBold-16pt-17.bdf", - "/usr/lib/fonts/WenQuanYiMedium-5pt-6.bdf", - "/usr/lib/fonts/WenQuanYiMedium-7pt-8.bdf", - "/usr/lib/fonts/DinkieBitmap9pxMedium-9pt-10.bdf", - "/usr/lib/fonts/WenQuanYiMedium-12pt-13.bdf", - "/usr/lib/fonts/WenQuanYiMedium-16pt-17.bdf", - "/usr/lib/fonts/WenQuanYiMedium-24pt-25.bdf", - "/usr/lib/fonts/WenQuanYiMedium-32pt-33.bdf", - "/usr/lib/fonts/WenQuanYiMicroHei.ttf", - "/usr/lib/fonts/msyhl_12pt.bdf", - "/usr/lib/fonts/arial.ttf", - "/usr/lib/fonts/YanglabeldotMedium-12pt-13.bdf", - "/usr/lib/fonts/DinkieBitmap9MepxdiumL-9pt-10.bdf", // 添加左翻字体 - "/usr/lib/fonts/WenQuanYiMediumL-5pt-6.bdf", - "/usr/lib/fonts/WenQuanYiMediumL-7pt-8.bdf", - "/usr/lib/fonts/WenQuanYiMediumL-12pt-13.bdf", - "/usr/lib/fonts/WenQuanYiMediumL-16pt-17.bdf", - "/usr/lib/fonts/WenQuanYiMediumL-24pt-25.bdf", - "/usr/lib/fonts/WenQuanYiMediumL-32pt-33.bdf", - "/usr/lib/fonts/DinkieBitmap9pxMediumR-9pt-10.bdf", // 添加右翻字体 - "/usr/lib/fonts/WenQuanYiMediumR-5pt-6.bdf", - "/usr/lib/fonts/WenQuanYiMediumR-7pt-8.bdf", - "/usr/lib/fonts/WenQuanYiMediumR-12pt-13.bdf", - "/usr/lib/fonts/WenQuanYiMediumR-16pt-17.bdf", - "/usr/lib/fonts/WenQuanYiMediumR-24pt-25.bdf", - "/usr/lib/fonts/WenQuanYiMediumR-32pt-33.bdf" - }; - foreach (const QString &path, fontPaths) { - if (QFile::exists(path)) { - int fontId = QFontDatabase::addApplicationFont(path); - if (fontId == -1) { - qDebug()<< "Failed to load font:" << path; - } else { - qDebug()<< "Loaded font:" << path<< "ID:"<< fontId; - } - } - } -} +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include "InkJetPrinter.h" +#include "logo_form.h" +#include "MyInputMethod.h" +#include "mainwindow.h" +#include +#include +#include +#include +#include "myinclude.h" +#include "Public.h" +#include "Log/filelogger.h" +//#define SYS_CN + +#include "dump.h" + +QString gAppNameStr = ""; + +/* +1. WenQuanYiMH_12_50.qpf2 是由 Zfull-GB_12_50(Zpix.ttf)在PCMAKEQPF软件下生成的,它包含较完整的字体库 nono 20160302 + +2. 基于WenQuanYiCN编越南语,中文通用字库 +3. 基于WenQuanYiMicroHei编 普通版本字库 +#git commit -am "测试提交新数据" +#git push +#git clone xiongnie@119.23.201.56:/var/repo_dir/QtUI.git +#git pull xiongnie@119.23.201.56:/var/repo_dir/QtUI.git +#git remote add origin git@github.com:username/Hello-World.git +#git push origin master 将本地项目给提交到服务器中 +#----------------------------------------------------------- +#git pull 本地与服务器端同步 +#----------------------------------------------------------------- +#git push (远程仓库名) (分支名) 将本地分支推送到服务器上去。 +#git push origin serverfix:awesomebranch + + +git remote add origin xiongnie@119.23.201.56:/var/repo_dir/QRUIV53.git + + +### + + + */ + + + +InkJetPrinter *pInkJectPrinter; +MyInputMethod *myInputMethod; + +//#include +//#include +//#include + +void loadApplicationFonts(); + +int main(int argc, char *argv[]) +{ + + QString keyBoardType = Public::ReadKeyBoardUse(); + if(keyBoardType == "MultiLanguage") + qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); + + QApplication a(argc, argv); + gAppNameStr = QString::fromUtf8(argv[0]); + installSignalHandlers(); + + loadApplicationFonts(); + + QApplication::setStyle(QStyleFactory::create("Windows")); + QFont f = a.font(); + QString langurageFile; + QFile file(SYS_ROOT_DIR"UseEn"); + + if(file.exists()) + { + QString langurageType = Public::ReadLanguageName();//"";// + qDebug()<<"La:"<load(langurageFile)==false){ + translator->deleteLater(); + QMessageBox::critical(0,("错误"),("无法加载中文翻译文件") + langurageFile); + } + else { + QApplication::installTranslator(translator); + } + + myInputMethod = new MyInputMethod();//edit@02-07 + + // 配置日志 + QString configFileName = ":/conf/config.ini"; + QSettings* logSettings = new QSettings(configFileName, QSettings::IniFormat, &a); + logSettings->beginGroup("logging"); + FileLogger* logger = new FileLogger(logSettings, 10000, &a); + logger->installMsgHandler(); + + InkJetPrinter w; +#ifndef Q_OS_WIN32 + w.setWindowTitle(("比洋喷码")); + + //edit@11-28 + const QString style_main2="QTabBar::tab {height:65px;border-top-left-radius: 6px;border-top-right-radius: 6px;padding-left: 11px;padding-right: 11px;border: 2px solid #C4C4C3;} \ + QTabBar::tab:selected {background-color: rgb(255, 170, 127);height:70px;}\ + QTabBar::tab:!selected {margin-top: 5px;}\ + QTabBar::scroller{ width:80px;} \ + QRadioButton::indicator{ width: 24px; height: 24px; } \ + QCheckBox::indicator { width: 18px; height: 18px; } "; + + w.setStyleSheet(style_main2); + //w.showFullScreen(); /*保证全屏,看不到系统标题*/ +#endif + if (QSysInfo::buildCpuArchitecture().contains("x86")) { + qDebug() << "Running in Debug mode"; + w.show(); + } else { + qDebug() << "Running in Release mode"; + w.showFullScreen(); + } + +// w.show(); + + pInkJectPrinter = &w; + return a.exec(); +} + +void loadApplicationFonts() { + QStringList fontPaths = { + "/usr/lib/fonts/YaHeiBold-5pt-6.bdf", + "/usr/lib/fonts/YaHeiBold-7pt-8.bdf", + "/usr/lib/fonts/YaHeiBold-9pt-10.bdf", + "/usr/lib/fonts/YaHeiBold-12pt-13.bdf", + "/usr/lib/fonts/YaHeiBold-16pt-17.bdf", + "/usr/lib/fonts/WenQuanYiMedium-5pt-6.bdf", + "/usr/lib/fonts/WenQuanYiMedium-7pt-8.bdf", + "/usr/lib/fonts/DinkieBitmap9pxMedium-9pt-10.bdf", + "/usr/lib/fonts/WenQuanYiMedium-12pt-13.bdf", + "/usr/lib/fonts/WenQuanYiMedium-16pt-17.bdf", + "/usr/lib/fonts/WenQuanYiMedium-24pt-25.bdf", + "/usr/lib/fonts/WenQuanYiMedium-32pt-33.bdf", + "/usr/lib/fonts/WenQuanYiMicroHei.ttf", + "/usr/lib/fonts/msyhl_12pt.bdf", + "/usr/lib/fonts/arial.ttf", + "/usr/lib/fonts/YanglabeldotMedium-12pt-13.bdf", + "/usr/lib/fonts/DinkieBitmap9MepxdiumL-9pt-10.bdf", // 添加左翻字体 + "/usr/lib/fonts/WenQuanYiMediumL-5pt-6.bdf", + "/usr/lib/fonts/WenQuanYiMediumL-7pt-8.bdf", + "/usr/lib/fonts/WenQuanYiMediumL-12pt-13.bdf", + "/usr/lib/fonts/WenQuanYiMediumL-16pt-17.bdf", + "/usr/lib/fonts/WenQuanYiMediumL-24pt-25.bdf", + "/usr/lib/fonts/WenQuanYiMediumL-32pt-33.bdf", + "/usr/lib/fonts/DinkieBitmap9pxMediumR-9pt-10.bdf", // 添加右翻字体 + "/usr/lib/fonts/WenQuanYiMediumR-5pt-6.bdf", + "/usr/lib/fonts/WenQuanYiMediumR-7pt-8.bdf", + "/usr/lib/fonts/WenQuanYiMediumR-12pt-13.bdf", + "/usr/lib/fonts/WenQuanYiMediumR-16pt-17.bdf", + "/usr/lib/fonts/WenQuanYiMediumR-24pt-25.bdf", + "/usr/lib/fonts/WenQuanYiMediumR-32pt-33.bdf" + }; + foreach (const QString &path, fontPaths) { + if (QFile::exists(path)) { + int fontId = QFontDatabase::addApplicationFont(path); + if (fontId == -1) { + qDebug()<< "Failed to load font:" << path; + } else { + qDebug()<< "Loaded font:" << path<< "ID:"<< fontId; + } + } + } +} diff --git a/mainwindow.cpp b/mainwindow.cpp index 8285519..47a9f6e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #define MDTFLAG 0xff00FF10 #define QRFLAG 0xff00FF20 @@ -622,6 +623,7 @@ void MainWindow::RefreshStatusLight(){//100ms // 20160620 新增主界面显示:压力,粘度,隔膜位置,晶振电压数,相位 ui->labPress->setText(QString("%1/%2").arg(sysPara->status.PRESSURE).arg(sysPara->para.pressure)); + ui->labViso->setText(QString("%1/%2").arg(sysPara->status.viscosity).arg(sysPara->para.viscosity) ); if(sysPara->para.gearPumpEnable) { diff --git a/mainwindow.h b/mainwindow.h index 7397adc..334955a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,347 +1,347 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include -#include "ParaSettingUI.h" -#include "PrintSetting.h" -#include -#include "QBarCode.h" -#include "dlgQrCode.h" -#include "dlgmywarring.h" -//#define RETANKACK // 改回收 -#include -#ifdef PICSCENE -#include "scene/picscene.h" -#include "VerBVersion.h" -#include "myinclude.h" - -class PicScene; -QT_BEGIN_NAMESPACE -class QAction; -class QToolBox; -class QSpinBox; -class QComboBox; -class QFontComboBox; -class QButtonGroup; -class QLineEdit; -class QGraphicsTextItem; -class QFont; -class QToolButton; -class QAbstractButton; -class QGraphicsView; -QT_END_NAMESPACE -#endif -#define CLEARCNTNOW - - - -#include -#include -#include -namespace Ui { - class MainWindow; -} - -class MainWindow : public QWidget,public ParaSettingUI -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - - void bindSysPara(SysPara *SysPara);//重载 - void updateSysParaToUI(); //重载 - void updateSysStatusToUI(); //重载 - void applyUIPara(); //重载 - bool updatePhaseIndicatorLight(); - void showPrintBitImage(); - int calculateMaxSpeed(int backup); - - void enablePrintButton(bool enable); - void enableReclaimCtrlButton(bool enable); - void resetReclaimCtrlButtonText(); - void enablePushButtonStart(bool enable); - int getMaxSpeedCalcPara(); - - void PreviewPressed(); - int getCurrPrintStatus(); - TextEditOption* getTexteditOption(); - - void SetEditMode(int mode); - bool fileChange; - bool pushButtonFlag; - - int getVarStarRow(int x, int y, int h, int w,char *dat); - - void testPrint(); - int searchQrVar(); - PicScene* getPicScene(); - //void pushOnlyCNT1Clear_Hide(); - - DlgMyWarring dlgMyWarring; - QString strWarring,strTitle; - QMessageBox *msgtest; - void updateTotalCnt(int en); - bool m_2sFlag; - bool flagOfClearHighVltageWarnning; - QTimer *timerShowItem,*timerPowerOff; - void UpdateDateTimeQRCode(QString strContent); - - //返回文档打印大小 - QSizeF getDocSize()const ; - - void setReBootQtUIEnable(bool); - void updatePrintDisplayLabel(); - -public slots: - void OnFinished(int event); - void onQRCodeClose(); - void onEditQRCode(); - void onEditBarCode(); - void onBarCodeClose(); - void on_pushButtonCleanUP_pressed(); - //void on_pushOnlyCNT1Clear_pressed(); - void onPushButtonCNTResetNowPressed(); - void changeEditMode(int editMode); - void SetMainTabEdit(int n); - void changeTxtMode(QString str); - // void openPngFile(QString filePath); - void openPicFIleOpen(QString filePath, bool insertFlag); - void onReclainTankPositionChanged(int value); - void checkForPowerOff(); - void on_pushButtonStart_pressed(); - - void setRunStatus(QString str); - - void setRunStatus(QPixmap pixMap); - - void _on_pushButtonPowerOff_pressed(bool notice); - - void on_pushButtonReclaimTankClose_pressed(); - - void alterDataPrint(unsigned char); - void showDat(unsigned char * Dat); - void SendPrintDataToFpga(unsigned char alterEnable); - void on_pushButtonStopPrint_pressed(); - void on_pushButtonPausePrint_pressed(); - void RefreshStatusLight(); - void onInitQRCode(); - void onUpdateDispQRCode(int type); // 更新二维码显示 - void modbusUpdateQRCode(); - //void onUpdateDispBcCode(int type); // 更新条形码显示 - void CheckStatus(int Flag); - void ShowWarnningText1(QString strTitle, QString strWarring); - void onStatusHighVoltageFault(); - void onStatusInkLeak(); - void onStatusInkSwint(); - void onStatusInkWaterLevel(); - void onStatusRecycleWarn(); - void onStatusSolvLevelWarn(); - void onStatusViscosityWarn(); - void onStatusChargefault(); - - void onPreviewScene(); - - void update_scroll(); - - void JSON_UpdateDATA(); - void on_pushButtonStartPrint_pressed(); - void onGenerateQRCode(QString strData); - void onShowAndHideItem(); - void sendPowerOffCmd(); - void powerOffConfirmed(); - void onSwitchTimerShowItem(bool flag); - void onLabelFaultRusumePressed(); - void onEnableReclaimCtrlButton(bool flag); - void onInkJetPrinterCurrentChanged(int); - - void showFPGAqueuesize(int); - void showSTM32queuesize(int); - void showqueueFPGAsize(int size); - void UpdateUIVersion(); - - void checkPrintingInterval(); -#ifdef EnableArabic - void setOpenFileName(QString); -#endif -private slots: - // void on_pushButtonTXTOpen_pressed(); - void on_pushButtonGetData_pressed(); - void onPushButtonPreviewPressed(); - - void on_pushButtonReclaimTanOpen_pressed(); - void ontextEdittextChanged(); - void onTextEditCursorPositionChanged(); - //void onLabelFaultRusumePressed(); - - - void onLabelProductCntPressed(); - void onLabelTotalProductCntPressed(); - void displayTime(); - void airPushingProcess(); - - void on_bottonEditText_pressed(); - - void on_pushButtonReduceTextDisplay_pressed(); - void on_pushButtonEnlargeTextDisplay_pressed(); - void showFPGAData(QByteArray); - - - void on_pushButton_Reboot_clicked(); - - void on_pushButtonPowerOff_clicked(); - - //网络二维码的更新和清空 - void slt_updateNetworkQR(); - void slt_clearAllQRCode(); - - -Q_SIGNALS: - void openFileChange(); - void openCurrFile(QString); - void saveJmFile(); - void setMainTabNow(int); // 切换到主窗口 - void InkjetCleanUP(); - void ShowWarnningText(QString , QString ); - void editItemMode(); - void CloseJd(); - void pushButtonStartPressed(bool); - void repeatInitedPid(); - void setCNT1Select(bool); - void setCNT2Select(bool); - void setCNT3Select(bool); - void getJSONData(); - void scenefileOpen(QString,bool); - void setDisableAll(); - - void closeSerial(); - void clearPressureFault(); - void readFPGAVersionReady(); - -//修改字体宽度 -void autoUpdateFontWidthByMainWindow(const unsigned int); -private: - Ui::MainWindow *ui; - - int dlgMyWarringShowDlyCnt; - void generateCharRamData(); - void reclaimTanOpen(); - - QBarCode *barcode; - dlgQrCode *dlgqrcode; - /** - 处理各种码的方法,分文本模式和场景模式 - */ - void handleCode(int col, int row, int* varLastRow, int type); - void handleCodeScene(int col, int row, int* varLastRow, int type, int textItemPosX, int textItemPosY); - - QThread ShowThead; - QTimer *timer; - QTimer *airPushTimer; - bool printingFlag; //判断当前是否在打印 - bool startPrintingFlag; - bool previewFlag; - bool m_powerOffInProgress = false; // 防止MySleep处理事件时重复进入关机流程 - - int searchExpiryVar(QString html = "");//检索有效期变量 - void ExpiryDotUpdate(char Mode); - int r_ExpiryDay; - void Test_Start_Stop(); - - // 检查起始行和结束行, 返回变量数量 - int checkRange(QImage textImage, int textColdot, - int posX, int posY); - - // 处理场景模式下的变量 - void handleSceneShow(bool MaxCol4000, unsigned char *dat); -#ifdef PICSCENE - PicScene *pPicScene; - QGraphicsView *view; - QHBoxLayout *pSceneHBoxLayout; - QWidget *pSceneEditOptional; - - QPushButton *pOpenSceneButton; - QPushButton *pNewSceneButton; - QPushButton *pImportSceneButton; - QPushButton *pSaveSceneButton; - QPushButton *pSaveAsSceneButton; - QPushButton *pEditSceneButton; - PicTextItem *textItem; -#endif - -#if 0 -private slots: - void deleteItem(); - void bringToFront(); - void sendToBack(); - void itemInserted(DiagramItem *item); - void textInserted(QGraphicsTextItem *item); - void currentFontChanged(const QFont &font); - void fontSizeChanged(const QString &size); - void sceneScaleChanged(const QString &scale); - void textColorChanged(); - void itemColorChanged(); - void lineColorChanged(); - void textButtonTriggered(); - void fillButtonTriggered(); - void lineButtonTriggered(); - void handleFontChange(); - void itemSelected(QGraphicsItem *item); - void about(); - - private: - void createToolBox(); - void createActions(); - void createMenus(); - void createToolbars(); - QWidget *createBackgroundCellWidget(const QString &text, - const QString &image); - QWidget *createCellWidget(const QString &text, - DiagramItem::DiagramType type); - QMenu *createColorMenu(const char *slot, QColor defaultColor); - QIcon createColorToolButtonIcon(const QString &image, QColor color); - QIcon createColorIcon(QColor color); - - DiagramScene *scene; - QGraphicsView *view; - - QAction *exitAction; - QAction *addAction; - QAction *deleteAction; - - QAction *toFrontAction; - QAction *sendBackAction; - - QMenu *fileMenu; - QMenu *itemMenu; - - QToolBar *textToolBar; - QToolBar *editToolBar; - QToolBar *colorToolBar; - QToolBar *pointerToolbar; - - QComboBox *sceneScaleCombo; - QComboBox *itemColorCombo; - QComboBox *textColorCombo; - QComboBox *fontSizeCombo; - QFontComboBox *fontCombo; - - QToolBox *toolBox; - QButtonGroup *buttonGroup; - QButtonGroup *pointerTypeGroup; - QToolButton *fontColorToolButton; - QToolButton *fillColorToolButton; - QToolButton *lineColorToolButton; - QAction *boldAction; - QAction *underlineAction; - QAction *italicAction; - QAction *textAction; - QAction *fillAction; - QAction *lineAction; -#endif - -}; - -#endif // MAINWINDOW_H +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include "ParaSettingUI.h" +#include "PrintSetting.h" +#include +#include "QBarCode.h" +#include "dlgQrCode.h" +#include "dlgmywarring.h" +//#define RETANKACK // 改回收 +#include +#ifdef PICSCENE +#include "scene/picscene.h" +#include "VerBVersion.h" +#include "myinclude.h" + +class PicScene; +QT_BEGIN_NAMESPACE +class QAction; +class QToolBox; +class QSpinBox; +class QComboBox; +class QFontComboBox; +class QButtonGroup; +class QLineEdit; +class QGraphicsTextItem; +class QFont; +class QToolButton; +class QAbstractButton; +class QGraphicsView; +QT_END_NAMESPACE +#endif +#define CLEARCNTNOW + + + +#include +#include +#include +namespace Ui { + class MainWindow; +} + +class MainWindow : public QWidget,public ParaSettingUI +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + + void bindSysPara(SysPara *SysPara);//重载 + void updateSysParaToUI(); //重载 + void updateSysStatusToUI(); //重载 + void applyUIPara(); //重载 + bool updatePhaseIndicatorLight(); + void showPrintBitImage(); + int calculateMaxSpeed(int backup); + + void enablePrintButton(bool enable); + void enableReclaimCtrlButton(bool enable); + void resetReclaimCtrlButtonText(); + void enablePushButtonStart(bool enable); + int getMaxSpeedCalcPara(); + + void PreviewPressed(); + int getCurrPrintStatus(); + TextEditOption* getTexteditOption(); + + void SetEditMode(int mode); + bool fileChange; + bool pushButtonFlag; + + int getVarStarRow(int x, int y, int h, int w,char *dat); + + void testPrint(); + int searchQrVar(); + PicScene* getPicScene(); + //void pushOnlyCNT1Clear_Hide(); + + DlgMyWarring dlgMyWarring; + QString strWarring,strTitle; + QMessageBox *msgtest; + void updateTotalCnt(int en); + bool m_2sFlag; + bool flagOfClearHighVltageWarnning; + QTimer *timerShowItem,*timerPowerOff; + void UpdateDateTimeQRCode(QString strContent); + + //返回文档打印大小 + QSizeF getDocSize()const ; + + void setReBootQtUIEnable(bool); + void updatePrintDisplayLabel(); + +public slots: + void OnFinished(int event); + void onQRCodeClose(); + void onEditQRCode(); + void onEditBarCode(); + void onBarCodeClose(); + void on_pushButtonCleanUP_pressed(); + //void on_pushOnlyCNT1Clear_pressed(); + void onPushButtonCNTResetNowPressed(); + void changeEditMode(int editMode); + void SetMainTabEdit(int n); + void changeTxtMode(QString str); + // void openPngFile(QString filePath); + void openPicFIleOpen(QString filePath, bool insertFlag); + void onReclainTankPositionChanged(int value); + void checkForPowerOff(); + void on_pushButtonStart_pressed(); + + void setRunStatus(QString str); + + void setRunStatus(QPixmap pixMap); + + void _on_pushButtonPowerOff_pressed(bool notice); + + void on_pushButtonReclaimTankClose_pressed(); + + void alterDataPrint(unsigned char); + void showDat(unsigned char * Dat); + void SendPrintDataToFpga(unsigned char alterEnable); + void on_pushButtonStopPrint_pressed(); + void on_pushButtonPausePrint_pressed(); + void RefreshStatusLight(); + void onInitQRCode(); + void onUpdateDispQRCode(int type); // 更新二维码显示 + void modbusUpdateQRCode(); + //void onUpdateDispBcCode(int type); // 更新条形码显示 + void CheckStatus(int Flag); + void ShowWarnningText1(QString strTitle, QString strWarring); + void onStatusHighVoltageFault(); + void onStatusInkLeak(); + void onStatusInkSwint(); + void onStatusInkWaterLevel(); + void onStatusRecycleWarn(); + void onStatusSolvLevelWarn(); + void onStatusViscosityWarn(); + void onStatusChargefault(); + + void onPreviewScene(); + + void update_scroll(); + + void JSON_UpdateDATA(); + void on_pushButtonStartPrint_pressed(); + void onGenerateQRCode(QString strData); + void onShowAndHideItem(); + void sendPowerOffCmd(); + void powerOffConfirmed(); + void onSwitchTimerShowItem(bool flag); + void onLabelFaultRusumePressed(); + void onEnableReclaimCtrlButton(bool flag); + void onInkJetPrinterCurrentChanged(int); + + void showFPGAqueuesize(int); + void showSTM32queuesize(int); + void showqueueFPGAsize(int size); + void UpdateUIVersion(); + + void checkPrintingInterval(); +#ifdef EnableArabic + void setOpenFileName(QString); +#endif +private slots: + // void on_pushButtonTXTOpen_pressed(); + void on_pushButtonGetData_pressed(); + void onPushButtonPreviewPressed(); + + void on_pushButtonReclaimTanOpen_pressed(); + void ontextEdittextChanged(); + void onTextEditCursorPositionChanged(); + //void onLabelFaultRusumePressed(); + + + void onLabelProductCntPressed(); + void onLabelTotalProductCntPressed(); + void displayTime(); + void airPushingProcess(); + + void on_bottonEditText_pressed(); + + void on_pushButtonReduceTextDisplay_pressed(); + void on_pushButtonEnlargeTextDisplay_pressed(); + void showFPGAData(QByteArray); + + + void on_pushButton_Reboot_clicked(); + + void on_pushButtonPowerOff_clicked(); + + //网络二维码的更新和清空 + void slt_updateNetworkQR(); + void slt_clearAllQRCode(); + + +Q_SIGNALS: + void openFileChange(); + void openCurrFile(QString); + void saveJmFile(); + void setMainTabNow(int); // 切换到主窗口 + void InkjetCleanUP(); + void ShowWarnningText(QString , QString ); + void editItemMode(); + void CloseJd(); + void pushButtonStartPressed(bool); + void repeatInitedPid(); + void setCNT1Select(bool); + void setCNT2Select(bool); + void setCNT3Select(bool); + void getJSONData(); + void scenefileOpen(QString,bool); + void setDisableAll(); + + void closeSerial(); + void clearPressureFault(); + void readFPGAVersionReady(); + +//修改字体宽度 +void autoUpdateFontWidthByMainWindow(const unsigned int); +private: + Ui::MainWindow *ui; + + int dlgMyWarringShowDlyCnt; + void generateCharRamData(); + void reclaimTanOpen(); + + QBarCode *barcode; + dlgQrCode *dlgqrcode; + /** + 处理各种码的方法,分文本模式和场景模式 + */ + void handleCode(int col, int row, int* varLastRow, int type); + void handleCodeScene(int col, int row, int* varLastRow, int type, int textItemPosX, int textItemPosY); + + QThread ShowThead; + QTimer *timer; + QTimer *airPushTimer; + bool printingFlag; //判断当前是否在打印 + bool startPrintingFlag; + bool previewFlag; + bool m_powerOffInProgress = false; // 防止MySleep处理事件时重复进入关机流程 + + int searchExpiryVar(QString html = "");//检索有效期变量 + void ExpiryDotUpdate(char Mode); + int r_ExpiryDay; + void Test_Start_Stop(); + + // 检查起始行和结束行, 返回变量数量 + int checkRange(QImage textImage, int textColdot, + int posX, int posY); + + // 处理场景模式下的变量 + void handleSceneShow(bool MaxCol4000, unsigned char *dat); +#ifdef PICSCENE + PicScene *pPicScene; + QGraphicsView *view; + QHBoxLayout *pSceneHBoxLayout; + QWidget *pSceneEditOptional; + + QPushButton *pOpenSceneButton; + QPushButton *pNewSceneButton; + QPushButton *pImportSceneButton; + QPushButton *pSaveSceneButton; + QPushButton *pSaveAsSceneButton; + QPushButton *pEditSceneButton; + PicTextItem *textItem; +#endif + +#if 0 +private slots: + void deleteItem(); + void bringToFront(); + void sendToBack(); + void itemInserted(DiagramItem *item); + void textInserted(QGraphicsTextItem *item); + void currentFontChanged(const QFont &font); + void fontSizeChanged(const QString &size); + void sceneScaleChanged(const QString &scale); + void textColorChanged(); + void itemColorChanged(); + void lineColorChanged(); + void textButtonTriggered(); + void fillButtonTriggered(); + void lineButtonTriggered(); + void handleFontChange(); + void itemSelected(QGraphicsItem *item); + void about(); + + private: + void createToolBox(); + void createActions(); + void createMenus(); + void createToolbars(); + QWidget *createBackgroundCellWidget(const QString &text, + const QString &image); + QWidget *createCellWidget(const QString &text, + DiagramItem::DiagramType type); + QMenu *createColorMenu(const char *slot, QColor defaultColor); + QIcon createColorToolButtonIcon(const QString &image, QColor color); + QIcon createColorIcon(QColor color); + + DiagramScene *scene; + QGraphicsView *view; + + QAction *exitAction; + QAction *addAction; + QAction *deleteAction; + + QAction *toFrontAction; + QAction *sendBackAction; + + QMenu *fileMenu; + QMenu *itemMenu; + + QToolBar *textToolBar; + QToolBar *editToolBar; + QToolBar *colorToolBar; + QToolBar *pointerToolbar; + + QComboBox *sceneScaleCombo; + QComboBox *itemColorCombo; + QComboBox *textColorCombo; + QComboBox *fontSizeCombo; + QFontComboBox *fontCombo; + + QToolBox *toolBox; + QButtonGroup *buttonGroup; + QButtonGroup *pointerTypeGroup; + QToolButton *fontColorToolButton; + QToolButton *fillColorToolButton; + QToolButton *lineColorToolButton; + QAction *boldAction; + QAction *underlineAction; + QAction *italicAction; + QAction *textAction; + QAction *fillAction; + QAction *lineAction; +#endif + +}; + +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 0f3fd3c..c5001f8 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1,4019 +1,4019 @@ - - - MainWindow - - - true - - - - 0 - 0 - 800 - 600 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 5 - 5 - - - - Qt::StrongFocus - - - InkJet - - - - 0 - - - - - 0 - - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 2 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - 0 - 50 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 45 - - - - 编辑 - - - - :/icon/edit.png:/icon/edit.png - - - - - - - - 0 - 45 - - - - 打开文件 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 0 - 45 - - - - 二维码 - - - - :/icon/bypm.png:/icon/bypm.png - - - - - - - - 0 - 45 - - - - 条形码 - - - - :/icon/BarCode1.png:/icon/BarCode1.png - - - - - - - - 0 - 45 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - 0 - 45 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - true - - - - 0 - 45 - - - - 获取数据 - - - - - - - 交替打印文件名 - - - - - - - - - - - - - QLayout::SetDefaultConstraint - - - 0 - - - - - - 0 - 18 - - - - - 16777215 - 18 - - - - 最大:[40行x 2048列] - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 140 - 18 - - - - - 140 - 18 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 18 - - - - - 16777215 - 18 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 0 - 18 - - - - - 16777215 - 18 - - - - 同步器速度 - - - QFrame::NoFrame - - - QFrame::Sunken - - - - - - - - - - - 16777215 - 18 - - - - Qt::Vertical - - - - - - - - 0 - 18 - - - - - 100 - 18 - - - - 当前时间 - - - - - - - - - - - - - 800 - 150 - - - - 0 - - - - - - - - 610 - 95 - - - - - 800 - 120 - - - - - Monospace - 9 - 50 - false - false - - - - BlankCursor - - - true - - - Qt::StrongFocus - - - QFrame::StyledPanel - - - 0 - - - false - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Monospace'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'WenQuanYi12'; vertical-align:bottom;"><br /></p></body></html> - - - - - - - - - - 5 - 5 - 761 - 120 - - - - - 0 - 0 - - - - - 620 - 100 - - - - - 16777215 - 120 - - - - background-color: rgb(230, 230, 230); - - - false - - - - - 0 - 0 - 500 - 53 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - - - - - - - 0 - 10 - 781 - 141 - - - - - 0 - 0 - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 0 - - - - - 60 - 16777215 - - - - - - - :/image/ALARMGreen.PNG - - - - - - - - 0 - 60 - - - - - 60 - 16777215 - - - - - - - :/image/reset.png - - - - - - - - - 0 - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨线开关 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 喷头盖开 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水缸满 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 墨水液位 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 溶剂液位 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 回收故障 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 粘度故障 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 相位故障 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 高压故障 - - - Qt::AlignCenter - - - - - - - - 60 - 0 - - - - - 70 - 16777215 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - 159 - 158 - 158 - - - - - - - - 故障恢复 - - - Qt::AlignCenter - - - - - - - - - 0 - - - 4 - - - - - - 0 - 0 - - - - - 120 - 16777215 - - - - - 2 - - - 1 - - - 1 - - - 2 - - - - - - 110 - 0 - - - - - 110 - 16777215 - - - - 立即重新计米 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::NoFrame - - - QFrame::Sunken - - - 产品总计数 - - - - - - - - 110 - 20 - - - - - 110 - 16777215 - - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - - - - - 110 - 63 - - - - - 110 - 16777215 - - - - Qt::LeftToRight - - - false - - - 关机 - - - - :/icon/poweroff.png:/icon/poweroff.png - - - - - - - - - - 3 - - - 5 - - - 0 - - - - - 0 - - - 3 - - - 0 - - - 0 - - - 0 - - - - - 3 - - - 3 - - - 3 - - - 3 - - - 1 - - - - - 3 - - - - - - 300 - 0 - - - - - 300 - 16777215 - - - - - - - true - - - - - - - - 160 - 0 - - - - - 180 - 20 - - - - 2014-08-23 - - - Qt::AlignCenter - - - - - - - - - - - 0 - - - 4 - - - - - - 150 - 20 - - - - 粘度 - - - - - - - - 150 - 20 - - - - 高压包 - - - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 150 - 20 - - - - 隔膜位置 - - - - - - - - 70 - 0 - - - - - 64 - 20 - - - - - - - - - - - - 64 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 110 - 20 - - - - - 500 - 16777215 - - - - QFrame::NoFrame - - - - - - - - - - - 88 - 0 - - - - - 16777215 - 20 - - - - - - - - - - - - 150 - 20 - - - - 压力 - - - - - - - TextLabel - - - - - - - - - - 0 - 55 - - - - - 80 - 16777215 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 60 - 60 - 60 - - - - - - - - - 147 - 146 - 146 - - - - - - - - 开 - - - - :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png - - - - - - - - 60 - 0 - - - - - 70 - 60 - - - - - - - - - - - - 0 - 55 - - - - - 80 - 16777215 - - - - 关 - - - - :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 1 - - - 0 - - - 0 - - - - - - 0 - 50 - - - - - 98 - 63 - - - - - - - - - 0 - 170 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 186 - 188 - 185 - - - - - - - 242 - 241 - 240 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 186 - 188 - 185 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/startprint2.png - :/icon/startprint1.png - :/icon/startprint1.png - :/icon/startprint.png:/icon/startprint2.png - - - - 92 - 60 - - - - false - - - - - - - - 0 - 50 - - - - - 98 - 63 - - - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 170 - 0 - 0 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 193 - 121 - 121 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 241 - 176 - 165 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 199 - 189 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 227 - 97 - 75 - - - - - - - 227 - 97 - 75 - - - - - - - 0 - 0 - 0 - - - - - - - 227 - 97 - 75 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - :/icon/stopprint2.png - :/icon/stopprint1.png - :/icon/stopprint1.png - :/icon/stopprint.png:/icon/stopprint2.png - - - - 92 - 60 - - - - - - - - - 0 - 50 - - - - - 98 - 63 - - - - 喷嘴逆清洗 - - - - 92 - 16 - - - - - - - - - 0 - 50 - - - - - 98 - 63 - - - - - - - - - 255 - 170 - 0 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 206 - 186 - 124 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 209 - 206 - 203 - - - - - - - 242 - 241 - 240 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 209 - 199 - 189 - - - - - - - 159 - 158 - 158 - - - - - - - 255 - 255 - 255 - - - - - - - 147 - 146 - 146 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - background-image:url(:/icon/pauseprint2.png) - - - 暂停打印 -停止高压 - - - - 92 - 60 - - - - - - - - - 0 - 50 - - - - - 98 - 63 - - - - background-color: rgb(0, 255, 0); - - - 紧急停机 - - - - - - - - 90 - 60 - - - - 重启 - - - - - - - - - - - - - - - - - ClickLabel - QLabel -
ClickLabel.h
-
- - MyView - QGraphicsView -
scene/myview.h
-
- - PicWidget - QWidget -
PicWidget.h
- 1 -
- - TextEditOption - QWidget -
TextEditOption.h
- 1 -
- - PrintTextDisplay - QWidget -
PrintTextDisplay.h
- 1 -
- - MyTextEdit - QTextEdit -
MyTextEdit.h
-
- - SceneEditOption - QWidget -
scene/SceneEditOption.h
- 1 -
- - SceneViewWidget - QWidget -
scene/sceneviewwidget.h
- 1 -
-
- - - - -
+ + + MainWindow + + + true + + + + 0 + 0 + 800 + 600 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 5 + 5 + + + + Qt::StrongFocus + + + InkJet + + + + 0 + + + + + 0 + + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 2 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + 0 + 50 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 45 + + + + 编辑 + + + + :/icon/edit.png:/icon/edit.png + + + + + + + + 0 + 45 + + + + 打开文件 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 0 + 45 + + + + 二维码 + + + + :/icon/bypm.png:/icon/bypm.png + + + + + + + + 0 + 45 + + + + 条形码 + + + + :/icon/BarCode1.png:/icon/BarCode1.png + + + + + + + + 0 + 45 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + 0 + 45 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + true + + + + 0 + 45 + + + + 获取数据 + + + + + + + 交替打印文件名 + + + + + + + + + + + + + QLayout::SetDefaultConstraint + + + 0 + + + + + + 0 + 18 + + + + + 16777215 + 18 + + + + 最大:[40行x 2048列] + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 140 + 18 + + + + + 140 + 18 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 18 + + + + + 16777215 + 18 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 0 + 18 + + + + + 16777215 + 18 + + + + 同步器速度 + + + QFrame::NoFrame + + + QFrame::Sunken + + + + + + + + + + + 16777215 + 18 + + + + Qt::Vertical + + + + + + + + 0 + 18 + + + + + 100 + 18 + + + + 当前时间 + + + + + + + + + + + + + 800 + 150 + + + + 0 + + + + + + + + 610 + 95 + + + + + 800 + 120 + + + + + Monospace + 9 + 50 + false + false + + + + BlankCursor + + + true + + + Qt::StrongFocus + + + QFrame::StyledPanel + + + 0 + + + false + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Monospace'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'WenQuanYi12'; vertical-align:bottom;"><br /></p></body></html> + + + + + + + + + + 5 + 5 + 761 + 120 + + + + + 0 + 0 + + + + + 620 + 100 + + + + + 16777215 + 120 + + + + background-color: rgb(230, 230, 230); + + + false + + + + + 0 + 0 + 500 + 53 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + + + 0 + 10 + 781 + 141 + + + + + 0 + 0 + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 0 + + + + + 60 + 16777215 + + + + + + + :/image/ALARMGreen.PNG + + + + + + + + 0 + 60 + + + + + 60 + 16777215 + + + + + + + :/image/reset.png + + + + + + + + + 0 + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨线开关 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 喷头盖开 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水缸满 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 墨水液位 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 溶剂液位 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 回收故障 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 粘度故障 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 相位故障 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 高压故障 + + + Qt::AlignCenter + + + + + + + + 60 + 0 + + + + + 70 + 16777215 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + 159 + 158 + 158 + + + + + + + + 故障恢复 + + + Qt::AlignCenter + + + + + + + + + 0 + + + 4 + + + + + + 0 + 0 + + + + + 120 + 16777215 + + + + + 2 + + + 1 + + + 1 + + + 2 + + + + + + 110 + 0 + + + + + 110 + 16777215 + + + + 立即重新计米 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::NoFrame + + + QFrame::Sunken + + + 产品总计数 + + + + + + + + 110 + 20 + + + + + 110 + 16777215 + + + + QFrame::WinPanel + + + QFrame::Sunken + + + + + + + + + + + 110 + 63 + + + + + 110 + 16777215 + + + + Qt::LeftToRight + + + false + + + 关机 + + + + :/icon/poweroff.png:/icon/poweroff.png + + + + + + + + + + 3 + + + 5 + + + 0 + + + + + 0 + + + 3 + + + 0 + + + 0 + + + 0 + + + + + 3 + + + 3 + + + 3 + + + 3 + + + 1 + + + + + 3 + + + + + + 300 + 0 + + + + + 300 + 16777215 + + + + + + + true + + + + + + + + 160 + 0 + + + + + 180 + 20 + + + + 2014-08-23 + + + Qt::AlignCenter + + + + + + + + + + + 0 + + + 4 + + + + + + 150 + 20 + + + + 粘度 + + + + + + + + 150 + 20 + + + + 高压包 + + + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 150 + 20 + + + + 隔膜位置 + + + + + + + + 70 + 0 + + + + + 64 + 20 + + + + + + + + + + + + 64 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 110 + 20 + + + + + 500 + 16777215 + + + + QFrame::NoFrame + + + + + + + + + + + 88 + 0 + + + + + 16777215 + 20 + + + + + + + + + + + + 150 + 20 + + + + 压力 + + + + + + + TextLabel + + + + + + + + + + 0 + 55 + + + + + 80 + 16777215 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 60 + 60 + 60 + + + + + + + + + 147 + 146 + 146 + + + + + + + + 开 + + + + :/icon/openreclaimtanl.png:/icon/openreclaimtanl.png + + + + + + + + 60 + 0 + + + + + 70 + 60 + + + + + + + + + + + + 0 + 55 + + + + + 80 + 16777215 + + + + 关 + + + + :/icon/closereclaimtanl.png:/icon/closereclaimtanl.png + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 + + + 0 + + + 0 + + + + + + 0 + 50 + + + + + 98 + 63 + + + + + + + + + 0 + 170 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 186 + 188 + 185 + + + + + + + 242 + 241 + 240 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 186 + 188 + 185 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/startprint2.png + :/icon/startprint1.png + :/icon/startprint1.png + :/icon/startprint.png:/icon/startprint2.png + + + + 92 + 60 + + + + false + + + + + + + + 0 + 50 + + + + + 98 + 63 + + + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 170 + 0 + 0 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 193 + 121 + 121 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 241 + 176 + 165 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 199 + 189 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 227 + 97 + 75 + + + + + + + 227 + 97 + 75 + + + + + + + 0 + 0 + 0 + + + + + + + 227 + 97 + 75 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + :/icon/stopprint2.png + :/icon/stopprint1.png + :/icon/stopprint1.png + :/icon/stopprint.png:/icon/stopprint2.png + + + + 92 + 60 + + + + + + + + + 0 + 50 + + + + + 98 + 63 + + + + 喷嘴逆清洗 + + + + 92 + 16 + + + + + + + + + 0 + 50 + + + + + 98 + 63 + + + + + + + + + 255 + 170 + 0 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 206 + 186 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 209 + 206 + 203 + + + + + + + 242 + 241 + 240 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 209 + 199 + 189 + + + + + + + 159 + 158 + 158 + + + + + + + 255 + 255 + 255 + + + + + + + 147 + 146 + 146 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + background-image:url(:/icon/pauseprint2.png) + + + 暂停打印 +停止高压 + + + + 92 + 60 + + + + + + + + + 0 + 50 + + + + + 98 + 63 + + + + background-color: rgb(0, 255, 0); + + + 紧急停机 + + + + + + + + 90 + 60 + + + + 重启 + + + + + + + + + + + + + + + + + ClickLabel + QLabel +
ClickLabel.h
+
+ + MyView + QGraphicsView +
scene/myview.h
+
+ + PicWidget + QWidget +
PicWidget.h
+ 1 +
+ + TextEditOption + QWidget +
TextEditOption.h
+ 1 +
+ + PrintTextDisplay + QWidget +
PrintTextDisplay.h
+ 1 +
+ + MyTextEdit + QTextEdit +
MyTextEdit.h
+
+ + SceneEditOption + QWidget +
scene/SceneEditOption.h
+ 1 +
+ + SceneViewWidget + QWidget +
scene/sceneviewwidget.h
+ 1 +
+
+ + + + +
diff --git a/memdisplayandedit.ui b/memdisplayandedit.ui index 804785c..a565d12 100644 --- a/memdisplayandedit.ui +++ b/memdisplayandedit.ui @@ -1,430 +1,430 @@ - - - MemDisplayAndEdit - - - - 0 - 0 - 605 - 140 - - - - Qt::StrongFocus - - - Form - - - - - 10 - 0 - 597 - 131 - - - - - 6 - - - - - 0 - - - 1 - - - - - - 40 - 0 - - - - - - - - - - - 07 - - - - - - - 02 - - - - - - - - 40 - 0 - - - - - - - - - - - 06 - - - - - - - 0D - - - - - - - 09 - - - - - - - 03 - - - - - - - 01 - - - - - - - 04 - - - - - - - 0C - - - - - - - 0A - - - - - - - 0F - - - - - - - - 40 - 0 - - - - - - - - - - - 05 - - - - - - - 00 - - - - - - - 08 - - - - - - - 0B - - - - - - - - 40 - 0 - - - - - - - - - - - 0E - - - - - - - - 40 - 0 - - - - - - - - - - - - 40 - 0 - - - - - - - - - - - - - 3 - - - - - 3 - - - - - - 45 - 16777215 - - - - 基地址: - - - - - - - - 90 - 16777215 - - - - true - - - true - - - - 0x0000 - - - - - 0xb100 - - - - - 0xb200 - - - - - 0xa400 - - - - - 0xe000 - - - - - - - - - - 3 - - - - - - 70 - 16777215 - - - - 读空间 - - - - - - - - 70 - 16777215 - - - - 写空间 - - - - - - - - - 3 - - - - - - 50 - 16777215 - - - - - - - - - - - - 60 - 16777215 - - - - 进制转换 - - - - - - - - 50 - 16777215 - - - - - - - - - - - - - 3 - - - - - - 50 - 16777215 - - - - 编辑 - - - - - - - - 50 - 16777215 - - - - 上一页 - - - - - - - - 50 - 16777215 - - - - 下一页 - - - - - - - - - - - - - + + + MemDisplayAndEdit + + + + 0 + 0 + 605 + 140 + + + + Qt::StrongFocus + + + Form + + + + + 10 + 0 + 597 + 131 + + + + + 6 + + + + + 0 + + + 1 + + + + + + 40 + 0 + + + + + + + + + + + 07 + + + + + + + 02 + + + + + + + + 40 + 0 + + + + + + + + + + + 06 + + + + + + + 0D + + + + + + + 09 + + + + + + + 03 + + + + + + + 01 + + + + + + + 04 + + + + + + + 0C + + + + + + + 0A + + + + + + + 0F + + + + + + + + 40 + 0 + + + + + + + + + + + 05 + + + + + + + 00 + + + + + + + 08 + + + + + + + 0B + + + + + + + + 40 + 0 + + + + + + + + + + + 0E + + + + + + + + 40 + 0 + + + + + + + + + + + + 40 + 0 + + + + + + + + + + + + + 3 + + + + + 3 + + + + + + 45 + 16777215 + + + + 基地址: + + + + + + + + 90 + 16777215 + + + + true + + + true + + + + 0x0000 + + + + + 0xb100 + + + + + 0xb200 + + + + + 0xa400 + + + + + 0xe000 + + + + + + + + + + 3 + + + + + + 70 + 16777215 + + + + 读空间 + + + + + + + + 70 + 16777215 + + + + 写空间 + + + + + + + + + 3 + + + + + + 50 + 16777215 + + + + + + + + + + + + 60 + 16777215 + + + + 进制转换 + + + + + + + + 50 + 16777215 + + + + + + + + + + + + + 3 + + + + + + 50 + 16777215 + + + + 编辑 + + + + + + + + 50 + 16777215 + + + + 上一页 + + + + + + + + 50 + 16777215 + + + + 下一页 + + + + + + + + + + + + + diff --git a/modbus/demo.c b/modbus/demo.c index bae6fde..a8be9bb 100644 --- a/modbus/demo.c +++ b/modbus/demo.c @@ -1,284 +1,284 @@ -/* - * FreeModbus Libary: Linux Demo Application - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: demo.c,v 1.2 2006/10/12 08:12:06 wolti Exp $ - */ - -/* ----------------------- Standard includes --------------------------------*/ -#include -#include -#include -#include -#include -#include -#include - -#include "demo.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define PROG "freemodbus" - -#define REG_INPUT_START 1000 -#define REG_INPUT_NREGS 10 -#define REG_HOLDING_START 2000 -#define REG_HOLDING_NREGS 130 - -/* ----------------------- Static variables ---------------------------------*/ -static USHORT usRegInputStart = REG_INPUT_START; -USHORT* usRegInputBuf; -static USHORT usRegHoldingStart = REG_HOLDING_START; -USHORT* usRegHoldingBuf; - -static pthread_mutex_t xLock = PTHREAD_MUTEX_INITIALIZER; -static BOOL bDoExit; - -/* ----------------------- Static functions ---------------------------------*/ -static BOOL bCreatePollingThread( void ); -//static enum ThreadState eGetPollingThreadState( void ); -//static void vSetPollingThreadState( enum ThreadState eNewState ); -static void *pvPollingThread( void *pvParameter ); - -/* ----------------------- Start implementation -----------------------------*/ -BOOL -bSetSignal( int iSignalNr, void ( *pSigHandler ) ( int ) ) -{ - BOOL bResult; - struct sigaction xNewSig, xOldSig; - - xNewSig.sa_handler = pSigHandler; - sigemptyset( &xNewSig.sa_mask ); - xNewSig.sa_flags = 0; - if( sigaction( iSignalNr, &xNewSig, &xOldSig ) != 0 ) - { - bResult = FALSE; - } - else - { - bResult = TRUE; - } - return bResult; -} - -void -vSigShutdown( int xSigNr ) -{ - switch ( xSigNr ) - { - case SIGQUIT: - case SIGINT: - case SIGTERM: - vSetPollingThreadState( SHUTDOWN ); - bDoExit = TRUE; - } -} - -BOOL -active_modbus( USHORT* mPara, USHORT* mStatus, USHORT port_num) -{ - int iExitCode = EXIT_SUCCESS; -// CHAR cCh; - - const UCHAR ucSlaveID[] = { 0xAA, 0xBB, 0xCC }; - usRegHoldingBuf = mPara; - usRegInputBuf = mStatus; - if( !bSetSignal( SIGQUIT, vSigShutdown ) || - !bSetSignal( SIGINT, vSigShutdown ) || !bSetSignal( SIGTERM, vSigShutdown ) ) - { - fprintf( stderr, "%s: can't install signal handlers: %s!\n", PROG, strerror( errno ) ); - iExitCode = EXIT_FAILURE; - } - else if( eMBInit( MB_RTU, 0x0A, port_num, 38400, MB_PAR_EVEN ) != MB_ENOERR ) - { - fprintf( stderr, "%s: can't initialize modbus stack!\n", PROG ); - iExitCode = EXIT_FAILURE; - } - else if( eMBSetSlaveID( 0x34, TRUE, ucSlaveID, 3 ) != MB_ENOERR ) - { - fprintf( stderr, "%s: can't set slave id!\n", PROG ); - iExitCode = EXIT_FAILURE; - } - else - { - vSetPollingThreadState( STOPPED ); - - if( bCreatePollingThread( ) != TRUE ) - { - iExitCode = EXIT_FAILURE; - vMBPortLog( MB_LOG_DEBUG, "active_modbus", "Can't start protocol stack! Already running?\n"); - } - } - - return iExitCode; -} - -BOOL -bCreatePollingThread( void ) -{ - BOOL bResult; - pthread_t xThread; - - if( eGetPollingThreadState( ) == STOPPED ) - { - if( pthread_create( &xThread, NULL, pvPollingThread, NULL ) != 0 ) - { - bResult = FALSE; - } - else - { - bResult = TRUE; - } - } - else - { - bResult = FALSE; - } - - return bResult; -} - -void * -pvPollingThread( void *pvParameter ) -{ - vSetPollingThreadState( RUNNING ); - - if( eMBEnable( ) == MB_ENOERR ) - { - do - { -// vMBPortLog( MB_LOG_DEBUG, "usRegInputBuf[0]", "%d\n", usRegInputBuf[0]); - if( eMBPoll( ) != MB_ENOERR ) - break; -// usRegInputBuf[0] = ( USHORT ) rand( ); - } - while( eGetPollingThreadState( ) != SHUTDOWN ); - } - - ( void )eMBDisable( ); - - vSetPollingThreadState( STOPPED ); - - return 0; -} - -enum ThreadState -eGetPollingThreadState( ) -{ - enum ThreadState eCurState; - - ( void )pthread_mutex_lock( &xLock ); - eCurState = ePollThreadState; - ( void )pthread_mutex_unlock( &xLock ); - - return eCurState; -} - -void -vSetPollingThreadState( enum ThreadState eNewState ) -{ - ( void )pthread_mutex_lock( &xLock ); - ePollThreadState = eNewState; - ( void )pthread_mutex_unlock( &xLock ); -} - -eMBErrorCode -eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs ) -{ - eMBErrorCode eStatus = MB_ENOERR; - int iRegIndex; - - vMBPortLog( MB_LOG_DEBUG, "eMBRegInputCB", "exe\n"); - if( ( usAddress >= REG_INPUT_START ) - && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) - { - iRegIndex = ( int )( usAddress - usRegInputStart ); - while( usNRegs > 0 ) - { - *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] >> 8 ); - *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); - iRegIndex++; - usNRegs--; - } - } - else - { - eStatus = MB_ENOREG; - } - - return eStatus; -} - -void CallProcessCommands(int index); - -eMBErrorCode -eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) -{ - eMBErrorCode eStatus = MB_ENOERR; - int iRegIndex; - - vMBPortLog( MB_LOG_DEBUG, "eMBRegHoldingCB", "exe\n"); - if( ( usAddress >= REG_HOLDING_START ) && - ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) - { - iRegIndex = ( int )( usAddress - usRegHoldingStart ); - switch ( eMode ) - { - /* Pass current register values to the protocol stack. */ - case MB_REG_READ: - while( usNRegs > 0 ) - { - *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); - *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); - iRegIndex++; - usNRegs--; - } - break; - - /* Update current register values with new values from the - * protocol stack. */ - case MB_REG_WRITE: - while( usNRegs > 0 ) - { - usRegHoldingBuf[iRegIndex - 1] = *pucRegBuffer++ << 8; - usRegHoldingBuf[iRegIndex - 1] |= *pucRegBuffer++; - vMBPortLog( MB_LOG_DEBUG, "eMBRegHoldingCB", "usRegHoldingBuf[%d] %d\n",iRegIndex - 1, usRegHoldingBuf[iRegIndex - 1]); - CallProcessCommands(iRegIndex); - iRegIndex++; - usNRegs--; - - } - } - } - else - { - eStatus = MB_ENOREG; - } - return eStatus; -} - - -eMBErrorCode -eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) -{ - return MB_ENOREG; -} - -eMBErrorCode -eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) -{ - return MB_ENOREG; -} +/* + * FreeModbus Libary: Linux Demo Application + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: demo.c,v 1.2 2006/10/12 08:12:06 wolti Exp $ + */ + +/* ----------------------- Standard includes --------------------------------*/ +#include +#include +#include +#include +#include +#include +#include + +#include "demo.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define PROG "freemodbus" + +#define REG_INPUT_START 1000 +#define REG_INPUT_NREGS 10 +#define REG_HOLDING_START 2000 +#define REG_HOLDING_NREGS 130 + +/* ----------------------- Static variables ---------------------------------*/ +static USHORT usRegInputStart = REG_INPUT_START; +USHORT* usRegInputBuf; +static USHORT usRegHoldingStart = REG_HOLDING_START; +USHORT* usRegHoldingBuf; + +static pthread_mutex_t xLock = PTHREAD_MUTEX_INITIALIZER; +static BOOL bDoExit; + +/* ----------------------- Static functions ---------------------------------*/ +static BOOL bCreatePollingThread( void ); +//static enum ThreadState eGetPollingThreadState( void ); +//static void vSetPollingThreadState( enum ThreadState eNewState ); +static void *pvPollingThread( void *pvParameter ); + +/* ----------------------- Start implementation -----------------------------*/ +BOOL +bSetSignal( int iSignalNr, void ( *pSigHandler ) ( int ) ) +{ + BOOL bResult; + struct sigaction xNewSig, xOldSig; + + xNewSig.sa_handler = pSigHandler; + sigemptyset( &xNewSig.sa_mask ); + xNewSig.sa_flags = 0; + if( sigaction( iSignalNr, &xNewSig, &xOldSig ) != 0 ) + { + bResult = FALSE; + } + else + { + bResult = TRUE; + } + return bResult; +} + +void +vSigShutdown( int xSigNr ) +{ + switch ( xSigNr ) + { + case SIGQUIT: + case SIGINT: + case SIGTERM: + vSetPollingThreadState( SHUTDOWN ); + bDoExit = TRUE; + } +} + +BOOL +active_modbus( USHORT* mPara, USHORT* mStatus, USHORT port_num) +{ + int iExitCode = EXIT_SUCCESS; +// CHAR cCh; + + const UCHAR ucSlaveID[] = { 0xAA, 0xBB, 0xCC }; + usRegHoldingBuf = mPara; + usRegInputBuf = mStatus; + if( !bSetSignal( SIGQUIT, vSigShutdown ) || + !bSetSignal( SIGINT, vSigShutdown ) || !bSetSignal( SIGTERM, vSigShutdown ) ) + { + fprintf( stderr, "%s: can't install signal handlers: %s!\n", PROG, strerror( errno ) ); + iExitCode = EXIT_FAILURE; + } + else if( eMBInit( MB_RTU, 0x0A, port_num, 38400, MB_PAR_EVEN ) != MB_ENOERR ) + { + fprintf( stderr, "%s: can't initialize modbus stack!\n", PROG ); + iExitCode = EXIT_FAILURE; + } + else if( eMBSetSlaveID( 0x34, TRUE, ucSlaveID, 3 ) != MB_ENOERR ) + { + fprintf( stderr, "%s: can't set slave id!\n", PROG ); + iExitCode = EXIT_FAILURE; + } + else + { + vSetPollingThreadState( STOPPED ); + + if( bCreatePollingThread( ) != TRUE ) + { + iExitCode = EXIT_FAILURE; + vMBPortLog( MB_LOG_DEBUG, "active_modbus", "Can't start protocol stack! Already running?\n"); + } + } + + return iExitCode; +} + +BOOL +bCreatePollingThread( void ) +{ + BOOL bResult; + pthread_t xThread; + + if( eGetPollingThreadState( ) == STOPPED ) + { + if( pthread_create( &xThread, NULL, pvPollingThread, NULL ) != 0 ) + { + bResult = FALSE; + } + else + { + bResult = TRUE; + } + } + else + { + bResult = FALSE; + } + + return bResult; +} + +void * +pvPollingThread( void *pvParameter ) +{ + vSetPollingThreadState( RUNNING ); + + if( eMBEnable( ) == MB_ENOERR ) + { + do + { +// vMBPortLog( MB_LOG_DEBUG, "usRegInputBuf[0]", "%d\n", usRegInputBuf[0]); + if( eMBPoll( ) != MB_ENOERR ) + break; +// usRegInputBuf[0] = ( USHORT ) rand( ); + } + while( eGetPollingThreadState( ) != SHUTDOWN ); + } + + ( void )eMBDisable( ); + + vSetPollingThreadState( STOPPED ); + + return 0; +} + +enum ThreadState +eGetPollingThreadState( ) +{ + enum ThreadState eCurState; + + ( void )pthread_mutex_lock( &xLock ); + eCurState = ePollThreadState; + ( void )pthread_mutex_unlock( &xLock ); + + return eCurState; +} + +void +vSetPollingThreadState( enum ThreadState eNewState ) +{ + ( void )pthread_mutex_lock( &xLock ); + ePollThreadState = eNewState; + ( void )pthread_mutex_unlock( &xLock ); +} + +eMBErrorCode +eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs ) +{ + eMBErrorCode eStatus = MB_ENOERR; + int iRegIndex; + + vMBPortLog( MB_LOG_DEBUG, "eMBRegInputCB", "exe\n"); + if( ( usAddress >= REG_INPUT_START ) + && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) + { + iRegIndex = ( int )( usAddress - usRegInputStart ); + while( usNRegs > 0 ) + { + *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] >> 8 ); + *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); + iRegIndex++; + usNRegs--; + } + } + else + { + eStatus = MB_ENOREG; + } + + return eStatus; +} + +void CallProcessCommands(int index); + +eMBErrorCode +eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) +{ + eMBErrorCode eStatus = MB_ENOERR; + int iRegIndex; + + vMBPortLog( MB_LOG_DEBUG, "eMBRegHoldingCB", "exe\n"); + if( ( usAddress >= REG_HOLDING_START ) && + ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) + { + iRegIndex = ( int )( usAddress - usRegHoldingStart ); + switch ( eMode ) + { + /* Pass current register values to the protocol stack. */ + case MB_REG_READ: + while( usNRegs > 0 ) + { + *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); + *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); + iRegIndex++; + usNRegs--; + } + break; + + /* Update current register values with new values from the + * protocol stack. */ + case MB_REG_WRITE: + while( usNRegs > 0 ) + { + usRegHoldingBuf[iRegIndex - 1] = *pucRegBuffer++ << 8; + usRegHoldingBuf[iRegIndex - 1] |= *pucRegBuffer++; + vMBPortLog( MB_LOG_DEBUG, "eMBRegHoldingCB", "usRegHoldingBuf[%d] %d\n",iRegIndex - 1, usRegHoldingBuf[iRegIndex - 1]); + CallProcessCommands(iRegIndex); + iRegIndex++; + usNRegs--; + + } + } + } + else + { + eStatus = MB_ENOREG; + } + return eStatus; +} + + +eMBErrorCode +eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) +{ + return MB_ENOREG; +} + +eMBErrorCode +eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) +{ + return MB_ENOREG; +} diff --git a/modbus/demo.h b/modbus/demo.h index 87edf02..4769d7f 100644 --- a/modbus/demo.h +++ b/modbus/demo.h @@ -1,27 +1,27 @@ -#ifndef _DEMO_H -#define _DEMO_H - - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -static enum ThreadState -{ - STOPPED, - RUNNING, - SHUTDOWN -} ePollThreadState; - -BOOL active_modbus( USHORT* mPara, USHORT* mStatus,USHORT port_num); -void vSetPollingThreadState( enum ThreadState eNewState ); -enum ThreadState eGetPollingThreadState( void ); -#ifdef __cplusplus -PR_END_EXTERN_C -#endif - -#endif +#ifndef _DEMO_H +#define _DEMO_H + + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +static enum ThreadState +{ + STOPPED, + RUNNING, + SHUTDOWN +} ePollThreadState; + +BOOL active_modbus( USHORT* mPara, USHORT* mStatus,USHORT port_num); +void vSetPollingThreadState( enum ThreadState eNewState ); +enum ThreadState eGetPollingThreadState( void ); +#ifdef __cplusplus +PR_END_EXTERN_C +#endif + +#endif diff --git a/modbus/modbus/ascii/mbascii.c b/modbus/modbus/ascii/mbascii.c index c513457..7293c34 100644 --- a/modbus/modbus/ascii/mbascii.c +++ b/modbus/modbus/ascii/mbascii.c @@ -1,486 +1,486 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbascii.c,v 1.17 2010/06/06 13:47:07 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbconfig.h" -#include "mbascii.h" -#include "mbframe.h" - -#include "mbcrc.h" -#include "mbport.h" - -#if MB_ASCII_ENABLED > 0 - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_ASCII_DEFAULT_CR '\r' /*!< Default CR character for Modbus ASCII. */ -#define MB_ASCII_DEFAULT_LF '\n' /*!< Default LF character for Modbus ASCII. */ -#define MB_SER_PDU_SIZE_MIN 3 /*!< Minimum size of a Modbus ASCII frame. */ -#define MB_SER_PDU_SIZE_MAX 256 /*!< Maximum size of a Modbus ASCII frame. */ -#define MB_SER_PDU_SIZE_LRC 1 /*!< Size of LRC field in PDU. */ -#define MB_SER_PDU_ADDR_OFF 0 /*!< Offset of slave address in Ser-PDU. */ -#define MB_SER_PDU_PDU_OFF 1 /*!< Offset of Modbus-PDU in Ser-PDU. */ - -/* ----------------------- Type definitions ---------------------------------*/ -typedef enum -{ - STATE_RX_IDLE, /*!< Receiver is in idle state. */ - STATE_RX_RCV, /*!< Frame is beeing received. */ - STATE_RX_WAIT_EOF /*!< Wait for End of Frame. */ -} eMBRcvState; - -typedef enum -{ - STATE_TX_IDLE, /*!< Transmitter is in idle state. */ - STATE_TX_START, /*!< Starting transmission (':' sent). */ - STATE_TX_DATA, /*!< Sending of data (Address, Data, LRC). */ - STATE_TX_END, /*!< End of transmission. */ - STATE_TX_NOTIFY /*!< Notify sender that the frame has been sent. */ -} eMBSndState; - -typedef enum -{ - BYTE_HIGH_NIBBLE, /*!< Character for high nibble of byte. */ - BYTE_LOW_NIBBLE /*!< Character for low nibble of byte. */ -} eMBBytePos; - -/* ----------------------- Static functions ---------------------------------*/ -static UCHAR prvucMBCHAR2BIN( UCHAR ucCharacter ); - -static UCHAR prvucMBBIN2CHAR( UCHAR ucByte ); - -static UCHAR prvucMBLRC( UCHAR * pucFrame, USHORT usLen ); - -/* ----------------------- Static variables ---------------------------------*/ -static volatile eMBSndState eSndState; -static volatile eMBRcvState eRcvState; - -/* We reuse the Modbus RTU buffer because only one buffer is needed and the - * RTU buffer is bigger. */ -extern volatile UCHAR ucRTUBuf[]; -static volatile UCHAR *ucASCIIBuf = ucRTUBuf; - -static volatile USHORT usRcvBufferPos; -static volatile eMBBytePos eBytePos; - -static volatile UCHAR *pucSndBufferCur; -static volatile USHORT usSndBufferCount; - -static volatile UCHAR ucLRC; -static volatile UCHAR ucMBLFCharacter; - -/* ----------------------- Start implementation -----------------------------*/ -eMBErrorCode -eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) -{ - eMBErrorCode eStatus = MB_ENOERR; - ( void )ucSlaveAddress; - - ENTER_CRITICAL_SECTION( ); - ucMBLFCharacter = MB_ASCII_DEFAULT_LF; - - if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE ) - { - eStatus = MB_EPORTERR; - } - else if( xMBPortTimersInit( MB_ASCII_TIMEOUT_SEC * 20000UL ) != TRUE ) - { - eStatus = MB_EPORTERR; - } - - EXIT_CRITICAL_SECTION( ); - - return eStatus; -} - -void -eMBASCIIStart( void ) -{ - ENTER_CRITICAL_SECTION( ); - vMBPortSerialEnable( TRUE, FALSE ); - eRcvState = STATE_RX_IDLE; - EXIT_CRITICAL_SECTION( ); - - /* No special startup required for ASCII. */ - ( void )xMBPortEventPost( EV_READY ); -} - -void -eMBASCIIStop( void ) -{ - ENTER_CRITICAL_SECTION( ); - vMBPortSerialEnable( FALSE, FALSE ); - vMBPortTimersDisable( ); - EXIT_CRITICAL_SECTION( ); -} - -eMBErrorCode -eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - ENTER_CRITICAL_SECTION( ); - assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); - - /* Length and CRC check */ - if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) - && ( prvucMBLRC( ( UCHAR * ) ucASCIIBuf, usRcvBufferPos ) == 0 ) ) - { - /* Save the address field. All frames are passed to the upper layed - * and the decision if a frame is used is done there. - */ - *pucRcvAddress = ucASCIIBuf[MB_SER_PDU_ADDR_OFF]; - - /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus - * size of address field and CRC checksum. - */ - *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_LRC ); - - /* Return the start of the Modbus PDU to the caller. */ - *pucFrame = ( UCHAR * ) & ucASCIIBuf[MB_SER_PDU_PDU_OFF]; - } - else - { - eStatus = MB_EIO; - } - EXIT_CRITICAL_SECTION( ); - return eStatus; -} - -eMBErrorCode -eMBASCIISend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength ) -{ - eMBErrorCode eStatus = MB_ENOERR; - UCHAR usLRC; - - ENTER_CRITICAL_SECTION( ); - /* Check if the receiver is still in idle state. If not we where too - * slow with processing the received frame and the master sent another - * frame on the network. We have to abort sending the frame. - */ - if( eRcvState == STATE_RX_IDLE ) - { - /* First byte before the Modbus-PDU is the slave address. */ - pucSndBufferCur = ( UCHAR * ) pucFrame - 1; - usSndBufferCount = 1; - - /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */ - pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress; - usSndBufferCount += usLength; - - /* Calculate LRC checksum for Modbus-Serial-Line-PDU. */ - usLRC = prvucMBLRC( ( UCHAR * ) pucSndBufferCur, usSndBufferCount ); - ucASCIIBuf[usSndBufferCount++] = usLRC; - - /* Activate the transmitter. */ - eSndState = STATE_TX_START; - vMBPortSerialEnable( FALSE, TRUE ); - } - else - { - eStatus = MB_EIO; - } - EXIT_CRITICAL_SECTION( ); - return eStatus; -} - -BOOL -xMBASCIIReceiveFSM( void ) -{ - BOOL xNeedPoll = FALSE; - UCHAR ucByte; - UCHAR ucResult; - - assert( eSndState == STATE_TX_IDLE ); - - ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte ); - switch ( eRcvState ) - { - /* A new character is received. If the character is a ':' the input - * buffer is cleared. A CR-character signals the end of the data - * block. Other characters are part of the data block and their - * ASCII value is converted back to a binary representation. - */ - case STATE_RX_RCV: - /* Enable timer for character timeout. */ - vMBPortTimersEnable( ); - if( ucByte == ':' ) - { - /* Empty receive buffer. */ - eBytePos = BYTE_HIGH_NIBBLE; - usRcvBufferPos = 0; - } - else if( ucByte == MB_ASCII_DEFAULT_CR ) - { - eRcvState = STATE_RX_WAIT_EOF; - } - else - { - ucResult = prvucMBCHAR2BIN( ucByte ); - switch ( eBytePos ) - { - /* High nibble of the byte comes first. We check for - * a buffer overflow here. */ - case BYTE_HIGH_NIBBLE: - if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ) - { - ucASCIIBuf[usRcvBufferPos] = ( UCHAR )( ucResult << 4 ); - eBytePos = BYTE_LOW_NIBBLE; - break; - } - else - { - /* not handled in Modbus specification but seems - * a resonable implementation. */ - eRcvState = STATE_RX_IDLE; - /* Disable previously activated timer because of error state. */ - vMBPortTimersDisable( ); - } - break; - - case BYTE_LOW_NIBBLE: - ucASCIIBuf[usRcvBufferPos] |= ucResult; - usRcvBufferPos++; - eBytePos = BYTE_HIGH_NIBBLE; - break; - } - } - break; - - case STATE_RX_WAIT_EOF: - if( ucByte == ucMBLFCharacter ) - { - /* Disable character timeout timer because all characters are - * received. */ - vMBPortTimersDisable( ); - /* Receiver is again in idle state. */ - eRcvState = STATE_RX_IDLE; - - /* Notify the caller of eMBASCIIReceive that a new frame - * was received. */ - xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED ); - } - else if( ucByte == ':' ) - { - /* Empty receive buffer and back to receive state. */ - eBytePos = BYTE_HIGH_NIBBLE; - usRcvBufferPos = 0; - eRcvState = STATE_RX_RCV; - - /* Enable timer for character timeout. */ - vMBPortTimersEnable( ); - } - else - { - /* Frame is not okay. Delete entire frame. */ - eRcvState = STATE_RX_IDLE; - } - break; - - case STATE_RX_IDLE: - if( ucByte == ':' ) - { - /* Enable timer for character timeout. */ - vMBPortTimersEnable( ); - /* Reset the input buffers to store the frame. */ - usRcvBufferPos = 0;; - eBytePos = BYTE_HIGH_NIBBLE; - eRcvState = STATE_RX_RCV; - } - break; - } - - return xNeedPoll; -} - -BOOL -xMBASCIITransmitFSM( void ) -{ - BOOL xNeedPoll = FALSE; - UCHAR ucByte; - - assert( eRcvState == STATE_RX_IDLE ); - switch ( eSndState ) - { - /* Start of transmission. The start of a frame is defined by sending - * the character ':'. */ - case STATE_TX_START: - ucByte = ':'; - xMBPortSerialPutByte( ( CHAR )ucByte ); - eSndState = STATE_TX_DATA; - eBytePos = BYTE_HIGH_NIBBLE; - break; - - /* Send the data block. Each data byte is encoded as a character hex - * stream with the high nibble sent first and the low nibble sent - * last. If all data bytes are exhausted we send a '\r' character - * to end the transmission. */ - case STATE_TX_DATA: - if( usSndBufferCount > 0 ) - { - switch ( eBytePos ) - { - case BYTE_HIGH_NIBBLE: - ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur >> 4 ) ); - xMBPortSerialPutByte( ( CHAR ) ucByte ); - eBytePos = BYTE_LOW_NIBBLE; - break; - - case BYTE_LOW_NIBBLE: - ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur & 0x0F ) ); - xMBPortSerialPutByte( ( CHAR )ucByte ); - pucSndBufferCur++; - eBytePos = BYTE_HIGH_NIBBLE; - usSndBufferCount--; - break; - } - } - else - { - xMBPortSerialPutByte( MB_ASCII_DEFAULT_CR ); - eSndState = STATE_TX_END; - } - break; - - /* Finish the frame by sending a LF character. */ - case STATE_TX_END: - xMBPortSerialPutByte( ( CHAR )ucMBLFCharacter ); - /* We need another state to make sure that the CR character has - * been sent. */ - eSndState = STATE_TX_NOTIFY; - break; - - /* Notify the task which called eMBASCIISend that the frame has - * been sent. */ - case STATE_TX_NOTIFY: - eSndState = STATE_TX_IDLE; - xNeedPoll = xMBPortEventPost( EV_FRAME_SENT ); - - /* Disable transmitter. This prevents another transmit buffer - * empty interrupt. */ - vMBPortSerialEnable( TRUE, FALSE ); - eSndState = STATE_TX_IDLE; - break; - - /* We should not get a transmitter event if the transmitter is in - * idle state. */ - case STATE_TX_IDLE: - /* enable receiver/disable transmitter. */ - vMBPortSerialEnable( TRUE, FALSE ); - break; - } - - return xNeedPoll; -} - -BOOL -xMBASCIITimerT1SExpired( void ) -{ - switch ( eRcvState ) - { - /* If we have a timeout we go back to the idle state and wait for - * the next frame. - */ - case STATE_RX_RCV: - case STATE_RX_WAIT_EOF: - eRcvState = STATE_RX_IDLE; - break; - - default: - assert( ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_WAIT_EOF ) ); - break; - } - vMBPortTimersDisable( ); - - /* no context switch required. */ - return FALSE; -} - - -static UCHAR -prvucMBCHAR2BIN( UCHAR ucCharacter ) -{ - if( ( ucCharacter >= '0' ) && ( ucCharacter <= '9' ) ) - { - return ( UCHAR )( ucCharacter - '0' ); - } - else if( ( ucCharacter >= 'A' ) && ( ucCharacter <= 'F' ) ) - { - return ( UCHAR )( ucCharacter - 'A' + 0x0A ); - } - else - { - return 0xFF; - } -} - -static UCHAR -prvucMBBIN2CHAR( UCHAR ucByte ) -{ - if( ucByte <= 0x09 ) - { - return ( UCHAR )( '0' + ucByte ); - } - else if( ( ucByte >= 0x0A ) && ( ucByte <= 0x0F ) ) - { - return ( UCHAR )( ucByte - 0x0A + 'A' ); - } - else - { - /* Programming error. */ - assert( 0 ); - } - return '0'; -} - - -static UCHAR -prvucMBLRC( UCHAR * pucFrame, USHORT usLen ) -{ - UCHAR ucLRC = 0; /* LRC char initialized */ - - while( usLen-- ) - { - ucLRC += *pucFrame++; /* Add buffer byte without carry */ - } - - /* Return twos complement */ - ucLRC = ( UCHAR ) ( -( ( CHAR ) ucLRC ) ); - return ucLRC; -} - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbascii.c,v 1.17 2010/06/06 13:47:07 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbconfig.h" +#include "mbascii.h" +#include "mbframe.h" + +#include "mbcrc.h" +#include "mbport.h" + +#if MB_ASCII_ENABLED > 0 + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_ASCII_DEFAULT_CR '\r' /*!< Default CR character for Modbus ASCII. */ +#define MB_ASCII_DEFAULT_LF '\n' /*!< Default LF character for Modbus ASCII. */ +#define MB_SER_PDU_SIZE_MIN 3 /*!< Minimum size of a Modbus ASCII frame. */ +#define MB_SER_PDU_SIZE_MAX 256 /*!< Maximum size of a Modbus ASCII frame. */ +#define MB_SER_PDU_SIZE_LRC 1 /*!< Size of LRC field in PDU. */ +#define MB_SER_PDU_ADDR_OFF 0 /*!< Offset of slave address in Ser-PDU. */ +#define MB_SER_PDU_PDU_OFF 1 /*!< Offset of Modbus-PDU in Ser-PDU. */ + +/* ----------------------- Type definitions ---------------------------------*/ +typedef enum +{ + STATE_RX_IDLE, /*!< Receiver is in idle state. */ + STATE_RX_RCV, /*!< Frame is beeing received. */ + STATE_RX_WAIT_EOF /*!< Wait for End of Frame. */ +} eMBRcvState; + +typedef enum +{ + STATE_TX_IDLE, /*!< Transmitter is in idle state. */ + STATE_TX_START, /*!< Starting transmission (':' sent). */ + STATE_TX_DATA, /*!< Sending of data (Address, Data, LRC). */ + STATE_TX_END, /*!< End of transmission. */ + STATE_TX_NOTIFY /*!< Notify sender that the frame has been sent. */ +} eMBSndState; + +typedef enum +{ + BYTE_HIGH_NIBBLE, /*!< Character for high nibble of byte. */ + BYTE_LOW_NIBBLE /*!< Character for low nibble of byte. */ +} eMBBytePos; + +/* ----------------------- Static functions ---------------------------------*/ +static UCHAR prvucMBCHAR2BIN( UCHAR ucCharacter ); + +static UCHAR prvucMBBIN2CHAR( UCHAR ucByte ); + +static UCHAR prvucMBLRC( UCHAR * pucFrame, USHORT usLen ); + +/* ----------------------- Static variables ---------------------------------*/ +static volatile eMBSndState eSndState; +static volatile eMBRcvState eRcvState; + +/* We reuse the Modbus RTU buffer because only one buffer is needed and the + * RTU buffer is bigger. */ +extern volatile UCHAR ucRTUBuf[]; +static volatile UCHAR *ucASCIIBuf = ucRTUBuf; + +static volatile USHORT usRcvBufferPos; +static volatile eMBBytePos eBytePos; + +static volatile UCHAR *pucSndBufferCur; +static volatile USHORT usSndBufferCount; + +static volatile UCHAR ucLRC; +static volatile UCHAR ucMBLFCharacter; + +/* ----------------------- Start implementation -----------------------------*/ +eMBErrorCode +eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) +{ + eMBErrorCode eStatus = MB_ENOERR; + ( void )ucSlaveAddress; + + ENTER_CRITICAL_SECTION( ); + ucMBLFCharacter = MB_ASCII_DEFAULT_LF; + + if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE ) + { + eStatus = MB_EPORTERR; + } + else if( xMBPortTimersInit( MB_ASCII_TIMEOUT_SEC * 20000UL ) != TRUE ) + { + eStatus = MB_EPORTERR; + } + + EXIT_CRITICAL_SECTION( ); + + return eStatus; +} + +void +eMBASCIIStart( void ) +{ + ENTER_CRITICAL_SECTION( ); + vMBPortSerialEnable( TRUE, FALSE ); + eRcvState = STATE_RX_IDLE; + EXIT_CRITICAL_SECTION( ); + + /* No special startup required for ASCII. */ + ( void )xMBPortEventPost( EV_READY ); +} + +void +eMBASCIIStop( void ) +{ + ENTER_CRITICAL_SECTION( ); + vMBPortSerialEnable( FALSE, FALSE ); + vMBPortTimersDisable( ); + EXIT_CRITICAL_SECTION( ); +} + +eMBErrorCode +eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + ENTER_CRITICAL_SECTION( ); + assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); + + /* Length and CRC check */ + if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) + && ( prvucMBLRC( ( UCHAR * ) ucASCIIBuf, usRcvBufferPos ) == 0 ) ) + { + /* Save the address field. All frames are passed to the upper layed + * and the decision if a frame is used is done there. + */ + *pucRcvAddress = ucASCIIBuf[MB_SER_PDU_ADDR_OFF]; + + /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus + * size of address field and CRC checksum. + */ + *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_LRC ); + + /* Return the start of the Modbus PDU to the caller. */ + *pucFrame = ( UCHAR * ) & ucASCIIBuf[MB_SER_PDU_PDU_OFF]; + } + else + { + eStatus = MB_EIO; + } + EXIT_CRITICAL_SECTION( ); + return eStatus; +} + +eMBErrorCode +eMBASCIISend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength ) +{ + eMBErrorCode eStatus = MB_ENOERR; + UCHAR usLRC; + + ENTER_CRITICAL_SECTION( ); + /* Check if the receiver is still in idle state. If not we where too + * slow with processing the received frame and the master sent another + * frame on the network. We have to abort sending the frame. + */ + if( eRcvState == STATE_RX_IDLE ) + { + /* First byte before the Modbus-PDU is the slave address. */ + pucSndBufferCur = ( UCHAR * ) pucFrame - 1; + usSndBufferCount = 1; + + /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */ + pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress; + usSndBufferCount += usLength; + + /* Calculate LRC checksum for Modbus-Serial-Line-PDU. */ + usLRC = prvucMBLRC( ( UCHAR * ) pucSndBufferCur, usSndBufferCount ); + ucASCIIBuf[usSndBufferCount++] = usLRC; + + /* Activate the transmitter. */ + eSndState = STATE_TX_START; + vMBPortSerialEnable( FALSE, TRUE ); + } + else + { + eStatus = MB_EIO; + } + EXIT_CRITICAL_SECTION( ); + return eStatus; +} + +BOOL +xMBASCIIReceiveFSM( void ) +{ + BOOL xNeedPoll = FALSE; + UCHAR ucByte; + UCHAR ucResult; + + assert( eSndState == STATE_TX_IDLE ); + + ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte ); + switch ( eRcvState ) + { + /* A new character is received. If the character is a ':' the input + * buffer is cleared. A CR-character signals the end of the data + * block. Other characters are part of the data block and their + * ASCII value is converted back to a binary representation. + */ + case STATE_RX_RCV: + /* Enable timer for character timeout. */ + vMBPortTimersEnable( ); + if( ucByte == ':' ) + { + /* Empty receive buffer. */ + eBytePos = BYTE_HIGH_NIBBLE; + usRcvBufferPos = 0; + } + else if( ucByte == MB_ASCII_DEFAULT_CR ) + { + eRcvState = STATE_RX_WAIT_EOF; + } + else + { + ucResult = prvucMBCHAR2BIN( ucByte ); + switch ( eBytePos ) + { + /* High nibble of the byte comes first. We check for + * a buffer overflow here. */ + case BYTE_HIGH_NIBBLE: + if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ) + { + ucASCIIBuf[usRcvBufferPos] = ( UCHAR )( ucResult << 4 ); + eBytePos = BYTE_LOW_NIBBLE; + break; + } + else + { + /* not handled in Modbus specification but seems + * a resonable implementation. */ + eRcvState = STATE_RX_IDLE; + /* Disable previously activated timer because of error state. */ + vMBPortTimersDisable( ); + } + break; + + case BYTE_LOW_NIBBLE: + ucASCIIBuf[usRcvBufferPos] |= ucResult; + usRcvBufferPos++; + eBytePos = BYTE_HIGH_NIBBLE; + break; + } + } + break; + + case STATE_RX_WAIT_EOF: + if( ucByte == ucMBLFCharacter ) + { + /* Disable character timeout timer because all characters are + * received. */ + vMBPortTimersDisable( ); + /* Receiver is again in idle state. */ + eRcvState = STATE_RX_IDLE; + + /* Notify the caller of eMBASCIIReceive that a new frame + * was received. */ + xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED ); + } + else if( ucByte == ':' ) + { + /* Empty receive buffer and back to receive state. */ + eBytePos = BYTE_HIGH_NIBBLE; + usRcvBufferPos = 0; + eRcvState = STATE_RX_RCV; + + /* Enable timer for character timeout. */ + vMBPortTimersEnable( ); + } + else + { + /* Frame is not okay. Delete entire frame. */ + eRcvState = STATE_RX_IDLE; + } + break; + + case STATE_RX_IDLE: + if( ucByte == ':' ) + { + /* Enable timer for character timeout. */ + vMBPortTimersEnable( ); + /* Reset the input buffers to store the frame. */ + usRcvBufferPos = 0;; + eBytePos = BYTE_HIGH_NIBBLE; + eRcvState = STATE_RX_RCV; + } + break; + } + + return xNeedPoll; +} + +BOOL +xMBASCIITransmitFSM( void ) +{ + BOOL xNeedPoll = FALSE; + UCHAR ucByte; + + assert( eRcvState == STATE_RX_IDLE ); + switch ( eSndState ) + { + /* Start of transmission. The start of a frame is defined by sending + * the character ':'. */ + case STATE_TX_START: + ucByte = ':'; + xMBPortSerialPutByte( ( CHAR )ucByte ); + eSndState = STATE_TX_DATA; + eBytePos = BYTE_HIGH_NIBBLE; + break; + + /* Send the data block. Each data byte is encoded as a character hex + * stream with the high nibble sent first and the low nibble sent + * last. If all data bytes are exhausted we send a '\r' character + * to end the transmission. */ + case STATE_TX_DATA: + if( usSndBufferCount > 0 ) + { + switch ( eBytePos ) + { + case BYTE_HIGH_NIBBLE: + ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur >> 4 ) ); + xMBPortSerialPutByte( ( CHAR ) ucByte ); + eBytePos = BYTE_LOW_NIBBLE; + break; + + case BYTE_LOW_NIBBLE: + ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur & 0x0F ) ); + xMBPortSerialPutByte( ( CHAR )ucByte ); + pucSndBufferCur++; + eBytePos = BYTE_HIGH_NIBBLE; + usSndBufferCount--; + break; + } + } + else + { + xMBPortSerialPutByte( MB_ASCII_DEFAULT_CR ); + eSndState = STATE_TX_END; + } + break; + + /* Finish the frame by sending a LF character. */ + case STATE_TX_END: + xMBPortSerialPutByte( ( CHAR )ucMBLFCharacter ); + /* We need another state to make sure that the CR character has + * been sent. */ + eSndState = STATE_TX_NOTIFY; + break; + + /* Notify the task which called eMBASCIISend that the frame has + * been sent. */ + case STATE_TX_NOTIFY: + eSndState = STATE_TX_IDLE; + xNeedPoll = xMBPortEventPost( EV_FRAME_SENT ); + + /* Disable transmitter. This prevents another transmit buffer + * empty interrupt. */ + vMBPortSerialEnable( TRUE, FALSE ); + eSndState = STATE_TX_IDLE; + break; + + /* We should not get a transmitter event if the transmitter is in + * idle state. */ + case STATE_TX_IDLE: + /* enable receiver/disable transmitter. */ + vMBPortSerialEnable( TRUE, FALSE ); + break; + } + + return xNeedPoll; +} + +BOOL +xMBASCIITimerT1SExpired( void ) +{ + switch ( eRcvState ) + { + /* If we have a timeout we go back to the idle state and wait for + * the next frame. + */ + case STATE_RX_RCV: + case STATE_RX_WAIT_EOF: + eRcvState = STATE_RX_IDLE; + break; + + default: + assert( ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_WAIT_EOF ) ); + break; + } + vMBPortTimersDisable( ); + + /* no context switch required. */ + return FALSE; +} + + +static UCHAR +prvucMBCHAR2BIN( UCHAR ucCharacter ) +{ + if( ( ucCharacter >= '0' ) && ( ucCharacter <= '9' ) ) + { + return ( UCHAR )( ucCharacter - '0' ); + } + else if( ( ucCharacter >= 'A' ) && ( ucCharacter <= 'F' ) ) + { + return ( UCHAR )( ucCharacter - 'A' + 0x0A ); + } + else + { + return 0xFF; + } +} + +static UCHAR +prvucMBBIN2CHAR( UCHAR ucByte ) +{ + if( ucByte <= 0x09 ) + { + return ( UCHAR )( '0' + ucByte ); + } + else if( ( ucByte >= 0x0A ) && ( ucByte <= 0x0F ) ) + { + return ( UCHAR )( ucByte - 0x0A + 'A' ); + } + else + { + /* Programming error. */ + assert( 0 ); + } + return '0'; +} + + +static UCHAR +prvucMBLRC( UCHAR * pucFrame, USHORT usLen ) +{ + UCHAR ucLRC = 0; /* LRC char initialized */ + + while( usLen-- ) + { + ucLRC += *pucFrame++; /* Add buffer byte without carry */ + } + + /* Return twos complement */ + ucLRC = ( UCHAR ) ( -( ( CHAR ) ucLRC ) ); + return ucLRC; +} + +#endif diff --git a/modbus/modbus/ascii/mbascii.h b/modbus/modbus/ascii/mbascii.h index 47846dd..d2500f7 100644 --- a/modbus/modbus/ascii/mbascii.h +++ b/modbus/modbus/ascii/mbascii.h @@ -1,56 +1,56 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbascii.h,v 1.8 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_ASCII_H -#define _MB_ASCII_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -#if MB_ASCII_ENABLED > 0 -eMBErrorCode eMBASCIIInit( UCHAR slaveAddress, UCHAR ucPort, - ULONG ulBaudRate, eMBParity eParity ); -void eMBASCIIStart( void ); -void eMBASCIIStop( void ); - -eMBErrorCode eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, - USHORT * pusLength ); -eMBErrorCode eMBASCIISend( UCHAR slaveAddress, const UCHAR * pucFrame, - USHORT usLength ); -BOOL xMBASCIIReceiveFSM( void ); -BOOL xMBASCIITransmitFSM( void ); -BOOL xMBASCIITimerT1SExpired( void ); -#endif - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbascii.h,v 1.8 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_ASCII_H +#define _MB_ASCII_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +#if MB_ASCII_ENABLED > 0 +eMBErrorCode eMBASCIIInit( UCHAR slaveAddress, UCHAR ucPort, + ULONG ulBaudRate, eMBParity eParity ); +void eMBASCIIStart( void ); +void eMBASCIIStop( void ); + +eMBErrorCode eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, + USHORT * pusLength ); +eMBErrorCode eMBASCIISend( UCHAR slaveAddress, const UCHAR * pucFrame, + USHORT usLength ); +BOOL xMBASCIIReceiveFSM( void ); +BOOL xMBASCIITransmitFSM( void ); +BOOL xMBASCIITimerT1SExpired( void ); +#endif + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/functions/mbfunccoils.c b/modbus/modbus/functions/mbfunccoils.c index 1988c45..45ea860 100644 --- a/modbus/modbus/functions/mbfunccoils.c +++ b/modbus/modbus/functions/mbfunccoils.c @@ -1,270 +1,270 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfunccoils.c,v 1.8 2007/02/18 23:47:16 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbconfig.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) -#define MB_PDU_FUNC_READ_COILCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_READ_SIZE ( 4 ) -#define MB_PDU_FUNC_READ_COILCNT_MAX ( 0x07D0 ) - -#define MB_PDU_FUNC_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF ) -#define MB_PDU_FUNC_WRITE_VALUE_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_WRITE_SIZE ( 4 ) - -#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF ( MB_PDU_DATA_OFF ) -#define MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF ( MB_PDU_DATA_OFF + 4 ) -#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF ( MB_PDU_DATA_OFF + 5 ) -#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN ( 5 ) -#define MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX ( 0x07B0 ) - -/* ----------------------- Static functions ---------------------------------*/ -eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); - -/* ----------------------- Start implementation -----------------------------*/ - -#if MB_FUNC_READ_COILS_ENABLED > 0 - -eMBException -eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usCoilCount; - UCHAR ucNBytes; - UCHAR *pucFrameCur; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); - usRegAddress++; - - usCoilCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF] << 8 ); - usCoilCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF + 1] ); - - /* Check if the number of registers to read is valid. If not - * return Modbus illegal data value exception. - */ - if( ( usCoilCount >= 1 ) && - ( usCoilCount < MB_PDU_FUNC_READ_COILCNT_MAX ) ) - { - /* Set the current PDU data pointer to the beginning. */ - pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; - *usLen = MB_PDU_FUNC_OFF; - - /* First byte contains the function code. */ - *pucFrameCur++ = MB_FUNC_READ_COILS; - *usLen += 1; - - /* Test if the quantity of coils is a multiple of 8. If not last - * byte is only partially field with unused coils set to zero. */ - if( ( usCoilCount & 0x0007 ) != 0 ) - { - ucNBytes = ( UCHAR )( usCoilCount / 8 + 1 ); - } - else - { - ucNBytes = ( UCHAR )( usCoilCount / 8 ); - } - *pucFrameCur++ = ucNBytes; - *usLen += 1; - - eRegStatus = - eMBRegCoilsCB( pucFrameCur, usRegAddress, usCoilCount, - MB_REG_READ ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - /* The response contains the function code, the starting address - * and the quantity of registers. We reuse the old values in the - * buffer because they are still valid. */ - *usLen += ucNBytes; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid read coil register request because the length - * is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#if MB_FUNC_WRITE_COIL_ENABLED > 0 -eMBException -eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - UCHAR ucBuf[2]; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] ); - usRegAddress++; - - if( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF + 1] == 0x00 ) && - ( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) || - ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0x00 ) ) ) - { - ucBuf[1] = 0; - if( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) - { - ucBuf[0] = 1; - } - else - { - ucBuf[0] = 0; - } - eRegStatus = - eMBRegCoilsCB( &ucBuf[0], usRegAddress, 1, MB_REG_WRITE ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid write coil register request because the length - * is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#endif - -#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 -eMBException -eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usCoilCnt; - UCHAR ucByteCount; - UCHAR ucByteCountVerify; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen > ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] ); - usRegAddress++; - - usCoilCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF] << 8 ); - usCoilCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF + 1] ); - - ucByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF]; - - /* Compute the number of expected bytes in the request. */ - if( ( usCoilCnt & 0x0007 ) != 0 ) - { - ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 + 1 ); - } - else - { - ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 ); - } - - if( ( usCoilCnt >= 1 ) && - ( usCoilCnt <= MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX ) && - ( ucByteCountVerify == ucByteCount ) ) - { - eRegStatus = - eMBRegCoilsCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF], - usRegAddress, usCoilCnt, MB_REG_WRITE ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - /* The response contains the function code, the starting address - * and the quantity of registers. We reuse the old values in the - * buffer because they are still valid. */ - *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid write coil register request because the length - * is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#endif - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfunccoils.c,v 1.8 2007/02/18 23:47:16 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbconfig.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) +#define MB_PDU_FUNC_READ_COILCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_READ_SIZE ( 4 ) +#define MB_PDU_FUNC_READ_COILCNT_MAX ( 0x07D0 ) + +#define MB_PDU_FUNC_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF ) +#define MB_PDU_FUNC_WRITE_VALUE_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_WRITE_SIZE ( 4 ) + +#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF ( MB_PDU_DATA_OFF ) +#define MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF ( MB_PDU_DATA_OFF + 4 ) +#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF ( MB_PDU_DATA_OFF + 5 ) +#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN ( 5 ) +#define MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX ( 0x07B0 ) + +/* ----------------------- Static functions ---------------------------------*/ +eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); + +/* ----------------------- Start implementation -----------------------------*/ + +#if MB_FUNC_READ_COILS_ENABLED > 0 + +eMBException +eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usCoilCount; + UCHAR ucNBytes; + UCHAR *pucFrameCur; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); + usRegAddress++; + + usCoilCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF] << 8 ); + usCoilCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF + 1] ); + + /* Check if the number of registers to read is valid. If not + * return Modbus illegal data value exception. + */ + if( ( usCoilCount >= 1 ) && + ( usCoilCount < MB_PDU_FUNC_READ_COILCNT_MAX ) ) + { + /* Set the current PDU data pointer to the beginning. */ + pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; + *usLen = MB_PDU_FUNC_OFF; + + /* First byte contains the function code. */ + *pucFrameCur++ = MB_FUNC_READ_COILS; + *usLen += 1; + + /* Test if the quantity of coils is a multiple of 8. If not last + * byte is only partially field with unused coils set to zero. */ + if( ( usCoilCount & 0x0007 ) != 0 ) + { + ucNBytes = ( UCHAR )( usCoilCount / 8 + 1 ); + } + else + { + ucNBytes = ( UCHAR )( usCoilCount / 8 ); + } + *pucFrameCur++ = ucNBytes; + *usLen += 1; + + eRegStatus = + eMBRegCoilsCB( pucFrameCur, usRegAddress, usCoilCount, + MB_REG_READ ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + /* The response contains the function code, the starting address + * and the quantity of registers. We reuse the old values in the + * buffer because they are still valid. */ + *usLen += ucNBytes; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid read coil register request because the length + * is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#if MB_FUNC_WRITE_COIL_ENABLED > 0 +eMBException +eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + UCHAR ucBuf[2]; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] ); + usRegAddress++; + + if( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF + 1] == 0x00 ) && + ( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) || + ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0x00 ) ) ) + { + ucBuf[1] = 0; + if( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) + { + ucBuf[0] = 1; + } + else + { + ucBuf[0] = 0; + } + eRegStatus = + eMBRegCoilsCB( &ucBuf[0], usRegAddress, 1, MB_REG_WRITE ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid write coil register request because the length + * is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#endif + +#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 +eMBException +eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usCoilCnt; + UCHAR ucByteCount; + UCHAR ucByteCountVerify; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen > ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] ); + usRegAddress++; + + usCoilCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF] << 8 ); + usCoilCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF + 1] ); + + ucByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF]; + + /* Compute the number of expected bytes in the request. */ + if( ( usCoilCnt & 0x0007 ) != 0 ) + { + ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 + 1 ); + } + else + { + ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 ); + } + + if( ( usCoilCnt >= 1 ) && + ( usCoilCnt <= MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX ) && + ( ucByteCountVerify == ucByteCount ) ) + { + eRegStatus = + eMBRegCoilsCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF], + usRegAddress, usCoilCnt, MB_REG_WRITE ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + /* The response contains the function code, the starting address + * and the quantity of registers. We reuse the old values in the + * buffer because they are still valid. */ + *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid write coil register request because the length + * is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#endif + +#endif diff --git a/modbus/modbus/functions/mbfuncdiag.c b/modbus/modbus/functions/mbfuncdiag.c index d75ffc0..d961f8e 100644 --- a/modbus/modbus/functions/mbfuncdiag.c +++ b/modbus/modbus/functions/mbfuncdiag.c @@ -1,29 +1,29 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfuncdiag.c,v 1.3 2006/12/07 22:10:34 wolti Exp $ - */ +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfuncdiag.c,v 1.3 2006/12/07 22:10:34 wolti Exp $ + */ diff --git a/modbus/modbus/functions/mbfuncdisc.c b/modbus/modbus/functions/mbfuncdisc.c index a1baa2b..cac8896 100644 --- a/modbus/modbus/functions/mbfuncdisc.c +++ b/modbus/modbus/functions/mbfuncdisc.c @@ -1,125 +1,125 @@ - /* - * FreeRTOS Modbus Libary: A Modbus serial implementation for FreeRTOS - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbconfig.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) -#define MB_PDU_FUNC_READ_DISCCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_READ_SIZE ( 4 ) -#define MB_PDU_FUNC_READ_DISCCNT_MAX ( 0x07D0 ) - -/* ----------------------- Static functions ---------------------------------*/ -eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); - -/* ----------------------- Start implementation -----------------------------*/ - -#if MB_FUNC_READ_COILS_ENABLED > 0 - -eMBException -eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usDiscreteCnt; - UCHAR ucNBytes; - UCHAR *pucFrameCur; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); - usRegAddress++; - - usDiscreteCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF] << 8 ); - usDiscreteCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF + 1] ); - - /* Check if the number of registers to read is valid. If not - * return Modbus illegal data value exception. - */ - if( ( usDiscreteCnt >= 1 ) && - ( usDiscreteCnt < MB_PDU_FUNC_READ_DISCCNT_MAX ) ) - { - /* Set the current PDU data pointer to the beginning. */ - pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; - *usLen = MB_PDU_FUNC_OFF; - - /* First byte contains the function code. */ - *pucFrameCur++ = MB_FUNC_READ_DISCRETE_INPUTS; - *usLen += 1; - - /* Test if the quantity of coils is a multiple of 8. If not last - * byte is only partially field with unused coils set to zero. */ - if( ( usDiscreteCnt & 0x0007 ) != 0 ) - { - ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 + 1 ); - } - else - { - ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 ); - } - *pucFrameCur++ = ucNBytes; - *usLen += 1; - - eRegStatus = - eMBRegDiscreteCB( pucFrameCur, usRegAddress, usDiscreteCnt ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - /* The response contains the function code, the starting address - * and the quantity of registers. We reuse the old values in the - * buffer because they are still valid. */ - *usLen += ucNBytes; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid read coil register request because the length - * is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#endif + /* + * FreeRTOS Modbus Libary: A Modbus serial implementation for FreeRTOS + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbconfig.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) +#define MB_PDU_FUNC_READ_DISCCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_READ_SIZE ( 4 ) +#define MB_PDU_FUNC_READ_DISCCNT_MAX ( 0x07D0 ) + +/* ----------------------- Static functions ---------------------------------*/ +eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); + +/* ----------------------- Start implementation -----------------------------*/ + +#if MB_FUNC_READ_COILS_ENABLED > 0 + +eMBException +eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usDiscreteCnt; + UCHAR ucNBytes; + UCHAR *pucFrameCur; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); + usRegAddress++; + + usDiscreteCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF] << 8 ); + usDiscreteCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF + 1] ); + + /* Check if the number of registers to read is valid. If not + * return Modbus illegal data value exception. + */ + if( ( usDiscreteCnt >= 1 ) && + ( usDiscreteCnt < MB_PDU_FUNC_READ_DISCCNT_MAX ) ) + { + /* Set the current PDU data pointer to the beginning. */ + pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; + *usLen = MB_PDU_FUNC_OFF; + + /* First byte contains the function code. */ + *pucFrameCur++ = MB_FUNC_READ_DISCRETE_INPUTS; + *usLen += 1; + + /* Test if the quantity of coils is a multiple of 8. If not last + * byte is only partially field with unused coils set to zero. */ + if( ( usDiscreteCnt & 0x0007 ) != 0 ) + { + ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 + 1 ); + } + else + { + ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 ); + } + *pucFrameCur++ = ucNBytes; + *usLen += 1; + + eRegStatus = + eMBRegDiscreteCB( pucFrameCur, usRegAddress, usDiscreteCnt ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + /* The response contains the function code, the starting address + * and the quantity of registers. We reuse the old values in the + * buffer because they are still valid. */ + *usLen += ucNBytes; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid read coil register request because the length + * is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#endif diff --git a/modbus/modbus/functions/mbfuncholding.c b/modbus/modbus/functions/mbfuncholding.c index e74a062..8a12398 100644 --- a/modbus/modbus/functions/mbfuncholding.c +++ b/modbus/modbus/functions/mbfuncholding.c @@ -1,308 +1,308 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfuncholding.c,v 1.12 2007/02/18 23:48:22 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbconfig.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF + 0) -#define MB_PDU_FUNC_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_READ_SIZE ( 4 ) -#define MB_PDU_FUNC_READ_REGCNT_MAX ( 0x007D ) - -#define MB_PDU_FUNC_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF + 0) -#define MB_PDU_FUNC_WRITE_VALUE_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_WRITE_SIZE ( 4 ) - -#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF ( MB_PDU_DATA_OFF + 0 ) -#define MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF ( MB_PDU_DATA_OFF + 4 ) -#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF ( MB_PDU_DATA_OFF + 5 ) -#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN ( 5 ) -#define MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ( 0x0078 ) - -#define MB_PDU_FUNC_READWRITE_READ_ADDR_OFF ( MB_PDU_DATA_OFF + 0 ) -#define MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF + 4 ) -#define MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF ( MB_PDU_DATA_OFF + 6 ) -#define MB_PDU_FUNC_READWRITE_BYTECNT_OFF ( MB_PDU_DATA_OFF + 8 ) -#define MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF ( MB_PDU_DATA_OFF + 9 ) -#define MB_PDU_FUNC_READWRITE_SIZE_MIN ( 9 ) - -/* ----------------------- Static functions ---------------------------------*/ -eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); - -/* ----------------------- Start implementation -----------------------------*/ - -#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 - -eMBException -eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] ); - usRegAddress++; - - /* Make callback to update the value. */ - eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF], - usRegAddress, 1, MB_REG_WRITE ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - } - else - { - /* Can't be a valid request because the length is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} -#endif - -#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 -eMBException -eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usRegCount; - UCHAR ucRegByteCount; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen >= ( MB_PDU_FUNC_WRITE_MUL_SIZE_MIN + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] ); - usRegAddress++; - - usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF] << 8 ); - usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF + 1] ); - - ucRegByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF]; - - if( ( usRegCount >= 1 ) && - ( usRegCount <= MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ) && - ( ucRegByteCount == ( UCHAR ) ( 2 * usRegCount ) ) ) - { - /* Make callback to update the register values. */ - eRegStatus = - eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF], - usRegAddress, usRegCount, MB_REG_WRITE ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - /* The response contains the function code, the starting - * address and the quantity of registers. We reuse the - * old values in the buffer because they are still valid. - */ - *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid request because the length is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} -#endif - -#if MB_FUNC_READ_HOLDING_ENABLED > 0 - -eMBException -eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usRegCount; - UCHAR *pucFrameCur; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); - usRegAddress++; - - usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 ); - usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] ); - - /* Check if the number of registers to read is valid. If not - * return Modbus illegal data value exception. - */ - if( ( usRegCount >= 1 ) && ( usRegCount <= MB_PDU_FUNC_READ_REGCNT_MAX ) ) - { - /* Set the current PDU data pointer to the beginning. */ - pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; - *usLen = MB_PDU_FUNC_OFF; - - /* First byte contains the function code. */ - *pucFrameCur++ = MB_FUNC_READ_HOLDING_REGISTER; - *usLen += 1; - - /* Second byte in the response contain the number of bytes. */ - *pucFrameCur++ = ( UCHAR ) ( usRegCount * 2 ); - *usLen += 1; - - /* Make callback to fill the buffer. */ - eRegStatus = eMBRegHoldingCB( pucFrameCur, usRegAddress, usRegCount, MB_REG_READ ); - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - *usLen += usRegCount * 2; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid request because the length is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#endif - -#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 - -eMBException -eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegReadAddress; - USHORT usRegReadCount; - USHORT usRegWriteAddress; - USHORT usRegWriteCount; - UCHAR ucRegWriteByteCount; - UCHAR *pucFrameCur; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen >= ( MB_PDU_FUNC_READWRITE_SIZE_MIN + MB_PDU_SIZE_MIN ) ) - { - usRegReadAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF] << 8U ); - usRegReadAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF + 1] ); - usRegReadAddress++; - - usRegReadCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF] << 8U ); - usRegReadCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF + 1] ); - - usRegWriteAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF] << 8U ); - usRegWriteAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF + 1] ); - usRegWriteAddress++; - - usRegWriteCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF] << 8U ); - usRegWriteCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF + 1] ); - - ucRegWriteByteCount = pucFrame[MB_PDU_FUNC_READWRITE_BYTECNT_OFF]; - - if( ( usRegReadCount >= 1 ) && ( usRegReadCount <= 0x7D ) && - ( usRegWriteCount >= 1 ) && ( usRegWriteCount <= 0x79 ) && - ( ( 2 * usRegWriteCount ) == ucRegWriteByteCount ) ) - { - /* Make callback to update the register values. */ - eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF], - usRegWriteAddress, usRegWriteCount, MB_REG_WRITE ); - - if( eRegStatus == MB_ENOERR ) - { - /* Set the current PDU data pointer to the beginning. */ - pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; - *usLen = MB_PDU_FUNC_OFF; - - /* First byte contains the function code. */ - *pucFrameCur++ = MB_FUNC_READWRITE_MULTIPLE_REGISTERS; - *usLen += 1; - - /* Second byte in the response contain the number of bytes. */ - *pucFrameCur++ = ( UCHAR ) ( usRegReadCount * 2 ); - *usLen += 1; - - /* Make the read callback. */ - eRegStatus = - eMBRegHoldingCB( pucFrameCur, usRegReadAddress, usRegReadCount, MB_REG_READ ); - if( eRegStatus == MB_ENOERR ) - { - *usLen += 2 * usRegReadCount; - } - } - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - return eStatus; -} - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfuncholding.c,v 1.12 2007/02/18 23:48:22 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbconfig.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF + 0) +#define MB_PDU_FUNC_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_READ_SIZE ( 4 ) +#define MB_PDU_FUNC_READ_REGCNT_MAX ( 0x007D ) + +#define MB_PDU_FUNC_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF + 0) +#define MB_PDU_FUNC_WRITE_VALUE_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_WRITE_SIZE ( 4 ) + +#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF ( MB_PDU_DATA_OFF + 0 ) +#define MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF ( MB_PDU_DATA_OFF + 4 ) +#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF ( MB_PDU_DATA_OFF + 5 ) +#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN ( 5 ) +#define MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ( 0x0078 ) + +#define MB_PDU_FUNC_READWRITE_READ_ADDR_OFF ( MB_PDU_DATA_OFF + 0 ) +#define MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF ( MB_PDU_DATA_OFF + 4 ) +#define MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF ( MB_PDU_DATA_OFF + 6 ) +#define MB_PDU_FUNC_READWRITE_BYTECNT_OFF ( MB_PDU_DATA_OFF + 8 ) +#define MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF ( MB_PDU_DATA_OFF + 9 ) +#define MB_PDU_FUNC_READWRITE_SIZE_MIN ( 9 ) + +/* ----------------------- Static functions ---------------------------------*/ +eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); + +/* ----------------------- Start implementation -----------------------------*/ + +#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 + +eMBException +eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] ); + usRegAddress++; + + /* Make callback to update the value. */ + eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF], + usRegAddress, 1, MB_REG_WRITE ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + } + else + { + /* Can't be a valid request because the length is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} +#endif + +#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 +eMBException +eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usRegCount; + UCHAR ucRegByteCount; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen >= ( MB_PDU_FUNC_WRITE_MUL_SIZE_MIN + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] ); + usRegAddress++; + + usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF] << 8 ); + usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF + 1] ); + + ucRegByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF]; + + if( ( usRegCount >= 1 ) && + ( usRegCount <= MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ) && + ( ucRegByteCount == ( UCHAR ) ( 2 * usRegCount ) ) ) + { + /* Make callback to update the register values. */ + eRegStatus = + eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF], + usRegAddress, usRegCount, MB_REG_WRITE ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + /* The response contains the function code, the starting + * address and the quantity of registers. We reuse the + * old values in the buffer because they are still valid. + */ + *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid request because the length is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} +#endif + +#if MB_FUNC_READ_HOLDING_ENABLED > 0 + +eMBException +eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usRegCount; + UCHAR *pucFrameCur; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); + usRegAddress++; + + usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 ); + usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] ); + + /* Check if the number of registers to read is valid. If not + * return Modbus illegal data value exception. + */ + if( ( usRegCount >= 1 ) && ( usRegCount <= MB_PDU_FUNC_READ_REGCNT_MAX ) ) + { + /* Set the current PDU data pointer to the beginning. */ + pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; + *usLen = MB_PDU_FUNC_OFF; + + /* First byte contains the function code. */ + *pucFrameCur++ = MB_FUNC_READ_HOLDING_REGISTER; + *usLen += 1; + + /* Second byte in the response contain the number of bytes. */ + *pucFrameCur++ = ( UCHAR ) ( usRegCount * 2 ); + *usLen += 1; + + /* Make callback to fill the buffer. */ + eRegStatus = eMBRegHoldingCB( pucFrameCur, usRegAddress, usRegCount, MB_REG_READ ); + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + *usLen += usRegCount * 2; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid request because the length is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#endif + +#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 + +eMBException +eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegReadAddress; + USHORT usRegReadCount; + USHORT usRegWriteAddress; + USHORT usRegWriteCount; + UCHAR ucRegWriteByteCount; + UCHAR *pucFrameCur; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen >= ( MB_PDU_FUNC_READWRITE_SIZE_MIN + MB_PDU_SIZE_MIN ) ) + { + usRegReadAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF] << 8U ); + usRegReadAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF + 1] ); + usRegReadAddress++; + + usRegReadCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF] << 8U ); + usRegReadCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF + 1] ); + + usRegWriteAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF] << 8U ); + usRegWriteAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF + 1] ); + usRegWriteAddress++; + + usRegWriteCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF] << 8U ); + usRegWriteCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF + 1] ); + + ucRegWriteByteCount = pucFrame[MB_PDU_FUNC_READWRITE_BYTECNT_OFF]; + + if( ( usRegReadCount >= 1 ) && ( usRegReadCount <= 0x7D ) && + ( usRegWriteCount >= 1 ) && ( usRegWriteCount <= 0x79 ) && + ( ( 2 * usRegWriteCount ) == ucRegWriteByteCount ) ) + { + /* Make callback to update the register values. */ + eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF], + usRegWriteAddress, usRegWriteCount, MB_REG_WRITE ); + + if( eRegStatus == MB_ENOERR ) + { + /* Set the current PDU data pointer to the beginning. */ + pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; + *usLen = MB_PDU_FUNC_OFF; + + /* First byte contains the function code. */ + *pucFrameCur++ = MB_FUNC_READWRITE_MULTIPLE_REGISTERS; + *usLen += 1; + + /* Second byte in the response contain the number of bytes. */ + *pucFrameCur++ = ( UCHAR ) ( usRegReadCount * 2 ); + *usLen += 1; + + /* Make the read callback. */ + eRegStatus = + eMBRegHoldingCB( pucFrameCur, usRegReadAddress, usRegReadCount, MB_REG_READ ); + if( eRegStatus == MB_ENOERR ) + { + *usLen += 2 * usRegReadCount; + } + } + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + return eStatus; +} + +#endif diff --git a/modbus/modbus/functions/mbfuncinput.c b/modbus/modbus/functions/mbfuncinput.c index cceedba..3766a3f 100644 --- a/modbus/modbus/functions/mbfuncinput.c +++ b/modbus/modbus/functions/mbfuncinput.c @@ -1,122 +1,122 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfuncinput.c,v 1.10 2007/09/12 10:15:56 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbconfig.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) -#define MB_PDU_FUNC_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) -#define MB_PDU_FUNC_READ_SIZE ( 4 ) -#define MB_PDU_FUNC_READ_REGCNT_MAX ( 0x007D ) - -#define MB_PDU_FUNC_READ_RSP_BYTECNT_OFF ( MB_PDU_DATA_OFF ) - -/* ----------------------- Static functions ---------------------------------*/ -eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); - -/* ----------------------- Start implementation -----------------------------*/ -#if MB_FUNC_READ_INPUT_ENABLED > 0 - -eMBException -eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen ) -{ - USHORT usRegAddress; - USHORT usRegCount; - UCHAR *pucFrameCur; - - eMBException eStatus = MB_EX_NONE; - eMBErrorCode eRegStatus; - - if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) - { - usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); - usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); - usRegAddress++; - - usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 ); - usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] ); - - /* Check if the number of registers to read is valid. If not - * return Modbus illegal data value exception. - */ - if( ( usRegCount >= 1 ) - && ( usRegCount < MB_PDU_FUNC_READ_REGCNT_MAX ) ) - { - /* Set the current PDU data pointer to the beginning. */ - pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; - *usLen = MB_PDU_FUNC_OFF; - - /* First byte contains the function code. */ - *pucFrameCur++ = MB_FUNC_READ_INPUT_REGISTER; - *usLen += 1; - - /* Second byte in the response contain the number of bytes. */ - *pucFrameCur++ = ( UCHAR )( usRegCount * 2 ); - *usLen += 1; - - eRegStatus = - eMBRegInputCB( pucFrameCur, usRegAddress, usRegCount ); - - /* If an error occured convert it into a Modbus exception. */ - if( eRegStatus != MB_ENOERR ) - { - eStatus = prveMBError2Exception( eRegStatus ); - } - else - { - *usLen += usRegCount * 2; - } - } - else - { - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - } - else - { - /* Can't be a valid read input register request because the length - * is incorrect. */ - eStatus = MB_EX_ILLEGAL_DATA_VALUE; - } - return eStatus; -} - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfuncinput.c,v 1.10 2007/09/12 10:15:56 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbconfig.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_PDU_FUNC_READ_ADDR_OFF ( MB_PDU_DATA_OFF ) +#define MB_PDU_FUNC_READ_REGCNT_OFF ( MB_PDU_DATA_OFF + 2 ) +#define MB_PDU_FUNC_READ_SIZE ( 4 ) +#define MB_PDU_FUNC_READ_REGCNT_MAX ( 0x007D ) + +#define MB_PDU_FUNC_READ_RSP_BYTECNT_OFF ( MB_PDU_DATA_OFF ) + +/* ----------------------- Static functions ---------------------------------*/ +eMBException prveMBError2Exception( eMBErrorCode eErrorCode ); + +/* ----------------------- Start implementation -----------------------------*/ +#if MB_FUNC_READ_INPUT_ENABLED > 0 + +eMBException +eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen ) +{ + USHORT usRegAddress; + USHORT usRegCount; + UCHAR *pucFrameCur; + + eMBException eStatus = MB_EX_NONE; + eMBErrorCode eRegStatus; + + if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) ) + { + usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 ); + usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] ); + usRegAddress++; + + usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 ); + usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] ); + + /* Check if the number of registers to read is valid. If not + * return Modbus illegal data value exception. + */ + if( ( usRegCount >= 1 ) + && ( usRegCount < MB_PDU_FUNC_READ_REGCNT_MAX ) ) + { + /* Set the current PDU data pointer to the beginning. */ + pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF]; + *usLen = MB_PDU_FUNC_OFF; + + /* First byte contains the function code. */ + *pucFrameCur++ = MB_FUNC_READ_INPUT_REGISTER; + *usLen += 1; + + /* Second byte in the response contain the number of bytes. */ + *pucFrameCur++ = ( UCHAR )( usRegCount * 2 ); + *usLen += 1; + + eRegStatus = + eMBRegInputCB( pucFrameCur, usRegAddress, usRegCount ); + + /* If an error occured convert it into a Modbus exception. */ + if( eRegStatus != MB_ENOERR ) + { + eStatus = prveMBError2Exception( eRegStatus ); + } + else + { + *usLen += usRegCount * 2; + } + } + else + { + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + } + else + { + /* Can't be a valid read input register request because the length + * is incorrect. */ + eStatus = MB_EX_ILLEGAL_DATA_VALUE; + } + return eStatus; +} + +#endif diff --git a/modbus/modbus/functions/mbfuncother.c b/modbus/modbus/functions/mbfuncother.c index fcee972..95f9603 100644 --- a/modbus/modbus/functions/mbfuncother.c +++ b/modbus/modbus/functions/mbfuncother.c @@ -1,88 +1,88 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfuncother.c,v 1.8 2006/12/07 22:10:34 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbconfig.h" - -#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0 - -/* ----------------------- Static variables ---------------------------------*/ -static UCHAR ucMBSlaveID[MB_FUNC_OTHER_REP_SLAVEID_BUF]; -static USHORT usMBSlaveIDLen; - -/* ----------------------- Start implementation -----------------------------*/ - -eMBErrorCode -eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning, - UCHAR const *pucAdditional, USHORT usAdditionalLen ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - /* the first byte and second byte in the buffer is reserved for - * the parameter ucSlaveID and the running flag. The rest of - * the buffer is available for additional data. */ - if( usAdditionalLen + 2 < MB_FUNC_OTHER_REP_SLAVEID_BUF ) - { - usMBSlaveIDLen = 0; - ucMBSlaveID[usMBSlaveIDLen++] = ucSlaveID; - ucMBSlaveID[usMBSlaveIDLen++] = ( UCHAR )( xIsRunning ? 0xFF : 0x00 ); - if( usAdditionalLen > 0 ) - { - memcpy( &ucMBSlaveID[usMBSlaveIDLen], pucAdditional, - ( size_t )usAdditionalLen ); - usMBSlaveIDLen += usAdditionalLen; - } - } - else - { - eStatus = MB_ENORES; - } - return eStatus; -} - -eMBException -eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen ) -{ - memcpy( &pucFrame[MB_PDU_DATA_OFF], &ucMBSlaveID[0], ( size_t )usMBSlaveIDLen ); - *usLen = ( USHORT )( MB_PDU_DATA_OFF + usMBSlaveIDLen ); - return MB_EX_NONE; -} - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfuncother.c,v 1.8 2006/12/07 22:10:34 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbconfig.h" + +#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0 + +/* ----------------------- Static variables ---------------------------------*/ +static UCHAR ucMBSlaveID[MB_FUNC_OTHER_REP_SLAVEID_BUF]; +static USHORT usMBSlaveIDLen; + +/* ----------------------- Start implementation -----------------------------*/ + +eMBErrorCode +eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning, + UCHAR const *pucAdditional, USHORT usAdditionalLen ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + /* the first byte and second byte in the buffer is reserved for + * the parameter ucSlaveID and the running flag. The rest of + * the buffer is available for additional data. */ + if( usAdditionalLen + 2 < MB_FUNC_OTHER_REP_SLAVEID_BUF ) + { + usMBSlaveIDLen = 0; + ucMBSlaveID[usMBSlaveIDLen++] = ucSlaveID; + ucMBSlaveID[usMBSlaveIDLen++] = ( UCHAR )( xIsRunning ? 0xFF : 0x00 ); + if( usAdditionalLen > 0 ) + { + memcpy( &ucMBSlaveID[usMBSlaveIDLen], pucAdditional, + ( size_t )usAdditionalLen ); + usMBSlaveIDLen += usAdditionalLen; + } + } + else + { + eStatus = MB_ENORES; + } + return eStatus; +} + +eMBException +eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen ) +{ + memcpy( &pucFrame[MB_PDU_DATA_OFF], &ucMBSlaveID[0], ( size_t )usMBSlaveIDLen ); + *usLen = ( USHORT )( MB_PDU_DATA_OFF + usMBSlaveIDLen ); + return MB_EX_NONE; +} + +#endif diff --git a/modbus/modbus/functions/mbutils.c b/modbus/modbus/functions/mbutils.c index 6a72570..ffc2509 100644 --- a/modbus/modbus/functions/mbutils.c +++ b/modbus/modbus/functions/mbutils.c @@ -1,141 +1,141 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbutils.c,v 1.6 2007/02/18 23:49:07 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbproto.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define BITS_UCHAR 8U - -/* ----------------------- Start implementation -----------------------------*/ -void -xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits, - UCHAR ucValue ) -{ - USHORT usWordBuf; - USHORT usMask; - USHORT usByteOffset; - USHORT usNPreBits; - USHORT usValue = ucValue; - - assert( ucNBits <= 8 ); - assert( ( size_t )BITS_UCHAR == sizeof( UCHAR ) * 8 ); - - /* Calculate byte offset for first byte containing the bit values starting - * at usBitOffset. */ - usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR ); - - /* How many bits precede our bits to set. */ - usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR ); - - /* Move bit field into position over bits to set */ - usValue <<= usNPreBits; - - /* Prepare a mask for setting the new bits. */ - usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 ); - usMask <<= usBitOffset - usByteOffset * BITS_UCHAR; - - /* copy bits into temporary storage. */ - usWordBuf = ucByteBuf[usByteOffset]; - usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR; - - /* Zero out bit field bits and then or value bits into them. */ - usWordBuf = ( USHORT )( ( usWordBuf & ( ~usMask ) ) | usValue ); - - /* move bits back into storage */ - ucByteBuf[usByteOffset] = ( UCHAR )( usWordBuf & 0xFF ); - ucByteBuf[usByteOffset + 1] = ( UCHAR )( usWordBuf >> BITS_UCHAR ); -} - -UCHAR -xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits ) -{ - USHORT usWordBuf; - USHORT usMask; - USHORT usByteOffset; - USHORT usNPreBits; - - /* Calculate byte offset for first byte containing the bit values starting - * at usBitOffset. */ - usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR ); - - /* How many bits precede our bits to set. */ - usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR ); - - /* Prepare a mask for setting the new bits. */ - usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 ); - - /* copy bits into temporary storage. */ - usWordBuf = ucByteBuf[usByteOffset]; - usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR; - - /* throw away unneeded bits. */ - usWordBuf >>= usNPreBits; - - /* mask away bits above the requested bitfield. */ - usWordBuf &= usMask; - - return ( UCHAR ) usWordBuf; -} - -eMBException -prveMBError2Exception( eMBErrorCode eErrorCode ) -{ - eMBException eStatus; - - switch ( eErrorCode ) - { - case MB_ENOERR: - eStatus = MB_EX_NONE; - break; - - case MB_ENOREG: - eStatus = MB_EX_ILLEGAL_DATA_ADDRESS; - break; - - case MB_ETIMEDOUT: - eStatus = MB_EX_SLAVE_BUSY; - break; - - default: - eStatus = MB_EX_SLAVE_DEVICE_FAILURE; - break; - } - - return eStatus; -} +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbutils.c,v 1.6 2007/02/18 23:49:07 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbproto.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define BITS_UCHAR 8U + +/* ----------------------- Start implementation -----------------------------*/ +void +xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits, + UCHAR ucValue ) +{ + USHORT usWordBuf; + USHORT usMask; + USHORT usByteOffset; + USHORT usNPreBits; + USHORT usValue = ucValue; + + assert( ucNBits <= 8 ); + assert( ( size_t )BITS_UCHAR == sizeof( UCHAR ) * 8 ); + + /* Calculate byte offset for first byte containing the bit values starting + * at usBitOffset. */ + usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR ); + + /* How many bits precede our bits to set. */ + usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR ); + + /* Move bit field into position over bits to set */ + usValue <<= usNPreBits; + + /* Prepare a mask for setting the new bits. */ + usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 ); + usMask <<= usBitOffset - usByteOffset * BITS_UCHAR; + + /* copy bits into temporary storage. */ + usWordBuf = ucByteBuf[usByteOffset]; + usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR; + + /* Zero out bit field bits and then or value bits into them. */ + usWordBuf = ( USHORT )( ( usWordBuf & ( ~usMask ) ) | usValue ); + + /* move bits back into storage */ + ucByteBuf[usByteOffset] = ( UCHAR )( usWordBuf & 0xFF ); + ucByteBuf[usByteOffset + 1] = ( UCHAR )( usWordBuf >> BITS_UCHAR ); +} + +UCHAR +xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits ) +{ + USHORT usWordBuf; + USHORT usMask; + USHORT usByteOffset; + USHORT usNPreBits; + + /* Calculate byte offset for first byte containing the bit values starting + * at usBitOffset. */ + usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR ); + + /* How many bits precede our bits to set. */ + usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR ); + + /* Prepare a mask for setting the new bits. */ + usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 ); + + /* copy bits into temporary storage. */ + usWordBuf = ucByteBuf[usByteOffset]; + usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR; + + /* throw away unneeded bits. */ + usWordBuf >>= usNPreBits; + + /* mask away bits above the requested bitfield. */ + usWordBuf &= usMask; + + return ( UCHAR ) usWordBuf; +} + +eMBException +prveMBError2Exception( eMBErrorCode eErrorCode ) +{ + eMBException eStatus; + + switch ( eErrorCode ) + { + case MB_ENOERR: + eStatus = MB_EX_NONE; + break; + + case MB_ENOREG: + eStatus = MB_EX_ILLEGAL_DATA_ADDRESS; + break; + + case MB_ETIMEDOUT: + eStatus = MB_EX_SLAVE_BUSY; + break; + + default: + eStatus = MB_EX_SLAVE_DEVICE_FAILURE; + break; + } + + return eStatus; +} diff --git a/modbus/modbus/include/mb.h b/modbus/modbus/include/mb.h index 4c75de5..5cc6769 100644 --- a/modbus/modbus/include/mb.h +++ b/modbus/modbus/include/mb.h @@ -1,417 +1,417 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mb.h,v 1.17 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_H -#define _MB_H - -#include "port.h" - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -#include "mbport.h" -#include "mbproto.h" - -/*! \defgroup modbus Modbus - * \code #include "mb.h" \endcode - * - * This module defines the interface for the application. It contains - * the basic functions and types required to use the Modbus protocol stack. - * A typical application will want to call eMBInit() first. If the device - * is ready to answer network requests it must then call eMBEnable() to activate - * the protocol stack. In the main loop the function eMBPoll() must be called - * periodically. The time interval between pooling depends on the configured - * Modbus timeout. If an RTOS is available a separate task should be created - * and the task should always call the function eMBPoll(). - * - * \code - * // Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A - * eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN ); - * // Enable the Modbus Protocol Stack. - * eMBEnable( ); - * for( ;; ) - * { - * // Call the main polling loop of the Modbus protocol stack. - * eMBPoll( ); - * ... - * } - * \endcode - */ - -/* ----------------------- Defines ------------------------------------------*/ - -/*! \ingroup modbus - * \brief Use the default Modbus TCP port (502) - */ -#define MB_TCP_PORT_USE_DEFAULT 0 - -/* ----------------------- Type definitions ---------------------------------*/ - -/*! \ingroup modbus - * \brief Modbus serial transmission modes (RTU/ASCII). - * - * Modbus serial supports two transmission modes. Either ASCII or RTU. RTU - * is faster but has more hardware requirements and requires a network with - * a low jitter. ASCII is slower and more reliable on slower links (E.g. modems) - */ - typedef enum -{ - MB_RTU, /*!< RTU transmission mode. */ - MB_ASCII, /*!< ASCII transmission mode. */ - MB_TCP /*!< TCP mode. */ -} eMBMode; - -/*! \ingroup modbus - * \brief If register should be written or read. - * - * This value is passed to the callback functions which support either - * reading or writing register values. Writing means that the application - * registers should be updated and reading means that the modbus protocol - * stack needs to know the current register values. - * - * \see eMBRegHoldingCB( ), eMBRegCoilsCB( ), eMBRegDiscreteCB( ) and - * eMBRegInputCB( ). - */ -typedef enum -{ - MB_REG_READ, /*!< Read register values and pass to protocol stack. */ - MB_REG_WRITE /*!< Update register values. */ -} eMBRegisterMode; - -/*! \ingroup modbus - * \brief Errorcodes used by all function in the protocol stack. - */ -typedef enum -{ - MB_ENOERR, /*!< no error. */ - MB_ENOREG, /*!< illegal register address. */ - MB_EINVAL, /*!< illegal argument. */ - MB_EPORTERR, /*!< porting layer error. */ - MB_ENORES, /*!< insufficient resources. */ - MB_EIO, /*!< I/O error. */ - MB_EILLSTATE, /*!< protocol stack in illegal state. */ - MB_ETIMEDOUT /*!< timeout error occurred. */ -} eMBErrorCode; - - -/* ----------------------- Function prototypes ------------------------------*/ -/*! \ingroup modbus - * \brief Initialize the Modbus protocol stack. - * - * This functions initializes the ASCII or RTU module and calls the - * init functions of the porting layer to prepare the hardware. Please - * note that the receiver is still disabled and no Modbus frames are - * processed until eMBEnable( ) has been called. - * - * \param eMode If ASCII or RTU mode should be used. - * \param ucSlaveAddress The slave address. Only frames sent to this - * address or to the broadcast address are processed. - * \param ucPort The port to use. E.g. 1 for COM1 on windows. This value - * is platform dependent and some ports simply choose to ignore it. - * \param ulBaudRate The baudrate. E.g. 19200. Supported baudrates depend - * on the porting layer. - * \param eParity Parity used for serial transmission. - * - * \return If no error occurs the function returns eMBErrorCode::MB_ENOERR. - * The protocol is then in the disabled state and ready for activation - * by calling eMBEnable( ). Otherwise one of the following error codes - * is returned: - * - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid - * slave addresses are in the range 1 - 247. - * - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error. - */ -extern eMBErrorCode eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, - UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ); - -/*! \ingroup modbus - * \brief Initialize the Modbus protocol stack for Modbus TCP. - * - * This function initializes the Modbus TCP Module. Please note that - * frame processing is still disabled until eMBEnable( ) is called. - * - * \param usTCPPort The TCP port to listen on. - * \return If the protocol stack has been initialized correctly the function - * returns eMBErrorCode::MB_ENOERR. Otherwise one of the following error - * codes is returned: - * - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid - * slave addresses are in the range 1 - 247. - * - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error. - */ -extern eMBErrorCode eMBTCPInit( USHORT usTCPPort ); - -/*! \ingroup modbus - * \brief Release resources used by the protocol stack. - * - * This function disables the Modbus protocol stack and release all - * hardware resources. It must only be called when the protocol stack - * is disabled. - * - * \note Note all ports implement this function. A port which wants to - * get an callback must define the macro MB_PORT_HAS_CLOSE to 1. - * - * \return If the resources where released it return eMBErrorCode::MB_ENOERR. - * If the protocol stack is not in the disabled state it returns - * eMBErrorCode::MB_EILLSTATE. - */ -extern eMBErrorCode eMBClose( void ); - -/*! \ingroup modbus - * \brief Enable the Modbus protocol stack. - * - * This function enables processing of Modbus frames. Enabling the protocol - * stack is only possible if it is in the disabled state. - * - * \return If the protocol stack is now in the state enabled it returns - * eMBErrorCode::MB_ENOERR. If it was not in the disabled state it - * return eMBErrorCode::MB_EILLSTATE. - */ -eMBErrorCode eMBEnable( void ); - -/*! \ingroup modbus - * \brief Disable the Modbus protocol stack. - * - * This function disables processing of Modbus frames. - * - * \return If the protocol stack has been disabled it returns - * eMBErrorCode::MB_ENOERR. If it was not in the enabled state it returns - * eMBErrorCode::MB_EILLSTATE. - */ -extern eMBErrorCode eMBDisable( void ); - -/*! \ingroup modbus - * \brief The main pooling loop of the Modbus protocol stack. - * - * This function must be called periodically. The timer interval required - * is given by the application dependent Modbus slave timeout. Internally the - * function calls xMBPortEventGet() and waits for an event from the receiver or - * transmitter state machines. - * - * \return If the protocol stack is not in the enabled state the function - * returns eMBErrorCode::MB_EILLSTATE. Otherwise it returns - * eMBErrorCode::MB_ENOERR. - */ -extern eMBErrorCode eMBPoll( void ); - -/*! \ingroup modbus - * \brief Configure the slave id of the device. - * - * This function should be called when the Modbus function Report Slave ID - * is enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED in mbconfig.h ). - * - * \param ucSlaveID Values is returned in the Slave ID byte of the - * Report Slave ID response. - * \param xIsRunning If TRUE the Run Indicator Status byte is set to 0xFF. - * otherwise the Run Indicator Status is 0x00. - * \param pucAdditional Values which should be returned in the Additional - * bytes of the Report Slave ID response. - * \param usAdditionalLen Length of the buffer pucAdditonal. - * - * \return If the static buffer defined by MB_FUNC_OTHER_REP_SLAVEID_BUF in - * mbconfig.h is to small it returns eMBErrorCode::MB_ENORES. Otherwise - * it returns eMBErrorCode::MB_ENOERR. - */ -extern eMBErrorCode eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning, - UCHAR const *pucAdditional, - USHORT usAdditionalLen ); - -/*! \ingroup modbus - * \brief Registers a callback handler for a given function code. - * - * This function registers a new callback handler for a given function code. - * The callback handler supplied is responsible for interpreting the Modbus PDU and - * the creation of an appropriate response. In case of an error it should return - * one of the possible Modbus exceptions which results in a Modbus exception frame - * sent by the protocol stack. - * - * \param ucFunctionCode The Modbus function code for which this handler should - * be registers. Valid function codes are in the range 1 to 127. - * \param pxHandler The function handler which should be called in case - * such a frame is received. If \c NULL a previously registered function handler - * for this function code is removed. - * - * \return eMBErrorCode::MB_ENOERR if the handler has been installed. If no - * more resources are available it returns eMBErrorCode::MB_ENORES. In this - * case the values in mbconfig.h should be adjusted. If the argument was not - * valid it returns eMBErrorCode::MB_EINVAL. - */ -extern eMBErrorCode eMBRegisterCB( UCHAR ucFunctionCode, - pxMBFunctionHandler pxHandler ); - -/* ----------------------- Callback -----------------------------------------*/ - -/*! \defgroup modbus_registers Modbus Registers - * \code #include "mb.h" \endcode - * The protocol stack does not internally allocate any memory for the - * registers. This makes the protocol stack very small and also usable on - * low end targets. In addition the values don't have to be in the memory - * and could for example be stored in a flash.
- * Whenever the protocol stack requires a value it calls one of the callback - * function with the register address and the number of registers to read - * as an argument. The application should then read the actual register values - * (for example the ADC voltage) and should store the result in the supplied - * buffer.
- * If the protocol stack wants to update a register value because a write - * register function was received a buffer with the new register values is - * passed to the callback function. The function should then use these values - * to update the application register values. - */ - -/*! \ingroup modbus_registers - * \brief Callback function used if the value of a Input Register - * is required by the protocol stack. The starting register address is given - * by \c usAddress and the last register is given by usAddress + - * usNRegs - 1. - * - * \param pucRegBuffer A buffer where the callback function should write - * the current value of the modbus registers to. - * \param usAddress The starting address of the register. Input registers - * are in the range 1 - 65535. - * \param usNRegs Number of registers the callback function must supply. - * - * \return The function must return one of the following error codes: - * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal - * Modbus response is sent. - * - eMBErrorCode::MB_ENOREG If the application can not supply values - * for registers within this range. In this case a - * ILLEGAL DATA ADDRESS exception frame is sent as a response. - * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is - * currently not available and the application dependent response - * timeout would be violated. In this case a SLAVE DEVICE BUSY - * exception is sent as a response. - * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case - * a SLAVE DEVICE FAILURE exception is sent as a response. - */ -extern eMBErrorCode eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, - USHORT usNRegs ); - -/*! \ingroup modbus_registers - * \brief Callback function used if a Holding Register value is - * read or written by the protocol stack. The starting register address - * is given by \c usAddress and the last register is given by - * usAddress + usNRegs - 1. - * - * \param pucRegBuffer If the application registers values should be updated the - * buffer points to the new registers values. If the protocol stack needs - * to now the current values the callback function should write them into - * this buffer. - * \param usAddress The starting address of the register. - * \param usNRegs Number of registers to read or write. - * \param eMode If eMBRegisterMode::MB_REG_WRITE the application register - * values should be updated from the values in the buffer. For example - * this would be the case when the Modbus master has issued an - * WRITE SINGLE REGISTER command. - * If the value eMBRegisterMode::MB_REG_READ the application should copy - * the current values into the buffer \c pucRegBuffer. - * - * \return The function must return one of the following error codes: - * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal - * Modbus response is sent. - * - eMBErrorCode::MB_ENOREG If the application can not supply values - * for registers within this range. In this case a - * ILLEGAL DATA ADDRESS exception frame is sent as a response. - * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is - * currently not available and the application dependent response - * timeout would be violated. In this case a SLAVE DEVICE BUSY - * exception is sent as a response. - * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case - * a SLAVE DEVICE FAILURE exception is sent as a response. - */ -extern eMBErrorCode eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, - USHORT usNRegs, eMBRegisterMode eMode ); - -/*! \ingroup modbus_registers - * \brief Callback function used if a Coil Register value is - * read or written by the protocol stack. If you are going to use - * this function you might use the functions xMBUtilSetBits( ) and - * xMBUtilGetBits( ) for working with bitfields. - * - * \param pucRegBuffer The bits are packed in bytes where the first coil - * starting at address \c usAddress is stored in the LSB of the - * first byte in the buffer pucRegBuffer. - * If the buffer should be written by the callback function unused - * coil values (I.e. if not a multiple of eight coils is used) should be set - * to zero. - * \param usAddress The first coil number. - * \param usNCoils Number of coil values requested. - * \param eMode If eMBRegisterMode::MB_REG_WRITE the application values should - * be updated from the values supplied in the buffer \c pucRegBuffer. - * If eMBRegisterMode::MB_REG_READ the application should store the current - * values in the buffer \c pucRegBuffer. - * - * \return The function must return one of the following error codes: - * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal - * Modbus response is sent. - * - eMBErrorCode::MB_ENOREG If the application does not map an coils - * within the requested address range. In this case a - * ILLEGAL DATA ADDRESS is sent as a response. - * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is - * currently not available and the application dependent response - * timeout would be violated. In this case a SLAVE DEVICE BUSY - * exception is sent as a response. - * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case - * a SLAVE DEVICE FAILURE exception is sent as a response. - */ -extern eMBErrorCode eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, - USHORT usNCoils, eMBRegisterMode eMode ); - -/*! \ingroup modbus_registers - * \brief Callback function used if a Input Discrete Register value is - * read by the protocol stack. - * - * If you are going to use his function you might use the functions - * xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields. - * - * \param pucRegBuffer The buffer should be updated with the current - * coil values. The first discrete input starting at \c usAddress must be - * stored at the LSB of the first byte in the buffer. If the requested number - * is not a multiple of eight the remaining bits should be set to zero. - * \param usAddress The starting address of the first discrete input. - * \param usNDiscrete Number of discrete input values. - * \return The function must return one of the following error codes: - * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal - * Modbus response is sent. - * - eMBErrorCode::MB_ENOREG If no such discrete inputs exists. - * In this case a ILLEGAL DATA ADDRESS exception frame is sent - * as a response. - * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is - * currently not available and the application dependent response - * timeout would be violated. In this case a SLAVE DEVICE BUSY - * exception is sent as a response. - * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case - * a SLAVE DEVICE FAILURE exception is sent as a response. - */ -extern eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, - USHORT usNDiscrete ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mb.h,v 1.17 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_H +#define _MB_H + +#include "port.h" + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +#include "mbport.h" +#include "mbproto.h" + +/*! \defgroup modbus Modbus + * \code #include "mb.h" \endcode + * + * This module defines the interface for the application. It contains + * the basic functions and types required to use the Modbus protocol stack. + * A typical application will want to call eMBInit() first. If the device + * is ready to answer network requests it must then call eMBEnable() to activate + * the protocol stack. In the main loop the function eMBPoll() must be called + * periodically. The time interval between pooling depends on the configured + * Modbus timeout. If an RTOS is available a separate task should be created + * and the task should always call the function eMBPoll(). + * + * \code + * // Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A + * eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN ); + * // Enable the Modbus Protocol Stack. + * eMBEnable( ); + * for( ;; ) + * { + * // Call the main polling loop of the Modbus protocol stack. + * eMBPoll( ); + * ... + * } + * \endcode + */ + +/* ----------------------- Defines ------------------------------------------*/ + +/*! \ingroup modbus + * \brief Use the default Modbus TCP port (502) + */ +#define MB_TCP_PORT_USE_DEFAULT 0 + +/* ----------------------- Type definitions ---------------------------------*/ + +/*! \ingroup modbus + * \brief Modbus serial transmission modes (RTU/ASCII). + * + * Modbus serial supports two transmission modes. Either ASCII or RTU. RTU + * is faster but has more hardware requirements and requires a network with + * a low jitter. ASCII is slower and more reliable on slower links (E.g. modems) + */ + typedef enum +{ + MB_RTU, /*!< RTU transmission mode. */ + MB_ASCII, /*!< ASCII transmission mode. */ + MB_TCP /*!< TCP mode. */ +} eMBMode; + +/*! \ingroup modbus + * \brief If register should be written or read. + * + * This value is passed to the callback functions which support either + * reading or writing register values. Writing means that the application + * registers should be updated and reading means that the modbus protocol + * stack needs to know the current register values. + * + * \see eMBRegHoldingCB( ), eMBRegCoilsCB( ), eMBRegDiscreteCB( ) and + * eMBRegInputCB( ). + */ +typedef enum +{ + MB_REG_READ, /*!< Read register values and pass to protocol stack. */ + MB_REG_WRITE /*!< Update register values. */ +} eMBRegisterMode; + +/*! \ingroup modbus + * \brief Errorcodes used by all function in the protocol stack. + */ +typedef enum +{ + MB_ENOERR, /*!< no error. */ + MB_ENOREG, /*!< illegal register address. */ + MB_EINVAL, /*!< illegal argument. */ + MB_EPORTERR, /*!< porting layer error. */ + MB_ENORES, /*!< insufficient resources. */ + MB_EIO, /*!< I/O error. */ + MB_EILLSTATE, /*!< protocol stack in illegal state. */ + MB_ETIMEDOUT /*!< timeout error occurred. */ +} eMBErrorCode; + + +/* ----------------------- Function prototypes ------------------------------*/ +/*! \ingroup modbus + * \brief Initialize the Modbus protocol stack. + * + * This functions initializes the ASCII or RTU module and calls the + * init functions of the porting layer to prepare the hardware. Please + * note that the receiver is still disabled and no Modbus frames are + * processed until eMBEnable( ) has been called. + * + * \param eMode If ASCII or RTU mode should be used. + * \param ucSlaveAddress The slave address. Only frames sent to this + * address or to the broadcast address are processed. + * \param ucPort The port to use. E.g. 1 for COM1 on windows. This value + * is platform dependent and some ports simply choose to ignore it. + * \param ulBaudRate The baudrate. E.g. 19200. Supported baudrates depend + * on the porting layer. + * \param eParity Parity used for serial transmission. + * + * \return If no error occurs the function returns eMBErrorCode::MB_ENOERR. + * The protocol is then in the disabled state and ready for activation + * by calling eMBEnable( ). Otherwise one of the following error codes + * is returned: + * - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid + * slave addresses are in the range 1 - 247. + * - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error. + */ +extern eMBErrorCode eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, + UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ); + +/*! \ingroup modbus + * \brief Initialize the Modbus protocol stack for Modbus TCP. + * + * This function initializes the Modbus TCP Module. Please note that + * frame processing is still disabled until eMBEnable( ) is called. + * + * \param usTCPPort The TCP port to listen on. + * \return If the protocol stack has been initialized correctly the function + * returns eMBErrorCode::MB_ENOERR. Otherwise one of the following error + * codes is returned: + * - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid + * slave addresses are in the range 1 - 247. + * - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error. + */ +extern eMBErrorCode eMBTCPInit( USHORT usTCPPort ); + +/*! \ingroup modbus + * \brief Release resources used by the protocol stack. + * + * This function disables the Modbus protocol stack and release all + * hardware resources. It must only be called when the protocol stack + * is disabled. + * + * \note Note all ports implement this function. A port which wants to + * get an callback must define the macro MB_PORT_HAS_CLOSE to 1. + * + * \return If the resources where released it return eMBErrorCode::MB_ENOERR. + * If the protocol stack is not in the disabled state it returns + * eMBErrorCode::MB_EILLSTATE. + */ +extern eMBErrorCode eMBClose( void ); + +/*! \ingroup modbus + * \brief Enable the Modbus protocol stack. + * + * This function enables processing of Modbus frames. Enabling the protocol + * stack is only possible if it is in the disabled state. + * + * \return If the protocol stack is now in the state enabled it returns + * eMBErrorCode::MB_ENOERR. If it was not in the disabled state it + * return eMBErrorCode::MB_EILLSTATE. + */ +eMBErrorCode eMBEnable( void ); + +/*! \ingroup modbus + * \brief Disable the Modbus protocol stack. + * + * This function disables processing of Modbus frames. + * + * \return If the protocol stack has been disabled it returns + * eMBErrorCode::MB_ENOERR. If it was not in the enabled state it returns + * eMBErrorCode::MB_EILLSTATE. + */ +extern eMBErrorCode eMBDisable( void ); + +/*! \ingroup modbus + * \brief The main pooling loop of the Modbus protocol stack. + * + * This function must be called periodically. The timer interval required + * is given by the application dependent Modbus slave timeout. Internally the + * function calls xMBPortEventGet() and waits for an event from the receiver or + * transmitter state machines. + * + * \return If the protocol stack is not in the enabled state the function + * returns eMBErrorCode::MB_EILLSTATE. Otherwise it returns + * eMBErrorCode::MB_ENOERR. + */ +extern eMBErrorCode eMBPoll( void ); + +/*! \ingroup modbus + * \brief Configure the slave id of the device. + * + * This function should be called when the Modbus function Report Slave ID + * is enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED in mbconfig.h ). + * + * \param ucSlaveID Values is returned in the Slave ID byte of the + * Report Slave ID response. + * \param xIsRunning If TRUE the Run Indicator Status byte is set to 0xFF. + * otherwise the Run Indicator Status is 0x00. + * \param pucAdditional Values which should be returned in the Additional + * bytes of the Report Slave ID response. + * \param usAdditionalLen Length of the buffer pucAdditonal. + * + * \return If the static buffer defined by MB_FUNC_OTHER_REP_SLAVEID_BUF in + * mbconfig.h is to small it returns eMBErrorCode::MB_ENORES. Otherwise + * it returns eMBErrorCode::MB_ENOERR. + */ +extern eMBErrorCode eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning, + UCHAR const *pucAdditional, + USHORT usAdditionalLen ); + +/*! \ingroup modbus + * \brief Registers a callback handler for a given function code. + * + * This function registers a new callback handler for a given function code. + * The callback handler supplied is responsible for interpreting the Modbus PDU and + * the creation of an appropriate response. In case of an error it should return + * one of the possible Modbus exceptions which results in a Modbus exception frame + * sent by the protocol stack. + * + * \param ucFunctionCode The Modbus function code for which this handler should + * be registers. Valid function codes are in the range 1 to 127. + * \param pxHandler The function handler which should be called in case + * such a frame is received. If \c NULL a previously registered function handler + * for this function code is removed. + * + * \return eMBErrorCode::MB_ENOERR if the handler has been installed. If no + * more resources are available it returns eMBErrorCode::MB_ENORES. In this + * case the values in mbconfig.h should be adjusted. If the argument was not + * valid it returns eMBErrorCode::MB_EINVAL. + */ +extern eMBErrorCode eMBRegisterCB( UCHAR ucFunctionCode, + pxMBFunctionHandler pxHandler ); + +/* ----------------------- Callback -----------------------------------------*/ + +/*! \defgroup modbus_registers Modbus Registers + * \code #include "mb.h" \endcode + * The protocol stack does not internally allocate any memory for the + * registers. This makes the protocol stack very small and also usable on + * low end targets. In addition the values don't have to be in the memory + * and could for example be stored in a flash.
+ * Whenever the protocol stack requires a value it calls one of the callback + * function with the register address and the number of registers to read + * as an argument. The application should then read the actual register values + * (for example the ADC voltage) and should store the result in the supplied + * buffer.
+ * If the protocol stack wants to update a register value because a write + * register function was received a buffer with the new register values is + * passed to the callback function. The function should then use these values + * to update the application register values. + */ + +/*! \ingroup modbus_registers + * \brief Callback function used if the value of a Input Register + * is required by the protocol stack. The starting register address is given + * by \c usAddress and the last register is given by usAddress + + * usNRegs - 1. + * + * \param pucRegBuffer A buffer where the callback function should write + * the current value of the modbus registers to. + * \param usAddress The starting address of the register. Input registers + * are in the range 1 - 65535. + * \param usNRegs Number of registers the callback function must supply. + * + * \return The function must return one of the following error codes: + * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal + * Modbus response is sent. + * - eMBErrorCode::MB_ENOREG If the application can not supply values + * for registers within this range. In this case a + * ILLEGAL DATA ADDRESS exception frame is sent as a response. + * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is + * currently not available and the application dependent response + * timeout would be violated. In this case a SLAVE DEVICE BUSY + * exception is sent as a response. + * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case + * a SLAVE DEVICE FAILURE exception is sent as a response. + */ +extern eMBErrorCode eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, + USHORT usNRegs ); + +/*! \ingroup modbus_registers + * \brief Callback function used if a Holding Register value is + * read or written by the protocol stack. The starting register address + * is given by \c usAddress and the last register is given by + * usAddress + usNRegs - 1. + * + * \param pucRegBuffer If the application registers values should be updated the + * buffer points to the new registers values. If the protocol stack needs + * to now the current values the callback function should write them into + * this buffer. + * \param usAddress The starting address of the register. + * \param usNRegs Number of registers to read or write. + * \param eMode If eMBRegisterMode::MB_REG_WRITE the application register + * values should be updated from the values in the buffer. For example + * this would be the case when the Modbus master has issued an + * WRITE SINGLE REGISTER command. + * If the value eMBRegisterMode::MB_REG_READ the application should copy + * the current values into the buffer \c pucRegBuffer. + * + * \return The function must return one of the following error codes: + * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal + * Modbus response is sent. + * - eMBErrorCode::MB_ENOREG If the application can not supply values + * for registers within this range. In this case a + * ILLEGAL DATA ADDRESS exception frame is sent as a response. + * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is + * currently not available and the application dependent response + * timeout would be violated. In this case a SLAVE DEVICE BUSY + * exception is sent as a response. + * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case + * a SLAVE DEVICE FAILURE exception is sent as a response. + */ +extern eMBErrorCode eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, + USHORT usNRegs, eMBRegisterMode eMode ); + +/*! \ingroup modbus_registers + * \brief Callback function used if a Coil Register value is + * read or written by the protocol stack. If you are going to use + * this function you might use the functions xMBUtilSetBits( ) and + * xMBUtilGetBits( ) for working with bitfields. + * + * \param pucRegBuffer The bits are packed in bytes where the first coil + * starting at address \c usAddress is stored in the LSB of the + * first byte in the buffer pucRegBuffer. + * If the buffer should be written by the callback function unused + * coil values (I.e. if not a multiple of eight coils is used) should be set + * to zero. + * \param usAddress The first coil number. + * \param usNCoils Number of coil values requested. + * \param eMode If eMBRegisterMode::MB_REG_WRITE the application values should + * be updated from the values supplied in the buffer \c pucRegBuffer. + * If eMBRegisterMode::MB_REG_READ the application should store the current + * values in the buffer \c pucRegBuffer. + * + * \return The function must return one of the following error codes: + * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal + * Modbus response is sent. + * - eMBErrorCode::MB_ENOREG If the application does not map an coils + * within the requested address range. In this case a + * ILLEGAL DATA ADDRESS is sent as a response. + * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is + * currently not available and the application dependent response + * timeout would be violated. In this case a SLAVE DEVICE BUSY + * exception is sent as a response. + * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case + * a SLAVE DEVICE FAILURE exception is sent as a response. + */ +extern eMBErrorCode eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, + USHORT usNCoils, eMBRegisterMode eMode ); + +/*! \ingroup modbus_registers + * \brief Callback function used if a Input Discrete Register value is + * read by the protocol stack. + * + * If you are going to use his function you might use the functions + * xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields. + * + * \param pucRegBuffer The buffer should be updated with the current + * coil values. The first discrete input starting at \c usAddress must be + * stored at the LSB of the first byte in the buffer. If the requested number + * is not a multiple of eight the remaining bits should be set to zero. + * \param usAddress The starting address of the first discrete input. + * \param usNDiscrete Number of discrete input values. + * \return The function must return one of the following error codes: + * - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal + * Modbus response is sent. + * - eMBErrorCode::MB_ENOREG If no such discrete inputs exists. + * In this case a ILLEGAL DATA ADDRESS exception frame is sent + * as a response. + * - eMBErrorCode::MB_ETIMEDOUT If the requested register block is + * currently not available and the application dependent response + * timeout would be violated. In this case a SLAVE DEVICE BUSY + * exception is sent as a response. + * - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case + * a SLAVE DEVICE FAILURE exception is sent as a response. + */ +extern eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, + USHORT usNDiscrete ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbconfig.h b/modbus/modbus/include/mbconfig.h index 7912143..a960642 100644 --- a/modbus/modbus/include/mbconfig.h +++ b/modbus/modbus/include/mbconfig.h @@ -1,132 +1,132 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbconfig.h,v 1.15 2010/06/06 13:54:40 wolti Exp $ - */ - -#ifndef _MB_CONFIG_H -#define _MB_CONFIG_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif -/* ----------------------- Defines ------------------------------------------*/ -/*! \defgroup modbus_cfg Modbus Configuration - * - * Most modules in the protocol stack are completly optional and can be - * excluded. This is specially important if target resources are very small - * and program memory space should be saved.
- * - * All of these settings are available in the file mbconfig.h - */ -/*! \addtogroup modbus_cfg - * @{ - */ -/*! \brief If Modbus ASCII support is enabled. */ -#define MB_ASCII_ENABLED ( 0 ) - -/*! \brief If Modbus RTU support is enabled. */ -#define MB_RTU_ENABLED ( 0 ) - -/*! \brief If Modbus TCP support is enabled. */ -#define MB_TCP_ENABLED ( 1 ) - -/*! \brief The character timeout value for Modbus ASCII. - * - * The character timeout value is not fixed for Modbus ASCII and is therefore - * a configuration option. It should be set to the maximum expected delay - * time of the network. - */ -#define MB_ASCII_TIMEOUT_SEC ( 1 ) - -/*! \brief Timeout to wait in ASCII prior to enabling transmitter. - * - * If defined the function calls vMBPortSerialDelay with the argument - * MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS to allow for a delay before - * the serial transmitter is enabled. This is required because some - * targets are so fast that there is no time between receiving and - * transmitting the frame. If the master is to slow with enabling its - * receiver then he will not receive the response correctly. - */ -#ifndef MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS -#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( 0 ) -#endif - -/*! \brief Maximum number of Modbus functions codes the protocol stack - * should support. - * - * The maximum number of supported Modbus functions must be greater than - * the sum of all enabled functions in this file and custom function - * handlers. If set to small adding more functions will fail. - */ -#define MB_FUNC_HANDLERS_MAX ( 16 ) - -/*! \brief Number of bytes which should be allocated for the Report Slave ID - * command. - * - * This number limits the maximum size of the additional segment in the - * report slave id function. See eMBSetSlaveID( ) for more information on - * how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED - * is set to 1. - */ -#define MB_FUNC_OTHER_REP_SLAVEID_BUF ( 32 ) - -/*! \brief If the Report Slave ID function should be enabled. */ -#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED ( 1 ) - -/*! \brief If the Read Input Registers function should be enabled. */ -#define MB_FUNC_READ_INPUT_ENABLED ( 1 ) - -/*! \brief If the Read Holding Registers function should be enabled. */ -#define MB_FUNC_READ_HOLDING_ENABLED ( 1 ) - -/*! \brief If the Write Single Register function should be enabled. */ -#define MB_FUNC_WRITE_HOLDING_ENABLED ( 1 ) - -/*! \brief If the Write Multiple registers function should be enabled. */ -#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED ( 1 ) - -/*! \brief If the Read Coils function should be enabled. */ -#define MB_FUNC_READ_COILS_ENABLED ( 0 ) - -/*! \brief If the Write Coils function should be enabled. */ -#define MB_FUNC_WRITE_COIL_ENABLED ( 0 ) - -/*! \brief If the Write Multiple Coils function should be enabled. */ -#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED ( 0 ) - -/*! \brief If the Read Discrete Inputs function should be enabled. */ -#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED ( 0 ) - -/*! \brief If the Read/Write Multiple Registers function should be enabled. */ -#define MB_FUNC_READWRITE_HOLDING_ENABLED ( 1 ) - -/*! @} */ -#ifdef __cplusplus - PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbconfig.h,v 1.15 2010/06/06 13:54:40 wolti Exp $ + */ + +#ifndef _MB_CONFIG_H +#define _MB_CONFIG_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif +/* ----------------------- Defines ------------------------------------------*/ +/*! \defgroup modbus_cfg Modbus Configuration + * + * Most modules in the protocol stack are completly optional and can be + * excluded. This is specially important if target resources are very small + * and program memory space should be saved.
+ * + * All of these settings are available in the file mbconfig.h + */ +/*! \addtogroup modbus_cfg + * @{ + */ +/*! \brief If Modbus ASCII support is enabled. */ +#define MB_ASCII_ENABLED ( 0 ) + +/*! \brief If Modbus RTU support is enabled. */ +#define MB_RTU_ENABLED ( 0 ) + +/*! \brief If Modbus TCP support is enabled. */ +#define MB_TCP_ENABLED ( 1 ) + +/*! \brief The character timeout value for Modbus ASCII. + * + * The character timeout value is not fixed for Modbus ASCII and is therefore + * a configuration option. It should be set to the maximum expected delay + * time of the network. + */ +#define MB_ASCII_TIMEOUT_SEC ( 1 ) + +/*! \brief Timeout to wait in ASCII prior to enabling transmitter. + * + * If defined the function calls vMBPortSerialDelay with the argument + * MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS to allow for a delay before + * the serial transmitter is enabled. This is required because some + * targets are so fast that there is no time between receiving and + * transmitting the frame. If the master is to slow with enabling its + * receiver then he will not receive the response correctly. + */ +#ifndef MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS +#define MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ( 0 ) +#endif + +/*! \brief Maximum number of Modbus functions codes the protocol stack + * should support. + * + * The maximum number of supported Modbus functions must be greater than + * the sum of all enabled functions in this file and custom function + * handlers. If set to small adding more functions will fail. + */ +#define MB_FUNC_HANDLERS_MAX ( 16 ) + +/*! \brief Number of bytes which should be allocated for the Report Slave ID + * command. + * + * This number limits the maximum size of the additional segment in the + * report slave id function. See eMBSetSlaveID( ) for more information on + * how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED + * is set to 1. + */ +#define MB_FUNC_OTHER_REP_SLAVEID_BUF ( 32 ) + +/*! \brief If the Report Slave ID function should be enabled. */ +#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED ( 1 ) + +/*! \brief If the Read Input Registers function should be enabled. */ +#define MB_FUNC_READ_INPUT_ENABLED ( 1 ) + +/*! \brief If the Read Holding Registers function should be enabled. */ +#define MB_FUNC_READ_HOLDING_ENABLED ( 1 ) + +/*! \brief If the Write Single Register function should be enabled. */ +#define MB_FUNC_WRITE_HOLDING_ENABLED ( 1 ) + +/*! \brief If the Write Multiple registers function should be enabled. */ +#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED ( 1 ) + +/*! \brief If the Read Coils function should be enabled. */ +#define MB_FUNC_READ_COILS_ENABLED ( 0 ) + +/*! \brief If the Write Coils function should be enabled. */ +#define MB_FUNC_WRITE_COIL_ENABLED ( 0 ) + +/*! \brief If the Write Multiple Coils function should be enabled. */ +#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED ( 0 ) + +/*! \brief If the Read Discrete Inputs function should be enabled. */ +#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED ( 0 ) + +/*! \brief If the Read/Write Multiple Registers function should be enabled. */ +#define MB_FUNC_READWRITE_HOLDING_ENABLED ( 1 ) + +/*! @} */ +#ifdef __cplusplus + PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbframe.h b/modbus/modbus/include/mbframe.h index 99d59c6..f854da6 100644 --- a/modbus/modbus/include/mbframe.h +++ b/modbus/modbus/include/mbframe.h @@ -1,87 +1,87 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbframe.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_FRAME_H -#define _MB_FRAME_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -/*! - * Constants which defines the format of a modbus frame. The example is - * shown for a Modbus RTU/ASCII frame. Note that the Modbus PDU is not - * dependent on the underlying transport. - * - * - * <------------------------ MODBUS SERIAL LINE PDU (1) -------------------> - * <----------- MODBUS PDU (1') ----------------> - * +-----------+---------------+----------------------------+-------------+ - * | Address | Function Code | Data | CRC/LRC | - * +-----------+---------------+----------------------------+-------------+ - * | | | | - * (2) (3/2') (3') (4) - * - * (1) ... MB_SER_PDU_SIZE_MAX = 256 - * (2) ... MB_SER_PDU_ADDR_OFF = 0 - * (3) ... MB_SER_PDU_PDU_OFF = 1 - * (4) ... MB_SER_PDU_SIZE_CRC = 2 - * - * (1') ... MB_PDU_SIZE_MAX = 253 - * (2') ... MB_PDU_FUNC_OFF = 0 - * (3') ... MB_PDU_DATA_OFF = 1 - * - */ - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_PDU_SIZE_MAX 253 /*!< Maximum size of a PDU. */ -#define MB_PDU_SIZE_MIN 1 /*!< Function Code */ -#define MB_PDU_FUNC_OFF 0 /*!< Offset of function code in PDU. */ -#define MB_PDU_DATA_OFF 1 /*!< Offset for response data in PDU. */ - -/* ----------------------- Prototypes 0-------------------------------------*/ -typedef void ( *pvMBFrameStart ) ( void ); - -typedef void ( *pvMBFrameStop ) ( void ); - -typedef eMBErrorCode( *peMBFrameReceive ) ( UCHAR * pucRcvAddress, - UCHAR ** pucFrame, - USHORT * pusLength ); - -typedef eMBErrorCode( *peMBFrameSend ) ( UCHAR slaveAddress, - const UCHAR * pucFrame, - USHORT usLength ); - -typedef void( *pvMBFrameClose ) ( void ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbframe.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_FRAME_H +#define _MB_FRAME_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +/*! + * Constants which defines the format of a modbus frame. The example is + * shown for a Modbus RTU/ASCII frame. Note that the Modbus PDU is not + * dependent on the underlying transport. + * + * + * <------------------------ MODBUS SERIAL LINE PDU (1) -------------------> + * <----------- MODBUS PDU (1') ----------------> + * +-----------+---------------+----------------------------+-------------+ + * | Address | Function Code | Data | CRC/LRC | + * +-----------+---------------+----------------------------+-------------+ + * | | | | + * (2) (3/2') (3') (4) + * + * (1) ... MB_SER_PDU_SIZE_MAX = 256 + * (2) ... MB_SER_PDU_ADDR_OFF = 0 + * (3) ... MB_SER_PDU_PDU_OFF = 1 + * (4) ... MB_SER_PDU_SIZE_CRC = 2 + * + * (1') ... MB_PDU_SIZE_MAX = 253 + * (2') ... MB_PDU_FUNC_OFF = 0 + * (3') ... MB_PDU_DATA_OFF = 1 + * + */ + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_PDU_SIZE_MAX 253 /*!< Maximum size of a PDU. */ +#define MB_PDU_SIZE_MIN 1 /*!< Function Code */ +#define MB_PDU_FUNC_OFF 0 /*!< Offset of function code in PDU. */ +#define MB_PDU_DATA_OFF 1 /*!< Offset for response data in PDU. */ + +/* ----------------------- Prototypes 0-------------------------------------*/ +typedef void ( *pvMBFrameStart ) ( void ); + +typedef void ( *pvMBFrameStop ) ( void ); + +typedef eMBErrorCode( *peMBFrameReceive ) ( UCHAR * pucRcvAddress, + UCHAR ** pucFrame, + USHORT * pusLength ); + +typedef eMBErrorCode( *peMBFrameSend ) ( UCHAR slaveAddress, + const UCHAR * pucFrame, + USHORT usLength ); + +typedef void( *pvMBFrameClose ) ( void ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbfunc.h b/modbus/modbus/include/mbfunc.h index aea14f7..988b85e 100644 --- a/modbus/modbus/include/mbfunc.h +++ b/modbus/modbus/include/mbfunc.h @@ -1,80 +1,80 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbfunc.h,v 1.12 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_FUNC_H -#define _MB_FUNC_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif -#if MB_FUNC_OTHER_REP_SLAVEID_BUF > 0 - eMBException eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_READ_INPUT_ENABLED > 0 -eMBException eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_READ_HOLDING_ENABLED > 0 -eMBException eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 -eMBException eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 -eMBException eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_READ_COILS_ENABLED > 0 -eMBException eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_WRITE_COIL_ENABLED > 0 -eMBException eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 -eMBException eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0 -eMBException eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 -eMBException eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); -#endif - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbfunc.h,v 1.12 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_FUNC_H +#define _MB_FUNC_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif +#if MB_FUNC_OTHER_REP_SLAVEID_BUF > 0 + eMBException eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_READ_INPUT_ENABLED > 0 +eMBException eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_READ_HOLDING_ENABLED > 0 +eMBException eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 +eMBException eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 +eMBException eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_READ_COILS_ENABLED > 0 +eMBException eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_WRITE_COIL_ENABLED > 0 +eMBException eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 +eMBException eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0 +eMBException eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 +eMBException eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen ); +#endif + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbport.h b/modbus/modbus/include/mbport.h index 4f25a96..5ac4607 100644 --- a/modbus/modbus/include/mbport.h +++ b/modbus/modbus/include/mbport.h @@ -1,129 +1,129 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbport.h,v 1.19 2010/06/06 13:54:40 wolti Exp $ - */ - -#ifndef _MB_PORT_H -#define _MB_PORT_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -/* ----------------------- Type definitions ---------------------------------*/ - -typedef enum -{ - EV_READY, /*!< Startup finished. */ - EV_FRAME_RECEIVED, /*!< Frame received. */ - EV_EXECUTE, /*!< Execute function. */ - EV_FRAME_SENT /*!< Frame sent. */ -} eMBEventType; - -/*! \ingroup modbus - * \brief Parity used for characters in serial mode. - * - * The parity which should be applied to the characters sent over the serial - * link. Please note that this values are actually passed to the porting - * layer and therefore not all parity modes might be available. - */ -typedef enum -{ - MB_PAR_NONE, /*!< No parity. */ - MB_PAR_ODD, /*!< Odd parity. */ - MB_PAR_EVEN /*!< Even parity. */ -} eMBParity; - -/* ----------------------- Supporting functions -----------------------------*/ -BOOL xMBPortEventInit( void ); - -BOOL xMBPortEventPost( eMBEventType eEvent ); - -BOOL xMBPortEventGet( /*@out@ */ eMBEventType * eEvent ); - -/* ----------------------- Serial port functions ----------------------------*/ - -BOOL xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate, - UCHAR ucDataBits, eMBParity eParity ); - -void vMBPortClose( void ); - -void xMBPortSerialClose( void ); - -void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable ); - -BOOL xMBPortSerialGetByte( CHAR * pucByte ); - -BOOL xMBPortSerialPutByte( CHAR ucByte ); - -/* ----------------------- Timers functions ---------------------------------*/ -BOOL xMBPortTimersInit( USHORT usTimeOut50us ); - -void xMBPortTimersClose( void ); - -void vMBPortTimersEnable( void ); - -void vMBPortTimersDisable( void ); - -void vMBPortTimersDelay( USHORT usTimeOutMS ); - -/* ----------------------- Callback for the protocol stack ------------------*/ - -/*! - * \brief Callback function for the porting layer when a new byte is - * available. - * - * Depending upon the mode this callback function is used by the RTU or - * ASCII transmission layers. In any case a call to xMBPortSerialGetByte() - * must immediately return a new character. - * - * \return TRUE if a event was posted to the queue because - * a new byte was received. The port implementation should wake up the - * tasks which are currently blocked on the eventqueue. - */ -extern BOOL( *pxMBFrameCBByteReceived ) ( void ); - -extern BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); - -extern BOOL( *pxMBPortCBTimerExpired ) ( void ); - -/* ----------------------- TCP port functions -------------------------------*/ -BOOL xMBTCPPortInit( USHORT usTCPPort ); - -void vMBTCPPortClose( void ); - -void vMBTCPPortDisable( void ); - -BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength ); - -BOOL xMBTCPPortSendResponse( const UCHAR *pucMBTCPFrame, USHORT usTCPLength ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbport.h,v 1.19 2010/06/06 13:54:40 wolti Exp $ + */ + +#ifndef _MB_PORT_H +#define _MB_PORT_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +/* ----------------------- Type definitions ---------------------------------*/ + +typedef enum +{ + EV_READY, /*!< Startup finished. */ + EV_FRAME_RECEIVED, /*!< Frame received. */ + EV_EXECUTE, /*!< Execute function. */ + EV_FRAME_SENT /*!< Frame sent. */ +} eMBEventType; + +/*! \ingroup modbus + * \brief Parity used for characters in serial mode. + * + * The parity which should be applied to the characters sent over the serial + * link. Please note that this values are actually passed to the porting + * layer and therefore not all parity modes might be available. + */ +typedef enum +{ + MB_PAR_NONE, /*!< No parity. */ + MB_PAR_ODD, /*!< Odd parity. */ + MB_PAR_EVEN /*!< Even parity. */ +} eMBParity; + +/* ----------------------- Supporting functions -----------------------------*/ +BOOL xMBPortEventInit( void ); + +BOOL xMBPortEventPost( eMBEventType eEvent ); + +BOOL xMBPortEventGet( /*@out@ */ eMBEventType * eEvent ); + +/* ----------------------- Serial port functions ----------------------------*/ + +BOOL xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate, + UCHAR ucDataBits, eMBParity eParity ); + +void vMBPortClose( void ); + +void xMBPortSerialClose( void ); + +void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable ); + +BOOL xMBPortSerialGetByte( CHAR * pucByte ); + +BOOL xMBPortSerialPutByte( CHAR ucByte ); + +/* ----------------------- Timers functions ---------------------------------*/ +BOOL xMBPortTimersInit( USHORT usTimeOut50us ); + +void xMBPortTimersClose( void ); + +void vMBPortTimersEnable( void ); + +void vMBPortTimersDisable( void ); + +void vMBPortTimersDelay( USHORT usTimeOutMS ); + +/* ----------------------- Callback for the protocol stack ------------------*/ + +/*! + * \brief Callback function for the porting layer when a new byte is + * available. + * + * Depending upon the mode this callback function is used by the RTU or + * ASCII transmission layers. In any case a call to xMBPortSerialGetByte() + * must immediately return a new character. + * + * \return TRUE if a event was posted to the queue because + * a new byte was received. The port implementation should wake up the + * tasks which are currently blocked on the eventqueue. + */ +extern BOOL( *pxMBFrameCBByteReceived ) ( void ); + +extern BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); + +extern BOOL( *pxMBPortCBTimerExpired ) ( void ); + +/* ----------------------- TCP port functions -------------------------------*/ +BOOL xMBTCPPortInit( USHORT usTCPPort ); + +void vMBTCPPortClose( void ); + +void vMBTCPPortDisable( void ); + +BOOL xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength ); + +BOOL xMBTCPPortSendResponse( const UCHAR *pucMBTCPFrame, USHORT usTCPLength ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbproto.h b/modbus/modbus/include/mbproto.h index 786aaf4..fe16fb9 100644 --- a/modbus/modbus/include/mbproto.h +++ b/modbus/modbus/include/mbproto.h @@ -1,83 +1,83 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbproto.h,v 1.14 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_PROTO_H -#define _MB_PROTO_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif -/* ----------------------- Defines ------------------------------------------*/ -#define MB_ADDRESS_BROADCAST ( 0 ) /*! Modbus broadcast address. */ -#define MB_ADDRESS_MIN ( 1 ) /*! Smallest possible slave address. */ -#define MB_ADDRESS_MAX ( 247 ) /*! Biggest possible slave address. */ -#define MB_FUNC_NONE ( 0 ) -#define MB_FUNC_READ_COILS ( 1 ) -#define MB_FUNC_READ_DISCRETE_INPUTS ( 2 ) -#define MB_FUNC_WRITE_SINGLE_COIL ( 5 ) -#define MB_FUNC_WRITE_MULTIPLE_COILS ( 15 ) -#define MB_FUNC_READ_HOLDING_REGISTER ( 3 ) -#define MB_FUNC_READ_INPUT_REGISTER ( 4 ) -#define MB_FUNC_WRITE_REGISTER ( 6 ) -#define MB_FUNC_WRITE_MULTIPLE_REGISTERS ( 16 ) -#define MB_FUNC_READWRITE_MULTIPLE_REGISTERS ( 23 ) -#define MB_FUNC_DIAG_READ_EXCEPTION ( 7 ) -#define MB_FUNC_DIAG_DIAGNOSTIC ( 8 ) -#define MB_FUNC_DIAG_GET_COM_EVENT_CNT ( 11 ) -#define MB_FUNC_DIAG_GET_COM_EVENT_LOG ( 12 ) -#define MB_FUNC_OTHER_REPORT_SLAVEID ( 17 ) -#define MB_FUNC_ERROR ( 128 ) -/* ----------------------- Type definitions ---------------------------------*/ - typedef enum -{ - MB_EX_NONE = 0x00, - MB_EX_ILLEGAL_FUNCTION = 0x01, - MB_EX_ILLEGAL_DATA_ADDRESS = 0x02, - MB_EX_ILLEGAL_DATA_VALUE = 0x03, - MB_EX_SLAVE_DEVICE_FAILURE = 0x04, - MB_EX_ACKNOWLEDGE = 0x05, - MB_EX_SLAVE_BUSY = 0x06, - MB_EX_MEMORY_PARITY_ERROR = 0x08, - MB_EX_GATEWAY_PATH_FAILED = 0x0A, - MB_EX_GATEWAY_TGT_FAILED = 0x0B -} eMBException; - -typedef eMBException( *pxMBFunctionHandler ) ( UCHAR * pucFrame, USHORT * pusLength ); - -typedef struct -{ - UCHAR ucFunctionCode; - pxMBFunctionHandler pxHandler; -} xMBFunctionHandler; - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbproto.h,v 1.14 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_PROTO_H +#define _MB_PROTO_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif +/* ----------------------- Defines ------------------------------------------*/ +#define MB_ADDRESS_BROADCAST ( 0 ) /*! Modbus broadcast address. */ +#define MB_ADDRESS_MIN ( 1 ) /*! Smallest possible slave address. */ +#define MB_ADDRESS_MAX ( 247 ) /*! Biggest possible slave address. */ +#define MB_FUNC_NONE ( 0 ) +#define MB_FUNC_READ_COILS ( 1 ) +#define MB_FUNC_READ_DISCRETE_INPUTS ( 2 ) +#define MB_FUNC_WRITE_SINGLE_COIL ( 5 ) +#define MB_FUNC_WRITE_MULTIPLE_COILS ( 15 ) +#define MB_FUNC_READ_HOLDING_REGISTER ( 3 ) +#define MB_FUNC_READ_INPUT_REGISTER ( 4 ) +#define MB_FUNC_WRITE_REGISTER ( 6 ) +#define MB_FUNC_WRITE_MULTIPLE_REGISTERS ( 16 ) +#define MB_FUNC_READWRITE_MULTIPLE_REGISTERS ( 23 ) +#define MB_FUNC_DIAG_READ_EXCEPTION ( 7 ) +#define MB_FUNC_DIAG_DIAGNOSTIC ( 8 ) +#define MB_FUNC_DIAG_GET_COM_EVENT_CNT ( 11 ) +#define MB_FUNC_DIAG_GET_COM_EVENT_LOG ( 12 ) +#define MB_FUNC_OTHER_REPORT_SLAVEID ( 17 ) +#define MB_FUNC_ERROR ( 128 ) +/* ----------------------- Type definitions ---------------------------------*/ + typedef enum +{ + MB_EX_NONE = 0x00, + MB_EX_ILLEGAL_FUNCTION = 0x01, + MB_EX_ILLEGAL_DATA_ADDRESS = 0x02, + MB_EX_ILLEGAL_DATA_VALUE = 0x03, + MB_EX_SLAVE_DEVICE_FAILURE = 0x04, + MB_EX_ACKNOWLEDGE = 0x05, + MB_EX_SLAVE_BUSY = 0x06, + MB_EX_MEMORY_PARITY_ERROR = 0x08, + MB_EX_GATEWAY_PATH_FAILED = 0x0A, + MB_EX_GATEWAY_TGT_FAILED = 0x0B +} eMBException; + +typedef eMBException( *pxMBFunctionHandler ) ( UCHAR * pucFrame, USHORT * pusLength ); + +typedef struct +{ + UCHAR ucFunctionCode; + pxMBFunctionHandler pxHandler; +} xMBFunctionHandler; + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/include/mbutils.h b/modbus/modbus/include/mbutils.h index 6149575..55f4334 100644 --- a/modbus/modbus/include/mbutils.h +++ b/modbus/modbus/include/mbutils.h @@ -1,108 +1,108 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbutils.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_UTILS_H -#define _MB_UTILS_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif -/*! \defgroup modbus_utils Utilities - * - * This module contains some utility functions which can be used by - * the application. It includes some special functions for working with - * bitfields backed by a character array buffer. - * - */ -/*! \addtogroup modbus_utils - * @{ - */ -/*! \brief Function to set bits in a byte buffer. - * - * This function allows the efficient use of an array to implement bitfields. - * The array used for storing the bits must always be a multiple of two - * bytes. Up to eight bits can be set or cleared in one operation. - * - * \param ucByteBuf A buffer where the bit values are stored. Must be a - * multiple of 2 bytes. No length checking is performed and if - * usBitOffset / 8 is greater than the size of the buffer memory contents - * is overwritten. - * \param usBitOffset The starting address of the bits to set. The first - * bit has the offset 0. - * \param ucNBits Number of bits to modify. The value must always be smaller - * than 8. - * \param ucValues Thew new values for the bits. The value for the first bit - * starting at usBitOffset is the LSB of the value - * ucValues - * - * \code - * ucBits[2] = {0, 0}; - * - * // Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1) - * xMBUtilSetBits( ucBits, 4, 1, 1 ); - * - * // Set bit 7 to 1 and bit 8 to 0. - * xMBUtilSetBits( ucBits, 7, 2, 0x01 ); - * - * // Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A; - * xMBUtilSetBits( ucBits, 8, 8, 0x5A); - * \endcode - */ -void xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, - UCHAR ucNBits, UCHAR ucValues ); - -/*! \brief Function to read bits in a byte buffer. - * - * This function is used to extract up bit values from an array. Up to eight - * bit values can be extracted in one step. - * - * \param ucByteBuf A buffer where the bit values are stored. - * \param usBitOffset The starting address of the bits to set. The first - * bit has the offset 0. - * \param ucNBits Number of bits to modify. The value must always be smaller - * than 8. - * - * \code - * UCHAR ucBits[2] = {0, 0}; - * UCHAR ucResult; - * - * // Extract the bits 3 - 10. - * ucResult = xMBUtilGetBits( ucBits, 3, 8 ); - * \endcode - */ -UCHAR xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, - UCHAR ucNBits ); - -/*! @} */ - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbutils.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_UTILS_H +#define _MB_UTILS_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif +/*! \defgroup modbus_utils Utilities + * + * This module contains some utility functions which can be used by + * the application. It includes some special functions for working with + * bitfields backed by a character array buffer. + * + */ +/*! \addtogroup modbus_utils + * @{ + */ +/*! \brief Function to set bits in a byte buffer. + * + * This function allows the efficient use of an array to implement bitfields. + * The array used for storing the bits must always be a multiple of two + * bytes. Up to eight bits can be set or cleared in one operation. + * + * \param ucByteBuf A buffer where the bit values are stored. Must be a + * multiple of 2 bytes. No length checking is performed and if + * usBitOffset / 8 is greater than the size of the buffer memory contents + * is overwritten. + * \param usBitOffset The starting address of the bits to set. The first + * bit has the offset 0. + * \param ucNBits Number of bits to modify. The value must always be smaller + * than 8. + * \param ucValues Thew new values for the bits. The value for the first bit + * starting at usBitOffset is the LSB of the value + * ucValues + * + * \code + * ucBits[2] = {0, 0}; + * + * // Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1) + * xMBUtilSetBits( ucBits, 4, 1, 1 ); + * + * // Set bit 7 to 1 and bit 8 to 0. + * xMBUtilSetBits( ucBits, 7, 2, 0x01 ); + * + * // Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A; + * xMBUtilSetBits( ucBits, 8, 8, 0x5A); + * \endcode + */ +void xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, + UCHAR ucNBits, UCHAR ucValues ); + +/*! \brief Function to read bits in a byte buffer. + * + * This function is used to extract up bit values from an array. Up to eight + * bit values can be extracted in one step. + * + * \param ucByteBuf A buffer where the bit values are stored. + * \param usBitOffset The starting address of the bits to set. The first + * bit has the offset 0. + * \param ucNBits Number of bits to modify. The value must always be smaller + * than 8. + * + * \code + * UCHAR ucBits[2] = {0, 0}; + * UCHAR ucResult; + * + * // Extract the bits 3 - 10. + * ucResult = xMBUtilGetBits( ucBits, 3, 8 ); + * \endcode + */ +UCHAR xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, + UCHAR ucNBits ); + +/*! @} */ + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/mb.c b/modbus/modbus/mb.c index ea06ddb..9d607b5 100644 --- a/modbus/modbus/mb.c +++ b/modbus/modbus/mb.c @@ -1,413 +1,413 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mb.c,v 1.28 2010/06/06 13:54:40 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbconfig.h" -#include "mbframe.h" -#include "mbproto.h" -#include "mbfunc.h" - -#include "mbport.h" -#if MB_RTU_ENABLED == 1 -#include "mbrtu.h" -#endif -#if MB_ASCII_ENABLED == 1 -#include "mbascii.h" -#endif -#if MB_TCP_ENABLED == 1 -#include "mbtcp.h" -#endif - -#ifndef MB_PORT_HAS_CLOSE -#define MB_PORT_HAS_CLOSE 0 -#endif - -/* ----------------------- Static variables ---------------------------------*/ - -static UCHAR ucMBAddress; -static eMBMode eMBCurrentMode; - -static enum -{ - STATE_ENABLED, - STATE_DISABLED, - STATE_NOT_INITIALIZED -} eMBState = STATE_NOT_INITIALIZED; - -/* Functions pointer which are initialized in eMBInit( ). Depending on the - * mode (RTU or ASCII) the are set to the correct implementations. - */ -static peMBFrameSend peMBFrameSendCur; -static pvMBFrameStart pvMBFrameStartCur; -static pvMBFrameStop pvMBFrameStopCur; -static peMBFrameReceive peMBFrameReceiveCur; -static pvMBFrameClose pvMBFrameCloseCur; - -/* Callback functions required by the porting layer. They are called when - * an external event has happend which includes a timeout or the reception - * or transmission of a character. - */ -BOOL( *pxMBFrameCBByteReceived ) ( void ); -BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); -BOOL( *pxMBPortCBTimerExpired ) ( void ); - -BOOL( *pxMBFrameCBReceiveFSMCur ) ( void ); -BOOL( *pxMBFrameCBTransmitFSMCur ) ( void ); - -/* An array of Modbus functions handlers which associates Modbus function - * codes with implementing functions. - */ -static xMBFunctionHandler xFuncHandlers[MB_FUNC_HANDLERS_MAX] = { -#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0 - {MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID}, -#endif -#if MB_FUNC_READ_INPUT_ENABLED > 0 - {MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister}, -#endif -#if MB_FUNC_READ_HOLDING_ENABLED > 0 - {MB_FUNC_READ_HOLDING_REGISTER, eMBFuncReadHoldingRegister}, -#endif -#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 - {MB_FUNC_WRITE_MULTIPLE_REGISTERS, eMBFuncWriteMultipleHoldingRegister}, -#endif -#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 - {MB_FUNC_WRITE_REGISTER, eMBFuncWriteHoldingRegister}, -#endif -#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 - {MB_FUNC_READWRITE_MULTIPLE_REGISTERS, eMBFuncReadWriteMultipleHoldingRegister}, -#endif -#if MB_FUNC_READ_COILS_ENABLED > 0 - {MB_FUNC_READ_COILS, eMBFuncReadCoils}, -#endif -#if MB_FUNC_WRITE_COIL_ENABLED > 0 - {MB_FUNC_WRITE_SINGLE_COIL, eMBFuncWriteCoil}, -#endif -#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 - {MB_FUNC_WRITE_MULTIPLE_COILS, eMBFuncWriteMultipleCoils}, -#endif -#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0 - {MB_FUNC_READ_DISCRETE_INPUTS, eMBFuncReadDiscreteInputs}, -#endif -}; - -/* ----------------------- Start implementation -----------------------------*/ -eMBErrorCode -eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - /* check preconditions */ - if( ( ucSlaveAddress == MB_ADDRESS_BROADCAST ) || - ( ucSlaveAddress < MB_ADDRESS_MIN ) || ( ucSlaveAddress > MB_ADDRESS_MAX ) ) - { - eStatus = MB_EINVAL; - } - else - { - ucMBAddress = ucSlaveAddress; - - switch ( eMode ) - { -#if MB_RTU_ENABLED > 0 - case MB_RTU: - pvMBFrameStartCur = eMBRTUStart; - pvMBFrameStopCur = eMBRTUStop; - peMBFrameSendCur = eMBRTUSend; - peMBFrameReceiveCur = eMBRTUReceive; - pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; - pxMBFrameCBByteReceived = xMBRTUReceiveFSM; - pxMBFrameCBTransmitterEmpty = xMBRTUTransmitFSM; - pxMBPortCBTimerExpired = xMBRTUTimerT35Expired; - - eStatus = eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity ); - break; -#endif -#if MB_ASCII_ENABLED > 0 - case MB_ASCII: - pvMBFrameStartCur = eMBASCIIStart; - pvMBFrameStopCur = eMBASCIIStop; - peMBFrameSendCur = eMBASCIISend; - peMBFrameReceiveCur = eMBASCIIReceive; - pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; - pxMBFrameCBByteReceived = xMBASCIIReceiveFSM; - pxMBFrameCBTransmitterEmpty = xMBASCIITransmitFSM; - pxMBPortCBTimerExpired = xMBASCIITimerT1SExpired; - - eStatus = eMBASCIIInit( ucMBAddress, ucPort, ulBaudRate, eParity ); - break; -#endif - default: - eStatus = MB_EINVAL; - } - - if( eStatus == MB_ENOERR ) - { - if( !xMBPortEventInit( ) ) - { - /* port dependent event module initalization failed. */ - eStatus = MB_EPORTERR; - } - else - { - eMBCurrentMode = eMode; - eMBState = STATE_DISABLED; - } - } - } - return eStatus; -} - -#if MB_TCP_ENABLED > 0 -eMBErrorCode -eMBTCPInit( USHORT ucTCPPort ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - if( ( eStatus = eMBTCPDoInit( ucTCPPort ) ) != MB_ENOERR ) - { - eMBState = STATE_DISABLED; - } - else if( !xMBPortEventInit( ) ) - { - - /* Port dependent event module initalization failed. */ - eStatus = MB_EPORTERR; - } - else - { - pvMBFrameStartCur = eMBTCPStart; - pvMBFrameStopCur = eMBTCPStop; - peMBFrameReceiveCur = eMBTCPReceive; - peMBFrameSendCur = eMBTCPSend; - pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBTCPPortClose : NULL; - ucMBAddress = MB_TCP_PSEUDO_ADDRESS; - eMBCurrentMode = MB_TCP; - eMBState = STATE_DISABLED; - } - return eStatus; -} -#endif - -eMBErrorCode -eMBRegisterCB( UCHAR ucFunctionCode, pxMBFunctionHandler pxHandler ) -{ - int i; - eMBErrorCode eStatus; - - if( ( 0 < ucFunctionCode ) && ( ucFunctionCode <= 127 ) ) - { - ENTER_CRITICAL_SECTION( ); - if( pxHandler != NULL ) - { - for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) - { - if( ( xFuncHandlers[i].pxHandler == NULL ) || - ( xFuncHandlers[i].pxHandler == pxHandler ) ) - { - xFuncHandlers[i].ucFunctionCode = ucFunctionCode; - xFuncHandlers[i].pxHandler = pxHandler; - break; - } - } - eStatus = ( i != MB_FUNC_HANDLERS_MAX ) ? MB_ENOERR : MB_ENORES; - } - else - { - for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) - { - if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode ) - { - xFuncHandlers[i].ucFunctionCode = 0; - xFuncHandlers[i].pxHandler = NULL; - break; - } - } - /* Remove can't fail. */ - eStatus = MB_ENOERR; - } - EXIT_CRITICAL_SECTION( ); - } - else - { - eStatus = MB_EINVAL; - } - return eStatus; -} - - -eMBErrorCode -eMBClose( void ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - if( eMBState == STATE_DISABLED ) - { - if( pvMBFrameCloseCur != NULL ) - { - pvMBFrameCloseCur( ); - } - } - else - { - eStatus = MB_EILLSTATE; - } - return eStatus; -} - -eMBErrorCode -eMBEnable( void ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - if( eMBState == STATE_DISABLED ) - { - /* Activate the protocol stack. */ - pvMBFrameStartCur( ); - eMBState = STATE_ENABLED; - } - else - { - eStatus = MB_EILLSTATE; - } - return eStatus; -} - -eMBErrorCode -eMBDisable( void ) -{ - eMBErrorCode eStatus; - - if( eMBState == STATE_ENABLED ) - { - pvMBFrameStopCur( ); - eMBState = STATE_DISABLED; - eStatus = MB_ENOERR; - } - else if( eMBState == STATE_DISABLED ) - { - eStatus = MB_ENOERR; - } - else - { - eStatus = MB_EILLSTATE; - } - return eStatus; -} - -eMBErrorCode -eMBPoll( void ) -{ - static UCHAR *ucMBFrame; - static UCHAR ucRcvAddress; - static UCHAR ucFunctionCode; - static USHORT usLength; - static eMBException eException; - - int i; - eMBErrorCode eStatus = MB_ENOERR; - eMBEventType eEvent; - - /* Check if the protocol stack is ready. */ - if( eMBState != STATE_ENABLED ) - { - return MB_EILLSTATE; - } - - /* Check if there is a event available. If not return control to caller. - * Otherwise we will handle the event. */ - if( xMBPortEventGet( &eEvent ) == TRUE ) - { - switch ( eEvent ) - { - case EV_READY: - break; - - case EV_FRAME_RECEIVED: - eStatus = peMBFrameReceiveCur( &ucRcvAddress, &ucMBFrame, &usLength ); - if( eStatus == MB_ENOERR ) - { - /* Check if the frame is for us. If not ignore the frame. */ - if( ( ucRcvAddress == ucMBAddress ) || ( ucRcvAddress == MB_ADDRESS_BROADCAST ) ) - { - ( void )xMBPortEventPost( EV_EXECUTE ); - } - } - break; - - case EV_EXECUTE: - ucFunctionCode = ucMBFrame[MB_PDU_FUNC_OFF]; - eException = MB_EX_ILLEGAL_FUNCTION; - for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) - { - /* No more function handlers registered. Abort. */ - if( xFuncHandlers[i].ucFunctionCode == 0 ) - { - break; - } - else if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode ) - { - eException = xFuncHandlers[i].pxHandler( ucMBFrame, &usLength ); - break; - } - } - - /* If the request was not sent to the broadcast address we - * return a reply. */ - if( ucRcvAddress != MB_ADDRESS_BROADCAST ) - { - if( eException != MB_EX_NONE ) - { - /* An exception occured. Build an error frame. */ - usLength = 0; - ucMBFrame[usLength++] = ( UCHAR )( ucFunctionCode | MB_FUNC_ERROR ); - ucMBFrame[usLength++] = eException; - } - if( ( eMBCurrentMode == MB_ASCII ) && MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ) - { - vMBPortTimersDelay( MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ); - } - eStatus = peMBFrameSendCur( ucMBAddress, ucMBFrame, usLength ); - } - break; - - case EV_FRAME_SENT: - break; - } - } - return MB_ENOERR; -} +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mb.c,v 1.28 2010/06/06 13:54:40 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbconfig.h" +#include "mbframe.h" +#include "mbproto.h" +#include "mbfunc.h" + +#include "mbport.h" +#if MB_RTU_ENABLED == 1 +#include "mbrtu.h" +#endif +#if MB_ASCII_ENABLED == 1 +#include "mbascii.h" +#endif +#if MB_TCP_ENABLED == 1 +#include "mbtcp.h" +#endif + +#ifndef MB_PORT_HAS_CLOSE +#define MB_PORT_HAS_CLOSE 0 +#endif + +/* ----------------------- Static variables ---------------------------------*/ + +static UCHAR ucMBAddress; +static eMBMode eMBCurrentMode; + +static enum +{ + STATE_ENABLED, + STATE_DISABLED, + STATE_NOT_INITIALIZED +} eMBState = STATE_NOT_INITIALIZED; + +/* Functions pointer which are initialized in eMBInit( ). Depending on the + * mode (RTU or ASCII) the are set to the correct implementations. + */ +static peMBFrameSend peMBFrameSendCur; +static pvMBFrameStart pvMBFrameStartCur; +static pvMBFrameStop pvMBFrameStopCur; +static peMBFrameReceive peMBFrameReceiveCur; +static pvMBFrameClose pvMBFrameCloseCur; + +/* Callback functions required by the porting layer. They are called when + * an external event has happend which includes a timeout or the reception + * or transmission of a character. + */ +BOOL( *pxMBFrameCBByteReceived ) ( void ); +BOOL( *pxMBFrameCBTransmitterEmpty ) ( void ); +BOOL( *pxMBPortCBTimerExpired ) ( void ); + +BOOL( *pxMBFrameCBReceiveFSMCur ) ( void ); +BOOL( *pxMBFrameCBTransmitFSMCur ) ( void ); + +/* An array of Modbus functions handlers which associates Modbus function + * codes with implementing functions. + */ +static xMBFunctionHandler xFuncHandlers[MB_FUNC_HANDLERS_MAX] = { +#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0 + {MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID}, +#endif +#if MB_FUNC_READ_INPUT_ENABLED > 0 + {MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister}, +#endif +#if MB_FUNC_READ_HOLDING_ENABLED > 0 + {MB_FUNC_READ_HOLDING_REGISTER, eMBFuncReadHoldingRegister}, +#endif +#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0 + {MB_FUNC_WRITE_MULTIPLE_REGISTERS, eMBFuncWriteMultipleHoldingRegister}, +#endif +#if MB_FUNC_WRITE_HOLDING_ENABLED > 0 + {MB_FUNC_WRITE_REGISTER, eMBFuncWriteHoldingRegister}, +#endif +#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0 + {MB_FUNC_READWRITE_MULTIPLE_REGISTERS, eMBFuncReadWriteMultipleHoldingRegister}, +#endif +#if MB_FUNC_READ_COILS_ENABLED > 0 + {MB_FUNC_READ_COILS, eMBFuncReadCoils}, +#endif +#if MB_FUNC_WRITE_COIL_ENABLED > 0 + {MB_FUNC_WRITE_SINGLE_COIL, eMBFuncWriteCoil}, +#endif +#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0 + {MB_FUNC_WRITE_MULTIPLE_COILS, eMBFuncWriteMultipleCoils}, +#endif +#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0 + {MB_FUNC_READ_DISCRETE_INPUTS, eMBFuncReadDiscreteInputs}, +#endif +}; + +/* ----------------------- Start implementation -----------------------------*/ +eMBErrorCode +eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + /* check preconditions */ + if( ( ucSlaveAddress == MB_ADDRESS_BROADCAST ) || + ( ucSlaveAddress < MB_ADDRESS_MIN ) || ( ucSlaveAddress > MB_ADDRESS_MAX ) ) + { + eStatus = MB_EINVAL; + } + else + { + ucMBAddress = ucSlaveAddress; + + switch ( eMode ) + { +#if MB_RTU_ENABLED > 0 + case MB_RTU: + pvMBFrameStartCur = eMBRTUStart; + pvMBFrameStopCur = eMBRTUStop; + peMBFrameSendCur = eMBRTUSend; + peMBFrameReceiveCur = eMBRTUReceive; + pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; + pxMBFrameCBByteReceived = xMBRTUReceiveFSM; + pxMBFrameCBTransmitterEmpty = xMBRTUTransmitFSM; + pxMBPortCBTimerExpired = xMBRTUTimerT35Expired; + + eStatus = eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity ); + break; +#endif +#if MB_ASCII_ENABLED > 0 + case MB_ASCII: + pvMBFrameStartCur = eMBASCIIStart; + pvMBFrameStopCur = eMBASCIIStop; + peMBFrameSendCur = eMBASCIISend; + peMBFrameReceiveCur = eMBASCIIReceive; + pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL; + pxMBFrameCBByteReceived = xMBASCIIReceiveFSM; + pxMBFrameCBTransmitterEmpty = xMBASCIITransmitFSM; + pxMBPortCBTimerExpired = xMBASCIITimerT1SExpired; + + eStatus = eMBASCIIInit( ucMBAddress, ucPort, ulBaudRate, eParity ); + break; +#endif + default: + eStatus = MB_EINVAL; + } + + if( eStatus == MB_ENOERR ) + { + if( !xMBPortEventInit( ) ) + { + /* port dependent event module initalization failed. */ + eStatus = MB_EPORTERR; + } + else + { + eMBCurrentMode = eMode; + eMBState = STATE_DISABLED; + } + } + } + return eStatus; +} + +#if MB_TCP_ENABLED > 0 +eMBErrorCode +eMBTCPInit( USHORT ucTCPPort ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + if( ( eStatus = eMBTCPDoInit( ucTCPPort ) ) != MB_ENOERR ) + { + eMBState = STATE_DISABLED; + } + else if( !xMBPortEventInit( ) ) + { + + /* Port dependent event module initalization failed. */ + eStatus = MB_EPORTERR; + } + else + { + pvMBFrameStartCur = eMBTCPStart; + pvMBFrameStopCur = eMBTCPStop; + peMBFrameReceiveCur = eMBTCPReceive; + peMBFrameSendCur = eMBTCPSend; + pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBTCPPortClose : NULL; + ucMBAddress = MB_TCP_PSEUDO_ADDRESS; + eMBCurrentMode = MB_TCP; + eMBState = STATE_DISABLED; + } + return eStatus; +} +#endif + +eMBErrorCode +eMBRegisterCB( UCHAR ucFunctionCode, pxMBFunctionHandler pxHandler ) +{ + int i; + eMBErrorCode eStatus; + + if( ( 0 < ucFunctionCode ) && ( ucFunctionCode <= 127 ) ) + { + ENTER_CRITICAL_SECTION( ); + if( pxHandler != NULL ) + { + for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) + { + if( ( xFuncHandlers[i].pxHandler == NULL ) || + ( xFuncHandlers[i].pxHandler == pxHandler ) ) + { + xFuncHandlers[i].ucFunctionCode = ucFunctionCode; + xFuncHandlers[i].pxHandler = pxHandler; + break; + } + } + eStatus = ( i != MB_FUNC_HANDLERS_MAX ) ? MB_ENOERR : MB_ENORES; + } + else + { + for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) + { + if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode ) + { + xFuncHandlers[i].ucFunctionCode = 0; + xFuncHandlers[i].pxHandler = NULL; + break; + } + } + /* Remove can't fail. */ + eStatus = MB_ENOERR; + } + EXIT_CRITICAL_SECTION( ); + } + else + { + eStatus = MB_EINVAL; + } + return eStatus; +} + + +eMBErrorCode +eMBClose( void ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + if( eMBState == STATE_DISABLED ) + { + if( pvMBFrameCloseCur != NULL ) + { + pvMBFrameCloseCur( ); + } + } + else + { + eStatus = MB_EILLSTATE; + } + return eStatus; +} + +eMBErrorCode +eMBEnable( void ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + if( eMBState == STATE_DISABLED ) + { + /* Activate the protocol stack. */ + pvMBFrameStartCur( ); + eMBState = STATE_ENABLED; + } + else + { + eStatus = MB_EILLSTATE; + } + return eStatus; +} + +eMBErrorCode +eMBDisable( void ) +{ + eMBErrorCode eStatus; + + if( eMBState == STATE_ENABLED ) + { + pvMBFrameStopCur( ); + eMBState = STATE_DISABLED; + eStatus = MB_ENOERR; + } + else if( eMBState == STATE_DISABLED ) + { + eStatus = MB_ENOERR; + } + else + { + eStatus = MB_EILLSTATE; + } + return eStatus; +} + +eMBErrorCode +eMBPoll( void ) +{ + static UCHAR *ucMBFrame; + static UCHAR ucRcvAddress; + static UCHAR ucFunctionCode; + static USHORT usLength; + static eMBException eException; + + int i; + eMBErrorCode eStatus = MB_ENOERR; + eMBEventType eEvent; + + /* Check if the protocol stack is ready. */ + if( eMBState != STATE_ENABLED ) + { + return MB_EILLSTATE; + } + + /* Check if there is a event available. If not return control to caller. + * Otherwise we will handle the event. */ + if( xMBPortEventGet( &eEvent ) == TRUE ) + { + switch ( eEvent ) + { + case EV_READY: + break; + + case EV_FRAME_RECEIVED: + eStatus = peMBFrameReceiveCur( &ucRcvAddress, &ucMBFrame, &usLength ); + if( eStatus == MB_ENOERR ) + { + /* Check if the frame is for us. If not ignore the frame. */ + if( ( ucRcvAddress == ucMBAddress ) || ( ucRcvAddress == MB_ADDRESS_BROADCAST ) ) + { + ( void )xMBPortEventPost( EV_EXECUTE ); + } + } + break; + + case EV_EXECUTE: + ucFunctionCode = ucMBFrame[MB_PDU_FUNC_OFF]; + eException = MB_EX_ILLEGAL_FUNCTION; + for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ ) + { + /* No more function handlers registered. Abort. */ + if( xFuncHandlers[i].ucFunctionCode == 0 ) + { + break; + } + else if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode ) + { + eException = xFuncHandlers[i].pxHandler( ucMBFrame, &usLength ); + break; + } + } + + /* If the request was not sent to the broadcast address we + * return a reply. */ + if( ucRcvAddress != MB_ADDRESS_BROADCAST ) + { + if( eException != MB_EX_NONE ) + { + /* An exception occured. Build an error frame. */ + usLength = 0; + ucMBFrame[usLength++] = ( UCHAR )( ucFunctionCode | MB_FUNC_ERROR ); + ucMBFrame[usLength++] = eException; + } + if( ( eMBCurrentMode == MB_ASCII ) && MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ) + { + vMBPortTimersDelay( MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS ); + } + eStatus = peMBFrameSendCur( ucMBAddress, ucMBFrame, usLength ); + } + break; + + case EV_FRAME_SENT: + break; + } + } + return MB_ENOERR; +} diff --git a/modbus/modbus/rtu/mbcrc.c b/modbus/modbus/rtu/mbcrc.c index 29b9ea7..6b1a683 100644 --- a/modbus/modbus/rtu/mbcrc.c +++ b/modbus/modbus/rtu/mbcrc.c @@ -1,98 +1,98 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbcrc.c,v 1.7 2007/02/18 23:50:27 wolti Exp $ - */ - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -static const UCHAR aucCRCHi[] = { - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40 -}; - -static const UCHAR aucCRCLo[] = { - 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, - 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, - 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, - 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, - 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, - 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, - 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, - 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, - 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, - 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, - 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, - 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, - 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, - 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, - 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, - 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, - 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, - 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, - 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, - 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, - 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, - 0x41, 0x81, 0x80, 0x40 -}; - -USHORT -usMBCRC16( UCHAR * pucFrame, USHORT usLen ) -{ - UCHAR ucCRCHi = 0xFF; - UCHAR ucCRCLo = 0xFF; - int iIndex; - - while( usLen-- ) - { - iIndex = ucCRCLo ^ *( pucFrame++ ); - ucCRCLo = ( UCHAR )( ucCRCHi ^ aucCRCHi[iIndex] ); - ucCRCHi = aucCRCLo[iIndex]; - } - return ( USHORT )( ucCRCHi << 8 | ucCRCLo ); -} +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbcrc.c,v 1.7 2007/02/18 23:50:27 wolti Exp $ + */ + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +static const UCHAR aucCRCHi[] = { + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40 +}; + +static const UCHAR aucCRCLo[] = { + 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, + 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, + 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, + 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, + 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, + 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, + 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, + 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, + 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, + 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, + 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, + 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, + 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, + 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, + 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, + 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, + 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, + 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, + 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, + 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, + 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, + 0x41, 0x81, 0x80, 0x40 +}; + +USHORT +usMBCRC16( UCHAR * pucFrame, USHORT usLen ) +{ + UCHAR ucCRCHi = 0xFF; + UCHAR ucCRCLo = 0xFF; + int iIndex; + + while( usLen-- ) + { + iIndex = ucCRCLo ^ *( pucFrame++ ); + ucCRCLo = ( UCHAR )( ucCRCHi ^ aucCRCHi[iIndex] ); + ucCRCHi = aucCRCLo[iIndex]; + } + return ( USHORT )( ucCRCHi << 8 | ucCRCLo ); +} diff --git a/modbus/modbus/rtu/mbcrc.h b/modbus/modbus/rtu/mbcrc.h index db22776..733503a 100644 --- a/modbus/modbus/rtu/mbcrc.h +++ b/modbus/modbus/rtu/mbcrc.h @@ -1,36 +1,36 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbcrc.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_CRC_H -#define _MB_CRC_H - -USHORT usMBCRC16( UCHAR * pucFrame, USHORT usLen ); - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbcrc.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_CRC_H +#define _MB_CRC_H + +USHORT usMBCRC16( UCHAR * pucFrame, USHORT usLen ); + +#endif diff --git a/modbus/modbus/rtu/mbrtu.c b/modbus/modbus/rtu/mbrtu.c index fc9b854..0ba2d9f 100644 --- a/modbus/modbus/rtu/mbrtu.c +++ b/modbus/modbus/rtu/mbrtu.c @@ -1,355 +1,355 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbrtu.c,v 1.18 2007/09/12 10:15:56 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbrtu.h" -#include "mbframe.h" - -#include "mbcrc.h" -#include "mbport.h" - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_SER_PDU_SIZE_MIN 4 /*!< Minimum size of a Modbus RTU frame. */ -#define MB_SER_PDU_SIZE_MAX 256 /*!< Maximum size of a Modbus RTU frame. */ -#define MB_SER_PDU_SIZE_CRC 2 /*!< Size of CRC field in PDU. */ -#define MB_SER_PDU_ADDR_OFF 0 /*!< Offset of slave address in Ser-PDU. */ -#define MB_SER_PDU_PDU_OFF 1 /*!< Offset of Modbus-PDU in Ser-PDU. */ - -/* ----------------------- Type definitions ---------------------------------*/ -typedef enum -{ - STATE_RX_INIT, /*!< Receiver is in initial state. */ - STATE_RX_IDLE, /*!< Receiver is in idle state. */ - STATE_RX_RCV, /*!< Frame is beeing received. */ - STATE_RX_ERROR /*!< If the frame is invalid. */ -} eMBRcvState; - -typedef enum -{ - STATE_TX_IDLE, /*!< Transmitter is in idle state. */ - STATE_TX_XMIT /*!< Transmitter is in transfer state. */ -} eMBSndState; - -/* ----------------------- Static variables ---------------------------------*/ -static volatile eMBSndState eSndState; -static volatile eMBRcvState eRcvState; - -volatile UCHAR ucRTUBuf[MB_SER_PDU_SIZE_MAX]; - -static volatile UCHAR *pucSndBufferCur; -static volatile USHORT usSndBufferCount; - -static volatile USHORT usRcvBufferPos; - -/* ----------------------- Start implementation -----------------------------*/ -eMBErrorCode -eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) -{ - eMBErrorCode eStatus = MB_ENOERR; - ULONG usTimerT35_50us; - - ( void )ucSlaveAddress; - ENTER_CRITICAL_SECTION( ); - - /* Modbus RTU uses 8 Databits. */ - if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE ) - { - eStatus = MB_EPORTERR; - } - else - { - /* If baudrate > 19200 then we should use the fixed timer values - * t35 = 1750us. Otherwise t35 must be 3.5 times the character time. - */ - if( ulBaudRate > 19200 ) - { - usTimerT35_50us = 35; /* 1800us. */ - } - else - { - /* The timer reload value for a character is given by: - * - * ChTimeValue = Ticks_per_1s / ( Baudrate / 11 ) - * = 11 * Ticks_per_1s / Baudrate - * = 220000 / Baudrate - * The reload for t3.5 is 1.5 times this value and similary - * for t3.5. - */ - usTimerT35_50us = ( 7UL * 220000UL ) / ( 2UL * ulBaudRate ); - } - if( xMBPortTimersInit( ( USHORT ) usTimerT35_50us ) != TRUE ) - { - eStatus = MB_EPORTERR; - } - } - EXIT_CRITICAL_SECTION( ); - - return eStatus; -} - -void -eMBRTUStart( void ) -{ - ENTER_CRITICAL_SECTION( ); - /* Initially the receiver is in the state STATE_RX_INIT. we start - * the timer and if no character is received within t3.5 we change - * to STATE_RX_IDLE. This makes sure that we delay startup of the - * modbus protocol stack until the bus is free. - */ - eRcvState = STATE_RX_INIT; - vMBPortSerialEnable( TRUE, FALSE ); - vMBPortTimersEnable( ); - - EXIT_CRITICAL_SECTION( ); -} - -void -eMBRTUStop( void ) -{ - ENTER_CRITICAL_SECTION( ); - vMBPortSerialEnable( FALSE, FALSE ); - vMBPortTimersDisable( ); - EXIT_CRITICAL_SECTION( ); -} - -eMBErrorCode -eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) -{ - BOOL xFrameReceived = FALSE; - eMBErrorCode eStatus = MB_ENOERR; - - ENTER_CRITICAL_SECTION( ); - assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); - - /* Length and CRC check */ - if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) - && ( usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) == 0 ) ) - { - /* Save the address field. All frames are passed to the upper layed - * and the decision if a frame is used is done there. - */ - *pucRcvAddress = ucRTUBuf[MB_SER_PDU_ADDR_OFF]; - - /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus - * size of address field and CRC checksum. - */ - *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC ); - - /* Return the start of the Modbus PDU to the caller. */ - *pucFrame = ( UCHAR * ) & ucRTUBuf[MB_SER_PDU_PDU_OFF]; - xFrameReceived = TRUE; - } - else - { - eStatus = MB_EIO; - } - - EXIT_CRITICAL_SECTION( ); - return eStatus; -} - -eMBErrorCode -eMBRTUSend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength ) -{ - eMBErrorCode eStatus = MB_ENOERR; - USHORT usCRC16; - - ENTER_CRITICAL_SECTION( ); - - /* Check if the receiver is still in idle state. If not we where to - * slow with processing the received frame and the master sent another - * frame on the network. We have to abort sending the frame. - */ - if( eRcvState == STATE_RX_IDLE ) - { - /* First byte before the Modbus-PDU is the slave address. */ - pucSndBufferCur = ( UCHAR * ) pucFrame - 1; - usSndBufferCount = 1; - - /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */ - pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress; - usSndBufferCount += usLength; - - /* Calculate CRC16 checksum for Modbus-Serial-Line-PDU. */ - usCRC16 = usMBCRC16( ( UCHAR * ) pucSndBufferCur, usSndBufferCount ); - ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 & 0xFF ); - ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 >> 8 ); - - /* Activate the transmitter. */ - eSndState = STATE_TX_XMIT; - vMBPortSerialEnable( FALSE, TRUE ); - } - else - { - eStatus = MB_EIO; - } - EXIT_CRITICAL_SECTION( ); - return eStatus; -} - -BOOL -xMBRTUReceiveFSM( void ) -{ - BOOL xTaskNeedSwitch = FALSE; - UCHAR ucByte; - - assert( eSndState == STATE_TX_IDLE ); - - /* Always read the character. */ - ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte ); - - switch ( eRcvState ) - { - /* If we have received a character in the init state we have to - * wait until the frame is finished. - */ - case STATE_RX_INIT: - vMBPortTimersEnable( ); - break; - - /* In the error state we wait until all characters in the - * damaged frame are transmitted. - */ - case STATE_RX_ERROR: - vMBPortTimersEnable( ); - break; - - /* In the idle state we wait for a new character. If a character - * is received the t1.5 and t3.5 timers are started and the - * receiver is in the state STATE_RX_RECEIVCE. - */ - case STATE_RX_IDLE: - usRcvBufferPos = 0; - ucRTUBuf[usRcvBufferPos++] = ucByte; - eRcvState = STATE_RX_RCV; - - /* Enable t3.5 timers. */ - vMBPortTimersEnable( ); - break; - - /* We are currently receiving a frame. Reset the timer after - * every character received. If more than the maximum possible - * number of bytes in a modbus frame is received the frame is - * ignored. - */ - case STATE_RX_RCV: - if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ) - { - ucRTUBuf[usRcvBufferPos++] = ucByte; - } - else - { - eRcvState = STATE_RX_ERROR; - } - vMBPortTimersEnable( ); - break; - } - return xTaskNeedSwitch; -} - -BOOL -xMBRTUTransmitFSM( void ) -{ - BOOL xNeedPoll = FALSE; - - assert( eRcvState == STATE_RX_IDLE ); - - switch ( eSndState ) - { - /* We should not get a transmitter event if the transmitter is in - * idle state. */ - case STATE_TX_IDLE: - /* enable receiver/disable transmitter. */ - vMBPortSerialEnable( TRUE, FALSE ); - break; - - case STATE_TX_XMIT: - /* check if we are finished. */ - if( usSndBufferCount != 0 ) - { - xMBPortSerialPutByte( ( CHAR )*pucSndBufferCur ); - pucSndBufferCur++; /* next byte in sendbuffer. */ - usSndBufferCount--; - } - else - { - xNeedPoll = xMBPortEventPost( EV_FRAME_SENT ); - /* Disable transmitter. This prevents another transmit buffer - * empty interrupt. */ - vMBPortSerialEnable( TRUE, FALSE ); - eSndState = STATE_TX_IDLE; - } - break; - } - - return xNeedPoll; -} - -BOOL -xMBRTUTimerT35Expired( void ) -{ - BOOL xNeedPoll = FALSE; - - switch ( eRcvState ) - { - /* Timer t35 expired. Startup phase is finished. */ - case STATE_RX_INIT: - xNeedPoll = xMBPortEventPost( EV_READY ); - break; - - /* A frame was received and t35 expired. Notify the listener that - * a new frame was received. */ - case STATE_RX_RCV: - xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED ); - break; - - /* An error occured while receiving the frame. */ - case STATE_RX_ERROR: - break; - - /* Function called in an illegal state. */ - default: - assert( ( eRcvState == STATE_RX_INIT ) || - ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_ERROR ) ); - } - - vMBPortTimersDisable( ); - eRcvState = STATE_RX_IDLE; - - return xNeedPoll; -} +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbrtu.c,v 1.18 2007/09/12 10:15:56 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbrtu.h" +#include "mbframe.h" + +#include "mbcrc.h" +#include "mbport.h" + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_SER_PDU_SIZE_MIN 4 /*!< Minimum size of a Modbus RTU frame. */ +#define MB_SER_PDU_SIZE_MAX 256 /*!< Maximum size of a Modbus RTU frame. */ +#define MB_SER_PDU_SIZE_CRC 2 /*!< Size of CRC field in PDU. */ +#define MB_SER_PDU_ADDR_OFF 0 /*!< Offset of slave address in Ser-PDU. */ +#define MB_SER_PDU_PDU_OFF 1 /*!< Offset of Modbus-PDU in Ser-PDU. */ + +/* ----------------------- Type definitions ---------------------------------*/ +typedef enum +{ + STATE_RX_INIT, /*!< Receiver is in initial state. */ + STATE_RX_IDLE, /*!< Receiver is in idle state. */ + STATE_RX_RCV, /*!< Frame is beeing received. */ + STATE_RX_ERROR /*!< If the frame is invalid. */ +} eMBRcvState; + +typedef enum +{ + STATE_TX_IDLE, /*!< Transmitter is in idle state. */ + STATE_TX_XMIT /*!< Transmitter is in transfer state. */ +} eMBSndState; + +/* ----------------------- Static variables ---------------------------------*/ +static volatile eMBSndState eSndState; +static volatile eMBRcvState eRcvState; + +volatile UCHAR ucRTUBuf[MB_SER_PDU_SIZE_MAX]; + +static volatile UCHAR *pucSndBufferCur; +static volatile USHORT usSndBufferCount; + +static volatile USHORT usRcvBufferPos; + +/* ----------------------- Start implementation -----------------------------*/ +eMBErrorCode +eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity ) +{ + eMBErrorCode eStatus = MB_ENOERR; + ULONG usTimerT35_50us; + + ( void )ucSlaveAddress; + ENTER_CRITICAL_SECTION( ); + + /* Modbus RTU uses 8 Databits. */ + if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE ) + { + eStatus = MB_EPORTERR; + } + else + { + /* If baudrate > 19200 then we should use the fixed timer values + * t35 = 1750us. Otherwise t35 must be 3.5 times the character time. + */ + if( ulBaudRate > 19200 ) + { + usTimerT35_50us = 35; /* 1800us. */ + } + else + { + /* The timer reload value for a character is given by: + * + * ChTimeValue = Ticks_per_1s / ( Baudrate / 11 ) + * = 11 * Ticks_per_1s / Baudrate + * = 220000 / Baudrate + * The reload for t3.5 is 1.5 times this value and similary + * for t3.5. + */ + usTimerT35_50us = ( 7UL * 220000UL ) / ( 2UL * ulBaudRate ); + } + if( xMBPortTimersInit( ( USHORT ) usTimerT35_50us ) != TRUE ) + { + eStatus = MB_EPORTERR; + } + } + EXIT_CRITICAL_SECTION( ); + + return eStatus; +} + +void +eMBRTUStart( void ) +{ + ENTER_CRITICAL_SECTION( ); + /* Initially the receiver is in the state STATE_RX_INIT. we start + * the timer and if no character is received within t3.5 we change + * to STATE_RX_IDLE. This makes sure that we delay startup of the + * modbus protocol stack until the bus is free. + */ + eRcvState = STATE_RX_INIT; + vMBPortSerialEnable( TRUE, FALSE ); + vMBPortTimersEnable( ); + + EXIT_CRITICAL_SECTION( ); +} + +void +eMBRTUStop( void ) +{ + ENTER_CRITICAL_SECTION( ); + vMBPortSerialEnable( FALSE, FALSE ); + vMBPortTimersDisable( ); + EXIT_CRITICAL_SECTION( ); +} + +eMBErrorCode +eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ) +{ + BOOL xFrameReceived = FALSE; + eMBErrorCode eStatus = MB_ENOERR; + + ENTER_CRITICAL_SECTION( ); + assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ); + + /* Length and CRC check */ + if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN ) + && ( usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) == 0 ) ) + { + /* Save the address field. All frames are passed to the upper layed + * and the decision if a frame is used is done there. + */ + *pucRcvAddress = ucRTUBuf[MB_SER_PDU_ADDR_OFF]; + + /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus + * size of address field and CRC checksum. + */ + *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC ); + + /* Return the start of the Modbus PDU to the caller. */ + *pucFrame = ( UCHAR * ) & ucRTUBuf[MB_SER_PDU_PDU_OFF]; + xFrameReceived = TRUE; + } + else + { + eStatus = MB_EIO; + } + + EXIT_CRITICAL_SECTION( ); + return eStatus; +} + +eMBErrorCode +eMBRTUSend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength ) +{ + eMBErrorCode eStatus = MB_ENOERR; + USHORT usCRC16; + + ENTER_CRITICAL_SECTION( ); + + /* Check if the receiver is still in idle state. If not we where to + * slow with processing the received frame and the master sent another + * frame on the network. We have to abort sending the frame. + */ + if( eRcvState == STATE_RX_IDLE ) + { + /* First byte before the Modbus-PDU is the slave address. */ + pucSndBufferCur = ( UCHAR * ) pucFrame - 1; + usSndBufferCount = 1; + + /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */ + pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress; + usSndBufferCount += usLength; + + /* Calculate CRC16 checksum for Modbus-Serial-Line-PDU. */ + usCRC16 = usMBCRC16( ( UCHAR * ) pucSndBufferCur, usSndBufferCount ); + ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 & 0xFF ); + ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 >> 8 ); + + /* Activate the transmitter. */ + eSndState = STATE_TX_XMIT; + vMBPortSerialEnable( FALSE, TRUE ); + } + else + { + eStatus = MB_EIO; + } + EXIT_CRITICAL_SECTION( ); + return eStatus; +} + +BOOL +xMBRTUReceiveFSM( void ) +{ + BOOL xTaskNeedSwitch = FALSE; + UCHAR ucByte; + + assert( eSndState == STATE_TX_IDLE ); + + /* Always read the character. */ + ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte ); + + switch ( eRcvState ) + { + /* If we have received a character in the init state we have to + * wait until the frame is finished. + */ + case STATE_RX_INIT: + vMBPortTimersEnable( ); + break; + + /* In the error state we wait until all characters in the + * damaged frame are transmitted. + */ + case STATE_RX_ERROR: + vMBPortTimersEnable( ); + break; + + /* In the idle state we wait for a new character. If a character + * is received the t1.5 and t3.5 timers are started and the + * receiver is in the state STATE_RX_RECEIVCE. + */ + case STATE_RX_IDLE: + usRcvBufferPos = 0; + ucRTUBuf[usRcvBufferPos++] = ucByte; + eRcvState = STATE_RX_RCV; + + /* Enable t3.5 timers. */ + vMBPortTimersEnable( ); + break; + + /* We are currently receiving a frame. Reset the timer after + * every character received. If more than the maximum possible + * number of bytes in a modbus frame is received the frame is + * ignored. + */ + case STATE_RX_RCV: + if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX ) + { + ucRTUBuf[usRcvBufferPos++] = ucByte; + } + else + { + eRcvState = STATE_RX_ERROR; + } + vMBPortTimersEnable( ); + break; + } + return xTaskNeedSwitch; +} + +BOOL +xMBRTUTransmitFSM( void ) +{ + BOOL xNeedPoll = FALSE; + + assert( eRcvState == STATE_RX_IDLE ); + + switch ( eSndState ) + { + /* We should not get a transmitter event if the transmitter is in + * idle state. */ + case STATE_TX_IDLE: + /* enable receiver/disable transmitter. */ + vMBPortSerialEnable( TRUE, FALSE ); + break; + + case STATE_TX_XMIT: + /* check if we are finished. */ + if( usSndBufferCount != 0 ) + { + xMBPortSerialPutByte( ( CHAR )*pucSndBufferCur ); + pucSndBufferCur++; /* next byte in sendbuffer. */ + usSndBufferCount--; + } + else + { + xNeedPoll = xMBPortEventPost( EV_FRAME_SENT ); + /* Disable transmitter. This prevents another transmit buffer + * empty interrupt. */ + vMBPortSerialEnable( TRUE, FALSE ); + eSndState = STATE_TX_IDLE; + } + break; + } + + return xNeedPoll; +} + +BOOL +xMBRTUTimerT35Expired( void ) +{ + BOOL xNeedPoll = FALSE; + + switch ( eRcvState ) + { + /* Timer t35 expired. Startup phase is finished. */ + case STATE_RX_INIT: + xNeedPoll = xMBPortEventPost( EV_READY ); + break; + + /* A frame was received and t35 expired. Notify the listener that + * a new frame was received. */ + case STATE_RX_RCV: + xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED ); + break; + + /* An error occured while receiving the frame. */ + case STATE_RX_ERROR: + break; + + /* Function called in an illegal state. */ + default: + assert( ( eRcvState == STATE_RX_INIT ) || + ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_ERROR ) ); + } + + vMBPortTimersDisable( ); + eRcvState = STATE_RX_IDLE; + + return xNeedPoll; +} diff --git a/modbus/modbus/rtu/mbrtu.h b/modbus/modbus/rtu/mbrtu.h index 8d8bd1f..084b214 100644 --- a/modbus/modbus/rtu/mbrtu.h +++ b/modbus/modbus/rtu/mbrtu.h @@ -1,51 +1,51 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbrtu.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_RTU_H -#define _MB_RTU_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - eMBErrorCode eMBRTUInit( UCHAR slaveAddress, UCHAR ucPort, ULONG ulBaudRate, - eMBParity eParity ); -void eMBRTUStart( void ); -void eMBRTUStop( void ); -eMBErrorCode eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ); -eMBErrorCode eMBRTUSend( UCHAR slaveAddress, const UCHAR * pucFrame, USHORT usLength ); -BOOL xMBRTUReceiveFSM( void ); -BOOL xMBRTUTransmitFSM( void ); -BOOL xMBRTUTimerT15Expired( void ); -BOOL xMBRTUTimerT35Expired( void ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbrtu.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_RTU_H +#define _MB_RTU_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + eMBErrorCode eMBRTUInit( UCHAR slaveAddress, UCHAR ucPort, ULONG ulBaudRate, + eMBParity eParity ); +void eMBRTUStart( void ); +void eMBRTUStop( void ); +eMBErrorCode eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ); +eMBErrorCode eMBRTUSend( UCHAR slaveAddress, const UCHAR * pucFrame, USHORT usLength ); +BOOL xMBRTUReceiveFSM( void ); +BOOL xMBRTUTransmitFSM( void ); +BOOL xMBRTUTimerT15Expired( void ); +BOOL xMBRTUTimerT35Expired( void ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbus/tcp/mbtcp.c b/modbus/modbus/tcp/mbtcp.c index fb06144..eb79a32 100644 --- a/modbus/modbus/tcp/mbtcp.c +++ b/modbus/modbus/tcp/mbtcp.c @@ -1,158 +1,158 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbtcp.c,v 1.3 2006/12/07 22:10:34 wolti Exp $ - */ - -/* ----------------------- System includes ----------------------------------*/ -#include "stdlib.h" -#include "string.h" - -/* ----------------------- Platform includes --------------------------------*/ -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbconfig.h" -#include "mbtcp.h" -#include "mbframe.h" -#include "mbport.h" - -#if MB_TCP_ENABLED > 0 - -/* ----------------------- Defines ------------------------------------------*/ - -/* ----------------------- MBAP Header --------------------------------------*/ -/* - * - * <------------------------ MODBUS TCP/IP ADU(1) -------------------------> - * <----------- MODBUS PDU (1') ----------------> - * +-----------+---------------+------------------------------------------+ - * | TID | PID | Length | UID |Code | Data | - * +-----------+---------------+------------------------------------------+ - * | | | | | - * (2) (3) (4) (5) (6) - * - * (2) ... MB_TCP_TID = 0 (Transaction Identifier - 2 Byte) - * (3) ... MB_TCP_PID = 2 (Protocol Identifier - 2 Byte) - * (4) ... MB_TCP_LEN = 4 (Number of bytes - 2 Byte) - * (5) ... MB_TCP_UID = 6 (Unit Identifier - 1 Byte) - * (6) ... MB_TCP_FUNC = 7 (Modbus Function Code) - * - * (1) ... Modbus TCP/IP Application Data Unit - * (1') ... Modbus Protocol Data Unit - */ - -#define MB_TCP_TID 0 -#define MB_TCP_PID 2 -#define MB_TCP_LEN 4 -#define MB_TCP_UID 6 -#define MB_TCP_FUNC 7 - -#define MB_TCP_PROTOCOL_ID 0 /* 0 = Modbus Protocol */ - - -/* ----------------------- Start implementation -----------------------------*/ -eMBErrorCode -eMBTCPDoInit( USHORT ucTCPPort ) -{ - eMBErrorCode eStatus = MB_ENOERR; - - if( xMBTCPPortInit( ucTCPPort ) == FALSE ) - { - eStatus = MB_EPORTERR; - } - return eStatus; -} - -void -eMBTCPStart( void ) -{ -} - -void -eMBTCPStop( void ) -{ - /* Make sure that no more clients are connected. */ - vMBTCPPortDisable( ); -} - -eMBErrorCode -eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** ppucFrame, USHORT * pusLength ) -{ - eMBErrorCode eStatus = MB_EIO; - UCHAR *pucMBTCPFrame; - USHORT usLength; - USHORT usPID; - - if( xMBTCPPortGetRequest( &pucMBTCPFrame, &usLength ) != FALSE ) - { - usPID = pucMBTCPFrame[MB_TCP_PID] << 8U; - usPID |= pucMBTCPFrame[MB_TCP_PID + 1]; - - if( usPID == MB_TCP_PROTOCOL_ID ) - { - *ppucFrame = &pucMBTCPFrame[MB_TCP_FUNC]; - *pusLength = usLength - MB_TCP_FUNC; - eStatus = MB_ENOERR; - - /* Modbus TCP does not use any addresses. Fake the source address such - * that the processing part deals with this frame. - */ - *pucRcvAddress = MB_TCP_PSEUDO_ADDRESS; - } - } - else - { - eStatus = MB_EIO; - } - return eStatus; -} - -eMBErrorCode -eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame, USHORT usLength ) -{ - eMBErrorCode eStatus = MB_ENOERR; - UCHAR *pucMBTCPFrame = ( UCHAR * ) pucFrame - MB_TCP_FUNC; - USHORT usTCPLength = usLength + MB_TCP_FUNC; - - /* The MBAP header is already initialized because the caller calls this - * function with the buffer returned by the previous call. Therefore we - * only have to update the length in the header. Note that the length - * header includes the size of the Modbus PDU and the UID Byte. Therefore - * the length is usLength plus one. - */ - pucMBTCPFrame[MB_TCP_LEN] = ( usLength + 1 ) >> 8U; - pucMBTCPFrame[MB_TCP_LEN + 1] = ( usLength + 1 ) & 0xFF; - if( xMBTCPPortSendResponse( pucMBTCPFrame, usTCPLength ) == FALSE ) - { - eStatus = MB_EIO; - } - return eStatus; -} - -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbtcp.c,v 1.3 2006/12/07 22:10:34 wolti Exp $ + */ + +/* ----------------------- System includes ----------------------------------*/ +#include "stdlib.h" +#include "string.h" + +/* ----------------------- Platform includes --------------------------------*/ +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbconfig.h" +#include "mbtcp.h" +#include "mbframe.h" +#include "mbport.h" + +#if MB_TCP_ENABLED > 0 + +/* ----------------------- Defines ------------------------------------------*/ + +/* ----------------------- MBAP Header --------------------------------------*/ +/* + * + * <------------------------ MODBUS TCP/IP ADU(1) -------------------------> + * <----------- MODBUS PDU (1') ----------------> + * +-----------+---------------+------------------------------------------+ + * | TID | PID | Length | UID |Code | Data | + * +-----------+---------------+------------------------------------------+ + * | | | | | + * (2) (3) (4) (5) (6) + * + * (2) ... MB_TCP_TID = 0 (Transaction Identifier - 2 Byte) + * (3) ... MB_TCP_PID = 2 (Protocol Identifier - 2 Byte) + * (4) ... MB_TCP_LEN = 4 (Number of bytes - 2 Byte) + * (5) ... MB_TCP_UID = 6 (Unit Identifier - 1 Byte) + * (6) ... MB_TCP_FUNC = 7 (Modbus Function Code) + * + * (1) ... Modbus TCP/IP Application Data Unit + * (1') ... Modbus Protocol Data Unit + */ + +#define MB_TCP_TID 0 +#define MB_TCP_PID 2 +#define MB_TCP_LEN 4 +#define MB_TCP_UID 6 +#define MB_TCP_FUNC 7 + +#define MB_TCP_PROTOCOL_ID 0 /* 0 = Modbus Protocol */ + + +/* ----------------------- Start implementation -----------------------------*/ +eMBErrorCode +eMBTCPDoInit( USHORT ucTCPPort ) +{ + eMBErrorCode eStatus = MB_ENOERR; + + if( xMBTCPPortInit( ucTCPPort ) == FALSE ) + { + eStatus = MB_EPORTERR; + } + return eStatus; +} + +void +eMBTCPStart( void ) +{ +} + +void +eMBTCPStop( void ) +{ + /* Make sure that no more clients are connected. */ + vMBTCPPortDisable( ); +} + +eMBErrorCode +eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** ppucFrame, USHORT * pusLength ) +{ + eMBErrorCode eStatus = MB_EIO; + UCHAR *pucMBTCPFrame; + USHORT usLength; + USHORT usPID; + + if( xMBTCPPortGetRequest( &pucMBTCPFrame, &usLength ) != FALSE ) + { + usPID = pucMBTCPFrame[MB_TCP_PID] << 8U; + usPID |= pucMBTCPFrame[MB_TCP_PID + 1]; + + if( usPID == MB_TCP_PROTOCOL_ID ) + { + *ppucFrame = &pucMBTCPFrame[MB_TCP_FUNC]; + *pusLength = usLength - MB_TCP_FUNC; + eStatus = MB_ENOERR; + + /* Modbus TCP does not use any addresses. Fake the source address such + * that the processing part deals with this frame. + */ + *pucRcvAddress = MB_TCP_PSEUDO_ADDRESS; + } + } + else + { + eStatus = MB_EIO; + } + return eStatus; +} + +eMBErrorCode +eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame, USHORT usLength ) +{ + eMBErrorCode eStatus = MB_ENOERR; + UCHAR *pucMBTCPFrame = ( UCHAR * ) pucFrame - MB_TCP_FUNC; + USHORT usTCPLength = usLength + MB_TCP_FUNC; + + /* The MBAP header is already initialized because the caller calls this + * function with the buffer returned by the previous call. Therefore we + * only have to update the length in the header. Note that the length + * header includes the size of the Modbus PDU and the UID Byte. Therefore + * the length is usLength plus one. + */ + pucMBTCPFrame[MB_TCP_LEN] = ( usLength + 1 ) >> 8U; + pucMBTCPFrame[MB_TCP_LEN + 1] = ( usLength + 1 ) & 0xFF; + if( xMBTCPPortSendResponse( pucMBTCPFrame, usTCPLength ) == FALSE ) + { + eStatus = MB_EIO; + } + return eStatus; +} + +#endif diff --git a/modbus/modbus/tcp/mbtcp.h b/modbus/modbus/tcp/mbtcp.h index 905d113..b4eb3fd 100644 --- a/modbus/modbus/tcp/mbtcp.h +++ b/modbus/modbus/tcp/mbtcp.h @@ -1,53 +1,53 @@ -/* - * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. - * Copyright (c) 2006 Christian Walter - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * File: $Id: mbtcp.h,v 1.2 2006/12/07 22:10:34 wolti Exp $ - */ - -#ifndef _MB_TCP_H -#define _MB_TCP_H - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif - -/* ----------------------- Defines ------------------------------------------*/ -#define MB_TCP_PSEUDO_ADDRESS 255 - -/* ----------------------- Function prototypes ------------------------------*/ - eMBErrorCode eMBTCPDoInit( USHORT ucTCPPort ); -void eMBTCPStart( void ); -void eMBTCPStop( void ); -eMBErrorCode eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, - USHORT * pusLength ); -eMBErrorCode eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame, - USHORT usLength ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. + * Copyright (c) 2006 Christian Walter + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * File: $Id: mbtcp.h,v 1.2 2006/12/07 22:10:34 wolti Exp $ + */ + +#ifndef _MB_TCP_H +#define _MB_TCP_H + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif + +/* ----------------------- Defines ------------------------------------------*/ +#define MB_TCP_PSEUDO_ADDRESS 255 + +/* ----------------------- Function prototypes ------------------------------*/ + eMBErrorCode eMBTCPDoInit( USHORT ucTCPPort ); +void eMBTCPStart( void ); +void eMBTCPStop( void ); +eMBErrorCode eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, + USHORT * pusLength ); +eMBErrorCode eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame, + USHORT usLength ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/modbusserial.cpp b/modbus/modbusserial.cpp index 4475be3..88517dd 100644 --- a/modbus/modbusserial.cpp +++ b/modbus/modbusserial.cpp @@ -1,469 +1,469 @@ -#include "modbusserial.h" -#include "InkJetPrinter.h" -#include -#include -#include "LogInfo.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" -#include "demo.h" - -/* ----------------------- Defines ------------------------------------------*/ - -//#define REG_INPUT_START 1 -//#define REG_INPUT_NREGS 400 -//#define REG_HOLDING_START 40001 -//#define REG_HOLDING_NREGS 400 -//#define REG_INPUT_START 1000 -//#define REG_INPUT_NREGS 4 -//#define REG_HOLDING_START 2000 -//#define REG_HOLDING_NREGS 130 - -/* ----------------------- Static variables ---------------------------------*/ -//static USHORT usRegInputStart = REG_INPUT_START; -//USHORT* usRegInputBuf; -//static USHORT usRegHoldingStart = REG_HOLDING_START; -//USHORT* usRegHoldingBuf; -void *uart_receive_thread(void *arg); - -ModbusSerial::ModbusSerial(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus) -{ -#ifdef MODBUS -// const UCHAR ucSlaveID[] = { 0xAA, 0xBB, 0xCC }; -// qDebug()<< "modbusserial class\r\n"; - modbus_status = 0; - modbus_up_QRCODE = 0; - port_num = 0; - input_registers = (uint16_t*) mStatus; - holding_registers = (uint16_t*) mPara; - - QProcess process; - process.start("find /dev -name ttyUSB*"); - process.waitForFinished(); - QByteArray output = process.readAllStandardOutput(); - QString str_output = output; - - QString str_tmp; - for(int j = 0; j < str_output.length(); j++) - { - if(str_output[j] > '0' && str_output[j] < '9') - str_tmp.append(str_output[j]); - } - - port_num = str_tmp.toInt(false, 10); - qDebug()<<"port_num="<start(100); -#endif -} - -ModbusSerial::~ModbusSerial(void) -{ -//#ifdef MODBUS -// disconnect(&serial_thread, SIGNAL(started()), this, SLOT(vPollingThread())); -// if (serial_thread.isRunning()) { -// serial_thread.quit(); -// serial_thread.wait(); -// } - ( void )eMBDisable( ); - vSetPollingThreadState( STOPPED ); - ( void )eMBClose(); -//#endif - if(modbus_timer) - { - delete modbus_timer; - } -} - -extern InkJetPrinter *pInkJectPrinter; - -//void ModbusSerial::vPollingThread() -//{ -// Serial_SetPollingThreadState( RUNNING ); -// -// if (modbus_status != 1) { -//// char fileName[100]; -//// memset(fileName, 0, 100); -//// snprintf(fileName, 100, "/home/plg/doc/104.html"); -//// qDebug()<<"fileName:"< '0' && str_output[j] < '9') - str_tmp.append(str_output[j]); - } - port_num = str_tmp.toInt(false, 10); - - if(0 == active_modbus(holding_registers, input_registers, port_num)) - { -// qDebug() << "updateQRcode"; -// modbus_up_QRCODE = true; -// emit updateQRcode(); - qDebug()<< "active_modbus success!\r\n"; - modbus_status = 1; - }else - { - modbus_status = 0; -// qDebug()<< "active_modbus ENOERR!\r\n"; - } - } -// qDebug()<<"ModbusStatus: "<< modbus_status; -// qDebug()<<"PollingThreadState:"<< eGetPollingThreadState( ); - - if(modbus_status == 1) - { - if(holding_registers[0] == PRINT_START_COMMAND) { - holding_registers[0] = NULL_COMMAND; - LogInfo::setRunStatusText(tr("接收到开始打印命令")); - emit startPrint(); - } - else if(holding_registers[0] == PRINT_PAUSE_COMMAND) { - holding_registers[0] = NULL_COMMAND; - LogInfo::setRunStatusText(tr("接收到暂停打印命令")); - emit pausePrint(); - } - else if(holding_registers[0] == PRINT_STOP_COMMAND) { - holding_registers[0] = NULL_COMMAND; - LogInfo::setRunStatusText(tr("接收到停止打印命令")); - emit stopPrint(); - }else if(holding_registers[0] == UPDATE_QRCODE) { - //else if(holding_registers[0] == 34) { - holding_registers[0] = NULL_COMMAND; - input_registers[0] = 0;//sysPara->modbusStatus.printFinishFlag = 0;//置打印标志 - LogInfo::setRunStatusText(tr("接收到DM码数据命令")); - qDebug() << "updateQRcode"; - modbus_up_QRCODE = true; - emit updateQRcode(); - } - } - -} -#endif - -#ifdef __com_485_ -class DevOp; -UCHAR revdata[100]; - -void ModbusSerial::processCommands() -{ - if(revdata[0] == 10) - { - if(revdata[5] == PRINT_START_COMMAND) { - revdata[5] = NULL_COMMAND; - emit startPrint(); - } - else if(revdata[5] == PRINT_PAUSE_COMMAND) { - revdata[5] = NULL_COMMAND; - emit pausePrint(); - } - else if(revdata[5] == PRINT_STOP_COMMAND) { - revdata[5] = NULL_COMMAND; - emit stopPrint(); - }else if(revdata[5] == UPDATE_QRCODE) { - //else if(holding_registers[0] == 34) { - revdata[5] = NULL_COMMAND; - qDebug() << "updateQRcode"; - modbus_up_QRCODE = true; - emit updateQRcode(); - } - } -} - - -void *uart_receive_thread(void *arg) -{ - QByteArray temp; - QByteArray recResponse; - while(1) - { - if(DevOp::comForRFID->isOpen()) - { - //int n = DevOp::comForRFID->write(temp); - //qDebug()<<"power com send "<bytesAvailable(); - if(n>0) - { - //recResponse.append(DevOp::comForRFID->read(n)); - recResponse.clear(); - recResponse = DevOp::comForRFID->read(n); - QString str; - str.sprintf("%d - %d - %d- %d", recResponse.at(0),recResponse.at(1),recResponse.at(2),recResponse.at(5)); - qDebug()<write(temp); - qDebug()<<"write response data"; - } - } - } - //return n; - -} - -#endif - -qint32 ModbusSerial::processCommands(qint32 index) -{ - qint32 rc = 0; - // 打印机指令 - if(index == ((offsetof(ModbusPrintParas, printCommand) + sizeof(uint16_t))/2 - 1)) { // 打印控制 - if(holding_registers[index] == PRINT_START_COMMAND) { - emit startPrint(); - } - else if(holding_registers[index] == PRINT_PAUSE_COMMAND) { - emit pausePrint(); - } - else if(holding_registers[index] == PRINT_STOP_COMMAND) { - emit stopPrint(); - } - } - else if(index == ((offsetof(ModbusPrintParas, QRcode_buf) + 110)/2 - 1)) { // 传送DM码数据 - qDebug() << "updateQRcode"; - modbus_up_QRCODE = true; - emit updateQRcode(); - } - else if(index == ((offsetof(ModbusPrintParas, selectFileName) + 100)/2 - 1)) { // 打开文件 - char fileName[100]; - int fileIndex = offsetof(ModbusPrintParas, selectFileName)/2; - memcpy(fileName, &holding_registers[fileIndex], 100); - //qDebug()<<"oopen file: "<modbus->processCommands(index); -} - -// -//eMBErrorCode -//eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs ) -//{ -// eMBErrorCode eStatus = MB_ENOERR; -// int iRegIndex; -// -// if( ( usAddress >= REG_INPUT_START ) -// && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) -// { -// usRegInputBuf = (USHORT*) pInkJectPrinter->modbus->input_registers; -// iRegIndex = ( int )( usAddress - usRegInputStart ); -// while( usNRegs > 0 ) -// { -// *pucRegBuffer++ = ( unsigned char )(( usRegInputBuf[iRegIndex] >> 8 )& 0xFF); -// *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); -// iRegIndex++; -// usNRegs--; -// } -// } -// else -// { -// eStatus = MB_ENOREG; -// } -// -// return eStatus; -//} -// -//eMBErrorCode -//eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) -//{ -// eMBErrorCode eStatus = MB_ENOERR; -// int iRegIndex; -// -// if( ( usAddress >= REG_HOLDING_START ) && -// ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) -// { -// -// usRegHoldingBuf = (USHORT*) pInkJectPrinter->modbus->holding_registers; -// iRegIndex = ( int )( usAddress - usRegHoldingStart ); -// switch ( eMode ) -// { -// /* Pass current register values to the protocol stack. */ -// case MB_REG_READ: -// while( usNRegs > 0 ) -// { -// *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); -// *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); -// iRegIndex++; -// usNRegs--; -// } -// break; -// -// /* Update current register values with new values from the -// * protocol stack. */ -// case MB_REG_WRITE: -// while( usNRegs > 0 ) -// { -// usRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8; -// usRegHoldingBuf[iRegIndex] |= *pucRegBuffer++; -// pInkJectPrinter->modbus->processCommands(iRegIndex); -// iRegIndex++; -// usNRegs--; -// } -// } -// } -// else -// { -// eStatus = MB_ENOREG; -// } -// return eStatus; -//} -// -// -//eMBErrorCode -//eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) -//{ -// Q_UNUSED(pucRegBuffer); -// Q_UNUSED(usAddress); -// Q_UNUSED(usNCoils); -// Q_UNUSED(eMode); -// return MB_ENOREG; -//} -// -//eMBErrorCode -//eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) -//{ -// Q_UNUSED(pucRegBuffer); -// Q_UNUSED(usAddress); -// Q_UNUSED(usNDiscrete); -// return MB_ENOREG; -//} - - - +#include "modbusserial.h" +#include "InkJetPrinter.h" +#include +#include +#include "LogInfo.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" +#include "demo.h" + +/* ----------------------- Defines ------------------------------------------*/ + +//#define REG_INPUT_START 1 +//#define REG_INPUT_NREGS 400 +//#define REG_HOLDING_START 40001 +//#define REG_HOLDING_NREGS 400 +//#define REG_INPUT_START 1000 +//#define REG_INPUT_NREGS 4 +//#define REG_HOLDING_START 2000 +//#define REG_HOLDING_NREGS 130 + +/* ----------------------- Static variables ---------------------------------*/ +//static USHORT usRegInputStart = REG_INPUT_START; +//USHORT* usRegInputBuf; +//static USHORT usRegHoldingStart = REG_HOLDING_START; +//USHORT* usRegHoldingBuf; +void *uart_receive_thread(void *arg); + +ModbusSerial::ModbusSerial(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus) +{ +#ifdef MODBUS +// const UCHAR ucSlaveID[] = { 0xAA, 0xBB, 0xCC }; +// qDebug()<< "modbusserial class\r\n"; + modbus_status = 0; + modbus_up_QRCODE = 0; + port_num = 0; + input_registers = (uint16_t*) mStatus; + holding_registers = (uint16_t*) mPara; + + QProcess process; + process.start("find /dev -name ttyUSB*"); + process.waitForFinished(); + QByteArray output = process.readAllStandardOutput(); + QString str_output = output; + + QString str_tmp; + for(int j = 0; j < str_output.length(); j++) + { + if(str_output[j] > '0' && str_output[j] < '9') + str_tmp.append(str_output[j]); + } + + port_num = str_tmp.toInt(false, 10); + qDebug()<<"port_num="<start(100); +#endif +} + +ModbusSerial::~ModbusSerial(void) +{ +//#ifdef MODBUS +// disconnect(&serial_thread, SIGNAL(started()), this, SLOT(vPollingThread())); +// if (serial_thread.isRunning()) { +// serial_thread.quit(); +// serial_thread.wait(); +// } + ( void )eMBDisable( ); + vSetPollingThreadState( STOPPED ); + ( void )eMBClose(); +//#endif + if(modbus_timer) + { + delete modbus_timer; + } +} + +extern InkJetPrinter *pInkJectPrinter; + +//void ModbusSerial::vPollingThread() +//{ +// Serial_SetPollingThreadState( RUNNING ); +// +// if (modbus_status != 1) { +//// char fileName[100]; +//// memset(fileName, 0, 100); +//// snprintf(fileName, 100, "/home/plg/doc/104.html"); +//// qDebug()<<"fileName:"< '0' && str_output[j] < '9') + str_tmp.append(str_output[j]); + } + port_num = str_tmp.toInt(false, 10); + + if(0 == active_modbus(holding_registers, input_registers, port_num)) + { +// qDebug() << "updateQRcode"; +// modbus_up_QRCODE = true; +// emit updateQRcode(); + qDebug()<< "active_modbus success!\r\n"; + modbus_status = 1; + }else + { + modbus_status = 0; +// qDebug()<< "active_modbus ENOERR!\r\n"; + } + } +// qDebug()<<"ModbusStatus: "<< modbus_status; +// qDebug()<<"PollingThreadState:"<< eGetPollingThreadState( ); + + if(modbus_status == 1) + { + if(holding_registers[0] == PRINT_START_COMMAND) { + holding_registers[0] = NULL_COMMAND; + LogInfo::setRunStatusText(tr("接收到开始打印命令")); + emit startPrint(); + } + else if(holding_registers[0] == PRINT_PAUSE_COMMAND) { + holding_registers[0] = NULL_COMMAND; + LogInfo::setRunStatusText(tr("接收到暂停打印命令")); + emit pausePrint(); + } + else if(holding_registers[0] == PRINT_STOP_COMMAND) { + holding_registers[0] = NULL_COMMAND; + LogInfo::setRunStatusText(tr("接收到停止打印命令")); + emit stopPrint(); + }else if(holding_registers[0] == UPDATE_QRCODE) { + //else if(holding_registers[0] == 34) { + holding_registers[0] = NULL_COMMAND; + input_registers[0] = 0;//sysPara->modbusStatus.printFinishFlag = 0;//置打印标志 + LogInfo::setRunStatusText(tr("接收到DM码数据命令")); + qDebug() << "updateQRcode"; + modbus_up_QRCODE = true; + emit updateQRcode(); + } + } + +} +#endif + +#ifdef __com_485_ +class DevOp; +UCHAR revdata[100]; + +void ModbusSerial::processCommands() +{ + if(revdata[0] == 10) + { + if(revdata[5] == PRINT_START_COMMAND) { + revdata[5] = NULL_COMMAND; + emit startPrint(); + } + else if(revdata[5] == PRINT_PAUSE_COMMAND) { + revdata[5] = NULL_COMMAND; + emit pausePrint(); + } + else if(revdata[5] == PRINT_STOP_COMMAND) { + revdata[5] = NULL_COMMAND; + emit stopPrint(); + }else if(revdata[5] == UPDATE_QRCODE) { + //else if(holding_registers[0] == 34) { + revdata[5] = NULL_COMMAND; + qDebug() << "updateQRcode"; + modbus_up_QRCODE = true; + emit updateQRcode(); + } + } +} + + +void *uart_receive_thread(void *arg) +{ + QByteArray temp; + QByteArray recResponse; + while(1) + { + if(DevOp::comForRFID->isOpen()) + { + //int n = DevOp::comForRFID->write(temp); + //qDebug()<<"power com send "<bytesAvailable(); + if(n>0) + { + //recResponse.append(DevOp::comForRFID->read(n)); + recResponse.clear(); + recResponse = DevOp::comForRFID->read(n); + QString str; + str.sprintf("%d - %d - %d- %d", recResponse.at(0),recResponse.at(1),recResponse.at(2),recResponse.at(5)); + qDebug()<write(temp); + qDebug()<<"write response data"; + } + } + } + //return n; + +} + +#endif + +qint32 ModbusSerial::processCommands(qint32 index) +{ + qint32 rc = 0; + // 打印机指令 + if(index == ((offsetof(ModbusPrintParas, printCommand) + sizeof(uint16_t))/2 - 1)) { // 打印控制 + if(holding_registers[index] == PRINT_START_COMMAND) { + emit startPrint(); + } + else if(holding_registers[index] == PRINT_PAUSE_COMMAND) { + emit pausePrint(); + } + else if(holding_registers[index] == PRINT_STOP_COMMAND) { + emit stopPrint(); + } + } + else if(index == ((offsetof(ModbusPrintParas, QRcode_buf) + 110)/2 - 1)) { // 传送DM码数据 + qDebug() << "updateQRcode"; + modbus_up_QRCODE = true; + emit updateQRcode(); + } + else if(index == ((offsetof(ModbusPrintParas, selectFileName) + 100)/2 - 1)) { // 打开文件 + char fileName[100]; + int fileIndex = offsetof(ModbusPrintParas, selectFileName)/2; + memcpy(fileName, &holding_registers[fileIndex], 100); + //qDebug()<<"oopen file: "<modbus->processCommands(index); +} + +// +//eMBErrorCode +//eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs ) +//{ +// eMBErrorCode eStatus = MB_ENOERR; +// int iRegIndex; +// +// if( ( usAddress >= REG_INPUT_START ) +// && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) +// { +// usRegInputBuf = (USHORT*) pInkJectPrinter->modbus->input_registers; +// iRegIndex = ( int )( usAddress - usRegInputStart ); +// while( usNRegs > 0 ) +// { +// *pucRegBuffer++ = ( unsigned char )(( usRegInputBuf[iRegIndex] >> 8 )& 0xFF); +// *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); +// iRegIndex++; +// usNRegs--; +// } +// } +// else +// { +// eStatus = MB_ENOREG; +// } +// +// return eStatus; +//} +// +//eMBErrorCode +//eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) +//{ +// eMBErrorCode eStatus = MB_ENOERR; +// int iRegIndex; +// +// if( ( usAddress >= REG_HOLDING_START ) && +// ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) +// { +// +// usRegHoldingBuf = (USHORT*) pInkJectPrinter->modbus->holding_registers; +// iRegIndex = ( int )( usAddress - usRegHoldingStart ); +// switch ( eMode ) +// { +// /* Pass current register values to the protocol stack. */ +// case MB_REG_READ: +// while( usNRegs > 0 ) +// { +// *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); +// *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); +// iRegIndex++; +// usNRegs--; +// } +// break; +// +// /* Update current register values with new values from the +// * protocol stack. */ +// case MB_REG_WRITE: +// while( usNRegs > 0 ) +// { +// usRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8; +// usRegHoldingBuf[iRegIndex] |= *pucRegBuffer++; +// pInkJectPrinter->modbus->processCommands(iRegIndex); +// iRegIndex++; +// usNRegs--; +// } +// } +// } +// else +// { +// eStatus = MB_ENOREG; +// } +// return eStatus; +//} +// +// +//eMBErrorCode +//eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) +//{ +// Q_UNUSED(pucRegBuffer); +// Q_UNUSED(usAddress); +// Q_UNUSED(usNCoils); +// Q_UNUSED(eMode); +// return MB_ENOREG; +//} +// +//eMBErrorCode +//eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) +//{ +// Q_UNUSED(pucRegBuffer); +// Q_UNUSED(usAddress); +// Q_UNUSED(usNDiscrete); +// return MB_ENOREG; +//} + + + diff --git a/modbus/modbusserial.h b/modbus/modbusserial.h index ba10057..3f3a873 100644 --- a/modbus/modbusserial.h +++ b/modbus/modbusserial.h @@ -1,69 +1,69 @@ -#ifndef MODBUSSERIAL_H -#define MODBUSSERIAL_H -#include -//#include -#include "../SysPara.h" -#include -#include -#include -//#include - -#define PRINT_START_COMMAND 0x01 -#define PRINT_PAUSE_COMMAND 0x02 -#define PRINT_STOP_COMMAND 0x03 -#define UPDATE_QRCODE 0x04 -#define NULL_COMMAND 0x00 -//enum { -// TCP, -// TCP_PI, -// RTU -//}; -//enum ThreadState -//{ -// STOPPED, -// RUNNING, -// SHUTDOWN -//}; - -class ModbusSerial:public QObject -{ - Q_OBJECT -public: - ModbusSerial(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus); - ~ModbusSerial(); - - uint16_t* input_registers; - uint16_t* holding_registers; - uint8_t modbus_up_QRCODE; -// QThread serial_thread; - -// enum ThreadState Serial_PollThreadState; -// enum ThreadState Serial_GetPollingThreadState(); -// void Serial_SetPollingThreadState( enum ThreadState eNewState ); - qint32 getModbusStatus(); - - -Q_SIGNALS: - void updateQRcode(); - void startPrint(); - void pausePrint(); - void stopPrint(); - void openFile(QString,bool); - void faultResume(); - void writeCalendar(); - void mbLineAndCharSpace(int lineSpace, int charSpace); - -public slots: - //void processCommands(); - qint32 processCommands(qint32 index); -// void vPollingThread(); - -private: - QTimer* modbus_timer; - qint32 modbus_status; - uint16_t port_num; -// QMutex modbusThreadMutex; - -}; -#endif - +#ifndef MODBUSSERIAL_H +#define MODBUSSERIAL_H +#include +//#include +#include "../SysPara.h" +#include +#include +#include +//#include + +#define PRINT_START_COMMAND 0x01 +#define PRINT_PAUSE_COMMAND 0x02 +#define PRINT_STOP_COMMAND 0x03 +#define UPDATE_QRCODE 0x04 +#define NULL_COMMAND 0x00 +//enum { +// TCP, +// TCP_PI, +// RTU +//}; +//enum ThreadState +//{ +// STOPPED, +// RUNNING, +// SHUTDOWN +//}; + +class ModbusSerial:public QObject +{ + Q_OBJECT +public: + ModbusSerial(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus); + ~ModbusSerial(); + + uint16_t* input_registers; + uint16_t* holding_registers; + uint8_t modbus_up_QRCODE; +// QThread serial_thread; + +// enum ThreadState Serial_PollThreadState; +// enum ThreadState Serial_GetPollingThreadState(); +// void Serial_SetPollingThreadState( enum ThreadState eNewState ); + qint32 getModbusStatus(); + + +Q_SIGNALS: + void updateQRcode(); + void startPrint(); + void pausePrint(); + void stopPrint(); + void openFile(QString,bool); + void faultResume(); + void writeCalendar(); + void mbLineAndCharSpace(int lineSpace, int charSpace); + +public slots: + //void processCommands(); + qint32 processCommands(qint32 index); +// void vPollingThread(); + +private: + QTimer* modbus_timer; + qint32 modbus_status; + uint16_t port_num; +// QMutex modbusThreadMutex; + +}; +#endif + diff --git a/modbus/modbustcp.cpp b/modbus/modbustcp.cpp index cc7cdba..01fdb30 100644 --- a/modbus/modbustcp.cpp +++ b/modbus/modbustcp.cpp @@ -1,284 +1,284 @@ -#include "modbustcp.h" -#include "InkJetPrinter.h" -#include -#include -#include "../../LogInfo.h" -#include -#include -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" - -/* ----------------------- Defines ------------------------------------------*/ - - -#define REG_INPUT_START 1 -#define REG_INPUT_NREGS 400 -#define REG_HOLDING_START 1//40001 //40001 -#define REG_HOLDING_NREGS 400 - -/* ----------------------- Static variables ---------------------------------*/ -static USHORT usRegInputStart = REG_INPUT_START; -//static USHORT usRegInputBuf[REG_INPUT_NREGS]; -static USHORT usRegHoldingStart = REG_HOLDING_START; -//static USHORT usRegHoldingBuf[REG_HOLDING_NREGS]; -USHORT* usRegInputBuf; -USHORT* usRegHoldingBuf; - - -ModbusTcp::ModbusTcp(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus) -{ -#ifdef MODBUS - modbus_status = 0; - modbus_up_QRCODE = 0; - if( eMBTCPInit( MB_TCP_PORT_USE_DEFAULT ) != MB_ENOERR ) - { - qDebug()<< "can't initialize modbus stack!\r\n"; - modbus_status = -1; - } - else - { - eSetPollingThreadState( STOPPED ); - /* CLI interface. */ - //bDoExit = FALSE; - } - input_registers = (uint16_t*) mStatus; - holding_registers = (uint16_t*) mPara; -// moveToThread(&m_thread); - -// if (modbus_status != -1) { -// connect(&m_thread, SIGNAL(started()), this, SLOT(pvPollingThread())); -// modbus_status = 1; -// } -#endif -} - -ModbusTcp::~ModbusTcp(void) -{ -#ifdef MODBUS -// disconnect(&m_thread, SIGNAL(started()), this, SLOT(pvPollingThread())); -// if (m_thread.isRunning()) { -// m_thread.quit(); -// m_thread.wait(); -// } - ( void )eMBClose( ); -#endif -} - -extern InkJetPrinter *pInkJectPrinter; -void ModbusTcp::pvPollingThread() -{ -#ifdef MODBUS - eSetPollingThreadState( RUNNING ); - if (modbus_status != 1) { - return; - } - if( eMBEnable( ) == MB_ENOERR ) - { - do - { - if( eMBPoll( ) != MB_ENOERR ) { - qDebug()<<"modbus poll error"; - break; - } - } - while( eGetPollingThreadState( ) != SHUTDOWN ); - } - if( eMBEnable( ) == MB_ENOERR ) - ( void )eMBDisable( ); - - eSetPollingThreadState( STOPPED ); -#endif - return; -} - -enum ThreadState -ModbusTcp::eGetPollingThreadState( ) -{ - enum ThreadState eCurState; - - modbusThreadMutex.lock(); - eCurState = ePollThreadState; - modbusThreadMutex.unlock(); - - return eCurState; -} - -void -ModbusTcp::eSetPollingThreadState( enum ThreadState eNewState ) -{ - modbusThreadMutex.lock(); - ePollThreadState = eNewState; - modbusThreadMutex.unlock(); -} - -qint32 ModbusTcp::getModbusStatus() -{ - return modbus_status; -} - -qint32 ModbusTcp::processCommands(qint32 index) -{ - qint32 rc = 0; - // 打印机指令 - if(index == ((offsetof(ModbusPrintParas, printCommand) + sizeof(uint16_t))/2 - 1)) { // 打印控制 - if(holding_registers[index] == PRINT_START_COMMAND) { - emit startPrint(); - } - else if(holding_registers[index] == PRINT_PAUSE_COMMAND) { - emit pausePrint(); - } - else if(holding_registers[index] == PRINT_STOP_COMMAND) { - emit stopPrint(); - } - } - else if(index == ((offsetof(ModbusPrintParas, QRcode_buf) + 240)/2 - 1)) { // 传送DM码数据 - qDebug() << "updateQRcode"; - modbus_up_QRCODE = true; - - emit updateQRcode(); - } - else if(index == ((offsetof(ModbusPrintParas, selectFileName) + 100)/2 - 1)) { // 打开文件 - char fileName[100]; - int fileIndex = offsetof(ModbusPrintParas, selectFileName)/2; - memcpy(fileName, &holding_registers[fileIndex], 100); - //qDebug()<<"oopen file: "<= REG_INPUT_START ) - && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) - { - usRegInputBuf = (USHORT*) pInkJectPrinter->modbus->input_registers; - iRegIndex = ( int )( usAddress - usRegInputStart ); - while( usNRegs > 0 ) - { - *pucRegBuffer++ = ( unsigned char )(( usRegInputBuf[iRegIndex] >> 8 )& 0xFF); - *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); - iRegIndex++; - usNRegs--; - } - } - else - { - eStatus = MB_ENOREG; - } - - return eStatus; -} - -eMBErrorCode -eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) -{ - eMBErrorCode eStatus = MB_ENOERR; - int iRegIndex; - - if( ( usAddress >= REG_HOLDING_START ) && - ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) - { - - usRegHoldingBuf = (USHORT*) pInkJectPrinter->modbus->holding_registers; - iRegIndex = ( int )( usAddress - usRegHoldingStart ); - - switch ( eMode ) - { - /* Pass current register values to the protocol stack. */ - case MB_REG_READ: - while( usNRegs > 0 ) - { - *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); - *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); - iRegIndex++; - usNRegs--; - } - break; - - /* Update current register values with new values from the - * protocol stack. */ - case MB_REG_WRITE: - while( usNRegs > 0 ) - { - usRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8; - usRegHoldingBuf[iRegIndex] |= *pucRegBuffer++; - pInkJectPrinter->modbus->processCommands(iRegIndex); - iRegIndex++; - usNRegs--; - } - - } - } - else - { - eStatus = MB_ENOREG; - } - return eStatus; -} - - -eMBErrorCode -eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) -{ - Q_UNUSED(pucRegBuffer); - Q_UNUSED(usAddress); - Q_UNUSED(usNCoils); - Q_UNUSED(eMode); - return MB_ENOREG; -} - -eMBErrorCode -eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) -{ - Q_UNUSED(pucRegBuffer); - Q_UNUSED(usAddress); - Q_UNUSED(usNDiscrete); - return MB_ENOREG; -} +#include "modbustcp.h" +#include "InkJetPrinter.h" +#include +#include +#include "../../LogInfo.h" +#include +#include +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" + +/* ----------------------- Defines ------------------------------------------*/ + + +#define REG_INPUT_START 1 +#define REG_INPUT_NREGS 400 +#define REG_HOLDING_START 1//40001 //40001 +#define REG_HOLDING_NREGS 400 + +/* ----------------------- Static variables ---------------------------------*/ +static USHORT usRegInputStart = REG_INPUT_START; +//static USHORT usRegInputBuf[REG_INPUT_NREGS]; +static USHORT usRegHoldingStart = REG_HOLDING_START; +//static USHORT usRegHoldingBuf[REG_HOLDING_NREGS]; +USHORT* usRegInputBuf; +USHORT* usRegHoldingBuf; + + +ModbusTcp::ModbusTcp(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus) +{ +#ifdef MODBUS + modbus_status = 0; + modbus_up_QRCODE = 0; + if( eMBTCPInit( MB_TCP_PORT_USE_DEFAULT ) != MB_ENOERR ) + { + qDebug()<< "can't initialize modbus stack!\r\n"; + modbus_status = -1; + } + else + { + eSetPollingThreadState( STOPPED ); + /* CLI interface. */ + //bDoExit = FALSE; + } + input_registers = (uint16_t*) mStatus; + holding_registers = (uint16_t*) mPara; +// moveToThread(&m_thread); + +// if (modbus_status != -1) { +// connect(&m_thread, SIGNAL(started()), this, SLOT(pvPollingThread())); +// modbus_status = 1; +// } +#endif +} + +ModbusTcp::~ModbusTcp(void) +{ +#ifdef MODBUS +// disconnect(&m_thread, SIGNAL(started()), this, SLOT(pvPollingThread())); +// if (m_thread.isRunning()) { +// m_thread.quit(); +// m_thread.wait(); +// } + ( void )eMBClose( ); +#endif +} + +extern InkJetPrinter *pInkJectPrinter; +void ModbusTcp::pvPollingThread() +{ +#ifdef MODBUS + eSetPollingThreadState( RUNNING ); + if (modbus_status != 1) { + return; + } + if( eMBEnable( ) == MB_ENOERR ) + { + do + { + if( eMBPoll( ) != MB_ENOERR ) { + qDebug()<<"modbus poll error"; + break; + } + } + while( eGetPollingThreadState( ) != SHUTDOWN ); + } + if( eMBEnable( ) == MB_ENOERR ) + ( void )eMBDisable( ); + + eSetPollingThreadState( STOPPED ); +#endif + return; +} + +enum ThreadState +ModbusTcp::eGetPollingThreadState( ) +{ + enum ThreadState eCurState; + + modbusThreadMutex.lock(); + eCurState = ePollThreadState; + modbusThreadMutex.unlock(); + + return eCurState; +} + +void +ModbusTcp::eSetPollingThreadState( enum ThreadState eNewState ) +{ + modbusThreadMutex.lock(); + ePollThreadState = eNewState; + modbusThreadMutex.unlock(); +} + +qint32 ModbusTcp::getModbusStatus() +{ + return modbus_status; +} + +qint32 ModbusTcp::processCommands(qint32 index) +{ + qint32 rc = 0; + // 打印机指令 + if(index == ((offsetof(ModbusPrintParas, printCommand) + sizeof(uint16_t))/2 - 1)) { // 打印控制 + if(holding_registers[index] == PRINT_START_COMMAND) { + emit startPrint(); + } + else if(holding_registers[index] == PRINT_PAUSE_COMMAND) { + emit pausePrint(); + } + else if(holding_registers[index] == PRINT_STOP_COMMAND) { + emit stopPrint(); + } + } + else if(index == ((offsetof(ModbusPrintParas, QRcode_buf) + 240)/2 - 1)) { // 传送DM码数据 + qDebug() << "updateQRcode"; + modbus_up_QRCODE = true; + + emit updateQRcode(); + } + else if(index == ((offsetof(ModbusPrintParas, selectFileName) + 100)/2 - 1)) { // 打开文件 + char fileName[100]; + int fileIndex = offsetof(ModbusPrintParas, selectFileName)/2; + memcpy(fileName, &holding_registers[fileIndex], 100); + //qDebug()<<"oopen file: "<= REG_INPUT_START ) + && ( usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS ) ) + { + usRegInputBuf = (USHORT*) pInkJectPrinter->modbus->input_registers; + iRegIndex = ( int )( usAddress - usRegInputStart ); + while( usNRegs > 0 ) + { + *pucRegBuffer++ = ( unsigned char )(( usRegInputBuf[iRegIndex] >> 8 )& 0xFF); + *pucRegBuffer++ = ( unsigned char )( usRegInputBuf[iRegIndex] & 0xFF ); + iRegIndex++; + usNRegs--; + } + } + else + { + eStatus = MB_ENOREG; + } + + return eStatus; +} + +eMBErrorCode +eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode ) +{ + eMBErrorCode eStatus = MB_ENOERR; + int iRegIndex; + + if( ( usAddress >= REG_HOLDING_START ) && + ( usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS ) ) + { + + usRegHoldingBuf = (USHORT*) pInkJectPrinter->modbus->holding_registers; + iRegIndex = ( int )( usAddress - usRegHoldingStart ); + + switch ( eMode ) + { + /* Pass current register values to the protocol stack. */ + case MB_REG_READ: + while( usNRegs > 0 ) + { + *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] >> 8 ); + *pucRegBuffer++ = ( UCHAR ) ( usRegHoldingBuf[iRegIndex] & 0xFF ); + iRegIndex++; + usNRegs--; + } + break; + + /* Update current register values with new values from the + * protocol stack. */ + case MB_REG_WRITE: + while( usNRegs > 0 ) + { + usRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8; + usRegHoldingBuf[iRegIndex] |= *pucRegBuffer++; + pInkJectPrinter->modbus->processCommands(iRegIndex); + iRegIndex++; + usNRegs--; + } + + } + } + else + { + eStatus = MB_ENOREG; + } + return eStatus; +} + + +eMBErrorCode +eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNCoils, eMBRegisterMode eMode ) +{ + Q_UNUSED(pucRegBuffer); + Q_UNUSED(usAddress); + Q_UNUSED(usNCoils); + Q_UNUSED(eMode); + return MB_ENOREG; +} + +eMBErrorCode +eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete ) +{ + Q_UNUSED(pucRegBuffer); + Q_UNUSED(usAddress); + Q_UNUSED(usNDiscrete); + return MB_ENOREG; +} diff --git a/modbus/modbustcp.h b/modbus/modbustcp.h index c4add3c..b7c3d5a 100644 --- a/modbus/modbustcp.h +++ b/modbus/modbustcp.h @@ -1,65 +1,65 @@ -#ifndef MODBUSTCP_H -#define MODBUSTCP_H -#include -//#include -#include "../SysPara.h" -#include -#include -#include -#include "myinclude.h" - -#define PRINT_START_COMMAND 0x01 -#define PRINT_PAUSE_COMMAND 0x02 -#define PRINT_STOP_COMMAND 0x03 -enum { - TCP, - TCP_PI, - RTU -}; -enum ThreadState -{ - STOPPED, - RUNNING, - SHUTDOWN -}; -class ModbusTcp:public QObject -{ - Q_OBJECT -public: - ModbusTcp(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus); - ~ModbusTcp(); - - uint16_t* input_registers; - uint16_t* holding_registers; - uint8_t modbus_up_QRCODE; -// QThread m_thread; - enum ThreadState ePollThreadState; - enum ThreadState eGetPollingThreadState(); - void eSetPollingThreadState( enum ThreadState eNewState ); - qint32 getModbusStatus(); - qint32 processCommands(qint32 index); - -Q_SIGNALS: - void startPrint(); - void pausePrint(); - void stopPrint(); - void openFile(QString,bool); - void faultResume(); - void writeCalendar(); - void mbLineAndCharSpace(int lineSpace, int charSpace); - void updateQRcode(); - void writeCalendar1(); - void writeCalendar1EndValue(); - void writeCalendar2EndValue(); - void writeCalendar2RepeatValue(); - void writeCalendar2InitValue(); - void CNTResetNow(); - -public slots: - void pvPollingThread(); -private: - qint32 modbus_status; - QMutex modbusThreadMutex; -}; - -#endif // MODBUSTCP_H +#ifndef MODBUSTCP_H +#define MODBUSTCP_H +#include +//#include +#include "../SysPara.h" +#include +#include +#include +#include "myinclude.h" + +#define PRINT_START_COMMAND 0x01 +#define PRINT_PAUSE_COMMAND 0x02 +#define PRINT_STOP_COMMAND 0x03 +enum { + TCP, + TCP_PI, + RTU +}; +enum ThreadState +{ + STOPPED, + RUNNING, + SHUTDOWN +}; +class ModbusTcp:public QObject +{ + Q_OBJECT +public: + ModbusTcp(ModbusPrintParas *mPara, const ModbusPrintStatus* mStatus); + ~ModbusTcp(); + + uint16_t* input_registers; + uint16_t* holding_registers; + uint8_t modbus_up_QRCODE; +// QThread m_thread; + enum ThreadState ePollThreadState; + enum ThreadState eGetPollingThreadState(); + void eSetPollingThreadState( enum ThreadState eNewState ); + qint32 getModbusStatus(); + qint32 processCommands(qint32 index); + +Q_SIGNALS: + void startPrint(); + void pausePrint(); + void stopPrint(); + void openFile(QString,bool); + void faultResume(); + void writeCalendar(); + void mbLineAndCharSpace(int lineSpace, int charSpace); + void updateQRcode(); + void writeCalendar1(); + void writeCalendar1EndValue(); + void writeCalendar2EndValue(); + void writeCalendar2RepeatValue(); + void writeCalendar2InitValue(); + void CNTResetNow(); + +public slots: + void pvPollingThread(); +private: + qint32 modbus_status; + QMutex modbusThreadMutex; +}; + +#endif // MODBUSTCP_H diff --git a/modbus/port/port.h b/modbus/port/port.h index 9eca4c4..e4cb1d0 100644 --- a/modbus/port/port.h +++ b/modbus/port/port.h @@ -1,81 +1,81 @@ -/* - * FreeModbus Libary: BSD Socket Library Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: port.h,v 1.1 2007/09/12 10:15:56 wolti Exp $ - */ - - /********************************************************** - * Linux TCP support. - * Based on Walter's project. - * Modified by Steven Guo - ***********************************************************/ - -#ifndef _PORT_H -#define _PORT_H - - -#include - -#define INLINE -#define PR_BEGIN_EXTERN_C extern "C" { -#define PR_END_EXTERN_C } - -#ifdef __cplusplus -PR_BEGIN_EXTERN_C -#endif -/* ----------------------- Defines ------------------------------------------*/ -#define ENTER_CRITICAL_SECTION( ) -#define EXIT_CRITICAL_SECTION( ) -#define MB_PORT_HAS_CLOSE 1 -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -/* ----------------------- Type definitions ---------------------------------*/ -typedef int SOCKET; - -#define SOCKET_ERROR (-1) -#define INVALID_SOCKET (~0) -typedef char BOOL; -typedef unsigned char UCHAR; -typedef unsigned char BYTE; -typedef char CHAR; -typedef unsigned short USHORT; -typedef short SHORT; - -typedef unsigned long ULONG; -typedef long LONG; -typedef enum -{ - MB_LOG_DEBUG, - MB_LOG_INFO, - MB_LOG_WARN, - MB_LOG_ERROR -} eMBPortLogLevel; - -/* ----------------------- Function prototypes ------------------------------*/ - -void TcpvMBPortLog( eMBPortLogLevel eLevel, const CHAR * szModule, const CHAR * szFmt, - ... ); - -#ifdef __cplusplus -PR_END_EXTERN_C -#endif -#endif +/* + * FreeModbus Libary: BSD Socket Library Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: port.h,v 1.1 2007/09/12 10:15:56 wolti Exp $ + */ + + /********************************************************** + * Linux TCP support. + * Based on Walter's project. + * Modified by Steven Guo + ***********************************************************/ + +#ifndef _PORT_H +#define _PORT_H + + +#include + +#define INLINE +#define PR_BEGIN_EXTERN_C extern "C" { +#define PR_END_EXTERN_C } + +#ifdef __cplusplus +PR_BEGIN_EXTERN_C +#endif +/* ----------------------- Defines ------------------------------------------*/ +#define ENTER_CRITICAL_SECTION( ) +#define EXIT_CRITICAL_SECTION( ) +#define MB_PORT_HAS_CLOSE 1 +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +/* ----------------------- Type definitions ---------------------------------*/ +typedef int SOCKET; + +#define SOCKET_ERROR (-1) +#define INVALID_SOCKET (~0) +typedef char BOOL; +typedef unsigned char UCHAR; +typedef unsigned char BYTE; +typedef char CHAR; +typedef unsigned short USHORT; +typedef short SHORT; + +typedef unsigned long ULONG; +typedef long LONG; +typedef enum +{ + MB_LOG_DEBUG, + MB_LOG_INFO, + MB_LOG_WARN, + MB_LOG_ERROR +} eMBPortLogLevel; + +/* ----------------------- Function prototypes ------------------------------*/ + +void TcpvMBPortLog( eMBPortLogLevel eLevel, const CHAR * szModule, const CHAR * szFmt, + ... ); + +#ifdef __cplusplus +PR_END_EXTERN_C +#endif +#endif diff --git a/modbus/port/portevent.c b/modbus/port/portevent.c index ea1acfc..8350329 100644 --- a/modbus/port/portevent.c +++ b/modbus/port/portevent.c @@ -1,72 +1,72 @@ -/* - * FreeModbus Libary: Win32 Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: portevent.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ - */ - - /********************************************************** - * Linux TCP support. - * Based on Walter's project. - * Modified by Steven Guo - ***********************************************************/ - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" - -/* ----------------------- Variables ----------------------------------------*/ -static eMBEventType eQueuedEvent; -static BOOL xEventInQueue; - -/* ----------------------- Function prototypes ------------------------------*/ -BOOL xMBPortTCPPool( void ); - -/* ----------------------- Start implementation -----------------------------*/ -BOOL -xMBPortEventInit( void ) -{ - xEventInQueue = FALSE; - return TRUE; -} - -BOOL -xMBPortEventPost( eMBEventType eEvent ) -{ - xEventInQueue = TRUE; - eQueuedEvent = eEvent; - return TRUE; -} - -BOOL -xMBPortEventGet( eMBEventType * eEvent ) -{ - BOOL xEventHappened = FALSE; - - if( xEventInQueue ) - { - *eEvent = eQueuedEvent; - xEventInQueue = FALSE; - xEventHappened = TRUE; - } - else - { - /* We can't do anything with errors from the pooling module. */ - ( void )xMBPortTCPPool( ); - } - return xEventHappened; -} +/* + * FreeModbus Libary: Win32 Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: portevent.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ + */ + + /********************************************************** + * Linux TCP support. + * Based on Walter's project. + * Modified by Steven Guo + ***********************************************************/ + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" + +/* ----------------------- Variables ----------------------------------------*/ +static eMBEventType eQueuedEvent; +static BOOL xEventInQueue; + +/* ----------------------- Function prototypes ------------------------------*/ +BOOL xMBPortTCPPool( void ); + +/* ----------------------- Start implementation -----------------------------*/ +BOOL +xMBPortEventInit( void ) +{ + xEventInQueue = FALSE; + return TRUE; +} + +BOOL +xMBPortEventPost( eMBEventType eEvent ) +{ + xEventInQueue = TRUE; + eQueuedEvent = eEvent; + return TRUE; +} + +BOOL +xMBPortEventGet( eMBEventType * eEvent ) +{ + BOOL xEventHappened = FALSE; + + if( xEventInQueue ) + { + *eEvent = eQueuedEvent; + xEventInQueue = FALSE; + xEventHappened = TRUE; + } + else + { + /* We can't do anything with errors from the pooling module. */ + ( void )xMBPortTCPPool( ); + } + return xEventHappened; +} diff --git a/modbus/port/portother.c b/modbus/port/portother.c index 94898e8..8f647a0 100644 --- a/modbus/port/portother.c +++ b/modbus/port/portother.c @@ -1,69 +1,69 @@ -/* - * FreeModbus Libary: Win32 Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: portother.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ - */ - - /********************************************************** - * Linux TCP support. - * Based on Walter's project. - * Modified by Steven Guo - ***********************************************************/ - -#include -#include -#include - -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" -#include "mbconfig.h" - - -BOOL -prvMBTCPPortAddressToString( SOCKET xSocket, CHAR * szAddr, USHORT usBufSize ) -{ - return TRUE; -} - -CHAR * -prvMBTCPPortFrameToString( UCHAR * pucFrame, USHORT usFrameLen ) -{ - return NULL; -} - -CHAR * -WsaError2String( int iError ) -{ - return NULL; -} - -void -vMBPortLog( eMBPortLogLevel eLevel, const CHAR * szModule, const CHAR * szFmt, ... ) -{ - va_list args; - static const CHAR *arszLevel2Str[] = { "DEBUG", "INFO", "WARN", "ERROR" }; - - fprintf( stderr, "%s: %s: ", arszLevel2Str[eLevel], szModule ); - - va_start( args, szFmt ); - fprintf( stderr, szFmt, args ); - va_end( args ); -} +/* + * FreeModbus Libary: Win32 Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: portother.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ + */ + + /********************************************************** + * Linux TCP support. + * Based on Walter's project. + * Modified by Steven Guo + ***********************************************************/ + +#include +#include +#include + +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" +#include "mbconfig.h" + + +BOOL +prvMBTCPPortAddressToString( SOCKET xSocket, CHAR * szAddr, USHORT usBufSize ) +{ + return TRUE; +} + +CHAR * +prvMBTCPPortFrameToString( UCHAR * pucFrame, USHORT usFrameLen ) +{ + return NULL; +} + +CHAR * +WsaError2String( int iError ) +{ + return NULL; +} + +void +vMBPortLog( eMBPortLogLevel eLevel, const CHAR * szModule, const CHAR * szFmt, ... ) +{ + va_list args; + static const CHAR *arszLevel2Str[] = { "DEBUG", "INFO", "WARN", "ERROR" }; + + fprintf( stderr, "%s: %s: ", arszLevel2Str[eLevel], szModule ); + + va_start( args, szFmt ); + fprintf( stderr, szFmt, args ); + va_end( args ); +} diff --git a/modbus/port/portserial.c b/modbus/port/portserial.c index 2c2399d..07b5972 100644 --- a/modbus/port/portserial.c +++ b/modbus/port/portserial.c @@ -1,364 +1,364 @@ -/* - * FreeModbus Libary: Linux Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: portserial.c,v 1.3 2006/10/12 08:35:34 wolti Exp $ - */ - -/* ----------------------- Standard includes --------------------------------*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" -#include "mbconfig.h" - -/* ----------------------- Defines -----------------------------------------*/ -#if MB_ASCII_ENABLED == 1 -#define BUF_SIZE 513 /* must hold a complete ASCII frame. */ -#else -#define BUF_SIZE 256 /* must hold a complete RTU frame. */ -#endif - -/* ----------------------- Static variables ---------------------------------*/ -static int iSerialFd = -1; -static BOOL bRxEnabled; -static BOOL bTxEnabled; - -static ULONG ulTimeoutMs; -static UCHAR ucBuffer[BUF_SIZE]; -static int uiRxBufferPos; -static int uiTxBufferPos; - -static struct termios xOldTIO; - -/* ----------------------- Function prototypes ------------------------------*/ -static BOOL prvbMBPortSerialRead( UCHAR * pucBuffer, USHORT usNBytes, USHORT * usNBytesRead ); -static BOOL prvbMBPortSerialWrite( UCHAR * pucBuffer, USHORT usNBytes ); - -/* ----------------------- Begin implementation -----------------------------*/ -void -vMBPortSerialEnable( BOOL bEnableRx, BOOL bEnableTx ) -{ - /* it is not allowed that both receiver and transmitter are enabled. */ - assert( !bEnableRx || !bEnableTx ); - - if( bEnableRx ) - { - ( void )tcflush( iSerialFd, TCIFLUSH ); - uiRxBufferPos = 0; - bRxEnabled = TRUE; - } - else - { - bRxEnabled = FALSE; - } - if( bEnableTx ) - { - bTxEnabled = TRUE; - uiTxBufferPos = 0; - } - else - { - bTxEnabled = FALSE; - } -} - -BOOL -xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity ) -{ - CHAR szDevice[16]; - BOOL bStatus = TRUE; - - struct termios xNewTIO; - speed_t xNewSpeed; - - //snprintf( szDevice, 16, "/dev/ttyUSB%d", ucPort ); - snprintf( szDevice, 16, "/dev/ttyO1"); - - if( ( iSerialFd = open( szDevice, O_RDWR | O_NOCTTY ) ) < 0 ) - { - vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't open serial port %s: %s\n", szDevice, - strerror( errno ) ); - bStatus = FALSE; - return bStatus; - } - else if( tcgetattr( iSerialFd, &xOldTIO ) != 0 ) - { - vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't get settings from port %s: %s\n", szDevice, - strerror( errno ) ); - } - else - { - bzero( &xNewTIO, sizeof( struct termios ) ); - - xNewTIO.c_iflag |= IGNBRK | INPCK; - xNewTIO.c_cflag |= CREAD | CLOCAL; - switch ( eParity ) - { - case MB_PAR_NONE: - break; - case MB_PAR_EVEN: - xNewTIO.c_cflag |= PARENB; - break; - case MB_PAR_ODD: - xNewTIO.c_cflag |= PARENB | PARODD; - break; - default: - bStatus = FALSE; - } - switch ( ucDataBits ) - { - case 8: - xNewTIO.c_cflag |= CS8; - break; - case 7: - xNewTIO.c_cflag |= CS7; - break; - default: - bStatus = FALSE; - } - switch ( ulBaudRate ) - { - case 9600: - xNewSpeed = B9600; - break; - case 19200: - xNewSpeed = B19200; - break; - case 38400: - xNewSpeed = B38400; - break; - case 57600: - xNewSpeed = B57600; - break; - case 115200: - xNewSpeed = B115200; - break; - default: - bStatus = FALSE; - } - /*设置等待时间和最小接收字符*/ - xNewTIO.c_cc[VTIME] = 0; - xNewTIO.c_cc[VMIN] = 0; - /*处理未接收字符*/ - tcflush(iSerialFd,TCIFLUSH); //lch add - if( bStatus ) - { - if( cfsetispeed( &xNewTIO, xNewSpeed ) != 0 ) - { - vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld for port %s: %s\n", - ulBaudRate, strerror( errno ) ); - } - else if( cfsetospeed( &xNewTIO, xNewSpeed ) != 0 ) - { - vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld for port %s: %s\n", - ulBaudRate, szDevice, strerror( errno ) ); - } - else if( tcsetattr( iSerialFd, TCSANOW, &xNewTIO ) != 0 ) - //else if( tcsetattr( iSerialFd, TCSAFLUSH, &xNewTIO ) != 0 ) //lch fix - { - vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set settings for port %s: %s\n", - szDevice, strerror( errno ) ); - } - else - { - vMBPortSerialEnable( FALSE, FALSE ); - bStatus = TRUE; - } - } - } - return bStatus; -} - -BOOL -xMBPortSerialSetTimeout( ULONG ulNewTimeoutMs ) -{ - if( ulNewTimeoutMs > 0 ) - { - ulTimeoutMs = ulNewTimeoutMs; - } - else - { - ulTimeoutMs = 1; - } - return TRUE; -} - -void -vMBPortClose( void ) -{ - if( iSerialFd != -1 ) - { - ( void )tcsetattr( iSerialFd, TCSANOW, &xOldTIO ); - ( void )close( iSerialFd ); - iSerialFd = -1; - } -} - -BOOL -prvbMBPortSerialRead( UCHAR * pucBuffer, USHORT usNBytes, USHORT * usNBytesRead ) -{ - BOOL bResult = TRUE; - ssize_t res; - fd_set rfds; - struct timeval tv; - -// tv.tv_sec = 1; -// tv.tv_usec = 60000; - tv.tv_sec = 0; - tv.tv_usec = 10000; //lch fix - - FD_ZERO( &rfds ); - FD_SET( iSerialFd, &rfds ); - - /* Wait until character received or timeout. Recover in case of an - * interrupted read system call. */ - do - { - if( select( iSerialFd + 1, &rfds, NULL, NULL, &tv ) == -1 ) - { - if( errno != EINTR ) - { - bResult = FALSE; - } - } - else if( FD_ISSET( iSerialFd, &rfds ) ) - { - if( ( res = read( iSerialFd, pucBuffer, usNBytes ) ) == -1 ) - { - bResult = FALSE; - } - else - { - *usNBytesRead = ( USHORT ) res; - break; - } - } - else - { - *usNBytesRead = 0; - break; - } - } - while( bResult == TRUE ); - return bResult; -} - -BOOL -prvbMBPortSerialWrite( UCHAR * pucBuffer, USHORT usNBytes ) -{ - ssize_t res; - size_t left = ( size_t ) usNBytes; - size_t done = 0; - - while( left > 0 ) - { - if( ( res = write( iSerialFd, pucBuffer + done, left ) ) == -1 ) - { - if( errno != EINTR ) - { - break; - } - /* call write again because of interrupted system call. */ - continue; - } - done += res; - left -= res; - } - return left == 0 ? TRUE : FALSE; -} - -BOOL -xMBPortSerialPoll( ) -{ - BOOL bStatus = TRUE; - USHORT usBytesRead; - int i; - - while( bRxEnabled ) - { - if( prvbMBPortSerialRead( &ucBuffer[0], BUF_SIZE, &usBytesRead ) ) - { - if( usBytesRead == 0 ) - { - /* timeout with no bytes. */ - break; - } - else if( usBytesRead > 0 ) - { - for( i = 0; i < usBytesRead; i++ ) - { - /* Call the modbus stack and let him fill the buffers. */ - ( void )pxMBFrameCBByteReceived( ); - } - uiRxBufferPos = 0; - } - } - else - { - vMBPortLog( MB_LOG_ERROR, "SER-POLL", "read failed on serial device: %s\n", - strerror( errno ) ); - bStatus = FALSE; - } - } - if( bTxEnabled ) - { - while( bTxEnabled ) - { - ( void )pxMBFrameCBTransmitterEmpty( ); - /* Call the modbus stack to let him fill the buffer. */ - } - if( !prvbMBPortSerialWrite( &ucBuffer[0], uiTxBufferPos ) ) - { - vMBPortLog( MB_LOG_ERROR, "SER-POLL", "write failed on serial device: %s\n", - strerror( errno ) ); - bStatus = FALSE; - } - } - - return bStatus; -} - -BOOL -xMBPortSerialPutByte( CHAR ucByte ) -{ - assert( uiTxBufferPos < BUF_SIZE ); - ucBuffer[uiTxBufferPos] = ucByte; - uiTxBufferPos++; - return TRUE; -} - -BOOL -xMBPortSerialGetByte( CHAR * pucByte ) -{ - assert( uiRxBufferPos < BUF_SIZE ); - *pucByte = ucBuffer[uiRxBufferPos]; - uiRxBufferPos++; - return TRUE; -} +/* + * FreeModbus Libary: Linux Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: portserial.c,v 1.3 2006/10/12 08:35:34 wolti Exp $ + */ + +/* ----------------------- Standard includes --------------------------------*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" +#include "mbconfig.h" + +/* ----------------------- Defines -----------------------------------------*/ +#if MB_ASCII_ENABLED == 1 +#define BUF_SIZE 513 /* must hold a complete ASCII frame. */ +#else +#define BUF_SIZE 256 /* must hold a complete RTU frame. */ +#endif + +/* ----------------------- Static variables ---------------------------------*/ +static int iSerialFd = -1; +static BOOL bRxEnabled; +static BOOL bTxEnabled; + +static ULONG ulTimeoutMs; +static UCHAR ucBuffer[BUF_SIZE]; +static int uiRxBufferPos; +static int uiTxBufferPos; + +static struct termios xOldTIO; + +/* ----------------------- Function prototypes ------------------------------*/ +static BOOL prvbMBPortSerialRead( UCHAR * pucBuffer, USHORT usNBytes, USHORT * usNBytesRead ); +static BOOL prvbMBPortSerialWrite( UCHAR * pucBuffer, USHORT usNBytes ); + +/* ----------------------- Begin implementation -----------------------------*/ +void +vMBPortSerialEnable( BOOL bEnableRx, BOOL bEnableTx ) +{ + /* it is not allowed that both receiver and transmitter are enabled. */ + assert( !bEnableRx || !bEnableTx ); + + if( bEnableRx ) + { + ( void )tcflush( iSerialFd, TCIFLUSH ); + uiRxBufferPos = 0; + bRxEnabled = TRUE; + } + else + { + bRxEnabled = FALSE; + } + if( bEnableTx ) + { + bTxEnabled = TRUE; + uiTxBufferPos = 0; + } + else + { + bTxEnabled = FALSE; + } +} + +BOOL +xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity ) +{ + CHAR szDevice[16]; + BOOL bStatus = TRUE; + + struct termios xNewTIO; + speed_t xNewSpeed; + + //snprintf( szDevice, 16, "/dev/ttyUSB%d", ucPort ); + snprintf( szDevice, 16, "/dev/ttyO1"); + + if( ( iSerialFd = open( szDevice, O_RDWR | O_NOCTTY ) ) < 0 ) + { + vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't open serial port %s: %s\n", szDevice, + strerror( errno ) ); + bStatus = FALSE; + return bStatus; + } + else if( tcgetattr( iSerialFd, &xOldTIO ) != 0 ) + { + vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't get settings from port %s: %s\n", szDevice, + strerror( errno ) ); + } + else + { + bzero( &xNewTIO, sizeof( struct termios ) ); + + xNewTIO.c_iflag |= IGNBRK | INPCK; + xNewTIO.c_cflag |= CREAD | CLOCAL; + switch ( eParity ) + { + case MB_PAR_NONE: + break; + case MB_PAR_EVEN: + xNewTIO.c_cflag |= PARENB; + break; + case MB_PAR_ODD: + xNewTIO.c_cflag |= PARENB | PARODD; + break; + default: + bStatus = FALSE; + } + switch ( ucDataBits ) + { + case 8: + xNewTIO.c_cflag |= CS8; + break; + case 7: + xNewTIO.c_cflag |= CS7; + break; + default: + bStatus = FALSE; + } + switch ( ulBaudRate ) + { + case 9600: + xNewSpeed = B9600; + break; + case 19200: + xNewSpeed = B19200; + break; + case 38400: + xNewSpeed = B38400; + break; + case 57600: + xNewSpeed = B57600; + break; + case 115200: + xNewSpeed = B115200; + break; + default: + bStatus = FALSE; + } + /*设置等待时间和最小接收字符*/ + xNewTIO.c_cc[VTIME] = 0; + xNewTIO.c_cc[VMIN] = 0; + /*处理未接收字符*/ + tcflush(iSerialFd,TCIFLUSH); //lch add + if( bStatus ) + { + if( cfsetispeed( &xNewTIO, xNewSpeed ) != 0 ) + { + vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld for port %s: %s\n", + ulBaudRate, strerror( errno ) ); + } + else if( cfsetospeed( &xNewTIO, xNewSpeed ) != 0 ) + { + vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld for port %s: %s\n", + ulBaudRate, szDevice, strerror( errno ) ); + } + else if( tcsetattr( iSerialFd, TCSANOW, &xNewTIO ) != 0 ) + //else if( tcsetattr( iSerialFd, TCSAFLUSH, &xNewTIO ) != 0 ) //lch fix + { + vMBPortLog( MB_LOG_ERROR, "SER-INIT", "Can't set settings for port %s: %s\n", + szDevice, strerror( errno ) ); + } + else + { + vMBPortSerialEnable( FALSE, FALSE ); + bStatus = TRUE; + } + } + } + return bStatus; +} + +BOOL +xMBPortSerialSetTimeout( ULONG ulNewTimeoutMs ) +{ + if( ulNewTimeoutMs > 0 ) + { + ulTimeoutMs = ulNewTimeoutMs; + } + else + { + ulTimeoutMs = 1; + } + return TRUE; +} + +void +vMBPortClose( void ) +{ + if( iSerialFd != -1 ) + { + ( void )tcsetattr( iSerialFd, TCSANOW, &xOldTIO ); + ( void )close( iSerialFd ); + iSerialFd = -1; + } +} + +BOOL +prvbMBPortSerialRead( UCHAR * pucBuffer, USHORT usNBytes, USHORT * usNBytesRead ) +{ + BOOL bResult = TRUE; + ssize_t res; + fd_set rfds; + struct timeval tv; + +// tv.tv_sec = 1; +// tv.tv_usec = 60000; + tv.tv_sec = 0; + tv.tv_usec = 10000; //lch fix + + FD_ZERO( &rfds ); + FD_SET( iSerialFd, &rfds ); + + /* Wait until character received or timeout. Recover in case of an + * interrupted read system call. */ + do + { + if( select( iSerialFd + 1, &rfds, NULL, NULL, &tv ) == -1 ) + { + if( errno != EINTR ) + { + bResult = FALSE; + } + } + else if( FD_ISSET( iSerialFd, &rfds ) ) + { + if( ( res = read( iSerialFd, pucBuffer, usNBytes ) ) == -1 ) + { + bResult = FALSE; + } + else + { + *usNBytesRead = ( USHORT ) res; + break; + } + } + else + { + *usNBytesRead = 0; + break; + } + } + while( bResult == TRUE ); + return bResult; +} + +BOOL +prvbMBPortSerialWrite( UCHAR * pucBuffer, USHORT usNBytes ) +{ + ssize_t res; + size_t left = ( size_t ) usNBytes; + size_t done = 0; + + while( left > 0 ) + { + if( ( res = write( iSerialFd, pucBuffer + done, left ) ) == -1 ) + { + if( errno != EINTR ) + { + break; + } + /* call write again because of interrupted system call. */ + continue; + } + done += res; + left -= res; + } + return left == 0 ? TRUE : FALSE; +} + +BOOL +xMBPortSerialPoll( ) +{ + BOOL bStatus = TRUE; + USHORT usBytesRead; + int i; + + while( bRxEnabled ) + { + if( prvbMBPortSerialRead( &ucBuffer[0], BUF_SIZE, &usBytesRead ) ) + { + if( usBytesRead == 0 ) + { + /* timeout with no bytes. */ + break; + } + else if( usBytesRead > 0 ) + { + for( i = 0; i < usBytesRead; i++ ) + { + /* Call the modbus stack and let him fill the buffers. */ + ( void )pxMBFrameCBByteReceived( ); + } + uiRxBufferPos = 0; + } + } + else + { + vMBPortLog( MB_LOG_ERROR, "SER-POLL", "read failed on serial device: %s\n", + strerror( errno ) ); + bStatus = FALSE; + } + } + if( bTxEnabled ) + { + while( bTxEnabled ) + { + ( void )pxMBFrameCBTransmitterEmpty( ); + /* Call the modbus stack to let him fill the buffer. */ + } + if( !prvbMBPortSerialWrite( &ucBuffer[0], uiTxBufferPos ) ) + { + vMBPortLog( MB_LOG_ERROR, "SER-POLL", "write failed on serial device: %s\n", + strerror( errno ) ); + bStatus = FALSE; + } + } + + return bStatus; +} + +BOOL +xMBPortSerialPutByte( CHAR ucByte ) +{ + assert( uiTxBufferPos < BUF_SIZE ); + ucBuffer[uiTxBufferPos] = ucByte; + uiTxBufferPos++; + return TRUE; +} + +BOOL +xMBPortSerialGetByte( CHAR * pucByte ) +{ + assert( uiRxBufferPos < BUF_SIZE ); + *pucByte = ucBuffer[uiRxBufferPos]; + uiRxBufferPos++; + return TRUE; +} diff --git a/modbus/port/porttcp.c b/modbus/port/porttcp.c index c193e07..43df2b6 100644 --- a/modbus/port/porttcp.c +++ b/modbus/port/porttcp.c @@ -1,385 +1,385 @@ -/* - * FreeModbus Libary: Win32 Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: porttcp.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ - */ - -/* - * Design Notes: - * - * The xMBPortTCPInit function allocates a socket and binds the socket to - * all available interfaces ( bind with INADDR_ANY ). In addition it - * creates an array of event objects which is used to check the state of - * the clients. On event object is used to handle new connections or - * closed ones. The other objects are used on a per client basis for - * processing. - */ - - /********************************************************** - * Linux TCP support. - * Based on Walter's project. - * Modified by Steven Guo - ***********************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" - -//#include - -/* ----------------------- MBAP Header --------------------------------------*/ -#define MB_TCP_UID 6 -#define MB_TCP_LEN 4 -#define MB_TCP_FUNC 7 - -/* ----------------------- Defines -----------------------------------------*/ -#define MB_TCP_DEFAULT_PORT 5022//5022 /* TCP listening port. */ -#define MB_TCP_POOL_TIMEOUT 50 /* pool timeout for event waiting. */ -#define MB_TCP_READ_TIMEOUT 1000 /* Maximum timeout to wait for packets. */ -#define MB_TCP_READ_CYCLE 100 /* Time between checking for new data. */ - -#define MB_TCP_DEBUG 1 /* Set to 1 for additional debug output. */ - -#define MB_TCP_BUF_SIZE ( 256 + 7 ) /* Must hold a complete Modbus TCP frame. */ - -#define EV_CONNECTION 0 -#define EV_CLIENT 1 -#define EV_NEVENTS EV_CLIENT + 1 - -/* ----------------------- Static variables ---------------------------------*/ -SOCKET xListenSocket; -SOCKET xClientSocket = INVALID_SOCKET; -static fd_set allset; - -static UCHAR aucTCPBuf[MB_TCP_BUF_SIZE]; -static USHORT usTCPBufPos; -static USHORT usTCPFrameBytesLeft; - -/* ----------------------- External functions -------------------------------*/ -CHAR *WsaError2String( int dwError ); - -/* ----------------------- Static functions ---------------------------------*/ -BOOL prvMBTCPPortAddressToString( SOCKET xSocket, CHAR * szAddr, USHORT usBufSize ); -CHAR *prvMBTCPPortFrameToString( UCHAR * pucFrame, USHORT usFrameLen ); -static BOOL prvbMBPortAcceptClient( void ); -static void prvvMBPortReleaseClient( void ); -//static QTcpServer qListenSocket; - -/* ----------------------- Begin implementation -----------------------------*/ - -BOOL -xMBTCPPortInit( USHORT usTCPPort ) -{ - USHORT usPort; - struct sockaddr_in serveraddr; - int tmp = 1; - - if( usTCPPort == 0 ) - { - usPort = MB_TCP_DEFAULT_PORT; - } - else - { - usPort = ( USHORT ) usTCPPort; - } - memset( &serveraddr, 0, sizeof( serveraddr ) ); - serveraddr.sin_family = AF_INET; - serveraddr.sin_addr.s_addr = htonl( INADDR_ANY ); - serveraddr.sin_port = htons( usPort ); - if( ( xListenSocket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == -1 ) - { - fprintf( stderr, "Create socket failed.\r\n" ); - return FALSE; - } - if(setsockopt(xListenSocket, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(int))<0) - { - fprintf( stderr, "setsockopt socket failed.\r\n" ); - return FALSE; - } - if( bind( xListenSocket, ( struct sockaddr * )&serveraddr, sizeof( serveraddr ) ) == -1 ) - { - fprintf( stderr, "Bind socket failed.\r\n" ); - return FALSE; - } - else if( listen( xListenSocket, 1 ) == -1 ) - { - fprintf( stderr, "Listen socket failed.\r\n" ); - return FALSE; - } - FD_ZERO( &allset ); - FD_SET( xListenSocket, &allset ); - return TRUE; -} - -void -vMBTCPPortClose( ) -{ - // Close all client sockets. - if( xClientSocket != SOCKET_ERROR ) - { - prvvMBPortReleaseClient( ); - } - // Close the listener socket. - if( xListenSocket != SOCKET_ERROR ) - { - close( xListenSocket ); - } -} - -void -vMBTCPPortDisable( void ) -{ - /* Close all client sockets. */ - if( xClientSocket != SOCKET_ERROR ) - { - prvvMBPortReleaseClient( ); - } -} - -/*! \ingroup port_win32tcp - * - * \brief Pool the listening socket and currently connected Modbus TCP clients - * for new events. - * \internal - * - * This function checks if new clients want to connect or if already connected - * clients are sending requests. If a new client is connected and there are - * still client slots left (The current implementation supports only one) - * then the connection is accepted and an event object for the new client - * socket is activated (See prvbMBPortAcceptClient() ). - * Events for already existing clients in \c FD_READ and \c FD_CLOSE. In case of - * an \c FD_CLOSE the client connection is released (See prvvMBPortReleaseClient() ). - * In case of an \c FD_READ command the existing data is read from the client - * and if a complete frame has been received the Modbus Stack is notified. - * - * \return FALSE in case of an internal I/O error. For example if the internal - * event objects are in an invalid state. Note that this does not include any - * client errors. In all other cases returns TRUE. - */ -int errorCount = 0; - -BOOL -xMBPortTCPPool( void ) -{ - int n; - fd_set fread; - struct timeval tval; - - tval.tv_sec = 1; - tval.tv_usec = 60000; - int ret; - USHORT usLength; - - if( xClientSocket == INVALID_SOCKET ) - { - /* Accept to client */ - if( ( n = select( xListenSocket + 1, &allset, NULL, NULL, NULL ) ) < 0 ) - { - if( errno == EINTR ) - { - ; - } - else - { - ; - } - } - if( FD_ISSET( xListenSocket, &allset ) ) - { - ( void )prvbMBPortAcceptClient( ); - } - } - - while( TRUE ) - { - FD_ZERO( &fread ); - FD_SET( xClientSocket, &fread ); - if( ( ( ret = select( xClientSocket + 1, &fread, NULL, NULL, &tval ) ) == SOCKET_ERROR ) - || !ret ) - { - sleep(1); - errorCount++; - if(errorCount > 10) - { - errorCount = 0; - close( xClientSocket ); - xClientSocket = INVALID_SOCKET; - return TRUE; - } - continue; - } - if( ret > 0 ) - { - if( FD_ISSET( xClientSocket, &fread ) ) - { - if( ( ( ret = - recv( xClientSocket, &aucTCPBuf[usTCPBufPos], usTCPFrameBytesLeft, - 0 ) ) == SOCKET_ERROR ) || ( !ret ) ) - { - close( xClientSocket ); - xClientSocket = INVALID_SOCKET; - return TRUE; - } - usTCPBufPos += ret; - usTCPFrameBytesLeft -= ret; - if( usTCPBufPos >= MB_TCP_FUNC ) - { - /* Length is a byte count of Modbus PDU (function code + data) and the - * unit identifier. */ - usLength = aucTCPBuf[MB_TCP_LEN] << 8U; - usLength |= aucTCPBuf[MB_TCP_LEN + 1]; - - /* Is the frame already complete. */ - if( usTCPBufPos < ( MB_TCP_UID + usLength ) ) - { - usTCPFrameBytesLeft = usLength + MB_TCP_UID - usTCPBufPos; - } - /* The frame is complete. */ - else if( usTCPBufPos == ( MB_TCP_UID + usLength ) ) - { - ( void )xMBPortEventPost( EV_FRAME_RECEIVED ); - return TRUE; - } - /* This can not happend because we always calculate the number of bytes - * to receive. */ - else - { - assert( usTCPBufPos <= ( MB_TCP_UID + usLength ) ); - } - } - } - } - } - return TRUE; -} - -/*! - * \ingroup port_win32tcp - * \brief Receives parts of a Modbus TCP frame and if complete notifies - * the protocol stack. - * \internal - * - * This function reads a complete Modbus TCP frame from the protocol stack. - * It starts by reading the header with an initial request size for - * usTCPFrameBytesLeft = MB_TCP_FUNC. If the header is complete the - * number of bytes left can be calculated from it (See Length in MBAP header). - * Further read calls are issued until the frame is complete. - * - * \return \c TRUE if part of a Modbus TCP frame could be processed. In case - * of a communication error the function returns \c FALSE. - */ - -BOOL -xMBTCPPortGetRequest( UCHAR ** ppucMBTCPFrame, USHORT * usTCPLength ) -{ - *ppucMBTCPFrame = &aucTCPBuf[0]; - *usTCPLength = usTCPBufPos; - - /* Reset the buffer. */ - usTCPBufPos = 0; - usTCPFrameBytesLeft = MB_TCP_FUNC; - return TRUE; -} - -BOOL -xMBTCPPortSendResponse( const UCHAR * pucMBTCPFrame, USHORT usTCPLength ) -{ - BOOL bFrameSent = FALSE; - BOOL bAbort = FALSE; - int res; - int iBytesSent = 0; - int iTimeOut = MB_TCP_READ_TIMEOUT; - - do - { - res = send( xClientSocket, &pucMBTCPFrame[iBytesSent], usTCPLength - iBytesSent, 0 ); - switch ( res ) - { - case -1: - if( iTimeOut > 0 ) - { - iTimeOut -= MB_TCP_READ_CYCLE; - usleep( MB_TCP_READ_CYCLE ); - } - else - { - bAbort = TRUE; - } - break; - case 0: - prvvMBPortReleaseClient( ); - bAbort = TRUE; - break; - default: - iBytesSent += res; - break; - } - } - while( ( iBytesSent != usTCPLength ) && !bAbort ); - - bFrameSent = iBytesSent == usTCPLength ? TRUE : FALSE; - - return bFrameSent; -} - -void -prvvMBPortReleaseClient( ) -{ - ( void )recv( xClientSocket, &aucTCPBuf[0], MB_TCP_BUF_SIZE, 0 ); - - ( void )close( xClientSocket ); - xClientSocket = INVALID_SOCKET; -} - -BOOL -prvbMBPortAcceptClient( ) -{ - SOCKET xNewSocket; - BOOL bOkay; - - /* Check if we can handle a new connection. */ - - if( xClientSocket != INVALID_SOCKET ) - { - fprintf( stderr, "can't accept new client. all connections in use.\n" ); - bOkay = FALSE; - } - else if( ( xNewSocket = accept( xListenSocket, NULL, NULL ) ) == INVALID_SOCKET ) - { - bOkay = FALSE; - } - else - { - xClientSocket = xNewSocket; - usTCPBufPos = 0; - usTCPFrameBytesLeft = MB_TCP_FUNC; - bOkay = TRUE; - } - return bOkay; -} +/* + * FreeModbus Libary: Win32 Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: porttcp.c,v 1.1 2007/09/12 10:15:56 wolti Exp $ + */ + +/* + * Design Notes: + * + * The xMBPortTCPInit function allocates a socket and binds the socket to + * all available interfaces ( bind with INADDR_ANY ). In addition it + * creates an array of event objects which is used to check the state of + * the clients. On event object is used to handle new connections or + * closed ones. The other objects are used on a per client basis for + * processing. + */ + + /********************************************************** + * Linux TCP support. + * Based on Walter's project. + * Modified by Steven Guo + ***********************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" + +//#include + +/* ----------------------- MBAP Header --------------------------------------*/ +#define MB_TCP_UID 6 +#define MB_TCP_LEN 4 +#define MB_TCP_FUNC 7 + +/* ----------------------- Defines -----------------------------------------*/ +#define MB_TCP_DEFAULT_PORT 5022//5022 /* TCP listening port. */ +#define MB_TCP_POOL_TIMEOUT 50 /* pool timeout for event waiting. */ +#define MB_TCP_READ_TIMEOUT 1000 /* Maximum timeout to wait for packets. */ +#define MB_TCP_READ_CYCLE 100 /* Time between checking for new data. */ + +#define MB_TCP_DEBUG 1 /* Set to 1 for additional debug output. */ + +#define MB_TCP_BUF_SIZE ( 256 + 7 ) /* Must hold a complete Modbus TCP frame. */ + +#define EV_CONNECTION 0 +#define EV_CLIENT 1 +#define EV_NEVENTS EV_CLIENT + 1 + +/* ----------------------- Static variables ---------------------------------*/ +SOCKET xListenSocket; +SOCKET xClientSocket = INVALID_SOCKET; +static fd_set allset; + +static UCHAR aucTCPBuf[MB_TCP_BUF_SIZE]; +static USHORT usTCPBufPos; +static USHORT usTCPFrameBytesLeft; + +/* ----------------------- External functions -------------------------------*/ +CHAR *WsaError2String( int dwError ); + +/* ----------------------- Static functions ---------------------------------*/ +BOOL prvMBTCPPortAddressToString( SOCKET xSocket, CHAR * szAddr, USHORT usBufSize ); +CHAR *prvMBTCPPortFrameToString( UCHAR * pucFrame, USHORT usFrameLen ); +static BOOL prvbMBPortAcceptClient( void ); +static void prvvMBPortReleaseClient( void ); +//static QTcpServer qListenSocket; + +/* ----------------------- Begin implementation -----------------------------*/ + +BOOL +xMBTCPPortInit( USHORT usTCPPort ) +{ + USHORT usPort; + struct sockaddr_in serveraddr; + int tmp = 1; + + if( usTCPPort == 0 ) + { + usPort = MB_TCP_DEFAULT_PORT; + } + else + { + usPort = ( USHORT ) usTCPPort; + } + memset( &serveraddr, 0, sizeof( serveraddr ) ); + serveraddr.sin_family = AF_INET; + serveraddr.sin_addr.s_addr = htonl( INADDR_ANY ); + serveraddr.sin_port = htons( usPort ); + if( ( xListenSocket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == -1 ) + { + fprintf( stderr, "Create socket failed.\r\n" ); + return FALSE; + } + if(setsockopt(xListenSocket, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(int))<0) + { + fprintf( stderr, "setsockopt socket failed.\r\n" ); + return FALSE; + } + if( bind( xListenSocket, ( struct sockaddr * )&serveraddr, sizeof( serveraddr ) ) == -1 ) + { + fprintf( stderr, "Bind socket failed.\r\n" ); + return FALSE; + } + else if( listen( xListenSocket, 1 ) == -1 ) + { + fprintf( stderr, "Listen socket failed.\r\n" ); + return FALSE; + } + FD_ZERO( &allset ); + FD_SET( xListenSocket, &allset ); + return TRUE; +} + +void +vMBTCPPortClose( ) +{ + // Close all client sockets. + if( xClientSocket != SOCKET_ERROR ) + { + prvvMBPortReleaseClient( ); + } + // Close the listener socket. + if( xListenSocket != SOCKET_ERROR ) + { + close( xListenSocket ); + } +} + +void +vMBTCPPortDisable( void ) +{ + /* Close all client sockets. */ + if( xClientSocket != SOCKET_ERROR ) + { + prvvMBPortReleaseClient( ); + } +} + +/*! \ingroup port_win32tcp + * + * \brief Pool the listening socket and currently connected Modbus TCP clients + * for new events. + * \internal + * + * This function checks if new clients want to connect or if already connected + * clients are sending requests. If a new client is connected and there are + * still client slots left (The current implementation supports only one) + * then the connection is accepted and an event object for the new client + * socket is activated (See prvbMBPortAcceptClient() ). + * Events for already existing clients in \c FD_READ and \c FD_CLOSE. In case of + * an \c FD_CLOSE the client connection is released (See prvvMBPortReleaseClient() ). + * In case of an \c FD_READ command the existing data is read from the client + * and if a complete frame has been received the Modbus Stack is notified. + * + * \return FALSE in case of an internal I/O error. For example if the internal + * event objects are in an invalid state. Note that this does not include any + * client errors. In all other cases returns TRUE. + */ +int errorCount = 0; + +BOOL +xMBPortTCPPool( void ) +{ + int n; + fd_set fread; + struct timeval tval; + + tval.tv_sec = 1; + tval.tv_usec = 60000; + int ret; + USHORT usLength; + + if( xClientSocket == INVALID_SOCKET ) + { + /* Accept to client */ + if( ( n = select( xListenSocket + 1, &allset, NULL, NULL, NULL ) ) < 0 ) + { + if( errno == EINTR ) + { + ; + } + else + { + ; + } + } + if( FD_ISSET( xListenSocket, &allset ) ) + { + ( void )prvbMBPortAcceptClient( ); + } + } + + while( TRUE ) + { + FD_ZERO( &fread ); + FD_SET( xClientSocket, &fread ); + if( ( ( ret = select( xClientSocket + 1, &fread, NULL, NULL, &tval ) ) == SOCKET_ERROR ) + || !ret ) + { + sleep(1); + errorCount++; + if(errorCount > 10) + { + errorCount = 0; + close( xClientSocket ); + xClientSocket = INVALID_SOCKET; + return TRUE; + } + continue; + } + if( ret > 0 ) + { + if( FD_ISSET( xClientSocket, &fread ) ) + { + if( ( ( ret = + recv( xClientSocket, &aucTCPBuf[usTCPBufPos], usTCPFrameBytesLeft, + 0 ) ) == SOCKET_ERROR ) || ( !ret ) ) + { + close( xClientSocket ); + xClientSocket = INVALID_SOCKET; + return TRUE; + } + usTCPBufPos += ret; + usTCPFrameBytesLeft -= ret; + if( usTCPBufPos >= MB_TCP_FUNC ) + { + /* Length is a byte count of Modbus PDU (function code + data) and the + * unit identifier. */ + usLength = aucTCPBuf[MB_TCP_LEN] << 8U; + usLength |= aucTCPBuf[MB_TCP_LEN + 1]; + + /* Is the frame already complete. */ + if( usTCPBufPos < ( MB_TCP_UID + usLength ) ) + { + usTCPFrameBytesLeft = usLength + MB_TCP_UID - usTCPBufPos; + } + /* The frame is complete. */ + else if( usTCPBufPos == ( MB_TCP_UID + usLength ) ) + { + ( void )xMBPortEventPost( EV_FRAME_RECEIVED ); + return TRUE; + } + /* This can not happend because we always calculate the number of bytes + * to receive. */ + else + { + assert( usTCPBufPos <= ( MB_TCP_UID + usLength ) ); + } + } + } + } + } + return TRUE; +} + +/*! + * \ingroup port_win32tcp + * \brief Receives parts of a Modbus TCP frame and if complete notifies + * the protocol stack. + * \internal + * + * This function reads a complete Modbus TCP frame from the protocol stack. + * It starts by reading the header with an initial request size for + * usTCPFrameBytesLeft = MB_TCP_FUNC. If the header is complete the + * number of bytes left can be calculated from it (See Length in MBAP header). + * Further read calls are issued until the frame is complete. + * + * \return \c TRUE if part of a Modbus TCP frame could be processed. In case + * of a communication error the function returns \c FALSE. + */ + +BOOL +xMBTCPPortGetRequest( UCHAR ** ppucMBTCPFrame, USHORT * usTCPLength ) +{ + *ppucMBTCPFrame = &aucTCPBuf[0]; + *usTCPLength = usTCPBufPos; + + /* Reset the buffer. */ + usTCPBufPos = 0; + usTCPFrameBytesLeft = MB_TCP_FUNC; + return TRUE; +} + +BOOL +xMBTCPPortSendResponse( const UCHAR * pucMBTCPFrame, USHORT usTCPLength ) +{ + BOOL bFrameSent = FALSE; + BOOL bAbort = FALSE; + int res; + int iBytesSent = 0; + int iTimeOut = MB_TCP_READ_TIMEOUT; + + do + { + res = send( xClientSocket, &pucMBTCPFrame[iBytesSent], usTCPLength - iBytesSent, 0 ); + switch ( res ) + { + case -1: + if( iTimeOut > 0 ) + { + iTimeOut -= MB_TCP_READ_CYCLE; + usleep( MB_TCP_READ_CYCLE ); + } + else + { + bAbort = TRUE; + } + break; + case 0: + prvvMBPortReleaseClient( ); + bAbort = TRUE; + break; + default: + iBytesSent += res; + break; + } + } + while( ( iBytesSent != usTCPLength ) && !bAbort ); + + bFrameSent = iBytesSent == usTCPLength ? TRUE : FALSE; + + return bFrameSent; +} + +void +prvvMBPortReleaseClient( ) +{ + ( void )recv( xClientSocket, &aucTCPBuf[0], MB_TCP_BUF_SIZE, 0 ); + + ( void )close( xClientSocket ); + xClientSocket = INVALID_SOCKET; +} + +BOOL +prvbMBPortAcceptClient( ) +{ + SOCKET xNewSocket; + BOOL bOkay; + + /* Check if we can handle a new connection. */ + + if( xClientSocket != INVALID_SOCKET ) + { + fprintf( stderr, "can't accept new client. all connections in use.\n" ); + bOkay = FALSE; + } + else if( ( xNewSocket = accept( xListenSocket, NULL, NULL ) ) == INVALID_SOCKET ) + { + bOkay = FALSE; + } + else + { + xClientSocket = xNewSocket; + usTCPBufPos = 0; + usTCPFrameBytesLeft = MB_TCP_FUNC; + bOkay = TRUE; + } + return bOkay; +} diff --git a/modbus/port/porttimer.c b/modbus/port/porttimer.c index c2cf0f2..a8bf3a9 100644 --- a/modbus/port/porttimer.c +++ b/modbus/port/porttimer.c @@ -1,97 +1,97 @@ -/* - * FreeModbus Libary: Linux Port - * Copyright (C) 2006 Christian Walter - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * File: $Id: porttimer.c,v 1.1 2006/08/01 20:58:50 wolti Exp $ - */ - -/* ----------------------- Standard includes --------------------------------*/ -#include -#include - -#include "port.h" - -/* ----------------------- Modbus includes ----------------------------------*/ -#include "mb.h" -#include "mbport.h" - -/* ----------------------- Defines ------------------------------------------*/ - -/* ----------------------- Static variables ---------------------------------*/ -ULONG ulTimeOut; -BOOL bTimeoutEnable; - -static struct timeval xTimeLast; - -/* ----------------------- Start implementation -----------------------------*/ -BOOL -xMBPortTimersInit( USHORT usTim1Timerout50us ) -{ - ulTimeOut = usTim1Timerout50us / 20U; - if( ulTimeOut == 0 ) - ulTimeOut = 1; - - return xMBPortSerialSetTimeout( ulTimeOut ); -} - -void -xMBPortTimersClose( ) -{ - /* Does not use any hardware resources. */ -} - -void -vMBPortTimerPoll( ) -{ - ULONG ulDeltaMS; - struct timeval xTimeCur; - - /* Timers are called from the serial layer because we have no high - * res timer in Win32. */ - if( bTimeoutEnable ) - { - if( gettimeofday( &xTimeCur, NULL ) != 0 ) - { - /* gettimeofday failed - retry next time. */ - } - else - { - ulDeltaMS = ( xTimeCur.tv_sec - xTimeLast.tv_sec ) * 1000L + - ( xTimeCur.tv_usec - xTimeLast.tv_usec ) * 1000L; - if( ulDeltaMS > ulTimeOut ) - { - bTimeoutEnable = FALSE; - ( void )pxMBPortCBTimerExpired( ); - } - } - } -} - -void -vMBPortTimersEnable( ) -{ - int res = gettimeofday( &xTimeLast, NULL ); - - assert( res == 0 ); - bTimeoutEnable = TRUE; -} - -void -vMBPortTimersDisable( ) -{ - bTimeoutEnable = FALSE; -} +/* + * FreeModbus Libary: Linux Port + * Copyright (C) 2006 Christian Walter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * File: $Id: porttimer.c,v 1.1 2006/08/01 20:58:50 wolti Exp $ + */ + +/* ----------------------- Standard includes --------------------------------*/ +#include +#include + +#include "port.h" + +/* ----------------------- Modbus includes ----------------------------------*/ +#include "mb.h" +#include "mbport.h" + +/* ----------------------- Defines ------------------------------------------*/ + +/* ----------------------- Static variables ---------------------------------*/ +ULONG ulTimeOut; +BOOL bTimeoutEnable; + +static struct timeval xTimeLast; + +/* ----------------------- Start implementation -----------------------------*/ +BOOL +xMBPortTimersInit( USHORT usTim1Timerout50us ) +{ + ulTimeOut = usTim1Timerout50us / 20U; + if( ulTimeOut == 0 ) + ulTimeOut = 1; + + return xMBPortSerialSetTimeout( ulTimeOut ); +} + +void +xMBPortTimersClose( ) +{ + /* Does not use any hardware resources. */ +} + +void +vMBPortTimerPoll( ) +{ + ULONG ulDeltaMS; + struct timeval xTimeCur; + + /* Timers are called from the serial layer because we have no high + * res timer in Win32. */ + if( bTimeoutEnable ) + { + if( gettimeofday( &xTimeCur, NULL ) != 0 ) + { + /* gettimeofday failed - retry next time. */ + } + else + { + ulDeltaMS = ( xTimeCur.tv_sec - xTimeLast.tv_sec ) * 1000L + + ( xTimeCur.tv_usec - xTimeLast.tv_usec ) * 1000L; + if( ulDeltaMS > ulTimeOut ) + { + bTimeoutEnable = FALSE; + ( void )pxMBPortCBTimerExpired( ); + } + } + } +} + +void +vMBPortTimersEnable( ) +{ + int res = gettimeofday( &xTimeLast, NULL ); + + assert( res == 0 ); + bTimeoutEnable = TRUE; +} + +void +vMBPortTimersDisable( ) +{ + bTimeoutEnable = FALSE; +} diff --git a/moveinput.cpp b/moveinput.cpp index eb08e7a..ffb08bf 100644 --- a/moveinput.cpp +++ b/moveinput.cpp @@ -1,48 +1,48 @@ -#include "moveinput.h" -#include "ui_moveinput.h" -//#include -#include "MyInputMethod.h" - -MoveInput::MoveInput(QWidget *parent) : - QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)), - ui(new Ui::MoveInput) -{ - ui->setupUi(this); - - connect(ui->Key_left,SIGNAL(pressed()),this,SLOT(onKeyLeftPressed())); - connect(ui->Key_right,SIGNAL(pressed()),this,SLOT(onKeyRightPressed())); - connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed())); - connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed())); -} - -MoveInput::~MoveInput() -{ - delete ui; -} - - -void MoveInput::onKeyLeftPressed(){ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); -#endif -} - -void MoveInput::onKeyRightPressed(){ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); -#endif -} -void MoveInput::onKeyUpPressed(){ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); -#endif -} -void MoveInput::onKeyDownPressed(){ -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); -#endif -} +#include "moveinput.h" +#include "ui_moveinput.h" +//#include +#include "MyInputMethod.h" + +MoveInput::MoveInput(QWidget *parent) : + QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool)), + ui(new Ui::MoveInput) +{ + ui->setupUi(this); + + connect(ui->Key_left,SIGNAL(pressed()),this,SLOT(onKeyLeftPressed())); + connect(ui->Key_right,SIGNAL(pressed()),this,SLOT(onKeyRightPressed())); + connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed())); + connect(ui->Key_down,SIGNAL(pressed()),this,SLOT(onKeyDownPressed())); +} + +MoveInput::~MoveInput() +{ + delete ui; +} + + +void MoveInput::onKeyLeftPressed(){ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); +#endif +} + +void MoveInput::onKeyRightPressed(){ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); +#endif +} +void MoveInput::onKeyUpPressed(){ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); +#endif +} +void MoveInput::onKeyDownPressed(){ +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); +#endif +} diff --git a/moveinput.h b/moveinput.h index 0361e9a..4d23ad0 100644 --- a/moveinput.h +++ b/moveinput.h @@ -1,28 +1,28 @@ -#ifndef MOVEINPUT_H -#define MOVEINPUT_H - -#include - -namespace Ui { -class MoveInput; -} - -class MoveInput : public QWidget -{ - Q_OBJECT - -public: - explicit MoveInput(QWidget *parent = 0); - ~MoveInput(); - -private slots: - void onKeyLeftPressed(); - void onKeyRightPressed(); - void onKeyUpPressed(); - void onKeyDownPressed(); - -private: - Ui::MoveInput *ui; -}; - -#endif // MOVEINPUT_H +#ifndef MOVEINPUT_H +#define MOVEINPUT_H + +#include + +namespace Ui { +class MoveInput; +} + +class MoveInput : public QWidget +{ + Q_OBJECT + +public: + explicit MoveInput(QWidget *parent = 0); + ~MoveInput(); + +private slots: + void onKeyLeftPressed(); + void onKeyRightPressed(); + void onKeyUpPressed(); + void onKeyDownPressed(); + +private: + Ui::MoveInput *ui; +}; + +#endif // MOVEINPUT_H diff --git a/moveinput.ui b/moveinput.ui index 3eee85e..fe6712a 100644 --- a/moveinput.ui +++ b/moveinput.ui @@ -1,181 +1,181 @@ - - - MoveInput - - - - 0 - 0 - 323 - 230 - - - - - - - - - 255 - 255 - 255 - - - - - - - 202 - 201 - 201 - - - - - - - - - 255 - 255 - 255 - - - - - - - 202 - 201 - 201 - - - - - - - - - 202 - 201 - 201 - - - - - - - 202 - 201 - 201 - - - - - - - - - - - - - 19 - 9 - 290 - 211 - - - - - - - - 0 - 50 - - - - - - - - :/icon/keyleft.png:/icon/keyleft.png - - - - - - - - 0 - 50 - - - - - - - - :/icon/keyup.png:/icon/keyup.png - - - - - - - false - - - - 0 - 50 - - - - - - - - - - - - 0 - 50 - - - - - - - - :/icon/keydown.png:/icon/keydown.png - - - - - - - - 0 - 50 - - - - - - - - :/icon/keyright.png:/icon/keyright.png - - - - - - - - - - - + + + MoveInput + + + + 0 + 0 + 323 + 230 + + + + + + + + + 255 + 255 + 255 + + + + + + + 202 + 201 + 201 + + + + + + + + + 255 + 255 + 255 + + + + + + + 202 + 201 + 201 + + + + + + + + + 202 + 201 + 201 + + + + + + + 202 + 201 + 201 + + + + + + + + + + + + + 19 + 9 + 290 + 211 + + + + + + + + 0 + 50 + + + + + + + + :/icon/keyleft.png:/icon/keyleft.png + + + + + + + + 0 + 50 + + + + + + + + :/icon/keyup.png:/icon/keyup.png + + + + + + + false + + + + 0 + 50 + + + + + + + + + + + + 0 + 50 + + + + + + + + :/icon/keydown.png:/icon/keydown.png + + + + + + + + 0 + 50 + + + + + + + + :/icon/keyright.png:/icon/keyright.png + + + + + + + + + + + diff --git a/mycom.cpp b/mycom.cpp index 45d8b3e..fb7c67a 100644 --- a/mycom.cpp +++ b/mycom.cpp @@ -1,198 +1,198 @@ -#include "mycom.h" -#define TTY_DEV "/dev/ttyUSB" //端口路径 如果是在电脑端选择ttyUSB,在mini2440端则选择ttySAC -//#define TTY_DEV "/dev/ttySAC" -#define TIMEOUT_SEC(buflen,baud) (buflen*20/baud+2)//接收超时 -#define TIMEOUT_USEC 0 -/************************************************* -fuction: char *get_ptty(pportinfo_t pportinfo) -description: get thd uart name -return: ptty -**************************************************/ -static char *get_ptty(pportinfo_t pportinfo) -{ - char *ptty=NULL; - switch(pportinfo->tty) - { - case '0': - ptty=TTY_DEV"0"; - break; - case '1': - ptty=TTY_DEV"1"; - break; - case '2': - ptty=TTY_DEV"2"; - break; - } - return ptty; -} -/************************************************* -fuction: convbaud(unsigned long int baudrate) -description: baud change -return: ptty -**************************************************/ -static int convbaud(unsigned long int baudrate) -{ - switch(baudrate){ - case 2400: - return B2400; - case 4800: - return B4800; - case 9600: - return B9600; - case 19200: - return B19200; - case 38400: - return B38400; - case 57600: - return B57600; - case 115200: - return B115200; - default: - return B9600; - } -} -/**************************************************************** -fuction: convbaud(unsigned long int baudrate) -description: set the uart -parameters: fdcom: 串口文件描述符, - pportinfo: 待设置的串口信息 -return: tmp -******************************************************************/ -int PortSet(int fdcom, const pportinfo_t pportinfo) -{ - struct termios termios_old, termios_new; - int baudrate, tmp; - char databit, stopbit, parity, fctl; - bzero(&termios_old, sizeof(termios_old));//置字符串前sizeof个字节为零 - bzero(&termios_new, sizeof(termios_new)); - cfmakeraw(&termios_new);//设置终端属性 - tcgetattr(fdcom, &termios_old);//get the serial port attributions - /*------------设置端口属性----------------*/ - //baudrates - baudrate = convbaud(pportinfo -> baudrate);//得到波特率 - cfsetospeed(&termios_new, baudrate);//填入串口输出端的波特率 - termios_new.c_cflag |= CLOCAL;//控制模式,保证程序不会成为端口的占有者 - // 控制模式,flow control - fctl = pportinfo-> fctl; - switch(fctl){ - case '0':{ - termios_new.c_cflag &= ~CRTSCTS;//no flow control - }break; - case '1':{ - termios_new.c_cflag |= CRTSCTS;//hardware flow control - }break; - case '2':{ - termios_new.c_iflag |= IXON | IXOFF |IXANY; //software flow control - }break; - } - //控制模式,data bits - termios_new.c_cflag &= ~CSIZE;//控制模式,屏蔽字符大小位 - databit = pportinfo -> databit; - switch(databit){ - case '5': - termios_new.c_cflag |= CS5; - case '6': - termios_new.c_cflag |= CS6; - case '7': - termios_new.c_cflag |= CS7; - default: - termios_new.c_cflag |= CS8; - } - //控制模式 parity check - parity = pportinfo -> parity; - switch(parity){ - case '0':{ - termios_new.c_cflag &= ~PARENB;//no parity check - }break; - case '1':{ - termios_new.c_cflag |= PARENB;//odd check - termios_new.c_cflag &= ~PARODD; - }break; - case '2':{ - termios_new.c_cflag |= PARENB;//even check - termios_new.c_cflag |= PARODD; - }break; - } - //控制模式,stop bits - stopbit = pportinfo -> stopbit; - if(stopbit == '2'){ - termios_new.c_cflag |= CSTOPB;//2 stop bits - } - else{ - termios_new.c_cflag &= ~CSTOPB;//1 stop bits - } - //other attributions default - termios_new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);//输入模式,原始数据输入 - tcflush(fdcom, TCIFLUSH);//溢出的数据可以接收,但不读 - tmp = tcsetattr(fdcom, TCSANOW, &termios_new);//设置新属性,TCSANOW:所有改变立即生效 tcgetattr(fdcom, &termios_old); - return(tmp); -} -/**************************************************************** -fuction: PortOpen(pportinfo_t pportinfo) -description: open serial port -parameters: pportinfo: 待设置的串口信息 -return: fdcom:文件描述符 -******************************************************************/ -int PortOpen(pportinfo_t pportinfo) -{ - int fdcom; //串口文件描述符 - char *ptty; - ptty = get_ptty(pportinfo); - //fdcom = open(ptty, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY); - fdcom = open(ptty, O_RDWR | O_NOCTTY | O_NONBLOCK); - return (fdcom); -} -/**************************************************************** -fuction: PortClose(int fdcom) -description: close serial port -parameters: fdcom:文件描述符 -return: NONE -******************************************************************/ -void PortClose(int fdcom) -{ - close(fdcom); -} -/**************************************************************** -fuction: PortSend(int fdcom, char *data, int datalen) -description: close serial port -parameters: fdcom: 串口描述符,data: 待发送数据,datalen: 数据长度 -return: len:实际长度 -******************************************************************/ -int PortSend(int fdcom, char *data, int datalen) -{ - int len = 0; - len = write(fdcom, data, datalen);//实际写入的长度 - if(len == datalen){ - return (len); - } - else{ - tcflush(fdcom, TCOFLUSH); - return -1; - } -} -/**************************************************************** -fuction: PortRecv(int fdcom, char *data, int datalen, int baudrate) -description: receive the datas -parameters: fdcom:串口描述符, data:接收缓冲区, datalen:接收长度, - baudrate:波特率 -return: readlen:实际读入的字节数 -******************************************************************/ -int PortRecv(int fdcom, char *data, int datalen, int baudrate) -{ - int readlen, fs_sel; - fd_set fs_read; - struct timeval tv_timeout; - FD_ZERO(&fs_read); - FD_SET(fdcom, &fs_read); - tv_timeout.tv_sec = TIMEOUT_SEC(datalen, baudrate); - tv_timeout.tv_usec = TIMEOUT_USEC; - fs_sel = select(fdcom+1, &fs_read, NULL, NULL, &tv_timeout); - if(fs_sel){ - readlen = read(fdcom, data, datalen); - return(readlen); - } - else{ - return(-1); - } - return (readlen); -} +#include "mycom.h" +#define TTY_DEV "/dev/ttyUSB" //端口路径 如果是在电脑端选择ttyUSB,在mini2440端则选择ttySAC +//#define TTY_DEV "/dev/ttySAC" +#define TIMEOUT_SEC(buflen,baud) (buflen*20/baud+2)//接收超时 +#define TIMEOUT_USEC 0 +/************************************************* +fuction: char *get_ptty(pportinfo_t pportinfo) +description: get thd uart name +return: ptty +**************************************************/ +static char *get_ptty(pportinfo_t pportinfo) +{ + char *ptty=NULL; + switch(pportinfo->tty) + { + case '0': + ptty=TTY_DEV"0"; + break; + case '1': + ptty=TTY_DEV"1"; + break; + case '2': + ptty=TTY_DEV"2"; + break; + } + return ptty; +} +/************************************************* +fuction: convbaud(unsigned long int baudrate) +description: baud change +return: ptty +**************************************************/ +static int convbaud(unsigned long int baudrate) +{ + switch(baudrate){ + case 2400: + return B2400; + case 4800: + return B4800; + case 9600: + return B9600; + case 19200: + return B19200; + case 38400: + return B38400; + case 57600: + return B57600; + case 115200: + return B115200; + default: + return B9600; + } +} +/**************************************************************** +fuction: convbaud(unsigned long int baudrate) +description: set the uart +parameters: fdcom: 串口文件描述符, + pportinfo: 待设置的串口信息 +return: tmp +******************************************************************/ +int PortSet(int fdcom, const pportinfo_t pportinfo) +{ + struct termios termios_old, termios_new; + int baudrate, tmp; + char databit, stopbit, parity, fctl; + bzero(&termios_old, sizeof(termios_old));//置字符串前sizeof个字节为零 + bzero(&termios_new, sizeof(termios_new)); + cfmakeraw(&termios_new);//设置终端属性 + tcgetattr(fdcom, &termios_old);//get the serial port attributions + /*------------设置端口属性----------------*/ + //baudrates + baudrate = convbaud(pportinfo -> baudrate);//得到波特率 + cfsetospeed(&termios_new, baudrate);//填入串口输出端的波特率 + termios_new.c_cflag |= CLOCAL;//控制模式,保证程序不会成为端口的占有者 + // 控制模式,flow control + fctl = pportinfo-> fctl; + switch(fctl){ + case '0':{ + termios_new.c_cflag &= ~CRTSCTS;//no flow control + }break; + case '1':{ + termios_new.c_cflag |= CRTSCTS;//hardware flow control + }break; + case '2':{ + termios_new.c_iflag |= IXON | IXOFF |IXANY; //software flow control + }break; + } + //控制模式,data bits + termios_new.c_cflag &= ~CSIZE;//控制模式,屏蔽字符大小位 + databit = pportinfo -> databit; + switch(databit){ + case '5': + termios_new.c_cflag |= CS5; + case '6': + termios_new.c_cflag |= CS6; + case '7': + termios_new.c_cflag |= CS7; + default: + termios_new.c_cflag |= CS8; + } + //控制模式 parity check + parity = pportinfo -> parity; + switch(parity){ + case '0':{ + termios_new.c_cflag &= ~PARENB;//no parity check + }break; + case '1':{ + termios_new.c_cflag |= PARENB;//odd check + termios_new.c_cflag &= ~PARODD; + }break; + case '2':{ + termios_new.c_cflag |= PARENB;//even check + termios_new.c_cflag |= PARODD; + }break; + } + //控制模式,stop bits + stopbit = pportinfo -> stopbit; + if(stopbit == '2'){ + termios_new.c_cflag |= CSTOPB;//2 stop bits + } + else{ + termios_new.c_cflag &= ~CSTOPB;//1 stop bits + } + //other attributions default + termios_new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);//输入模式,原始数据输入 + tcflush(fdcom, TCIFLUSH);//溢出的数据可以接收,但不读 + tmp = tcsetattr(fdcom, TCSANOW, &termios_new);//设置新属性,TCSANOW:所有改变立即生效 tcgetattr(fdcom, &termios_old); + return(tmp); +} +/**************************************************************** +fuction: PortOpen(pportinfo_t pportinfo) +description: open serial port +parameters: pportinfo: 待设置的串口信息 +return: fdcom:文件描述符 +******************************************************************/ +int PortOpen(pportinfo_t pportinfo) +{ + int fdcom; //串口文件描述符 + char *ptty; + ptty = get_ptty(pportinfo); + //fdcom = open(ptty, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY); + fdcom = open(ptty, O_RDWR | O_NOCTTY | O_NONBLOCK); + return (fdcom); +} +/**************************************************************** +fuction: PortClose(int fdcom) +description: close serial port +parameters: fdcom:文件描述符 +return: NONE +******************************************************************/ +void PortClose(int fdcom) +{ + close(fdcom); +} +/**************************************************************** +fuction: PortSend(int fdcom, char *data, int datalen) +description: close serial port +parameters: fdcom: 串口描述符,data: 待发送数据,datalen: 数据长度 +return: len:实际长度 +******************************************************************/ +int PortSend(int fdcom, char *data, int datalen) +{ + int len = 0; + len = write(fdcom, data, datalen);//实际写入的长度 + if(len == datalen){ + return (len); + } + else{ + tcflush(fdcom, TCOFLUSH); + return -1; + } +} +/**************************************************************** +fuction: PortRecv(int fdcom, char *data, int datalen, int baudrate) +description: receive the datas +parameters: fdcom:串口描述符, data:接收缓冲区, datalen:接收长度, + baudrate:波特率 +return: readlen:实际读入的字节数 +******************************************************************/ +int PortRecv(int fdcom, char *data, int datalen, int baudrate) +{ + int readlen, fs_sel; + fd_set fs_read; + struct timeval tv_timeout; + FD_ZERO(&fs_read); + FD_SET(fdcom, &fs_read); + tv_timeout.tv_sec = TIMEOUT_SEC(datalen, baudrate); + tv_timeout.tv_usec = TIMEOUT_USEC; + fs_sel = select(fdcom+1, &fs_read, NULL, NULL, &tv_timeout); + if(fs_sel){ + readlen = read(fdcom, data, datalen); + return(readlen); + } + else{ + return(-1); + } + return (readlen); +} diff --git a/mycom.h b/mycom.h index 857bc31..8929111 100644 --- a/mycom.h +++ b/mycom.h @@ -1,33 +1,33 @@ -#ifndef MYCOM_H -#define MYCOM_H -#include //printf等用到 -#include //file control -#include //bzero等用到 -#include //exit(0)等用到 -#include //sleep等用到 -#include //串口应用程序必须添加的头文件 -#include //定义pid_t,size等 -#include //read,write,getpid等等 -#include //ioctl -typedef struct //define the uart value struct -{ - char prompt; //prompt after reciving data - int baudrate; //baudrate - char databit; //data bits, 5, 6, 7, 8 - char debug; //debug mode, 0: none, 1: debug - char echo; //echo mode, 0: none, 1: echo - char fctl; //flow control, 0: none, 1: hardware, 2: software - char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7 - char parity; //parity 0: none, 1: odd, 2: even - char stopbit; //stop bits, 1, 2 - //const int reserved; //reserved, must be zero - int reserved; //reserved, must be zero -}portinfo_t; -typedef portinfo_t *pportinfo_t; //redefine the portinfo_t -/**************** declaration the fuction to set the uart *******************/ -int PortOpen(pportinfo_t pportinfo); //open the uart -int PortSet(int fdcom, const pportinfo_t pportinfo); //set the uart -void PortClose(int fdcom); //close the uart -int PortSend(int fdcom, char *data, int datalen); //send the datas -int PortRecv(int fdcom, char *data, int datalen, int baudrate);//receive the datas -#endif // MYCOM_H +#ifndef MYCOM_H +#define MYCOM_H +#include //printf等用到 +#include //file control +#include //bzero等用到 +#include //exit(0)等用到 +#include //sleep等用到 +#include //串口应用程序必须添加的头文件 +#include //定义pid_t,size等 +#include //read,write,getpid等等 +#include //ioctl +typedef struct //define the uart value struct +{ + char prompt; //prompt after reciving data + int baudrate; //baudrate + char databit; //data bits, 5, 6, 7, 8 + char debug; //debug mode, 0: none, 1: debug + char echo; //echo mode, 0: none, 1: echo + char fctl; //flow control, 0: none, 1: hardware, 2: software + char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7 + char parity; //parity 0: none, 1: odd, 2: even + char stopbit; //stop bits, 1, 2 + //const int reserved; //reserved, must be zero + int reserved; //reserved, must be zero +}portinfo_t; +typedef portinfo_t *pportinfo_t; //redefine the portinfo_t +/**************** declaration the fuction to set the uart *******************/ +int PortOpen(pportinfo_t pportinfo); //open the uart +int PortSet(int fdcom, const pportinfo_t pportinfo); //set the uart +void PortClose(int fdcom); //close the uart +int PortSend(int fdcom, char *data, int datalen); //send the datas +int PortRecv(int fdcom, char *data, int datalen, int baudrate);//receive the datas +#endif // MYCOM_H diff --git a/myinclude.h b/myinclude.h index ca9390e..b0a030f 100644 --- a/myinclude.h +++ b/myinclude.h @@ -1,87 +1,87 @@ -#ifndef MYINCLUDE_H -#define MYINCLUDE_H -#define TXTFILE 0 -#define PICFILE 1 -#define SCENE 2 - -#define SYS_ROOT_DIR "/home/plg/" -#include "qnamespace.h" - -#define MYSAVEFILEDLG // 定义自己的保存文件对话框,解决系统对话框按键不弹起问题 -#define LANINTERFACE_NAME "eth0" - -// #define FPGATEST // 给韦工测试时启用,发布版本需要关闭 -// #define NETWORKQRCODE //二维码允许tcp客户端修改 -// #define __RFID_OLD //旧的加密算法 -// #define __RFID_CARD //刷卡功能 -// #define __RFID_IND //允许印度进行二次加密的宏 -//#define EnableArabic //界面语言切换为英文生效 -//#define EnableBangla //新孟加拉语 - - -#define TEST_MODE 0 //测试模式 -#define SIMULATE_PRINTING_MODE 0 //模拟打印模式 - -#ifdef __CONVERTERWIFI__ -#define LANINTERFACE_NAME "eth0" -#endif - -// 启用No72版本电压调整功能 -// #define ENB_VOLTAGE_ADJUST_NO72 1 - -// 启用No73版本电压调整功能 -// #define ENB_VOLTAGE_ADJUST_NO73 1 - -enum CRYS_FREQ{ - CRYS_64K, - CRYS_83K, - CRYS_96K, - CRYS_128K -}; - -enum PRINT_MODE{ - FAST_PRINT, - STANDARD_PRINT, - SLOW_PRINT_ONE, - SLOW_PRINT_TWO, - SLOW_PRINT_THR, - SLOW_PRINT_FOR, - SLOW_PRINT_FIV, - SLOW_PRINT_SIX, - SLOW_PRINT_SEV, - SLOW_PRINT_EIG, - SLOW_PRINT_NIE -}; - -enum Voltage_Version{ - VersionOf72And12R, - VersionOf72And16R, - VersionOf72And21R, - VersionOf72And25R, - VersionOf72And32R, - VersionOf72And5Row5Dot, - VersionOf72And4Row7Dot, - VersionOf72And44R, - VersionOf67, - VersionOf67And7HighSpeed, //7点阵高速 - VersionOf67And7SuperSpeed, //7点阵超高速 - VersionOf67And9HighSpeed, //9点阵高速 - VersionOf67And9SuperSpeed, //9点阵超高速 - VersionOf73, - VersionOf72And5Row5Dot34, // 34点阵5行5点阵 - VersionOf72And4Row7Dot34 // 34点阵4行7点阵 -}; - -enum Voltage_Para{ - DEFAULT, - FiveLineFiveDot, - FourLineSevenDot -}; -#endif -// MYINCLUDE_H -/* -20140627: - 再改这功能,同步器状态下,不打印走米打钩时一直计米,取消打钩时按停止打印按钮不计米,按打印按钮一直计米与故障无关。 - 目前1-都计米,2-高压故障时不计米,其它计米。 -*/ - +#ifndef MYINCLUDE_H +#define MYINCLUDE_H +#define TXTFILE 0 +#define PICFILE 1 +#define SCENE 2 + +#define SYS_ROOT_DIR "/home/plg/" +#include "qnamespace.h" + +#define MYSAVEFILEDLG // 定义自己的保存文件对话框,解决系统对话框按键不弹起问题 +#define LANINTERFACE_NAME "eth0" + +// #define FPGATEST // 给韦工测试时启用,发布版本需要关闭 +#define NETWORKQRCODE //二维码允许tcp客户端修改 +// #define __RFID_OLD //旧的加密算法 +// #define __RFID_CARD //刷卡功能 +// #define __RFID_IND //允许印度进行二次加密的宏 +//#define EnableArabic //界面语言切换为英文生效 +//#define EnableBangla //新孟加拉语 + + +#define TEST_MODE 0 //测试模式 +#define SIMULATE_PRINTING_MODE 0 //模拟打印模式 + +#ifdef __CONVERTERWIFI__ +#define LANINTERFACE_NAME "eth0" +#endif + +// 启用No72版本电压调整功能 +// #define ENB_VOLTAGE_ADJUST_NO72 1 + +// 启用No73版本电压调整功能 +// #define ENB_VOLTAGE_ADJUST_NO73 1 + +enum CRYS_FREQ{ + CRYS_64K, + CRYS_83K, + CRYS_96K, + CRYS_128K +}; + +enum PRINT_MODE{ + FAST_PRINT, + STANDARD_PRINT, + SLOW_PRINT_ONE, + SLOW_PRINT_TWO, + SLOW_PRINT_THR, + SLOW_PRINT_FOR, + SLOW_PRINT_FIV, + SLOW_PRINT_SIX, + SLOW_PRINT_SEV, + SLOW_PRINT_EIG, + SLOW_PRINT_NIE +}; + +enum Voltage_Version{ + VersionOf72And12R, + VersionOf72And16R, + VersionOf72And21R, + VersionOf72And25R, + VersionOf72And32R, + VersionOf72And5Row5Dot, + VersionOf72And4Row7Dot, + VersionOf72And44R, + VersionOf67, + VersionOf67And7HighSpeed, //7点阵高速 + VersionOf67And7SuperSpeed, //7点阵超高速 + VersionOf67And9HighSpeed, //9点阵高速 + VersionOf67And9SuperSpeed, //9点阵超高速 + VersionOf73, + VersionOf72And5Row5Dot34, // 34点阵5行5点阵 + VersionOf72And4Row7Dot34 // 34点阵4行7点阵 +}; + +enum Voltage_Para{ + DEFAULT, + FiveLineFiveDot, + FourLineSevenDot +}; +#endif +// MYINCLUDE_H +/* +20140627: + 再改这功能,同步器状态下,不打印走米打钩时一直计米,取消打钩时按停止打印按钮不计米,按打印按钮一直计米与故障无关。 + 目前1-都计米,2-高压故障时不计米,其它计米。 +*/ + diff --git a/otherinfo.ui b/otherinfo.ui index 3836ee9..94741b0 100644 --- a/otherinfo.ui +++ b/otherinfo.ui @@ -1,478 +1,478 @@ - - - OtherInfo - - - - 0 - 0 - 800 - 600 - - - - Qt::StrongFocus - - - Form - - - - - - 2 - - - - - 2 - - - - - - - - - - - - 相位位置: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 37 - - - - true - - - 1 - - - 100 - - - 40 - - - - - - - 相位偏移: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - -1560 - - - 1560 - - - 0 - - - - - - - true - - - - 0 - 37 - - - - 1 - - - 64000 - - - 7 - - - - - - - - 16777215 - 30 - - - - - - - - - - - - 16777215 - 30 - - - - 飞行时间: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 20 - - - - DetectDelay - - - - - - - true - - - - 0 - 0 - - - - 30 - - - 100 - - - 5 - - - 55 - - - - - - - Qt::LeftToRight - - - 相检: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 20 - - - - FullTimeEn - - - - - - - - 16777215 - 20 - - - - DetectVol - - - - - - - - 16777215 - 20 - - - - HighLowRatio - - - - - - - Qt::LeftToRight - - - 充电占空比100% - - - - - - - - 16777215 - 37 - - - - detect_num - - - - - - - false - - - 锁定相位 - - - - :/icon/lockphase.png:/icon/lockphase.png - - - - - - - 相位检测电压: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 频闪灯周期: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 检测墨点数量: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 37 - - - - - - - - 检测延时: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 0 - 0 - - - - 1000 - - - - - - - - - - 605 - 120 - - - - - 16777215 - 16777215 - - - - - - - - - 605 - 140 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 70 - - - - - 250 - 16777215 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - Qt::LeftToRight - - - 应用当前配置 - - - - :/icon/apply.png:/icon/apply.png - - - - - - - - - - - - PhaseGraphic - QWidget -
PhaseGraphic.h
- 1 -
- - MemDisplayAndEdit - QWidget -
MemDisplayAndEdit.h
- 1 -
-
- - - - -
+ + + OtherInfo + + + + 0 + 0 + 800 + 600 + + + + Qt::StrongFocus + + + Form + + + + + + 2 + + + + + 2 + + + + + + + + + + + + 相位位置: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 37 + + + + true + + + 1 + + + 100 + + + 40 + + + + + + + 相位偏移: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + -1560 + + + 1560 + + + 0 + + + + + + + true + + + + 0 + 37 + + + + 1 + + + 64000 + + + 7 + + + + + + + + 16777215 + 30 + + + + + + + + + + + + 16777215 + 30 + + + + 飞行时间: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 20 + + + + DetectDelay + + + + + + + true + + + + 0 + 0 + + + + 30 + + + 100 + + + 5 + + + 55 + + + + + + + Qt::LeftToRight + + + 相检: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 20 + + + + FullTimeEn + + + + + + + + 16777215 + 20 + + + + DetectVol + + + + + + + + 16777215 + 20 + + + + HighLowRatio + + + + + + + Qt::LeftToRight + + + 充电占空比100% + + + + + + + + 16777215 + 37 + + + + detect_num + + + + + + + false + + + 锁定相位 + + + + :/icon/lockphase.png:/icon/lockphase.png + + + + + + + 相位检测电压: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 频闪灯周期: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 检测墨点数量: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 37 + + + + + + + + 检测延时: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 0 + 0 + + + + 1000 + + + + + + + + + + 605 + 120 + + + + + 16777215 + 16777215 + + + + + + + + + 605 + 140 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 70 + + + + + 250 + 16777215 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + Qt::LeftToRight + + + 应用当前配置 + + + + :/icon/apply.png:/icon/apply.png + + + + + + + + + + + + PhaseGraphic + QWidget +
PhaseGraphic.h
+ 1 +
+ + MemDisplayAndEdit + QWidget +
MemDisplayAndEdit.h
+ 1 +
+
+ + + + +
diff --git a/picedit.ui b/picedit.ui index b56a019..87ce024 100644 --- a/picedit.ui +++ b/picedit.ui @@ -1,832 +1,832 @@ - - - PicEdit - - - - 0 - 0 - 642 - 442 - - - - Qt::StrongFocus - - - Form - - - - - - - - - - - 0 - 40 - - - - - 72 - 16777215 - - - - 开启软键盘 - - - - - - - - 63 - 40 - - - - 插入变量 - - - - :/icon/vari.png:/icon/vari.png - - - - - - - - 50 - 40 - - - - 保存/打印 - - - - :/icon/filesave.png:/icon/filesave.png - - - - - - - - 55 - 40 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - 55 - 40 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - - 74 - 40 - - - - - 74 - 16777215 - - - - Qt::ImhNone - - - 0 - - - - 5点阵 - - - - - 7点阵 - - - - - 9点阵 - - - - - 12点阵宋体 - - - - - 16点阵宋体 - - - - - 16点阵黑体 - - - - - 24点阵宋体 - - - - - 24点阵黑体 - - - - - - - - - 16777215 - 20 - - - - 列高 - - - Qt::AlignCenter - - - - - - - - 40 - 40 - - - - - 40 - 16777215 - - - - - 0 - 0 - - - - 1 - - - 256 - - - 40 - - - - - - - - 0 - 40 - - - - - 62 - 16777215 - - - - - 无加粗 - - - - - 加粗1倍 - - - - - 加粗2倍 - - - - - - - - - 10 - 25 - - - - - true - - - - false - - - Qt::StrongFocus - - - false - - - Qt::ImhDigitsOnly|Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase - - - - - - - - - - - - 0 - 145 - - - - - 16777215 - 145 - - - - Qt::ImhNone - - - false - - - Qt::AlignCenter - - - - - 159 - 21 - 300 - 100 - - - - Qt::RightToLeft - - - Qt::ImhDigitsOnly - - - - - - - - - - 0 - - - 6 - - - - - - 80 - 0 - - - - - 130 - 16777215 - - - - 光栅[X:Y] - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 放大比例 - - - Qt::AlignCenter - - - - - - - - 52 - 16777215 - - - - 插入模式 - - - Qt::AlignCenter - - - - - - - - 0 - 16 - - - - - 200 - 16777215 - - - - 文件名 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 80 - 0 - - - - - 130 - 16777215 - - - - CURR[X,Y] - - - - - - - - - Qt::Horizontal - - - - - - - 5 - - - - - - 90 - 50 - - - - 新建信息 - - - - :/icon/filenew.png:/icon/filenew.png - - - - - - - - 90 - 50 - - - - 打开文件 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 90 - 50 - - - - 字符间距 - - - - :/icon/linespace.png:/icon/linespace.png - - - - - - - - 90 - 50 - - - - 插入/修改 - - - - - - - - 90 - 50 - - - - 删除字符 - - - - :/icon/keydelete.png:/icon/keydelete.png - - - - - - - true - - - - 90 - 50 - - - - 插入图片 - - - - :/icon/insert.png:/icon/insert.png - - - - - - - - 90 - 50 - - - - 保存为 - - - - :/icon/filesaveas.png:/icon/filesaveas.png - - - - - - - true - - - - 90 - 50 - - - - 字库编辑 - - - - - - - 网格 - - - true - - - - - - - Qt::NoFocus - - - Qt::LeftToRight - - - 粗体 - - - - - - - 显示控制符 - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - 行首 - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - - - - - :/icon/arrowleft.png:/icon/arrowleft.png - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - - - - - :/icon/arrowup.png:/icon/arrowup.png - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - - - - - :/icon/arrowdown.png:/icon/arrowdown.png - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - - - - - :/icon/arrowright.png:/icon/arrowright.png - - - - - - - - 50 - 50 - - - - - 70 - 50 - - - - 行尾 - - - - - - - 字符光标 - - - - - - - 像素光标 - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - - - 编辑现有的多字体 - - - - - - - - 300 - 16777215 - - - - 点击光栅可打开键盘,点击空白处关闭 - - - Qt::AlignCenter - - - - - - - - - - - - PicWidget - QWidget -
PicWidget.h
- 1 -
-
- - - - -
+ + + PicEdit + + + + 0 + 0 + 642 + 442 + + + + Qt::StrongFocus + + + Form + + + + + + + + + + + 0 + 40 + + + + + 72 + 16777215 + + + + 开启软键盘 + + + + + + + + 63 + 40 + + + + 插入变量 + + + + :/icon/vari.png:/icon/vari.png + + + + + + + + 50 + 40 + + + + 保存/打印 + + + + :/icon/filesave.png:/icon/filesave.png + + + + + + + + 55 + 40 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + 55 + 40 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + + 74 + 40 + + + + + 74 + 16777215 + + + + Qt::ImhNone + + + 0 + + + + 5点阵 + + + + + 7点阵 + + + + + 9点阵 + + + + + 12点阵宋体 + + + + + 16点阵宋体 + + + + + 16点阵黑体 + + + + + 24点阵宋体 + + + + + 24点阵黑体 + + + + + + + + + 16777215 + 20 + + + + 列高 + + + Qt::AlignCenter + + + + + + + + 40 + 40 + + + + + 40 + 16777215 + + + + + 0 + 0 + + + + 1 + + + 256 + + + 40 + + + + + + + + 0 + 40 + + + + + 62 + 16777215 + + + + + 无加粗 + + + + + 加粗1倍 + + + + + 加粗2倍 + + + + + + + + + 10 + 25 + + + + + true + + + + false + + + Qt::StrongFocus + + + false + + + Qt::ImhDigitsOnly|Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase + + + + + + + + + + + + 0 + 145 + + + + + 16777215 + 145 + + + + Qt::ImhNone + + + false + + + Qt::AlignCenter + + + + + 159 + 21 + 300 + 100 + + + + Qt::RightToLeft + + + Qt::ImhDigitsOnly + + + + + + + + + + 0 + + + 6 + + + + + + 80 + 0 + + + + + 130 + 16777215 + + + + 光栅[X:Y] + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + 放大比例 + + + Qt::AlignCenter + + + + + + + + 52 + 16777215 + + + + 插入模式 + + + Qt::AlignCenter + + + + + + + + 0 + 16 + + + + + 200 + 16777215 + + + + 文件名 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 80 + 0 + + + + + 130 + 16777215 + + + + CURR[X,Y] + + + + + + + + + Qt::Horizontal + + + + + + + 5 + + + + + + 90 + 50 + + + + 新建信息 + + + + :/icon/filenew.png:/icon/filenew.png + + + + + + + + 90 + 50 + + + + 打开文件 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 90 + 50 + + + + 字符间距 + + + + :/icon/linespace.png:/icon/linespace.png + + + + + + + + 90 + 50 + + + + 插入/修改 + + + + + + + + 90 + 50 + + + + 删除字符 + + + + :/icon/keydelete.png:/icon/keydelete.png + + + + + + + true + + + + 90 + 50 + + + + 插入图片 + + + + :/icon/insert.png:/icon/insert.png + + + + + + + + 90 + 50 + + + + 保存为 + + + + :/icon/filesaveas.png:/icon/filesaveas.png + + + + + + + true + + + + 90 + 50 + + + + 字库编辑 + + + + + + + 网格 + + + true + + + + + + + Qt::NoFocus + + + Qt::LeftToRight + + + 粗体 + + + + + + + 显示控制符 + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + 行首 + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + + + + + :/icon/arrowleft.png:/icon/arrowleft.png + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + + + + + :/icon/arrowup.png:/icon/arrowup.png + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + + + + + :/icon/arrowdown.png:/icon/arrowdown.png + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + + + + + :/icon/arrowright.png:/icon/arrowright.png + + + + + + + + 50 + 50 + + + + + 70 + 50 + + + + 行尾 + + + + + + + 字符光标 + + + + + + + 像素光标 + + + + + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + + + + + + 编辑现有的多字体 + + + + + + + + 300 + 16777215 + + + + 点击光栅可打开键盘,点击空白处关闭 + + + Qt::AlignCenter + + + + + + + + + + + + PicWidget + QWidget +
PicWidget.h
+ 1 +
+
+ + + + +
diff --git a/posix_qextserialport.cpp b/posix_qextserialport.cpp index 4f53abc..43aa60c 100644 --- a/posix_qextserialport.cpp +++ b/posix_qextserialport.cpp @@ -1,1128 +1,1128 @@ - -/*! -\class Posix_QextSerialPort -\version 1.0.0 -\author Stefan Sander -\author Michal Policht - -A cross-platform serial port class. -This class encapsulates the POSIX portion of QextSerialPort. The user will be notified of errors -and possible portability conflicts at run-time by default - this behavior can be turned off by -defining _TTY_NOWARN_ (to turn off all warnings) or _TTY_NOWARN_PORT_ (to turn off portability -warnings) in the project. Note that _TTY_NOWARN_ will also turn off portability warnings. -*/ - -#include -#include "posix_qextserialport.h" - -/*! -\fn Posix_QextSerialPort::Posix_QextSerialPort() -Default constructor. Note that the name of the device used by a QextSerialPort constructed with -this constructor will be determined by #defined constants, or lack thereof - the default behavior -is the same as _TTY_LINUX_. Possible naming conventions and their associated constants are: - -\verbatim - -Constant Used By Naming Convention ----------- ------------- ------------------------ -_TTY_WIN_ Windows COM1, COM2 -_TTY_IRIX_ SGI/IRIX /dev/ttyf1, /dev/ttyf2 -_TTY_HPUX_ HP-UX /dev/tty1p0, /dev/tty2p0 -_TTY_SUN_ SunOS/Solaris /dev/ttya, /dev/ttyb -_TTY_DIGITAL_ Digital UNIX /dev/tty01, /dev/tty02 -_TTY_FREEBSD_ FreeBSD /dev/ttyd0, /dev/ttyd1 -_TTY_LINUX_ Linux /dev/ttySAC0, /dev/ttySAC1 - Linux /dev/ttyS0, /dev/ttyS1 -\endverbatim - -This constructor assigns the device name to the name of the first port on the specified system. -See the other constructors if you need to open a different port. -*/ -Posix_QextSerialPort::Posix_QextSerialPort() -: QextSerialBase() -{ - Posix_File=new QFile(); -} - -/*! -\fn Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort&) -Copy constructor. -*/ -Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort& s) - : QextSerialBase(s.port) -{ - setOpenMode(s.openMode()); - port = s.port; - Settings.BaudRate=s.Settings.BaudRate; - Settings.DataBits=s.Settings.DataBits; - Settings.Parity=s.Settings.Parity; - Settings.StopBits=s.Settings.StopBits; - Settings.FlowControl=s.Settings.FlowControl; - lastErr=s.lastErr; - - Posix_File=new QFile(); - Posix_File=s.Posix_File; - memcpy(&Posix_Timeout, &s.Posix_Timeout, sizeof(struct timeval)); - memcpy(&Posix_Copy_Timeout, &s.Posix_Copy_Timeout, sizeof(struct timeval)); - memcpy(&Posix_CommConfig, &s.Posix_CommConfig, sizeof(struct termios)); -} - -/*! -\fn Posix_QextSerialPort::Posix_QextSerialPort(const QString & name) -Constructs a serial port attached to the port specified by name. -name is the name of the device, which is windowsystem-specific, -e.g."COM1" or "/dev/ttyS0". -*/ -Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, QextSerialBase::QueryMode mode) - : QextSerialBase(name) -{ - Posix_File=new QFile(); - setQueryMode(mode); - init(); -} - -/*! -\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings) -Constructs a port with default name and specified settings. -*/ -Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode) - : QextSerialBase() -{ - setBaudRate(settings.BaudRate); - setDataBits(settings.DataBits); - setParity(settings.Parity); - setStopBits(settings.StopBits); - setFlowControl(settings.FlowControl); - - Posix_File=new QFile(); - setTimeout(settings.Timeout_Millisec); - setQueryMode(mode); - init(); -} - -/*! -\fn Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, const PortSettings& settings) -Constructs a port with specified name and settings. -*/ -Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode) - : QextSerialBase(name) -{ - setBaudRate(settings.BaudRate); - setDataBits(settings.DataBits); - setParity(settings.Parity); - setStopBits(settings.StopBits); - setFlowControl(settings.FlowControl); - - Posix_File=new QFile(); - setTimeout(settings.Timeout_Millisec); - setQueryMode(mode); - init(); -} - -/*! -\fn Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s) -Override the = operator. -*/ -Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s) -{ - setOpenMode(s.openMode()); - port = s.port; - Settings.BaudRate=s.Settings.BaudRate; - Settings.DataBits=s.Settings.DataBits; - Settings.Parity=s.Settings.Parity; - Settings.StopBits=s.Settings.StopBits; - Settings.FlowControl=s.Settings.FlowControl; - lastErr=s.lastErr; - - Posix_File=s.Posix_File; - memcpy(&Posix_Timeout, &(s.Posix_Timeout), sizeof(struct timeval)); - memcpy(&Posix_Copy_Timeout, &(s.Posix_Copy_Timeout), sizeof(struct timeval)); - memcpy(&Posix_CommConfig, &(s.Posix_CommConfig), sizeof(struct termios)); - return *this; -} - -void Posix_QextSerialPort::init() -{ - if (queryMode() == QextSerialBase::EventDriven) - qWarning("POSIX doesn't have event driven mechanism implemented yet"); -} - -/*! -\fn Posix_QextSerialPort::~Posix_QextSerialPort() -Standard destructor. -*/ -Posix_QextSerialPort::~Posix_QextSerialPort() -{ - if (isOpen()) { - close(); - } - Posix_File->close(); - delete Posix_File; -} - -/*! -\fn void Posix_QextSerialPort::setBaudRate(BaudRateType baudRate) -Sets the baud rate of the serial port. Note that not all rates are applicable on -all platforms. The following table shows translations of the various baud rate -constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * -are speeds that are usable on both Windows and POSIX. - -\note -BAUD76800 may not be supported on all POSIX systems. SGI/IRIX systems do not support -BAUD1800. - -\verbatim - - RATE Windows Speed POSIX Speed - ----------- ------------- ----------- - BAUD50 110 50 - BAUD75 110 75 - *BAUD110 110 110 - BAUD134 110 134.5 - BAUD150 110 150 - BAUD200 110 200 - *BAUD300 300 300 - *BAUD600 600 600 - *BAUD1200 1200 1200 - BAUD1800 1200 1800 - *BAUD2400 2400 2400 - *BAUD4800 4800 4800 - *BAUD9600 9600 9600 - BAUD14400 14400 9600 - *BAUD19200 19200 19200 - *BAUD38400 38400 38400 - BAUD56000 56000 38400 - *BAUD57600 57600 57600 - BAUD76800 57600 76800 - *BAUD115200 115200 115200 - BAUD128000 128000 115200 - BAUD256000 256000 115200 -\endverbatim -*/ -void Posix_QextSerialPort::setBaudRate(BaudRateType baudRate) -{ - LOCK_MUTEX(); - if (Settings.BaudRate!=baudRate) { - switch (baudRate) { - case BAUD14400: - Settings.BaudRate=BAUD9600; - break; - - case BAUD56000: - Settings.BaudRate=BAUD38400; - break; - - case BAUD76800: - -#ifndef B76800 - Settings.BaudRate=BAUD57600; -#else - Settings.BaudRate=baudRate; -#endif - break; - - case BAUD128000: - case BAUD256000: - Settings.BaudRate=BAUD115200; - break; - - default: - Settings.BaudRate=baudRate; - break; - } - } - if (isOpen()) { - switch (baudRate) { - - /*50 baud*/ - case BAUD50: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 50 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B50; -#else - cfsetispeed(&Posix_CommConfig, B50); - cfsetospeed(&Posix_CommConfig, B50); -#endif - break; - - /*75 baud*/ - case BAUD75: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 75 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B75; -#else - cfsetispeed(&Posix_CommConfig, B75); - cfsetospeed(&Posix_CommConfig, B75); -#endif - break; - - /*110 baud*/ - case BAUD110: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B110; -#else - cfsetispeed(&Posix_CommConfig, B110); - cfsetospeed(&Posix_CommConfig, B110); -#endif - break; - - /*134.5 baud*/ - case BAUD134: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 134.5 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B134; -#else - cfsetispeed(&Posix_CommConfig, B134); - cfsetospeed(&Posix_CommConfig, B134); -#endif - break; - - /*150 baud*/ - case BAUD150: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 150 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B150; -#else - cfsetispeed(&Posix_CommConfig, B150); - cfsetospeed(&Posix_CommConfig, B150); -#endif - break; - - /*200 baud*/ - case BAUD200: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 200 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B200; -#else - cfsetispeed(&Posix_CommConfig, B200); - cfsetospeed(&Posix_CommConfig, B200); -#endif - break; - - /*300 baud*/ - case BAUD300: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B300; -#else - cfsetispeed(&Posix_CommConfig, B300); - cfsetospeed(&Posix_CommConfig, B300); -#endif - break; - - /*600 baud*/ - case BAUD600: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B600; -#else - cfsetispeed(&Posix_CommConfig, B600); - cfsetospeed(&Posix_CommConfig, B600); -#endif - break; - - /*1200 baud*/ - case BAUD1200: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B1200; -#else - cfsetispeed(&Posix_CommConfig, B1200); - cfsetospeed(&Posix_CommConfig, B1200); -#endif - break; - - /*1800 baud*/ - case BAUD1800: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and IRIX do not support 1800 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B1800; -#else - cfsetispeed(&Posix_CommConfig, B1800); - cfsetospeed(&Posix_CommConfig, B1800); -#endif - break; - - /*2400 baud*/ - case BAUD2400: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B2400; -#else - cfsetispeed(&Posix_CommConfig, B2400); - cfsetospeed(&Posix_CommConfig, B2400); -#endif - break; - - /*4800 baud*/ - case BAUD4800: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B4800; -#else - cfsetispeed(&Posix_CommConfig, B4800); - cfsetospeed(&Posix_CommConfig, B4800); -#endif - break; - - /*9600 baud*/ - case BAUD9600: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B9600; -#else - cfsetispeed(&Posix_CommConfig, B9600); - cfsetospeed(&Posix_CommConfig, B9600); -#endif - break; - - /*14400 baud*/ - case BAUD14400: - TTY_WARNING("Posix_QextSerialPort: POSIX does not support 14400 baud operation. Switching to 9600 baud."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B9600; -#else - cfsetispeed(&Posix_CommConfig, B9600); - cfsetospeed(&Posix_CommConfig, B9600); -#endif - break; - - /*19200 baud*/ - case BAUD19200: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B19200; -#else - cfsetispeed(&Posix_CommConfig, B19200); - cfsetospeed(&Posix_CommConfig, B19200); -#endif - break; - - /*38400 baud*/ - case BAUD38400: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B38400; -#else - cfsetispeed(&Posix_CommConfig, B38400); - cfsetospeed(&Posix_CommConfig, B38400); -#endif - break; - - /*56000 baud*/ - case BAUD56000: - TTY_WARNING("Posix_QextSerialPort: POSIX does not support 56000 baud operation. Switching to 38400 baud."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B38400; -#else - cfsetispeed(&Posix_CommConfig, B38400); - cfsetospeed(&Posix_CommConfig, B38400); -#endif - break; - - /*57600 baud*/ - case BAUD57600: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B57600; -#else - cfsetispeed(&Posix_CommConfig, B57600); - cfsetospeed(&Posix_CommConfig, B57600); -#endif - break; - - /*76800 baud*/ - case BAUD76800: - TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and some POSIX systems do not support 76800 baud operation."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - -#ifdef B76800 - Posix_CommConfig.c_cflag|=B76800; -#else - TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support. Switching to 57600 baud."); - Posix_CommConfig.c_cflag|=B57600; -#endif //B76800 -#else //CBAUD -#ifdef B76800 - cfsetispeed(&Posix_CommConfig, B76800); - cfsetospeed(&Posix_CommConfig, B76800); -#else - TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support. Switching to 57600 baud."); - cfsetispeed(&Posix_CommConfig, B57600); - cfsetospeed(&Posix_CommConfig, B57600); -#endif //B76800 -#endif //CBAUD - break; - - /*115200 baud*/ - case BAUD115200: -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B115200; -#else - cfsetispeed(&Posix_CommConfig, B115200); - cfsetospeed(&Posix_CommConfig, B115200); -#endif - break; - - /*128000 baud*/ - case BAUD128000: - TTY_WARNING("Posix_QextSerialPort: POSIX does not support 128000 baud operation. Switching to 115200 baud."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B115200; -#else - cfsetispeed(&Posix_CommConfig, B115200); - cfsetospeed(&Posix_CommConfig, B115200); -#endif - break; - - /*256000 baud*/ - case BAUD256000: - TTY_WARNING("Posix_QextSerialPort: POSIX does not support 256000 baud operation. Switching to 115200 baud."); -#ifdef CBAUD - Posix_CommConfig.c_cflag&=(~CBAUD); - Posix_CommConfig.c_cflag|=B115200; -#else - cfsetispeed(&Posix_CommConfig, B115200); - cfsetospeed(&Posix_CommConfig, B115200); -#endif - break; - } - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setDataBits(DataBitsType dataBits) -Sets the number of data bits used by the serial port. Possible values of dataBits are: -\verbatim - DATA_5 5 data bits - DATA_6 6 data bits - DATA_7 7 data bits - DATA_8 8 data bits -\endverbatim - -\note -This function is subject to the following restrictions: -\par - 5 data bits cannot be used with 2 stop bits. -\par - 8 data bits cannot be used with space parity on POSIX systems. - -*/ -void Posix_QextSerialPort::setDataBits(DataBitsType dataBits) -{ - LOCK_MUTEX(); - if (Settings.DataBits!=dataBits) { - if ((Settings.StopBits==STOP_2 && dataBits==DATA_5) || - (Settings.StopBits==STOP_1_5 && dataBits!=DATA_5) || - (Settings.Parity==PAR_SPACE && dataBits==DATA_8)) { - } - else { - Settings.DataBits=dataBits; - } - } - if (isOpen()) { - switch(dataBits) { - - /*5 data bits*/ - case DATA_5: - if (Settings.StopBits==STOP_2) { - TTY_WARNING("Posix_QextSerialPort: 5 Data bits cannot be used with 2 stop bits."); - } - else { - Settings.DataBits=dataBits; - Posix_CommConfig.c_cflag&=(~CSIZE); - Posix_CommConfig.c_cflag|=CS5; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - - /*6 data bits*/ - case DATA_6: - if (Settings.StopBits==STOP_1_5) { - TTY_WARNING("Posix_QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits."); - } - else { - Settings.DataBits=dataBits; - Posix_CommConfig.c_cflag&=(~CSIZE); - Posix_CommConfig.c_cflag|=CS6; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - - /*7 data bits*/ - case DATA_7: - if (Settings.StopBits==STOP_1_5) { - TTY_WARNING("Posix_QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits."); - } - else { - Settings.DataBits=dataBits; - Posix_CommConfig.c_cflag&=(~CSIZE); - Posix_CommConfig.c_cflag|=CS7; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - - /*8 data bits*/ - case DATA_8: - if (Settings.StopBits==STOP_1_5) { - TTY_WARNING("Posix_QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits."); - } - else { - Settings.DataBits=dataBits; - Posix_CommConfig.c_cflag&=(~CSIZE); - Posix_CommConfig.c_cflag|=CS8; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - } - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setParity(ParityType parity) -Sets the parity associated with the serial port. The possible values of parity are: -\verbatim - PAR_SPACE Space Parity - PAR_MARK Mark Parity - PAR_NONE No Parity - PAR_EVEN Even Parity - PAR_ODD Odd Parity -\endverbatim - -\note -This function is subject to the following limitations: -\par -POSIX systems do not support mark parity. -\par -POSIX systems support space parity only if tricked into doing so, and only with - fewer than 8 data bits. Use space parity very carefully with POSIX systems. - -*/ -void Posix_QextSerialPort::setParity(ParityType parity) -{ - LOCK_MUTEX(); - if (Settings.Parity!=parity) { - if (parity==PAR_MARK || (parity==PAR_SPACE && Settings.DataBits==DATA_8)) { - } - else { - Settings.Parity=parity; - } - } - if (isOpen()) { - switch (parity) { - - /*space parity*/ - case PAR_SPACE: - if (Settings.DataBits==DATA_8) { - TTY_PORTABILITY_WARNING("Posix_QextSerialPort: Space parity is only supported in POSIX with 7 or fewer data bits"); - } - else { - - /*space parity not directly supported - add an extra data bit to simulate it*/ - Posix_CommConfig.c_cflag&=~(PARENB|CSIZE); - switch(Settings.DataBits) { - case DATA_5: - Settings.DataBits=DATA_6; - Posix_CommConfig.c_cflag|=CS6; - break; - - case DATA_6: - Settings.DataBits=DATA_7; - Posix_CommConfig.c_cflag|=CS7; - break; - - case DATA_7: - Settings.DataBits=DATA_8; - Posix_CommConfig.c_cflag|=CS8; - break; - - case DATA_8: - break; - } - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - - /*mark parity - WINDOWS ONLY*/ - case PAR_MARK: - TTY_WARNING("Posix_QextSerialPort: Mark parity is not supported by POSIX."); - break; - - /*no parity*/ - case PAR_NONE: - Posix_CommConfig.c_cflag&=(~PARENB); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - - /*even parity*/ - case PAR_EVEN: - Posix_CommConfig.c_cflag&=(~PARODD); - Posix_CommConfig.c_cflag|=PARENB; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - - /*odd parity*/ - case PAR_ODD: - Posix_CommConfig.c_cflag|=(PARENB|PARODD); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - } - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setStopBits(StopBitsType stopBits) -Sets the number of stop bits used by the serial port. Possible values of stopBits are: -\verbatim - STOP_1 1 stop bit - STOP_1_5 1.5 stop bits - STOP_2 2 stop bits -\endverbatim -\note -This function is subject to the following restrictions: -\par - 2 stop bits cannot be used with 5 data bits. -\par - POSIX does not support 1.5 stop bits. - -*/ -void Posix_QextSerialPort::setStopBits(StopBitsType stopBits) -{ - LOCK_MUTEX(); - if (Settings.StopBits!=stopBits) { - if ((Settings.DataBits==DATA_5 && stopBits==STOP_2) || stopBits==STOP_1_5) {} - else { - Settings.StopBits=stopBits; - } - } - if (isOpen()) { - switch (stopBits) { - - /*one stop bit*/ - case STOP_1: - Settings.StopBits=stopBits; - Posix_CommConfig.c_cflag&=(~CSTOPB); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - - /*1.5 stop bits*/ - case STOP_1_5: - TTY_WARNING("Posix_QextSerialPort: 1.5 stop bit operation is not supported by POSIX."); - break; - - /*two stop bits*/ - case STOP_2: - if (Settings.DataBits==DATA_5) { - TTY_WARNING("Posix_QextSerialPort: 2 stop bits cannot be used with 5 data bits"); - } - else { - Settings.StopBits=stopBits; - Posix_CommConfig.c_cflag|=CSTOPB; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - break; - } - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setFlowControl(FlowType flow) -Sets the flow control used by the port. Possible values of flow are: -\verbatim - FLOW_OFF No flow control - FLOW_HARDWARE Hardware (RTS/CTS) flow control - FLOW_XONXOFF Software (XON/XOFF) flow control -\endverbatim -\note -FLOW_HARDWARE may not be supported on all versions of UNIX. In cases where it is -unsupported, FLOW_HARDWARE is the same as FLOW_OFF. - -*/ -void Posix_QextSerialPort::setFlowControl(FlowType flow) -{ - LOCK_MUTEX(); - if (Settings.FlowControl!=flow) { - Settings.FlowControl=flow; - } - if (isOpen()) { - switch(flow) { - - /*no flow control*/ - case FLOW_OFF: - Posix_CommConfig.c_cflag&=(~CRTSCTS); - Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY)); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - - /*software (XON/XOFF) flow control*/ - case FLOW_XONXOFF: - Posix_CommConfig.c_cflag&=(~CRTSCTS); - Posix_CommConfig.c_iflag|=(IXON|IXOFF|IXANY); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - - case FLOW_HARDWARE: - Posix_CommConfig.c_cflag|=CRTSCTS; - Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY)); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - break; - } - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setTimeout(ulong sec); -Sets the read and write timeouts for the port to millisec milliseconds. -Note that this is a per-character timeout, i.e. the port will wait this long for each -individual character, not for the whole read operation. This timeout also applies to the -bytesWaiting() function. - -\note -POSIX does not support millisecond-level control for I/O timeout values. Any -timeout set using this function will be set to the next lowest tenth of a second for -the purposes of detecting read or write timeouts. For example a timeout of 550 milliseconds -will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and -writing the port. However millisecond-level control is allowed by the select() system call, -so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for -the purpose of detecting available bytes in the read buffer. - -*/ -void Posix_QextSerialPort::setTimeout(long millisec) -{ - LOCK_MUTEX(); - Settings.Timeout_Millisec = millisec; - Posix_Copy_Timeout.tv_sec = millisec / 1000; - Posix_Copy_Timeout.tv_usec = millisec % 1000; - if (isOpen()) { - tcgetattr(Posix_File->handle(), &Posix_CommConfig); - Posix_CommConfig.c_cc[VTIME] = millisec/100; - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } - UNLOCK_MUTEX(); -} - -/*! -\fn bool Posix_QextSerialPort::open(OpenMode mode) -Opens the serial port associated to this class. -This function has no effect if the port associated with the class is already open. -The port is also configured to the current settings, as stored in the Settings structure. -*/ -bool Posix_QextSerialPort::open(OpenMode mode) -{ - LOCK_MUTEX(); - if (mode == QIODevice::NotOpen) - return isOpen(); - if (!isOpen()) { - /*open the port*/ - Posix_File->setFileName(port); - // qDebug("Trying to open File"); - if (Posix_File->open(QIODevice::ReadWrite|QIODevice::Unbuffered)) { - // qDebug("Opened File succesfully"); - /*set open mode*/ - QIODevice::open(mode); - - /*configure port settings*/ - tcgetattr(Posix_File->handle(), &Posix_CommConfig); - - /*set up other port settings*/ - Posix_CommConfig.c_cflag|=CREAD|CLOCAL; - Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); - Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); - Posix_CommConfig.c_oflag&=(~OPOST); - Posix_CommConfig.c_cc[VMIN]=0; - Posix_CommConfig.c_cc[VINTR] = _POSIX_VDISABLE; - Posix_CommConfig.c_cc[VQUIT] = _POSIX_VDISABLE; - Posix_CommConfig.c_cc[VSTART] = _POSIX_VDISABLE; - Posix_CommConfig.c_cc[VSTOP] = _POSIX_VDISABLE; - Posix_CommConfig.c_cc[VSUSP] = _POSIX_VDISABLE; - setBaudRate(Settings.BaudRate); - setDataBits(Settings.DataBits); - setParity(Settings.Parity); - setStopBits(Settings.StopBits); - setFlowControl(Settings.FlowControl); - setTimeout(Settings.Timeout_Millisec); - tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); - } else { - qDebug("Could not open File! Error code : %d", Posix_File->error()); - } - } - UNLOCK_MUTEX(); - return isOpen(); -} - -/*! -\fn void Posix_QextSerialPort::close() -Closes a serial port. This function has no effect if the serial port associated with the class -is not currently open. -*/ -void Posix_QextSerialPort::close() -{ - LOCK_MUTEX(); - Posix_File->close(); - QIODevice::close(); - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::flush() -Flushes all pending I/O to the serial port. This function has no effect if the serial port -associated with the class is not currently open. -*/ -void Posix_QextSerialPort::flush() -{ - LOCK_MUTEX(); - if (isOpen()) { - Posix_File->flush(); - } - UNLOCK_MUTEX(); -} - -/*! -\fn qint64 Posix_QextSerialPort::size() const -This function will return the number of bytes waiting in the receive queue of the serial port. -It is included primarily to provide a complete QIODevice interface, and will not record errors -in the lastErr member (because it is const). This function is also not thread-safe - in -multithreading situations, use Posix_QextSerialPort::bytesWaiting() instead. -*/ -qint64 Posix_QextSerialPort::size() const -{ - int numBytes; - if (ioctl(Posix_File->handle(), FIONREAD, &numBytes)<0) { - numBytes=0; - } - return (qint64)numBytes; -} - -/*! -\fn qint64 Posix_QextSerialPort::bytesAvailable() -Returns the number of bytes waiting in the port's receive queue. This function will return 0 if -the port is not currently open, or -1 on error. Error information can be retrieved by calling -Posix_QextSerialPort::getLastError(). -*/ -qint64 Posix_QextSerialPort::bytesAvailable() -{ - LOCK_MUTEX(); - if (isOpen()) { - int bytesQueued; - fd_set fileSet; - FD_ZERO(&fileSet); - FD_SET(Posix_File->handle(), &fileSet); - - /*on Linux systems the Posix_Timeout structure will be altered by the select() call. - Make sure we use the right timeout values*/ - //memcpy(&Posix_Timeout, &Posix_Copy_Timeout, sizeof(struct timeval)); - Posix_Timeout = Posix_Copy_Timeout; - int n=select(Posix_File->handle()+1, &fileSet, NULL, &fileSet, &Posix_Timeout); - if (!n) { - lastErr=E_PORT_TIMEOUT; - UNLOCK_MUTEX(); - return -1; - } - if (n==-1 || ioctl(Posix_File->handle(), FIONREAD, &bytesQueued)==-1) { - translateError(errno); - UNLOCK_MUTEX(); - return -1; - } - lastErr=E_NO_ERROR; - UNLOCK_MUTEX(); - return bytesQueued + QIODevice::bytesAvailable(); - } - UNLOCK_MUTEX(); - return 0; -} - -/*! -\fn void Posix_QextSerialPort::ungetChar(char) -This function is included to implement the full QIODevice interface, and currently has no -purpose within this class. This function is meaningless on an unbuffered device and currently -only prints a warning message to that effect. -*/ -void Posix_QextSerialPort::ungetChar(char) -{ - /*meaningless on unbuffered sequential device - return error and print a warning*/ - TTY_WARNING("Posix_QextSerialPort: ungetChar() called on an unbuffered sequential device - operation is meaningless"); -} - -/*! -\fn void Posix_QextSerialPort::translateError(ulong error) -Translates a system-specific error code to a QextSerialPort error code. Used internally. -*/ -void Posix_QextSerialPort::translateError(ulong error) -{ - switch (error) { - case EBADF: - case ENOTTY: - lastErr=E_INVALID_FD; - break; - - case EINTR: - lastErr=E_CAUGHT_NON_BLOCKED_SIGNAL; - break; - - case ENOMEM: - lastErr=E_NO_MEMORY; - break; - } -} - -/*! -\fn void Posix_QextSerialPort::setDtr(bool set) -Sets DTR line to the requested state (high by default). This function will have no effect if -the port associated with the class is not currently open. -*/ -void Posix_QextSerialPort::setDtr(bool set) -{ - LOCK_MUTEX(); - if (isOpen()) { - int status; - ioctl(Posix_File->handle(), TIOCMGET, &status); - if (set) { - status|=TIOCM_DTR; - } - else { - status&=~TIOCM_DTR; - } - ioctl(Posix_File->handle(), TIOCMSET, &status); - } - UNLOCK_MUTEX(); -} - -/*! -\fn void Posix_QextSerialPort::setRts(bool set) -Sets RTS line to the requested state (high by default). This function will have no effect if -the port associated with the class is not currently open. -*/ -void Posix_QextSerialPort::setRts(bool set) -{ - LOCK_MUTEX(); - if (isOpen()) { - int status; - ioctl(Posix_File->handle(), TIOCMGET, &status); - if (set) { - status|=TIOCM_RTS; - } - else { - status&=~TIOCM_RTS; - } - ioctl(Posix_File->handle(), TIOCMSET, &status); - } - UNLOCK_MUTEX(); -} - -/*! -\fn unsigned long Posix_QextSerialPort::lineStatus() -returns the line status as stored by the port function. This function will retrieve the states -of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines -can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned -long with specific bits indicating which lines are high. The following constants should be used -to examine the states of individual lines: - -\verbatim -Mask Line ------- ---- -LS_CTS CTS -LS_DSR DSR -LS_DCD DCD -LS_RI RI -LS_RTS RTS (POSIX only) -LS_DTR DTR (POSIX only) -LS_ST Secondary TXD (POSIX only) -LS_SR Secondary RXD (POSIX only) -\endverbatim - -This function will return 0 if the port associated with the class is not currently open. -*/ -unsigned long Posix_QextSerialPort::lineStatus() -{ - unsigned long Status=0, Temp=0; - LOCK_MUTEX(); - if (isOpen()) { - ioctl(Posix_File->handle(), TIOCMGET, &Temp); - if (Temp&TIOCM_CTS) { - Status|=LS_CTS; - } - if (Temp&TIOCM_DSR) { - Status|=LS_DSR; - } - if (Temp&TIOCM_RI) { - Status|=LS_RI; - } - if (Temp&TIOCM_CD) { - Status|=LS_DCD; - } - if (Temp&TIOCM_DTR) { - Status|=LS_DTR; - } - if (Temp&TIOCM_RTS) { - Status|=LS_RTS; - } - if (Temp&TIOCM_ST) { - Status|=LS_ST; - } - if (Temp&TIOCM_SR) { - Status|=LS_SR; - } - } - UNLOCK_MUTEX(); - return Status; -} - -/*! -\fn qint64 Posix_QextSerialPort::readData(char * data, qint64 maxSize) -Reads a block of data from the serial port. This function will read at most maxSize bytes from -the serial port and place them in the buffer pointed to by data. Return value is the number of -bytes actually read, or -1 on error. - -\warning before calling this function ensure that serial port associated with this class -is currently open (use isOpen() function to check if port is open). -*/ -qint64 Posix_QextSerialPort::readData(char * data, qint64 maxSize) -{ - LOCK_MUTEX(); - int retVal=0; - retVal=Posix_File->read(data, maxSize); - if (retVal==-1) - lastErr=E_READ_FAILED; - UNLOCK_MUTEX(); - - return retVal; -} - -/*! -\fn qint64 Posix_QextSerialPort::writeData(const char * data, qint64 maxSize) -Writes a block of data to the serial port. This function will write maxSize bytes -from the buffer pointed to by data to the serial port. Return value is the number -of bytes actually written, or -1 on error. - -\warning before calling this function ensure that serial port associated with this class -is currently open (use isOpen() function to check if port is open). -*/ -qint64 Posix_QextSerialPort::writeData(const char * data, qint64 maxSize) -{ - LOCK_MUTEX(); - int retVal=0; - retVal=Posix_File->write(data, maxSize); - if (retVal==-1) - lastErr=E_WRITE_FAILED; - UNLOCK_MUTEX(); - - return retVal; -} + +/*! +\class Posix_QextSerialPort +\version 1.0.0 +\author Stefan Sander +\author Michal Policht + +A cross-platform serial port class. +This class encapsulates the POSIX portion of QextSerialPort. The user will be notified of errors +and possible portability conflicts at run-time by default - this behavior can be turned off by +defining _TTY_NOWARN_ (to turn off all warnings) or _TTY_NOWARN_PORT_ (to turn off portability +warnings) in the project. Note that _TTY_NOWARN_ will also turn off portability warnings. +*/ + +#include +#include "posix_qextserialport.h" + +/*! +\fn Posix_QextSerialPort::Posix_QextSerialPort() +Default constructor. Note that the name of the device used by a QextSerialPort constructed with +this constructor will be determined by #defined constants, or lack thereof - the default behavior +is the same as _TTY_LINUX_. Possible naming conventions and their associated constants are: + +\verbatim + +Constant Used By Naming Convention +---------- ------------- ------------------------ +_TTY_WIN_ Windows COM1, COM2 +_TTY_IRIX_ SGI/IRIX /dev/ttyf1, /dev/ttyf2 +_TTY_HPUX_ HP-UX /dev/tty1p0, /dev/tty2p0 +_TTY_SUN_ SunOS/Solaris /dev/ttya, /dev/ttyb +_TTY_DIGITAL_ Digital UNIX /dev/tty01, /dev/tty02 +_TTY_FREEBSD_ FreeBSD /dev/ttyd0, /dev/ttyd1 +_TTY_LINUX_ Linux /dev/ttySAC0, /dev/ttySAC1 + Linux /dev/ttyS0, /dev/ttyS1 +\endverbatim + +This constructor assigns the device name to the name of the first port on the specified system. +See the other constructors if you need to open a different port. +*/ +Posix_QextSerialPort::Posix_QextSerialPort() +: QextSerialBase() +{ + Posix_File=new QFile(); +} + +/*! +\fn Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort&) +Copy constructor. +*/ +Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort& s) + : QextSerialBase(s.port) +{ + setOpenMode(s.openMode()); + port = s.port; + Settings.BaudRate=s.Settings.BaudRate; + Settings.DataBits=s.Settings.DataBits; + Settings.Parity=s.Settings.Parity; + Settings.StopBits=s.Settings.StopBits; + Settings.FlowControl=s.Settings.FlowControl; + lastErr=s.lastErr; + + Posix_File=new QFile(); + Posix_File=s.Posix_File; + memcpy(&Posix_Timeout, &s.Posix_Timeout, sizeof(struct timeval)); + memcpy(&Posix_Copy_Timeout, &s.Posix_Copy_Timeout, sizeof(struct timeval)); + memcpy(&Posix_CommConfig, &s.Posix_CommConfig, sizeof(struct termios)); +} + +/*! +\fn Posix_QextSerialPort::Posix_QextSerialPort(const QString & name) +Constructs a serial port attached to the port specified by name. +name is the name of the device, which is windowsystem-specific, +e.g."COM1" or "/dev/ttyS0". +*/ +Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, QextSerialBase::QueryMode mode) + : QextSerialBase(name) +{ + Posix_File=new QFile(); + setQueryMode(mode); + init(); +} + +/*! +\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings) +Constructs a port with default name and specified settings. +*/ +Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode) + : QextSerialBase() +{ + setBaudRate(settings.BaudRate); + setDataBits(settings.DataBits); + setParity(settings.Parity); + setStopBits(settings.StopBits); + setFlowControl(settings.FlowControl); + + Posix_File=new QFile(); + setTimeout(settings.Timeout_Millisec); + setQueryMode(mode); + init(); +} + +/*! +\fn Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, const PortSettings& settings) +Constructs a port with specified name and settings. +*/ +Posix_QextSerialPort::Posix_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode) + : QextSerialBase(name) +{ + setBaudRate(settings.BaudRate); + setDataBits(settings.DataBits); + setParity(settings.Parity); + setStopBits(settings.StopBits); + setFlowControl(settings.FlowControl); + + Posix_File=new QFile(); + setTimeout(settings.Timeout_Millisec); + setQueryMode(mode); + init(); +} + +/*! +\fn Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s) +Override the = operator. +*/ +Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s) +{ + setOpenMode(s.openMode()); + port = s.port; + Settings.BaudRate=s.Settings.BaudRate; + Settings.DataBits=s.Settings.DataBits; + Settings.Parity=s.Settings.Parity; + Settings.StopBits=s.Settings.StopBits; + Settings.FlowControl=s.Settings.FlowControl; + lastErr=s.lastErr; + + Posix_File=s.Posix_File; + memcpy(&Posix_Timeout, &(s.Posix_Timeout), sizeof(struct timeval)); + memcpy(&Posix_Copy_Timeout, &(s.Posix_Copy_Timeout), sizeof(struct timeval)); + memcpy(&Posix_CommConfig, &(s.Posix_CommConfig), sizeof(struct termios)); + return *this; +} + +void Posix_QextSerialPort::init() +{ + if (queryMode() == QextSerialBase::EventDriven) + qWarning("POSIX doesn't have event driven mechanism implemented yet"); +} + +/*! +\fn Posix_QextSerialPort::~Posix_QextSerialPort() +Standard destructor. +*/ +Posix_QextSerialPort::~Posix_QextSerialPort() +{ + if (isOpen()) { + close(); + } + Posix_File->close(); + delete Posix_File; +} + +/*! +\fn void Posix_QextSerialPort::setBaudRate(BaudRateType baudRate) +Sets the baud rate of the serial port. Note that not all rates are applicable on +all platforms. The following table shows translations of the various baud rate +constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * +are speeds that are usable on both Windows and POSIX. + +\note +BAUD76800 may not be supported on all POSIX systems. SGI/IRIX systems do not support +BAUD1800. + +\verbatim + + RATE Windows Speed POSIX Speed + ----------- ------------- ----------- + BAUD50 110 50 + BAUD75 110 75 + *BAUD110 110 110 + BAUD134 110 134.5 + BAUD150 110 150 + BAUD200 110 200 + *BAUD300 300 300 + *BAUD600 600 600 + *BAUD1200 1200 1200 + BAUD1800 1200 1800 + *BAUD2400 2400 2400 + *BAUD4800 4800 4800 + *BAUD9600 9600 9600 + BAUD14400 14400 9600 + *BAUD19200 19200 19200 + *BAUD38400 38400 38400 + BAUD56000 56000 38400 + *BAUD57600 57600 57600 + BAUD76800 57600 76800 + *BAUD115200 115200 115200 + BAUD128000 128000 115200 + BAUD256000 256000 115200 +\endverbatim +*/ +void Posix_QextSerialPort::setBaudRate(BaudRateType baudRate) +{ + LOCK_MUTEX(); + if (Settings.BaudRate!=baudRate) { + switch (baudRate) { + case BAUD14400: + Settings.BaudRate=BAUD9600; + break; + + case BAUD56000: + Settings.BaudRate=BAUD38400; + break; + + case BAUD76800: + +#ifndef B76800 + Settings.BaudRate=BAUD57600; +#else + Settings.BaudRate=baudRate; +#endif + break; + + case BAUD128000: + case BAUD256000: + Settings.BaudRate=BAUD115200; + break; + + default: + Settings.BaudRate=baudRate; + break; + } + } + if (isOpen()) { + switch (baudRate) { + + /*50 baud*/ + case BAUD50: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 50 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B50; +#else + cfsetispeed(&Posix_CommConfig, B50); + cfsetospeed(&Posix_CommConfig, B50); +#endif + break; + + /*75 baud*/ + case BAUD75: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 75 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B75; +#else + cfsetispeed(&Posix_CommConfig, B75); + cfsetospeed(&Posix_CommConfig, B75); +#endif + break; + + /*110 baud*/ + case BAUD110: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B110; +#else + cfsetispeed(&Posix_CommConfig, B110); + cfsetospeed(&Posix_CommConfig, B110); +#endif + break; + + /*134.5 baud*/ + case BAUD134: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 134.5 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B134; +#else + cfsetispeed(&Posix_CommConfig, B134); + cfsetospeed(&Posix_CommConfig, B134); +#endif + break; + + /*150 baud*/ + case BAUD150: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 150 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B150; +#else + cfsetispeed(&Posix_CommConfig, B150); + cfsetospeed(&Posix_CommConfig, B150); +#endif + break; + + /*200 baud*/ + case BAUD200: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 200 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B200; +#else + cfsetispeed(&Posix_CommConfig, B200); + cfsetospeed(&Posix_CommConfig, B200); +#endif + break; + + /*300 baud*/ + case BAUD300: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B300; +#else + cfsetispeed(&Posix_CommConfig, B300); + cfsetospeed(&Posix_CommConfig, B300); +#endif + break; + + /*600 baud*/ + case BAUD600: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B600; +#else + cfsetispeed(&Posix_CommConfig, B600); + cfsetospeed(&Posix_CommConfig, B600); +#endif + break; + + /*1200 baud*/ + case BAUD1200: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B1200; +#else + cfsetispeed(&Posix_CommConfig, B1200); + cfsetospeed(&Posix_CommConfig, B1200); +#endif + break; + + /*1800 baud*/ + case BAUD1800: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and IRIX do not support 1800 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B1800; +#else + cfsetispeed(&Posix_CommConfig, B1800); + cfsetospeed(&Posix_CommConfig, B1800); +#endif + break; + + /*2400 baud*/ + case BAUD2400: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B2400; +#else + cfsetispeed(&Posix_CommConfig, B2400); + cfsetospeed(&Posix_CommConfig, B2400); +#endif + break; + + /*4800 baud*/ + case BAUD4800: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B4800; +#else + cfsetispeed(&Posix_CommConfig, B4800); + cfsetospeed(&Posix_CommConfig, B4800); +#endif + break; + + /*9600 baud*/ + case BAUD9600: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B9600; +#else + cfsetispeed(&Posix_CommConfig, B9600); + cfsetospeed(&Posix_CommConfig, B9600); +#endif + break; + + /*14400 baud*/ + case BAUD14400: + TTY_WARNING("Posix_QextSerialPort: POSIX does not support 14400 baud operation. Switching to 9600 baud."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B9600; +#else + cfsetispeed(&Posix_CommConfig, B9600); + cfsetospeed(&Posix_CommConfig, B9600); +#endif + break; + + /*19200 baud*/ + case BAUD19200: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B19200; +#else + cfsetispeed(&Posix_CommConfig, B19200); + cfsetospeed(&Posix_CommConfig, B19200); +#endif + break; + + /*38400 baud*/ + case BAUD38400: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B38400; +#else + cfsetispeed(&Posix_CommConfig, B38400); + cfsetospeed(&Posix_CommConfig, B38400); +#endif + break; + + /*56000 baud*/ + case BAUD56000: + TTY_WARNING("Posix_QextSerialPort: POSIX does not support 56000 baud operation. Switching to 38400 baud."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B38400; +#else + cfsetispeed(&Posix_CommConfig, B38400); + cfsetospeed(&Posix_CommConfig, B38400); +#endif + break; + + /*57600 baud*/ + case BAUD57600: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B57600; +#else + cfsetispeed(&Posix_CommConfig, B57600); + cfsetospeed(&Posix_CommConfig, B57600); +#endif + break; + + /*76800 baud*/ + case BAUD76800: + TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and some POSIX systems do not support 76800 baud operation."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + +#ifdef B76800 + Posix_CommConfig.c_cflag|=B76800; +#else + TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support. Switching to 57600 baud."); + Posix_CommConfig.c_cflag|=B57600; +#endif //B76800 +#else //CBAUD +#ifdef B76800 + cfsetispeed(&Posix_CommConfig, B76800); + cfsetospeed(&Posix_CommConfig, B76800); +#else + TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support. Switching to 57600 baud."); + cfsetispeed(&Posix_CommConfig, B57600); + cfsetospeed(&Posix_CommConfig, B57600); +#endif //B76800 +#endif //CBAUD + break; + + /*115200 baud*/ + case BAUD115200: +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B115200; +#else + cfsetispeed(&Posix_CommConfig, B115200); + cfsetospeed(&Posix_CommConfig, B115200); +#endif + break; + + /*128000 baud*/ + case BAUD128000: + TTY_WARNING("Posix_QextSerialPort: POSIX does not support 128000 baud operation. Switching to 115200 baud."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B115200; +#else + cfsetispeed(&Posix_CommConfig, B115200); + cfsetospeed(&Posix_CommConfig, B115200); +#endif + break; + + /*256000 baud*/ + case BAUD256000: + TTY_WARNING("Posix_QextSerialPort: POSIX does not support 256000 baud operation. Switching to 115200 baud."); +#ifdef CBAUD + Posix_CommConfig.c_cflag&=(~CBAUD); + Posix_CommConfig.c_cflag|=B115200; +#else + cfsetispeed(&Posix_CommConfig, B115200); + cfsetospeed(&Posix_CommConfig, B115200); +#endif + break; + } + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setDataBits(DataBitsType dataBits) +Sets the number of data bits used by the serial port. Possible values of dataBits are: +\verbatim + DATA_5 5 data bits + DATA_6 6 data bits + DATA_7 7 data bits + DATA_8 8 data bits +\endverbatim + +\note +This function is subject to the following restrictions: +\par + 5 data bits cannot be used with 2 stop bits. +\par + 8 data bits cannot be used with space parity on POSIX systems. + +*/ +void Posix_QextSerialPort::setDataBits(DataBitsType dataBits) +{ + LOCK_MUTEX(); + if (Settings.DataBits!=dataBits) { + if ((Settings.StopBits==STOP_2 && dataBits==DATA_5) || + (Settings.StopBits==STOP_1_5 && dataBits!=DATA_5) || + (Settings.Parity==PAR_SPACE && dataBits==DATA_8)) { + } + else { + Settings.DataBits=dataBits; + } + } + if (isOpen()) { + switch(dataBits) { + + /*5 data bits*/ + case DATA_5: + if (Settings.StopBits==STOP_2) { + TTY_WARNING("Posix_QextSerialPort: 5 Data bits cannot be used with 2 stop bits."); + } + else { + Settings.DataBits=dataBits; + Posix_CommConfig.c_cflag&=(~CSIZE); + Posix_CommConfig.c_cflag|=CS5; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + + /*6 data bits*/ + case DATA_6: + if (Settings.StopBits==STOP_1_5) { + TTY_WARNING("Posix_QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits."); + } + else { + Settings.DataBits=dataBits; + Posix_CommConfig.c_cflag&=(~CSIZE); + Posix_CommConfig.c_cflag|=CS6; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + + /*7 data bits*/ + case DATA_7: + if (Settings.StopBits==STOP_1_5) { + TTY_WARNING("Posix_QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits."); + } + else { + Settings.DataBits=dataBits; + Posix_CommConfig.c_cflag&=(~CSIZE); + Posix_CommConfig.c_cflag|=CS7; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + + /*8 data bits*/ + case DATA_8: + if (Settings.StopBits==STOP_1_5) { + TTY_WARNING("Posix_QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits."); + } + else { + Settings.DataBits=dataBits; + Posix_CommConfig.c_cflag&=(~CSIZE); + Posix_CommConfig.c_cflag|=CS8; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + } + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setParity(ParityType parity) +Sets the parity associated with the serial port. The possible values of parity are: +\verbatim + PAR_SPACE Space Parity + PAR_MARK Mark Parity + PAR_NONE No Parity + PAR_EVEN Even Parity + PAR_ODD Odd Parity +\endverbatim + +\note +This function is subject to the following limitations: +\par +POSIX systems do not support mark parity. +\par +POSIX systems support space parity only if tricked into doing so, and only with + fewer than 8 data bits. Use space parity very carefully with POSIX systems. + +*/ +void Posix_QextSerialPort::setParity(ParityType parity) +{ + LOCK_MUTEX(); + if (Settings.Parity!=parity) { + if (parity==PAR_MARK || (parity==PAR_SPACE && Settings.DataBits==DATA_8)) { + } + else { + Settings.Parity=parity; + } + } + if (isOpen()) { + switch (parity) { + + /*space parity*/ + case PAR_SPACE: + if (Settings.DataBits==DATA_8) { + TTY_PORTABILITY_WARNING("Posix_QextSerialPort: Space parity is only supported in POSIX with 7 or fewer data bits"); + } + else { + + /*space parity not directly supported - add an extra data bit to simulate it*/ + Posix_CommConfig.c_cflag&=~(PARENB|CSIZE); + switch(Settings.DataBits) { + case DATA_5: + Settings.DataBits=DATA_6; + Posix_CommConfig.c_cflag|=CS6; + break; + + case DATA_6: + Settings.DataBits=DATA_7; + Posix_CommConfig.c_cflag|=CS7; + break; + + case DATA_7: + Settings.DataBits=DATA_8; + Posix_CommConfig.c_cflag|=CS8; + break; + + case DATA_8: + break; + } + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + + /*mark parity - WINDOWS ONLY*/ + case PAR_MARK: + TTY_WARNING("Posix_QextSerialPort: Mark parity is not supported by POSIX."); + break; + + /*no parity*/ + case PAR_NONE: + Posix_CommConfig.c_cflag&=(~PARENB); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + + /*even parity*/ + case PAR_EVEN: + Posix_CommConfig.c_cflag&=(~PARODD); + Posix_CommConfig.c_cflag|=PARENB; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + + /*odd parity*/ + case PAR_ODD: + Posix_CommConfig.c_cflag|=(PARENB|PARODD); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + } + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setStopBits(StopBitsType stopBits) +Sets the number of stop bits used by the serial port. Possible values of stopBits are: +\verbatim + STOP_1 1 stop bit + STOP_1_5 1.5 stop bits + STOP_2 2 stop bits +\endverbatim +\note +This function is subject to the following restrictions: +\par + 2 stop bits cannot be used with 5 data bits. +\par + POSIX does not support 1.5 stop bits. + +*/ +void Posix_QextSerialPort::setStopBits(StopBitsType stopBits) +{ + LOCK_MUTEX(); + if (Settings.StopBits!=stopBits) { + if ((Settings.DataBits==DATA_5 && stopBits==STOP_2) || stopBits==STOP_1_5) {} + else { + Settings.StopBits=stopBits; + } + } + if (isOpen()) { + switch (stopBits) { + + /*one stop bit*/ + case STOP_1: + Settings.StopBits=stopBits; + Posix_CommConfig.c_cflag&=(~CSTOPB); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + + /*1.5 stop bits*/ + case STOP_1_5: + TTY_WARNING("Posix_QextSerialPort: 1.5 stop bit operation is not supported by POSIX."); + break; + + /*two stop bits*/ + case STOP_2: + if (Settings.DataBits==DATA_5) { + TTY_WARNING("Posix_QextSerialPort: 2 stop bits cannot be used with 5 data bits"); + } + else { + Settings.StopBits=stopBits; + Posix_CommConfig.c_cflag|=CSTOPB; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + break; + } + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setFlowControl(FlowType flow) +Sets the flow control used by the port. Possible values of flow are: +\verbatim + FLOW_OFF No flow control + FLOW_HARDWARE Hardware (RTS/CTS) flow control + FLOW_XONXOFF Software (XON/XOFF) flow control +\endverbatim +\note +FLOW_HARDWARE may not be supported on all versions of UNIX. In cases where it is +unsupported, FLOW_HARDWARE is the same as FLOW_OFF. + +*/ +void Posix_QextSerialPort::setFlowControl(FlowType flow) +{ + LOCK_MUTEX(); + if (Settings.FlowControl!=flow) { + Settings.FlowControl=flow; + } + if (isOpen()) { + switch(flow) { + + /*no flow control*/ + case FLOW_OFF: + Posix_CommConfig.c_cflag&=(~CRTSCTS); + Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY)); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + + /*software (XON/XOFF) flow control*/ + case FLOW_XONXOFF: + Posix_CommConfig.c_cflag&=(~CRTSCTS); + Posix_CommConfig.c_iflag|=(IXON|IXOFF|IXANY); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + + case FLOW_HARDWARE: + Posix_CommConfig.c_cflag|=CRTSCTS; + Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY)); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + break; + } + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setTimeout(ulong sec); +Sets the read and write timeouts for the port to millisec milliseconds. +Note that this is a per-character timeout, i.e. the port will wait this long for each +individual character, not for the whole read operation. This timeout also applies to the +bytesWaiting() function. + +\note +POSIX does not support millisecond-level control for I/O timeout values. Any +timeout set using this function will be set to the next lowest tenth of a second for +the purposes of detecting read or write timeouts. For example a timeout of 550 milliseconds +will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and +writing the port. However millisecond-level control is allowed by the select() system call, +so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for +the purpose of detecting available bytes in the read buffer. + +*/ +void Posix_QextSerialPort::setTimeout(long millisec) +{ + LOCK_MUTEX(); + Settings.Timeout_Millisec = millisec; + Posix_Copy_Timeout.tv_sec = millisec / 1000; + Posix_Copy_Timeout.tv_usec = millisec % 1000; + if (isOpen()) { + tcgetattr(Posix_File->handle(), &Posix_CommConfig); + Posix_CommConfig.c_cc[VTIME] = millisec/100; + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } + UNLOCK_MUTEX(); +} + +/*! +\fn bool Posix_QextSerialPort::open(OpenMode mode) +Opens the serial port associated to this class. +This function has no effect if the port associated with the class is already open. +The port is also configured to the current settings, as stored in the Settings structure. +*/ +bool Posix_QextSerialPort::open(OpenMode mode) +{ + LOCK_MUTEX(); + if (mode == QIODevice::NotOpen) + return isOpen(); + if (!isOpen()) { + /*open the port*/ + Posix_File->setFileName(port); + // qDebug("Trying to open File"); + if (Posix_File->open(QIODevice::ReadWrite|QIODevice::Unbuffered)) { + // qDebug("Opened File succesfully"); + /*set open mode*/ + QIODevice::open(mode); + + /*configure port settings*/ + tcgetattr(Posix_File->handle(), &Posix_CommConfig); + + /*set up other port settings*/ + Posix_CommConfig.c_cflag|=CREAD|CLOCAL; + Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); + Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); + Posix_CommConfig.c_oflag&=(~OPOST); + Posix_CommConfig.c_cc[VMIN]=0; + Posix_CommConfig.c_cc[VINTR] = _POSIX_VDISABLE; + Posix_CommConfig.c_cc[VQUIT] = _POSIX_VDISABLE; + Posix_CommConfig.c_cc[VSTART] = _POSIX_VDISABLE; + Posix_CommConfig.c_cc[VSTOP] = _POSIX_VDISABLE; + Posix_CommConfig.c_cc[VSUSP] = _POSIX_VDISABLE; + setBaudRate(Settings.BaudRate); + setDataBits(Settings.DataBits); + setParity(Settings.Parity); + setStopBits(Settings.StopBits); + setFlowControl(Settings.FlowControl); + setTimeout(Settings.Timeout_Millisec); + tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig); + } else { + qDebug("Could not open File! Error code : %d", Posix_File->error()); + } + } + UNLOCK_MUTEX(); + return isOpen(); +} + +/*! +\fn void Posix_QextSerialPort::close() +Closes a serial port. This function has no effect if the serial port associated with the class +is not currently open. +*/ +void Posix_QextSerialPort::close() +{ + LOCK_MUTEX(); + Posix_File->close(); + QIODevice::close(); + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::flush() +Flushes all pending I/O to the serial port. This function has no effect if the serial port +associated with the class is not currently open. +*/ +void Posix_QextSerialPort::flush() +{ + LOCK_MUTEX(); + if (isOpen()) { + Posix_File->flush(); + } + UNLOCK_MUTEX(); +} + +/*! +\fn qint64 Posix_QextSerialPort::size() const +This function will return the number of bytes waiting in the receive queue of the serial port. +It is included primarily to provide a complete QIODevice interface, and will not record errors +in the lastErr member (because it is const). This function is also not thread-safe - in +multithreading situations, use Posix_QextSerialPort::bytesWaiting() instead. +*/ +qint64 Posix_QextSerialPort::size() const +{ + int numBytes; + if (ioctl(Posix_File->handle(), FIONREAD, &numBytes)<0) { + numBytes=0; + } + return (qint64)numBytes; +} + +/*! +\fn qint64 Posix_QextSerialPort::bytesAvailable() +Returns the number of bytes waiting in the port's receive queue. This function will return 0 if +the port is not currently open, or -1 on error. Error information can be retrieved by calling +Posix_QextSerialPort::getLastError(). +*/ +qint64 Posix_QextSerialPort::bytesAvailable() +{ + LOCK_MUTEX(); + if (isOpen()) { + int bytesQueued; + fd_set fileSet; + FD_ZERO(&fileSet); + FD_SET(Posix_File->handle(), &fileSet); + + /*on Linux systems the Posix_Timeout structure will be altered by the select() call. + Make sure we use the right timeout values*/ + //memcpy(&Posix_Timeout, &Posix_Copy_Timeout, sizeof(struct timeval)); + Posix_Timeout = Posix_Copy_Timeout; + int n=select(Posix_File->handle()+1, &fileSet, NULL, &fileSet, &Posix_Timeout); + if (!n) { + lastErr=E_PORT_TIMEOUT; + UNLOCK_MUTEX(); + return -1; + } + if (n==-1 || ioctl(Posix_File->handle(), FIONREAD, &bytesQueued)==-1) { + translateError(errno); + UNLOCK_MUTEX(); + return -1; + } + lastErr=E_NO_ERROR; + UNLOCK_MUTEX(); + return bytesQueued + QIODevice::bytesAvailable(); + } + UNLOCK_MUTEX(); + return 0; +} + +/*! +\fn void Posix_QextSerialPort::ungetChar(char) +This function is included to implement the full QIODevice interface, and currently has no +purpose within this class. This function is meaningless on an unbuffered device and currently +only prints a warning message to that effect. +*/ +void Posix_QextSerialPort::ungetChar(char) +{ + /*meaningless on unbuffered sequential device - return error and print a warning*/ + TTY_WARNING("Posix_QextSerialPort: ungetChar() called on an unbuffered sequential device - operation is meaningless"); +} + +/*! +\fn void Posix_QextSerialPort::translateError(ulong error) +Translates a system-specific error code to a QextSerialPort error code. Used internally. +*/ +void Posix_QextSerialPort::translateError(ulong error) +{ + switch (error) { + case EBADF: + case ENOTTY: + lastErr=E_INVALID_FD; + break; + + case EINTR: + lastErr=E_CAUGHT_NON_BLOCKED_SIGNAL; + break; + + case ENOMEM: + lastErr=E_NO_MEMORY; + break; + } +} + +/*! +\fn void Posix_QextSerialPort::setDtr(bool set) +Sets DTR line to the requested state (high by default). This function will have no effect if +the port associated with the class is not currently open. +*/ +void Posix_QextSerialPort::setDtr(bool set) +{ + LOCK_MUTEX(); + if (isOpen()) { + int status; + ioctl(Posix_File->handle(), TIOCMGET, &status); + if (set) { + status|=TIOCM_DTR; + } + else { + status&=~TIOCM_DTR; + } + ioctl(Posix_File->handle(), TIOCMSET, &status); + } + UNLOCK_MUTEX(); +} + +/*! +\fn void Posix_QextSerialPort::setRts(bool set) +Sets RTS line to the requested state (high by default). This function will have no effect if +the port associated with the class is not currently open. +*/ +void Posix_QextSerialPort::setRts(bool set) +{ + LOCK_MUTEX(); + if (isOpen()) { + int status; + ioctl(Posix_File->handle(), TIOCMGET, &status); + if (set) { + status|=TIOCM_RTS; + } + else { + status&=~TIOCM_RTS; + } + ioctl(Posix_File->handle(), TIOCMSET, &status); + } + UNLOCK_MUTEX(); +} + +/*! +\fn unsigned long Posix_QextSerialPort::lineStatus() +returns the line status as stored by the port function. This function will retrieve the states +of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines +can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned +long with specific bits indicating which lines are high. The following constants should be used +to examine the states of individual lines: + +\verbatim +Mask Line +------ ---- +LS_CTS CTS +LS_DSR DSR +LS_DCD DCD +LS_RI RI +LS_RTS RTS (POSIX only) +LS_DTR DTR (POSIX only) +LS_ST Secondary TXD (POSIX only) +LS_SR Secondary RXD (POSIX only) +\endverbatim + +This function will return 0 if the port associated with the class is not currently open. +*/ +unsigned long Posix_QextSerialPort::lineStatus() +{ + unsigned long Status=0, Temp=0; + LOCK_MUTEX(); + if (isOpen()) { + ioctl(Posix_File->handle(), TIOCMGET, &Temp); + if (Temp&TIOCM_CTS) { + Status|=LS_CTS; + } + if (Temp&TIOCM_DSR) { + Status|=LS_DSR; + } + if (Temp&TIOCM_RI) { + Status|=LS_RI; + } + if (Temp&TIOCM_CD) { + Status|=LS_DCD; + } + if (Temp&TIOCM_DTR) { + Status|=LS_DTR; + } + if (Temp&TIOCM_RTS) { + Status|=LS_RTS; + } + if (Temp&TIOCM_ST) { + Status|=LS_ST; + } + if (Temp&TIOCM_SR) { + Status|=LS_SR; + } + } + UNLOCK_MUTEX(); + return Status; +} + +/*! +\fn qint64 Posix_QextSerialPort::readData(char * data, qint64 maxSize) +Reads a block of data from the serial port. This function will read at most maxSize bytes from +the serial port and place them in the buffer pointed to by data. Return value is the number of +bytes actually read, or -1 on error. + +\warning before calling this function ensure that serial port associated with this class +is currently open (use isOpen() function to check if port is open). +*/ +qint64 Posix_QextSerialPort::readData(char * data, qint64 maxSize) +{ + LOCK_MUTEX(); + int retVal=0; + retVal=Posix_File->read(data, maxSize); + if (retVal==-1) + lastErr=E_READ_FAILED; + UNLOCK_MUTEX(); + + return retVal; +} + +/*! +\fn qint64 Posix_QextSerialPort::writeData(const char * data, qint64 maxSize) +Writes a block of data to the serial port. This function will write maxSize bytes +from the buffer pointed to by data to the serial port. Return value is the number +of bytes actually written, or -1 on error. + +\warning before calling this function ensure that serial port associated with this class +is currently open (use isOpen() function to check if port is open). +*/ +qint64 Posix_QextSerialPort::writeData(const char * data, qint64 maxSize) +{ + LOCK_MUTEX(); + int retVal=0; + retVal=Posix_File->write(data, maxSize); + if (retVal==-1) + lastErr=E_WRITE_FAILED; + UNLOCK_MUTEX(); + + return retVal; +} diff --git a/posix_qextserialport.h b/posix_qextserialport.h index 2c0ebe8..298bc2e 100644 --- a/posix_qextserialport.h +++ b/posix_qextserialport.h @@ -1,63 +1,63 @@ -#ifndef _POSIX_QEXTSERIALPORT_H_ -#define _POSIX_QEXTSERIALPORT_H_ - -#include -#include -#include -#include -#include -#include -#include -#include "qextserialbase.h" - -class Posix_QextSerialPort:public QextSerialBase -{ - private: - /*! - * This method is a part of constructor. - */ - void init(); - - protected: - QFile* Posix_File; - struct termios Posix_CommConfig; - struct timeval Posix_Timeout; - struct timeval Posix_Copy_Timeout; - - virtual qint64 readData(char * data, qint64 maxSize); - virtual qint64 writeData(const char * data, qint64 maxSize); - - public: - Posix_QextSerialPort(); - Posix_QextSerialPort(const Posix_QextSerialPort& s); - Posix_QextSerialPort(const QString & name, QextSerialBase::QueryMode mode = QextSerialBase::Polling); - Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling); - Posix_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling); - Posix_QextSerialPort& operator=(const Posix_QextSerialPort& s); - virtual ~Posix_QextSerialPort(); - - virtual void setBaudRate(BaudRateType); - virtual void setDataBits(DataBitsType); - virtual void setParity(ParityType); - virtual void setStopBits(StopBitsType); - virtual void setFlowControl(FlowType); - virtual void setTimeout(long); - - virtual bool open(OpenMode mode); - virtual void close(); - virtual void flush(); - - virtual qint64 size() const; - virtual qint64 bytesAvailable(); - - virtual void ungetChar(char c); - - virtual void translateError(ulong error); - - virtual void setDtr(bool set=true); - virtual void setRts(bool set=true); - virtual ulong lineStatus(); - -}; - -#endif +#ifndef _POSIX_QEXTSERIALPORT_H_ +#define _POSIX_QEXTSERIALPORT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "qextserialbase.h" + +class Posix_QextSerialPort:public QextSerialBase +{ + private: + /*! + * This method is a part of constructor. + */ + void init(); + + protected: + QFile* Posix_File; + struct termios Posix_CommConfig; + struct timeval Posix_Timeout; + struct timeval Posix_Copy_Timeout; + + virtual qint64 readData(char * data, qint64 maxSize); + virtual qint64 writeData(const char * data, qint64 maxSize); + + public: + Posix_QextSerialPort(); + Posix_QextSerialPort(const Posix_QextSerialPort& s); + Posix_QextSerialPort(const QString & name, QextSerialBase::QueryMode mode = QextSerialBase::Polling); + Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling); + Posix_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode = QextSerialBase::Polling); + Posix_QextSerialPort& operator=(const Posix_QextSerialPort& s); + virtual ~Posix_QextSerialPort(); + + virtual void setBaudRate(BaudRateType); + virtual void setDataBits(DataBitsType); + virtual void setParity(ParityType); + virtual void setStopBits(StopBitsType); + virtual void setFlowControl(FlowType); + virtual void setTimeout(long); + + virtual bool open(OpenMode mode); + virtual void close(); + virtual void flush(); + + virtual qint64 size() const; + virtual qint64 bytesAvailable(); + + virtual void ungetChar(char c); + + virtual void translateError(ulong error); + + virtual void setDtr(bool set=true); + virtual void setRts(bool set=true); + virtual ulong lineStatus(); + +}; + +#endif diff --git a/print_net.cpp b/print_net.cpp index fc44987..ed2b75a 100644 --- a/print_net.cpp +++ b/print_net.cpp @@ -1,456 +1,456 @@ -#include "print_net.h" -#include "QDebug" -#include -#include -#include "LogInfo.h" -#define QT_NO_SSL - -PrintNet::PrintNet() -{ - m_bShortNet = false; - // 创建网络管理器用于GET method - this->getManager = new QNetworkAccessManager(this); - connect(getManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *))); - // 创建网络管理器用于POST method - this->postManager = new QNetworkAccessManager(this); - connect(postManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postPrintFinished(QNetworkReply *))); - - m_postmanager = new QNetworkAccessManager(this); - connect(m_postmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postGetShortUrlFinished(QNetworkReply *))); -} - -PrintNet::~PrintNet() -{ - delete this->getManager; - delete this->postManager; -} - -// 初步实现 喷码机向服务器获取打印数据 以及 上报状态 接口 -// 未处理 网络条件不具备 / 访问超时 等异常 - -// 递归列出JSON所有层内容 -void PrintNet::traversJson(QJsonObject json_obj) -{ - foreach (const QString& key, json_obj.keys()) - { - QJsonValue value = json_obj.value(key); - if (!value.isObject()) - { -// qDebug()<<"[traversJson]key="<',">").replace('"',""").replace('\'',"'");//edit@02-07 -// .replace('¥',"¥").replace('®',"®").replace('°',"°").replace('±',"±").replace('×',"x") -// .replace('*',"*").replace('÷',"÷").replace('²',"²").replace('³',"³").replace('Ω',"Ω") -// .replace('Φ',"Φ").replace('¥',"¥").replace('φ',"φ").replace('©',"©").replace('@',"@") -// .replace('㎡',"㎡").replace('℃',"℃").replace('℉',"℉").replace('\r',' ').replace('\n',' ') ; -// const char *std_str = t_str.toStdString().data(); -// strcpy(Json_get_data.PrintingContent,std_str); - strncpy(Json_get_data.PrintingContent,t_str.toStdString().c_str(),sizeof(Json_get_data.PrintingContent)); - Json_get_data.PrintingContent[sizeof(Json_get_data.PrintingContent) -1] = '\0'; - }else - if(key == "ProductPlanQty"){ - Json_get_data.ProductPlanQty = value.toDouble(); - }else - if(key == "ProductUniqueCode"){ - QString t_str; - t_str = value.toString(); -// const char *std_str = t_str.toStdString().data(); -// strcpy(Json_get_data.ProductUniqueCode,std_str); - strncpy(Json_get_data.ProductUniqueCode,t_str.toStdString().c_str(),sizeof(Json_get_data.ProductUniqueCode)); - Json_get_data.ProductUniqueCode[sizeof(Json_get_data.ProductUniqueCode) -1] = '\0'; - }else - if(key == "ProductionTask"){ - Json_get_data.ProductionTask = value.toDouble(); - }else - if(key == "StartMetre"){ - Json_get_data.StartMetre = value.toDouble(); - }else - if(key == "TasdNeedConfirm"){ - Json_get_data.TasdNeedConfirm = value.toBool(); - }else - if(key == "TaskSwitchingMode"){ - Json_get_data.TaskSwitchingMode = value.toDouble(); - } - } - else - { - traversJson(value.toObject()); - } - } -} - -void PrintNet::postPrintFinished(QNetworkReply *reply) -{ - QNetworkReply::NetworkError error; - error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) - if (error) - { // 非0值表示有错误发生 - switch(error) - { - case QNetworkReply::ConnectionRefusedError: - save_messege = "远程主机拒绝连接"; - break; - - case QNetworkReply::RemoteHostClosedError: - save_messege = "远程主机关闭连接"; - break; - - case QNetworkReply::HostNotFoundError: - save_messege = "远程主机未找到"; - break; - - case QNetworkReply::TimeoutError: - save_messege = "连接到远程主机超时"; - break; - - case QNetworkReply::ContentAccessDenied: - save_messege = "远程主机拒绝访问"; - break; - - case QNetworkReply::ContentNotFoundError: - save_messege = "内容未找到"; - break; - default: - save_messege = "通信失败"; - } - emit json_server_error(); - return; - } - - //未出错时获取响应信息 - QByteArray rsp_data = reply->readAll(); - //以下对获取的JSON数据进行解析 - QJsonDocument json = QJsonDocument::fromJson(rsp_data); - - QJsonObject obj = json.object(); - - traversJson(obj); // 递归列出JSON所有层内容 -// qDebug() << "[postPrintFinished]ResultCode: " << obj["ResultCode"]; -// qDebug() << "[postPrintFinished]ResultMessage: " << obj["ResultMessage"]; -// qDebug() << "[postPrintFinished]ResultData: " << obj["ResultData"]; - - save_messege = obj["ResultMessage"].toString(); - - reply->deleteLater(); -} - -QString PrintNet::getMessege() -{ - return save_messege; -} -// 处理HTTP请求的应答 -void PrintNet::replyFinished(QNetworkReply *reply) -{ - QNetworkReply::NetworkError error; - error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) - if (error) - { // 非0值表示有错误发生 - switch(error) - { - case QNetworkReply::ConnectionRefusedError: - save_messege = "远程主机拒绝连接"; - break; - - case QNetworkReply::RemoteHostClosedError: - save_messege = "远程主机关闭连接"; - break; - - case QNetworkReply::HostNotFoundError: - save_messege = "远程主机未找到"; - break; - - case QNetworkReply::TimeoutError: - save_messege = "连接到远程主机超时"; - break; - - case QNetworkReply::ContentAccessDenied: - save_messege = "远程主机拒绝访问"; - break; - - case QNetworkReply::ContentNotFoundError: - save_messege = "内容未找到"; - break; - default: - save_messege = "通信失败"; - } - - emit json_server_error(); - return; - } - //未出错时获取响应信息 - QByteArray rsp_data = reply->readAll(); - //以下对获取的JSON数据进行解析 - QJsonDocument json = QJsonDocument::fromJson(rsp_data); - QJsonObject obj = json.object(); - traversJson(obj); // 递归列出JSON所有层内容 - -// qDebug() << "[replyFinished] ResultCode: " << obj["ResultCode"]; -// qDebug() << "[replyFinished] ResultMessage: " << obj["ResultMessage"]; -// qDebug() << "[replyFinished] ResultData: " << obj["ResultData"]; - - save_messege = obj["ResultMessage"].toString(); - - reply->deleteLater(); - save_messege = "JSON获取成功!"; - emit showMessege(); - if(m_bShortNet) - { - FromBaiDuGetShortUrl(Json_get_data.QRCodeContent); - } - else - { - emit receiveJSONDatafinish(); - } -} - -// 从服务器获取打印数据 -// url - 提供打印数据的服务器链接 -// equip_code - 喷码机编号 -void PrintNet::PrintNetGetData(QString url, const QString& equip_code) -{ - EquipmentCode = equip_code; - //设计本接口实现时,考虑输入的url为问号(?)之前那部分,不同的喷码机equip_code不同 - //QUrl qrl("http://47.111.170.144:8754/KLAPS/APSServer/ECode/GetProductUniqueCodeTest?EquipmentCode=1"); - QUrl qrl(url); -#ifndef QT_MAJOR_VERSION5 - // 在访问服务器API的链接中添加喷码机编号 - //qrl.addQueryItem("EquipmentCode", QString::number(equip_code)); - qrl.addQueryItem("EquipmentCode", equip_code); -#else - QUrlQuery query; - query.addQueryItem("EquipmentCode", equip_code); - qrl.setQuery(query); -#endif - - // 构造请求 - QNetworkRequest request; - request.setUrl(qrl); - - getManager->get(request); // HTTP GET -} - -// 向服务器上报打印完成状态 -// url - 上报打印完成状态的服务器链接 -void PrintNet::PrintNetPostFinish(QString url) -{ - QUrl qrl(url); - - - // 构造JSON对象数据 - QJsonObject json; - json.insert("ProductUniqueCode", QString(Json_get_data.ProductUniqueCode)); - json.insert("ProductionTask", QString::number(Json_get_data.ProductionTask)); - json.insert("PrintingContent", QString(Json_get_data.PrintingContent)); - //json.insert("EquipmentUniqueCode", QString::number(EquipmentCode) ); - json.insert("EquipmentUniqueCode", EquipmentCode ); - json.insert("StartingMeters", QString::number(Json_get_data.StartMetre)); - json.insert("ProductNumber", QString::number(Json_get_data.ProductPlanQty)); - json.insert("Coordinates", QString("北纬N31°51′15.36 东经E117°12′8.77")); -// qDebug() << json; - - QJsonDocument jsonDoc(json); -// qDebug() << jsonDoc; - - QByteArray jsonData = jsonDoc.toJson(); -// qDebug() << jsonData; - - QNetworkRequest request; - request.setUrl(qrl); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - - postManager->post(request, jsonData); // HTTP POST -} - -// 向服务器上报设备运行状态 -// url - 上报设备运行状态的服务器链接 - -void PrintNet::PrintNetPostState(QString url) -{ - QUrl qrl(url); - - // 构造JSON对象数据 - QJsonObject json; - //json.insert("EquipmentUniqueCode", QString::number(EquipmentCode)); - json.insert("EquipmentUniqueCode", EquipmentCode ); - json.insert("CurrentMeter", QString("13.3")); - json.insert("CurrentEcode", QString(Json_get_data.ProductUniqueCode)); - json.insert("CurrentPrintingContent", QString(Json_get_data.PrintingContent)); -// qDebug() << json; - - QJsonDocument jsonDoc(json); -// qDebug() << jsonDoc; - - QByteArray jsonData = jsonDoc.toJson(); -// qDebug() << jsonData; - - QNetworkRequest request; - request.setUrl(qrl); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - - postManager->post(request, jsonData); // HTTP POST -} - -// 向百度云获取转换的短网址 -//longUrl要转换的长url - -void PrintNet::FromBaiDuGetShortUrl(QString longUrl) -{ - QUrl qrl(QString("https://dwz.cn/api/v3/short-urls")); - - // 构造JSON对象数据 - QJsonObject json; - json.insert("LongUrl", longUrl); - json.insert("TermOfValidity", QString("long-term")); - //json.insert("CurrentEcode", QString(Json_get_data.ProductUniqueCode)); - //json.insert("CurrentPrintingContent", QString(Json_get_data.PrintingContent)); - //qDebug() << json; - - QJsonArray Arrjson; - Arrjson.append(json); - - QJsonDocument jsonDoc(Arrjson); - //qDebug() << jsonDoc; - - QByteArray jsonData = jsonDoc.toJson(); - //qDebug() << jsonData; - - //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): setSsl before")); - QNetworkRequest request; - request.setUrl(qrl); -#ifndef QT_NO_SSL - //LogInfo::setRunStatusText(tr("defaultConfiguration new before")); - QSslConfiguration config = QSslConfiguration::defaultConfiguration(); - //LogInfo::setRunStatusText(tr("defaultConfiguration 1")); -#ifndef QT_MAJOR_VERSION5 - config.setProtocol(QSsl::TlsV1); -#else - config.setProtocol(QSsl::SslProtocol::TlsV1_0);//edit@02-07 -#endif - //LogInfo::setRunStatusText(tr("defaultConfiguration 2")); - config.setPeerVerifyMode(QSslSocket::VerifyNone); - //LogInfo::setRunStatusText(tr("defaultConfiguration 3")); - request.setSslConfiguration(config); - //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): setSsl after")); -#endif - - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json; charset=UTF-8"); - request.setRawHeader("Dwz-Token" ,"708e8736a533df553a8898699280bcf9"); - - //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): <1>")); - //QNetworkAccessManager *post_manager = new QNetworkAccessManager(this); - //connect(post_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postGetShortUrlFinished(QNetworkReply *))); - m_postmanager->post(request, jsonData); // HTTP POST - //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): <2>")); - //connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onNetReplyError(QNetworkReply::NetworkError))); - //connect(reply, SIGNAL(sslErrors(QList&)), this, SLOT(onNetReplySshErrors(QList&))); -#ifndef QT_NO_SSL - connect(post_manager, SIGNAL(sslErrors(QNetworkReply*,QList)), - this, SLOT(sslErrors(QNetworkReply*,QList))); -#endif - -} -#ifndef QT_NO_SSL -void PrintNet::sslErrors(QNetworkReply *reply,const QList &) -{ - reply->ignoreSslErrors(); -} -#endif - -void PrintNet::postGetShortUrlFinished(QNetworkReply *reply) -{ - //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <3>")); - QNetworkReply::NetworkError error; - error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) - if (error) - { // 非0值表示有错误发生 - switch(error) - { - case QNetworkReply::ConnectionRefusedError: - save_messege = "远程主机拒绝连接"; - break; - - case QNetworkReply::RemoteHostClosedError: - save_messege = "远程主机关闭连接"; - break; - - case QNetworkReply::HostNotFoundError: - save_messege = "远程主机未找到"; - break; - - case QNetworkReply::TimeoutError: - save_messege = "连接到远程主机超时"; - break; - - case QNetworkReply::ContentAccessDenied: - save_messege = "远程主机拒绝访问"; - break; - - case QNetworkReply::ContentNotFoundError: - save_messege = "内容未找到"; - break; - default: - save_messege = "通信失败"; - } - //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <4>")); - emit json_server_error(); - //emit receiveJSONDatafinish(); - return; - } - - //未出错时获取响应信息 - QByteArray rsp_data = reply->readAll(); - //以下对获取的JSON数据进行解析 - QJsonDocument json = QJsonDocument::fromJson(rsp_data); - //qDebug() << json; - - QJsonObject obj = json.object(); - // qDebug() << obj; - - QString strResultCode; - save_messege = strResultCode.number(obj["Code"].toDouble()); - if(save_messege != "0") - { - //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <5>")); - //emit receiveJSONDatafinish(); - save_messege = "获取短网址出错,错误码:"+ save_messege; - return; - } - QJsonArray JsonArr = obj["ShortUrls"].toArray(); - QJsonValue value = JsonArr.at(0); - QJsonObject jsonObj = value.toObject(); - foreach (const QString& key, jsonObj.keys()) - { - QJsonValue value = jsonObj.value(key); - if (!value.isObject()) - { - if(key == "ShortUrl") - { - QString t_str; - t_str = value.toString(); - const char *std_str = t_str.toStdString().data(); - strcpy(Json_get_data.QRCodeContent,std_str); - } - } - - } - save_messege = "获取短网址成功"; - //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <6>")); - reply->deleteLater(); - emit receiveJSONDatafinish(); -} - - -void PrintNet::getJson_data(JSON_DATA *json_data) -{ - memcpy(json_data, &Json_get_data, sizeof(JSON_DATA)); -} +#include "print_net.h" +#include "QDebug" +#include +#include +#include "LogInfo.h" +#define QT_NO_SSL + +PrintNet::PrintNet() +{ + m_bShortNet = false; + // 创建网络管理器用于GET method + this->getManager = new QNetworkAccessManager(this); + connect(getManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *))); + // 创建网络管理器用于POST method + this->postManager = new QNetworkAccessManager(this); + connect(postManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postPrintFinished(QNetworkReply *))); + + m_postmanager = new QNetworkAccessManager(this); + connect(m_postmanager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postGetShortUrlFinished(QNetworkReply *))); +} + +PrintNet::~PrintNet() +{ + delete this->getManager; + delete this->postManager; +} + +// 初步实现 喷码机向服务器获取打印数据 以及 上报状态 接口 +// 未处理 网络条件不具备 / 访问超时 等异常 + +// 递归列出JSON所有层内容 +void PrintNet::traversJson(QJsonObject json_obj) +{ + foreach (const QString& key, json_obj.keys()) + { + QJsonValue value = json_obj.value(key); + if (!value.isObject()) + { +// qDebug()<<"[traversJson]key="<',">").replace('"',""").replace('\'',"'");//edit@02-07 +// .replace('¥',"¥").replace('®',"®").replace('°',"°").replace('±',"±").replace('×',"x") +// .replace('*',"*").replace('÷',"÷").replace('²',"²").replace('³',"³").replace('Ω',"Ω") +// .replace('Φ',"Φ").replace('¥',"¥").replace('φ',"φ").replace('©',"©").replace('@',"@") +// .replace('㎡',"㎡").replace('℃',"℃").replace('℉',"℉").replace('\r',' ').replace('\n',' ') ; +// const char *std_str = t_str.toStdString().data(); +// strcpy(Json_get_data.PrintingContent,std_str); + strncpy(Json_get_data.PrintingContent,t_str.toStdString().c_str(),sizeof(Json_get_data.PrintingContent)); + Json_get_data.PrintingContent[sizeof(Json_get_data.PrintingContent) -1] = '\0'; + }else + if(key == "ProductPlanQty"){ + Json_get_data.ProductPlanQty = value.toDouble(); + }else + if(key == "ProductUniqueCode"){ + QString t_str; + t_str = value.toString(); +// const char *std_str = t_str.toStdString().data(); +// strcpy(Json_get_data.ProductUniqueCode,std_str); + strncpy(Json_get_data.ProductUniqueCode,t_str.toStdString().c_str(),sizeof(Json_get_data.ProductUniqueCode)); + Json_get_data.ProductUniqueCode[sizeof(Json_get_data.ProductUniqueCode) -1] = '\0'; + }else + if(key == "ProductionTask"){ + Json_get_data.ProductionTask = value.toDouble(); + }else + if(key == "StartMetre"){ + Json_get_data.StartMetre = value.toDouble(); + }else + if(key == "TasdNeedConfirm"){ + Json_get_data.TasdNeedConfirm = value.toBool(); + }else + if(key == "TaskSwitchingMode"){ + Json_get_data.TaskSwitchingMode = value.toDouble(); + } + } + else + { + traversJson(value.toObject()); + } + } +} + +void PrintNet::postPrintFinished(QNetworkReply *reply) +{ + QNetworkReply::NetworkError error; + error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) + if (error) + { // 非0值表示有错误发生 + switch(error) + { + case QNetworkReply::ConnectionRefusedError: + save_messege = "远程主机拒绝连接"; + break; + + case QNetworkReply::RemoteHostClosedError: + save_messege = "远程主机关闭连接"; + break; + + case QNetworkReply::HostNotFoundError: + save_messege = "远程主机未找到"; + break; + + case QNetworkReply::TimeoutError: + save_messege = "连接到远程主机超时"; + break; + + case QNetworkReply::ContentAccessDenied: + save_messege = "远程主机拒绝访问"; + break; + + case QNetworkReply::ContentNotFoundError: + save_messege = "内容未找到"; + break; + default: + save_messege = "通信失败"; + } + emit json_server_error(); + return; + } + + //未出错时获取响应信息 + QByteArray rsp_data = reply->readAll(); + //以下对获取的JSON数据进行解析 + QJsonDocument json = QJsonDocument::fromJson(rsp_data); + + QJsonObject obj = json.object(); + + traversJson(obj); // 递归列出JSON所有层内容 +// qDebug() << "[postPrintFinished]ResultCode: " << obj["ResultCode"]; +// qDebug() << "[postPrintFinished]ResultMessage: " << obj["ResultMessage"]; +// qDebug() << "[postPrintFinished]ResultData: " << obj["ResultData"]; + + save_messege = obj["ResultMessage"].toString(); + + reply->deleteLater(); +} + +QString PrintNet::getMessege() +{ + return save_messege; +} +// 处理HTTP请求的应答 +void PrintNet::replyFinished(QNetworkReply *reply) +{ + QNetworkReply::NetworkError error; + error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) + if (error) + { // 非0值表示有错误发生 + switch(error) + { + case QNetworkReply::ConnectionRefusedError: + save_messege = "远程主机拒绝连接"; + break; + + case QNetworkReply::RemoteHostClosedError: + save_messege = "远程主机关闭连接"; + break; + + case QNetworkReply::HostNotFoundError: + save_messege = "远程主机未找到"; + break; + + case QNetworkReply::TimeoutError: + save_messege = "连接到远程主机超时"; + break; + + case QNetworkReply::ContentAccessDenied: + save_messege = "远程主机拒绝访问"; + break; + + case QNetworkReply::ContentNotFoundError: + save_messege = "内容未找到"; + break; + default: + save_messege = "通信失败"; + } + + emit json_server_error(); + return; + } + //未出错时获取响应信息 + QByteArray rsp_data = reply->readAll(); + //以下对获取的JSON数据进行解析 + QJsonDocument json = QJsonDocument::fromJson(rsp_data); + QJsonObject obj = json.object(); + traversJson(obj); // 递归列出JSON所有层内容 + +// qDebug() << "[replyFinished] ResultCode: " << obj["ResultCode"]; +// qDebug() << "[replyFinished] ResultMessage: " << obj["ResultMessage"]; +// qDebug() << "[replyFinished] ResultData: " << obj["ResultData"]; + + save_messege = obj["ResultMessage"].toString(); + + reply->deleteLater(); + save_messege = "JSON获取成功!"; + emit showMessege(); + if(m_bShortNet) + { + FromBaiDuGetShortUrl(Json_get_data.QRCodeContent); + } + else + { + emit receiveJSONDatafinish(); + } +} + +// 从服务器获取打印数据 +// url - 提供打印数据的服务器链接 +// equip_code - 喷码机编号 +void PrintNet::PrintNetGetData(QString url, const QString& equip_code) +{ + EquipmentCode = equip_code; + //设计本接口实现时,考虑输入的url为问号(?)之前那部分,不同的喷码机equip_code不同 + //QUrl qrl("http://47.111.170.144:8754/KLAPS/APSServer/ECode/GetProductUniqueCodeTest?EquipmentCode=1"); + QUrl qrl(url); +#ifndef QT_MAJOR_VERSION5 + // 在访问服务器API的链接中添加喷码机编号 + //qrl.addQueryItem("EquipmentCode", QString::number(equip_code)); + qrl.addQueryItem("EquipmentCode", equip_code); +#else + QUrlQuery query; + query.addQueryItem("EquipmentCode", equip_code); + qrl.setQuery(query); +#endif + + // 构造请求 + QNetworkRequest request; + request.setUrl(qrl); + + getManager->get(request); // HTTP GET +} + +// 向服务器上报打印完成状态 +// url - 上报打印完成状态的服务器链接 +void PrintNet::PrintNetPostFinish(QString url) +{ + QUrl qrl(url); + + + // 构造JSON对象数据 + QJsonObject json; + json.insert("ProductUniqueCode", QString(Json_get_data.ProductUniqueCode)); + json.insert("ProductionTask", QString::number(Json_get_data.ProductionTask)); + json.insert("PrintingContent", QString(Json_get_data.PrintingContent)); + //json.insert("EquipmentUniqueCode", QString::number(EquipmentCode) ); + json.insert("EquipmentUniqueCode", EquipmentCode ); + json.insert("StartingMeters", QString::number(Json_get_data.StartMetre)); + json.insert("ProductNumber", QString::number(Json_get_data.ProductPlanQty)); + json.insert("Coordinates", QString("北纬N31°51′15.36 东经E117°12′8.77")); +// qDebug() << json; + + QJsonDocument jsonDoc(json); +// qDebug() << jsonDoc; + + QByteArray jsonData = jsonDoc.toJson(); +// qDebug() << jsonData; + + QNetworkRequest request; + request.setUrl(qrl); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + postManager->post(request, jsonData); // HTTP POST +} + +// 向服务器上报设备运行状态 +// url - 上报设备运行状态的服务器链接 + +void PrintNet::PrintNetPostState(QString url) +{ + QUrl qrl(url); + + // 构造JSON对象数据 + QJsonObject json; + //json.insert("EquipmentUniqueCode", QString::number(EquipmentCode)); + json.insert("EquipmentUniqueCode", EquipmentCode ); + json.insert("CurrentMeter", QString("13.3")); + json.insert("CurrentEcode", QString(Json_get_data.ProductUniqueCode)); + json.insert("CurrentPrintingContent", QString(Json_get_data.PrintingContent)); +// qDebug() << json; + + QJsonDocument jsonDoc(json); +// qDebug() << jsonDoc; + + QByteArray jsonData = jsonDoc.toJson(); +// qDebug() << jsonData; + + QNetworkRequest request; + request.setUrl(qrl); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + postManager->post(request, jsonData); // HTTP POST +} + +// 向百度云获取转换的短网址 +//longUrl要转换的长url + +void PrintNet::FromBaiDuGetShortUrl(QString longUrl) +{ + QUrl qrl(QString("https://dwz.cn/api/v3/short-urls")); + + // 构造JSON对象数据 + QJsonObject json; + json.insert("LongUrl", longUrl); + json.insert("TermOfValidity", QString("long-term")); + //json.insert("CurrentEcode", QString(Json_get_data.ProductUniqueCode)); + //json.insert("CurrentPrintingContent", QString(Json_get_data.PrintingContent)); + //qDebug() << json; + + QJsonArray Arrjson; + Arrjson.append(json); + + QJsonDocument jsonDoc(Arrjson); + //qDebug() << jsonDoc; + + QByteArray jsonData = jsonDoc.toJson(); + //qDebug() << jsonData; + + //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): setSsl before")); + QNetworkRequest request; + request.setUrl(qrl); +#ifndef QT_NO_SSL + //LogInfo::setRunStatusText(tr("defaultConfiguration new before")); + QSslConfiguration config = QSslConfiguration::defaultConfiguration(); + //LogInfo::setRunStatusText(tr("defaultConfiguration 1")); +#ifndef QT_MAJOR_VERSION5 + config.setProtocol(QSsl::TlsV1); +#else + config.setProtocol(QSsl::SslProtocol::TlsV1_0);//edit@02-07 +#endif + //LogInfo::setRunStatusText(tr("defaultConfiguration 2")); + config.setPeerVerifyMode(QSslSocket::VerifyNone); + //LogInfo::setRunStatusText(tr("defaultConfiguration 3")); + request.setSslConfiguration(config); + //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): setSsl after")); +#endif + + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json; charset=UTF-8"); + request.setRawHeader("Dwz-Token" ,"708e8736a533df553a8898699280bcf9"); + + //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): <1>")); + //QNetworkAccessManager *post_manager = new QNetworkAccessManager(this); + //connect(post_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(postGetShortUrlFinished(QNetworkReply *))); + m_postmanager->post(request, jsonData); // HTTP POST + //LogInfo::setRunStatusText(tr("FromBaiDuGetShortUrl(): <2>")); + //connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onNetReplyError(QNetworkReply::NetworkError))); + //connect(reply, SIGNAL(sslErrors(QList&)), this, SLOT(onNetReplySshErrors(QList&))); +#ifndef QT_NO_SSL + connect(post_manager, SIGNAL(sslErrors(QNetworkReply*,QList)), + this, SLOT(sslErrors(QNetworkReply*,QList))); +#endif + +} +#ifndef QT_NO_SSL +void PrintNet::sslErrors(QNetworkReply *reply,const QList &) +{ + reply->ignoreSslErrors(); +} +#endif + +void PrintNet::postGetShortUrlFinished(QNetworkReply *reply) +{ + //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <3>")); + QNetworkReply::NetworkError error; + error = reply->error(); // 应答无错误时为QNetworkReply::NoError(0) + if (error) + { // 非0值表示有错误发生 + switch(error) + { + case QNetworkReply::ConnectionRefusedError: + save_messege = "远程主机拒绝连接"; + break; + + case QNetworkReply::RemoteHostClosedError: + save_messege = "远程主机关闭连接"; + break; + + case QNetworkReply::HostNotFoundError: + save_messege = "远程主机未找到"; + break; + + case QNetworkReply::TimeoutError: + save_messege = "连接到远程主机超时"; + break; + + case QNetworkReply::ContentAccessDenied: + save_messege = "远程主机拒绝访问"; + break; + + case QNetworkReply::ContentNotFoundError: + save_messege = "内容未找到"; + break; + default: + save_messege = "通信失败"; + } + //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <4>")); + emit json_server_error(); + //emit receiveJSONDatafinish(); + return; + } + + //未出错时获取响应信息 + QByteArray rsp_data = reply->readAll(); + //以下对获取的JSON数据进行解析 + QJsonDocument json = QJsonDocument::fromJson(rsp_data); + //qDebug() << json; + + QJsonObject obj = json.object(); + // qDebug() << obj; + + QString strResultCode; + save_messege = strResultCode.number(obj["Code"].toDouble()); + if(save_messege != "0") + { + //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <5>")); + //emit receiveJSONDatafinish(); + save_messege = "获取短网址出错,错误码:"+ save_messege; + return; + } + QJsonArray JsonArr = obj["ShortUrls"].toArray(); + QJsonValue value = JsonArr.at(0); + QJsonObject jsonObj = value.toObject(); + foreach (const QString& key, jsonObj.keys()) + { + QJsonValue value = jsonObj.value(key); + if (!value.isObject()) + { + if(key == "ShortUrl") + { + QString t_str; + t_str = value.toString(); + const char *std_str = t_str.toStdString().data(); + strcpy(Json_get_data.QRCodeContent,std_str); + } + } + + } + save_messege = "获取短网址成功"; + //LogInfo::setRunStatusText(tr("postGetShortUrlFinished(): <6>")); + reply->deleteLater(); + emit receiveJSONDatafinish(); +} + + +void PrintNet::getJson_data(JSON_DATA *json_data) +{ + memcpy(json_data, &Json_get_data, sizeof(JSON_DATA)); +} diff --git a/print_net.h b/print_net.h index 4c5a70d..6fde28d 100644 --- a/print_net.h +++ b/print_net.h @@ -1,55 +1,55 @@ -#ifndef PRINT_NET_H -#define PRINT_NET_H - -#include - -#include -#include -#include -#include -#include -//#include "qjsonexport.h" -//#include "qjsonobject.h" -//#include "qjsonvalue.h" -//#include "qjsondocument.h" -//#include "qjsonarray.h" -#include "SysPara.h" - - -class PrintNet : public QObject -{ -Q_OBJECT - QNetworkAccessManager *manager; -private slots: - void replyFinished(QNetworkReply *); - void postPrintFinished(QNetworkReply *); - void postGetShortUrlFinished(QNetworkReply *); - // void sslErrors(QNetworkReply *reply,const QList &); - -Q_SIGNALS: - void receiveJSONDatafinish(); - void json_server_error(); - void showMessege(); -public: - PrintNet(); - ~PrintNet(); - void PrintNetGetData(QString url, const QString& equip_code); - void PrintNetPostFinish(QString url); - void PrintNetPostState(QString url); - void traversJson(QJsonObject json_obj); - void getJson_data(JSON_DATA *json_data); - QString getMessege(); - void FromBaiDuGetShortUrl(QString longUrl); - - JSON_DATA Json_get_data; - bool m_bShortNet; -private: - QNetworkAccessManager *getManager; - QNetworkAccessManager *postManager; - QNetworkAccessManager *m_postmanager; - QString EquipmentCode; - QString save_messege; - -}; - -#endif // PRINT_NET_H +#ifndef PRINT_NET_H +#define PRINT_NET_H + +#include + +#include +#include +#include +#include +#include +//#include "qjsonexport.h" +//#include "qjsonobject.h" +//#include "qjsonvalue.h" +//#include "qjsondocument.h" +//#include "qjsonarray.h" +#include "SysPara.h" + + +class PrintNet : public QObject +{ +Q_OBJECT + QNetworkAccessManager *manager; +private slots: + void replyFinished(QNetworkReply *); + void postPrintFinished(QNetworkReply *); + void postGetShortUrlFinished(QNetworkReply *); + // void sslErrors(QNetworkReply *reply,const QList &); + +Q_SIGNALS: + void receiveJSONDatafinish(); + void json_server_error(); + void showMessege(); +public: + PrintNet(); + ~PrintNet(); + void PrintNetGetData(QString url, const QString& equip_code); + void PrintNetPostFinish(QString url); + void PrintNetPostState(QString url); + void traversJson(QJsonObject json_obj); + void getJson_data(JSON_DATA *json_data); + QString getMessege(); + void FromBaiDuGetShortUrl(QString longUrl); + + JSON_DATA Json_get_data; + bool m_bShortNet; +private: + QNetworkAccessManager *getManager; + QNetworkAccessManager *postManager; + QNetworkAccessManager *m_postmanager; + QString EquipmentCode; + QString save_messege; + +}; + +#endif // PRINT_NET_H diff --git a/printsetting.ui b/printsetting.ui index a67e22f..4ee1e8a 100644 --- a/printsetting.ui +++ b/printsetting.ui @@ -1,3704 +1,3704 @@ - - - PrintSetting - - - true - - - - 0 - 0 - 800 - 600 - - - - - 0 - 90 - - - - Qt::ClickFocus - - - Form - - - - QLayout::SetDefaultConstraint - - - - - 6 - - - 0 - - - 0 - - - - - - 150 - 70 - - - - - 250 - 16777215 - - - - Qt::LeftToRight - - - 输入密码 - - - - - - - - 100 - 0 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 15 - 16777215 - - - - - false - - - - Qt::NoFocus - - - 墨线时间 - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 120 - 0 - - - - - 16777215 - 16 - - - - 0 - - - Qt::AlignCenter - - - - - - - 0 - - - Qt::AlignCenter - - - - - - - 开机次数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 墨线时间: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 16 - - - - 0 - - - Qt::AlignCenter - - - - - - - 维护时间: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - 0 - 70 - - - - - 250 - 16777215 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - Qt::LeftToRight - - - 应用当前配置 - - - - :/icon/apply.png:/icon/apply.png - - - - - - - - - - 0 - 0 - - - - - 0 - 370 - - - - - 16777215 - 16777215 - - - - QTabBar::tab{height:56px;padding-left: 5px;padding-right: 5px} -QTabBar::tab:selected {background-color: rgb(255, 170, 127)} -QTabBar::tab:!selected {margin-top: 5px;} - - - 0 - - - - 常用设置 - - - - - - QLayout::SetDefaultConstraint - - - - - TextLabel - - - - - - - - 0 - 37 - - - - - 16777215 - 25 - - - - 打印模式: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 25 - - - - 字体宽度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 25 - - - - 首行电压(%): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16777215 - 25 - - - - 字体加粗: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 5 - - - 50 - - - - - - - - 0 - 37 - - - - 0 - - - 100 - - - 75 - - - - - - - - 0 - 37 - - - - QComboBox QAbstractItemView::item -{ min-height: 25px;} - - - - 快速 - - - - - 标准 - - - - - 慢速 - - - - - - - - - 16777215 - 25 - - - - 字高设置(%): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 30 - - - 75 - - - - - - - - 0 - 37 - - - - 16777215 - - - - - - - - 16777215 - 25 - - - - 行末电压(%): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - Qt::ImhDigitsOnly - - - 0 - - - 20 - - - 1 - - - 0 - - - - - - - - 0 - 37 - - - - 修改授权 - - - - - - - - - 0 - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 回收故障处理 - - - false - - - false - - - false - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 超速暂停打印 - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 信息上下颠倒 - - - - :/icon/updown.png:/icon/updown.png - - - - - - - - 0 - 37 - - - - - 16777215 - 16777215 - - - - Qt::RightToLeft - - - 相位故障关机 - - - - - - - - 0 - 37 - - - - - 16777215 - 16777215 - - - - Qt::RightToLeft - - - 相位故障不打印 - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 信息左右颠倒 - - - - :/icon/leftright.png:/icon/leftright.png - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 不打印走米 - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 省点 - - - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 自然数计米 - - - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 高压故障关回收槽 - - - - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 字形优化 - - - - - - - - 0 - 37 - - - - - 16777215 - 16777215 - - - - Qt::RightToLeft - - - 故障停止走米 - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 电眼误触禁止 - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 调整电压 - - - - - - - - - - 高级设置 - - - - - 0 - 0 - 611 - 254 - - - - - - - false - - - - 0 - 37 - - - - 交替扫描隔点(默认为1): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - 冗点比例(默认为0%): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - 点距调整值(默认为0): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - Qt::ImhDigitsOnly - - - 1 - - - 40 - - - 1 - - - 1 - - - - - - - false - - - - 0 - 37 - - - - 行末调整点模式: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 调整电压 - - - - - - - false - - - - 0 - 37 - - - - 行末调整点数(默认为0): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - - 快速 - - - - - 标准 - - - - - 慢速1 - - - - - 慢速2 - - - - - 慢速3 - - - - - 慢速4 - - - - - 慢速5 - - - - - 慢速6 - - - - - 慢速7 - - - - - 慢速8 - - - - - 慢速9 - - - - - - - - false - - - - 0 - 37 - - - - 行末点微调(‰): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - 点距调整电压位置: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - -2000 - - - 2000 - - - 0 - - - - - - - false - - - - 0 - 37 - - - - Qt::ImhDigitsOnly - - - 0 - - - 60 - - - 1 - - - 0 - - - - - - - false - - - - 0 - 37 - - - - Qt::RightToLeft - - - 扫描颠倒 - - - - - - - false - - - - 0 - 37 - - - - - 懒惰模式 - - - - - 贪婪模式 - - - - - 均衡模式 - - - - - - - - false - - - - 0 - 37 - - - - -200 - - - 200 - - - 0 - - - - - - - false - - - - 0 - 37 - - - - 去除冗点模式(默认懒惰): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - 0 - - - 50 - - - - - - - false - - - - 0 - 37 - - - - Qt::ImhDigitsOnly - - - 0 - - - 40 - - - 1 - - - 0 - - - - - - - - - 高级设置 - - - - - 9 - 90 - 760 - 16 - - - - Qt::Horizontal - - - - - - 9 - 430 - 760 - 41 - - - - Qt::Horizontal - - - - - - 9 - 9 - 761 - 82 - - - - - - - - 0 - 37 - - - - 使用推荐设置 - - - - - - - - 0 - 37 - - - - - 快 - - - - - 标准 - - - - - 慢速1 - - - - - 慢速2 - - - - - - - - true - - - 检测回收槽 - - - - - - - - 0 - 37 - - - - 锁定脉冲计数 - - - - - - - true - - - - 0 - 37 - - - - 每条信息只打印一次 - - - - - - - - 0 - 37 - - - - - 电线电缆 - - - - - 制药/食品/电子 - - - - - 建筑管材 - - - - - 其他 - - - - - - - - 新放大板 - - - - - - - - 185 - 25 - - - - 高速模式 - - - - - - - - - 10 - 110 - 761 - 211 - - - - - - - - 0 - 37 - - - - 不检测喷头盖 - - - - - - - - 0 - 37 - - - - 非字宽 - - - true - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 使用齿轮泵 - - - - - - - - 0 - 37 - - - - 复位发送打印数据 - - - - - - - 高压阈值: - - - - - - - false - - - - 0 - 37 - - - - 300 - - - 5000 - - - 10 - - - - - - - - 0 - 37 - - - - 交替扫描隔点(默认为1): - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 扫描颠倒 - - - - - - - - 0 - 37 - - - - - - - - - 0 - 37 - - - - 冗点比例(默认为0%): - - - - - - - - 0 - 37 - - - - - - - - - 0 - 37 - - - - Qt::RightToLeft - - - 打印时绿灯常亮 - - - - - - - Qt::RightToLeft - - - 使用回收泵 - - - - - - - 齿轮泵转速预警值 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 185 - 37 - - - - Qt::LeftToRight - - - 1000 - - - 2000 - - - 10 - - - 1000 - - - - - - - - 0 - 37 - - - - 导出随机码文本 - - - - - - - 电压参数 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - - 默认 - - - - - 5行5点阵 - - - - - 4行7点阵 - - - - - - - - - - 计数器设置 - - - - - 0 - 0 - 771 - 201 - - - - - 0 - 0 - - - - - 0 - 100 - - - - - 16777215 - 350 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} -QTabBar::tab{height:50px;padding-left: 5px;padding-right: 5px} -QTabBar::tab:selected {background-color: rgb(255, 170, 127)} -QTabBar::tab:!selected {margin-top: 5px;} - - - 3 - - - - 计数器1设置 - - - - - 0 - 0 - 582 - 131 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 清零 - - - - - - - false - - - - 0 - 37 - - - - 0 - - - 99999999 - - - 1 - - - - - - - - 0 - 37 - - - - 1 - - - 65535 - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 重复数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 9999999 - - - 1 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 重设值 - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 结束值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} - - - 增量值: - - - - - - - - 0 - 0 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} - - - 当前值: - - - - - - - - 85 - 37 - - - - 99999999 - - - 9999 - - - - - - - - - - Qt::AlignCenter - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 起始值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - Qt::ImhDigitsOnly - - - -49999999 - - - 49999999 - - - 1 - - - - - - - - - - 0 - 0 - - - - 3 - - - - - - - - - - 0 - 0 - - - - - 64 - 37 - - - - 可变长度 - - - - - - - - 20 - 21 - - - - - - - - - - - 小数点位数 - - - - - - - - - 590 - 0 - 161 - 131 - - - - 注意:“其它设置”页下的"分段计米“勾选时,计数器1不可用。 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - 计数器2设置 - - - - - 0 - 0 - 563 - 125 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 起始值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 999999 - - - 1 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 结束值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 80 - 37 - - - - 9999999 - - - 9999 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 重复数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 1 - - - 65535 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - 增量值: - - - - - - - - 0 - 37 - - - - -49999999 - - - 49999999 - - - 1 - - - - - - - - 0 - 37 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} - - - 当前值: - - - - - - - false - - - - 0 - 37 - - - - 0 - - - 999999999 - - - 1 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 重设值 - - - - - - - - 0 - 37 - - - - 清零 - - - - - - - true - - - - 11 - - - - Qt::LeftToRight - - - - - - Qt::AlignCenter - - - - - - - - - 计数器3设置 - - - - - 0 - 0 - 563 - 125 - - - - - - - - 0 - 37 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} - - - 当前值: - - - - - - - Qt::LeftToRight - - - 重复数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::LeftToRight - - - 结束值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - QRadioButton::indicator { -width: 25px; -height: 25px; -} - - - 增量值: - - - - - - - false - - - - 0 - 37 - - - - 0 - - - 999999999 - - - 1 - - - - - - - - 0 - 33 - - - - Qt::LeftToRight - - - - - - 重设值 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - -49999999 - - - 49999999 - - - 1 - - - - - - - - 0 - 37 - - - - 1 - - - 65535 - - - - - - - - 0 - 37 - - - - 999999 - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 起始值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 80 - 37 - - - - 9999999 - - - 9999 - - - - - - - - 0 - 37 - - - - 清零 - - - - - - - true - - - - 11 - - - - Qt::LeftToRight - - - - - - Qt::AlignCenter - - - - - - - - - 跳米设置 - - - - - 10 - 10 - 561 - 82 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 起始值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 95 - 37 - - - - 65535 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 结束值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 95 - 37 - - - - 65535 - - - 999 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 增量值: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 95 - 37 - - - - 0 - - - 65535 - - - 1 - - - - - - - true - - - - 0 - 37 - - - - Qt::LeftToRight - - - 跳米数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 95 - 37 - - - - 0 - - - 999999999 - - - 1 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 跳米打印 - - - - - - - - - - - 0 - 200 - 581 - 168 - - - - - - - - 0 - 37 - - - - QComboBox QAbstractItemView::item -{ min-height: 25px;} - - - QComboBox::AdjustToContents - - - - yyyy-MM-dd - - - - - yyyy/MM/dd - - - - - yyyyMMdd - - - - - yyyy年MM月dd日 - - - - - yyyy-MM-dd hh:mm - - - - - yyyy/MM/dd hh:mm - - - - - yyyyMMddhhmm - - - - - yyyy年MM月dd日hh:mm - - - - - hh:mm - - - - - ddhhmm - - - - - dd MM yy - - - - - dd/MM/yy - - - - - dd/MM/yyyy - - - - - dd-MM-yy - - - - - dd-MM-yyyy - - - - - - - - - 0 - 0 - - - - 复位到起始值 - - - - - - - Qt::LeftToRight - - - 有效期(天): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 9999 - - - 0 - - - - - - - - 0 - 0 - - - - 计数器保存关机值 - - - - - - - true - - - - 100 - 0 - - - - 计数器3 - - - false - - - - - - - true - - - - 100 - 37 - - - - 计数器1 - - - false - - - - - - - 生产日期: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - - 100 - 0 - - - - 计数器2 - - - false - - - - - - - - 0 - 37 - - - - 循环产品计数 - - - - - - - - - 交替打印设置 - - - - - 11 - 56 - 551 - 211 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 重复次数: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 2 - - - 65535 - - - 100 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 起始位置: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 37 - - - - 1 - - - 65535 - - - 1 - - - - - - - 距离尾部(mm): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::LeftToRight - - - 隐藏值米标: - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - Qt::RightToLeft - - - 隐藏打印值 - - - - - - - - 0 - 37 - - - - - 无交替 - - - - - 普通交替 - - - - - 电眼触发交替 - - - - - 首尾交替 - - - - - - - - - 0 - 37 - - - - 1 - - - 65535 - - - 50 - - - - - - - - 0 - 37 - - - - Qt::LeftToRight - - - 交替间隔: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - 0 - 37 - - - - 1 - - - 255 - - - - - - - 打印条件倍数值: - - - - - - - false - - - - 0 - 0 - - - - - 0 - 37 - - - - 9999999 - - - - - - - false - - - - 0 - 0 - - - - - 0 - 37 - - - - 99999 - - - - - - - false - - - - 0 - 0 - - - - - 0 - 37 - - - - 1 - - - - - - - - - 576 - 170 - 91 - 91 - - - - 使用隐藏功能时必须使用计数器1 - - - true - - - - - - 其它设置 - - - - - 322 - 10 - 16 - 16 - - - - - - - - - - 170 - 10 - 16 - 16 - - - - - - - - - - 240 - 0 - 511 - 261 - - - - - - 450 - 180 - 51 - 51 - - - - 下移 - - - - - - 10 - 10 - 121 - 22 - - - - 分段计米 - - - - - - 10 - 80 - 431 - 164 - - - - true - - - 0 - - - 4 - - - false - - - 80 - - - true - - - 18 - - - true - - - 30 - - - - - - - - - - 10 - 40 - 360 - 33 - - - - - - - 添 加 - - - - - - - 插 入 - - - - - - - 删 除 - - - - - - - 全部删除 - - - - - - - - - 450 - 90 - 51 - 51 - - - - 上移 - - - - - - - 10 - 10 - 221 - 251 - - - - - - 0 - 0 - 211 - 95 - - - - - - - 更换信息文件时执行的动作: - - - - - - - Qt::LeftToRight - - - 产品计数器自动清0 - - - - - - - Qt::LeftToRight - - - 总产品计数器自动清0 - - - - - - - - - 0 - 100 - 212 - 71 - - - - - - - 外接显示屏: - - - - - - - - 无 - - - - - 小屏 - - - - - 大屏 - - - - - - - - - 总产品计数值 - - - - - 计数器1 - - - - - 计数器2 - - - - - - - - 显示屏显示: - - - - - - - - - 0 - 180 - 212 - 51 - - - - 米标显示 - - - - - - - 打印电压缩放 - - - - - 20 - 30 - 165 - 39 - - - - - - - - 0 - 37 - - - - 整体缩放(%) : - - - - - - - - 0 - 37 - - - - 40 - - - 150 - - - 100 - - - - - - - - - 650 - 150 - 121 - 51 - - - - - - - - - - 520 - 180 - 121 - 51 - - - - - - - - - - - - - - - - + + + PrintSetting + + + true + + + + 0 + 0 + 800 + 600 + + + + + 0 + 90 + + + + Qt::ClickFocus + + + Form + + + + QLayout::SetDefaultConstraint + + + + + 6 + + + 0 + + + 0 + + + + + + 150 + 70 + + + + + 250 + 16777215 + + + + Qt::LeftToRight + + + 输入密码 + + + + + + + + 100 + 0 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 15 + 16777215 + + + + + false + + + + Qt::NoFocus + + + 墨线时间 + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 120 + 0 + + + + + 16777215 + 16 + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + 开机次数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 墨线时间: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 16 + + + + 0 + + + Qt::AlignCenter + + + + + + + 维护时间: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 0 + 70 + + + + + 250 + 16777215 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + Qt::LeftToRight + + + 应用当前配置 + + + + :/icon/apply.png:/icon/apply.png + + + + + + + + + + 0 + 0 + + + + + 0 + 370 + + + + + 16777215 + 16777215 + + + + QTabBar::tab{height:56px;padding-left: 5px;padding-right: 5px} +QTabBar::tab:selected {background-color: rgb(255, 170, 127)} +QTabBar::tab:!selected {margin-top: 5px;} + + + 0 + + + + 常用设置 + + + + + + QLayout::SetDefaultConstraint + + + + + TextLabel + + + + + + + + 0 + 37 + + + + + 16777215 + 25 + + + + 打印模式: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 25 + + + + 字体宽度: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 25 + + + + 首行电压(%): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16777215 + 25 + + + + 字体加粗: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 5 + + + 50 + + + + + + + + 0 + 37 + + + + 0 + + + 100 + + + 75 + + + + + + + + 0 + 37 + + + + QComboBox QAbstractItemView::item +{ min-height: 25px;} + + + + 快速 + + + + + 标准 + + + + + 慢速 + + + + + + + + + 16777215 + 25 + + + + 字高设置(%): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 30 + + + 75 + + + + + + + + 0 + 37 + + + + 16777215 + + + + + + + + 16777215 + 25 + + + + 行末电压(%): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + Qt::ImhDigitsOnly + + + 0 + + + 20 + + + 1 + + + 0 + + + + + + + + 0 + 37 + + + + 修改授权 + + + + + + + + + 0 + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 回收故障处理 + + + false + + + false + + + false + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 超速暂停打印 + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 信息上下颠倒 + + + + :/icon/updown.png:/icon/updown.png + + + + + + + + 0 + 37 + + + + + 16777215 + 16777215 + + + + Qt::RightToLeft + + + 相位故障关机 + + + + + + + + 0 + 37 + + + + + 16777215 + 16777215 + + + + Qt::RightToLeft + + + 相位故障不打印 + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 信息左右颠倒 + + + + :/icon/leftright.png:/icon/leftright.png + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 不打印走米 + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 省点 + + + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 自然数计米 + + + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 高压故障关回收槽 + + + + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 字形优化 + + + + + + + + 0 + 37 + + + + + 16777215 + 16777215 + + + + Qt::RightToLeft + + + 故障停止走米 + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 电眼误触禁止 + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 调整电压 + + + + + + + + + + 高级设置 + + + + + 0 + 0 + 611 + 254 + + + + + + + false + + + + 0 + 37 + + + + 交替扫描隔点(默认为1): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + 冗点比例(默认为0%): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + 点距调整值(默认为0): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + Qt::ImhDigitsOnly + + + 1 + + + 40 + + + 1 + + + 1 + + + + + + + false + + + + 0 + 37 + + + + 行末调整点模式: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 调整电压 + + + + + + + false + + + + 0 + 37 + + + + 行末调整点数(默认为0): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + + 快速 + + + + + 标准 + + + + + 慢速1 + + + + + 慢速2 + + + + + 慢速3 + + + + + 慢速4 + + + + + 慢速5 + + + + + 慢速6 + + + + + 慢速7 + + + + + 慢速8 + + + + + 慢速9 + + + + + + + + false + + + + 0 + 37 + + + + 行末点微调(‰): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + 点距调整电压位置: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + -2000 + + + 2000 + + + 0 + + + + + + + false + + + + 0 + 37 + + + + Qt::ImhDigitsOnly + + + 0 + + + 60 + + + 1 + + + 0 + + + + + + + false + + + + 0 + 37 + + + + Qt::RightToLeft + + + 扫描颠倒 + + + + + + + false + + + + 0 + 37 + + + + + 懒惰模式 + + + + + 贪婪模式 + + + + + 均衡模式 + + + + + + + + false + + + + 0 + 37 + + + + -200 + + + 200 + + + 0 + + + + + + + false + + + + 0 + 37 + + + + 去除冗点模式(默认懒惰): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + 0 + + + 50 + + + + + + + false + + + + 0 + 37 + + + + Qt::ImhDigitsOnly + + + 0 + + + 40 + + + 1 + + + 0 + + + + + + + + + 高级设置 + + + + + 9 + 90 + 760 + 16 + + + + Qt::Horizontal + + + + + + 9 + 430 + 760 + 41 + + + + Qt::Horizontal + + + + + + 9 + 9 + 761 + 82 + + + + + + + + 0 + 37 + + + + 使用推荐设置 + + + + + + + + 0 + 37 + + + + + 快 + + + + + 标准 + + + + + 慢速1 + + + + + 慢速2 + + + + + + + + true + + + 检测回收槽 + + + + + + + + 0 + 37 + + + + 锁定脉冲计数 + + + + + + + true + + + + 0 + 37 + + + + 每条信息只打印一次 + + + + + + + + 0 + 37 + + + + + 电线电缆 + + + + + 制药/食品/电子 + + + + + 建筑管材 + + + + + 其他 + + + + + + + + 新放大板 + + + + + + + + 185 + 25 + + + + 高速模式 + + + + + + + + + 10 + 110 + 761 + 211 + + + + + + + + 0 + 37 + + + + 不检测喷头盖 + + + + + + + + 0 + 37 + + + + 非字宽 + + + true + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 使用齿轮泵 + + + + + + + + 0 + 37 + + + + 复位发送打印数据 + + + + + + + 高压阈值: + + + + + + + false + + + + 0 + 37 + + + + 300 + + + 5000 + + + 10 + + + + + + + + 0 + 37 + + + + 交替扫描隔点(默认为1): + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 扫描颠倒 + + + + + + + + 0 + 37 + + + + + + + + + 0 + 37 + + + + 冗点比例(默认为0%): + + + + + + + + 0 + 37 + + + + + + + + + 0 + 37 + + + + Qt::RightToLeft + + + 打印时绿灯常亮 + + + + + + + Qt::RightToLeft + + + 使用回收泵 + + + + + + + 齿轮泵转速预警值 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 185 + 37 + + + + Qt::LeftToRight + + + 1000 + + + 2000 + + + 10 + + + 1000 + + + + + + + + 0 + 37 + + + + 导出随机码文本 + + + + + + + 电压参数 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + + 默认 + + + + + 5行5点阵 + + + + + 4行7点阵 + + + + + + + + + + 计数器设置 + + + + + 0 + 0 + 771 + 201 + + + + + 0 + 0 + + + + + 0 + 100 + + + + + 16777215 + 350 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} +QTabBar::tab{height:50px;padding-left: 5px;padding-right: 5px} +QTabBar::tab:selected {background-color: rgb(255, 170, 127)} +QTabBar::tab:!selected {margin-top: 5px;} + + + 3 + + + + 计数器1设置 + + + + + 0 + 0 + 582 + 131 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 清零 + + + + + + + false + + + + 0 + 37 + + + + 0 + + + 99999999 + + + 1 + + + + + + + + 0 + 37 + + + + 1 + + + 65535 + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 重复数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 9999999 + + + 1 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 重设值 + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 结束值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} + + + 增量值: + + + + + + + + 0 + 0 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} + + + 当前值: + + + + + + + + 85 + 37 + + + + 99999999 + + + 9999 + + + + + + + + + + Qt::AlignCenter + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 起始值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + Qt::ImhDigitsOnly + + + -49999999 + + + 49999999 + + + 1 + + + + + + + + + + 0 + 0 + + + + 3 + + + + + + + + + + 0 + 0 + + + + + 64 + 37 + + + + 可变长度 + + + + + + + + 20 + 21 + + + + + + + + + + + 小数点位数 + + + + + + + + + 590 + 0 + 161 + 131 + + + + 注意:“其它设置”页下的"分段计米“勾选时,计数器1不可用。 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + 计数器2设置 + + + + + 0 + 0 + 563 + 125 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 起始值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 999999 + + + 1 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 结束值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 80 + 37 + + + + 9999999 + + + 9999 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 重复数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 1 + + + 65535 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + 增量值: + + + + + + + + 0 + 37 + + + + -49999999 + + + 49999999 + + + 1 + + + + + + + + 0 + 37 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} + + + 当前值: + + + + + + + false + + + + 0 + 37 + + + + 0 + + + 999999999 + + + 1 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 重设值 + + + + + + + + 0 + 37 + + + + 清零 + + + + + + + true + + + + 11 + + + + Qt::LeftToRight + + + + + + Qt::AlignCenter + + + + + + + + + 计数器3设置 + + + + + 0 + 0 + 563 + 125 + + + + + + + + 0 + 37 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} + + + 当前值: + + + + + + + Qt::LeftToRight + + + 重复数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::LeftToRight + + + 结束值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + QRadioButton::indicator { +width: 25px; +height: 25px; +} + + + 增量值: + + + + + + + false + + + + 0 + 37 + + + + 0 + + + 999999999 + + + 1 + + + + + + + + 0 + 33 + + + + Qt::LeftToRight + + + + + + 重设值 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + -49999999 + + + 49999999 + + + 1 + + + + + + + + 0 + 37 + + + + 1 + + + 65535 + + + + + + + + 0 + 37 + + + + 999999 + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 起始值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 80 + 37 + + + + 9999999 + + + 9999 + + + + + + + + 0 + 37 + + + + 清零 + + + + + + + true + + + + 11 + + + + Qt::LeftToRight + + + + + + Qt::AlignCenter + + + + + + + + + 跳米设置 + + + + + 10 + 10 + 561 + 82 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 起始值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 95 + 37 + + + + 65535 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 结束值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 95 + 37 + + + + 65535 + + + 999 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 增量值: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 95 + 37 + + + + 0 + + + 65535 + + + 1 + + + + + + + true + + + + 0 + 37 + + + + Qt::LeftToRight + + + 跳米数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 95 + 37 + + + + 0 + + + 999999999 + + + 1 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 跳米打印 + + + + + + + + + + + 0 + 200 + 581 + 168 + + + + + + + + 0 + 37 + + + + QComboBox QAbstractItemView::item +{ min-height: 25px;} + + + QComboBox::AdjustToContents + + + + yyyy-MM-dd + + + + + yyyy/MM/dd + + + + + yyyyMMdd + + + + + yyyy年MM月dd日 + + + + + yyyy-MM-dd hh:mm + + + + + yyyy/MM/dd hh:mm + + + + + yyyyMMddhhmm + + + + + yyyy年MM月dd日hh:mm + + + + + hh:mm + + + + + ddhhmm + + + + + dd MM yy + + + + + dd/MM/yy + + + + + dd/MM/yyyy + + + + + dd-MM-yy + + + + + dd-MM-yyyy + + + + + + + + + 0 + 0 + + + + 复位到起始值 + + + + + + + Qt::LeftToRight + + + 有效期(天): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 9999 + + + 0 + + + + + + + + 0 + 0 + + + + 计数器保存关机值 + + + + + + + true + + + + 100 + 0 + + + + 计数器3 + + + false + + + + + + + true + + + + 100 + 37 + + + + 计数器1 + + + false + + + + + + + 生产日期: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + 100 + 0 + + + + 计数器2 + + + false + + + + + + + + 0 + 37 + + + + 循环产品计数 + + + + + + + + + 交替打印设置 + + + + + 11 + 56 + 551 + 211 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 重复次数: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 2 + + + 65535 + + + 100 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 起始位置: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 37 + + + + 1 + + + 65535 + + + 1 + + + + + + + 距离尾部(mm): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::LeftToRight + + + 隐藏值米标: + + + Qt::AlignCenter + + + + + + + true + + + + 0 + 0 + + + + Qt::RightToLeft + + + 隐藏打印值 + + + + + + + + 0 + 37 + + + + + 无交替 + + + + + 普通交替 + + + + + 电眼触发交替 + + + + + 首尾交替 + + + + + + + + + 0 + 37 + + + + 1 + + + 65535 + + + 50 + + + + + + + + 0 + 37 + + + + Qt::LeftToRight + + + 交替间隔: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + + 0 + 37 + + + + 1 + + + 255 + + + + + + + 打印条件倍数值: + + + + + + + false + + + + 0 + 0 + + + + + 0 + 37 + + + + 9999999 + + + + + + + false + + + + 0 + 0 + + + + + 0 + 37 + + + + 99999 + + + + + + + false + + + + 0 + 0 + + + + + 0 + 37 + + + + 1 + + + + + + + + + 576 + 170 + 91 + 91 + + + + 使用隐藏功能时必须使用计数器1 + + + true + + + + + + 其它设置 + + + + + 322 + 10 + 16 + 16 + + + + + + + + + + 170 + 10 + 16 + 16 + + + + + + + + + + 240 + 0 + 511 + 261 + + + + + + 450 + 180 + 51 + 51 + + + + 下移 + + + + + + 10 + 10 + 121 + 22 + + + + 分段计米 + + + + + + 10 + 80 + 431 + 164 + + + + true + + + 0 + + + 4 + + + false + + + 80 + + + true + + + 18 + + + true + + + 30 + + + + + + + + + + 10 + 40 + 360 + 33 + + + + + + + 添 加 + + + + + + + 插 入 + + + + + + + 删 除 + + + + + + + 全部删除 + + + + + + + + + 450 + 90 + 51 + 51 + + + + 上移 + + + + + + + 10 + 10 + 221 + 251 + + + + + + 0 + 0 + 211 + 95 + + + + + + + 更换信息文件时执行的动作: + + + + + + + Qt::LeftToRight + + + 产品计数器自动清0 + + + + + + + Qt::LeftToRight + + + 总产品计数器自动清0 + + + + + + + + + 0 + 100 + 212 + 71 + + + + + + + 外接显示屏: + + + + + + + + 无 + + + + + 小屏 + + + + + 大屏 + + + + + + + + + 总产品计数值 + + + + + 计数器1 + + + + + 计数器2 + + + + + + + + 显示屏显示: + + + + + + + + + 0 + 180 + 212 + 51 + + + + 米标显示 + + + + + + + 打印电压缩放 + + + + + 20 + 30 + 165 + 39 + + + + + + + + 0 + 37 + + + + 整体缩放(%) : + + + + + + + + 0 + 37 + + + + 40 + + + 150 + + + 100 + + + + + + + + + 650 + 150 + 121 + 51 + + + + + + + + + + 520 + 180 + 121 + 51 + + + + + + + + + + + + + + + + diff --git a/protocol/message.cpp b/protocol/message.cpp index 47e345a..5da3720 100644 --- a/protocol/message.cpp +++ b/protocol/message.cpp @@ -1,186 +1,186 @@ -#include "message.h" - -Message::Message(QObject *parent) -{ - FRAME_START = 0x2B; // '+' - FRAME_END = 0x3C; // '<' - HEADER_SIZE = 4; // 1(起始) + 2(长度) + 1(预留) - TRAILER_SIZE = 1; // 1(结束) - MIN_FRAME_SIZE = HEADER_SIZE + TRAILER_SIZE; // 5字节 -} - -Message::~Message() -{ - -} - -QByteArray Message::pack(const QByteArray &data) -{ - // 检查数据长度 - if (data.size() > 65535) { - //Message::pack - 数据长度超过65535字节限制 - return QByteArray(); - } - - // 创建协议头 - MsgHead head; - head.start = FRAME_START; - head.reserved = 0; - // 只保存实际内容的长度 - head.length = static_cast(data.size()); - // head.toNetworkOrder(); // 转换为大端序 - - // 创建协议尾 - MsgTail tail; - tail.end = FRAME_END; - - // 构建完整帧 - QByteArray frame; - frame.reserve(HEADER_SIZE + data.size() + TRAILER_SIZE); - - // 添加头部 - frame.append(reinterpret_cast(&head), HEADER_SIZE); - - // 添加数据 - if (!data.isEmpty()) { - frame.append(data); - } - - // 添加尾部 - frame.append(reinterpret_cast(&tail), TRAILER_SIZE); - - return frame; -} - -bool Message::unpack(const QByteArray &frame, QByteArray &data) -{ - if (!validate(frame)) { - return false; - } - - // 检查数据长度 - MsgHead head; - memcpy(&head, frame.constData(), HEADER_SIZE); - - quint16 dataLength = head.length; - int expectedSize = HEADER_SIZE + dataLength + TRAILER_SIZE; - - if (frame.size() < expectedSize) { - // 帧不完整 - return false; - } - - // 提取数据 - data = frame.mid(HEADER_SIZE, dataLength); - - return true; -} - -bool Message::validate(const QByteArray &frame) -{ - // 检查最小长度 - if (frame.size() < MIN_FRAME_SIZE) { - return false; - } - - // 读取头部 - MsgHead head; - memcpy(&head, frame.constData(), HEADER_SIZE); - - // 验证起始标识 - if (!head.isValid()) { - return false; - } - - quint16 dataLength = head.length; - - // 读取尾部 - MsgTail tail; - memcpy(&tail, frame.constData() + HEADER_SIZE + dataLength, TRAILER_SIZE); - - // 验证结束标识 - if (!tail.isValid()) { - return false; - } - - return true; -} - -QByteArray Message::extractFrame(const QByteArray &buffer, int &consumedBytes) -{ - consumedBytes = 0; - - // 查找起始标识 - int startPos = buffer.indexOf(FRAME_START); - if (startPos < 0) { - return QByteArray(); // 没有找到起始标识 - } - - // 检查是否有完整的头部 - if (startPos + HEADER_SIZE > buffer.size()) { - return QByteArray(); // 头部不完整 - } - - // 读取数据长度 - quint16 dataLength = readLength(buffer.mid(startPos, HEADER_SIZE)); - - // 计算完整帧大小 - int frameSize = HEADER_SIZE + dataLength + TRAILER_SIZE; - - // 检查是否有完整的帧 - if (startPos + frameSize > buffer.size()) { - return QByteArray(); // 帧不完整 - } - - // 提取并验证完整帧 - QByteArray frame = buffer.mid(startPos, frameSize); - - if (!checkFrameBoundary(frame)) { - // 起始标识正确,但结束标识不正确,可能是错误的数据 - // qWarning() << "Message::extractFrame - 帧边界检查失败"; - consumedBytes = startPos + 1; // 跳过这个错误的起始标识 - return QByteArray(); - } - - consumedBytes = startPos + frameSize; - return frame; -} - -// 读取数据长度 -quint16 Message::readLength(const QByteArray &frame) -{ - if (frame.size() < HEADER_SIZE) { - return 0; - } - - MsgHead head; - memcpy(&head, frame.constData(), HEADER_SIZE); - return head.length; -} - -// 检查帧边界 -bool Message::checkFrameBoundary(const QByteArray &frame) -{ - if (frame.size() < MIN_FRAME_SIZE) { - return false; - } - - // 检查起始标识 - MsgHead head; - memcpy(&head, frame.constData(), HEADER_SIZE); - if (!head.isValid()) { - return false; - } - - // 检查结束标识 - int dataLength = head.length; - - if (frame.size() < HEADER_SIZE + dataLength + TRAILER_SIZE) { - return false; - } - - MsgTail tail; - memcpy(&tail, frame.constData() + HEADER_SIZE + dataLength, TRAILER_SIZE); - return tail.isValid(); -} - +#include "message.h" + +Message::Message(QObject *parent) +{ + FRAME_START = 0x2B; // '+' + FRAME_END = 0x3C; // '<' + HEADER_SIZE = 4; // 1(起始) + 2(长度) + 1(预留) + TRAILER_SIZE = 1; // 1(结束) + MIN_FRAME_SIZE = HEADER_SIZE + TRAILER_SIZE; // 5字节 +} + +Message::~Message() +{ + +} + +QByteArray Message::pack(const QByteArray &data) +{ + // 检查数据长度 + if (data.size() > 65535) { + //Message::pack - 数据长度超过65535字节限制 + return QByteArray(); + } + + // 创建协议头 + MsgHead head; + head.start = FRAME_START; + head.reserved = 0; + // 只保存实际内容的长度 + head.length = static_cast(data.size()); + // head.toNetworkOrder(); // 转换为大端序 + + // 创建协议尾 + MsgTail tail; + tail.end = FRAME_END; + + // 构建完整帧 + QByteArray frame; + frame.reserve(HEADER_SIZE + data.size() + TRAILER_SIZE); + + // 添加头部 + frame.append(reinterpret_cast(&head), HEADER_SIZE); + + // 添加数据 + if (!data.isEmpty()) { + frame.append(data); + } + + // 添加尾部 + frame.append(reinterpret_cast(&tail), TRAILER_SIZE); + + return frame; +} + +bool Message::unpack(const QByteArray &frame, QByteArray &data) +{ + if (!validate(frame)) { + return false; + } + + // 检查数据长度 + MsgHead head; + memcpy(&head, frame.constData(), HEADER_SIZE); + + quint16 dataLength = head.length; + int expectedSize = HEADER_SIZE + dataLength + TRAILER_SIZE; + + if (frame.size() < expectedSize) { + // 帧不完整 + return false; + } + + // 提取数据 + data = frame.mid(HEADER_SIZE, dataLength); + + return true; +} + +bool Message::validate(const QByteArray &frame) +{ + // 检查最小长度 + if (frame.size() < MIN_FRAME_SIZE) { + return false; + } + + // 读取头部 + MsgHead head; + memcpy(&head, frame.constData(), HEADER_SIZE); + + // 验证起始标识 + if (!head.isValid()) { + return false; + } + + quint16 dataLength = head.length; + + // 读取尾部 + MsgTail tail; + memcpy(&tail, frame.constData() + HEADER_SIZE + dataLength, TRAILER_SIZE); + + // 验证结束标识 + if (!tail.isValid()) { + return false; + } + + return true; +} + +QByteArray Message::extractFrame(const QByteArray &buffer, int &consumedBytes) +{ + consumedBytes = 0; + + // 查找起始标识 + int startPos = buffer.indexOf(FRAME_START); + if (startPos < 0) { + return QByteArray(); // 没有找到起始标识 + } + + // 检查是否有完整的头部 + if (startPos + HEADER_SIZE > buffer.size()) { + return QByteArray(); // 头部不完整 + } + + // 读取数据长度 + quint16 dataLength = readLength(buffer.mid(startPos, HEADER_SIZE)); + + // 计算完整帧大小 + int frameSize = HEADER_SIZE + dataLength + TRAILER_SIZE; + + // 检查是否有完整的帧 + if (startPos + frameSize > buffer.size()) { + return QByteArray(); // 帧不完整 + } + + // 提取并验证完整帧 + QByteArray frame = buffer.mid(startPos, frameSize); + + if (!checkFrameBoundary(frame)) { + // 起始标识正确,但结束标识不正确,可能是错误的数据 + // qWarning() << "Message::extractFrame - 帧边界检查失败"; + consumedBytes = startPos + 1; // 跳过这个错误的起始标识 + return QByteArray(); + } + + consumedBytes = startPos + frameSize; + return frame; +} + +// 读取数据长度 +quint16 Message::readLength(const QByteArray &frame) +{ + if (frame.size() < HEADER_SIZE) { + return 0; + } + + MsgHead head; + memcpy(&head, frame.constData(), HEADER_SIZE); + return head.length; +} + +// 检查帧边界 +bool Message::checkFrameBoundary(const QByteArray &frame) +{ + if (frame.size() < MIN_FRAME_SIZE) { + return false; + } + + // 检查起始标识 + MsgHead head; + memcpy(&head, frame.constData(), HEADER_SIZE); + if (!head.isValid()) { + return false; + } + + // 检查结束标识 + int dataLength = head.length; + + if (frame.size() < HEADER_SIZE + dataLength + TRAILER_SIZE) { + return false; + } + + MsgTail tail; + memcpy(&tail, frame.constData() + HEADER_SIZE + dataLength, TRAILER_SIZE); + return tail.isValid(); +} + diff --git a/protocol/message.h b/protocol/message.h index 97f0358..2c319cd 100644 --- a/protocol/message.h +++ b/protocol/message.h @@ -1,78 +1,78 @@ -#ifndef MESSAGE_H -#define MESSAGE_H - -// 协议类:用于接收外部 网络通信 发送的打印内容 - -#include -#include - -/* -| 起始标识(1B) | 预留字段(1B) | 内容长度(2B) | 数据内容(NB) | 结束标识(1B) | -| 0x2B | 自定义 | N() | 实际数据 | 0x3C | -2B 00 02 00 08 08 3C -*/ -// 内存对齐 -#pragma pack(push, 1) -struct MsgHead { - char start; - char reserved; - unsigned short length; - - MsgHead() { - start = 0x2B; - reserved = 0; - length = 0; - } - - bool isValid() { - return start == 0x2B; - } -}; - -struct MsgTail { - quint8 end; - - MsgTail() { - end = 0x3C; - } - - bool isValid() { - return end == 0x3C; - } -}; - -#pragma pack(pop) - -class Message : public QObject -{ - Q_OBJECT - -public: - Message(QObject *parent = 0); - ~Message(); - - // 打包:数据 + 预留字段 -> 完整帧 - QByteArray pack(const QByteArray &data); - - // 解包:完整帧 -> 数据和预留字段 - bool unpack(const QByteArray &frame, QByteArray &data); - - // 验证帧格式 - bool validate(const QByteArray &frame); - - QByteArray extractFrame(const QByteArray &buffer, int &consumedBytes); - -private: - // 协议常量 - char FRAME_START ; // '+' 0x2b - char FRAME_END; // '<' 0x3c - int HEADER_SIZE ; // 1(起始) + 2(长度) + 1(预留) - int TRAILER_SIZE; // 1(结束) - int MIN_FRAME_SIZE; // 5字节 - - quint16 readLength(const QByteArray &frame); - - bool checkFrameBoundary(const QByteArray &frame); -}; - -#endif // MESSAGE_H +#ifndef MESSAGE_H +#define MESSAGE_H + +// 协议类:用于接收外部 网络通信 发送的打印内容 + +#include +#include + +/* +| 起始标识(1B) | 预留字段(1B) | 内容长度(2B) | 数据内容(NB) | 结束标识(1B) | +| 0x2B | 自定义 | N() | 实际数据 | 0x3C | +2B 00 02 00 08 08 3C +*/ +// 内存对齐 +#pragma pack(push, 1) +struct MsgHead { + char start; + char reserved; + unsigned short length; + + MsgHead() { + start = 0x2B; + reserved = 0; + length = 0; + } + + bool isValid() { + return start == 0x2B; + } +}; + +struct MsgTail { + quint8 end; + + MsgTail() { + end = 0x3C; + } + + bool isValid() { + return end == 0x3C; + } +}; + +#pragma pack(pop) + +class Message : public QObject +{ + Q_OBJECT + +public: + Message(QObject *parent = 0); + ~Message(); + + // 打包:数据 + 预留字段 -> 完整帧 + QByteArray pack(const QByteArray &data); + + // 解包:完整帧 -> 数据和预留字段 + bool unpack(const QByteArray &frame, QByteArray &data); + + // 验证帧格式 + bool validate(const QByteArray &frame); + + QByteArray extractFrame(const QByteArray &buffer, int &consumedBytes); + +private: + // 协议常量 + char FRAME_START ; // '+' 0x2b + char FRAME_END; // '<' 0x3c + int HEADER_SIZE ; // 1(起始) + 2(长度) + 1(预留) + int TRAILER_SIZE; // 1(结束) + int MIN_FRAME_SIZE; // 5字节 + + quint16 readLength(const QByteArray &frame); + + bool checkFrameBoundary(const QByteArray &frame); +}; + +#endif // MESSAGE_H diff --git a/protocol/serverthread.cpp b/protocol/serverthread.cpp index 31f47e7..9c0e7f3 100644 --- a/protocol/serverthread.cpp +++ b/protocol/serverthread.cpp @@ -1,156 +1,156 @@ -#include "serverthread.h" -#include -#include -#include - -ServerThread::ServerThread(QObject *parent) - : QThread(parent) - , m_running(false) - , m_processedCount(0) - , m_totalProcessedBytes(0) -{ - qDebug() << "ServerThread 创建 - 线程ID:" << QThread::currentThreadId(); -} - -ServerThread::~ServerThread() -{ - stopThread(); - qDebug() << "ServerThread 销毁 - 处理任务数:" << m_processedCount; -} - -void ServerThread::stopThread() -{ - qDebug() << "ServerThread 停止中..."; - - m_running = false; - m_condition.wakeAll(); - - if (isRunning()) { - wait(5000); // 等待最多5秒 - if (isRunning()) { - qWarning() << "ServerThread 强制终止"; - terminate(); - wait(); - } - } -} - -void ServerThread::addTask(const WorkTask &task) -{ - QMutexLocker locker(&m_mutex); - m_taskQueue.enqueue(task); - m_condition.wakeOne(); -} - -int ServerThread::pendingTasks() const -{ - QMutexLocker locker(&m_mutex); - return m_taskQueue.size(); -} - -quint64 ServerThread::processedCount() const -{ - return m_processedCount; -} - -quint64 ServerThread::totalProcessedBytes() const -{ - return m_totalProcessedBytes; -} - -bool ServerThread::isProcessing() const -{ - QMutexLocker locker(&m_mutex); - return !m_taskQueue.isEmpty(); -} - -void ServerThread::run() -{ - m_running = true; - - while (m_running) { - WorkTask task; - bool hasTask = false; - - { - QMutexLocker locker(&m_mutex); - - if (m_taskQueue.isEmpty()) { - // 等待新任务,超时1秒后继续循环检查m_running - m_condition.wait(&m_mutex, 1000); - continue; - } - - task = m_taskQueue.dequeue(); - hasTask = true; - } - - if (!hasTask || !m_running) { - continue; - } - - // 处理任务 - try { - QByteArray result; - - switch (task.taskType) { - case 0: // 处理接收到的数据 - result = processReceivedData(task.data); - break; - - case 1: // 打包待发送数据 - result = packSendData(task.data); - break; - - default: - emit sig_taskError(task.socketId, QString("未知任务类型: %1").arg(task.taskType)); - continue; - } - - // 更新统计 - m_processedCount++; - m_totalProcessedBytes += task.data.size(); - - // 发送处理结果 - if (!result.isEmpty()) { - emit sig_taskProcessed(task.socketId, result); - } - - } catch (const std::exception &e) { - emit sig_taskError(task.socketId, QString("处理异常: %1").arg(e.what())); - } catch (...) { - emit sig_taskError(task.socketId, "未知处理异常"); - } - - // 短暂休眠,避免CPU占用过高 - msleep(1); - } - -} - -QByteArray ServerThread::processReceivedData(const QByteArray &data) -{ - QString text = QString::fromUtf8(data); - - // 普通数据处理示例 - QByteArray result; - - // 添加时间戳前缀 - QString timestamp = QDateTime::currentDateTime().toString("[hh:mm:ss] "); - result = timestamp.toUtf8(); - - // 回显处理后的数据 - result += text.toUtf8(); - - // 可以在此添加更多业务逻辑 - // 例如:数据验证、转换、存储等 - - return result; -} - -QByteArray ServerThread::packSendData(const QByteArray &data) -{ - // 添加到待发送队列或进行预处理 - // 这里简单返回原数据,实际打包在TcpServer中完成 - return data; -} +#include "serverthread.h" +#include +#include +#include + +ServerThread::ServerThread(QObject *parent) + : QThread(parent) + , m_running(false) + , m_processedCount(0) + , m_totalProcessedBytes(0) +{ + qDebug() << "ServerThread 创建 - 线程ID:" << QThread::currentThreadId(); +} + +ServerThread::~ServerThread() +{ + stopThread(); + qDebug() << "ServerThread 销毁 - 处理任务数:" << m_processedCount; +} + +void ServerThread::stopThread() +{ + qDebug() << "ServerThread 停止中..."; + + m_running = false; + m_condition.wakeAll(); + + if (isRunning()) { + wait(5000); // 等待最多5秒 + if (isRunning()) { + qWarning() << "ServerThread 强制终止"; + terminate(); + wait(); + } + } +} + +void ServerThread::addTask(const WorkTask &task) +{ + QMutexLocker locker(&m_mutex); + m_taskQueue.enqueue(task); + m_condition.wakeOne(); +} + +int ServerThread::pendingTasks() const +{ + QMutexLocker locker(&m_mutex); + return m_taskQueue.size(); +} + +quint64 ServerThread::processedCount() const +{ + return m_processedCount; +} + +quint64 ServerThread::totalProcessedBytes() const +{ + return m_totalProcessedBytes; +} + +bool ServerThread::isProcessing() const +{ + QMutexLocker locker(&m_mutex); + return !m_taskQueue.isEmpty(); +} + +void ServerThread::run() +{ + m_running = true; + + while (m_running) { + WorkTask task; + bool hasTask = false; + + { + QMutexLocker locker(&m_mutex); + + if (m_taskQueue.isEmpty()) { + // 等待新任务,超时1秒后继续循环检查m_running + m_condition.wait(&m_mutex, 1000); + continue; + } + + task = m_taskQueue.dequeue(); + hasTask = true; + } + + if (!hasTask || !m_running) { + continue; + } + + // 处理任务 + try { + QByteArray result; + + switch (task.taskType) { + case 0: // 处理接收到的数据 + result = processReceivedData(task.data); + break; + + case 1: // 打包待发送数据 + result = packSendData(task.data); + break; + + default: + emit sig_taskError(task.socketId, QString("未知任务类型: %1").arg(task.taskType)); + continue; + } + + // 更新统计 + m_processedCount++; + m_totalProcessedBytes += task.data.size(); + + // 发送处理结果 + if (!result.isEmpty()) { + emit sig_taskProcessed(task.socketId, result); + } + + } catch (const std::exception &e) { + emit sig_taskError(task.socketId, QString("处理异常: %1").arg(e.what())); + } catch (...) { + emit sig_taskError(task.socketId, "未知处理异常"); + } + + // 短暂休眠,避免CPU占用过高 + msleep(1); + } + +} + +QByteArray ServerThread::processReceivedData(const QByteArray &data) +{ + QString text = QString::fromUtf8(data); + + // 普通数据处理示例 + QByteArray result; + + // 添加时间戳前缀 + QString timestamp = QDateTime::currentDateTime().toString("[hh:mm:ss] "); + result = timestamp.toUtf8(); + + // 回显处理后的数据 + result += text.toUtf8(); + + // 可以在此添加更多业务逻辑 + // 例如:数据验证、转换、存储等 + + return result; +} + +QByteArray ServerThread::packSendData(const QByteArray &data) +{ + // 添加到待发送队列或进行预处理 + // 这里简单返回原数据,实际打包在TcpServer中完成 + return data; +} diff --git a/protocol/serverthread.h b/protocol/serverthread.h index c6dcb8c..341cf1a 100644 --- a/protocol/serverthread.h +++ b/protocol/serverthread.h @@ -1,63 +1,63 @@ -#ifndef SERVER_THREAD_H -#define SERVER_THREAD_H - -#include -#include -#include -#include -#include - -// 工作任务结构体 -struct WorkTask { - quint64 socketId; - QByteArray data; - int taskType; // 0: 处理数据, 1: 发送数据 - - WorkTask() : socketId(0), taskType(0) {} - WorkTask(quint64 id, const QByteArray &d, int type = 0) - : socketId(id), data(d), taskType(type) {} -}; - -class ServerThread : public QThread -{ - Q_OBJECT - -public: - explicit ServerThread(QObject *parent = 0); - ~ServerThread(); - - // 线程控制 - void stopThread(); - void addTask(const WorkTask &task); - - // 状态查询 - int pendingTasks() const; - quint64 processedCount() const; - quint64 totalProcessedBytes() const; - bool isProcessing() const; - -signals: - // 处理结果信号 - void sig_taskProcessed(quint64 socketId, const QByteArray &processedData); - void sig_taskError(quint64 socketId, const QString &error); - -protected: - void run() override; - -private: - // 核心处理函数 - QByteArray processReceivedData(const QByteArray &data); - QByteArray packSendData(const QByteArray &data); - - // 线程控制 - volatile bool m_running; - mutable QMutex m_mutex; - QWaitCondition m_condition; - QQueue m_taskQueue; - - // 统计信息 - quint64 m_processedCount; - quint64 m_totalProcessedBytes; -}; - -#endif // SERVER_THREAD_H +#ifndef SERVER_THREAD_H +#define SERVER_THREAD_H + +#include +#include +#include +#include +#include + +// 工作任务结构体 +struct WorkTask { + quint64 socketId; + QByteArray data; + int taskType; // 0: 处理数据, 1: 发送数据 + + WorkTask() : socketId(0), taskType(0) {} + WorkTask(quint64 id, const QByteArray &d, int type = 0) + : socketId(id), data(d), taskType(type) {} +}; + +class ServerThread : public QThread +{ + Q_OBJECT + +public: + explicit ServerThread(QObject *parent = 0); + ~ServerThread(); + + // 线程控制 + void stopThread(); + void addTask(const WorkTask &task); + + // 状态查询 + int pendingTasks() const; + quint64 processedCount() const; + quint64 totalProcessedBytes() const; + bool isProcessing() const; + +signals: + // 处理结果信号 + void sig_taskProcessed(quint64 socketId, const QByteArray &processedData); + void sig_taskError(quint64 socketId, const QString &error); + +protected: + void run() override; + +private: + // 核心处理函数 + QByteArray processReceivedData(const QByteArray &data); + QByteArray packSendData(const QByteArray &data); + + // 线程控制 + volatile bool m_running; + mutable QMutex m_mutex; + QWaitCondition m_condition; + QQueue m_taskQueue; + + // 统计信息 + quint64 m_processedCount; + quint64 m_totalProcessedBytes; +}; + +#endif // SERVER_THREAD_H diff --git a/protocol/tcpserver.cpp b/protocol/tcpserver.cpp index cfc9cae..7c73d29 100644 --- a/protocol/tcpserver.cpp +++ b/protocol/tcpserver.cpp @@ -1,551 +1,551 @@ -#include "tcpserver.h" -#include -#include -#include -#include "LogInfo.h" - -// Qt4兼容的时间戳函数 -qint64 TcpServer::getCurrentTimestamp() const -{ - return QDateTime::currentDateTime().toTime_t(); -} - -QString TcpServer::getPeerAddress(QTcpSocket *socket) const -{ - if (!socket) return QString(); - return socket->peerAddress().toString(); -} - -quint16 TcpServer::getPeerPort(QTcpSocket *socket) const -{ - if (!socket) return 0; - return socket->peerPort(); -} - -TcpServer::TcpServer(QObject *parent) - : QObject(parent) - , m_server(new QTcpServer(this)) - , m_message(this) - , m_nextThreadIndex(0) - , m_maxPendingConnections(10) //最大连接数量 - , m_maxBufferSize(1024 * 1024) - , m_heartbeatInterval(30) - , m_connectionTimeout(300) - , m_workerThreadCount(2) //工作线程数量 - , m_nextSocketId(1) - , m_totalReceived(0) - , m_totalSent(0) -{ - // 创建心跳定时器 - m_heartbeatTimer = new QTimer(this); - connect(m_heartbeatTimer, SIGNAL(timeout()), this, SLOT(slt_onHeartbeatCheck())); - - // 连接服务器信号 - connect(m_server, SIGNAL(newConnection()), this, SLOT(slt_onNewConnection())); - - // 创建工作线程 - setWorkerThreadCount(m_workerThreadCount); -} - -TcpServer::~TcpServer() -{ - stop(); - - // 停止所有ServerThread - for (int i = 0; i < m_workerThreads.size(); ++i) { - m_workerThreads[i]->stopThread(); - m_workerThreads[i]->deleteLater(); - } - m_workerThreads.clear(); -} - -// 设置工作线程数量 -void TcpServer::setWorkerThreadCount(int count) -{ - if (count < 1) count = 1; - if (count > 8) count = 8; - - // 停止现有线程 - for (int i = 0; i < m_workerThreads.size(); ++i) { - m_workerThreads[i]->stopThread(); - m_workerThreads[i]->deleteLater(); - } - m_workerThreads.clear(); - - // 创建新的ServerThread - for (int i = 0; i < count; ++i) { - ServerThread *thread = new ServerThread(this); - - // 连接ServerThread信号 - connect(thread, SIGNAL(taskProcessed(quint64, const QByteArray&)), - this, SLOT(slt_onTaskProcessed(quint64, const QByteArray&))); - connect(thread, SIGNAL(taskError(quint64, const QString&)), - this, SLOT(slt_onTaskError(quint64, const QString&))); - connect(thread, SIGNAL(threadStatus(const QString&)), - this, SIGNAL(sig_logMessage(const QString&))); - - m_workerThreads.append(thread); - thread->start(); - - emit sig_logMessage(QString("ServerThread %1 已启动").arg(i + 1)); - } - - m_workerThreadCount = count; - m_nextThreadIndex = 0; -} - -int TcpServer::workerThreadCount() const -{ - return m_workerThreadCount; -} - -// 获取下一个ServerThread(轮询负载均衡) -ServerThread* TcpServer::getNextWorkerThread() -{ - if (m_workerThreads.isEmpty()) { - return 0; - } - - ServerThread *thread = m_workerThreads[m_nextThreadIndex]; - m_nextThreadIndex = (m_nextThreadIndex + 1) % m_workerThreads.size(); - return thread; -} - -// 分发任务到ServerThread -void TcpServer::distributeToWorkerThread(quint64 socketId, const QByteArray &data, int taskType) -{ - ServerThread *thread = getNextWorkerThread(); - if (thread) { - WorkTask task(socketId, data, taskType); - thread->addTask(task); - } -} - -// ServerThread处理完成回调 -void TcpServer::slt_onTaskProcessed(quint64 socketId, const QByteArray &processedData) -{ - if (!validateSocket(socketId)) { - emit sig_logMessage(QString("处理完成但客户端 %1 已断开").arg(socketId), 1); - return; - } - - // 打包并发送处理后的数据 - QByteArray frame = m_message.pack(processedData); - - if (!frame.isEmpty()) { - QTcpSocket *socket = m_clientMap[socketId]; - socket->write(frame); - m_totalSent += frame.size(); - - if (m_clientInfoMap.contains(socketId)) { - m_clientInfoMap[socketId].totalSent += frame.size(); - } - } -} - -// ServerThread错误回调 -void TcpServer::slt_onTaskError(quint64 socketId, const QString &error) -{ - emit sig_logMessage(QString("ServerThread处理错误 - SocketID:%1, 错误:%2").arg(socketId).arg(error), 2); -} - -// 启动服务器 -bool TcpServer::start(quint16 port, const QHostAddress &address) -{ - if (m_server->isListening()) { - emit sig_logMessage("服务器已经在运行中"); - return true; - } - - m_server->setMaxPendingConnections(m_maxPendingConnections); - - if (!m_server->listen(address, port)) { - QString error = QString("服务器启动失败: %1").arg(m_server->errorString()); - emit sig_serverError(error); - emit sig_logMessage(error, 2); - return false; - } - - if (m_heartbeatInterval > 0) { - m_heartbeatTimer->start(m_heartbeatInterval * 1000); - } - - emit sig_serverStarted(m_server->serverPort()); - emit sig_logMessage(QString("服务器启动成功 - 端口:%1, ServerThread数:%2") - .arg(m_server->serverPort()) - .arg(m_workerThreadCount)); - - return true; -} - -// 停止服务器 -void TcpServer::stop() -{ - // 1. 停止心跳定时器 - if (m_heartbeatTimer->isActive()) { - m_heartbeatTimer->stop(); - } - - // 2. 停止接受新连接 - m_server->close(); - - // 3. 断开所有客户端连接 - QList clientIds = m_clientMap.keys(); - for (int i = 0; i < clientIds.size(); ++i) { - cleanupClient(clientIds[i], "服务器关闭"); - } - - // 4. 停止所有工作线程 - for (int i = 0; i < m_workerThreads.size(); ++i) { - if (m_workerThreads[i]->isRunning()) { - m_workerThreads[i]->stopThread(); - m_workerThreads[i]->wait(5000); // 等待线程退出 - } - } - - // 5. 清空所有数据结构 - m_clientMap.clear(); - m_clientInfoMap.clear(); - - emit sig_serverStopped(); - emit sig_logMessage("服务器已停止"); -} - -bool TcpServer::isRunning() const -{ - return m_server->isListening(); -} - -// 发送数据到客户端 -bool TcpServer::sendToClient(quint64 socketId, const QByteArray &data) -{ - if (!validateSocket(socketId)) { - emit sig_logMessage(QString("发送失败: 客户端 %1 不存在").arg(socketId), 1); - return false; - } - - // 通过ServerThread打包发送 - // 就目前项目而言,应该用不到多线程处理 -// distributeToWorkerThread(socketId, data, 1); - - return true; -} - -bool TcpServer::sendToAll(const QByteArray &data) -{ - bool success = true; - QList clientIds = m_clientMap.keys(); - - for (int i = 0; i < clientIds.size(); ++i) { - if (!sendToClient(clientIds[i], data)) { - success = false; - } - } - - return success; -} - -bool TcpServer::sendToAllExcept(quint64 socketId, const QByteArray &data) -{ - bool success = true; - QList clientIds = m_clientMap.keys(); - - for (int i = 0; i < clientIds.size(); ++i) { - if (clientIds[i] != socketId) { - if (!sendToClient(clientIds[i], data)) { - success = false; - } - } - } - - return success; -} - -// 新连接处理 -void TcpServer::slt_onNewConnection() -{ - while (m_server->hasPendingConnections()) { - QTcpSocket *socket = m_server->nextPendingConnection(); - - if (!socket) continue; - - quint64 socketId = m_nextSocketId++; - setupSocket(socket); - - ClientInfo info; - info.address = getPeerAddress(socket); - info.port = getPeerPort(socket); - info.socketId = socketId; - info.lastActiveTime = getCurrentTimestamp(); - - m_clientMap[socketId] = socket; - m_clientInfoMap[socketId] = info; - - emit sig_clientConnected(socketId, info.address, info.port); - emit sig_logMessage(QString("新客户端连接 %1 - %2:%3") - .arg(socketId) - .arg(info.address) - .arg(info.port)); - - emitStatistics(); - } -} - -// 数据接收处理 -void TcpServer::slt_onReadyRead() -{ - QTcpSocket *socket = qobject_cast(sender()); - if (!socket) return; - - LogInfo::setRunStatusText("TCPServer onReadyRead"); - - // 查找SocketId - quint64 socketId = 0; - QHash::const_iterator it; - for (it = m_clientMap.constBegin(); it != m_clientMap.constEnd(); ++it) { - if (it.value() == socket) { - socketId = it.key(); - break; - } - } - - if (socketId == 0) { - emit sig_logMessage("接收到未知Socket的数据", 1); - return; - } - - QByteArray newData = socket->readAll(); - m_totalReceived += newData.size(); - - if (m_clientInfoMap.contains(socketId)) { - m_clientInfoMap[socketId].totalReceived += newData.size(); - m_clientInfoMap[socketId].lastActiveTime = getCurrentTimestamp(); - } - - emit sig_rawDataReceived(socketId, newData); - - if (!m_clientInfoMap.contains(socketId)) return; - - QByteArray &buffer = m_clientInfoMap[socketId].buffer; - buffer.append(newData); - - if (buffer.size() > m_maxBufferSize) { - emit sig_logMessage(QString("客户端 %1 缓冲区溢出").arg(socketId), 2); - cleanupClient(socketId, "缓冲区溢出"); - return; - } - - processBuffer(socketId); -} - -// 处理接收缓冲区 -void TcpServer::processBuffer(quint64 socketId) -{ - if (!m_clientInfoMap.contains(socketId)) return; - - QByteArray &buffer = m_clientInfoMap[socketId].buffer; - int totalConsumed = 0; - - while (totalConsumed < buffer.size()) { - QByteArray remainingBuffer = buffer.mid(totalConsumed); - int consumed = 0; - - QByteArray frame = m_message.extractFrame(remainingBuffer, consumed); - - if (frame.isEmpty()) { - if (consumed > 0) { - totalConsumed += consumed; - continue; - } - break; - } - - QByteArray data; - - if (m_message.unpack(frame, data)) { - emit sig_dataReceived(socketId, data); - - // 分发到ServerThread处理 - // 就目前项目而言,应该用不到多线程处理 -// distributeToWorkerThread(socketId, data, 0); - } else { - LogInfo::setRunStatusText("processBuffer:解包失败"); - emit sig_logMessage(QString("客户端 %1 解包失败").arg(socketId), 1); - } - - totalConsumed += consumed; - } - - if (totalConsumed > 0) { - buffer.remove(0, totalConsumed); - } -} - -// 客户端断开 -void TcpServer::slt_onDisconnected() -{ - QTcpSocket *socket = qobject_cast(sender()); - if (!socket) return; - - quint64 socketId = 0; - QHash::iterator it; - for (it = m_clientMap.begin(); it != m_clientMap.end(); ++it) { - if (it.value() == socket) { - socketId = it.key(); - break; - } - } - - if (socketId == 0) return; - cleanupClient(socketId, "客户端主动断开"); -} - -void TcpServer::slt_onSocketError(QAbstractSocket::SocketError socketError) -{ - QTcpSocket *socket = qobject_cast(sender()); - if (!socket) return; - - quint64 socketId = 0; - QHash::const_iterator it; - for (it = m_clientMap.constBegin(); it != m_clientMap.constEnd(); ++it) { - if (it.value() == socket) { - socketId = it.key(); - break; - } - } - - if (socketId == 0) return; - - QString errorMsg = socket->errorString(); - emit sig_clientError(socketId, errorMsg); - emit sig_logMessage(QString("客户端 %1 错误: %2").arg(socketId).arg(errorMsg), 2); - - if (socketError != QAbstractSocket::RemoteHostClosedError) { - cleanupClient(socketId, "Socket错误: " + errorMsg); - } -} - -void TcpServer::slt_onHeartbeatCheck() -{ - qint64 currentTime = getCurrentTimestamp(); - QList timeoutClients; - - QHash::iterator it; - for (it = m_clientInfoMap.begin(); it != m_clientInfoMap.end(); ++it) { - if (currentTime - it.value().lastActiveTime > m_connectionTimeout) { - timeoutClients.append(it.key()); - } - } - - for (int i = 0; i < timeoutClients.size(); ++i) { - cleanupClient(timeoutClients[i], "连接超时"); - } - - if (!timeoutClients.isEmpty()) { - emitStatistics(); - } -} - -void TcpServer::setupSocket(QTcpSocket *socket) -{ - socket->setSocketOption(QAbstractSocket::LowDelayOption, 1); - socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); - - connect(socket, SIGNAL(readyRead()), this, SLOT(slt_onReadyRead())); - connect(socket, SIGNAL(disconnected()), this, SLOT(slt_onDisconnected())); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(slt_onSocketError(QAbstractSocket::SocketError))); -} - -void TcpServer::cleanupClient(quint64 socketId, const QString &reason) -{ - QTcpSocket *socket = m_clientMap.value(socketId); - if (!socket) return; - - emit sig_clientDisconnected(socketId, reason); - emit sig_logMessage(QString("客户端 %1 断开: %2").arg(socketId).arg(reason)); - - m_clientMap.remove(socketId); - m_clientInfoMap.remove(socketId); - - socket->disconnectFromHost(); - if (socket->state() != QAbstractSocket::UnconnectedState) { - socket->waitForDisconnected(1000); - } - socket->deleteLater(); - - emitStatistics(); -} - -void TcpServer::updateClientActivity(quint64 socketId) -{ - if (m_clientInfoMap.contains(socketId)) { - m_clientInfoMap[socketId].lastActiveTime = getCurrentTimestamp(); - } -} - -bool TcpServer::validateSocket(quint64 socketId) -{ - if (!m_clientMap.contains(socketId)) return false; - QTcpSocket *socket = m_clientMap[socketId]; - return socket && socket->state() == QAbstractSocket::ConnectedState; -} - -void TcpServer::emitStatistics() -{ - int activeThreads = 0; - for (int i = 0; i < m_workerThreads.size(); ++i) { - if (m_workerThreads[i]->isProcessing()) { - activeThreads++; - } - } - - emit sig_statisticsUpdated(m_clientMap.size(), activeThreads, - m_totalReceived, m_totalSent); -} - -quint16 TcpServer::serverPort() const -{ - return m_server->serverPort(); -} - -int TcpServer::clientCount() const -{ - return m_clientMap.size(); -} - -QList TcpServer::getClientList() const -{ - return m_clientInfoMap.values(); -} - -ClientInfo TcpServer::getClientInfo(quint64 socketId) const -{ - return m_clientInfoMap.value(socketId); -} - -void TcpServer::setMaxPendingConnections(int maxConnections) -{ - m_maxPendingConnections = maxConnections; - if (m_server->isListening()) { - m_server->setMaxPendingConnections(maxConnections); - } -} - -void TcpServer::setMaxBufferSize(int maxSize) -{ - m_maxBufferSize = maxSize; -} - -void TcpServer::setHeartbeatInterval(int seconds) -{ - m_heartbeatInterval = seconds; - if (m_heartbeatTimer->isActive()) { - m_heartbeatTimer->setInterval(seconds * 1000); - } -} - -void TcpServer::setConnectionTimeout(int seconds) -{ - m_connectionTimeout = seconds; -} +#include "tcpserver.h" +#include +#include +#include +#include "LogInfo.h" + +// Qt4兼容的时间戳函数 +qint64 TcpServer::getCurrentTimestamp() const +{ + return QDateTime::currentDateTime().toTime_t(); +} + +QString TcpServer::getPeerAddress(QTcpSocket *socket) const +{ + if (!socket) return QString(); + return socket->peerAddress().toString(); +} + +quint16 TcpServer::getPeerPort(QTcpSocket *socket) const +{ + if (!socket) return 0; + return socket->peerPort(); +} + +TcpServer::TcpServer(QObject *parent) + : QObject(parent) + , m_server(new QTcpServer(this)) + , m_message(this) + , m_nextThreadIndex(0) + , m_maxPendingConnections(10) //最大连接数量 + , m_maxBufferSize(1024 * 1024) + , m_heartbeatInterval(30) + , m_connectionTimeout(300) + , m_workerThreadCount(2) //工作线程数量 + , m_nextSocketId(1) + , m_totalReceived(0) + , m_totalSent(0) +{ + // 创建心跳定时器 + m_heartbeatTimer = new QTimer(this); + connect(m_heartbeatTimer, SIGNAL(timeout()), this, SLOT(slt_onHeartbeatCheck())); + + // 连接服务器信号 + connect(m_server, SIGNAL(newConnection()), this, SLOT(slt_onNewConnection())); + + // 创建工作线程 + setWorkerThreadCount(m_workerThreadCount); +} + +TcpServer::~TcpServer() +{ + stop(); + + // 停止所有ServerThread + for (int i = 0; i < m_workerThreads.size(); ++i) { + m_workerThreads[i]->stopThread(); + m_workerThreads[i]->deleteLater(); + } + m_workerThreads.clear(); +} + +// 设置工作线程数量 +void TcpServer::setWorkerThreadCount(int count) +{ + if (count < 1) count = 1; + if (count > 8) count = 8; + + // 停止现有线程 + for (int i = 0; i < m_workerThreads.size(); ++i) { + m_workerThreads[i]->stopThread(); + m_workerThreads[i]->deleteLater(); + } + m_workerThreads.clear(); + + // 创建新的ServerThread + for (int i = 0; i < count; ++i) { + ServerThread *thread = new ServerThread(this); + + // 连接ServerThread信号 + connect(thread, SIGNAL(taskProcessed(quint64, const QByteArray&)), + this, SLOT(slt_onTaskProcessed(quint64, const QByteArray&))); + connect(thread, SIGNAL(taskError(quint64, const QString&)), + this, SLOT(slt_onTaskError(quint64, const QString&))); + connect(thread, SIGNAL(threadStatus(const QString&)), + this, SIGNAL(sig_logMessage(const QString&))); + + m_workerThreads.append(thread); + thread->start(); + + emit sig_logMessage(QString("ServerThread %1 已启动").arg(i + 1)); + } + + m_workerThreadCount = count; + m_nextThreadIndex = 0; +} + +int TcpServer::workerThreadCount() const +{ + return m_workerThreadCount; +} + +// 获取下一个ServerThread(轮询负载均衡) +ServerThread* TcpServer::getNextWorkerThread() +{ + if (m_workerThreads.isEmpty()) { + return 0; + } + + ServerThread *thread = m_workerThreads[m_nextThreadIndex]; + m_nextThreadIndex = (m_nextThreadIndex + 1) % m_workerThreads.size(); + return thread; +} + +// 分发任务到ServerThread +void TcpServer::distributeToWorkerThread(quint64 socketId, const QByteArray &data, int taskType) +{ + ServerThread *thread = getNextWorkerThread(); + if (thread) { + WorkTask task(socketId, data, taskType); + thread->addTask(task); + } +} + +// ServerThread处理完成回调 +void TcpServer::slt_onTaskProcessed(quint64 socketId, const QByteArray &processedData) +{ + if (!validateSocket(socketId)) { + emit sig_logMessage(QString("处理完成但客户端 %1 已断开").arg(socketId), 1); + return; + } + + // 打包并发送处理后的数据 + QByteArray frame = m_message.pack(processedData); + + if (!frame.isEmpty()) { + QTcpSocket *socket = m_clientMap[socketId]; + socket->write(frame); + m_totalSent += frame.size(); + + if (m_clientInfoMap.contains(socketId)) { + m_clientInfoMap[socketId].totalSent += frame.size(); + } + } +} + +// ServerThread错误回调 +void TcpServer::slt_onTaskError(quint64 socketId, const QString &error) +{ + emit sig_logMessage(QString("ServerThread处理错误 - SocketID:%1, 错误:%2").arg(socketId).arg(error), 2); +} + +// 启动服务器 +bool TcpServer::start(quint16 port, const QHostAddress &address) +{ + if (m_server->isListening()) { + emit sig_logMessage("服务器已经在运行中"); + return true; + } + + m_server->setMaxPendingConnections(m_maxPendingConnections); + + if (!m_server->listen(address, port)) { + QString error = QString("服务器启动失败: %1").arg(m_server->errorString()); + emit sig_serverError(error); + emit sig_logMessage(error, 2); + return false; + } + + if (m_heartbeatInterval > 0) { + m_heartbeatTimer->start(m_heartbeatInterval * 1000); + } + + emit sig_serverStarted(m_server->serverPort()); + emit sig_logMessage(QString("服务器启动成功 - 端口:%1, ServerThread数:%2") + .arg(m_server->serverPort()) + .arg(m_workerThreadCount)); + + return true; +} + +// 停止服务器 +void TcpServer::stop() +{ + // 1. 停止心跳定时器 + if (m_heartbeatTimer->isActive()) { + m_heartbeatTimer->stop(); + } + + // 2. 停止接受新连接 + m_server->close(); + + // 3. 断开所有客户端连接 + QList clientIds = m_clientMap.keys(); + for (int i = 0; i < clientIds.size(); ++i) { + cleanupClient(clientIds[i], "服务器关闭"); + } + + // 4. 停止所有工作线程 + for (int i = 0; i < m_workerThreads.size(); ++i) { + if (m_workerThreads[i]->isRunning()) { + m_workerThreads[i]->stopThread(); + m_workerThreads[i]->wait(5000); // 等待线程退出 + } + } + + // 5. 清空所有数据结构 + m_clientMap.clear(); + m_clientInfoMap.clear(); + + emit sig_serverStopped(); + emit sig_logMessage("服务器已停止"); +} + +bool TcpServer::isRunning() const +{ + return m_server->isListening(); +} + +// 发送数据到客户端 +bool TcpServer::sendToClient(quint64 socketId, const QByteArray &data) +{ + if (!validateSocket(socketId)) { + emit sig_logMessage(QString("发送失败: 客户端 %1 不存在").arg(socketId), 1); + return false; + } + + // 通过ServerThread打包发送 + // 就目前项目而言,应该用不到多线程处理 +// distributeToWorkerThread(socketId, data, 1); + + return true; +} + +bool TcpServer::sendToAll(const QByteArray &data) +{ + bool success = true; + QList clientIds = m_clientMap.keys(); + + for (int i = 0; i < clientIds.size(); ++i) { + if (!sendToClient(clientIds[i], data)) { + success = false; + } + } + + return success; +} + +bool TcpServer::sendToAllExcept(quint64 socketId, const QByteArray &data) +{ + bool success = true; + QList clientIds = m_clientMap.keys(); + + for (int i = 0; i < clientIds.size(); ++i) { + if (clientIds[i] != socketId) { + if (!sendToClient(clientIds[i], data)) { + success = false; + } + } + } + + return success; +} + +// 新连接处理 +void TcpServer::slt_onNewConnection() +{ + while (m_server->hasPendingConnections()) { + QTcpSocket *socket = m_server->nextPendingConnection(); + + if (!socket) continue; + + quint64 socketId = m_nextSocketId++; + setupSocket(socket); + + ClientInfo info; + info.address = getPeerAddress(socket); + info.port = getPeerPort(socket); + info.socketId = socketId; + info.lastActiveTime = getCurrentTimestamp(); + + m_clientMap[socketId] = socket; + m_clientInfoMap[socketId] = info; + + emit sig_clientConnected(socketId, info.address, info.port); + emit sig_logMessage(QString("新客户端连接 %1 - %2:%3") + .arg(socketId) + .arg(info.address) + .arg(info.port)); + + emitStatistics(); + } +} + +// 数据接收处理 +void TcpServer::slt_onReadyRead() +{ + QTcpSocket *socket = qobject_cast(sender()); + if (!socket) return; + + LogInfo::setRunStatusText("TCPServer onReadyRead"); + + // 查找SocketId + quint64 socketId = 0; + QHash::const_iterator it; + for (it = m_clientMap.constBegin(); it != m_clientMap.constEnd(); ++it) { + if (it.value() == socket) { + socketId = it.key(); + break; + } + } + + if (socketId == 0) { + emit sig_logMessage("接收到未知Socket的数据", 1); + return; + } + + QByteArray newData = socket->readAll(); + m_totalReceived += newData.size(); + + if (m_clientInfoMap.contains(socketId)) { + m_clientInfoMap[socketId].totalReceived += newData.size(); + m_clientInfoMap[socketId].lastActiveTime = getCurrentTimestamp(); + } + + emit sig_rawDataReceived(socketId, newData); + + if (!m_clientInfoMap.contains(socketId)) return; + + QByteArray &buffer = m_clientInfoMap[socketId].buffer; + buffer.append(newData); + + if (buffer.size() > m_maxBufferSize) { + emit sig_logMessage(QString("客户端 %1 缓冲区溢出").arg(socketId), 2); + cleanupClient(socketId, "缓冲区溢出"); + return; + } + + processBuffer(socketId); +} + +// 处理接收缓冲区 +void TcpServer::processBuffer(quint64 socketId) +{ + if (!m_clientInfoMap.contains(socketId)) return; + + QByteArray &buffer = m_clientInfoMap[socketId].buffer; + int totalConsumed = 0; + + while (totalConsumed < buffer.size()) { + QByteArray remainingBuffer = buffer.mid(totalConsumed); + int consumed = 0; + + QByteArray frame = m_message.extractFrame(remainingBuffer, consumed); + + if (frame.isEmpty()) { + if (consumed > 0) { + totalConsumed += consumed; + continue; + } + break; + } + + QByteArray data; + + if (m_message.unpack(frame, data)) { + emit sig_dataReceived(socketId, data); + + // 分发到ServerThread处理 + // 就目前项目而言,应该用不到多线程处理 +// distributeToWorkerThread(socketId, data, 0); + } else { + LogInfo::setRunStatusText("processBuffer:解包失败"); + emit sig_logMessage(QString("客户端 %1 解包失败").arg(socketId), 1); + } + + totalConsumed += consumed; + } + + if (totalConsumed > 0) { + buffer.remove(0, totalConsumed); + } +} + +// 客户端断开 +void TcpServer::slt_onDisconnected() +{ + QTcpSocket *socket = qobject_cast(sender()); + if (!socket) return; + + quint64 socketId = 0; + QHash::iterator it; + for (it = m_clientMap.begin(); it != m_clientMap.end(); ++it) { + if (it.value() == socket) { + socketId = it.key(); + break; + } + } + + if (socketId == 0) return; + cleanupClient(socketId, "客户端主动断开"); +} + +void TcpServer::slt_onSocketError(QAbstractSocket::SocketError socketError) +{ + QTcpSocket *socket = qobject_cast(sender()); + if (!socket) return; + + quint64 socketId = 0; + QHash::const_iterator it; + for (it = m_clientMap.constBegin(); it != m_clientMap.constEnd(); ++it) { + if (it.value() == socket) { + socketId = it.key(); + break; + } + } + + if (socketId == 0) return; + + QString errorMsg = socket->errorString(); + emit sig_clientError(socketId, errorMsg); + emit sig_logMessage(QString("客户端 %1 错误: %2").arg(socketId).arg(errorMsg), 2); + + if (socketError != QAbstractSocket::RemoteHostClosedError) { + cleanupClient(socketId, "Socket错误: " + errorMsg); + } +} + +void TcpServer::slt_onHeartbeatCheck() +{ + qint64 currentTime = getCurrentTimestamp(); + QList timeoutClients; + + QHash::iterator it; + for (it = m_clientInfoMap.begin(); it != m_clientInfoMap.end(); ++it) { + if (currentTime - it.value().lastActiveTime > m_connectionTimeout) { + timeoutClients.append(it.key()); + } + } + + for (int i = 0; i < timeoutClients.size(); ++i) { + cleanupClient(timeoutClients[i], "连接超时"); + } + + if (!timeoutClients.isEmpty()) { + emitStatistics(); + } +} + +void TcpServer::setupSocket(QTcpSocket *socket) +{ + socket->setSocketOption(QAbstractSocket::LowDelayOption, 1); + socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + + connect(socket, SIGNAL(readyRead()), this, SLOT(slt_onReadyRead())); + connect(socket, SIGNAL(disconnected()), this, SLOT(slt_onDisconnected())); + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), + this, SLOT(slt_onSocketError(QAbstractSocket::SocketError))); +} + +void TcpServer::cleanupClient(quint64 socketId, const QString &reason) +{ + QTcpSocket *socket = m_clientMap.value(socketId); + if (!socket) return; + + emit sig_clientDisconnected(socketId, reason); + emit sig_logMessage(QString("客户端 %1 断开: %2").arg(socketId).arg(reason)); + + m_clientMap.remove(socketId); + m_clientInfoMap.remove(socketId); + + socket->disconnectFromHost(); + if (socket->state() != QAbstractSocket::UnconnectedState) { + socket->waitForDisconnected(1000); + } + socket->deleteLater(); + + emitStatistics(); +} + +void TcpServer::updateClientActivity(quint64 socketId) +{ + if (m_clientInfoMap.contains(socketId)) { + m_clientInfoMap[socketId].lastActiveTime = getCurrentTimestamp(); + } +} + +bool TcpServer::validateSocket(quint64 socketId) +{ + if (!m_clientMap.contains(socketId)) return false; + QTcpSocket *socket = m_clientMap[socketId]; + return socket && socket->state() == QAbstractSocket::ConnectedState; +} + +void TcpServer::emitStatistics() +{ + int activeThreads = 0; + for (int i = 0; i < m_workerThreads.size(); ++i) { + if (m_workerThreads[i]->isProcessing()) { + activeThreads++; + } + } + + emit sig_statisticsUpdated(m_clientMap.size(), activeThreads, + m_totalReceived, m_totalSent); +} + +quint16 TcpServer::serverPort() const +{ + return m_server->serverPort(); +} + +int TcpServer::clientCount() const +{ + return m_clientMap.size(); +} + +QList TcpServer::getClientList() const +{ + return m_clientInfoMap.values(); +} + +ClientInfo TcpServer::getClientInfo(quint64 socketId) const +{ + return m_clientInfoMap.value(socketId); +} + +void TcpServer::setMaxPendingConnections(int maxConnections) +{ + m_maxPendingConnections = maxConnections; + if (m_server->isListening()) { + m_server->setMaxPendingConnections(maxConnections); + } +} + +void TcpServer::setMaxBufferSize(int maxSize) +{ + m_maxBufferSize = maxSize; +} + +void TcpServer::setHeartbeatInterval(int seconds) +{ + m_heartbeatInterval = seconds; + if (m_heartbeatTimer->isActive()) { + m_heartbeatTimer->setInterval(seconds * 1000); + } +} + +void TcpServer::setConnectionTimeout(int seconds) +{ + m_connectionTimeout = seconds; +} diff --git a/protocol/tcpserver.h b/protocol/tcpserver.h index 36c72d2..4c13dd4 100644 --- a/protocol/tcpserver.h +++ b/protocol/tcpserver.h @@ -1,147 +1,147 @@ -#ifndef TCPSERVER_H -#define TCPSERVER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "message.h" -#include "serverthread.h" - -/** - TCP 服务端模块,用于处理外部tcp发来的数据 -**/ - -// 客户端连接信息 -struct ClientInfo { - QString address; - quint16 port; - quint64 socketId; - QByteArray buffer; // 接收缓冲区 - qint64 lastActiveTime; // 最后活跃时间 - quint64 totalReceived; // 总接收字节数 - quint64 totalSent; // 总发送字节数 - - ClientInfo() { - port = 0; - socketId = 0; - lastActiveTime = 0; - totalReceived = 0; - totalSent = 0; - } -}; - -class TcpServer : public QObject -{ - Q_OBJECT - -public: - explicit TcpServer(QObject *parent = 0); - ~TcpServer(); - - // 服务器控制 - bool start(quint16 port, const QHostAddress &address = QHostAddress::Any); - void stop(); - bool isRunning() const; - - // 发送数据 - bool sendToClient(quint64 socketId, const QByteArray &data); - bool sendToAll(const QByteArray &data); - bool sendToAllExcept(quint64 socketId, const QByteArray &data); - - // 线程管理 - void setWorkerThreadCount(int count); - int workerThreadCount() const; - - // 获取服务器状态 - quint16 serverPort() const; - int clientCount() const; - QList getClientList() const; - ClientInfo getClientInfo(quint64 socketId) const; - - // 配置选项 - void setMaxPendingConnections(int maxConnections); - void setMaxBufferSize(int maxSize); - void setHeartbeatInterval(int seconds); - void setConnectionTimeout(int seconds); - -signals: - // 服务器状态信号 - void sig_serverStarted(quint16 port); - void sig_serverStopped(); - void sig_serverError(const QString &error); - - // 客户端连接信号 - void sig_clientConnected(quint64 socketId, const QString &address, quint16 port); - void sig_clientDisconnected(quint64 socketId, const QString &reason); - void sig_clientError(quint64 socketId, const QString &error); - - // 数据接收信号 - void sig_dataReceived(quint64 socketId, const QByteArray &data); - void sig_rawDataReceived(quint64 socketId, const QByteArray &rawData); - - // 统计信号 - void sig_statisticsUpdated(int clientCount, int threadCount, - quint64 totalReceived, quint64 totalSent); - - // 日志信号 - void sig_logMessage(const QString &message, int level = 0); - -private slots: - void slt_onNewConnection(); - void slt_onReadyRead(); - void slt_onDisconnected(); - void slt_onSocketError(QAbstractSocket::SocketError socketError); - void slt_onHeartbeatCheck(); - void slt_onTaskProcessed(quint64 socketId, const QByteArray &processedData); - void slt_onTaskError(quint64 socketId, const QString &error); - -private: - // 核心组件 - QTcpServer *m_server; - QHash m_clientMap; - QHash m_clientInfoMap; - Message m_message; - - // 工作线程池 - QList m_workerThreads; - int m_nextThreadIndex; - - // 配置参数 - int m_maxPendingConnections; //最大连接数量 - int m_maxBufferSize; - int m_heartbeatInterval; //心跳 - int m_connectionTimeout; - int m_workerThreadCount; //工作线程数量 - - // 定时器 - QTimer *m_heartbeatTimer; - - // 统计信息 - quint64 m_nextSocketId; - quint64 m_totalReceived; - quint64 m_totalSent; - - // 内部方法 - void setupSocket(QTcpSocket *socket); - void processBuffer(quint64 socketId); - void distributeToWorkerThread(quint64 socketId, const QByteArray &data, int taskType); - void cleanupClient(quint64 socketId, const QString &reason); - void updateClientActivity(quint64 socketId); - bool validateSocket(quint64 socketId); - void emitStatistics(); - ServerThread* getNextWorkerThread(); - - // Qt4兼容的辅助方法 - qint64 getCurrentTimestamp() const; - QString getPeerAddress(QTcpSocket *socket) const; - quint16 getPeerPort(QTcpSocket *socket) const; -}; - -#endif // TCPSERVER_H +#ifndef TCPSERVER_H +#define TCPSERVER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "message.h" +#include "serverthread.h" + +/** + TCP 服务端模块,用于处理外部tcp发来的数据 +**/ + +// 客户端连接信息 +struct ClientInfo { + QString address; + quint16 port; + quint64 socketId; + QByteArray buffer; // 接收缓冲区 + qint64 lastActiveTime; // 最后活跃时间 + quint64 totalReceived; // 总接收字节数 + quint64 totalSent; // 总发送字节数 + + ClientInfo() { + port = 0; + socketId = 0; + lastActiveTime = 0; + totalReceived = 0; + totalSent = 0; + } +}; + +class TcpServer : public QObject +{ + Q_OBJECT + +public: + explicit TcpServer(QObject *parent = 0); + ~TcpServer(); + + // 服务器控制 + bool start(quint16 port, const QHostAddress &address = QHostAddress::Any); + void stop(); + bool isRunning() const; + + // 发送数据 + bool sendToClient(quint64 socketId, const QByteArray &data); + bool sendToAll(const QByteArray &data); + bool sendToAllExcept(quint64 socketId, const QByteArray &data); + + // 线程管理 + void setWorkerThreadCount(int count); + int workerThreadCount() const; + + // 获取服务器状态 + quint16 serverPort() const; + int clientCount() const; + QList getClientList() const; + ClientInfo getClientInfo(quint64 socketId) const; + + // 配置选项 + void setMaxPendingConnections(int maxConnections); + void setMaxBufferSize(int maxSize); + void setHeartbeatInterval(int seconds); + void setConnectionTimeout(int seconds); + +signals: + // 服务器状态信号 + void sig_serverStarted(quint16 port); + void sig_serverStopped(); + void sig_serverError(const QString &error); + + // 客户端连接信号 + void sig_clientConnected(quint64 socketId, const QString &address, quint16 port); + void sig_clientDisconnected(quint64 socketId, const QString &reason); + void sig_clientError(quint64 socketId, const QString &error); + + // 数据接收信号 + void sig_dataReceived(quint64 socketId, const QByteArray &data); + void sig_rawDataReceived(quint64 socketId, const QByteArray &rawData); + + // 统计信号 + void sig_statisticsUpdated(int clientCount, int threadCount, + quint64 totalReceived, quint64 totalSent); + + // 日志信号 + void sig_logMessage(const QString &message, int level = 0); + +private slots: + void slt_onNewConnection(); + void slt_onReadyRead(); + void slt_onDisconnected(); + void slt_onSocketError(QAbstractSocket::SocketError socketError); + void slt_onHeartbeatCheck(); + void slt_onTaskProcessed(quint64 socketId, const QByteArray &processedData); + void slt_onTaskError(quint64 socketId, const QString &error); + +private: + // 核心组件 + QTcpServer *m_server; + QHash m_clientMap; + QHash m_clientInfoMap; + Message m_message; + + // 工作线程池 + QList m_workerThreads; + int m_nextThreadIndex; + + // 配置参数 + int m_maxPendingConnections; //最大连接数量 + int m_maxBufferSize; + int m_heartbeatInterval; //心跳 + int m_connectionTimeout; + int m_workerThreadCount; //工作线程数量 + + // 定时器 + QTimer *m_heartbeatTimer; + + // 统计信息 + quint64 m_nextSocketId; + quint64 m_totalReceived; + quint64 m_totalSent; + + // 内部方法 + void setupSocket(QTcpSocket *socket); + void processBuffer(quint64 socketId); + void distributeToWorkerThread(quint64 socketId, const QByteArray &data, int taskType); + void cleanupClient(quint64 socketId, const QString &reason); + void updateClientActivity(quint64 socketId); + bool validateSocket(quint64 socketId); + void emitStatistics(); + ServerThread* getNextWorkerThread(); + + // Qt4兼容的辅助方法 + qint64 getCurrentTimestamp() const; + QString getPeerAddress(QTcpSocket *socket) const; + quint16 getPeerPort(QTcpSocket *socket) const; +}; + +#endif // TCPSERVER_H diff --git a/pulsenumfix.ui b/pulsenumfix.ui index 17045f9..3246c23 100644 --- a/pulsenumfix.ui +++ b/pulsenumfix.ui @@ -1,231 +1,231 @@ - - - PulseNumFix - - - - 0 - 0 - 481 - 228 - - - - Qt::StrongFocus - - - Dialog - - - - - 240 - 180 - 221 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 10 - 461 - 177 - - - - - 4 - - - 4 - - - 4 - - - - - - - 根据速度 - - - - - - - 根据喷印 - - - true - - - - - - - 根据脉冲数 - - - - - - - 根据同步器参数 - - - - - - - - - - - - - 实际皮带速度(毫米/秒): - - - - - - - Qt::ImhNone - - - - - - - - - - - 实际喷印间隔长度(毫米): - - - - - - - Qt::ImhNone - - - - - - - - - - - 长度(毫米): - - - - - - - Qt::ImhNone - - - - - - - 同步脉冲数 - - - - - - - Qt::ImhNone - - - - - - - - - - - 同步器直径(毫米): - - - - - - - Qt::ImhNone - - - - - - - 脉冲数/转: - - - - - - - Qt::ImhNone - - - - - - - - - - - - - - buttonBox - accepted() - PulseNumFix - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - PulseNumFix - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + PulseNumFix + + + + 0 + 0 + 481 + 228 + + + + Qt::StrongFocus + + + Dialog + + + + + 240 + 180 + 221 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 461 + 177 + + + + + 4 + + + 4 + + + 4 + + + + + + + 根据速度 + + + + + + + 根据喷印 + + + true + + + + + + + 根据脉冲数 + + + + + + + 根据同步器参数 + + + + + + + + + + + + + 实际皮带速度(毫米/秒): + + + + + + + Qt::ImhNone + + + + + + + + + + + 实际喷印间隔长度(毫米): + + + + + + + Qt::ImhNone + + + + + + + + + + + 长度(毫米): + + + + + + + Qt::ImhNone + + + + + + + 同步脉冲数 + + + + + + + Qt::ImhNone + + + + + + + + + + + 同步器直径(毫米): + + + + + + + Qt::ImhNone + + + + + + + 脉冲数/转: + + + + + + + Qt::ImhNone + + + + + + + + + + + + + + buttonBox + accepted() + PulseNumFix + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + PulseNumFix + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/qextserialbase.cpp b/qextserialbase.cpp index 4c77fb7..854adf6 100644 --- a/qextserialbase.cpp +++ b/qextserialbase.cpp @@ -1,226 +1,226 @@ -#include "qextserialbase.h" - -/*! -\fn QextSerialBase::QextSerialBase() -Default constructor. -*/ -QextSerialBase::QextSerialBase() - : QIODevice() -{ - -#ifdef _TTY_WIN_ - setPortName("COM1"); - -#elif defined(_TTY_IRIX_) - setPortName("/dev/ttyf1"); - -#elif defined(_TTY_HPUX_) - setPortName("/dev/tty1p0"); - -#elif defined(_TTY_SUN_) - setPortName("/dev/ttya"); - -#elif defined(_TTY_DIGITAL_) - setPortName("/dev/tty01"); - -#elif defined(_TTY_FREEBSD_) - setPortName("/dev/ttyd1"); - -#else - setPortName("/dev/ttyS0"); -#endif - - construct(); -} - -/*! -\fn QextSerialBase::QextSerialBase(const QString & name) -Construct a port and assign it to the device specified by the name parameter. -*/ -QextSerialBase::QextSerialBase(const QString & name) - : QIODevice() -{ - setPortName(name); - construct(); -} - -/*! -\fn QextSerialBase::~QextSerialBase() -Standard destructor. -*/ -QextSerialBase::~QextSerialBase() -{ - delete mutex; -} - -/*! -\fn void QextSerialBase::construct() -Common constructor function for setting up default port settings. -(115200 Baud, 8N1, Hardware flow control where supported, otherwise no flow control, and 0 ms timeout). -*/ -void QextSerialBase::construct() -{ - Settings.BaudRate=BAUD115200; - Settings.DataBits=DATA_8; - Settings.Parity=PAR_NONE; - Settings.StopBits=STOP_1; - Settings.FlowControl=FLOW_HARDWARE; - Settings.Timeout_Millisec=500; - mutex = new QMutex( QMutex::Recursive ); - setOpenMode(QIODevice::NotOpen); -} - -void QextSerialBase::setQueryMode(QueryMode mechanism) -{ - _queryMode = mechanism; -} - -/*! -\fn void QextSerialBase::setPortName(const QString & name) -Sets the name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0". -*/ -void QextSerialBase::setPortName(const QString & name) -{ - port = name; -} - -/*! -\fn QString QextSerialBase::portName() const -Returns the name set by setPortName(). -*/ -QString QextSerialBase::portName() const -{ - return port; -} - -/*! -\fn BaudRateType QextSerialBase::baudRate(void) const -Returns the baud rate of the serial port. For a list of possible return values see -the definition of the enum BaudRateType. -*/ -BaudRateType QextSerialBase::baudRate(void) const -{ - return Settings.BaudRate; -} - -/*! -\fn DataBitsType QextSerialBase::dataBits() const -Returns the number of data bits used by the port. For a list of possible values returned by -this function, see the definition of the enum DataBitsType. -*/ -DataBitsType QextSerialBase::dataBits() const -{ - return Settings.DataBits; -} - -/*! -\fn ParityType QextSerialBase::parity() const -Returns the type of parity used by the port. For a list of possible values returned by -this function, see the definition of the enum ParityType. -*/ -ParityType QextSerialBase::parity() const -{ - return Settings.Parity; -} - -/*! -\fn StopBitsType QextSerialBase::stopBits() const -Returns the number of stop bits used by the port. For a list of possible return values, see -the definition of the enum StopBitsType. -*/ -StopBitsType QextSerialBase::stopBits() const -{ - return Settings.StopBits; -} - -/*! -\fn FlowType QextSerialBase::flowControl() const -Returns the type of flow control used by the port. For a list of possible values returned -by this function, see the definition of the enum FlowType. -*/ -FlowType QextSerialBase::flowControl() const -{ - return Settings.FlowControl; -} - -/*! -\fn bool QextSerialBase::isSequential() const -Returns true if device is sequential, otherwise returns false. Serial port is sequential device -so this function always returns true. Check QIODevice::isSequential() documentation for more -information. -*/ -bool QextSerialBase::isSequential() const -{ - return true; -} - -/*! -\fn bool QextSerialBase::atEnd() const -This function will return true if the input buffer is empty (or on error), and false otherwise. -Call QextSerialBase::lastError() for error information. -*/ -bool QextSerialBase::atEnd() const -{ - if (size()) { - return true; - } - return false; -} - -/*! -\fn qint64 QextSerialBase::readLine(char * data, qint64 maxSize) -This function will read a line of buffered input from the port, stopping when either maxSize bytes -have been read, the port has no more data available, or a newline is encountered. -The value returned is the length of the string that was read. -*/ -qint64 QextSerialBase::readLine(char * data, qint64 maxSize) -{ - qint64 numBytes = bytesAvailable(); - char* pData = data; - - if (maxSize < 2) //maxSize must be larger than 1 - return -1; - - /*read a byte at a time for MIN(bytesAvail, maxSize - 1) iterations, or until a newline*/ - while (pData<(data+numBytes) && --maxSize) { - readData(pData, 1); - if (*pData++ == '\n') { - break; - } - } - *pData='\0'; - - /*return size of data read*/ - return (pData-data); -} - -/*! -\fn ulong QextSerialBase::lastError() const -Returns the code for the last error encountered by the port, or E_NO_ERROR if the last port -operation was successful. Possible error codes are: - -\verbatim -Error Explanation ---------------------------- ------------------------------------------------------------- -E_NO_ERROR No Error has occured -E_INVALID_FD Invalid file descriptor (port was not opened correctly) -E_NO_MEMORY Unable to allocate memory tables (POSIX) -E_CAUGHT_NON_BLOCKED_SIGNAL Caught a non-blocked signal (POSIX) -E_PORT_TIMEOUT Operation timed out (POSIX) -E_INVALID_DEVICE The file opened by the port is not a character device (POSIX) -E_BREAK_CONDITION The port detected a break condition -E_FRAMING_ERROR The port detected a framing error - (usually caused by incorrect baud rate settings) -E_IO_ERROR There was an I/O error while communicating with the port -E_BUFFER_OVERRUN Character buffer overrun -E_RECEIVE_OVERFLOW Receive buffer overflow -E_RECEIVE_PARITY_ERROR The port detected a parity error in the received data -E_TRANSMIT_OVERFLOW Transmit buffer overflow -E_READ_FAILED General read operation failure -E_WRITE_FAILED General write operation failure -\endverbatim -*/ -ulong QextSerialBase::lastError() const -{ - return lastErr; -} +#include "qextserialbase.h" + +/*! +\fn QextSerialBase::QextSerialBase() +Default constructor. +*/ +QextSerialBase::QextSerialBase() + : QIODevice() +{ + +#ifdef _TTY_WIN_ + setPortName("COM1"); + +#elif defined(_TTY_IRIX_) + setPortName("/dev/ttyf1"); + +#elif defined(_TTY_HPUX_) + setPortName("/dev/tty1p0"); + +#elif defined(_TTY_SUN_) + setPortName("/dev/ttya"); + +#elif defined(_TTY_DIGITAL_) + setPortName("/dev/tty01"); + +#elif defined(_TTY_FREEBSD_) + setPortName("/dev/ttyd1"); + +#else + setPortName("/dev/ttyS0"); +#endif + + construct(); +} + +/*! +\fn QextSerialBase::QextSerialBase(const QString & name) +Construct a port and assign it to the device specified by the name parameter. +*/ +QextSerialBase::QextSerialBase(const QString & name) + : QIODevice() +{ + setPortName(name); + construct(); +} + +/*! +\fn QextSerialBase::~QextSerialBase() +Standard destructor. +*/ +QextSerialBase::~QextSerialBase() +{ + delete mutex; +} + +/*! +\fn void QextSerialBase::construct() +Common constructor function for setting up default port settings. +(115200 Baud, 8N1, Hardware flow control where supported, otherwise no flow control, and 0 ms timeout). +*/ +void QextSerialBase::construct() +{ + Settings.BaudRate=BAUD115200; + Settings.DataBits=DATA_8; + Settings.Parity=PAR_NONE; + Settings.StopBits=STOP_1; + Settings.FlowControl=FLOW_HARDWARE; + Settings.Timeout_Millisec=500; + mutex = new QMutex( QMutex::Recursive ); + setOpenMode(QIODevice::NotOpen); +} + +void QextSerialBase::setQueryMode(QueryMode mechanism) +{ + _queryMode = mechanism; +} + +/*! +\fn void QextSerialBase::setPortName(const QString & name) +Sets the name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0". +*/ +void QextSerialBase::setPortName(const QString & name) +{ + port = name; +} + +/*! +\fn QString QextSerialBase::portName() const +Returns the name set by setPortName(). +*/ +QString QextSerialBase::portName() const +{ + return port; +} + +/*! +\fn BaudRateType QextSerialBase::baudRate(void) const +Returns the baud rate of the serial port. For a list of possible return values see +the definition of the enum BaudRateType. +*/ +BaudRateType QextSerialBase::baudRate(void) const +{ + return Settings.BaudRate; +} + +/*! +\fn DataBitsType QextSerialBase::dataBits() const +Returns the number of data bits used by the port. For a list of possible values returned by +this function, see the definition of the enum DataBitsType. +*/ +DataBitsType QextSerialBase::dataBits() const +{ + return Settings.DataBits; +} + +/*! +\fn ParityType QextSerialBase::parity() const +Returns the type of parity used by the port. For a list of possible values returned by +this function, see the definition of the enum ParityType. +*/ +ParityType QextSerialBase::parity() const +{ + return Settings.Parity; +} + +/*! +\fn StopBitsType QextSerialBase::stopBits() const +Returns the number of stop bits used by the port. For a list of possible return values, see +the definition of the enum StopBitsType. +*/ +StopBitsType QextSerialBase::stopBits() const +{ + return Settings.StopBits; +} + +/*! +\fn FlowType QextSerialBase::flowControl() const +Returns the type of flow control used by the port. For a list of possible values returned +by this function, see the definition of the enum FlowType. +*/ +FlowType QextSerialBase::flowControl() const +{ + return Settings.FlowControl; +} + +/*! +\fn bool QextSerialBase::isSequential() const +Returns true if device is sequential, otherwise returns false. Serial port is sequential device +so this function always returns true. Check QIODevice::isSequential() documentation for more +information. +*/ +bool QextSerialBase::isSequential() const +{ + return true; +} + +/*! +\fn bool QextSerialBase::atEnd() const +This function will return true if the input buffer is empty (or on error), and false otherwise. +Call QextSerialBase::lastError() for error information. +*/ +bool QextSerialBase::atEnd() const +{ + if (size()) { + return true; + } + return false; +} + +/*! +\fn qint64 QextSerialBase::readLine(char * data, qint64 maxSize) +This function will read a line of buffered input from the port, stopping when either maxSize bytes +have been read, the port has no more data available, or a newline is encountered. +The value returned is the length of the string that was read. +*/ +qint64 QextSerialBase::readLine(char * data, qint64 maxSize) +{ + qint64 numBytes = bytesAvailable(); + char* pData = data; + + if (maxSize < 2) //maxSize must be larger than 1 + return -1; + + /*read a byte at a time for MIN(bytesAvail, maxSize - 1) iterations, or until a newline*/ + while (pData<(data+numBytes) && --maxSize) { + readData(pData, 1); + if (*pData++ == '\n') { + break; + } + } + *pData='\0'; + + /*return size of data read*/ + return (pData-data); +} + +/*! +\fn ulong QextSerialBase::lastError() const +Returns the code for the last error encountered by the port, or E_NO_ERROR if the last port +operation was successful. Possible error codes are: + +\verbatim +Error Explanation +--------------------------- ------------------------------------------------------------- +E_NO_ERROR No Error has occured +E_INVALID_FD Invalid file descriptor (port was not opened correctly) +E_NO_MEMORY Unable to allocate memory tables (POSIX) +E_CAUGHT_NON_BLOCKED_SIGNAL Caught a non-blocked signal (POSIX) +E_PORT_TIMEOUT Operation timed out (POSIX) +E_INVALID_DEVICE The file opened by the port is not a character device (POSIX) +E_BREAK_CONDITION The port detected a break condition +E_FRAMING_ERROR The port detected a framing error + (usually caused by incorrect baud rate settings) +E_IO_ERROR There was an I/O error while communicating with the port +E_BUFFER_OVERRUN Character buffer overrun +E_RECEIVE_OVERFLOW Receive buffer overflow +E_RECEIVE_PARITY_ERROR The port detected a parity error in the received data +E_TRANSMIT_OVERFLOW Transmit buffer overflow +E_READ_FAILED General read operation failure +E_WRITE_FAILED General write operation failure +\endverbatim +*/ +ulong QextSerialBase::lastError() const +{ + return lastErr; +} diff --git a/qextserialbase.h b/qextserialbase.h index e1474e4..93037cb 100644 --- a/qextserialbase.h +++ b/qextserialbase.h @@ -1,258 +1,258 @@ -#ifndef _QEXTSERIALBASE_H_ -#define _QEXTSERIALBASE_H_ - -#include -#include -#include -#include - -/*if all warning messages are turned off, flag portability warnings to be turned off as well*/ -#ifdef _TTY_NOWARN_ -#define _TTY_NOWARN_PORT_ -#endif - -/*macros for thread support*/ -#define LOCK_MUTEX() mutex->lock() -#define UNLOCK_MUTEX() mutex->unlock() - -/*macros for warning and debug messages*/ -#ifdef _TTY_NOWARN_PORT_ -#define TTY_PORTABILITY_WARNING(s) -#else -#define TTY_PORTABILITY_WARNING(s) qWarning(s) -#endif /*_TTY_NOWARN_PORT_*/ -#ifdef _TTY_NOWARN_ -#define TTY_WARNING(s) -#else -#define TTY_WARNING(s) qWarning(s) -#endif /*_TTY_NOWARN_*/ - - -/*line status constants*/ -#define LS_CTS 0x01 -#define LS_DSR 0x02 -#define LS_DCD 0x04 -#define LS_RI 0x08 -#define LS_RTS 0x10 -#define LS_DTR 0x20 -#define LS_ST 0x40 -#define LS_SR 0x80 - -/*error constants*/ -#define E_NO_ERROR 0 -#define E_INVALID_FD 1 -#define E_NO_MEMORY 2 -#define E_CAUGHT_NON_BLOCKED_SIGNAL 3 -#define E_PORT_TIMEOUT 4 -#define E_INVALID_DEVICE 5 -#define E_BREAK_CONDITION 6 -#define E_FRAMING_ERROR 7 -#define E_IO_ERROR 8 -#define E_BUFFER_OVERRUN 9 -#define E_RECEIVE_OVERFLOW 10 -#define E_RECEIVE_PARITY_ERROR 11 -#define E_TRANSMIT_OVERFLOW 12 -#define E_READ_FAILED 13 -#define E_WRITE_FAILED 14 - -/*! - * Enums for port settings. - */ -enum NamingConvention -{ - WIN_NAMES, - IRIX_NAMES, - HPUX_NAMES, - SUN_NAMES, - DIGITAL_NAMES, - FREEBSD_NAMES, - LINUX_NAMES -}; - -enum BaudRateType -{ - BAUD50, //POSIX ONLY - BAUD75, //POSIX ONLY - BAUD110, - BAUD134, //POSIX ONLY - BAUD150, //POSIX ONLY - BAUD200, //POSIX ONLY - BAUD300, - BAUD600, - BAUD1200, - BAUD1800, //POSIX ONLY - BAUD2400, - BAUD4800, - BAUD9600, - BAUD14400, //WINDOWS ONLY - BAUD19200, - BAUD38400, - BAUD56000, //WINDOWS ONLY - BAUD57600, - BAUD76800, //POSIX ONLY - BAUD115200, - BAUD128000, //WINDOWS ONLY - BAUD256000 //WINDOWS ONLY -}; - -enum DataBitsType -{ - DATA_5, - DATA_6, - DATA_7, - DATA_8 -}; - -enum ParityType -{ - PAR_NONE, - PAR_ODD, - PAR_EVEN, - PAR_MARK, //WINDOWS ONLY - PAR_SPACE -}; - -enum StopBitsType -{ - STOP_1, - STOP_1_5, //WINDOWS ONLY - STOP_2 -}; - -enum FlowType -{ - FLOW_OFF, - FLOW_HARDWARE, - FLOW_XONXOFF -}; - -/** - * structure to contain port settings - */ -struct PortSettings -{ - BaudRateType BaudRate; - DataBitsType DataBits; - ParityType Parity; - StopBitsType StopBits; - FlowType FlowControl; - long Timeout_Millisec; -}; - -/*! - * \author Stefan Sander - * \author Michal Policht - * - * A common base class for Win_QextSerialBase, Posix_QextSerialBase and QextSerialPort. - */ -class QextSerialBase : public QIODevice -{ - Q_OBJECT - - public: - enum QueryMode { - Polling, - EventDriven - }; - - protected: - QMutex* mutex; - QString port; - PortSettings Settings; - ulong lastErr; - QextSerialBase::QueryMode _queryMode; - - virtual qint64 readData(char * data, qint64 maxSize)=0; - virtual qint64 writeData(const char * data, qint64 maxSize)=0; - - public: - QextSerialBase(); - QextSerialBase(const QString & name); - virtual ~QextSerialBase(); - virtual void construct(); - virtual void setPortName(const QString & name); - virtual QString portName() const; - - /**! - * Get query mode. - * \return query mode. - */ - inline QextSerialBase::QueryMode queryMode() const { return _queryMode; }; - - /*! - * Set desired serial communication handling style. You may choose from polling - * or event driven approach. This function does nothing when port is open; to - * apply changes port must be reopened. - * - * In event driven approach read() and write() functions are acting - * asynchronously. They return immediately and the operation is performed in - * the background, so they doesn't freeze the calling thread. - * To determine when operation is finished, QextSerialPort runs separate thread - * and monitors serial port events. Whenever the event occurs, adequate signal - * is emitted. - * - * When polling is set, read() and write() are acting synchronously. Signals are - * not working in this mode and some functions may not be available. The advantage - * of polling is that it generates less overhead due to lack of signals emissions - * and it doesn't start separate thread to monitor events. - * - * Generally event driven approach is more capable and friendly, although some - * applications may need as low overhead as possible and then polling comes. - * - * \param mode query mode. - */ - virtual void setQueryMode(QueryMode mode); - -// virtual void setBlockingRead(bool block) = 0; ///< @todo implement. - - virtual void setBaudRate(BaudRateType)=0; - virtual BaudRateType baudRate() const; - virtual void setDataBits(DataBitsType)=0; - virtual DataBitsType dataBits() const; - virtual void setParity(ParityType)=0; - virtual ParityType parity() const; - virtual void setStopBits(StopBitsType)=0; - virtual StopBitsType stopBits() const; - virtual void setFlowControl(FlowType)=0; - virtual FlowType flowControl() const; - virtual void setTimeout(long)=0; - - virtual bool open(OpenMode mode)=0; - virtual bool isSequential() const; - virtual void close()=0; - virtual void flush()=0; - - virtual qint64 size() const=0; - virtual qint64 bytesAvailable()=0; - virtual bool atEnd() const; - - virtual void ungetChar(char c)=0; - virtual qint64 readLine(char * data, qint64 maxSize); - - virtual ulong lastError() const; - virtual void translateError(ulong error)=0; - - virtual void setDtr(bool set=true)=0; - virtual void setRts(bool set=true)=0; - virtual ulong lineStatus()=0; - - signals: - /** - * This signal is emitted whenever port settings are updated. - * \param valid \p true if settings are valid, \p false otherwise. - * - * @todo implement. - */ -// void validSettings(bool valid); - - /*! - * This signal is emitted whenever dsr line has changed its state. You may - * use this signal to check if device is connected. - * \param status \p true when DSR signal is on, \p false otherwise. - * - * \see lineStatus(). - */ - void dsrChanged(bool status); -}; - -#endif +#ifndef _QEXTSERIALBASE_H_ +#define _QEXTSERIALBASE_H_ + +#include +#include +#include +#include + +/*if all warning messages are turned off, flag portability warnings to be turned off as well*/ +#ifdef _TTY_NOWARN_ +#define _TTY_NOWARN_PORT_ +#endif + +/*macros for thread support*/ +#define LOCK_MUTEX() mutex->lock() +#define UNLOCK_MUTEX() mutex->unlock() + +/*macros for warning and debug messages*/ +#ifdef _TTY_NOWARN_PORT_ +#define TTY_PORTABILITY_WARNING(s) +#else +#define TTY_PORTABILITY_WARNING(s) qWarning(s) +#endif /*_TTY_NOWARN_PORT_*/ +#ifdef _TTY_NOWARN_ +#define TTY_WARNING(s) +#else +#define TTY_WARNING(s) qWarning(s) +#endif /*_TTY_NOWARN_*/ + + +/*line status constants*/ +#define LS_CTS 0x01 +#define LS_DSR 0x02 +#define LS_DCD 0x04 +#define LS_RI 0x08 +#define LS_RTS 0x10 +#define LS_DTR 0x20 +#define LS_ST 0x40 +#define LS_SR 0x80 + +/*error constants*/ +#define E_NO_ERROR 0 +#define E_INVALID_FD 1 +#define E_NO_MEMORY 2 +#define E_CAUGHT_NON_BLOCKED_SIGNAL 3 +#define E_PORT_TIMEOUT 4 +#define E_INVALID_DEVICE 5 +#define E_BREAK_CONDITION 6 +#define E_FRAMING_ERROR 7 +#define E_IO_ERROR 8 +#define E_BUFFER_OVERRUN 9 +#define E_RECEIVE_OVERFLOW 10 +#define E_RECEIVE_PARITY_ERROR 11 +#define E_TRANSMIT_OVERFLOW 12 +#define E_READ_FAILED 13 +#define E_WRITE_FAILED 14 + +/*! + * Enums for port settings. + */ +enum NamingConvention +{ + WIN_NAMES, + IRIX_NAMES, + HPUX_NAMES, + SUN_NAMES, + DIGITAL_NAMES, + FREEBSD_NAMES, + LINUX_NAMES +}; + +enum BaudRateType +{ + BAUD50, //POSIX ONLY + BAUD75, //POSIX ONLY + BAUD110, + BAUD134, //POSIX ONLY + BAUD150, //POSIX ONLY + BAUD200, //POSIX ONLY + BAUD300, + BAUD600, + BAUD1200, + BAUD1800, //POSIX ONLY + BAUD2400, + BAUD4800, + BAUD9600, + BAUD14400, //WINDOWS ONLY + BAUD19200, + BAUD38400, + BAUD56000, //WINDOWS ONLY + BAUD57600, + BAUD76800, //POSIX ONLY + BAUD115200, + BAUD128000, //WINDOWS ONLY + BAUD256000 //WINDOWS ONLY +}; + +enum DataBitsType +{ + DATA_5, + DATA_6, + DATA_7, + DATA_8 +}; + +enum ParityType +{ + PAR_NONE, + PAR_ODD, + PAR_EVEN, + PAR_MARK, //WINDOWS ONLY + PAR_SPACE +}; + +enum StopBitsType +{ + STOP_1, + STOP_1_5, //WINDOWS ONLY + STOP_2 +}; + +enum FlowType +{ + FLOW_OFF, + FLOW_HARDWARE, + FLOW_XONXOFF +}; + +/** + * structure to contain port settings + */ +struct PortSettings +{ + BaudRateType BaudRate; + DataBitsType DataBits; + ParityType Parity; + StopBitsType StopBits; + FlowType FlowControl; + long Timeout_Millisec; +}; + +/*! + * \author Stefan Sander + * \author Michal Policht + * + * A common base class for Win_QextSerialBase, Posix_QextSerialBase and QextSerialPort. + */ +class QextSerialBase : public QIODevice +{ + Q_OBJECT + + public: + enum QueryMode { + Polling, + EventDriven + }; + + protected: + QMutex* mutex; + QString port; + PortSettings Settings; + ulong lastErr; + QextSerialBase::QueryMode _queryMode; + + virtual qint64 readData(char * data, qint64 maxSize)=0; + virtual qint64 writeData(const char * data, qint64 maxSize)=0; + + public: + QextSerialBase(); + QextSerialBase(const QString & name); + virtual ~QextSerialBase(); + virtual void construct(); + virtual void setPortName(const QString & name); + virtual QString portName() const; + + /**! + * Get query mode. + * \return query mode. + */ + inline QextSerialBase::QueryMode queryMode() const { return _queryMode; }; + + /*! + * Set desired serial communication handling style. You may choose from polling + * or event driven approach. This function does nothing when port is open; to + * apply changes port must be reopened. + * + * In event driven approach read() and write() functions are acting + * asynchronously. They return immediately and the operation is performed in + * the background, so they doesn't freeze the calling thread. + * To determine when operation is finished, QextSerialPort runs separate thread + * and monitors serial port events. Whenever the event occurs, adequate signal + * is emitted. + * + * When polling is set, read() and write() are acting synchronously. Signals are + * not working in this mode and some functions may not be available. The advantage + * of polling is that it generates less overhead due to lack of signals emissions + * and it doesn't start separate thread to monitor events. + * + * Generally event driven approach is more capable and friendly, although some + * applications may need as low overhead as possible and then polling comes. + * + * \param mode query mode. + */ + virtual void setQueryMode(QueryMode mode); + +// virtual void setBlockingRead(bool block) = 0; ///< @todo implement. + + virtual void setBaudRate(BaudRateType)=0; + virtual BaudRateType baudRate() const; + virtual void setDataBits(DataBitsType)=0; + virtual DataBitsType dataBits() const; + virtual void setParity(ParityType)=0; + virtual ParityType parity() const; + virtual void setStopBits(StopBitsType)=0; + virtual StopBitsType stopBits() const; + virtual void setFlowControl(FlowType)=0; + virtual FlowType flowControl() const; + virtual void setTimeout(long)=0; + + virtual bool open(OpenMode mode)=0; + virtual bool isSequential() const; + virtual void close()=0; + virtual void flush()=0; + + virtual qint64 size() const=0; + virtual qint64 bytesAvailable()=0; + virtual bool atEnd() const; + + virtual void ungetChar(char c)=0; + virtual qint64 readLine(char * data, qint64 maxSize); + + virtual ulong lastError() const; + virtual void translateError(ulong error)=0; + + virtual void setDtr(bool set=true)=0; + virtual void setRts(bool set=true)=0; + virtual ulong lineStatus()=0; + + signals: + /** + * This signal is emitted whenever port settings are updated. + * \param valid \p true if settings are valid, \p false otherwise. + * + * @todo implement. + */ +// void validSettings(bool valid); + + /*! + * This signal is emitted whenever dsr line has changed its state. You may + * use this signal to check if device is connected. + * \param status \p true when DSR signal is on, \p false otherwise. + * + * \see lineStatus(). + */ + void dsrChanged(bool status); +}; + +#endif diff --git a/qjson/qjson-backport_global.h b/qjson/qjson-backport_global.h index dcc7866..2538e1a 100644 --- a/qjson/qjson-backport_global.h +++ b/qjson/qjson-backport_global.h @@ -1,12 +1,12 @@ -#ifndef QJSONBACKPORT_GLOBAL_H -#define QJSONBACKPORT_GLOBAL_H - -#include - -#if defined(QJSONBACKPORT_LIBRARY) -# define QJSONBACKPORTSHARED_EXPORT Q_DECL_EXPORT -#else -# define QJSONBACKPORTSHARED_EXPORT Q_DECL_IMPORT -#endif - -#endif // QJSONBACKPORT_GLOBAL_H +#ifndef QJSONBACKPORT_GLOBAL_H +#define QJSONBACKPORT_GLOBAL_H + +#include + +#if defined(QJSONBACKPORT_LIBRARY) +# define QJSONBACKPORTSHARED_EXPORT Q_DECL_EXPORT +#else +# define QJSONBACKPORTSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // QJSONBACKPORT_GLOBAL_H diff --git a/qjson/qjson.cpp b/qjson/qjson.cpp index 4f7372a..3875033 100644 --- a/qjson/qjson.cpp +++ b/qjson/qjson.cpp @@ -1,427 +1,427 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjson_p.h" -#include - -QT_BEGIN_NAMESPACE - -namespace QJsonPrivate -{ - -#ifdef Q_LITTLE_ENDIAN -#define Q_TO_LITTLE_ENDIAN(x) (x) -#else -#define Q_TO_LITTLE_ENDIAN(x) ( ((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | ((x & 0xff000000) >> 24) ) -#endif - -static const Base emptyArray = { { Q_TO_LITTLE_ENDIAN(sizeof(Base)) }, { 0 }, { 0 } }; -static const Base emptyObject = { { Q_TO_LITTLE_ENDIAN(sizeof(Base)) }, { 0 }, { 0 } }; - - -void Data::compact() -{ - Q_ASSERT(sizeof(Value) == sizeof(offset)); - - if (!compactionCounter) - return; - - Base *base = header->root(); - int reserve = 0; - if (base->is_object) { - Object *o = static_cast(base); - for (int i = 0; i < (int)o->length; ++i) - reserve += o->entryAt(i)->usedStorage(o); - } else { - Array *a = static_cast(base); - for (int i = 0; i < (int)a->length; ++i) - reserve += (*a)[i].usedStorage(a); - } - - int size = sizeof(Base) + reserve + base->length*sizeof(offset); - int alloc = sizeof(Header) + size; - Header *h = (Header *) malloc(alloc); - h->tag = QJsonDocument::BinaryFormatTag; - h->version = 1; - Base *b = h->root(); - b->size = size; - b->is_object = header->root()->is_object; - b->length = base->length; - b->tableOffset = reserve + sizeof(Array); - - int offset = sizeof(Base); - if (b->is_object) { - Object *o = static_cast(base); - Object *no = static_cast(b); - - for (int i = 0; i < (int)o->length; ++i) { - no->table()[i] = offset; - - const Entry *e = o->entryAt(i); - Entry *ne = no->entryAt(i); - int s = e->size(); - memcpy(ne, e, s); - offset += s; - int dataSize = e->value.usedStorage(o); - if (dataSize) { - memcpy((char *)no + offset, e->value.data(o), dataSize); - ne->value.value = offset; - offset += dataSize; - } - } - } else { - Array *a = static_cast(base); - Array *na = static_cast(b); - - for (int i = 0; i < (int)a->length; ++i) { - const Value &v = (*a)[i]; - Value &nv = (*na)[i]; - nv = v; - int dataSize = v.usedStorage(a); - if (dataSize) { - memcpy((char *)na + offset, v.data(a), dataSize); - nv.value = offset; - offset += dataSize; - } - } - } - Q_ASSERT(offset == (int)b->tableOffset); - - free(header); - header = h; - this->alloc = alloc; - compactionCounter = 0; -} - -bool Data::valid() const -{ - if (header->tag != QJsonDocument::BinaryFormatTag || header->version != 1u) - return false; - - bool res = false; - if (header->root()->is_object) - res = static_cast(header->root())->isValid(); - else - res = static_cast(header->root())->isValid(); - - return res; -} - - -int Base::reserveSpace(uint dataSize, int posInTable, uint numItems, bool replace) -{ - Q_ASSERT(posInTable >= 0 && posInTable <= (int)length); - - offset off = tableOffset; - // move table to new position - if (replace) { - memmove((char *)(table()) + dataSize, table(), length*sizeof(offset)); - } else { - memmove((char *)(table() + posInTable + numItems) + dataSize, table() + posInTable, (length - posInTable)*sizeof(offset)); - memmove((char *)(table()) + dataSize, table(), posInTable*sizeof(offset)); - } - tableOffset += dataSize; - for (int i = 0; i < (int)numItems; ++i) - table()[posInTable + i] = off; - size += dataSize; - if (!replace) { - length += numItems; - size += numItems * sizeof(offset); - } - return off; -} - -void Base::removeItems(int pos, int numItems) -{ - Q_ASSERT(pos >= 0 && pos <= (int)length); - if (pos + numItems < (int)length) - memmove(table() + pos, table() + pos + numItems, (length - pos - numItems)*sizeof(offset)); - length -= numItems; -} - -int Object::indexOf(const QString &key, bool *exists) -{ - int min = 0; - int n = length; - while (n > 0) { - int half = n >> 1; - int middle = min + half; - if (*entryAt(middle) >= key) { - n = half; - } else { - min = middle + 1; - n -= half + 1; - } - } - if (min < (int)length && *entryAt(min) == key) { - *exists = true; - return min; - } - *exists = false; - return min; -} - -bool Object::isValid() const -{ - if (tableOffset + length*sizeof(offset) > size) - return false; - - for (uint i = 0; i < length; ++i) { - offset entryOffset = table()[i]; - if (entryOffset + sizeof(Entry) >= tableOffset) - return false; - Entry *e = entryAt(i); - int s = e->size(); - if (table()[i] + s > tableOffset) - return false; - if (!e->value.isValid(this)) - return false; - } - return true; -} - - - -bool Array::isValid() const -{ - if (tableOffset + length*sizeof(offset) > size) - return false; - - for (uint i = 0; i < length; ++i) { - if (!at(i).isValid(this)) - return false; - } - return true; -} - - -bool Entry::operator ==(const QString &key) const -{ - if (value.latinKey) - return (shallowLatin1Key() == key); - else - return (shallowKey() == key); -} - -bool Entry::operator >=(const QString &key) const -{ - if (value.latinKey) - return (shallowLatin1Key() >= key); - else - return (shallowKey() >= key); -} - -bool Entry::operator ==(const Entry &other) const -{ - if (value.latinKey) { - if (other.value.latinKey) - return shallowLatin1Key() == other.shallowLatin1Key(); - return shallowLatin1Key() == other.shallowKey(); - } else if (other.value.latinKey) { - return shallowKey() == other.shallowLatin1Key(); - } - return shallowKey() == other.shallowKey(); -} - -bool Entry::operator >=(const Entry &other) const -{ - if (value.latinKey) { - if (other.value.latinKey) - return shallowLatin1Key() >= other.shallowLatin1Key(); - return shallowLatin1Key() >= other.shallowKey(); - } else if (other.value.latinKey) { - return shallowKey() >= other.shallowLatin1Key(); - } - return shallowKey() >= other.shallowKey(); -} - - -int Value::usedStorage(const Base *b) const -{ - int s = 0; - switch (type) { - case QJsonValue::Double: - if (latinOrIntValue) - break; - s = sizeof(double); - break; - case QJsonValue::String: { - char *d = data(b); - if (latinOrIntValue) - s = sizeof(ushort) + *(ushort *)d; - else - s = sizeof(int) + sizeof(ushort)*(*(int *)d); - break; - } - case QJsonValue::Array: - case QJsonValue::Object: - s = base(b)->size; - break; - case QJsonValue::Null: - case QJsonValue::Bool: - default: - break; - } - return alignedSize(s); -} - -bool Value::isValid(const Base *b) const -{ - int offset = 0; - switch (type) { - case QJsonValue::Double: - if (latinOrIntValue) - break; - // fall through - case QJsonValue::String: - case QJsonValue::Array: - case QJsonValue::Object: - offset = value; - break; - case QJsonValue::Null: - case QJsonValue::Bool: - default: - break; - } - - if (!offset) - return true; - if (offset + sizeof(uint) > b->tableOffset) - return false; - - int s = usedStorage(b); - if (!s) - return true; - if (s < 0 || offset + s > (int)b->tableOffset) - return false; - if (type == QJsonValue::Array) - return static_cast(base(b))->isValid(); - if (type == QJsonValue::Object) - return static_cast(base(b))->isValid(); - return true; -} - -/*! - \internal - */ -int Value::requiredStorage(const QJsonValue &v, bool *compressed) -{ - *compressed = false; - switch (v.t) { - case QJsonValue::Double: - if (QJsonPrivate::compressedNumber(v.dbl) != INT_MAX) { - *compressed = true; - return 0; - } - return sizeof(double); - case QJsonValue::String: { - QString s = v.toString(); - *compressed = QJsonPrivate::useCompressed(s); - return QJsonPrivate::qStringSize(s, *compressed); - } - case QJsonValue::Array: - case QJsonValue::Object: - return v.base ? v.base->size : sizeof(QJsonPrivate::Base); - case QJsonValue::Undefined: - case QJsonValue::Null: - case QJsonValue::Bool: - break; - } - return 0; -} - -/*! - \internal - */ -uint Value::valueToStore(const QJsonValue &v, uint offset) -{ - switch (v.t) { - case QJsonValue::Undefined: - case QJsonValue::Null: - break; - case QJsonValue::Bool: - return v.b; - case QJsonValue::Double: { - int c = QJsonPrivate::compressedNumber(v.dbl); - if (c != INT_MAX) - return c; - } - // fall through - case QJsonValue::String: - case QJsonValue::Array: - case QJsonValue::Object: - return offset; - } - return 0; -} - -/*! - \internal - */ -void Value::copyData(const QJsonValue &v, char *dest, bool compressed) -{ - switch (v.t) { - case QJsonValue::Double: - if (!compressed) { - qToLittleEndian(v.ui, (uchar *)dest); - } - break; - case QJsonValue::String: { - QString str = v.toString(); - QJsonPrivate::copyString(dest, str, compressed); - break; - } - case QJsonValue::Array: - case QJsonValue::Object: { - const QJsonPrivate::Base *b = v.base; - if (!b) - b = (v.t == QJsonValue::Array ? &emptyArray : &emptyObject); - memcpy(dest, b, b->size); - break; - } - default: - break; - } -} - -} // namespace QJsonPrivate - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjson_p.h" +#include + +QT_BEGIN_NAMESPACE + +namespace QJsonPrivate +{ + +#ifdef Q_LITTLE_ENDIAN +#define Q_TO_LITTLE_ENDIAN(x) (x) +#else +#define Q_TO_LITTLE_ENDIAN(x) ( ((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | ((x & 0xff000000) >> 24) ) +#endif + +static const Base emptyArray = { { Q_TO_LITTLE_ENDIAN(sizeof(Base)) }, { 0 }, { 0 } }; +static const Base emptyObject = { { Q_TO_LITTLE_ENDIAN(sizeof(Base)) }, { 0 }, { 0 } }; + + +void Data::compact() +{ + Q_ASSERT(sizeof(Value) == sizeof(offset)); + + if (!compactionCounter) + return; + + Base *base = header->root(); + int reserve = 0; + if (base->is_object) { + Object *o = static_cast(base); + for (int i = 0; i < (int)o->length; ++i) + reserve += o->entryAt(i)->usedStorage(o); + } else { + Array *a = static_cast(base); + for (int i = 0; i < (int)a->length; ++i) + reserve += (*a)[i].usedStorage(a); + } + + int size = sizeof(Base) + reserve + base->length*sizeof(offset); + int alloc = sizeof(Header) + size; + Header *h = (Header *) malloc(alloc); + h->tag = QJsonDocument::BinaryFormatTag; + h->version = 1; + Base *b = h->root(); + b->size = size; + b->is_object = header->root()->is_object; + b->length = base->length; + b->tableOffset = reserve + sizeof(Array); + + int offset = sizeof(Base); + if (b->is_object) { + Object *o = static_cast(base); + Object *no = static_cast(b); + + for (int i = 0; i < (int)o->length; ++i) { + no->table()[i] = offset; + + const Entry *e = o->entryAt(i); + Entry *ne = no->entryAt(i); + int s = e->size(); + memcpy(ne, e, s); + offset += s; + int dataSize = e->value.usedStorage(o); + if (dataSize) { + memcpy((char *)no + offset, e->value.data(o), dataSize); + ne->value.value = offset; + offset += dataSize; + } + } + } else { + Array *a = static_cast(base); + Array *na = static_cast(b); + + for (int i = 0; i < (int)a->length; ++i) { + const Value &v = (*a)[i]; + Value &nv = (*na)[i]; + nv = v; + int dataSize = v.usedStorage(a); + if (dataSize) { + memcpy((char *)na + offset, v.data(a), dataSize); + nv.value = offset; + offset += dataSize; + } + } + } + Q_ASSERT(offset == (int)b->tableOffset); + + free(header); + header = h; + this->alloc = alloc; + compactionCounter = 0; +} + +bool Data::valid() const +{ + if (header->tag != QJsonDocument::BinaryFormatTag || header->version != 1u) + return false; + + bool res = false; + if (header->root()->is_object) + res = static_cast(header->root())->isValid(); + else + res = static_cast(header->root())->isValid(); + + return res; +} + + +int Base::reserveSpace(uint dataSize, int posInTable, uint numItems, bool replace) +{ + Q_ASSERT(posInTable >= 0 && posInTable <= (int)length); + + offset off = tableOffset; + // move table to new position + if (replace) { + memmove((char *)(table()) + dataSize, table(), length*sizeof(offset)); + } else { + memmove((char *)(table() + posInTable + numItems) + dataSize, table() + posInTable, (length - posInTable)*sizeof(offset)); + memmove((char *)(table()) + dataSize, table(), posInTable*sizeof(offset)); + } + tableOffset += dataSize; + for (int i = 0; i < (int)numItems; ++i) + table()[posInTable + i] = off; + size += dataSize; + if (!replace) { + length += numItems; + size += numItems * sizeof(offset); + } + return off; +} + +void Base::removeItems(int pos, int numItems) +{ + Q_ASSERT(pos >= 0 && pos <= (int)length); + if (pos + numItems < (int)length) + memmove(table() + pos, table() + pos + numItems, (length - pos - numItems)*sizeof(offset)); + length -= numItems; +} + +int Object::indexOf(const QString &key, bool *exists) +{ + int min = 0; + int n = length; + while (n > 0) { + int half = n >> 1; + int middle = min + half; + if (*entryAt(middle) >= key) { + n = half; + } else { + min = middle + 1; + n -= half + 1; + } + } + if (min < (int)length && *entryAt(min) == key) { + *exists = true; + return min; + } + *exists = false; + return min; +} + +bool Object::isValid() const +{ + if (tableOffset + length*sizeof(offset) > size) + return false; + + for (uint i = 0; i < length; ++i) { + offset entryOffset = table()[i]; + if (entryOffset + sizeof(Entry) >= tableOffset) + return false; + Entry *e = entryAt(i); + int s = e->size(); + if (table()[i] + s > tableOffset) + return false; + if (!e->value.isValid(this)) + return false; + } + return true; +} + + + +bool Array::isValid() const +{ + if (tableOffset + length*sizeof(offset) > size) + return false; + + for (uint i = 0; i < length; ++i) { + if (!at(i).isValid(this)) + return false; + } + return true; +} + + +bool Entry::operator ==(const QString &key) const +{ + if (value.latinKey) + return (shallowLatin1Key() == key); + else + return (shallowKey() == key); +} + +bool Entry::operator >=(const QString &key) const +{ + if (value.latinKey) + return (shallowLatin1Key() >= key); + else + return (shallowKey() >= key); +} + +bool Entry::operator ==(const Entry &other) const +{ + if (value.latinKey) { + if (other.value.latinKey) + return shallowLatin1Key() == other.shallowLatin1Key(); + return shallowLatin1Key() == other.shallowKey(); + } else if (other.value.latinKey) { + return shallowKey() == other.shallowLatin1Key(); + } + return shallowKey() == other.shallowKey(); +} + +bool Entry::operator >=(const Entry &other) const +{ + if (value.latinKey) { + if (other.value.latinKey) + return shallowLatin1Key() >= other.shallowLatin1Key(); + return shallowLatin1Key() >= other.shallowKey(); + } else if (other.value.latinKey) { + return shallowKey() >= other.shallowLatin1Key(); + } + return shallowKey() >= other.shallowKey(); +} + + +int Value::usedStorage(const Base *b) const +{ + int s = 0; + switch (type) { + case QJsonValue::Double: + if (latinOrIntValue) + break; + s = sizeof(double); + break; + case QJsonValue::String: { + char *d = data(b); + if (latinOrIntValue) + s = sizeof(ushort) + *(ushort *)d; + else + s = sizeof(int) + sizeof(ushort)*(*(int *)d); + break; + } + case QJsonValue::Array: + case QJsonValue::Object: + s = base(b)->size; + break; + case QJsonValue::Null: + case QJsonValue::Bool: + default: + break; + } + return alignedSize(s); +} + +bool Value::isValid(const Base *b) const +{ + int offset = 0; + switch (type) { + case QJsonValue::Double: + if (latinOrIntValue) + break; + // fall through + case QJsonValue::String: + case QJsonValue::Array: + case QJsonValue::Object: + offset = value; + break; + case QJsonValue::Null: + case QJsonValue::Bool: + default: + break; + } + + if (!offset) + return true; + if (offset + sizeof(uint) > b->tableOffset) + return false; + + int s = usedStorage(b); + if (!s) + return true; + if (s < 0 || offset + s > (int)b->tableOffset) + return false; + if (type == QJsonValue::Array) + return static_cast(base(b))->isValid(); + if (type == QJsonValue::Object) + return static_cast(base(b))->isValid(); + return true; +} + +/*! + \internal + */ +int Value::requiredStorage(const QJsonValue &v, bool *compressed) +{ + *compressed = false; + switch (v.t) { + case QJsonValue::Double: + if (QJsonPrivate::compressedNumber(v.dbl) != INT_MAX) { + *compressed = true; + return 0; + } + return sizeof(double); + case QJsonValue::String: { + QString s = v.toString(); + *compressed = QJsonPrivate::useCompressed(s); + return QJsonPrivate::qStringSize(s, *compressed); + } + case QJsonValue::Array: + case QJsonValue::Object: + return v.base ? v.base->size : sizeof(QJsonPrivate::Base); + case QJsonValue::Undefined: + case QJsonValue::Null: + case QJsonValue::Bool: + break; + } + return 0; +} + +/*! + \internal + */ +uint Value::valueToStore(const QJsonValue &v, uint offset) +{ + switch (v.t) { + case QJsonValue::Undefined: + case QJsonValue::Null: + break; + case QJsonValue::Bool: + return v.b; + case QJsonValue::Double: { + int c = QJsonPrivate::compressedNumber(v.dbl); + if (c != INT_MAX) + return c; + } + // fall through + case QJsonValue::String: + case QJsonValue::Array: + case QJsonValue::Object: + return offset; + } + return 0; +} + +/*! + \internal + */ +void Value::copyData(const QJsonValue &v, char *dest, bool compressed) +{ + switch (v.t) { + case QJsonValue::Double: + if (!compressed) { + qToLittleEndian(v.ui, (uchar *)dest); + } + break; + case QJsonValue::String: { + QString str = v.toString(); + QJsonPrivate::copyString(dest, str, compressed); + break; + } + case QJsonValue::Array: + case QJsonValue::Object: { + const QJsonPrivate::Base *b = v.base; + if (!b) + b = (v.t == QJsonValue::Array ? &emptyArray : &emptyObject); + memcpy(dest, b, b->size); + break; + } + default: + break; + } +} + +} // namespace QJsonPrivate + +QT_END_NAMESPACE diff --git a/qjson/qjson_p.h b/qjson/qjson_p.h index d83db7e..3a97dce 100644 --- a/qjson/qjson_p.h +++ b/qjson/qjson_p.h @@ -1,765 +1,765 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSON_P_H -#define QJSON_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qjsonexport.h" -#include "qjsonobject.h" -#include "qjsonvalue.h" -#include "qjsondocument.h" -#include "qjsonarray.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -/* - This defines a binary data structure for Json data. The data structure is optimised for fast reading - and minimum allocations. The whole data structure can be mmap'ed and used directly. - - In most cases the binary structure is not as space efficient as a utf8 encoded text representation, but - much faster to access. - - The size requirements are: - - String: - Latin1 data: 2 bytes header + string.length() - Full Unicode: 4 bytes header + 2*(string.length()) - - Values: 4 bytes + size of data (size can be 0 for some data) - bool: 0 bytes - double: 8 bytes (0 if integer with less than 27bits) - string: see above - array: size of array - object: size of object - Array: 12 bytes + 4*length + size of Value data - Object: 12 bytes + 8*length + size of Key Strings + size of Value data - - For an example such as - - { // object: 12 + 5*8 = 52 - "firstName": "John", // key 12, value 8 = 20 - "lastName" : "Smith", // key 12, value 8 = 20 - "age" : 25, // key 8, value 0 = 8 - "address" : // key 12, object below = 140 - { // object: 12 + 4*8 - "streetAddress": "21 2nd Street", // key 16, value 16 - "city" : "New York", // key 8, value 12 - "state" : "NY", // key 8, value 4 - "postalCode" : "10021" // key 12, value 8 - }, // object total: 128 - "phoneNumber": // key: 16, value array below = 172 - [ // array: 12 + 2*4 + values below: 156 - { // object 12 + 2*8 - "type" : "home", // key 8, value 8 - "number": "212 555-1234" // key 8, value 16 - }, // object total: 68 - { // object 12 + 2*8 - "type" : "fax", // key 8, value 8 - "number": "646 555-4567" // key 8, value 16 - } // object total: 68 - ] // array total: 156 - } // great total: 412 bytes - - The uncompressed text file used roughly 500 bytes, so in this case we end up using about - the same space as the text representation. - - Other measurements have shown a slightly bigger binary size than a compact text - representation where all possible whitespace was stripped out. -*/ -namespace QJsonPrivate { - -class Array; -class Object; -class Value; -class Entry; - -template -class q_littleendian -{ -public: - T val; - - q_littleendian &operator =(T i) { val = qToLittleEndian(i); return *this; } - operator T() const { return qFromLittleEndian(val); } - - bool operator ==(T i) { return qFromLittleEndian(val) == i; } - bool operator !=(T i) { return qFromLittleEndian(val) != i; } - bool operator ==(q_littleendian i) { return val == i.val; } - bool operator !=(q_littleendian i) { return val != i.val; } - bool operator <(T i) { return qFromLittleEndian(val) < i; } - bool operator >(T i) { return qFromLittleEndian(val) > i; } - bool operator <=(T i) { return qFromLittleEndian(val) <= i; } - bool operator >=(T i) { return qFromLittleEndian(val) >= i; } - q_littleendian &operator +=(T i) { - val = qToLittleEndian(qFromLittleEndian(val) + i); - return *this; - } -}; - -typedef q_littleendian qle_short; -typedef q_littleendian qle_ushort; -typedef q_littleendian qle_int; -typedef q_littleendian qle_uint; - -template -class qle_bitfield -{ -public: - uint val; - - enum { - mask = ((1u << width) - 1) << pos - }; - - void operator =(uint t) { - uint i = qFromLittleEndian(val); - i &= ~mask; - i |= t << pos; - val = qToLittleEndian(i); - } - operator uint() const { - uint t = qFromLittleEndian(val); - t &= mask; - t >>= pos; - return t; - } - bool operator !() const { - return !operator uint(); - } - - bool operator ==(uint t) { return uint(*this) == t; } - bool operator !=(uint t) { return uint(*this) != t; } - bool operator <(uint t) { return uint(*this) < t; } - bool operator >(uint t) { return uint(*this) > t; } - bool operator <=(uint t) { return uint(*this) <= t; } - bool operator >=(uint t) { return uint(*this) >= t; } - qle_bitfield &operator +=(uint i) { - *this = (uint(*this) + i); - return *this; - } - qle_bitfield &operator -=(uint i) { - *this = (uint(*this) - i); - return *this; - } -}; - -template -class qle_signedbitfield -{ -public: - uint val; - - enum { - mask = ((1u << width) - 1) << pos - }; - - void operator =(int t) { - uint i = qFromLittleEndian(val); - i &= ~mask; - i |= t << pos; - val = qToLittleEndian(i); - } - operator int() const { - uint i = qFromLittleEndian(val); - i <<= 32 - width - pos; - int t = (int) i; - t >>= pos; - return t; - } - bool operator !() const { - return !operator int(); - } - - bool operator ==(int t) { return int(*this) == t; } - bool operator !=(int t) { return int(*this) != t; } - bool operator <(int t) { return int(*this) < t; } - bool operator >(int t) { return int(*this) > t; } - bool operator <=(int t) { return int(*this) <= t; } - bool operator >=(int t) { return int(*this) >= t; } - qle_signedbitfield &operator +=(int i) { - *this = (int(*this) + i); - return *this; - } - qle_signedbitfield &operator -=(int i) { - *this = (int(*this) - i); - return *this; - } -}; - -typedef qle_uint offset; - -// round the size up to the next 4 byte boundary -inline int alignedSize(int size) { return (size + 3) & ~3; } - -static inline bool useCompressed(const QString &s) -{ - if (s.length() >= 0x8000) - return false; - const ushort *uc = (const ushort *)s.constData(); - const ushort *e = uc + s.length(); - while (uc < e) { - if (*uc > 0xff) - return false; - ++uc; - } - return true; -} - -static inline int qStringSize(const QString &string, bool compress) -{ - int l = 2 + string.length(); - if (!compress) - l *= 2; - return alignedSize(l); -} - -// returns INT_MAX if it can't compress it into 28 bits -static inline int compressedNumber(double d) -{ - // this relies on details of how ieee floats are represented - const int exponent_off = 52; - const quint64 fraction_mask = 0x000fffffffffffffull; - const quint64 exponent_mask = 0x7ff0000000000000ull; - - quint64 val; - memcpy (&val, &d, sizeof(double)); - int exp = (int)((val & exponent_mask) >> exponent_off) - 1023; - if (exp < 0 || exp > 25) - return INT_MAX; - - quint64 non_int = val & (fraction_mask >> exp); - if (non_int) - return INT_MAX; - - bool neg = (val >> 63); - val &= fraction_mask; - val |= ((quint64)1 << 52); - int res = (int)(val >> (52 - exp)); - return neg ? -res : res; -} - -class Latin1String; - -class String -{ -public: - String(const char *data) { d = (Data *)data; } - - struct Data { - qle_int length; - qle_ushort utf16[1]; - }; - - Data *d; - - inline String &operator=(const QString &str) - { - d->length = str.length(); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - for (int i = 0; i < str.length(); ++i) - d->utf16[i] = uc[i]; -#else - memcpy(d->utf16, str.unicode(), str.length()*sizeof(ushort)); -#endif - if (str.length() & 1) - d->utf16[str.length()] = 0; - return *this; - } - - inline bool operator ==(const QString &str) const { - int slen = str.length(); - int l = d->length; - if (slen != l) - return false; - const ushort *s = (const ushort *)str.constData(); - const qle_ushort *a = d->utf16; - const ushort *b = s; - while (l-- && *a == *b) - a++,b++; - return (l == -1); - } - inline bool operator !=(const QString &str) const { - return !operator ==(str); - } - inline bool operator >=(const QString &str) const { - // ### - return toString() >= str; - } - - inline bool operator<(const Latin1String &str) const; - inline bool operator>=(const Latin1String &str) const { return !operator <(str); } - inline bool operator ==(const Latin1String &str) const; - - inline bool operator ==(const String &str) const { - if (d->length != str.d->length) - return false; - return !memcmp(d->utf16, str.d->utf16, d->length*sizeof(ushort)); - } - inline bool operator<(const String &other) const; - inline bool operator >=(const String &other) const { return other < *this; } - - inline QString toString() const { -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - return QString((QChar *)d->utf16, d->length); -#else - int l = d->length; - QString str(l, Qt::Uninitialized); - QChar *ch = str.data(); - for (int i = 0; i < l; ++i) - ch[i] = d->utf16[i]; - return str; -#endif - } - -}; - -class Latin1String -{ -public: - Latin1String(const char *data) { d = (Data *)data; } - - struct Data { - qle_short length; - char latin1[1]; - }; - Data *d; - - inline Latin1String &operator=(const QString &str) - { - d->length = str.length(); - uchar *l = (uchar *)d->latin1; - const ushort *uc = (const ushort *)str.unicode(); - for (int i = 0; i < str.length(); ++i) - *l++ = uc[i]; - while ((quintptr)l & 0x3) - *l++ = 0; - return *this; - } - - inline bool operator ==(const QString &str) const { -// return QLatin1String(d->latin1, d->length) == str; - return QString::fromLatin1(d->latin1, d->length) == str; - } - inline bool operator !=(const QString &str) const { - return !operator ==(str); - } - inline bool operator >=(const QString &str) const { -// return QLatin1String(d->latin1, d->length) >= str; - return QString::fromLatin1(d->latin1, d->length) >= str; - } - - inline bool operator ==(const Latin1String &str) const { - return d->length == str.d->length && !strcmp(d->latin1, str.d->latin1); - } - inline bool operator >=(const Latin1String &str) const { - int l = qMin(d->length, str.d->length); - int val = strncmp(d->latin1, str.d->latin1, l); - if (!val) - val = d->length - str.d->length; - return val >= 0; - } - - inline bool operator ==(const String &str) const { - return (str == *this); - } - inline bool operator >=(const String &str) const { - return (str < *this); - } - - inline QString toString() const { - return QString::fromLatin1(d->latin1, d->length); - } -}; - -inline bool String::operator ==(const Latin1String &str) const -{ - if ((int)d->length != (int)str.d->length) - return false; - const qle_ushort *uc = d->utf16; - const qle_ushort *e = uc + d->length; - const uchar *c = (uchar *)str.d->latin1; - - while (uc < e) { - if (*uc != *c) - return false; - ++uc; - ++c; - } - return true; -} - -inline bool String::operator <(const String &other) const -{ - int alen = d->length; - int blen = other.d->length; - int l = qMin(alen, blen); - qle_ushort *a = d->utf16; - qle_ushort *b = other.d->utf16; - - while (l-- && *a == *b) - a++,b++; - if (l==-1) - return (alen < blen); - return (ushort)*a - (ushort)*b; -} - -inline bool String::operator<(const Latin1String &str) const -{ - const uchar *c = (uchar *) str.d->latin1; - if (!c || *c == 0) - return false; - - const qle_ushort *uc = d->utf16; - const qle_ushort *e = uc + qMin((int)d->length, (int)str.d->length); - - while (uc < e) { - if (*uc != *c) - break; - ++uc; - ++c; - } - return (uc == e ? (int)d->length < (int)str.d->length : (ushort)*uc < *c); - -} - -static inline void copyString(char *dest, const QString &str, bool compress) -{ - if (compress) { - Latin1String string(dest); - string = str; - } else { - String string(dest); - string = str; - } -} - - -/* - Base is the base class for both Object and Array. Both classe work more or less the same way. - The class starts with a header (defined by the struct below), then followed by data (the data for - values in the Array case and Entry's (see below) for objects. - - After the data a table follows (tableOffset points to it) containing Value objects for Arrays, and - offsets from the beginning of the object to Entry's in the case of Object. - - Entry's in the Object's table are lexicographically sorted by key in the table(). This allows the usage - of a binary search over the keys in an Object. - */ -class Base -{ -public: - qle_uint size; - union { - uint _dummy; - qle_bitfield<0, 1> is_object; - qle_bitfield<1, 31> length; - }; - offset tableOffset; - // content follows here - - inline bool isObject() const { return is_object; } - inline bool isArray() const { return !isObject(); } - - inline offset *table() const { return (offset *) (((char *) this) + tableOffset); } - - int reserveSpace(uint dataSize, int posInTable, uint numItems, bool replace); - void removeItems(int pos, int numItems); -}; - -class Object : public Base -{ -public: - Entry *entryAt(int i) const { - return reinterpret_cast(((char *)this) + table()[i]); - } - int indexOf(const QString &key, bool *exists); - - bool isValid() const; -}; - - -class Array : public Base -{ -public: - inline Value at(int i) const; - inline Value &operator [](int i); - - bool isValid() const; -}; - - -class Value -{ -public: - union { - uint _dummy; - qle_bitfield<0, 3> type; - qle_bitfield<3, 1> latinOrIntValue; - qle_bitfield<4, 1> latinKey; - qle_bitfield<5, 27> value; - qle_signedbitfield<5, 27> int_value; - }; - - inline char *data(const Base *b) const { return ((char *)b) + value; } - int usedStorage(const Base *b) const; - - bool toBoolean() const; - double toDouble(const Base *b) const; - QString toString(const Base *b) const; - String asString(const Base *b) const; - Latin1String asLatin1String(const Base *b) const; - Base *base(const Base *b) const; - - bool isValid(const Base *b) const; - - static int requiredStorage(const QJsonValue &v, bool *compressed); - static uint valueToStore(const QJsonValue &v, uint offset); - static void copyData(const QJsonValue &v, char *dest, bool compressed); -}; - -inline Value Array::at(int i) const -{ - return *(Value *) (table() + i); -} - -inline Value &Array::operator [](int i) -{ - return *(Value *) (table() + i); -} - - - -class Entry { -public: - Value value; - // key - // value data follows key - - int size() const { - int s = sizeof(Entry); - if (value.latinKey) - s += sizeof(ushort) + *(ushort *) ((const char *)this + sizeof(Entry)); - else - s += sizeof(uint) + *(int *) ((const char *)this + sizeof(Entry)); - return alignedSize(s); - } - - int usedStorage(Base *b) const { - return size() + value.usedStorage(b); - } - - String shallowKey() const - { - Q_ASSERT(!value.latinKey); - return String((const char *)this + sizeof(Entry)); - } - Latin1String shallowLatin1Key() const - { - Q_ASSERT(value.latinKey); - return Latin1String((const char *)this + sizeof(Entry)); - } - QString key() const - { - if (value.latinKey) { - return shallowLatin1Key().toString(); - } - return shallowKey().toString(); - } - - bool operator ==(const QString &key) const; - inline bool operator !=(const QString &key) const { return !operator ==(key); } - bool operator >=(const QString &key) const; - - bool operator ==(const Entry &other) const; - bool operator >=(const Entry &other) const; -}; - -inline bool operator <(const QString &key, const Entry &e) -{ return e >= key; } - -class Header { -public: - qle_uint tag; // 'qbjs' - qle_uint version; // 1 - Base *root() { return (Base *)(this + 1); } -}; - - -inline bool Value::toBoolean() const -{ - Q_ASSERT(type == QJsonValue::Bool); - return value != 0; -} - -inline double Value::toDouble(const Base *b) const -{ - Q_ASSERT(type == QJsonValue::Double); - if (latinOrIntValue) - return int_value; - - quint64 i = qFromLittleEndian((const uchar *)b + value); - double d; - memcpy(&d, &i, sizeof(double)); - return d; -} - -inline String Value::asString(const Base *b) const -{ - Q_ASSERT(type == QJsonValue::String && !latinOrIntValue); - return String(data(b)); -} - -inline Latin1String Value::asLatin1String(const Base *b) const -{ - Q_ASSERT(type == QJsonValue::String && latinOrIntValue); - return Latin1String(data(b)); -} - -inline QString Value::toString(const Base *b) const -{ - if (latinOrIntValue) - return asLatin1String(b).toString(); - else - return asString(b).toString(); -} - -inline Base *Value::base(const Base *b) const -{ - Q_ASSERT(type == QJsonValue::Array || type == QJsonValue::Object); - return reinterpret_cast(data(b)); -} - -class Data { -public: - enum Validation { - Unchecked, - Validated, - Invalid - }; - - QAtomicInt ref; - int alloc; - union { - char *rawData; - Header *header; - }; - uint compactionCounter : 31; - uint ownsData : 1; - - inline Data(char *raw, int a) - : alloc(a), rawData(raw), compactionCounter(0), ownsData(true) - { - } - inline Data(int reserved, QJsonValue::Type valueType) - : rawData(0), compactionCounter(0), ownsData(true) - { - Q_ASSERT(valueType == QJsonValue::Array || valueType == QJsonValue::Object); - - alloc = sizeof(Header) + sizeof(Base) + reserved + sizeof(offset); - header = (Header *)malloc(alloc); - Q_CHECK_PTR(header); - header->tag = QJsonDocument::BinaryFormatTag; - header->version = 1; - Base *b = header->root(); - b->size = sizeof(Base); - b->is_object = (valueType == QJsonValue::Object); - b->tableOffset = sizeof(Base); - b->length = 0; - } - inline ~Data() - { if (ownsData) free(rawData); } - - uint offsetOf(const void *ptr) const { return (uint)(((char *)ptr - rawData)); } - - QJsonObject toObject(Object *o) const - { - return QJsonObject(const_cast(this), o); - } - - QJsonArray toArray(Array *a) const - { - return QJsonArray(const_cast(this), a); - } - - Data *clone(Base *b, int reserve = 0) - { - int size = sizeof(Header) + b->size + reserve; - char *raw = (char *)malloc(size); - Q_CHECK_PTR(raw); - memcpy(raw + sizeof(Header), b, b->size); - Header *h = (Header *)raw; - h->tag = QJsonDocument::BinaryFormatTag; - h->version = 1; - Data *d = new Data(raw, size); - d->compactionCounter = (b == header->root()) ? compactionCounter : 0; - return d; - } - - void compact(); - bool valid() const; - -private: - Q_DISABLE_COPY(Data) -}; - -} - -QT_END_NAMESPACE - -#endif // QJSON_P_H +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSON_P_H +#define QJSON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qjsonexport.h" +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qjsondocument.h" +#include "qjsonarray.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +/* + This defines a binary data structure for Json data. The data structure is optimised for fast reading + and minimum allocations. The whole data structure can be mmap'ed and used directly. + + In most cases the binary structure is not as space efficient as a utf8 encoded text representation, but + much faster to access. + + The size requirements are: + + String: + Latin1 data: 2 bytes header + string.length() + Full Unicode: 4 bytes header + 2*(string.length()) + + Values: 4 bytes + size of data (size can be 0 for some data) + bool: 0 bytes + double: 8 bytes (0 if integer with less than 27bits) + string: see above + array: size of array + object: size of object + Array: 12 bytes + 4*length + size of Value data + Object: 12 bytes + 8*length + size of Key Strings + size of Value data + + For an example such as + + { // object: 12 + 5*8 = 52 + "firstName": "John", // key 12, value 8 = 20 + "lastName" : "Smith", // key 12, value 8 = 20 + "age" : 25, // key 8, value 0 = 8 + "address" : // key 12, object below = 140 + { // object: 12 + 4*8 + "streetAddress": "21 2nd Street", // key 16, value 16 + "city" : "New York", // key 8, value 12 + "state" : "NY", // key 8, value 4 + "postalCode" : "10021" // key 12, value 8 + }, // object total: 128 + "phoneNumber": // key: 16, value array below = 172 + [ // array: 12 + 2*4 + values below: 156 + { // object 12 + 2*8 + "type" : "home", // key 8, value 8 + "number": "212 555-1234" // key 8, value 16 + }, // object total: 68 + { // object 12 + 2*8 + "type" : "fax", // key 8, value 8 + "number": "646 555-4567" // key 8, value 16 + } // object total: 68 + ] // array total: 156 + } // great total: 412 bytes + + The uncompressed text file used roughly 500 bytes, so in this case we end up using about + the same space as the text representation. + + Other measurements have shown a slightly bigger binary size than a compact text + representation where all possible whitespace was stripped out. +*/ +namespace QJsonPrivate { + +class Array; +class Object; +class Value; +class Entry; + +template +class q_littleendian +{ +public: + T val; + + q_littleendian &operator =(T i) { val = qToLittleEndian(i); return *this; } + operator T() const { return qFromLittleEndian(val); } + + bool operator ==(T i) { return qFromLittleEndian(val) == i; } + bool operator !=(T i) { return qFromLittleEndian(val) != i; } + bool operator ==(q_littleendian i) { return val == i.val; } + bool operator !=(q_littleendian i) { return val != i.val; } + bool operator <(T i) { return qFromLittleEndian(val) < i; } + bool operator >(T i) { return qFromLittleEndian(val) > i; } + bool operator <=(T i) { return qFromLittleEndian(val) <= i; } + bool operator >=(T i) { return qFromLittleEndian(val) >= i; } + q_littleendian &operator +=(T i) { + val = qToLittleEndian(qFromLittleEndian(val) + i); + return *this; + } +}; + +typedef q_littleendian qle_short; +typedef q_littleendian qle_ushort; +typedef q_littleendian qle_int; +typedef q_littleendian qle_uint; + +template +class qle_bitfield +{ +public: + uint val; + + enum { + mask = ((1u << width) - 1) << pos + }; + + void operator =(uint t) { + uint i = qFromLittleEndian(val); + i &= ~mask; + i |= t << pos; + val = qToLittleEndian(i); + } + operator uint() const { + uint t = qFromLittleEndian(val); + t &= mask; + t >>= pos; + return t; + } + bool operator !() const { + return !operator uint(); + } + + bool operator ==(uint t) { return uint(*this) == t; } + bool operator !=(uint t) { return uint(*this) != t; } + bool operator <(uint t) { return uint(*this) < t; } + bool operator >(uint t) { return uint(*this) > t; } + bool operator <=(uint t) { return uint(*this) <= t; } + bool operator >=(uint t) { return uint(*this) >= t; } + qle_bitfield &operator +=(uint i) { + *this = (uint(*this) + i); + return *this; + } + qle_bitfield &operator -=(uint i) { + *this = (uint(*this) - i); + return *this; + } +}; + +template +class qle_signedbitfield +{ +public: + uint val; + + enum { + mask = ((1u << width) - 1) << pos + }; + + void operator =(int t) { + uint i = qFromLittleEndian(val); + i &= ~mask; + i |= t << pos; + val = qToLittleEndian(i); + } + operator int() const { + uint i = qFromLittleEndian(val); + i <<= 32 - width - pos; + int t = (int) i; + t >>= pos; + return t; + } + bool operator !() const { + return !operator int(); + } + + bool operator ==(int t) { return int(*this) == t; } + bool operator !=(int t) { return int(*this) != t; } + bool operator <(int t) { return int(*this) < t; } + bool operator >(int t) { return int(*this) > t; } + bool operator <=(int t) { return int(*this) <= t; } + bool operator >=(int t) { return int(*this) >= t; } + qle_signedbitfield &operator +=(int i) { + *this = (int(*this) + i); + return *this; + } + qle_signedbitfield &operator -=(int i) { + *this = (int(*this) - i); + return *this; + } +}; + +typedef qle_uint offset; + +// round the size up to the next 4 byte boundary +inline int alignedSize(int size) { return (size + 3) & ~3; } + +static inline bool useCompressed(const QString &s) +{ + if (s.length() >= 0x8000) + return false; + const ushort *uc = (const ushort *)s.constData(); + const ushort *e = uc + s.length(); + while (uc < e) { + if (*uc > 0xff) + return false; + ++uc; + } + return true; +} + +static inline int qStringSize(const QString &string, bool compress) +{ + int l = 2 + string.length(); + if (!compress) + l *= 2; + return alignedSize(l); +} + +// returns INT_MAX if it can't compress it into 28 bits +static inline int compressedNumber(double d) +{ + // this relies on details of how ieee floats are represented + const int exponent_off = 52; + const quint64 fraction_mask = 0x000fffffffffffffull; + const quint64 exponent_mask = 0x7ff0000000000000ull; + + quint64 val; + memcpy (&val, &d, sizeof(double)); + int exp = (int)((val & exponent_mask) >> exponent_off) - 1023; + if (exp < 0 || exp > 25) + return INT_MAX; + + quint64 non_int = val & (fraction_mask >> exp); + if (non_int) + return INT_MAX; + + bool neg = (val >> 63); + val &= fraction_mask; + val |= ((quint64)1 << 52); + int res = (int)(val >> (52 - exp)); + return neg ? -res : res; +} + +class Latin1String; + +class String +{ +public: + String(const char *data) { d = (Data *)data; } + + struct Data { + qle_int length; + qle_ushort utf16[1]; + }; + + Data *d; + + inline String &operator=(const QString &str) + { + d->length = str.length(); +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + for (int i = 0; i < str.length(); ++i) + d->utf16[i] = uc[i]; +#else + memcpy(d->utf16, str.unicode(), str.length()*sizeof(ushort)); +#endif + if (str.length() & 1) + d->utf16[str.length()] = 0; + return *this; + } + + inline bool operator ==(const QString &str) const { + int slen = str.length(); + int l = d->length; + if (slen != l) + return false; + const ushort *s = (const ushort *)str.constData(); + const qle_ushort *a = d->utf16; + const ushort *b = s; + while (l-- && *a == *b) + a++,b++; + return (l == -1); + } + inline bool operator !=(const QString &str) const { + return !operator ==(str); + } + inline bool operator >=(const QString &str) const { + // ### + return toString() >= str; + } + + inline bool operator<(const Latin1String &str) const; + inline bool operator>=(const Latin1String &str) const { return !operator <(str); } + inline bool operator ==(const Latin1String &str) const; + + inline bool operator ==(const String &str) const { + if (d->length != str.d->length) + return false; + return !memcmp(d->utf16, str.d->utf16, d->length*sizeof(ushort)); + } + inline bool operator<(const String &other) const; + inline bool operator >=(const String &other) const { return other < *this; } + + inline QString toString() const { +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + return QString((QChar *)d->utf16, d->length); +#else + int l = d->length; + QString str(l, Qt::Uninitialized); + QChar *ch = str.data(); + for (int i = 0; i < l; ++i) + ch[i] = d->utf16[i]; + return str; +#endif + } + +}; + +class Latin1String +{ +public: + Latin1String(const char *data) { d = (Data *)data; } + + struct Data { + qle_short length; + char latin1[1]; + }; + Data *d; + + inline Latin1String &operator=(const QString &str) + { + d->length = str.length(); + uchar *l = (uchar *)d->latin1; + const ushort *uc = (const ushort *)str.unicode(); + for (int i = 0; i < str.length(); ++i) + *l++ = uc[i]; + while ((quintptr)l & 0x3) + *l++ = 0; + return *this; + } + + inline bool operator ==(const QString &str) const { +// return QLatin1String(d->latin1, d->length) == str; + return QString::fromLatin1(d->latin1, d->length) == str; + } + inline bool operator !=(const QString &str) const { + return !operator ==(str); + } + inline bool operator >=(const QString &str) const { +// return QLatin1String(d->latin1, d->length) >= str; + return QString::fromLatin1(d->latin1, d->length) >= str; + } + + inline bool operator ==(const Latin1String &str) const { + return d->length == str.d->length && !strcmp(d->latin1, str.d->latin1); + } + inline bool operator >=(const Latin1String &str) const { + int l = qMin(d->length, str.d->length); + int val = strncmp(d->latin1, str.d->latin1, l); + if (!val) + val = d->length - str.d->length; + return val >= 0; + } + + inline bool operator ==(const String &str) const { + return (str == *this); + } + inline bool operator >=(const String &str) const { + return (str < *this); + } + + inline QString toString() const { + return QString::fromLatin1(d->latin1, d->length); + } +}; + +inline bool String::operator ==(const Latin1String &str) const +{ + if ((int)d->length != (int)str.d->length) + return false; + const qle_ushort *uc = d->utf16; + const qle_ushort *e = uc + d->length; + const uchar *c = (uchar *)str.d->latin1; + + while (uc < e) { + if (*uc != *c) + return false; + ++uc; + ++c; + } + return true; +} + +inline bool String::operator <(const String &other) const +{ + int alen = d->length; + int blen = other.d->length; + int l = qMin(alen, blen); + qle_ushort *a = d->utf16; + qle_ushort *b = other.d->utf16; + + while (l-- && *a == *b) + a++,b++; + if (l==-1) + return (alen < blen); + return (ushort)*a - (ushort)*b; +} + +inline bool String::operator<(const Latin1String &str) const +{ + const uchar *c = (uchar *) str.d->latin1; + if (!c || *c == 0) + return false; + + const qle_ushort *uc = d->utf16; + const qle_ushort *e = uc + qMin((int)d->length, (int)str.d->length); + + while (uc < e) { + if (*uc != *c) + break; + ++uc; + ++c; + } + return (uc == e ? (int)d->length < (int)str.d->length : (ushort)*uc < *c); + +} + +static inline void copyString(char *dest, const QString &str, bool compress) +{ + if (compress) { + Latin1String string(dest); + string = str; + } else { + String string(dest); + string = str; + } +} + + +/* + Base is the base class for both Object and Array. Both classe work more or less the same way. + The class starts with a header (defined by the struct below), then followed by data (the data for + values in the Array case and Entry's (see below) for objects. + + After the data a table follows (tableOffset points to it) containing Value objects for Arrays, and + offsets from the beginning of the object to Entry's in the case of Object. + + Entry's in the Object's table are lexicographically sorted by key in the table(). This allows the usage + of a binary search over the keys in an Object. + */ +class Base +{ +public: + qle_uint size; + union { + uint _dummy; + qle_bitfield<0, 1> is_object; + qle_bitfield<1, 31> length; + }; + offset tableOffset; + // content follows here + + inline bool isObject() const { return is_object; } + inline bool isArray() const { return !isObject(); } + + inline offset *table() const { return (offset *) (((char *) this) + tableOffset); } + + int reserveSpace(uint dataSize, int posInTable, uint numItems, bool replace); + void removeItems(int pos, int numItems); +}; + +class Object : public Base +{ +public: + Entry *entryAt(int i) const { + return reinterpret_cast(((char *)this) + table()[i]); + } + int indexOf(const QString &key, bool *exists); + + bool isValid() const; +}; + + +class Array : public Base +{ +public: + inline Value at(int i) const; + inline Value &operator [](int i); + + bool isValid() const; +}; + + +class Value +{ +public: + union { + uint _dummy; + qle_bitfield<0, 3> type; + qle_bitfield<3, 1> latinOrIntValue; + qle_bitfield<4, 1> latinKey; + qle_bitfield<5, 27> value; + qle_signedbitfield<5, 27> int_value; + }; + + inline char *data(const Base *b) const { return ((char *)b) + value; } + int usedStorage(const Base *b) const; + + bool toBoolean() const; + double toDouble(const Base *b) const; + QString toString(const Base *b) const; + String asString(const Base *b) const; + Latin1String asLatin1String(const Base *b) const; + Base *base(const Base *b) const; + + bool isValid(const Base *b) const; + + static int requiredStorage(const QJsonValue &v, bool *compressed); + static uint valueToStore(const QJsonValue &v, uint offset); + static void copyData(const QJsonValue &v, char *dest, bool compressed); +}; + +inline Value Array::at(int i) const +{ + return *(Value *) (table() + i); +} + +inline Value &Array::operator [](int i) +{ + return *(Value *) (table() + i); +} + + + +class Entry { +public: + Value value; + // key + // value data follows key + + int size() const { + int s = sizeof(Entry); + if (value.latinKey) + s += sizeof(ushort) + *(ushort *) ((const char *)this + sizeof(Entry)); + else + s += sizeof(uint) + *(int *) ((const char *)this + sizeof(Entry)); + return alignedSize(s); + } + + int usedStorage(Base *b) const { + return size() + value.usedStorage(b); + } + + String shallowKey() const + { + Q_ASSERT(!value.latinKey); + return String((const char *)this + sizeof(Entry)); + } + Latin1String shallowLatin1Key() const + { + Q_ASSERT(value.latinKey); + return Latin1String((const char *)this + sizeof(Entry)); + } + QString key() const + { + if (value.latinKey) { + return shallowLatin1Key().toString(); + } + return shallowKey().toString(); + } + + bool operator ==(const QString &key) const; + inline bool operator !=(const QString &key) const { return !operator ==(key); } + bool operator >=(const QString &key) const; + + bool operator ==(const Entry &other) const; + bool operator >=(const Entry &other) const; +}; + +inline bool operator <(const QString &key, const Entry &e) +{ return e >= key; } + +class Header { +public: + qle_uint tag; // 'qbjs' + qle_uint version; // 1 + Base *root() { return (Base *)(this + 1); } +}; + + +inline bool Value::toBoolean() const +{ + Q_ASSERT(type == QJsonValue::Bool); + return value != 0; +} + +inline double Value::toDouble(const Base *b) const +{ + Q_ASSERT(type == QJsonValue::Double); + if (latinOrIntValue) + return int_value; + + quint64 i = qFromLittleEndian((const uchar *)b + value); + double d; + memcpy(&d, &i, sizeof(double)); + return d; +} + +inline String Value::asString(const Base *b) const +{ + Q_ASSERT(type == QJsonValue::String && !latinOrIntValue); + return String(data(b)); +} + +inline Latin1String Value::asLatin1String(const Base *b) const +{ + Q_ASSERT(type == QJsonValue::String && latinOrIntValue); + return Latin1String(data(b)); +} + +inline QString Value::toString(const Base *b) const +{ + if (latinOrIntValue) + return asLatin1String(b).toString(); + else + return asString(b).toString(); +} + +inline Base *Value::base(const Base *b) const +{ + Q_ASSERT(type == QJsonValue::Array || type == QJsonValue::Object); + return reinterpret_cast(data(b)); +} + +class Data { +public: + enum Validation { + Unchecked, + Validated, + Invalid + }; + + QAtomicInt ref; + int alloc; + union { + char *rawData; + Header *header; + }; + uint compactionCounter : 31; + uint ownsData : 1; + + inline Data(char *raw, int a) + : alloc(a), rawData(raw), compactionCounter(0), ownsData(true) + { + } + inline Data(int reserved, QJsonValue::Type valueType) + : rawData(0), compactionCounter(0), ownsData(true) + { + Q_ASSERT(valueType == QJsonValue::Array || valueType == QJsonValue::Object); + + alloc = sizeof(Header) + sizeof(Base) + reserved + sizeof(offset); + header = (Header *)malloc(alloc); + Q_CHECK_PTR(header); + header->tag = QJsonDocument::BinaryFormatTag; + header->version = 1; + Base *b = header->root(); + b->size = sizeof(Base); + b->is_object = (valueType == QJsonValue::Object); + b->tableOffset = sizeof(Base); + b->length = 0; + } + inline ~Data() + { if (ownsData) free(rawData); } + + uint offsetOf(const void *ptr) const { return (uint)(((char *)ptr - rawData)); } + + QJsonObject toObject(Object *o) const + { + return QJsonObject(const_cast(this), o); + } + + QJsonArray toArray(Array *a) const + { + return QJsonArray(const_cast(this), a); + } + + Data *clone(Base *b, int reserve = 0) + { + int size = sizeof(Header) + b->size + reserve; + char *raw = (char *)malloc(size); + Q_CHECK_PTR(raw); + memcpy(raw + sizeof(Header), b, b->size); + Header *h = (Header *)raw; + h->tag = QJsonDocument::BinaryFormatTag; + h->version = 1; + Data *d = new Data(raw, size); + d->compactionCounter = (b == header->root()) ? compactionCounter : 0; + return d; + } + + void compact(); + bool valid() const; + +private: + Q_DISABLE_COPY(Data) +}; + +} + +QT_END_NAMESPACE + +#endif // QJSON_P_H diff --git a/qjson/qjsonarray.cpp b/qjson/qjsonarray.cpp index 1b6f968..e1ba762 100644 --- a/qjson/qjsonarray.cpp +++ b/qjson/qjsonarray.cpp @@ -1,1017 +1,1017 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjsonobject.h" -#include "qjsonvalue.h" -#include "qjsonarray.h" -#include -#include - -#include "qjsonwriter_p.h" -#include "qjson_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QJsonArray - \ingroup json - \reentrant - \since 5.0 - - \brief The QJsonArray class encapsulates a JSON array. - - A JSON array is a list of values. The list can be manipulated by inserting and - removing QJsonValue's from the array. - - A QJsonArray can be converted to and from a QVariantList. You can query the - number of entries with size(), insert(), and remove() entries from it - and iterate over its content using the standard C++ iterator pattern. - - QJsonArray is an implicitly shared class and shares the data with the document - it has been created from as long as it is not being modified. - - You can convert the array to and from text based JSON through QJsonDocument. -*/ - -/*! - Creates an empty array. - */ -QJsonArray::QJsonArray() - : d(0), a(0) -{ -} - -/*! - \internal - */ -QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array) - : d(data), a(array) -{ - d->ref.ref(); -} - -/*! - Deletes the array. - */ -QJsonArray::~QJsonArray() -{ - if (d && !d->ref.deref()) - delete d; -} - -/*! - Creates a copy of \a other. - - Since QJsonArray is implicitly shared, the copy is shallow - as long as the object doesn't get modified. - */ -QJsonArray::QJsonArray(const QJsonArray &other) -{ - d = other.d; - a = other.a; - if (d) - d->ref.ref(); -} - -/*! - Assigns \a other to this array. - */ -QJsonArray &QJsonArray::operator =(const QJsonArray &other) -{ - if (d != other.d) { - if (d && !d->ref.deref()) - delete d; - d = other.d; - if (d) - d->ref.ref(); - } - a = other.a; - - return *this; -} - -/*! - Converts the string list \a list to a QJsonArray. - - The values in \a list will be converted to JSON values. - - \sa toVariantList, QJsonValue::fromString - */ -QJsonArray QJsonArray::fromStringList(const QStringList &list) -{ - QJsonArray array; - for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) - array.append(QJsonValue(*it)); - return array; -} - -/*! - Converts the variant list \a list to a QJsonArray. - - The QVariant values in \a list will be converted to JSON values. - - \sa toVariantList, QJsonValue::fromVariant - */ -QJsonArray QJsonArray::fromVariantList(const QVariantList &list) -{ - QJsonArray array; - for (QVariantList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) - array.append(QJsonValue::fromVariant(*it)); - return array; -} - -/*! - Converts this object to a QVariantList. - - Returns the created map. - */ -QVariantList QJsonArray::toVariantList() const -{ - QVariantList list; - - if (a) { - for (int i = 0; i < (int)a->length; ++i) - list.append(QJsonValue(d, a, a->at(i)).toVariant()); - } - return list; -} - - -/*! - Returns the number of values stored in the array. - */ -int QJsonArray::size() const -{ - if (!d) - return 0; - - return (int)a->length; -} - -/*! - Returns \c true if the object is empty. This is the same as size() == 0. - - \sa size - */ -bool QJsonArray::isEmpty() const -{ - if (!d) - return true; - - return !a->length; -} - -/*! - Returns a QJsonValue representing the value for index \a i. - - The returned QJsonValue is \c Undefined, if \a i is out of bounds. - - */ -QJsonValue QJsonArray::at(int i) const -{ - if (!a || i < 0 || i >= (int)a->length) - return QJsonValue(QJsonValue::Undefined); - - return QJsonValue(d, a, a->at(i)); -} - -/*! - Returns the first value stored in the array. - - Same as \c at(0). - - \sa at - */ -QJsonValue QJsonArray::first() const -{ - return at(0); -} - -/*! - Returns the last value stored in the array. - - Same as \c{at(size() - 1)}. - - \sa at - */ -QJsonValue QJsonArray::last() const -{ - return at(a ? (a->length - 1) : 0); -} - -/*! - Inserts \a value at the beginning of the array. - - This is the same as \c{insert(0, \a value)}. - - \sa append(), insert() - */ -void QJsonArray::prepend(const QJsonValue &value) -{ - insert(0, value); -} - -/*! - Inserts \a value at the end of the array. - - \sa prepend(), insert() - */ -void QJsonArray::append(const QJsonValue &value) -{ - insert(a ? (int)a->length : 0, value); -} - -/*! - Removes the value at index position \a i. \a i must be a valid - index position in the array (i.e., \c{0 <= \a i < size()}). - - \sa insert(), replace() - */ -void QJsonArray::removeAt(int i) -{ - if (!a || i < 0 || i >= (int)a->length) - return; - - detach(); - a->removeItems(i, 1); - ++d->compactionCounter; - if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2) - compact(); -} - -/*! \fn void QJsonArray::removeFirst() - - Removes the first item in the array. Calling this function is - equivalent to calling \c{removeAt(0)}. The array must not be empty. If - the array can be empty, call isEmpty() before calling this - function. - - \sa removeAt(), takeFirst() -*/ - -/*! \fn void QJsonArray::removeLast() - - Removes the last item in the array. Calling this function is - equivalent to calling \c{removeAt(size() - 1)}. The array must not be - empty. If the array can be empty, call isEmpty() before calling - this function. - - \sa removeAt(), takeLast() -*/ - -/*! - Removes the item at index position \a i and returns it. \a i must - be a valid index position in the array (i.e., \c{0 <= \a i < size()}). - - If you don't use the return value, removeAt() is more efficient. - - \sa removeAt() - */ -QJsonValue QJsonArray::takeAt(int i) -{ - if (!a || i < 0 || i >= (int)a->length) - return QJsonValue(QJsonValue::Undefined); - - detach(); - - QJsonValue v(d, a, a->at(i)); - v.detach(); - - removeAt(i); - - return v; -} - -/*! - Inserts \a value at index position \a i in the array. If \a i - is \c 0, the value is prepended to the array. If \a i is size(), the - value is appended to the array. - - \sa append(), prepend(), replace(), removeAt() - */ -void QJsonArray::insert(int i, const QJsonValue &value) -{ - Q_ASSERT (i >= 0 && i <= (a ? (int)a->length : 0)); - - bool compressed; - int valueSize = QJsonPrivate::Value::requiredStorage(value, &compressed); - - detach(valueSize + sizeof(QJsonPrivate::Value)); - - if (!a->length) - a->tableOffset = sizeof(QJsonPrivate::Array); - - int valueOffset = a->reserveSpace(valueSize, i, 1, false); - QJsonPrivate::Value &v = (*a)[i]; - v.type = (value.t == QJsonValue::Undefined ? QJsonValue::Null : value.t); - v.latinOrIntValue = compressed; - v.latinKey = false; - v.value = QJsonPrivate::Value::valueToStore(value, valueOffset); - if (valueSize) - QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed); -} - -/*! - Replaces the item at index position \a i with \a value. \a i must - be a valid index position in the array (i.e., \c{0 <= \a i < size()}). - - \sa operator[](), removeAt() - */ -void QJsonArray::replace(int i, const QJsonValue &value) -{ - Q_ASSERT (a && i >= 0 && i < (int)(a->length)); - - bool compressed; - int valueSize = QJsonPrivate::Value::requiredStorage(value, &compressed); - - detach(valueSize); - - if (!a->length) - a->tableOffset = sizeof(QJsonPrivate::Array); - - int valueOffset = a->reserveSpace(valueSize, i, 1, true); - QJsonPrivate::Value &v = (*a)[i]; - v.type = (value.t == QJsonValue::Undefined ? QJsonValue::Null : value.t); - v.latinOrIntValue = compressed; - v.latinKey = false; - v.value = QJsonPrivate::Value::valueToStore(value, valueOffset); - if (valueSize) - QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed); - - ++d->compactionCounter; - if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2) - compact(); -} - -/*! - Returns \c true if the array contains an occurrence of \a value, otherwise \c false. - - \sa count() - */ -bool QJsonArray::contains(const QJsonValue &value) const -{ - for (int i = 0; i < size(); i++) { - if (at(i) == value) - return true; - } - return false; -} - -/*! - Returns the value at index position \a i as a modifiable reference. - \a i must be a valid index position in the array (i.e., \c{0 <= \a i < - size()}). - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. - - \sa at(), value() - */ -QJsonValueRef QJsonArray::operator [](int i) -{ - Q_ASSERT(a && i >= 0 && i < (int)a->length); - return QJsonValueRef(this, i); -} - -/*! - \overload - - Same as at(). - */ -QJsonValue QJsonArray::operator[](int i) const -{ - return at(i); -} - -/*! - Returns \c true if this array is equal to \a other. - */ -bool QJsonArray::operator==(const QJsonArray &other) const -{ - if (a == other.a) - return true; - - if (!a) - return !other.a->length; - if (!other.a) - return !a->length; - if (a->length != other.a->length) - return false; - - for (int i = 0; i < (int)a->length; ++i) { - if (QJsonValue(d, a, a->at(i)) != QJsonValue(other.d, other.a, other.a->at(i))) - return false; - } - return true; -} - -/*! - Returns \c true if this array is not equal to \a other. - */ -bool QJsonArray::operator!=(const QJsonArray &other) const -{ - return !(*this == other); -} - -/*! \fn QJsonArray::iterator QJsonArray::begin() - - Returns an \l{STL-style iterator} pointing to the first item in - the array. - - \sa constBegin(), end() -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::begin() const - - \overload -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::constBegin() const - - Returns a const \l{STL-style iterator} pointing to the first item - in the array. - - \sa begin(), constEnd() -*/ - -/*! \fn QJsonArray::iterator QJsonArray::end() - - Returns an \l{STL-style iterator} pointing to the imaginary item - after the last item in the array. - - \sa begin(), constEnd() -*/ - -/*! \fn const_iterator QJsonArray::end() const - - \overload -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::constEnd() const - - Returns a const \l{STL-style iterator} pointing to the imaginary - item after the last item in the array. - - \sa constBegin(), end() -*/ - -/*! \fn void QJsonArray::push_back(const T &value) - - This function is provided for STL compatibility. It is equivalent - to \l{QJsonArray::append()}{append(\a value)}. -*/ - -/*! \fn void QJsonArray::push_front(const T &value) - - This function is provided for STL compatibility. It is equivalent - to \l{QJsonArray::prepend()}{prepend(\a value)}. -*/ - -/*! \fn void QJsonArray::pop_front() - - This function is provided for STL compatibility. It is equivalent - to removeFirst(). The array must not be empty. If the array can be - empty, call isEmpty() before calling this function. -*/ - -/*! \fn void QJsonArray::pop_back() - - This function is provided for STL compatibility. It is equivalent - to removeLast(). The array must not be empty. If the array can be - empty, call isEmpty() before calling this function. -*/ - -/*! \fn bool QJsonArray::empty() const - - This function is provided for STL compatibility. It is equivalent - to isEmpty() and returns \c true if the array is empty. -*/ - -/*! \class QJsonArray::iterator - \brief The QJsonArray::iterator class provides an STL-style non-const iterator for QJsonArray. - - QJsonArray::iterator allows you to iterate over a QJsonArray - and to modify the array item associated with the - iterator. If you want to iterate over a const QJsonArray, use - QJsonArray::const_iterator instead. It is generally a good practice to - use QJsonArray::const_iterator on a non-const QJsonArray as well, unless - you need to change the QJsonArray through the iterator. Const - iterators are slightly faster and improves code readability. - - The default QJsonArray::iterator constructor creates an uninitialized - iterator. You must initialize it using a QJsonArray function like - QJsonArray::begin(), QJsonArray::end(), or QJsonArray::insert() before you can - start iterating. - - Most QJsonArray functions accept an integer index rather than an - iterator. For that reason, iterators are rarely useful in - connection with QJsonArray. One place where STL-style iterators do - make sense is as arguments to \l{generic algorithms}. - - Multiple iterators can be used on the same array. However, be - aware that any non-const function call performed on the QJsonArray - will render all existing iterators undefined. - - \sa QJsonArray::const_iterator -*/ - -/*! \typedef QJsonArray::iterator::iterator_category - - A synonym for \i {std::random_access_iterator_tag} indicating - this iterator is a random access iterator. -*/ - -/*! \typedef QJsonArray::iterator::difference_type - - \internal -*/ - -/*! \typedef QJsonArray::iterator::value_type - - \internal -*/ - -/*! \typedef QJsonArray::iterator::reference - - \internal -*/ - -/*! \fn QJsonArray::iterator::iterator() - - Constructs an uninitialized iterator. - - Functions like operator*() and operator++() should not be called - on an uninitialized iterator. Use operator=() to assign a value - to it before using it. - - \sa QJsonArray::begin() QJsonArray::end() -*/ - -/*! \fn QJsonArray::iterator::iterator(const iterator &other) - - Constructs a copy of \a other. -*/ - -/*! \fn QJsonValueRef QJsonArray::iterator::operator*() const - - Returns a modifiable reference to the current item. - - You can change the value of an item by using operator*() on the - left side of an assignment. - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. -*/ - -/*! \fn QJsonValueRef QJsonArray::iterator::operator[](int j) const - - Returns a modifiable reference to the item at position \c{*this + j}. - - This function is provided to make QJsonArray iterators behave like C++ - pointers. - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. - - \sa operator+() -*/ - -/*! - \fn bool QJsonArray::iterator::operator==(const iterator &other) const - \fn bool QJsonArray::iterator::operator==(const const_iterator &other) const - - Returns \c true if \a other points to the same item as this - iterator; otherwise returns \c false. - - \sa operator!=() -*/ - -/*! - \fn bool QJsonArray::iterator::operator!=(const iterator &other) const - \fn bool QJsonArray::iterator::operator!=(const const_iterator &other) const - - Returns \c true if \a other points to a different item than this - iterator; otherwise returns \c false. - - \sa operator==() -*/ - -/*! - \fn bool QJsonArray::iterator::operator<(const iterator& other) const - \fn bool QJsonArray::iterator::operator<(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is less than - the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::iterator::operator<=(const iterator& other) const - \fn bool QJsonArray::iterator::operator<=(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is less than - or equal to the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::iterator::operator>(const iterator& other) const - \fn bool QJsonArray::iterator::operator>(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is greater - than the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::iterator::operator>=(const iterator& other) const - \fn bool QJsonArray::iterator::operator>=(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is greater - than or equal to the item pointed to by the \a other iterator. -*/ - -/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator++() - - The prefix ++ operator, \c{++it}, advances the iterator to the - next item in the array and returns an iterator to the new current - item. - - Calling this function on QJsonArray::end() leads to undefined results. - - \sa operator--() -*/ - -/*! \fn QJsonArray::iterator QJsonArray::iterator::operator++(int) - - \overload - - The postfix ++ operator, \c{it++}, advances the iterator to the - next item in the array and returns an iterator to the previously - current item. -*/ - -/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator--() - - The prefix -- operator, \c{--it}, makes the preceding item - current and returns an iterator to the new current item. - - Calling this function on QJsonArray::begin() leads to undefined results. - - \sa operator++() -*/ - -/*! \fn QJsonArray::iterator QJsonArray::iterator::operator--(int) - - \overload - - The postfix -- operator, \c{it--}, makes the preceding item - current and returns an iterator to the previously current item. -*/ - -/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator+=(int j) - - Advances the iterator by \a j items. If \a j is negative, the - iterator goes backward. - - \sa operator-=(), operator+() -*/ - -/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator-=(int j) - - Makes the iterator go back by \a j items. If \a j is negative, - the iterator goes forward. - - \sa operator+=(), operator-() -*/ - -/*! \fn QJsonArray::iterator QJsonArray::iterator::operator+(int j) const - - Returns an iterator to the item at \a j positions forward from - this iterator. If \a j is negative, the iterator goes backward. - - \sa operator-(), operator+=() -*/ - -/*! \fn QJsonArray::iterator QJsonArray::iterator::operator-(int j) const - - Returns an iterator to the item at \a j positions backward from - this iterator. If \a j is negative, the iterator goes forward. - - \sa operator+(), operator-=() -*/ - -/*! \fn int QJsonArray::iterator::operator-(iterator other) const - - Returns the number of items between the item pointed to by \a - other and the item pointed to by this iterator. -*/ - -/*! \class QJsonArray::const_iterator - \brief The QJsonArray::const_iterator class provides an STL-style const iterator for QJsonArray. - - QJsonArray::const_iterator allows you to iterate over a - QJsonArray. If you want to modify the QJsonArray as - you iterate over it, use QJsonArray::iterator instead. It is generally a - good practice to use QJsonArray::const_iterator on a non-const QJsonArray - as well, unless you need to change the QJsonArray through the - iterator. Const iterators are slightly faster and improves - code readability. - - The default QJsonArray::const_iterator constructor creates an - uninitialized iterator. You must initialize it using a QJsonArray - function like QJsonArray::constBegin(), QJsonArray::constEnd(), or - QJsonArray::insert() before you can start iterating. - - Most QJsonArray functions accept an integer index rather than an - iterator. For that reason, iterators are rarely useful in - connection with QJsonArray. One place where STL-style iterators do - make sense is as arguments to \l{generic algorithms}. - - Multiple iterators can be used on the same array. However, be - aware that any non-const function call performed on the QJsonArray - will render all existing iterators undefined. - - \sa QJsonArray::iterator, QJsonArrayIterator -*/ - -/*! \fn QJsonArray::const_iterator::const_iterator() - - Constructs an uninitialized iterator. - - Functions like operator*() and operator++() should not be called - on an uninitialized iterator. Use operator=() to assign a value - to it before using it. - - \sa QJsonArray::constBegin() QJsonArray::constEnd() -*/ - -/*! \typedef QJsonArray::const_iterator::iterator_category - - A synonym for \i {std::random_access_iterator_tag} indicating - this iterator is a random access iterator. -*/ - -/*! \typedef QJsonArray::const_iterator::difference_type - - \internal -*/ - -/*! \typedef QJsonArray::const_iterator::value_type - - \internal -*/ - -/*! \typedef QJsonArray::const_iterator::reference - - \internal -*/ - -/*! \fn QJsonArray::const_iterator::const_iterator(const const_iterator &other) - - Constructs a copy of \a other. -*/ - -/*! \fn QJsonArray::const_iterator::const_iterator(const iterator &other) - - Constructs a copy of \a other. -*/ - -/*! \fn QJsonValue QJsonArray::const_iterator::operator*() const - - Returns the current item. -*/ - -/*! \fn QJsonValue QJsonArray::const_iterator::operator[](int j) const - - Returns the item at position \c{*this + j}. - - This function is provided to make QJsonArray iterators behave like C++ - pointers. - - \sa operator+() -*/ - -/*! \fn bool QJsonArray::const_iterator::operator==(const const_iterator &other) const - - Returns \c true if \a other points to the same item as this - iterator; otherwise returns \c false. - - \sa operator!=() -*/ - -/*! \fn bool QJsonArray::const_iterator::operator!=(const const_iterator &other) const - - Returns \c true if \a other points to a different item than this - iterator; otherwise returns \c false. - - \sa operator==() -*/ - -/*! - \fn bool QJsonArray::const_iterator::operator<(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is less than - the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::const_iterator::operator<=(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is less than - or equal to the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::const_iterator::operator>(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is greater - than the item pointed to by the \a other iterator. -*/ - -/*! - \fn bool QJsonArray::const_iterator::operator>=(const const_iterator& other) const - - Returns \c true if the item pointed to by this iterator is greater - than or equal to the item pointed to by the \a other iterator. -*/ - -/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator++() - - The prefix ++ operator, \c{++it}, advances the iterator to the - next item in the array and returns an iterator to the new current - item. - - Calling this function on QJsonArray::end() leads to undefined results. - - \sa operator--() -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator++(int) - - \overload - - The postfix ++ operator, \c{it++}, advances the iterator to the - next item in the array and returns an iterator to the previously - current item. -*/ - -/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator--() - - The prefix -- operator, \c{--it}, makes the preceding item - current and returns an iterator to the new current item. - - Calling this function on QJsonArray::begin() leads to undefined results. - - \sa operator++() -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator--(int) - - \overload - - The postfix -- operator, \c{it--}, makes the preceding item - current and returns an iterator to the previously current item. -*/ - -/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator+=(int j) - - Advances the iterator by \a j items. If \a j is negative, the - iterator goes backward. - - \sa operator-=(), operator+() -*/ - -/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator-=(int j) - - Makes the iterator go back by \a j items. If \a j is negative, - the iterator goes forward. - - \sa operator+=(), operator-() -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator+(int j) const - - Returns an iterator to the item at \a j positions forward from - this iterator. If \a j is negative, the iterator goes backward. - - \sa operator-(), operator+=() -*/ - -/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator-(int j) const - - Returns an iterator to the item at \a j positions backward from - this iterator. If \a j is negative, the iterator goes forward. - - \sa operator+(), operator-=() -*/ - -/*! \fn int QJsonArray::const_iterator::operator-(const_iterator other) const - - Returns the number of items between the item pointed to by \a - other and the item pointed to by this iterator. -*/ - - -/*! - \internal - */ -void QJsonArray::detach(uint reserve) -{ - if (!d) { - d = new QJsonPrivate::Data(reserve, QJsonValue::Array); - a = static_cast(d->header->root()); - d->ref.ref(); - return; - } - /* - if (reserve == 0 && d->ref.load() == 1) - return; - */ - if (reserve == 0 && int(d->ref) == 1) - return; - - QJsonPrivate::Data *x = d->clone(a, reserve); - x->ref.ref(); - if (!d->ref.deref()) - delete d; - d = x; - a = static_cast(d->header->root()); -} - -/*! - \internal - */ -void QJsonArray::compact() -{ - if (!d || !d->compactionCounter) - return; - - detach(); - d->compact(); - a = static_cast(d->header->root()); -} - - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QJsonArray &a) -{ - if (!a.a) { - dbg << "QJsonArray()"; - return dbg; - } - QByteArray json; - QJsonPrivate::Writer::arrayToJson(a.a, json, 0, true); - dbg.nospace() << "QJsonArray(" - << json.constData() // print as utf-8 string without extra quotation marks - << ")"; - return dbg.space(); -} -#endif - -QT_END_NAMESPACE - +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qjsonarray.h" +#include +#include + +#include "qjsonwriter_p.h" +#include "qjson_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QJsonArray + \ingroup json + \reentrant + \since 5.0 + + \brief The QJsonArray class encapsulates a JSON array. + + A JSON array is a list of values. The list can be manipulated by inserting and + removing QJsonValue's from the array. + + A QJsonArray can be converted to and from a QVariantList. You can query the + number of entries with size(), insert(), and remove() entries from it + and iterate over its content using the standard C++ iterator pattern. + + QJsonArray is an implicitly shared class and shares the data with the document + it has been created from as long as it is not being modified. + + You can convert the array to and from text based JSON through QJsonDocument. +*/ + +/*! + Creates an empty array. + */ +QJsonArray::QJsonArray() + : d(0), a(0) +{ +} + +/*! + \internal + */ +QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array) + : d(data), a(array) +{ + d->ref.ref(); +} + +/*! + Deletes the array. + */ +QJsonArray::~QJsonArray() +{ + if (d && !d->ref.deref()) + delete d; +} + +/*! + Creates a copy of \a other. + + Since QJsonArray is implicitly shared, the copy is shallow + as long as the object doesn't get modified. + */ +QJsonArray::QJsonArray(const QJsonArray &other) +{ + d = other.d; + a = other.a; + if (d) + d->ref.ref(); +} + +/*! + Assigns \a other to this array. + */ +QJsonArray &QJsonArray::operator =(const QJsonArray &other) +{ + if (d != other.d) { + if (d && !d->ref.deref()) + delete d; + d = other.d; + if (d) + d->ref.ref(); + } + a = other.a; + + return *this; +} + +/*! + Converts the string list \a list to a QJsonArray. + + The values in \a list will be converted to JSON values. + + \sa toVariantList, QJsonValue::fromString + */ +QJsonArray QJsonArray::fromStringList(const QStringList &list) +{ + QJsonArray array; + for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) + array.append(QJsonValue(*it)); + return array; +} + +/*! + Converts the variant list \a list to a QJsonArray. + + The QVariant values in \a list will be converted to JSON values. + + \sa toVariantList, QJsonValue::fromVariant + */ +QJsonArray QJsonArray::fromVariantList(const QVariantList &list) +{ + QJsonArray array; + for (QVariantList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) + array.append(QJsonValue::fromVariant(*it)); + return array; +} + +/*! + Converts this object to a QVariantList. + + Returns the created map. + */ +QVariantList QJsonArray::toVariantList() const +{ + QVariantList list; + + if (a) { + for (int i = 0; i < (int)a->length; ++i) + list.append(QJsonValue(d, a, a->at(i)).toVariant()); + } + return list; +} + + +/*! + Returns the number of values stored in the array. + */ +int QJsonArray::size() const +{ + if (!d) + return 0; + + return (int)a->length; +} + +/*! + Returns \c true if the object is empty. This is the same as size() == 0. + + \sa size + */ +bool QJsonArray::isEmpty() const +{ + if (!d) + return true; + + return !a->length; +} + +/*! + Returns a QJsonValue representing the value for index \a i. + + The returned QJsonValue is \c Undefined, if \a i is out of bounds. + + */ +QJsonValue QJsonArray::at(int i) const +{ + if (!a || i < 0 || i >= (int)a->length) + return QJsonValue(QJsonValue::Undefined); + + return QJsonValue(d, a, a->at(i)); +} + +/*! + Returns the first value stored in the array. + + Same as \c at(0). + + \sa at + */ +QJsonValue QJsonArray::first() const +{ + return at(0); +} + +/*! + Returns the last value stored in the array. + + Same as \c{at(size() - 1)}. + + \sa at + */ +QJsonValue QJsonArray::last() const +{ + return at(a ? (a->length - 1) : 0); +} + +/*! + Inserts \a value at the beginning of the array. + + This is the same as \c{insert(0, \a value)}. + + \sa append(), insert() + */ +void QJsonArray::prepend(const QJsonValue &value) +{ + insert(0, value); +} + +/*! + Inserts \a value at the end of the array. + + \sa prepend(), insert() + */ +void QJsonArray::append(const QJsonValue &value) +{ + insert(a ? (int)a->length : 0, value); +} + +/*! + Removes the value at index position \a i. \a i must be a valid + index position in the array (i.e., \c{0 <= \a i < size()}). + + \sa insert(), replace() + */ +void QJsonArray::removeAt(int i) +{ + if (!a || i < 0 || i >= (int)a->length) + return; + + detach(); + a->removeItems(i, 1); + ++d->compactionCounter; + if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2) + compact(); +} + +/*! \fn void QJsonArray::removeFirst() + + Removes the first item in the array. Calling this function is + equivalent to calling \c{removeAt(0)}. The array must not be empty. If + the array can be empty, call isEmpty() before calling this + function. + + \sa removeAt(), takeFirst() +*/ + +/*! \fn void QJsonArray::removeLast() + + Removes the last item in the array. Calling this function is + equivalent to calling \c{removeAt(size() - 1)}. The array must not be + empty. If the array can be empty, call isEmpty() before calling + this function. + + \sa removeAt(), takeLast() +*/ + +/*! + Removes the item at index position \a i and returns it. \a i must + be a valid index position in the array (i.e., \c{0 <= \a i < size()}). + + If you don't use the return value, removeAt() is more efficient. + + \sa removeAt() + */ +QJsonValue QJsonArray::takeAt(int i) +{ + if (!a || i < 0 || i >= (int)a->length) + return QJsonValue(QJsonValue::Undefined); + + detach(); + + QJsonValue v(d, a, a->at(i)); + v.detach(); + + removeAt(i); + + return v; +} + +/*! + Inserts \a value at index position \a i in the array. If \a i + is \c 0, the value is prepended to the array. If \a i is size(), the + value is appended to the array. + + \sa append(), prepend(), replace(), removeAt() + */ +void QJsonArray::insert(int i, const QJsonValue &value) +{ + Q_ASSERT (i >= 0 && i <= (a ? (int)a->length : 0)); + + bool compressed; + int valueSize = QJsonPrivate::Value::requiredStorage(value, &compressed); + + detach(valueSize + sizeof(QJsonPrivate::Value)); + + if (!a->length) + a->tableOffset = sizeof(QJsonPrivate::Array); + + int valueOffset = a->reserveSpace(valueSize, i, 1, false); + QJsonPrivate::Value &v = (*a)[i]; + v.type = (value.t == QJsonValue::Undefined ? QJsonValue::Null : value.t); + v.latinOrIntValue = compressed; + v.latinKey = false; + v.value = QJsonPrivate::Value::valueToStore(value, valueOffset); + if (valueSize) + QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed); +} + +/*! + Replaces the item at index position \a i with \a value. \a i must + be a valid index position in the array (i.e., \c{0 <= \a i < size()}). + + \sa operator[](), removeAt() + */ +void QJsonArray::replace(int i, const QJsonValue &value) +{ + Q_ASSERT (a && i >= 0 && i < (int)(a->length)); + + bool compressed; + int valueSize = QJsonPrivate::Value::requiredStorage(value, &compressed); + + detach(valueSize); + + if (!a->length) + a->tableOffset = sizeof(QJsonPrivate::Array); + + int valueOffset = a->reserveSpace(valueSize, i, 1, true); + QJsonPrivate::Value &v = (*a)[i]; + v.type = (value.t == QJsonValue::Undefined ? QJsonValue::Null : value.t); + v.latinOrIntValue = compressed; + v.latinKey = false; + v.value = QJsonPrivate::Value::valueToStore(value, valueOffset); + if (valueSize) + QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed); + + ++d->compactionCounter; + if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2) + compact(); +} + +/*! + Returns \c true if the array contains an occurrence of \a value, otherwise \c false. + + \sa count() + */ +bool QJsonArray::contains(const QJsonValue &value) const +{ + for (int i = 0; i < size(); i++) { + if (at(i) == value) + return true; + } + return false; +} + +/*! + Returns the value at index position \a i as a modifiable reference. + \a i must be a valid index position in the array (i.e., \c{0 <= \a i < + size()}). + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. + + \sa at(), value() + */ +QJsonValueRef QJsonArray::operator [](int i) +{ + Q_ASSERT(a && i >= 0 && i < (int)a->length); + return QJsonValueRef(this, i); +} + +/*! + \overload + + Same as at(). + */ +QJsonValue QJsonArray::operator[](int i) const +{ + return at(i); +} + +/*! + Returns \c true if this array is equal to \a other. + */ +bool QJsonArray::operator==(const QJsonArray &other) const +{ + if (a == other.a) + return true; + + if (!a) + return !other.a->length; + if (!other.a) + return !a->length; + if (a->length != other.a->length) + return false; + + for (int i = 0; i < (int)a->length; ++i) { + if (QJsonValue(d, a, a->at(i)) != QJsonValue(other.d, other.a, other.a->at(i))) + return false; + } + return true; +} + +/*! + Returns \c true if this array is not equal to \a other. + */ +bool QJsonArray::operator!=(const QJsonArray &other) const +{ + return !(*this == other); +} + +/*! \fn QJsonArray::iterator QJsonArray::begin() + + Returns an \l{STL-style iterator} pointing to the first item in + the array. + + \sa constBegin(), end() +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::begin() const + + \overload +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::constBegin() const + + Returns a const \l{STL-style iterator} pointing to the first item + in the array. + + \sa begin(), constEnd() +*/ + +/*! \fn QJsonArray::iterator QJsonArray::end() + + Returns an \l{STL-style iterator} pointing to the imaginary item + after the last item in the array. + + \sa begin(), constEnd() +*/ + +/*! \fn const_iterator QJsonArray::end() const + + \overload +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::constEnd() const + + Returns a const \l{STL-style iterator} pointing to the imaginary + item after the last item in the array. + + \sa constBegin(), end() +*/ + +/*! \fn void QJsonArray::push_back(const T &value) + + This function is provided for STL compatibility. It is equivalent + to \l{QJsonArray::append()}{append(\a value)}. +*/ + +/*! \fn void QJsonArray::push_front(const T &value) + + This function is provided for STL compatibility. It is equivalent + to \l{QJsonArray::prepend()}{prepend(\a value)}. +*/ + +/*! \fn void QJsonArray::pop_front() + + This function is provided for STL compatibility. It is equivalent + to removeFirst(). The array must not be empty. If the array can be + empty, call isEmpty() before calling this function. +*/ + +/*! \fn void QJsonArray::pop_back() + + This function is provided for STL compatibility. It is equivalent + to removeLast(). The array must not be empty. If the array can be + empty, call isEmpty() before calling this function. +*/ + +/*! \fn bool QJsonArray::empty() const + + This function is provided for STL compatibility. It is equivalent + to isEmpty() and returns \c true if the array is empty. +*/ + +/*! \class QJsonArray::iterator + \brief The QJsonArray::iterator class provides an STL-style non-const iterator for QJsonArray. + + QJsonArray::iterator allows you to iterate over a QJsonArray + and to modify the array item associated with the + iterator. If you want to iterate over a const QJsonArray, use + QJsonArray::const_iterator instead. It is generally a good practice to + use QJsonArray::const_iterator on a non-const QJsonArray as well, unless + you need to change the QJsonArray through the iterator. Const + iterators are slightly faster and improves code readability. + + The default QJsonArray::iterator constructor creates an uninitialized + iterator. You must initialize it using a QJsonArray function like + QJsonArray::begin(), QJsonArray::end(), or QJsonArray::insert() before you can + start iterating. + + Most QJsonArray functions accept an integer index rather than an + iterator. For that reason, iterators are rarely useful in + connection with QJsonArray. One place where STL-style iterators do + make sense is as arguments to \l{generic algorithms}. + + Multiple iterators can be used on the same array. However, be + aware that any non-const function call performed on the QJsonArray + will render all existing iterators undefined. + + \sa QJsonArray::const_iterator +*/ + +/*! \typedef QJsonArray::iterator::iterator_category + + A synonym for \i {std::random_access_iterator_tag} indicating + this iterator is a random access iterator. +*/ + +/*! \typedef QJsonArray::iterator::difference_type + + \internal +*/ + +/*! \typedef QJsonArray::iterator::value_type + + \internal +*/ + +/*! \typedef QJsonArray::iterator::reference + + \internal +*/ + +/*! \fn QJsonArray::iterator::iterator() + + Constructs an uninitialized iterator. + + Functions like operator*() and operator++() should not be called + on an uninitialized iterator. Use operator=() to assign a value + to it before using it. + + \sa QJsonArray::begin() QJsonArray::end() +*/ + +/*! \fn QJsonArray::iterator::iterator(const iterator &other) + + Constructs a copy of \a other. +*/ + +/*! \fn QJsonValueRef QJsonArray::iterator::operator*() const + + Returns a modifiable reference to the current item. + + You can change the value of an item by using operator*() on the + left side of an assignment. + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. +*/ + +/*! \fn QJsonValueRef QJsonArray::iterator::operator[](int j) const + + Returns a modifiable reference to the item at position \c{*this + j}. + + This function is provided to make QJsonArray iterators behave like C++ + pointers. + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. + + \sa operator+() +*/ + +/*! + \fn bool QJsonArray::iterator::operator==(const iterator &other) const + \fn bool QJsonArray::iterator::operator==(const const_iterator &other) const + + Returns \c true if \a other points to the same item as this + iterator; otherwise returns \c false. + + \sa operator!=() +*/ + +/*! + \fn bool QJsonArray::iterator::operator!=(const iterator &other) const + \fn bool QJsonArray::iterator::operator!=(const const_iterator &other) const + + Returns \c true if \a other points to a different item than this + iterator; otherwise returns \c false. + + \sa operator==() +*/ + +/*! + \fn bool QJsonArray::iterator::operator<(const iterator& other) const + \fn bool QJsonArray::iterator::operator<(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is less than + the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::iterator::operator<=(const iterator& other) const + \fn bool QJsonArray::iterator::operator<=(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is less than + or equal to the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::iterator::operator>(const iterator& other) const + \fn bool QJsonArray::iterator::operator>(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is greater + than the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::iterator::operator>=(const iterator& other) const + \fn bool QJsonArray::iterator::operator>=(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is greater + than or equal to the item pointed to by the \a other iterator. +*/ + +/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator++() + + The prefix ++ operator, \c{++it}, advances the iterator to the + next item in the array and returns an iterator to the new current + item. + + Calling this function on QJsonArray::end() leads to undefined results. + + \sa operator--() +*/ + +/*! \fn QJsonArray::iterator QJsonArray::iterator::operator++(int) + + \overload + + The postfix ++ operator, \c{it++}, advances the iterator to the + next item in the array and returns an iterator to the previously + current item. +*/ + +/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator--() + + The prefix -- operator, \c{--it}, makes the preceding item + current and returns an iterator to the new current item. + + Calling this function on QJsonArray::begin() leads to undefined results. + + \sa operator++() +*/ + +/*! \fn QJsonArray::iterator QJsonArray::iterator::operator--(int) + + \overload + + The postfix -- operator, \c{it--}, makes the preceding item + current and returns an iterator to the previously current item. +*/ + +/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator+=(int j) + + Advances the iterator by \a j items. If \a j is negative, the + iterator goes backward. + + \sa operator-=(), operator+() +*/ + +/*! \fn QJsonArray::iterator &QJsonArray::iterator::operator-=(int j) + + Makes the iterator go back by \a j items. If \a j is negative, + the iterator goes forward. + + \sa operator+=(), operator-() +*/ + +/*! \fn QJsonArray::iterator QJsonArray::iterator::operator+(int j) const + + Returns an iterator to the item at \a j positions forward from + this iterator. If \a j is negative, the iterator goes backward. + + \sa operator-(), operator+=() +*/ + +/*! \fn QJsonArray::iterator QJsonArray::iterator::operator-(int j) const + + Returns an iterator to the item at \a j positions backward from + this iterator. If \a j is negative, the iterator goes forward. + + \sa operator+(), operator-=() +*/ + +/*! \fn int QJsonArray::iterator::operator-(iterator other) const + + Returns the number of items between the item pointed to by \a + other and the item pointed to by this iterator. +*/ + +/*! \class QJsonArray::const_iterator + \brief The QJsonArray::const_iterator class provides an STL-style const iterator for QJsonArray. + + QJsonArray::const_iterator allows you to iterate over a + QJsonArray. If you want to modify the QJsonArray as + you iterate over it, use QJsonArray::iterator instead. It is generally a + good practice to use QJsonArray::const_iterator on a non-const QJsonArray + as well, unless you need to change the QJsonArray through the + iterator. Const iterators are slightly faster and improves + code readability. + + The default QJsonArray::const_iterator constructor creates an + uninitialized iterator. You must initialize it using a QJsonArray + function like QJsonArray::constBegin(), QJsonArray::constEnd(), or + QJsonArray::insert() before you can start iterating. + + Most QJsonArray functions accept an integer index rather than an + iterator. For that reason, iterators are rarely useful in + connection with QJsonArray. One place where STL-style iterators do + make sense is as arguments to \l{generic algorithms}. + + Multiple iterators can be used on the same array. However, be + aware that any non-const function call performed on the QJsonArray + will render all existing iterators undefined. + + \sa QJsonArray::iterator, QJsonArrayIterator +*/ + +/*! \fn QJsonArray::const_iterator::const_iterator() + + Constructs an uninitialized iterator. + + Functions like operator*() and operator++() should not be called + on an uninitialized iterator. Use operator=() to assign a value + to it before using it. + + \sa QJsonArray::constBegin() QJsonArray::constEnd() +*/ + +/*! \typedef QJsonArray::const_iterator::iterator_category + + A synonym for \i {std::random_access_iterator_tag} indicating + this iterator is a random access iterator. +*/ + +/*! \typedef QJsonArray::const_iterator::difference_type + + \internal +*/ + +/*! \typedef QJsonArray::const_iterator::value_type + + \internal +*/ + +/*! \typedef QJsonArray::const_iterator::reference + + \internal +*/ + +/*! \fn QJsonArray::const_iterator::const_iterator(const const_iterator &other) + + Constructs a copy of \a other. +*/ + +/*! \fn QJsonArray::const_iterator::const_iterator(const iterator &other) + + Constructs a copy of \a other. +*/ + +/*! \fn QJsonValue QJsonArray::const_iterator::operator*() const + + Returns the current item. +*/ + +/*! \fn QJsonValue QJsonArray::const_iterator::operator[](int j) const + + Returns the item at position \c{*this + j}. + + This function is provided to make QJsonArray iterators behave like C++ + pointers. + + \sa operator+() +*/ + +/*! \fn bool QJsonArray::const_iterator::operator==(const const_iterator &other) const + + Returns \c true if \a other points to the same item as this + iterator; otherwise returns \c false. + + \sa operator!=() +*/ + +/*! \fn bool QJsonArray::const_iterator::operator!=(const const_iterator &other) const + + Returns \c true if \a other points to a different item than this + iterator; otherwise returns \c false. + + \sa operator==() +*/ + +/*! + \fn bool QJsonArray::const_iterator::operator<(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is less than + the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::const_iterator::operator<=(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is less than + or equal to the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::const_iterator::operator>(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is greater + than the item pointed to by the \a other iterator. +*/ + +/*! + \fn bool QJsonArray::const_iterator::operator>=(const const_iterator& other) const + + Returns \c true if the item pointed to by this iterator is greater + than or equal to the item pointed to by the \a other iterator. +*/ + +/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator++() + + The prefix ++ operator, \c{++it}, advances the iterator to the + next item in the array and returns an iterator to the new current + item. + + Calling this function on QJsonArray::end() leads to undefined results. + + \sa operator--() +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator++(int) + + \overload + + The postfix ++ operator, \c{it++}, advances the iterator to the + next item in the array and returns an iterator to the previously + current item. +*/ + +/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator--() + + The prefix -- operator, \c{--it}, makes the preceding item + current and returns an iterator to the new current item. + + Calling this function on QJsonArray::begin() leads to undefined results. + + \sa operator++() +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator--(int) + + \overload + + The postfix -- operator, \c{it--}, makes the preceding item + current and returns an iterator to the previously current item. +*/ + +/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator+=(int j) + + Advances the iterator by \a j items. If \a j is negative, the + iterator goes backward. + + \sa operator-=(), operator+() +*/ + +/*! \fn QJsonArray::const_iterator &QJsonArray::const_iterator::operator-=(int j) + + Makes the iterator go back by \a j items. If \a j is negative, + the iterator goes forward. + + \sa operator+=(), operator-() +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator+(int j) const + + Returns an iterator to the item at \a j positions forward from + this iterator. If \a j is negative, the iterator goes backward. + + \sa operator-(), operator+=() +*/ + +/*! \fn QJsonArray::const_iterator QJsonArray::const_iterator::operator-(int j) const + + Returns an iterator to the item at \a j positions backward from + this iterator. If \a j is negative, the iterator goes forward. + + \sa operator+(), operator-=() +*/ + +/*! \fn int QJsonArray::const_iterator::operator-(const_iterator other) const + + Returns the number of items between the item pointed to by \a + other and the item pointed to by this iterator. +*/ + + +/*! + \internal + */ +void QJsonArray::detach(uint reserve) +{ + if (!d) { + d = new QJsonPrivate::Data(reserve, QJsonValue::Array); + a = static_cast(d->header->root()); + d->ref.ref(); + return; + } + /* + if (reserve == 0 && d->ref.load() == 1) + return; + */ + if (reserve == 0 && int(d->ref) == 1) + return; + + QJsonPrivate::Data *x = d->clone(a, reserve); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; + a = static_cast(d->header->root()); +} + +/*! + \internal + */ +void QJsonArray::compact() +{ + if (!d || !d->compactionCounter) + return; + + detach(); + d->compact(); + a = static_cast(d->header->root()); +} + + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QJsonArray &a) +{ + if (!a.a) { + dbg << "QJsonArray()"; + return dbg; + } + QByteArray json; + QJsonPrivate::Writer::arrayToJson(a.a, json, 0, true); + dbg.nospace() << "QJsonArray(" + << json.constData() // print as utf-8 string without extra quotation marks + << ")"; + return dbg.space(); +} +#endif + +QT_END_NAMESPACE + diff --git a/qjson/qjsonarray.h b/qjson/qjsonarray.h index 9ed64e4..f4e47a7 100644 --- a/qjson/qjsonarray.h +++ b/qjson/qjsonarray.h @@ -1,224 +1,224 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONARRAY_H -#define QJSONARRAY_H - -#include "qjsonvalue.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDebug; -class QStringList; -template class QList; -typedef QList QVariantList; - -class Q_JSONRPC_EXPORT QJsonArray -{ -public: - QJsonArray(); - ~QJsonArray(); - - QJsonArray(const QJsonArray &other); - QJsonArray &operator =(const QJsonArray &other); - - static QJsonArray fromStringList(const QStringList &list); - static QJsonArray fromVariantList(const QVariantList &list); - QVariantList toVariantList() const; - - int size() const; - inline int count() const { return size(); } - - bool isEmpty() const; - QJsonValue at(int i) const; - QJsonValue first() const; - QJsonValue last() const; - - void prepend(const QJsonValue &value); - void append(const QJsonValue &value); - void removeAt(int i); - QJsonValue takeAt(int i); - inline void removeFirst() { removeAt(0); } - inline void removeLast() { removeAt(size() - 1); } - - void insert(int i, const QJsonValue &value); - void replace(int i, const QJsonValue &value); - - bool contains(const QJsonValue &element) const; - QJsonValueRef operator[](int i); - QJsonValue operator[](int i) const; - - bool operator==(const QJsonArray &other) const; - bool operator!=(const QJsonArray &other) const; - - class const_iterator; - - class iterator { - public: - QJsonArray *a; - int i; - typedef std::random_access_iterator_tag iterator_category; - typedef int difference_type; - typedef QJsonValue value_type; - //typedef T *pointer; - typedef QJsonValueRef reference; - - inline iterator() : a(0), i(0) { } - explicit inline iterator(QJsonArray *array, int index) : a(array), i(index) { } - - inline QJsonValueRef operator*() const { return QJsonValueRef(a, i); } - //inline T *operator->() const { return &concrete(i)->value; } - inline QJsonValueRef operator[](int j) const { return QJsonValueRef(a, i + j); } - - inline bool operator==(const iterator &o) const { return i == o.i; } - inline bool operator!=(const iterator &o) const { return i != o.i; } - inline bool operator<(const iterator& other) const { return i < other.i; } - inline bool operator<=(const iterator& other) const { return i <= other.i; } - inline bool operator>(const iterator& other) const { return i > other.i; } - inline bool operator>=(const iterator& other) const { return i >= other.i; } - inline bool operator==(const const_iterator &o) const { return i == o.i; } - inline bool operator!=(const const_iterator &o) const { return i != o.i; } - inline bool operator<(const const_iterator& other) const { return i < other.i; } - inline bool operator<=(const const_iterator& other) const { return i <= other.i; } - inline bool operator>(const const_iterator& other) const { return i > other.i; } - inline bool operator>=(const const_iterator& other) const { return i >= other.i; } - inline iterator &operator++() { ++i; return *this; } - inline iterator operator++(int) { iterator n = *this; ++i; return n; } - inline iterator &operator--() { i--; return *this; } - inline iterator operator--(int) { iterator n = *this; i--; return n; } - inline iterator &operator+=(int j) { i+=j; return *this; } - inline iterator &operator-=(int j) { i-=j; return *this; } - inline iterator operator+(int j) const { return iterator(a, i+j); } - inline iterator operator-(int j) const { return iterator(a, i-j); } - inline int operator-(iterator j) const { return i - j.i; } - }; - friend class iterator; - - class const_iterator { - public: - const QJsonArray *a; - int i; - typedef std::random_access_iterator_tag iterator_category; - typedef qptrdiff difference_type; - typedef QJsonValue value_type; - //typedef const T *pointer; - typedef QJsonValue reference; - - inline const_iterator() : a(0), i(0) { } - explicit inline const_iterator(const QJsonArray *array, int index) : a(array), i(index) { } - inline const_iterator(const const_iterator &o) : a(o.a), i(o.i) {} - inline const_iterator(const iterator &o) : a(o.a), i(o.i) {} - - inline QJsonValue operator*() const { return a->at(i); } - //inline T *operator->() const { return &concrete(i)->value; } - inline QJsonValue operator[](int j) const { return a->at(i+j); } - inline bool operator==(const const_iterator &o) const { return i == o.i; } - inline bool operator!=(const const_iterator &o) const { return i != o.i; } - inline bool operator<(const const_iterator& other) const { return i < other.i; } - inline bool operator<=(const const_iterator& other) const { return i <= other.i; } - inline bool operator>(const const_iterator& other) const { return i > other.i; } - inline bool operator>=(const const_iterator& other) const { return i >= other.i; } - inline const_iterator &operator++() { ++i; return *this; } - inline const_iterator operator++(int) { const_iterator n = *this; ++i; return n; } - inline const_iterator &operator--() { i--; return *this; } - inline const_iterator operator--(int) { const_iterator n = *this; i--; return n; } - inline const_iterator &operator+=(int j) { i+=j; return *this; } - inline const_iterator &operator-=(int j) { i-=j; return *this; } - inline const_iterator operator+(int j) const { return const_iterator(a, i+j); } - inline const_iterator operator-(int j) const { return const_iterator(a, i-j); } - inline int operator-(const_iterator j) const { return i - j.i; } - }; - friend class const_iterator; - - // stl style - inline iterator begin() { detach(); return iterator(this, 0); } - inline const_iterator begin() const { return const_iterator(this, 0); } - inline const_iterator constBegin() const { return const_iterator(this, 0); } - inline iterator end() { detach(); return iterator(this, size()); } - inline const_iterator end() const { return const_iterator(this, size()); } - inline const_iterator constEnd() const { return const_iterator(this, size()); } - iterator insert(iterator before, const QJsonValue &value) { insert(before.i, value); return before; } - iterator erase(iterator pos) { removeAt(pos.i); return pos; } - - // more Qt - typedef iterator Iterator; - typedef const_iterator ConstIterator; - - // stl compatibility - inline void push_back(const QJsonValue &t) { append(t); } - inline void push_front(const QJsonValue &t) { prepend(t); } - inline void pop_front() { removeFirst(); } - inline void pop_back() { removeLast(); } - inline bool empty() const { return isEmpty(); } - typedef int size_type; - typedef QJsonValue value_type; - typedef value_type *pointer; - typedef const value_type *const_pointer; - typedef QJsonValueRef reference; - typedef QJsonValue const_reference; - typedef int difference_type; - -private: - friend class QJsonPrivate::Data; - friend class QJsonValue; - friend class QJsonDocument; - friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonArray &); - - QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array); - void compact(); - void detach(uint reserve = 0); - - QJsonPrivate::Data *d; - QJsonPrivate::Array *a; -}; - -#ifndef QT_NO_DEBUG_STREAM -Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonArray &); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QJSONARRAY_H +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONARRAY_H +#define QJSONARRAY_H + +#include "qjsonvalue.h" +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDebug; +class QStringList; +template class QList; +typedef QList QVariantList; + +class Q_JSONRPC_EXPORT QJsonArray +{ +public: + QJsonArray(); + ~QJsonArray(); + + QJsonArray(const QJsonArray &other); + QJsonArray &operator =(const QJsonArray &other); + + static QJsonArray fromStringList(const QStringList &list); + static QJsonArray fromVariantList(const QVariantList &list); + QVariantList toVariantList() const; + + int size() const; + inline int count() const { return size(); } + + bool isEmpty() const; + QJsonValue at(int i) const; + QJsonValue first() const; + QJsonValue last() const; + + void prepend(const QJsonValue &value); + void append(const QJsonValue &value); + void removeAt(int i); + QJsonValue takeAt(int i); + inline void removeFirst() { removeAt(0); } + inline void removeLast() { removeAt(size() - 1); } + + void insert(int i, const QJsonValue &value); + void replace(int i, const QJsonValue &value); + + bool contains(const QJsonValue &element) const; + QJsonValueRef operator[](int i); + QJsonValue operator[](int i) const; + + bool operator==(const QJsonArray &other) const; + bool operator!=(const QJsonArray &other) const; + + class const_iterator; + + class iterator { + public: + QJsonArray *a; + int i; + typedef std::random_access_iterator_tag iterator_category; + typedef int difference_type; + typedef QJsonValue value_type; + //typedef T *pointer; + typedef QJsonValueRef reference; + + inline iterator() : a(0), i(0) { } + explicit inline iterator(QJsonArray *array, int index) : a(array), i(index) { } + + inline QJsonValueRef operator*() const { return QJsonValueRef(a, i); } + //inline T *operator->() const { return &concrete(i)->value; } + inline QJsonValueRef operator[](int j) const { return QJsonValueRef(a, i + j); } + + inline bool operator==(const iterator &o) const { return i == o.i; } + inline bool operator!=(const iterator &o) const { return i != o.i; } + inline bool operator<(const iterator& other) const { return i < other.i; } + inline bool operator<=(const iterator& other) const { return i <= other.i; } + inline bool operator>(const iterator& other) const { return i > other.i; } + inline bool operator>=(const iterator& other) const { return i >= other.i; } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline bool operator<(const const_iterator& other) const { return i < other.i; } + inline bool operator<=(const const_iterator& other) const { return i <= other.i; } + inline bool operator>(const const_iterator& other) const { return i > other.i; } + inline bool operator>=(const const_iterator& other) const { return i >= other.i; } + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { iterator n = *this; ++i; return n; } + inline iterator &operator--() { i--; return *this; } + inline iterator operator--(int) { iterator n = *this; i--; return n; } + inline iterator &operator+=(int j) { i+=j; return *this; } + inline iterator &operator-=(int j) { i-=j; return *this; } + inline iterator operator+(int j) const { return iterator(a, i+j); } + inline iterator operator-(int j) const { return iterator(a, i-j); } + inline int operator-(iterator j) const { return i - j.i; } + }; + friend class iterator; + + class const_iterator { + public: + const QJsonArray *a; + int i; + typedef std::random_access_iterator_tag iterator_category; + typedef qptrdiff difference_type; + typedef QJsonValue value_type; + //typedef const T *pointer; + typedef QJsonValue reference; + + inline const_iterator() : a(0), i(0) { } + explicit inline const_iterator(const QJsonArray *array, int index) : a(array), i(index) { } + inline const_iterator(const const_iterator &o) : a(o.a), i(o.i) {} + inline const_iterator(const iterator &o) : a(o.a), i(o.i) {} + + inline QJsonValue operator*() const { return a->at(i); } + //inline T *operator->() const { return &concrete(i)->value; } + inline QJsonValue operator[](int j) const { return a->at(i+j); } + inline bool operator==(const const_iterator &o) const { return i == o.i; } + inline bool operator!=(const const_iterator &o) const { return i != o.i; } + inline bool operator<(const const_iterator& other) const { return i < other.i; } + inline bool operator<=(const const_iterator& other) const { return i <= other.i; } + inline bool operator>(const const_iterator& other) const { return i > other.i; } + inline bool operator>=(const const_iterator& other) const { return i >= other.i; } + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator n = *this; ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { const_iterator n = *this; i--; return n; } + inline const_iterator &operator+=(int j) { i+=j; return *this; } + inline const_iterator &operator-=(int j) { i-=j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(a, i+j); } + inline const_iterator operator-(int j) const { return const_iterator(a, i-j); } + inline int operator-(const_iterator j) const { return i - j.i; } + }; + friend class const_iterator; + + // stl style + inline iterator begin() { detach(); return iterator(this, 0); } + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline iterator end() { detach(); return iterator(this, size()); } + inline const_iterator end() const { return const_iterator(this, size()); } + inline const_iterator constEnd() const { return const_iterator(this, size()); } + iterator insert(iterator before, const QJsonValue &value) { insert(before.i, value); return before; } + iterator erase(iterator pos) { removeAt(pos.i); return pos; } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + + // stl compatibility + inline void push_back(const QJsonValue &t) { append(t); } + inline void push_front(const QJsonValue &t) { prepend(t); } + inline void pop_front() { removeFirst(); } + inline void pop_back() { removeLast(); } + inline bool empty() const { return isEmpty(); } + typedef int size_type; + typedef QJsonValue value_type; + typedef value_type *pointer; + typedef const value_type *const_pointer; + typedef QJsonValueRef reference; + typedef QJsonValue const_reference; + typedef int difference_type; + +private: + friend class QJsonPrivate::Data; + friend class QJsonValue; + friend class QJsonDocument; + friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonArray &); + + QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array); + void compact(); + void detach(uint reserve = 0); + + QJsonPrivate::Data *d; + QJsonPrivate::Array *a; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonArray &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QJSONARRAY_H diff --git a/qjson/qjsondocument.cpp b/qjson/qjsondocument.cpp index 28f63e4..df475da 100644 --- a/qjson/qjsondocument.cpp +++ b/qjson/qjsondocument.cpp @@ -1,537 +1,537 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjsondocument.h" -#include "qjsonobject.h" -#include "qjsonvalue.h" -#include "qjsonarray.h" -#include -#include -#include -#include "qjsonwriter_p.h" -#include "qjsonparser_p.h" -#include "qjson_p.h" - -QT_BEGIN_NAMESPACE - -/*! \class QJsonDocument - \ingroup json - \reentrant - \since 5.0 - - \brief The QJsonDocument class provides a way to read and write JSON documents. - - QJsonDocument is a class that wraps a complete JSON document and can read and - write this document both from a UTF-8 encoded text based representation as well - as Qt's own binary format. - - A JSON document can be converted from its text-based representation to a QJsonDocument - using QJsonDocument::fromJson(). toJson() converts it back to text. The parser is very - fast and efficient and converts the JSON to the binary representation used by Qt. - - Validity of the parsed document can be queried with !isNull() - - A document can be queried as to whether it contains an array or an object using isArray() - and isObject(). The array or object contained in the document can be retrieved using - array() or object() and then read or manipulated. - - A document can also be created from a stored binary representation using fromBinaryData() or - fromRawData(). -*/ - -/*! - * Constructs an empty and invalid document. - */ -QJsonDocument::QJsonDocument() - : d(0) -{ -} - -/*! - * Creates a QJsonDocument from \a object. - */ -QJsonDocument::QJsonDocument(const QJsonObject &object) - : d(0) -{ - setObject(object); -} - -/*! - * Constructs a QJsonDocument from \a array. - */ -QJsonDocument::QJsonDocument(const QJsonArray &array) - : d(0) -{ - setArray(array); -} - -/*! \internal - */ -QJsonDocument::QJsonDocument(QJsonPrivate::Data *data) - : d(data) -{ - Q_ASSERT(d); - d->ref.ref(); -} - -/*! - Deletes the document. - - Binary data set with fromRawData is not freed. - */ -QJsonDocument::~QJsonDocument() -{ - if (d && !d->ref.deref()) - delete d; -} - -/*! - * Creates a copy of the \a other document. - */ -QJsonDocument::QJsonDocument(const QJsonDocument &other) -{ - d = other.d; - if (d) - d->ref.ref(); -} - -/*! - * Assigns the \a other document to this QJsonDocument. - * Returns a reference to this object. - */ -QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other) -{ - if (d != other.d) { - if (d && !d->ref.deref()) - delete d; - d = other.d; - if (d) - d->ref.ref(); - } - - return *this; -} - -/*! \enum QJsonDocument::DataValidation - - This value is used to tell QJsonDocument whether to validate the binary data - when converting to a QJsonDocument using fromBinaryData() or fromRawData(). - - \value Validate Validate the data before using it. This is the default. - \value BypassValidation Bypasses data validation. Only use if you received the - data from a trusted place and know it's valid, as using of invalid data can crash - the application. - */ - -/*! - Creates a QJsonDocument that uses the first \a size bytes from - \a data. It assumes \a data contains a binary encoded JSON document. - The created document does not take ownership of \a data and the caller - has to guarantee that \a data will not be deleted or modified as long as - any QJsonDocument, QJsonObject or QJsonArray still references the data. - - \a data has to be aligned to a 4 byte boundary. - - \a validation decides whether the data is checked for validity before being used. - By default the data is validated. If the \a data is not valid, the method returns - a null document. - - Returns a QJsonDocument representing the data. - - \sa rawData fromBinaryData isNull DataValidation - */ -QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation) -{ - if (quintptr(data) & 3) { - qWarning() <<"QJsonDocument::fromRawData: data has to have 4 byte alignment"; - return QJsonDocument(); - } - - QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size); - d->ownsData = false; - - if (validation != BypassValidation && !d->valid()) { - delete d; - return QJsonDocument(); - } - - return QJsonDocument(d); -} - -/*! - Returns the raw binary representation of the data - \a size will contain the size of the \a data. - - This method is useful to e.g. stream the JSON document - in it's binary form to a file. - */ -const char *QJsonDocument::rawData(int *size) const -{ - if (!d) { - *size = 0; - return 0; - } - *size = d->alloc; - return d->rawData; -} - -/*! - Creates a QJsonDocument from \a data. - - \a validation decides whether the data is checked for validity before being used. - By default the data is validated. If the \a data is not valid, the method returns - a null document. - - \sa toBinaryData fromRawData isNull DataValidation - */ -QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation) -{ - QJsonPrivate::Header h; - memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header)); - QJsonPrivate::Base root; - memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base)); - - // do basic checks here, so we don't try to allocate more memory than we can. - if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) || - h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u || - sizeof(QJsonPrivate::Header) + root.size > (uint)data.size()) - return QJsonDocument(); - - char *raw = (char *)malloc(data.size()); - if (!raw) - return QJsonDocument(); - - memcpy(raw, data.constData(), data.size()); - QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, data.size()); - - if (validation != BypassValidation && !d->valid()) { - delete d; - return QJsonDocument(); - } - - return QJsonDocument(d); -} - -/*! - Creates a QJsonDocument from the QVariant \a variant. - - If the \a variant contains any other type than a QVariant::Map, - QVariant::List or QVariant::StringList, the returned document - document is invalid. - - \sa toVariant - */ -QJsonDocument QJsonDocument::fromVariant(const QVariant &variant) -{ - QJsonDocument doc; - if (variant.type() == QVariant::Map) { - doc.setObject(QJsonObject::fromVariantMap(variant.toMap())); - } else if (variant.type() == QVariant::List) { - doc.setArray(QJsonArray::fromVariantList(variant.toList())); - } else if (variant.type() == QVariant::StringList) { - doc.setArray(QJsonArray::fromStringList(variant.toStringList())); - } - return doc; -} - -/*! - Returns a QVariant representing the Json document. - - The returned variant will be a QVariantList if the document is - a QJsonArray and a QVariantMap if the document is a QJsonObject. - - \sa fromVariant, QJsonValue::toVariant() - */ -QVariant QJsonDocument::toVariant() const -{ - if (!d) - return QVariant(); - - if (d->header->root()->isArray()) - return QJsonArray(d, static_cast(d->header->root())).toVariantList(); - else - return QJsonObject(d, static_cast(d->header->root())).toVariantMap(); -} - -/*! - Converts the QJsonDocument to a UTF-8 encoded JSON document. - - \sa fromJson - */ -QByteArray QJsonDocument::toJson() const -{ - if (!d) - return QByteArray(); - - QByteArray json; - - if (d->header->root()->isArray()) - QJsonPrivate::Writer::arrayToJson(static_cast(d->header->root()), json, 0); - else - QJsonPrivate::Writer::objectToJson(static_cast(d->header->root()), json, 0); - - return json; -} - -/*! - Parses a UTF-8 encoded JSON document and creates a QJsonDocument - from it. isNull() will return \c false if no error was encountered during - parsing. - - \sa toJson - */ -QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) -{ - QJsonPrivate::Parser parser(json.constData(), json.length()); - return parser.parse(error); -} - -/*! - Returns true if the document doesn't contain any data. - */ -bool QJsonDocument::isEmpty() const -{ - if (!d) - return true; - - return false; -} - -/*! - Returns a binary representation of the document. - - The binary representation is also the native format used internally in Qt, - and is very efficient and fast to convert to and from. - - The binary format can be stored on disk and interchanged with other applications - or computers. fromBinaryData() can be used to convert it back into a - JSON document. - - \sa fromBinaryData - */ -QByteArray QJsonDocument::toBinaryData() const -{ - if (!d || !d->rawData) - return QByteArray(); - - return QByteArray(d->rawData, d->header->root()->size + sizeof(QJsonPrivate::Header)); -} - -/*! - Returns true if the document contains an array. - - \sa array() isObject() - */ -bool QJsonDocument::isArray() const -{ - if (!d) - return false; - - QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData; - return h->root()->isArray(); -} - -/*! - Returns true if the document contains an object. - - \sa object() isArray() - */ -bool QJsonDocument::isObject() const -{ - if (!d) - return false; - - QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData; - return h->root()->isObject(); -} - -/*! - Returns the QJsonObject contained in the document. - - Returns an empty object if the document contains an - array. - - \sa isObject array setObject - */ -QJsonObject QJsonDocument::object() const -{ - if (d) { - QJsonPrivate::Base *b = d->header->root(); - if (b->isObject()) - return QJsonObject(d, static_cast(b)); - } - return QJsonObject(); -} - -/*! - Returns the QJsonArray contained in the document. - - Returns an empty array if the document contains an - object. - - \sa isArray object setArray - */ -QJsonArray QJsonDocument::array() const -{ - if (d) { - QJsonPrivate::Base *b = d->header->root(); - if (b->isArray()) - return QJsonArray(d, static_cast(b)); - } - return QJsonArray(); -} - -/*! - Sets \a object as the main object of this document. - - \sa setArray object - */ -void QJsonDocument::setObject(const QJsonObject &object) -{ - if (d && !d->ref.deref()) - delete d; - - d = object.d; - - if (!d) { - d = new QJsonPrivate::Data(0, QJsonValue::Object); - } else if (d->compactionCounter || object.o != d->header->root()) { - QJsonObject o(object); - if (d->compactionCounter) - o.compact(); - else - o.detach(); - d = o.d; - d->ref.ref(); - return; - } - d->ref.ref(); -} - -/*! - Sets \a array as the main object of this document. - - \sa setObject array - */ -void QJsonDocument::setArray(const QJsonArray &array) -{ - if (d && !d->ref.deref()) - delete d; - - d = array.d; - - if (!d) { - d = new QJsonPrivate::Data(0, QJsonValue::Array); - } else if (d->compactionCounter || array.a != d->header->root()) { - QJsonArray a(array); - if (d->compactionCounter) - a.compact(); - else - a.detach(); - d = a.d; - d->ref.ref(); - return; - } - d->ref.ref(); -} - -/*! - Returns \c true if the \a other document is equal to this document. - */ -bool QJsonDocument::operator==(const QJsonDocument &other) const -{ - if (d == other.d) - return true; - - if (!d || !other.d) - return false; - - if (d->header->root()->isArray() != other.d->header->root()->isArray()) - return false; - - if (d->header->root()->isObject()) - return QJsonObject(d, static_cast(d->header->root())) - == QJsonObject(other.d, static_cast(other.d->header->root())); - else - return QJsonArray(d, static_cast(d->header->root())) - == QJsonArray(other.d, static_cast(other.d->header->root())); -} - -/*! - \fn bool QJsonDocument::operator!=(const QJsonDocument &other) const - - returns \c true if \a other is not equal to this document - */ - -/*! - returns true if this document is null. - - Null documents are documents created through the default constructor. - - Documents created from UTF-8 encoded text or the binary format are - validated during parsing. If validation fails, the returned document - will also be null. - */ -bool QJsonDocument::isNull() const -{ - return (d == 0); -} - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QJsonDocument &o) -{ - if (!o.d) { - dbg << "QJsonDocument()"; - return dbg; - } - QByteArray json; - if (o.d->header->root()->isArray()) - QJsonPrivate::Writer::arrayToJson(static_cast(o.d->header->root()), json, 0, true); - else - QJsonPrivate::Writer::objectToJson(static_cast(o.d->header->root()), json, 0, true); - dbg.nospace() << "QJsonDocument(" - << json.constData() // print as utf-8 string without extra quotation marks - << ")"; - return dbg.space(); -} -#endif - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjsondocument.h" +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qjsonarray.h" +#include +#include +#include +#include "qjsonwriter_p.h" +#include "qjsonparser_p.h" +#include "qjson_p.h" + +QT_BEGIN_NAMESPACE + +/*! \class QJsonDocument + \ingroup json + \reentrant + \since 5.0 + + \brief The QJsonDocument class provides a way to read and write JSON documents. + + QJsonDocument is a class that wraps a complete JSON document and can read and + write this document both from a UTF-8 encoded text based representation as well + as Qt's own binary format. + + A JSON document can be converted from its text-based representation to a QJsonDocument + using QJsonDocument::fromJson(). toJson() converts it back to text. The parser is very + fast and efficient and converts the JSON to the binary representation used by Qt. + + Validity of the parsed document can be queried with !isNull() + + A document can be queried as to whether it contains an array or an object using isArray() + and isObject(). The array or object contained in the document can be retrieved using + array() or object() and then read or manipulated. + + A document can also be created from a stored binary representation using fromBinaryData() or + fromRawData(). +*/ + +/*! + * Constructs an empty and invalid document. + */ +QJsonDocument::QJsonDocument() + : d(0) +{ +} + +/*! + * Creates a QJsonDocument from \a object. + */ +QJsonDocument::QJsonDocument(const QJsonObject &object) + : d(0) +{ + setObject(object); +} + +/*! + * Constructs a QJsonDocument from \a array. + */ +QJsonDocument::QJsonDocument(const QJsonArray &array) + : d(0) +{ + setArray(array); +} + +/*! \internal + */ +QJsonDocument::QJsonDocument(QJsonPrivate::Data *data) + : d(data) +{ + Q_ASSERT(d); + d->ref.ref(); +} + +/*! + Deletes the document. + + Binary data set with fromRawData is not freed. + */ +QJsonDocument::~QJsonDocument() +{ + if (d && !d->ref.deref()) + delete d; +} + +/*! + * Creates a copy of the \a other document. + */ +QJsonDocument::QJsonDocument(const QJsonDocument &other) +{ + d = other.d; + if (d) + d->ref.ref(); +} + +/*! + * Assigns the \a other document to this QJsonDocument. + * Returns a reference to this object. + */ +QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other) +{ + if (d != other.d) { + if (d && !d->ref.deref()) + delete d; + d = other.d; + if (d) + d->ref.ref(); + } + + return *this; +} + +/*! \enum QJsonDocument::DataValidation + + This value is used to tell QJsonDocument whether to validate the binary data + when converting to a QJsonDocument using fromBinaryData() or fromRawData(). + + \value Validate Validate the data before using it. This is the default. + \value BypassValidation Bypasses data validation. Only use if you received the + data from a trusted place and know it's valid, as using of invalid data can crash + the application. + */ + +/*! + Creates a QJsonDocument that uses the first \a size bytes from + \a data. It assumes \a data contains a binary encoded JSON document. + The created document does not take ownership of \a data and the caller + has to guarantee that \a data will not be deleted or modified as long as + any QJsonDocument, QJsonObject or QJsonArray still references the data. + + \a data has to be aligned to a 4 byte boundary. + + \a validation decides whether the data is checked for validity before being used. + By default the data is validated. If the \a data is not valid, the method returns + a null document. + + Returns a QJsonDocument representing the data. + + \sa rawData fromBinaryData isNull DataValidation + */ +QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation) +{ + if (quintptr(data) & 3) { + qWarning() <<"QJsonDocument::fromRawData: data has to have 4 byte alignment"; + return QJsonDocument(); + } + + QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size); + d->ownsData = false; + + if (validation != BypassValidation && !d->valid()) { + delete d; + return QJsonDocument(); + } + + return QJsonDocument(d); +} + +/*! + Returns the raw binary representation of the data + \a size will contain the size of the \a data. + + This method is useful to e.g. stream the JSON document + in it's binary form to a file. + */ +const char *QJsonDocument::rawData(int *size) const +{ + if (!d) { + *size = 0; + return 0; + } + *size = d->alloc; + return d->rawData; +} + +/*! + Creates a QJsonDocument from \a data. + + \a validation decides whether the data is checked for validity before being used. + By default the data is validated. If the \a data is not valid, the method returns + a null document. + + \sa toBinaryData fromRawData isNull DataValidation + */ +QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation) +{ + QJsonPrivate::Header h; + memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header)); + QJsonPrivate::Base root; + memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base)); + + // do basic checks here, so we don't try to allocate more memory than we can. + if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) || + h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u || + sizeof(QJsonPrivate::Header) + root.size > (uint)data.size()) + return QJsonDocument(); + + char *raw = (char *)malloc(data.size()); + if (!raw) + return QJsonDocument(); + + memcpy(raw, data.constData(), data.size()); + QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, data.size()); + + if (validation != BypassValidation && !d->valid()) { + delete d; + return QJsonDocument(); + } + + return QJsonDocument(d); +} + +/*! + Creates a QJsonDocument from the QVariant \a variant. + + If the \a variant contains any other type than a QVariant::Map, + QVariant::List or QVariant::StringList, the returned document + document is invalid. + + \sa toVariant + */ +QJsonDocument QJsonDocument::fromVariant(const QVariant &variant) +{ + QJsonDocument doc; + if (variant.type() == QVariant::Map) { + doc.setObject(QJsonObject::fromVariantMap(variant.toMap())); + } else if (variant.type() == QVariant::List) { + doc.setArray(QJsonArray::fromVariantList(variant.toList())); + } else if (variant.type() == QVariant::StringList) { + doc.setArray(QJsonArray::fromStringList(variant.toStringList())); + } + return doc; +} + +/*! + Returns a QVariant representing the Json document. + + The returned variant will be a QVariantList if the document is + a QJsonArray and a QVariantMap if the document is a QJsonObject. + + \sa fromVariant, QJsonValue::toVariant() + */ +QVariant QJsonDocument::toVariant() const +{ + if (!d) + return QVariant(); + + if (d->header->root()->isArray()) + return QJsonArray(d, static_cast(d->header->root())).toVariantList(); + else + return QJsonObject(d, static_cast(d->header->root())).toVariantMap(); +} + +/*! + Converts the QJsonDocument to a UTF-8 encoded JSON document. + + \sa fromJson + */ +QByteArray QJsonDocument::toJson() const +{ + if (!d) + return QByteArray(); + + QByteArray json; + + if (d->header->root()->isArray()) + QJsonPrivate::Writer::arrayToJson(static_cast(d->header->root()), json, 0); + else + QJsonPrivate::Writer::objectToJson(static_cast(d->header->root()), json, 0); + + return json; +} + +/*! + Parses a UTF-8 encoded JSON document and creates a QJsonDocument + from it. isNull() will return \c false if no error was encountered during + parsing. + + \sa toJson + */ +QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) +{ + QJsonPrivate::Parser parser(json.constData(), json.length()); + return parser.parse(error); +} + +/*! + Returns true if the document doesn't contain any data. + */ +bool QJsonDocument::isEmpty() const +{ + if (!d) + return true; + + return false; +} + +/*! + Returns a binary representation of the document. + + The binary representation is also the native format used internally in Qt, + and is very efficient and fast to convert to and from. + + The binary format can be stored on disk and interchanged with other applications + or computers. fromBinaryData() can be used to convert it back into a + JSON document. + + \sa fromBinaryData + */ +QByteArray QJsonDocument::toBinaryData() const +{ + if (!d || !d->rawData) + return QByteArray(); + + return QByteArray(d->rawData, d->header->root()->size + sizeof(QJsonPrivate::Header)); +} + +/*! + Returns true if the document contains an array. + + \sa array() isObject() + */ +bool QJsonDocument::isArray() const +{ + if (!d) + return false; + + QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData; + return h->root()->isArray(); +} + +/*! + Returns true if the document contains an object. + + \sa object() isArray() + */ +bool QJsonDocument::isObject() const +{ + if (!d) + return false; + + QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData; + return h->root()->isObject(); +} + +/*! + Returns the QJsonObject contained in the document. + + Returns an empty object if the document contains an + array. + + \sa isObject array setObject + */ +QJsonObject QJsonDocument::object() const +{ + if (d) { + QJsonPrivate::Base *b = d->header->root(); + if (b->isObject()) + return QJsonObject(d, static_cast(b)); + } + return QJsonObject(); +} + +/*! + Returns the QJsonArray contained in the document. + + Returns an empty array if the document contains an + object. + + \sa isArray object setArray + */ +QJsonArray QJsonDocument::array() const +{ + if (d) { + QJsonPrivate::Base *b = d->header->root(); + if (b->isArray()) + return QJsonArray(d, static_cast(b)); + } + return QJsonArray(); +} + +/*! + Sets \a object as the main object of this document. + + \sa setArray object + */ +void QJsonDocument::setObject(const QJsonObject &object) +{ + if (d && !d->ref.deref()) + delete d; + + d = object.d; + + if (!d) { + d = new QJsonPrivate::Data(0, QJsonValue::Object); + } else if (d->compactionCounter || object.o != d->header->root()) { + QJsonObject o(object); + if (d->compactionCounter) + o.compact(); + else + o.detach(); + d = o.d; + d->ref.ref(); + return; + } + d->ref.ref(); +} + +/*! + Sets \a array as the main object of this document. + + \sa setObject array + */ +void QJsonDocument::setArray(const QJsonArray &array) +{ + if (d && !d->ref.deref()) + delete d; + + d = array.d; + + if (!d) { + d = new QJsonPrivate::Data(0, QJsonValue::Array); + } else if (d->compactionCounter || array.a != d->header->root()) { + QJsonArray a(array); + if (d->compactionCounter) + a.compact(); + else + a.detach(); + d = a.d; + d->ref.ref(); + return; + } + d->ref.ref(); +} + +/*! + Returns \c true if the \a other document is equal to this document. + */ +bool QJsonDocument::operator==(const QJsonDocument &other) const +{ + if (d == other.d) + return true; + + if (!d || !other.d) + return false; + + if (d->header->root()->isArray() != other.d->header->root()->isArray()) + return false; + + if (d->header->root()->isObject()) + return QJsonObject(d, static_cast(d->header->root())) + == QJsonObject(other.d, static_cast(other.d->header->root())); + else + return QJsonArray(d, static_cast(d->header->root())) + == QJsonArray(other.d, static_cast(other.d->header->root())); +} + +/*! + \fn bool QJsonDocument::operator!=(const QJsonDocument &other) const + + returns \c true if \a other is not equal to this document + */ + +/*! + returns true if this document is null. + + Null documents are documents created through the default constructor. + + Documents created from UTF-8 encoded text or the binary format are + validated during parsing. If validation fails, the returned document + will also be null. + */ +bool QJsonDocument::isNull() const +{ + return (d == 0); +} + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QJsonDocument &o) +{ + if (!o.d) { + dbg << "QJsonDocument()"; + return dbg; + } + QByteArray json; + if (o.d->header->root()->isArray()) + QJsonPrivate::Writer::arrayToJson(static_cast(o.d->header->root()), json, 0, true); + else + QJsonPrivate::Writer::objectToJson(static_cast(o.d->header->root()), json, 0, true); + dbg.nospace() << "QJsonDocument(" + << json.constData() // print as utf-8 string without extra quotation marks + << ")"; + return dbg.space(); +} +#endif + +QT_END_NAMESPACE diff --git a/qjson/qjsondocument.h b/qjson/qjsondocument.h index cc14490..46b7f64 100644 --- a/qjson/qjsondocument.h +++ b/qjson/qjsondocument.h @@ -1,146 +1,146 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONDOCUMENT_H -#define QJSONDOCUMENT_H - -#include "qjsonvalue.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDebug; - -namespace QJsonPrivate { - class Parser; -} - -struct Q_JSONRPC_EXPORT QJsonParseError -{ - enum ParseError { - NoError = 0, - UnterminatedObject, - MissingNameSeparator, - UnterminatedArray, - MissingValueSeparator, - IllegalValue, - EndOfNumber, - IllegalNumber, - StringEscapeSequence, - StringUTF8Scan, - EndOfString, - MissingObject - }; - - int offset; - ParseError error; -}; - -class Q_JSONRPC_EXPORT QJsonDocument -{ -public: -#ifdef Q_LITTLE_ENDIAN - static const uint BinaryFormatTag = ('q') | ('b' << 8) | ('j' << 16) | ('s' << 24); -#else - static const uint BinaryFormatTag = ('q' << 24) | ('b' << 16) | ('j' << 8) | ('s'); -#endif - - QJsonDocument(); - explicit QJsonDocument(const QJsonObject &object); - explicit QJsonDocument(const QJsonArray &array); - ~QJsonDocument(); - - QJsonDocument(const QJsonDocument &other); - QJsonDocument &operator =(const QJsonDocument &other); - - enum DataValidation { - Validate, - BypassValidation - }; - - static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate); - const char *rawData(int *size) const; - - static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate); - QByteArray toBinaryData() const; - - static QJsonDocument fromVariant(const QVariant &variant); - QVariant toVariant() const; - - static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0); - QByteArray toJson() const; - - bool isEmpty() const; - bool isArray() const; - bool isObject() const; - - QJsonObject object() const; - QJsonArray array() const; - - void setObject(const QJsonObject &object); - void setArray(const QJsonArray &array); - - bool operator==(const QJsonDocument &other) const; - bool operator!=(const QJsonDocument &other) const { return !(*this == other); } - - bool isNull() const; - -private: - friend class QJsonValue; - friend class QJsonPrivate::Data; - friend class QJsonPrivate::Parser; - friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); - - QJsonDocument(QJsonPrivate::Data *data); - - QJsonPrivate::Data *d; -}; - -#ifndef QT_NO_DEBUG_STREAM -Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QJSONDOCUMENT_H +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONDOCUMENT_H +#define QJSONDOCUMENT_H + +#include "qjsonvalue.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDebug; + +namespace QJsonPrivate { + class Parser; +} + +struct Q_JSONRPC_EXPORT QJsonParseError +{ + enum ParseError { + NoError = 0, + UnterminatedObject, + MissingNameSeparator, + UnterminatedArray, + MissingValueSeparator, + IllegalValue, + EndOfNumber, + IllegalNumber, + StringEscapeSequence, + StringUTF8Scan, + EndOfString, + MissingObject + }; + + int offset; + ParseError error; +}; + +class Q_JSONRPC_EXPORT QJsonDocument +{ +public: +#ifdef Q_LITTLE_ENDIAN + static const uint BinaryFormatTag = ('q') | ('b' << 8) | ('j' << 16) | ('s' << 24); +#else + static const uint BinaryFormatTag = ('q' << 24) | ('b' << 16) | ('j' << 8) | ('s'); +#endif + + QJsonDocument(); + explicit QJsonDocument(const QJsonObject &object); + explicit QJsonDocument(const QJsonArray &array); + ~QJsonDocument(); + + QJsonDocument(const QJsonDocument &other); + QJsonDocument &operator =(const QJsonDocument &other); + + enum DataValidation { + Validate, + BypassValidation + }; + + static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate); + const char *rawData(int *size) const; + + static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate); + QByteArray toBinaryData() const; + + static QJsonDocument fromVariant(const QVariant &variant); + QVariant toVariant() const; + + static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0); + QByteArray toJson() const; + + bool isEmpty() const; + bool isArray() const; + bool isObject() const; + + QJsonObject object() const; + QJsonArray array() const; + + void setObject(const QJsonObject &object); + void setArray(const QJsonArray &array); + + bool operator==(const QJsonDocument &other) const; + bool operator!=(const QJsonDocument &other) const { return !(*this == other); } + + bool isNull() const; + +private: + friend class QJsonValue; + friend class QJsonPrivate::Data; + friend class QJsonPrivate::Parser; + friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); + + QJsonDocument(QJsonPrivate::Data *data); + + QJsonPrivate::Data *d; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonDocument &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QJSONDOCUMENT_H diff --git a/qjson/qjsonexport.h b/qjson/qjsonexport.h index f7e3c42..08238a8 100644 --- a/qjson/qjsonexport.h +++ b/qjson/qjsonexport.h @@ -1,16 +1,16 @@ - -#ifndef QJSONEXPORT_H -#define QJSONEXPORT_H - - -#ifdef Q_JSONRPC_DLL -# ifdef Q_BUILD_JSONRPC // build qjsonrpc Dll -# define Q_JSONRPC_EXPORT Q_DECL_EXPORT -# else // use qjsonrpc as Dll -# define Q_JSONRPC_EXPORT Q_DECL_IMPORT -# endif -#else -# define Q_JSONRPC_EXPORT -#endif - -#endif + +#ifndef QJSONEXPORT_H +#define QJSONEXPORT_H + + +#ifdef Q_JSONRPC_DLL +# ifdef Q_BUILD_JSONRPC // build qjsonrpc Dll +# define Q_JSONRPC_EXPORT Q_DECL_EXPORT +# else // use qjsonrpc as Dll +# define Q_JSONRPC_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_JSONRPC_EXPORT +#endif + +#endif diff --git a/qjson/qjsonobject.cpp b/qjson/qjsonobject.cpp index a96195d..b9244c9 100644 --- a/qjson/qjsonobject.cpp +++ b/qjson/qjsonobject.cpp @@ -1,1022 +1,1022 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjsonobject.h" -#include "qjsonvalue.h" -#include "qjsonarray.h" -#include -#include -#include -#include "qjson_p.h" -#include "qjsonwriter_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QJsonObject - \ingroup json - \reentrant - \since 5.0 - - \brief The QJsonObject class encapsulates a JSON object. - - A JSON object is a list of key value pairs, where the keys are unique strings - and the values are represented by a QJsonValue. - - A QJsonObject can be converted to and from a QVariantMap. You can query the - number of (key, value) pairs with size(), insert(), and remove() entries from it - and iterate over its content using the standard C++ iterator pattern. - - QJsonObject is an implicitly shared class, and shares the data with the document - it has been created from as long as it is not being modified. - - You can convert the array to and from text based JSON through QJsonDocument. -*/ - -/*! - Constructs an empty JSON object - - \sa isEmpty - */ -QJsonObject::QJsonObject() - : d(0), o(0) -{ -} - -/*! - \internal - */ -QJsonObject::QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object) - : d(data), o(object) -{ - Q_ASSERT(d); - Q_ASSERT(o); - d->ref.ref(); -} - - -/*! - Destroys the object. - */ -QJsonObject::~QJsonObject() -{ - if (d && !d->ref.deref()) - delete d; -} - -/*! - Creates a copy of \a other. - - Since QJsonObject is implicitly shared, the copy is shallow - as long as the object does not get modified. - */ -QJsonObject::QJsonObject(const QJsonObject &other) -{ - d = other.d; - o = other.o; - if (d) - d->ref.ref(); -} - -/*! - Assigns \a other to this object. - */ -QJsonObject &QJsonObject::operator =(const QJsonObject &other) -{ - if (d != other.d) { - if (d && !d->ref.deref()) - delete d; - d = other.d; - if (d) - d->ref.ref(); - } - o = other.o; - - return *this; -} - -/*! - Converts the variant map \a map to a QJsonObject. - - The keys in \a map will be used as the keys in the JSON object, - and the QVariant values will be converted to JSON values. - - \sa toVariantMap, QJsonValue::fromVariant - */ -QJsonObject QJsonObject::fromVariantMap(const QVariantMap &map) -{ - // ### this is implemented the trivial way, not the most efficient way - - QJsonObject object; - for (QVariantMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) - object.insert(it.key(), QJsonValue::fromVariant(it.value())); - return object; -} - -/*! - Converts this object to a QVariantMap. - - Returns the created map. - */ -QVariantMap QJsonObject::toVariantMap() const -{ - QVariantMap map; - if (o) { - for (uint i = 0; i < o->length; ++i) { - QJsonPrivate::Entry *e = o->entryAt(i); - map.insert(e->key(), QJsonValue(d, o, e->value).toVariant()); - } - } - return map; -} - -/*! - Returns a list of all keys in this object. - */ -QStringList QJsonObject::keys() const -{ - if (!d) - return QStringList(); - - QStringList keys; - - for (uint i = 0; i < o->length; ++i) { - QJsonPrivate::Entry *e = o->entryAt(i); - keys.append(e->key()); - } - - return keys; -} - -/*! - Returns the the number of (key, value) pairs stored in the object. - */ -int QJsonObject::size() const -{ - if (!d) - return 0; - - return o->length; -} - -/*! - Returns \c true if the object is empty. This is the same as size() == 0. - - \sa size - */ -bool QJsonObject::isEmpty() const -{ - if (!d) - return true; - - return !o->length; -} - -/*! - Returns a QJsonValue representing the value for the key \a key. - - The returned QJsonValue is \c Undefined, if the key does not exist. - - \sa setValue, QJsonValue, QJsonValue::isUndefined - */ -QJsonValue QJsonObject::value(const QString &key) const -{ - if (!d) - return QJsonValue(); - - bool keyExists; - int i = o->indexOf(key, &keyExists); - if (!keyExists) - return QJsonValue(QJsonValue::Undefined); - return QJsonValue(d, o, o->entryAt(i)->value); -} - -/*! - Returns a QJsonValue representing the value for the key \a key. - - This does the same as value(). - - The returned QJsonValue is \c Undefined, if the key does not exist. - - \sa value, setValue, QJsonValue, QJsonValue::isUndefined - */ -QJsonValue QJsonObject::operator [](const QString &key) const -{ - return value(key); -} - -/*! - Returns a reference to the value for \a key. - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. - - \sa setValue, value - */ -QJsonValueRef QJsonObject::operator [](const QString &key) -{ - // ### somewhat inefficient, as we lookup the key twice if it doesn't yet exist - bool keyExists = false; - int index = o ? o->indexOf(key, &keyExists) : -1; - if (!keyExists) { - iterator i = insert(key, QJsonValue()); - index = i.i; - } - return QJsonValueRef(this, index); -} - -/*! - Inserts a new item with the key \a key and a value of \a value. - - If there is already an item with the key \a key then that item's value - is replaced with \a value. - - Returns an iterator pointing to the inserted item. - - If the value is QJsonValue::Undefined, it will cause the key to get removed - from the object. The returned iterator will then point to end() - - \sa remove, take, QJsonObject::iterator, end - */ -QJsonObject::iterator QJsonObject::insert(const QString &key, const QJsonValue &value) -{ - if (value.t == QJsonValue::Undefined) { - remove(key); - return end(); - } - - bool latinOrIntValue; - int valueSize = QJsonPrivate::Value::requiredStorage(value, &latinOrIntValue); - - bool latinKey = QJsonPrivate::useCompressed(key); - int valueOffset = sizeof(QJsonPrivate::Entry) + QJsonPrivate::qStringSize(key, latinKey); - int requiredSize = valueOffset + valueSize; - - detach(requiredSize + sizeof(QJsonPrivate::offset)); // offset for the new index entry - - if (!o->length) - o->tableOffset = sizeof(QJsonPrivate::Object); - - bool keyExists = false; - int pos = o->indexOf(key, &keyExists); - if (keyExists) - ++d->compactionCounter; - - o->reserveSpace(requiredSize, pos, 1, keyExists); - - QJsonPrivate::Entry *e = o->entryAt(pos); - e->value.type = value.t; - e->value.latinKey = latinKey; - e->value.latinOrIntValue = latinOrIntValue; - e->value.value = QJsonPrivate::Value::valueToStore(value, (char *)e - (char *)o + valueOffset); - QJsonPrivate::copyString((char *)(e + 1), key, latinKey); - if (valueSize) - QJsonPrivate::Value::copyData(value, (char *)e + valueOffset, latinOrIntValue); - - return iterator(this, pos); -} - -/*! - Removes \a key from the object. - - \sa insert, take - */ -void QJsonObject::remove(const QString &key) -{ - if (!d) - return; - - bool keyExists; - int index = o->indexOf(key, &keyExists); - if (!keyExists) - return; - - detach(); - o->removeItems(index, 1); - ++d->compactionCounter; - if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) - compact(); -} - -/*! - Removes \a key from the object. - - Returns a QJsonValue containing the value referenced by \a key. - If \a key was not contained in the object, the returned QJsonValue - is Undefined. - - \sa insert, remove, QJsonValue - */ -QJsonValue QJsonObject::take(const QString &key) -{ - if (!o) - return QJsonValue(QJsonValue::Undefined); - - bool keyExists; - int index = o->indexOf(key, &keyExists); - if (!keyExists) - return QJsonValue(QJsonValue::Undefined); - - QJsonPrivate::Entry *e = o->entryAt(index); - o->removeItems(index, 1); - ++d->compactionCounter; - if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) - compact(); - - return QJsonValue(d, o, e->value); -} - -/*! - Returns \c true if the object contains key \a key. - - \sa insert, remove, take - */ -bool QJsonObject::contains(const QString &key) const -{ - if (!o) - return false; - - bool keyExists; - o->indexOf(key, &keyExists); - return keyExists; -} - -/*! - Returns \c true if \a other is equal to this object - */ -bool QJsonObject::operator==(const QJsonObject &other) const -{ - if (o == other.o) - return true; - - if (!o) - return !other.o->length; - if (!other.o) - return !o->length; - if (o->length != other.o->length) - return false; - - for (uint i = 0; i < o->length; ++i) { - QJsonPrivate::Entry *e = o->entryAt(i); - QJsonValue v(d, o, e->value); - if (other.value(e->key()) != v) - return false; - } - - return true; -} - -/*! - Returns \c true if \a other is not equal to this object - */ -bool QJsonObject::operator!=(const QJsonObject &other) const -{ - return !(*this == other); -} - -/*! - Removes the (key, value) pair pointed to by the iterator \a it - from the map, and returns an iterator to the next item in the - map. - - \sa remove() - */ -QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it) -{ -// Q_ASSERT(d && d->ref.load() == 1); - Q_ASSERT(d && int(d->ref) == 1); - if (it.o != this || it.i < 0 || it.i >= (int)o->length) - return iterator(this, o->length); - - int index = it.i; - - o->removeItems(index, 1); - ++d->compactionCounter; - if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) - compact(); - - // iterator hasn't changed - return it; -} - -/*! - Returns an iterator pointing to the item with key \a key in the - map. - - If the map contains no item with key \a key, the function - returns end(). - */ -QJsonObject::iterator QJsonObject::find(const QString &key) -{ - bool keyExists = false; - int index = o ? o->indexOf(key, &keyExists) : 0; - if (!keyExists) - return end(); - return iterator(this, index); -} - -/*! \fn QJsonObject::const_iterator QJsonObject::find(const Key &key) const - - \overload -*/ - -/*! - Returns an const iterator pointing to the item with key \a key in the - map. - - If the map contains no item with key \a key, the function - returns constEnd(). - */ -QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const -{ - bool keyExists = false; - int index = o ? o->indexOf(key, &keyExists) : 0; - if (!keyExists) - return end(); - return const_iterator(this, index); -} - -/*! \fn int QJsonObject::count() const - - \overload - - Same as size(). -*/ - -/*! \fn int QJsonObject::length() const - - \overload - - Same as size(). -*/ - -/*! \fn QJsonObject::iterator QJsonObject::begin() - - Returns an \l{STL-style iterator} pointing to the first item in - the object. - - \sa constBegin(), end() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::begin() const - - \overload -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::constBegin() const - - Returns a const \l{STL-style iterator} pointing to the first item - in the object. - - \sa begin(), constEnd() -*/ - -/*! \fn QJsonObject::iterator QJsonObject::end() - - Returns an \l{STL-style iterator} pointing to the imaginary item - after the last item in the object. - - \sa begin(), constEnd() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::end() const - - \overload -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::constEnd() const - - Returns a const \l{STL-style iterator} pointing to the imaginary - item after the last item in the object. - - \sa constBegin(), end() -*/ - -/*! - \fn bool QJsonObject::empty() const - - This function is provided for STL compatibility. It is equivalent - to isEmpty(), returning \c true if the object is empty; otherwise - returning \c false. -*/ - -/*! \class QJsonObject::iterator - \brief The QJsonObject::iterator class provides an STL-style non-const iterator for QJsonObject. - - QJsonObject::iterator allows you to iterate over a QJsonObject - and to modify the value (but not the key) stored under - a particular key. If you want to iterate over a const QJsonObject, you - should use QJsonObject::const_iterator. It is generally good practice to - use QJsonObject::const_iterator on a non-const QJsonObject as well, unless you - need to change the QJsonObject through the iterator. Const iterators are - slightly faster, and improves code readability. - - The default QJsonObject::iterator constructor creates an uninitialized - iterator. You must initialize it using a QJsonObject function like - QJsonObject::begin(), QJsonObject::end(), or QJsonObject::find() before you can - start iterating. - - Multiple iterators can be used on the same object. Existing iterators will however - become dangling once the object gets modified. - - \sa QJsonObject::const_iterator -*/ - -/*! \typedef QJsonObject::iterator::difference_type - - \internal -*/ - -/*! \typedef QJsonObject::iterator::iterator_category - - A synonym for \i {std::bidirectional_iterator_tag} indicating - this iterator is a bidirectional iterator. -*/ - -/*! \typedef QJsonObject::iterator::reference - - \internal -*/ - -/*! \typedef QJsonObject::iterator::value_type - - \internal -*/ - -/*! \fn QJsonObject::iterator::iterator() - - Constructs an uninitialized iterator. - - Functions like key(), value(), and operator++() must not be - called on an uninitialized iterator. Use operator=() to assign a - value to it before using it. - - \sa QJsonObject::begin() QJsonObject::end() -*/ - -/*! \fn QString QJsonObject::iterator::key() const - - Returns the current item's key. - - There is no direct way of changing an item's key through an - iterator, although it can be done by calling QJsonObject::erase() - followed by QJsonObject::insert(). - - \sa value() -*/ - -/*! \fn QJsonValueRef QJsonObject::iterator::value() const - - Returns a modifiable reference to the current item's value. - - You can change the value of an item by using value() on - the left side of an assignment. - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. - - \sa key(), operator*() -*/ - -/*! \fn QJsonValueRef QJsonObject::iterator::operator*() const - - Returns a modifiable reference to the current item's value. - - Same as value(). - - The return value is of type QJsonValueRef, a helper class for QJsonArray - and QJsonObject. When you get an object of type QJsonValueRef, you can - use it as if it were a reference to a QJsonValue. If you assign to it, - the assignment will apply to the character in the QJsonArray of QJsonObject - from which you got the reference. - - \sa key() -*/ - -/*! - \fn bool QJsonObject::iterator::operator==(const iterator &other) const - \fn bool QJsonObject::iterator::operator==(const const_iterator &other) const - - Returns \c true if \a other points to the same item as this - iterator; otherwise returns \c false. - - \sa operator!=() -*/ - -/*! - \fn bool QJsonObject::iterator::operator!=(const iterator &other) const - \fn bool QJsonObject::iterator::operator!=(const const_iterator &other) const - - Returns \c true if \a other points to a different item than this - iterator; otherwise returns \c false. - - \sa operator==() -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator++() - - The prefix ++ operator, \c{++i}, advances the iterator to the - next item in the object and returns an iterator to the new current - item. - - Calling this function on QJsonObject::end() leads to undefined results. - - \sa operator--() -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator++(int) - - \overload - - The postfix ++ operator, \c{i++}, advances the iterator to the - next item in the object and returns an iterator to the previously - current item. -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator--() - - The prefix -- operator, \c{--i}, makes the preceding item - current and returns an iterator pointing to the new current item. - - Calling this function on QJsonObject::begin() leads to undefined - results. - - \sa operator++() -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator--(int) - - \overload - - The postfix -- operator, \c{i--}, makes the preceding item - current and returns an iterator pointing to the previously - current item. -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator+(int j) const - - Returns an iterator to the item at \a j positions forward from - this iterator. If \a j is negative, the iterator goes backward. - - \sa operator-() - -*/ - -/*! \fn QJsonObject::iterator QJsonObject::iterator::operator-(int j) const - - Returns an iterator to the item at \a j positions backward from - this iterator. If \a j is negative, the iterator goes forward. - - \sa operator+() -*/ - -/*! \fn QJsonObject::iterator &QJsonObject::iterator::operator+=(int j) - - Advances the iterator by \a j items. If \a j is negative, the - iterator goes backward. - - \sa operator-=(), operator+() -*/ - -/*! \fn QJsonObject::iterator &QJsonObject::iterator::operator-=(int j) - - Makes the iterator go back by \a j items. If \a j is negative, - the iterator goes forward. - - \sa operator+=(), operator-() -*/ - -/*! \class QJsonObject::const_iterator - \brief The QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject. - - QJsonObject::const_iterator allows you to iterate over a QJsonObject. - If you want to modify the QJsonObject as you iterate - over it, you must use QJsonObject::iterator instead. It is generally - good practice to use QJsonObject::const_iterator on a non-const QJsonObject as - well, unless you need to change the QJsonObject through the iterator. - Const iterators are slightly faster and improves code - readability. - - The default QJsonObject::const_iterator constructor creates an - uninitialized iterator. You must initialize it using a QJsonObject - function like QJsonObject::constBegin(), QJsonObject::constEnd(), or - QJsonObject::find() before you can start iterating. - - Multiple iterators can be used on the same object. Existing iterators - will however become dangling if the object gets modified. - - \sa QJsonObject::iterator, QJsonObjectIterator -*/ - -/*! \typedef QJsonObject::const_iterator::difference_type - - \internal -*/ - -/*! \typedef QJsonObject::const_iterator::iterator_category - - A synonym for \i {std::bidirectional_iterator_tag} indicating - this iterator is a bidirectional iterator. -*/ - -/*! \typedef QJsonObject::const_iterator::reference - - \internal -*/ - -/*! \typedef QJsonObject::const_iterator::value_type - - \internal -*/ - -/*! \fn QJsonObject::const_iterator::const_iterator() - - Constructs an uninitialized iterator. - - Functions like key(), value(), and operator++() must not be - called on an uninitialized iterator. Use operator=() to assign a - value to it before using it. - - \sa QJsonObject::constBegin() QJsonObject::constEnd() -*/ - -/*! \fn QJsonObject::const_iterator::const_iterator(const iterator &other) - - Constructs a copy of \a other. -*/ - -/*! \fn QString QJsonObject::const_iterator::key() const - - Returns the current item's key. - - \sa value() -*/ - -/*! \fn QJsonValue QJsonObject::const_iterator::value() const - - Returns the current item's value. - - \sa key(), operator*() -*/ - -/*! \fn QJsonValue QJsonObject::const_iterator::operator*() const - - Returns the current item's value. - - Same as value(). - - \sa key() -*/ - -/*! \fn bool QJsonObject::const_iterator::operator==(const const_iterator &other) const - - Returns \c true if \a other points to the same item as this - iterator; otherwise returns \c false. - - \sa operator!=() -*/ - -/*! \fn bool QJsonObject::const_iterator::operator!=(const const_iterator &other) const - - Returns \c true if \a other points to a different item than this - iterator; otherwise returns \c false. - - \sa operator==() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator++() - - The prefix ++ operator, \c{++i}, advances the iterator to the - next item in the object and returns an iterator to the new current - item. - - Calling this function on QJsonObject::end() leads to undefined results. - - \sa operator--() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator++(int) - - \overload - - The postfix ++ operator, \c{i++}, advances the iterator to the - next item in the object and returns an iterator to the previously - current item. -*/ - -/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator--() - - The prefix -- operator, \c{--i}, makes the preceding item - current and returns an iterator pointing to the new current item. - - Calling this function on QJsonObject::begin() leads to undefined - results. - - \sa operator++() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator--(int) - - \overload - - The postfix -- operator, \c{i--}, makes the preceding item - current and returns an iterator pointing to the previously - current item. -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator+(int j) const - - Returns an iterator to the item at \a j positions forward from - this iterator. If \a j is negative, the iterator goes backward. - - This operation can be slow for large \a j values. - - \sa operator-() -*/ - -/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator-(int j) const - - Returns an iterator to the item at \a j positions backward from - this iterator. If \a j is negative, the iterator goes forward. - - This operation can be slow for large \a j values. - - \sa operator+() -*/ - -/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator+=(int j) - - Advances the iterator by \a j items. If \a j is negative, the - iterator goes backward. - - This operation can be slow for large \a j values. - - \sa operator-=(), operator+() -*/ - -/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator-=(int j) - - Makes the iterator go back by \a j items. If \a j is negative, - the iterator goes forward. - - This operation can be slow for large \a j values. - - \sa operator+=(), operator-() -*/ - - -/*! - \internal - */ -void QJsonObject::detach(uint reserve) -{ - if (!d) { - d = new QJsonPrivate::Data(reserve, QJsonValue::Object); - o = static_cast(d->header->root()); - d->ref.ref(); - return; - } - /* - if (reserve == 0 && d->ref.load() == 1) - return; - */ - if (reserve == 0 && int(d->ref) == 1) - return; - - QJsonPrivate::Data *x = d->clone(o, reserve); - x->ref.ref(); - if (!d->ref.deref()) - delete d; - d = x; - o = static_cast(d->header->root()); -} - -/*! - \internal - */ -void QJsonObject::compact() -{ - if (!d || !d->compactionCounter) - return; - - detach(); - d->compact(); - o = static_cast(d->header->root()); -} - -/*! - \internal - */ -QString QJsonObject::keyAt(int i) const -{ - Q_ASSERT(o && i >= 0 && i < (int)o->length); - - QJsonPrivate::Entry *e = o->entryAt(i); - return e->key(); -} - -/*! - \internal - */ -QJsonValue QJsonObject::valueAt(int i) const -{ - if (!o || i < 0 || i >= (int)o->length) - return QJsonValue(QJsonValue::Undefined); - - QJsonPrivate::Entry *e = o->entryAt(i); - return QJsonValue(d, o, e->value); -} - -/*! - \internal - */ -void QJsonObject::setValueAt(int i, const QJsonValue &val) -{ - Q_ASSERT(o && i >= 0 && i < (int)o->length); - - QJsonPrivate::Entry *e = o->entryAt(i); - insert(e->key(), val); -} - -/*! \typedef QJsonObject::Iterator - - Qt-style synonym for QJsonObject::iterator. -*/ - -/*! \typedef QJsonObject::ConstIterator - - Qt-style synonym for QJsonObject::const_iterator. -*/ - - -/*! \class QJsonObject::iterator - \ingroup json - \reentrant - \since 5.0 - - \brief The QJsonDocument::iterator class provides a way to iterate over q QJsonObject - - - */ - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QJsonObject &o) -{ - if (!o.o) { - dbg << "QJsonObject()"; - return dbg; - } - QByteArray json; - QJsonPrivate::Writer::objectToJson(o.o, json, 0, true); - dbg.nospace() << "QJsonObject(" - << json.constData() // print as utf-8 string without extra quotation marks - << ")"; - return dbg.space(); -} -#endif - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qjsonarray.h" +#include +#include +#include +#include "qjson_p.h" +#include "qjsonwriter_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QJsonObject + \ingroup json + \reentrant + \since 5.0 + + \brief The QJsonObject class encapsulates a JSON object. + + A JSON object is a list of key value pairs, where the keys are unique strings + and the values are represented by a QJsonValue. + + A QJsonObject can be converted to and from a QVariantMap. You can query the + number of (key, value) pairs with size(), insert(), and remove() entries from it + and iterate over its content using the standard C++ iterator pattern. + + QJsonObject is an implicitly shared class, and shares the data with the document + it has been created from as long as it is not being modified. + + You can convert the array to and from text based JSON through QJsonDocument. +*/ + +/*! + Constructs an empty JSON object + + \sa isEmpty + */ +QJsonObject::QJsonObject() + : d(0), o(0) +{ +} + +/*! + \internal + */ +QJsonObject::QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object) + : d(data), o(object) +{ + Q_ASSERT(d); + Q_ASSERT(o); + d->ref.ref(); +} + + +/*! + Destroys the object. + */ +QJsonObject::~QJsonObject() +{ + if (d && !d->ref.deref()) + delete d; +} + +/*! + Creates a copy of \a other. + + Since QJsonObject is implicitly shared, the copy is shallow + as long as the object does not get modified. + */ +QJsonObject::QJsonObject(const QJsonObject &other) +{ + d = other.d; + o = other.o; + if (d) + d->ref.ref(); +} + +/*! + Assigns \a other to this object. + */ +QJsonObject &QJsonObject::operator =(const QJsonObject &other) +{ + if (d != other.d) { + if (d && !d->ref.deref()) + delete d; + d = other.d; + if (d) + d->ref.ref(); + } + o = other.o; + + return *this; +} + +/*! + Converts the variant map \a map to a QJsonObject. + + The keys in \a map will be used as the keys in the JSON object, + and the QVariant values will be converted to JSON values. + + \sa toVariantMap, QJsonValue::fromVariant + */ +QJsonObject QJsonObject::fromVariantMap(const QVariantMap &map) +{ + // ### this is implemented the trivial way, not the most efficient way + + QJsonObject object; + for (QVariantMap::const_iterator it = map.constBegin(); it != map.constEnd(); ++it) + object.insert(it.key(), QJsonValue::fromVariant(it.value())); + return object; +} + +/*! + Converts this object to a QVariantMap. + + Returns the created map. + */ +QVariantMap QJsonObject::toVariantMap() const +{ + QVariantMap map; + if (o) { + for (uint i = 0; i < o->length; ++i) { + QJsonPrivate::Entry *e = o->entryAt(i); + map.insert(e->key(), QJsonValue(d, o, e->value).toVariant()); + } + } + return map; +} + +/*! + Returns a list of all keys in this object. + */ +QStringList QJsonObject::keys() const +{ + if (!d) + return QStringList(); + + QStringList keys; + + for (uint i = 0; i < o->length; ++i) { + QJsonPrivate::Entry *e = o->entryAt(i); + keys.append(e->key()); + } + + return keys; +} + +/*! + Returns the the number of (key, value) pairs stored in the object. + */ +int QJsonObject::size() const +{ + if (!d) + return 0; + + return o->length; +} + +/*! + Returns \c true if the object is empty. This is the same as size() == 0. + + \sa size + */ +bool QJsonObject::isEmpty() const +{ + if (!d) + return true; + + return !o->length; +} + +/*! + Returns a QJsonValue representing the value for the key \a key. + + The returned QJsonValue is \c Undefined, if the key does not exist. + + \sa setValue, QJsonValue, QJsonValue::isUndefined + */ +QJsonValue QJsonObject::value(const QString &key) const +{ + if (!d) + return QJsonValue(); + + bool keyExists; + int i = o->indexOf(key, &keyExists); + if (!keyExists) + return QJsonValue(QJsonValue::Undefined); + return QJsonValue(d, o, o->entryAt(i)->value); +} + +/*! + Returns a QJsonValue representing the value for the key \a key. + + This does the same as value(). + + The returned QJsonValue is \c Undefined, if the key does not exist. + + \sa value, setValue, QJsonValue, QJsonValue::isUndefined + */ +QJsonValue QJsonObject::operator [](const QString &key) const +{ + return value(key); +} + +/*! + Returns a reference to the value for \a key. + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. + + \sa setValue, value + */ +QJsonValueRef QJsonObject::operator [](const QString &key) +{ + // ### somewhat inefficient, as we lookup the key twice if it doesn't yet exist + bool keyExists = false; + int index = o ? o->indexOf(key, &keyExists) : -1; + if (!keyExists) { + iterator i = insert(key, QJsonValue()); + index = i.i; + } + return QJsonValueRef(this, index); +} + +/*! + Inserts a new item with the key \a key and a value of \a value. + + If there is already an item with the key \a key then that item's value + is replaced with \a value. + + Returns an iterator pointing to the inserted item. + + If the value is QJsonValue::Undefined, it will cause the key to get removed + from the object. The returned iterator will then point to end() + + \sa remove, take, QJsonObject::iterator, end + */ +QJsonObject::iterator QJsonObject::insert(const QString &key, const QJsonValue &value) +{ + if (value.t == QJsonValue::Undefined) { + remove(key); + return end(); + } + + bool latinOrIntValue; + int valueSize = QJsonPrivate::Value::requiredStorage(value, &latinOrIntValue); + + bool latinKey = QJsonPrivate::useCompressed(key); + int valueOffset = sizeof(QJsonPrivate::Entry) + QJsonPrivate::qStringSize(key, latinKey); + int requiredSize = valueOffset + valueSize; + + detach(requiredSize + sizeof(QJsonPrivate::offset)); // offset for the new index entry + + if (!o->length) + o->tableOffset = sizeof(QJsonPrivate::Object); + + bool keyExists = false; + int pos = o->indexOf(key, &keyExists); + if (keyExists) + ++d->compactionCounter; + + o->reserveSpace(requiredSize, pos, 1, keyExists); + + QJsonPrivate::Entry *e = o->entryAt(pos); + e->value.type = value.t; + e->value.latinKey = latinKey; + e->value.latinOrIntValue = latinOrIntValue; + e->value.value = QJsonPrivate::Value::valueToStore(value, (char *)e - (char *)o + valueOffset); + QJsonPrivate::copyString((char *)(e + 1), key, latinKey); + if (valueSize) + QJsonPrivate::Value::copyData(value, (char *)e + valueOffset, latinOrIntValue); + + return iterator(this, pos); +} + +/*! + Removes \a key from the object. + + \sa insert, take + */ +void QJsonObject::remove(const QString &key) +{ + if (!d) + return; + + bool keyExists; + int index = o->indexOf(key, &keyExists); + if (!keyExists) + return; + + detach(); + o->removeItems(index, 1); + ++d->compactionCounter; + if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) + compact(); +} + +/*! + Removes \a key from the object. + + Returns a QJsonValue containing the value referenced by \a key. + If \a key was not contained in the object, the returned QJsonValue + is Undefined. + + \sa insert, remove, QJsonValue + */ +QJsonValue QJsonObject::take(const QString &key) +{ + if (!o) + return QJsonValue(QJsonValue::Undefined); + + bool keyExists; + int index = o->indexOf(key, &keyExists); + if (!keyExists) + return QJsonValue(QJsonValue::Undefined); + + QJsonPrivate::Entry *e = o->entryAt(index); + o->removeItems(index, 1); + ++d->compactionCounter; + if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) + compact(); + + return QJsonValue(d, o, e->value); +} + +/*! + Returns \c true if the object contains key \a key. + + \sa insert, remove, take + */ +bool QJsonObject::contains(const QString &key) const +{ + if (!o) + return false; + + bool keyExists; + o->indexOf(key, &keyExists); + return keyExists; +} + +/*! + Returns \c true if \a other is equal to this object + */ +bool QJsonObject::operator==(const QJsonObject &other) const +{ + if (o == other.o) + return true; + + if (!o) + return !other.o->length; + if (!other.o) + return !o->length; + if (o->length != other.o->length) + return false; + + for (uint i = 0; i < o->length; ++i) { + QJsonPrivate::Entry *e = o->entryAt(i); + QJsonValue v(d, o, e->value); + if (other.value(e->key()) != v) + return false; + } + + return true; +} + +/*! + Returns \c true if \a other is not equal to this object + */ +bool QJsonObject::operator!=(const QJsonObject &other) const +{ + return !(*this == other); +} + +/*! + Removes the (key, value) pair pointed to by the iterator \a it + from the map, and returns an iterator to the next item in the + map. + + \sa remove() + */ +QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it) +{ +// Q_ASSERT(d && d->ref.load() == 1); + Q_ASSERT(d && int(d->ref) == 1); + if (it.o != this || it.i < 0 || it.i >= (int)o->length) + return iterator(this, o->length); + + int index = it.i; + + o->removeItems(index, 1); + ++d->compactionCounter; + if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2) + compact(); + + // iterator hasn't changed + return it; +} + +/*! + Returns an iterator pointing to the item with key \a key in the + map. + + If the map contains no item with key \a key, the function + returns end(). + */ +QJsonObject::iterator QJsonObject::find(const QString &key) +{ + bool keyExists = false; + int index = o ? o->indexOf(key, &keyExists) : 0; + if (!keyExists) + return end(); + return iterator(this, index); +} + +/*! \fn QJsonObject::const_iterator QJsonObject::find(const Key &key) const + + \overload +*/ + +/*! + Returns an const iterator pointing to the item with key \a key in the + map. + + If the map contains no item with key \a key, the function + returns constEnd(). + */ +QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const +{ + bool keyExists = false; + int index = o ? o->indexOf(key, &keyExists) : 0; + if (!keyExists) + return end(); + return const_iterator(this, index); +} + +/*! \fn int QJsonObject::count() const + + \overload + + Same as size(). +*/ + +/*! \fn int QJsonObject::length() const + + \overload + + Same as size(). +*/ + +/*! \fn QJsonObject::iterator QJsonObject::begin() + + Returns an \l{STL-style iterator} pointing to the first item in + the object. + + \sa constBegin(), end() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::begin() const + + \overload +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::constBegin() const + + Returns a const \l{STL-style iterator} pointing to the first item + in the object. + + \sa begin(), constEnd() +*/ + +/*! \fn QJsonObject::iterator QJsonObject::end() + + Returns an \l{STL-style iterator} pointing to the imaginary item + after the last item in the object. + + \sa begin(), constEnd() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::end() const + + \overload +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::constEnd() const + + Returns a const \l{STL-style iterator} pointing to the imaginary + item after the last item in the object. + + \sa constBegin(), end() +*/ + +/*! + \fn bool QJsonObject::empty() const + + This function is provided for STL compatibility. It is equivalent + to isEmpty(), returning \c true if the object is empty; otherwise + returning \c false. +*/ + +/*! \class QJsonObject::iterator + \brief The QJsonObject::iterator class provides an STL-style non-const iterator for QJsonObject. + + QJsonObject::iterator allows you to iterate over a QJsonObject + and to modify the value (but not the key) stored under + a particular key. If you want to iterate over a const QJsonObject, you + should use QJsonObject::const_iterator. It is generally good practice to + use QJsonObject::const_iterator on a non-const QJsonObject as well, unless you + need to change the QJsonObject through the iterator. Const iterators are + slightly faster, and improves code readability. + + The default QJsonObject::iterator constructor creates an uninitialized + iterator. You must initialize it using a QJsonObject function like + QJsonObject::begin(), QJsonObject::end(), or QJsonObject::find() before you can + start iterating. + + Multiple iterators can be used on the same object. Existing iterators will however + become dangling once the object gets modified. + + \sa QJsonObject::const_iterator +*/ + +/*! \typedef QJsonObject::iterator::difference_type + + \internal +*/ + +/*! \typedef QJsonObject::iterator::iterator_category + + A synonym for \i {std::bidirectional_iterator_tag} indicating + this iterator is a bidirectional iterator. +*/ + +/*! \typedef QJsonObject::iterator::reference + + \internal +*/ + +/*! \typedef QJsonObject::iterator::value_type + + \internal +*/ + +/*! \fn QJsonObject::iterator::iterator() + + Constructs an uninitialized iterator. + + Functions like key(), value(), and operator++() must not be + called on an uninitialized iterator. Use operator=() to assign a + value to it before using it. + + \sa QJsonObject::begin() QJsonObject::end() +*/ + +/*! \fn QString QJsonObject::iterator::key() const + + Returns the current item's key. + + There is no direct way of changing an item's key through an + iterator, although it can be done by calling QJsonObject::erase() + followed by QJsonObject::insert(). + + \sa value() +*/ + +/*! \fn QJsonValueRef QJsonObject::iterator::value() const + + Returns a modifiable reference to the current item's value. + + You can change the value of an item by using value() on + the left side of an assignment. + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. + + \sa key(), operator*() +*/ + +/*! \fn QJsonValueRef QJsonObject::iterator::operator*() const + + Returns a modifiable reference to the current item's value. + + Same as value(). + + The return value is of type QJsonValueRef, a helper class for QJsonArray + and QJsonObject. When you get an object of type QJsonValueRef, you can + use it as if it were a reference to a QJsonValue. If you assign to it, + the assignment will apply to the character in the QJsonArray of QJsonObject + from which you got the reference. + + \sa key() +*/ + +/*! + \fn bool QJsonObject::iterator::operator==(const iterator &other) const + \fn bool QJsonObject::iterator::operator==(const const_iterator &other) const + + Returns \c true if \a other points to the same item as this + iterator; otherwise returns \c false. + + \sa operator!=() +*/ + +/*! + \fn bool QJsonObject::iterator::operator!=(const iterator &other) const + \fn bool QJsonObject::iterator::operator!=(const const_iterator &other) const + + Returns \c true if \a other points to a different item than this + iterator; otherwise returns \c false. + + \sa operator==() +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator++() + + The prefix ++ operator, \c{++i}, advances the iterator to the + next item in the object and returns an iterator to the new current + item. + + Calling this function on QJsonObject::end() leads to undefined results. + + \sa operator--() +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator++(int) + + \overload + + The postfix ++ operator, \c{i++}, advances the iterator to the + next item in the object and returns an iterator to the previously + current item. +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator--() + + The prefix -- operator, \c{--i}, makes the preceding item + current and returns an iterator pointing to the new current item. + + Calling this function on QJsonObject::begin() leads to undefined + results. + + \sa operator++() +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator--(int) + + \overload + + The postfix -- operator, \c{i--}, makes the preceding item + current and returns an iterator pointing to the previously + current item. +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator+(int j) const + + Returns an iterator to the item at \a j positions forward from + this iterator. If \a j is negative, the iterator goes backward. + + \sa operator-() + +*/ + +/*! \fn QJsonObject::iterator QJsonObject::iterator::operator-(int j) const + + Returns an iterator to the item at \a j positions backward from + this iterator. If \a j is negative, the iterator goes forward. + + \sa operator+() +*/ + +/*! \fn QJsonObject::iterator &QJsonObject::iterator::operator+=(int j) + + Advances the iterator by \a j items. If \a j is negative, the + iterator goes backward. + + \sa operator-=(), operator+() +*/ + +/*! \fn QJsonObject::iterator &QJsonObject::iterator::operator-=(int j) + + Makes the iterator go back by \a j items. If \a j is negative, + the iterator goes forward. + + \sa operator+=(), operator-() +*/ + +/*! \class QJsonObject::const_iterator + \brief The QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject. + + QJsonObject::const_iterator allows you to iterate over a QJsonObject. + If you want to modify the QJsonObject as you iterate + over it, you must use QJsonObject::iterator instead. It is generally + good practice to use QJsonObject::const_iterator on a non-const QJsonObject as + well, unless you need to change the QJsonObject through the iterator. + Const iterators are slightly faster and improves code + readability. + + The default QJsonObject::const_iterator constructor creates an + uninitialized iterator. You must initialize it using a QJsonObject + function like QJsonObject::constBegin(), QJsonObject::constEnd(), or + QJsonObject::find() before you can start iterating. + + Multiple iterators can be used on the same object. Existing iterators + will however become dangling if the object gets modified. + + \sa QJsonObject::iterator, QJsonObjectIterator +*/ + +/*! \typedef QJsonObject::const_iterator::difference_type + + \internal +*/ + +/*! \typedef QJsonObject::const_iterator::iterator_category + + A synonym for \i {std::bidirectional_iterator_tag} indicating + this iterator is a bidirectional iterator. +*/ + +/*! \typedef QJsonObject::const_iterator::reference + + \internal +*/ + +/*! \typedef QJsonObject::const_iterator::value_type + + \internal +*/ + +/*! \fn QJsonObject::const_iterator::const_iterator() + + Constructs an uninitialized iterator. + + Functions like key(), value(), and operator++() must not be + called on an uninitialized iterator. Use operator=() to assign a + value to it before using it. + + \sa QJsonObject::constBegin() QJsonObject::constEnd() +*/ + +/*! \fn QJsonObject::const_iterator::const_iterator(const iterator &other) + + Constructs a copy of \a other. +*/ + +/*! \fn QString QJsonObject::const_iterator::key() const + + Returns the current item's key. + + \sa value() +*/ + +/*! \fn QJsonValue QJsonObject::const_iterator::value() const + + Returns the current item's value. + + \sa key(), operator*() +*/ + +/*! \fn QJsonValue QJsonObject::const_iterator::operator*() const + + Returns the current item's value. + + Same as value(). + + \sa key() +*/ + +/*! \fn bool QJsonObject::const_iterator::operator==(const const_iterator &other) const + + Returns \c true if \a other points to the same item as this + iterator; otherwise returns \c false. + + \sa operator!=() +*/ + +/*! \fn bool QJsonObject::const_iterator::operator!=(const const_iterator &other) const + + Returns \c true if \a other points to a different item than this + iterator; otherwise returns \c false. + + \sa operator==() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator++() + + The prefix ++ operator, \c{++i}, advances the iterator to the + next item in the object and returns an iterator to the new current + item. + + Calling this function on QJsonObject::end() leads to undefined results. + + \sa operator--() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator++(int) + + \overload + + The postfix ++ operator, \c{i++}, advances the iterator to the + next item in the object and returns an iterator to the previously + current item. +*/ + +/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator--() + + The prefix -- operator, \c{--i}, makes the preceding item + current and returns an iterator pointing to the new current item. + + Calling this function on QJsonObject::begin() leads to undefined + results. + + \sa operator++() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator--(int) + + \overload + + The postfix -- operator, \c{i--}, makes the preceding item + current and returns an iterator pointing to the previously + current item. +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator+(int j) const + + Returns an iterator to the item at \a j positions forward from + this iterator. If \a j is negative, the iterator goes backward. + + This operation can be slow for large \a j values. + + \sa operator-() +*/ + +/*! \fn QJsonObject::const_iterator QJsonObject::const_iterator::operator-(int j) const + + Returns an iterator to the item at \a j positions backward from + this iterator. If \a j is negative, the iterator goes forward. + + This operation can be slow for large \a j values. + + \sa operator+() +*/ + +/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator+=(int j) + + Advances the iterator by \a j items. If \a j is negative, the + iterator goes backward. + + This operation can be slow for large \a j values. + + \sa operator-=(), operator+() +*/ + +/*! \fn QJsonObject::const_iterator &QJsonObject::const_iterator::operator-=(int j) + + Makes the iterator go back by \a j items. If \a j is negative, + the iterator goes forward. + + This operation can be slow for large \a j values. + + \sa operator+=(), operator-() +*/ + + +/*! + \internal + */ +void QJsonObject::detach(uint reserve) +{ + if (!d) { + d = new QJsonPrivate::Data(reserve, QJsonValue::Object); + o = static_cast(d->header->root()); + d->ref.ref(); + return; + } + /* + if (reserve == 0 && d->ref.load() == 1) + return; + */ + if (reserve == 0 && int(d->ref) == 1) + return; + + QJsonPrivate::Data *x = d->clone(o, reserve); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; + o = static_cast(d->header->root()); +} + +/*! + \internal + */ +void QJsonObject::compact() +{ + if (!d || !d->compactionCounter) + return; + + detach(); + d->compact(); + o = static_cast(d->header->root()); +} + +/*! + \internal + */ +QString QJsonObject::keyAt(int i) const +{ + Q_ASSERT(o && i >= 0 && i < (int)o->length); + + QJsonPrivate::Entry *e = o->entryAt(i); + return e->key(); +} + +/*! + \internal + */ +QJsonValue QJsonObject::valueAt(int i) const +{ + if (!o || i < 0 || i >= (int)o->length) + return QJsonValue(QJsonValue::Undefined); + + QJsonPrivate::Entry *e = o->entryAt(i); + return QJsonValue(d, o, e->value); +} + +/*! + \internal + */ +void QJsonObject::setValueAt(int i, const QJsonValue &val) +{ + Q_ASSERT(o && i >= 0 && i < (int)o->length); + + QJsonPrivate::Entry *e = o->entryAt(i); + insert(e->key(), val); +} + +/*! \typedef QJsonObject::Iterator + + Qt-style synonym for QJsonObject::iterator. +*/ + +/*! \typedef QJsonObject::ConstIterator + + Qt-style synonym for QJsonObject::const_iterator. +*/ + + +/*! \class QJsonObject::iterator + \ingroup json + \reentrant + \since 5.0 + + \brief The QJsonDocument::iterator class provides a way to iterate over q QJsonObject + + + */ + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QJsonObject &o) +{ + if (!o.o) { + dbg << "QJsonObject()"; + return dbg; + } + QByteArray json; + QJsonPrivate::Writer::objectToJson(o.o, json, 0, true); + dbg.nospace() << "QJsonObject(" + << json.constData() // print as utf-8 string without extra quotation marks + << ")"; + return dbg.space(); +} +#endif + +QT_END_NAMESPACE diff --git a/qjson/qjsonobject.h b/qjson/qjsonobject.h index c52e617..1cb99bd 100644 --- a/qjson/qjsonobject.h +++ b/qjson/qjsonobject.h @@ -1,219 +1,219 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONOBJECT_H -#define QJSONOBJECT_H - -#include "qjsonvalue.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDebug; -template class QMap; -typedef QMap QVariantMap; - -class Q_JSONRPC_EXPORT QJsonObject -{ -public: - QJsonObject(); - ~QJsonObject(); - - QJsonObject(const QJsonObject &other); - QJsonObject &operator =(const QJsonObject &other); - - static QJsonObject fromVariantMap(const QVariantMap &map); - QVariantMap toVariantMap() const; - - QStringList keys() const; - int size() const; - inline int count() const { return size(); } - inline int length() const { return size(); } - bool isEmpty() const; - - QJsonValue value(const QString &key) const; - QJsonValue operator[] (const QString &key) const; - QJsonValueRef operator[] (const QString &key); - - void remove(const QString &key); - QJsonValue take(const QString &key); - bool contains(const QString &key) const; - - bool operator==(const QJsonObject &other) const; - bool operator!=(const QJsonObject &other) const; - - class const_iterator; - - class iterator - { - friend class const_iterator; - friend class QJsonObject; - QJsonObject *o; - int i; - - public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef int difference_type; - typedef QJsonValue value_type; -// typedef T *pointer; - typedef QJsonValueRef reference; - - inline iterator() : o(0), i(0) {} - inline iterator(QJsonObject *obj, int index) : o(obj), i(index) {} - - inline QString key() const { return o->keyAt(i); } - inline QJsonValueRef value() const { return QJsonValueRef(o, i); } - inline QJsonValueRef operator*() const { return QJsonValueRef(o, i); } - //inline T *operator->() const { return &concrete(i)->value; } - inline bool operator==(const iterator &other) const { return i == other.i; } - inline bool operator!=(const iterator &other) const { return i != other.i; } - - inline iterator &operator++() { ++i; return *this; } - inline iterator operator++(int) { iterator r = *this; ++i; return r; } - inline iterator &operator--() { --i; return *this; } - inline iterator operator--(int) { iterator r = *this; --i; return r; } - inline iterator operator+(int j) const - { iterator r = *this; r.i += j; return r; } - inline iterator operator-(int j) const { return operator+(-j); } - inline iterator &operator+=(int j) { i += j; return *this; } - inline iterator &operator-=(int j) { i -= j; return *this; } - - public: - inline bool operator==(const const_iterator &other) const { return i == other.i; } - inline bool operator!=(const const_iterator &other) const { return i != other.i; } - }; - friend class iterator; - - class const_iterator - { - friend class iterator; - const QJsonObject *o; - int i; - - public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef int difference_type; - typedef QJsonValue value_type; - typedef QJsonValue reference; - - inline const_iterator() : o(0), i(0) {} - inline const_iterator(const QJsonObject *obj, int index) - : o(obj), i(index) {} - inline const_iterator(const iterator &other) - : o(other.o), i(other.i) {} - - inline QString key() const { return o->keyAt(i); } - inline QJsonValue value() const { return o->valueAt(i); } - inline QJsonValue operator*() const { return o->valueAt(i); } - //inline const T *operator->() const { return &concrete(i)->value; } - inline bool operator==(const const_iterator &other) const { return i == other.i; } - inline bool operator!=(const const_iterator &other) const { return i != other.i; } - - inline const_iterator &operator++() { ++i; return *this; } - inline const_iterator operator++(int) { const_iterator r = *this; ++i; return r; } - inline const_iterator &operator--() { --i; return *this; } - inline const_iterator operator--(int) { const_iterator r = *this; --i; return r; } - inline const_iterator operator+(int j) const - { const_iterator r = *this; r.i += j; return r; } - inline const_iterator operator-(int j) const { return operator+(-j); } - inline const_iterator &operator+=(int j) { i += j; return *this; } - inline const_iterator &operator-=(int j) { i -= j; return *this; } - - inline bool operator==(const iterator &other) const { return i == other.i; } - inline bool operator!=(const iterator &other) const { return i != other.i; } - }; - friend class const_iterator; - - // STL style - inline iterator begin() { detach(); return iterator(this, 0); } - inline const_iterator begin() const { return const_iterator(this, 0); } - inline const_iterator constBegin() const { return const_iterator(this, 0); } - inline iterator end() { detach(); return iterator(this, size()); } - inline const_iterator end() const { return const_iterator(this, size()); } - inline const_iterator constEnd() const { return const_iterator(this, size()); } - iterator erase(iterator it); - - // more Qt - typedef iterator Iterator; - typedef const_iterator ConstIterator; - iterator find(const QString &key); - const_iterator find(const QString &key) const { return constFind(key); } - const_iterator constFind(const QString &key) const; - iterator insert(const QString &key, const QJsonValue &value); - - // STL compatibility - typedef QJsonValue mapped_type; - typedef QString key_type; - typedef int size_type; - - inline bool empty() const { return isEmpty(); } - -private: - friend class QJsonPrivate::Data; - friend class QJsonValue; - friend class QJsonDocument; - friend class QJsonValueRef; - - friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonObject &); - - QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object); - void detach(uint reserve = 0); - void compact(); - - QString keyAt(int i) const; - QJsonValue valueAt(int i) const; - void setValueAt(int i, const QJsonValue &val); - - QJsonPrivate::Data *d; - QJsonPrivate::Object *o; -}; - -#ifndef QT_NO_DEBUG_STREAM -Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonObject &); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QJSONOBJECT_H +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONOBJECT_H +#define QJSONOBJECT_H + +#include "qjsonvalue.h" +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDebug; +template class QMap; +typedef QMap QVariantMap; + +class Q_JSONRPC_EXPORT QJsonObject +{ +public: + QJsonObject(); + ~QJsonObject(); + + QJsonObject(const QJsonObject &other); + QJsonObject &operator =(const QJsonObject &other); + + static QJsonObject fromVariantMap(const QVariantMap &map); + QVariantMap toVariantMap() const; + + QStringList keys() const; + int size() const; + inline int count() const { return size(); } + inline int length() const { return size(); } + bool isEmpty() const; + + QJsonValue value(const QString &key) const; + QJsonValue operator[] (const QString &key) const; + QJsonValueRef operator[] (const QString &key); + + void remove(const QString &key); + QJsonValue take(const QString &key); + bool contains(const QString &key) const; + + bool operator==(const QJsonObject &other) const; + bool operator!=(const QJsonObject &other) const; + + class const_iterator; + + class iterator + { + friend class const_iterator; + friend class QJsonObject; + QJsonObject *o; + int i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef int difference_type; + typedef QJsonValue value_type; +// typedef T *pointer; + typedef QJsonValueRef reference; + + inline iterator() : o(0), i(0) {} + inline iterator(QJsonObject *obj, int index) : o(obj), i(index) {} + + inline QString key() const { return o->keyAt(i); } + inline QJsonValueRef value() const { return QJsonValueRef(o, i); } + inline QJsonValueRef operator*() const { return QJsonValueRef(o, i); } + //inline T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const iterator &other) const { return i == other.i; } + inline bool operator!=(const iterator &other) const { return i != other.i; } + + inline iterator &operator++() { ++i; return *this; } + inline iterator operator++(int) { iterator r = *this; ++i; return r; } + inline iterator &operator--() { --i; return *this; } + inline iterator operator--(int) { iterator r = *this; --i; return r; } + inline iterator operator+(int j) const + { iterator r = *this; r.i += j; return r; } + inline iterator operator-(int j) const { return operator+(-j); } + inline iterator &operator+=(int j) { i += j; return *this; } + inline iterator &operator-=(int j) { i -= j; return *this; } + + public: + inline bool operator==(const const_iterator &other) const { return i == other.i; } + inline bool operator!=(const const_iterator &other) const { return i != other.i; } + }; + friend class iterator; + + class const_iterator + { + friend class iterator; + const QJsonObject *o; + int i; + + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef int difference_type; + typedef QJsonValue value_type; + typedef QJsonValue reference; + + inline const_iterator() : o(0), i(0) {} + inline const_iterator(const QJsonObject *obj, int index) + : o(obj), i(index) {} + inline const_iterator(const iterator &other) + : o(other.o), i(other.i) {} + + inline QString key() const { return o->keyAt(i); } + inline QJsonValue value() const { return o->valueAt(i); } + inline QJsonValue operator*() const { return o->valueAt(i); } + //inline const T *operator->() const { return &concrete(i)->value; } + inline bool operator==(const const_iterator &other) const { return i == other.i; } + inline bool operator!=(const const_iterator &other) const { return i != other.i; } + + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator r = *this; ++i; return r; } + inline const_iterator &operator--() { --i; return *this; } + inline const_iterator operator--(int) { const_iterator r = *this; --i; return r; } + inline const_iterator operator+(int j) const + { const_iterator r = *this; r.i += j; return r; } + inline const_iterator operator-(int j) const { return operator+(-j); } + inline const_iterator &operator+=(int j) { i += j; return *this; } + inline const_iterator &operator-=(int j) { i -= j; return *this; } + + inline bool operator==(const iterator &other) const { return i == other.i; } + inline bool operator!=(const iterator &other) const { return i != other.i; } + }; + friend class const_iterator; + + // STL style + inline iterator begin() { detach(); return iterator(this, 0); } + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline iterator end() { detach(); return iterator(this, size()); } + inline const_iterator end() const { return const_iterator(this, size()); } + inline const_iterator constEnd() const { return const_iterator(this, size()); } + iterator erase(iterator it); + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + iterator find(const QString &key); + const_iterator find(const QString &key) const { return constFind(key); } + const_iterator constFind(const QString &key) const; + iterator insert(const QString &key, const QJsonValue &value); + + // STL compatibility + typedef QJsonValue mapped_type; + typedef QString key_type; + typedef int size_type; + + inline bool empty() const { return isEmpty(); } + +private: + friend class QJsonPrivate::Data; + friend class QJsonValue; + friend class QJsonDocument; + friend class QJsonValueRef; + + friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonObject &); + + QJsonObject(QJsonPrivate::Data *data, QJsonPrivate::Object *object); + void detach(uint reserve = 0); + void compact(); + + QString keyAt(int i) const; + QJsonValue valueAt(int i) const; + void setValueAt(int i, const QJsonValue &val); + + QJsonPrivate::Data *d; + QJsonPrivate::Object *o; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonObject &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QJSONOBJECT_H diff --git a/qjson/qjsonparser.cpp b/qjson/qjsonparser.cpp index b1e6a5a..3c575ef 100644 --- a/qjson/qjsonparser.cpp +++ b/qjson/qjsonparser.cpp @@ -1,801 +1,801 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qjsonparser_p.h" -#include "qjson_p.h" - -//#define PARSER_DEBUG -#ifdef PARSER_DEBUG -static int indent = 0; -#define BEGIN qDebug() << QByteArray(4*indent++, ' ').constData() << "pos=" << current -#define END --indent -#define DEBUG qDebug() << QByteArray(4*indent, ' ').constData() -#else -#define BEGIN if (1) ; else qDebug() -#define END do {} while (0) -#define DEBUG if (1) ; else qDebug() -#endif - -QT_BEGIN_NAMESPACE - -using namespace QJsonPrivate; - -Parser::Parser(const char *json, int length) - : head(json), json(json), data(0), dataLength(0), current(0), lastError(QJsonParseError::NoError) -{ - end = json + length; -} - - - -/* - -begin-array = ws %x5B ws ; [ left square bracket - -begin-object = ws %x7B ws ; { left curly bracket - -end-array = ws %x5D ws ; ] right square bracket - -end-object = ws %x7D ws ; } right curly bracket - -name-separator = ws %x3A ws ; : colon - -value-separator = ws %x2C ws ; , comma - -Insignificant whitespace is allowed before or after any of the six -structural characters. - -ws = *( - %x20 / ; Space - %x09 / ; Horizontal tab - %x0A / ; Line feed or New line - %x0D ; Carriage return - ) - -*/ - -enum { - Space = 0x20, - Tab = 0x09, - LineFeed = 0x0a, - Return = 0x0d, - BeginArray = 0x5b, - BeginObject = 0x7b, - EndArray = 0x5d, - EndObject = 0x7d, - NameSeparator = 0x3a, - ValueSeparator = 0x2c, - Quote = 0x22 -}; - - - -bool Parser::eatSpace() -{ - while (json < end) { - if (*json > Space) - break; - if (*json != Space && - *json != Tab && - *json != LineFeed && - *json != Return) - break; - ++json; - } - return (json < end); -} - -char Parser::nextToken() -{ - if (!eatSpace()) - return 0; - char token = *json++; - switch (token) { - case BeginArray: - case BeginObject: - case NameSeparator: - case ValueSeparator: - case EndArray: - case EndObject: - eatSpace(); - case Quote: - break; - default: - token = 0; - break; - } - return token; -} - -/* - JSON-text = object / array -*/ -QJsonDocument Parser::parse(QJsonParseError *error) -{ -#ifdef PARSER_DEBUG - indent = 0; - qDebug() << ">>>>> parser begin"; -#endif - // allocate some space - dataLength = qMax(end - json, (ptrdiff_t) 256); - data = (char *)malloc(dataLength); - - // fill in Header data - QJsonPrivate::Header *h = (QJsonPrivate::Header *)data; - h->tag = QJsonDocument::BinaryFormatTag; - h->version = 1u; - - current = sizeof(QJsonPrivate::Header); - - char token = nextToken(); - DEBUG << token; - if (token == BeginArray) { - if (!parseArray()) - goto error; - } else if (token == BeginObject) { - if (!parseObject()) - goto error; - } else { - goto error; - } - - END; - { - if (error) { - error->offset = 0; - error->error = QJsonParseError::NoError; - } - QJsonPrivate::Data *d = new QJsonPrivate::Data(data, current); - return QJsonDocument(d); - } - -error: -#ifdef PARSER_DEBUG - qDebug() << ">>>>> parser error"; -#endif - if (error) { - error->offset = json - head; - error->error = lastError; - } - free(data); - return QJsonDocument(); -} - - -void Parser::ParsedObject::insert(uint offset) { - const QJsonPrivate::Entry *newEntry = reinterpret_cast(parser->data + objectPosition + offset); - int min = 0; - int n = offsets.size(); - while (n > 0) { - int half = n >> 1; - int middle = min + half; - if (*entryAt(middle) >= *newEntry) { - n = half; - } else { - min = middle + 1; - n -= half + 1; - } - } - if (min < offsets.size() && *entryAt(min) == *newEntry) { - offsets[min] = offset; - } else { - offsets.insert(min, offset); - } -} - -/* - object = begin-object [ member *( value-separator member ) ] - end-object -*/ - -bool Parser::parseObject() -{ - int objectOffset = reserveSpace(sizeof(QJsonPrivate::Object)); - BEGIN << "parseObject pos=" << objectOffset << current << json; - - ParsedObject parsedObject(this, objectOffset); - - char token = nextToken(); - while (token == Quote) { - int off = current - objectOffset; - if (!parseMember(objectOffset)) - return false; - parsedObject.insert(off); - token = nextToken(); - if (token != ValueSeparator) - break; - token = nextToken(); - if (token == EndObject) { - lastError = QJsonParseError::MissingObject; - return false; - } - } - - DEBUG << "end token=" << token; - if (token != EndObject) { - lastError = QJsonParseError::UnterminatedObject; - return false; - } - - DEBUG << "numEntries" << parsedObject.offsets.size(); - int table = objectOffset; - // finalize the object - if (parsedObject.offsets.size()) { - int tableSize = parsedObject.offsets.size()*sizeof(uint); - table = reserveSpace(tableSize); -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - memcpy(data + table, parsedObject.offsets.constData(), tableSize); -#else - offset *o = (offset *)(data + table); - for (int i = 0; i < tableSize; ++i) - o[i] = parsedObject.offsets[i]; - -#endif - } - - QJsonPrivate::Object *o = (QJsonPrivate::Object *)(data + objectOffset); - o->tableOffset = table - objectOffset; - o->size = current - objectOffset; - o->is_object = true; - o->length = parsedObject.offsets.size(); - - DEBUG << "current=" << current; - END; - return true; -} - -/* - member = string name-separator value -*/ -bool Parser::parseMember(int baseOffset) -{ - int entryOffset = reserveSpace(sizeof(QJsonPrivate::Entry)); - BEGIN << "parseMember pos=" << entryOffset; - - bool latin1; - if (!parseString(&latin1)) - return false; - char token = nextToken(); - if (token != NameSeparator) { - lastError = QJsonParseError::MissingNameSeparator; - return false; - } - QJsonPrivate::Value val; - if (!parseValue(&val, baseOffset)) - return false; - - // finalize the entry - QJsonPrivate::Entry *e = (QJsonPrivate::Entry *)(data + entryOffset); - e->value = val; - e->value.latinKey = latin1; - - END; - return true; -} - -/* - array = begin-array [ value *( value-separator value ) ] end-array -*/ -bool Parser::parseArray() -{ - BEGIN << "parseArray"; - int arrayOffset = reserveSpace(sizeof(QJsonPrivate::Array)); - - QVarLengthArray values; - - if (!eatSpace()) { - lastError = QJsonParseError::UnterminatedArray; - return false; - } - if (*json == EndArray) { - nextToken(); - } else { - while (1) { - QJsonPrivate::Value val; - if (!parseValue(&val, arrayOffset)) - return false; - values.append(val); - char token = nextToken(); - if (token == EndArray) - break; - else if (token != ValueSeparator) { - if (!eatSpace()) - lastError = QJsonParseError::UnterminatedArray; - else - lastError = QJsonParseError::MissingValueSeparator; - return false; - } - } - } - - DEBUG << "size =" << values.size(); - int table = arrayOffset; - // finalize the object - if (values.size()) { - int tableSize = values.size()*sizeof(QJsonPrivate::Value); - table = reserveSpace(tableSize); - memcpy(data + table, values.constData(), tableSize); - } - - QJsonPrivate::Array *a = (QJsonPrivate::Array *)(data + arrayOffset); - a->tableOffset = table - arrayOffset; - a->size = current - arrayOffset; - a->is_object = false; - a->length = values.size(); - - DEBUG << "current=" << current; - END; - return true; -} - -/* -value = false / null / true / object / array / number / string - -*/ - -bool Parser::parseValue(QJsonPrivate::Value *val, int baseOffset) -{ - BEGIN << "parse Value" << json; - val->_dummy = 0; - - switch (*json++) { - case 'n': - if (end - json < 4) { - lastError = QJsonParseError::IllegalValue; - return false; - } - if (*json++ == 'u' && - *json++ == 'l' && - *json++ == 'l') { - val->type = QJsonValue::Null; - DEBUG << "value: null"; - END; - return true; - } - lastError = QJsonParseError::IllegalValue; - return false; - case 't': - if (end - json < 4) { - lastError = QJsonParseError::IllegalValue; - return false; - } - if (*json++ == 'r' && - *json++ == 'u' && - *json++ == 'e') { - val->type = QJsonValue::Bool; - val->value = true; - DEBUG << "value: true"; - END; - return true; - } - lastError = QJsonParseError::IllegalValue; - return false; - case 'f': - if (end - json < 5) { - lastError = QJsonParseError::IllegalValue; - return false; - } - if (*json++ == 'a' && - *json++ == 'l' && - *json++ == 's' && - *json++ == 'e') { - val->type = QJsonValue::Bool; - val->value = false; - DEBUG << "value: false"; - END; - return true; - } - lastError = QJsonParseError::IllegalValue; - return false; - case Quote: { - val->type = QJsonValue::String; - val->value = current - baseOffset; - bool latin1; - if (!parseString(&latin1)) - return false; - val->latinOrIntValue = latin1; - DEBUG << "value: string"; - END; - return true; - } - case BeginArray: - val->type = QJsonValue::Array; - val->value = current - baseOffset; - if (!parseArray()) - return false; - DEBUG << "value: array"; - END; - return true; - case BeginObject: - val->type = QJsonValue::Object; - val->value = current - baseOffset; - if (!parseObject()) - return false; - DEBUG << "value: object"; - END; - return true; - case EndArray: - lastError = QJsonParseError::MissingObject; - return false; - default: - --json; - if (!parseNumber(val, baseOffset)) - return false; - DEBUG << "value: number"; - END; - } - - return true; -} - - - - - -/* - number = [ minus ] int [ frac ] [ exp ] - decimal-point = %x2E ; . - digit1-9 = %x31-39 ; 1-9 - e = %x65 / %x45 ; e E - exp = e [ minus / plus ] 1*DIGIT - frac = decimal-point 1*DIGIT - int = zero / ( digit1-9 *DIGIT ) - minus = %x2D ; - - plus = %x2B ; + - zero = %x30 ; 0 - -*/ - -bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) -{ - BEGIN << "parseNumber" << json; - val->type = QJsonValue::Double; - - const char *start = json; - bool isInt = true; - - // minus - if (json < end && *json == '-') - ++json; - - // int = zero / ( digit1-9 *DIGIT ) - if (json < end && *json == '0') { - ++json; - } else { - while (json < end && *json >= '0' && *json <= '9') - ++json; - } - - // frac = decimal-point 1*DIGIT - if (json < end && *json == '.') { - isInt = false; - ++json; - while (json < end && *json >= '0' && *json <= '9') - ++json; - } - - // exp = e [ minus / plus ] 1*DIGIT - if (json < end && (*json == 'e' || *json == 'E')) { - isInt = false; - ++json; - if (json < end && (*json == '-' || *json == '+')) - ++json; - while (json < end && *json >= '0' && *json <= '9') - ++json; - } - - if (json >= end) { - lastError = QJsonParseError::EndOfNumber; - return false; - } - - QByteArray number(start, json - start); - DEBUG << "numberstring" << number; - - if (isInt) { - bool ok; - int n = number.toInt(&ok); - if (ok && n < (1<<25) && n > -(1<<25)) { - val->int_value = n; - val->latinOrIntValue = true; - END; - return true; - } - } - - bool ok; - union { - quint64 ui; - double d; - }; - d = number.toDouble(&ok); - - if (!ok) { - lastError = QJsonParseError::IllegalNumber; - return false; - } - - int pos = reserveSpace(sizeof(double)); - *(quint64 *)(data + pos) = qToLittleEndian(ui); - val->value = pos - baseOffset; - val->latinOrIntValue = false; - - END; - return true; -} - -/* - - string = quotation-mark *char quotation-mark - - char = unescaped / - escape ( - %x22 / ; " quotation mark U+0022 - %x5C / ; \ reverse solidus U+005C - %x2F / ; / solidus U+002F - %x62 / ; b backspace U+0008 - %x66 / ; f form feed U+000C - %x6E / ; n line feed U+000A - %x72 / ; r carriage return U+000D - %x74 / ; t tab U+0009 - %x75 4HEXDIG ) ; uXXXX U+XXXX - - escape = %x5C ; \ - - quotation-mark = %x22 ; " - - unescaped = %x20-21 / %x23-5B / %x5D-10FFFF - */ -static inline bool addHexDigit(char digit, uint *result) -{ - *result <<= 4; - if (digit >= '0' && digit <= '9') - *result |= (digit - '0'); - else if (digit >= 'a' && digit <= 'f') - *result |= (digit - 'a') + 10; - else if (digit >= 'A' && digit <= 'F') - *result |= (digit - 'A') + 10; - else - return false; - return true; -} - -static inline bool scanEscapeSequence(const char *&json, const char *end, uint *ch) -{ - ++json; - if (json >= end) - return false; - - DEBUG << "scan escape" << (char)*json; - uint escaped = *json++; - switch (escaped) { - case '"': - *ch = '"'; break; - case '\\': - *ch = '\\'; break; - case '/': - *ch = '/'; break; - case 'b': - *ch = 0x8; break; - case 'f': - *ch = 0xc; break; - case 'n': - *ch = 0xa; break; - case 'r': - *ch = 0xd; break; - case 't': - *ch = 0x9; break; - case 'u': { - *ch = 0; - if (json > end - 4) - return false; - for (int i = 0; i < 4; ++i) { - if (!addHexDigit(*json, ch)) - return false; - ++json; - } - return true; - } - default: - // this is not as strict as one could be, but allows for more Json files - // to be parsed correctly. - *ch = escaped; - return true; - } - return true; -} - -static inline bool isUnicodeNonCharacter(uint ucs4) -{ - // Unicode has a couple of "non-characters" that one can use internally, - // but are not allowed to be used for text interchange. - // - // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF, - // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and - // U+FDEF (inclusive) - - return (ucs4 & 0xfffe) == 0xfffe - || (ucs4 - 0xfdd0U) < 16; -} - -static inline bool scanUtf8Char(const char *&json, const char *end, uint *result) -{ - int need; - uint min_uc; - uint uc; - uchar ch = *json++; - if (ch < 128) { - *result = ch; - return true; - } else if ((ch & 0xe0) == 0xc0) { - uc = ch & 0x1f; - need = 1; - min_uc = 0x80; - } else if ((ch & 0xf0) == 0xe0) { - uc = ch & 0x0f; - need = 2; - min_uc = 0x800; - } else if ((ch&0xf8) == 0xf0) { - uc = ch & 0x07; - need = 3; - min_uc = 0x10000; - } else { - return false; - } - - if (json >= end - need) - return false; - - for (int i = 0; i < need; ++i) { - ch = *json++; - if ((ch&0xc0) != 0x80) - return false; - uc = (uc << 6) | (ch & 0x3f); - } - - if (isUnicodeNonCharacter(uc) || uc >= 0x110000 || - (uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff)) - return false; - - *result = uc; - return true; -} - -bool Parser::parseString(bool *latin1) -{ - *latin1 = true; - - const char *start = json; - int outStart = current; - - // try to write out a latin1 string - - int stringPos = reserveSpace(2); - BEGIN << "parse string stringPos=" << stringPos << json; - while (json < end) { - uint ch = 0; - if (*json == '"') - break; - else if (*json == '\\') { - if (!scanEscapeSequence(json, end, &ch)) { - lastError = QJsonParseError::StringEscapeSequence; - return false; - } - } else { - if (!scanUtf8Char(json, end, &ch)) { - lastError = QJsonParseError::StringUTF8Scan; - return false; - } - } - if (ch > 0xff) { - *latin1 = false; - break; - } - int pos = reserveSpace(1); - DEBUG << " " << ch << (char)ch; - data[pos] = (uchar)ch; - } - ++json; - DEBUG << "end of string"; - if (json >= end) { - lastError = QJsonParseError::EndOfString; - return false; - } - - // no unicode string, we are done - if (*latin1) { - // write string length - *(QJsonPrivate::qle_ushort *)(data + stringPos) = current - outStart - sizeof(ushort); - int pos = reserveSpace((4 - current) & 3); - while (pos & 3) - data[pos++] = 0; - END; - return true; - } - - *latin1 = false; - DEBUG << "not latin"; - - json = start; - current = outStart + sizeof(int); - - while (json < end) { - uint ch = 0; - if (*json == '"') - break; - else if (*json == '\\') { - if (!scanEscapeSequence(json, end, &ch)) { - lastError = QJsonParseError::StringEscapeSequence; - return false; - } - } else { - if (!scanUtf8Char(json, end, &ch)) { - lastError = QJsonParseError::StringUTF8Scan; - return false; - } - } - if (ch > 0xffff) { - int pos = reserveSpace(4); - *(QJsonPrivate::qle_ushort *)(data + pos) = QChar::highSurrogate(ch); - *(QJsonPrivate::qle_ushort *)(data + pos + 2) = QChar::lowSurrogate(ch); - } else { - int pos = reserveSpace(2); - *(QJsonPrivate::qle_ushort *)(data + pos) = (ushort)ch; - } - } - ++json; - - if (json >= end) { - lastError = QJsonParseError::EndOfString; - return false; - } - - // write string length - *(QJsonPrivate::qle_int *)(data + stringPos) = (current - outStart - sizeof(int))/2; - int pos = reserveSpace((4 - current) & 3); - while (pos & 3) - data[pos++] = 0; - END; - return true; -} - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qjsonparser_p.h" +#include "qjson_p.h" + +//#define PARSER_DEBUG +#ifdef PARSER_DEBUG +static int indent = 0; +#define BEGIN qDebug() << QByteArray(4*indent++, ' ').constData() << "pos=" << current +#define END --indent +#define DEBUG qDebug() << QByteArray(4*indent, ' ').constData() +#else +#define BEGIN if (1) ; else qDebug() +#define END do {} while (0) +#define DEBUG if (1) ; else qDebug() +#endif + +QT_BEGIN_NAMESPACE + +using namespace QJsonPrivate; + +Parser::Parser(const char *json, int length) + : head(json), json(json), data(0), dataLength(0), current(0), lastError(QJsonParseError::NoError) +{ + end = json + length; +} + + + +/* + +begin-array = ws %x5B ws ; [ left square bracket + +begin-object = ws %x7B ws ; { left curly bracket + +end-array = ws %x5D ws ; ] right square bracket + +end-object = ws %x7D ws ; } right curly bracket + +name-separator = ws %x3A ws ; : colon + +value-separator = ws %x2C ws ; , comma + +Insignificant whitespace is allowed before or after any of the six +structural characters. + +ws = *( + %x20 / ; Space + %x09 / ; Horizontal tab + %x0A / ; Line feed or New line + %x0D ; Carriage return + ) + +*/ + +enum { + Space = 0x20, + Tab = 0x09, + LineFeed = 0x0a, + Return = 0x0d, + BeginArray = 0x5b, + BeginObject = 0x7b, + EndArray = 0x5d, + EndObject = 0x7d, + NameSeparator = 0x3a, + ValueSeparator = 0x2c, + Quote = 0x22 +}; + + + +bool Parser::eatSpace() +{ + while (json < end) { + if (*json > Space) + break; + if (*json != Space && + *json != Tab && + *json != LineFeed && + *json != Return) + break; + ++json; + } + return (json < end); +} + +char Parser::nextToken() +{ + if (!eatSpace()) + return 0; + char token = *json++; + switch (token) { + case BeginArray: + case BeginObject: + case NameSeparator: + case ValueSeparator: + case EndArray: + case EndObject: + eatSpace(); + case Quote: + break; + default: + token = 0; + break; + } + return token; +} + +/* + JSON-text = object / array +*/ +QJsonDocument Parser::parse(QJsonParseError *error) +{ +#ifdef PARSER_DEBUG + indent = 0; + qDebug() << ">>>>> parser begin"; +#endif + // allocate some space + dataLength = qMax(end - json, (ptrdiff_t) 256); + data = (char *)malloc(dataLength); + + // fill in Header data + QJsonPrivate::Header *h = (QJsonPrivate::Header *)data; + h->tag = QJsonDocument::BinaryFormatTag; + h->version = 1u; + + current = sizeof(QJsonPrivate::Header); + + char token = nextToken(); + DEBUG << token; + if (token == BeginArray) { + if (!parseArray()) + goto error; + } else if (token == BeginObject) { + if (!parseObject()) + goto error; + } else { + goto error; + } + + END; + { + if (error) { + error->offset = 0; + error->error = QJsonParseError::NoError; + } + QJsonPrivate::Data *d = new QJsonPrivate::Data(data, current); + return QJsonDocument(d); + } + +error: +#ifdef PARSER_DEBUG + qDebug() << ">>>>> parser error"; +#endif + if (error) { + error->offset = json - head; + error->error = lastError; + } + free(data); + return QJsonDocument(); +} + + +void Parser::ParsedObject::insert(uint offset) { + const QJsonPrivate::Entry *newEntry = reinterpret_cast(parser->data + objectPosition + offset); + int min = 0; + int n = offsets.size(); + while (n > 0) { + int half = n >> 1; + int middle = min + half; + if (*entryAt(middle) >= *newEntry) { + n = half; + } else { + min = middle + 1; + n -= half + 1; + } + } + if (min < offsets.size() && *entryAt(min) == *newEntry) { + offsets[min] = offset; + } else { + offsets.insert(min, offset); + } +} + +/* + object = begin-object [ member *( value-separator member ) ] + end-object +*/ + +bool Parser::parseObject() +{ + int objectOffset = reserveSpace(sizeof(QJsonPrivate::Object)); + BEGIN << "parseObject pos=" << objectOffset << current << json; + + ParsedObject parsedObject(this, objectOffset); + + char token = nextToken(); + while (token == Quote) { + int off = current - objectOffset; + if (!parseMember(objectOffset)) + return false; + parsedObject.insert(off); + token = nextToken(); + if (token != ValueSeparator) + break; + token = nextToken(); + if (token == EndObject) { + lastError = QJsonParseError::MissingObject; + return false; + } + } + + DEBUG << "end token=" << token; + if (token != EndObject) { + lastError = QJsonParseError::UnterminatedObject; + return false; + } + + DEBUG << "numEntries" << parsedObject.offsets.size(); + int table = objectOffset; + // finalize the object + if (parsedObject.offsets.size()) { + int tableSize = parsedObject.offsets.size()*sizeof(uint); + table = reserveSpace(tableSize); +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + memcpy(data + table, parsedObject.offsets.constData(), tableSize); +#else + offset *o = (offset *)(data + table); + for (int i = 0; i < tableSize; ++i) + o[i] = parsedObject.offsets[i]; + +#endif + } + + QJsonPrivate::Object *o = (QJsonPrivate::Object *)(data + objectOffset); + o->tableOffset = table - objectOffset; + o->size = current - objectOffset; + o->is_object = true; + o->length = parsedObject.offsets.size(); + + DEBUG << "current=" << current; + END; + return true; +} + +/* + member = string name-separator value +*/ +bool Parser::parseMember(int baseOffset) +{ + int entryOffset = reserveSpace(sizeof(QJsonPrivate::Entry)); + BEGIN << "parseMember pos=" << entryOffset; + + bool latin1; + if (!parseString(&latin1)) + return false; + char token = nextToken(); + if (token != NameSeparator) { + lastError = QJsonParseError::MissingNameSeparator; + return false; + } + QJsonPrivate::Value val; + if (!parseValue(&val, baseOffset)) + return false; + + // finalize the entry + QJsonPrivate::Entry *e = (QJsonPrivate::Entry *)(data + entryOffset); + e->value = val; + e->value.latinKey = latin1; + + END; + return true; +} + +/* + array = begin-array [ value *( value-separator value ) ] end-array +*/ +bool Parser::parseArray() +{ + BEGIN << "parseArray"; + int arrayOffset = reserveSpace(sizeof(QJsonPrivate::Array)); + + QVarLengthArray values; + + if (!eatSpace()) { + lastError = QJsonParseError::UnterminatedArray; + return false; + } + if (*json == EndArray) { + nextToken(); + } else { + while (1) { + QJsonPrivate::Value val; + if (!parseValue(&val, arrayOffset)) + return false; + values.append(val); + char token = nextToken(); + if (token == EndArray) + break; + else if (token != ValueSeparator) { + if (!eatSpace()) + lastError = QJsonParseError::UnterminatedArray; + else + lastError = QJsonParseError::MissingValueSeparator; + return false; + } + } + } + + DEBUG << "size =" << values.size(); + int table = arrayOffset; + // finalize the object + if (values.size()) { + int tableSize = values.size()*sizeof(QJsonPrivate::Value); + table = reserveSpace(tableSize); + memcpy(data + table, values.constData(), tableSize); + } + + QJsonPrivate::Array *a = (QJsonPrivate::Array *)(data + arrayOffset); + a->tableOffset = table - arrayOffset; + a->size = current - arrayOffset; + a->is_object = false; + a->length = values.size(); + + DEBUG << "current=" << current; + END; + return true; +} + +/* +value = false / null / true / object / array / number / string + +*/ + +bool Parser::parseValue(QJsonPrivate::Value *val, int baseOffset) +{ + BEGIN << "parse Value" << json; + val->_dummy = 0; + + switch (*json++) { + case 'n': + if (end - json < 4) { + lastError = QJsonParseError::IllegalValue; + return false; + } + if (*json++ == 'u' && + *json++ == 'l' && + *json++ == 'l') { + val->type = QJsonValue::Null; + DEBUG << "value: null"; + END; + return true; + } + lastError = QJsonParseError::IllegalValue; + return false; + case 't': + if (end - json < 4) { + lastError = QJsonParseError::IllegalValue; + return false; + } + if (*json++ == 'r' && + *json++ == 'u' && + *json++ == 'e') { + val->type = QJsonValue::Bool; + val->value = true; + DEBUG << "value: true"; + END; + return true; + } + lastError = QJsonParseError::IllegalValue; + return false; + case 'f': + if (end - json < 5) { + lastError = QJsonParseError::IllegalValue; + return false; + } + if (*json++ == 'a' && + *json++ == 'l' && + *json++ == 's' && + *json++ == 'e') { + val->type = QJsonValue::Bool; + val->value = false; + DEBUG << "value: false"; + END; + return true; + } + lastError = QJsonParseError::IllegalValue; + return false; + case Quote: { + val->type = QJsonValue::String; + val->value = current - baseOffset; + bool latin1; + if (!parseString(&latin1)) + return false; + val->latinOrIntValue = latin1; + DEBUG << "value: string"; + END; + return true; + } + case BeginArray: + val->type = QJsonValue::Array; + val->value = current - baseOffset; + if (!parseArray()) + return false; + DEBUG << "value: array"; + END; + return true; + case BeginObject: + val->type = QJsonValue::Object; + val->value = current - baseOffset; + if (!parseObject()) + return false; + DEBUG << "value: object"; + END; + return true; + case EndArray: + lastError = QJsonParseError::MissingObject; + return false; + default: + --json; + if (!parseNumber(val, baseOffset)) + return false; + DEBUG << "value: number"; + END; + } + + return true; +} + + + + + +/* + number = [ minus ] int [ frac ] [ exp ] + decimal-point = %x2E ; . + digit1-9 = %x31-39 ; 1-9 + e = %x65 / %x45 ; e E + exp = e [ minus / plus ] 1*DIGIT + frac = decimal-point 1*DIGIT + int = zero / ( digit1-9 *DIGIT ) + minus = %x2D ; - + plus = %x2B ; + + zero = %x30 ; 0 + +*/ + +bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) +{ + BEGIN << "parseNumber" << json; + val->type = QJsonValue::Double; + + const char *start = json; + bool isInt = true; + + // minus + if (json < end && *json == '-') + ++json; + + // int = zero / ( digit1-9 *DIGIT ) + if (json < end && *json == '0') { + ++json; + } else { + while (json < end && *json >= '0' && *json <= '9') + ++json; + } + + // frac = decimal-point 1*DIGIT + if (json < end && *json == '.') { + isInt = false; + ++json; + while (json < end && *json >= '0' && *json <= '9') + ++json; + } + + // exp = e [ minus / plus ] 1*DIGIT + if (json < end && (*json == 'e' || *json == 'E')) { + isInt = false; + ++json; + if (json < end && (*json == '-' || *json == '+')) + ++json; + while (json < end && *json >= '0' && *json <= '9') + ++json; + } + + if (json >= end) { + lastError = QJsonParseError::EndOfNumber; + return false; + } + + QByteArray number(start, json - start); + DEBUG << "numberstring" << number; + + if (isInt) { + bool ok; + int n = number.toInt(&ok); + if (ok && n < (1<<25) && n > -(1<<25)) { + val->int_value = n; + val->latinOrIntValue = true; + END; + return true; + } + } + + bool ok; + union { + quint64 ui; + double d; + }; + d = number.toDouble(&ok); + + if (!ok) { + lastError = QJsonParseError::IllegalNumber; + return false; + } + + int pos = reserveSpace(sizeof(double)); + *(quint64 *)(data + pos) = qToLittleEndian(ui); + val->value = pos - baseOffset; + val->latinOrIntValue = false; + + END; + return true; +} + +/* + + string = quotation-mark *char quotation-mark + + char = unescaped / + escape ( + %x22 / ; " quotation mark U+0022 + %x5C / ; \ reverse solidus U+005C + %x2F / ; / solidus U+002F + %x62 / ; b backspace U+0008 + %x66 / ; f form feed U+000C + %x6E / ; n line feed U+000A + %x72 / ; r carriage return U+000D + %x74 / ; t tab U+0009 + %x75 4HEXDIG ) ; uXXXX U+XXXX + + escape = %x5C ; \ + + quotation-mark = %x22 ; " + + unescaped = %x20-21 / %x23-5B / %x5D-10FFFF + */ +static inline bool addHexDigit(char digit, uint *result) +{ + *result <<= 4; + if (digit >= '0' && digit <= '9') + *result |= (digit - '0'); + else if (digit >= 'a' && digit <= 'f') + *result |= (digit - 'a') + 10; + else if (digit >= 'A' && digit <= 'F') + *result |= (digit - 'A') + 10; + else + return false; + return true; +} + +static inline bool scanEscapeSequence(const char *&json, const char *end, uint *ch) +{ + ++json; + if (json >= end) + return false; + + DEBUG << "scan escape" << (char)*json; + uint escaped = *json++; + switch (escaped) { + case '"': + *ch = '"'; break; + case '\\': + *ch = '\\'; break; + case '/': + *ch = '/'; break; + case 'b': + *ch = 0x8; break; + case 'f': + *ch = 0xc; break; + case 'n': + *ch = 0xa; break; + case 'r': + *ch = 0xd; break; + case 't': + *ch = 0x9; break; + case 'u': { + *ch = 0; + if (json > end - 4) + return false; + for (int i = 0; i < 4; ++i) { + if (!addHexDigit(*json, ch)) + return false; + ++json; + } + return true; + } + default: + // this is not as strict as one could be, but allows for more Json files + // to be parsed correctly. + *ch = escaped; + return true; + } + return true; +} + +static inline bool isUnicodeNonCharacter(uint ucs4) +{ + // Unicode has a couple of "non-characters" that one can use internally, + // but are not allowed to be used for text interchange. + // + // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF, + // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and + // U+FDEF (inclusive) + + return (ucs4 & 0xfffe) == 0xfffe + || (ucs4 - 0xfdd0U) < 16; +} + +static inline bool scanUtf8Char(const char *&json, const char *end, uint *result) +{ + int need; + uint min_uc; + uint uc; + uchar ch = *json++; + if (ch < 128) { + *result = ch; + return true; + } else if ((ch & 0xe0) == 0xc0) { + uc = ch & 0x1f; + need = 1; + min_uc = 0x80; + } else if ((ch & 0xf0) == 0xe0) { + uc = ch & 0x0f; + need = 2; + min_uc = 0x800; + } else if ((ch&0xf8) == 0xf0) { + uc = ch & 0x07; + need = 3; + min_uc = 0x10000; + } else { + return false; + } + + if (json >= end - need) + return false; + + for (int i = 0; i < need; ++i) { + ch = *json++; + if ((ch&0xc0) != 0x80) + return false; + uc = (uc << 6) | (ch & 0x3f); + } + + if (isUnicodeNonCharacter(uc) || uc >= 0x110000 || + (uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff)) + return false; + + *result = uc; + return true; +} + +bool Parser::parseString(bool *latin1) +{ + *latin1 = true; + + const char *start = json; + int outStart = current; + + // try to write out a latin1 string + + int stringPos = reserveSpace(2); + BEGIN << "parse string stringPos=" << stringPos << json; + while (json < end) { + uint ch = 0; + if (*json == '"') + break; + else if (*json == '\\') { + if (!scanEscapeSequence(json, end, &ch)) { + lastError = QJsonParseError::StringEscapeSequence; + return false; + } + } else { + if (!scanUtf8Char(json, end, &ch)) { + lastError = QJsonParseError::StringUTF8Scan; + return false; + } + } + if (ch > 0xff) { + *latin1 = false; + break; + } + int pos = reserveSpace(1); + DEBUG << " " << ch << (char)ch; + data[pos] = (uchar)ch; + } + ++json; + DEBUG << "end of string"; + if (json >= end) { + lastError = QJsonParseError::EndOfString; + return false; + } + + // no unicode string, we are done + if (*latin1) { + // write string length + *(QJsonPrivate::qle_ushort *)(data + stringPos) = current - outStart - sizeof(ushort); + int pos = reserveSpace((4 - current) & 3); + while (pos & 3) + data[pos++] = 0; + END; + return true; + } + + *latin1 = false; + DEBUG << "not latin"; + + json = start; + current = outStart + sizeof(int); + + while (json < end) { + uint ch = 0; + if (*json == '"') + break; + else if (*json == '\\') { + if (!scanEscapeSequence(json, end, &ch)) { + lastError = QJsonParseError::StringEscapeSequence; + return false; + } + } else { + if (!scanUtf8Char(json, end, &ch)) { + lastError = QJsonParseError::StringUTF8Scan; + return false; + } + } + if (ch > 0xffff) { + int pos = reserveSpace(4); + *(QJsonPrivate::qle_ushort *)(data + pos) = QChar::highSurrogate(ch); + *(QJsonPrivate::qle_ushort *)(data + pos + 2) = QChar::lowSurrogate(ch); + } else { + int pos = reserveSpace(2); + *(QJsonPrivate::qle_ushort *)(data + pos) = (ushort)ch; + } + } + ++json; + + if (json >= end) { + lastError = QJsonParseError::EndOfString; + return false; + } + + // write string length + *(QJsonPrivate::qle_int *)(data + stringPos) = (current - outStart - sizeof(int))/2; + int pos = reserveSpace((4 - current) & 3); + while (pos & 3) + data[pos++] = 0; + END; + return true; +} + +QT_END_NAMESPACE diff --git a/qjson/qjsonparser_p.h b/qjson/qjsonparser_p.h index 05e870e..7760a36 100644 --- a/qjson/qjsonparser_p.h +++ b/qjson/qjsonparser_p.h @@ -1,120 +1,120 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONPARSER_P_H -#define QJSONPARSER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qjsondocument.h" -#include - -QT_BEGIN_NAMESPACE - -namespace QJsonPrivate { - -class Parser -{ -public: - Parser(const char *json, int length); - - QJsonDocument parse(QJsonParseError *error); - - class ParsedObject - { - public: - ParsedObject(Parser *p, int pos) : parser(p), objectPosition(pos) {} - void insert(uint offset); - - Parser *parser; - int objectPosition; - QVector offsets; - - inline QJsonPrivate::Entry *entryAt(int i) const { - return reinterpret_cast(parser->data + objectPosition + offsets[i]); - } - }; - - -private: - inline bool eatSpace(); - inline char nextToken(); - - bool parseObject(); - bool parseArray(); - bool parseMember(int baseOffset); - bool parseString(bool *latin1); - bool parseValue(QJsonPrivate::Value *val, int baseOffset); - bool parseNumber(QJsonPrivate::Value *val, int baseOffset); - const char *head; - const char *json; - const char *end; - - char *data; - int dataLength; - int current; - QJsonParseError::ParseError lastError; - - inline int reserveSpace(int space) { - if (current + space >= dataLength) { - dataLength = 2*dataLength + space; - data = (char *)realloc(data, dataLength); - } - int pos = current; - current += space; - return pos; - } -}; - -} - -QT_END_NAMESPACE - -#endif +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONPARSER_P_H +#define QJSONPARSER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qjsondocument.h" +#include + +QT_BEGIN_NAMESPACE + +namespace QJsonPrivate { + +class Parser +{ +public: + Parser(const char *json, int length); + + QJsonDocument parse(QJsonParseError *error); + + class ParsedObject + { + public: + ParsedObject(Parser *p, int pos) : parser(p), objectPosition(pos) {} + void insert(uint offset); + + Parser *parser; + int objectPosition; + QVector offsets; + + inline QJsonPrivate::Entry *entryAt(int i) const { + return reinterpret_cast(parser->data + objectPosition + offsets[i]); + } + }; + + +private: + inline bool eatSpace(); + inline char nextToken(); + + bool parseObject(); + bool parseArray(); + bool parseMember(int baseOffset); + bool parseString(bool *latin1); + bool parseValue(QJsonPrivate::Value *val, int baseOffset); + bool parseNumber(QJsonPrivate::Value *val, int baseOffset); + const char *head; + const char *json; + const char *end; + + char *data; + int dataLength; + int current; + QJsonParseError::ParseError lastError; + + inline int reserveSpace(int space) { + if (current + space >= dataLength) { + dataLength = 2*dataLength + space; + data = (char *)realloc(data, dataLength); + } + int pos = current; + current += space; + return pos; + } +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/qjson/qjsonvalue.cpp b/qjson/qjsonvalue.cpp index a0f7cea..aff7202 100644 --- a/qjson/qjsonvalue.cpp +++ b/qjson/qjsonvalue.cpp @@ -1,592 +1,592 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjsonobject.h" -#include "qjsonvalue.h" -#include "qjsonarray.h" -#include -#include -#include - -#include "qjson_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QJsonValue - \ingroup json - \reentrant - \since 5.0 - - \brief The QJsonValue class encapsulates a value in JSON. - - A value in JSON can be one of 6 basic types: - - JSON is a format to store structured data. It has 6 basic data types: - - \list - \o bool QJsonValue::Bool - \o double QJsonValue::Double - \o string QJsonValue::String - \o array QJsonValue::Array - \o object QJsonValue::Object - \o null QJsonValue::Null - \endlist - - A value can represent any of the above data types. In addition, QJsonValue has one special - flag to represent undefined values. This can be queried with isUndefined(). - - The type of the value can be queried with type() or accessors like isBool(), isString(), and so on. - Likewise, the value can be converted to the type stored in it using the toBool(), toString() and so on. - - Values are strictly typed internally and contrary to QVariant will not attempt to do any implicit type - conversions. This implies that converting to a type that is not stored in the value will return a default - constructed return value. -*/ - -/*! - Creates a QJsonValue of type \a type. - - The default is to create a Null value. - */ -QJsonValue::QJsonValue(Type type) - : ui(0), d(0), t(type) -{ -} - -/*! - \internal - */ -QJsonValue::QJsonValue(QJsonPrivate::Data *data, QJsonPrivate::Base *base, const QJsonPrivate::Value &v) - : d(0) -{ - t = (Type)(uint)v.type; - switch (t) { - case Undefined: - case Null: - dbl = 0; - break; - case Bool: - b = v.toBoolean(); - break; - case Double: - dbl = v.toDouble(base); - break; - case String: { - /* - QString s = v.toString(base); - stringData = s.data_ptr(); - stringData->ref.ref(); - */ - stringValue = v.toString(base); - break; - } - case Array: - case Object: - d = data; - this->base = v.base(base); - break; - } - if (d) - d->ref.ref(); -} - -/*! - Creates a value of type Bool, with value \a b. - */ -QJsonValue::QJsonValue(bool b) - : d(0), t(Bool) -{ - this->b = b; -} - -/*! - Creates a value of type Double, with value \a n. - */ -QJsonValue::QJsonValue(double n) - : d(0), t(Double) -{ - this->dbl = n; -} - -/*! - \overload - Creates a value of type Double, with value \a n. - */ -QJsonValue::QJsonValue(int n) - : d(0), t(Double) -{ - this->dbl = n; -} - -/*! - Creates a value of type String, with value \a s. - */ -QJsonValue::QJsonValue(const QString &s) - : d(0), t(String) -{ - /* - stringData = *(QStringData **)(&s); - stringData->ref.ref(); - */ - stringValue = s; -} - -/*! - Creates a value of type String, with value \a s. - */ -QJsonValue::QJsonValue(const QLatin1String &s) - : d(0), t(String) -{ - // ### FIXME: Avoid creating the temp QString below - /* - QString str(s); - stringData = *(QStringData **)(&str); - stringData->ref.ref(); - */ - stringValue = s; -} - -/*! - Creates a value of type Array, with value \a a. - */ -QJsonValue::QJsonValue(const QJsonArray &a) - : d(a.d), t(Array) -{ - base = a.a; - if (d) - d->ref.ref(); -} - -/*! - Creates a value of type Object, with value \a o. - */ -QJsonValue::QJsonValue(const QJsonObject &o) - : d(o.d), t(Object) -{ - base = o.o; - if (d) - d->ref.ref(); -} - - -/*! - Destroys the value. - */ -QJsonValue::~QJsonValue() -{ - /* - if (t == String && stringData && !stringData->ref.deref()) - free(stringData); - */ - - if (d && !d->ref.deref()) - delete d; -} - -/*! - Creates a copy of \a other. - */ -QJsonValue::QJsonValue(const QJsonValue &other) -{ - t = other.t; - d = other.d; - ui = other.ui; - stringValue = other.stringValue; - - if (d) - d->ref.ref(); - - /* - if (t == String && stringData) - stringData->ref.ref(); - */ -} - -/*! - Assigns the value stored in \a other to this object. - */ -QJsonValue &QJsonValue::operator =(const QJsonValue &other) -{ - /* - if (t == String && stringData && !stringData->ref.deref()) - free(stringData); - */ - - t = other.t; - dbl = other.dbl; - stringValue = other.stringValue; - - if (d != other.d) { - - if (d && !d->ref.deref()) - delete d; - d = other.d; - if (d) - d->ref.ref(); - - } - - /* - if (t == String && stringData) - stringData->ref.ref(); - */ - - return *this; -} - -/*! - Converts \a variant to a QJsonValue and returns it. - - The conversion will convert QVariant types as follows: - - \list - \o QVariant::Bool to Bool - \o QVariant::Int - \o QVariant::Double - \o QVariant::LongLong - \o QVariant::ULongLong - \o QVariant::UInt to Double - \o QVariant::String to String - \o QVariant::StringList - \o QVariant::VariantList to Array - \o QVariant::VariantMap to Object - \endlist - - For all other QVariant types a conversion to a QString will be attempted. If the returned string - is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString. - - \sa toVariant() - */ -QJsonValue QJsonValue::fromVariant(const QVariant &variant) -{ - switch (variant.type()) { - case QVariant::Bool: - return QJsonValue(variant.toBool()); - case QVariant::Int: - case QVariant::Double: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::UInt: - return QJsonValue(variant.toDouble()); - case QVariant::String: - return QJsonValue(variant.toString()); - case QVariant::StringList: - return QJsonValue(QJsonArray::fromStringList(variant.toStringList())); - case QVariant::List: - return QJsonValue(QJsonArray::fromVariantList(variant.toList())); - case QVariant::Map: - return QJsonValue(QJsonObject::fromVariantMap(variant.toMap())); - default: - break; - } - QString string = variant.toString(); - if (string.isEmpty()) - return QJsonValue(); - return QJsonValue(string); -} - -/*! - Converts the value to a QVariant. - - The QJsonValue types will be converted as follows: - - \value Null QVariant() - \value Bool QVariant::Bool - \value Double QVariant::Double - \value String QVariant::String - \value Array QVariantList - \value Object QVariantMap - \value Undefined QVariant() - - \sa fromVariant() - */ -QVariant QJsonValue::toVariant() const -{ - switch (t) { - case Bool: - return b; - case Double: - return dbl; - case String: - return toString(); - case Array: - return QJsonArray(d, static_cast(base)).toVariantList(); - case Object: - return QJsonObject(d, static_cast(base)).toVariantMap(); - case Null: - case Undefined: - break; - } - return QVariant(); -} - -/*! - \enum QJsonValue::Type - - This enum describes the type of the JSON value. - - \value Null A Null value - \value Bool A boolean value. Use toBool() to convert to a bool. - \value Double A double. Use toDouble() to convert to a double. - \value String A string. Use toString() to convert to a QString. - \value Array An array. Use toArray() to convert to a QJsonArray. - \value Object An object. Use toObject() to convert to a QJsonObject. - \value Undefined The value is undefined. This is usually returned as an - error condition, when trying to read an out of bounds value - in an array or a non existant key in an object. -*/ - -/*! - Returns the type of the value. - - \sa QJsonValue::Type - */ -QJsonValue::Type QJsonValue::type() const -{ - return t; -} - -/*! - Converts the value to a bool and returns it. - - If type() is not bool, false will be returned. - */ -bool QJsonValue::toBool() const -{ - if (t != Bool) - return false; - return b; -} - -/*! - Converts the value to a double and returns it. - - If type() is not Double, 0. will be returned. - */ -double QJsonValue::toDouble() const -{ - if (t != Double) - return 0; - return dbl; -} - -/*! - Converts the value to a QString and returns it. - - If type() is not String, a QString() will be returned. - */ -QString QJsonValue::toString() const -{ - if (t != String) - return QString(); - - /* - stringData->ref.ref(); // the constructor below doesn't add a ref. - return QString(*(const QConstStringData<1> *)stringData); - */ - return stringValue; -} - -/*! - Converts the value to an array and returns it. - - If type() is not Array, a QJsonArray() will be returned. - */ -QJsonArray QJsonValue::toArray() const -{ - if (!d || t != Array) - return QJsonArray(); - - return QJsonArray(d, static_cast(base)); -} - -/*! - Converts the value to an object and returns it. - - If type() is not Object, a QJsonObject() will be returned. - */ -QJsonObject QJsonValue::toObject() const -{ - if (!d || t != Object) - return QJsonObject(); - - return QJsonObject(d, static_cast(base)); -} - -/*! - Returns true if the value is equal to \a other. - */ -bool QJsonValue::operator==(const QJsonValue &other) const -{ - if (t != other.t) - return false; - - switch (t) { - case Undefined: - case Null: - break; - case Bool: - return b == other.b; - case Double: - return dbl == other.dbl; - case String: - return toString() == other.toString(); - case Array: - return QJsonArray(d, static_cast(base)) - == QJsonArray(other.d, static_cast(other.base)); - case Object: - return QJsonObject(d, static_cast(base)) - == QJsonObject(other.d, static_cast(other.base)); - } - return true; -} - -/*! - Returns true if the value is not equal to \a other. - */ -bool QJsonValue::operator!=(const QJsonValue &other) const -{ - return !(*this == other); -} - -/*! - \internal - */ -void QJsonValue::detach() -{ - if (!d) - return; - - QJsonPrivate::Data *x = d->clone(base); - x->ref.ref(); - if (!d->ref.deref()) - delete d; - d = x; - base = static_cast(d->header->root()); -} - - -/*! - \class QJsonValueRef - \reentrant - \brief The QJsonValueRef class is a helper class for QJsonValue. - - \internal - - \ingroup json - - When you get an object of type QJsonValueRef, if you can assign to it, - the assignment will apply to the character in the string from - which you got the reference. That is its whole purpose in life. - - You can use it exactly in the same way as a reference to a QJsonValue. - - The QJsonValueRef becomes invalid once modifications are made to the - string: if you want to keep the character, copy it into a QJsonValue. - - Most of the QJsonValue member functions also exist in QJsonValueRef. - However, they are not explicitly documented here. -*/ - - -QJsonValueRef &QJsonValueRef::operator =(const QJsonValue &val) -{ - if (is_object) - o->setValueAt(index, val); - else - a->replace(index, val); - - return *this; -} - -QJsonArray QJsonValueRef::toArray() const -{ - return toValue().toArray(); -} - -QJsonObject QJsonValueRef::toObject() const -{ - return toValue().toObject(); -} - -QJsonValue QJsonValueRef::toValue() const -{ - if (!is_object) - return a->at(index); - return o->valueAt(index); -} - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QJsonValue &o) -{ - switch (o.t) { - case QJsonValue::Undefined: - dbg.nospace() << "QJsonValue(undefined)"; - break; - case QJsonValue::Null: - dbg.nospace() << "QJsonValue(null)"; - break; - case QJsonValue::Bool: - dbg.nospace() << "QJsonValue(bool, " << o.toBool() << ")"; - break; - case QJsonValue::Double: - dbg.nospace() << "QJsonValue(double, " << o.toDouble() << ")"; - break; - case QJsonValue::String: - dbg.nospace() << "QJsonValue(string, " << o.toString() << ")"; - break; - case QJsonValue::Array: - dbg.nospace() << "QJsonValue(array, "; - dbg.nospace() << o.toArray(); - dbg.nospace() << ")"; - break; - case QJsonValue::Object: - dbg.nospace() << "QJsonValue(object, "; - dbg.nospace() << o.toObject(); - dbg.nospace() << ")"; - break; - } - return dbg.space(); -} -#endif - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjsonobject.h" +#include "qjsonvalue.h" +#include "qjsonarray.h" +#include +#include +#include + +#include "qjson_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QJsonValue + \ingroup json + \reentrant + \since 5.0 + + \brief The QJsonValue class encapsulates a value in JSON. + + A value in JSON can be one of 6 basic types: + + JSON is a format to store structured data. It has 6 basic data types: + + \list + \o bool QJsonValue::Bool + \o double QJsonValue::Double + \o string QJsonValue::String + \o array QJsonValue::Array + \o object QJsonValue::Object + \o null QJsonValue::Null + \endlist + + A value can represent any of the above data types. In addition, QJsonValue has one special + flag to represent undefined values. This can be queried with isUndefined(). + + The type of the value can be queried with type() or accessors like isBool(), isString(), and so on. + Likewise, the value can be converted to the type stored in it using the toBool(), toString() and so on. + + Values are strictly typed internally and contrary to QVariant will not attempt to do any implicit type + conversions. This implies that converting to a type that is not stored in the value will return a default + constructed return value. +*/ + +/*! + Creates a QJsonValue of type \a type. + + The default is to create a Null value. + */ +QJsonValue::QJsonValue(Type type) + : ui(0), d(0), t(type) +{ +} + +/*! + \internal + */ +QJsonValue::QJsonValue(QJsonPrivate::Data *data, QJsonPrivate::Base *base, const QJsonPrivate::Value &v) + : d(0) +{ + t = (Type)(uint)v.type; + switch (t) { + case Undefined: + case Null: + dbl = 0; + break; + case Bool: + b = v.toBoolean(); + break; + case Double: + dbl = v.toDouble(base); + break; + case String: { + /* + QString s = v.toString(base); + stringData = s.data_ptr(); + stringData->ref.ref(); + */ + stringValue = v.toString(base); + break; + } + case Array: + case Object: + d = data; + this->base = v.base(base); + break; + } + if (d) + d->ref.ref(); +} + +/*! + Creates a value of type Bool, with value \a b. + */ +QJsonValue::QJsonValue(bool b) + : d(0), t(Bool) +{ + this->b = b; +} + +/*! + Creates a value of type Double, with value \a n. + */ +QJsonValue::QJsonValue(double n) + : d(0), t(Double) +{ + this->dbl = n; +} + +/*! + \overload + Creates a value of type Double, with value \a n. + */ +QJsonValue::QJsonValue(int n) + : d(0), t(Double) +{ + this->dbl = n; +} + +/*! + Creates a value of type String, with value \a s. + */ +QJsonValue::QJsonValue(const QString &s) + : d(0), t(String) +{ + /* + stringData = *(QStringData **)(&s); + stringData->ref.ref(); + */ + stringValue = s; +} + +/*! + Creates a value of type String, with value \a s. + */ +QJsonValue::QJsonValue(const QLatin1String &s) + : d(0), t(String) +{ + // ### FIXME: Avoid creating the temp QString below + /* + QString str(s); + stringData = *(QStringData **)(&str); + stringData->ref.ref(); + */ + stringValue = s; +} + +/*! + Creates a value of type Array, with value \a a. + */ +QJsonValue::QJsonValue(const QJsonArray &a) + : d(a.d), t(Array) +{ + base = a.a; + if (d) + d->ref.ref(); +} + +/*! + Creates a value of type Object, with value \a o. + */ +QJsonValue::QJsonValue(const QJsonObject &o) + : d(o.d), t(Object) +{ + base = o.o; + if (d) + d->ref.ref(); +} + + +/*! + Destroys the value. + */ +QJsonValue::~QJsonValue() +{ + /* + if (t == String && stringData && !stringData->ref.deref()) + free(stringData); + */ + + if (d && !d->ref.deref()) + delete d; +} + +/*! + Creates a copy of \a other. + */ +QJsonValue::QJsonValue(const QJsonValue &other) +{ + t = other.t; + d = other.d; + ui = other.ui; + stringValue = other.stringValue; + + if (d) + d->ref.ref(); + + /* + if (t == String && stringData) + stringData->ref.ref(); + */ +} + +/*! + Assigns the value stored in \a other to this object. + */ +QJsonValue &QJsonValue::operator =(const QJsonValue &other) +{ + /* + if (t == String && stringData && !stringData->ref.deref()) + free(stringData); + */ + + t = other.t; + dbl = other.dbl; + stringValue = other.stringValue; + + if (d != other.d) { + + if (d && !d->ref.deref()) + delete d; + d = other.d; + if (d) + d->ref.ref(); + + } + + /* + if (t == String && stringData) + stringData->ref.ref(); + */ + + return *this; +} + +/*! + Converts \a variant to a QJsonValue and returns it. + + The conversion will convert QVariant types as follows: + + \list + \o QVariant::Bool to Bool + \o QVariant::Int + \o QVariant::Double + \o QVariant::LongLong + \o QVariant::ULongLong + \o QVariant::UInt to Double + \o QVariant::String to String + \o QVariant::StringList + \o QVariant::VariantList to Array + \o QVariant::VariantMap to Object + \endlist + + For all other QVariant types a conversion to a QString will be attempted. If the returned string + is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString. + + \sa toVariant() + */ +QJsonValue QJsonValue::fromVariant(const QVariant &variant) +{ + switch (variant.type()) { + case QVariant::Bool: + return QJsonValue(variant.toBool()); + case QVariant::Int: + case QVariant::Double: + case QVariant::LongLong: + case QVariant::ULongLong: + case QVariant::UInt: + return QJsonValue(variant.toDouble()); + case QVariant::String: + return QJsonValue(variant.toString()); + case QVariant::StringList: + return QJsonValue(QJsonArray::fromStringList(variant.toStringList())); + case QVariant::List: + return QJsonValue(QJsonArray::fromVariantList(variant.toList())); + case QVariant::Map: + return QJsonValue(QJsonObject::fromVariantMap(variant.toMap())); + default: + break; + } + QString string = variant.toString(); + if (string.isEmpty()) + return QJsonValue(); + return QJsonValue(string); +} + +/*! + Converts the value to a QVariant. + + The QJsonValue types will be converted as follows: + + \value Null QVariant() + \value Bool QVariant::Bool + \value Double QVariant::Double + \value String QVariant::String + \value Array QVariantList + \value Object QVariantMap + \value Undefined QVariant() + + \sa fromVariant() + */ +QVariant QJsonValue::toVariant() const +{ + switch (t) { + case Bool: + return b; + case Double: + return dbl; + case String: + return toString(); + case Array: + return QJsonArray(d, static_cast(base)).toVariantList(); + case Object: + return QJsonObject(d, static_cast(base)).toVariantMap(); + case Null: + case Undefined: + break; + } + return QVariant(); +} + +/*! + \enum QJsonValue::Type + + This enum describes the type of the JSON value. + + \value Null A Null value + \value Bool A boolean value. Use toBool() to convert to a bool. + \value Double A double. Use toDouble() to convert to a double. + \value String A string. Use toString() to convert to a QString. + \value Array An array. Use toArray() to convert to a QJsonArray. + \value Object An object. Use toObject() to convert to a QJsonObject. + \value Undefined The value is undefined. This is usually returned as an + error condition, when trying to read an out of bounds value + in an array or a non existant key in an object. +*/ + +/*! + Returns the type of the value. + + \sa QJsonValue::Type + */ +QJsonValue::Type QJsonValue::type() const +{ + return t; +} + +/*! + Converts the value to a bool and returns it. + + If type() is not bool, false will be returned. + */ +bool QJsonValue::toBool() const +{ + if (t != Bool) + return false; + return b; +} + +/*! + Converts the value to a double and returns it. + + If type() is not Double, 0. will be returned. + */ +double QJsonValue::toDouble() const +{ + if (t != Double) + return 0; + return dbl; +} + +/*! + Converts the value to a QString and returns it. + + If type() is not String, a QString() will be returned. + */ +QString QJsonValue::toString() const +{ + if (t != String) + return QString(); + + /* + stringData->ref.ref(); // the constructor below doesn't add a ref. + return QString(*(const QConstStringData<1> *)stringData); + */ + return stringValue; +} + +/*! + Converts the value to an array and returns it. + + If type() is not Array, a QJsonArray() will be returned. + */ +QJsonArray QJsonValue::toArray() const +{ + if (!d || t != Array) + return QJsonArray(); + + return QJsonArray(d, static_cast(base)); +} + +/*! + Converts the value to an object and returns it. + + If type() is not Object, a QJsonObject() will be returned. + */ +QJsonObject QJsonValue::toObject() const +{ + if (!d || t != Object) + return QJsonObject(); + + return QJsonObject(d, static_cast(base)); +} + +/*! + Returns true if the value is equal to \a other. + */ +bool QJsonValue::operator==(const QJsonValue &other) const +{ + if (t != other.t) + return false; + + switch (t) { + case Undefined: + case Null: + break; + case Bool: + return b == other.b; + case Double: + return dbl == other.dbl; + case String: + return toString() == other.toString(); + case Array: + return QJsonArray(d, static_cast(base)) + == QJsonArray(other.d, static_cast(other.base)); + case Object: + return QJsonObject(d, static_cast(base)) + == QJsonObject(other.d, static_cast(other.base)); + } + return true; +} + +/*! + Returns true if the value is not equal to \a other. + */ +bool QJsonValue::operator!=(const QJsonValue &other) const +{ + return !(*this == other); +} + +/*! + \internal + */ +void QJsonValue::detach() +{ + if (!d) + return; + + QJsonPrivate::Data *x = d->clone(base); + x->ref.ref(); + if (!d->ref.deref()) + delete d; + d = x; + base = static_cast(d->header->root()); +} + + +/*! + \class QJsonValueRef + \reentrant + \brief The QJsonValueRef class is a helper class for QJsonValue. + + \internal + + \ingroup json + + When you get an object of type QJsonValueRef, if you can assign to it, + the assignment will apply to the character in the string from + which you got the reference. That is its whole purpose in life. + + You can use it exactly in the same way as a reference to a QJsonValue. + + The QJsonValueRef becomes invalid once modifications are made to the + string: if you want to keep the character, copy it into a QJsonValue. + + Most of the QJsonValue member functions also exist in QJsonValueRef. + However, they are not explicitly documented here. +*/ + + +QJsonValueRef &QJsonValueRef::operator =(const QJsonValue &val) +{ + if (is_object) + o->setValueAt(index, val); + else + a->replace(index, val); + + return *this; +} + +QJsonArray QJsonValueRef::toArray() const +{ + return toValue().toArray(); +} + +QJsonObject QJsonValueRef::toObject() const +{ + return toValue().toObject(); +} + +QJsonValue QJsonValueRef::toValue() const +{ + if (!is_object) + return a->at(index); + return o->valueAt(index); +} + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QJsonValue &o) +{ + switch (o.t) { + case QJsonValue::Undefined: + dbg.nospace() << "QJsonValue(undefined)"; + break; + case QJsonValue::Null: + dbg.nospace() << "QJsonValue(null)"; + break; + case QJsonValue::Bool: + dbg.nospace() << "QJsonValue(bool, " << o.toBool() << ")"; + break; + case QJsonValue::Double: + dbg.nospace() << "QJsonValue(double, " << o.toDouble() << ")"; + break; + case QJsonValue::String: + dbg.nospace() << "QJsonValue(string, " << o.toString() << ")"; + break; + case QJsonValue::Array: + dbg.nospace() << "QJsonValue(array, "; + dbg.nospace() << o.toArray(); + dbg.nospace() << ")"; + break; + case QJsonValue::Object: + dbg.nospace() << "QJsonValue(object, "; + dbg.nospace() << o.toObject(); + dbg.nospace() << ")"; + break; + } + return dbg.space(); +} +#endif + +QT_END_NAMESPACE diff --git a/qjson/qjsonvalue.h b/qjson/qjsonvalue.h index 313386b..18926df 100644 --- a/qjson/qjsonvalue.h +++ b/qjson/qjsonvalue.h @@ -1,192 +1,192 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONVALUE_H -#define QJSONVALUE_H - -#include -#include -#include - -#include "qjsonexport.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDebug; -class QVariant; -class QJsonArray; -class QJsonObject; - -namespace QJsonPrivate { - class Data; - class Base; - class Object; - class Header; - class Array; - class Value; - class Entry; -} - -class Q_JSONRPC_EXPORT QJsonValue -{ -public: - enum Type { - Null = 0x0, - Bool = 0x1, - Double = 0x2, - String = 0x3, - Array = 0x4, - Object = 0x5, - Undefined = 0x80 - }; - - QJsonValue(Type = Null); - QJsonValue(bool b); - QJsonValue(double n); - QJsonValue(int n); - QJsonValue(const QString &s); - QJsonValue(const QLatin1String &s); - QJsonValue(const QJsonArray &a); - QJsonValue(const QJsonObject &o); - - ~QJsonValue(); - - QJsonValue(const QJsonValue &other); - QJsonValue &operator =(const QJsonValue &other); - - static QJsonValue fromVariant(const QVariant &variant); - QVariant toVariant() const; - - Type type() const; - inline bool isNull() const { return type() == Null; } - inline bool isBool() const { return type() == Bool; } - inline bool isDouble() const { return type() == Double; } - inline bool isString() const { return type() == String; } - inline bool isArray() const { return type() == Array; } - inline bool isObject() const { return type() == Object; } - inline bool isUndefined() const { return type() == Undefined; } - - bool toBool() const; - double toDouble() const; - QString toString() const; - QJsonArray toArray() const; - QJsonObject toObject() const; - - bool operator==(const QJsonValue &other) const; - bool operator!=(const QJsonValue &other) const; - inline QJsonValue(const void *) {} -private: - // avoid implicit conversions from char * to bool - - friend class QJsonPrivate::Value; - friend class QJsonArray; - friend class QJsonObject; - friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonValue &); - - QJsonValue(QJsonPrivate::Data *d, QJsonPrivate::Base *b, const QJsonPrivate::Value& v); - - void detach(); - - union { - quint64 ui; - bool b; - double dbl; -// QStringData *stringData; - QJsonPrivate::Base *base; - }; - - QString stringValue; - - QJsonPrivate::Data *d; // needed for Objects and Arrays - Type t; -}; - -class Q_JSONRPC_EXPORT QJsonValueRef -{ -public: - QJsonValueRef(QJsonArray *array, int idx) - : a(array), is_object(false), index(idx) {} - QJsonValueRef(QJsonObject *object, int idx) - : o(object), is_object(true), index(idx) {} - - inline operator QJsonValue() const { return toValue(); } - QJsonValueRef &operator = (const QJsonValue &val); - - inline QJsonValue::Type type() const { return toValue().type(); } - inline bool isNull() const { return type() == QJsonValue::Null; } - inline bool isBool() const { return type() == QJsonValue::Bool; } - inline bool isDouble() const { return type() == QJsonValue::Double; } - inline bool isString() const { return type() == QJsonValue::String; } - inline bool isArray() const { return type() == QJsonValue::Array; } - inline bool isObject() const { return type() == QJsonValue::Object; } - inline bool isUndefined() const { return type() == QJsonValue::Undefined; } - - inline bool toBool() const { return toValue().toBool(); } - inline double toDouble() const { return toValue().toDouble(); } - inline QString toString() const { return toValue().toString(); } - QJsonArray toArray() const; - QJsonObject toObject() const; - - inline bool operator==(const QJsonValue &other) const { return toValue() == other; } - inline bool operator!=(const QJsonValue &other) const { return toValue() != other; } - -private: - QJsonValue toValue() const; - - union { - QJsonArray *a; - QJsonObject *o; - }; - uint is_object : 1; - uint index : 31; -}; - -#ifndef QT_NO_DEBUG_STREAM -Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonValue &); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QJSONVALUE_H +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONVALUE_H +#define QJSONVALUE_H + +#include +#include +#include + +#include "qjsonexport.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDebug; +class QVariant; +class QJsonArray; +class QJsonObject; + +namespace QJsonPrivate { + class Data; + class Base; + class Object; + class Header; + class Array; + class Value; + class Entry; +} + +class Q_JSONRPC_EXPORT QJsonValue +{ +public: + enum Type { + Null = 0x0, + Bool = 0x1, + Double = 0x2, + String = 0x3, + Array = 0x4, + Object = 0x5, + Undefined = 0x80 + }; + + QJsonValue(Type = Null); + QJsonValue(bool b); + QJsonValue(double n); + QJsonValue(int n); + QJsonValue(const QString &s); + QJsonValue(const QLatin1String &s); + QJsonValue(const QJsonArray &a); + QJsonValue(const QJsonObject &o); + + ~QJsonValue(); + + QJsonValue(const QJsonValue &other); + QJsonValue &operator =(const QJsonValue &other); + + static QJsonValue fromVariant(const QVariant &variant); + QVariant toVariant() const; + + Type type() const; + inline bool isNull() const { return type() == Null; } + inline bool isBool() const { return type() == Bool; } + inline bool isDouble() const { return type() == Double; } + inline bool isString() const { return type() == String; } + inline bool isArray() const { return type() == Array; } + inline bool isObject() const { return type() == Object; } + inline bool isUndefined() const { return type() == Undefined; } + + bool toBool() const; + double toDouble() const; + QString toString() const; + QJsonArray toArray() const; + QJsonObject toObject() const; + + bool operator==(const QJsonValue &other) const; + bool operator!=(const QJsonValue &other) const; + inline QJsonValue(const void *) {} +private: + // avoid implicit conversions from char * to bool + + friend class QJsonPrivate::Value; + friend class QJsonArray; + friend class QJsonObject; + friend Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonValue &); + + QJsonValue(QJsonPrivate::Data *d, QJsonPrivate::Base *b, const QJsonPrivate::Value& v); + + void detach(); + + union { + quint64 ui; + bool b; + double dbl; +// QStringData *stringData; + QJsonPrivate::Base *base; + }; + + QString stringValue; + + QJsonPrivate::Data *d; // needed for Objects and Arrays + Type t; +}; + +class Q_JSONRPC_EXPORT QJsonValueRef +{ +public: + QJsonValueRef(QJsonArray *array, int idx) + : a(array), is_object(false), index(idx) {} + QJsonValueRef(QJsonObject *object, int idx) + : o(object), is_object(true), index(idx) {} + + inline operator QJsonValue() const { return toValue(); } + QJsonValueRef &operator = (const QJsonValue &val); + + inline QJsonValue::Type type() const { return toValue().type(); } + inline bool isNull() const { return type() == QJsonValue::Null; } + inline bool isBool() const { return type() == QJsonValue::Bool; } + inline bool isDouble() const { return type() == QJsonValue::Double; } + inline bool isString() const { return type() == QJsonValue::String; } + inline bool isArray() const { return type() == QJsonValue::Array; } + inline bool isObject() const { return type() == QJsonValue::Object; } + inline bool isUndefined() const { return type() == QJsonValue::Undefined; } + + inline bool toBool() const { return toValue().toBool(); } + inline double toDouble() const { return toValue().toDouble(); } + inline QString toString() const { return toValue().toString(); } + QJsonArray toArray() const; + QJsonObject toObject() const; + + inline bool operator==(const QJsonValue &other) const { return toValue() == other; } + inline bool operator!=(const QJsonValue &other) const { return toValue() != other; } + +private: + QJsonValue toValue() const; + + union { + QJsonArray *a; + QJsonObject *o; + }; + uint is_object : 1; + uint index : 31; +}; + +#ifndef QT_NO_DEBUG_STREAM +Q_JSONRPC_EXPORT QDebug operator<<(QDebug, const QJsonValue &); +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QJSONVALUE_H diff --git a/qjson/qjsonwriter.cpp b/qjson/qjsonwriter.cpp index d544e61..4d3c289 100644 --- a/qjson/qjsonwriter.cpp +++ b/qjson/qjsonwriter.cpp @@ -1,280 +1,280 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qjsonwriter_p.h" -#include "qjson_p.h" - -QT_BEGIN_NAMESPACE - -using namespace QJsonPrivate; - -static void objectContentToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact); -static void arrayContentToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact); - -// some code from qutfcodec.cpp, inlined here for performance reasons -// to allow fast escaping of strings -static inline bool isUnicodeNonCharacter(uint ucs4) -{ - // Unicode has a couple of "non-characters" that one can use internally, - // but are not allowed to be used for text interchange. - // - // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF, - // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and - // U+FDEF (inclusive) - - return (ucs4 & 0xfffe) == 0xfffe - || (ucs4 - 0xfdd0U) < 16; -} - -static inline uchar hexdig(uint u) -{ - return (u < 0xa ? '0' + u : 'a' + u - 0xa); -} - -static QByteArray escapedString(const QString &s) -{ - const uchar replacement = '?'; - QByteArray ba(s.length(), Qt::Uninitialized); - - uchar *cursor = (uchar *)ba.data(); - const uchar *ba_end = cursor + ba.length(); - - const QChar *ch = (const QChar *)s.constData(); - const QChar *end = ch + s.length(); - - int surrogate_high = -1; - - while (ch < end) { - if (cursor >= ba_end - 6) { - // ensure we have enough space - int pos = cursor - (const uchar *)ba.constData(); - ba.resize(ba.size()*2); - cursor = (uchar *)ba.data() + pos; - ba_end = (const uchar *)ba.constData() + ba.length(); - } - - uint u = ch->unicode(); - if (surrogate_high >= 0) { - if (ch->isLowSurrogate()) { - u = QChar::surrogateToUcs4(surrogate_high, u); - surrogate_high = -1; - } else { - // high surrogate without low - *cursor = replacement; - ++ch; - surrogate_high = -1; - continue; - } - } else if (ch->isLowSurrogate()) { - // low surrogate without high - *cursor = replacement; - ++ch; - continue; - } else if (ch->isHighSurrogate()) { - surrogate_high = u; - ++ch; - continue; - } - - if (u < 0x80) { - if (u < 0x20 || u == 0x22 || u == 0x5c) { - *cursor++ = '\\'; - switch (u) { - case 0x22: - *cursor++ = '"'; - break; - case 0x5c: - *cursor++ = '\\'; - break; - case 0x8: - *cursor++ = 'b'; - break; - case 0xc: - *cursor++ = 'f'; - break; - case 0xa: - *cursor++ = 'n'; - break; - case 0xd: - *cursor++ = 'r'; - break; - case 0x9: - *cursor++ = 't'; - break; - default: - *cursor++ = 'u'; - *cursor++ = '0'; - *cursor++ = '0'; - *cursor++ = hexdig(u>>4); - *cursor++ = hexdig(u & 0xf); - } - } else { - *cursor++ = (uchar)u; - } - } else { - if (u < 0x0800) { - *cursor++ = 0xc0 | ((uchar) (u >> 6)); - } else { - // is it one of the Unicode non-characters? - if (isUnicodeNonCharacter(u)) { - *cursor++ = replacement; - ++ch; - continue; - } - - if (u > 0xffff) { - *cursor++ = 0xf0 | ((uchar) (u >> 18)); - *cursor++ = 0x80 | (((uchar) (u >> 12)) & 0x3f); - } else { - *cursor++ = 0xe0 | (((uchar) (u >> 12)) & 0x3f); - } - *cursor++ = 0x80 | (((uchar) (u >> 6)) & 0x3f); - } - *cursor++ = 0x80 | ((uchar) (u&0x3f)); - } - ++ch; - } - - ba.resize(cursor - (const uchar *)ba.constData()); - return ba; -} - -static void valueToJson(const QJsonPrivate::Base *b, const QJsonPrivate::Value &v, QByteArray &json, int indent, bool compact) -{ - QJsonValue::Type type = (QJsonValue::Type)(uint)v.type; - switch (type) { - case QJsonValue::Bool: - json += v.toBoolean() ? "true" : "false"; - break; - case QJsonValue::Double: - json += QByteArray::number(v.toDouble(b)); - break; - case QJsonValue::String: - json += '"'; - json += escapedString(v.toString(b)); - json += '"'; - break; - case QJsonValue::Array: - json += compact ? "[" : "[\n"; - arrayContentToJson(static_cast(v.base(b)), json, indent + (compact ? 0 : 1), compact); - json += QByteArray(4*indent, ' '); - json += "]"; - break; - case QJsonValue::Object: - json += compact ? "{" : "{\n"; - objectContentToJson(static_cast(v.base(b)), json, indent + (compact ? 0 : 1), compact); - json += QByteArray(4*indent, ' '); - json += "}"; - break; - case QJsonValue::Null: - default: - json += "null"; - } -} - -static void arrayContentToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact) -{ - if (!a || !a->length) - return; - - QByteArray indentString(4*indent, ' '); - - uint i = 0; - while (1) { - json += indentString; - valueToJson(a, a->at(i), json, indent, compact); - - if (++i == a->length) { - if (!compact) - json += '\n'; - break; - } - - json += compact ? "," : ",\n"; - } -} - - -static void objectContentToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact) -{ - if (!o || !o->length) - return; - - QByteArray indentString(4*indent, ' '); - - uint i = 0; - while (1) { - QJsonPrivate::Entry *e = o->entryAt(i); - json += indentString; - json += '"'; - json += escapedString(e->key()); - json += "\": "; - valueToJson(o, e->value, json, indent, compact); - - if (++i == o->length) { - if (!compact) - json += '\n'; - break; - } - - json += compact ? "," : ",\n"; - } -} - -void Writer::objectToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact) -{ - json.reserve(json.size() + (o ? (int)o->size : 16)); - json += compact ? "{" : "{\n"; - objectContentToJson(o, json, indent + (compact ? 0 : 1), compact); - json += QByteArray(4*indent, ' '); - json += compact ? "}" : "}\n"; -} - -void Writer::arrayToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact) -{ - json.reserve(json.size() + (a ? (int)a->size : 16)); - json += compact ? "[" : "[\n"; - arrayContentToJson(a, json, indent + (compact ? 0 : 1), compact); - json += QByteArray(4*indent, ' '); - json += compact ? "]" : "]\n"; -} - -QT_END_NAMESPACE +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qjsonwriter_p.h" +#include "qjson_p.h" + +QT_BEGIN_NAMESPACE + +using namespace QJsonPrivate; + +static void objectContentToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact); +static void arrayContentToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact); + +// some code from qutfcodec.cpp, inlined here for performance reasons +// to allow fast escaping of strings +static inline bool isUnicodeNonCharacter(uint ucs4) +{ + // Unicode has a couple of "non-characters" that one can use internally, + // but are not allowed to be used for text interchange. + // + // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF, + // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and + // U+FDEF (inclusive) + + return (ucs4 & 0xfffe) == 0xfffe + || (ucs4 - 0xfdd0U) < 16; +} + +static inline uchar hexdig(uint u) +{ + return (u < 0xa ? '0' + u : 'a' + u - 0xa); +} + +static QByteArray escapedString(const QString &s) +{ + const uchar replacement = '?'; + QByteArray ba(s.length(), Qt::Uninitialized); + + uchar *cursor = (uchar *)ba.data(); + const uchar *ba_end = cursor + ba.length(); + + const QChar *ch = (const QChar *)s.constData(); + const QChar *end = ch + s.length(); + + int surrogate_high = -1; + + while (ch < end) { + if (cursor >= ba_end - 6) { + // ensure we have enough space + int pos = cursor - (const uchar *)ba.constData(); + ba.resize(ba.size()*2); + cursor = (uchar *)ba.data() + pos; + ba_end = (const uchar *)ba.constData() + ba.length(); + } + + uint u = ch->unicode(); + if (surrogate_high >= 0) { + if (ch->isLowSurrogate()) { + u = QChar::surrogateToUcs4(surrogate_high, u); + surrogate_high = -1; + } else { + // high surrogate without low + *cursor = replacement; + ++ch; + surrogate_high = -1; + continue; + } + } else if (ch->isLowSurrogate()) { + // low surrogate without high + *cursor = replacement; + ++ch; + continue; + } else if (ch->isHighSurrogate()) { + surrogate_high = u; + ++ch; + continue; + } + + if (u < 0x80) { + if (u < 0x20 || u == 0x22 || u == 0x5c) { + *cursor++ = '\\'; + switch (u) { + case 0x22: + *cursor++ = '"'; + break; + case 0x5c: + *cursor++ = '\\'; + break; + case 0x8: + *cursor++ = 'b'; + break; + case 0xc: + *cursor++ = 'f'; + break; + case 0xa: + *cursor++ = 'n'; + break; + case 0xd: + *cursor++ = 'r'; + break; + case 0x9: + *cursor++ = 't'; + break; + default: + *cursor++ = 'u'; + *cursor++ = '0'; + *cursor++ = '0'; + *cursor++ = hexdig(u>>4); + *cursor++ = hexdig(u & 0xf); + } + } else { + *cursor++ = (uchar)u; + } + } else { + if (u < 0x0800) { + *cursor++ = 0xc0 | ((uchar) (u >> 6)); + } else { + // is it one of the Unicode non-characters? + if (isUnicodeNonCharacter(u)) { + *cursor++ = replacement; + ++ch; + continue; + } + + if (u > 0xffff) { + *cursor++ = 0xf0 | ((uchar) (u >> 18)); + *cursor++ = 0x80 | (((uchar) (u >> 12)) & 0x3f); + } else { + *cursor++ = 0xe0 | (((uchar) (u >> 12)) & 0x3f); + } + *cursor++ = 0x80 | (((uchar) (u >> 6)) & 0x3f); + } + *cursor++ = 0x80 | ((uchar) (u&0x3f)); + } + ++ch; + } + + ba.resize(cursor - (const uchar *)ba.constData()); + return ba; +} + +static void valueToJson(const QJsonPrivate::Base *b, const QJsonPrivate::Value &v, QByteArray &json, int indent, bool compact) +{ + QJsonValue::Type type = (QJsonValue::Type)(uint)v.type; + switch (type) { + case QJsonValue::Bool: + json += v.toBoolean() ? "true" : "false"; + break; + case QJsonValue::Double: + json += QByteArray::number(v.toDouble(b)); + break; + case QJsonValue::String: + json += '"'; + json += escapedString(v.toString(b)); + json += '"'; + break; + case QJsonValue::Array: + json += compact ? "[" : "[\n"; + arrayContentToJson(static_cast(v.base(b)), json, indent + (compact ? 0 : 1), compact); + json += QByteArray(4*indent, ' '); + json += "]"; + break; + case QJsonValue::Object: + json += compact ? "{" : "{\n"; + objectContentToJson(static_cast(v.base(b)), json, indent + (compact ? 0 : 1), compact); + json += QByteArray(4*indent, ' '); + json += "}"; + break; + case QJsonValue::Null: + default: + json += "null"; + } +} + +static void arrayContentToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact) +{ + if (!a || !a->length) + return; + + QByteArray indentString(4*indent, ' '); + + uint i = 0; + while (1) { + json += indentString; + valueToJson(a, a->at(i), json, indent, compact); + + if (++i == a->length) { + if (!compact) + json += '\n'; + break; + } + + json += compact ? "," : ",\n"; + } +} + + +static void objectContentToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact) +{ + if (!o || !o->length) + return; + + QByteArray indentString(4*indent, ' '); + + uint i = 0; + while (1) { + QJsonPrivate::Entry *e = o->entryAt(i); + json += indentString; + json += '"'; + json += escapedString(e->key()); + json += "\": "; + valueToJson(o, e->value, json, indent, compact); + + if (++i == o->length) { + if (!compact) + json += '\n'; + break; + } + + json += compact ? "," : ",\n"; + } +} + +void Writer::objectToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact) +{ + json.reserve(json.size() + (o ? (int)o->size : 16)); + json += compact ? "{" : "{\n"; + objectContentToJson(o, json, indent + (compact ? 0 : 1), compact); + json += QByteArray(4*indent, ' '); + json += compact ? "}" : "}\n"; +} + +void Writer::arrayToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact) +{ + json.reserve(json.size() + (a ? (int)a->size : 16)); + json += compact ? "[" : "[\n"; + arrayContentToJson(a, json, indent + (compact ? 0 : 1), compact); + json += QByteArray(4*indent, ' '); + json += compact ? "]" : "]\n"; +} + +QT_END_NAMESPACE diff --git a/qjson/qjsonwriter_p.h b/qjson/qjsonwriter_p.h index 14dfe6b..4fe0f98 100644 --- a/qjson/qjsonwriter_p.h +++ b/qjson/qjsonwriter_p.h @@ -1,73 +1,73 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QJSONWRITER_P_H -#define QJSONWRITER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// -#include "qjsonvalue.h" - -QT_BEGIN_NAMESPACE - -namespace QJsonPrivate -{ - -class Writer -{ -public: - static void objectToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact = false); - static void arrayToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact = false); -}; - -} - -QT_END_NAMESPACE - -#endif +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QJSONWRITER_P_H +#define QJSONWRITER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// +#include "qjsonvalue.h" + +QT_BEGIN_NAMESPACE + +namespace QJsonPrivate +{ + +class Writer +{ +public: + static void objectToJson(const QJsonPrivate::Object *o, QByteArray &json, int indent, bool compact = false); + static void arrayToJson(const QJsonPrivate::Array *a, QByteArray &json, int indent, bool compact = false); +}; + +} + +QT_END_NAMESPACE + +#endif diff --git a/qjson/upQJson.pri b/qjson/upQJson.pri index c31fa95..ce65f11 100644 --- a/qjson/upQJson.pri +++ b/qjson/upQJson.pri @@ -1,24 +1,24 @@ -!greaterThan(QT_MAJOR_VERSION, 4): { - - INCLUDEPATH += \ - $$PWD - - SOURCES += \ - $$PWD/qjson.cpp \ - $$PWD/qjsonarray.cpp \ - $$PWD/qjsondocument.cpp \ - $$PWD/qjsonobject.cpp \ - $$PWD/qjsonparser.cpp \ - $$PWD/qjsonvalue.cpp \ - $$PWD/qjsonwriter.cpp - - HEADERS += \ - $$PWD/qjson_p.h \ - $$PWD/qjsonarray.h \ - $$PWD/qjsondocument.h \ - $$PWD/qjsonobject.h \ - $$PWD/qjsonparser_p.h \ - $$PWD/qjsonvalue.h \ - $$PWD/qjsonwriter_p.h - -} +!greaterThan(QT_MAJOR_VERSION, 4): { + + INCLUDEPATH += \ + $$PWD + + SOURCES += \ + $$PWD/qjson.cpp \ + $$PWD/qjsonarray.cpp \ + $$PWD/qjsondocument.cpp \ + $$PWD/qjsonobject.cpp \ + $$PWD/qjsonparser.cpp \ + $$PWD/qjsonvalue.cpp \ + $$PWD/qjsonwriter.cpp + + HEADERS += \ + $$PWD/qjson_p.h \ + $$PWD/qjsonarray.h \ + $$PWD/qjsondocument.h \ + $$PWD/qjsonobject.h \ + $$PWD/qjsonparser_p.h \ + $$PWD/qjsonvalue.h \ + $$PWD/qjsonwriter_p.h + +} diff --git a/qt4 b/qt4 index b94909d..265ec42 100644 --- a/qt4 +++ b/qt4 @@ -1,38 +1,38 @@ -#!/bin/sh - -export TSLIB_TSDEVICE=/dev/input/event0 -export TSLIB_CONFFILE=/usr/local/etc/ts.conf -export TSLIB_PLUGINDIR=/usr/local/lib/ts -export TSLIB_CALIBFILE=/etc/pointercal -export LD_LIBRARY_PATH=/usr/local/lib -export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin - -export QWS_DISPLAY=:1 - -TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent -if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then - export QWS_MOUSE_PROTO="Tslib:/dev/input/event0 MouseMan:/dev/input/mice" - if [ ! -s /etc/pointercal ] ; then - rm /etc/pointercal - /usr/local/bin/ts_calibrate - fi -else - export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice" -fi -unset TS_INFO_FILE - -export QWS_KEYBOARD=TTY:/dev/tty1 - -export HOME=/root - -#cd /usr/local/Trolltech/QtEmbedded-4.6.3-arm/demos/embedded/fluidlauncher -cd /home/plg -chmod a+x QtUI -hotplug -if [ ! -f /home/plg/runFlag ];then - chmod a+x emergency - ./emergency -qws -fi -rm /home/plg/runFlag -killall QtUI -./QtUI -qws & +#!/bin/sh + +export TSLIB_TSDEVICE=/dev/input/event0 +export TSLIB_CONFFILE=/usr/local/etc/ts.conf +export TSLIB_PLUGINDIR=/usr/local/lib/ts +export TSLIB_CALIBFILE=/etc/pointercal +export LD_LIBRARY_PATH=/usr/local/lib +export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin + +export QWS_DISPLAY=:1 + +TS_INFO_FILE=/sys/devices/virtual/input/input0/uevent +if [ -e $TS_INFO_FILE -a "/bin/grep -q TouchScreen < $TS_INFO_FILE" ]; then + export QWS_MOUSE_PROTO="Tslib:/dev/input/event0 MouseMan:/dev/input/mice" + if [ ! -s /etc/pointercal ] ; then + rm /etc/pointercal + /usr/local/bin/ts_calibrate + fi +else + export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice" +fi +unset TS_INFO_FILE + +export QWS_KEYBOARD=TTY:/dev/tty1 + +export HOME=/root + +#cd /usr/local/Trolltech/QtEmbedded-4.6.3-arm/demos/embedded/fluidlauncher +cd /home/plg +chmod a+x QtUI +hotplug +if [ ! -f /home/plg/runFlag ];then + chmod a+x emergency + ./emergency -qws +fi +rm /home/plg/runFlag +killall QtUI +./QtUI -qws & diff --git a/rcS b/rcS index 1b5b1c5..104d93f 100644 --- a/rcS +++ b/rcS @@ -1,60 +1,60 @@ -#! /bin/sh - -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin: -runlevel=S -prevlevel=N -umask 022 -export PATH runlevel prevlevel - -# -# Trap CTRL-C &c only in this shell so we can interrupt subprocesses. -# -trap ":" INT QUIT TSTP -/bin/hostname FriendlyARM - -/bin/mount -n -t proc none /proc -/bin/mount -n -t sysfs none /sys -/bin/mount -n -t usbfs none /proc/bus/usb -/bin/mount -t ramfs none /dev - -echo /sbin/mdev > /proc/sys/kernel/hotplug -/sbin/mdev -s -/bin/hotplug -# mounting file system specified in /etc/fstab -mkdir -p /dev/pts -mkdir -p /dev/shm -/bin/mount -n -t devpts none /dev/pts -o mode=0622 -/bin/mount -n -t tmpfs tmpfs /dev/shm -/bin/mount -n -t ramfs none /tmp -/bin/mount -n -t ramfs none /var -mkdir -p /var/empty -mkdir -p /var/log -mkdir -p /var/lock -mkdir -p /var/run -mkdir -p /var/tmp - -/sbin/hwclock -s - -syslogd -/etc/rc.d/init.d/netd start -echo " " > /dev/tty1 -echo "Starting networking..." > /dev/tty1 -sleep 1 -/etc/rc.d/init.d/httpd start -echo " " > /dev/tty1 -echo "Starting web server..." > /dev/tty1 -sleep 1 -/etc/rc.d/init.d/leds start -echo " " > /dev/tty1 -echo "Starting leds service..." > /dev/tty1 -echo " " -sleep 1 - -/sbin/ifconfig lo 127.0.0.1 -/etc/init.d/ifconfig-eth0 - -#/bin/qt4 & -/home/plg/qt4 -echo " " > /dev/tty1 -echo "Starting Qtopia, please waiting..." > /dev/tty1 - +#! /bin/sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin: +runlevel=S +prevlevel=N +umask 022 +export PATH runlevel prevlevel + +# +# Trap CTRL-C &c only in this shell so we can interrupt subprocesses. +# +trap ":" INT QUIT TSTP +/bin/hostname FriendlyARM + +/bin/mount -n -t proc none /proc +/bin/mount -n -t sysfs none /sys +/bin/mount -n -t usbfs none /proc/bus/usb +/bin/mount -t ramfs none /dev + +echo /sbin/mdev > /proc/sys/kernel/hotplug +/sbin/mdev -s +/bin/hotplug +# mounting file system specified in /etc/fstab +mkdir -p /dev/pts +mkdir -p /dev/shm +/bin/mount -n -t devpts none /dev/pts -o mode=0622 +/bin/mount -n -t tmpfs tmpfs /dev/shm +/bin/mount -n -t ramfs none /tmp +/bin/mount -n -t ramfs none /var +mkdir -p /var/empty +mkdir -p /var/log +mkdir -p /var/lock +mkdir -p /var/run +mkdir -p /var/tmp + +/sbin/hwclock -s + +syslogd +/etc/rc.d/init.d/netd start +echo " " > /dev/tty1 +echo "Starting networking..." > /dev/tty1 +sleep 1 +/etc/rc.d/init.d/httpd start +echo " " > /dev/tty1 +echo "Starting web server..." > /dev/tty1 +sleep 1 +/etc/rc.d/init.d/leds start +echo " " > /dev/tty1 +echo "Starting leds service..." > /dev/tty1 +echo " " +sleep 1 + +/sbin/ifconfig lo 127.0.0.1 +/etc/init.d/ifconfig-eth0 + +#/bin/qt4 & +/home/plg/qt4 +echo " " > /dev/tty1 +echo "Starting Qtopia, please waiting..." > /dev/tty1 + diff --git a/resolve_dump.sh b/resolve_dump.sh index 991f700..b680e6e 100644 --- a/resolve_dump.sh +++ b/resolve_dump.sh @@ -1,103 +1,103 @@ -#!/bin/bash - -TOOLCHAIN_PREFIX="aarch64-linux-gnu-" -ADDR2LINE="${TOOLCHAIN_PREFIX}addr2line" - -if [ -z "$1" ]; then - echo "错误: 请指定 dump 文件路径" - echo "用法: $0 [QtUI所在目录]" - echo "" - echo "示例:" - echo " $0 ./dumpfile_2026_07_01_11_33_07.txt" - echo " $0 ./dumpfile_2026_07_01_11_33_07.txt /path/to/QtUI_dir" - exit 1 -fi - -DUMP_FILE="$1" - -if [ ! -f "$DUMP_FILE" ]; then - echo "错误: 找不到 dump 文件: $DUMP_FILE" - exit 1 -fi - -DUMP_DIR="$(dirname "$DUMP_FILE")" -DUMP_BASENAME="$(basename "$DUMP_FILE")" -DUMP_NAME="${DUMP_BASENAME%.*}" -DUMP_EXT="${DUMP_BASENAME##*.}" -RESOLVED_FILE="${DUMP_DIR}/${DUMP_NAME}_resolved.${DUMP_EXT}" - -if [ -n "$2" ]; then - QTUI_DIR="$2" -else - QTUI_DIR="$(cd "$(dirname "$0")" && pwd)" -fi - -QTUI_PATH="${QTUI_DIR}/QtUI" -QTUI_DBG="${QTUI_DIR}/QtUI.dbg" - -if [ ! -f "$QTUI_PATH" ]; then - echo "错误: 找不到 QtUI 文件: $QTUI_PATH" - echo "请确保 QtUI 和 QtUI.dbg 在同一目录下" - exit 1 -fi - -if [ ! -f "$QTUI_DBG" ]; then - echo "警告: 找不到 QtUI.dbg 文件: $QTUI_DBG" - echo "addr2line 将仅使用 QtUI 中的调试信息(如果有)" -fi - -if ! command -v "$ADDR2LINE" &> /dev/null; then - echo "错误: 找不到 $ADDR2LINE" - exit 1 -fi - -BASE_ADDR=$(grep -oP 'Base address:\s*\K0x[0-9a-fA-F]+' "$DUMP_FILE") - -if [ -z "$BASE_ADDR" ]; then - echo "错误: 无法从 dump 文件中解析 Base address" - exit 1 -fi - -echo "Base address: $BASE_ADDR" -echo "QtUI 路径: $QTUI_PATH" -echo "QtUI.dbg: $QTUI_DBG" -echo "输出文件: $RESOLVED_FILE" -echo "" - -echo "正在解析 dump 文件: $DUMP_FILE" -echo "=========================================" -echo "" - -ADDR_LINE_REGEX='^(.+/QtUI)\(\+0x([0-9a-fA-F]+)\)\s+\[(0x[0-9a-fA-F]+)\]' - -{ - while IFS= read -r line; do - if [[ "$line" =~ $ADDR_LINE_REGEX ]]; then - OFFSET="0x${BASH_REMATCH[2]}" - RUNTIME_ADDR="${BASH_REMATCH[3]}" - - read -r source_line - - RESOLVED=$($ADDR2LINE -e "$QTUI_PATH" -f -C -p "$OFFSET" 2>/dev/null) - - echo "$line" - if [ -n "$RESOLVED" ] && [ "$RESOLVED" != "?? ??:0" ] && [ "$RESOLVED" != "?? ??:?" ]; then - echo " $RESOLVED" - else - echo " $source_line" - fi - echo "" - elif [[ "$line" =~ ^Base\ address: ]]; then - echo "$line" - echo "" - elif [[ "$line" =~ ^Stack\ trace\ info: ]]; then - echo "$line" - echo "" - else - echo "$line" - fi - done < "$DUMP_FILE" - - echo "=========================================" - echo "解析完成" +#!/bin/bash + +TOOLCHAIN_PREFIX="aarch64-linux-gnu-" +ADDR2LINE="${TOOLCHAIN_PREFIX}addr2line" + +if [ -z "$1" ]; then + echo "错误: 请指定 dump 文件路径" + echo "用法: $0 [QtUI所在目录]" + echo "" + echo "示例:" + echo " $0 ./dumpfile_2026_07_01_11_33_07.txt" + echo " $0 ./dumpfile_2026_07_01_11_33_07.txt /path/to/QtUI_dir" + exit 1 +fi + +DUMP_FILE="$1" + +if [ ! -f "$DUMP_FILE" ]; then + echo "错误: 找不到 dump 文件: $DUMP_FILE" + exit 1 +fi + +DUMP_DIR="$(dirname "$DUMP_FILE")" +DUMP_BASENAME="$(basename "$DUMP_FILE")" +DUMP_NAME="${DUMP_BASENAME%.*}" +DUMP_EXT="${DUMP_BASENAME##*.}" +RESOLVED_FILE="${DUMP_DIR}/${DUMP_NAME}_resolved.${DUMP_EXT}" + +if [ -n "$2" ]; then + QTUI_DIR="$2" +else + QTUI_DIR="$(cd "$(dirname "$0")" && pwd)" +fi + +QTUI_PATH="${QTUI_DIR}/QtUI" +QTUI_DBG="${QTUI_DIR}/QtUI.dbg" + +if [ ! -f "$QTUI_PATH" ]; then + echo "错误: 找不到 QtUI 文件: $QTUI_PATH" + echo "请确保 QtUI 和 QtUI.dbg 在同一目录下" + exit 1 +fi + +if [ ! -f "$QTUI_DBG" ]; then + echo "警告: 找不到 QtUI.dbg 文件: $QTUI_DBG" + echo "addr2line 将仅使用 QtUI 中的调试信息(如果有)" +fi + +if ! command -v "$ADDR2LINE" &> /dev/null; then + echo "错误: 找不到 $ADDR2LINE" + exit 1 +fi + +BASE_ADDR=$(grep -oP 'Base address:\s*\K0x[0-9a-fA-F]+' "$DUMP_FILE") + +if [ -z "$BASE_ADDR" ]; then + echo "错误: 无法从 dump 文件中解析 Base address" + exit 1 +fi + +echo "Base address: $BASE_ADDR" +echo "QtUI 路径: $QTUI_PATH" +echo "QtUI.dbg: $QTUI_DBG" +echo "输出文件: $RESOLVED_FILE" +echo "" + +echo "正在解析 dump 文件: $DUMP_FILE" +echo "=========================================" +echo "" + +ADDR_LINE_REGEX='^(.+/QtUI)\(\+0x([0-9a-fA-F]+)\)\s+\[(0x[0-9a-fA-F]+)\]' + +{ + while IFS= read -r line; do + if [[ "$line" =~ $ADDR_LINE_REGEX ]]; then + OFFSET="0x${BASH_REMATCH[2]}" + RUNTIME_ADDR="${BASH_REMATCH[3]}" + + read -r source_line + + RESOLVED=$($ADDR2LINE -e "$QTUI_PATH" -f -C -p "$OFFSET" 2>/dev/null) + + echo "$line" + if [ -n "$RESOLVED" ] && [ "$RESOLVED" != "?? ??:0" ] && [ "$RESOLVED" != "?? ??:?" ]; then + echo " $RESOLVED" + else + echo " $source_line" + fi + echo "" + elif [[ "$line" =~ ^Base\ address: ]]; then + echo "$line" + echo "" + elif [[ "$line" =~ ^Stack\ trace\ info: ]]; then + echo "$line" + echo "" + else + echo "$line" + fi + done < "$DUMP_FILE" + + echo "=========================================" + echo "解析完成" } | tee "$RESOLVED_FILE" \ No newline at end of file diff --git a/rfid/rfidfunction.cpp b/rfid/rfidfunction.cpp index 7b5408c..85fe37d 100644 --- a/rfid/rfidfunction.cpp +++ b/rfid/rfidfunction.cpp @@ -1,645 +1,645 @@ -#include "rfidfunction.h" -#include "sm3.h" -#include "sm4.h" -#include -#include - - -// 计算校验和并输出 -void RFIDFunction::CheckSumOut(unsigned char* buf, unsigned char len) -{ - unsigned char i; - unsigned char checksum; - checksum = 0; - for (i = 0; i < (len - 1); i++) - { - checksum ^= buf[i]; // 逐位异或计算校验和 - } - buf[len - 1] = (unsigned char)~checksum; // 取反作为校验和 -} - -// 检查输入的校验和是否正确 -bool RFIDFunction::CheckSumIn(unsigned char* buf, unsigned char len) -{ - unsigned char i; - unsigned char checksum; - checksum = 0; - for (i = 0; i < (len - 1); i++) - { - checksum ^= buf[i]; // 逐位异或计算校验和 - } - if (buf[len - 1] == (unsigned char)~checksum) // 比较校验和 - { - return true; // 校验和正确 - } - return false; // 校验和错误 -} - -// 将十六进制字符串转换为字节数组 -void hexStrToByte(const QByteArray& hexIn, unsigned char* dest) -{ - int sourceLen = hexIn.size(); - unsigned char* source = (unsigned char*)hexIn.constData(); - short i; - unsigned char highByte, lowByte; - - for (i = 0; i < sourceLen; i += 2) - { - highByte = toupper(source[i]); // 高位 - lowByte = toupper(source[i + 1]); // 低位 - - if (highByte > 0x39) - { - highByte -= 0x37; // A-F转换 - } - else - { - highByte -= 0x30; // 0-9转换 - } - - if (lowByte > 0x39) - { - lowByte -= 0x37; // A-F转换 - } - else - { - lowByte -= 0x30; // 0-9转换 - } - dest[i / 2] = (highByte << 4) | lowByte; // 合并高低位 - } - return; -} - -// 检测输入的字符是否是有效的16进制字符 -bool isValidHex(const QByteArray& input) -{ - int length = input.size(); // 获取输入的长度 - for (int i = 0; i < length; ++i) // 使用传统的for循环 - { - char c = input[i]; // 获取当前字符 - // 检查字符是否在0-9, A-F, a-f范围内 - if (!((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'F') || - (c >= 'a' && c <= 'f'))) - { - return false; // 如果有无效字符,返回false - } - } - return true; // 所有字符均有效,返回true -} - - -void sleepMs(unsigned int msec) -{ - QTime dieTime = QTime::currentTime().addMSecs(msec); - - while( QTime::currentTime() < dieTime ) - - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); -} - - -RFIDFunction::RFIDFunction(QObject *parent) - : QObject(parent),m_SerialPort(NULL) -{ - m_SerialSate = initSerialPortAndOpen("COM3"); // 初始化串口 -} - -RFIDFunction::~RFIDFunction() -{ - if (m_SerialPort) { - if (m_SerialPort->isOpen()) { - m_SerialPort->close(); - } - delete m_SerialPort; - m_SerialPort = nullptr; - } -} - -/*** - * @描述 : 创建读写卡的密码(Key_A和Key_B) - * @入参 : info 生成密码的数据 - * @输出 : 无 - * @返回 : 密钥的原始数据 - */ -const QByteArray RFIDFunction::createPassword(const QByteArray& info) -{ - if (info.isEmpty()) - { - return ""; // 如果输入为空,返回空 - } - int inputSize = info.size(); - if (inputSize > 8192) - { - return ""; // 如果输入大小超过限制,返回空 - } - //先用SM3对原始数据进行哈希生成 - unsigned char hashDataOrigin[32] = { 0 }; - SM3::sm3Hash((unsigned char*)info.data(), inputSize, hashDataOrigin); // 生成哈希 - - //接着使用哈希生成SM4加密密钥 - unsigned char sm4Key[16] = { 0 }; - unsigned char sm4IV[16] = { 0 }; - int index_1 = 0; - int index_2 = 0; - for (int i = 0; i < 32; i++) - { - if (i % 2 == 0) - { - sm4Key[index_1++] = hashDataOrigin[i]; // 偶数位作为SM4密钥 - } - else - { - sm4IV[index_2++] = hashDataOrigin[i]; // 奇数位作为SM4初始向量 - } - } - - //再用SM4对原始数据进行加密 - unsigned char out[8192] = {0}; - sm4_context sm4Ctx; - SM4::sm4_setkey_enc(&sm4Ctx, sm4Key); // 设置SM4加密密钥 - SM4::sm4_crypt_cbc(&sm4Ctx, SM4_ENCRYPT, inputSize, sm4IV, (unsigned char*)info.data(), out); // 执行SM4加密 - - //最后再用SM3对加密后的数据取哈希 - unsigned char hashEncrypted[32] = { 0 }; - SM3::sm3Hash(out, inputSize, hashEncrypted); // 生成加密数据的哈希 - index_1 = 0; - char key[16] = { 0 }; - for (int i = 0; i < 32; i++) - { - if (i % 2 != 0)//取哈希的奇数位作为最终的密码 - { - key[index_1++] = hashEncrypted[i]; - } - } - return QByteArray(key,16).toHex(); // 返回最终的密码 -} - - -bool RFIDFunction::getSerialState() -{ - return m_SerialSate; // 返回串口状态 -} - -RFIDFunction::ErrorCode RFIDFunction::initSerialPortAndOpen(const QString& portName, - BaudRateType baudRate, - DataBitsType setDataBits, - StopBitsType stopBits, - ParityType parity) -{ - m_SerialPort = new Posix_QextSerialPort("/dev/ttyO3",QextSerialBase::Polling); // 创建串口对象 - m_SerialPort->setPortName(portName); // 设置串口名称 - m_SerialPort->setBaudRate((BaudRateType)baudRate); // 设置波特率 - m_SerialPort->setDataBits(setDataBits); // 设置数据位 - m_SerialPort->setStopBits(stopBits); // 设置停止位 - m_SerialPort->setParity(parity); // 设置校验位 - m_SerialPort->setFlowControl(FLOW_OFF); - if (m_SerialPort->open(QIODevice::ReadWrite)) // 打开串口 - { - return Serial_Error; // 打开失败,返回串口错误 - } - - return No_Error; // 打开成功,返回无错误 -} - -RFIDFunction::ErrorCode RFIDFunction::setOriginPassword(const QByteArray& psw) -{ - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x03; // 命令头 - com[1] = 0x0B; // 数据长度 - com[2] = 0xC4; // 命令类型 - com[3] = 0x20; // 额外数据 - unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 - hexStrToByte(psw, hexOut); // 将密码转换为字节数组 - memcpy(com + 4, hexOut, 6); // 将密码添加到命令中 - CheckSumOut(com, com[1]); // 计算校验和 - - //QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == 0xC4) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - -RFIDFunction::ErrorCode RFIDFunction::setWriteAndReadPassword(const QByteArray& writePassword, const QByteArray& readPassword, KeyFunction keyFunc) -{ - if (writePassword.isEmpty() || readPassword.isEmpty()) - { - return Data_Is_Empty_Error; // 如果密码为空,返回错误 - } - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x03; // 命令头 - com[1] = 0x15; // 数据长度 - com[2] = 0xC3; // 命令类型 - com[3] = 0x20; // 额外数据 - unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 - hexStrToByte(writePassword.toHex(), hexOut); // 将写密码转换为字节数组 - memcpy(com + 4, hexOut, 6); // 将写密码添加到命令中 - switch (keyFunc) // 根据密钥功能设置命令 - { - case RFIDFunction::KeyA_Same_KeyB: - /* - * 控制如下:KEYA,KEYB 可以用来读 、写 、增值 、减值 、更改扇区密钥 - */ - com[10] = 0xFF; // 设置KEYA和KEYB相同 - com[11] = 0x07; // 设置权限 - com[12] = 0x80; // 设置操作 - com[13] = 0x69; // 设置结束标志 - break; - case RFIDFunction::KeyB_Control_KeyA: - /* - 控制如下:KEYA 可以读数据块 、减值 、查询余额 - KEYB 可以读写数据块 、增值 、减值 、查询余额 - KEYA 、KEYB 不可读,KEYA,KEYB 由 KEYB 修改 - */ - com[10] = 0x08; // 设置KEYB控制KEYA - com[11] = 0x77; // 设置权限 - com[12] = 0x8F; // 设置操作 - com[13] = 0x69; // 设置结束标志 - break; - default: - break; - } - memset(hexOut, 0, 32); // 清空hexOut - hexStrToByte(readPassword.toHex(), hexOut); // 将读密码转换为字节数组 - memcpy(com + 14, hexOut, 6); // 将读密码添加到命令中 - CheckSumOut(com, com[1]); // 计算校验和 - - QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 - - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == 0xC3) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - -RFIDFunction::ErrorCode RFIDFunction::setEncryptedBlock(KeyType type, ControlBlock block) -{ - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x01; // 命令头 - com[1] = 0x08; // 数据长度 - switch (type)//只有两种密码,A和B - { - case RFIDFunction::KEY_A: - com[2] = 0xA5; // 设置为KEY_A - break; - case RFIDFunction::KEY_B: - com[2] = 0x5A; // 设置为KEY_B - break; - default: - com[2] = 0xA5; // 默认设置为KEY_A - break; - } - com[3] = 0x20; // 额外数据 - memcpy(com + 4, &block, 1); // 将加密块添加到命令中 - - com[5] = 0x01;//蜂鸣器开 0x00不开 - com[6] = 0x00;//保留 - CheckSumOut(com, com[1]); // 计算校验和 - - QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 - - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x01) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - -RFIDFunction::ErrorCode RFIDFunction::writeDataToBlock(KeyType type, DataBlock block, const QByteArray& data) -{ - if (data.isEmpty()) - { - return Data_Is_Empty_Error; // 如果数据为空,返回错误 - } - - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x01; // 命令头 - com[1] = 0x17; // 数据长度 - switch (type)//只有两种密码,A和B - { - case RFIDFunction::KEY_A: - com[2] = 0xA4; // 设置为KEY_A - break; - case RFIDFunction::KEY_B: - com[2] = 0x5B; // 设置为KEY_B - break; - default: - com[2] = 0xA4; // 默认设置为KEY_A - break; - } - com[3] = 0x20; // 额外数据 - memcpy(com + 4, &block, 1); // 将数据块添加到命令中 - - com[5] = 0x01;//蜂鸣器开 0x00不开 - unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 - memset(hexOut, 0, 32); // 清空hexOut - if (!isValidHex(data)) // 检查数据是否合法 - { - return Data_Is_Illegal_Error; // 数据非法 - } - hexStrToByte(data, hexOut); // 将数据转换为字节数组 - memcpy(com + 6, hexOut, 16); // 将数据添加到命令中 - - CheckSumOut(com, com[1]); // 计算校验和 - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x01) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - -RFIDFunction::ErrorCode RFIDFunction::readDataFromBlock(KeyType type, DataBlock block, QByteArray& data) -{ - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x01; // 命令头 - com[1] = 0x08; // 数据长度 - switch (type)//只有两种密码,A和B - { - case RFIDFunction::KEY_A: - com[2] = 0xA3; // 设置为KEY_A - break; - case RFIDFunction::KEY_B: - com[2] = 0x5C; // 设置为KEY_B - break; - default: - com[2] = 0xA3; // 默认设置为KEY_A - break; - } - com[3] = 0x20; // 额外数据 - - memcpy(com + 4, &block, 1); // 将数据块添加到命令中 - - com[5] = 0x01;//蜂鸣器开 0x00不开 - com[6] = 0x00;//保留 - CheckSumOut(com, com[1]); // 计算校验和 - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - //QByteArray AAA = readData.toHex(); // 转换为十六进制字符串 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x01) && (revData[1] == 0x16) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - data = QByteArray::fromHex(readData.mid(3,16)); - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - - -RFIDFunction::ErrorCode RFIDFunction::setWorkMode(WorkMode mode, DataBlock block, UploadMode uploadMode) -{ - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x03; // 命令头 - com[1] = 0x08; // 数据长度 - com[2] = 0xC1; // 工作模式 - com[3] = 0x20; // 设备号数据 - - memcpy(com + 4, &mode, 1); // 将工作模式添加到命令中 - switch (mode) - { - case RFIDFunction::Command_Mode: - com[5] = 0x00; - com[6] = 0x00; - break; - case RFIDFunction::Auto_Read_Card_Num_Mode: - com[5] = 0x00; - com[6] = uploadMode; - break; - case RFIDFunction::Auto_Read_Data_Mode: - case RFIDFunction::Auto_Read_Card_Num_Data_Mode: - default: - com[5] = block; - com[6] = uploadMode; - break; - } - CheckSumOut(com, com[1]); // 计算校验和 - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - QByteArray AAA = readData.toHex(); // 转换为十六进制字符串 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} - -RFIDFunction::ErrorCode RFIDFunction::getReaderAddress(QByteArray& psw) -{ - unsigned char com[32] = { 0 }; // 命令数组 - com[0] = 0x02; // 命令头 - com[1] = 0x08; // 数据长度 - com[2] = 0xB0; // 命令类型 - com[3] = 0x00; // 额外数据 - com[4] = 0x00; // 额外数据 - com[5] = 0x00; // 额外数据 - com[6] = 0x00; // 额外数据 - - CheckSumOut(com, com[1]); // 计算校验和 - - QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 - if (m_SerialPort->isOpen()) // 检查串口是否打开 - { - qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 - if (len != com[1]) // 检查发送长度 - { - return Send_Data_Error; // 发送错误 - } - // 等待请求完成 - sleepMs(200); - - QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 - unsigned char revData[32] = { 0 }; // 存储返回数据 - memcpy(revData, readData.data(), readData.size()); // 复制返回数据 - if ((revData[0] == 0x02) && (revData[1] == 0x08) && (revData[2] == com[2])) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revData, revData[1]); //计算校验和 - if (status) - { - if (revData[4] == 0x00) //写数据块成功 - { - psw = QByteArray::fromHex(QByteArray(revData[5], 1)); - return No_Error; // 返回无错误 - } - } - else - { - return Received_Data_Check_Error; // 校验和错误 - } - } - else - { - return Received_Data_Error; // 返回数据错误 - } - } - return Serial_Error; // 串口错误 -} +#include "rfidfunction.h" +#include "sm3.h" +#include "sm4.h" +#include +#include + + +// 计算校验和并输出 +void RFIDFunction::CheckSumOut(unsigned char* buf, unsigned char len) +{ + unsigned char i; + unsigned char checksum; + checksum = 0; + for (i = 0; i < (len - 1); i++) + { + checksum ^= buf[i]; // 逐位异或计算校验和 + } + buf[len - 1] = (unsigned char)~checksum; // 取反作为校验和 +} + +// 检查输入的校验和是否正确 +bool RFIDFunction::CheckSumIn(unsigned char* buf, unsigned char len) +{ + unsigned char i; + unsigned char checksum; + checksum = 0; + for (i = 0; i < (len - 1); i++) + { + checksum ^= buf[i]; // 逐位异或计算校验和 + } + if (buf[len - 1] == (unsigned char)~checksum) // 比较校验和 + { + return true; // 校验和正确 + } + return false; // 校验和错误 +} + +// 将十六进制字符串转换为字节数组 +void hexStrToByte(const QByteArray& hexIn, unsigned char* dest) +{ + int sourceLen = hexIn.size(); + unsigned char* source = (unsigned char*)hexIn.constData(); + short i; + unsigned char highByte, lowByte; + + for (i = 0; i < sourceLen; i += 2) + { + highByte = toupper(source[i]); // 高位 + lowByte = toupper(source[i + 1]); // 低位 + + if (highByte > 0x39) + { + highByte -= 0x37; // A-F转换 + } + else + { + highByte -= 0x30; // 0-9转换 + } + + if (lowByte > 0x39) + { + lowByte -= 0x37; // A-F转换 + } + else + { + lowByte -= 0x30; // 0-9转换 + } + dest[i / 2] = (highByte << 4) | lowByte; // 合并高低位 + } + return; +} + +// 检测输入的字符是否是有效的16进制字符 +bool isValidHex(const QByteArray& input) +{ + int length = input.size(); // 获取输入的长度 + for (int i = 0; i < length; ++i) // 使用传统的for循环 + { + char c = input[i]; // 获取当前字符 + // 检查字符是否在0-9, A-F, a-f范围内 + if (!((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f'))) + { + return false; // 如果有无效字符,返回false + } + } + return true; // 所有字符均有效,返回true +} + + +void sleepMs(unsigned int msec) +{ + QTime dieTime = QTime::currentTime().addMSecs(msec); + + while( QTime::currentTime() < dieTime ) + + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); +} + + +RFIDFunction::RFIDFunction(QObject *parent) + : QObject(parent),m_SerialPort(NULL) +{ + m_SerialSate = initSerialPortAndOpen("COM3"); // 初始化串口 +} + +RFIDFunction::~RFIDFunction() +{ + if (m_SerialPort) { + if (m_SerialPort->isOpen()) { + m_SerialPort->close(); + } + delete m_SerialPort; + m_SerialPort = nullptr; + } +} + +/*** + * @描述 : 创建读写卡的密码(Key_A和Key_B) + * @入参 : info 生成密码的数据 + * @输出 : 无 + * @返回 : 密钥的原始数据 + */ +const QByteArray RFIDFunction::createPassword(const QByteArray& info) +{ + if (info.isEmpty()) + { + return ""; // 如果输入为空,返回空 + } + int inputSize = info.size(); + if (inputSize > 8192) + { + return ""; // 如果输入大小超过限制,返回空 + } + //先用SM3对原始数据进行哈希生成 + unsigned char hashDataOrigin[32] = { 0 }; + SM3::sm3Hash((unsigned char*)info.data(), inputSize, hashDataOrigin); // 生成哈希 + + //接着使用哈希生成SM4加密密钥 + unsigned char sm4Key[16] = { 0 }; + unsigned char sm4IV[16] = { 0 }; + int index_1 = 0; + int index_2 = 0; + for (int i = 0; i < 32; i++) + { + if (i % 2 == 0) + { + sm4Key[index_1++] = hashDataOrigin[i]; // 偶数位作为SM4密钥 + } + else + { + sm4IV[index_2++] = hashDataOrigin[i]; // 奇数位作为SM4初始向量 + } + } + + //再用SM4对原始数据进行加密 + unsigned char out[8192] = {0}; + sm4_context sm4Ctx; + SM4::sm4_setkey_enc(&sm4Ctx, sm4Key); // 设置SM4加密密钥 + SM4::sm4_crypt_cbc(&sm4Ctx, SM4_ENCRYPT, inputSize, sm4IV, (unsigned char*)info.data(), out); // 执行SM4加密 + + //最后再用SM3对加密后的数据取哈希 + unsigned char hashEncrypted[32] = { 0 }; + SM3::sm3Hash(out, inputSize, hashEncrypted); // 生成加密数据的哈希 + index_1 = 0; + char key[16] = { 0 }; + for (int i = 0; i < 32; i++) + { + if (i % 2 != 0)//取哈希的奇数位作为最终的密码 + { + key[index_1++] = hashEncrypted[i]; + } + } + return QByteArray(key,16).toHex(); // 返回最终的密码 +} + + +bool RFIDFunction::getSerialState() +{ + return m_SerialSate; // 返回串口状态 +} + +RFIDFunction::ErrorCode RFIDFunction::initSerialPortAndOpen(const QString& portName, + BaudRateType baudRate, + DataBitsType setDataBits, + StopBitsType stopBits, + ParityType parity) +{ + m_SerialPort = new Posix_QextSerialPort("/dev/ttyO3",QextSerialBase::Polling); // 创建串口对象 + m_SerialPort->setPortName(portName); // 设置串口名称 + m_SerialPort->setBaudRate((BaudRateType)baudRate); // 设置波特率 + m_SerialPort->setDataBits(setDataBits); // 设置数据位 + m_SerialPort->setStopBits(stopBits); // 设置停止位 + m_SerialPort->setParity(parity); // 设置校验位 + m_SerialPort->setFlowControl(FLOW_OFF); + if (m_SerialPort->open(QIODevice::ReadWrite)) // 打开串口 + { + return Serial_Error; // 打开失败,返回串口错误 + } + + return No_Error; // 打开成功,返回无错误 +} + +RFIDFunction::ErrorCode RFIDFunction::setOriginPassword(const QByteArray& psw) +{ + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x03; // 命令头 + com[1] = 0x0B; // 数据长度 + com[2] = 0xC4; // 命令类型 + com[3] = 0x20; // 额外数据 + unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 + hexStrToByte(psw, hexOut); // 将密码转换为字节数组 + memcpy(com + 4, hexOut, 6); // 将密码添加到命令中 + CheckSumOut(com, com[1]); // 计算校验和 + + //QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == 0xC4) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + +RFIDFunction::ErrorCode RFIDFunction::setWriteAndReadPassword(const QByteArray& writePassword, const QByteArray& readPassword, KeyFunction keyFunc) +{ + if (writePassword.isEmpty() || readPassword.isEmpty()) + { + return Data_Is_Empty_Error; // 如果密码为空,返回错误 + } + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x03; // 命令头 + com[1] = 0x15; // 数据长度 + com[2] = 0xC3; // 命令类型 + com[3] = 0x20; // 额外数据 + unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 + hexStrToByte(writePassword.toHex(), hexOut); // 将写密码转换为字节数组 + memcpy(com + 4, hexOut, 6); // 将写密码添加到命令中 + switch (keyFunc) // 根据密钥功能设置命令 + { + case RFIDFunction::KeyA_Same_KeyB: + /* + * 控制如下:KEYA,KEYB 可以用来读 、写 、增值 、减值 、更改扇区密钥 + */ + com[10] = 0xFF; // 设置KEYA和KEYB相同 + com[11] = 0x07; // 设置权限 + com[12] = 0x80; // 设置操作 + com[13] = 0x69; // 设置结束标志 + break; + case RFIDFunction::KeyB_Control_KeyA: + /* + 控制如下:KEYA 可以读数据块 、减值 、查询余额 + KEYB 可以读写数据块 、增值 、减值 、查询余额 + KEYA 、KEYB 不可读,KEYA,KEYB 由 KEYB 修改 + */ + com[10] = 0x08; // 设置KEYB控制KEYA + com[11] = 0x77; // 设置权限 + com[12] = 0x8F; // 设置操作 + com[13] = 0x69; // 设置结束标志 + break; + default: + break; + } + memset(hexOut, 0, 32); // 清空hexOut + hexStrToByte(readPassword.toHex(), hexOut); // 将读密码转换为字节数组 + memcpy(com + 14, hexOut, 6); // 将读密码添加到命令中 + CheckSumOut(com, com[1]); // 计算校验和 + + QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 + + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == 0xC3) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + +RFIDFunction::ErrorCode RFIDFunction::setEncryptedBlock(KeyType type, ControlBlock block) +{ + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x01; // 命令头 + com[1] = 0x08; // 数据长度 + switch (type)//只有两种密码,A和B + { + case RFIDFunction::KEY_A: + com[2] = 0xA5; // 设置为KEY_A + break; + case RFIDFunction::KEY_B: + com[2] = 0x5A; // 设置为KEY_B + break; + default: + com[2] = 0xA5; // 默认设置为KEY_A + break; + } + com[3] = 0x20; // 额外数据 + memcpy(com + 4, &block, 1); // 将加密块添加到命令中 + + com[5] = 0x01;//蜂鸣器开 0x00不开 + com[6] = 0x00;//保留 + CheckSumOut(com, com[1]); // 计算校验和 + + QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 + + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x01) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + +RFIDFunction::ErrorCode RFIDFunction::writeDataToBlock(KeyType type, DataBlock block, const QByteArray& data) +{ + if (data.isEmpty()) + { + return Data_Is_Empty_Error; // 如果数据为空,返回错误 + } + + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x01; // 命令头 + com[1] = 0x17; // 数据长度 + switch (type)//只有两种密码,A和B + { + case RFIDFunction::KEY_A: + com[2] = 0xA4; // 设置为KEY_A + break; + case RFIDFunction::KEY_B: + com[2] = 0x5B; // 设置为KEY_B + break; + default: + com[2] = 0xA4; // 默认设置为KEY_A + break; + } + com[3] = 0x20; // 额外数据 + memcpy(com + 4, &block, 1); // 将数据块添加到命令中 + + com[5] = 0x01;//蜂鸣器开 0x00不开 + unsigned char hexOut[32] = { 0 }; // 存储转换后的十六进制数据 + memset(hexOut, 0, 32); // 清空hexOut + if (!isValidHex(data)) // 检查数据是否合法 + { + return Data_Is_Illegal_Error; // 数据非法 + } + hexStrToByte(data, hexOut); // 将数据转换为字节数组 + memcpy(com + 6, hexOut, 16); // 将数据添加到命令中 + + CheckSumOut(com, com[1]); // 计算校验和 + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x01) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + +RFIDFunction::ErrorCode RFIDFunction::readDataFromBlock(KeyType type, DataBlock block, QByteArray& data) +{ + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x01; // 命令头 + com[1] = 0x08; // 数据长度 + switch (type)//只有两种密码,A和B + { + case RFIDFunction::KEY_A: + com[2] = 0xA3; // 设置为KEY_A + break; + case RFIDFunction::KEY_B: + com[2] = 0x5C; // 设置为KEY_B + break; + default: + com[2] = 0xA3; // 默认设置为KEY_A + break; + } + com[3] = 0x20; // 额外数据 + + memcpy(com + 4, &block, 1); // 将数据块添加到命令中 + + com[5] = 0x01;//蜂鸣器开 0x00不开 + com[6] = 0x00;//保留 + CheckSumOut(com, com[1]); // 计算校验和 + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + //QByteArray AAA = readData.toHex(); // 转换为十六进制字符串 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x01) && (revData[1] == 0x16) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + data = QByteArray::fromHex(readData.mid(3,16)); + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + + +RFIDFunction::ErrorCode RFIDFunction::setWorkMode(WorkMode mode, DataBlock block, UploadMode uploadMode) +{ + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x03; // 命令头 + com[1] = 0x08; // 数据长度 + com[2] = 0xC1; // 工作模式 + com[3] = 0x20; // 设备号数据 + + memcpy(com + 4, &mode, 1); // 将工作模式添加到命令中 + switch (mode) + { + case RFIDFunction::Command_Mode: + com[5] = 0x00; + com[6] = 0x00; + break; + case RFIDFunction::Auto_Read_Card_Num_Mode: + com[5] = 0x00; + com[6] = uploadMode; + break; + case RFIDFunction::Auto_Read_Data_Mode: + case RFIDFunction::Auto_Read_Card_Num_Data_Mode: + default: + com[5] = block; + com[6] = uploadMode; + break; + } + CheckSumOut(com, com[1]); // 计算校验和 + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + QByteArray AAA = readData.toHex(); // 转换为十六进制字符串 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x03) && (revData[1] == 0x08) && (revData[2] == com[2]) && (revData[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} + +RFIDFunction::ErrorCode RFIDFunction::getReaderAddress(QByteArray& psw) +{ + unsigned char com[32] = { 0 }; // 命令数组 + com[0] = 0x02; // 命令头 + com[1] = 0x08; // 数据长度 + com[2] = 0xB0; // 命令类型 + com[3] = 0x00; // 额外数据 + com[4] = 0x00; // 额外数据 + com[5] = 0x00; // 额外数据 + com[6] = 0x00; // 额外数据 + + CheckSumOut(com, com[1]); // 计算校验和 + + QByteArray AAA = QByteArray((char*)com, com[1]).toHex(); // 转换为十六进制字符串 + if (m_SerialPort->isOpen()) // 检查串口是否打开 + { + qint64 len = m_SerialPort->write(QByteArray((char*)com, com[1])); // 发送命令 + if (len != com[1]) // 检查发送长度 + { + return Send_Data_Error; // 发送错误 + } + // 等待请求完成 + sleepMs(200); + + QByteArray readData = m_SerialPort->readAll(); // 读取返回数据 + unsigned char revData[32] = { 0 }; // 存储返回数据 + memcpy(revData, readData.data(), readData.size()); // 复制返回数据 + if ((revData[0] == 0x02) && (revData[1] == 0x08) && (revData[2] == com[2])) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revData, revData[1]); //计算校验和 + if (status) + { + if (revData[4] == 0x00) //写数据块成功 + { + psw = QByteArray::fromHex(QByteArray(revData[5], 1)); + return No_Error; // 返回无错误 + } + } + else + { + return Received_Data_Check_Error; // 校验和错误 + } + } + else + { + return Received_Data_Error; // 返回数据错误 + } + } + return Serial_Error; // 串口错误 +} diff --git a/rfid/rfidfunction.h b/rfid/rfidfunction.h index 81304c2..5012539 100644 --- a/rfid/rfidfunction.h +++ b/rfid/rfidfunction.h @@ -1,171 +1,171 @@ -#pragma once - -#include -#include -#include -#include "posix_qextserialport.h" - -class RFIDFunction:public QObject -{ - Q_OBJECT -public: - enum ControlBlock//加密块 - { - Sector_0_Block_3 = 3, - Sector_1_Block_3 = 7, - Sector_2_Block_3 = 11, - Sector_3_Block_3 = 15, - Sector_4_Block_3 = 19, - Sector_5_Block_3 = 23, - Sector_6_Block_3 = 27, - Sector_7_Block_3 = 31, - Sector_8_Block_3 = 35, - Sector_9_Block_3 = 39, - Sector_10_Block_3 = 43, - Sector_11_Block_3 = 47, - Sector_12_Block_3 = 51, - Sector_13_Block_3 = 55, - Sector_14_Block_3 = 59, - Sector_15_Block_3 = 63 - }; - - enum KeyType//密钥类型 - { - KEY_A = 0, // 密钥A - KEY_B // 密钥B - }; - - enum DataBlock //数据块 - { - Sector_0_Block_1 = 1, - Sector_0_Block_2 = 2, - - Sector_1_Block_0 = 4, - Sector_1_Block_1 = 5, - Sector_1_Block_2 = 6, - - Sector_2_Block_0 = 8, - Sector_2_Block_1 = 9, - Sector_2_Block_2 = 10, - - Sector_3_Block_0 = 12, - Sector_3_Block_1 = 13, - Sector_3_Block_2 = 14, - - Sector_4_Block_0 = 16, - Sector_4_Block_1 = 17, - Sector_4_Block_2 = 18, - - Sector_5_Block_0 = 20, - Sector_5_Block_1 = 21, - Sector_5_Block_2 = 22, - - Sector_6_Block_0 = 24, - Sector_6_Block_1 = 25, - Sector_6_Block_2 = 26, - - Sector_7_Block_0 = 28, - Sector_7_Block_1 = 29, - Sector_7_Block_2 = 30, - - Sector_8_Block_0 = 32, - Sector_8_Block_1 = 33, - Sector_8_Block_2 = 34, - - Sector_9_Block_0 = 36, - Sector_9_Block_1 = 37, - Sector_9_Block_2 = 38, - - Sector_10_Block_0 = 40, - Sector_10_Block_1 = 41, - Sector_10_Block_2 = 42, - - Sector_11_Block_0 = 44, - Sector_11_Block_1 = 45, - Sector_11_Block_2 = 46, - - Sector_12_Block_0 = 48, - Sector_12_Block_1 = 49, - Sector_12_Block_2 = 50, - - Sector_13_Block_0 = 52, - Sector_13_Block_1 = 53, - Sector_13_Block_2 = 54, - - Sector_14_Block_0 = 56, - Sector_14_Block_1 = 57, - Sector_14_Block_2 = 58, - - Sector_15_Block_0 = 60, - Sector_15_Block_1 = 61, - Sector_15_Block_2 = 62 - }; - - enum KeyFunction - { - KeyA_Same_KeyB = 0, // KEYA和KEYB相同 - KeyB_Control_KeyA // KEYB控制KEYA - }; - - - - enum WorkMode //工作模式 - { - Command_Mode = 0x01,//命令模式(关闭自动读卡),该模式会关闭自动读卡功能 - Auto_Read_Card_Num_Mode = 0x02,//自动读卡号 - Auto_Read_Data_Mode = 0x03,//自动读块数据,块号为要自动读的数据块编号 - Auto_Read_Card_Num_Data_Mode = 0x04//自动读卡号与指定块数据,块号为要自动读的数据块编号 - }; - - enum UploadMode//上传模式 - { - Auto_Upload = 0x00,//读卡后主动发送数据,主动将读到的数据发送给上位机 - Command_Upload = 0x01//读卡后被动发送数据,需要收到上位机获取数据的命令才将读到的数据发送给上位机 - }; - - - - enum ErrorCode - { - No_Error = 0, // 无错误 - Serial_Error, // 串口错误 - Send_Data_Error, // 发送数据错误 - Data_Is_Empty_Error, // 数据为空错误 - Data_Size_More_Than_8192_Error, // 数据大小超过8192错误 - Received_Data_Check_Error, // 接收数据校验错误 - Received_Data_Error, // 接收数据错误 - Data_Is_Illegal_Error // 数据非法错误 - }; - -public: - RFIDFunction(QObject* parent); // 构造函数 - ~RFIDFunction(); // 析构函数 - void CheckSumOut(unsigned char* buf, unsigned char len); - bool CheckSumIn(unsigned char* buf, unsigned char len); - - - ErrorCode initSerialPortAndOpen(const QString& portName, // 初始化串口并打开 - BaudRateType baudRate = BAUD9600, // 波特率 - DataBitsType setDataBits = DATA_8, // 数据位 - StopBitsType stopBits = STOP_1, // 停止位 - ParityType parity = PAR_NONE // 校验位 - ); - - static const QByteArray createPassword(const QByteArray& info); // 创建密码 - - bool getSerialState(); // 获取串口状态 - ErrorCode setOriginPassword(const QByteArray& psw); // 设置原始密码 - ErrorCode setWriteAndReadPassword(const QByteArray& writePassword, const QByteArray& readPassword, KeyFunction keyFunc); // 设置读写密码 - ErrorCode setEncryptedBlock(KeyType type, ControlBlock block); // 设置加密块 - ErrorCode writeDataToBlock(KeyType type, DataBlock block, const QByteArray& data); // 写数据到块 - ErrorCode readDataFromBlock(KeyType type, DataBlock block, QByteArray& data); // 从块读取数据 - ErrorCode setWorkMode(WorkMode mode, DataBlock block = Sector_1_Block_2, UploadMode uploadMode = Auto_Upload);//设置工作模式 - ErrorCode getReaderAddress(QByteArray& psw); // 获取读卡器地址 - - - -private: - bool m_SerialSate; // 串口状态 - Posix_QextSerialPort *m_SerialPort;; // 串口对象 - -}; +#pragma once + +#include +#include +#include +#include "posix_qextserialport.h" + +class RFIDFunction:public QObject +{ + Q_OBJECT +public: + enum ControlBlock//加密块 + { + Sector_0_Block_3 = 3, + Sector_1_Block_3 = 7, + Sector_2_Block_3 = 11, + Sector_3_Block_3 = 15, + Sector_4_Block_3 = 19, + Sector_5_Block_3 = 23, + Sector_6_Block_3 = 27, + Sector_7_Block_3 = 31, + Sector_8_Block_3 = 35, + Sector_9_Block_3 = 39, + Sector_10_Block_3 = 43, + Sector_11_Block_3 = 47, + Sector_12_Block_3 = 51, + Sector_13_Block_3 = 55, + Sector_14_Block_3 = 59, + Sector_15_Block_3 = 63 + }; + + enum KeyType//密钥类型 + { + KEY_A = 0, // 密钥A + KEY_B // 密钥B + }; + + enum DataBlock //数据块 + { + Sector_0_Block_1 = 1, + Sector_0_Block_2 = 2, + + Sector_1_Block_0 = 4, + Sector_1_Block_1 = 5, + Sector_1_Block_2 = 6, + + Sector_2_Block_0 = 8, + Sector_2_Block_1 = 9, + Sector_2_Block_2 = 10, + + Sector_3_Block_0 = 12, + Sector_3_Block_1 = 13, + Sector_3_Block_2 = 14, + + Sector_4_Block_0 = 16, + Sector_4_Block_1 = 17, + Sector_4_Block_2 = 18, + + Sector_5_Block_0 = 20, + Sector_5_Block_1 = 21, + Sector_5_Block_2 = 22, + + Sector_6_Block_0 = 24, + Sector_6_Block_1 = 25, + Sector_6_Block_2 = 26, + + Sector_7_Block_0 = 28, + Sector_7_Block_1 = 29, + Sector_7_Block_2 = 30, + + Sector_8_Block_0 = 32, + Sector_8_Block_1 = 33, + Sector_8_Block_2 = 34, + + Sector_9_Block_0 = 36, + Sector_9_Block_1 = 37, + Sector_9_Block_2 = 38, + + Sector_10_Block_0 = 40, + Sector_10_Block_1 = 41, + Sector_10_Block_2 = 42, + + Sector_11_Block_0 = 44, + Sector_11_Block_1 = 45, + Sector_11_Block_2 = 46, + + Sector_12_Block_0 = 48, + Sector_12_Block_1 = 49, + Sector_12_Block_2 = 50, + + Sector_13_Block_0 = 52, + Sector_13_Block_1 = 53, + Sector_13_Block_2 = 54, + + Sector_14_Block_0 = 56, + Sector_14_Block_1 = 57, + Sector_14_Block_2 = 58, + + Sector_15_Block_0 = 60, + Sector_15_Block_1 = 61, + Sector_15_Block_2 = 62 + }; + + enum KeyFunction + { + KeyA_Same_KeyB = 0, // KEYA和KEYB相同 + KeyB_Control_KeyA // KEYB控制KEYA + }; + + + + enum WorkMode //工作模式 + { + Command_Mode = 0x01,//命令模式(关闭自动读卡),该模式会关闭自动读卡功能 + Auto_Read_Card_Num_Mode = 0x02,//自动读卡号 + Auto_Read_Data_Mode = 0x03,//自动读块数据,块号为要自动读的数据块编号 + Auto_Read_Card_Num_Data_Mode = 0x04//自动读卡号与指定块数据,块号为要自动读的数据块编号 + }; + + enum UploadMode//上传模式 + { + Auto_Upload = 0x00,//读卡后主动发送数据,主动将读到的数据发送给上位机 + Command_Upload = 0x01//读卡后被动发送数据,需要收到上位机获取数据的命令才将读到的数据发送给上位机 + }; + + + + enum ErrorCode + { + No_Error = 0, // 无错误 + Serial_Error, // 串口错误 + Send_Data_Error, // 发送数据错误 + Data_Is_Empty_Error, // 数据为空错误 + Data_Size_More_Than_8192_Error, // 数据大小超过8192错误 + Received_Data_Check_Error, // 接收数据校验错误 + Received_Data_Error, // 接收数据错误 + Data_Is_Illegal_Error // 数据非法错误 + }; + +public: + RFIDFunction(QObject* parent); // 构造函数 + ~RFIDFunction(); // 析构函数 + void CheckSumOut(unsigned char* buf, unsigned char len); + bool CheckSumIn(unsigned char* buf, unsigned char len); + + + ErrorCode initSerialPortAndOpen(const QString& portName, // 初始化串口并打开 + BaudRateType baudRate = BAUD9600, // 波特率 + DataBitsType setDataBits = DATA_8, // 数据位 + StopBitsType stopBits = STOP_1, // 停止位 + ParityType parity = PAR_NONE // 校验位 + ); + + static const QByteArray createPassword(const QByteArray& info); // 创建密码 + + bool getSerialState(); // 获取串口状态 + ErrorCode setOriginPassword(const QByteArray& psw); // 设置原始密码 + ErrorCode setWriteAndReadPassword(const QByteArray& writePassword, const QByteArray& readPassword, KeyFunction keyFunc); // 设置读写密码 + ErrorCode setEncryptedBlock(KeyType type, ControlBlock block); // 设置加密块 + ErrorCode writeDataToBlock(KeyType type, DataBlock block, const QByteArray& data); // 写数据到块 + ErrorCode readDataFromBlock(KeyType type, DataBlock block, QByteArray& data); // 从块读取数据 + ErrorCode setWorkMode(WorkMode mode, DataBlock block = Sector_1_Block_2, UploadMode uploadMode = Auto_Upload);//设置工作模式 + ErrorCode getReaderAddress(QByteArray& psw); // 获取读卡器地址 + + + +private: + bool m_SerialSate; // 串口状态 + Posix_QextSerialPort *m_SerialPort;; // 串口对象 + +}; diff --git a/rfid/rfidmanager.cpp b/rfid/rfidmanager.cpp index 446035b..64e1f28 100644 --- a/rfid/rfidmanager.cpp +++ b/rfid/rfidmanager.cpp @@ -1,1138 +1,1138 @@ -#include "rfidfunction.h" -#include "rfidmanager.h" - -#include -#include -#include -#include -#include -//#include "runtimectrl.h" - -constexpr char* SUPER_CARD_ID = "397F4A8E5B9F6CA07D395B28E4A6"; - -RFIDManager::RFIDManager() -{ - comForRFID_init(); -} - -void RFIDManager::CheckSumOut(UCHAR *buf, UCHAR len) -{ - UCHAR i; - UCHAR checksum; - checksum = 0; - if (len == 0) - return; - - for (i = 0; i < (len - 1); i++) - { - checksum ^= buf[i]; - } - buf[len - 1] = (UCHAR)~checksum; -} - -bool RFIDManager::CheckSumIn(UCHAR *buf, UCHAR len) -{ - UCHAR i; - UCHAR checksum; - checksum = 0; - if (len == 0) return false; - for (i = 0; i < (len - 1); i++) - { - checksum ^= buf[i]; - } - if (buf[len - 1] == (UCHAR)~checksum) - { - return true; - } - return false; -} - -void RFIDManager::MySleep(unsigned int msec, int expSize) -{ -// QTime dieTime = QTime::currentTime().addMSecs(msec); -// while( QTime::currentTime() < dieTime ) { -// QCoreApplication::processEvents(QEventLoop::AllEvents, 100); -// } - -// QByteArray recResponse; - RFIDReadData.clear(); - QElapsedTimer elapsedTimer; - elapsedTimer.start(); - while (!elapsedTimer.hasExpired(msec)) { - if (RFIDReadData.size() >= expSize) { -// recResponse = comForRFID->read(8); - break; - } - QCoreApplication::processEvents(QEventLoop::AllEvents, 10); - } -} - -void RFIDManager::Hex2Str(const UCHAR *sSrc, UCHAR *sDest, int nSrcLen) -{ - int i; - char szTmp[3]; - for (i = 0; i < nSrcLen; i++) - { - sprintf(szTmp, "%02X", (unsigned char)sSrc[i]); - memcpy(&sDest[i * 2], szTmp, 2); - } - sDest[nSrcLen * 2] = '\0'; - return; -} - -void RFIDManager::HexStrToByte(const UCHAR *source, UCHAR *dest, int sourceLen) -{ - short i; - unsigned char highByte, lowByte; - - for (i = 0; i < sourceLen; i += 2) - { - highByte = toupper(source[i]); - lowByte = toupper(source[i + 1]); - - if (highByte > 0x39) - highByte -= 0x37; - else - highByte -= 0x30; - - if (lowByte > 0x39) - lowByte -= 0x37; - else - lowByte -= 0x30; - - dest[i / 2] = (highByte << 4) | lowByte; - } - return; -} - - -void RFIDManager::comForRFID_init() -{ - if (comForRFID) { - delete comForRFID; - comForRFID = nullptr; - } - - checkCardIntervalTime = 0; - setICReaderModeFlag = false; - - comForRFID = new QSerialPort(); - -#ifdef ARCH_AARCH64 - comForRFID->setPortName("/dev/ttyAS1"); -#else - comForRFID->setPortName("/dev/ttyUSB0"); -#endif - - qDebug() << "RFID serial port name: " << comForRFID->portName(); - - comForRFID->setBaudRate(9600); - comForRFID->setDataBits(QSerialPort::Data8); - comForRFID->setParity(QSerialPort::NoParity); - comForRFID->setStopBits(QSerialPort::OneStop); - comForRFID->setFlowControl(QSerialPort::NoFlowControl); - if (comForRFID->open(QIODevice::ReadWrite)) { - qDebug() << "RFID串口打开成功"; - connect(comForRFID,SIGNAL(readyRead()),this,SLOT(slt_readRFIDData())); - } else { - qDebug() << "RFID串口打开失败:" << comForRFID->errorString(); - delete comForRFID; - comForRFID = nullptr; - return; - } - - initTimer(); -} - -int RFIDManager::comReadRFID_data() -{ - UCHAR Cmd[23] = { 0x01, 0x17, 0xA4, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - UCHAR revdata[100]; - Cmd[1] = 0x08; - Cmd[2] = 0xA3; - Cmd[4] = 0x06; //读块6 - CheckSumOut(Cmd, Cmd[1]); - QByteArray temp; - QByteArray recResponse; - temp.append((const char*)Cmd,Cmd[1]); - if(comForRFID->isOpen()) - { - LogInfo::setRunStatusText(tr("readB6Req")); - comForRFID->clear(QSerialPort::Input); - comForRFID->write(temp); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - - MySleep(2000, 0x16); - - int n = RFIDReadData.size(); - if(n < 0x16) - { - LogInfo::setRunStatusText("RFID invalied data"); - return 0; - } - - n = std::max(0x16, n); - - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - memcpy(revdata, recResponse.data(), n); - if ((revdata[0] == 0x01) && ((revdata[1] == 8) - || (revdata[1] == 22)) && (revdata[1] == n) - && (revdata[2] == 0xA3) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 - { - LogInfo::setRunStatusText(tr("readB6suc")); - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status) - { - if (revdata[4] == 0x00) //读数据块成功 - { - UCHAR blockdata[16]; - UCHAR temp[33]; - for (int i = 0; i < 16; i++) - { - blockdata[i] = revdata[5 + i]; //复制数据到数组 - } - Hex2Str(&blockdata[0], &temp[0], 16); // 数据块数据转换为字符 - - strRevdata = QString((const char*)temp); - // qDebug() << "读数据块成功,数据块6" << "数据为:" << temp << endl << endl; - return 1; - } - } - } - return 0; -} - -QByteArray RFIDManager::buildMarkCardCommand(int block, int cardType, const QString& originalCardData) -{ - UCHAR Cmd[23] = { 0x01, 0x17, 0xA4, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - - Cmd[1] = 0x17; - Cmd[2] = 0x5B; - Cmd[4] = block; //读块6 - - // 超级IC卡:数据以397F4A8E5B9F6CA07D395B28E4A6结尾,直接原样写回数据 - bool isSuperCard = !originalCardData.isEmpty() - && originalCardData.endsWith(SUPER_CARD_ID); - - if (isSuperCard) { - // 超级IC卡:将原始数据原样写回,不写入使用时间 - QByteArray hexData = originalCardData.toLatin1(); - UCHAR dataBytes[16] = {0}; - HexStrToByte((const UCHAR*)hexData.constData(), dataBytes, hexData.size()); - for (int i = 0; i < 16; i++) { - Cmd[i + 6] = dataBytes[i]; - } - LogInfo::setRunStatusText(tr("Super IC card, write back original data")); - qDebug() << "Super IC card detected, writing back original data:" << originalCardData; - } else { - //save current date and time - QDateTime curDateTime = QDateTime::currentDateTime(); - QString str = curDateTime.toString("yy:MM:dd:hh:mm:ss"); - QList list = str.split(":"); - for(int i = 0;i < list.size();i++){ - Cmd[i+6] = list.at(i).toInt(); - LogInfo::setRunStatusText(tr("Cmd[%1]: %2").arg(i+6).arg(Cmd[i+6])); - qDebug()<<"Cmd["<bytesAvailable(); - // if(n < 8) { - // qDebug() << "读取数据失败, 数据长度不足8字节" << endl << endl; - // return false; - // } - - UCHAR revdata[100]; - int n = recResponse.size(); - if (n > sizeof(revdata)) return false; - memcpy(revdata, recResponse.constData(), n); - - if ((revdata[0] == 0x01) && (revdata[1] == 8) - && (revdata[1] == n) && (revdata[2] == 0x5B) - && (revdata[3] == 0x20)) //判断是否为写数据返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status && revdata[4] == 0x00) - { - //写数据块成功 - qDebug() << notice << "成功!" << endl << endl; - LogInfo::setRunStatusText(notice+"成功!"); - return true; - } - } - - qDebug() << notice << "失败!" << endl << endl; - LogInfo::setRunStatusText(notice+"失败!"); - return false; -} - -RFIDManager *RFIDManager::instance() -{ - static RFIDManager* ins = nullptr; - if(ins == nullptr) { - ins = new RFIDManager(); - } - - return ins; -} - -int RFIDManager::RFIDmarkCardUsedAsync(int type, const QString& cardData) -{ - if (!comForRFID || !comForRFID->isOpen()) { - qDebug()<<"read uart for RFID not open!"; - return -1; - } - - // 对于超级卡,执行余额减一操作 - bool isSuperCard = !cardData.isEmpty() - && cardData.endsWith(SUPER_CARD_ID); - if(isSuperCard) { - MySleep(200); - int ret = superCardDeduct(); - if(ret < 0) { - qDebug() << "超级卡余额减一失败"; - return ret; - } - - LogInfo::setRunStatusText("Super card remain: "+QString::number(ret)); - - return ret; - } - - // 构建命令(不硬编码块号) 读块6 - QByteArray cmd = buildMarkCardCommand(0x06, type, cardData); - if (cmd.isEmpty()) { - qDebug() << "命令构建失败"; - return -1; - } - - // 临时断开信号,避免干扰 - bool wasConnected = comForRFID->disconnect(this); - wasConnected = true; - - // 清空缓冲区 - comForRFID->clear(QSerialPort::Input); - comForRFID->clear(QSerialPort::Output); - - // 发送命令 - qint64 written = comForRFID->write(cmd); - if (written != cmd.size()) { - qCritical() << "发送数据失败,发送字节数:" << written << "预期:" << cmd.size(); - if (wasConnected) { - connect(comForRFID, &QSerialPort::readyRead, - this, &RFIDManager::slt_readRFIDData); - } - return -1; - } - - QByteArray recResponse; - QElapsedTimer elapsedTimer; - elapsedTimer.start(); - while (!elapsedTimer.hasExpired(2000)) { - if (comForRFID->bytesAvailable() >= 8) { - recResponse = comForRFID->read(8); - break; - } - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - // 恢复信号连接 - if (wasConnected) { - connect(comForRFID, &QSerialPort::readyRead, - this, &RFIDManager::slt_readRFIDData); - } - - bool res = verifyWriteResponse(recResponse, tr("写数据到数据块6")); - if (!res) { - qDebug() << "响应验证失败"; - return -1; - } - qDebug() << "卡片标记成功,块:" << 06 << "耗时:" << elapsedTimer.elapsed() << "ms"; - return 0; -} - -void RFIDManager::initRFIDMoudle(unsigned int addr, SysPara * sysPara) -{ - this->sysPara = sysPara; - setICReaderModeFlag = true; - setRFIDReaderWorkMode(); - setRFIDReaderKey(addr,1); - setICReaderModeFlag = false; -} - -void RFIDManager::handleCheck(unsigned int addr) -{ - if(sysPara == nullptr) return; - - // ink:100A2233445566778899AABBCCDDEEFF - if(!setICReaderModeFlag) - { - strRevdata =""; - receiveReadRFID_data(); - if(strRevdata.length() > 3) - { - if((strRevdata.left(3) == QString::number(addr).left(3)) - || strRevdata.left(32) == QString("100A")+SUPER_CARD_ID - || strRevdata.left(32) == QString("100B")+SUPER_CARD_ID) - { - if(strRevdata.at(3) == 'A') - { - bool flag = true; - if(!sysPara->status.flagOfNeedInkCard){ - flag = false; - emit sig_showMsg(tr("不需要刷墨水卡!")); - } - else if(sysPara->status.statWarn & WARN_STATUS_INK_WARN){ - flag = false; - emit sig_showMsg(tr("请先添加原厂墨水再刷墨水卡!")); - } - -#ifdef __RFID_IND - if(flag){ - sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,2); - sysPara->devOp->strRevdata =""; - if(sysPara->devOp->readIndBlock()){ - if(sysPara->devOp->strRevdata.left(3) == QString::number(ui->tabPrintSetting->dlgInputAddr->jd.addr).left(3)){ - if(sysPara->devOp->strRevdata.at(3) == 'C'){ - if(sysPara->devOp->comWriteRFID_data(2) == 1)//把卡数据清零 - { - // sysPara->RFIDPara.InkRFIDCnt = 0; - // sysPara->RFIDPara.PrintInkDots = 0; - // sysPara->saveRFIDPara(); - // sysPara->devOp->checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); - } - } - } - } - else{ - flag = false; - LogInfo::setRunStatusText(tr("Read India Ink Block data failure.")); - } - sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,1); - } -#endif - if(flag){ - auto ret = RFIDmarkCardUsedAsync(1, strRevdata); - if(ret >= 0 || ret == -11)//把卡数据清零或原样写回 - { - sysPara->RFIDPara.InkRFIDCnt = 0; - sysPara->RFIDPara.PrintInkDots = 0; - sysPara->saveRFIDPara(); - sysPara->para.RFIDInkWarn = false; - sysPara->para.inkWarnDate = 0; - sysPara->para.inkWarnTime = 0; - sysPara->status.flagOfInkMaxDot = false; - sysPara->status.flagOfNeedInkCard = false; - checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); - emit sig_showMsg(tr("刷墨水卡成功!")); - sysPara->saveParaToFile(); - } - else if(ret == -10) { - emit sig_showMsg(tr("刷超级墨水卡失败,请联系厂商。")); - } - } - } - else if(strRevdata.at(3) == 'B') - { - bool flag = true; - if(!sysPara->status.flagOfNeedSolventCard){ - flag = false; - emit sig_showMsg(tr("不需要刷溶剂卡!")); - } - else if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN){ - flag = false; - emit sig_showMsg(tr("请先添加原厂溶剂再刷溶剂卡!")); - } - -#ifdef __RFID_IND - if(flag){ - sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,2); - sysPara->devOp->strRevdata =""; - if(sysPara->devOp->readIndBlock()){ - if(sysPara->devOp->strRevdata.left(3) == QString::number(ui->tabPrintSetting->dlgInputAddr->jd.addr).left(3)){ - if(sysPara->devOp->strRevdata.at(3) == 'D'){ - if(sysPara->devOp->comWriteRFID_data(2) == 1)//把卡数据清零 - { - // sysPara->RFIDPara.InkRFIDCnt = 0; - // sysPara->RFIDPara.PrintInkDots = 0; - // sysPara->saveRFIDPara(); - // sysPara->devOp->checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); - } - } - } - } - else{ - flag = false; - LogInfo::setRunStatusText(tr("Read India solvent Block data failure.")); - } - sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,1); - } -#endif - if(flag){ - auto ret = RFIDmarkCardUsedAsync(1, strRevdata); - if(ret >= 0 || ret == -11)//把卡数据清零或原样写回 - { - sysPara->RFIDPara.SOLVRFIDCnt = 0; - sysPara->RFIDPara.solventNumber = 0; - sysPara->saveRFIDPara(); - sysPara->para.RFIDSolventWarn = 0; - sysPara->para.solventWarnDate = 0; - sysPara->para.solventWarnTime = 0; - sysPara->para.RFIDSolventWarnMixCnt = 0; - sysPara->status.flagOfSolventMaxNum = false; - sysPara->status.flagOfNeedSolventCard = false; - checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); - emit sig_showMsg(tr("刷溶剂卡成功!")); - sysPara->saveParaToFile(); - } - else if(ret == -10) { - emit sig_showMsg(tr("刷超级溶剂卡失败,请联系厂商。")); - } - } - } - else - { - emit sig_showMsg(tr("MAC无效卡!")); - } - } - else - { -// LogInfo::setRunStatusText(tr("card data: %1").arg(sysPara->devOp->strRevdata)); - QString str1 = QString::number(strRevdata.mid(0,2).toInt(0,16)).rightJustified(2,'0'); - QString str2 =QString::number(strRevdata.mid(2,2).toInt(0,16)).rightJustified(2,'0'); - QString str3 = QString::number(strRevdata.mid(4,2).toInt(0,16)).rightJustified(2,'0'); - QString str4 = QString::number(strRevdata.mid(6,2).toInt(0,16)).rightJustified(2,'0'); - QString str5 = QString::number(strRevdata.mid(8,2).toInt(0,16)).rightJustified(2,'0'); - QString str6 =QString::number( strRevdata.mid(10,2).toInt(0,16)).rightJustified(2,'0'); - QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6; - QString strShow = tr("无效卡,这张卡已经在%1时使用过").arg(strDateTime); - emit sig_showMsg(strShow); - } - } - } -} - -void RFIDManager::bindSysPara(SysPara *sysPara) -{ - this->sysPara = sysPara; -} - -int RFIDManager::setRFIDCarKey() -{ - UCHAR revdata[100]; - UCHAR Cmd[8] ; - Cmd[0] = 0x01; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x08; - Cmd[2] = 0xA5; //加密扇区 - Cmd[3] = 0x20; - Cmd[4] = 0x07; //块7 - Cmd[5] = 0x01; - Cmd[6] = 0x00; - Cmd[7] = 0x00; - - CheckSumOut(Cmd, Cmd[1]); - QByteArray temp; - QByteArray recResponse; - temp.append((const char*)Cmd,Cmd[1]); - if(comForRFID->isOpen()) - { - comForRFID->clear(QSerialPort::Input); - comForRFID->write(temp); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - - MySleep(2000); - - int n = RFIDReadData.size(); - if(n>2) - { - recResponse = RFIDReadData; - RFIDReadData.clear(); - QString str; - str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); - qDebug()<<"加密IC卡: "< sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - memcpy(revdata, recResponse.data(), n); - if ((revdata[0] == 0x01) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xA5) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status) - { - if (revdata[4] == 0x00) //成功 - { - qDebug() << "加密IC卡成功!" << endl << endl; - } - else - { - qDebug() << "加密IC卡失败!" << endl << endl; - } - } - } - else - { - qDebug() << "加密IC卡失败2!" << endl << endl; - } -} - -int RFIDManager::setRFIDReaderKey(int mac,int type) -{ - if (!comForRFID) return; - if(mac == 0) mac = 100; - QString strMac1 = QString::number(mac).mid(0,3); - strMac1 = "Vernon" + strMac1 + "Bach"; - strMac1 = strMac1.leftJustified(16,'6'); - QString strMac2 =QString::number(mac).mid(0,3); - strMac2 = "VernonBach" + strMac2; - strMac2 = strMac2.leftJustified(16,'6'); - - QByteArray password = ""; - if(type == 1) - password = RFIDFunction::createPassword((const QByteArray)strMac1.toUtf8()); - else if(type == 2) - password = RFIDFunction::createPassword((const QByteArray)strMac2.toUtf8()); - const QByteArray pw = password.mid(12,12); - - UCHAR revdata[100]; - UCHAR Cmd[21] ; - Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x15; - Cmd[2] = 0xC3; //设置密钥 - Cmd[3] = 0x20; - - Cmd[4] = 0x99; - Cmd[5] = 0x88; - Cmd[6] = 0x77; - Cmd[7] = 0x66; - Cmd[8] = 0x55; - Cmd[9] = 0x44; - - Cmd[10] = 0xFF; - Cmd[11] = 0x07; - Cmd[12] = 0x80; - Cmd[13] = 0x69; - Cmd[14] = 0xAA; - Cmd[15] = 0xBB; - Cmd[16] = 0xCC; - Cmd[17] = 0xDD; - Cmd[18] = 0xEE; - Cmd[19] = 0xFF; - Cmd[20] = 0x1B; - -#ifndef __RFID_OLD - bool ok; - for(int i = 0;i<6;i++){ - int pwInt = Cmd[i+14] = pw.mid(i*2,2).toInt(&ok,16); - if (!ok) { - qDebug() << "Error: Invalid hex value: "<isOpen()) - { - comForRFID->clear(QSerialPort::Input); - RFIDReadData.clear(); - comForRFID->write(temp); - comForRFID->disconnect(this); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - - QElapsedTimer elapsedTimer; - elapsedTimer.start(); - while(!elapsedTimer.hasExpired(2000)) { - qApp->processEvents(QEventLoop::AllEvents, 100); - if(comForRFID->bytesAvailable() >= 8) { - recResponse = comForRFID->read(8); - break; - } - } - - connect(comForRFID, &QSerialPort::readyRead, this, &RFIDManager::slt_readRFIDData); - - int n = recResponse.size(); - if(n < 8) { - LogInfo::setRunStatusText(tr("设置读写器密码失败!")); - return 0; - } - - n = std::max(8, n); - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - - memcpy(revdata, recResponse.data(), n); - if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC3) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status) - { - if (revdata[4] == 0x00) //成功 - { - qDebug() << "设置读写器密码成功!" << endl << endl; - LogInfo::setRunStatusText(tr("设置读写器密码成功!")); - } - else - { - qDebug() << "设置读写器密码失败!" << endl << endl; - } - } - } - else - { - qDebug() << "设置读写器密码失败!" << endl << endl; - } - - return 0; -} - -int RFIDManager::setRFIDReaderOriginalKey(void) -{ - UCHAR revdata[100]; - UCHAR Cmd[11] ; - Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x0B; - Cmd[2] = 0xC4; //设置密钥 - Cmd[3] = 0x20; - Cmd[4] = 0xFF; - Cmd[5] = 0xFF; - Cmd[6] = 0xFF; - Cmd[7] = 0xFF; - Cmd[8] = 0xFF; - Cmd[9] = 0xFF; - Cmd[10] = 0x00; - - CheckSumOut(Cmd, Cmd[1]); - QByteArray temp; - QByteArray recResponse; - temp.append((const char*)Cmd,Cmd[1]); - if(comForRFID->isOpen()) - { - comForRFID->clear(QSerialPort::Input); - comForRFID->write(temp); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - MySleep(2000); - int n = RFIDReadData.size(); - if(n < 8) { - LogInfo::setRunStatusText(tr("设置读写器原始密码失败!")); - return 0; - } - - n = std::max(8, n); - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - - memcpy(revdata, recResponse.data(), n); - if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC4) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status) - { - if (revdata[4] == 0x00) //成功 - { - qDebug() << "设置读写器原始密码成功!" << endl << endl; - } - else - { - qDebug() << "设置读写器原始密码失败!" << endl << endl; - } - } - } - else - { - qDebug() << "设置读写器原始密码失败!" << endl << endl; - } -} - -int RFIDManager::setRFIDReaderWorkMode(void) -{ - if (!comForRFID) return; - UCHAR revdata[100]; - UCHAR Cmd[8] ; - Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x08; - Cmd[2] = 0xC1; //设置工作模式 - Cmd[3] = 0x20; - Cmd[4] = 0x03; - Cmd[5] = 0x06; //读块6 - Cmd[6] = 0x00; //主动发送数据 - Cmd[7] = 0x00; - - CheckSumOut(Cmd, Cmd[1]); - QByteArray temp; - QByteArray recResponse; - temp.append((const char*)Cmd,Cmd[1]); - if(comForRFID->isOpen()) - { - comForRFID->clear(QSerialPort::Input); - RFIDReadData.clear(); - comForRFID->write(temp); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - // 延时200毫秒等待读写器返回数据,延时太小可能无法接收完整的数据包 - MySleep(2000); - int n = RFIDReadData.size(); - - if(n < 8) { - LogInfo::setRunStatusText(tr("设置读写器工作模式失败!")); - return 0; - } - - n = std::max(8, n); - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - - if(n>2) - { - recResponse = RFIDReadData; - RFIDReadData.clear(); - QString str; - str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); - qDebug()<<"设置读写器工作模式: "< sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - memcpy(revdata, recResponse.data(), n); - if ((revdata[0] == 0x03) &&( revdata[1] == 8 ) - && (revdata[1] == n) && (revdata[2] == 0xC1) - && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status && revdata[4] == 0x00) - { - qDebug() << "设置读写器工作模式成功!" << endl << endl; - LogInfo::setRunStatusText(tr("设置读写器工作模式成功!")); - return 1; - } - } - qDebug() << "设置读写器工作模式失败!" << endl << endl; - return 0; -} - -int RFIDManager::receiveReadRFID_data(void) -{ - UCHAR revdata[100]; - QByteArray recResponse; - int n = RFIDReadData.size(); - if(n>0) - { - recResponse = RFIDReadData; - RFIDReadData.clear(); -// showData(recResponse); - } - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - memcpy(revdata, recResponse.data(), n); - - if ((revdata[0] == 0x04) && ((revdata[1] == 8) - || (revdata[1] == 22)) && (revdata[1] == n) - && (revdata[2] == 0x03) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 - { - bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 - if (status) - { - if (revdata[4] == 0x00) //读数据块成功 - { - UCHAR blockdata[16]; - UCHAR temp[33]; - for (int i = 0; i < 16; i++) - { - blockdata[i] = revdata[5 + i]; //复制数据到数组 - } - Hex2Str(&blockdata[0], &temp[0], 16); // 数据块数据转换为字符 - strRevdata = QString((const char*)temp); - return 1; - } - else - { - return 0; - } - } - } - return 0; -} - -int RFIDManager::queryReadRFID_address(void) -{ - if (!comForRFID) return; - UCHAR Cmd[8] ; - Cmd[0] = 0x02; //命令格式请核对协议手册充值章节 - Cmd[1] = 0x08; - Cmd[2] = 0xB0; //查询读写器地址 - Cmd[3] = 0x00; - Cmd[4] = 0x00; - Cmd[5] = 0x00; - Cmd[6] = 0x00; - Cmd[7] = 0x00; - CheckSumOut(Cmd, Cmd[1]); - QByteArray temp; - - UCHAR revdata[100]; - - temp.append((const char*)Cmd,Cmd[1]); - if(comForRFID->isOpen()) - { - comForRFID->clear(QSerialPort::Input); - RFIDReadData.clear(); - comForRFID->write(temp); - } - else - { - qDebug()<<"read uart for RFID not open!"; - } - MySleep(2000); - int n = RFIDReadData.size(); - if(n < 8) { - LogInfo::setRunStatusText(tr("查询读写器地址失败")); - return 1; - } - - n = std::max(8, n); - if (n > sizeof(revdata)) { - return 0; // 防止后面拷贝越界 - } - - if (n > sizeof(revdata)) return; - memcpy(revdata, RFIDReadData.data(), n); - if(n>0) - { -// showData(RFIDReadData); - if(CheckSumIn(revdata, revdata[1]) == false){ - RFIDReadData.clear(); - return 0; - } - if(revdata[0] == 0x02 && revdata[1] == 0x08 - && revdata[2] == 0xB0 && revdata[4] == 0x00){ - RFIDReadData.clear(); - return 1; - } - } - else //没有收到数据 - return 2; - -} - -int RFIDManager::superCardDeduct() -{ - uint8_t cmd[] = {0x01, 0x0B, 0xA7, 0x20, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}; - CheckSumOut(cmd, cmd[1]); - - // 临时断开信号,避免干扰 - bool wasConnected = comForRFID->disconnect(this); - wasConnected = true; - - // 清空缓冲区 - comForRFID->clear(QSerialPort::Input); - comForRFID->clear(QSerialPort::Output); - - // 发送命令 - qint64 written = comForRFID->write((const char*)(cmd), sizeof(cmd)); - if (written != ARRAY_SIZE(cmd)) { - qCritical() << "发送数据失败,发送字节数:" << written << "预期:" << ARRAY_SIZE(cmd); - if (wasConnected) { - connect(comForRFID, &QSerialPort::readyRead, - this, &RFIDManager::slt_readRFIDData); - } - return -1; - } - - QByteArray recResponse; - QElapsedTimer elapsedTimer; - int expectSize = 0; - elapsedTimer.start(); - while (!elapsedTimer.hasExpired(2000)) { - if (comForRFID->bytesAvailable() >= 8 && recResponse.size() == 0) { - recResponse = comForRFID->read(2); - expectSize = recResponse[1] - 2; - continue; - } - - if(comForRFID->bytesAvailable() >= expectSize && recResponse.size() == 2) { - recResponse.append(comForRFID->read(expectSize)); - break; - } - - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); - } - - qDebug() << "expectSize:" << expectSize + 2; - - // 恢复信号连接 - if (wasConnected) { - connect(comForRFID, &QSerialPort::readyRead, - this, &RFIDManager::slt_readRFIDData); - } - - if(recResponse.size() <= 2) { - LogInfo::setRunStatusText("Response data length error, too short."); - qWarning() << "Response data length error, too short."; - return -1; - } - - if(CheckSumIn((UCHAR*)(recResponse.data()), recResponse.at(1)) == false) { - // 校验和错误 - LogInfo::setRunStatusText("Failed to check sum"); - qWarning() << "Failed to check sum"; - return -1; - } - - qDebug() << "Super card response data size: " << recResponse.size() << "in content: " << recResponse[1]; - uint8_t recData [10] = {0}; - memccpy(recData, recResponse.data(), sizeof(uint8_t), qMin(recResponse.size(), 10)); - - int remains = 0; - - // 01 0A A7 20 00 2A 00 00 00 59 成功 - // 01 08 A7 20 01 00 00 70 失败 - if(recResponse.at(1) == 0x0A && recResponse[2] == 0xA7 && recResponse[3] == 0x20 && recResponse[4] == 0x00) { - // 成功 - // 响应数据是4字节的小端整数 - remains = recResponse[5] | (recResponse[6] << 8) | (recResponse[7] << 16) | (recResponse[8] << 24); - LogInfo::setRunStatusText(QString("Super card remaining times:%1").arg(remains)); - } else if(recResponse.at(1) == 0x08 && recResponse[2] == 0xA7 && recResponse[3] == 0x20) { - // 失败 - /* - 0x01:扣款失败 - 0x03:扣款成功,读取余额失败 - */ - if(recResponse[4] == 0x01) { - LogInfo::setRunStatusText(("Super card times not enough")); - qWarning() << "Super card times not enough"; - remains = -10; - } else if(recResponse[4] == 0x03) { - LogInfo::setRunStatusText(("Super card times deduct success, but remaining times unknown")); - qWarning() << "Super card times deduct success, but remaining times unknown"; - remains = -11; - } - } - - return remains; -} - -void RFIDManager::initTimer() -{ - if (RFIDTimer == nullptr) { - RFIDTimer = new QTimer(this); - connect(RFIDTimer, &QTimer::timeout, - this, &RFIDManager::slt_timerHandle); - RFIDTimer->start(10 * 1000); - } -} - -//bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) -//{ -// QMessageBox box(QMessageBox::Warning, tr("警告"), -// msgTxt, QMessageBox::Ok | QMessageBox::Cancel); - -// int rfidCountDown = sysPara->para.rfidCountDown; -// QTimer msgTimer; -// QString boxTxt = variableMsgTxt; -// connect(&msgTimer, &QTimer::timeout, [this, &box, &rfidCountDown, boxTxt]() { -// box.setText(boxTxt.arg(rfidCountDown)); -// box.update(); -// rfidCountDown--; -// if(rfidCountDown == 0) { -// box.accept(); -// } -// }); - -// if(sysPara->para.rfidCountDown > 0) { -// box.setText(boxTxt.arg(sysPara->para.rfidCountDown)); -// msgTimer.start(1000); -// } - -// box.exec(); - -// return box.result() == QMessageBox::Ok || box.result() == QMessageBox::Accepted; -//} - - -void RFIDManager::slt_readRFIDData() -{ - QMutexLocker locker(&m_rfidMutex); - RFIDReadData.append(comForRFID->readAll()); -} - -void RFIDManager::slt_timerHandle() -{ - static int faultyNum = 0; - static uint noticeICReaderErrorTime = QDateTime::currentDateTime().toTime_t(); - if((QDateTime::currentDateTime().toTime_t() - noticeICReaderErrorTime > 7200 - || QDateTime::currentDateTime().toTime_t() == noticeICReaderErrorTime) - || (faultyNum > 0 && faultyNum < 10)) - { - noticeICReaderErrorTime = QDateTime::currentDateTime().toTime_t(); - if(queryReadRFID_address() == 2) - { - faultyNum++; - if(faultyNum >= 10){ - emit sig_showMsg(tr("13.读卡器故障!")); - qDebug()<<"读卡器故障"; - } - } - else - faultyNum = 0; - } +#include "rfidfunction.h" +#include "rfidmanager.h" + +#include +#include +#include +#include +#include +//#include "runtimectrl.h" + +constexpr char* SUPER_CARD_ID = "397F4A8E5B9F6CA07D395B28E4A6"; + +RFIDManager::RFIDManager() +{ + comForRFID_init(); +} + +void RFIDManager::CheckSumOut(UCHAR *buf, UCHAR len) +{ + UCHAR i; + UCHAR checksum; + checksum = 0; + if (len == 0) + return; + + for (i = 0; i < (len - 1); i++) + { + checksum ^= buf[i]; + } + buf[len - 1] = (UCHAR)~checksum; +} + +bool RFIDManager::CheckSumIn(UCHAR *buf, UCHAR len) +{ + UCHAR i; + UCHAR checksum; + checksum = 0; + if (len == 0) return false; + for (i = 0; i < (len - 1); i++) + { + checksum ^= buf[i]; + } + if (buf[len - 1] == (UCHAR)~checksum) + { + return true; + } + return false; +} + +void RFIDManager::MySleep(unsigned int msec, int expSize) +{ +// QTime dieTime = QTime::currentTime().addMSecs(msec); +// while( QTime::currentTime() < dieTime ) { +// QCoreApplication::processEvents(QEventLoop::AllEvents, 100); +// } + +// QByteArray recResponse; + RFIDReadData.clear(); + QElapsedTimer elapsedTimer; + elapsedTimer.start(); + while (!elapsedTimer.hasExpired(msec)) { + if (RFIDReadData.size() >= expSize) { +// recResponse = comForRFID->read(8); + break; + } + QCoreApplication::processEvents(QEventLoop::AllEvents, 10); + } +} + +void RFIDManager::Hex2Str(const UCHAR *sSrc, UCHAR *sDest, int nSrcLen) +{ + int i; + char szTmp[3]; + for (i = 0; i < nSrcLen; i++) + { + sprintf(szTmp, "%02X", (unsigned char)sSrc[i]); + memcpy(&sDest[i * 2], szTmp, 2); + } + sDest[nSrcLen * 2] = '\0'; + return; +} + +void RFIDManager::HexStrToByte(const UCHAR *source, UCHAR *dest, int sourceLen) +{ + short i; + unsigned char highByte, lowByte; + + for (i = 0; i < sourceLen; i += 2) + { + highByte = toupper(source[i]); + lowByte = toupper(source[i + 1]); + + if (highByte > 0x39) + highByte -= 0x37; + else + highByte -= 0x30; + + if (lowByte > 0x39) + lowByte -= 0x37; + else + lowByte -= 0x30; + + dest[i / 2] = (highByte << 4) | lowByte; + } + return; +} + + +void RFIDManager::comForRFID_init() +{ + if (comForRFID) { + delete comForRFID; + comForRFID = nullptr; + } + + checkCardIntervalTime = 0; + setICReaderModeFlag = false; + + comForRFID = new QSerialPort(); + +#ifdef ARCH_AARCH64 + comForRFID->setPortName("/dev/ttyAS1"); +#else + comForRFID->setPortName("/dev/ttyUSB0"); +#endif + + qDebug() << "RFID serial port name: " << comForRFID->portName(); + + comForRFID->setBaudRate(9600); + comForRFID->setDataBits(QSerialPort::Data8); + comForRFID->setParity(QSerialPort::NoParity); + comForRFID->setStopBits(QSerialPort::OneStop); + comForRFID->setFlowControl(QSerialPort::NoFlowControl); + if (comForRFID->open(QIODevice::ReadWrite)) { + qDebug() << "RFID串口打开成功"; + connect(comForRFID,SIGNAL(readyRead()),this,SLOT(slt_readRFIDData())); + } else { + qDebug() << "RFID串口打开失败:" << comForRFID->errorString(); + delete comForRFID; + comForRFID = nullptr; + return; + } + + initTimer(); +} + +int RFIDManager::comReadRFID_data() +{ + UCHAR Cmd[23] = { 0x01, 0x17, 0xA4, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + UCHAR revdata[100]; + Cmd[1] = 0x08; + Cmd[2] = 0xA3; + Cmd[4] = 0x06; //读块6 + CheckSumOut(Cmd, Cmd[1]); + QByteArray temp; + QByteArray recResponse; + temp.append((const char*)Cmd,Cmd[1]); + if(comForRFID->isOpen()) + { + LogInfo::setRunStatusText(tr("readB6Req")); + comForRFID->clear(QSerialPort::Input); + comForRFID->write(temp); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + + MySleep(2000, 0x16); + + int n = RFIDReadData.size(); + if(n < 0x16) + { + LogInfo::setRunStatusText("RFID invalied data"); + return 0; + } + + n = std::max(0x16, n); + + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + memcpy(revdata, recResponse.data(), n); + if ((revdata[0] == 0x01) && ((revdata[1] == 8) + || (revdata[1] == 22)) && (revdata[1] == n) + && (revdata[2] == 0xA3) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 + { + LogInfo::setRunStatusText(tr("readB6suc")); + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status) + { + if (revdata[4] == 0x00) //读数据块成功 + { + UCHAR blockdata[16]; + UCHAR temp[33]; + for (int i = 0; i < 16; i++) + { + blockdata[i] = revdata[5 + i]; //复制数据到数组 + } + Hex2Str(&blockdata[0], &temp[0], 16); // 数据块数据转换为字符 + + strRevdata = QString((const char*)temp); + // qDebug() << "读数据块成功,数据块6" << "数据为:" << temp << endl << endl; + return 1; + } + } + } + return 0; +} + +QByteArray RFIDManager::buildMarkCardCommand(int block, int cardType, const QString& originalCardData) +{ + UCHAR Cmd[23] = { 0x01, 0x17, 0xA4, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + Cmd[1] = 0x17; + Cmd[2] = 0x5B; + Cmd[4] = block; //读块6 + + // 超级IC卡:数据以397F4A8E5B9F6CA07D395B28E4A6结尾,直接原样写回数据 + bool isSuperCard = !originalCardData.isEmpty() + && originalCardData.endsWith(SUPER_CARD_ID); + + if (isSuperCard) { + // 超级IC卡:将原始数据原样写回,不写入使用时间 + QByteArray hexData = originalCardData.toLatin1(); + UCHAR dataBytes[16] = {0}; + HexStrToByte((const UCHAR*)hexData.constData(), dataBytes, hexData.size()); + for (int i = 0; i < 16; i++) { + Cmd[i + 6] = dataBytes[i]; + } + LogInfo::setRunStatusText(tr("Super IC card, write back original data")); + qDebug() << "Super IC card detected, writing back original data:" << originalCardData; + } else { + //save current date and time + QDateTime curDateTime = QDateTime::currentDateTime(); + QString str = curDateTime.toString("yy:MM:dd:hh:mm:ss"); + QList list = str.split(":"); + for(int i = 0;i < list.size();i++){ + Cmd[i+6] = list.at(i).toInt(); + LogInfo::setRunStatusText(tr("Cmd[%1]: %2").arg(i+6).arg(Cmd[i+6])); + qDebug()<<"Cmd["<bytesAvailable(); + // if(n < 8) { + // qDebug() << "读取数据失败, 数据长度不足8字节" << endl << endl; + // return false; + // } + + UCHAR revdata[100]; + int n = recResponse.size(); + if (n > sizeof(revdata)) return false; + memcpy(revdata, recResponse.constData(), n); + + if ((revdata[0] == 0x01) && (revdata[1] == 8) + && (revdata[1] == n) && (revdata[2] == 0x5B) + && (revdata[3] == 0x20)) //判断是否为写数据返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status && revdata[4] == 0x00) + { + //写数据块成功 + qDebug() << notice << "成功!" << endl << endl; + LogInfo::setRunStatusText(notice+"成功!"); + return true; + } + } + + qDebug() << notice << "失败!" << endl << endl; + LogInfo::setRunStatusText(notice+"失败!"); + return false; +} + +RFIDManager *RFIDManager::instance() +{ + static RFIDManager* ins = nullptr; + if(ins == nullptr) { + ins = new RFIDManager(); + } + + return ins; +} + +int RFIDManager::RFIDmarkCardUsedAsync(int type, const QString& cardData) +{ + if (!comForRFID || !comForRFID->isOpen()) { + qDebug()<<"read uart for RFID not open!"; + return -1; + } + + // 对于超级卡,执行余额减一操作 + bool isSuperCard = !cardData.isEmpty() + && cardData.endsWith(SUPER_CARD_ID); + if(isSuperCard) { + MySleep(200); + int ret = superCardDeduct(); + if(ret < 0) { + qDebug() << "超级卡余额减一失败"; + return ret; + } + + LogInfo::setRunStatusText("Super card remain: "+QString::number(ret)); + + return ret; + } + + // 构建命令(不硬编码块号) 读块6 + QByteArray cmd = buildMarkCardCommand(0x06, type, cardData); + if (cmd.isEmpty()) { + qDebug() << "命令构建失败"; + return -1; + } + + // 临时断开信号,避免干扰 + bool wasConnected = comForRFID->disconnect(this); + wasConnected = true; + + // 清空缓冲区 + comForRFID->clear(QSerialPort::Input); + comForRFID->clear(QSerialPort::Output); + + // 发送命令 + qint64 written = comForRFID->write(cmd); + if (written != cmd.size()) { + qCritical() << "发送数据失败,发送字节数:" << written << "预期:" << cmd.size(); + if (wasConnected) { + connect(comForRFID, &QSerialPort::readyRead, + this, &RFIDManager::slt_readRFIDData); + } + return -1; + } + + QByteArray recResponse; + QElapsedTimer elapsedTimer; + elapsedTimer.start(); + while (!elapsedTimer.hasExpired(2000)) { + if (comForRFID->bytesAvailable() >= 8) { + recResponse = comForRFID->read(8); + break; + } + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } + + // 恢复信号连接 + if (wasConnected) { + connect(comForRFID, &QSerialPort::readyRead, + this, &RFIDManager::slt_readRFIDData); + } + + bool res = verifyWriteResponse(recResponse, tr("写数据到数据块6")); + if (!res) { + qDebug() << "响应验证失败"; + return -1; + } + qDebug() << "卡片标记成功,块:" << 06 << "耗时:" << elapsedTimer.elapsed() << "ms"; + return 0; +} + +void RFIDManager::initRFIDMoudle(unsigned int addr, SysPara * sysPara) +{ + this->sysPara = sysPara; + setICReaderModeFlag = true; + setRFIDReaderWorkMode(); + setRFIDReaderKey(addr,1); + setICReaderModeFlag = false; +} + +void RFIDManager::handleCheck(unsigned int addr) +{ + if(sysPara == nullptr) return; + + // ink:100A2233445566778899AABBCCDDEEFF + if(!setICReaderModeFlag) + { + strRevdata =""; + receiveReadRFID_data(); + if(strRevdata.length() > 3) + { + if((strRevdata.left(3) == QString::number(addr).left(3)) + || strRevdata.left(32) == QString("100A")+SUPER_CARD_ID + || strRevdata.left(32) == QString("100B")+SUPER_CARD_ID) + { + if(strRevdata.at(3) == 'A') + { + bool flag = true; + if(!sysPara->status.flagOfNeedInkCard){ + flag = false; + emit sig_showMsg(tr("不需要刷墨水卡!")); + } + else if(sysPara->status.statWarn & WARN_STATUS_INK_WARN){ + flag = false; + emit sig_showMsg(tr("请先添加原厂墨水再刷墨水卡!")); + } + +#ifdef __RFID_IND + if(flag){ + sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,2); + sysPara->devOp->strRevdata =""; + if(sysPara->devOp->readIndBlock()){ + if(sysPara->devOp->strRevdata.left(3) == QString::number(ui->tabPrintSetting->dlgInputAddr->jd.addr).left(3)){ + if(sysPara->devOp->strRevdata.at(3) == 'C'){ + if(sysPara->devOp->comWriteRFID_data(2) == 1)//把卡数据清零 + { + // sysPara->RFIDPara.InkRFIDCnt = 0; + // sysPara->RFIDPara.PrintInkDots = 0; + // sysPara->saveRFIDPara(); + // sysPara->devOp->checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); + } + } + } + } + else{ + flag = false; + LogInfo::setRunStatusText(tr("Read India Ink Block data failure.")); + } + sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,1); + } +#endif + if(flag){ + auto ret = RFIDmarkCardUsedAsync(1, strRevdata); + if(ret >= 0 || ret == -11)//把卡数据清零或原样写回 + { + sysPara->RFIDPara.InkRFIDCnt = 0; + sysPara->RFIDPara.PrintInkDots = 0; + sysPara->saveRFIDPara(); + sysPara->para.RFIDInkWarn = false; + sysPara->para.inkWarnDate = 0; + sysPara->para.inkWarnTime = 0; + sysPara->status.flagOfInkMaxDot = false; + sysPara->status.flagOfNeedInkCard = false; + checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); + emit sig_showMsg(tr("刷墨水卡成功!")); + sysPara->saveParaToFile(); + } + else if(ret == -10) { + emit sig_showMsg(tr("刷超级墨水卡失败,请联系厂商。")); + } + } + } + else if(strRevdata.at(3) == 'B') + { + bool flag = true; + if(!sysPara->status.flagOfNeedSolventCard){ + flag = false; + emit sig_showMsg(tr("不需要刷溶剂卡!")); + } + else if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN){ + flag = false; + emit sig_showMsg(tr("请先添加原厂溶剂再刷溶剂卡!")); + } + +#ifdef __RFID_IND + if(flag){ + sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,2); + sysPara->devOp->strRevdata =""; + if(sysPara->devOp->readIndBlock()){ + if(sysPara->devOp->strRevdata.left(3) == QString::number(ui->tabPrintSetting->dlgInputAddr->jd.addr).left(3)){ + if(sysPara->devOp->strRevdata.at(3) == 'D'){ + if(sysPara->devOp->comWriteRFID_data(2) == 1)//把卡数据清零 + { + // sysPara->RFIDPara.InkRFIDCnt = 0; + // sysPara->RFIDPara.PrintInkDots = 0; + // sysPara->saveRFIDPara(); + // sysPara->devOp->checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); + } + } + } + } + else{ + flag = false; + LogInfo::setRunStatusText(tr("Read India solvent Block data failure.")); + } + sysPara->devOp->setRFIDReaderKey(ui->tabPrintSetting->dlgInputAddr->jd.addr,1); + } +#endif + if(flag){ + auto ret = RFIDmarkCardUsedAsync(1, strRevdata); + if(ret >= 0 || ret == -11)//把卡数据清零或原样写回 + { + sysPara->RFIDPara.SOLVRFIDCnt = 0; + sysPara->RFIDPara.solventNumber = 0; + sysPara->saveRFIDPara(); + sysPara->para.RFIDSolventWarn = 0; + sysPara->para.solventWarnDate = 0; + sysPara->para.solventWarnTime = 0; + sysPara->para.RFIDSolventWarnMixCnt = 0; + sysPara->status.flagOfSolventMaxNum = false; + sysPara->status.flagOfNeedSolventCard = false; + checkCardIntervalTime = QDateTime::currentDateTime().toTime_t(); + emit sig_showMsg(tr("刷溶剂卡成功!")); + sysPara->saveParaToFile(); + } + else if(ret == -10) { + emit sig_showMsg(tr("刷超级溶剂卡失败,请联系厂商。")); + } + } + } + else + { + emit sig_showMsg(tr("MAC无效卡!")); + } + } + else + { +// LogInfo::setRunStatusText(tr("card data: %1").arg(sysPara->devOp->strRevdata)); + QString str1 = QString::number(strRevdata.mid(0,2).toInt(0,16)).rightJustified(2,'0'); + QString str2 =QString::number(strRevdata.mid(2,2).toInt(0,16)).rightJustified(2,'0'); + QString str3 = QString::number(strRevdata.mid(4,2).toInt(0,16)).rightJustified(2,'0'); + QString str4 = QString::number(strRevdata.mid(6,2).toInt(0,16)).rightJustified(2,'0'); + QString str5 = QString::number(strRevdata.mid(8,2).toInt(0,16)).rightJustified(2,'0'); + QString str6 =QString::number( strRevdata.mid(10,2).toInt(0,16)).rightJustified(2,'0'); + QString strDateTime = str1 + "-" + str2 + "-" + str3 + " " + str4 + ":" + str5 + ":" + str6; + QString strShow = tr("无效卡,这张卡已经在%1时使用过").arg(strDateTime); + emit sig_showMsg(strShow); + } + } + } +} + +void RFIDManager::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + +int RFIDManager::setRFIDCarKey() +{ + UCHAR revdata[100]; + UCHAR Cmd[8] ; + Cmd[0] = 0x01; //命令格式请核对协议手册充值章节 + Cmd[1] = 0x08; + Cmd[2] = 0xA5; //加密扇区 + Cmd[3] = 0x20; + Cmd[4] = 0x07; //块7 + Cmd[5] = 0x01; + Cmd[6] = 0x00; + Cmd[7] = 0x00; + + CheckSumOut(Cmd, Cmd[1]); + QByteArray temp; + QByteArray recResponse; + temp.append((const char*)Cmd,Cmd[1]); + if(comForRFID->isOpen()) + { + comForRFID->clear(QSerialPort::Input); + comForRFID->write(temp); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + + MySleep(2000); + + int n = RFIDReadData.size(); + if(n>2) + { + recResponse = RFIDReadData; + RFIDReadData.clear(); + QString str; + str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); + qDebug()<<"加密IC卡: "< sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + memcpy(revdata, recResponse.data(), n); + if ((revdata[0] == 0x01) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xA5) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status) + { + if (revdata[4] == 0x00) //成功 + { + qDebug() << "加密IC卡成功!" << endl << endl; + } + else + { + qDebug() << "加密IC卡失败!" << endl << endl; + } + } + } + else + { + qDebug() << "加密IC卡失败2!" << endl << endl; + } +} + +int RFIDManager::setRFIDReaderKey(int mac,int type) +{ + if (!comForRFID) return; + if(mac == 0) mac = 100; + QString strMac1 = QString::number(mac).mid(0,3); + strMac1 = "Vernon" + strMac1 + "Bach"; + strMac1 = strMac1.leftJustified(16,'6'); + QString strMac2 =QString::number(mac).mid(0,3); + strMac2 = "VernonBach" + strMac2; + strMac2 = strMac2.leftJustified(16,'6'); + + QByteArray password = ""; + if(type == 1) + password = RFIDFunction::createPassword((const QByteArray)strMac1.toUtf8()); + else if(type == 2) + password = RFIDFunction::createPassword((const QByteArray)strMac2.toUtf8()); + const QByteArray pw = password.mid(12,12); + + UCHAR revdata[100]; + UCHAR Cmd[21] ; + Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 + Cmd[1] = 0x15; + Cmd[2] = 0xC3; //设置密钥 + Cmd[3] = 0x20; + + Cmd[4] = 0x99; + Cmd[5] = 0x88; + Cmd[6] = 0x77; + Cmd[7] = 0x66; + Cmd[8] = 0x55; + Cmd[9] = 0x44; + + Cmd[10] = 0xFF; + Cmd[11] = 0x07; + Cmd[12] = 0x80; + Cmd[13] = 0x69; + Cmd[14] = 0xAA; + Cmd[15] = 0xBB; + Cmd[16] = 0xCC; + Cmd[17] = 0xDD; + Cmd[18] = 0xEE; + Cmd[19] = 0xFF; + Cmd[20] = 0x1B; + +#ifndef __RFID_OLD + bool ok; + for(int i = 0;i<6;i++){ + int pwInt = Cmd[i+14] = pw.mid(i*2,2).toInt(&ok,16); + if (!ok) { + qDebug() << "Error: Invalid hex value: "<isOpen()) + { + comForRFID->clear(QSerialPort::Input); + RFIDReadData.clear(); + comForRFID->write(temp); + comForRFID->disconnect(this); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + + QElapsedTimer elapsedTimer; + elapsedTimer.start(); + while(!elapsedTimer.hasExpired(2000)) { + qApp->processEvents(QEventLoop::AllEvents, 100); + if(comForRFID->bytesAvailable() >= 8) { + recResponse = comForRFID->read(8); + break; + } + } + + connect(comForRFID, &QSerialPort::readyRead, this, &RFIDManager::slt_readRFIDData); + + int n = recResponse.size(); + if(n < 8) { + LogInfo::setRunStatusText(tr("设置读写器密码失败!")); + return 0; + } + + n = std::max(8, n); + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + + memcpy(revdata, recResponse.data(), n); + if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC3) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status) + { + if (revdata[4] == 0x00) //成功 + { + qDebug() << "设置读写器密码成功!" << endl << endl; + LogInfo::setRunStatusText(tr("设置读写器密码成功!")); + } + else + { + qDebug() << "设置读写器密码失败!" << endl << endl; + } + } + } + else + { + qDebug() << "设置读写器密码失败!" << endl << endl; + } + + return 0; +} + +int RFIDManager::setRFIDReaderOriginalKey(void) +{ + UCHAR revdata[100]; + UCHAR Cmd[11] ; + Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 + Cmd[1] = 0x0B; + Cmd[2] = 0xC4; //设置密钥 + Cmd[3] = 0x20; + Cmd[4] = 0xFF; + Cmd[5] = 0xFF; + Cmd[6] = 0xFF; + Cmd[7] = 0xFF; + Cmd[8] = 0xFF; + Cmd[9] = 0xFF; + Cmd[10] = 0x00; + + CheckSumOut(Cmd, Cmd[1]); + QByteArray temp; + QByteArray recResponse; + temp.append((const char*)Cmd,Cmd[1]); + if(comForRFID->isOpen()) + { + comForRFID->clear(QSerialPort::Input); + comForRFID->write(temp); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + MySleep(2000); + int n = RFIDReadData.size(); + if(n < 8) { + LogInfo::setRunStatusText(tr("设置读写器原始密码失败!")); + return 0; + } + + n = std::max(8, n); + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + + memcpy(revdata, recResponse.data(), n); + if ((revdata[0] == 0x03) &&( revdata[1] == 8 )&& (revdata[1] == n) && (revdata[2] == 0xC4) && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status) + { + if (revdata[4] == 0x00) //成功 + { + qDebug() << "设置读写器原始密码成功!" << endl << endl; + } + else + { + qDebug() << "设置读写器原始密码失败!" << endl << endl; + } + } + } + else + { + qDebug() << "设置读写器原始密码失败!" << endl << endl; + } +} + +int RFIDManager::setRFIDReaderWorkMode(void) +{ + if (!comForRFID) return; + UCHAR revdata[100]; + UCHAR Cmd[8] ; + Cmd[0] = 0x03; //命令格式请核对协议手册充值章节 + Cmd[1] = 0x08; + Cmd[2] = 0xC1; //设置工作模式 + Cmd[3] = 0x20; + Cmd[4] = 0x03; + Cmd[5] = 0x06; //读块6 + Cmd[6] = 0x00; //主动发送数据 + Cmd[7] = 0x00; + + CheckSumOut(Cmd, Cmd[1]); + QByteArray temp; + QByteArray recResponse; + temp.append((const char*)Cmd,Cmd[1]); + if(comForRFID->isOpen()) + { + comForRFID->clear(QSerialPort::Input); + RFIDReadData.clear(); + comForRFID->write(temp); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + // 延时200毫秒等待读写器返回数据,延时太小可能无法接收完整的数据包 + MySleep(2000); + int n = RFIDReadData.size(); + + if(n < 8) { + LogInfo::setRunStatusText(tr("设置读写器工作模式失败!")); + return 0; + } + + n = std::max(8, n); + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + + if(n>2) + { + recResponse = RFIDReadData; + RFIDReadData.clear(); + QString str; + str.sprintf("%d - %d - %d", recResponse.at(0),recResponse.at(1),recResponse.at(2)); + qDebug()<<"设置读写器工作模式: "< sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + memcpy(revdata, recResponse.data(), n); + if ((revdata[0] == 0x03) &&( revdata[1] == 8 ) + && (revdata[1] == n) && (revdata[2] == 0xC1) + && (revdata[3] == 0x20)) //判断是否为设置地址返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status && revdata[4] == 0x00) + { + qDebug() << "设置读写器工作模式成功!" << endl << endl; + LogInfo::setRunStatusText(tr("设置读写器工作模式成功!")); + return 1; + } + } + qDebug() << "设置读写器工作模式失败!" << endl << endl; + return 0; +} + +int RFIDManager::receiveReadRFID_data(void) +{ + UCHAR revdata[100]; + QByteArray recResponse; + int n = RFIDReadData.size(); + if(n>0) + { + recResponse = RFIDReadData; + RFIDReadData.clear(); +// showData(recResponse); + } + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + memcpy(revdata, recResponse.data(), n); + + if ((revdata[0] == 0x04) && ((revdata[1] == 8) + || (revdata[1] == 22)) && (revdata[1] == n) + && (revdata[2] == 0x03) && (revdata[3] == 0x20))//判断是否为读数据块返回的数据包 + { + bool status = CheckSumIn(revdata, revdata[1]); //计算校验和 + if (status) + { + if (revdata[4] == 0x00) //读数据块成功 + { + UCHAR blockdata[16]; + UCHAR temp[33]; + for (int i = 0; i < 16; i++) + { + blockdata[i] = revdata[5 + i]; //复制数据到数组 + } + Hex2Str(&blockdata[0], &temp[0], 16); // 数据块数据转换为字符 + strRevdata = QString((const char*)temp); + return 1; + } + else + { + return 0; + } + } + } + return 0; +} + +int RFIDManager::queryReadRFID_address(void) +{ + if (!comForRFID) return; + UCHAR Cmd[8] ; + Cmd[0] = 0x02; //命令格式请核对协议手册充值章节 + Cmd[1] = 0x08; + Cmd[2] = 0xB0; //查询读写器地址 + Cmd[3] = 0x00; + Cmd[4] = 0x00; + Cmd[5] = 0x00; + Cmd[6] = 0x00; + Cmd[7] = 0x00; + CheckSumOut(Cmd, Cmd[1]); + QByteArray temp; + + UCHAR revdata[100]; + + temp.append((const char*)Cmd,Cmd[1]); + if(comForRFID->isOpen()) + { + comForRFID->clear(QSerialPort::Input); + RFIDReadData.clear(); + comForRFID->write(temp); + } + else + { + qDebug()<<"read uart for RFID not open!"; + } + MySleep(2000); + int n = RFIDReadData.size(); + if(n < 8) { + LogInfo::setRunStatusText(tr("查询读写器地址失败")); + return 1; + } + + n = std::max(8, n); + if (n > sizeof(revdata)) { + return 0; // 防止后面拷贝越界 + } + + if (n > sizeof(revdata)) return; + memcpy(revdata, RFIDReadData.data(), n); + if(n>0) + { +// showData(RFIDReadData); + if(CheckSumIn(revdata, revdata[1]) == false){ + RFIDReadData.clear(); + return 0; + } + if(revdata[0] == 0x02 && revdata[1] == 0x08 + && revdata[2] == 0xB0 && revdata[4] == 0x00){ + RFIDReadData.clear(); + return 1; + } + } + else //没有收到数据 + return 2; + +} + +int RFIDManager::superCardDeduct() +{ + uint8_t cmd[] = {0x01, 0x0B, 0xA7, 0x20, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}; + CheckSumOut(cmd, cmd[1]); + + // 临时断开信号,避免干扰 + bool wasConnected = comForRFID->disconnect(this); + wasConnected = true; + + // 清空缓冲区 + comForRFID->clear(QSerialPort::Input); + comForRFID->clear(QSerialPort::Output); + + // 发送命令 + qint64 written = comForRFID->write((const char*)(cmd), sizeof(cmd)); + if (written != ARRAY_SIZE(cmd)) { + qCritical() << "发送数据失败,发送字节数:" << written << "预期:" << ARRAY_SIZE(cmd); + if (wasConnected) { + connect(comForRFID, &QSerialPort::readyRead, + this, &RFIDManager::slt_readRFIDData); + } + return -1; + } + + QByteArray recResponse; + QElapsedTimer elapsedTimer; + int expectSize = 0; + elapsedTimer.start(); + while (!elapsedTimer.hasExpired(2000)) { + if (comForRFID->bytesAvailable() >= 8 && recResponse.size() == 0) { + recResponse = comForRFID->read(2); + expectSize = recResponse[1] - 2; + continue; + } + + if(comForRFID->bytesAvailable() >= expectSize && recResponse.size() == 2) { + recResponse.append(comForRFID->read(expectSize)); + break; + } + + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + } + + qDebug() << "expectSize:" << expectSize + 2; + + // 恢复信号连接 + if (wasConnected) { + connect(comForRFID, &QSerialPort::readyRead, + this, &RFIDManager::slt_readRFIDData); + } + + if(recResponse.size() <= 2) { + LogInfo::setRunStatusText("Response data length error, too short."); + qWarning() << "Response data length error, too short."; + return -1; + } + + if(CheckSumIn((UCHAR*)(recResponse.data()), recResponse.at(1)) == false) { + // 校验和错误 + LogInfo::setRunStatusText("Failed to check sum"); + qWarning() << "Failed to check sum"; + return -1; + } + + qDebug() << "Super card response data size: " << recResponse.size() << "in content: " << recResponse[1]; + uint8_t recData [10] = {0}; + memccpy(recData, recResponse.data(), sizeof(uint8_t), qMin(recResponse.size(), 10)); + + int remains = 0; + + // 01 0A A7 20 00 2A 00 00 00 59 成功 + // 01 08 A7 20 01 00 00 70 失败 + if(recResponse.at(1) == 0x0A && recResponse[2] == 0xA7 && recResponse[3] == 0x20 && recResponse[4] == 0x00) { + // 成功 + // 响应数据是4字节的小端整数 + remains = recResponse[5] | (recResponse[6] << 8) | (recResponse[7] << 16) | (recResponse[8] << 24); + LogInfo::setRunStatusText(QString("Super card remaining times:%1").arg(remains)); + } else if(recResponse.at(1) == 0x08 && recResponse[2] == 0xA7 && recResponse[3] == 0x20) { + // 失败 + /* + 0x01:扣款失败 + 0x03:扣款成功,读取余额失败 + */ + if(recResponse[4] == 0x01) { + LogInfo::setRunStatusText(("Super card times not enough")); + qWarning() << "Super card times not enough"; + remains = -10; + } else if(recResponse[4] == 0x03) { + LogInfo::setRunStatusText(("Super card times deduct success, but remaining times unknown")); + qWarning() << "Super card times deduct success, but remaining times unknown"; + remains = -11; + } + } + + return remains; +} + +void RFIDManager::initTimer() +{ + if (RFIDTimer == nullptr) { + RFIDTimer = new QTimer(this); + connect(RFIDTimer, &QTimer::timeout, + this, &RFIDManager::slt_timerHandle); + RFIDTimer->start(10 * 1000); + } +} + +//bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) +//{ +// QMessageBox box(QMessageBox::Warning, tr("警告"), +// msgTxt, QMessageBox::Ok | QMessageBox::Cancel); + +// int rfidCountDown = sysPara->para.rfidCountDown; +// QTimer msgTimer; +// QString boxTxt = variableMsgTxt; +// connect(&msgTimer, &QTimer::timeout, [this, &box, &rfidCountDown, boxTxt]() { +// box.setText(boxTxt.arg(rfidCountDown)); +// box.update(); +// rfidCountDown--; +// if(rfidCountDown == 0) { +// box.accept(); +// } +// }); + +// if(sysPara->para.rfidCountDown > 0) { +// box.setText(boxTxt.arg(sysPara->para.rfidCountDown)); +// msgTimer.start(1000); +// } + +// box.exec(); + +// return box.result() == QMessageBox::Ok || box.result() == QMessageBox::Accepted; +//} + + +void RFIDManager::slt_readRFIDData() +{ + QMutexLocker locker(&m_rfidMutex); + RFIDReadData.append(comForRFID->readAll()); +} + +void RFIDManager::slt_timerHandle() +{ + static int faultyNum = 0; + static uint noticeICReaderErrorTime = QDateTime::currentDateTime().toTime_t(); + if((QDateTime::currentDateTime().toTime_t() - noticeICReaderErrorTime > 7200 + || QDateTime::currentDateTime().toTime_t() == noticeICReaderErrorTime) + || (faultyNum > 0 && faultyNum < 10)) + { + noticeICReaderErrorTime = QDateTime::currentDateTime().toTime_t(); + if(queryReadRFID_address() == 2) + { + faultyNum++; + if(faultyNum >= 10){ + emit sig_showMsg(tr("13.读卡器故障!")); + qDebug()<<"读卡器故障"; + } + } + else + faultyNum = 0; + } } \ No newline at end of file diff --git a/rfid/rfidmanager.h b/rfid/rfidmanager.h index 026b5b7..9f4649d 100644 --- a/rfid/rfidmanager.h +++ b/rfid/rfidmanager.h @@ -1,87 +1,87 @@ -#ifndef RFIDMANAGER_H -#define RFIDMANAGER_H - -#include "myinclude.h" -#include -#include -#include -#include -#include "SysPara.h" - -typedef unsigned char UCHAR; -class RFIDManager : public QObject -{ - Q_OBJECT -public: - static RFIDManager* instance(); - -public: - - /** - * @brief 向卡片写入当前日期时间,标识该卡片已被使用 - */ - int RFIDmarkCardUsedAsync(int type, const QString& cardData = QString()); - - // InkJetPrinter定时器timerHandler触发,检查刷卡状态 - // 初始化刷卡模块 - void initRFIDMoudle(unsigned int addr, SysPara * sysPara); - - // 300ms检查处理 - void handleCheck(unsigned int addr); - - void bindSysPara(SysPara *sysPara); -private: - RFIDManager(); - - // 工具类函数 - void CheckSumOut(UCHAR *buf, UCHAR len); - bool CheckSumIn(UCHAR *buf, UCHAR len); - void MySleep(unsigned int msec, int expSize = 8); - void Hex2Str(const UCHAR *sSrc, UCHAR *sDest, int nSrcLen); - void HexStrToByte(const UCHAR* source, UCHAR* dest, int sourceLen); - - // 串口 - QSerialPort *comForRFID = nullptr; - void comForRFID_init(); - int comReadRFID_data(); - - QByteArray buildMarkCardCommand(int block, int cardType, const QString& originalCardData = QString()); - bool verifyWriteResponse(const QByteArray& response, QString notice); - - int setRFIDCarKey(void); - int setRFIDReaderKey(int,int); - int setRFIDReaderOriginalKey(void); - int setRFIDReaderWorkMode(void); - int receiveReadRFID_data(void); - int queryReadRFID_address(void); - - int superCardDeduct(); - - QMutex m_rfidMutex; - QByteArray RFIDReadData; - QString strRevdata; - bool setICReaderModeFlag; - uint checkCardIntervalTime; - - QTimer* RFIDTimer = nullptr; - void initTimer(); - -// bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt); - - // vx5的系统参数没有实现单例 - SysPara *sysPara = nullptr; -signals: - void sig_showMsg(QString msg); - - void sig_maintenanceShow(); - -private slots: - //接收刷卡数据槽函数 - void slt_readRFIDData(); - - //超时处理槽函数 - void slt_timerHandle(); - -}; - +#ifndef RFIDMANAGER_H +#define RFIDMANAGER_H + +#include "myinclude.h" +#include +#include +#include +#include +#include "SysPara.h" + +typedef unsigned char UCHAR; +class RFIDManager : public QObject +{ + Q_OBJECT +public: + static RFIDManager* instance(); + +public: + + /** + * @brief 向卡片写入当前日期时间,标识该卡片已被使用 + */ + int RFIDmarkCardUsedAsync(int type, const QString& cardData = QString()); + + // InkJetPrinter定时器timerHandler触发,检查刷卡状态 + // 初始化刷卡模块 + void initRFIDMoudle(unsigned int addr, SysPara * sysPara); + + // 300ms检查处理 + void handleCheck(unsigned int addr); + + void bindSysPara(SysPara *sysPara); +private: + RFIDManager(); + + // 工具类函数 + void CheckSumOut(UCHAR *buf, UCHAR len); + bool CheckSumIn(UCHAR *buf, UCHAR len); + void MySleep(unsigned int msec, int expSize = 8); + void Hex2Str(const UCHAR *sSrc, UCHAR *sDest, int nSrcLen); + void HexStrToByte(const UCHAR* source, UCHAR* dest, int sourceLen); + + // 串口 + QSerialPort *comForRFID = nullptr; + void comForRFID_init(); + int comReadRFID_data(); + + QByteArray buildMarkCardCommand(int block, int cardType, const QString& originalCardData = QString()); + bool verifyWriteResponse(const QByteArray& response, QString notice); + + int setRFIDCarKey(void); + int setRFIDReaderKey(int,int); + int setRFIDReaderOriginalKey(void); + int setRFIDReaderWorkMode(void); + int receiveReadRFID_data(void); + int queryReadRFID_address(void); + + int superCardDeduct(); + + QMutex m_rfidMutex; + QByteArray RFIDReadData; + QString strRevdata; + bool setICReaderModeFlag; + uint checkCardIntervalTime; + + QTimer* RFIDTimer = nullptr; + void initTimer(); + +// bool cardTouchConfirm(QString msgTxt, QString variableMsgTxt); + + // vx5的系统参数没有实现单例 + SysPara *sysPara = nullptr; +signals: + void sig_showMsg(QString msg); + + void sig_maintenanceShow(); + +private slots: + //接收刷卡数据槽函数 + void slt_readRFIDData(); + + //超时处理槽函数 + void slt_timerHandle(); + +}; + #endif // RFIDMANAGER_H \ No newline at end of file diff --git a/rfid/sm3.cpp b/rfid/sm3.cpp index 13f662f..7ff542e 100644 --- a/rfid/sm3.cpp +++ b/rfid/sm3.cpp @@ -1,310 +1,310 @@ - -#include "sm3.h" -#include -#include -#ifndef GET_ULONG_BE -#define GET_ULONG_BE(n,b,i) \ -{ \ - (n) = ( (uint32_t) (b)[(i) ] << 24 ) \ - | ( (uint32_t) (b)[(i) + 1] << 16 ) \ - | ( (uint32_t) (b)[(i) + 2] << 8 ) \ - | ( (uint32_t) (b)[(i) + 3] ); \ -} -#endif - -#ifndef PUT_ULONG_BE -#define PUT_ULONG_BE(n,b,i) \ -{ \ - (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \ - (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \ - (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \ - (b)[(i) + 3] = (unsigned char) ( (n) ); \ -} -#endif - -void SM3::sm3_starts( sm3_context *ctx ) -{ - ctx->total[0] = 0; - ctx->total[1] = 0; - - ctx->state[0] = 0x7380166F; - ctx->state[1] = 0x4914B2B9; - ctx->state[2] = 0x172442D7; - ctx->state[3] = 0xDA8A0600; - ctx->state[4] = 0xA96F30BC; - ctx->state[5] = 0x163138AA; - ctx->state[6] = 0xE38DEE4D; - ctx->state[7] = 0xB0FB0E4E; - -} - -static void sm3_process( sm3_context *ctx, unsigned char data[64] ) -{ - uint32_t SS1, SS2, TT1, TT2, W[68],W1[64]; - uint32_t A, B, C, D, E, F, G, H; - uint32_t T[64]; - uint32_t Temp1,Temp2,Temp3,Temp4,Temp5; - int j; - for(j = 0; j < 16; j++) - T[j] = 0x79CC4519; - for(j =16; j < 64; j++) - T[j] = 0x7A879D8A; - - GET_ULONG_BE( W[ 0], data, 0 ); - GET_ULONG_BE( W[ 1], data, 4 ); - GET_ULONG_BE( W[ 2], data, 8 ); - GET_ULONG_BE( W[ 3], data, 12 ); - GET_ULONG_BE( W[ 4], data, 16 ); - GET_ULONG_BE( W[ 5], data, 20 ); - GET_ULONG_BE( W[ 6], data, 24 ); - GET_ULONG_BE( W[ 7], data, 28 ); - GET_ULONG_BE( W[ 8], data, 32 ); - GET_ULONG_BE( W[ 9], data, 36 ); - GET_ULONG_BE( W[10], data, 40 ); - GET_ULONG_BE( W[11], data, 44 ); - GET_ULONG_BE( W[12], data, 48 ); - GET_ULONG_BE( W[13], data, 52 ); - GET_ULONG_BE( W[14], data, 56 ); - GET_ULONG_BE( W[15], data, 60 ); - -#define FF0(x,y,z) ( (x) ^ (y) ^ (z)) -#define FF1(x,y,z) (((x) & (y)) | ( (x) & (z)) | ( (y) & (z))) - -#define GG0(x,y,z) ( (x) ^ (y) ^ (z)) -#define GG1(x,y,z) (((x) & (y)) | ( (~(x)) & (z)) ) - - -#define SHL(x,n) (((x) & 0xFFFFFFFF) << n) -#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n))) - -#define P0(x) ((x) ^ ROTL((x),9) ^ ROTL((x),17)) -#define P1(x) ((x) ^ ROTL((x),15) ^ ROTL((x),23)) - - for(j = 16; j < 68; j++ ) - { - //W[j] = P1( W[j-16] ^ W[j-9] ^ ROTL(W[j-3],15)) ^ ROTL(W[j - 13],7 ) ^ W[j-6]; - //Why thd release's result is different with the debug's ? - //Below is okay. Interesting, Perhaps VC6 has a bug of Optimizaiton. - - Temp1 = W[j-16] ^ W[j-9]; - Temp2 = ROTL(W[j-3],15); - Temp3 = Temp1 ^ Temp2; - Temp4 = P1(Temp3); - Temp5 = ROTL(W[j - 13],7 ) ^ W[j-6]; - W[j] = Temp4 ^ Temp5; - } - - - for(j = 0; j < 64; j++) - { - W1[j] = W[j] ^ W[j+4]; - } - - - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; - E = ctx->state[4]; - F = ctx->state[5]; - G = ctx->state[6]; - H = ctx->state[7]; - - for(j =0; j < 16; j++) - { - SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7); - SS2 = SS1 ^ ROTL(A,12); - TT1 = FF0(A,B,C) + D + SS2 + W1[j]; - TT2 = GG0(E,F,G) + H + SS1 + W[j]; - D = C; - C = ROTL(B,9); - B = A; - A = TT1; - H = G; - G = ROTL(F,19); - F = E; - E = P0(TT2); - } - - for(j =16; j < 64; j++) - { - SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7); - SS2 = SS1 ^ ROTL(A,12); - TT1 = FF1(A,B,C) + D + SS2 + W1[j]; - TT2 = GG1(E,F,G) + H + SS1 + W[j]; - D = C; - C = ROTL(B,9); - B = A; - A = TT1; - H = G; - G = ROTL(F,19); - F = E; - E = P0(TT2); - } - - ctx->state[0] ^= A; - ctx->state[1] ^= B; - ctx->state[2] ^= C; - ctx->state[3] ^= D; - ctx->state[4] ^= E; - ctx->state[5] ^= F; - ctx->state[6] ^= G; - ctx->state[7] ^= H; - -} - - -void SM3::sm3_update( sm3_context *ctx, unsigned char *input, int ilen ) -{ - int fill; - uint32_t left; - - if( ilen <= 0 ) - return; - - left = ctx->total[0] & 0x3F; - fill = 64 - left; - - ctx->total[0] += ilen; - ctx->total[0] &= 0xFFFFFFFF; - - if( ctx->total[0] < (uint32_t) ilen ) - ctx->total[1]++; - - if( left && ilen >= fill ) - { - memcpy( (void *) (ctx->buffer + left), - (void *) input, fill ); - sm3_process( ctx, ctx->buffer ); - input += fill; - ilen -= fill; - left = 0; - } - - while( ilen >= 64 ) - { - sm3_process( ctx, input ); - input += 64; - ilen -= 64; - } - - if( ilen > 0 ) - { - memcpy( (void *) (ctx->buffer + left), - (void *) input, ilen ); - } -} - -static const unsigned char sm3_padding[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -void SM3::sm3_finish( sm3_context *ctx, unsigned char output[32] ) -{ - uint32_t last, padn; - uint32_t high, low; - unsigned char msglen[8]; - - high = ( ctx->total[0] >> 29 ) - | ( ctx->total[1] << 3 ); - low = ( ctx->total[0] << 3 ); - - PUT_ULONG_BE( high, msglen, 0 ); - PUT_ULONG_BE( low, msglen, 4 ); - - last = ctx->total[0] & 0x3F; - padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); - - sm3_update( ctx, (unsigned char *) sm3_padding, padn ); - sm3_update( ctx, msglen, 8 ); - - PUT_ULONG_BE( ctx->state[0], output, 0 ); - PUT_ULONG_BE( ctx->state[1], output, 4 ); - PUT_ULONG_BE( ctx->state[2], output, 8 ); - PUT_ULONG_BE( ctx->state[3], output, 12 ); - PUT_ULONG_BE( ctx->state[4], output, 16 ); - PUT_ULONG_BE( ctx->state[5], output, 20 ); - PUT_ULONG_BE( ctx->state[6], output, 24 ); - PUT_ULONG_BE( ctx->state[7], output, 28 ); -} - -void SM3::sm3Hash( unsigned char *input, int ilen, - unsigned char output[32] ) -{ - sm3_context ctx; - - sm3_starts( &ctx ); - sm3_update( &ctx, input, ilen ); - sm3_finish( &ctx, output ); - - memset( &ctx, 0, sizeof( sm3_context ) ); -} - -void SM3::sm3_hmac_starts( sm3_context *ctx, unsigned char *key, int keylen ) -{ - int i; - unsigned char sum[32]; - - if( keylen > 64 ) - { - sm3Hash( key, keylen, sum ); - keylen = 32; - key = sum; - } - - memset( ctx->ipad, 0x36, 64 ); - memset( ctx->opad, 0x5C, 64 ); - - for( i = 0; i < keylen; i++ ) - { - ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] ); - ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] ); - } - - sm3_starts( ctx); - sm3_update( ctx, ctx->ipad, 64 ); - - memset( sum, 0, sizeof( sum ) ); -} - -void SM3::sm3_hmac_update( sm3_context *ctx, unsigned char *input, int ilen ) -{ - sm3_update( ctx, input, ilen ); -} - -void SM3::sm3_hmac_finish( sm3_context *ctx, unsigned char output[32] ) -{ - int hlen; - unsigned char tmpbuf[32]; - hlen = 32; - sm3_finish( ctx, tmpbuf ); - sm3_starts( ctx ); - sm3_update( ctx, ctx->opad, 64 ); - sm3_update( ctx, tmpbuf, hlen ); - sm3_finish( ctx, output ); - memset( tmpbuf, 0, sizeof( tmpbuf ) ); -} - -void SM3::sm3_hmac( unsigned char *key, int keylen, - unsigned char *input, int ilen, - unsigned char output[32] ) -{ - sm3_context ctx; - - sm3_hmac_starts( &ctx, key, keylen); - sm3_hmac_update( &ctx, input, ilen ); - sm3_hmac_finish( &ctx, output ); - - memset( &ctx, 0, sizeof( sm3_context ) ); -} - - - - - - - + +#include "sm3.h" +#include +#include +#ifndef GET_ULONG_BE +#define GET_ULONG_BE(n,b,i) \ +{ \ + (n) = ( (uint32_t) (b)[(i) ] << 24 ) \ + | ( (uint32_t) (b)[(i) + 1] << 16 ) \ + | ( (uint32_t) (b)[(i) + 2] << 8 ) \ + | ( (uint32_t) (b)[(i) + 3] ); \ +} +#endif + +#ifndef PUT_ULONG_BE +#define PUT_ULONG_BE(n,b,i) \ +{ \ + (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \ + (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \ + (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \ + (b)[(i) + 3] = (unsigned char) ( (n) ); \ +} +#endif + +void SM3::sm3_starts( sm3_context *ctx ) +{ + ctx->total[0] = 0; + ctx->total[1] = 0; + + ctx->state[0] = 0x7380166F; + ctx->state[1] = 0x4914B2B9; + ctx->state[2] = 0x172442D7; + ctx->state[3] = 0xDA8A0600; + ctx->state[4] = 0xA96F30BC; + ctx->state[5] = 0x163138AA; + ctx->state[6] = 0xE38DEE4D; + ctx->state[7] = 0xB0FB0E4E; + +} + +static void sm3_process( sm3_context *ctx, unsigned char data[64] ) +{ + uint32_t SS1, SS2, TT1, TT2, W[68],W1[64]; + uint32_t A, B, C, D, E, F, G, H; + uint32_t T[64]; + uint32_t Temp1,Temp2,Temp3,Temp4,Temp5; + int j; + for(j = 0; j < 16; j++) + T[j] = 0x79CC4519; + for(j =16; j < 64; j++) + T[j] = 0x7A879D8A; + + GET_ULONG_BE( W[ 0], data, 0 ); + GET_ULONG_BE( W[ 1], data, 4 ); + GET_ULONG_BE( W[ 2], data, 8 ); + GET_ULONG_BE( W[ 3], data, 12 ); + GET_ULONG_BE( W[ 4], data, 16 ); + GET_ULONG_BE( W[ 5], data, 20 ); + GET_ULONG_BE( W[ 6], data, 24 ); + GET_ULONG_BE( W[ 7], data, 28 ); + GET_ULONG_BE( W[ 8], data, 32 ); + GET_ULONG_BE( W[ 9], data, 36 ); + GET_ULONG_BE( W[10], data, 40 ); + GET_ULONG_BE( W[11], data, 44 ); + GET_ULONG_BE( W[12], data, 48 ); + GET_ULONG_BE( W[13], data, 52 ); + GET_ULONG_BE( W[14], data, 56 ); + GET_ULONG_BE( W[15], data, 60 ); + +#define FF0(x,y,z) ( (x) ^ (y) ^ (z)) +#define FF1(x,y,z) (((x) & (y)) | ( (x) & (z)) | ( (y) & (z))) + +#define GG0(x,y,z) ( (x) ^ (y) ^ (z)) +#define GG1(x,y,z) (((x) & (y)) | ( (~(x)) & (z)) ) + + +#define SHL(x,n) (((x) & 0xFFFFFFFF) << n) +#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n))) + +#define P0(x) ((x) ^ ROTL((x),9) ^ ROTL((x),17)) +#define P1(x) ((x) ^ ROTL((x),15) ^ ROTL((x),23)) + + for(j = 16; j < 68; j++ ) + { + //W[j] = P1( W[j-16] ^ W[j-9] ^ ROTL(W[j-3],15)) ^ ROTL(W[j - 13],7 ) ^ W[j-6]; + //Why thd release's result is different with the debug's ? + //Below is okay. Interesting, Perhaps VC6 has a bug of Optimizaiton. + + Temp1 = W[j-16] ^ W[j-9]; + Temp2 = ROTL(W[j-3],15); + Temp3 = Temp1 ^ Temp2; + Temp4 = P1(Temp3); + Temp5 = ROTL(W[j - 13],7 ) ^ W[j-6]; + W[j] = Temp4 ^ Temp5; + } + + + for(j = 0; j < 64; j++) + { + W1[j] = W[j] ^ W[j+4]; + } + + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + F = ctx->state[5]; + G = ctx->state[6]; + H = ctx->state[7]; + + for(j =0; j < 16; j++) + { + SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7); + SS2 = SS1 ^ ROTL(A,12); + TT1 = FF0(A,B,C) + D + SS2 + W1[j]; + TT2 = GG0(E,F,G) + H + SS1 + W[j]; + D = C; + C = ROTL(B,9); + B = A; + A = TT1; + H = G; + G = ROTL(F,19); + F = E; + E = P0(TT2); + } + + for(j =16; j < 64; j++) + { + SS1 = ROTL((ROTL(A,12) + E + ROTL(T[j],j)), 7); + SS2 = SS1 ^ ROTL(A,12); + TT1 = FF1(A,B,C) + D + SS2 + W1[j]; + TT2 = GG1(E,F,G) + H + SS1 + W[j]; + D = C; + C = ROTL(B,9); + B = A; + A = TT1; + H = G; + G = ROTL(F,19); + F = E; + E = P0(TT2); + } + + ctx->state[0] ^= A; + ctx->state[1] ^= B; + ctx->state[2] ^= C; + ctx->state[3] ^= D; + ctx->state[4] ^= E; + ctx->state[5] ^= F; + ctx->state[6] ^= G; + ctx->state[7] ^= H; + +} + + +void SM3::sm3_update( sm3_context *ctx, unsigned char *input, int ilen ) +{ + int fill; + uint32_t left; + + if( ilen <= 0 ) + return; + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += ilen; + ctx->total[0] &= 0xFFFFFFFF; + + if( ctx->total[0] < (uint32_t) ilen ) + ctx->total[1]++; + + if( left && ilen >= fill ) + { + memcpy( (void *) (ctx->buffer + left), + (void *) input, fill ); + sm3_process( ctx, ctx->buffer ); + input += fill; + ilen -= fill; + left = 0; + } + + while( ilen >= 64 ) + { + sm3_process( ctx, input ); + input += 64; + ilen -= 64; + } + + if( ilen > 0 ) + { + memcpy( (void *) (ctx->buffer + left), + (void *) input, ilen ); + } +} + +static const unsigned char sm3_padding[64] = +{ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +void SM3::sm3_finish( sm3_context *ctx, unsigned char output[32] ) +{ + uint32_t last, padn; + uint32_t high, low; + unsigned char msglen[8]; + + high = ( ctx->total[0] >> 29 ) + | ( ctx->total[1] << 3 ); + low = ( ctx->total[0] << 3 ); + + PUT_ULONG_BE( high, msglen, 0 ); + PUT_ULONG_BE( low, msglen, 4 ); + + last = ctx->total[0] & 0x3F; + padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); + + sm3_update( ctx, (unsigned char *) sm3_padding, padn ); + sm3_update( ctx, msglen, 8 ); + + PUT_ULONG_BE( ctx->state[0], output, 0 ); + PUT_ULONG_BE( ctx->state[1], output, 4 ); + PUT_ULONG_BE( ctx->state[2], output, 8 ); + PUT_ULONG_BE( ctx->state[3], output, 12 ); + PUT_ULONG_BE( ctx->state[4], output, 16 ); + PUT_ULONG_BE( ctx->state[5], output, 20 ); + PUT_ULONG_BE( ctx->state[6], output, 24 ); + PUT_ULONG_BE( ctx->state[7], output, 28 ); +} + +void SM3::sm3Hash( unsigned char *input, int ilen, + unsigned char output[32] ) +{ + sm3_context ctx; + + sm3_starts( &ctx ); + sm3_update( &ctx, input, ilen ); + sm3_finish( &ctx, output ); + + memset( &ctx, 0, sizeof( sm3_context ) ); +} + +void SM3::sm3_hmac_starts( sm3_context *ctx, unsigned char *key, int keylen ) +{ + int i; + unsigned char sum[32]; + + if( keylen > 64 ) + { + sm3Hash( key, keylen, sum ); + keylen = 32; + key = sum; + } + + memset( ctx->ipad, 0x36, 64 ); + memset( ctx->opad, 0x5C, 64 ); + + for( i = 0; i < keylen; i++ ) + { + ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] ); + ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] ); + } + + sm3_starts( ctx); + sm3_update( ctx, ctx->ipad, 64 ); + + memset( sum, 0, sizeof( sum ) ); +} + +void SM3::sm3_hmac_update( sm3_context *ctx, unsigned char *input, int ilen ) +{ + sm3_update( ctx, input, ilen ); +} + +void SM3::sm3_hmac_finish( sm3_context *ctx, unsigned char output[32] ) +{ + int hlen; + unsigned char tmpbuf[32]; + hlen = 32; + sm3_finish( ctx, tmpbuf ); + sm3_starts( ctx ); + sm3_update( ctx, ctx->opad, 64 ); + sm3_update( ctx, tmpbuf, hlen ); + sm3_finish( ctx, output ); + memset( tmpbuf, 0, sizeof( tmpbuf ) ); +} + +void SM3::sm3_hmac( unsigned char *key, int keylen, + unsigned char *input, int ilen, + unsigned char output[32] ) +{ + sm3_context ctx; + + sm3_hmac_starts( &ctx, key, keylen); + sm3_hmac_update( &ctx, input, ilen ); + sm3_hmac_finish( &ctx, output ); + + memset( &ctx, 0, sizeof( sm3_context ) ); +} + + + + + + + diff --git a/rfid/sm3.h b/rfid/sm3.h index 934332b..3ac7802 100644 --- a/rfid/sm3.h +++ b/rfid/sm3.h @@ -1,37 +1,37 @@ - -#ifndef SM3_H -#define SM3_H -#include -#include - -typedef struct -{ - uint32_t total[2]; - uint32_t state[8]; - unsigned char buffer[64]; - - unsigned char ipad[64]; - unsigned char opad[64]; - -}sm3_context; -class SM3 -{ -public: - - - static void sm3_starts(sm3_context* ctx); - static void sm3_update(sm3_context* ctx, unsigned char* input, int ilen); - static void sm3_finish(sm3_context* ctx, unsigned char output[32]); - static void sm3Hash(unsigned char* input, int ilen, - unsigned char output[32]); - - static void sm3_hmac_starts(sm3_context* ctx, unsigned char* key, int keylen); - static void sm3_hmac_update(sm3_context* ctx, unsigned char* input, int ilen); - static void sm3_hmac_finish(sm3_context* ctx, unsigned char output[32]); - static void sm3_hmac(unsigned char* key, int keylen, - unsigned char* input, int ilen, - unsigned char output[32]); -}; - - -#endif /* sm3.h */ + +#ifndef SM3_H +#define SM3_H +#include +#include + +typedef struct +{ + uint32_t total[2]; + uint32_t state[8]; + unsigned char buffer[64]; + + unsigned char ipad[64]; + unsigned char opad[64]; + +}sm3_context; +class SM3 +{ +public: + + + static void sm3_starts(sm3_context* ctx); + static void sm3_update(sm3_context* ctx, unsigned char* input, int ilen); + static void sm3_finish(sm3_context* ctx, unsigned char output[32]); + static void sm3Hash(unsigned char* input, int ilen, + unsigned char output[32]); + + static void sm3_hmac_starts(sm3_context* ctx, unsigned char* key, int keylen); + static void sm3_hmac_update(sm3_context* ctx, unsigned char* input, int ilen); + static void sm3_hmac_finish(sm3_context* ctx, unsigned char output[32]); + static void sm3_hmac(unsigned char* key, int keylen, + unsigned char* input, int ilen, + unsigned char output[32]); +}; + + +#endif /* sm3.h */ diff --git a/rfid/sm4.cpp b/rfid/sm4.cpp index da723d4..320c957 100644 --- a/rfid/sm4.cpp +++ b/rfid/sm4.cpp @@ -1,231 +1,231 @@ - -#include "sm4.h" -#include -#include - -#ifndef GET_ULONG_BE -#define GET_ULONG_BE(n,b,i) \ -{ \ - (n) = ( (unsigned long) (b)[(i) ] << 24 ) \ - | ( (unsigned long) (b)[(i) + 1] << 16 ) \ - | ( (unsigned long) (b)[(i) + 2] << 8 ) \ - | ( (unsigned long) (b)[(i) + 3] ); \ -} -#endif - -#ifndef PUT_ULONG_BE -#define PUT_ULONG_BE(n,b,i) \ -{ \ - (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \ - (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \ - (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \ - (b)[(i) + 3] = (unsigned char) ( (n) ); \ -} -#endif - -#define SHL(x,n) (((x) & 0xFFFFFFFF) << n) -#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n))) - -#define SWAP(a,b) { unsigned long t = a; a = b; b = t; t = 0; } - -static const unsigned char SboxTable[16][16] = -{ -{0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x05}, -{0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x04,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x06,0x99}, -{0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0x0b,0x43,0xed,0xcf,0xac,0x62}, -{0xe4,0xb3,0x1c,0xa9,0xc9,0x08,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6}, -{0x47,0x07,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8}, -{0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0x0f,0x4b,0x70,0x56,0x9d,0x35}, -{0x1e,0x24,0x0e,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x01,0x21,0x78,0x87}, -{0xd4,0x00,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x02,0xe7,0xa0,0xc4,0xc8,0x9e}, -{0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1}, -{0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3}, -{0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0x0d,0x53,0x4e,0x6f}, -{0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x03,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51}, -{0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8}, -{0x0a,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0}, -{0x89,0x69,0x97,0x4a,0x0c,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x09,0xc5,0x6e,0xc6,0x84}, -{0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48} -}; - - -static const unsigned long FK[4] = {0xa3b1bac6,0x56aa3350,0x677d9197,0xb27022dc}; - -static const unsigned long CK[32] = -{ -0x00070e15,0x1c232a31,0x383f464d,0x545b6269, -0x70777e85,0x8c939aa1,0xa8afb6bd,0xc4cbd2d9, -0xe0e7eef5,0xfc030a11,0x181f262d,0x343b4249, -0x50575e65,0x6c737a81,0x888f969d,0xa4abb2b9, -0xc0c7ced5,0xdce3eaf1,0xf8ff060d,0x141b2229, -0x30373e45,0x4c535a61,0x686f767d,0x848b9299, -0xa0a7aeb5,0xbcc3cad1,0xd8dfe6ed,0xf4fb0209, -0x10171e25,0x2c333a41,0x484f565d,0x646b7279 -}; - - -static unsigned char sm4Sbox(unsigned char inch) -{ - unsigned char *pTable = (unsigned char *)SboxTable; - unsigned char retVal = (unsigned char)(pTable[inch]); - return retVal; -} - -static unsigned long sm4Lt(unsigned long ka) -{ - unsigned long bb = 0; - unsigned long c = 0; - unsigned char a[4]; - unsigned char b[4]; - PUT_ULONG_BE(ka,a,0) - b[0] = sm4Sbox(a[0]); - b[1] = sm4Sbox(a[1]); - b[2] = sm4Sbox(a[2]); - b[3] = sm4Sbox(a[3]); - GET_ULONG_BE(bb,b,0) - c =bb^(ROTL(bb, 2))^(ROTL(bb, 10))^(ROTL(bb, 18))^(ROTL(bb, 24)); - return c; -} - -static unsigned long sm4F(unsigned long x0, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long rk) -{ - return (x0^sm4Lt(x1^x2^x3^rk)); -} - -static unsigned long sm4CalciRK(unsigned long ka) -{ - unsigned long bb = 0; - unsigned long rk = 0; - unsigned char a[4]; - unsigned char b[4]; - PUT_ULONG_BE(ka,a,0) - b[0] = sm4Sbox(a[0]); - b[1] = sm4Sbox(a[1]); - b[2] = sm4Sbox(a[2]); - b[3] = sm4Sbox(a[3]); - GET_ULONG_BE(bb,b,0) - rk = bb^(ROTL(bb, 13))^(ROTL(bb, 23)); - return rk; -} - -static void sm4_setkey( unsigned long SK[32], unsigned char key[16] ) -{ - unsigned long MK[4]; - unsigned long k[36]; - unsigned long i = 0; - - GET_ULONG_BE( MK[0], key, 0 ); - GET_ULONG_BE( MK[1], key, 4 ); - GET_ULONG_BE( MK[2], key, 8 ); - GET_ULONG_BE( MK[3], key, 12 ); - k[0] = MK[0]^FK[0]; - k[1] = MK[1]^FK[1]; - k[2] = MK[2]^FK[2]; - k[3] = MK[3]^FK[3]; - for(; i<32; i++) - { - k[i+4] = k[i] ^ (sm4CalciRK(k[i+1]^k[i+2]^k[i+3]^CK[i])); - SK[i] = k[i+4]; - } - -} - -static void sm4_one_round( unsigned long sk[32], - unsigned char input[16], - unsigned char output[16] ) -{ - unsigned long i = 0; - unsigned long ulbuf[36]; - - memset(ulbuf, 0, sizeof(ulbuf)); - GET_ULONG_BE( ulbuf[0], input, 0 ) - GET_ULONG_BE( ulbuf[1], input, 4 ) - GET_ULONG_BE( ulbuf[2], input, 8 ) - GET_ULONG_BE( ulbuf[3], input, 12 ) - while(i<32) - { - ulbuf[i+4] = sm4F(ulbuf[i], ulbuf[i+1], ulbuf[i+2], ulbuf[i+3], sk[i]); - i++; - } - PUT_ULONG_BE(ulbuf[35],output,0); - PUT_ULONG_BE(ulbuf[34],output,4); - PUT_ULONG_BE(ulbuf[33],output,8); - PUT_ULONG_BE(ulbuf[32],output,12); -} - -void SM4::sm4_setkey_enc( sm4_context *ctx, unsigned char key[16] ) -{ - ctx->mode = SM4_ENCRYPT; - sm4_setkey( ctx->sk, key ); -} - -void SM4::sm4_setkey_dec( sm4_context *ctx, unsigned char key[16] ) -{ - int i; - ctx->mode = SM4_ENCRYPT; - sm4_setkey( ctx->sk, key ); - for( i = 0; i < 16; i ++ ) - { - SWAP( ctx->sk[ i ], ctx->sk[ 31-i] ); - } -} - -void SM4::sm4_crypt_ecb( sm4_context *ctx, - int mode, - int length, - unsigned char *input, - unsigned char *output) -{ - while( length > 0 ) - { - sm4_one_round( ctx->sk, input, output ); - input += 16; - output += 16; - length -= 16; - } - -} - -void SM4::sm4_crypt_cbc( sm4_context *ctx, - int mode, - int length, - unsigned char iv[16], - unsigned char *input, - unsigned char *output ) -{ - int i; - unsigned char temp[16]; - - if( mode == SM4_ENCRYPT ) - { - while( length > 0 ) - { - for( i = 0; i < 16; i++ ) - output[i] = (unsigned char)( input[i] ^ iv[i] ); - - sm4_one_round( ctx->sk, output, output ); - memcpy( iv, output, 16 ); - - input += 16; - output += 16; - length -= 16; - } - } - else /* SM4_DECRYPT */ - { - while( length > 0 ) - { - memcpy( temp, input, 16 ); - sm4_one_round( ctx->sk, input, output ); - - for( i = 0; i < 16; i++ ) - output[i] = (unsigned char)( output[i] ^ iv[i] ); - - memcpy( iv, temp, 16 ); - - input += 16; - output += 16; - length -= 16; - } - } -} + +#include "sm4.h" +#include +#include + +#ifndef GET_ULONG_BE +#define GET_ULONG_BE(n,b,i) \ +{ \ + (n) = ( (unsigned long) (b)[(i) ] << 24 ) \ + | ( (unsigned long) (b)[(i) + 1] << 16 ) \ + | ( (unsigned long) (b)[(i) + 2] << 8 ) \ + | ( (unsigned long) (b)[(i) + 3] ); \ +} +#endif + +#ifndef PUT_ULONG_BE +#define PUT_ULONG_BE(n,b,i) \ +{ \ + (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \ + (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \ + (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \ + (b)[(i) + 3] = (unsigned char) ( (n) ); \ +} +#endif + +#define SHL(x,n) (((x) & 0xFFFFFFFF) << n) +#define ROTL(x,n) (SHL((x),n) | ((x) >> (32 - n))) + +#define SWAP(a,b) { unsigned long t = a; a = b; b = t; t = 0; } + +static const unsigned char SboxTable[16][16] = +{ +{0xd6,0x90,0xe9,0xfe,0xcc,0xe1,0x3d,0xb7,0x16,0xb6,0x14,0xc2,0x28,0xfb,0x2c,0x05}, +{0x2b,0x67,0x9a,0x76,0x2a,0xbe,0x04,0xc3,0xaa,0x44,0x13,0x26,0x49,0x86,0x06,0x99}, +{0x9c,0x42,0x50,0xf4,0x91,0xef,0x98,0x7a,0x33,0x54,0x0b,0x43,0xed,0xcf,0xac,0x62}, +{0xe4,0xb3,0x1c,0xa9,0xc9,0x08,0xe8,0x95,0x80,0xdf,0x94,0xfa,0x75,0x8f,0x3f,0xa6}, +{0x47,0x07,0xa7,0xfc,0xf3,0x73,0x17,0xba,0x83,0x59,0x3c,0x19,0xe6,0x85,0x4f,0xa8}, +{0x68,0x6b,0x81,0xb2,0x71,0x64,0xda,0x8b,0xf8,0xeb,0x0f,0x4b,0x70,0x56,0x9d,0x35}, +{0x1e,0x24,0x0e,0x5e,0x63,0x58,0xd1,0xa2,0x25,0x22,0x7c,0x3b,0x01,0x21,0x78,0x87}, +{0xd4,0x00,0x46,0x57,0x9f,0xd3,0x27,0x52,0x4c,0x36,0x02,0xe7,0xa0,0xc4,0xc8,0x9e}, +{0xea,0xbf,0x8a,0xd2,0x40,0xc7,0x38,0xb5,0xa3,0xf7,0xf2,0xce,0xf9,0x61,0x15,0xa1}, +{0xe0,0xae,0x5d,0xa4,0x9b,0x34,0x1a,0x55,0xad,0x93,0x32,0x30,0xf5,0x8c,0xb1,0xe3}, +{0x1d,0xf6,0xe2,0x2e,0x82,0x66,0xca,0x60,0xc0,0x29,0x23,0xab,0x0d,0x53,0x4e,0x6f}, +{0xd5,0xdb,0x37,0x45,0xde,0xfd,0x8e,0x2f,0x03,0xff,0x6a,0x72,0x6d,0x6c,0x5b,0x51}, +{0x8d,0x1b,0xaf,0x92,0xbb,0xdd,0xbc,0x7f,0x11,0xd9,0x5c,0x41,0x1f,0x10,0x5a,0xd8}, +{0x0a,0xc1,0x31,0x88,0xa5,0xcd,0x7b,0xbd,0x2d,0x74,0xd0,0x12,0xb8,0xe5,0xb4,0xb0}, +{0x89,0x69,0x97,0x4a,0x0c,0x96,0x77,0x7e,0x65,0xb9,0xf1,0x09,0xc5,0x6e,0xc6,0x84}, +{0x18,0xf0,0x7d,0xec,0x3a,0xdc,0x4d,0x20,0x79,0xee,0x5f,0x3e,0xd7,0xcb,0x39,0x48} +}; + + +static const unsigned long FK[4] = {0xa3b1bac6,0x56aa3350,0x677d9197,0xb27022dc}; + +static const unsigned long CK[32] = +{ +0x00070e15,0x1c232a31,0x383f464d,0x545b6269, +0x70777e85,0x8c939aa1,0xa8afb6bd,0xc4cbd2d9, +0xe0e7eef5,0xfc030a11,0x181f262d,0x343b4249, +0x50575e65,0x6c737a81,0x888f969d,0xa4abb2b9, +0xc0c7ced5,0xdce3eaf1,0xf8ff060d,0x141b2229, +0x30373e45,0x4c535a61,0x686f767d,0x848b9299, +0xa0a7aeb5,0xbcc3cad1,0xd8dfe6ed,0xf4fb0209, +0x10171e25,0x2c333a41,0x484f565d,0x646b7279 +}; + + +static unsigned char sm4Sbox(unsigned char inch) +{ + unsigned char *pTable = (unsigned char *)SboxTable; + unsigned char retVal = (unsigned char)(pTable[inch]); + return retVal; +} + +static unsigned long sm4Lt(unsigned long ka) +{ + unsigned long bb = 0; + unsigned long c = 0; + unsigned char a[4]; + unsigned char b[4]; + PUT_ULONG_BE(ka,a,0) + b[0] = sm4Sbox(a[0]); + b[1] = sm4Sbox(a[1]); + b[2] = sm4Sbox(a[2]); + b[3] = sm4Sbox(a[3]); + GET_ULONG_BE(bb,b,0) + c =bb^(ROTL(bb, 2))^(ROTL(bb, 10))^(ROTL(bb, 18))^(ROTL(bb, 24)); + return c; +} + +static unsigned long sm4F(unsigned long x0, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long rk) +{ + return (x0^sm4Lt(x1^x2^x3^rk)); +} + +static unsigned long sm4CalciRK(unsigned long ka) +{ + unsigned long bb = 0; + unsigned long rk = 0; + unsigned char a[4]; + unsigned char b[4]; + PUT_ULONG_BE(ka,a,0) + b[0] = sm4Sbox(a[0]); + b[1] = sm4Sbox(a[1]); + b[2] = sm4Sbox(a[2]); + b[3] = sm4Sbox(a[3]); + GET_ULONG_BE(bb,b,0) + rk = bb^(ROTL(bb, 13))^(ROTL(bb, 23)); + return rk; +} + +static void sm4_setkey( unsigned long SK[32], unsigned char key[16] ) +{ + unsigned long MK[4]; + unsigned long k[36]; + unsigned long i = 0; + + GET_ULONG_BE( MK[0], key, 0 ); + GET_ULONG_BE( MK[1], key, 4 ); + GET_ULONG_BE( MK[2], key, 8 ); + GET_ULONG_BE( MK[3], key, 12 ); + k[0] = MK[0]^FK[0]; + k[1] = MK[1]^FK[1]; + k[2] = MK[2]^FK[2]; + k[3] = MK[3]^FK[3]; + for(; i<32; i++) + { + k[i+4] = k[i] ^ (sm4CalciRK(k[i+1]^k[i+2]^k[i+3]^CK[i])); + SK[i] = k[i+4]; + } + +} + +static void sm4_one_round( unsigned long sk[32], + unsigned char input[16], + unsigned char output[16] ) +{ + unsigned long i = 0; + unsigned long ulbuf[36]; + + memset(ulbuf, 0, sizeof(ulbuf)); + GET_ULONG_BE( ulbuf[0], input, 0 ) + GET_ULONG_BE( ulbuf[1], input, 4 ) + GET_ULONG_BE( ulbuf[2], input, 8 ) + GET_ULONG_BE( ulbuf[3], input, 12 ) + while(i<32) + { + ulbuf[i+4] = sm4F(ulbuf[i], ulbuf[i+1], ulbuf[i+2], ulbuf[i+3], sk[i]); + i++; + } + PUT_ULONG_BE(ulbuf[35],output,0); + PUT_ULONG_BE(ulbuf[34],output,4); + PUT_ULONG_BE(ulbuf[33],output,8); + PUT_ULONG_BE(ulbuf[32],output,12); +} + +void SM4::sm4_setkey_enc( sm4_context *ctx, unsigned char key[16] ) +{ + ctx->mode = SM4_ENCRYPT; + sm4_setkey( ctx->sk, key ); +} + +void SM4::sm4_setkey_dec( sm4_context *ctx, unsigned char key[16] ) +{ + int i; + ctx->mode = SM4_ENCRYPT; + sm4_setkey( ctx->sk, key ); + for( i = 0; i < 16; i ++ ) + { + SWAP( ctx->sk[ i ], ctx->sk[ 31-i] ); + } +} + +void SM4::sm4_crypt_ecb( sm4_context *ctx, + int mode, + int length, + unsigned char *input, + unsigned char *output) +{ + while( length > 0 ) + { + sm4_one_round( ctx->sk, input, output ); + input += 16; + output += 16; + length -= 16; + } + +} + +void SM4::sm4_crypt_cbc( sm4_context *ctx, + int mode, + int length, + unsigned char iv[16], + unsigned char *input, + unsigned char *output ) +{ + int i; + unsigned char temp[16]; + + if( mode == SM4_ENCRYPT ) + { + while( length > 0 ) + { + for( i = 0; i < 16; i++ ) + output[i] = (unsigned char)( input[i] ^ iv[i] ); + + sm4_one_round( ctx->sk, output, output ); + memcpy( iv, output, 16 ); + + input += 16; + output += 16; + length -= 16; + } + } + else /* SM4_DECRYPT */ + { + while( length > 0 ) + { + memcpy( temp, input, 16 ); + sm4_one_round( ctx->sk, input, output ); + + for( i = 0; i < 16; i++ ) + output[i] = (unsigned char)( output[i] ^ iv[i] ); + + memcpy( iv, temp, 16 ); + + input += 16; + output += 16; + length -= 16; + } + } +} diff --git a/rfid/sm4.h b/rfid/sm4.h index eb0a2ef..2397417 100644 --- a/rfid/sm4.h +++ b/rfid/sm4.h @@ -1,34 +1,34 @@ -#ifndef SM4_H -#define SM4_H - -#define SM4_ENCRYPT 1 -#define SM4_DECRYPT 0 - -typedef struct -{ - int mode; - unsigned long sk[32]; -} -sm4_context; - -class SM4 -{ -public: - static void sm4_setkey_enc(sm4_context* ctx, unsigned char key[16]); - - static void sm4_setkey_dec(sm4_context* ctx, unsigned char key[16]); - - static void sm4_crypt_ecb(sm4_context* ctx, - int mode, - int length, - unsigned char* input, - unsigned char* output); - static void sm4_crypt_cbc(sm4_context* ctx, - int mode, - int length, - unsigned char iv[16], - unsigned char* input, - unsigned char* output); -}; - -#endif /* sm4.h */ +#ifndef SM4_H +#define SM4_H + +#define SM4_ENCRYPT 1 +#define SM4_DECRYPT 0 + +typedef struct +{ + int mode; + unsigned long sk[32]; +} +sm4_context; + +class SM4 +{ +public: + static void sm4_setkey_enc(sm4_context* ctx, unsigned char key[16]); + + static void sm4_setkey_dec(sm4_context* ctx, unsigned char key[16]); + + static void sm4_crypt_ecb(sm4_context* ctx, + int mode, + int length, + unsigned char* input, + unsigned char* output); + static void sm4_crypt_cbc(sm4_context* ctx, + int mode, + int length, + unsigned char iv[16], + unsigned char* input, + unsigned char* output); +}; + +#endif /* sm4.h */ diff --git a/scene/SceneEditOption.cpp b/scene/SceneEditOption.cpp index 416e088..b8fb553 100644 --- a/scene/SceneEditOption.cpp +++ b/scene/SceneEditOption.cpp @@ -1,1000 +1,1000 @@ -#include "SceneEditOption.h" -#include "pictextitem.h" -#include "ui_sceneEditOption.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "myview.h" -#include "LogInfo.h" -#include -#include -#include - -#include -#include - -MoveInput* moveInput; -SceneEditOption::SceneEditOption(QWidget *parent) : - QWidget(parent), - ui(new Ui::SceneEditOption),newScene(0) -{ - ui->setupUi(this); - editMode = SCENE; - xmlfileName = ""; - dialogFileOperation = new DialogFileOperation(0); -#ifdef MYSAVEFILEDLG - dialogSaveFile =new DialogSaveFile(0); - //connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); -#endif - m_CreateImageFlag = false; - m_pSavePicScene = new QGraphicsScene(); - m_pSavePicScene->setSceneRect(QRectF(0, 0, 3200, MAX_PRINT_ROW_NUM)); //生成图片的场景 - moveInput = new MoveInput(parent); - - pPicScene2 = new PicScene(this); //Scene Test - auto items = pPicScene2->items(); - int a =0; -} - -SceneEditOption::~SceneEditOption() -{ - if(m_pSavePicScene) - { - delete m_pSavePicScene; - } - if(moveInput) - { - delete moveInput; - } -} - -void SceneEditOption::bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText){ - this->stackedWidgetOption = stackedWidgetOption;// stackedWidgetOption - this->stackedWidgetText = stackedWidgetText; - connect(this->stackedWidgetOption,SIGNAL(currentChanged(int)),this,SLOT(onStackedWidgetOptionCurrentChanged(int))); -} - -void SceneEditOption::bindSysPara(SysPara *sysPara){ - this->sysPara = sysPara; -} -void SceneEditOption::enableButtonSave(){ - if(!ui->saveButton->isEnabled()) - ui->saveButton->setEnabled(true); -} -void SceneEditOption::onStackedWidgetOptionCurrentChanged(int index) -{ - const QString objectName=this->stackedWidgetOption->currentWidget()->objectName(); - // const QString objectName=this->stackedWidgetOption->widget(index)->objectName(); - qDebug()<<"index="<para.EditMode) - { - // qDebug()<<"显示新场景--open"; - this->pPicScene->setIsdrawBackground(true); - this->stackedWidgetOption->hide(); - // //show_scene_new_dlg(); - // foreach (QLayout *lay, listQLayout) { - // newScene->showQLayout(lay,false); - // } - newScene->Layout_ToNew(); - newScene->show(); - - // //edit@03-07 - // for(char i=((MyView*)pViewer)->getzoomRatio();i<3;i++) - // { - // on_enlargeButton_pressed(); - // } - } - else - { - // qDebug()<<"隐藏新场景--hide"; - this->pPicScene->setIsdrawBackground(false); - this->stackedWidgetOption->setVisible(true); - newScene->hide(); - newScene->Layout_ToDefault(); - // foreach (QLayout *lay, listQLayout) { - // newScene->showQLayout(lay,true); - // } - } - - } -} - -void SceneEditOption::bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit){ - this->pPicScene = pPicScene; - this->pViewer = pGraphicViewer; - this->textEdit = pTextEdit; - //connect(pPicScene,SIGNAL(xmlContentChanged ()),this,SLOT(enableButtonSave())); - connect(pPicScene,SIGNAL(selectionChanged()),this,SLOT(enableButtonSave())); - - ui->saveButton->setEnabled(false); - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - connect(dialogFileOperation,SIGNAL(createSceneImage(QString)),this,SLOT(onCreateSceneImage(QString))); -#ifdef MYSAVEFILEDLG - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); -#endif - //edit@12-06 显示网格线 - this->pPicScene->setIsdrawBackground(true); -} - -void SceneEditOption::show_scene_new_dlg() -{ - QWidget *tabMainWindow=this->parentWidget()->parentWidget(); - - if(!newScene) - { - this->stackedWidgetOption->hide(); - newScene=new FormScenedlg(tabMainWindow); - newScene->setObjectName("newScene"); - - newScene->setAutoFillBackground(true); - newScene->setPalette(tabMainWindow->palette()); - - newScene->bindScene(this->pPicScene,this->pViewer,this->textEdit); - //edit@12-07另一种信号通信 - connect(newScene,SIGNAL(delButton()),this,SLOT(on_delButton_pressed())); - connect(newScene,SIGNAL(saveButton()),this,SLOT(on_saveButton_pressed())); - connect(newScene,SIGNAL(openfileButton()),this,SLOT(on_openfileButton_pressed())); - connect(newScene,SIGNAL(previewButton()),this,SLOT(on_previewButton_pressed())); - //connect(newScene,SIGNAL(previewButton()),this,SIGNAL(previewScene())); - - connect(newScene,SIGNAL(addButton()),this,SLOT(on_addButton_pressed())); - connect(newScene,SIGNAL(EditItemButton()),this,SLOT(on_EditItemButton_pressed())); - connect(newScene,SIGNAL(saveAsButton()),this,SLOT(on_saveAsButton_pressed())); - connect(newScene,SIGNAL(newfileButton()),this,SLOT(on_newfileButton_pressed())); - connect(newScene,SIGNAL(enlargeButton()),this,SLOT(on_enlargeButton_pressed())); - connect(newScene,SIGNAL(reduceButton()),this,SLOT(on_reduceButton_pressed())); - connect(newScene,SIGNAL(ZoomOrigin()),this,SLOT(on_test_pressed())); - connect(newScene,SIGNAL(btn_test2()),this,SLOT(on_btn_test2())); - connect(this->pPicScene,SIGNAL(showTextWidthHeight()),newScene,SLOT(reset_showTextWidthHeight())); - //connect(this->pPicScene,SIGNAL(adjustItemsPos()),newScene,SLOT(adjustItemsPosFalse())); - connect(newScene,SIGNAL(insertImage(QString,bool)),this,SLOT(insertImageItem(QString,bool))); - - newScene->move(0,270); - newScene->Layout_ToNew(); - } -} - -void SceneEditOption::on_previewButton_pressed() -{ - syncAllPositions(); - this->pPicScene->setIsdrawBackground(false); - emit previewScene(); -} - - -void SceneEditOption::on_addButton_pressed() -{ - // ========== 清空编辑器内容 ========== - textEdit->clear(); - textEdit->setHtml(""); - - // ========== 场景1:添加图元(用于显示) ========== - textItem = new PicTextItem(); - QList items = pPicScene->items(); - if(!items.isEmpty()){ -// QRectF itemRect= items.last()->boundingRect(); -// textItem->setPos(items.last()->scenePos().x()+itemRect.width()+20, items.last()->scenePos().y()); - QRectF itemRect= items.first()->boundingRect(); - textItem->setPos(items.first()->scenePos().x()+itemRect.width()+20, items.first()->scenePos().y()); - } - else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 - - pPicScene->addItem(textItem); - pPicScene->clearSelection(); - textItem->setHtml(""); - textItem->setSelected(true); - - // ========== 场景2:添加图元(存储真实内容) ========== - - textItem2 = new PicTextItem(); - textItem2->setPos(textItem->pos()); - pPicScene2->addItem(textItem2); - pPicScene2->clearSelection(); - textItem2->setHtml(""); - textItem2->setSelected(true); - - - ui->saveButton->setEnabled(true); - on_EditItemButton_pressed(); -} -bool SceneEditOption::maybeSave(){ - - if (xmlfileName.startsWith(QLatin1String(":/"))) - return true; - - QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("文档已经改变,是否保存?")); - QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); - QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); - QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); - - msgBox.exec(); - - if (msgBox.clickedButton() == saveButton) { - on_saveButton_pressed(); - return false; - } else if (msgBox.clickedButton() == cancleSaveButton) { - return true; - } - else - return false; - - return true; -} - -int SceneEditOption::getSelectedIndex() -{ - QList items = pPicScene->items(); - for(int i = 0; i < items.size(); i++) { - if(items.at(i)->isSelected()) { - return i; - } - } - return -1; // 没有选中的图元 -} - -void SceneEditOption::syncAllPositions() -{ - QList items1 = pPicScene->items(); - QList items2 = pPicScene2->items(); - - int minSize = qMin(items1.size(), items2.size()); - - for (int i = 0; i < minSize; i++) { - QPointF pos1 = items1.at(i)->pos(); - QPointF pos2 = items2.at(i)->pos(); - - if (pos1 != pos2) { - items2.at(i)->setPos(pos1); - } - } - -} -void SceneEditOption::on_newfileButton_pressed() -{ - if (maybeSave()) { - pPicScene->clear(); - pViewer->viewport()->update(); - unsigned char SpecialVarEnable = 0; - sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1); - xmlfileName = ""; - QFile file(xmlfileName); - emit fileNameChanged(QFileInfo(xmlfileName).fileName()); - //Scene Test - pPicScene2->clear(); - } -#ifdef VARCOLOR - textEdit->insertHtml(QString("  ")); -#endif -} -void SceneEditOption::on_delButton_pressed() -{ - int index = getSelectedIndex(); // 获取选中图元的索引 - if (index == -1) return; - - QList items = pPicScene->items(); - if (index < items.size()) { - // 从场景1删除 - QGraphicsItem *item = items.at(index); - pPicScene->removeItem(item); - delete item; - } - - QList htmlItems = pPicScene2->items(); - if (index < htmlItems.size()) { - // 从场景2删除 - QGraphicsItem *htmlItem = htmlItems.at(index); - pPicScene->removeItem(htmlItem); - delete htmlItem; - } - - ui->saveButton->setEnabled(true); -} -void SceneEditOption::on_saveAsButton_pressed() -{ - pPicScene->clearSelection(); -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->refreshListView(editMode); - dialogSaveFile->show(); - dialogSaveFile->setEnterFileName(""); -#endif -} -void SceneEditOption::on_saveButton_pressed() -{ - pPicScene->clearSelection(); - if(xmlfileName.isEmpty()) - { - qDebug()<<"xml file null"; -#ifdef MYSAVEFILEDLG - disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); - connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); - dialogSaveFile->refreshListView(editMode); - dialogSaveFile->show(); - dialogSaveFile->setEnterFileName(""); - -#endif - } - else - { - pPicScene->update(); - saveFile(); - if(sysPara){ - sysPara->sysFile =xmlfileName; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); - } - //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); - ui->saveButton->setEnabled(false); - emit fileNameChanged(QFileInfo(xmlfileName).fileName()); - } -} - -void SceneEditOption::on_openfileButton_pressed() -{ - pPicScene->clearSelection(); - dialogFileOperation->refreshListView(editMode); - dialogFileOperation->exec(); -} - -void SceneEditOption::on_EditItemButton_pressed() -{ - // 1. 获取选中图元的索引 - int selectedIndex = getSelectedIndex(); - if (selectedIndex == -1) return; - - // 2. 获取两个场景的图元列表 - QList items = pPicScene->items(); - QList htmlItems = pPicScene2->items(); - // 3. 边界检查:确保两个场景的图元数量匹配 - if (items.size() != htmlItems.size()) { - return; - } - // 4. 检查索引是否在范围内 - if (selectedIndex >= htmlItems.size() && selectedIndex >= items.size()) { - return; - } - // 5. 获取对应的图元 - PicTextItem *pTextItem = qgraphicsitem_cast(items.at(selectedIndex)); - PicTextItem *pTextItem2 = qgraphicsitem_cast(htmlItems.at(selectedIndex)); - // 6. 执行编辑操作 - //QString htmlContent = pTextItem2->toHtml(); - // 从场景2获取HTML内容,并修复变量图片的垂直对齐 - QString htmlContent = fixVariableImagesAlignment(pTextItem2->toHtml()); - textEdit->setHtml(htmlContent); - - // 保持选中状态 - pTextItem->setSelected(true); - pTextItem2->setSelected(true); - - // 切换到textedit的界面 - emit editItemMode(); - stackedWidgetText->setCurrentIndex(0); - stackedWidgetOption->setCurrentIndex(0); - ui->saveButton->setEnabled(true); - -} - -void SceneEditOption::onEditItemDone() -{ - int selectedIndex = getSelectedIndex(); - if (selectedIndex == -1) return; - // ========== 只更新场景2的HTML内容 ========== - QList htmlItems = pPicScene2->items(); - if (selectedIndex < htmlItems.size()) { - PicTextItem *pTextItem2 = qgraphicsitem_cast(htmlItems.at(selectedIndex)); - if (pTextItem2) { - // 场景2:更新真实内容 - pTextItem2->setHtml(textEdit->toHtml()); - onSceneAccepted(pTextItem2); - } - } - // 场景1只需要更新显示,不需要存储完整HTML - QList items = pPicScene->items(); - if (selectedIndex < items.size()) { - PicTextItem *pTextItem = qgraphicsitem_cast(items.at(selectedIndex)); - if (pTextItem) { - // 场景1:只需要更新显示内容(如渲染后的图片) - // 处理图片 - //创建Item的Html对应的图片 - if (createItemImage()) { - QString html = ""; - textEdit->setHtml(html); - } - else textEdit->setHtml(""); - - if (pPicScene->items().size() > selectedIndex) { - PicTextItem * item = (PicTextItem *)pPicScene->items().at(selectedIndex); - item->setHtml(textEdit->toHtml()); - onSceneAccepted(item); - } - } - } - - stackedWidgetText->setCurrentIndex(3); - stackedWidgetOption->setCurrentIndex(1); - return; -} - -void SceneEditOption::onCreateSceneImage(QString filePath) -{ - m_CreateImageFlag = true; - m_pSavePicScene->clear(); - onFileOpen(filePath,false); - m_pSavePicScene->clearSelection(); - QSize size(m_pSavePicScene->itemsBoundingRect().width(),m_pSavePicScene->itemsBoundingRect().height()); - QImage image(size,QImage::Format_ARGB32); - image.fill(0x00ffffff);//填充白色 - QPainter painter(&image); - m_pSavePicScene->render(&painter,QRectF(),m_pSavePicScene->itemsBoundingRect()); - image.save("./printSceneView.png");//图片 - m_CreateImageFlag = false; -} - -extern QStringList stringListRecive; - -void SceneEditOption::parseVbfile(QXmlStreamReader &reader) { - // int textItemPosX; - // int textItemPosY; - // textItemPosX = picText->pos().x() - pPicScene->itemsBoundingRect().x(); - // textItemPosY = picText->pos().y() - pPicScene->itemsBoundingRect().y(); - float pos_x,pos_y; - bool Condition= false ; - int CatchStartValue = -1; - int CatchValue = -1; - while (!reader.atEnd()) { - reader.readNext(); - if (reader.isStartElement()) { // 开始元素 - QString strElementName = reader.name().toString(); - if (QString::compare(strElementName, "VBfile") == 0) { - //qDebug() << QString::fromLocal8Bit("********** 开始元素 ********** "); - } else if (QString::compare(strElementName, QString("pointer_x")) == 0) { // 方式一 - reader.readNext(); - if (reader.isCharacters()) { - pos_x = reader.text().toString().toDouble(); - //qDebug() << QString("pointer_x:%1").arg(reader.text().toString()); - } - } else if (QString::compare(strElementName, QString("pointer_y")) == 0) { // 方式二 - pos_y = reader.readElementText().toDouble(); - //qDebug() << QString("pointer_y:%1").arg(reader.readElementText()); - } - else if (QString::compare(strElementName, QString("Condition")) == 0) { - Condition = reader.readElementText().toInt() ? true : false; - } - else if (QString::compare(strElementName, QString("CatchStartValue")) == 0) { - CatchStartValue = reader.readElementText().toInt(); - } - else if (QString::compare(strElementName, QString("CatchValue")) == 0) { - CatchValue = reader.readElementText().toInt(); - } - else if (QString::compare(strElementName, QString("html_src")) == 0) { - //qDebug() << QString("html_src:%1").arg(reader.readElementText()); - } - } else if (reader.isEntityReference()) { // 实体引用 - QString strName = reader.name().toString(); - QString strText = reader.text().toString(); - //qDebug() << QString("EntityReference : %1(%2)").arg(strName).arg(strText); - } else if (reader.isCDATA()) { // CDATA - QString strCDATA = reader.text().toString(); - //qDebug() << QString("CDATA : %1").arg(strCDATA); - PicTextItem *pPictText = new PicTextItem(); - if(m_CreateImageFlag) - { - m_pSavePicScene->addItem(pPictText); - } - else - { - pPicScene->addItem(pPictText); - } - QFont font = pPictText->font(); - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - pPictText->setFont(font); - pPictText->setPos(pos_x,pos_y); - pPictText->SpecialConditions = Condition; - pPictText->CatchCnt1StartValue = CatchStartValue; - pPictText->CatchCnt1CurrValue = CatchValue; - // Condition= false ; - // CatchValue = -1; - //LogInfo::setRunStatusText(tr("接收文件解析::2")); - if(!sysPara->status.forTemplateUse || m_CreateImageFlag) - { - pPictText->setHtml(strCDATA); - } - else - { - //qDebug() << tr("接收文件解析:"); - //LogInfo::setRunStatusText(tr("接收文件解析::3")); - //stringListRecive << "aaaa" << "bbbb" << "cccc"; - if(strCDATA.contains("#1111") || strCDATA.contains("")) - { - if(stringListRecive.size() > 0) - { - if(strCDATA.contains("#1111")) - { - strCDATA.replace("#1111",stringListRecive.at(0).toStdString().c_str()); - } - else if(strCDATA.contains("")) - { - emit generateQRCode(stringListRecive.at(0)); - strCDATA.replace("modbusQR#01.bmp","modbusQR.bmp"); - } - } - - } - else if(strCDATA.contains("#2222") || strCDATA.contains("")) - { - if(stringListRecive.size() > 1) - { - if(strCDATA.contains("#2222")) - { - strCDATA.replace("#2222",stringListRecive.at(1).toStdString().c_str()); - } - else if(strCDATA.contains("")) - { - emit generateQRCode(stringListRecive.at(1)); - strCDATA.replace("modbusQR#02.bmp","modbusQR.bmp"); - } - } - } - else if(strCDATA.contains("#3333") || strCDATA.contains("")) - { - if(stringListRecive.size() > 2) - { - if(strCDATA.contains("#3333")) - { - strCDATA.replace("#3333",stringListRecive.at(2).toStdString().c_str()); - } - else if(strCDATA.contains("")) - { - emit generateQRCode(stringListRecive.at(2)); - strCDATA.replace("modbusQR#03.bmp","modbusQR.bmp"); - } - } - } - pPictText->setHtml(strCDATA); - } - // if(Condition) - // { - // SpecialVarPrint specialVarPrint; - // specialVarPrint.SpecialVarEnable = Condition; - // specialVarPrint.SpecialVarCountStart = CatchStartValue; - // specialVarPrint.SpecialVarCountEnd = CatchValue; - // specialVarPrint.SpecialVarColStart = 3 + pos_x- pPicScene->itemsBoundingRect().x(); - // specialVarPrint.SpecialVarColEnd = 3 + pos_x - pPicScene->itemsBoundingRect().x()+ pPictText->boundingRect().width(); - // specialVarPrint.SpecialVarRowStart = pos_y - pPicScene->itemsBoundingRect().y(); - // specialVarPrint.SpecialVarRowEnd = pos_y - pPicScene->itemsBoundingRect().y()+ pPictText->boundingRect().height(); - // sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&specialVarPrint,sizeof(SpecialVarPrint)); // Send specialVarPrint 2022-8-6 - // LogInfo::setRunStatusText(tr("发送特殊变量内容:")); - // LogInfo::setRunStatusText(tr("SpecialVarEnable:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarEnable))); - // LogInfo::setRunStatusText(tr("SpecialVarCountStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountStart))); - // LogInfo::setRunStatusText(tr("SpecialVarCountEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountEnd))); - // LogInfo::setRunStatusText(tr("SpecialVarColStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColStart))); - // LogInfo::setRunStatusText(tr("SpecialVarColEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColEnd))); - // LogInfo::setRunStatusText(tr("SpecialVarRowStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowStart))); - // LogInfo::setRunStatusText(tr("SpecialVarRowEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowEnd))); - // LogInfo::setRunStatusText(tr("itemsBoundingRect().y():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().y()))); - // LogInfo::setRunStatusText(tr("itemsBoundingRect().x():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().x()))); - // } - Condition= false ; - CatchValue = -1; - CatchStartValue = -1; - - reader.readNext(); - if (reader.isCharacters()) { - QString strCharacters = reader.text().toString(); - //qDebug() << QString("Characters : %1").arg(strCharacters); - } - } else if (reader.isEndElement()) { // 结束元素 - QString strElementName = reader.name().toString(); - if (QString::compare(strElementName, "Blogs") == 0) { - //qDebug() << QString::fromLocal8Bit("********** 结束元素 ********** "); - break; // 跳出循环(解析 QXmlStreamReader::EndDocument) - } else if (QString::compare(strElementName, "Blog") == 0) { - //qDebug() << QString::fromLocal8Bit("********** 结束元素 ********** "); - } - } - } -} -/* - * 和DialogFileOperation对接 - * */ -void SceneEditOption::onFileOpen(QString filePath,bool insertFlag){ - if(editMode==SCENE) { - if(filePath.endsWith(".xml")) - { - QFile file(filePath); - - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // 以只写模式打开文件 - xmlfileName=filePath; - QXmlStreamReader reader(&file); - if(!m_CreateImageFlag) - { - pPicScene->clear(); - pViewer->viewport()->update(); - unsigned char SpecialVarEnable = 0; - sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1); - } - // 解析 XML,直到结束 - while (!reader.atEnd()) { - - // 读取下一个元素 - QXmlStreamReader::TokenType nType = reader.readNext(); - - switch (nType) { - case QXmlStreamReader::StartDocument: { // 开始文档 - //qDebug() << QString::fromLocal8Bit("********** 开始文档(XML 声明) ********** "); - // XML 声明 - QString strVersion = reader.documentVersion().toString(); - QString strEncoding = reader.documentEncoding().toString(); - bool bAlone = reader.isStandaloneDocument(); - //qDebug() << QString::fromLocal8Bit("版本:%1 编码:%2 Standalone:%3") - // .arg(strVersion).arg(strEncoding).arg(bAlone) << "\r\n"; - break; - } - case QXmlStreamReader::Comment: { // 注释 - //qDebug() << QString::fromLocal8Bit("********** 注释 ********** "); - QString strComment = reader.text().toString(); - //qDebug() << strComment << "\r\n"; - break; - } - case QXmlStreamReader::ProcessingInstruction: { // 处理指令 - //qDebug() << QString::fromLocal8Bit("********** 处理指令 ********** "); - QString strProcInstr = reader.processingInstructionData().toString(); - //qDebug() << strProcInstr << "\r\n"; - break; - } - case QXmlStreamReader::DTD: { // DTD - //qDebug() << QString::fromLocal8Bit("********** DTD ********** "); - QString strDTD = reader.text().toString(); - QXmlStreamNotationDeclarations notationDeclarations = reader.notationDeclarations(); // 符号声明 - QXmlStreamEntityDeclarations entityDeclarations = reader.entityDeclarations(); // 实体声明 - // DTD 声明 - QString strDTDName = reader.dtdName().toString(); - QString strDTDPublicId = reader.dtdPublicId().toString(); // DTD 公开标识符 - QString strDTDSystemId = reader.dtdSystemId().toString(); // DTD 系统标识符 - //qDebug() << QString::fromLocal8Bit("DTD : %1").arg(strDTD); - //qDebug() << QString::fromLocal8Bit("DTD 名称 : %1").arg(strDTDName); - //qDebug() << QString::fromLocal8Bit("DTD 公开标识符 : %1").arg(strDTDPublicId); - //qDebug() << QString::fromLocal8Bit("DTD 系统标识符 : %1").arg(strDTDSystemId); - //qDebug() << "\r\n"; - - break; - } - case QXmlStreamReader::StartElement: { // 开始元素 - QString strElementName = reader.name().toString(); - if (QString::compare(strElementName, "VBfiles") == 0) { // 根元素 - //qDebug() << QString::fromLocal8Bit("********** 开始元素 ********** "); - QXmlStreamAttributes attributes = reader.attributes(); - if (attributes.hasAttribute("Version")) { - QString strVersion = attributes.value("Version").toString(); - //qDebug() << QString::fromLocal8Bit("属性:Version(%1)").arg(strVersion); - } - - parseVbfile(reader); - } - break; - } - case QXmlStreamReader::EndDocument: { // 结束文档 - //qDebug() << QString::fromLocal8Bit("********** 结束文档 ********** "); - break; - } - } - } - - if (reader.hasError()) { // 解析出错 - //qDebug() << QString::fromLocal8Bit("错误信息:%1 行号:%2 列号:%3 字符位移:%4").arg(reader.errorString()).arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.characterOffset()); - } - //qDebug()<<"open done"; - file.close(); // 关闭文件 - //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData()); - if(!m_CreateImageFlag)//生成图片显示 - { - if(sysPara) - { - sysPara->sysFile =filePath; - sysPara->loadParaFromFile(); - //qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData()); - } - - emit fileNameChanged(QFileInfo(xmlfileName).fileName()); - ui->saveButton->setEnabled(false); - QList items = pPicScene->items(); - foreach (QGraphicsItem *item, items) { - PicTextItem *picText = qgraphicsitem_cast(item); - onSceneAccepted(picText); - } - - //Scene Test - updatePicScene2Item(); - - } - - } - } - } -} -void SceneEditOption::saveFile(){ - QFile file(xmlfileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) { // 只写模式打开文件 - qDebug() << QString("Cannot write file %1(%2).").arg(xmlfileName).arg(file.errorString()); - return; - } - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); // 自动格式化 - writer.writeStartDocument("1.0", true); // 开始文档(XML 声明) - writer.writeComment(QString::fromLocal8Bit("Vernon Bach graphic scene file")); // 注释 - writer.writeDTD(QString::fromLocal8Bit(" ]>")); - writer.writeStartElement("VBfiles"); // 开始根元素 - writer.writeAttribute("Version", "1.0"); // 属性 - - QList items = pPicScene->items(); - //Scene Test pPicScene2保存的是html pPicScene保存的是图片 - QList items2 = pPicScene2->items(); - // std::cout<<"save pPicScene2 size:"<items().size()<(item); - writer.writeStartElement("VBfile"); // 开始子元素 - writer.writeTextElement(QString::fromLocal8Bit("pointer_x"), QString::fromLocal8Bit("%1").arg(picText->pos().x())); - writer.writeTextElement(QString::fromLocal8Bit("pointer_y"), QString::fromLocal8Bit("%1").arg(picText->pos().y())); - writer.writeTextElement(QString::fromLocal8Bit("Condition"), QString::fromLocal8Bit("%1").arg(picText->SpecialConditions? 1:0)); - writer.writeTextElement(QString::fromLocal8Bit("CatchStartValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1StartValue)); - writer.writeTextElement(QString::fromLocal8Bit("CatchValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1CurrValue)); - writer.writeTextElement(QString::fromLocal8Bit("html_src"), QString::fromLocal8Bit("my_src")); - - //Scene Test 内容用pPicScene2 Item的html 其他的位置信息用pPicScene Item - if(indextoHtml())); - } - index++; - - // writer.writeCDATA((picText->toHtml())); - writer.writeEndElement(); // 结束子元素 - } - writer.writeEndElement(); // 结束根元素 - writer.writeEndDocument(); // 结束文档 - fsync(file.handle()); - file.close(); // 关闭文件 -} - -void SceneEditOption::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class - qDebug()<sysFile =xmlfileName; - snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); - } - //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); - ui->saveButton->setEnabled(false); - emit fileNameChanged(QFileInfo(xmlfileName).fileName()); -} -void SceneEditOption::on_enlargeButton_pressed() -{ - ((MyView*)pViewer)->ZoomOut(); -} -void SceneEditOption::on_reduceButton_pressed() -{ - ((MyView*)pViewer)->ZoomIn(); -} - -//将系统参数中的行间距和字符间距应用到图元 -void SceneEditOption::onSceneAccepted(PicTextItem *pTextItem){ - for(QTextBlock textBlock = pTextItem->document()->begin();textBlock != pTextItem->document()->end(); textBlock = textBlock.next()){ - QTextBlockFormat textBlockFormat = textBlock.blockFormat(); - textBlockFormat.setAlignment(Qt::AlignTop); - textBlockFormat.setTopMargin(-1); - textBlockFormat.setBottomMargin(sysPara->para.textEditLineSpace-1); - QTextCursor textCursor = pTextItem->textCursor(); - textCursor.setPosition(textBlock.position()); - textCursor.setBlockFormat(textBlockFormat); - pTextItem->setTextCursor(textCursor); - } - - QFont font = pTextItem->font(); - font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); - pTextItem->setFont(font); - - sysPara->saveParaToFile(); -} - -//edit@12-10 -void SceneEditOption::on_test_pressed() -{ - const QPoint originScene=pViewer->mapFromScene(0,0); - const QRectF sceneRect=pPicScene->sceneRect(); - const QRectF BoundingRect=pPicScene->itemsBoundingRect(); - qDebug()<]*)>"); - imgRx.setMinimal(true); - int pos = 0; - - while ((pos = imgRx.indexIn(result, pos)) != -1) { - QString attr = imgRx.cap(1); - QString fullTag = imgRx.cap(0); - - // 判断是否是变量图片 - bool isVariableImg = fullTag.contains("digitalWidth") || - fullTag.contains("expiryDate") || - fullTag.contains("curDate") || - fullTag.contains("class") || - fullTag.contains(":/9/") || // DM码 - fullTag.contains(":/10/") || // 二维码 - fullTag.contains(":/11/"); // 条形码 - - if (isVariableImg) { - // 检查是否已经有 vertical-align 样式 - if (!attr.contains("vertical-align", Qt::CaseInsensitive)) { - // 清理属性 - attr = attr.trimmed(); - if (attr.endsWith('/')) attr.chop(1); - if (attr.endsWith('/')) attr.chop(1); - - // 构造新标签 - QString newTag = QString("").arg(attr); - result.replace(pos, imgRx.matchedLength(), newTag); - qDebug() << "[FIX] Added vertical-align to variable image"; - } - } - pos += imgRx.matchedLength(); - } - - return result; -} - -//edit@12-10 -void SceneEditOption::on_btn_test2() -{ - const QPoint originScene=pViewer->mapFromScene(0,0); - QRectF sceneRect=pPicScene->sceneRect(); - - qreal left=sceneRect.width(),top=sceneRect.width(); - foreach (const QGraphicsItem *item, pPicScene->items()) { - left=qMin(left,item->pos().x()); - top=qMin(top,item->pos().y()); - } - - foreach (QGraphicsItem *item, pPicScene->items()) { - QPointF oldpos=item->pos(); - //oldpos=pViewer->mapToScene(oldpos.x()-left,oldpos.y()-top); - oldpos=QPointF(oldpos.x()-left,oldpos.y()-(top-pViewer->mapToScene(0,0).y())); - item->setPos(oldpos); - } - pPicScene->update(); -} - -void SceneEditOption::onInkJetPrinterCurrentChanged(int index) -{ - if(SCENE==sysPara->para.EditMode) - { - if(0==index)//edit@12-14 mainwindow tab - { - onStackedWidgetOptionCurrentChanged(1); - } - else //edit@12-14 other tabs - { - onStackedWidgetOptionCurrentChanged(0); - } - } -} - - -bool SceneEditOption::createItemImage(){ - QSize docSize = textEdit->document()->size().toSize(); - QImage image(docSize,QImage::Format_ARGB32); - // image.fill(0x00ffffff);//填充白色 - image.fill(Qt::transparent); - QPainter painter(&image); - textEdit->document()->drawContents (&painter, image.rect()); /*将text写到pic*/ - bool res = image.save("/home/plg/doc/scene.png"); - return res; -} - - -void SceneEditOption::updatePicScene2Item(){ - - pPicScene2->clear(); - QList items = pPicScene->items(); - for(int i=0;iaddItem(textItem2); - textItem2->setPlainText(""); - } - // 重新复制所有 items - for(int i=0;iitems().at(i); - pTextItem2->setHtml(pTextItem->toHtml()); - pTextItem2->setPos(pTextItem->pos()); - textEdit->setHtml(pTextItem->toHtml()); - if(!pTextItem->toHtml().contains(""; - textEdit->setHtml(html); - } - else textEdit->setHtml(""); - } - pTextItem->setHtml(textEdit->toHtml()); - } - -} - -QList SceneEditOption::getPicSceneItems() -{ - return pPicScene2->items(); -} - -//Scene Test -void SceneEditOption::insertImageItem(QString filePath,bool){ - - pPicScene->clearSelection(); - QString html = ""; - textEdit->setHtml (html); - textItem = new PicTextItem(); - pPicScene->addItem(textItem); - - pPicScene2->clearSelection(); - textItem2 = new PicTextItem(); - pPicScene2->addItem(textItem2); - textItem2->setHtml(textEdit->toHtml()); - - QList items = pPicScene->items(); - if(pPicScene->items().count()>1){ - QRectF itemRect= items.at(1)->boundingRect(); - textItem->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y()); - } - else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 - textItem->setSelected(true); - textItem->setHtml(textEdit->toHtml()); - -} +#include "SceneEditOption.h" +#include "pictextitem.h" +#include "ui_sceneEditOption.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "myview.h" +#include "LogInfo.h" +#include +#include +#include + +#include +#include + +MoveInput* moveInput; +SceneEditOption::SceneEditOption(QWidget *parent) : + QWidget(parent), + ui(new Ui::SceneEditOption),newScene(0) +{ + ui->setupUi(this); + editMode = SCENE; + xmlfileName = ""; + dialogFileOperation = new DialogFileOperation(0); +#ifdef MYSAVEFILEDLG + dialogSaveFile =new DialogSaveFile(0); + //connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); +#endif + m_CreateImageFlag = false; + m_pSavePicScene = new QGraphicsScene(); + m_pSavePicScene->setSceneRect(QRectF(0, 0, 3200, MAX_PRINT_ROW_NUM)); //生成图片的场景 + moveInput = new MoveInput(parent); + + pPicScene2 = new PicScene(this); //Scene Test + auto items = pPicScene2->items(); + int a =0; +} + +SceneEditOption::~SceneEditOption() +{ + if(m_pSavePicScene) + { + delete m_pSavePicScene; + } + if(moveInput) + { + delete moveInput; + } +} + +void SceneEditOption::bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText){ + this->stackedWidgetOption = stackedWidgetOption;// stackedWidgetOption + this->stackedWidgetText = stackedWidgetText; + connect(this->stackedWidgetOption,SIGNAL(currentChanged(int)),this,SLOT(onStackedWidgetOptionCurrentChanged(int))); +} + +void SceneEditOption::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; +} +void SceneEditOption::enableButtonSave(){ + if(!ui->saveButton->isEnabled()) + ui->saveButton->setEnabled(true); +} +void SceneEditOption::onStackedWidgetOptionCurrentChanged(int index) +{ + const QString objectName=this->stackedWidgetOption->currentWidget()->objectName(); + // const QString objectName=this->stackedWidgetOption->widget(index)->objectName(); + qDebug()<<"index="<para.EditMode) + { + // qDebug()<<"显示新场景--open"; + this->pPicScene->setIsdrawBackground(true); + this->stackedWidgetOption->hide(); + // //show_scene_new_dlg(); + // foreach (QLayout *lay, listQLayout) { + // newScene->showQLayout(lay,false); + // } + newScene->Layout_ToNew(); + newScene->show(); + + // //edit@03-07 + // for(char i=((MyView*)pViewer)->getzoomRatio();i<3;i++) + // { + // on_enlargeButton_pressed(); + // } + } + else + { + // qDebug()<<"隐藏新场景--hide"; + this->pPicScene->setIsdrawBackground(false); + this->stackedWidgetOption->setVisible(true); + newScene->hide(); + newScene->Layout_ToDefault(); + // foreach (QLayout *lay, listQLayout) { + // newScene->showQLayout(lay,true); + // } + } + + } +} + +void SceneEditOption::bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit){ + this->pPicScene = pPicScene; + this->pViewer = pGraphicViewer; + this->textEdit = pTextEdit; + //connect(pPicScene,SIGNAL(xmlContentChanged ()),this,SLOT(enableButtonSave())); + connect(pPicScene,SIGNAL(selectionChanged()),this,SLOT(enableButtonSave())); + + ui->saveButton->setEnabled(false); + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + connect(dialogFileOperation,SIGNAL(createSceneImage(QString)),this,SLOT(onCreateSceneImage(QString))); +#ifdef MYSAVEFILEDLG + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); +#endif + //edit@12-06 显示网格线 + this->pPicScene->setIsdrawBackground(true); +} + +void SceneEditOption::show_scene_new_dlg() +{ + QWidget *tabMainWindow=this->parentWidget()->parentWidget(); + + if(!newScene) + { + this->stackedWidgetOption->hide(); + newScene=new FormScenedlg(tabMainWindow); + newScene->setObjectName("newScene"); + + newScene->setAutoFillBackground(true); + newScene->setPalette(tabMainWindow->palette()); + + newScene->bindScene(this->pPicScene,this->pViewer,this->textEdit); + //edit@12-07另一种信号通信 + connect(newScene,SIGNAL(delButton()),this,SLOT(on_delButton_pressed())); + connect(newScene,SIGNAL(saveButton()),this,SLOT(on_saveButton_pressed())); + connect(newScene,SIGNAL(openfileButton()),this,SLOT(on_openfileButton_pressed())); + connect(newScene,SIGNAL(previewButton()),this,SLOT(on_previewButton_pressed())); + //connect(newScene,SIGNAL(previewButton()),this,SIGNAL(previewScene())); + + connect(newScene,SIGNAL(addButton()),this,SLOT(on_addButton_pressed())); + connect(newScene,SIGNAL(EditItemButton()),this,SLOT(on_EditItemButton_pressed())); + connect(newScene,SIGNAL(saveAsButton()),this,SLOT(on_saveAsButton_pressed())); + connect(newScene,SIGNAL(newfileButton()),this,SLOT(on_newfileButton_pressed())); + connect(newScene,SIGNAL(enlargeButton()),this,SLOT(on_enlargeButton_pressed())); + connect(newScene,SIGNAL(reduceButton()),this,SLOT(on_reduceButton_pressed())); + connect(newScene,SIGNAL(ZoomOrigin()),this,SLOT(on_test_pressed())); + connect(newScene,SIGNAL(btn_test2()),this,SLOT(on_btn_test2())); + connect(this->pPicScene,SIGNAL(showTextWidthHeight()),newScene,SLOT(reset_showTextWidthHeight())); + //connect(this->pPicScene,SIGNAL(adjustItemsPos()),newScene,SLOT(adjustItemsPosFalse())); + connect(newScene,SIGNAL(insertImage(QString,bool)),this,SLOT(insertImageItem(QString,bool))); + + newScene->move(0,270); + newScene->Layout_ToNew(); + } +} + +void SceneEditOption::on_previewButton_pressed() +{ + syncAllPositions(); + this->pPicScene->setIsdrawBackground(false); + emit previewScene(); +} + + +void SceneEditOption::on_addButton_pressed() +{ + // ========== 清空编辑器内容 ========== + textEdit->clear(); + textEdit->setHtml(""); + + // ========== 场景1:添加图元(用于显示) ========== + textItem = new PicTextItem(); + QList items = pPicScene->items(); + if(!items.isEmpty()){ +// QRectF itemRect= items.last()->boundingRect(); +// textItem->setPos(items.last()->scenePos().x()+itemRect.width()+20, items.last()->scenePos().y()); + QRectF itemRect= items.first()->boundingRect(); + textItem->setPos(items.first()->scenePos().x()+itemRect.width()+20, items.first()->scenePos().y()); + } + else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 + + pPicScene->addItem(textItem); + pPicScene->clearSelection(); + textItem->setHtml(""); + textItem->setSelected(true); + + // ========== 场景2:添加图元(存储真实内容) ========== + + textItem2 = new PicTextItem(); + textItem2->setPos(textItem->pos()); + pPicScene2->addItem(textItem2); + pPicScene2->clearSelection(); + textItem2->setHtml(""); + textItem2->setSelected(true); + + + ui->saveButton->setEnabled(true); + on_EditItemButton_pressed(); +} +bool SceneEditOption::maybeSave(){ + + if (xmlfileName.startsWith(QLatin1String(":/"))) + return true; + + QMessageBox msgBox(QMessageBox::Information,tr("提示"),tr("文档已经改变,是否保存?")); + QPushButton *saveButton = msgBox.addButton(tr("保存"), QMessageBox::ActionRole); + QPushButton *cancleSaveButton = msgBox.addButton(tr("放弃保存"), QMessageBox::ActionRole); + QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); + + msgBox.exec(); + + if (msgBox.clickedButton() == saveButton) { + on_saveButton_pressed(); + return false; + } else if (msgBox.clickedButton() == cancleSaveButton) { + return true; + } + else + return false; + + return true; +} + +int SceneEditOption::getSelectedIndex() +{ + QList items = pPicScene->items(); + for(int i = 0; i < items.size(); i++) { + if(items.at(i)->isSelected()) { + return i; + } + } + return -1; // 没有选中的图元 +} + +void SceneEditOption::syncAllPositions() +{ + QList items1 = pPicScene->items(); + QList items2 = pPicScene2->items(); + + int minSize = qMin(items1.size(), items2.size()); + + for (int i = 0; i < minSize; i++) { + QPointF pos1 = items1.at(i)->pos(); + QPointF pos2 = items2.at(i)->pos(); + + if (pos1 != pos2) { + items2.at(i)->setPos(pos1); + } + } + +} +void SceneEditOption::on_newfileButton_pressed() +{ + if (maybeSave()) { + pPicScene->clear(); + pViewer->viewport()->update(); + unsigned char SpecialVarEnable = 0; + sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1); + xmlfileName = ""; + QFile file(xmlfileName); + emit fileNameChanged(QFileInfo(xmlfileName).fileName()); + //Scene Test + pPicScene2->clear(); + } +#ifdef VARCOLOR + textEdit->insertHtml(QString("  ")); +#endif +} +void SceneEditOption::on_delButton_pressed() +{ + int index = getSelectedIndex(); // 获取选中图元的索引 + if (index == -1) return; + + QList items = pPicScene->items(); + if (index < items.size()) { + // 从场景1删除 + QGraphicsItem *item = items.at(index); + pPicScene->removeItem(item); + delete item; + } + + QList htmlItems = pPicScene2->items(); + if (index < htmlItems.size()) { + // 从场景2删除 + QGraphicsItem *htmlItem = htmlItems.at(index); + pPicScene->removeItem(htmlItem); + delete htmlItem; + } + + ui->saveButton->setEnabled(true); +} +void SceneEditOption::on_saveAsButton_pressed() +{ + pPicScene->clearSelection(); +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->refreshListView(editMode); + dialogSaveFile->show(); + dialogSaveFile->setEnterFileName(""); +#endif +} +void SceneEditOption::on_saveButton_pressed() +{ + pPicScene->clearSelection(); + if(xmlfileName.isEmpty()) + { + qDebug()<<"xml file null"; +#ifdef MYSAVEFILEDLG + disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0); + connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool))); + dialogSaveFile->refreshListView(editMode); + dialogSaveFile->show(); + dialogSaveFile->setEnterFileName(""); + +#endif + } + else + { + pPicScene->update(); + saveFile(); + if(sysPara){ + sysPara->sysFile =xmlfileName; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); + } + //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); + ui->saveButton->setEnabled(false); + emit fileNameChanged(QFileInfo(xmlfileName).fileName()); + } +} + +void SceneEditOption::on_openfileButton_pressed() +{ + pPicScene->clearSelection(); + dialogFileOperation->refreshListView(editMode); + dialogFileOperation->exec(); +} + +void SceneEditOption::on_EditItemButton_pressed() +{ + // 1. 获取选中图元的索引 + int selectedIndex = getSelectedIndex(); + if (selectedIndex == -1) return; + + // 2. 获取两个场景的图元列表 + QList items = pPicScene->items(); + QList htmlItems = pPicScene2->items(); + // 3. 边界检查:确保两个场景的图元数量匹配 + if (items.size() != htmlItems.size()) { + return; + } + // 4. 检查索引是否在范围内 + if (selectedIndex >= htmlItems.size() && selectedIndex >= items.size()) { + return; + } + // 5. 获取对应的图元 + PicTextItem *pTextItem = qgraphicsitem_cast(items.at(selectedIndex)); + PicTextItem *pTextItem2 = qgraphicsitem_cast(htmlItems.at(selectedIndex)); + // 6. 执行编辑操作 + //QString htmlContent = pTextItem2->toHtml(); + // 从场景2获取HTML内容,并修复变量图片的垂直对齐 + QString htmlContent = fixVariableImagesAlignment(pTextItem2->toHtml()); + textEdit->setHtml(htmlContent); + + // 保持选中状态 + pTextItem->setSelected(true); + pTextItem2->setSelected(true); + + // 切换到textedit的界面 + emit editItemMode(); + stackedWidgetText->setCurrentIndex(0); + stackedWidgetOption->setCurrentIndex(0); + ui->saveButton->setEnabled(true); + +} + +void SceneEditOption::onEditItemDone() +{ + int selectedIndex = getSelectedIndex(); + if (selectedIndex == -1) return; + // ========== 只更新场景2的HTML内容 ========== + QList htmlItems = pPicScene2->items(); + if (selectedIndex < htmlItems.size()) { + PicTextItem *pTextItem2 = qgraphicsitem_cast(htmlItems.at(selectedIndex)); + if (pTextItem2) { + // 场景2:更新真实内容 + pTextItem2->setHtml(textEdit->toHtml()); + onSceneAccepted(pTextItem2); + } + } + // 场景1只需要更新显示,不需要存储完整HTML + QList items = pPicScene->items(); + if (selectedIndex < items.size()) { + PicTextItem *pTextItem = qgraphicsitem_cast(items.at(selectedIndex)); + if (pTextItem) { + // 场景1:只需要更新显示内容(如渲染后的图片) + // 处理图片 + //创建Item的Html对应的图片 + if (createItemImage()) { + QString html = ""; + textEdit->setHtml(html); + } + else textEdit->setHtml(""); + + if (pPicScene->items().size() > selectedIndex) { + PicTextItem * item = (PicTextItem *)pPicScene->items().at(selectedIndex); + item->setHtml(textEdit->toHtml()); + onSceneAccepted(item); + } + } + } + + stackedWidgetText->setCurrentIndex(3); + stackedWidgetOption->setCurrentIndex(1); + return; +} + +void SceneEditOption::onCreateSceneImage(QString filePath) +{ + m_CreateImageFlag = true; + m_pSavePicScene->clear(); + onFileOpen(filePath,false); + m_pSavePicScene->clearSelection(); + QSize size(m_pSavePicScene->itemsBoundingRect().width(),m_pSavePicScene->itemsBoundingRect().height()); + QImage image(size,QImage::Format_ARGB32); + image.fill(0x00ffffff);//填充白色 + QPainter painter(&image); + m_pSavePicScene->render(&painter,QRectF(),m_pSavePicScene->itemsBoundingRect()); + image.save("./printSceneView.png");//图片 + m_CreateImageFlag = false; +} + +extern QStringList stringListRecive; + +void SceneEditOption::parseVbfile(QXmlStreamReader &reader) { + // int textItemPosX; + // int textItemPosY; + // textItemPosX = picText->pos().x() - pPicScene->itemsBoundingRect().x(); + // textItemPosY = picText->pos().y() - pPicScene->itemsBoundingRect().y(); + float pos_x,pos_y; + bool Condition= false ; + int CatchStartValue = -1; + int CatchValue = -1; + while (!reader.atEnd()) { + reader.readNext(); + if (reader.isStartElement()) { // 开始元素 + QString strElementName = reader.name().toString(); + if (QString::compare(strElementName, "VBfile") == 0) { + //qDebug() << QString::fromLocal8Bit("********** 开始元素 ********** "); + } else if (QString::compare(strElementName, QString("pointer_x")) == 0) { // 方式一 + reader.readNext(); + if (reader.isCharacters()) { + pos_x = reader.text().toString().toDouble(); + //qDebug() << QString("pointer_x:%1").arg(reader.text().toString()); + } + } else if (QString::compare(strElementName, QString("pointer_y")) == 0) { // 方式二 + pos_y = reader.readElementText().toDouble(); + //qDebug() << QString("pointer_y:%1").arg(reader.readElementText()); + } + else if (QString::compare(strElementName, QString("Condition")) == 0) { + Condition = reader.readElementText().toInt() ? true : false; + } + else if (QString::compare(strElementName, QString("CatchStartValue")) == 0) { + CatchStartValue = reader.readElementText().toInt(); + } + else if (QString::compare(strElementName, QString("CatchValue")) == 0) { + CatchValue = reader.readElementText().toInt(); + } + else if (QString::compare(strElementName, QString("html_src")) == 0) { + //qDebug() << QString("html_src:%1").arg(reader.readElementText()); + } + } else if (reader.isEntityReference()) { // 实体引用 + QString strName = reader.name().toString(); + QString strText = reader.text().toString(); + //qDebug() << QString("EntityReference : %1(%2)").arg(strName).arg(strText); + } else if (reader.isCDATA()) { // CDATA + QString strCDATA = reader.text().toString(); + //qDebug() << QString("CDATA : %1").arg(strCDATA); + PicTextItem *pPictText = new PicTextItem(); + if(m_CreateImageFlag) + { + m_pSavePicScene->addItem(pPictText); + } + else + { + pPicScene->addItem(pPictText); + } + QFont font = pPictText->font(); + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + pPictText->setFont(font); + pPictText->setPos(pos_x,pos_y); + pPictText->SpecialConditions = Condition; + pPictText->CatchCnt1StartValue = CatchStartValue; + pPictText->CatchCnt1CurrValue = CatchValue; + // Condition= false ; + // CatchValue = -1; + //LogInfo::setRunStatusText(tr("接收文件解析::2")); + if(!sysPara->status.forTemplateUse || m_CreateImageFlag) + { + pPictText->setHtml(strCDATA); + } + else + { + //qDebug() << tr("接收文件解析:"); + //LogInfo::setRunStatusText(tr("接收文件解析::3")); + //stringListRecive << "aaaa" << "bbbb" << "cccc"; + if(strCDATA.contains("#1111") || strCDATA.contains("")) + { + if(stringListRecive.size() > 0) + { + if(strCDATA.contains("#1111")) + { + strCDATA.replace("#1111",stringListRecive.at(0).toStdString().c_str()); + } + else if(strCDATA.contains("")) + { + emit generateQRCode(stringListRecive.at(0)); + strCDATA.replace("modbusQR#01.bmp","modbusQR.bmp"); + } + } + + } + else if(strCDATA.contains("#2222") || strCDATA.contains("")) + { + if(stringListRecive.size() > 1) + { + if(strCDATA.contains("#2222")) + { + strCDATA.replace("#2222",stringListRecive.at(1).toStdString().c_str()); + } + else if(strCDATA.contains("")) + { + emit generateQRCode(stringListRecive.at(1)); + strCDATA.replace("modbusQR#02.bmp","modbusQR.bmp"); + } + } + } + else if(strCDATA.contains("#3333") || strCDATA.contains("")) + { + if(stringListRecive.size() > 2) + { + if(strCDATA.contains("#3333")) + { + strCDATA.replace("#3333",stringListRecive.at(2).toStdString().c_str()); + } + else if(strCDATA.contains("")) + { + emit generateQRCode(stringListRecive.at(2)); + strCDATA.replace("modbusQR#03.bmp","modbusQR.bmp"); + } + } + } + pPictText->setHtml(strCDATA); + } + // if(Condition) + // { + // SpecialVarPrint specialVarPrint; + // specialVarPrint.SpecialVarEnable = Condition; + // specialVarPrint.SpecialVarCountStart = CatchStartValue; + // specialVarPrint.SpecialVarCountEnd = CatchValue; + // specialVarPrint.SpecialVarColStart = 3 + pos_x- pPicScene->itemsBoundingRect().x(); + // specialVarPrint.SpecialVarColEnd = 3 + pos_x - pPicScene->itemsBoundingRect().x()+ pPictText->boundingRect().width(); + // specialVarPrint.SpecialVarRowStart = pos_y - pPicScene->itemsBoundingRect().y(); + // specialVarPrint.SpecialVarRowEnd = pos_y - pPicScene->itemsBoundingRect().y()+ pPictText->boundingRect().height(); + // sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&specialVarPrint,sizeof(SpecialVarPrint)); // Send specialVarPrint 2022-8-6 + // LogInfo::setRunStatusText(tr("发送特殊变量内容:")); + // LogInfo::setRunStatusText(tr("SpecialVarEnable:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarEnable))); + // LogInfo::setRunStatusText(tr("SpecialVarCountStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountStart))); + // LogInfo::setRunStatusText(tr("SpecialVarCountEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountEnd))); + // LogInfo::setRunStatusText(tr("SpecialVarColStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColStart))); + // LogInfo::setRunStatusText(tr("SpecialVarColEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColEnd))); + // LogInfo::setRunStatusText(tr("SpecialVarRowStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowStart))); + // LogInfo::setRunStatusText(tr("SpecialVarRowEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowEnd))); + // LogInfo::setRunStatusText(tr("itemsBoundingRect().y():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().y()))); + // LogInfo::setRunStatusText(tr("itemsBoundingRect().x():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().x()))); + // } + Condition= false ; + CatchValue = -1; + CatchStartValue = -1; + + reader.readNext(); + if (reader.isCharacters()) { + QString strCharacters = reader.text().toString(); + //qDebug() << QString("Characters : %1").arg(strCharacters); + } + } else if (reader.isEndElement()) { // 结束元素 + QString strElementName = reader.name().toString(); + if (QString::compare(strElementName, "Blogs") == 0) { + //qDebug() << QString::fromLocal8Bit("********** 结束元素 ********** "); + break; // 跳出循环(解析 QXmlStreamReader::EndDocument) + } else if (QString::compare(strElementName, "Blog") == 0) { + //qDebug() << QString::fromLocal8Bit("********** 结束元素 ********** "); + } + } + } +} +/* + * 和DialogFileOperation对接 + * */ +void SceneEditOption::onFileOpen(QString filePath,bool insertFlag){ + if(editMode==SCENE) { + if(filePath.endsWith(".xml")) + { + QFile file(filePath); + + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // 以只写模式打开文件 + xmlfileName=filePath; + QXmlStreamReader reader(&file); + if(!m_CreateImageFlag) + { + pPicScene->clear(); + pViewer->viewport()->update(); + unsigned char SpecialVarEnable = 0; + sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1); + } + // 解析 XML,直到结束 + while (!reader.atEnd()) { + + // 读取下一个元素 + QXmlStreamReader::TokenType nType = reader.readNext(); + + switch (nType) { + case QXmlStreamReader::StartDocument: { // 开始文档 + //qDebug() << QString::fromLocal8Bit("********** 开始文档(XML 声明) ********** "); + // XML 声明 + QString strVersion = reader.documentVersion().toString(); + QString strEncoding = reader.documentEncoding().toString(); + bool bAlone = reader.isStandaloneDocument(); + //qDebug() << QString::fromLocal8Bit("版本:%1 编码:%2 Standalone:%3") + // .arg(strVersion).arg(strEncoding).arg(bAlone) << "\r\n"; + break; + } + case QXmlStreamReader::Comment: { // 注释 + //qDebug() << QString::fromLocal8Bit("********** 注释 ********** "); + QString strComment = reader.text().toString(); + //qDebug() << strComment << "\r\n"; + break; + } + case QXmlStreamReader::ProcessingInstruction: { // 处理指令 + //qDebug() << QString::fromLocal8Bit("********** 处理指令 ********** "); + QString strProcInstr = reader.processingInstructionData().toString(); + //qDebug() << strProcInstr << "\r\n"; + break; + } + case QXmlStreamReader::DTD: { // DTD + //qDebug() << QString::fromLocal8Bit("********** DTD ********** "); + QString strDTD = reader.text().toString(); + QXmlStreamNotationDeclarations notationDeclarations = reader.notationDeclarations(); // 符号声明 + QXmlStreamEntityDeclarations entityDeclarations = reader.entityDeclarations(); // 实体声明 + // DTD 声明 + QString strDTDName = reader.dtdName().toString(); + QString strDTDPublicId = reader.dtdPublicId().toString(); // DTD 公开标识符 + QString strDTDSystemId = reader.dtdSystemId().toString(); // DTD 系统标识符 + //qDebug() << QString::fromLocal8Bit("DTD : %1").arg(strDTD); + //qDebug() << QString::fromLocal8Bit("DTD 名称 : %1").arg(strDTDName); + //qDebug() << QString::fromLocal8Bit("DTD 公开标识符 : %1").arg(strDTDPublicId); + //qDebug() << QString::fromLocal8Bit("DTD 系统标识符 : %1").arg(strDTDSystemId); + //qDebug() << "\r\n"; + + break; + } + case QXmlStreamReader::StartElement: { // 开始元素 + QString strElementName = reader.name().toString(); + if (QString::compare(strElementName, "VBfiles") == 0) { // 根元素 + //qDebug() << QString::fromLocal8Bit("********** 开始元素 ********** "); + QXmlStreamAttributes attributes = reader.attributes(); + if (attributes.hasAttribute("Version")) { + QString strVersion = attributes.value("Version").toString(); + //qDebug() << QString::fromLocal8Bit("属性:Version(%1)").arg(strVersion); + } + + parseVbfile(reader); + } + break; + } + case QXmlStreamReader::EndDocument: { // 结束文档 + //qDebug() << QString::fromLocal8Bit("********** 结束文档 ********** "); + break; + } + } + } + + if (reader.hasError()) { // 解析出错 + //qDebug() << QString::fromLocal8Bit("错误信息:%1 行号:%2 列号:%3 字符位移:%4").arg(reader.errorString()).arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.characterOffset()); + } + //qDebug()<<"open done"; + file.close(); // 关闭文件 + //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData()); + if(!m_CreateImageFlag)//生成图片显示 + { + if(sysPara) + { + sysPara->sysFile =filePath; + sysPara->loadParaFromFile(); + //qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData()); + } + + emit fileNameChanged(QFileInfo(xmlfileName).fileName()); + ui->saveButton->setEnabled(false); + QList items = pPicScene->items(); + foreach (QGraphicsItem *item, items) { + PicTextItem *picText = qgraphicsitem_cast(item); + onSceneAccepted(picText); + } + + //Scene Test + updatePicScene2Item(); + + } + + } + } + } +} +void SceneEditOption::saveFile(){ + QFile file(xmlfileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) { // 只写模式打开文件 + qDebug() << QString("Cannot write file %1(%2).").arg(xmlfileName).arg(file.errorString()); + return; + } + QXmlStreamWriter writer(&file); + writer.setAutoFormatting(true); // 自动格式化 + writer.writeStartDocument("1.0", true); // 开始文档(XML 声明) + writer.writeComment(QString::fromLocal8Bit("Vernon Bach graphic scene file")); // 注释 + writer.writeDTD(QString::fromLocal8Bit(" ]>")); + writer.writeStartElement("VBfiles"); // 开始根元素 + writer.writeAttribute("Version", "1.0"); // 属性 + + QList items = pPicScene->items(); + //Scene Test pPicScene2保存的是html pPicScene保存的是图片 + QList items2 = pPicScene2->items(); + // std::cout<<"save pPicScene2 size:"<items().size()<(item); + writer.writeStartElement("VBfile"); // 开始子元素 + writer.writeTextElement(QString::fromLocal8Bit("pointer_x"), QString::fromLocal8Bit("%1").arg(picText->pos().x())); + writer.writeTextElement(QString::fromLocal8Bit("pointer_y"), QString::fromLocal8Bit("%1").arg(picText->pos().y())); + writer.writeTextElement(QString::fromLocal8Bit("Condition"), QString::fromLocal8Bit("%1").arg(picText->SpecialConditions? 1:0)); + writer.writeTextElement(QString::fromLocal8Bit("CatchStartValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1StartValue)); + writer.writeTextElement(QString::fromLocal8Bit("CatchValue"), QString::fromLocal8Bit("%1").arg(picText->CatchCnt1CurrValue)); + writer.writeTextElement(QString::fromLocal8Bit("html_src"), QString::fromLocal8Bit("my_src")); + + //Scene Test 内容用pPicScene2 Item的html 其他的位置信息用pPicScene Item + if(indextoHtml())); + } + index++; + + // writer.writeCDATA((picText->toHtml())); + writer.writeEndElement(); // 结束子元素 + } + writer.writeEndElement(); // 结束根元素 + writer.writeEndDocument(); // 结束文档 + fsync(file.handle()); + file.close(); // 关闭文件 +} + +void SceneEditOption::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class + qDebug()<sysFile =xmlfileName; + snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); + } + //snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData()); + ui->saveButton->setEnabled(false); + emit fileNameChanged(QFileInfo(xmlfileName).fileName()); +} +void SceneEditOption::on_enlargeButton_pressed() +{ + ((MyView*)pViewer)->ZoomOut(); +} +void SceneEditOption::on_reduceButton_pressed() +{ + ((MyView*)pViewer)->ZoomIn(); +} + +//将系统参数中的行间距和字符间距应用到图元 +void SceneEditOption::onSceneAccepted(PicTextItem *pTextItem){ + for(QTextBlock textBlock = pTextItem->document()->begin();textBlock != pTextItem->document()->end(); textBlock = textBlock.next()){ + QTextBlockFormat textBlockFormat = textBlock.blockFormat(); + textBlockFormat.setAlignment(Qt::AlignTop); + textBlockFormat.setTopMargin(-1); + textBlockFormat.setBottomMargin(sysPara->para.textEditLineSpace-1); + QTextCursor textCursor = pTextItem->textCursor(); + textCursor.setPosition(textBlock.position()); + textCursor.setBlockFormat(textBlockFormat); + pTextItem->setTextCursor(textCursor); + } + + QFont font = pTextItem->font(); + font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace); + pTextItem->setFont(font); + + sysPara->saveParaToFile(); +} + +//edit@12-10 +void SceneEditOption::on_test_pressed() +{ + const QPoint originScene=pViewer->mapFromScene(0,0); + const QRectF sceneRect=pPicScene->sceneRect(); + const QRectF BoundingRect=pPicScene->itemsBoundingRect(); + qDebug()<]*)>"); + imgRx.setMinimal(true); + int pos = 0; + + while ((pos = imgRx.indexIn(result, pos)) != -1) { + QString attr = imgRx.cap(1); + QString fullTag = imgRx.cap(0); + + // 判断是否是变量图片 + bool isVariableImg = fullTag.contains("digitalWidth") || + fullTag.contains("expiryDate") || + fullTag.contains("curDate") || + fullTag.contains("class") || + fullTag.contains(":/9/") || // DM码 + fullTag.contains(":/10/") || // 二维码 + fullTag.contains(":/11/"); // 条形码 + + if (isVariableImg) { + // 检查是否已经有 vertical-align 样式 + if (!attr.contains("vertical-align", Qt::CaseInsensitive)) { + // 清理属性 + attr = attr.trimmed(); + if (attr.endsWith('/')) attr.chop(1); + if (attr.endsWith('/')) attr.chop(1); + + // 构造新标签 + QString newTag = QString("").arg(attr); + result.replace(pos, imgRx.matchedLength(), newTag); + qDebug() << "[FIX] Added vertical-align to variable image"; + } + } + pos += imgRx.matchedLength(); + } + + return result; +} + +//edit@12-10 +void SceneEditOption::on_btn_test2() +{ + const QPoint originScene=pViewer->mapFromScene(0,0); + QRectF sceneRect=pPicScene->sceneRect(); + + qreal left=sceneRect.width(),top=sceneRect.width(); + foreach (const QGraphicsItem *item, pPicScene->items()) { + left=qMin(left,item->pos().x()); + top=qMin(top,item->pos().y()); + } + + foreach (QGraphicsItem *item, pPicScene->items()) { + QPointF oldpos=item->pos(); + //oldpos=pViewer->mapToScene(oldpos.x()-left,oldpos.y()-top); + oldpos=QPointF(oldpos.x()-left,oldpos.y()-(top-pViewer->mapToScene(0,0).y())); + item->setPos(oldpos); + } + pPicScene->update(); +} + +void SceneEditOption::onInkJetPrinterCurrentChanged(int index) +{ + if(SCENE==sysPara->para.EditMode) + { + if(0==index)//edit@12-14 mainwindow tab + { + onStackedWidgetOptionCurrentChanged(1); + } + else //edit@12-14 other tabs + { + onStackedWidgetOptionCurrentChanged(0); + } + } +} + + +bool SceneEditOption::createItemImage(){ + QSize docSize = textEdit->document()->size().toSize(); + QImage image(docSize,QImage::Format_ARGB32); + // image.fill(0x00ffffff);//填充白色 + image.fill(Qt::transparent); + QPainter painter(&image); + textEdit->document()->drawContents (&painter, image.rect()); /*将text写到pic*/ + bool res = image.save("/home/plg/doc/scene.png"); + return res; +} + + +void SceneEditOption::updatePicScene2Item(){ + + pPicScene2->clear(); + QList items = pPicScene->items(); + for(int i=0;iaddItem(textItem2); + textItem2->setPlainText(""); + } + // 重新复制所有 items + for(int i=0;iitems().at(i); + pTextItem2->setHtml(pTextItem->toHtml()); + pTextItem2->setPos(pTextItem->pos()); + textEdit->setHtml(pTextItem->toHtml()); + if(!pTextItem->toHtml().contains(""; + textEdit->setHtml(html); + } + else textEdit->setHtml(""); + } + pTextItem->setHtml(textEdit->toHtml()); + } + +} + +QList SceneEditOption::getPicSceneItems() +{ + return pPicScene2->items(); +} + +//Scene Test +void SceneEditOption::insertImageItem(QString filePath,bool){ + + pPicScene->clearSelection(); + QString html = ""; + textEdit->setHtml (html); + textItem = new PicTextItem(); + pPicScene->addItem(textItem); + + pPicScene2->clearSelection(); + textItem2 = new PicTextItem(); + pPicScene2->addItem(textItem2); + textItem2->setHtml(textEdit->toHtml()); + + QList items = pPicScene->items(); + if(pPicScene->items().count()>1){ + QRectF itemRect= items.at(1)->boundingRect(); + textItem->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y()); + } + else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 + textItem->setSelected(true); + textItem->setHtml(textEdit->toHtml()); + +} diff --git a/scene/SceneEditOption.h b/scene/SceneEditOption.h index 79e9450..eadef55 100644 --- a/scene/SceneEditOption.h +++ b/scene/SceneEditOption.h @@ -1,126 +1,126 @@ -#ifndef SCENEEDITOPTION_H -#define SCENEEDITOPTION_H - -#include -#include -#include -#include -#include -#include -#include -#include "ParaSettingUI.h" -#include "MyFileDialog.h" -#include -#include -#include -#include "DialogFileOperation.h" -#include "DialogInsertVari.h" -#include "DialogFontSize.h" -#include "DialogLineSpace.h" -#include "PicWidget.h" -#include -#include "dlgQrCode.h" -#include "QBarCode.h" -#include "DialogSaveFile.h" -#include "SceneEditOption.h" -#include "pictextitem.h" -#include "picscene.h" -#include "moveinput.h" -#include "formscenedlg.h" -#include -#include "MyFileDialog.h" -namespace Ui { -class SceneEditOption; -} - -class SceneEditOption : public QWidget,public ParaSettingUI -{ - Q_OBJECT -public: - explicit SceneEditOption(QWidget *parent = 0); - ~SceneEditOption(); - - void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText); - void bindSysPara(SysPara *sysPara); - void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer, QTextEdit *pTextEdit); - bool createItemImage(); - void updatePicScene2Item(); - - QList getPicSceneItems(); -signals: - void previewScene(); - void addPicTextItem(); - void importFile(QString); - void delItem(); - void saveScene(QString); - void openSceneFile(QString); - void editItem(); - void editItemMode(); - void fileNameChanged(QString); - void generateQRCode(QString); -public slots: - void enableButtonSave(); - void onSaveASFile(QString filename,bool Flag); - void saveFile(); - void onFileOpen(QString filePath,bool insertFlag); - void onEditItemDone(); - void onCreateSceneImage(QString filePath);//生成场景图片 - void onStackedWidgetOptionCurrentChanged(int index); - //edit@12-07 - void show_scene_new_dlg(); - void on_btn_test2(); - void onInkJetPrinterCurrentChanged(int index); - void insertImageItem(QString,bool); -private slots: - void on_delButton_pressed(); - - void on_saveButton_pressed(); - void on_openfileButton_pressed(); - - void on_previewButton_pressed(); - - void on_addButton_pressed(); - - void on_EditItemButton_pressed(); - - void on_saveAsButton_pressed(); - - void on_newfileButton_pressed(); - void on_enlargeButton_pressed(); - void on_reduceButton_pressed(); - void on_test_pressed(); - -private: - // 修复编辑时文本和变量错位问题 - QString fixVariableImagesAlignment(const QString &html); - void parseVbfile(QXmlStreamReader &reader); - bool maybeSave(); - Ui::SceneEditOption *ui; - QStackedWidget *stackedWidgetOption; - QStackedWidget *stackedWidgetText; - PicScene *pPicScene; //保存Item的Html对应的图片 用于显示 解决场景模式文本无法放大的问题 - PicScene *pPicScene2; //保存Item的Html 用于编辑和保存 pPicScene和pPicScene2的Item一一对应 - QGraphicsView *pViewer; - QTextEdit *textEdit; - QGraphicsScene *m_pSavePicScene; - bool m_CreateImageFlag; - int getSelectedIndex(); - void syncAllPositions(); - - DialogFileOperation *dialogFileOperation; -#ifdef MYSAVEFILEDLG - DialogSaveFile *dialogSaveFile; -#endif - MyFileDialog *fileDialog; - - PicTextItem *textItem; - PicTextItem *textItem2; - //PicScene *scene; - QString currFileName; - void onSceneAccepted(PicTextItem *pTextItem); - int editMode;//保存当前的编辑模式 - QString xmlfileName; - FormScenedlg *newScene; -}; - -#endif // SCENEEDITOPTION_H +#ifndef SCENEEDITOPTION_H +#define SCENEEDITOPTION_H + +#include +#include +#include +#include +#include +#include +#include +#include "ParaSettingUI.h" +#include "MyFileDialog.h" +#include +#include +#include +#include "DialogFileOperation.h" +#include "DialogInsertVari.h" +#include "DialogFontSize.h" +#include "DialogLineSpace.h" +#include "PicWidget.h" +#include +#include "dlgQrCode.h" +#include "QBarCode.h" +#include "DialogSaveFile.h" +#include "SceneEditOption.h" +#include "pictextitem.h" +#include "picscene.h" +#include "moveinput.h" +#include "formscenedlg.h" +#include +#include "MyFileDialog.h" +namespace Ui { +class SceneEditOption; +} + +class SceneEditOption : public QWidget,public ParaSettingUI +{ + Q_OBJECT +public: + explicit SceneEditOption(QWidget *parent = 0); + ~SceneEditOption(); + + void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText); + void bindSysPara(SysPara *sysPara); + void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer, QTextEdit *pTextEdit); + bool createItemImage(); + void updatePicScene2Item(); + + QList getPicSceneItems(); +signals: + void previewScene(); + void addPicTextItem(); + void importFile(QString); + void delItem(); + void saveScene(QString); + void openSceneFile(QString); + void editItem(); + void editItemMode(); + void fileNameChanged(QString); + void generateQRCode(QString); +public slots: + void enableButtonSave(); + void onSaveASFile(QString filename,bool Flag); + void saveFile(); + void onFileOpen(QString filePath,bool insertFlag); + void onEditItemDone(); + void onCreateSceneImage(QString filePath);//生成场景图片 + void onStackedWidgetOptionCurrentChanged(int index); + //edit@12-07 + void show_scene_new_dlg(); + void on_btn_test2(); + void onInkJetPrinterCurrentChanged(int index); + void insertImageItem(QString,bool); +private slots: + void on_delButton_pressed(); + + void on_saveButton_pressed(); + void on_openfileButton_pressed(); + + void on_previewButton_pressed(); + + void on_addButton_pressed(); + + void on_EditItemButton_pressed(); + + void on_saveAsButton_pressed(); + + void on_newfileButton_pressed(); + void on_enlargeButton_pressed(); + void on_reduceButton_pressed(); + void on_test_pressed(); + +private: + // 修复编辑时文本和变量错位问题 + QString fixVariableImagesAlignment(const QString &html); + void parseVbfile(QXmlStreamReader &reader); + bool maybeSave(); + Ui::SceneEditOption *ui; + QStackedWidget *stackedWidgetOption; + QStackedWidget *stackedWidgetText; + PicScene *pPicScene; //保存Item的Html对应的图片 用于显示 解决场景模式文本无法放大的问题 + PicScene *pPicScene2; //保存Item的Html 用于编辑和保存 pPicScene和pPicScene2的Item一一对应 + QGraphicsView *pViewer; + QTextEdit *textEdit; + QGraphicsScene *m_pSavePicScene; + bool m_CreateImageFlag; + int getSelectedIndex(); + void syncAllPositions(); + + DialogFileOperation *dialogFileOperation; +#ifdef MYSAVEFILEDLG + DialogSaveFile *dialogSaveFile; +#endif + MyFileDialog *fileDialog; + + PicTextItem *textItem; + PicTextItem *textItem2; + //PicScene *scene; + QString currFileName; + void onSceneAccepted(PicTextItem *pTextItem); + int editMode;//保存当前的编辑模式 + QString xmlfileName; + FormScenedlg *newScene; +}; + +#endif // SCENEEDITOPTION_H diff --git a/scene/formscenedlg.cpp b/scene/formscenedlg.cpp index 8fdbd7f..70fc62a 100644 --- a/scene/formscenedlg.cpp +++ b/scene/formscenedlg.cpp @@ -1,559 +1,559 @@ -#include "formscenedlg.h" -#include "ui_formscenedlg.h" -#include -#include -#include -#include -#include "MyInputMethod.h" - -FormScenedlg::FormScenedlg(QWidget *parent) : - QWidget(parent), - ui(new Ui::FormScenedlg),pPicScene(0),tabMainWindow(0),dialogFileOperation(0),textEdit(0) -{ - ui->setupUi(this); - SWmaximumSize1={}; - SWgeometry1={}; - FVgeometry2={}; - GVgeometry3={}; - - - QPushButton *btnArray[]={ - // ui->KeyDown, - // ui->KeyLeft, - // ui->KeyRight, - // ui->KeyUp, - ui->itemLast, - ui->itemFirst, - ui->saveAsButton, - ui->saveButton, - ui->addButton, - //ui->itemPrev, - //ui->itemNext, - ui->previewButton, - ui->newfileButton, - ui->openfileButton, - ui->delButton, - ui->EditItemButton, - ui->insertImage, - ui->reduceButton, - ui->enlargeButton, - ui->ZoomOrigin - }; - - const QString sysfamily=qApp->font().family(); - - for(int i=0;iZoomOrigin->font(); // 获取当前字体 - const int defaultPointSize=16;//font.pointSize()<10?10:font.pointSize(); - - if(Public::ReadLanguageName()=="English"){ - font.setFamily("Arial"); - } -// font.setFamily("WenQuanYiMH"); - //font.setFamily("wenquanyi"); - font.setBold(true); - font.setPointSize(1*defaultPointSize); // 设置字体大小为12点 - font.setWeight(QFont::Black); - btnArray[i]->setFont(font); // 应用新字体到按钮 - } - - //不显示测试按钮 - ui->itemPrev->setVisible(false); - ui->itemNext->setVisible(false); - ui->ZoomOrigin->setVisible(false); - ui->btn_test2->setVisible(false); - -} - -FormScenedlg::~FormScenedlg() -{ - delete ui; - delete dialogFileOperation; - dialogFileOperation=0; -} -void FormScenedlg::horizontalScrollBar_valueChanged(int value) -{ - QTimer::singleShot(100,this,SLOT(sceneRectChanged_timerHandler())); -} - -void FormScenedlg::verticalScrollBar_valueChanged(int value) -{ - QTimer::singleShot(100,this,SLOT(sceneRectChanged_timerHandler())); -} - -void FormScenedlg::bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit){ - this->pPicScene = pPicScene; - this->pViewer = pGraphicViewer; - this->textEdit = pTextEdit; - - QObject::connect(pViewer->verticalScrollBar(), SIGNAL(valueChanged(int)), this,SLOT(verticalScrollBar_valueChanged(int))); - QObject::connect(pViewer->horizontalScrollBar(), SIGNAL(valueChanged(int)), this,SLOT(horizontalScrollBar_valueChanged(int))); - - dialogFileOperation = new DialogFileOperation(0); - dialogFileOperation->setWindowTitle(tr("插入图片")); -// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); - //Scene Test - connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SIGNAL(insertImage(QString,bool))); - - - - //edit@12-12读取旧的布局信息 - const QStackedWidget* pStackedWidget= static_cast(this->pViewer->parentWidget()->parentWidget()); - const QWidget* fileSceneViewer = static_cast(this->pViewer->parentWidget()); - if(pStackedWidget && fileSceneViewer) - { - tabMainWindow=fileSceneViewer->parentWidget()->parentWidget(); - SWmaximumSize1=pStackedWidget->maximumSize(); - SWgeometry1=pStackedWidget->geometry(); - - //QSize FVmaximumSize=fileSceneViewer->maximumSize(); - FVgeometry2=fileSceneViewer->geometry(); - - //QSize GVmaximumSize=this->pViewer->maximumSize(); - GVgeometry3=this->pViewer->geometry(); - - //qDebug()<<"1-2-3-size="<pViewer && this->pPicScene) -// { -// const QPoint originScene=pViewer->mapFromScene(0,0); -// if(originScene!=lastOriginScene) -// { -// lastOriginScene=originScene; - this->pPicScene->update(); -// //qDebug()<<"sceneRectChanged-update="<setMaximumSize(SWmaximumSize1.width(),SWmaximumSize1.height()+150); - pStackedWidget->setGeometry(SWgeometry1.x(),SWgeometry1.y(),SWgeometry1.width(),SWgeometry1.height()+150); - fileSceneViewer->setGeometry(FVgeometry2.x(),FVgeometry2.y(),FVgeometry2.width(),FVgeometry2.height()+150); - this->pViewer->setGeometry(GVgeometry3.x(),GVgeometry3.y(),GVgeometry3.width(),GVgeometry3.height()+80); - } - -} -//edit@12-12 恢复布局 -void FormScenedlg::Layout_ToDefault() -{ - QStackedWidget* pStackedWidget= static_cast(this->pViewer->parentWidget()->parentWidget()); - QWidget* fileSceneViewer = static_cast(this->pViewer->parentWidget()); - - //QWidget *tabMainWindow=fileSceneViewer->parentWidget()->parentWidget(); - QHBoxLayout *horizontalLayout=dynamic_cast(FormScenedlg::findChildAll(tabMainWindow->layout(),"horizontalLayout"));//edit@12-14 信息提示栏 - FormScenedlg::showQLayout(horizontalLayout,true); - - if(pStackedWidget && fileSceneViewer) - { - pStackedWidget->setMaximumSize(SWmaximumSize1); - pStackedWidget->setGeometry(SWgeometry1); - fileSceneViewer->setGeometry(FVgeometry2); - this->pViewer->setGeometry(GVgeometry3); - } -} - -void FormScenedlg::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void FormScenedlg::on_addButton_clicked() -{ - emit addButton(); -} - -void FormScenedlg::on_EditItemButton_clicked() -{ - emit EditItemButton(); -} - -void FormScenedlg::on_delButton_clicked() -{ - emit delButton(); -} - -void FormScenedlg::on_newfileButton_clicked() -{ -emit newfileButton(); -} - -void FormScenedlg::on_openfileButton_clicked() -{ -emit openfileButton(); -} - -void FormScenedlg::on_previewButton_clicked() -{ - pPicScene->clearSelection(); - foreach (QGraphicsItem *item, pPicScene->items()) { - item->clearFocus(); - item->setSelected(false); - } - //ui->previewButton->setFocus(); - emit previewButton(); -} - -void FormScenedlg::on_saveButton_clicked() -{ -emit saveButton(); -} - -void FormScenedlg::on_saveAsButton_clicked() -{ -emit saveAsButton(); -} -//edit@12-06 放大 -void FormScenedlg::on_enlargeButton_clicked() -{ - emit enlargeButton(); - adjustItemsPos(); - //QTimer::singleShot(100,this,SLOT(adjustItemsPos())); -} - -void FormScenedlg::on_reduceButton_clicked() -{ - emit reduceButton(); - adjustItemsPos(); - //QTimer::singleShot(100,this,SLOT(adjustItemsPos())); -} - -void FormScenedlg::on_KeyLeft_clicked() -{ - pViewer->setFocus(); -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); -#endif - //QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); -} - -void FormScenedlg::on_KeyUp_clicked() -{ - pViewer->setFocus(); -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); -#endif -//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); -} - -void FormScenedlg::on_KeyRight_clicked() -{ - pViewer->setFocus(); -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); -#endif -//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); -} - -void FormScenedlg::on_KeyDown_clicked() -{ - pViewer->setFocus(); -#ifndef Q_OS_WIN32 - //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件 - MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); -#endif -//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); -} - -void FormScenedlg::on_insertImage_clicked() -{ - if(dialogFileOperation) - { - dialogFileOperation->refreshListView(PICFILE); - dialogFileOperation->exec(); - } -} - -void FormScenedlg::on_ZoomOrigin_clicked() -{ - adjustItemsPos(false); -} - -void FormScenedlg::on_btn_test2_clicked() -{ - emit ZoomOrigin(); - -} - -//edit@12-11 选中下一个图元 -void FormScenedlg::on_itemNext_clicked() -{ - QList items=pPicScene->items(); - if(!items.empty()) - { - int index=0; - for(index=0;indexisSelected())break; - } - - pPicScene->clearSelection(); - if(index+1setSelected(true); - items.at(index)->setFocus(); - } - else - { - //edit@12-11 超范围,滚动到第一个 - index=0; - items.front()->setSelected(true); - items.front()->setFocus(); - } - //PrintselectedItemInfo(); - - } -} - -//edit@12-11选中上一个图元 -void FormScenedlg::on_itemPrev_clicked() -{ - QList items=pPicScene->items(); - if(!items.empty()) - { - int index=0; - for(index=0;indexisSelected())break; - } - - pPicScene->clearSelection(); - if(0<=index-1) - { - index-=1; - //edit@12-11选中前一个 - items.at(index)->setSelected(true); - items.at(index)->setFocus(); - } - else - { - //edit@12-11 超范围,滚动到最后位置 - index=items.size()-1; - items.back()->setSelected(true); - items.back()->setFocus(); - } - //PrintselectedItemInfo(); - } -} - -void FormScenedlg::PrintselectedItemInfo() -{ - foreach (QGraphicsItem *item, pPicScene->items()) { - if(item->isSelected()) - { - qDebug()<<"PrintselectedItemInfo-pos="<pos(); - //qDebug()<<"PrintselectedItemInfo-pos="<views().front()->mapFromScene(item->pos()); - break; - } - } -} -//edit@12-11 自动调整元素位置到原点 -void FormScenedlg::adjustItemsPos(bool bMoveScrollBar) -{ - - auto items = pPicScene->items(); - - // if(!items.isEmpty()){ - // pViewer->centerOn(items.first()); - // auto i = items.first(); - // if(i->flags() & QGraphicsItem::ItemIgnoresTransformations) - // qDebug() << "ItemIgnoresTransformations"; - - // pPicScene->update(); - // return; - // } - - if(bMoveScrollBar) - { - pViewer->verticalScrollBar()->setValue(0); - pViewer->horizontalScrollBar()->setValue(0); - } - - QPointF movePoint; - const QRectF sceneRect=pPicScene->sceneRect(); - qreal left=sceneRect.width(),top=sceneRect.width(); - foreach (const QGraphicsItem *item, pPicScene->items()) { - left=qMin(left,item->pos().x()); - top=qMin(top,item->pos().y()); - } - foreach (QGraphicsItem *item, pPicScene->items()) { - QPointF oldpos=item->pos(); - //oldpos=QPointF(qCeil(oldpos.x()-left-1),qCeil(oldpos.y()-(top-pViewer->mapToScene(0,0).y()+1))); - oldpos=QPointF(qCeil(oldpos.x()-left),qCeil(oldpos.y()-(top-pViewer->mapToScene(0,0).y()))); - item->setPos(oldpos); - if(item->isSelected())movePoint=oldpos; - } - - if(bMoveScrollBar) - { - //pViewer->verticalScrollBar()->setValue(0); - //pViewer->horizontalScrollBar()->setValue(0); - - if(0mapFromScene(movePoint.x(),movePoint.y()); - //pViewer->verticalScrollBar()->setValue(movePoint.y()); - pViewer->horizontalScrollBar()->setValue(movePoint.x()); - } - } - - if(!pPicScene->items().empty())pPicScene->update(); - - //qDebug()<<"adjustItemsPos="<count(); ++i) { - QLayoutItem *item = layout->itemAt(i); - if (QWidget *widget = item->widget()) { - visible?widget->show():widget->hide(); - } else if (QLayout *subLayout = item->layout()) { - showQLayout(subLayout,visible); - } - } -} - -QObject *FormScenedlg::findChildAll(const QLayout *layout,const QString &name) -{ - for (int i = 0; i < layout->count(); ++i) { - QLayoutItem *item = layout->itemAt(i); - if (QObject *widget = item->widget()) { - if(widget->objectName()==name)return widget; - } else if (QLayout *subLayout = item->layout()) { - if(subLayout->objectName()==name)return subLayout; - QObject *q= findChildAll(subLayout,name); - if(q)return q;continue; - } - } - return 0; -} -void FormScenedlg::onFileOpen(QString filePath,bool ){ - pPicScene->clearSelection(); - QString html = ""; - textEdit->setHtml (html); - textItem = new PicTextItem(); - pPicScene->addItem(textItem); - QList items = pPicScene->items(); - if(pPicScene->items().count()>1){ - QRectF itemRect= items.at(1)->boundingRect(); - textItem->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y()); - } - else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 - textItem->setSelected(true); - textItem->setHtml(textEdit->toHtml()); -} - -void FormScenedlg::reset_showTextWidthHeight() -{ - const QRectF BoundingRect=pPicScene->itemsBoundingRect(); - QLabel *labelTextWidthHeight=dynamic_cast(FormScenedlg::findChildAll(tabMainWindow->layout(),"labelTextWidthHeight")); - if(labelTextWidthHeight && 1items()) { - if(item->x()<0)item->setX(0); - if(item->y()<0)item->setY(0); - //const int i=-1==((QGraphicsTextItem*)item)->toHtml().indexOf("img ",0,Qt::CaseInsensitive)?0:1; - const int i=-1==((QGraphicsTextItem*)item)->toHtml().indexOf("home/plg/doc/",0,Qt::CaseInsensitive)?0:1; - if(item->sceneBoundingRect().bottom()>bottomItem[i]) - { - bottomItem[i]=item->sceneBoundingRect().bottom(); - } - } - QString newText; - int HighlightedValue= BoundingRect.height(); - newText = tr("[ %1行 x %2列 ]").arg(HighlightedValue).arg(BoundingRect.width()); - - const QString oldText=labelTextWidthHeight->text(); - if(32setText(tr("

[ %1行 x %2列 ]

") - .arg(HighlightedValue).arg(qCeil(BoundingRect.width()))); - } - else - { - labelTextWidthHeight->setText(newText); - } - - if(oldText!=newText) - { - //QTimer::singleShot(10,this,SLOT(adjustItemsPos())); - QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); - } - } -} - -void FormScenedlg::on_itemFirst_clicked() -{ - int index=-1; - const QRectF sceneRect=pPicScene->sceneRect(); - qreal left=sceneRect.width(); - QList allitems=pPicScene->items(); - for(int i =0;iclearFocus(); - allitems.at(i)->setSelected(false); - if(left>allitems.at(i)->pos().x()) - { - index=i; - left=allitems.at(i)->pos().x(); - } - } - if(-1!=index)pPicScene->items().at(index)->setSelected(true); - adjustItemsPos(); -} - -void FormScenedlg::on_itemLast_clicked() -{ - pPicScene->clearSelection(); - int index=-1; - const QRectF sceneRect=pPicScene->sceneRect(); - qreal left=0; - QList allitems=pPicScene->items(); - for(int i =0;iclearFocus(); - allitems.at(i)->setSelected(false); - if(leftpos().x()) - { - index=i; - left=allitems.at(i)->pos().x(); - } - } - if(-1!=index)pPicScene->items().at(index)->setSelected(true); - adjustItemsPos(); -} - -//void FormScenedlg::onSceneRectChanged(const QString &text) -//{ -// qDebug()<<"FormScenedlg::sceneRectChanged="; -//} +#include "formscenedlg.h" +#include "ui_formscenedlg.h" +#include +#include +#include +#include +#include "MyInputMethod.h" + +FormScenedlg::FormScenedlg(QWidget *parent) : + QWidget(parent), + ui(new Ui::FormScenedlg),pPicScene(0),tabMainWindow(0),dialogFileOperation(0),textEdit(0) +{ + ui->setupUi(this); + SWmaximumSize1={}; + SWgeometry1={}; + FVgeometry2={}; + GVgeometry3={}; + + + QPushButton *btnArray[]={ + // ui->KeyDown, + // ui->KeyLeft, + // ui->KeyRight, + // ui->KeyUp, + ui->itemLast, + ui->itemFirst, + ui->saveAsButton, + ui->saveButton, + ui->addButton, + //ui->itemPrev, + //ui->itemNext, + ui->previewButton, + ui->newfileButton, + ui->openfileButton, + ui->delButton, + ui->EditItemButton, + ui->insertImage, + ui->reduceButton, + ui->enlargeButton, + ui->ZoomOrigin + }; + + const QString sysfamily=qApp->font().family(); + + for(int i=0;iZoomOrigin->font(); // 获取当前字体 + const int defaultPointSize=16;//font.pointSize()<10?10:font.pointSize(); + + if(Public::ReadLanguageName()=="English"){ + font.setFamily("Arial"); + } +// font.setFamily("WenQuanYiMH"); + //font.setFamily("wenquanyi"); + font.setBold(true); + font.setPointSize(1*defaultPointSize); // 设置字体大小为12点 + font.setWeight(QFont::Black); + btnArray[i]->setFont(font); // 应用新字体到按钮 + } + + //不显示测试按钮 + ui->itemPrev->setVisible(false); + ui->itemNext->setVisible(false); + ui->ZoomOrigin->setVisible(false); + ui->btn_test2->setVisible(false); + +} + +FormScenedlg::~FormScenedlg() +{ + delete ui; + delete dialogFileOperation; + dialogFileOperation=0; +} +void FormScenedlg::horizontalScrollBar_valueChanged(int value) +{ + QTimer::singleShot(100,this,SLOT(sceneRectChanged_timerHandler())); +} + +void FormScenedlg::verticalScrollBar_valueChanged(int value) +{ + QTimer::singleShot(100,this,SLOT(sceneRectChanged_timerHandler())); +} + +void FormScenedlg::bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit){ + this->pPicScene = pPicScene; + this->pViewer = pGraphicViewer; + this->textEdit = pTextEdit; + + QObject::connect(pViewer->verticalScrollBar(), SIGNAL(valueChanged(int)), this,SLOT(verticalScrollBar_valueChanged(int))); + QObject::connect(pViewer->horizontalScrollBar(), SIGNAL(valueChanged(int)), this,SLOT(horizontalScrollBar_valueChanged(int))); + + dialogFileOperation = new DialogFileOperation(0); + dialogFileOperation->setWindowTitle(tr("插入图片")); +// connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool))); + //Scene Test + connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SIGNAL(insertImage(QString,bool))); + + + + //edit@12-12读取旧的布局信息 + const QStackedWidget* pStackedWidget= static_cast(this->pViewer->parentWidget()->parentWidget()); + const QWidget* fileSceneViewer = static_cast(this->pViewer->parentWidget()); + if(pStackedWidget && fileSceneViewer) + { + tabMainWindow=fileSceneViewer->parentWidget()->parentWidget(); + SWmaximumSize1=pStackedWidget->maximumSize(); + SWgeometry1=pStackedWidget->geometry(); + + //QSize FVmaximumSize=fileSceneViewer->maximumSize(); + FVgeometry2=fileSceneViewer->geometry(); + + //QSize GVmaximumSize=this->pViewer->maximumSize(); + GVgeometry3=this->pViewer->geometry(); + + //qDebug()<<"1-2-3-size="<pViewer && this->pPicScene) +// { +// const QPoint originScene=pViewer->mapFromScene(0,0); +// if(originScene!=lastOriginScene) +// { +// lastOriginScene=originScene; + this->pPicScene->update(); +// //qDebug()<<"sceneRectChanged-update="<setMaximumSize(SWmaximumSize1.width(),SWmaximumSize1.height()+150); + pStackedWidget->setGeometry(SWgeometry1.x(),SWgeometry1.y(),SWgeometry1.width(),SWgeometry1.height()+150); + fileSceneViewer->setGeometry(FVgeometry2.x(),FVgeometry2.y(),FVgeometry2.width(),FVgeometry2.height()+150); + this->pViewer->setGeometry(GVgeometry3.x(),GVgeometry3.y(),GVgeometry3.width(),GVgeometry3.height()+80); + } + +} +//edit@12-12 恢复布局 +void FormScenedlg::Layout_ToDefault() +{ + QStackedWidget* pStackedWidget= static_cast(this->pViewer->parentWidget()->parentWidget()); + QWidget* fileSceneViewer = static_cast(this->pViewer->parentWidget()); + + //QWidget *tabMainWindow=fileSceneViewer->parentWidget()->parentWidget(); + QHBoxLayout *horizontalLayout=dynamic_cast(FormScenedlg::findChildAll(tabMainWindow->layout(),"horizontalLayout"));//edit@12-14 信息提示栏 + FormScenedlg::showQLayout(horizontalLayout,true); + + if(pStackedWidget && fileSceneViewer) + { + pStackedWidget->setMaximumSize(SWmaximumSize1); + pStackedWidget->setGeometry(SWgeometry1); + fileSceneViewer->setGeometry(FVgeometry2); + this->pViewer->setGeometry(GVgeometry3); + } +} + +void FormScenedlg::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void FormScenedlg::on_addButton_clicked() +{ + emit addButton(); +} + +void FormScenedlg::on_EditItemButton_clicked() +{ + emit EditItemButton(); +} + +void FormScenedlg::on_delButton_clicked() +{ + emit delButton(); +} + +void FormScenedlg::on_newfileButton_clicked() +{ +emit newfileButton(); +} + +void FormScenedlg::on_openfileButton_clicked() +{ +emit openfileButton(); +} + +void FormScenedlg::on_previewButton_clicked() +{ + pPicScene->clearSelection(); + foreach (QGraphicsItem *item, pPicScene->items()) { + item->clearFocus(); + item->setSelected(false); + } + //ui->previewButton->setFocus(); + emit previewButton(); +} + +void FormScenedlg::on_saveButton_clicked() +{ +emit saveButton(); +} + +void FormScenedlg::on_saveAsButton_clicked() +{ +emit saveAsButton(); +} +//edit@12-06 放大 +void FormScenedlg::on_enlargeButton_clicked() +{ + emit enlargeButton(); + adjustItemsPos(); + //QTimer::singleShot(100,this,SLOT(adjustItemsPos())); +} + +void FormScenedlg::on_reduceButton_clicked() +{ + emit reduceButton(); + adjustItemsPos(); + //QTimer::singleShot(100,this,SLOT(adjustItemsPos())); +} + +void FormScenedlg::on_KeyLeft_clicked() +{ + pViewer->setFocus(); +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier); +#endif + //QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); +} + +void FormScenedlg::on_KeyUp_clicked() +{ + pViewer->setFocus(); +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier); +#endif +//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); +} + +void FormScenedlg::on_KeyRight_clicked() +{ + pViewer->setFocus(); +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier); +#endif +//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); +} + +void FormScenedlg::on_KeyDown_clicked() +{ + pViewer->setFocus(); +#ifndef Q_OS_WIN32 + //QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件 + MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier); +#endif +//QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); +} + +void FormScenedlg::on_insertImage_clicked() +{ + if(dialogFileOperation) + { + dialogFileOperation->refreshListView(PICFILE); + dialogFileOperation->exec(); + } +} + +void FormScenedlg::on_ZoomOrigin_clicked() +{ + adjustItemsPos(false); +} + +void FormScenedlg::on_btn_test2_clicked() +{ + emit ZoomOrigin(); + +} + +//edit@12-11 选中下一个图元 +void FormScenedlg::on_itemNext_clicked() +{ + QList items=pPicScene->items(); + if(!items.empty()) + { + int index=0; + for(index=0;indexisSelected())break; + } + + pPicScene->clearSelection(); + if(index+1setSelected(true); + items.at(index)->setFocus(); + } + else + { + //edit@12-11 超范围,滚动到第一个 + index=0; + items.front()->setSelected(true); + items.front()->setFocus(); + } + //PrintselectedItemInfo(); + + } +} + +//edit@12-11选中上一个图元 +void FormScenedlg::on_itemPrev_clicked() +{ + QList items=pPicScene->items(); + if(!items.empty()) + { + int index=0; + for(index=0;indexisSelected())break; + } + + pPicScene->clearSelection(); + if(0<=index-1) + { + index-=1; + //edit@12-11选中前一个 + items.at(index)->setSelected(true); + items.at(index)->setFocus(); + } + else + { + //edit@12-11 超范围,滚动到最后位置 + index=items.size()-1; + items.back()->setSelected(true); + items.back()->setFocus(); + } + //PrintselectedItemInfo(); + } +} + +void FormScenedlg::PrintselectedItemInfo() +{ + foreach (QGraphicsItem *item, pPicScene->items()) { + if(item->isSelected()) + { + qDebug()<<"PrintselectedItemInfo-pos="<pos(); + //qDebug()<<"PrintselectedItemInfo-pos="<views().front()->mapFromScene(item->pos()); + break; + } + } +} +//edit@12-11 自动调整元素位置到原点 +void FormScenedlg::adjustItemsPos(bool bMoveScrollBar) +{ + + auto items = pPicScene->items(); + + // if(!items.isEmpty()){ + // pViewer->centerOn(items.first()); + // auto i = items.first(); + // if(i->flags() & QGraphicsItem::ItemIgnoresTransformations) + // qDebug() << "ItemIgnoresTransformations"; + + // pPicScene->update(); + // return; + // } + + if(bMoveScrollBar) + { + pViewer->verticalScrollBar()->setValue(0); + pViewer->horizontalScrollBar()->setValue(0); + } + + QPointF movePoint; + const QRectF sceneRect=pPicScene->sceneRect(); + qreal left=sceneRect.width(),top=sceneRect.width(); + foreach (const QGraphicsItem *item, pPicScene->items()) { + left=qMin(left,item->pos().x()); + top=qMin(top,item->pos().y()); + } + foreach (QGraphicsItem *item, pPicScene->items()) { + QPointF oldpos=item->pos(); + //oldpos=QPointF(qCeil(oldpos.x()-left-1),qCeil(oldpos.y()-(top-pViewer->mapToScene(0,0).y()+1))); + oldpos=QPointF(qCeil(oldpos.x()-left),qCeil(oldpos.y()-(top-pViewer->mapToScene(0,0).y()))); + item->setPos(oldpos); + if(item->isSelected())movePoint=oldpos; + } + + if(bMoveScrollBar) + { + //pViewer->verticalScrollBar()->setValue(0); + //pViewer->horizontalScrollBar()->setValue(0); + + if(0mapFromScene(movePoint.x(),movePoint.y()); + //pViewer->verticalScrollBar()->setValue(movePoint.y()); + pViewer->horizontalScrollBar()->setValue(movePoint.x()); + } + } + + if(!pPicScene->items().empty())pPicScene->update(); + + //qDebug()<<"adjustItemsPos="<count(); ++i) { + QLayoutItem *item = layout->itemAt(i); + if (QWidget *widget = item->widget()) { + visible?widget->show():widget->hide(); + } else if (QLayout *subLayout = item->layout()) { + showQLayout(subLayout,visible); + } + } +} + +QObject *FormScenedlg::findChildAll(const QLayout *layout,const QString &name) +{ + for (int i = 0; i < layout->count(); ++i) { + QLayoutItem *item = layout->itemAt(i); + if (QObject *widget = item->widget()) { + if(widget->objectName()==name)return widget; + } else if (QLayout *subLayout = item->layout()) { + if(subLayout->objectName()==name)return subLayout; + QObject *q= findChildAll(subLayout,name); + if(q)return q;continue; + } + } + return 0; +} +void FormScenedlg::onFileOpen(QString filePath,bool ){ + pPicScene->clearSelection(); + QString html = ""; + textEdit->setHtml (html); + textItem = new PicTextItem(); + pPicScene->addItem(textItem); + QList items = pPicScene->items(); + if(pPicScene->items().count()>1){ + QRectF itemRect= items.at(1)->boundingRect(); + textItem->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y()); + } + else textItem->setPos(this->pViewer->mapToScene(0,0));//edit@12-07 + textItem->setSelected(true); + textItem->setHtml(textEdit->toHtml()); +} + +void FormScenedlg::reset_showTextWidthHeight() +{ + const QRectF BoundingRect=pPicScene->itemsBoundingRect(); + QLabel *labelTextWidthHeight=dynamic_cast(FormScenedlg::findChildAll(tabMainWindow->layout(),"labelTextWidthHeight")); + if(labelTextWidthHeight && 1items()) { + if(item->x()<0)item->setX(0); + if(item->y()<0)item->setY(0); + //const int i=-1==((QGraphicsTextItem*)item)->toHtml().indexOf("img ",0,Qt::CaseInsensitive)?0:1; + const int i=-1==((QGraphicsTextItem*)item)->toHtml().indexOf("home/plg/doc/",0,Qt::CaseInsensitive)?0:1; + if(item->sceneBoundingRect().bottom()>bottomItem[i]) + { + bottomItem[i]=item->sceneBoundingRect().bottom(); + } + } + QString newText; + int HighlightedValue= BoundingRect.height(); + newText = tr("[ %1行 x %2列 ]").arg(HighlightedValue).arg(BoundingRect.width()); + + const QString oldText=labelTextWidthHeight->text(); + if(32setText(tr("

[ %1行 x %2列 ]

") + .arg(HighlightedValue).arg(qCeil(BoundingRect.width()))); + } + else + { + labelTextWidthHeight->setText(newText); + } + + if(oldText!=newText) + { + //QTimer::singleShot(10,this,SLOT(adjustItemsPos())); + QTimer::singleShot(10,this,SLOT(adjustItemsPosFalse())); + } + } +} + +void FormScenedlg::on_itemFirst_clicked() +{ + int index=-1; + const QRectF sceneRect=pPicScene->sceneRect(); + qreal left=sceneRect.width(); + QList allitems=pPicScene->items(); + for(int i =0;iclearFocus(); + allitems.at(i)->setSelected(false); + if(left>allitems.at(i)->pos().x()) + { + index=i; + left=allitems.at(i)->pos().x(); + } + } + if(-1!=index)pPicScene->items().at(index)->setSelected(true); + adjustItemsPos(); +} + +void FormScenedlg::on_itemLast_clicked() +{ + pPicScene->clearSelection(); + int index=-1; + const QRectF sceneRect=pPicScene->sceneRect(); + qreal left=0; + QList allitems=pPicScene->items(); + for(int i =0;iclearFocus(); + allitems.at(i)->setSelected(false); + if(leftpos().x()) + { + index=i; + left=allitems.at(i)->pos().x(); + } + } + if(-1!=index)pPicScene->items().at(index)->setSelected(true); + adjustItemsPos(); +} + +//void FormScenedlg::onSceneRectChanged(const QString &text) +//{ +// qDebug()<<"FormScenedlg::sceneRectChanged="; +//} diff --git a/scene/formscenedlg.h b/scene/formscenedlg.h index 92ea830..4cf956e 100644 --- a/scene/formscenedlg.h +++ b/scene/formscenedlg.h @@ -1,128 +1,128 @@ -#ifndef FORMSCENEDLG_H -#define FORMSCENEDLG_H - -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include "picscene.h" -#include "DialogFileOperation.h" -#include "pictextitem.h" -#include "myinclude.h" -#include "Public.h" -namespace Ui { -class FormScenedlg; -} - -class FormScenedlg : public QWidget -{ - Q_OBJECT - -public: - explicit FormScenedlg(QWidget *parent = 0); - ~FormScenedlg(); - void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit); - - - static void showQLayout(QLayout *layout, bool visible=true); - static QObject *findChildAll(const QLayout *layout, const QString &name); - void Layout_ToNew(); - void Layout_ToDefault(); -public slots: -//void onSceneRectChanged(const QString &text); -protected: - void changeEvent(QEvent *e); - -signals: - void delButton(); - void saveButton(); - void openfileButton(); - void previewButton(); - void addButton(); - void EditItemButton(); - void saveAsButton(); - void newfileButton(); - void enlargeButton(); - void reduceButton(); - void ZoomOrigin(); - void btn_test2(); - void insertImage(QString,bool); -private slots: - void on_addButton_clicked(); - - void on_EditItemButton_clicked(); - - void on_delButton_clicked(); - - void on_newfileButton_clicked(); - - void on_openfileButton_clicked(); - - void on_previewButton_clicked(); - - void on_saveButton_clicked(); - - void on_saveAsButton_clicked(); - - void on_enlargeButton_clicked(); - - void on_reduceButton_clicked(); - - void on_KeyLeft_clicked(); - - void on_KeyUp_clicked(); - - void on_KeyRight_clicked(); - - void on_KeyDown_clicked(); - - void on_insertImage_clicked(); - - void on_ZoomOrigin_clicked(); - - void on_btn_test2_clicked(); - - void on_itemNext_clicked(); - - void on_itemPrev_clicked(); - - void PrintselectedItemInfo(); - void adjustItemsPos(bool bMoveScrollBar=true); - void adjustItemsPosFalse(){adjustItemsPos(false);} - void sceneRectChanged_timerHandler(); - void verticalScrollBar_valueChanged(int value); - void horizontalScrollBar_valueChanged(int value); - void onFileOpen(QString filePath, bool insertFlag); - void reset_showTextWidthHeight(); - void on_itemFirst_clicked(); - - void on_itemLast_clicked(); - - -private: - Ui::FormScenedlg *ui; - PicScene *pPicScene; - QGraphicsView *pViewer; - - QSize SWmaximumSize1; - QRect SWgeometry1; - QRect FVgeometry2; - QRect GVgeometry3; - QPoint lastOriginScene; - QWidget *tabMainWindow; - DialogFileOperation *dialogFileOperation; - QTextEdit *textEdit; - PicTextItem *textItem; - - - // QWidget interface -protected: -}; - -#endif // FORMSCENEDLG_H +#ifndef FORMSCENEDLG_H +#define FORMSCENEDLG_H + +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include "picscene.h" +#include "DialogFileOperation.h" +#include "pictextitem.h" +#include "myinclude.h" +#include "Public.h" +namespace Ui { +class FormScenedlg; +} + +class FormScenedlg : public QWidget +{ + Q_OBJECT + +public: + explicit FormScenedlg(QWidget *parent = 0); + ~FormScenedlg(); + void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit); + + + static void showQLayout(QLayout *layout, bool visible=true); + static QObject *findChildAll(const QLayout *layout, const QString &name); + void Layout_ToNew(); + void Layout_ToDefault(); +public slots: +//void onSceneRectChanged(const QString &text); +protected: + void changeEvent(QEvent *e); + +signals: + void delButton(); + void saveButton(); + void openfileButton(); + void previewButton(); + void addButton(); + void EditItemButton(); + void saveAsButton(); + void newfileButton(); + void enlargeButton(); + void reduceButton(); + void ZoomOrigin(); + void btn_test2(); + void insertImage(QString,bool); +private slots: + void on_addButton_clicked(); + + void on_EditItemButton_clicked(); + + void on_delButton_clicked(); + + void on_newfileButton_clicked(); + + void on_openfileButton_clicked(); + + void on_previewButton_clicked(); + + void on_saveButton_clicked(); + + void on_saveAsButton_clicked(); + + void on_enlargeButton_clicked(); + + void on_reduceButton_clicked(); + + void on_KeyLeft_clicked(); + + void on_KeyUp_clicked(); + + void on_KeyRight_clicked(); + + void on_KeyDown_clicked(); + + void on_insertImage_clicked(); + + void on_ZoomOrigin_clicked(); + + void on_btn_test2_clicked(); + + void on_itemNext_clicked(); + + void on_itemPrev_clicked(); + + void PrintselectedItemInfo(); + void adjustItemsPos(bool bMoveScrollBar=true); + void adjustItemsPosFalse(){adjustItemsPos(false);} + void sceneRectChanged_timerHandler(); + void verticalScrollBar_valueChanged(int value); + void horizontalScrollBar_valueChanged(int value); + void onFileOpen(QString filePath, bool insertFlag); + void reset_showTextWidthHeight(); + void on_itemFirst_clicked(); + + void on_itemLast_clicked(); + + +private: + Ui::FormScenedlg *ui; + PicScene *pPicScene; + QGraphicsView *pViewer; + + QSize SWmaximumSize1; + QRect SWgeometry1; + QRect FVgeometry2; + QRect GVgeometry3; + QPoint lastOriginScene; + QWidget *tabMainWindow; + DialogFileOperation *dialogFileOperation; + QTextEdit *textEdit; + PicTextItem *textItem; + + + // QWidget interface +protected: +}; + +#endif // FORMSCENEDLG_H diff --git a/scene/formscenedlg.ui b/scene/formscenedlg.ui index 250c477..1d253e3 100644 --- a/scene/formscenedlg.ui +++ b/scene/formscenedlg.ui @@ -1,866 +1,866 @@ - - - FormScenedlg - - - - 0 - 0 - 800 - 258 - - - - Form - - - - - 510 - 90 - 281 - 161 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 10 - - - 18 - - - - - - 60 - 60 - - - - - - - - :/icon/keydown.png:/icon/keydown.png - - - - - - - - 60 - 60 - - - - - :/icon/keyleft.png:/icon/keyleft.png - - - - - - - - 60 - 60 - - - - - :/icon/keyright.png:/icon/keyright.png - - - - - - - - 60 - 60 - - - - - - - - :/icon/keyup.png:/icon/keyup.png - - - - - - - - 60 - 60 - - - - Qt::RightToLeft - - - QPushButton{spacing:0px;} - - - Last - - - - :/icon/keyend.png:/icon/keyend.png - - - - - - - - 60 - 60 - - - - First - - - - :/icon/keyhome.png:/icon/keyhome.png - - - - - - - - true - - - - 425 - 189 - 71 - 41 - - - - font: 800 16pt "wenquanyi"; - - - 重置位置 - - - - - - 430 - 50 - 61 - 101 - - - - Test2 - - - - - true - - - - 150 - 170 - 131 - 81 - - - - - 0 - 60 - - - - 另存为 - - - - - true - - - - 11 - 170 - 131 - 81 - - - - - 0 - 60 - - - - 保存 - - - - - - 11 - 0 - 131 - 81 - - - - - 60 - 60 - - - - - - - - - 0 - 0 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 127 - 255 - 191 - - - - - - - 106 - 212 - 159 - - - - - - - 42 - 85 - 63 - - - - - - - 56 - 113 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 170 - 212 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 127 - 255 - 191 - - - - - - - 106 - 212 - 159 - - - - - - - 42 - 85 - 63 - - - - - - - 56 - 113 - 84 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 170 - 212 - 191 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 42 - 85 - 63 - - - - - - - 85 - 170 - 127 - - - - - - - 127 - 255 - 191 - - - - - - - 106 - 212 - 159 - - - - - - - 42 - 85 - 63 - - - - - - - 56 - 113 - 84 - - - - - - - 42 - 85 - 63 - - - - - - - 255 - 255 - 255 - - - - - - - 42 - 85 - 63 - - - - - - - 85 - 170 - 127 - - - - - - - 85 - 170 - 127 - - - - - - - 0 - 0 - 0 - - - - - - - 85 - 170 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - 预览 - - - - - true - - - - 11 - 84 - 131 - 81 - - - - - 0 - 60 - - - - QPushButton#evilButton { - background-color: blue; - border-style: outset; - border-width: 2px; - border-radius: 10px; - border-color: beige; - font: bold 14px; - min-width: 10em; - padding: 6px; -} -QPushButton#evilButton:pressed { - background-color: rgb(224, 0, 0); - border-style: inset; -} - - - 新增图元 - - - - - - 480 - 230 - 16 - 16 - - - - Next-item - - - - - true - - - - 150 - 0 - 131 - 81 - - - - - 0 - 60 - - - - 新建 - - - - - true - - - - 290 - 0 - 131 - 81 - - - - - 0 - 60 - - - - 打开 - - - - - true - - - - 290 - 170 - 131 - 81 - - - - - 0 - 60 - - - - 删除图元 - - - - - true - - - - 290 - 84 - 131 - 81 - - - - - 0 - 60 - - - - 编辑图元 - - - - - true - - - - 150 - 84 - 131 - 81 - - - - - 0 - 60 - - - - 插入图像 - - - - - - 460 - 230 - 16 - 16 - - - - Prev-item - - - - - - 510 - 0 - 131 - 81 - - - - 场景缩小 - - - - - - 660 - 0 - 131 - 81 - - - - Qt::LeftToRight - - - 场景放大 - - - - - - - - + + + FormScenedlg + + + + 0 + 0 + 800 + 258 + + + + Form + + + + + 510 + 90 + 281 + 161 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 10 + + + 18 + + + + + + 60 + 60 + + + + + + + + :/icon/keydown.png:/icon/keydown.png + + + + + + + + 60 + 60 + + + + + :/icon/keyleft.png:/icon/keyleft.png + + + + + + + + 60 + 60 + + + + + :/icon/keyright.png:/icon/keyright.png + + + + + + + + 60 + 60 + + + + + + + + :/icon/keyup.png:/icon/keyup.png + + + + + + + + 60 + 60 + + + + Qt::RightToLeft + + + QPushButton{spacing:0px;} + + + Last + + + + :/icon/keyend.png:/icon/keyend.png + + + + + + + + 60 + 60 + + + + First + + + + :/icon/keyhome.png:/icon/keyhome.png + + + + + + + + true + + + + 425 + 189 + 71 + 41 + + + + font: 800 16pt "wenquanyi"; + + + 重置位置 + + + + + + 430 + 50 + 61 + 101 + + + + Test2 + + + + + true + + + + 150 + 170 + 131 + 81 + + + + + 0 + 60 + + + + 另存为 + + + + + true + + + + 11 + 170 + 131 + 81 + + + + + 0 + 60 + + + + 保存 + + + + + + 11 + 0 + 131 + 81 + + + + + 60 + 60 + + + + + + + + + 0 + 0 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 127 + 255 + 191 + + + + + + + 106 + 212 + 159 + + + + + + + 42 + 85 + 63 + + + + + + + 56 + 113 + 84 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 0 + 0 + + + + + + + 170 + 212 + 191 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 127 + 255 + 191 + + + + + + + 106 + 212 + 159 + + + + + + + 42 + 85 + 63 + + + + + + + 56 + 113 + 84 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 0 + 0 + + + + + + + 170 + 212 + 191 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 42 + 85 + 63 + + + + + + + 85 + 170 + 127 + + + + + + + 127 + 255 + 191 + + + + + + + 106 + 212 + 159 + + + + + + + 42 + 85 + 63 + + + + + + + 56 + 113 + 84 + + + + + + + 42 + 85 + 63 + + + + + + + 255 + 255 + 255 + + + + + + + 42 + 85 + 63 + + + + + + + 85 + 170 + 127 + + + + + + + 85 + 170 + 127 + + + + + + + 0 + 0 + 0 + + + + + + + 85 + 170 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + 预览 + + + + + true + + + + 11 + 84 + 131 + 81 + + + + + 0 + 60 + + + + QPushButton#evilButton { + background-color: blue; + border-style: outset; + border-width: 2px; + border-radius: 10px; + border-color: beige; + font: bold 14px; + min-width: 10em; + padding: 6px; +} +QPushButton#evilButton:pressed { + background-color: rgb(224, 0, 0); + border-style: inset; +} + + + 新增图元 + + + + + + 480 + 230 + 16 + 16 + + + + Next-item + + + + + true + + + + 150 + 0 + 131 + 81 + + + + + 0 + 60 + + + + 新建 + + + + + true + + + + 290 + 0 + 131 + 81 + + + + + 0 + 60 + + + + 打开 + + + + + true + + + + 290 + 170 + 131 + 81 + + + + + 0 + 60 + + + + 删除图元 + + + + + true + + + + 290 + 84 + 131 + 81 + + + + + 0 + 60 + + + + 编辑图元 + + + + + true + + + + 150 + 84 + 131 + 81 + + + + + 0 + 60 + + + + 插入图像 + + + + + + 460 + 230 + 16 + 16 + + + + Prev-item + + + + + + 510 + 0 + 131 + 81 + + + + 场景缩小 + + + + + + 660 + 0 + 131 + 81 + + + + Qt::LeftToRight + + + 场景放大 + + + + + + + + diff --git a/scene/myview.cpp b/scene/myview.cpp index 50f29b5..c963465 100644 --- a/scene/myview.cpp +++ b/scene/myview.cpp @@ -1,64 +1,64 @@ -#include "myview.h" -#include -#include "picscene.h" -#include -MyView::MyView(QWidget *parent) : - QGraphicsView(parent) -{ - zoomRatio = 1; - //setDragMode(QGraphicsView::ScrollHandDrag);//手型拖动 - //setAlignment(Qt::AlignLeft | Qt::AlignTop); - //setFocusPolicy( Qt::NoFocus ); -} -static float a = 1.61; -void MyView::ZoomOut(void) -{ - if(zoomRatio < 6) - { - zoomRatio++; -// scale(2,2); - scale(a,a); - } -} - -void MyView::ZoomIn(void) -{ - if(zoomRatio > 2) - { - zoomRatio--; - scale(1/a,1/a); - } -} - -//void MyView::wheelEvent(QWheelEvent*event) //滚轮事件 -//{ -//// if(event->delta() > 0) //如果鼠标滚轮远离使用者,则delta()返回正值 -//// scale(0.5,0.5); //视图缩放 -//// else scale(2,2); -//} - - -//void MyView::mousePressEvent(QMouseEvent*event) -//{ -//// rotate(90); //视图旋转顺时针90度 -//} - -void MyView::keyPressEvent(QKeyEvent *event) -{ - //event->accept(); - //parent()->event((QEvent*) event); - if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right || event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) - { - // 处理上下键事件 - PicScene* picScene = dynamic_cast(this->scene()); - if(picScene) - { - picScene->keyPressEvent(event); - } - } - else - { - // 其他键事件交给父类处理 - QGraphicsView::keyPressEvent(event); - } -} +#include "myview.h" +#include +#include "picscene.h" +#include +MyView::MyView(QWidget *parent) : + QGraphicsView(parent) +{ + zoomRatio = 1; + //setDragMode(QGraphicsView::ScrollHandDrag);//手型拖动 + //setAlignment(Qt::AlignLeft | Qt::AlignTop); + //setFocusPolicy( Qt::NoFocus ); +} +static float a = 1.61; +void MyView::ZoomOut(void) +{ + if(zoomRatio < 6) + { + zoomRatio++; +// scale(2,2); + scale(a,a); + } +} + +void MyView::ZoomIn(void) +{ + if(zoomRatio > 2) + { + zoomRatio--; + scale(1/a,1/a); + } +} + +//void MyView::wheelEvent(QWheelEvent*event) //滚轮事件 +//{ +//// if(event->delta() > 0) //如果鼠标滚轮远离使用者,则delta()返回正值 +//// scale(0.5,0.5); //视图缩放 +//// else scale(2,2); +//} + + +//void MyView::mousePressEvent(QMouseEvent*event) +//{ +//// rotate(90); //视图旋转顺时针90度 +//} + +void MyView::keyPressEvent(QKeyEvent *event) +{ + //event->accept(); + //parent()->event((QEvent*) event); + if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right || event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) + { + // 处理上下键事件 + PicScene* picScene = dynamic_cast(this->scene()); + if(picScene) + { + picScene->keyPressEvent(event); + } + } + else + { + // 其他键事件交给父类处理 + QGraphicsView::keyPressEvent(event); + } +} diff --git a/scene/myview.h b/scene/myview.h index 35f6be0..6021e8f 100644 --- a/scene/myview.h +++ b/scene/myview.h @@ -1,29 +1,29 @@ -#ifndef MYVIEW_H -#define MYVIEW_H - -#include - -class MyView : public QGraphicsView -{ - Q_OBJECT -public: - explicit MyView(QWidget *parent = 0); - - void ZoomOut(void); - void ZoomIn(void); - //char getzoomRatio(){return zoomRatio;} -private: - char zoomRatio; - -signals: - -public slots: - -protected : -// void wheelEvent(QWheelEvent *event); -// void mousePressEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - -}; - -#endif // MYVIEW_H +#ifndef MYVIEW_H +#define MYVIEW_H + +#include + +class MyView : public QGraphicsView +{ + Q_OBJECT +public: + explicit MyView(QWidget *parent = 0); + + void ZoomOut(void); + void ZoomIn(void); + //char getzoomRatio(){return zoomRatio;} +private: + char zoomRatio; + +signals: + +public slots: + +protected : +// void wheelEvent(QWheelEvent *event); +// void mousePressEvent(QMouseEvent *event); + void keyPressEvent(QKeyEvent *event); + +}; + +#endif // MYVIEW_H diff --git a/scene/picscene.cpp b/scene/picscene.cpp index 5f60f15..eaa9989 100644 --- a/scene/picscene.cpp +++ b/scene/picscene.cpp @@ -1,117 +1,117 @@ -#include "picscene.h" -#include -#include -#include -#include -PicScene::PicScene(QObject *parent) : - QGraphicsScene(parent),IsdrawBackground(false) -{ -} - -void PicScene::setMode(Mode mode) -{ - myMode = mode; -} - -void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) -{ - if (mouseEvent->button() != Qt::LeftButton) - return; - - QGraphicsScene::mousePressEvent(mouseEvent); -} - -//! [9] - -//! [10] -void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) -{ - update();//edit@12-12 - QGraphicsScene::mouseMoveEvent(mouseEvent); -} -//! [10] - -//! [11] -void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) -{ - QGraphicsScene::mouseReleaseEvent(mouseEvent); -} -//! [13] - -//! [14] -bool PicScene::isItemChange(int type) -{ - foreach (QGraphicsItem *item, selectedItems()) { - if (item->type() == type) - return true; - } - return false; -} -//! [14] - -void PicScene::keyPressEvent(QKeyEvent *event) -{ - QGraphicsScene::keyPressEvent(event); -} -//edit@12-09 -void PicScene::drawBackground(QPainter *painter, const QRectF &rect) -{ - QGraphicsScene::drawBackground(painter,rect); - - if(IsdrawBackground) - { - Q_UNUSED(rect); - QPen pen; - - const qreal left=rect.left(); - const qreal right=rect.right(); - const qreal top=rect.top(); - const qreal bottom=rect.bottom(); - - const int step=1; - //pen.setColor(QColor(60,60,60)); - pen.setColor(Qt::lightGray); - //pen.setColor(Qt::darkCyan); - pen.setWidth(0); - //pen.setStyle(Qt::DashLine); - painter->setPen(pen); - //绘制横线 - //绘制Y轴正半轴 - for(int i=0;i>=top;i-=step) - { - painter->drawLine(left,i,right,i); - } - - //绘制Y轴负半轴 - for(int i=0;i<=bottom;i+=step) - { - painter->drawLine(left,i,right,i); - } - - //绘制竖线 - //绘制X轴正半轴 - for(int i=0;i<=right;i+=step) - { - painter->drawLine(i,top,i,bottom); - } - //绘制X轴负半轴 - for(int i=0;i>=left;i-=step) - { - painter->drawLine(i,top,i,bottom); - } - - //edit@12-11 - pen.setColor(Qt::green); - painter->setPen(pen); - QRectF BoundingRect=this->itemsBoundingRect(); - BoundingRect.setHeight(32); - painter->drawRect(BoundingRect); - } - - emit showTextWidthHeight(); -} -//edit@12-09 -void PicScene::setIsdrawBackground(bool newIsdrawBackground) -{ - IsdrawBackground = newIsdrawBackground; -} +#include "picscene.h" +#include +#include +#include +#include +PicScene::PicScene(QObject *parent) : + QGraphicsScene(parent),IsdrawBackground(false) +{ +} + +void PicScene::setMode(Mode mode) +{ + myMode = mode; +} + +void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + if (mouseEvent->button() != Qt::LeftButton) + return; + + QGraphicsScene::mousePressEvent(mouseEvent); +} + +//! [9] + +//! [10] +void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + update();//edit@12-12 + QGraphicsScene::mouseMoveEvent(mouseEvent); +} +//! [10] + +//! [11] +void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + QGraphicsScene::mouseReleaseEvent(mouseEvent); +} +//! [13] + +//! [14] +bool PicScene::isItemChange(int type) +{ + foreach (QGraphicsItem *item, selectedItems()) { + if (item->type() == type) + return true; + } + return false; +} +//! [14] + +void PicScene::keyPressEvent(QKeyEvent *event) +{ + QGraphicsScene::keyPressEvent(event); +} +//edit@12-09 +void PicScene::drawBackground(QPainter *painter, const QRectF &rect) +{ + QGraphicsScene::drawBackground(painter,rect); + + if(IsdrawBackground) + { + Q_UNUSED(rect); + QPen pen; + + const qreal left=rect.left(); + const qreal right=rect.right(); + const qreal top=rect.top(); + const qreal bottom=rect.bottom(); + + const int step=1; + //pen.setColor(QColor(60,60,60)); + pen.setColor(Qt::lightGray); + //pen.setColor(Qt::darkCyan); + pen.setWidth(0); + //pen.setStyle(Qt::DashLine); + painter->setPen(pen); + //绘制横线 + //绘制Y轴正半轴 + for(int i=0;i>=top;i-=step) + { + painter->drawLine(left,i,right,i); + } + + //绘制Y轴负半轴 + for(int i=0;i<=bottom;i+=step) + { + painter->drawLine(left,i,right,i); + } + + //绘制竖线 + //绘制X轴正半轴 + for(int i=0;i<=right;i+=step) + { + painter->drawLine(i,top,i,bottom); + } + //绘制X轴负半轴 + for(int i=0;i>=left;i-=step) + { + painter->drawLine(i,top,i,bottom); + } + + //edit@12-11 + pen.setColor(Qt::green); + painter->setPen(pen); + QRectF BoundingRect=this->itemsBoundingRect(); + BoundingRect.setHeight(32); + painter->drawRect(BoundingRect); + } + + emit showTextWidthHeight(); +} +//edit@12-09 +void PicScene::setIsdrawBackground(bool newIsdrawBackground) +{ + IsdrawBackground = newIsdrawBackground; +} diff --git a/scene/picscene.h b/scene/picscene.h index 2a27f95..2a2f960 100644 --- a/scene/picscene.h +++ b/scene/picscene.h @@ -1,69 +1,69 @@ -#ifndef PICSCENE_H -#define PICSCENE_H -#include -#include "pictextitem.h" -#include - -QT_BEGIN_NAMESPACE -class QGraphicsSceneMouseEvent; -class QMenu; -class QPointF; -class QGraphicsLineItem; -class QFont; -class QGraphicsTextItem; -class QColor; -QT_END_NAMESPACE - -class PicScene : public QGraphicsScene -{ - Q_OBJECT -public: - enum Mode { InsertItem, InsertLine, InsertText, InsertPic, MoveItem }; - explicit PicScene(QObject *parent = 0); - - QFont font() const - { return myFont; } - QColor textColor() const - { return myTextColor; } - QColor itemColor() const - { return myItemColor; } - QColor lineColor() const - { return myLineColor; } - void setLineColor(const QColor &color); - void setTextColor(const QColor &color); - void setItemColor(const QColor &color); - void setFont(const QFont &font); - void keyPressEvent(QKeyEvent *event); - -public slots: - void setMode(Mode mode); - void setIsdrawBackground(bool newIsdrawBackground); -signals: - void textInserted(QGraphicsTextItem *item); - void itemSelected(QGraphicsItem *item); - void xmlContentChanged(); - void showTextWidthHeight(); - void adjustItemsPos(); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); - void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent); - void drawBackground(QPainter *painter, const QRectF &rect); -private: - bool isItemChange(int type); - - QMenu *myItemMenu; - Mode myMode; - bool leftButtonDown; - QPointF startPoint; - QGraphicsLineItem *line; - QFont myFont; - PicTextItem *textItem; - QColor myTextColor; - QColor myItemColor; - QColor myLineColor; -private: - bool IsdrawBackground; -}; -#endif // PICSCENE_H +#ifndef PICSCENE_H +#define PICSCENE_H +#include +#include "pictextitem.h" +#include + +QT_BEGIN_NAMESPACE +class QGraphicsSceneMouseEvent; +class QMenu; +class QPointF; +class QGraphicsLineItem; +class QFont; +class QGraphicsTextItem; +class QColor; +QT_END_NAMESPACE + +class PicScene : public QGraphicsScene +{ + Q_OBJECT +public: + enum Mode { InsertItem, InsertLine, InsertText, InsertPic, MoveItem }; + explicit PicScene(QObject *parent = 0); + + QFont font() const + { return myFont; } + QColor textColor() const + { return myTextColor; } + QColor itemColor() const + { return myItemColor; } + QColor lineColor() const + { return myLineColor; } + void setLineColor(const QColor &color); + void setTextColor(const QColor &color); + void setItemColor(const QColor &color); + void setFont(const QFont &font); + void keyPressEvent(QKeyEvent *event); + +public slots: + void setMode(Mode mode); + void setIsdrawBackground(bool newIsdrawBackground); +signals: + void textInserted(QGraphicsTextItem *item); + void itemSelected(QGraphicsItem *item); + void xmlContentChanged(); + void showTextWidthHeight(); + void adjustItemsPos(); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); + void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent); + void drawBackground(QPainter *painter, const QRectF &rect); +private: + bool isItemChange(int type); + + QMenu *myItemMenu; + Mode myMode; + bool leftButtonDown; + QPointF startPoint; + QGraphicsLineItem *line; + QFont myFont; + PicTextItem *textItem; + QColor myTextColor; + QColor myItemColor; + QColor myLineColor; +private: + bool IsdrawBackground; +}; +#endif // PICSCENE_H diff --git a/scene/pictextitem.cpp b/scene/pictextitem.cpp index 28c4c48..bb16b8c 100644 --- a/scene/pictextitem.cpp +++ b/scene/pictextitem.cpp @@ -1,100 +1,100 @@ -#include -#include "pictextitem.h" -#include "picscene.h" -#include "moveinput.h" - -extern MoveInput* moveInput; -PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene) : - QGraphicsTextItem(parent)//edit@02-07 -{ - setFlag(QGraphicsItem::ItemIsMovable); - setFlag(QGraphicsItem::ItemIsSelectable); - setFlag(QGraphicsItem::ItemIsFocusable); - QFont font; - font.setFamily("wenquanyi"); - font.setPixelSize(12); - document()->setDefaultStyleSheet("p { margin: 0; }"); - document()->setDocumentMargin(0); - SpecialConditions = false; - CatchCnt1CurrValue = -1; - CatchCnt1StartValue = -1; - - // 插入的变量贴底部,防止错位,修复打开文件时变量图片的垂直对齐 - document()->setDefaultStyleSheet("img { vertical-align: bottom; }"); -} -//! [1] -QVariant PicTextItem::itemChange(GraphicsItemChange change, - const QVariant &value) -{ - if (change == ItemSceneChange && scene()) { - QPointF newPos = value.toPoint(); - QRectF rect = scene()->sceneRect(); - if (!rect.contains(newPos)) { - newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left()))); - newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top()))); - } - } - return QGraphicsItem::itemChange(change, value); -} -//! [1] - -//! [2] -void PicTextItem::focusOutEvent(QFocusEvent *event) -{ - moveInput->hide(); - emit lostFocus(this); - QGraphicsTextItem::focusOutEvent(event); - // -} -//! [2] - -//! [5] -void PicTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) -{ - //if (textInteractionFlags() == Qt::NoTextInteraction) - // setTextInteractionFlags(Qt::TextEditorInteraction); - //setTextInteractionFlags(Qt::TextBrowserInteraction); - QGraphicsTextItem::mouseDoubleClickEvent(event); - //emit itemEdit(toHtml()); -} -//! [5] - -//限制图元拖动范围 -void PicTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) -{ - //edit@12-07 - QPointF newPos = this->pos(); - this->setPos(qCeil(newPos.x()),qCeil(newPos.y())); - - if(scene()) - scene()->update(); - - QGraphicsTextItem::mouseReleaseEvent(event); -} - -void PicTextItem::keyPressEvent(QKeyEvent *event) -{ - foreach (QGraphicsItem *item, scene()->selectedItems()) { - if(event->key() == Qt::Key_Left) - { - item->moveBy(-1, 0); - } - else if(event->key() == Qt::Key_Right) - { - item->moveBy(1, 0); - } - else if(event->key() == Qt::Key_Up) - { - item->moveBy(0, -1); - } - else if(event->key() == Qt::Key_Down) - { - item->moveBy(0, 1); - } - } - if(!scene()->selectedItems().empty()) - { - scene()->update(); - } - QGraphicsTextItem::keyPressEvent(event); -} +#include +#include "pictextitem.h" +#include "picscene.h" +#include "moveinput.h" + +extern MoveInput* moveInput; +PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene) : + QGraphicsTextItem(parent)//edit@02-07 +{ + setFlag(QGraphicsItem::ItemIsMovable); + setFlag(QGraphicsItem::ItemIsSelectable); + setFlag(QGraphicsItem::ItemIsFocusable); + QFont font; + font.setFamily("wenquanyi"); + font.setPixelSize(12); + document()->setDefaultStyleSheet("p { margin: 0; }"); + document()->setDocumentMargin(0); + SpecialConditions = false; + CatchCnt1CurrValue = -1; + CatchCnt1StartValue = -1; + + // 插入的变量贴底部,防止错位,修复打开文件时变量图片的垂直对齐 + document()->setDefaultStyleSheet("img { vertical-align: bottom; }"); +} +//! [1] +QVariant PicTextItem::itemChange(GraphicsItemChange change, + const QVariant &value) +{ + if (change == ItemSceneChange && scene()) { + QPointF newPos = value.toPoint(); + QRectF rect = scene()->sceneRect(); + if (!rect.contains(newPos)) { + newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left()))); + newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top()))); + } + } + return QGraphicsItem::itemChange(change, value); +} +//! [1] + +//! [2] +void PicTextItem::focusOutEvent(QFocusEvent *event) +{ + moveInput->hide(); + emit lostFocus(this); + QGraphicsTextItem::focusOutEvent(event); + // +} +//! [2] + +//! [5] +void PicTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + //if (textInteractionFlags() == Qt::NoTextInteraction) + // setTextInteractionFlags(Qt::TextEditorInteraction); + //setTextInteractionFlags(Qt::TextBrowserInteraction); + QGraphicsTextItem::mouseDoubleClickEvent(event); + //emit itemEdit(toHtml()); +} +//! [5] + +//限制图元拖动范围 +void PicTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) +{ + //edit@12-07 + QPointF newPos = this->pos(); + this->setPos(qCeil(newPos.x()),qCeil(newPos.y())); + + if(scene()) + scene()->update(); + + QGraphicsTextItem::mouseReleaseEvent(event); +} + +void PicTextItem::keyPressEvent(QKeyEvent *event) +{ + foreach (QGraphicsItem *item, scene()->selectedItems()) { + if(event->key() == Qt::Key_Left) + { + item->moveBy(-1, 0); + } + else if(event->key() == Qt::Key_Right) + { + item->moveBy(1, 0); + } + else if(event->key() == Qt::Key_Up) + { + item->moveBy(0, -1); + } + else if(event->key() == Qt::Key_Down) + { + item->moveBy(0, 1); + } + } + if(!scene()->selectedItems().empty()) + { + scene()->update(); + } + QGraphicsTextItem::keyPressEvent(event); +} diff --git a/scene/pictextitem.h b/scene/pictextitem.h index 7275216..fbb3c87 100644 --- a/scene/pictextitem.h +++ b/scene/pictextitem.h @@ -1,42 +1,42 @@ -#ifndef PICTEXTITEM_H -#define PICTEXTITEM_H - -#include -#include -#include -class QFocusEvent; -class QGraphicsItem; -class QGraphicsScene; -class QGraphicsSceneMouseEvent; - -class PicTextItem : public QGraphicsTextItem -{ - Q_OBJECT -public: - enum { Type = UserType + 3 }; - explicit PicTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); - - int type() const - { return Type; } - -signals: - void lostFocus(PicTextItem *item); - void selectedChange(QGraphicsItem *item); - void itemEdit(QString); - -protected: - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - void focusOutEvent(QFocusEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); - void keyPressEvent(QKeyEvent *event); - -public slots: - -public: - bool SpecialConditions; - int CatchCnt1StartValue; - int CatchCnt1CurrValue; - -}; -#endif // PICTEXTITEM_H +#ifndef PICTEXTITEM_H +#define PICTEXTITEM_H + +#include +#include +#include +class QFocusEvent; +class QGraphicsItem; +class QGraphicsScene; +class QGraphicsSceneMouseEvent; + +class PicTextItem : public QGraphicsTextItem +{ + Q_OBJECT +public: + enum { Type = UserType + 3 }; + explicit PicTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); + + int type() const + { return Type; } + +signals: + void lostFocus(PicTextItem *item); + void selectedChange(QGraphicsItem *item); + void itemEdit(QString); + +protected: + QVariant itemChange(GraphicsItemChange change, const QVariant &value); + void focusOutEvent(QFocusEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); + void keyPressEvent(QKeyEvent *event); + +public slots: + +public: + bool SpecialConditions; + int CatchCnt1StartValue; + int CatchCnt1CurrValue; + +}; +#endif // PICTEXTITEM_H diff --git a/scene/sceneEditOption.ui b/scene/sceneEditOption.ui index 85a09d9..a5c3791 100644 --- a/scene/sceneEditOption.ui +++ b/scene/sceneEditOption.ui @@ -1,186 +1,186 @@ - - - SceneEditOption - - - - 0 - 0 - 924 - 58 - - - - Form - - - - - - - - - 0 - 40 - - - - 预览 - - - - - - - true - - - - 0 - 40 - - - - 新建 - - - - - - - true - - - - 0 - 40 - - - - 打开 - - - - - - - true - - - - 0 - 40 - - - - 保存 - - - - - - - true - - - - 0 - 40 - - - - 另存为 - - - - - - - true - - - - 0 - 40 - - - - 新增图元 - - - - - - - true - - - - 0 - 40 - - - - 编辑图元 - - - - - - - true - - - - 0 - 40 - - - - 删除图元 - - - - - - - - 0 - 40 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - - 0 - 40 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - - - - - + + + SceneEditOption + + + + 0 + 0 + 924 + 58 + + + + Form + + + + + + + + + 0 + 40 + + + + 预览 + + + + + + + true + + + + 0 + 40 + + + + 新建 + + + + + + + true + + + + 0 + 40 + + + + 打开 + + + + + + + true + + + + 0 + 40 + + + + 保存 + + + + + + + true + + + + 0 + 40 + + + + 另存为 + + + + + + + true + + + + 0 + 40 + + + + 新增图元 + + + + + + + true + + + + 0 + 40 + + + + 编辑图元 + + + + + + + true + + + + 0 + 40 + + + + 删除图元 + + + + + + + + 0 + 40 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + + 0 + 40 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + + + + + diff --git a/scene/sceneviewwidget.cpp b/scene/sceneviewwidget.cpp index 336480d..8841843 100644 --- a/scene/sceneviewwidget.cpp +++ b/scene/sceneviewwidget.cpp @@ -1,8 +1,8 @@ -#include "sceneviewwidget.h" -#include - -SceneViewWidget::SceneViewWidget(QWidget *parent) : - QWidget(parent) -{ - -} +#include "sceneviewwidget.h" +#include + +SceneViewWidget::SceneViewWidget(QWidget *parent) : + QWidget(parent) +{ + +} diff --git a/scene/sceneviewwidget.h b/scene/sceneviewwidget.h index 66b7326..2d8473f 100644 --- a/scene/sceneviewwidget.h +++ b/scene/sceneviewwidget.h @@ -1,18 +1,18 @@ -#ifndef SCENEVIEWWIDGET_H -#define SCENEVIEWWIDGET_H - -#include -#include -class SceneViewWidget : public QWidget -{ - Q_OBJECT -public: - explicit SceneViewWidget(QWidget *parent = 0); - QGraphicsView *pView; -signals: - -public slots: - -}; - -#endif // SCENEVIEWWIDGET_H +#ifndef SCENEVIEWWIDGET_H +#define SCENEVIEWWIDGET_H + +#include +#include +class SceneViewWidget : public QWidget +{ + Q_OBJECT +public: + explicit SceneViewWidget(QWidget *parent = 0); + QGraphicsView *pView; +signals: + +public slots: + +}; + +#endif // SCENEVIEWWIDGET_H diff --git a/serial.cpp b/serial.cpp index 5ac58a8..f60bd95 100644 --- a/serial.cpp +++ b/serial.cpp @@ -1,126 +1,126 @@ -//serial.h的具体实现,要注意的地方是数据类型的转换,QLineEdit的text().toASCII返回的是QByteArray,而PortSend要发送的是 -//char类型的数据,所以就需要转换,在Qt中使用.data()就可以实现转换。还有要注意的地方就是QSocketNotifier不要忘记添加了。 -#include "serial.h" -portinfo_t portinfo = { - '0', // print prompt after receiving - 115200, // baudrate: 115200 - '8', // databit 8 - '0', // debug: off - '0', // echo off - '0', // flow control: software - '0', // default tt: SAC0 - '0', // parity: none - '1', // stopbit: 1 - 0 // reserved -}; -/* -typedef struct //define the uart value struct -{ - char prompt; //prompt after reciving data - int baudrate; //baudrate - char databit; //data bits, 5, 6, 7, 8 - char debug; //debug mode, 0: none, 1: debug - char echo; //echo mode, 0: none, 1: echo - char fctl; //flow control, 0: none, 1: hardware, 2: software - char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7 - char parity; //parity 0: none, 1: odd, 2: even - char stopbit; //stop bits, 1, 2 - //const int reserved; //reserved, must be zero - int reserved; //reserved, must be zero -}portinfo_t; - */ -static int serial_fd; -char databuffer[20]; -int datalen; -serial::serial(QWidget *parent) - : QWidget(parent) -{ - -// layout();//lay out - -// open_button->setEnabled(true); -// close_button->setEnabled(false); -// send_button->setEnabled(false); - -// connect(open_button,SIGNAL(clicked()),this,SLOT(open_serial())); -// connect(close_button,SIGNAL(clicked()),this,SLOT(close_serial())); -// connect(send_button,SIGNAL(clicked()),this,SLOT(send_setial())); - - QSocketNotifier *notifier=new QSocketNotifier(serial_fd,QSocketNotifier::Read,this); - connect(notifier,SIGNAL(activated(int)),this,SLOT(read_serial())); - read_serial(); -} -serial::~serial() -{ - -} -void serial::init_serial( int baudrate, int portNumber,int stopbit ) -{ - portinfo.baudrate = baudrate; - portinfo.tty = portNumber+'0'; - portinfo.stopbit = stopbit+'0'; - portinfo.fctl = '0'; -} -void serial::open_serial() -{ - serial_fd=PortOpen(&portinfo); - if(serial_fd<0) - { - perror("Error:open serial port error"); - //exit(1); - } - PortSet(serial_fd,&portinfo); - QSocketNotifier *notifier=new QSocketNotifier(serial_fd,QSocketNotifier::Read,this); - connect(notifier,SIGNAL(activated(int)),this,SLOT(read_serial())); - read_serial(); -} -void serial::close_serial() -{ - PortClose(serial_fd); - -} -void serial::read_serial() -{ - datalen=PortRecv(serial_fd,databuffer,10,115200); - //textbrowser->insertPlainText(databuffer); - qDebug()<<"read:"<setText("123489"); -// QVBoxLayout *vlayout1=new QVBoxLayout; -// vlayout1->addWidget(label1); -// vlayout1->addWidget(textbrowser); -// vlayout1->addWidget(label2); -// QVBoxLayout *vlayout3=new QVBoxLayout; -// vlayout3->addWidget(open_button); -// vlayout3->addWidget(close_button); -// QHBoxLayout *hlayout2=new QHBoxLayout; -// hlayout2->addLayout(vlayout1); -// hlayout2->addLayout(vlayout3); -// QHBoxLayout *hlayout1=new QHBoxLayout; -// hlayout1->addWidget(lineedit); -// hlayout1->addWidget(send_button); -// QVBoxLayout *vlayout2=new QVBoxLayout; -// vlayout2->addLayout(hlayout2); -// vlayout2->addLayout(hlayout1); -// setLayout(vlayout2); -//} - -//总结:总算完成了,前后花了两天的时候,很高兴的是自己没有放弃。至于这个串口的QT有什么用,那作用老大了,以前我用VB写过环境 -//监控系统,在PC端实现的,低下用的是ADUC824,那代码,叫宏伟啊。Qt就简单多了(站在巨人的肩膀上)。有了UART的通信,一些 -//控制类的东西都可以实现了,而且界面还可以做得要多漂亮就有多漂亮(看个人的了)。 +//serial.h的具体实现,要注意的地方是数据类型的转换,QLineEdit的text().toASCII返回的是QByteArray,而PortSend要发送的是 +//char类型的数据,所以就需要转换,在Qt中使用.data()就可以实现转换。还有要注意的地方就是QSocketNotifier不要忘记添加了。 +#include "serial.h" +portinfo_t portinfo = { + '0', // print prompt after receiving + 115200, // baudrate: 115200 + '8', // databit 8 + '0', // debug: off + '0', // echo off + '0', // flow control: software + '0', // default tt: SAC0 + '0', // parity: none + '1', // stopbit: 1 + 0 // reserved +}; +/* +typedef struct //define the uart value struct +{ + char prompt; //prompt after reciving data + int baudrate; //baudrate + char databit; //data bits, 5, 6, 7, 8 + char debug; //debug mode, 0: none, 1: debug + char echo; //echo mode, 0: none, 1: echo + char fctl; //flow control, 0: none, 1: hardware, 2: software + char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7 + char parity; //parity 0: none, 1: odd, 2: even + char stopbit; //stop bits, 1, 2 + //const int reserved; //reserved, must be zero + int reserved; //reserved, must be zero +}portinfo_t; + */ +static int serial_fd; +char databuffer[20]; +int datalen; +serial::serial(QWidget *parent) + : QWidget(parent) +{ + +// layout();//lay out + +// open_button->setEnabled(true); +// close_button->setEnabled(false); +// send_button->setEnabled(false); + +// connect(open_button,SIGNAL(clicked()),this,SLOT(open_serial())); +// connect(close_button,SIGNAL(clicked()),this,SLOT(close_serial())); +// connect(send_button,SIGNAL(clicked()),this,SLOT(send_setial())); + + QSocketNotifier *notifier=new QSocketNotifier(serial_fd,QSocketNotifier::Read,this); + connect(notifier,SIGNAL(activated(int)),this,SLOT(read_serial())); + read_serial(); +} +serial::~serial() +{ + +} +void serial::init_serial( int baudrate, int portNumber,int stopbit ) +{ + portinfo.baudrate = baudrate; + portinfo.tty = portNumber+'0'; + portinfo.stopbit = stopbit+'0'; + portinfo.fctl = '0'; +} +void serial::open_serial() +{ + serial_fd=PortOpen(&portinfo); + if(serial_fd<0) + { + perror("Error:open serial port error"); + //exit(1); + } + PortSet(serial_fd,&portinfo); + QSocketNotifier *notifier=new QSocketNotifier(serial_fd,QSocketNotifier::Read,this); + connect(notifier,SIGNAL(activated(int)),this,SLOT(read_serial())); + read_serial(); +} +void serial::close_serial() +{ + PortClose(serial_fd); + +} +void serial::read_serial() +{ + datalen=PortRecv(serial_fd,databuffer,10,115200); + //textbrowser->insertPlainText(databuffer); + qDebug()<<"read:"<setText("123489"); +// QVBoxLayout *vlayout1=new QVBoxLayout; +// vlayout1->addWidget(label1); +// vlayout1->addWidget(textbrowser); +// vlayout1->addWidget(label2); +// QVBoxLayout *vlayout3=new QVBoxLayout; +// vlayout3->addWidget(open_button); +// vlayout3->addWidget(close_button); +// QHBoxLayout *hlayout2=new QHBoxLayout; +// hlayout2->addLayout(vlayout1); +// hlayout2->addLayout(vlayout3); +// QHBoxLayout *hlayout1=new QHBoxLayout; +// hlayout1->addWidget(lineedit); +// hlayout1->addWidget(send_button); +// QVBoxLayout *vlayout2=new QVBoxLayout; +// vlayout2->addLayout(hlayout2); +// vlayout2->addLayout(hlayout1); +// setLayout(vlayout2); +//} + +//总结:总算完成了,前后花了两天的时候,很高兴的是自己没有放弃。至于这个串口的QT有什么用,那作用老大了,以前我用VB写过环境 +//监控系统,在PC端实现的,低下用的是ADUC824,那代码,叫宏伟啊。Qt就简单多了(站在巨人的肩膀上)。有了UART的通信,一些 +//控制类的东西都可以实现了,而且界面还可以做得要多漂亮就有多漂亮(看个人的了)。 diff --git a/serial.h b/serial.h index 1308356..6feda07 100644 --- a/serial.h +++ b/serial.h @@ -1,19 +1,19 @@ -#ifndef SERIAL_H -#define SERIAL_H -#include -#include "mycom.h" -class serial : public QWidget -{ - Q_OBJECT -public: - serial(QWidget *parent = 0); - ~serial(); - void init_serial( int baudrate, int portNumber,int stopbit ); - -public slots: - void open_serial(); - void close_serial(); - void read_serial(); - void send_serial(char *buf,int len); -}; -#endif // SERIAL_H +#ifndef SERIAL_H +#define SERIAL_H +#include +#include "mycom.h" +class serial : public QWidget +{ + Q_OBJECT +public: + serial(QWidget *parent = 0); + ~serial(); + void init_serial( int baudrate, int portNumber,int stopbit ); + +public slots: + void open_serial(); + void close_serial(); + void read_serial(); + void send_serial(char *buf,int len); +}; +#endif // SERIAL_H diff --git a/strip_debug.sh b/strip_debug.sh index 8ff4f83..f2c8130 100644 --- a/strip_debug.sh +++ b/strip_debug.sh @@ -1,61 +1,61 @@ -#!/bin/bash - -TOOLCHAIN="aarch64-linux-gnu-objcopy" - -if [ -n "$1" ]; then - QTUI_PATH="$1" -else - SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" - QTUI_PATH="${SCRIPT_DIR}/QtUI" -fi - -if [ ! -f "$QTUI_PATH" ]; then - echo "错误: 找不到 QtUI 文件: $QTUI_PATH" - echo "用法: $0 [QtUI路径]" - exit 1 -fi - -if ! command -v "$TOOLCHAIN" &> /dev/null; then - echo "错误: 找不到工具链 $TOOLCHAIN" - exit 1 -fi - -QTUI_DIR="$(dirname "$QTUI_PATH")" -QTUI_NAME="$(basename "$QTUI_PATH")" -QTUI_DBG="${QTUI_DIR}/${QTUI_NAME}.dbg" - -echo "目标文件: $QTUI_PATH" -echo "" - -echo "步骤 1/3: 分离调试符号..." -$TOOLCHAIN --only-keep-debug "$QTUI_PATH" "$QTUI_DBG" -if [ $? -ne 0 ]; then - echo "错误: 分离调试符号失败" - exit 1 -fi -echo "完成: $QTUI_DBG" - -echo "步骤 2/3: 移除调试符号..." -$TOOLCHAIN --strip-debug "$QTUI_PATH" "$QTUI_PATH" -if [ $? -ne 0 ]; then - echo "错误: 移除调试符号失败" - exit 1 -fi -echo "完成" - -echo "步骤 3/3: 关联调试符号文件..." -$TOOLCHAIN --add-gnu-debuglink="$QTUI_DBG" "$QTUI_PATH" -if [ $? -ne 0 ]; then - echo "错误: 关联调试符号文件失败" - exit 1 -fi -echo "完成" - -echo "" -echo "========== 结果 ==========" -ls -lh "$QTUI_PATH" "$QTUI_DBG" -echo "" -echo "操作完成:" -echo " 发行程序: $QTUI_PATH" -echo " 调试符号: $QTUI_DBG" +#!/bin/bash + +TOOLCHAIN="aarch64-linux-gnu-objcopy" + +if [ -n "$1" ]; then + QTUI_PATH="$1" +else + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + QTUI_PATH="${SCRIPT_DIR}/QtUI" +fi + +if [ ! -f "$QTUI_PATH" ]; then + echo "错误: 找不到 QtUI 文件: $QTUI_PATH" + echo "用法: $0 [QtUI路径]" + exit 1 +fi + +if ! command -v "$TOOLCHAIN" &> /dev/null; then + echo "错误: 找不到工具链 $TOOLCHAIN" + exit 1 +fi + +QTUI_DIR="$(dirname "$QTUI_PATH")" +QTUI_NAME="$(basename "$QTUI_PATH")" +QTUI_DBG="${QTUI_DIR}/${QTUI_NAME}.dbg" + +echo "目标文件: $QTUI_PATH" +echo "" + +echo "步骤 1/3: 分离调试符号..." +$TOOLCHAIN --only-keep-debug "$QTUI_PATH" "$QTUI_DBG" +if [ $? -ne 0 ]; then + echo "错误: 分离调试符号失败" + exit 1 +fi +echo "完成: $QTUI_DBG" + +echo "步骤 2/3: 移除调试符号..." +$TOOLCHAIN --strip-debug "$QTUI_PATH" "$QTUI_PATH" +if [ $? -ne 0 ]; then + echo "错误: 移除调试符号失败" + exit 1 +fi +echo "完成" + +echo "步骤 3/3: 关联调试符号文件..." +$TOOLCHAIN --add-gnu-debuglink="$QTUI_DBG" "$QTUI_PATH" +if [ $? -ne 0 ]; then + echo "错误: 关联调试符号文件失败" + exit 1 +fi +echo "完成" + +echo "" +echo "========== 结果 ==========" +ls -lh "$QTUI_PATH" "$QTUI_DBG" +echo "" +echo "操作完成:" +echo " 发行程序: $QTUI_PATH" +echo " 调试符号: $QTUI_DBG" echo " 注意: 两个文件已关联,必须成对存放" \ No newline at end of file diff --git a/systemmanage.ui b/systemmanage.ui index 1a112fb..65aa611 100644 --- a/systemmanage.ui +++ b/systemmanage.ui @@ -1,828 +1,828 @@ - - - SystemManage - - - - 0 - 0 - 800 - 600 - - - - Qt::StrongFocus - - - Form - - - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 6 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - 0 - 65 - - - - - 130 - 16777215 - - - - Qt::LeftToRight - - - 手动控制泵阀 - - - - :/icon/controlbyhand.png:/icon/controlbyhand.png - - - - - - - - 40 - 0 - - - - - 16777215 - 16777215 - - - - Qt::ClickFocus - - - - - - - - - - - - - 70 - 37 - - - - 0 - - - 400 - - - 10 - - - 100 - - - - - - - - 0 - 40 - - - - - 100 - 16777215 - - - - Qt::NoFocus - - - 齿轮泵开 - - - - - - - - 0 - 40 - - - - 齿轮泵关 - - - - - - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 回收槽开 - - - - - - - - 45 - 0 - - - - - 16777215 - 16777215 - - - - 停止 - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 回收槽关 - - - - - - - - 45 - 0 - - - - - 16777215 - 16777215 - - - - 停止 - - - - - - - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 6 - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 压缩机 - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 墨水阀 - - - - - - - - 30 - 16777215 - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 混合阀 - - - - - - - - 30 - 16777215 - - - - - - - - - - - - 55 - 16777215 - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 回收泵 - - - - - - - - 55 - 16777215 - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 粘度泵 - - - - - - - - - - 30 - 20 - - - - - - - - - - - - 16777215 - 16 - - - - - - - - - - - - 0 - 20 - - - - - 16777215 - 16 - - - - - - - - - - - - - - 0 - 65 - - - - 泄压阀 - - - - - - - - 30 - 16777215 - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 主墨泵 - - - - - - - - 55 - 16777215 - - - - - - - - - - - - 30 - 16777215 - - - - - - - - - - - - 0 - 65 - - - - - 100 - 16777215 - - - - 循环阀 - - - - - - - - - 3 - - - - - - - - 0 - 60 - - - - 切换键盘 - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 排气 - - - - image/autoclean.pngimage/autoclean.png - - - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 导出配置到U盘 - - - - :/icon/export.png:/icon/export.png - - - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 更新字库 - - - - :/icon/updatefont.png:/icon/updatefont.png - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 导出字库 - - - - :/icon/udisk.png:/icon/udisk.png - - - - - - - - - - - - 0 - 60 - - - - - 16777215 - 16777215 - - - - 时间设置 - - - - :/icon/time.png:/icon/time.png - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 自动清洗 - - - - image/autoclean.pngimage/autoclean.png - - - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 更新软件 - - - - :/icon/updatesoftware.png:/icon/updatesoftware.png - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 从U盘导入配置 - - - - :/icon/import.png:/icon/import.png - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 更新FPGA软件 - - - - - - - - 0 - 60 - - - - - 200 - 16777215 - - - - 环境配置 - - - - - - - - 0 - 60 - - - - 更新单片机软件 - - - - - - - - - - - - - - + + + SystemManage + + + + 0 + 0 + 800 + 600 + + + + Qt::StrongFocus + + + Form + + + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + 6 + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + 0 + 65 + + + + + 130 + 16777215 + + + + Qt::LeftToRight + + + 手动控制泵阀 + + + + :/icon/controlbyhand.png:/icon/controlbyhand.png + + + + + + + + 40 + 0 + + + + + 16777215 + 16777215 + + + + Qt::ClickFocus + + + + + + + + + + + + + 70 + 37 + + + + 0 + + + 400 + + + 10 + + + 100 + + + + + + + + 0 + 40 + + + + + 100 + 16777215 + + + + Qt::NoFocus + + + 齿轮泵开 + + + + + + + + 0 + 40 + + + + 齿轮泵关 + + + + + + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 回收槽开 + + + + + + + + 45 + 0 + + + + + 16777215 + 16777215 + + + + 停止 + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 回收槽关 + + + + + + + + 45 + 0 + + + + + 16777215 + 16777215 + + + + 停止 + + + + + + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 6 + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 压缩机 + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 墨水阀 + + + + + + + + 30 + 16777215 + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 混合阀 + + + + + + + + 30 + 16777215 + + + + + + + + + + + + 55 + 16777215 + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 回收泵 + + + + + + + + 55 + 16777215 + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 粘度泵 + + + + + + + + + + 30 + 20 + + + + + + + + + + + + 16777215 + 16 + + + + + + + + + + + + 0 + 20 + + + + + 16777215 + 16 + + + + + + + + + + + + + + 0 + 65 + + + + 泄压阀 + + + + + + + + 30 + 16777215 + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 主墨泵 + + + + + + + + 55 + 16777215 + + + + + + + + + + + + 30 + 16777215 + + + + + + + + + + + + 0 + 65 + + + + + 100 + 16777215 + + + + 循环阀 + + + + + + + + + 3 + + + + + + + + 0 + 60 + + + + 切换键盘 + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 排气 + + + + image/autoclean.pngimage/autoclean.png + + + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 导出配置到U盘 + + + + :/icon/export.png:/icon/export.png + + + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 更新字库 + + + + :/icon/updatefont.png:/icon/updatefont.png + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 导出字库 + + + + :/icon/udisk.png:/icon/udisk.png + + + + + + + + + + + + 0 + 60 + + + + + 16777215 + 16777215 + + + + 时间设置 + + + + :/icon/time.png:/icon/time.png + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 自动清洗 + + + + image/autoclean.pngimage/autoclean.png + + + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 更新软件 + + + + :/icon/updatesoftware.png:/icon/updatesoftware.png + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 从U盘导入配置 + + + + :/icon/import.png:/icon/import.png + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 更新FPGA软件 + + + + + + + + 0 + 60 + + + + + 200 + 16777215 + + + + 环境配置 + + + + + + + + 0 + 60 + + + + 更新单片机软件 + + + + + + + + + + + + + + diff --git a/textEdit2.html b/textEdit2.html deleted file mode 100644 index 916373b..0000000 --- a/textEdit2.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

f

\ No newline at end of file diff --git a/textEdit3.html b/textEdit3.html deleted file mode 100644 index ad48e49..0000000 --- a/textEdit3.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

fdafdsa

\ No newline at end of file diff --git a/textEditnew.html b/textEditnew.html deleted file mode 100644 index 0175808..0000000 --- a/textEditnew.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

化公为私于机构改革讨价还价液恭恭敬敬用同方

\ No newline at end of file diff --git a/textEditnew3.html b/textEditnew3.html deleted file mode 100644 index 40fc439..0000000 --- a/textEditnew3.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

yujhfdddeef

\ No newline at end of file diff --git a/texteditoption.ui b/texteditoption.ui index fc03fba..aa71c29 100644 --- a/texteditoption.ui +++ b/texteditoption.ui @@ -1,376 +1,376 @@ - - - TextEditOption - - - - 0 - 0 - 800 - 58 - - - - - 0 - 0 - - - - Qt::StrongFocus - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 间距 - - - - :/icon/linespace.png:/icon/linespace.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 字体 - - - - :/icon/font.png:/icon/font.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 预览 - - - - :/icon/preview.png:/icon/preview.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 插变量 - - - - :/icon/vari.png:/icon/vari.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 新建 - - - - :/icon/filenew.png:/icon/filenew.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 保存 - - - - :/icon/filesave.png:/icon/filesave.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 文件 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 80 - 16777215 - - - - 另存为 - - - - :/icon/filesaveas.png:/icon/filesaveas.png - - - - - - - - - - 80 - 0 - - - - WenQuanYi12 - - - Qt::AlignCenter - - - - - - - - 18 - 0 - - - - - 18 - 16777215 - - - - 12 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 15 - 0 - - - - - 15 - 16777215 - - - - 点 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - Qt::LeftToRight - - - 粗体 - - - - :/icon/textbold.png:/icon/textbold.png - - - - - - - - - - - - - - + + + TextEditOption + + + + 0 + 0 + 800 + 58 + + + + + 0 + 0 + + + + Qt::StrongFocus + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 间距 + + + + :/icon/linespace.png:/icon/linespace.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 字体 + + + + :/icon/font.png:/icon/font.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 预览 + + + + :/icon/preview.png:/icon/preview.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 插变量 + + + + :/icon/vari.png:/icon/vari.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 新建 + + + + :/icon/filenew.png:/icon/filenew.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 保存 + + + + :/icon/filesave.png:/icon/filesave.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 文件 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 80 + 16777215 + + + + 另存为 + + + + :/icon/filesaveas.png:/icon/filesaveas.png + + + + + + + + + + 80 + 0 + + + + WenQuanYi12 + + + Qt::AlignCenter + + + + + + + + 18 + 0 + + + + + 18 + 16777215 + + + + 12 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 15 + 0 + + + + + 15 + 16777215 + + + + 点 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + Qt::LeftToRight + + + 粗体 + + + + :/icon/textbold.png:/icon/textbold.png + + + + + + + + + + + + + + diff --git a/thai.ts_bak b/thai.ts_bak index 4916131..755824a 100644 --- a/thai.ts_bak +++ b/thai.ts_bak @@ -1,7529 +1,7529 @@ - - - -UTF-8 - - DevOp - - - - - - - - 警告 - - - - - 字高超出范围 - - - - - 字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误 - - - - - 喷印间隔太短,无法满足同步打印宽度设置,字宽将自动缩短! - - - - - - 错误 - - - - - 在同步计米的情况下无打印串或显示区域为零 - - - - - 在同步计米的情况下喷印同步脉冲数过多,请检查你的配置 - - - - - 喷印字符串太短,请增加字符串长度或在打印设置中减少喷印长度 - - - - - 喷印长度太短,请减少字符串长度或在打印设置中增加喷印长度 - - - - - DialogAuthorization - - - Dialog - - - - - 授权密码: - - - - - 提升授权 - - - - - DialogCycleprint - - - Dialog - - - - - 1循环范围:0- - - - - - 1循环次数: - - - - - 2循环范围:0- - - - - - 2循环次数: - - - - - 3循环范围:0- - - - - - 3循环次数: - - - - - 6循环次数: - - - - - 6循环范围:0- - - - - - 5循环范围:0- - - - - - 5循环次数: - - - - - 4循环范围:0- - - - - - 4循环次数: - - - - - DialogFileOperation - - - Dialog - - - - - 本地文件 - - - - - U盘文件 - - - - - 删除文件 - - - - - 删除全部 - - - - - 从U盘导入 - - - - - 导出到U盘 - - - - - 插入 - - - - - 打开文件 - - - - - 上一个 - - - - - 下一个 - - - - - 退出 - - - - - 文件操作 - - - - - - - 警告 - - - - - 是否确认删除当前文件? - - - - - 是否确认删除所有文件? - - - - - - - - 提示 - - - - - 是否确认从U盘导入所有文件? - - - - - mv %1/VoltParaHi.bin %1/VoltParaStd.bin %2/ - - - - - cp %1/* %2/ - - - - - 成功从U盘导入? - - - - - 是否确认将所有文件导出到U盘? - - - - - 成功导出到U盘? - - - - - U盘未插入或U盘根目录下的doc文件夹不存在! - - - - - DialogFontSize - - - Dialog - - - - - 9点(左横) - - - - - 16点(中/英) - - - - - 7点(左横) - - - - - 7点(英) - - - - - 5点(英) - - - - - 9点(右横) - - - - - 12点(中/英) - - - - - 9点(英) - - - - - 7点(右横) - - - - - 24点(中/英) - - - - - 7点(孟加拉) - - - - - 32点 - - - - - 7点(rf7) - - - - - 21点(rf21) - - - - - 12点(新罗马) - - - - - 123456890ABCDEFGWXYZ - - - - - - - - - - - 查字库标识 - - - - - 选择字体大小 - - - - - DialogInputTxt - - - Dialog - - - - - DialogInsertVari - - - Dialog - - - - - 变量类型 - - - - - 生产日期 - - - - - 年 - - - - - 计数器1 - - - - - 计数器2 - - - - - 时 - - - - - 周 - - - - - 随机码1 - - - - - 月 - - - - - DataMatrix - - - - - QRCode - - - - - 有效日期 - - - - - Class - - - - - 秒 - - - - - 日 - - - - - 分 - - - - - BarCode128 - - - - - 计数器3 - - - - - 数字个数 - - - - - 9个 - - - - - 11个 - - - - - 10个 - - - - - 2个 - - - - - 1个 - - - - - 3个 - - - - - 4个 - - - - - 5个 - - - - - 6个 - - - - - 7个 - - - - - 8个 - - - - - 12个 - - - - - 13个 - - - - - 14个 - - - - - 15个 - - - - - 变量插入 - - - - - DialogLineSpace - - - Dialog - - - - - - 0个像素 - - - - - - 1个像素 - - - - - - 2个像素 - - - - - - 3个像素 - - - - - - 4个像素 - - - - - - 5个像素 - - - - - 6个像素 - - - - - 7个像素 - - - - - 行间距: - - - - - 字符间距: - - - - - 选择行间距和字符间距 - - - - - DialogPointDistanceAdjust - - - Dialog - - - - - 列首: - - - - - 列中: - - - - - 列尾: - - - - - 重置 - - - - - 测试 - - - - - DialogSaveFile - - - Dialog - - - - - 本地文件 - - - - - U盘文件 - - - - - 预览文件内容: - - - - - 上一个 - - - - - 下一个 - - - - - 请输入文件名: - - - - - 取消 - - - - - - 保存 - - - - - 警告 - - - - - U盘未插入或U盘根目录下的doc文件夹不存在! - - - - - DialogShowCounter - - - Dialog - - - - - 米标显示: - - - - - 目前循环范围: - - - - - - - 米 - - - - - 剩余米数: - - - - - 循环次数: - - - - - 立即重新计米 - - - - - 起始: - - - - - 结束: - - - - - Dialoginputpasswd - - - Dialog - - - - - 修改密码: - - - - - Dialogmodifypasswd - - - Dialog - - - - - 修改密码: - - - - - 密码授权 - - - - - DigitalInput - - - Form - - - - - 9 - - - - - 3 - - - - - 8 - - - - - - - - - - - 退格 - - - - - 1 - - - - - 4 - - - - - 0 - - - - - 5 - - - - - 7 - - - - - 2 - - - - - 6 - - - - - 全选 - - - - - DlgInputAddr - - - Dialog - - - - - 请输入6位机编号(前3位为经销商编号) - - - - - PowerOnCnt - - - - - PrintDotCnt - - - - - PowerMax - - - - - PrintMax - - - - - 开始时间 - - - - - 结束时间 - - - - - SuperNodeIP: - - - - - edgeIP: - - - - - - - - - - . - - - - - 喷码机恢复工作! - - - - - 维护时间剩余 - - - - - 小时,喷码机将停止工作.请与供应商联系! - - - - - - 当前日期: - - - - - - 正确? - - - - - 维护时间已到,喷码机停止工作!请与供应商联系 - - - - - DlgMutiLanguage - - - 界面语言设置 - - - - - 西班牙语 - - - - - 中文 - - - - - 泰语 - - - - - 英语 - - - - - 土耳其语 - - - - - 越南语 - - - - - (注意: 选择切换显示语言, 重启后才能生效) - - - - - DlgMyWarring - - - 警告 - - - - - 确定 - - - - - TextLabel - - - - - DlgSelectInputLanguage - - - Dialog - - - - - 汉语(Chinese) - - - - - 英语(English) - - - - - 越南语(Vietnam) - - - - - DlgShowMsg - - - 警告 - - - - - 确定 - - - - - DlgVarLength - - - 变长喷印参数 - - - - - 头部长度(m) - - - - - 尾部长度(m) - - - - - 总长(m) - - - - - - 调整长度(mm) - - - - - 可变长度允许 - - - - - 确定 - - - - - InkJetPrinter - - - TabWidget - - - - - 主窗口 - - - - - - - 信息编辑 - - - - - 图案编辑 - - - - - 打印设置 - - - - - 触发设置 - - - - - - 系统设置 - - - - - - 系统管理 - - - - - - 其他信息 - - - - - - 日志信息 - LogInfo - - - - - 网络管理 - - - - - 电压调整 - VolSet - - - - Save - - - - - 不连续电压 - Discontinuous voltage - - - - - vol0 - - - - - - vol1 - - - - - - vol2 - - - - - - vol3 - - - - - - vol4 - - - - - - vol5 - - - - - - vol6 - - - - - - vol7 - - - - - - vol8 - - - - - - vol9 - - - - - - vol10 - - - - - - vol11 - - - - - - vol12 - - - - - - vol13 - - - - - - vol14 - - - - - - vol15 - - - - - - vol16 - - - - - - vol17 - - - - - - vol18 - - - - - - vol19 - - - - - - vol20 - - - - - - vol21 - - - - - - vol22 - - - - - - vol23 - - - - - - vol24 - - - - - - vol25 - - - - - - vol26 - - - - - - vol27 - - - - - - vol28 - - - - - - vol29 - - - - - - vol30 - - - - - - vol31 - - - - - - vol32 - - - - - - vol33 - - - - - - vol34 - - - - - - vol35 - - - - - - vol36 - - - - - - vol37 - - - - - - vol38 - - - - - - vol39 - - - - - 连续电压 - Continuous voltage - - - - 满列电压 - Full train voltage - - - - fvol0 - - - - - fvol1 - - - - - fvol2 - - - - - fvol3 - - - - - fvol4 - - - - - fvol5 - - - - - fvol6 - - - - - fvol7 - - - - - fvol8 - - - - - fvol9 - - - - - fvol10 - - - - - fvol11 - - - - - fvol12 - - - - - fvol13 - - - - - fvol14 - - - - - fvol15 - - - - - fvol16 - - - - - fvol17 - - - - - fvol18 - - - - - fvol19 - - - - - fvol20 - - - - - fvol21 - - - - - fvol22 - - - - - fvol23 - - - - - fvol24 - - - - - fvol25 - - - - - fvol26 - - - - - fvol27 - - - - - fvol28 - - - - - fvol29 - - - - - fvol30 - - - - - fvol31 - - - - - fvol32 - - - - - fvol33 - - - - - fvol34 - - - - - fvol35 - - - - - fvol36 - - - - - fvol37 - - - - - fvol38 - - - - - fvol39 - - - - - 其他调整 - Other adjustments - - - - 整体缩放(%) : - Overall scaling (%) : - - - - WriteByte - - - - - ReadByte - - - - - - - Address: - - - - - - Value: - - - - - WriteWord - - - - - ReadWord - - - - - ReadDword - - - - - WriteDword - - - - - ValueH: - - - - - ValueL: - - - - - 定时开机 - timed start - - - - - 压力泄漏或压力传感器故障! - Pressure leakage or pressure sensor failure! - - - - 运行中压力泄漏,停齿轮泵! - If the pressure leaks during operation, stop the gear pump! - - - - - 测试时间结束,准备关机 - The test time is over, ready to shut down - - - - 定时开机循环完成,准备关机 - self checking done in alarm resump, ready to poweroff - - - - 准备关机 - ready poweroff - - - - 与FPGA失去通信!!! - Lose contact with FPGA ! - - - - 与FPGA通信恢复正常 - The contact with FPGA recovered - - - - 开始自检,请等待60秒............... - - - - - 开始自检,请等待%1秒............... - - - - - - 自检完成!!! - Self-checking done ! - - - - - 墨水或溶剂空,准备关机 - Ink or mekeup empty, prepare shutdown - - - - 喷印速度过快!无法喷印完全,自动暂停喷印!!! - Jetting overspeed ! Cannot print all content. -Printing paused automatically! - - - - 喷印速度过快!无法喷印完全!!! - Speed is too fast or interval is too short! Unable to print all char!!! - - - - 压力波动超过设定的5个值. - The pressure fluctuation exceeds the set 5 values - - - - 停止打印,自动关闭高压. - Stop printing and automatically turn off high voltage - - - - 压力异常:上次压力值%1,当前压力值%2 - Pressure fault:last value is %1, current value is %2 - - - - 高压异常:上次电流值%1,当前电流值%2 - High voltage fault:last current value is %1, current current value is %2 - - - - - 齿轮泵转速过高,请立即停机并联系供应商! - The speed is too high, please stop immediately and contact the supplier! - - - - - 齿轮泵转速过高,请清理过滤器或者检查是否泄露! - The speed is too high, please clean the filter or check for leaks! - - - - 警告:加热器长时间无法达到预期温度,故障或设置错误! - Warning: The heater cannot reach pre-set temperature, -it may caused by fault or setting mistake ! - - - - - 错误!!!!!!!!!!!主墨泵故障 - Wrong!!! Main ink pump fault - - - - - 主墨泵故障!!! - Main ink pump fault! - - - - 错误!!!!!!!!!!!压缩机故障 - Wrong!!! Compressor fault - - - - 压缩机故障!!! - Compressor fault ! - - - - - 错误!粘度计下位灯故障. - Error! Viscometer inferior lamp failure. - - - - - 错误!粘度计故障:检测不到上位灯. - Error:Viscometer fault! the upper lamp is not detected. - - - - 混合阀打开1: - The mixing valve opens 1: - - - - - 警告!!!!!!!!!!!粘度值偏低 - Warning! Low viscosity - - - - - 错误!!!!!!!!!!!粘度偏大故障 - Error! Viscosity larger fault - - - - 粘度检测异常,粘度值太大!!! - The viscosity anomaly detection, viscosity too high!!! - - - - 混合阀打开2: - The mixing valve opens 2: - - - - - - 电机故障 - Motor fault - - - - 电机故障!!! - Motor fault ! - - - - - 回收槽到头 - Collector reaches the end - - - - - - - 回收槽卡住或者回收槽开关时间设置错误 - Collector seized, or the collector's switch time was setted in wrong - - - - 喷印速度过快或间隔太短!无法喷印完全,自动暂停喷印!!! - Speed is too fast or interval is too short! Unable to print all, stop print now!!! - - - - 喷印速度过快或间隔太短!无法喷印完全!!! - Speed is too fast or interval is too short! Unable to print all char!!! - - - - 提示 - hint - - - - 是否接收新的信息! - Whether to receive new information! - - - - InputMethod - - - Form - - - - - 1 书 - - - - - 2 输 - - - - - 3 数 - - - - - 4 属 - - - - - 5 熟 - - - - - 上一页 - - - - - 下一页 - - - - - ` - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 0 - - - - - - - - - - - = - - - - - 退格 - - - - - - 英文 - - - - - q - - - - - w - - - - - e - - - - - r - - - - - t - - - - - y - - - - - u - - - - - i - - - - - o - - - - - p - - - - - [ - - - - - ] - - - - - \ - - - - - - 大写 - - - - - a - - - - - s - - - - - d - - - - - f - - - - - g - - - - - h - - - - - j - - - - - k - - - - - l - - - - - ; - - - - - ' - - - - - Enter - - - - - Shift - - - - - z - - - - - x - - - - - c - - - - - v - - - - - b - - - - - n - - - - - m - - - - - , - - - - - . - - - - - / - - - - - 上 - - - - - 特殊字 - - - - - 隐藏 - - - - - Ctrl - - - - - 删除 - - - - - 行首 - - - - - 行尾 - - - - - 左 - - - - - 下 - - - - - 右 - - - - - - 错误 - - - - - hanziDisplayLabels缺少初始化 - - - - - warning - - - - - myInputMethod is null - - - - - - 找不到输入法初始化文件 - - - - - 小写 - - - - - Tiếng Việt - - - - - Russian - - - - - Japanese - - - - - 全选 - - - - - 复制 - - - - - 粘贴 - - - - - 剪切 - - - - - 后退 - - - - - InsertSpaceNumDialog - - - 插入空格数 - - - - - 空格个数: - - - - - LogInfo - - - Form - - - - - 当前状态 - - - - - 清空当前状态 - - - - - 历史状态 - - - - - TextLabel - - - - - 删除历史文件 - - - - - 打开历史文件 - - - - - 导出日志到U盘 - - - - - 版本信息 - - - - - 请先打开历史状态文件! - - - - - - - 警告 - - - - - - - 无法打开文件 - - - - - - - - 提示 - - - - - 是否确认将所有日志文件导出到U盘? - - - - - 成功导出到U盘? - - - - - 选择历史记录文件 - - - - - 是否确认将历史日志文件全部清除? - - - - - 是否确认将当前日志全部清除? - - - - - MainWindow - - - InkJet - - - - - 编辑 - แก้ไข - - - - 打开文件 - เปิดไฟล์ - - - - 二维码 - คิวอาร์โค้ด - - - - 条形码 - บาร์โค้ด - - - - 缩小 - ซูมเข้า - - - - 放大 - ซูมออก - - - - 获取数据 - get the data - - - - 交替打印文件名 - Alternate printing file name - - - - 最大:[40行x 2048列] - - - - - 同步器速度 - ความเร็ว - - - - 当前时间 - เวลา - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Monospace'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi'; font-size:10pt; vertical-align:bottom;"><br /></p></body></html> - - - - - 墨线开关 - สวิตซ์ -หมึก - - - - 喷头盖开 - ฝาหัวพิมพ์ - เปิด - - - - 墨水缸满 - ถังหมึก -เต็ม - - - - 墨水液位 - ระดับหมึก -ต่ำ - - - - 溶剂液位 - เมคอัพ -ต่ำ - - - - 回收故障 - ท่อดูดกลับ -ผิดพลาด - - - - 粘度故障 - ความหนืด -ผิดพลาด - - - - 相位故障 - เฟสหมึก -ผิดพลาด - - - - 高压故障 - ไฮโวลท์ -ผิดพลาด - - - - 故障恢复 - รีเซ็ตความ -ผิดพลาด - - - - 立即重新计米 - รีเซ็ตจำนวนนับ - - - - 产品计数 - การตรวจนับสินค้า - - - - 产品总计数 - Grand Total - - - - 关机 - ปิดเครื่อง - - - - 2014-08-23 - 1 {2014-08-23?} - - - - 粘度 - - - - - 高压包 - - - - - - 隔膜位置 - DiaphragmPOS - - - - 压力 - - - - - - - - 开 - เปิดหัว -พิมพ์ - - - - - - - 关 - ปิดหัว -พิมพ์ - - - - - 暂停打印 -停止高压 - Pause to print -Stop high pressure - - - - 喷嘴逆清洗 - ทำความสะอาด -รูฉีดหมึก - - - - 紧急停机 - ปิดฉุกเฉิน - - - - - 机箱: - CASE: - - - - - - 正在喷印............... - Printting...... - - - - 喷头盖开, 喷印无法正常进行!!! - Cannot print while printhead cover is open ! - - - - - 墨水缸满报警 - The ink jar is full of alarm - - - - - 墨水液位报警 - ระดับหมึกต่ำ - - - - - 溶剂液位报警 - ระดับเมคอัพต่ำ - - - - - 高压故障,暂停打印 - High voltage fault, Pause Printing. - - - - - 高压故障,暂停打印. - High voltage fault, Pause Printing. - - - - 高压故障,关回收槽 - HighVoltFault,ReclainTank auto Colse - - - - 高压故障,关回收槽和墨线 - HighVoltFault,ReclainTank auto Colse - - - - - - - - 回收故障,关闭回收槽,关墨线 - HighVoltFault,ReclainTank auto Colse - - - - 回收故障. - Recovery failure. - - - - 回收异常,墨线可能偏离.(%1) - Recovery abnormal, InkLine may deviate (%1) - - - - 维护时间已到,喷码机停止工作! - The maintenance time has come,Inkjet printer stop working! - - - - - 暂停喷印............... - Pause printing... - - - - 相位故障:飞行时间错误! - Phase fault: wrong flight time! - - - - 相位故障:相位检测错误! - Phase fault: phase detection error! - - - - - - 相位故障,准备关机 - Phase Fault, ShoutDown Now - - - - - - 相位故障,暂停打印 - Phase fault, printing was paused - - - - 相位故障,屏蔽DAC输出 - Phase fault, DAC export was shield - - - - - 相位故障,屏蔽充电 - Phase fault, charging was shield - - - - 齿轮泵转速 - - - - - 交替打印 - AltPrint - - - - 电眼交替 - Alter by electronic Eye - - - - %1.%2[%3.%4]米/分 - %1.%2[%3.%4] m/s - - - - 列延时:%1点 - Column interval: %1 pixel - - - - - - - - - - - - - - - 警告 - Warnning - - - - 无法打开文件 - Cannot open file - - - - 打开文件: - เปิดไฟล์: - - - - - - 提示 - Tips - - - - 文件未保存,是否先保存文件! - File not save,please save it Now! - - - - - 最多支持的列数目为:%1请减小信息长度. - The maximum number of columns supported is:%1, please decrease the length of the information. - - - - - - - 变量数大于8个,某些变量将不起作用!!! - The variable number is greater than 8, and some variables will not work!!! - - - - - 请减少信息中的变量(或计数器)数量. - Please reduce the number of variables (or counters) in the printe file. - - - - warning,界面上有变量未显示完全 - Warning,Interface shows not all variables - - - - - - - [ %1行 x %2列 ] - %1 row x %2 column - - - - - - - - 错误 - ผิดพลาด - - - - 喷印间隔过短,应高于%1! - Printing interval is too short, -should be higher than %1! - - - - 喷头盖未关,请先关喷头盖! - Please close the printhead cover ! - - - - 墨线未开,请先开墨线开关! - Please turn on the inkjet switch ! - - - - 正在加高压... - High voltage is being up... - - - - 当前总列数 %1 ,支持的总列数为 %2,请减少打印串的长度 - Present total column number is %1, system support total column number is %2, please reduce the length of character string - - - - 打印耗时 %1ms ,触发间隔 :%2ms ,触发间隔至少应当大于打印耗时3ms - Print time: %1ms, trigger interval: %2ms, trigger interval must be greater than print time, and the gap should not less than 3ms - - - - 开始打印1 - เริ่มพิมพ์1 - - - - - 开始打印 - เริ่มพิมพ์ - - - - 回收槽未到底!!!!!! - Collector does not return to the end ! - - - - 停止打印 - หยุดพิมพ์ - - - - - 随机码文本将展出到U盘,请插入U盘 - The RandomCode save U disk. Please insert the U disk - - - - 暂停打印 - Print paused - - - - 继续打印 - พิมพ์ต่อเนื่อง - - - - 继续打印 -保持高压 - To continue printing -Keep the high pressure - - - - 正在排气 ............... - Exhausting........ - - - - - 停止 - หยุด - - - - 正在打开回收槽... - เปิดหัวพิมพ์... - - - - 停止打开 - หยุดเปิด - - - - - 警告!回收槽开关时间未设置! - Warning! The switch time of collector does not set! - - - - - 回收槽之前发生阻塞或回收槽时间设置错误,是否强制将当前位置设为到顶位置? - Collector blocked or recycle time wrong set at before. Do you want to set present positon as the end position forcibly ? - - - - 正在关闭回收槽... - closing reatank now... - - - - 停止关闭 - Stop closing - - - - 准备关机...... - Printer is going to close shutdown... - - - - 泵启动 - ปั๊มทำงาน - - - - 泵停止 - ปั๊มหยุดทำงาน - - - - 回收槽未关,是否关闭回收槽后关机! - Collector does not return. Do you want to turn off the collector before shutdown ? - - - - 是否确认关机? - Do you want to turn the printer off ? - - - - 是否初始化产品计数? - Do you want to initialize the Product Count ? - - - - 是否清除总产品计数? - Do you want to clear the Grand Total ? - - - - 是否立即重新计米? - Are you want to reset counter! - - - - 警告:‘-’和空格的宽度不一样 - Warning: the width of '-'is not same as a space - - - - 条形码信息编辑 - แก้ไขบาร์โค้ด - - - - - 二维码信息编辑 - แก้ไขคิวอาร์โค้ด - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi'; font-size:10pt;"><br /></p></body></html> - - - - - 获取DM码内容为空! - Get DM code content is empty! - - - - - 获取DM码内容: - get DM code data: - - - - - 获取DM码内容跟上次相同 - Get the same DM code content as last time - - - - 高压故障:两高压偏转板间的电压检测异常 - High-voltage fault: two high voltage deflection plate voltage detection abnormal - - - - 1.高压偏转板和高压底座潮湿、脏污,请清洗并吹干高压板和高压底座; - 1. high pressure deflector and high voltage base, wet and dirty, please clean and dry high pressure plate and high voltage base; - - - - 2.机器更换主板或者高压包,请进入“系统设置”点击“重置高压”,字高设置为90时,重置高压报警值应在480—550之间; - 2., the machine changes the motherboard or high voltage package, please enter the "system settings", click "reset high", and set the word high to 90, reset the high voltage alarm value should be between 480 and 550; - - - - 3.高压线路漏电,请更换高压线路; - 3. high voltage line leakage, please replace the high voltage line; - - - - 4.高压底座漏电,请更换高压底座。 - 4. high voltage base leakage, please replace the high voltage base. - - - - 墨水过多:墨水溢出 - Excessive ink: ink overflow - - - - 1. 请停止添加墨水; - 1. please stop adding ink; - - - - 2. 请排出多余墨水。 - 2. please discharge excess ink. - - - - 墨水液位:墨水即将耗尽 - Ink level: ink is about to run out - - - - 1. 墨水耗尽,3小时后将自动关机,请及时添加墨水。 - 1., the ink is exhausted, 3 hours after the automatic shutdown, please add ink in time. - - - - 回收故障:未检测到有墨水回收 - Recovery failure: no ink recovery was detected - - - - 1. 墨水未射入回收管,请修正墨线方向; - 1. ink not into recycling tube, please correct line direction; - - - - 2. 墨水粘度太低,请更换新墨水; - 2. ink viscosity is too low, please replace the new ink; - - - - 3. 回收管堵塞,请清通或者更换回收管; - 3. recovery of pipe blockage, please clear or replace the recovery tube; - - - - 4. 回收泵故障,请清洗或者更换回收泵; - 4., the recovery pump failure, please clean or replace the recovery pump; - - - - 5. 确认各参数及设备无异常后请进入“打印设置”取消“回收故障处理”的勾选,退回主窗口界面点击“故障恢复”按钮. - 5. after confirming that all the parameters and equipment are not abnormal, please enter the "print settings", cancel the "recovery troubleshooting" check, return to the main window interface, click the "fault recovery" button. - - - - 溶剂液位:溶剂即将耗尽 - Mekeup level: mekeup is about to run out - - - - 1. 溶剂耗尽,3小时后将自动关机,请及时添加溶剂。 - 1. mekeup depletion, 3 hours after the automatic shutdown, please add solvent in time. - - - - - 粘度故障报警 - Viscosity alarm - - - - 粘度故障:墨水粘度无法自动调整 - Viscosity fault: Ink viscosity can not be adjusted automatically - - - - 1. 混合阀失灵,请冲洗或者更换混合阀; - 1. the mixing valve fails, please flush or replace the mixing valve; - - - - 2. 墨水罐内的墨水异常,请更换新墨水; - 2. the ink in the ink pot is abnormal. Please replace the ink; - - - - 粘度计异常: - Viscometer anomaly: - - - - 1. 泵前过滤网堵塞,请更换泵前滤网; - 1. the filter screen is blocked before the pump. Please replace the strainer before the pump; - - - - 2. 粘度泵异常,请清洗或更换粘度泵; - 2. viscosity pump abnormal, please clean or replace viscosity pump; - - - - 3. 粘度传感器异常,请检查传感器线路或者更换传感器. - 3. viscosity sensor abnormal, please check the sensor or replace the it. - - - - 相位故障报警 - Phase alarm - - - - 相位故障:相位信号检测异常 - Phase fault: phase detection exception - - - - 1. 墨水分裂不正常,请调整墨水分裂; - 1. ink dot split abnormal, please adjust the ink split; - - - - 2. 充电槽或者相检头脏污,请清洗充电槽和相检头; - 2. charging tank or check head dirty, please clean the charging tank and phase head; - - - - 3. 放大板功能性异常,请更换放大板; - 3. the magnifying board is abnormal. Please replace it; - - - - 4. 相检头和墨线的距离过远,请检测喷头活动机构,调整相检头和墨线间的距离; - 4. phase detection head and its distance is too far away, check the nozzle moving mechanism, adjusting the distance between the head and the ink; - - - - 5. 地线未接或者外界干扰,请连接地线或者隔离外界干扰; - 5. the ground has not received or outside interference, please connect the ground wire or isolate the outside interference; - - - - 6. 墨水质量异常,请更换新墨水。 - 6. the ink is of exceptional quality. Please replace the ink. - - - - 回收槽开关检测完成! - Recycling tank switch detection completed! - - - - MemDisplayAndEdit - - - Form - - - - - 07 - - - - - 02 - - - - - 06 - - - - - 0D - - - - - 09 - - - - - 03 - - - - - 01 - - - - - 04 - - - - - 0C - - - - - 0A - - - - - 0F - - - - - 05 - - - - - 00 - - - - - 08 - - - - - 0B - - - - - 0E - - - - - 基地址: - - - - - 0x0000 - - - - - 0xb100 - - - - - 0xb200 - - - - - 0xa400 - - - - - 0xe000 - - - - - 读空间 - - - - - 写空间 - - - - - 进制转换 - - - - - - 编辑 - - - - - 上一页 - - - - - 下一页 - - - - - 完成 - - - - - ModbusSerial - - - 接收到开始打印命令 - - - - - 接收到暂停打印命令 - - - - - 接收到停止打印命令 - - - - - 接收到DM码数据命令 - - - - - MyFileDialog - - - 确定 - - - - - NetworkManager - - - Form - - - - - WiFi: - - - - - Mask: - - - - - GW: - - - - - - IP: - - - - - Status: - - - - - 取消 - - - - - 主获取数据按钮 - - - - - SSID: - - - - - 有线LAN - - - - - 手动设定 - - - - - Disconnect - - - - - Plaintext (open / no authentication) - - - - - Static WEP (no authentication) - - - - - Static WEP (Shared Key authentication) - - - - - IEEE 802.1X - - - - - WPA-Personal (PSK) - - - - - WPA-Enterprise (EAP) - - - - - WPA2-Personal (PSK) - - - - - WPA2-Enterprise (EAP) - - - - - 设备码: - - - - - Encryption: - - - - - 服务IP: - - - - - None - - - - - WEP - - - - - TKIP - - - - - CCMP - - - - - 8754 - - - - - 服务端口: - - - - - PSK: - - - - - Connect - - - - - Password: - - - - - Scan - - - - - Remove - - - - - auth: - - - - - 获取数据 - - - - - ScanSSID - - - - - Network: - - - - - 1 - - - - - 47.111.170.144 - - - - - AddNetwork - - - - - 测试 - - - - - 应用配置 - - - - - 去掉数字码 - - - - - 去掉QR码 - - - - - wpa_supplicant service is not running. -Do you want to start it? - - - - - Disconnected - - - - - Inactive - - - - - Scanning - - - - - Authenticating - - - - - Associating - - - - - Associated - - - - - 4-Way Handshake - - - - - Group Handshake - - - - - Completed - - - - - Unknown - - - - - Could not get status from wpa_supplicant - - - - - Select any network - - - - - WPS AP in active PBC mode found - - - - - Press the PBC button on the screen to start registration - - - - - WPS AP with recently selected registrar - - - - - WPS AP detected - - - - - PBC mode overlap detected - - - - - More than one AP is currently in active WPS PBC mode. Wait couple of minutes and try again - - - - - Network configuration received - - - - - Registration started - - - - - Registrar does not yet know PIN - - - - - Registration failed - - - - - Registration succeeded - - - - - WPA Pre-Shared Key Error - - - - - WPA-PSK requires a passphrase of 8 to 63 characters -or 64 hex digit PSK - - - - - Network ID Error - - - - - Network ID String contains non-word characters. -It must be a simple string, without spaces, containing -only characters in this range: [A-Za-z0-9_-] - - - - - - Failed to add network to wpa_supplicant -configuration. - - - - - Failed to enable network in wpa_supplicant -configuration. - - - - - This will permanently remove the network -from the configuration. Do you really want -to remove this network? - - - - - Yes - - - - - No - - - - - Failed to remove network from wpa_supplicant -configuration. - - - - - - - - 提示 - - - - - 是否去获取数据! - - - - - 获取数据中... - - - - - - 上报数据中... - - - - - - IP设置错误! - - - - - 应用成功 - - - - - OtherInfo - - - Form - - - - - 相位位置: - - - - - 相位偏移: - - - - - 飞行时间: - - - - - DetectDelay - - - - - 相检: - - - - - FullTimeEn - - - - - DetectVol - - - - - HighLowRatio - - - - - 充电占空比100% - - - - - detect_num - - - - - - 锁定相位 - - - - - 相位检测电压: - - - - - 频闪灯周期: - - - - - 检测墨点数量: - - - - - 检测延时: - - - - - 应用当前配置 - - - - - 提示 - - - - - 应用成功 - - - - - 点 - - - - - 解锁相位 - - - - - PicEdit - - - Form - - - - - 开启软键盘 - - - - - 插入变量 - - - - - - 保存/打印 - - - - - 缩小 - - - - - 放大 - - - - - 5点阵 - - - - - 7点阵 - - - - - 9点阵 - - - - - 12点阵宋体 - - - - - 16点阵宋体 - - - - - 16点阵黑体 - - - - - 24点阵宋体 - - - - - 24点阵黑体 - - - - - 列高 - - - - - 无加粗 - - - - - 加粗1倍 - - - - - 加粗2倍 - - - - - 光栅[X:Y] - - - - - 放大比例 - - - - - 插入模式 - - - - - 文件名 - - - - - CURR[X,Y] - - - - - 新建信息 - - - - - 打开文件 - - - - - 字符间距 - - - - - 插入/修改 - - - - - 删除字符 - - - - - 插入图片 - - - - - 保存为 - - - - - - - 字库编辑 - - - - - 网格 - - - - - 粗体 - - - - - 显示控制符 - - - - - 行首 - - - - - 行尾 - - - - - 字符光标 - - - - - 像素光标 - - - - - 编辑现有的多字体 - - - - - 点击光栅可打开键盘,点击空白处关闭 - - - - - - - - - - - - 放大倍数:%1 - - - - - - 插入模式 - - - - - - 修改模式 - - - - - 编辑现有的多字体文件 -请使用修改模式!!! - - - - - - - 保存 - - - - - 点击光栅可打开键盘,点击空白处关闭 - - - - - 信息编辑 - - - - - 字库保存 - - - - - - 返回信息编辑 - - - - - 请选择字体,打开键盘并输入要编辑的字符 - - - - - - - 提示 - - - - - 图片已经改变,是否保存? - - - - - 放弃保存 - - - - - 文件另存为... - - - - - 另存为 - - - - - - - - - - 文件名: - - - - - 文件名:) - - - - - 文件保存为... - - - - - 本条信息的变量超过规定数量! - - - - - 是否立即喷印当前的文件? - - - - - 是 - - - - - 否 - - - - - 按回车键(Enter)可增加新行. 选择字体,光栅会自动调整 - - - - - 选择[字体]可改变光标大小. - - - - - 选择[绘图]方式,可以绘制任意图形 - - - - - 光标不匹配时,不能输入或删除. - - - - - 点击空白处可关闭键盘. - - - - - 通过[字库编辑]功能,用户可以自定义新字符 - - - - - 选择[文本模式]可切换到主界面编辑方式. - - - - - 点击光栅可打开键盘,点击空白处关闭键盘 - - - - - 使用[字库编辑]功能,用户可自己修改字形 - - - - - PicWidget - - - Please input a char. - - - - - 请输入要编辑的字符 - - - - - 编辑字符:%1 - - - - - [%1行,%2列] - - - - - 光标[%1,%2] - - - - - - - - - - - - - - 警告 - - - - - 最大支持宽度:%1 高度:%2 当前请求:%3 x %4 - - - - - - - 请新创建建图片 - - - - - - - 文件:%1 无法打开 - - - - - 信息中的变量数超过了最大值(8)!请减小变量数. - - - - - - 两个变量之间至少要空出一个墨点! - - - - - PrintSetting - - - Form - - - - - 提升权限 - - - - - 墨线时间 - - - - - - - - 0 - - - - - 墨线时间: - - - - - 开机次数: - - - - - 维护时间: - - - - - 应用当前配置 - - - - - 常用设置 - - - - - TextLabel - - - - - 打印模式: - - - - - 字体宽度: - - - - - 首行电压(%): - - - - - 字体加粗: - - - - - - 快速 - - - - - - - 标准 - - - - - - 慢速1 - - - - - - 慢速2 - - - - - - 慢速3 - - - - - - 慢速4 - - - - - - 慢速5 - - - - - 字高设置(%): - - - - - 行末电压(%): - - - - - 修改授权 - - - - - 回收故障处理 - - - - - 超速暂停打印 - - - - - 自然数计米 - - - - - 信息上下颠倒 - - - - - 相位故障关机 - - - - - 相位故障不打印 - - - - - 故障停止走米 - - - - - 信息左右颠倒 - - - - - 不打印走米 - - - - - 省点 - - - - - 电眼误触禁止 - - - - - 高压故障关回收槽 - - - - - - 调整电压 - - - - - 字形优化 - - - - - - 高级设置 - - - - - - 交替扫描隔点(默认为1): - - - - - - 冗点比例(默认为0%): - - - - - 点距调整值(默认为0): - - - - - 行末调整点模式: - - - - - 行末调整点数(默认为0): - - - - - 慢速6 - - - - - 慢速7 - - - - - 慢速8 - - - - - 慢速9 - - - - - 行末点微调(‰): - - - - - 点距调整电压位置: - - - - - - 扫描颠倒 - - - - - 懒惰模式 - - - - - 贪婪模式 - - - - - 均衡模式 - - - - - 去除冗点模式(默认懒惰): - - - - - 使用推荐设置 - - - - - 行业: - - - - - 快 - - - - - 慢速 - - - - - 电线电缆 - - - - - 制药/食品/电子 - - - - - 建筑管材 - - - - - 其他 - - - - - 速度: - - - - - 检测回收槽 - - - - - - 锁定脉冲计数 - - - - - 每条信息只打印一次 - - - - - 非字宽 - - - - - 使用齿轮泵 - - - - - 打印时绿灯常亮 - - - - - 不检测喷头盖 - - - - - 导出随机码文本 - - - - - 高压阈值: - - - - - 复位发送打印数据 - - - - - 计数器设置 - - - - - 计数器1设置 - - - - - 可变长度 - - - - - - - 清零 - - - - - - - 重复数: - - - - - - - 重设值 - - - - - - - - 结束值: - - - - - 显示小数点 - - - - - - - - 增量值: - - - - - - - 当前值: - - - - - - - - 起始值: - - - - - 注意:“其它设置”页下的"分段计米“勾选时,计数器1不可用。 - - - - - 计数器2设置 - - - - - 计数器3设置 - - - - - 跳米设置 - - - - - 跳米数: - - - - - 跳米打印 - - - - - yyyy-MM-dd - - - - - yyyy/MM/dd - - - - - yyyyMMdd - - - - - yyyy年MM月dd日 - - - - - yyyy-MM-dd hh:mm - - - - - yyyy/MM/dd hh:mm - - - - - yyyyMMddhhmm - - - - - yyyy年MM月dd日hh:mm - - - - - hh:mm - - - - - dd MM yy - - - - - dd/MM/yy - - - - - dd/MM/yyyy - - - - - dd-MM-yy - - - - - dd-MM-yyyy - - - - - 复位到起始值 - - - - - 有效期(天): - - - - - 计数器保存关机值 - - - - - 计数器3 - - - - - - 计数器1 - - - - - 生产日期: - - - - - - 计数器2 - - - - - 循环产品计数 - - - - - 交替打印设置 - - - - - 重复次数: - - - - - 起始位置: - - - - - 距离尾部(mm): - - - - - 特殊变量结束值: - - - - - 特殊条件计数 - - - - - 无交替 - - - - - 普通交替 - - - - - 电眼触发交替 - - - - - 首尾交替 - - - - - 交替间隔: - - - - - 特殊变量起始值: - - - - - 打印 - - - - - 其它设置 - - - - - 更换信息文件时执行的动作: - - - - - 产品计数器自动清0 - - - - - 总产品计数器自动清0 - - - - - 外接显示屏: - - - - - 无 - - - - - 小屏 - - - - - 大屏 - - - - - 总产品计数值 - - - - - 显示屏显示: - - - - - 分段计米 - - - - - 插 入 - - - - - 添 加 - - - - - 全部删除 - - - - - 删 除 - - - - - 米标显示 - - - - - 上移 - - - - - 下移 - - - - - 打印电压缩放 - - - - - 整体缩放(%) : - - - - - 提示:可变长度参数不正确 - - - - - 要求:调整长度小于喷印间隔 - - - - - - 提示:交替参数不正确 - - - - - 要求:起始位置<交替间隔 - - - - - 要求:(重复次数+起始位置)<交替间隔 - - - - - - - - - 提示 - - - - - 应用成功 - - - - - 小时 - - - - - - - 错误 - - - - - - 授权码: - - - - - 错误 - - - - - 喷码机维护设置成功! - - - - - 系统维护设置成功! - - - - - 不存在 - - - - - - 提升授权 - - - - - 取消授权 - - - - - - - - - - - 警告 - - - - - 是否确认使用推荐设置? - - - - - 随机码文件为空,不需要导出 - - - - - 随机码文本将展出到U盘,请插入U盘 - - - - - 计数器1(结束值-开始值)不能被增量整除,结束值将被设为%1 - - - - - 计数器1(结束-开始)不能被增量整除,结束值将被设为%1 - - - - - 1 - - - - - 正在打印第%1组设置,不可删除 - - - - - 是否确认删除第%1组设置? - - - - - 是否确认删除全部设置? - - - - - 字体宽度不能为0 - - - - - 是否立即重新计米? - - - - - 解锁脉冲计数 - - - - - PulseNumFix - - - Dialog - - - - - 根据速度 - - - - - 根据喷印 - - - - - 根据脉冲数 - - - - - 根据同步器参数 - - - - - 实际皮带速度(毫米/秒): - - - - - 实际喷印间隔长度(毫米): - - - - - 长度(毫米): - - - - - 同步脉冲数 - - - - - 同步器直径(毫米): - - - - - 脉冲数/转: - - - - - 脉冲数修正 - - - - - - - - 错误 - - - - - 速度不应该为0 - - - - - 实际同步长度不应该为0 - - - - - 长度不应该为0 - - - - - 直径不应该为0 - - - - - QBarCode - - - Dialog - - - - - 条形码类型 - - - - - 条形码高度 - - - - - 条码宽度 - - - - - 1点 - - - - - 2点 - - - - - 3点 - - - - - 4点 - - - - - - 5点 - - - - - 6点 - - - - - 文本1 - - - - - 显示缩放 - - - - - 墨水类型 - - - - - 黑墨 - - - - - 白墨 - - - - - 文本3 - - - - - 计数器2 - - - - - 文本2 - - - - - 计数器1 - - - - - 插入文档 - - - - - 预览 - - - - - 返回 - - - - - 条码保存 - - - - - FileName - - - - - 增加数字行 - - - - - 日期 - - - - - 时间 - - - - - 文件未保存 - - - - - BARCODE_128 - - - - - BARCODE_93 - - - - - 7点 - - - - - 9点 - - - - - 12点 - - - - - 16点 - - - - - 24点 - - - - - - 标签宽度:%1,标签高度:%2,文本宽度:%3 - - - - - QObject - - - - 手动设定 - - - - - 应用 - - - - - 起始值 - - - - - 结束值 - - - - - 循环值 - - - - - SceneEditOption - - - Form - - - - - 预览 - - - - - 新建 - - - - - 打开 - - - - - - 保存 - - - - - 另存为 - - - - - 新增图元 - - - - - 编辑图元 - - - - - 删除图元 - - - - - 放大 - - - - - 缩小 - - - - - 提示 - - - - - 文档已经改变,是否保存? - - - - - 放弃保存 - - - - - SystemManage - - - Form - - - - - 手动控制泵阀 - - - - - 齿轮泵开 - - - - - 齿轮泵关 - - - - - 回收槽开 - - - - - - - - - - - - - - 停止 - - - - - 回收槽关 - - - - - 回收泵 - - - - - - 压缩机 - - - - - 混合阀 - - - - - 粘度泵 - - - - - 主墨泵 - - - - - 泄压阀 - - - - - 循环阀 - - - - - 墨水阀 - - - - - 时间设置 - - - - - 从U盘导入配置 - - - - - 更新软件 - - - - - 屏幕校正 - - - - - 更新字库 - - - - - 导出字库 - - - - - 系统升级 - - - - - 出厂设置 - - - - - 自动清洗 - - - - - 电机测试 - - - - - 排气 - - - - - 导出配置到U盘 - - - - - - - Cancel - - - - - (1/2) Cleaning, please wait... - - - - - - - 自动 - - - - - - - - - - - - - - - - - - - - - 开 - - - - - - - - - - - - - - - - - - - - - - 关 - - - - - - - - - - - - - - - - - - - 警告 - - - - - - - - 请先移开喷头盖! - - - - - 是否确认进入手动模式? - - - - - 请先确认已经关闭回收槽,确认进入自动模式? - - - - - - 手动 - - - - - - - - - - - - 启动 - - - - - - - - - - - - - - - - - - 提示 - - - - - - - - 密码不正确! - - - - - Application - - - - - 是否确认更新字库? - - - - - 没找到对应字库,更新失败! - - - - - 更新字库成功,重启后生效! - - - - - 恢复出厂设置成功,请重新关机上电 - - - - - 校准触摸屏 - - - - - 是否确认开始校准程序?请小心进行校准! - - - - - 无法生成脚本 - - - - - 是否确认更新软件? - - - - - - - - - 错误 - - - - - 更新失败! - - - - - 软件更新成功,重启后生效! - - - - - 找不到更新软件! - - - - - 是否确认更新系统? - - - - - 系统更新成功,重启后生效! - - - - - 文件不存在! - - - - - 如果开始清洗,务必确认回收槽已经打开10毫米以上,并且在一分钟后将停止清洗 - - - - - 开始清洗 - - - - - 停止清洗 - - - - - 压力 - - - - - autoclean cancel or status: - - - - - (2/3) Cleaning - - - - - (3/3) Cleaning - - - - - 混合阀打开3: - - - - - 是否确认导出配置到U盘? - - - - - 检测不到U盘 - - - - - 成功导出配置到U盘 - - - - - 是否确认从U盘导入配置? - - - - - 配置文件/udisk/sysPara.bin不存在! - - - - - 从U盘成功导入配置,重启后生效! - - - - - autoclean start - - - - - 是否确认启动自动清洗? - - - - - 是否确认墨水排除,加入清洗剂? - - - - - (1/3) Cleaning - - - - - 是否确认导出字库到U盘? - - - - - U盘不可识别! - - - - - 字库导出完成! - - - - - 是否开始电机测试? - - - - - 正在排气,是否停止? - - - - - SystemSetting - - - Form - - - - - 电机电流: - - - - - 晶振电压(%): - - - - - - °C - - - - - 回收泵力度(%): - - - - - 压力: - - - - - 喷嘴直径: - - - - - 脉冲计数器: - - - - - 64K - - - - - 76K - - - - - 96K - - - - - 128K - - - - - 新晶振 - - - - - 晶振频率: - - - - - 粘度: - - - - - 高压包容差: - - - - - 50 (UM) - - - - - 60 (UM) - - - - - 70 (UM) - - - - - 0 - - - - - 0.6 - - - - - 1.0 - - - - - 1.6 - - - - - 2.0 - - - - - 文本模式 - - - - - 点阵模式 - - - - - 场景模式 - - - - - 信息编辑模式: - - - - - 频率修正: - - - - - 粘度泵动作间隔(秒): - - - - - Hz - - - - - 隔膜位置: - - - - - 墨水温度: - - - - - 粘度校正(%): - - - - - 喷头温度: - - - - - 回收槽开关时间: - - - - - 隔膜位置偏移: - - - - - 5 - - - - - 10 - - - - - 15 - - - - - 20 - - - - - 25 - - - - - 30 - - - - - 40 - - - - - 45 - - - - - 50 - - - - - 55 - - - - - 60 - - - - - 风扇开启温度: - - - - - 重置高压 - - - - - 界面语言设置 - - - - - 喷嘴逆清洗 - - - - - 搜索最佳晶振频率 - - - - - 搜索最佳晶振电压 - - - - - 应用当前配置 - - - - - - - - - - - - - 错误 - - - - - 实际频率不能为%1 - - - - - - - 提示 - - - - - 应用成功 - - - - - 自动清洗时间约为一分钟,然后自动停止 - - - - - 开始清洗 - - - - - 停止清洗 - - - - - 正在喷嘴逆清洗...... - - - - - 清洗完成 - - - - - 密码不正确! - - - - - - - Application - - - - - 是否更新高压包电流数据? - - - - - - - 喷头盖未关,请先关喷头盖! - - - - - - 墨线开关未开,请先打开墨线开关! - - - - - - 回收槽未全部打开! - - - - - 自动搜索耗时较长,期间请不要进行其他操作,是否确认自动搜索最佳晶振电压? - - - - - 自动搜索耗时较长,是否确认自动搜索当前频率2K范围内最佳晶振频率? - - - - - 搜索的起始频率%1 HZ超出范围? - - - - - 高压设置完成 - - - - - Oscillator Freq %1 --- 最长高电平时钟 %2 - - - - - 最佳晶振频率完成 - - - - - - Oscillator voltage %1 --- 最长高电平时钟 %2 - - - - - - 最佳晶振电压完成 - - - - - Tiếng Việt(Vietnamese interface) - - - - - Chinese interface(中文界面) - - - - - English interface(英文界面) - - - - - TextEditOption - - - Form - - - - - 间距 - - - - - 字体 - - - - - 预览 - - - - - 插变量 - - - - - 新建 - - - - - - - 保存 - - - - - 文件 - - - - - - 另存为 - - - - - wenquanyi - - - - - 12 - - - - - 点 - - - - - 粗体 - - - - - - - - - - 警告 - - - - - - - - 无法打开文件 - - - - - - Application - - - - - - 是否确认将文件内容追加到打开的文件? - - - - - 插入图片 - - - - - 插入文本 - - - - - 错误 - - - - - TextEditOption 构造函数参数textEdit 不应当为空 - - - - - 打开文件 - - - - - 以.txt保存将丢失所有格式,你是否愿意保存为.html格式? - - - - - 提醒 - - - - - 检测到有图片 %1 来自U盘,是否拷贝图片到本地? - - - - - 无法保存文件 - - - - - 保存... - - - - - 提示 - - - - - 文档已经改变,是否保存? - - - - - 放弃保存 - - - - - 二维码变量设置 - - - - - 完成 - - - - - TimeSettingDialog - - - Dialog - - - - - 秒: - - - - - 分: - - - - - 月: - - - - - 日: - - - - - 时: - - - - - 年: - - - - - 设置时间 - - - - - TriggerCtrl - - - Form - - - - - 触发模式 - - - - - 光电电平触发 - - - - - 光电边沿触发 - - - - - 同步器触发 - - - - - 延时触发 - - - - - - 封锁时间(毫秒) - - - - - 脉冲数/毫米 - - - - - 无镜像打印 - - - - - 自动水平翻转 - - - - - 自动垂直翻转 - - - - - 中心对称旋转 - - - - - 行末<->行首 - - - - - 行首<->行首 - - - - - 镜象交替类型 - - - - - 同步器清零 - - - - - 脉冲数修正 - - - - - 脉冲输出使能 - - - - - - - - - 重复间隔(毫秒) - - - - - - - - 延时(毫秒): - - - - - 字符宽度: - - - - - 同步打印 - - - - - 间隔模式: - - - - - 产生脉冲所需计数: - - - - - 镜像交替间隔 - - - - - 按字符宽度 - - - - - 按喷印比例 - - - - - 禁止电眼清零 - - - - - 允许电眼复位 - - - - - 允许电眼立即复位 - - - - - 同步喷印模式 - - - - - 重复次数 - - - - - - - - 触发延时(毫秒) - - - - - 同步器正反转打印 - - - - - 同步器只正转打印 - - - - - 同步器只反转打印 - - - - - 喷印间隔(毫米) - - - - - 电眼清零 - - - - - 脉冲信号值: - - - - - 20131228-1 - - - - - 应用当前配置 - - - - - 独立参数 - - - - - - - - 触发延时(毫米) - - - - - - - 重复间隔(毫米) - - - - - - 封锁间隔(毫米) - - - - - - - - 延时(毫米): - - - - - 字符宽度 - - - - - 喷印比例(%) - - - - - 提示:参数不正确 - - - - - 要求:触发长度小于喷印间隔 - - - - - 提示 - - - - - 应用成功 - - - - - 封锁间隔(毫秒) - - - - - ZkEdit - - - Form - - - - - 编辑图案 - - - - - 缩小 - - - - - - - 保存 - - - - - 新建 - - - - - 保存为 - - - - - 高度 - - - - - 图像扩张 - - - - - 打开 - - - - - 宽度 - - - - - A - - - - - 放大 - - - - - 导入 - - - - - 图像裁剪 - - - - - 提示 - - - - - 图片已经改变,是否保存? - - - - - 放弃保存 - - - - - - - 放大倍数:%1 - - - - - 图片另存为... - - - - - 另存为 - - - - - 打开文件 - - - - - 图片保存为... - - - - - 导入文件 - - - - - dlgDrawInit - - - 图案参数设置 - - - - - 图案宽度(像素) - - - - - 图案高度(像素) - - - - - 确定 - - - - - dlgQrCode - - - Dialog - - - - - 返回 - - - - - DataMatrix - - - - - QRCode - - - - - 保存 - - - - - 预览 - - - - - 正相打印 - - - - - 反相打印 - - - - - 变量增量 - - - - - 信息前缀 - - - - - 变量(初值) - - - - - 信息后缀 - - - - - - TextLabel - - - - - 计数器(变量) - - - - - 自动刷新 - - - - - 插入文档 - - - - - 条形码 - - - - - 默认 - - - - - 8 x 18 - - - - - 8 x 32 - - - - - 12 x 26 - - - - - 12 x 36 - - - - - 16 x 36 - - - - - 16 x 48 - - - - - DM码尺寸: - - - - - 自动插入时间 - - - - - 警告 - - - - - 输入内容超出选择DM码尺寸大小,请选择更大的尺寸! - - - - - [%1 X %2] - - - - - logo_Form - - - Form - - - - - zkWidget - - - - 警告 - - - - - 最大支持宽度:%1 高度:%2 当前请求:%3 x %4 - - - - - 请新创建建图片 - - - - + + + +UTF-8 + + DevOp + + + + + + + + 警告 + + + + + 字高超出范围 + + + + + 字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误 + + + + + 喷印间隔太短,无法满足同步打印宽度设置,字宽将自动缩短! + + + + + + 错误 + + + + + 在同步计米的情况下无打印串或显示区域为零 + + + + + 在同步计米的情况下喷印同步脉冲数过多,请检查你的配置 + + + + + 喷印字符串太短,请增加字符串长度或在打印设置中减少喷印长度 + + + + + 喷印长度太短,请减少字符串长度或在打印设置中增加喷印长度 + + + + + DialogAuthorization + + + Dialog + + + + + 授权密码: + + + + + 提升授权 + + + + + DialogCycleprint + + + Dialog + + + + + 1循环范围:0- + + + + + 1循环次数: + + + + + 2循环范围:0- + + + + + 2循环次数: + + + + + 3循环范围:0- + + + + + 3循环次数: + + + + + 6循环次数: + + + + + 6循环范围:0- + + + + + 5循环范围:0- + + + + + 5循环次数: + + + + + 4循环范围:0- + + + + + 4循环次数: + + + + + DialogFileOperation + + + Dialog + + + + + 本地文件 + + + + + U盘文件 + + + + + 删除文件 + + + + + 删除全部 + + + + + 从U盘导入 + + + + + 导出到U盘 + + + + + 插入 + + + + + 打开文件 + + + + + 上一个 + + + + + 下一个 + + + + + 退出 + + + + + 文件操作 + + + + + + + 警告 + + + + + 是否确认删除当前文件? + + + + + 是否确认删除所有文件? + + + + + + + + 提示 + + + + + 是否确认从U盘导入所有文件? + + + + + mv %1/VoltParaHi.bin %1/VoltParaStd.bin %2/ + + + + + cp %1/* %2/ + + + + + 成功从U盘导入? + + + + + 是否确认将所有文件导出到U盘? + + + + + 成功导出到U盘? + + + + + U盘未插入或U盘根目录下的doc文件夹不存在! + + + + + DialogFontSize + + + Dialog + + + + + 9点(左横) + + + + + 16点(中/英) + + + + + 7点(左横) + + + + + 7点(英) + + + + + 5点(英) + + + + + 9点(右横) + + + + + 12点(中/英) + + + + + 9点(英) + + + + + 7点(右横) + + + + + 24点(中/英) + + + + + 7点(孟加拉) + + + + + 32点 + + + + + 7点(rf7) + + + + + 21点(rf21) + + + + + 12点(新罗马) + + + + + 123456890ABCDEFGWXYZ + + + + + - + + + + + 查字库标识 + + + + + 选择字体大小 + + + + + DialogInputTxt + + + Dialog + + + + + DialogInsertVari + + + Dialog + + + + + 变量类型 + + + + + 生产日期 + + + + + 年 + + + + + 计数器1 + + + + + 计数器2 + + + + + 时 + + + + + 周 + + + + + 随机码1 + + + + + 月 + + + + + DataMatrix + + + + + QRCode + + + + + 有效日期 + + + + + Class + + + + + 秒 + + + + + 日 + + + + + 分 + + + + + BarCode128 + + + + + 计数器3 + + + + + 数字个数 + + + + + 9个 + + + + + 11个 + + + + + 10个 + + + + + 2个 + + + + + 1个 + + + + + 3个 + + + + + 4个 + + + + + 5个 + + + + + 6个 + + + + + 7个 + + + + + 8个 + + + + + 12个 + + + + + 13个 + + + + + 14个 + + + + + 15个 + + + + + 变量插入 + + + + + DialogLineSpace + + + Dialog + + + + + + 0个像素 + + + + + + 1个像素 + + + + + + 2个像素 + + + + + + 3个像素 + + + + + + 4个像素 + + + + + + 5个像素 + + + + + 6个像素 + + + + + 7个像素 + + + + + 行间距: + + + + + 字符间距: + + + + + 选择行间距和字符间距 + + + + + DialogPointDistanceAdjust + + + Dialog + + + + + 列首: + + + + + 列中: + + + + + 列尾: + + + + + 重置 + + + + + 测试 + + + + + DialogSaveFile + + + Dialog + + + + + 本地文件 + + + + + U盘文件 + + + + + 预览文件内容: + + + + + 上一个 + + + + + 下一个 + + + + + 请输入文件名: + + + + + 取消 + + + + + + 保存 + + + + + 警告 + + + + + U盘未插入或U盘根目录下的doc文件夹不存在! + + + + + DialogShowCounter + + + Dialog + + + + + 米标显示: + + + + + 目前循环范围: + + + + + + + 米 + + + + + 剩余米数: + + + + + 循环次数: + + + + + 立即重新计米 + + + + + 起始: + + + + + 结束: + + + + + Dialoginputpasswd + + + Dialog + + + + + 修改密码: + + + + + Dialogmodifypasswd + + + Dialog + + + + + 修改密码: + + + + + 密码授权 + + + + + DigitalInput + + + Form + + + + + 9 + + + + + 3 + + + + + 8 + + + + + - + + + + + 退格 + + + + + 1 + + + + + 4 + + + + + 0 + + + + + 5 + + + + + 7 + + + + + 2 + + + + + 6 + + + + + 全选 + + + + + DlgInputAddr + + + Dialog + + + + + 请输入6位机编号(前3位为经销商编号) + + + + + PowerOnCnt + + + + + PrintDotCnt + + + + + PowerMax + + + + + PrintMax + + + + + 开始时间 + + + + + 结束时间 + + + + + SuperNodeIP: + + + + + edgeIP: + + + + + + + + + + . + + + + + 喷码机恢复工作! + + + + + 维护时间剩余 + + + + + 小时,喷码机将停止工作.请与供应商联系! + + + + + + 当前日期: + + + + + + 正确? + + + + + 维护时间已到,喷码机停止工作!请与供应商联系 + + + + + DlgMutiLanguage + + + 界面语言设置 + + + + + 西班牙语 + + + + + 中文 + + + + + 泰语 + + + + + 英语 + + + + + 土耳其语 + + + + + 越南语 + + + + + (注意: 选择切换显示语言, 重启后才能生效) + + + + + DlgMyWarring + + + 警告 + + + + + 确定 + + + + + TextLabel + + + + + DlgSelectInputLanguage + + + Dialog + + + + + 汉语(Chinese) + + + + + 英语(English) + + + + + 越南语(Vietnam) + + + + + DlgShowMsg + + + 警告 + + + + + 确定 + + + + + DlgVarLength + + + 变长喷印参数 + + + + + 头部长度(m) + + + + + 尾部长度(m) + + + + + 总长(m) + + + + + + 调整长度(mm) + + + + + 可变长度允许 + + + + + 确定 + + + + + InkJetPrinter + + + TabWidget + + + + + 主窗口 + + + + + + + 信息编辑 + + + + + 图案编辑 + + + + + 打印设置 + + + + + 触发设置 + + + + + + 系统设置 + + + + + + 系统管理 + + + + + + 其他信息 + + + + + + 日志信息 + LogInfo + + + + + 网络管理 + + + + + 电压调整 + VolSet + + + + Save + + + + + 不连续电压 + Discontinuous voltage + + + + + vol0 + + + + + + vol1 + + + + + + vol2 + + + + + + vol3 + + + + + + vol4 + + + + + + vol5 + + + + + + vol6 + + + + + + vol7 + + + + + + vol8 + + + + + + vol9 + + + + + + vol10 + + + + + + vol11 + + + + + + vol12 + + + + + + vol13 + + + + + + vol14 + + + + + + vol15 + + + + + + vol16 + + + + + + vol17 + + + + + + vol18 + + + + + + vol19 + + + + + + vol20 + + + + + + vol21 + + + + + + vol22 + + + + + + vol23 + + + + + + vol24 + + + + + + vol25 + + + + + + vol26 + + + + + + vol27 + + + + + + vol28 + + + + + + vol29 + + + + + + vol30 + + + + + + vol31 + + + + + + vol32 + + + + + + vol33 + + + + + + vol34 + + + + + + vol35 + + + + + + vol36 + + + + + + vol37 + + + + + + vol38 + + + + + + vol39 + + + + + 连续电压 + Continuous voltage + + + + 满列电压 + Full train voltage + + + + fvol0 + + + + + fvol1 + + + + + fvol2 + + + + + fvol3 + + + + + fvol4 + + + + + fvol5 + + + + + fvol6 + + + + + fvol7 + + + + + fvol8 + + + + + fvol9 + + + + + fvol10 + + + + + fvol11 + + + + + fvol12 + + + + + fvol13 + + + + + fvol14 + + + + + fvol15 + + + + + fvol16 + + + + + fvol17 + + + + + fvol18 + + + + + fvol19 + + + + + fvol20 + + + + + fvol21 + + + + + fvol22 + + + + + fvol23 + + + + + fvol24 + + + + + fvol25 + + + + + fvol26 + + + + + fvol27 + + + + + fvol28 + + + + + fvol29 + + + + + fvol30 + + + + + fvol31 + + + + + fvol32 + + + + + fvol33 + + + + + fvol34 + + + + + fvol35 + + + + + fvol36 + + + + + fvol37 + + + + + fvol38 + + + + + fvol39 + + + + + 其他调整 + Other adjustments + + + + 整体缩放(%) : + Overall scaling (%) : + + + + WriteByte + + + + + ReadByte + + + + + + + Address: + + + + + + Value: + + + + + WriteWord + + + + + ReadWord + + + + + ReadDword + + + + + WriteDword + + + + + ValueH: + + + + + ValueL: + + + + + 定时开机 + timed start + + + + + 压力泄漏或压力传感器故障! + Pressure leakage or pressure sensor failure! + + + + 运行中压力泄漏,停齿轮泵! + If the pressure leaks during operation, stop the gear pump! + + + + + 测试时间结束,准备关机 + The test time is over, ready to shut down + + + + 定时开机循环完成,准备关机 + self checking done in alarm resump, ready to poweroff + + + + 准备关机 + ready poweroff + + + + 与FPGA失去通信!!! + Lose contact with FPGA ! + + + + 与FPGA通信恢复正常 + The contact with FPGA recovered + + + + 开始自检,请等待60秒............... + + + + + 开始自检,请等待%1秒............... + + + + + + 自检完成!!! + Self-checking done ! + + + + + 墨水或溶剂空,准备关机 + Ink or mekeup empty, prepare shutdown + + + + 喷印速度过快!无法喷印完全,自动暂停喷印!!! + Jetting overspeed ! Cannot print all content. +Printing paused automatically! + + + + 喷印速度过快!无法喷印完全!!! + Speed is too fast or interval is too short! Unable to print all char!!! + + + + 压力波动超过设定的5个值. + The pressure fluctuation exceeds the set 5 values + + + + 停止打印,自动关闭高压. + Stop printing and automatically turn off high voltage + + + + 压力异常:上次压力值%1,当前压力值%2 + Pressure fault:last value is %1, current value is %2 + + + + 高压异常:上次电流值%1,当前电流值%2 + High voltage fault:last current value is %1, current current value is %2 + + + + + 齿轮泵转速过高,请立即停机并联系供应商! + The speed is too high, please stop immediately and contact the supplier! + + + + + 齿轮泵转速过高,请清理过滤器或者检查是否泄露! + The speed is too high, please clean the filter or check for leaks! + + + + 警告:加热器长时间无法达到预期温度,故障或设置错误! + Warning: The heater cannot reach pre-set temperature, +it may caused by fault or setting mistake ! + + + + + 错误!!!!!!!!!!!主墨泵故障 + Wrong!!! Main ink pump fault + + + + + 主墨泵故障!!! + Main ink pump fault! + + + + 错误!!!!!!!!!!!压缩机故障 + Wrong!!! Compressor fault + + + + 压缩机故障!!! + Compressor fault ! + + + + + 错误!粘度计下位灯故障. + Error! Viscometer inferior lamp failure. + + + + + 错误!粘度计故障:检测不到上位灯. + Error:Viscometer fault! the upper lamp is not detected. + + + + 混合阀打开1: + The mixing valve opens 1: + + + + + 警告!!!!!!!!!!!粘度值偏低 + Warning! Low viscosity + + + + + 错误!!!!!!!!!!!粘度偏大故障 + Error! Viscosity larger fault + + + + 粘度检测异常,粘度值太大!!! + The viscosity anomaly detection, viscosity too high!!! + + + + 混合阀打开2: + The mixing valve opens 2: + + + + + + 电机故障 + Motor fault + + + + 电机故障!!! + Motor fault ! + + + + + 回收槽到头 + Collector reaches the end + + + + + + + 回收槽卡住或者回收槽开关时间设置错误 + Collector seized, or the collector's switch time was setted in wrong + + + + 喷印速度过快或间隔太短!无法喷印完全,自动暂停喷印!!! + Speed is too fast or interval is too short! Unable to print all, stop print now!!! + + + + 喷印速度过快或间隔太短!无法喷印完全!!! + Speed is too fast or interval is too short! Unable to print all char!!! + + + + 提示 + hint + + + + 是否接收新的信息! + Whether to receive new information! + + + + InputMethod + + + Form + + + + + 1 书 + + + + + 2 输 + + + + + 3 数 + + + + + 4 属 + + + + + 5 熟 + + + + + 上一页 + + + + + 下一页 + + + + + ` + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 0 + + + + + - + + + + + = + + + + + 退格 + + + + + + 英文 + + + + + q + + + + + w + + + + + e + + + + + r + + + + + t + + + + + y + + + + + u + + + + + i + + + + + o + + + + + p + + + + + [ + + + + + ] + + + + + \ + + + + + + 大写 + + + + + a + + + + + s + + + + + d + + + + + f + + + + + g + + + + + h + + + + + j + + + + + k + + + + + l + + + + + ; + + + + + ' + + + + + Enter + + + + + Shift + + + + + z + + + + + x + + + + + c + + + + + v + + + + + b + + + + + n + + + + + m + + + + + , + + + + + . + + + + + / + + + + + 上 + + + + + 特殊字 + + + + + 隐藏 + + + + + Ctrl + + + + + 删除 + + + + + 行首 + + + + + 行尾 + + + + + 左 + + + + + 下 + + + + + 右 + + + + + + 错误 + + + + + hanziDisplayLabels缺少初始化 + + + + + warning + + + + + myInputMethod is null + + + + + + 找不到输入法初始化文件 + + + + + 小写 + + + + + Tiếng Việt + + + + + Russian + + + + + Japanese + + + + + 全选 + + + + + 复制 + + + + + 粘贴 + + + + + 剪切 + + + + + 后退 + + + + + InsertSpaceNumDialog + + + 插入空格数 + + + + + 空格个数: + + + + + LogInfo + + + Form + + + + + 当前状态 + + + + + 清空当前状态 + + + + + 历史状态 + + + + + TextLabel + + + + + 删除历史文件 + + + + + 打开历史文件 + + + + + 导出日志到U盘 + + + + + 版本信息 + + + + + 请先打开历史状态文件! + + + + + + + 警告 + + + + + + + 无法打开文件 + + + + + + + + 提示 + + + + + 是否确认将所有日志文件导出到U盘? + + + + + 成功导出到U盘? + + + + + 选择历史记录文件 + + + + + 是否确认将历史日志文件全部清除? + + + + + 是否确认将当前日志全部清除? + + + + + MainWindow + + + InkJet + + + + + 编辑 + แก้ไข + + + + 打开文件 + เปิดไฟล์ + + + + 二维码 + คิวอาร์โค้ด + + + + 条形码 + บาร์โค้ด + + + + 缩小 + ซูมเข้า + + + + 放大 + ซูมออก + + + + 获取数据 + get the data + + + + 交替打印文件名 + Alternate printing file name + + + + 最大:[40行x 2048列] + + + + + 同步器速度 + ความเร็ว + + + + 当前时间 + เวลา + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Monospace'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi'; font-size:10pt; vertical-align:bottom;"><br /></p></body></html> + + + + + 墨线开关 + สวิตซ์ +หมึก + + + + 喷头盖开 + ฝาหัวพิมพ์ + เปิด + + + + 墨水缸满 + ถังหมึก +เต็ม + + + + 墨水液位 + ระดับหมึก +ต่ำ + + + + 溶剂液位 + เมคอัพ +ต่ำ + + + + 回收故障 + ท่อดูดกลับ +ผิดพลาด + + + + 粘度故障 + ความหนืด +ผิดพลาด + + + + 相位故障 + เฟสหมึก +ผิดพลาด + + + + 高压故障 + ไฮโวลท์ +ผิดพลาด + + + + 故障恢复 + รีเซ็ตความ +ผิดพลาด + + + + 立即重新计米 + รีเซ็ตจำนวนนับ + + + + 产品计数 + การตรวจนับสินค้า + + + + 产品总计数 + Grand Total + + + + 关机 + ปิดเครื่อง + + + + 2014-08-23 + 1 {2014-08-23?} + + + + 粘度 + + + + + 高压包 + + + + + + 隔膜位置 + DiaphragmPOS + + + + 压力 + + + + + + + + 开 + เปิดหัว +พิมพ์ + + + + + + + 关 + ปิดหัว +พิมพ์ + + + + + 暂停打印 +停止高压 + Pause to print +Stop high pressure + + + + 喷嘴逆清洗 + ทำความสะอาด +รูฉีดหมึก + + + + 紧急停机 + ปิดฉุกเฉิน + + + + + 机箱: + CASE: + + + + + + 正在喷印............... + Printting...... + + + + 喷头盖开, 喷印无法正常进行!!! + Cannot print while printhead cover is open ! + + + + + 墨水缸满报警 + The ink jar is full of alarm + + + + + 墨水液位报警 + ระดับหมึกต่ำ + + + + + 溶剂液位报警 + ระดับเมคอัพต่ำ + + + + + 高压故障,暂停打印 + High voltage fault, Pause Printing. + + + + + 高压故障,暂停打印. + High voltage fault, Pause Printing. + + + + 高压故障,关回收槽 + HighVoltFault,ReclainTank auto Colse + + + + 高压故障,关回收槽和墨线 + HighVoltFault,ReclainTank auto Colse + + + + + + + + 回收故障,关闭回收槽,关墨线 + HighVoltFault,ReclainTank auto Colse + + + + 回收故障. + Recovery failure. + + + + 回收异常,墨线可能偏离.(%1) + Recovery abnormal, InkLine may deviate (%1) + + + + 维护时间已到,喷码机停止工作! + The maintenance time has come,Inkjet printer stop working! + + + + + 暂停喷印............... + Pause printing... + + + + 相位故障:飞行时间错误! + Phase fault: wrong flight time! + + + + 相位故障:相位检测错误! + Phase fault: phase detection error! + + + + + + 相位故障,准备关机 + Phase Fault, ShoutDown Now + + + + + + 相位故障,暂停打印 + Phase fault, printing was paused + + + + 相位故障,屏蔽DAC输出 + Phase fault, DAC export was shield + + + + + 相位故障,屏蔽充电 + Phase fault, charging was shield + + + + 齿轮泵转速 + + + + + 交替打印 + AltPrint + + + + 电眼交替 + Alter by electronic Eye + + + + %1.%2[%3.%4]米/分 + %1.%2[%3.%4] m/s + + + + 列延时:%1点 + Column interval: %1 pixel + + + + + + + + + + + + + + + 警告 + Warnning + + + + 无法打开文件 + Cannot open file + + + + 打开文件: + เปิดไฟล์: + + + + + + 提示 + Tips + + + + 文件未保存,是否先保存文件! + File not save,please save it Now! + + + + + 最多支持的列数目为:%1请减小信息长度. + The maximum number of columns supported is:%1, please decrease the length of the information. + + + + + + + 变量数大于8个,某些变量将不起作用!!! + The variable number is greater than 8, and some variables will not work!!! + + + + + 请减少信息中的变量(或计数器)数量. + Please reduce the number of variables (or counters) in the printe file. + + + + warning,界面上有变量未显示完全 + Warning,Interface shows not all variables + + + + + + + [ %1行 x %2列 ] + %1 row x %2 column + + + + + + + + 错误 + ผิดพลาด + + + + 喷印间隔过短,应高于%1! + Printing interval is too short, +should be higher than %1! + + + + 喷头盖未关,请先关喷头盖! + Please close the printhead cover ! + + + + 墨线未开,请先开墨线开关! + Please turn on the inkjet switch ! + + + + 正在加高压... + High voltage is being up... + + + + 当前总列数 %1 ,支持的总列数为 %2,请减少打印串的长度 + Present total column number is %1, system support total column number is %2, please reduce the length of character string + + + + 打印耗时 %1ms ,触发间隔 :%2ms ,触发间隔至少应当大于打印耗时3ms + Print time: %1ms, trigger interval: %2ms, trigger interval must be greater than print time, and the gap should not less than 3ms + + + + 开始打印1 + เริ่มพิมพ์1 + + + + + 开始打印 + เริ่มพิมพ์ + + + + 回收槽未到底!!!!!! + Collector does not return to the end ! + + + + 停止打印 + หยุดพิมพ์ + + + + + 随机码文本将展出到U盘,请插入U盘 + The RandomCode save U disk. Please insert the U disk + + + + 暂停打印 + Print paused + + + + 继续打印 + พิมพ์ต่อเนื่อง + + + + 继续打印 +保持高压 + To continue printing +Keep the high pressure + + + + 正在排气 ............... + Exhausting........ + + + + + 停止 + หยุด + + + + 正在打开回收槽... + เปิดหัวพิมพ์... + + + + 停止打开 + หยุดเปิด + + + + + 警告!回收槽开关时间未设置! + Warning! The switch time of collector does not set! + + + + + 回收槽之前发生阻塞或回收槽时间设置错误,是否强制将当前位置设为到顶位置? + Collector blocked or recycle time wrong set at before. Do you want to set present positon as the end position forcibly ? + + + + 正在关闭回收槽... + closing reatank now... + + + + 停止关闭 + Stop closing + + + + 准备关机...... + Printer is going to close shutdown... + + + + 泵启动 + ปั๊มทำงาน + + + + 泵停止 + ปั๊มหยุดทำงาน + + + + 回收槽未关,是否关闭回收槽后关机! + Collector does not return. Do you want to turn off the collector before shutdown ? + + + + 是否确认关机? + Do you want to turn the printer off ? + + + + 是否初始化产品计数? + Do you want to initialize the Product Count ? + + + + 是否清除总产品计数? + Do you want to clear the Grand Total ? + + + + 是否立即重新计米? + Are you want to reset counter! + + + + 警告:‘-’和空格的宽度不一样 + Warning: the width of '-'is not same as a space + + + + 条形码信息编辑 + แก้ไขบาร์โค้ด + + + + + 二维码信息编辑 + แก้ไขคิวอาร์โค้ด + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'wenquanyi'; font-size:10pt;"><br /></p></body></html> + + + + + 获取DM码内容为空! + Get DM code content is empty! + + + + + 获取DM码内容: + get DM code data: + + + + + 获取DM码内容跟上次相同 + Get the same DM code content as last time + + + + 高压故障:两高压偏转板间的电压检测异常 + High-voltage fault: two high voltage deflection plate voltage detection abnormal + + + + 1.高压偏转板和高压底座潮湿、脏污,请清洗并吹干高压板和高压底座; + 1. high pressure deflector and high voltage base, wet and dirty, please clean and dry high pressure plate and high voltage base; + + + + 2.机器更换主板或者高压包,请进入“系统设置”点击“重置高压”,字高设置为90时,重置高压报警值应在480—550之间; + 2., the machine changes the motherboard or high voltage package, please enter the "system settings", click "reset high", and set the word high to 90, reset the high voltage alarm value should be between 480 and 550; + + + + 3.高压线路漏电,请更换高压线路; + 3. high voltage line leakage, please replace the high voltage line; + + + + 4.高压底座漏电,请更换高压底座。 + 4. high voltage base leakage, please replace the high voltage base. + + + + 墨水过多:墨水溢出 + Excessive ink: ink overflow + + + + 1. 请停止添加墨水; + 1. please stop adding ink; + + + + 2. 请排出多余墨水。 + 2. please discharge excess ink. + + + + 墨水液位:墨水即将耗尽 + Ink level: ink is about to run out + + + + 1. 墨水耗尽,3小时后将自动关机,请及时添加墨水。 + 1., the ink is exhausted, 3 hours after the automatic shutdown, please add ink in time. + + + + 回收故障:未检测到有墨水回收 + Recovery failure: no ink recovery was detected + + + + 1. 墨水未射入回收管,请修正墨线方向; + 1. ink not into recycling tube, please correct line direction; + + + + 2. 墨水粘度太低,请更换新墨水; + 2. ink viscosity is too low, please replace the new ink; + + + + 3. 回收管堵塞,请清通或者更换回收管; + 3. recovery of pipe blockage, please clear or replace the recovery tube; + + + + 4. 回收泵故障,请清洗或者更换回收泵; + 4., the recovery pump failure, please clean or replace the recovery pump; + + + + 5. 确认各参数及设备无异常后请进入“打印设置”取消“回收故障处理”的勾选,退回主窗口界面点击“故障恢复”按钮. + 5. after confirming that all the parameters and equipment are not abnormal, please enter the "print settings", cancel the "recovery troubleshooting" check, return to the main window interface, click the "fault recovery" button. + + + + 溶剂液位:溶剂即将耗尽 + Mekeup level: mekeup is about to run out + + + + 1. 溶剂耗尽,3小时后将自动关机,请及时添加溶剂。 + 1. mekeup depletion, 3 hours after the automatic shutdown, please add solvent in time. + + + + + 粘度故障报警 + Viscosity alarm + + + + 粘度故障:墨水粘度无法自动调整 + Viscosity fault: Ink viscosity can not be adjusted automatically + + + + 1. 混合阀失灵,请冲洗或者更换混合阀; + 1. the mixing valve fails, please flush or replace the mixing valve; + + + + 2. 墨水罐内的墨水异常,请更换新墨水; + 2. the ink in the ink pot is abnormal. Please replace the ink; + + + + 粘度计异常: + Viscometer anomaly: + + + + 1. 泵前过滤网堵塞,请更换泵前滤网; + 1. the filter screen is blocked before the pump. Please replace the strainer before the pump; + + + + 2. 粘度泵异常,请清洗或更换粘度泵; + 2. viscosity pump abnormal, please clean or replace viscosity pump; + + + + 3. 粘度传感器异常,请检查传感器线路或者更换传感器. + 3. viscosity sensor abnormal, please check the sensor or replace the it. + + + + 相位故障报警 + Phase alarm + + + + 相位故障:相位信号检测异常 + Phase fault: phase detection exception + + + + 1. 墨水分裂不正常,请调整墨水分裂; + 1. ink dot split abnormal, please adjust the ink split; + + + + 2. 充电槽或者相检头脏污,请清洗充电槽和相检头; + 2. charging tank or check head dirty, please clean the charging tank and phase head; + + + + 3. 放大板功能性异常,请更换放大板; + 3. the magnifying board is abnormal. Please replace it; + + + + 4. 相检头和墨线的距离过远,请检测喷头活动机构,调整相检头和墨线间的距离; + 4. phase detection head and its distance is too far away, check the nozzle moving mechanism, adjusting the distance between the head and the ink; + + + + 5. 地线未接或者外界干扰,请连接地线或者隔离外界干扰; + 5. the ground has not received or outside interference, please connect the ground wire or isolate the outside interference; + + + + 6. 墨水质量异常,请更换新墨水。 + 6. the ink is of exceptional quality. Please replace the ink. + + + + 回收槽开关检测完成! + Recycling tank switch detection completed! + + + + MemDisplayAndEdit + + + Form + + + + + 07 + + + + + 02 + + + + + 06 + + + + + 0D + + + + + 09 + + + + + 03 + + + + + 01 + + + + + 04 + + + + + 0C + + + + + 0A + + + + + 0F + + + + + 05 + + + + + 00 + + + + + 08 + + + + + 0B + + + + + 0E + + + + + 基地址: + + + + + 0x0000 + + + + + 0xb100 + + + + + 0xb200 + + + + + 0xa400 + + + + + 0xe000 + + + + + 读空间 + + + + + 写空间 + + + + + 进制转换 + + + + + + 编辑 + + + + + 上一页 + + + + + 下一页 + + + + + 完成 + + + + + ModbusSerial + + + 接收到开始打印命令 + + + + + 接收到暂停打印命令 + + + + + 接收到停止打印命令 + + + + + 接收到DM码数据命令 + + + + + MyFileDialog + + + 确定 + + + + + NetworkManager + + + Form + + + + + WiFi: + + + + + Mask: + + + + + GW: + + + + + + IP: + + + + + Status: + + + + + 取消 + + + + + 主获取数据按钮 + + + + + SSID: + + + + + 有线LAN + + + + + 手动设定 + + + + + Disconnect + + + + + Plaintext (open / no authentication) + + + + + Static WEP (no authentication) + + + + + Static WEP (Shared Key authentication) + + + + + IEEE 802.1X + + + + + WPA-Personal (PSK) + + + + + WPA-Enterprise (EAP) + + + + + WPA2-Personal (PSK) + + + + + WPA2-Enterprise (EAP) + + + + + 设备码: + + + + + Encryption: + + + + + 服务IP: + + + + + None + + + + + WEP + + + + + TKIP + + + + + CCMP + + + + + 8754 + + + + + 服务端口: + + + + + PSK: + + + + + Connect + + + + + Password: + + + + + Scan + + + + + Remove + + + + + auth: + + + + + 获取数据 + + + + + ScanSSID + + + + + Network: + + + + + 1 + + + + + 47.111.170.144 + + + + + AddNetwork + + + + + 测试 + + + + + 应用配置 + + + + + 去掉数字码 + + + + + 去掉QR码 + + + + + wpa_supplicant service is not running. +Do you want to start it? + + + + + Disconnected + + + + + Inactive + + + + + Scanning + + + + + Authenticating + + + + + Associating + + + + + Associated + + + + + 4-Way Handshake + + + + + Group Handshake + + + + + Completed + + + + + Unknown + + + + + Could not get status from wpa_supplicant + + + + + Select any network + + + + + WPS AP in active PBC mode found + + + + + Press the PBC button on the screen to start registration + + + + + WPS AP with recently selected registrar + + + + + WPS AP detected + + + + + PBC mode overlap detected + + + + + More than one AP is currently in active WPS PBC mode. Wait couple of minutes and try again + + + + + Network configuration received + + + + + Registration started + + + + + Registrar does not yet know PIN + + + + + Registration failed + + + + + Registration succeeded + + + + + WPA Pre-Shared Key Error + + + + + WPA-PSK requires a passphrase of 8 to 63 characters +or 64 hex digit PSK + + + + + Network ID Error + + + + + Network ID String contains non-word characters. +It must be a simple string, without spaces, containing +only characters in this range: [A-Za-z0-9_-] + + + + + + Failed to add network to wpa_supplicant +configuration. + + + + + Failed to enable network in wpa_supplicant +configuration. + + + + + This will permanently remove the network +from the configuration. Do you really want +to remove this network? + + + + + Yes + + + + + No + + + + + Failed to remove network from wpa_supplicant +configuration. + + + + + + + + 提示 + + + + + 是否去获取数据! + + + + + 获取数据中... + + + + + + 上报数据中... + + + + + + IP设置错误! + + + + + 应用成功 + + + + + OtherInfo + + + Form + + + + + 相位位置: + + + + + 相位偏移: + + + + + 飞行时间: + + + + + DetectDelay + + + + + 相检: + + + + + FullTimeEn + + + + + DetectVol + + + + + HighLowRatio + + + + + 充电占空比100% + + + + + detect_num + + + + + + 锁定相位 + + + + + 相位检测电压: + + + + + 频闪灯周期: + + + + + 检测墨点数量: + + + + + 检测延时: + + + + + 应用当前配置 + + + + + 提示 + + + + + 应用成功 + + + + + 点 + + + + + 解锁相位 + + + + + PicEdit + + + Form + + + + + 开启软键盘 + + + + + 插入变量 + + + + + + 保存/打印 + + + + + 缩小 + + + + + 放大 + + + + + 5点阵 + + + + + 7点阵 + + + + + 9点阵 + + + + + 12点阵宋体 + + + + + 16点阵宋体 + + + + + 16点阵黑体 + + + + + 24点阵宋体 + + + + + 24点阵黑体 + + + + + 列高 + + + + + 无加粗 + + + + + 加粗1倍 + + + + + 加粗2倍 + + + + + 光栅[X:Y] + + + + + 放大比例 + + + + + 插入模式 + + + + + 文件名 + + + + + CURR[X,Y] + + + + + 新建信息 + + + + + 打开文件 + + + + + 字符间距 + + + + + 插入/修改 + + + + + 删除字符 + + + + + 插入图片 + + + + + 保存为 + + + + + + + 字库编辑 + + + + + 网格 + + + + + 粗体 + + + + + 显示控制符 + + + + + 行首 + + + + + 行尾 + + + + + 字符光标 + + + + + 像素光标 + + + + + 编辑现有的多字体 + + + + + 点击光栅可打开键盘,点击空白处关闭 + + + + + + + + + + + + 放大倍数:%1 + + + + + + 插入模式 + + + + + + 修改模式 + + + + + 编辑现有的多字体文件 +请使用修改模式!!! + + + + + + + 保存 + + + + + 点击光栅可打开键盘,点击空白处关闭 + + + + + 信息编辑 + + + + + 字库保存 + + + + + + 返回信息编辑 + + + + + 请选择字体,打开键盘并输入要编辑的字符 + + + + + + + 提示 + + + + + 图片已经改变,是否保存? + + + + + 放弃保存 + + + + + 文件另存为... + + + + + 另存为 + + + + + + + + + + 文件名: + + + + + 文件名:) + + + + + 文件保存为... + + + + + 本条信息的变量超过规定数量! + + + + + 是否立即喷印当前的文件? + + + + + 是 + + + + + 否 + + + + + 按回车键(Enter)可增加新行. 选择字体,光栅会自动调整 + + + + + 选择[字体]可改变光标大小. + + + + + 选择[绘图]方式,可以绘制任意图形 + + + + + 光标不匹配时,不能输入或删除. + + + + + 点击空白处可关闭键盘. + + + + + 通过[字库编辑]功能,用户可以自定义新字符 + + + + + 选择[文本模式]可切换到主界面编辑方式. + + + + + 点击光栅可打开键盘,点击空白处关闭键盘 + + + + + 使用[字库编辑]功能,用户可自己修改字形 + + + + + PicWidget + + + Please input a char. + + + + + 请输入要编辑的字符 + + + + + 编辑字符:%1 + + + + + [%1行,%2列] + + + + + 光标[%1,%2] + + + + + + + + + + + + + + 警告 + + + + + 最大支持宽度:%1 高度:%2 当前请求:%3 x %4 + + + + + + + 请新创建建图片 + + + + + + + 文件:%1 无法打开 + + + + + 信息中的变量数超过了最大值(8)!请减小变量数. + + + + + + 两个变量之间至少要空出一个墨点! + + + + + PrintSetting + + + Form + + + + + 提升权限 + + + + + 墨线时间 + + + + + + + + 0 + + + + + 墨线时间: + + + + + 开机次数: + + + + + 维护时间: + + + + + 应用当前配置 + + + + + 常用设置 + + + + + TextLabel + + + + + 打印模式: + + + + + 字体宽度: + + + + + 首行电压(%): + + + + + 字体加粗: + + + + + + 快速 + + + + + + + 标准 + + + + + + 慢速1 + + + + + + 慢速2 + + + + + + 慢速3 + + + + + + 慢速4 + + + + + + 慢速5 + + + + + 字高设置(%): + + + + + 行末电压(%): + + + + + 修改授权 + + + + + 回收故障处理 + + + + + 超速暂停打印 + + + + + 自然数计米 + + + + + 信息上下颠倒 + + + + + 相位故障关机 + + + + + 相位故障不打印 + + + + + 故障停止走米 + + + + + 信息左右颠倒 + + + + + 不打印走米 + + + + + 省点 + + + + + 电眼误触禁止 + + + + + 高压故障关回收槽 + + + + + + 调整电压 + + + + + 字形优化 + + + + + + 高级设置 + + + + + + 交替扫描隔点(默认为1): + + + + + + 冗点比例(默认为0%): + + + + + 点距调整值(默认为0): + + + + + 行末调整点模式: + + + + + 行末调整点数(默认为0): + + + + + 慢速6 + + + + + 慢速7 + + + + + 慢速8 + + + + + 慢速9 + + + + + 行末点微调(‰): + + + + + 点距调整电压位置: + + + + + + 扫描颠倒 + + + + + 懒惰模式 + + + + + 贪婪模式 + + + + + 均衡模式 + + + + + 去除冗点模式(默认懒惰): + + + + + 使用推荐设置 + + + + + 行业: + + + + + 快 + + + + + 慢速 + + + + + 电线电缆 + + + + + 制药/食品/电子 + + + + + 建筑管材 + + + + + 其他 + + + + + 速度: + + + + + 检测回收槽 + + + + + + 锁定脉冲计数 + + + + + 每条信息只打印一次 + + + + + 非字宽 + + + + + 使用齿轮泵 + + + + + 打印时绿灯常亮 + + + + + 不检测喷头盖 + + + + + 导出随机码文本 + + + + + 高压阈值: + + + + + 复位发送打印数据 + + + + + 计数器设置 + + + + + 计数器1设置 + + + + + 可变长度 + + + + + + + 清零 + + + + + + + 重复数: + + + + + + + 重设值 + + + + + + + + 结束值: + + + + + 显示小数点 + + + + + + + + 增量值: + + + + + + + 当前值: + + + + + + + + 起始值: + + + + + 注意:“其它设置”页下的"分段计米“勾选时,计数器1不可用。 + + + + + 计数器2设置 + + + + + 计数器3设置 + + + + + 跳米设置 + + + + + 跳米数: + + + + + 跳米打印 + + + + + yyyy-MM-dd + + + + + yyyy/MM/dd + + + + + yyyyMMdd + + + + + yyyy年MM月dd日 + + + + + yyyy-MM-dd hh:mm + + + + + yyyy/MM/dd hh:mm + + + + + yyyyMMddhhmm + + + + + yyyy年MM月dd日hh:mm + + + + + hh:mm + + + + + dd MM yy + + + + + dd/MM/yy + + + + + dd/MM/yyyy + + + + + dd-MM-yy + + + + + dd-MM-yyyy + + + + + 复位到起始值 + + + + + 有效期(天): + + + + + 计数器保存关机值 + + + + + 计数器3 + + + + + + 计数器1 + + + + + 生产日期: + + + + + + 计数器2 + + + + + 循环产品计数 + + + + + 交替打印设置 + + + + + 重复次数: + + + + + 起始位置: + + + + + 距离尾部(mm): + + + + + 特殊变量结束值: + + + + + 特殊条件计数 + + + + + 无交替 + + + + + 普通交替 + + + + + 电眼触发交替 + + + + + 首尾交替 + + + + + 交替间隔: + + + + + 特殊变量起始值: + + + + + 打印 + + + + + 其它设置 + + + + + 更换信息文件时执行的动作: + + + + + 产品计数器自动清0 + + + + + 总产品计数器自动清0 + + + + + 外接显示屏: + + + + + 无 + + + + + 小屏 + + + + + 大屏 + + + + + 总产品计数值 + + + + + 显示屏显示: + + + + + 分段计米 + + + + + 插 入 + + + + + 添 加 + + + + + 全部删除 + + + + + 删 除 + + + + + 米标显示 + + + + + 上移 + + + + + 下移 + + + + + 打印电压缩放 + + + + + 整体缩放(%) : + + + + + 提示:可变长度参数不正确 + + + + + 要求:调整长度小于喷印间隔 + + + + + + 提示:交替参数不正确 + + + + + 要求:起始位置<交替间隔 + + + + + 要求:(重复次数+起始位置)<交替间隔 + + + + + + + + + 提示 + + + + + 应用成功 + + + + + 小时 + + + + + + + 错误 + + + + + + 授权码: + + + + + 错误 + + + + + 喷码机维护设置成功! + + + + + 系统维护设置成功! + + + + + 不存在 + + + + + + 提升授权 + + + + + 取消授权 + + + + + + + + + + + 警告 + + + + + 是否确认使用推荐设置? + + + + + 随机码文件为空,不需要导出 + + + + + 随机码文本将展出到U盘,请插入U盘 + + + + + 计数器1(结束值-开始值)不能被增量整除,结束值将被设为%1 + + + + + 计数器1(结束-开始)不能被增量整除,结束值将被设为%1 + + + + + 1 + + + + + 正在打印第%1组设置,不可删除 + + + + + 是否确认删除第%1组设置? + + + + + 是否确认删除全部设置? + + + + + 字体宽度不能为0 + + + + + 是否立即重新计米? + + + + + 解锁脉冲计数 + + + + + PulseNumFix + + + Dialog + + + + + 根据速度 + + + + + 根据喷印 + + + + + 根据脉冲数 + + + + + 根据同步器参数 + + + + + 实际皮带速度(毫米/秒): + + + + + 实际喷印间隔长度(毫米): + + + + + 长度(毫米): + + + + + 同步脉冲数 + + + + + 同步器直径(毫米): + + + + + 脉冲数/转: + + + + + 脉冲数修正 + + + + + + + + 错误 + + + + + 速度不应该为0 + + + + + 实际同步长度不应该为0 + + + + + 长度不应该为0 + + + + + 直径不应该为0 + + + + + QBarCode + + + Dialog + + + + + 条形码类型 + + + + + 条形码高度 + + + + + 条码宽度 + + + + + 1点 + + + + + 2点 + + + + + 3点 + + + + + 4点 + + + + + + 5点 + + + + + 6点 + + + + + 文本1 + + + + + 显示缩放 + + + + + 墨水类型 + + + + + 黑墨 + + + + + 白墨 + + + + + 文本3 + + + + + 计数器2 + + + + + 文本2 + + + + + 计数器1 + + + + + 插入文档 + + + + + 预览 + + + + + 返回 + + + + + 条码保存 + + + + + FileName + + + + + 增加数字行 + + + + + 日期 + + + + + 时间 + + + + + 文件未保存 + + + + + BARCODE_128 + + + + + BARCODE_93 + + + + + 7点 + + + + + 9点 + + + + + 12点 + + + + + 16点 + + + + + 24点 + + + + + + 标签宽度:%1,标签高度:%2,文本宽度:%3 + + + + + QObject + + + + 手动设定 + + + + + 应用 + + + + + 起始值 + + + + + 结束值 + + + + + 循环值 + + + + + SceneEditOption + + + Form + + + + + 预览 + + + + + 新建 + + + + + 打开 + + + + + + 保存 + + + + + 另存为 + + + + + 新增图元 + + + + + 编辑图元 + + + + + 删除图元 + + + + + 放大 + + + + + 缩小 + + + + + 提示 + + + + + 文档已经改变,是否保存? + + + + + 放弃保存 + + + + + SystemManage + + + Form + + + + + 手动控制泵阀 + + + + + 齿轮泵开 + + + + + 齿轮泵关 + + + + + 回收槽开 + + + + + + + + + + + + + + 停止 + + + + + 回收槽关 + + + + + 回收泵 + + + + + + 压缩机 + + + + + 混合阀 + + + + + 粘度泵 + + + + + 主墨泵 + + + + + 泄压阀 + + + + + 循环阀 + + + + + 墨水阀 + + + + + 时间设置 + + + + + 从U盘导入配置 + + + + + 更新软件 + + + + + 屏幕校正 + + + + + 更新字库 + + + + + 导出字库 + + + + + 系统升级 + + + + + 出厂设置 + + + + + 自动清洗 + + + + + 电机测试 + + + + + 排气 + + + + + 导出配置到U盘 + + + + + + + Cancel + + + + + (1/2) Cleaning, please wait... + + + + + + + 自动 + + + + + + + + + + + + + + + + + + + + + 开 + + + + + + + + + + + + + + + + + + + + + + 关 + + + + + + + + + + + + + + + + + + + 警告 + + + + + + + + 请先移开喷头盖! + + + + + 是否确认进入手动模式? + + + + + 请先确认已经关闭回收槽,确认进入自动模式? + + + + + + 手动 + + + + + + + + + + + + 启动 + + + + + + + + + + + + + + + + + + 提示 + + + + + + + + 密码不正确! + + + + + Application + + + + + 是否确认更新字库? + + + + + 没找到对应字库,更新失败! + + + + + 更新字库成功,重启后生效! + + + + + 恢复出厂设置成功,请重新关机上电 + + + + + 校准触摸屏 + + + + + 是否确认开始校准程序?请小心进行校准! + + + + + 无法生成脚本 + + + + + 是否确认更新软件? + + + + + + + + + 错误 + + + + + 更新失败! + + + + + 软件更新成功,重启后生效! + + + + + 找不到更新软件! + + + + + 是否确认更新系统? + + + + + 系统更新成功,重启后生效! + + + + + 文件不存在! + + + + + 如果开始清洗,务必确认回收槽已经打开10毫米以上,并且在一分钟后将停止清洗 + + + + + 开始清洗 + + + + + 停止清洗 + + + + + 压力 + + + + + autoclean cancel or status: + + + + + (2/3) Cleaning + + + + + (3/3) Cleaning + + + + + 混合阀打开3: + + + + + 是否确认导出配置到U盘? + + + + + 检测不到U盘 + + + + + 成功导出配置到U盘 + + + + + 是否确认从U盘导入配置? + + + + + 配置文件/udisk/sysPara.bin不存在! + + + + + 从U盘成功导入配置,重启后生效! + + + + + autoclean start + + + + + 是否确认启动自动清洗? + + + + + 是否确认墨水排除,加入清洗剂? + + + + + (1/3) Cleaning + + + + + 是否确认导出字库到U盘? + + + + + U盘不可识别! + + + + + 字库导出完成! + + + + + 是否开始电机测试? + + + + + 正在排气,是否停止? + + + + + SystemSetting + + + Form + + + + + 电机电流: + + + + + 晶振电压(%): + + + + + + °C + + + + + 回收泵力度(%): + + + + + 压力: + + + + + 喷嘴直径: + + + + + 脉冲计数器: + + + + + 64K + + + + + 76K + + + + + 96K + + + + + 128K + + + + + 新晶振 + + + + + 晶振频率: + + + + + 粘度: + + + + + 高压包容差: + + + + + 50 (UM) + + + + + 60 (UM) + + + + + 70 (UM) + + + + + 0 + + + + + 0.6 + + + + + 1.0 + + + + + 1.6 + + + + + 2.0 + + + + + 文本模式 + + + + + 点阵模式 + + + + + 场景模式 + + + + + 信息编辑模式: + + + + + 频率修正: + + + + + 粘度泵动作间隔(秒): + + + + + Hz + + + + + 隔膜位置: + + + + + 墨水温度: + + + + + 粘度校正(%): + + + + + 喷头温度: + + + + + 回收槽开关时间: + + + + + 隔膜位置偏移: + + + + + 5 + + + + + 10 + + + + + 15 + + + + + 20 + + + + + 25 + + + + + 30 + + + + + 40 + + + + + 45 + + + + + 50 + + + + + 55 + + + + + 60 + + + + + 风扇开启温度: + + + + + 重置高压 + + + + + 界面语言设置 + + + + + 喷嘴逆清洗 + + + + + 搜索最佳晶振频率 + + + + + 搜索最佳晶振电压 + + + + + 应用当前配置 + + + + + + + + + + + + + 错误 + + + + + 实际频率不能为%1 + + + + + + + 提示 + + + + + 应用成功 + + + + + 自动清洗时间约为一分钟,然后自动停止 + + + + + 开始清洗 + + + + + 停止清洗 + + + + + 正在喷嘴逆清洗...... + + + + + 清洗完成 + + + + + 密码不正确! + + + + + + + Application + + + + + 是否更新高压包电流数据? + + + + + + + 喷头盖未关,请先关喷头盖! + + + + + + 墨线开关未开,请先打开墨线开关! + + + + + + 回收槽未全部打开! + + + + + 自动搜索耗时较长,期间请不要进行其他操作,是否确认自动搜索最佳晶振电压? + + + + + 自动搜索耗时较长,是否确认自动搜索当前频率2K范围内最佳晶振频率? + + + + + 搜索的起始频率%1 HZ超出范围? + + + + + 高压设置完成 + + + + + Oscillator Freq %1 --- 最长高电平时钟 %2 + + + + + 最佳晶振频率完成 + + + + + + Oscillator voltage %1 --- 最长高电平时钟 %2 + + + + + + 最佳晶振电压完成 + + + + + Tiếng Việt(Vietnamese interface) + + + + + Chinese interface(中文界面) + + + + + English interface(英文界面) + + + + + TextEditOption + + + Form + + + + + 间距 + + + + + 字体 + + + + + 预览 + + + + + 插变量 + + + + + 新建 + + + + + + + 保存 + + + + + 文件 + + + + + + 另存为 + + + + + wenquanyi + + + + + 12 + + + + + 点 + + + + + 粗体 + + + + + + + + + + 警告 + + + + + + + + 无法打开文件 + + + + + + Application + + + + + + 是否确认将文件内容追加到打开的文件? + + + + + 插入图片 + + + + + 插入文本 + + + + + 错误 + + + + + TextEditOption 构造函数参数textEdit 不应当为空 + + + + + 打开文件 + + + + + 以.txt保存将丢失所有格式,你是否愿意保存为.html格式? + + + + + 提醒 + + + + + 检测到有图片 %1 来自U盘,是否拷贝图片到本地? + + + + + 无法保存文件 + + + + + 保存... + + + + + 提示 + + + + + 文档已经改变,是否保存? + + + + + 放弃保存 + + + + + 二维码变量设置 + + + + + 完成 + + + + + TimeSettingDialog + + + Dialog + + + + + 秒: + + + + + 分: + + + + + 月: + + + + + 日: + + + + + 时: + + + + + 年: + + + + + 设置时间 + + + + + TriggerCtrl + + + Form + + + + + 触发模式 + + + + + 光电电平触发 + + + + + 光电边沿触发 + + + + + 同步器触发 + + + + + 延时触发 + + + + + + 封锁时间(毫秒) + + + + + 脉冲数/毫米 + + + + + 无镜像打印 + + + + + 自动水平翻转 + + + + + 自动垂直翻转 + + + + + 中心对称旋转 + + + + + 行末<->行首 + + + + + 行首<->行首 + + + + + 镜象交替类型 + + + + + 同步器清零 + + + + + 脉冲数修正 + + + + + 脉冲输出使能 + + + + + + + + + 重复间隔(毫秒) + + + + + + + + 延时(毫秒): + + + + + 字符宽度: + + + + + 同步打印 + + + + + 间隔模式: + + + + + 产生脉冲所需计数: + + + + + 镜像交替间隔 + + + + + 按字符宽度 + + + + + 按喷印比例 + + + + + 禁止电眼清零 + + + + + 允许电眼复位 + + + + + 允许电眼立即复位 + + + + + 同步喷印模式 + + + + + 重复次数 + + + + + + + + 触发延时(毫秒) + + + + + 同步器正反转打印 + + + + + 同步器只正转打印 + + + + + 同步器只反转打印 + + + + + 喷印间隔(毫米) + + + + + 电眼清零 + + + + + 脉冲信号值: + + + + + 20131228-1 + + + + + 应用当前配置 + + + + + 独立参数 + + + + + + + + 触发延时(毫米) + + + + + + + 重复间隔(毫米) + + + + + + 封锁间隔(毫米) + + + + + + + + 延时(毫米): + + + + + 字符宽度 + + + + + 喷印比例(%) + + + + + 提示:参数不正确 + + + + + 要求:触发长度小于喷印间隔 + + + + + 提示 + + + + + 应用成功 + + + + + 封锁间隔(毫秒) + + + + + ZkEdit + + + Form + + + + + 编辑图案 + + + + + 缩小 + + + + + + + 保存 + + + + + 新建 + + + + + 保存为 + + + + + 高度 + + + + + 图像扩张 + + + + + 打开 + + + + + 宽度 + + + + + A + + + + + 放大 + + + + + 导入 + + + + + 图像裁剪 + + + + + 提示 + + + + + 图片已经改变,是否保存? + + + + + 放弃保存 + + + + + + + 放大倍数:%1 + + + + + 图片另存为... + + + + + 另存为 + + + + + 打开文件 + + + + + 图片保存为... + + + + + 导入文件 + + + + + dlgDrawInit + + + 图案参数设置 + + + + + 图案宽度(像素) + + + + + 图案高度(像素) + + + + + 确定 + + + + + dlgQrCode + + + Dialog + + + + + 返回 + + + + + DataMatrix + + + + + QRCode + + + + + 保存 + + + + + 预览 + + + + + 正相打印 + + + + + 反相打印 + + + + + 变量增量 + + + + + 信息前缀 + + + + + 变量(初值) + + + + + 信息后缀 + + + + + + TextLabel + + + + + 计数器(变量) + + + + + 自动刷新 + + + + + 插入文档 + + + + + 条形码 + + + + + 默认 + + + + + 8 x 18 + + + + + 8 x 32 + + + + + 12 x 26 + + + + + 12 x 36 + + + + + 16 x 36 + + + + + 16 x 48 + + + + + DM码尺寸: + + + + + 自动插入时间 + + + + + 警告 + + + + + 输入内容超出选择DM码尺寸大小,请选择更大的尺寸! + + + + + [%1 X %2] + + + + + logo_Form + + + Form + + + + + zkWidget + + + + 警告 + + + + + 最大支持宽度:%1 高度:%2 当前请求:%3 x %4 + + + + + 请新创建建图片 + + + + diff --git a/timesettingdialog.ui b/timesettingdialog.ui index 1ed6c8f..91bac37 100644 --- a/timesettingdialog.ui +++ b/timesettingdialog.ui @@ -1,242 +1,242 @@ - - - TimeSettingDialog - - - - 0 - 0 - 449 - 149 - - - - Qt::StrongFocus - - - Dialog - - - - - 230 - 110 - 201 - 41 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 10 - 431 - 91 - - - - - - - 0 - - - 59 - - - - - - - - 40 - 16777215 - - - - 秒: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 40 - 16777215 - - - - 分: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - 59 - - - - - - - 1970 - - - 4000 - - - - - - - - 40 - 16777215 - - - - 月: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 40 - 16777215 - - - - 日: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 40 - 16777215 - - - - 时: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - 23 - - - 0 - - - - - - - 1 - - - 31 - - - - - - - - 40 - 16777215 - - - - 年: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 1 - - - 12 - - - - - - - - - - buttonBox - accepted() - TimeSettingDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - TimeSettingDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + TimeSettingDialog + + + + 0 + 0 + 449 + 149 + + + + Qt::StrongFocus + + + Dialog + + + + + 230 + 110 + 201 + 41 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 10 + 431 + 91 + + + + + + + 0 + + + 59 + + + + + + + + 40 + 16777215 + + + + 秒: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 40 + 16777215 + + + + 分: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + + + 59 + + + + + + + 1970 + + + 4000 + + + + + + + + 40 + 16777215 + + + + 月: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 40 + 16777215 + + + + 日: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 40 + 16777215 + + + + 时: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + + + 23 + + + 0 + + + + + + + 1 + + + 31 + + + + + + + + 40 + 16777215 + + + + 年: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 1 + + + 12 + + + + + + + + + + buttonBox + accepted() + TimeSettingDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + TimeSettingDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/triggerctrl.ui b/triggerctrl.ui index edfad29..8747748 100644 --- a/triggerctrl.ui +++ b/triggerctrl.ui @@ -1,1001 +1,1001 @@ - - - TriggerCtrl - - - - 0 - 0 - 800 - 600 - - - - - 0 - 0 - - - - Qt::StrongFocus - - - Form - - - - - - - - - 0 - 0 - - - - - 16777215 - 60 - - - - QRadioButton::indicator{ -width: 24px; -height: 24px; - } - - - 触发模式 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - - - QLayout::SetDefaultConstraint - - - 9 - - - 9 - - - 6 - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - 光电电平触发 - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 同步器触发 - - - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - 延时触发 - - - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - 光电边沿触发 - - - - - - - - - - - - 6 - - - - - 封锁时间(毫秒) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - 6 - - - 9999999 - - - 10 - - - - - - - 脉冲数/毫米 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - - 无镜像打印 - - - - - 自动水平翻转 - - - - - 自动垂直翻转 - - - - - 中心对称旋转 - - - - - - - - - 0 - 0 - - - - 1 - - - 65535 - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 16777215 - 37 - - - - Qt::ImhNone - - - - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - 行末<->行首 - - - - - 行首<->行首 - - - - - - - - 镜象交替类型 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 16777215 - 37 - - - - 0 - - - 99 - - - 8 - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 同步器清零 - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 脉冲数修正 - - - - :/icon/pulse.png:/icon/pulse.png - - - - - - - - 0 - 0 - - - - 1 - - - 200 - - - - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - 1 - - - 65535 - - - 1 - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - 0 - 0 - - - - 脉冲输出使能 - - - - - - - Qt::LeftToRight - - - 重复间隔(毫秒) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 延时(毫秒): - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 字符宽度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Qt::LeftToRight - - - 同步打印 - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - - - - Qt::LeftToRight - - - 间隔模式: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - 0 - - - 65535 - - - 1 - - - 10 - - - - - - - 产生脉冲所需计数: - - - - - - - - 0 - 0 - - - - 重复间隔(毫秒) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 镜像交替间隔 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 16777215 - 37 - - - - 0 - - - - 按字符宽度 - - - - - 按喷印比例 - - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - 1 - - - 253 - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 16777215 - 37 - - - - - 禁止电眼清零 - - - - - 允许电眼复位 - - - - - 允许电眼立即复位 - - - - - - - - 同步喷印模式 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - 65535 - - - - - - - 重复次数 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - 1 - - - 100000 - - - 1 - - - 1 - - - - - - - Qt::Horizontal - - - - - - - 触发延时(毫秒) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 37 - - - - 1 - - - 65535 - - - 6 - - - - - - - - 0 - 0 - - - - - 同步器正反转打印 - - - - - 同步器只正转打印 - - - - - 同步器只反转打印 - - - - - - - - Qt::LeftToRight - - - 喷印间隔(毫米) - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - 电眼清零 - - - - - - - 脉冲信号值: - - - - - - - - 0 - 0 - - - - - - - 100 - - - - - - - - - Qt::Horizontal - - - - - - - - - 20131228-1 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - - - - - - - - - 0 - 70 - - - - - 250 - 16777215 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - - 255 - 170 - 127 - - - - - - - - Qt::LeftToRight - - - 应用当前配置 - - - - :/icon/apply.png:/icon/apply.png - - - - - - - Qt::Horizontal - - - - - - - - - - - - - - + + + TriggerCtrl + + + + 0 + 0 + 800 + 600 + + + + + 0 + 0 + + + + Qt::StrongFocus + + + Form + + + + + + + + + 0 + 0 + + + + + 16777215 + 60 + + + + QRadioButton::indicator{ +width: 24px; +height: 24px; + } + + + 触发模式 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + + + QLayout::SetDefaultConstraint + + + 9 + + + 9 + + + 6 + + + + + + 0 + 0 + + + + Qt::RightToLeft + + + 光电电平触发 + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 同步器触发 + + + + + + + + 0 + 0 + + + + Qt::RightToLeft + + + 延时触发 + + + + + + + + 0 + 0 + + + + Qt::RightToLeft + + + 光电边沿触发 + + + + + + + + + + + + 6 + + + + + 封锁时间(毫秒) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + 6 + + + 9999999 + + + 10 + + + + + + + 脉冲数/毫米 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + + 无镜像打印 + + + + + 自动水平翻转 + + + + + 自动垂直翻转 + + + + + 中心对称旋转 + + + + + + + + + 0 + 0 + + + + 1 + + + 65535 + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 37 + + + + Qt::ImhNone + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + + 行末<->行首 + + + + + 行首<->行首 + + + + + + + + 镜象交替类型 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 37 + + + + 0 + + + 99 + + + 8 + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 同步器清零 + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 脉冲数修正 + + + + :/icon/pulse.png:/icon/pulse.png + + + + + + + + 0 + 0 + + + + 1 + + + 200 + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + 1 + + + 65535 + + + 1 + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + + 0 + 0 + + + + 脉冲输出使能 + + + + + + + Qt::LeftToRight + + + 重复间隔(毫秒) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 延时(毫秒): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 字符宽度: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + 同步打印 + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + + + + Qt::LeftToRight + + + 间隔模式: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + 0 + + + 65535 + + + 1 + + + 10 + + + + + + + 产生脉冲所需计数: + + + + + + + + 0 + 0 + + + + 重复间隔(毫秒) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 镜像交替间隔 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 37 + + + + 0 + + + + 按字符宽度 + + + + + 按喷印比例 + + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + 1 + + + 253 + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 37 + + + + + 禁止电眼清零 + + + + + 允许电眼复位 + + + + + 允许电眼立即复位 + + + + + + + + 同步喷印模式 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + 65535 + + + + + + + 重复次数 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + 1 + + + 100000 + + + 1 + + + 1 + + + + + + + Qt::Horizontal + + + + + + + 触发延时(毫秒) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 37 + + + + 1 + + + 65535 + + + 6 + + + + + + + + 0 + 0 + + + + + 同步器正反转打印 + + + + + 同步器只正转打印 + + + + + 同步器只反转打印 + + + + + + + + Qt::LeftToRight + + + 喷印间隔(毫米) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + 电眼清零 + + + + + + + 脉冲信号值: + + + + + + + + 0 + 0 + + + + + + + 100 + + + + + + + + + Qt::Horizontal + + + + + + + + + 20131228-1 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 70 + + + + + 250 + 16777215 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + + 255 + 170 + 127 + + + + + + + + Qt::LeftToRight + + + 应用当前配置 + + + + :/icon/apply.png:/icon/apply.png + + + + + + + Qt::Horizontal + + + + + + + + + + + + + + diff --git a/x86_build b/x86_build index 6a01a85..e19b9cc 100644 --- a/x86_build +++ b/x86_build @@ -1,2 +1,2 @@ -/usr/local/Trolltech/QtEmbedded-4.6.3/bin/qmake -project -/usr/local/Trolltech/QtEmbedded-4.6.3/bin/qmake +/usr/local/Trolltech/QtEmbedded-4.6.3/bin/qmake -project +/usr/local/Trolltech/QtEmbedded-4.6.3/bin/qmake diff --git a/zkWidget.cpp b/zkWidget.cpp index 8e62e28..1f67f87 100644 --- a/zkWidget.cpp +++ b/zkWidget.cpp @@ -1,359 +1,359 @@ -/* - * zkWidget.cpp - * - * Created on: Jul 2, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#include "zkWidget.h" -#include -#include -#include -#include -#include "SysPara.h" - -zkWidget::zkWidget(QWidget *parent):QWidget(parent){ - memset(pointMap,0,sizeof(pointMap)); - heightPoint = 0; - widthPoint = 0; - scale = 16; - currXpos = 0; - currYpos = 0; - modified = false; -} - -zkWidget::~zkWidget(){ - -} - -void zkWidget::paintEvent(QPaintEvent *event){ - QPainter painter(this); - QRect rect = event->rect(); - int x = (int)(rect.x()/scale); - int y = (int)(rect.y()/scale); - int x_ = rect.x() + rect.width(); - int y_ = rect.y() + rect.height(); - int last_x = x_/scale; - int last_y = y_/scale; - //qDebug() << "x:" << rect.x() << "y:" << rect.y() << "width:" << rect.width() << "heigh:" << rect.height(); - for(int i = x; i < widthPoint && i <= last_x; i++){ - for(int j = y; j < heightPoint && j <= last_y; j++){ - QPen pen; - int width = 0; - if(currXpos == i && currYpos == j){ - width = (scale>4)?2:1; - pen.setColor(QColor(Qt::red)); - - } - else { - width = (scale > 3)?1:0; - pen.setColor(QColor(Qt::gray)); - } - pen.setWidth(width); - painter.setPen(width?pen:Qt::NoPen); - if(pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]){ - painter.setBrush(QColor(Qt::black)); - } - else{ - painter.setBrush(QColor(Qt::white)); - } - painter.drawRect(i*scale + width,j*scale + width,scale - 2*width,scale - 2*width); // - } - } -} - -void zkWidget::mousePressEvent ( QMouseEvent * event ){ - int x = (int )(event->x()/(scale)); - int y = (int )(event->y()/scale); - - if(x < widthPoint && y < heightPoint){ - int oriX = currXpos; - int oriY = currYpos; - currXpos = x; - currYpos = y; - pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]?0:1; - update(oriX*scale,oriY*scale,scale,scale); //将原来的焦点去掉 - update(x*scale,y*scale,scale,scale); - modified = true; - emit picWidgetModify(widthPoint,heightPoint); - } - -} - -void zkWidget::currPositionMove(int shiftX,int shiftY,bool moveAllPic,bool trimPic,bool expandPic) -{ - if((widthPoint && heightPoint) || expandPic){ - if(moveAllPic){ - shiftX = - shiftX; - shiftY = -shiftY; - int init_x = (shiftX < 0)?(widthPoint - 1):0; - int end_x = (shiftX >= 0)?(widthPoint):-1; - int step_x = (shiftX < 0)?-1:1; - int init_y = (shiftY < 0)?(heightPoint - 1):0; - int end_y = (shiftY >= 0)?(heightPoint):- 1; - int step_y = (shiftY < 0)?-1:1; - for(int x = init_x; x != end_x; x+= step_x){ - for(int y = init_y; y != end_y; y+= step_y){ - int new_x = x + shiftX; - int new_y = y + shiftY; - if(new_x < 0 || new_x >= widthPoint || new_y < 0 || new_y >= heightPoint){ - //pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = trueColorEnable?backGround.rgba():0xffffffff; - pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = 0x00000000; - } - else - pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = pointMap[new_x*MAX_PIC_WIDGET_HEIGHT + new_y]; - } - } - update(); - } - else if(trimPic){ - - int diffX = (widthPoint > qAbs(shiftX))?qAbs(shiftX):widthPoint; - int diffY = (heightPoint > qAbs(shiftY))?qAbs(shiftY):heightPoint; - if(shiftX > 0){ - currPositionMove(- diffX,0,true,false,false); - } - if(shiftY > 0){ - currPositionMove(0,-diffY,true,false,false); - } - heightPoint -= diffY; - widthPoint -= diffX; - resize(widthPoint*scale,heightPoint*scale); - update(); - } - else if(expandPic){ - int diffX = ((MAX_PIC_WIDGET_WIDTH - widthPoint) > qAbs(shiftX))?qAbs(shiftX):(MAX_PIC_WIDGET_WIDTH - widthPoint); - int diffY = ((MAX_PIC_WIDGET_HEIGHT - heightPoint) > qAbs(shiftY))?qAbs(shiftY):(MAX_PIC_WIDGET_HEIGHT - heightPoint); - for(int y = 0; y < heightPoint + diffY;y ++){ - for(int x = 0; x < widthPoint + diffX; x++){ - if(y < heightPoint && x < widthPoint){ - - } - else { - //pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = trueColorEnable?backGround.rgba():0xffffffff; - pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = 0x0000000; - } - } - } - heightPoint += diffY; - widthPoint += diffX; - resize(widthPoint*scale,heightPoint*scale); - if(shiftX < 0){ - currPositionMove(diffX,0,true,false,false); - } - if(shiftY < 0){ - currPositionMove(0,diffY,true,false,false); - } - //qDebug() << "diffX:" << diffX << "diffY:" << diffY << "heightPoint:" << heightPoint << "widthPoint" << widthPoint; - update(); - } - else { - int oriX = currXpos; - int oriY = currYpos; - currXpos += shiftX; - currYpos += shiftY; - currXpos = (currXpos >= 0)?(currXpos%widthPoint):(currXpos + widthPoint); - currYpos = (currYpos >= 0)?(currYpos%heightPoint):(currYpos + heightPoint); - update(oriX*scale,oriY*scale,scale,scale); - update(currXpos*scale,currYpos*scale,scale,scale); - } - emit picWidgetModify(widthPoint,heightPoint); - } -} -void zkWidget::ensureCurrPos(){ - if(heightPoint && widthPoint){ - int x = currXpos; - int y = currYpos; - - for(int i=0;igeometry().width(); - int height = widget->geometry().height(); - int scaleX = w?width/w:width; //不要除零 - int scaleY = h?height/h:height; - scaleX = scaleX > 0?scaleX:1; //scale不能小于零 - scaleY = scaleY > 0?scaleY:1; - scale = scaleX > scaleY?scaleY:scaleX; - } - currXpos = 0; - currYpos = 0; - memset(pointMap,0,sizeof(pointMap)); - resizeWidget(w,h); - modified = false; -} - - -void zkWidget::resizeWidget(int w,int h){ - if(w > MAX_PIC_WIDGET_WIDTH || h > MAX_PIC_WIDGET_HEIGHT){ - QMessageBox::warning(0,tr("警告"),tr("最大支持宽度:%1 高度:%2 当前请求:%3 x %4").arg(MAX_PIC_WIDGET_WIDTH).arg(MAX_PIC_WIDGET_HEIGHT).arg(w).arg(h)); - widthPoint = (w > MAX_PIC_WIDGET_WIDTH)?MAX_PIC_WIDGET_WIDTH:w; - heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; - } - else{ - widthPoint = w; - heightPoint = h; - } - resize(w*scale,h*scale); - update(); -} - - -void zkWidget::enlargeDisplay(){ - if(scale < (1<<10)){ - scale = scale + ((scale>2)?scale/2:1); - resize(widthPoint*scale,heightPoint*scale); - update(); - } -} - - -void zkWidget::reduceDisplay(){ - if(scale > 1){ - scale = scale - ((scale > 2)?scale/3:1); - resize(widthPoint*scale,heightPoint*scale); - update(); - } -} - -void zkWidget::setScale(int scale){ - if(scale > 1) - this->scale = scale; - else - scale = 1; - resize(widthPoint*scale,heightPoint*scale); - update(); -} - -void zkWidget::loadImage(QString filename,bool forceSize,QString charStr,QFont *font){ - if((widthPoint == 0 || heightPoint == 0) && forceSize){ - QMessageBox::warning(0,"警告","请新创建建图片"); - } - else { - bool forceForegroundBackgroundColorFill = false; - QImage img; - QFile file(filename); - if(!filename.isEmpty() && file.exists()) - img.load(filename); - else if(charStr.size()){ - if(font){ - QFontMetrics fontMetrics(*font); - //int rightBearing = fontMetrics.rightBearing(QChar(unicode)); - //int leftBearing = fontMetrics.leftBearing(QChar(unicode)); - int width = forceSize?widthPoint:(fontMetrics.width(charStr)) ; - int height = forceSize?heightPoint:(fontMetrics.ascent() + fontMetrics.descent()); - if(width == 0){ - QMessageBox::warning(0,"警告",QString("字串:%1 在字体%2中不存在").arg(charStr).arg(font->family())); - return ; - } - QSize size(width,height); - QImage image(size,QImage::Format_ARGB32); - img = image; - img.fill(0xffffffff); - QPainter painter(&img); - painter.setFont(*font); - painter.drawText(QPoint(0,fontMetrics.ascent()),charStr); - forceForegroundBackgroundColorFill = true; - } - } - if(img.isNull()){ - QMessageBox::warning(0,"Warning",QString("File:%1 open failed").arg(filename)); - } - else { - int w = img.rect().width(); - int h = img.rect().height(); - memset(pointMap,0,sizeof(pointMap)); - if(!forceSize){ - widthPoint = (w > MAX_PIC_WIDGET_WIDTH)?MAX_PIC_WIDGET_WIDTH:w; - heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; - resize(widthPoint*scale,heightPoint*scale); - } - QRgb argb = 0; - for(int i = 0; i < widthPoint;i++){ - for(int j = 0; j < heightPoint ; j++){ - bool pixelVisible = false; - int init_x = i*w/widthPoint; - int end_x = (w >= widthPoint)?(i + 1)*w/widthPoint:init_x + 1; - int init_y = j*h/heightPoint; - int end_y = (h >= heightPoint)?(j + 1)*h/heightPoint:init_y + 1; - for(int l = init_x; l < end_x; l++){ - for(int m = init_y; m < end_y; m ++){ - argb = img.pixel(l,m); - //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); - if(argb == 0xffffffff) //节约时钟周期 - continue; - if((argb & 0xff000000) && (((argb&0xff0000) < 0x800000) - || ((argb&0xff00) < 0x8000) || ((argb&0xff) < 0x80))){ - pixelVisible = true; - break; - } - } - if(pixelVisible) - break; - } - if(pixelVisible) - pointMap[i*MAX_PIC_WIDGET_HEIGHT + j] = 1; - } - } - update(); - setModified(false); - } - } -} -void zkWidget::saveImage(QString filename){ - if(widthPoint == 0 || heightPoint == 0){ - QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); - } - else { - QSize size(widthPoint,heightPoint); - QImage image(size,QImage::Format_ARGB32); - image.fill(qRgba(0,0,0,0xff)); - for(int i = 0 ; i < widthPoint; i++){ - for(int j = 0; j < heightPoint; j++){ - image.setPixel(i,j,pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]?0xff000000:0xffffffff); - } - } - filename = DOC_ROOT_DIR+ QFileInfo(filename).baseName()+".jpg"; - image.save( filename ); - } - setModified(false); -} +/* + * zkWidget.cpp + * + * Created on: Jul 2, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#include "zkWidget.h" +#include +#include +#include +#include +#include "SysPara.h" + +zkWidget::zkWidget(QWidget *parent):QWidget(parent){ + memset(pointMap,0,sizeof(pointMap)); + heightPoint = 0; + widthPoint = 0; + scale = 16; + currXpos = 0; + currYpos = 0; + modified = false; +} + +zkWidget::~zkWidget(){ + +} + +void zkWidget::paintEvent(QPaintEvent *event){ + QPainter painter(this); + QRect rect = event->rect(); + int x = (int)(rect.x()/scale); + int y = (int)(rect.y()/scale); + int x_ = rect.x() + rect.width(); + int y_ = rect.y() + rect.height(); + int last_x = x_/scale; + int last_y = y_/scale; + //qDebug() << "x:" << rect.x() << "y:" << rect.y() << "width:" << rect.width() << "heigh:" << rect.height(); + for(int i = x; i < widthPoint && i <= last_x; i++){ + for(int j = y; j < heightPoint && j <= last_y; j++){ + QPen pen; + int width = 0; + if(currXpos == i && currYpos == j){ + width = (scale>4)?2:1; + pen.setColor(QColor(Qt::red)); + + } + else { + width = (scale > 3)?1:0; + pen.setColor(QColor(Qt::gray)); + } + pen.setWidth(width); + painter.setPen(width?pen:Qt::NoPen); + if(pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]){ + painter.setBrush(QColor(Qt::black)); + } + else{ + painter.setBrush(QColor(Qt::white)); + } + painter.drawRect(i*scale + width,j*scale + width,scale - 2*width,scale - 2*width); // + } + } +} + +void zkWidget::mousePressEvent ( QMouseEvent * event ){ + int x = (int )(event->x()/(scale)); + int y = (int )(event->y()/scale); + + if(x < widthPoint && y < heightPoint){ + int oriX = currXpos; + int oriY = currYpos; + currXpos = x; + currYpos = y; + pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]?0:1; + update(oriX*scale,oriY*scale,scale,scale); //将原来的焦点去掉 + update(x*scale,y*scale,scale,scale); + modified = true; + emit picWidgetModify(widthPoint,heightPoint); + } + +} + +void zkWidget::currPositionMove(int shiftX,int shiftY,bool moveAllPic,bool trimPic,bool expandPic) +{ + if((widthPoint && heightPoint) || expandPic){ + if(moveAllPic){ + shiftX = - shiftX; + shiftY = -shiftY; + int init_x = (shiftX < 0)?(widthPoint - 1):0; + int end_x = (shiftX >= 0)?(widthPoint):-1; + int step_x = (shiftX < 0)?-1:1; + int init_y = (shiftY < 0)?(heightPoint - 1):0; + int end_y = (shiftY >= 0)?(heightPoint):- 1; + int step_y = (shiftY < 0)?-1:1; + for(int x = init_x; x != end_x; x+= step_x){ + for(int y = init_y; y != end_y; y+= step_y){ + int new_x = x + shiftX; + int new_y = y + shiftY; + if(new_x < 0 || new_x >= widthPoint || new_y < 0 || new_y >= heightPoint){ + //pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = trueColorEnable?backGround.rgba():0xffffffff; + pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = 0x00000000; + } + else + pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = pointMap[new_x*MAX_PIC_WIDGET_HEIGHT + new_y]; + } + } + update(); + } + else if(trimPic){ + + int diffX = (widthPoint > qAbs(shiftX))?qAbs(shiftX):widthPoint; + int diffY = (heightPoint > qAbs(shiftY))?qAbs(shiftY):heightPoint; + if(shiftX > 0){ + currPositionMove(- diffX,0,true,false,false); + } + if(shiftY > 0){ + currPositionMove(0,-diffY,true,false,false); + } + heightPoint -= diffY; + widthPoint -= diffX; + resize(widthPoint*scale,heightPoint*scale); + update(); + } + else if(expandPic){ + int diffX = ((MAX_PIC_WIDGET_WIDTH - widthPoint) > qAbs(shiftX))?qAbs(shiftX):(MAX_PIC_WIDGET_WIDTH - widthPoint); + int diffY = ((MAX_PIC_WIDGET_HEIGHT - heightPoint) > qAbs(shiftY))?qAbs(shiftY):(MAX_PIC_WIDGET_HEIGHT - heightPoint); + for(int y = 0; y < heightPoint + diffY;y ++){ + for(int x = 0; x < widthPoint + diffX; x++){ + if(y < heightPoint && x < widthPoint){ + + } + else { + //pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = trueColorEnable?backGround.rgba():0xffffffff; + pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = 0x0000000; + } + } + } + heightPoint += diffY; + widthPoint += diffX; + resize(widthPoint*scale,heightPoint*scale); + if(shiftX < 0){ + currPositionMove(diffX,0,true,false,false); + } + if(shiftY < 0){ + currPositionMove(0,diffY,true,false,false); + } + //qDebug() << "diffX:" << diffX << "diffY:" << diffY << "heightPoint:" << heightPoint << "widthPoint" << widthPoint; + update(); + } + else { + int oriX = currXpos; + int oriY = currYpos; + currXpos += shiftX; + currYpos += shiftY; + currXpos = (currXpos >= 0)?(currXpos%widthPoint):(currXpos + widthPoint); + currYpos = (currYpos >= 0)?(currYpos%heightPoint):(currYpos + heightPoint); + update(oriX*scale,oriY*scale,scale,scale); + update(currXpos*scale,currYpos*scale,scale,scale); + } + emit picWidgetModify(widthPoint,heightPoint); + } +} +void zkWidget::ensureCurrPos(){ + if(heightPoint && widthPoint){ + int x = currXpos; + int y = currYpos; + + for(int i=0;igeometry().width(); + int height = widget->geometry().height(); + int scaleX = w?width/w:width; //不要除零 + int scaleY = h?height/h:height; + scaleX = scaleX > 0?scaleX:1; //scale不能小于零 + scaleY = scaleY > 0?scaleY:1; + scale = scaleX > scaleY?scaleY:scaleX; + } + currXpos = 0; + currYpos = 0; + memset(pointMap,0,sizeof(pointMap)); + resizeWidget(w,h); + modified = false; +} + + +void zkWidget::resizeWidget(int w,int h){ + if(w > MAX_PIC_WIDGET_WIDTH || h > MAX_PIC_WIDGET_HEIGHT){ + QMessageBox::warning(0,tr("警告"),tr("最大支持宽度:%1 高度:%2 当前请求:%3 x %4").arg(MAX_PIC_WIDGET_WIDTH).arg(MAX_PIC_WIDGET_HEIGHT).arg(w).arg(h)); + widthPoint = (w > MAX_PIC_WIDGET_WIDTH)?MAX_PIC_WIDGET_WIDTH:w; + heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; + } + else{ + widthPoint = w; + heightPoint = h; + } + resize(w*scale,h*scale); + update(); +} + + +void zkWidget::enlargeDisplay(){ + if(scale < (1<<10)){ + scale = scale + ((scale>2)?scale/2:1); + resize(widthPoint*scale,heightPoint*scale); + update(); + } +} + + +void zkWidget::reduceDisplay(){ + if(scale > 1){ + scale = scale - ((scale > 2)?scale/3:1); + resize(widthPoint*scale,heightPoint*scale); + update(); + } +} + +void zkWidget::setScale(int scale){ + if(scale > 1) + this->scale = scale; + else + scale = 1; + resize(widthPoint*scale,heightPoint*scale); + update(); +} + +void zkWidget::loadImage(QString filename,bool forceSize,QString charStr,QFont *font){ + if((widthPoint == 0 || heightPoint == 0) && forceSize){ + QMessageBox::warning(0,"警告","请新创建建图片"); + } + else { + bool forceForegroundBackgroundColorFill = false; + QImage img; + QFile file(filename); + if(!filename.isEmpty() && file.exists()) + img.load(filename); + else if(charStr.size()){ + if(font){ + QFontMetrics fontMetrics(*font); + //int rightBearing = fontMetrics.rightBearing(QChar(unicode)); + //int leftBearing = fontMetrics.leftBearing(QChar(unicode)); + int width = forceSize?widthPoint:(fontMetrics.width(charStr)) ; + int height = forceSize?heightPoint:(fontMetrics.ascent() + fontMetrics.descent()); + if(width == 0){ + QMessageBox::warning(0,"警告",QString("字串:%1 在字体%2中不存在").arg(charStr).arg(font->family())); + return ; + } + QSize size(width,height); + QImage image(size,QImage::Format_ARGB32); + img = image; + img.fill(0xffffffff); + QPainter painter(&img); + painter.setFont(*font); + painter.drawText(QPoint(0,fontMetrics.ascent()),charStr); + forceForegroundBackgroundColorFill = true; + } + } + if(img.isNull()){ + QMessageBox::warning(0,"Warning",QString("File:%1 open failed").arg(filename)); + } + else { + int w = img.rect().width(); + int h = img.rect().height(); + memset(pointMap,0,sizeof(pointMap)); + if(!forceSize){ + widthPoint = (w > MAX_PIC_WIDGET_WIDTH)?MAX_PIC_WIDGET_WIDTH:w; + heightPoint = (h > MAX_PIC_WIDGET_HEIGHT)?MAX_PIC_WIDGET_HEIGHT:h; + resize(widthPoint*scale,heightPoint*scale); + } + QRgb argb = 0; + for(int i = 0; i < widthPoint;i++){ + for(int j = 0; j < heightPoint ; j++){ + bool pixelVisible = false; + int init_x = i*w/widthPoint; + int end_x = (w >= widthPoint)?(i + 1)*w/widthPoint:init_x + 1; + int init_y = j*h/heightPoint; + int end_y = (h >= heightPoint)?(j + 1)*h/heightPoint:init_y + 1; + for(int l = init_x; l < end_x; l++){ + for(int m = init_y; m < end_y; m ++){ + argb = img.pixel(l,m); + //qDebug() << "i:" << i << "j" << j << " " << QString::number(argb,16); + if(argb == 0xffffffff) //节约时钟周期 + continue; + if((argb & 0xff000000) && (((argb&0xff0000) < 0x800000) + || ((argb&0xff00) < 0x8000) || ((argb&0xff) < 0x80))){ + pixelVisible = true; + break; + } + } + if(pixelVisible) + break; + } + if(pixelVisible) + pointMap[i*MAX_PIC_WIDGET_HEIGHT + j] = 1; + } + } + update(); + setModified(false); + } + } +} +void zkWidget::saveImage(QString filename){ + if(widthPoint == 0 || heightPoint == 0){ + QMessageBox::warning(0,tr("警告"),tr("请新创建建图片")); + } + else { + QSize size(widthPoint,heightPoint); + QImage image(size,QImage::Format_ARGB32); + image.fill(qRgba(0,0,0,0xff)); + for(int i = 0 ; i < widthPoint; i++){ + for(int j = 0; j < heightPoint; j++){ + image.setPixel(i,j,pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]?0xff000000:0xffffffff); + } + } + filename = DOC_ROOT_DIR+ QFileInfo(filename).baseName()+".jpg"; + image.save( filename ); + } + setModified(false); +} diff --git a/zkWidget.h b/zkWidget.h index 1a70c0d..aaddaee 100644 --- a/zkWidget.h +++ b/zkWidget.h @@ -1,73 +1,73 @@ -/* - * zkWidget.h - * - * Created on: Jul 2, 2013 - * Author: yiyu - * QQ:1036184468 - * Descriptoin: - - */ - -#ifndef ZKWIDGET_H_ -#define ZKWIDGET_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#define MAX_PIC_WIDGET_HEIGHT 256 -#define MAX_PIC_WIDGET_WIDTH 256 -class zkWidget:public QWidget{ - - Q_OBJECT - -public: - explicit zkWidget(QWidget *parent = 0); - ~zkWidget(); - - void resizeWidget(int w,int h); - void initWidget(int w,int h); - //void loadImage(QString filename,bool forceSize = true); - void loadImage(QString filename,bool forceSize = true ,QString charStr = "",QFont *font = 0); - void saveImage(QString filename); - void enlargeDisplay(); - void reduceDisplay(); - void setScale(int scale); - - void paintEvent(QPaintEvent *); - void mousePressEvent ( QMouseEvent * event ); - - //void currPositionMove(int shiftX,int shiftY); - void currPositionMove(int shiftX,int shiftY,bool moveAllPic,bool trimPic,bool expandPic); - void ensureCurrPos(); - int getScaleValue(); - bool isModified(); - - - int getHeight(); - int getWidth(); - -Q_SIGNALS: - void picWidgetModify(int w,int h); - -private: - unsigned char pointMap[MAX_PIC_WIDGET_HEIGHT * MAX_PIC_WIDGET_WIDTH]; - int heightPoint; - int widthPoint; - int scale; - - int currXpos; - int currYpos; - bool modified; - void setModified(bool m); - - -}; - -#endif /* PICWIDGET_H_ */ +/* + * zkWidget.h + * + * Created on: Jul 2, 2013 + * Author: yiyu + * QQ:1036184468 + * Descriptoin: + + */ + +#ifndef ZKWIDGET_H_ +#define ZKWIDGET_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#define MAX_PIC_WIDGET_HEIGHT 256 +#define MAX_PIC_WIDGET_WIDTH 256 +class zkWidget:public QWidget{ + + Q_OBJECT + +public: + explicit zkWidget(QWidget *parent = 0); + ~zkWidget(); + + void resizeWidget(int w,int h); + void initWidget(int w,int h); + //void loadImage(QString filename,bool forceSize = true); + void loadImage(QString filename,bool forceSize = true ,QString charStr = "",QFont *font = 0); + void saveImage(QString filename); + void enlargeDisplay(); + void reduceDisplay(); + void setScale(int scale); + + void paintEvent(QPaintEvent *); + void mousePressEvent ( QMouseEvent * event ); + + //void currPositionMove(int shiftX,int shiftY); + void currPositionMove(int shiftX,int shiftY,bool moveAllPic,bool trimPic,bool expandPic); + void ensureCurrPos(); + int getScaleValue(); + bool isModified(); + + + int getHeight(); + int getWidth(); + +Q_SIGNALS: + void picWidgetModify(int w,int h); + +private: + unsigned char pointMap[MAX_PIC_WIDGET_HEIGHT * MAX_PIC_WIDGET_WIDTH]; + int heightPoint; + int widthPoint; + int scale; + + int currXpos; + int currYpos; + bool modified; + void setModified(bool m); + + +}; + +#endif /* PICWIDGET_H_ */ diff --git a/zkedit.ui b/zkedit.ui index ee7adaa..94dd261 100644 --- a/zkedit.ui +++ b/zkedit.ui @@ -1,541 +1,541 @@ - - - ZkEdit - - - - 0 - 0 - 800 - 600 - - - - Qt::StrongFocus - - - Form - - - - - - - - false - - - Qt::AlignCenter - - - - - 0 - 89 - 400 - 400 - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 20 - - - - 编辑图案 - - - - - - - - 180 - 20 - - - - - - - - - - - 0 - - - 30 - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - :/icon/arrowdown.png:/icon/arrowdown.png - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - :/icon/sure.png:/icon/sure.png - - - - 24 - 24 - - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - :/icon/arrowleft.png:/icon/arrowleft.png - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - :/icon/arrowup.png:/icon/arrowup.png - - - - - - - - 50 - 50 - - - - - 50 - 50 - - - - - - - - :/icon/arrowright.png:/icon/arrowright.png - - - - - - - - - 5 - - - - - - 180 - 45 - - - - - 180 - 16777215 - - - - 缩小 - - - - :/icon/zoomout.png:/icon/zoomout.png - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 保存 - - - - :/icon/filesave.png:/icon/filesave.png - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 新建 - - - - :/icon/filenew.png:/icon/filenew.png - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - - 180 - 37 - - - - 1 - - - 256 - - - 12 - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 保存为 - - - - :/icon/filesaveas.png:/icon/filesaveas.png - - - - - - - - 180 - 0 - - - - - 180 - 20 - - - - 高度 - - - - - - - 图像扩张 - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 打开 - - - - :/icon/fileopen.png:/icon/fileopen.png - - - - - - - - 180 - 0 - - - - - 180 - 20 - - - - 宽度 - - - - - - - false - - - - 0 - 0 - - - - - 80 - 16777215 - - - - A - - - 11 - - - - - - - - 0 - 0 - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 1 - - - 256 - - - 12 - - - - - - - - 180 - 45 - - - - - 180 - 16777215 - - - - 放大 - - - - :/icon/zoomin.png:/icon/zoomin.png - - - - - - - - 180 - 0 - - - - - 180 - 16777215 - - - - 导入 - - - - :/icon/fileimport.png:/icon/fileimport.png - - - - - - - 图像裁剪 - - - - - - - - - - - - - - zkWidget - QWidget -
zkWidget.h
- 1 -
-
- - - - -
+ + + ZkEdit + + + + 0 + 0 + 800 + 600 + + + + Qt::StrongFocus + + + Form + + + + + + + + false + + + Qt::AlignCenter + + + + + 0 + 89 + 400 + 400 + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 16777215 + 20 + + + + 编辑图案 + + + + + + + + 180 + 20 + + + + + + + + + + + 0 + + + 30 + + + + + + 50 + 50 + + + + + 50 + 50 + + + + + + + + :/icon/arrowdown.png:/icon/arrowdown.png + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + + + + + :/icon/sure.png:/icon/sure.png + + + + 24 + 24 + + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + + + + + :/icon/arrowleft.png:/icon/arrowleft.png + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + + + + + :/icon/arrowup.png:/icon/arrowup.png + + + + + + + + 50 + 50 + + + + + 50 + 50 + + + + + + + + :/icon/arrowright.png:/icon/arrowright.png + + + + + + + + + 5 + + + + + + 180 + 45 + + + + + 180 + 16777215 + + + + 缩小 + + + + :/icon/zoomout.png:/icon/zoomout.png + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 保存 + + + + :/icon/filesave.png:/icon/filesave.png + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 新建 + + + + :/icon/filenew.png:/icon/filenew.png + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 180 + 37 + + + + 1 + + + 256 + + + 12 + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 保存为 + + + + :/icon/filesaveas.png:/icon/filesaveas.png + + + + + + + + 180 + 0 + + + + + 180 + 20 + + + + 高度 + + + + + + + 图像扩张 + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 打开 + + + + :/icon/fileopen.png:/icon/fileopen.png + + + + + + + + 180 + 0 + + + + + 180 + 20 + + + + 宽度 + + + + + + + false + + + + 0 + 0 + + + + + 80 + 16777215 + + + + A + + + 11 + + + + + + + + 0 + 0 + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 1 + + + 256 + + + 12 + + + + + + + + 180 + 45 + + + + + 180 + 16777215 + + + + 放大 + + + + :/icon/zoomin.png:/icon/zoomin.png + + + + + + + + 180 + 0 + + + + + 180 + 16777215 + + + + 导入 + + + + :/icon/fileimport.png:/icon/fileimport.png + + + + + + + 图像裁剪 + + + + + + + + + + + + + + zkWidget + QWidget +
zkWidget.h
+ 1 +
+
+ + + + +