hlp:桂林国际齿轮泵代码

This commit is contained in:
kite_lucs
2026-10-09 10:25:24 +08:00
commit fd606b3c81
2447 changed files with 999531 additions and 0 deletions
@@ -0,0 +1,364 @@
/*
* FreeModbus Libary: Linux Port
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
*
* 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 <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#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;
}
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 48 KiB

@@ -0,0 +1,147 @@
/****************************************************************************
** Meta object code from reading C++ file 'dlginputaddr.h'
**
** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.5)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../dlginputaddr.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'dlginputaddr.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.5. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_DlgInputAddr[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
7, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
5, // signalCount
// signals: signature, parameters, type, tag, flags
14, 13, 13, 13, 0x05,
38, 13, 13, 13, 0x05,
62, 13, 13, 13, 0x05,
83, 81, 13, 13, 0x05,
114, 13, 13, 13, 0x05,
// slots: signature, parameters, type, tag, flags
140, 133, 13, 13, 0x08,
206, 179, 13, 13, 0x08,
0 // eod
};
static const char qt_meta_stringdata_DlgInputAddr[] = {
"DlgInputAddr\0\0changePowerCnt(QString)\0"
"changePrintCnt(QString)\0dateError(QString)\0"
",\0printErrorStatus(QString,uint)\0"
"changeMac(QString)\0button\0"
"on_buttonBox_clicked(QAbstractButton*)\0"
"year,mon,mday,hour,min,sec\0"
"setTime(int,int,int,int,int,int)\0"
};
void DlgInputAddr::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
DlgInputAddr *_t = static_cast<DlgInputAddr *>(_o);
switch (_id) {
case 0: _t->changePowerCnt((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 1: _t->changePrintCnt((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 2: _t->dateError((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 3: _t->printErrorStatus((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< uint(*)>(_a[2]))); break;
case 4: _t->changeMac((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 5: _t->on_buttonBox_clicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
case 6: _t->setTime((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4])),(*reinterpret_cast< int(*)>(_a[5])),(*reinterpret_cast< int(*)>(_a[6]))); break;
default: ;
}
}
}
const QMetaObjectExtraData DlgInputAddr::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject DlgInputAddr::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_DlgInputAddr,
qt_meta_data_DlgInputAddr, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &DlgInputAddr::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *DlgInputAddr::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *DlgInputAddr::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_DlgInputAddr))
return static_cast<void*>(const_cast< DlgInputAddr*>(this));
return QDialog::qt_metacast(_clname);
}
int DlgInputAddr::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 7)
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
}
return _id;
}
// SIGNAL 0
void DlgInputAddr::changePowerCnt(QString _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void DlgInputAddr::changePrintCnt(QString _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
// SIGNAL 2
void DlgInputAddr::dateError(QString _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
// SIGNAL 3
void DlgInputAddr::printErrorStatus(QString _t1, unsigned int _t2)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 3, _a);
}
// SIGNAL 4
void DlgInputAddr::changeMac(QString _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 4, _a);
}
QT_END_MOC_NAMESPACE
@@ -0,0 +1,57 @@
/*
* MyFileDialog.cpp
*
* Created on: Jul 14, 2013
* Author: yiyu
* QQ:1036184468
* Descriptoin:
*/
#include "MyFileDialog.h"
#include "SysPara.h"
#include <QDir>
#include <QDesktopServices>
#include <QUrl>
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<QUrl> 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(); //默认不要弹出输入法
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,269 @@
/********************************************************************************
** Form generated from reading UI file 'dialogfileoperation.ui'
**
** Created by: Qt User Interface Compiler version 4.8.5
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_DIALOGFILEOPERATION_H
#define UI_DIALOGFILEOPERATION_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QDialog>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QListView>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QTextEdit>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_DialogFileOperation
{
public:
QWidget *verticalLayoutWidget_3;
QVBoxLayout *verticalLayout_3;
QHBoxLayout *horizontalLayout_3;
QListView *listViewFile;
QVBoxLayout *verticalLayout;
QHBoxLayout *horizontalLayout_2;
QRadioButton *radioButtonLocal;
QRadioButton *radioButtonUdisk;
QHBoxLayout *horizontalLayout_4;
QPushButton *pushButtonDelFile;
QPushButton *pushButtonDelAll;
QPushButton *pushButtonImport;
QPushButton *pushButtonExport;
QTextEdit *textEditView;
QHBoxLayout *horizontalLayout;
QPushButton *pushButtonInsert;
QPushButton *pushButtonOpen;
QPushButton *pushButtonLast;
QPushButton *pushButtonNext;
QPushButton *pushButtonExit;
void setupUi(QDialog *DialogFileOperation)
{
if (DialogFileOperation->objectName().isEmpty())
DialogFileOperation->setObjectName(QString::fromUtf8("DialogFileOperation"));
DialogFileOperation->resize(757, 314);
DialogFileOperation->setFocusPolicy(Qt::StrongFocus);
verticalLayoutWidget_3 = new QWidget(DialogFileOperation);
verticalLayoutWidget_3->setObjectName(QString::fromUtf8("verticalLayoutWidget_3"));
verticalLayoutWidget_3->setGeometry(QRect(10, 10, 748, 291));
verticalLayout_3 = new QVBoxLayout(verticalLayoutWidget_3);
verticalLayout_3->setContentsMargins(2, 2, 2, 2);
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
verticalLayout_3->setContentsMargins(0, 0, 0, 0);
horizontalLayout_3 = new QHBoxLayout();
horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
listViewFile = new QListView(verticalLayoutWidget_3);
listViewFile->setObjectName(QString::fromUtf8("listViewFile"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(listViewFile->sizePolicy().hasHeightForWidth());
listViewFile->setSizePolicy(sizePolicy);
listViewFile->setMinimumSize(QSize(200, 0));
listViewFile->setMaximumSize(QSize(100, 16777215));
horizontalLayout_3->addWidget(listViewFile);
verticalLayout = new QVBoxLayout();
verticalLayout->setContentsMargins(2, 2, 2, 2);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setSpacing(1);
horizontalLayout_2->setContentsMargins(1, 1, 1, 1);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
radioButtonLocal = new QRadioButton(verticalLayoutWidget_3);
radioButtonLocal->setObjectName(QString::fromUtf8("radioButtonLocal"));
radioButtonLocal->setLayoutDirection(Qt::LeftToRight);
QIcon icon;
icon.addFile(QString::fromUtf8(":/icon/localdisk.png"), QSize(), QIcon::Normal, QIcon::Off);
radioButtonLocal->setIcon(icon);
radioButtonLocal->setChecked(true);
horizontalLayout_2->addWidget(radioButtonLocal);
radioButtonUdisk = new QRadioButton(verticalLayoutWidget_3);
radioButtonUdisk->setObjectName(QString::fromUtf8("radioButtonUdisk"));
radioButtonUdisk->setLayoutDirection(Qt::LeftToRight);
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/icon/udisk.png"), QSize(), QIcon::Normal, QIcon::Off);
radioButtonUdisk->setIcon(icon1);
horizontalLayout_2->addWidget(radioButtonUdisk);
verticalLayout->addLayout(horizontalLayout_2);
horizontalLayout_4 = new QHBoxLayout();
horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
horizontalLayout_4->setContentsMargins(-1, 2, -1, -1);
pushButtonDelFile = new QPushButton(verticalLayoutWidget_3);
pushButtonDelFile->setObjectName(QString::fromUtf8("pushButtonDelFile"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(37);
sizePolicy1.setHeightForWidth(pushButtonDelFile->sizePolicy().hasHeightForWidth());
pushButtonDelFile->setSizePolicy(sizePolicy1);
pushButtonDelFile->setMinimumSize(QSize(0, 37));
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/icon/keydelete.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonDelFile->setIcon(icon2);
horizontalLayout_4->addWidget(pushButtonDelFile);
pushButtonDelAll = new QPushButton(verticalLayoutWidget_3);
pushButtonDelAll->setObjectName(QString::fromUtf8("pushButtonDelAll"));
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(pushButtonDelAll->sizePolicy().hasHeightForWidth());
pushButtonDelAll->setSizePolicy(sizePolicy2);
pushButtonDelAll->setMinimumSize(QSize(0, 37));
QIcon icon3;
icon3.addFile(QString::fromUtf8(":/icon/filedelete.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonDelAll->setIcon(icon3);
horizontalLayout_4->addWidget(pushButtonDelAll);
pushButtonImport = new QPushButton(verticalLayoutWidget_3);
pushButtonImport->setObjectName(QString::fromUtf8("pushButtonImport"));
sizePolicy2.setHeightForWidth(pushButtonImport->sizePolicy().hasHeightForWidth());
pushButtonImport->setSizePolicy(sizePolicy2);
pushButtonImport->setMinimumSize(QSize(0, 37));
QIcon icon4;
icon4.addFile(QString::fromUtf8(":/icon/import.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonImport->setIcon(icon4);
horizontalLayout_4->addWidget(pushButtonImport);
pushButtonExport = new QPushButton(verticalLayoutWidget_3);
pushButtonExport->setObjectName(QString::fromUtf8("pushButtonExport"));
sizePolicy2.setHeightForWidth(pushButtonExport->sizePolicy().hasHeightForWidth());
pushButtonExport->setSizePolicy(sizePolicy2);
pushButtonExport->setMinimumSize(QSize(0, 37));
QIcon icon5;
icon5.addFile(QString::fromUtf8(":/icon/export.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonExport->setIcon(icon5);
horizontalLayout_4->addWidget(pushButtonExport);
verticalLayout->addLayout(horizontalLayout_4);
textEditView = new QTextEdit(verticalLayoutWidget_3);
textEditView->setObjectName(QString::fromUtf8("textEditView"));
textEditView->setEnabled(true);
textEditView->setAutoFillBackground(false);
verticalLayout->addWidget(textEditView);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setSpacing(0);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
pushButtonInsert = new QPushButton(verticalLayoutWidget_3);
pushButtonInsert->setObjectName(QString::fromUtf8("pushButtonInsert"));
sizePolicy2.setHeightForWidth(pushButtonInsert->sizePolicy().hasHeightForWidth());
pushButtonInsert->setSizePolicy(sizePolicy2);
pushButtonInsert->setMinimumSize(QSize(0, 37));
pushButtonInsert->setMaximumSize(QSize(90, 16777215));
QIcon icon6;
icon6.addFile(QString::fromUtf8(":/icon/insert.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonInsert->setIcon(icon6);
horizontalLayout->addWidget(pushButtonInsert);
pushButtonOpen = new QPushButton(verticalLayoutWidget_3);
pushButtonOpen->setObjectName(QString::fromUtf8("pushButtonOpen"));
sizePolicy2.setHeightForWidth(pushButtonOpen->sizePolicy().hasHeightForWidth());
pushButtonOpen->setSizePolicy(sizePolicy2);
pushButtonOpen->setMaximumSize(QSize(90, 16777215));
QIcon icon7;
icon7.addFile(QString::fromUtf8(":/icon/fileoperation.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonOpen->setIcon(icon7);
horizontalLayout->addWidget(pushButtonOpen);
pushButtonLast = new QPushButton(verticalLayoutWidget_3);
pushButtonLast->setObjectName(QString::fromUtf8("pushButtonLast"));
sizePolicy2.setHeightForWidth(pushButtonLast->sizePolicy().hasHeightForWidth());
pushButtonLast->setSizePolicy(sizePolicy2);
pushButtonLast->setMaximumSize(QSize(90, 16777215));
QIcon icon8;
icon8.addFile(QString::fromUtf8(":/icon/lastpage.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonLast->setIcon(icon8);
horizontalLayout->addWidget(pushButtonLast);
pushButtonNext = new QPushButton(verticalLayoutWidget_3);
pushButtonNext->setObjectName(QString::fromUtf8("pushButtonNext"));
sizePolicy2.setHeightForWidth(pushButtonNext->sizePolicy().hasHeightForWidth());
pushButtonNext->setSizePolicy(sizePolicy2);
pushButtonNext->setMaximumSize(QSize(90, 16777215));
QIcon icon9;
icon9.addFile(QString::fromUtf8(":/icon/nextpage.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonNext->setIcon(icon9);
horizontalLayout->addWidget(pushButtonNext);
pushButtonExit = new QPushButton(verticalLayoutWidget_3);
pushButtonExit->setObjectName(QString::fromUtf8("pushButtonExit"));
sizePolicy2.setHeightForWidth(pushButtonExit->sizePolicy().hasHeightForWidth());
pushButtonExit->setSizePolicy(sizePolicy2);
pushButtonExit->setMaximumSize(QSize(90, 16777215));
QIcon icon10;
icon10.addFile(QString::fromUtf8(":/icon/exit.png"), QSize(), QIcon::Normal, QIcon::Off);
pushButtonExit->setIcon(icon10);
horizontalLayout->addWidget(pushButtonExit);
verticalLayout->addLayout(horizontalLayout);
horizontalLayout_3->addLayout(verticalLayout);
verticalLayout_3->addLayout(horizontalLayout_3);
retranslateUi(DialogFileOperation);
QMetaObject::connectSlotsByName(DialogFileOperation);
} // setupUi
void retranslateUi(QDialog *DialogFileOperation)
{
DialogFileOperation->setWindowTitle(QApplication::translate("DialogFileOperation", "Dialog", 0, QApplication::UnicodeUTF8));
radioButtonLocal->setText(QApplication::translate("DialogFileOperation", "\346\234\254\345\234\260\346\226\207\344\273\266", 0, QApplication::UnicodeUTF8));
radioButtonUdisk->setText(QApplication::translate("DialogFileOperation", "U\347\233\230\346\226\207\344\273\266", 0, QApplication::UnicodeUTF8));
pushButtonDelFile->setText(QApplication::translate("DialogFileOperation", "\345\210\240\351\231\244\346\226\207\344\273\266", 0, QApplication::UnicodeUTF8));
pushButtonDelAll->setText(QApplication::translate("DialogFileOperation", "\345\210\240\351\231\244\345\205\250\351\203\250", 0, QApplication::UnicodeUTF8));
pushButtonImport->setText(QApplication::translate("DialogFileOperation", "\344\273\216U\347\233\230\345\257\274\345\205\245", 0, QApplication::UnicodeUTF8));
pushButtonExport->setText(QApplication::translate("DialogFileOperation", "\345\257\274\345\207\272\345\210\260U\347\233\230", 0, QApplication::UnicodeUTF8));
pushButtonInsert->setText(QApplication::translate("DialogFileOperation", "\346\217\222\345\205\245", 0, QApplication::UnicodeUTF8));
pushButtonOpen->setText(QApplication::translate("DialogFileOperation", "\346\211\223\345\274\200\346\226\207\344\273\266", 0, QApplication::UnicodeUTF8));
pushButtonLast->setText(QApplication::translate("DialogFileOperation", "\344\270\212\344\270\200\344\270\252", 0, QApplication::UnicodeUTF8));
pushButtonNext->setText(QApplication::translate("DialogFileOperation", "\344\270\213\344\270\200\344\270\252", 0, QApplication::UnicodeUTF8));
pushButtonExit->setText(QApplication::translate("DialogFileOperation", "\351\200\200\345\207\272", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class DialogFileOperation: public Ui_DialogFileOperation {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_DIALOGFILEOPERATION_H
@@ -0,0 +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 <qvarlengtharray.h>
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<uint> offsets;
inline QJsonPrivate::Entry *entryAt(int i) const {
return reinterpret_cast<QJsonPrivate::Entry *>(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