hlp:桂林国际齿轮泵代码
This commit is contained in:
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
* zkWidget.cpp
|
||||
*
|
||||
* Created on: Jul 2, 2013
|
||||
* Author: yiyu
|
||||
* QQ:1036184468
|
||||
* Descriptoin:
|
||||
|
||||
*/
|
||||
|
||||
#include "zkWidget.h"
|
||||
#include <QColor>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#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;i<widthPoint;i++){
|
||||
for(int j=0;j<heightPoint;j++){
|
||||
pointMap[i*MAX_PIC_WIDGET_HEIGHT + j] = pointMap[i*MAX_PIC_WIDGET_HEIGHT + j]?0:1;
|
||||
}
|
||||
}
|
||||
update();
|
||||
|
||||
//pointMap[x*MAX_PIC_WIDGET_HEIGHT + y] = pointMap[x*MAX_PIC_WIDGET_HEIGHT + y]?0:1;
|
||||
//update(x*scale,y*scale,scale,scale);
|
||||
modified = true;
|
||||
emit picWidgetModify(widthPoint,heightPoint);
|
||||
}
|
||||
}
|
||||
|
||||
bool zkWidget::isModified(){
|
||||
return modified;
|
||||
}
|
||||
|
||||
void zkWidget::setModified(bool m){
|
||||
modified = m;
|
||||
}
|
||||
|
||||
int zkWidget::getHeight(){
|
||||
return heightPoint;
|
||||
}
|
||||
|
||||
int zkWidget::getWidth(){
|
||||
return widthPoint;
|
||||
|
||||
}
|
||||
|
||||
int zkWidget::getScaleValue(){
|
||||
return scale;
|
||||
}
|
||||
|
||||
void zkWidget::initWidget(int w,int h){
|
||||
scale = 30;
|
||||
if(parentWidget()){
|
||||
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 = 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);
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'PicWidget.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 "../PicWidget.h"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'PicWidget.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_PicWidget[] = {
|
||||
|
||||
// content:
|
||||
6, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
6, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
5, // signalCount
|
||||
|
||||
// signals: signature, parameters, type, tag, flags
|
||||
11, 10, 10, 10, 0x05,
|
||||
29, 10, 10, 10, 0x05,
|
||||
43, 10, 10, 10, 0x05,
|
||||
66, 10, 10, 10, 0x05,
|
||||
92, 89, 10, 10, 0x05,
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
108, 10, 10, 10, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_PicWidget[] = {
|
||||
"PicWidget\0\0picWidgetModify()\0ShowKeybord()\0"
|
||||
"rowColChanged(QString)\0currXYChanged(QString)\0"
|
||||
"cc\0ChangeFont(int)\0cursorFlash()\0"
|
||||
};
|
||||
|
||||
void PicWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
PicWidget *_t = static_cast<PicWidget *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->picWidgetModify(); break;
|
||||
case 1: _t->ShowKeybord(); break;
|
||||
case 2: _t->rowColChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
|
||||
case 3: _t->currXYChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
|
||||
case 4: _t->ChangeFont((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 5: _t->cursorFlash(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData PicWidget::staticMetaObjectExtraData = {
|
||||
0, qt_static_metacall
|
||||
};
|
||||
|
||||
const QMetaObject PicWidget::staticMetaObject = {
|
||||
{ &QWidget::staticMetaObject, qt_meta_stringdata_PicWidget,
|
||||
qt_meta_data_PicWidget, &staticMetaObjectExtraData }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &PicWidget::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *PicWidget::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *PicWidget::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_PicWidget))
|
||||
return static_cast<void*>(const_cast< PicWidget*>(this));
|
||||
return QWidget::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int PicWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QWidget::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 6)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 6;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
// SIGNAL 0
|
||||
void PicWidget::picWidgetModify()
|
||||
{
|
||||
QMetaObject::activate(this, &staticMetaObject, 0, 0);
|
||||
}
|
||||
|
||||
// SIGNAL 1
|
||||
void PicWidget::ShowKeybord()
|
||||
{
|
||||
QMetaObject::activate(this, &staticMetaObject, 1, 0);
|
||||
}
|
||||
|
||||
// SIGNAL 2
|
||||
void PicWidget::rowColChanged(QString _t1)
|
||||
{
|
||||
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
|
||||
QMetaObject::activate(this, &staticMetaObject, 2, _a);
|
||||
}
|
||||
|
||||
// SIGNAL 3
|
||||
void PicWidget::currXYChanged(QString _t1)
|
||||
{
|
||||
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
|
||||
QMetaObject::activate(this, &staticMetaObject, 3, _a);
|
||||
}
|
||||
|
||||
// SIGNAL 4
|
||||
void PicWidget::ChangeFont(int _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,92 @@
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'MyInputMethod.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 "../MyInputMethod.h"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'MyInputMethod.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_MyInputMethod[] = {
|
||||
|
||||
// content:
|
||||
6, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
1, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
0, // signalCount
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
15, 14, 14, 14, 0x08,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_MyInputMethod[] = {
|
||||
"MyInputMethod\0\0switchBangalInput(bool)\0"
|
||||
};
|
||||
|
||||
void MyInputMethod::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
MyInputMethod *_t = static_cast<MyInputMethod *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->switchBangalInput((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData MyInputMethod::staticMetaObjectExtraData = {
|
||||
0, qt_static_metacall
|
||||
};
|
||||
|
||||
const QMetaObject MyInputMethod::staticMetaObject = {
|
||||
{ &QWSInputMethod::staticMetaObject, qt_meta_stringdata_MyInputMethod,
|
||||
qt_meta_data_MyInputMethod, &staticMetaObjectExtraData }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &MyInputMethod::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *MyInputMethod::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *MyInputMethod::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_MyInputMethod))
|
||||
return static_cast<void*>(const_cast< MyInputMethod*>(this));
|
||||
return QWSInputMethod::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int MyInputMethod::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QWSInputMethod::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 1)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 1;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
QT_END_MOC_NAMESPACE
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* FreeModbus Libary: BSD Socket Library 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: 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 <gotop167@163.com>
|
||||
***********************************************************/
|
||||
|
||||
#ifndef _PORT_H
|
||||
#define _PORT_H
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#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
|
||||
Reference in New Issue
Block a user