diff options
Diffstat (limited to 'src/modules/objects')
| -rw-r--r-- | src/modules/objects/KvsObject_pixmap.cpp | 726 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_pixmap.h | 93 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_popupMenu.cpp | 140 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_popupMenu.h | 4 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_socket.cpp | 43 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_socket.h | 50 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_treeWidget.cpp | 2 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_webView.cpp | 142 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_widget.cpp | 73 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_widget.h | 6 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_window.cpp | 1 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_wizard.h | 4 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_workspace.cpp | 212 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_workspace.h | 26 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_wrapper.cpp | 194 | ||||
| -rw-r--r-- | src/modules/objects/libkviobjects.cpp | 11 |
16 files changed, 942 insertions, 785 deletions
diff --git a/src/modules/objects/KvsObject_pixmap.cpp b/src/modules/objects/KvsObject_pixmap.cpp index 5bbbfc769..b471f80fc 100644 --- a/src/modules/objects/KvsObject_pixmap.cpp +++ b/src/modules/objects/KvsObject_pixmap.cpp @@ -35,7 +35,7 @@ #include <QFile> /* - @doc: pixmap + @doc: pixmap @keyterms: pixmap object class @title: @@ -54,32 +54,32 @@ Fills the pixmap with color and opacity.[br] !fn: $resize(<width:integer>,<height:integer>) Resizes the pixmap to w width and h height. Set wh or hg to 0, to have a null pixmap. - !fn: $scale(<width:integer>,<height:integer>,[<aspect_ratio:string>]) - Scales the pixmap or the animation by sx horizontally and sy vertically. + !fn: $scale(<width:integer>,<height:integer>,[<aspect_ratio:string>]) + Scales the pixmap or the animation by sx horizontally and sy vertically. Aspect_ratio values: - IgnoreAspectRatio:the pixmap is scaled ignoring his aspect ratio. - KeepAspectRatio: pixmap is scaled to a rectangle as large as possible inside size, preserving the aspect ratio. - KeepAspectRatioByExpanding, the pixmap is scaled to a rectangle as small as possible outside size, preserving the aspect ratio. - Default value is KeepAspectRatio. - !fn: $load(<file_name:string>) - Load a pixmap from the file <file_name>. - !fn: $save(<file_name:string>) - Save the pixmap or the current animation frame to the file <file_name>. - !fn: $loadAnimation(<file_name:string>) - Load an animation from the file <file_name> and start it. - !fn: $startAnimation() - Start the animation. - !fn: $stopAnimation() - Stop the animation. + Default value is KeepAspectRatio. + !fn: $load(<file_name:string>) + Load a pixmap from the file <file_name>. + !fn: $save(<file_name:string>) + Save the pixmap or the current animation frame to the file <file_name>. + !fn: $loadAnimation(<file_name:string>) + Load an animation from the file <file_name> and start it. + !fn: $startAnimation() + Start the animation. + !fn: $stopAnimation() + Stop the animation. !fn: <integer> $height() - Return the height of the pixmap or of the animation. + Return the height of the pixmap or of the animation. !fn: <integer> $width() - Return the width of the pixmap or of the animation. - !fn: $frameChangedEvent() - This event is triggered by KVIrc when the current animation frame changes. - @signals: - !sg: $frameChanged() - This signal is emitted by the default implementation of [classfnc]$frameChangedEvent[/classfnc]().[br] + Return the width of the pixmap or of the animation. + !fn: $frameChangedEvent() + This event is triggered by KVIrc when the current animation frame changes. + @signals: + !sg: $frameChanged() + This signal is emitted by the default implementation of [classfnc]$frameChangedEvent[/classfnc]().[br] */ @@ -117,9 +117,12 @@ KVSO_END_CONSTRUCTOR(KvsObject_pixmap) KVSO_BEGIN_DESTRUCTOR(KvsObject_pixmap) emit aboutToDie(); - if (m_pPixmap)delete m_pPixmap; - if (m_pAnimatedPixmap) delete m_pAnimatedPixmap; - if (m_pImage) delete m_pImage; + if (m_pPixmap) + delete m_pPixmap; + if (m_pAnimatedPixmap) + delete m_pAnimatedPixmap; + if (m_pImage) + delete m_pImage; KVSO_END_CONSTRUCTOR(KvsObject_pixmap) @@ -135,13 +138,14 @@ KVSO_CLASS_FUNCTION(pixmap,fill) KVSO_PARAMETER("color_mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szColorMode) KVSO_PARAMETER("opacity",KVS_PT_INT,KVS_PF_OPTIONAL,iOpacity) KVSO_PARAMETERS_END(c) + QColor col; if (!var1->asInteger(iCol1)) { var1->asString(szColor); - if (c->paramCount()<2) iOpacity=255; - else - { + if (c->paramCount()<2) + iOpacity=255; + else { if (!var2->asInteger(iOpacity)) { c->warning(__tr2qs_ctx("The opacity parameter didn't evaluate to integer","objects")); @@ -150,9 +154,7 @@ KVSO_CLASS_FUNCTION(pixmap,fill) } col.setNamedColor(szColor); col.setAlpha(iOpacity); - } - else - { + } else { if(c->paramCount()<3) { c->error(__tr2qs_ctx("Color name or triplette rgb/hsv value required","objects")); @@ -161,32 +163,35 @@ KVSO_CLASS_FUNCTION(pixmap,fill) if (!var2->asInteger(iCol2)||!var3->asInteger(iCol3)) { c->error(__tr2qs_ctx("One of the triplette parameters didn't evaluate to an integer","objects"));\ - return true; + return true; } - if (c->paramCount()<5) iOpacity=255; + if (c->paramCount()<5) + iOpacity=255; + if(KviQString::equalCI(szColorMode, "HSV")) - col.setHsv(iCol1,iCol2,iCol3,iOpacity); + col.setHsv(iCol1,iCol2,iCol3,iOpacity); else - col.setRgb(iCol1,iCol2,iCol3,iOpacity); + col.setRgb(iCol1,iCol2,iCol3,iOpacity); } if(m_currentType==Image) { - if(m_pImage) - { - if(!m_pPixmap) m_pPixmap = new QPixmap(); - *m_pPixmap = QPixmap::fromImage(*m_pImage); - delete m_pImage; - m_pImage = 0; - } - else m_pPixmap = 0; - } - else if(m_currentType==AnimatedPixmap) - { + if(m_pImage) + { + if(!m_pPixmap) + m_pPixmap = new QPixmap(); + *m_pPixmap = QPixmap::fromImage(*m_pImage); + delete m_pImage; + m_pImage = 0; + } else { + m_pPixmap = 0; + } + } else if(m_currentType==AnimatedPixmap) { delete m_pAnimatedPixmap; m_pAnimatedPixmap=0; } m_currentType = Pixmap; - if(!m_pPixmap) m_pPixmap=new QPixmap(); + if(!m_pPixmap) + m_pPixmap=new QPixmap(); m_pPixmap->fill(col); return true; } @@ -198,20 +203,22 @@ KVSO_CLASS_FUNCTION(pixmap,resize) KVSO_PARAMETER("width",KVS_PT_INTEGER,0,iWidth) KVSO_PARAMETER("height",KVS_PT_INTEGER,0,iHeight) KVSO_PARAMETERS_END(c) + if(m_currentType==Image) { if(m_pImage) - delete m_pImage; - m_pImage = 0; + { + delete m_pImage; + m_pImage = 0; + } } - else if(m_currentType==AnimatedPixmap) - { - if (m_pAnimatedPixmap) + else if(m_currentType==AnimatedPixmap) { + if(m_pAnimatedPixmap) + { delete m_pAnimatedPixmap; - m_pAnimatedPixmap=0; - } - else if(m_pPixmap) - { + m_pAnimatedPixmap=0; + } + } else if(m_pPixmap) { delete m_pPixmap; } m_currentType = Image; @@ -234,13 +241,15 @@ KVSO_CLASS_FUNCTION(pixmap,setPixel) KVSO_PARAMETER("color_mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szColorMode) KVSO_PARAMETER("opacity",KVS_PT_INT,KVS_PF_OPTIONAL,iOpacity) KVSO_PARAMETERS_END(c) + QColor col; if (!var1->asInteger(iCol1)) { var1->asString(szColor); - if (c->paramCount()<4) iOpacity=255; - else + if (c->paramCount()<4) { + iOpacity=255; + } else { if (!var2->asInteger(iOpacity)) { c->warning(__tr2qs_ctx("The opacity parameter didn't evaluate to integer","objects")); @@ -249,9 +258,7 @@ KVSO_CLASS_FUNCTION(pixmap,setPixel) } col.setNamedColor(szColor); col.setAlpha(iOpacity); - } - else - { + } else { if(c->paramCount()<5) { c->error(__tr2qs_ctx("Color name or triplette rgb/hsv value required","objects")); @@ -262,26 +269,25 @@ KVSO_CLASS_FUNCTION(pixmap,setPixel) c->error(__tr2qs_ctx("One of the triplette parameters didn't evaluate to an integer","objects"));\ return true; } - if (c->paramCount()<7) iOpacity=255; + if (c->paramCount()<7) + iOpacity=255; + if(KviQString::equalCI(szColorMode, "HSV")) - col.setHsv(iCol1,iCol2,iCol3,iOpacity); + col.setHsv(iCol1,iCol2,iCol3,iOpacity); else - col.setRgb(iCol1,iCol2,iCol3,iOpacity); + col.setRgb(iCol1,iCol2,iCol3,iOpacity); } + if(m_currentType==AnimatedPixmap) { c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); return true; - } - else if((m_currentType==Image && !m_pImage) || (m_currentType==Pixmap && !m_pPixmap)) - { + } else if((m_currentType==Image && !m_pImage) || (m_currentType==Pixmap && !m_pPixmap)) { c->error(__tr2qs_ctx("The pixmap is null","objects")); return false; - } - else if(m_currentType==Pixmap) - { - if(m_pImage) - delete m_pImage; + } else if(m_currentType==Pixmap) { + if(m_pImage) + delete m_pImage; *m_pImage = m_pPixmap->toImage(); delete m_pPixmap; } @@ -292,365 +298,403 @@ KVSO_CLASS_FUNCTION(pixmap,setPixel) KVSO_CLASS_FUNCTION(pixmap,rotate) { - kvs_real_t dAngle; - QString szAxis; - KVSO_PARAMETERS_BEGIN(c) + kvs_real_t dAngle; + QString szAxis; + KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("angle",KVS_PT_DOUBLE,0,dAngle) KVSO_PARAMETER("axis",KVS_PT_STRING,KVS_PF_OPTIONAL,szAxis) - KVSO_PARAMETERS_END(c) - Qt::Axis axis = Qt::ZAxis; - if(!szAxis.isEmpty()) - { - if (KviQString::equalCI(szAxis,"XAxis"))axis=Qt::XAxis; - else if (KviQString::equalCI(szAxis,"YAxis")) axis=Qt::YAxis; - else if (KviQString::equalCI(szAxis,"ZAxis")) axis=Qt::ZAxis; - else c->warning(__tr2qs_ctx("Unknown axis '%Q' switching to default ZAxis","objects"),&szAxis); - } - if(m_currentType==Pixmap) - { - if(m_pPixmap){ - if(!m_pImage) m_pImage = new QImage(); - *m_pImage = m_pPixmap->toImage(); + KVSO_PARAMETERS_END(c) + + Qt::Axis axis = Qt::ZAxis; + if(!szAxis.isEmpty()) + { + if (KviQString::equalCI(szAxis,"XAxis")) + axis=Qt::XAxis; + else if (KviQString::equalCI(szAxis,"YAxis")) + axis=Qt::YAxis; + else if (KviQString::equalCI(szAxis,"ZAxis")) + axis=Qt::ZAxis; + else + c->warning(__tr2qs_ctx("Unknown axis '%Q' switching to default ZAxis","objects"),&szAxis); + } + + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + if(!m_pImage) + m_pImage = new QImage(); + *m_pImage = m_pPixmap->toImage(); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else if(m_currentType==AnimatedPixmap) { + c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); + return true; } - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; + + if(!m_pImage) + { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; } - } - else if(m_currentType==AnimatedPixmap) - { - c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); - return true; - } - if(!m_pImage) - { - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - m_currentType = Image; - QTransform transform; - transform.rotate(dAngle,axis); - *m_pImage=m_pImage->transformed(transform); - return true; + m_currentType = Image; + QTransform transform; + transform.rotate(dAngle,axis); + *m_pImage=m_pImage->transformed(transform); + return true; } KVSO_CLASS_FUNCTION(pixmap,mirrored) { - kvs_real_t dAngle; - bool bHorizontal,bVertical; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("bHorizontal",KVS_PT_BOOLEAN,0,bHorizontal) - KVSO_PARAMETER("bvertical",KVS_PT_BOOLEAN,0,bVertical) + kvs_real_t dAngle; + bool bHorizontal,bVertical; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("bHorizontal",KVS_PT_BOOLEAN,0,bHorizontal) + KVSO_PARAMETER("bvertical",KVS_PT_BOOLEAN,0,bVertical) + KVSO_PARAMETERS_END(c) - KVSO_PARAMETERS_END(c) - if(m_currentType==Pixmap) - { - if(m_pPixmap){ - if(!m_pImage) m_pImage = new QImage(); - *m_pImage = m_pPixmap->toImage(); + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + if(!m_pImage) m_pImage = new QImage(); + *m_pImage = m_pPixmap->toImage(); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else if(m_currentType==AnimatedPixmap) { + c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); + return true; } - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; + + if(!m_pImage) + { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; } - } - else if(m_currentType==AnimatedPixmap) - { - c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); - return true; - } - if(!m_pImage) - { - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - m_currentType = Image; - *m_pImage=m_pImage->mirrored(bHorizontal,bVertical); - return true; + m_currentType = Image; + *m_pImage=m_pImage->mirrored(bHorizontal,bVertical); + return true; } KVSO_CLASS_FUNCTION(pixmap,toGrayScale) { - if(m_currentType==Pixmap) - { - if(m_pPixmap){ - if(!m_pImage) m_pImage = new QImage(); - *m_pImage = m_pPixmap->toImage(); + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + if(!m_pImage) m_pImage = new QImage(); + *m_pImage = m_pPixmap->toImage(); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else if(m_currentType==AnimatedPixmap) { + c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); + return true; } - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; + + if(!m_pImage) + { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + m_currentType = Image; + QRgb col; + int w=m_pImage->width(); + int h=m_pImage->height(); + int res; + for(int y=0; y<h; y++) + { + QRgb *data = (QRgb *) m_pImage->scanLine(y); + for (int x=0; x<w; x++) + { + col = *data; + res = (qRed(col)+qGreen(col)+qBlue(col))/3; + *data++ = qRgba(res, res, res,qAlpha(col)); + } } - } - else if(m_currentType==AnimatedPixmap) - { - c->warning(__tr2qs_ctx("AnimatedPixmap not supported","objects")); - return true; - } - if(!m_pImage) - { - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - m_currentType = Image; - QRgb col; - int w=m_pImage->width(); - int h=m_pImage->height(); - int res; - for(int y=0; y<h; y++) - { - QRgb *data = (QRgb *) m_pImage->scanLine(y); - for (int x=0; x<w; x++) - { - col = *data; - res = (qRed(col)+qGreen(col)+qBlue(col))/3; - *data++ = qRgba(res, res, res,qAlpha(col)); - } - } - return true; + return true; } + KVSO_CLASS_FUNCTION(pixmap,scale) { - kvs_int_t iWidth,iHeight; - QString szAspectRatio; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("width",KVS_PT_INTEGER,0,iWidth) - KVSO_PARAMETER("height",KVS_PT_INTEGER,0,iHeight) - KVSO_PARAMETER("aspect_ratio",KVS_PT_STRING,KVS_PF_OPTIONAL,szAspectRatio) - KVSO_PARAMETERS_END(c) - Qt::AspectRatioMode ratio=Qt::KeepAspectRatio; - if(!szAspectRatio.isEmpty()) - { - if(KviQString::equalCI(szAspectRatio,"IgnoreAspectRatio")) ratio=Qt::IgnoreAspectRatio; - else if (KviQString::equalCI(szAspectRatio,"KeepAspectRatio")) ratio=Qt::KeepAspectRatio; - else if (KviQString::equalCI(szAspectRatio,"KeepAspectRatioByExpanding")) ratio=Qt::KeepAspectRatioByExpanding; - else c->warning(__tr2qs_ctx("Unknown aspect ratio %Q - Switching to KeepAspectRatio ratio","objects"),&szAspectRatio); - } - if(m_currentType==Pixmap) - { - if(m_pPixmap) - *m_pPixmap=m_pPixmap->scaled(iWidth,iHeight,ratio,Qt::SmoothTransformation); - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - } - else if (m_currentType==AnimatedPixmap) - m_pAnimatedPixmap->resize(QSize(iWidth,iHeight),ratio); - else if(m_pImage) - *m_pImage=m_pImage->scaled(iWidth,iHeight,ratio,Qt::SmoothTransformation); - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - return true; + kvs_int_t iWidth,iHeight; + QString szAspectRatio; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("width",KVS_PT_INTEGER,0,iWidth) + KVSO_PARAMETER("height",KVS_PT_INTEGER,0,iHeight) + KVSO_PARAMETER("aspect_ratio",KVS_PT_STRING,KVS_PF_OPTIONAL,szAspectRatio) + KVSO_PARAMETERS_END(c) + + Qt::AspectRatioMode ratio=Qt::KeepAspectRatio; + if(!szAspectRatio.isEmpty()) + { + if(KviQString::equalCI(szAspectRatio,"IgnoreAspectRatio")) + ratio=Qt::IgnoreAspectRatio; + else if (KviQString::equalCI(szAspectRatio,"KeepAspectRatio")) + ratio=Qt::KeepAspectRatio; + else if (KviQString::equalCI(szAspectRatio,"KeepAspectRatioByExpanding")) + ratio=Qt::KeepAspectRatioByExpanding; + else + c->warning(__tr2qs_ctx("Unknown aspect ratio %Q - Switching to KeepAspectRatio ratio","objects"),&szAspectRatio); + } + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + *m_pPixmap=m_pPixmap->scaled(iWidth,iHeight,ratio,Qt::SmoothTransformation); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else if (m_currentType==AnimatedPixmap) { + m_pAnimatedPixmap->resize(QSize(iWidth,iHeight),ratio); + } else if(m_pImage) { + *m_pImage=m_pImage->scaled(iWidth,iHeight,ratio,Qt::SmoothTransformation); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + return true; } -KVSO_CLASS_FUNCTION(pixmap,loadAnimation) +KVSO_CLASS_FUNCTION(pixmap,loadAnimation) { - QString szFile; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) - KVSO_PARAMETERS_END(c) - if(!QFile::exists(szFile)) - { + QString szFile; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) + KVSO_PARAMETERS_END(c) + + if(!QFile::exists(szFile)) + { c->warning(__tr2qs_ctx("I can't find the specified file '%Q'.","objects"),&szFile); return true; - } - if (m_pAnimatedPixmap){ + } + if (m_pAnimatedPixmap) { delete m_pAnimatedPixmap; m_pAnimatedPixmap = 0; - } - if (m_pPixmap) - { + } + if (m_pPixmap) + { delete m_pPixmap; m_pPixmap=0; - } - m_pAnimatedPixmap= new KviAnimatedPixmap(szFile); - connect(m_pAnimatedPixmap,SIGNAL(frameChanged()),this,SLOT(frameChanged())); - return true; + } + m_pAnimatedPixmap= new KviAnimatedPixmap(szFile); + connect(m_pAnimatedPixmap,SIGNAL(frameChanged()),this,SLOT(frameChanged())); + return true; } KVSO_CLASS_FUNCTION(pixmap,startAnimation) { Q_UNUSED(c); - if (m_pAnimatedPixmap) m_pAnimatedPixmap->start(); - return true; + if (m_pAnimatedPixmap) + m_pAnimatedPixmap->start(); + return true; } KVSO_CLASS_FUNCTION(pixmap,stopAnimation) { Q_UNUSED(c); - if (m_pAnimatedPixmap) m_pAnimatedPixmap->stop(); - return true; + if (m_pAnimatedPixmap) + m_pAnimatedPixmap->stop(); + return true; } KVSO_CLASS_FUNCTION(pixmap,load) { - QString szFile; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) - KVSO_PARAMETERS_END(c) - if(!QFile::exists(szFile)) - { + QString szFile; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) + KVSO_PARAMETERS_END(c) + + if(!QFile::exists(szFile)) + { c->warning(__tr2qs_ctx("I can't find the specified file '%Q'.","objects"),&szFile); return true; - } - if(!m_pImage) m_pImage=new QImage(); + } + if(!m_pImage) + m_pImage=new QImage(); - m_pImage->load(szFile); - return true; - if (m_currentType==Image && m_pImage) + m_pImage->load(szFile); + return true; +/* + * FIXME UNUSED CODE + if (m_currentType==Image && m_pImage) delete m_pImage; - else if (m_currentType==AnimatedPixmap && m_pAnimatedPixmap) + else if (m_currentType==AnimatedPixmap && m_pAnimatedPixmap) delete m_pAnimatedPixmap; - if(!m_pPixmap) m_pPixmap=new QPixmap(); - m_currentType=Pixmap; - m_pPixmap->load(szFile); - qDebug("alpha %i",m_pPixmap->hasAlpha()); - return true; + if(!m_pPixmap) m_pPixmap=new QPixmap(); + m_currentType=Pixmap; + m_pPixmap->load(szFile); + qDebug("alpha %i",m_pPixmap->hasAlpha()); + return true; +*/ } + KVSO_CLASS_FUNCTION(pixmap,save) { - QString szFile; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) - KVSO_PARAMETERS_END(c) - if(m_currentType==Pixmap) - { - if(m_pPixmap) - m_pPixmap->save(szFile); - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; - } - } - else if(m_currentType==Image) - { - if(m_pImage) - m_pImage->save(szFile); - else{ - c->error(__tr2qs_ctx("The pixmap is null","objects")); - return false; + QString szFile; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("file",KVS_PT_STRING,0,szFile) + KVSO_PARAMETERS_END(c) + + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + m_pPixmap->save(szFile); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else if(m_currentType==Image) { + if(m_pImage) + { + m_pImage->save(szFile); + } else { + c->error(__tr2qs_ctx("The pixmap is null","objects")); + return false; + } + } else { + m_pAnimatedPixmap->pixmap()->save(szFile); } - } - else m_pAnimatedPixmap->pixmap()->save(szFile); - return true; + return true; } void KvsObject_pixmap::setInternalPixmap(QPixmap *pPixmap) { - if(m_currentType==Image && m_pImage) delete m_pImage; - else if(m_currentType==Pixmap && m_pPixmap) delete m_pPixmap; - m_currentType=Pixmap; - m_pPixmap=pPixmap; + if(m_currentType==Image && m_pImage) + delete m_pImage; + else if(m_currentType==Pixmap && m_pPixmap) + delete m_pPixmap; + m_currentType=Pixmap; + m_pPixmap=pPixmap; } void KvsObject_pixmap::setInternalImage(QImage *pImage) { - if(m_currentType==Image && m_pImage) delete m_pImage; - else if(m_currentType==Pixmap && m_pPixmap) delete m_pPixmap; - m_currentType=Image; - m_pImage=pImage; + if(m_currentType==Image && m_pImage) + delete m_pImage; + else if(m_currentType==Pixmap && m_pPixmap) + delete m_pPixmap; + m_currentType=Image; + m_pImage=pImage; } KVSO_CLASS_FUNCTION(pixmap,loadFromMemoryBuffer) { - KviKvsObject * pObject; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("hobject",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETERS_END(c) + KviKvsObject * pObject; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("hobject",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if (!pObject) - { - c->warning(__tr2qs_ctx("Buffer parameter is not an object","objects")); - return true; - } - if (!pObject->inheritsClass("memorybuffer")) - { - c->warning(__tr2qs_ctx("Buffer parameter is not a memorybuffer object","objects")); - return true; - } - if (m_pAnimatedPixmap){ - delete m_pAnimatedPixmap; - m_pAnimatedPixmap=0; - } - if (!m_pPixmap) m_pPixmap=new QPixmap(); - m_pPixmap->loadFromData(((KvsObject_memoryBuffer *)pObject)->dataBuffer()); - return true; + pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + if (!pObject) + { + c->warning(__tr2qs_ctx("Buffer parameter is not an object","objects")); + return true; + } + if (!pObject->inheritsClass("memorybuffer")) + { + c->warning(__tr2qs_ctx("Buffer parameter is not a memorybuffer object","objects")); + return true; + } + if (m_pAnimatedPixmap) + { + delete m_pAnimatedPixmap; + m_pAnimatedPixmap=0; + } + if (!m_pPixmap) + m_pPixmap=new QPixmap(); + m_pPixmap->loadFromData(((KvsObject_memoryBuffer *)pObject)->dataBuffer()); + return true; } KVSO_CLASS_FUNCTION(pixmap,grabWidget) { - CHECK_INTERNAL_POINTER(m_pPixmap) - KviKvsObject * pObject; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - CHECK_HOBJECT_IS_WIDGET(pObject) - if (m_pAnimatedPixmap){ - delete m_pAnimatedPixmap; - m_pAnimatedPixmap=0; - } - if (!m_pPixmap) m_pPixmap=new QPixmap(); - *m_pPixmap=QPixmap::grabWidget(((KvsObject_widget *)pObject)->widget()); - /* QString szFileName; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("file_name",KVS_PT_STRING,0,szFileName) - KVSO_PARAMETERS_END(c) - QPrinter printer;//(QPrinter::HighResolution); - printer.setOutputFormat(QPrinter::PdfFormat); - printer.setPaperSize(QPrinter::A4); - printer.setOutputFileName(szFileName); + CHECK_INTERNAL_POINTER(m_pPixmap) + KviKvsObject * pObject; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETERS_END(c) - QPixmap pixmap=QPixmap::grabWidget(((QTableWidget *)widget())); - QPainter painter(&printer); - painter.drawPixmap(QPoint(0,0), pixmap, pixmap.rect()); - */ + pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + CHECK_HOBJECT_IS_WIDGET(pObject) + if (m_pAnimatedPixmap) + { + delete m_pAnimatedPixmap; + m_pAnimatedPixmap=0; + } + if (!m_pPixmap) + m_pPixmap=new QPixmap(); + *m_pPixmap=QPixmap::grabWidget(((KvsObject_widget *)pObject)->widget()); + return true; - return true; +/* FIXME UNUSED CODE + QString szFileName; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("file_name",KVS_PT_STRING,0,szFileName) + KVSO_PARAMETERS_END(c) + QPrinter printer;//(QPrinter::HighResolution); + printer.setOutputFormat(QPrinter::PdfFormat); + printer.setPaperSize(QPrinter::A4); + printer.setOutputFileName(szFileName); + + QPixmap pixmap=QPixmap::grabWidget(((QTableWidget *)widget())); + QPainter painter(&printer); + painter.drawPixmap(QPoint(0,0), pixmap, pixmap.rect()); +*/ } + KVSO_CLASS_FUNCTION(pixmap,height) { - if (m_currentType==Image && m_pImage) c->returnValue()->setInteger(m_pImage->height()); - else if(m_currentType==Pixmap && m_pPixmap) c->returnValue()->setInteger(m_pPixmap->height()); - else c->returnValue()->setInteger(0); - //else if(m_pAnimatedPixmap) c->returnValue()->setInteger(m_pAnimatedPixmap->size().height()); - //else c->returnValue()->setInteger(m_pPixmap->height()); - return true; + if (m_currentType==Image && m_pImage) + c->returnValue()->setInteger(m_pImage->height()); + else if(m_currentType==Pixmap && m_pPixmap) + c->returnValue()->setInteger(m_pPixmap->height()); + else + c->returnValue()->setInteger(0); + //else if(m_pAnimatedPixmap) c->returnValue()->setInteger(m_pAnimatedPixmap->size().height()); + //else c->returnValue()->setInteger(m_pPixmap->height()); + return true; } + KVSO_CLASS_FUNCTION(pixmap,width) { - - if (m_currentType==Image && m_pImage) c->returnValue()->setInteger(m_pImage->width()); - else if(m_currentType==Pixmap && m_pPixmap) c->returnValue()->setInteger(m_pPixmap->width()); - else c->returnValue()->setInteger(0); - //else if(m_pAnimatedPixmap) c->returnValue()->setInteger(m_pAnimatedPixmap->size().height()); - //else c->returnValue()->setInteger(m_pPixmap->height()); - return true; + if (m_currentType==Image && m_pImage) + c->returnValue()->setInteger(m_pImage->width()); + else if(m_currentType==Pixmap && m_pPixmap) + c->returnValue()->setInteger(m_pPixmap->width()); + else + c->returnValue()->setInteger(0); + //else if(m_pAnimatedPixmap) c->returnValue()->setInteger(m_pAnimatedPixmap->size().height()); + //else c->returnValue()->setInteger(m_pPixmap->height()); + return true; } /*QPixmap * KvsObject_pixmap::getPixmap() { - if (!m_pAnimatedPixmap && !m_pPixmap) return new QPixmap(); - else if(m_pAnimatedPixmap) return m_pAnimatedPixmap->pixmap(); - else return m_pPixmap; + if (!m_pAnimatedPixmap && !m_pPixmap) return new QPixmap(); + else if(m_pAnimatedPixmap) return m_pAnimatedPixmap->pixmap(); + else return m_pPixmap; }*/ KVSO_CLASS_FUNCTION(pixmap,frameChangedEvent) { - emitSignal("frameChanged",c); - return true; + emitSignal("frameChanged",c); + return true; } // slots void KvsObject_pixmap::frameChanged() { - KviKvsVariantList *params=0; - callFunction(this,"frameChangedEvent",params); + KviKvsVariantList *params=0; + callFunction(this,"frameChangedEvent",params); } #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES diff --git a/src/modules/objects/KvsObject_pixmap.h b/src/modules/objects/KvsObject_pixmap.h index e0845224c..2f6dc67d3 100644 --- a/src/modules/objects/KvsObject_pixmap.h +++ b/src/modules/objects/KvsObject_pixmap.h @@ -50,64 +50,67 @@ public: QImage * getImage() { - if(!m_pImage) m_pImage = new QImage(); - if(m_currentType==Pixmap) - { - if(m_pPixmap){ - *m_pImage = m_pPixmap->toImage(); - delete m_pPixmap; - m_pPixmap = 0; - } - } - m_currentType = Image; - return m_pImage; + if(!m_pImage) + m_pImage = new QImage(); + if(m_currentType==Pixmap) + { + if(m_pPixmap) + { + *m_pImage = m_pPixmap->toImage(); + delete m_pPixmap; + m_pPixmap = 0; + } + } + m_currentType = Image; + return m_pImage; } QPixmap * getPixmap() { - if(!m_pPixmap) m_pPixmap = new QPixmap(); - if(m_currentType==Image) - { - if(m_pImage){ - *m_pPixmap = m_pPixmap->fromImage(*m_pImage); - delete m_pImage; - m_pImage = 0; - } - } - m_currentType = Pixmap; - return m_pPixmap; + if(!m_pPixmap) + m_pPixmap = new QPixmap(); + if(m_currentType==Image) + { + if(m_pImage) + { + *m_pPixmap = m_pPixmap->fromImage(*m_pImage); + delete m_pImage; + m_pImage = 0; + } + } + m_currentType = Pixmap; + return m_pPixmap; } protected: - KviAnimatedPixmap * m_pAnimatedPixmap; - QPixmap * m_pPixmap; + KviAnimatedPixmap * m_pAnimatedPixmap; + QPixmap * m_pPixmap; QImage * m_pImage; signals: void aboutToDie(); protected: + bool fill(KviKvsObjectFunctionCall *c); + bool resize(KviKvsObjectFunctionCall *c); + bool scale(KviKvsObjectFunctionCall *c); + //bool rotate(KviKvsObjectFunctionCall *c); + bool save(KviKvsObjectFunctionCall *c); + bool startAnimation(KviKvsObjectFunctionCall *c); + bool stopAnimation(KviKvsObjectFunctionCall *c); + bool loadAnimation(KviKvsObjectFunctionCall *c); + bool load(KviKvsObjectFunctionCall *c); + bool height(KviKvsObjectFunctionCall *c); + bool width(KviKvsObjectFunctionCall *c); + bool grabWidget(KviKvsObjectFunctionCall *c); + bool loadFromMemoryBuffer(KviKvsObjectFunctionCall *c); + bool rotate(KviKvsObjectFunctionCall *c); + bool toGrayScale(KviKvsObjectFunctionCall *c); + bool mirrored(KviKvsObjectFunctionCall *c); + bool setPixel(KviKvsObjectFunctionCall *c); - bool fill(KviKvsObjectFunctionCall *c); - bool resize(KviKvsObjectFunctionCall *c); - bool scale(KviKvsObjectFunctionCall *c); - //bool rotate(KviKvsObjectFunctionCall *c); - bool save(KviKvsObjectFunctionCall *c); - bool startAnimation(KviKvsObjectFunctionCall *c); - bool stopAnimation(KviKvsObjectFunctionCall *c); - bool loadAnimation(KviKvsObjectFunctionCall *c); - bool load(KviKvsObjectFunctionCall *c); - bool height(KviKvsObjectFunctionCall *c); - bool width(KviKvsObjectFunctionCall *c); - bool grabWidget(KviKvsObjectFunctionCall *c); - bool loadFromMemoryBuffer(KviKvsObjectFunctionCall *c); - bool rotate(KviKvsObjectFunctionCall *c); - bool toGrayScale(KviKvsObjectFunctionCall *c); - bool mirrored(KviKvsObjectFunctionCall *c); - bool setPixel(KviKvsObjectFunctionCall *c); - - bool frameChangedEvent(KviKvsObjectFunctionCall *c); + bool frameChangedEvent(KviKvsObjectFunctionCall *c); protected slots: - void frameChanged(); - }; + void frameChanged(); +}; #endif // !_CLASS_PIXMAP_H_ diff --git a/src/modules/objects/KvsObject_popupMenu.cpp b/src/modules/objects/KvsObject_popupMenu.cpp index 307f19f60..ea250b0b2 100644 --- a/src/modules/objects/KvsObject_popupMenu.cpp +++ b/src/modules/objects/KvsObject_popupMenu.cpp @@ -172,28 +172,28 @@ static int iIdentifier=0; static int addActionToDict(QAction *pAction) { - actionsDict.insert(iIdentifier,pAction); - iIdentifier++; - return (iIdentifier-1); + actionsDict.insert(iIdentifier,pAction); + iIdentifier++; + return (iIdentifier-1); } static void removeMenuAllActions(QMenu *pMenu) { - QList<QAction*> pActionsList=pMenu->actions(); - QList<QAction*> pActionsListDictValues=actionsDict.values(); - for(int i=0;i<pActionsList.count();i++) - { - int iIdx=pActionsListDictValues.indexOf(pActionsList.at(i)); - if (iIdx>=0) actionsDict.remove(actionsDict.key(pActionsList.at(i))); - } + QList<QAction*> pActionsList=pMenu->actions(); + QList<QAction*> pActionsListDictValues=actionsDict.values(); + for(int i=0;i<pActionsList.count();i++) + { + int iIdx=pActionsListDictValues.indexOf(pActionsList.at(i)); + if (iIdx>=0) actionsDict.remove(actionsDict.key(pActionsList.at(i))); + } } static QAction* getAction(int idx) { - return actionsDict.value(idx); + return actionsDict.value(idx); } static void removeAction(int idx) { - actionsDict.remove(idx); + actionsDict.remove(idx); } @@ -222,9 +222,9 @@ KVSO_END_DESTRUCTOR(KvsObject_popupMenu) bool KvsObject_popupMenu::init(KviKvsRunTimeContext *,KviKvsVariantList *) { - SET_OBJECT(QMenu) + SET_OBJECT(QMenu) connect(widget(),SIGNAL(triggered(QAction *)),this,SLOT(slottriggered(QAction *))); - connect(widget(),SIGNAL(destroyed(QObject *)),this,SLOT(aboutToDie(QObject *))); + connect(widget(),SIGNAL(destroyed(QObject *)),this,SLOT(aboutToDie(QObject *))); connect(widget(),SIGNAL(highlighted(int)),this,SLOT(slothighlighted(int))); return true; } @@ -237,18 +237,19 @@ KVSO_CLASS_FUNCTION(popupMenu,insertItem) KVSO_PARAMETER("text",KVS_PT_STRING,0,szItem) KVSO_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szIcon) KVSO_PARAMETERS_END(c) + QPixmap *pix = 0; - QAction * pAction = 0; + QAction * pAction = 0; if(!szIcon.isEmpty()) { pix = g_pIconManager->getImage(szIcon); - if (pix) pAction=((QMenu *)widget())->addAction(*pix,szItem); + if (pix) pAction=((QMenu *)widget())->addAction(*pix,szItem); else c->warning(__tr2qs_ctx("Icon '%Q' doesn't exist","objects"),&szIcon); } else - pAction=((QMenu *)widget())->addAction(szItem); - int identifier=addActionToDict(pAction); - c->returnValue()->setInteger((kvs_int_t)identifier); + pAction=((QMenu *)widget())->addAction(szItem); + int identifier=addActionToDict(pAction); + c->returnValue()->setInteger((kvs_int_t)identifier); return true; } @@ -293,55 +294,57 @@ KVSO_CLASS_FUNCTION(popupMenu,exec) KVSO_CLASS_FUNCTION(popupMenu,addMenu) { - CHECK_INTERNAL_POINTER(widget()) - KviKvsObject *pObject; - kvs_uint_t iIdx; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("popupmenu",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,iIdx) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if (!pObject)\ - { - c->warning(__tr2qs_ctx("Popup menu parameter is not an object","objects"));\ - return true; - } - if (!pObject->object())\ - { - c->warning(__tr2qs_ctx("Popup menu parameter is not a valid object","objects"));\ - return true;\ - } - if(!pObject->inheritsClass("popupmenu"))\ - {\ - c->warning(__tr2qs_ctx("Popupmenu object required","objects"));\ - return true;\ - } - QAction *pAction; - if(iIdx) - { - QAction *pActionBefore=actionsDict[iIdx]; - pAction=((QMenu *)widget())->insertMenu(pActionBefore,(QMenu*)pObject->object()); - } - else pAction=((QMenu *)widget())->addMenu((QMenu*)pObject->object()); - int identifier=addActionToDict(pAction); - c->returnValue()->setInteger((kvs_int_t)identifier); - identifier++; - return true; + CHECK_INTERNAL_POINTER(widget()) + KviKvsObject *pObject; + kvs_uint_t iIdx; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("popupmenu",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,iIdx) + KVSO_PARAMETERS_END(c) + + pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + if (!pObject) + { + c->warning(__tr2qs_ctx("Popup menu parameter is not an object","objects")); + return true; + } + if (!pObject->object()) + { + c->warning(__tr2qs_ctx("Popup menu parameter is not a valid object","objects")); + return true; + } + if(!pObject->inheritsClass("popupmenu")) + { + c->warning(__tr2qs_ctx("Popupmenu object required","objects")); + return true; + } + QAction *pAction; + if(iIdx) + { + QAction *pActionBefore=actionsDict[iIdx]; + pAction=((QMenu *)widget())->insertMenu(pActionBefore,(QMenu*)pObject->object()); + } else { + pAction=((QMenu *)widget())->addMenu((QMenu*)pObject->object()); + } + int identifier=addActionToDict(pAction); + c->returnValue()->setInteger((kvs_int_t)identifier); + identifier++; + return true; } KVSO_CLASS_FUNCTION(popupMenu,removeItem) { CHECK_INTERNAL_POINTER(widget()) - kvs_int_t iIdx; + kvs_int_t iIdx; KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("item_id",KVS_PT_INTEGER,0,iIdx) + KVSO_PARAMETER("item_id",KVS_PT_INTEGER,0,iIdx) KVSO_PARAMETERS_END(c) - QAction * pAction=getAction(iIdx); - if(pAction) + QAction * pAction=getAction(iIdx); + if(pAction) { - ((QMenu *)widget())->removeAction(pAction); - removeAction(iIdx); + ((QMenu *)widget())->removeAction(pAction); + removeAction(iIdx); } return true; } @@ -353,8 +356,9 @@ KVSO_CLASS_FUNCTION(popupMenu,insertSeparator) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIndex) KVSO_PARAMETERS_END(c) - QAction * pAction=getAction(iIndex); - if(pAction)((QMenu *)widget())->insertSeparator(pAction); + QAction * pAction=getAction(iIndex); + if(pAction) + ((QMenu *)widget())->insertSeparator(pAction); return true; } @@ -365,8 +369,8 @@ void KvsObject_popupMenu::slothighlighted(int i) } void KvsObject_popupMenu::aboutToDie(QObject *pObject) { - qDebug("Removing popup from kvs dict"); - removeMenuAllActions((QMenu *)pObject); + qDebug("Removing popup from kvs dict"); + removeMenuAllActions((QMenu *)pObject); } KVSO_CLASS_FUNCTION(popupMenu,highlightedEvent) { @@ -379,10 +383,10 @@ void KvsObject_popupMenu::slottriggered(QAction *a) QHashIterator<int, QAction *> i(actionsDict); while (i.hasNext()) { - i.next(); - if (i.value()== a) break; - } - KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i.key())); + i.next(); + if (i.value()== a) break; + } + KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i.key())); callFunction(this,"activatedEvent",¶ms); } diff --git a/src/modules/objects/KvsObject_popupMenu.h b/src/modules/objects/KvsObject_popupMenu.h index 95e1a023a..af6c9336c 100644 --- a/src/modules/objects/KvsObject_popupMenu.h +++ b/src/modules/objects/KvsObject_popupMenu.h @@ -46,7 +46,7 @@ protected: bool insertItem(KviKvsObjectFunctionCall *c); bool setTitle(KviKvsObjectFunctionCall *c); - bool addMenu(KviKvsObjectFunctionCall *c); + bool addMenu(KviKvsObjectFunctionCall *c); bool exec(KviKvsObjectFunctionCall *c); bool removeItem(KviKvsObjectFunctionCall *c); bool removeItemAt(KviKvsObjectFunctionCall *c); @@ -57,7 +57,7 @@ protected: protected slots: void slottriggered(QAction *); void slothighlighted(int); - void aboutToDie(QObject *); + void aboutToDie(QObject *); }; #endif // !_CLASS_POPUPMENU_H_ diff --git a/src/modules/objects/KvsObject_socket.cpp b/src/modules/objects/KvsObject_socket.cpp index ac93d2c8c..03f991895 100644 --- a/src/modules/objects/KvsObject_socket.cpp +++ b/src/modules/objects/KvsObject_socket.cpp @@ -52,11 +52,11 @@ #include <QTcpServer> const char * const sockstate_tbl[] = { - "Unconnected", - "HostLookUp", - "Connecting", - "Connected", - "Bound", + "Unconnected", + "HostLookUp", + "Connecting", + "Connected", + "Bound", "Listening", "Closing" }; @@ -324,9 +324,11 @@ KVSO_BEGIN_CONSTRUCTOR(KvsObject_socket,KviKvsObject) KVSO_END_CONSTRUCTOR(KvsObject_socket) KVSO_BEGIN_DESTRUCTOR(KvsObject_socket) - if (m_pSocket)delete m_pSocket; + if (m_pSocket) + delete m_pSocket; m_pSocket = 0; - if (m_pServer) delete m_pServer; + if (m_pServer) + delete m_pServer; m_pServer = 0; KVSO_END_DESTRUCTOR(KvsObject_socket) //---------------------- @@ -334,7 +336,6 @@ KVSO_END_DESTRUCTOR(KvsObject_socket) KVSO_CLASS_FUNCTION(socket,status) { - c->returnValue()->setString(getStateString(m_pSocket->state())); return true; } @@ -363,18 +364,19 @@ KVSO_CLASS_FUNCTION(socket,localPort) c->returnValue()->setInteger(m_pSocket->localPort()); return true; } + KVSO_CLASS_FUNCTION(socket,bytesAvailable) { c->returnValue()->setInteger(m_pSocket->bytesAvailable()); return true; } + KVSO_CLASS_FUNCTION(socket,localIp) { c->returnValue()->setString(m_pSocket->localAddress().toString()); return true; } - KVSO_CLASS_FUNCTION(socket,read) { kvs_int_t iLen; @@ -399,9 +401,7 @@ KVSO_CLASS_FUNCTION(socket,read) int oldsize=pBuffer->size(); pBuffer->resize(oldsize+iLen); m_pSocket->read(pBuffer->data()+oldsize,iLen); - } - else if(pObject->inheritsClass("file")) - { + } else if(pObject->inheritsClass("file")) { KviFile *pFile=((KvsObject_file *)pObject)->file(); if (!pFile->isOpen()) { @@ -409,9 +409,7 @@ KVSO_CLASS_FUNCTION(socket,read) return true; } pFile->write(m_pSocket->read(iLen)); - } - else - { + } else { c->warning(__tr2qs_ctx("Buffer parameter is not a memorybuffer object","objects")); return true; } @@ -433,8 +431,6 @@ KVSO_CLASS_FUNCTION(socket,read) return true; } - - KVSO_CLASS_FUNCTION(socket,write) { kvs_uint_t uLen; @@ -458,9 +454,7 @@ KVSO_CLASS_FUNCTION(socket,write) { QByteArray *p=((KvsObject_memoryBuffer *)pObject)->pBuffer(); m_pSocket->write(*p); - } - else if(pObject->inheritsClass("file")) - { + } else if(pObject->inheritsClass("file")) { KviFile * pFile = ((KvsObject_file *)pObject)->file(); if(!pFile->isOpen()) { @@ -559,6 +553,7 @@ KVSO_CLASS_FUNCTION(socket,functionConnect) c->returnValue()->setBoolean(true); return true; } + /* KVSO_CLASS_FUNCTION(socket,functionsetReadBufferSize) { @@ -657,6 +652,7 @@ void KvsObject_socket::slotReadyRead() lParams.append(new KviKvsVariant((kvs_int_t)m_pSocket->bytesAvailable())); callFunction(this,"dataAvailableEvent",&lParams); } + void KvsObject_socket::slotConnected() { KviKvsVariantList *lParams=0; @@ -704,7 +700,8 @@ void KvsObject_socket::slotNewConnection() bool ret=false; KviKvsVariant *retv=new KviKvsVariant(ret); callFunction(this,"incomingConnectionEvent",retv,¶ms); - if (retv){ + if (retv) + { pObject=KviKvsKernel::instance()->objectController()->lookupObject(hobj); if (pObject) pObject->dieNow(); } @@ -753,7 +750,3 @@ KVSO_CLASS_FUNCTION(socket,stateChangedEvent) #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_KvsObject_socket.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - - - - diff --git a/src/modules/objects/KvsObject_socket.h b/src/modules/objects/KvsObject_socket.h index 0cc3d95d0..f1b740014 100644 --- a/src/modules/objects/KvsObject_socket.h +++ b/src/modules/objects/KvsObject_socket.h @@ -36,51 +36,51 @@ class KvsObject_socket : public KviKvsObject public: KVSO_DECLARE_OBJECT(KvsObject_socket) protected: - QAbstractSocket *m_pSocket; - QTcpServer *m_pServer; - KviKvsRunTimeContext *m_pContext; + QAbstractSocket *m_pSocket; + QTcpServer *m_pServer; + KviKvsRunTimeContext *m_pContext; protected: - virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); + virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); const char * getStateString(QAbstractSocket::SocketState); - void setInternalSocket(QAbstractSocket *pSocket) - { - delete m_pSocket; - m_pSocket=pSocket; - } + void setInternalSocket(QAbstractSocket *pSocket) + { + delete m_pSocket; + m_pSocket=pSocket; + } bool status(KviKvsObjectFunctionCall *c); - bool remotePort(KviKvsObjectFunctionCall *c); + bool remotePort(KviKvsObjectFunctionCall *c); bool remoteIp(KviKvsObjectFunctionCall *c); bool localPort(KviKvsObjectFunctionCall *c); bool localIp(KviKvsObjectFunctionCall *c); - bool functionConnect(KviKvsObjectFunctionCall *c); + bool functionConnect(KviKvsObjectFunctionCall *c); bool close(KviKvsObjectFunctionCall *c); bool read(KviKvsObjectFunctionCall *c); bool write(KviKvsObjectFunctionCall *c); bool bytesAvailable(KviKvsObjectFunctionCall *c); - bool setProtocol(KviKvsObjectFunctionCall *c); + bool setProtocol(KviKvsObjectFunctionCall *c); //bool setReadBufferSize(KviKvsObjectFunctionCall *c); bool listen(KviKvsObjectFunctionCall *c); - bool dataAvailableEvent(KviKvsObjectFunctionCall *c); - bool incomingConnectionEvent(KviKvsObjectFunctionCall *c); - bool connectedEvent(KviKvsObjectFunctionCall *c); - bool disconnectedEvent(KviKvsObjectFunctionCall *c); - bool errorEvent(KviKvsObjectFunctionCall *c); - bool hostFoundEvent(KviKvsObjectFunctionCall *c); - bool stateChangedEvent(KviKvsObjectFunctionCall *c); + bool dataAvailableEvent(KviKvsObjectFunctionCall *c); + bool incomingConnectionEvent(KviKvsObjectFunctionCall *c); + bool connectedEvent(KviKvsObjectFunctionCall *c); + bool disconnectedEvent(KviKvsObjectFunctionCall *c); + bool errorEvent(KviKvsObjectFunctionCall *c); + bool hostFoundEvent(KviKvsObjectFunctionCall *c); + bool stateChangedEvent(KviKvsObjectFunctionCall *c); - void makeConnections(); + void makeConnections(); protected slots: - void slotReadyRead(); + void slotReadyRead(); void slotNewConnection(); - void slotConnected(); - void slotDisconnected(); - void slotError( QAbstractSocket::SocketError socketError ); - void slotHostFound(); + void slotConnected(); + void slotDisconnected(); + void slotError( QAbstractSocket::SocketError socketError ); + void slotHostFound(); void slotStateChanged( QAbstractSocket::SocketState socketState ); }; #endif //_CLASS_SOCKET_H_ diff --git a/src/modules/objects/KvsObject_treeWidget.cpp b/src/modules/objects/KvsObject_treeWidget.cpp index c12649bfb..8bc3e5bb7 100644 --- a/src/modules/objects/KvsObject_treeWidget.cpp +++ b/src/modules/objects/KvsObject_treeWidget.cpp @@ -138,7 +138,7 @@ In its arument the currrent item.[br] The default implementation emits the [classfnc]$spacePressed[/classfnc]() signal. - !fn: $onItemEvent(<item:object) + !fn: $onItemEvent(<item:object>) This event is called by framwork when the user moves the mouse cursor onto item. The default implementation emits the [classfnc]$onItem[/classfnc]() signal. diff --git a/src/modules/objects/KvsObject_webView.cpp b/src/modules/objects/KvsObject_webView.cpp index f164835f0..6c372e838 100644 --- a/src/modules/objects/KvsObject_webView.cpp +++ b/src/modules/objects/KvsObject_webView.cpp @@ -131,7 +131,7 @@ const QWebSettings::WebAttribute webattributes_cod[] = { @keyterms: An embedded webview widget, @title: - + webview @type: class @short: @@ -140,10 +140,142 @@ const QWebSettings::WebAttribute webattributes_cod[] = { [class]object[/class] [class]widget[/class] @description: - + Provides an embedded web browser using webkit. @functions: - !fn: $load() + !fn: $load(<url:string>) + Sets the current url for the webView and starts loading it + + !fn: array $frames() + Returns an array containing the names of the document frames. + + !fn: $firstChild() + Sets the first child of the current element as the new current element. + Returns true if the current element has been changed. + + !fn: $findAll(<query:string>) + Searches for all the elements named <query> and stores them in a collection + + !fn: $findFirst(<query:string>) + Searches for the first element named <query>; returns true if an element have been found, false if not. + + !fn: $parentElement() + Sets the parent of the current element as the new current element. + Returns true if the current element has been changed. + + !fn: $nextSibling() + Sets the element just after the current one as the new current element. + Returns true if the current element has been changed. + + !fn: $currentElementTagName() + Returns the tag name of the current element + + !fn: $moveToQueryResultsAt(<index:int>) + Changes the current element to the <index>th element of the collection + + !fn: int $queryResultsCount() + Returns the number of elements in the collection + + !fn: $getDocumentElement([frame_name:string]) + Sets the document element of the frame [frame_name] as the current element. + If no value has been specified for [frame_name] or [frame_name] is empty, the main frame of the page will be used. + + !fn: string $attributeNames() + Returns a comma-separated list of the attribute names set on the current element + + !fn: string $attribute(<name:string>) + Returns the value of the attribute <name> for the current element. + + !fn: pixmap $makePreview() + Returns a 212x142 thumbnail of the current webView contants. + The returned object is an instance of the pixmap class. + + !fn: string $rememberCurrent() + Returns the id of the current web element and stores it in a cache + + !fn: $moveTo(<id:string>) + Changes the current element to <id> + + !fn: string $toPlainText() + Returns the string representation of the current element + + !fn: $setAttribute(<name:string>,<value:string>) + Sets the attribute <name> with value <value> to the current element + + !fn: $setWebSetting(<name:string>,<value:bool>) + Enables or disables the <name> setting depending on <value>. + Valid settings name: JavascriptEnabled, PluginsEnabled, JavascriptCanOpenWindows, JavascriptCanAccessClipboard, ZoomTextOnly, LocalContentCanAccessFileUrls. + + !fn: $removeFromDocument() + Removes the current element from the document. The parent element is set as the new current element. + + !fn: $removeClass(<class_name:string>) + Removes a class from the current element + + !fn: string $classes() + Returns a comma-separated list of classes set on the current element + + !fn: $setLinkDelegationPolicy(<policy:string>) + Sets the link delegation policy: what happens when the users click on a link. Valid values: + [br] DontDelegateLinks: No links are delegated. Instead, webView tries to handle them all. + [br] DelegateExternalLinks: When activating links that point to documents not stored on the local filesystem or an equivalent then $linkClickedEvent() is executed. + [br] DelegateAllLinks: Whenever a link is activated the $linkClickedEvent() is executed. + + !fn: $linkClickedEvent() + This function can be called when the user clicks on a link, depending no the current link delegation policy. + The argument of the function is the url that has been clicked.[br] + The default implementation emits the [classfnc:webview]$linkClicked[/classfnc]() signal. + + !fn: $loadStartedEvent() + This function is called when the load of the page has started. + The default implementation emits the [classfnc:webview]$loadStarted[/classfnc]() signal. + + !fn: $loadProgressEvent() + This function can be called during the page load progress. + The argument of the function is an int value that represent the loading progress status, ranging from 0 to 100.[br] + The default implementation emits the [classfnc:webview]$loadProgress[/classfnc]() signal. + + !fn: $loadFinishedEvent() + This function is called when the load of the page has finished. + The argument of the function is a bool value that is true if the page has been loaded successfully, false otherwise.[br] + The default implementation emits the [classfnc:webview]$loadFinished[/classfnc]() signal. + + !fn: $downloadRequestEvent() + This function is called when the user tries to download a file. + The argument of the function is the url of the file.[br] + You should return a valid path in the filesystem where to save the file.[br] + The default implementation emits the [classfnc:webview]$downloadRequest[/classfnc]() signal. + + !fn: $downloadProgressEvent() + This function can be called during the download of a file. + Three integer arguments are passed to this function: the number of downloaded bytes, the download id, the size of the remove file (if known). + The default implementation emits the [classfnc:webview]$downloadProgress[/classfnc]() signal. + + !fn: $downloadCompletedEvent() + This function can be called when a file download finishes. + The argument of the function is the an integer value containing the download id. + The default implementation emits the [classfnc:webview]$downloadCompleted[/classfnc]() signal. + + @signals: + !sg: linkClicked() + This signal is emitted by the default implementation of [classfnc:webview]linkClickedEvent[/classfnc](). + + !sg: loadStarted() + This signal is emitted by the default implementation of [classfnc:webview]loadStartedEvent[/classfnc](). + + !sg: loadProgress() + This signal is emitted by the default implementation of [classfnc:webview]loadProgressEvent[/classfnc](). + + !sg: loadFinished() + This signal is emitted by the default implementation of [classfnc:webview]loadFinishedEvent[/classfnc](). + + !sg: downloadRequest() + This signal is emitted by the default implementation of [classfnc:webview]downloadRequestEvent[/classfnc](). + + !sg: downloadProgress() + This signal is emitted by the default implementation of [classfnc:webview]downloadProgressEvent[/classfnc](). + !sg: downloadCompleted() + This signal is emitted by the default implementation of [classfnc:webview]downloadCompletedEvent[/classfnc](). */ @@ -240,7 +372,7 @@ KVSO_CLASS_FUNCTION(webView,setLinkDelegationPolicy) else if(KviQString::equalCI(szPolicy,"DelegateAllLinks")) policy=QWebPage::DelegateAllLinks; else - c->warning(__tr2qs_ctx("Unknown delegation policy '%Q'- Switch do default dontDeleGateLinks","objects"),&szPolicy); + c->warning(__tr2qs_ctx("Unknown delegation policy '%Q'- Switch do default dontDelegateLinks","objects"),&szPolicy); ((QWebView *)widget())->page()->setLinkDelegationPolicy(policy); return true; } @@ -250,7 +382,7 @@ KVSO_CLASS_FUNCTION(webView,load) CHECK_INTERNAL_POINTER(widget()) QString szUrl; KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("text",KVS_PT_STRING,0,szUrl) + KVSO_PARAMETER("url",KVS_PT_STRING,0,szUrl) KVSO_PARAMETERS_END(c) ((QWebView *)widget())->load(QUrl(szUrl)); return true; diff --git a/src/modules/objects/KvsObject_widget.cpp b/src/modules/objects/KvsObject_widget.cpp index 2a2cfe588..c18150b85 100644 --- a/src/modules/objects/KvsObject_widget.cpp +++ b/src/modules/objects/KvsObject_widget.cpp @@ -593,32 +593,32 @@ const char * const widgettypes_tbl[] = { // if possible, leave the things go after just a c->warning() // - // widget() will be never 0 in THIS class - // but in derived classes WILL be - // ... now that I think about it, it - // may happen that widget() will be zero here too: - // If the Qt "physical" widget gets destroyed - // by some external factor (for example when children - // of a wrapper widget destroyed by KVIrc). - // - // as a convention: - // if widget() can be 0 in a class - // the user must have a function to check it - // (sth as object::$hasObject() could do the trick) - // obviously this will happen only in well defined cases - // as in a qtwrapper not yet wrapped or failed to wrap (so - // qtwrapper::$wrap() returned '0' for example) - // or after the widget has been destroyed... - // if widget() is 0, the functions perform no actions - // return no errors and results that have to be assumed - // as invalid (this allows the minimum overhead: if widget() +// widget() will be never 0 in THIS class +// but in derived classes WILL be +// ... now that I think about it, it +// may happen that widget() will be zero here too: +// If the Qt "physical" widget gets destroyed +// by some external factor (for example when children +// of a wrapper widget destroyed by KVIrc). +// +// as a convention: +// if widget() can be 0 in a class +// the user must have a function to check it +// (sth as object::$hasObject() could do the trick) +// obviously this will happen only in well defined cases +// as in a qtwrapper not yet wrapped or failed to wrap (so +// qtwrapper::$wrap() returned '0' for example) +// or after the widget has been destroyed... +// if widget() is 0, the functions perform no actions +// return no errors and results that have to be assumed +// as invalid (this allows the minimum overhead: if widget() //============================================================================================================= KVSO_BEGIN_REGISTERCLASS(KvsObject_widget,"widget","object") - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,setParent) + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,setParent) // apparence KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,show) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,hide) @@ -684,7 +684,7 @@ KVSO_BEGIN_REGISTERCLASS(KvsObject_widget,"widget","object") KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,colorPalette) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,setStyleSheet) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,setKeyShortcut) -KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,grab) + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,grab) // statusbar KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,insertIntoStatusBar) KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_widget,removeFromStatusBar) @@ -714,21 +714,14 @@ KVSO_END_REGISTERCLASS(KvsObject_widget) KVSO_BEGIN_CONSTRUCTOR(KvsObject_widget,KviKvsObject) KVSO_END_CONSTRUCTOR(KvsObject_widget) + KVSO_BEGIN_DESTRUCTOR(KvsObject_widget) -emit aboutToDie(); + emit aboutToDie(); KVSO_END_CONSTRUCTOR(KvsObject_widget) bool KvsObject_widget::init(KviKvsRunTimeContext *c,KviKvsVariantList *) { setObject(new KviKvsWidget(this,parentScriptWidget())); - //qDebug("abc"); - /*QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(widget()); - effect->setColor(QColor(0, 0, 0, 255)); - effect->setBlurRadius(20); - widget()->setGraphicsEffect(effect); - if (!widget()->graphicsEffect()) qDebug("non settato"); - else qDebug("settato"); - */ m_pContext=c; widget()->setObjectName(getName()); return true; @@ -996,14 +989,15 @@ bool KvsObject_widget::eventFilter(QObject *o,QEvent *e) return ret; } } - /*if(o->parent()) + /* + if(o->parent()) { - qDebug("Propagation to parent"); - return KviKvsObject::eventFilter(o->parent(),e); - } - else{ - qDebug("Propagation to object");*/ - return KviKvsObject::eventFilter(o,e); + qDebug("Propagation to parent"); + return KviKvsObject::eventFilter(o->parent(),e); + } else { + qDebug("Propagation to object"); + */ + return KviKvsObject::eventFilter(o,e); // } } @@ -1026,9 +1020,10 @@ KVSO_CLASS_FUNCTION(widget,update) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - if (iW || iH) widget()->update(QRect(iX,iY,iW,iH)); + if (iW || iH) + widget()->update(QRect(iX,iY,iW,iH)); else - widget()->update(); + widget()->update(); return true; } diff --git a/src/modules/objects/KvsObject_widget.h b/src/modules/objects/KvsObject_widget.h index 200492e85..3b8b88df1 100644 --- a/src/modules/objects/KvsObject_widget.h +++ b/src/modules/objects/KvsObject_widget.h @@ -92,7 +92,7 @@ protected: bool repaint(KviKvsObjectFunctionCall *c); bool insertIntoStatusBar(KviKvsObjectFunctionCall *c); bool removeFromStatusBar(KviKvsObjectFunctionCall *c); - bool setParent(KviKvsObjectFunctionCall *c); + bool setParent(KviKvsObjectFunctionCall *c); bool resize(KviKvsObjectFunctionCall *c); bool screenResolution(KviKvsObjectFunctionCall * c); bool setAttribute(KviKvsObjectFunctionCall *c); @@ -110,7 +110,7 @@ protected: bool setMinimumHeight(KviKvsObjectFunctionCall *c); bool setMinimumWidth(KviKvsObjectFunctionCall *c); bool setMouseTracking(KviKvsObjectFunctionCall *c); - bool setForegroundColor(KviKvsObjectFunctionCall *c); + bool setForegroundColor(KviKvsObjectFunctionCall *c); bool setStyleSheet(KviKvsObjectFunctionCall *c); bool setToolTip(KviKvsObjectFunctionCall *); bool setWindowIcon(KviKvsObjectFunctionCall *c); @@ -139,8 +139,6 @@ class KviKvsWidget : public QWidget Q_PROPERTY(QSize sizeHint READ sizeHint) public: KviKvsWidget(KvsObject_widget * ob,QWidget * par); - - virtual ~KviKvsWidget(); protected: KvsObject_widget * m_pObject; diff --git a/src/modules/objects/KvsObject_window.cpp b/src/modules/objects/KvsObject_window.cpp index f3b741481..08439ccec 100644 --- a/src/modules/objects/KvsObject_window.cpp +++ b/src/modules/objects/KvsObject_window.cpp @@ -39,7 +39,6 @@ KviKvsScriptWindowWindow::KviKvsScriptWindowWindow(KviMainWindow * pParent,const { m_pCentralWidget = 0; m_pIcon = 0; - } KviKvsScriptWindowWindow::~KviKvsScriptWindowWindow() diff --git a/src/modules/objects/KvsObject_wizard.h b/src/modules/objects/KvsObject_wizard.h index a68705860..deb8dc67e 100644 --- a/src/modules/objects/KvsObject_wizard.h +++ b/src/modules/objects/KvsObject_wizard.h @@ -44,7 +44,7 @@ public: protected: virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); - bool addPage(KviKvsObjectFunctionCall *c); + bool addPage(KviKvsObjectFunctionCall *c); bool insertPage(KviKvsObjectFunctionCall *c); bool removePage(KviKvsObjectFunctionCall *c); bool setTitle(KviKvsObjectFunctionCall *c); @@ -62,8 +62,8 @@ protected: bool backClickedEvent(KviKvsObjectFunctionCall *c); }; -class KviKvsMdmWizard : public KviTalWizard +class KviKvsMdmWizard : public KviTalWizard { Q_OBJECT public: diff --git a/src/modules/objects/KvsObject_workspace.cpp b/src/modules/objects/KvsObject_workspace.cpp index 8b3858e42..af0f4c876 100644 --- a/src/modules/objects/KvsObject_workspace.cpp +++ b/src/modules/objects/KvsObject_workspace.cpp @@ -82,7 +82,7 @@ {[br] constructor[br] {[br] - $$->$setGeometry(%X,%Y,100,100)[br](KviKvsObjectFunctionCall *c + $$->$setGeometry(%X,%Y,100,100)[br](KviKvsObjectFunctionCall *c $$->%label=$new(label,$$)[br] $$->%label->$settext("Another class by N\&G")[br] $$->%label->$setautoresize(1)[br] @@ -167,162 +167,168 @@ */ KVSO_BEGIN_REGISTERCLASS(KvsObject_workspace,"workspace","widget") - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,addSubWindow); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,removeSubWindow); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activeWindow); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,scrollBarsEnabled); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,setscrollBarsEnabled); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,cascade); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,tile); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,closeActiveWindow); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,closeAllWindows); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activateNextWindow); - KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activatePrevWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,addSubWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,removeSubWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activeWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,scrollBarsEnabled); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,setscrollBarsEnabled); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,cascade); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,tile); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,closeActiveWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,closeAllWindows); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activateNextWindow); + KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_workspace,activatePrevWindow); KVSO_END_REGISTERCLASS(KvsObject_workspace) KVSO_BEGIN_CONSTRUCTOR(KvsObject_workspace,KvsObject_widget) -pWidgetDict=new QHash<kvs_hobject_t,QMdiSubWindow *>; + pWidgetDict=new QHash<kvs_hobject_t,QMdiSubWindow *>; KVSO_END_CONSTRUCTOR(KvsObject_workspace) KVSO_BEGIN_DESTRUCTOR(KvsObject_workspace) -if (pWidgetDict) -{ - pWidgetDict->clear(); - delete pWidgetDict; - pWidgetDict=0; -} + if (pWidgetDict) + { + pWidgetDict->clear(); + delete pWidgetDict; + pWidgetDict=0; + } KVSO_END_CONSTRUCTOR(KvsObject_workspace) bool KvsObject_workspace::init(KviKvsRunTimeContext *, KviKvsVariantList *) { - SET_OBJECT(QMdiArea); + SET_OBJECT(QMdiArea); return true; } KVSO_CLASS_FUNCTION(workspace,addSubWindow) { - CHECK_INTERNAL_POINTER(widget()) - KviKvsObject * pObject; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - CHECK_HOBJECT_IS_WIDGET(pObject) - QMdiSubWindow *pMdi=((QMdiArea *)object())->addSubWindow(((QWidget *)(pObject->object()))); - pWidgetDict->insert(hObject,pMdi); - ((QMdiArea *)object())->setActiveSubWindow(pMdi); - return true; + CHECK_INTERNAL_POINTER(widget()) + KviKvsObject * pObject; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETERS_END(c) + + pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + CHECK_HOBJECT_IS_WIDGET(pObject) + QMdiSubWindow *pMdi=((QMdiArea *)object())->addSubWindow(((QWidget *)(pObject->object()))); + pWidgetDict->insert(hObject,pMdi); + ((QMdiArea *)object())->setActiveSubWindow(pMdi); + return true; } KVSO_CLASS_FUNCTION(workspace,removeSubWindow) { - CHECK_INTERNAL_POINTER(widget()) - KviKvsObject * pObject; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - CHECK_HOBJECT_IS_WIDGET(pObject) - QMdiSubWindow *pMdiSubWindow=pWidgetDict->value(hObject); - if(pMdiSubWindow) - { - ((QMdiArea *)object())->removeSubWindow(pMdiSubWindow); - pWidgetDict->remove(hObject); - } - else c->warning(__tr2qs_ctx("The widget must be a subwindow of this workspace","objects")); - return true; + CHECK_INTERNAL_POINTER(widget()) + KviKvsObject * pObject; + kvs_hobject_t hObject; + KVSO_PARAMETERS_BEGIN(c) + KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) + KVSO_PARAMETERS_END(c) + + pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); + CHECK_HOBJECT_IS_WIDGET(pObject) + QMdiSubWindow *pMdiSubWindow=pWidgetDict->value(hObject); + if(pMdiSubWindow) + { + ((QMdiArea *)object())->removeSubWindow(pMdiSubWindow); + pWidgetDict->remove(hObject); + } else { + c->warning(__tr2qs_ctx("The widget must be a subwindow of this workspace","objects")); + } + return true; } KVSO_CLASS_FUNCTION(workspace,cascade) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->cascadeSubWindows(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->cascadeSubWindows(); + return true; } KVSO_CLASS_FUNCTION(workspace,tile) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->tileSubWindows(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->tileSubWindows(); + return true; } KVSO_CLASS_FUNCTION(workspace,closeActiveWindow) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->closeActiveSubWindow(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->closeActiveSubWindow(); + return true; } KVSO_CLASS_FUNCTION(workspace,closeAllWindows) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->closeAllSubWindows(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->closeAllSubWindows(); + return true; } KVSO_CLASS_FUNCTION(workspace,activateNextWindow) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->activateNextSubWindow(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->activateNextSubWindow(); + return true; } KVSO_CLASS_FUNCTION(workspace,activatePrevWindow) { - CHECK_INTERNAL_POINTER(widget()) - ((QMdiArea *)widget())->activatePreviousSubWindow(); - return true; + CHECK_INTERNAL_POINTER(widget()) + ((QMdiArea *)widget())->activatePreviousSubWindow(); + return true; } KVSO_CLASS_FUNCTION(workspace,activeWindow) { - CHECK_INTERNAL_POINTER(widget()) - QMdiSubWindow *pActiveMdi=((QMdiArea *)widget())->activeSubWindow(); - if (pActiveMdi) - { - QHashIterator<kvs_hobject_t,QMdiSubWindow *> t(*pWidgetDict); - while (t.hasNext()) - { - t.next(); - kvs_hobject_t hObject=t.key(); - QMdiSubWindow *pMdi=t.value(); - if (pMdi==pActiveMdi) - { - c->returnValue()->setHObject(hObject); - break; - } - } - } - else c->returnValue()->setHObject((kvs_hobject_t)0); - return true; + CHECK_INTERNAL_POINTER(widget()) + QMdiSubWindow *pActiveMdi=((QMdiArea *)widget())->activeSubWindow(); + if (pActiveMdi) + { + QHashIterator<kvs_hobject_t,QMdiSubWindow *> t(*pWidgetDict); + while (t.hasNext()) + { + t.next(); + kvs_hobject_t hObject=t.key(); + QMdiSubWindow *pMdi=t.value(); + if (pMdi==pActiveMdi) + { + c->returnValue()->setHObject(hObject); + break; + } + } + } + else c->returnValue()->setHObject((kvs_hobject_t)0); + return true; } + KVSO_CLASS_FUNCTION(workspace,scrollBarsEnabled) { - CHECK_INTERNAL_POINTER(widget()) - bool bEnabled; - if(((QMdiArea *)widget())->verticalScrollBarPolicy()!=Qt::ScrollBarAlwaysOff) bEnabled=true; - else bEnabled=false; - c->returnValue()->setBoolean(bEnabled); + CHECK_INTERNAL_POINTER(widget()) + bool bEnabled; + if(((QMdiArea *)widget())->verticalScrollBarPolicy()!=Qt::ScrollBarAlwaysOff) + bEnabled=true; + else + bEnabled=false; + c->returnValue()->setBoolean(bEnabled); return true; } KVSO_CLASS_FUNCTION(workspace,setscrollBarsEnabled) { - CHECK_INTERNAL_POINTER(widget()) - bool bEnabled; + CHECK_INTERNAL_POINTER(widget()) + bool bEnabled; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - if(bEnabled) - { - ((QMdiArea *)widget())->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ((QMdiArea *)widget())->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - } - else - { - ((QMdiArea *)widget())->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ((QMdiArea *)widget())->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } - return true; + if(bEnabled) + { + ((QMdiArea *)widget())->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + ((QMdiArea *)widget())->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + } + else + { + ((QMdiArea *)widget())->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ((QMdiArea *)widget())->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } + return true; } diff --git a/src/modules/objects/KvsObject_workspace.h b/src/modules/objects/KvsObject_workspace.h index 16652955f..63b0cf837 100644 --- a/src/modules/objects/KvsObject_workspace.h +++ b/src/modules/objects/KvsObject_workspace.h @@ -35,23 +35,21 @@ public: public: QWidget * widget() { return (QWidget *)object(); }; protected: - QHash<kvs_hobject_t, QMdiSubWindow*> *pWidgetDict; + QHash<kvs_hobject_t, QMdiSubWindow*> *pWidgetDict; virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); - bool addSubWindow(KviKvsObjectFunctionCall *c); - bool removeSubWindow(KviKvsObjectFunctionCall *c); - bool cascade(KviKvsObjectFunctionCall *c); - bool tile(KviKvsObjectFunctionCall *c); - bool closeActiveWindow(KviKvsObjectFunctionCall *c); - bool closeAllWindows(KviKvsObjectFunctionCall *c); - bool activateNextWindow(KviKvsObjectFunctionCall *c); - bool activatePrevWindow(KviKvsObjectFunctionCall *c); - bool scrollBarsEnabled(KviKvsObjectFunctionCall *c); - bool setscrollBarsEnabled(KviKvsObjectFunctionCall *c); - - bool activeWindow(KviKvsObjectFunctionCall *c); - + bool addSubWindow(KviKvsObjectFunctionCall *c); + bool removeSubWindow(KviKvsObjectFunctionCall *c); + bool cascade(KviKvsObjectFunctionCall *c); + bool tile(KviKvsObjectFunctionCall *c); + bool closeActiveWindow(KviKvsObjectFunctionCall *c); + bool closeAllWindows(KviKvsObjectFunctionCall *c); + bool activateNextWindow(KviKvsObjectFunctionCall *c); + bool activatePrevWindow(KviKvsObjectFunctionCall *c); + bool scrollBarsEnabled(KviKvsObjectFunctionCall *c); + bool setscrollBarsEnabled(KviKvsObjectFunctionCall *c); + bool activeWindow(KviKvsObjectFunctionCall *c); }; #endif //!_CLASS_WORKSPACE_H_ diff --git a/src/modules/objects/KvsObject_wrapper.cpp b/src/modules/objects/KvsObject_wrapper.cpp index fa6b2ea75..d3c069ae0 100644 --- a/src/modules/objects/KvsObject_wrapper.cpp +++ b/src/modules/objects/KvsObject_wrapper.cpp @@ -37,66 +37,66 @@ /* - @doc: wrapper - @keyterms: - wrapper object class, - @title: - wrapper class - @type: - class - @short: - Provides a wrapper class that hooks to an existing Qt graphic object modifying it. - @inherits: - [class]object[/class] - [class]widget[/class] - @description: - This is a class for advanced KVIrc scripting.[br] - It can wrap any existing KVIrc widget.[br] - This class allows some unbelievable changes to the whole graphic environment of the kvirc,[br] - in fact, could hook every widget, you can modify the property or you can be inserted other widget as child of this...[br] - in short you have absolute liberty. [br] - The power of this class is fantastic, because it allows the change at "run time" of almost all the elements of the Kvirc.[br] - But to use this class in optimal way and to exploit its power, you have to know the Qt.... so you won't have limits [br] - The KVIrc Qt widgets are arranged in trees (just as the objects).[br] - The difference is that there are more toplevel widgets (and so more than one tree).[br] - You can use [fnc]$objects.dump()[/fnc] to take a look at the KVIrc Qt objects tree.[br] - Here is a part of the tree:[br][br] - Ptr 14332520: top level object: kvirc_frame, class KviMainWindow, visible, rect = -4, -4, 1024, 708 - Ptr 17296024: object: qt_top_dock, class QDockArea - Ptr 14882136: object: qt_custom_toolbar, class KviCustomToolBar - Ptr 18143368: object: qt_dockwidget_internal, class QDockWindowTitleBar - [br][br] - Every listed widget has a "name", a "class" and a set of properties.[br] - The first entry in this example is a KVIrc server window, class "KviMainWindow" and name "kvirc_frame": - it is a toplevel widget.[br] - The "qt_top_dock", "qt_custom_toolbar" and the "qt_dockwidget_internal" are - direct children of that widget.[br] - To indicate a specific widget we will use the "class::name" form.[br] - So to indicate the main KVIrc frame you will use "KviMainWindow::kvirc_main_frame". - Look at this example:[br] - %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,KviStatusBar::unnamed)[br] - %A->$setBackGroundColor(FFFFFF)[br] - For first thing we create an object type wrapper,then we flow the tree that there from the command /object.dump and we will have:[br] - . [br] - . [br] - Ptr 14196288: top level object: kvirc_frame, class KviMainWindow, visible, rect = -4, -4, 1024, 712 [br] + @doc: wrapper + @keyterms: + wrapper object class, + @title: + wrapper class + @type: + class + @short: + Provides a wrapper class that hooks to an existing Qt graphic object modifying it. + @inherits: + [class]object[/class] + [class]widget[/class] + @description: + This is a class for advanced KVIrc scripting.[br] + It can wrap any existing KVIrc widget.[br] + This class allows some unbelievable changes to the whole graphic environment of the kvirc,[br] + in fact, could hook every widget, you can modify the property or you can be inserted other widget as child of this...[br] + in short you have absolute liberty. [br] + The power of this class is fantastic, because it allows the change at "run time" of almost all the elements of the Kvirc.[br] + But to use this class in optimal way and to exploit its power, you have to know the Qt.... so you won't have limits [br] + The KVIrc Qt widgets are arranged in trees (just as the objects).[br] + The difference is that there are more toplevel widgets (and so more than one tree).[br] + You can use [fnc]$objects.dump()[/fnc] to take a look at the KVIrc Qt objects tree.[br] + Here is a part of the tree:[br][br] + Ptr 14332520: top level object: kvirc_frame, class KviMainWindow, visible, rect = -4, -4, 1024, 708 + Ptr 17296024: object: qt_top_dock, class QDockArea + Ptr 14882136: object: qt_custom_toolbar, class KviCustomToolBar + Ptr 18143368: object: qt_dockwidget_internal, class QDockWindowTitleBar + [br][br] + Every listed widget has a "name", a "class" and a set of properties.[br] + The first entry in this example is a KVIrc server window, class "KviMainWindow" and name "kvirc_frame": + it is a toplevel widget.[br] + The "qt_top_dock", "qt_custom_toolbar" and the "qt_dockwidget_internal" are + direct children of that widget.[br] + To indicate a specific widget we will use the "class::name" form.[br] + So to indicate the main KVIrc frame you will use "KviMainWindow::kvirc_main_frame". + Look at this example:[br] + %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,KviStatusBar::unnamed)[br] + %A->$setBackGroundColor(FFFFFF)[br] + For first thing we create an object type wrapper,then we flow the tree that there from the command /object.dump and we will have:[br] + . [br] + . [br] + Ptr 14196288: top level object: kvirc_frame, class KviMainWindow, visible, rect = -4, -4, 1024, 712 [br] . [br] - Ptr 17197360: object: unnamed, class KviStatusBar [br] - . [br] - . [br] - in this way we can follow the order, father->child from the top-level widget(KviMainWindow::kvirc_frame)[br] - to reach the child that interests us (KviStatusBar::unnamed)[br] - Then, following the syntax we will have: - %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,KviStatusBar::unnamed) - Now %A. will be point to the wrapped object, therefore we could modify its property or to consider it as if it were an object created by us in scripting. [br] - Obviously, deleting the created object (for example %A) you don't will delete the object of Kvirc (in this case the statusbar). [br] - Another example could be this:[br] - %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,QToolButton::kvirc.identityoptions)[br] - %A->$setProperty(usesBigPixmap,0)[br] - In this fool example with the function $setProperty, we has setted the property usesBigPixmap to False, making to become the small icons of the ToolBar.[br] - [br] - The wrapping object search can optionally start with a window - identifier with the following syntax: WinId::<window_id>. + Ptr 17197360: object: unnamed, class KviStatusBar [br] + . [br] + . [br] + in this way we can follow the order, father->child from the top-level widget(KviMainWindow::kvirc_frame)[br] + to reach the child that interests us (KviStatusBar::unnamed)[br] + Then, following the syntax we will have: + %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,KviStatusBar::unnamed) + Now %A. will be point to the wrapped object, therefore we could modify its property or to consider it as if it were an object created by us in scripting. [br] + Obviously, deleting the created object (for example %A) you don't will delete the object of Kvirc (in this case the statusbar). [br] + Another example could be this:[br] + %A=$new(wrapper,0,test,KviMainWindow::kvirc_frame,QToolButton::kvirc.identityoptions)[br] + %A->$setProperty(usesBigPixmap,0)[br] + In this fool example with the function $setProperty, we has setted the property usesBigPixmap to False, making to become the small icons of the ToolBar.[br] + [br] + The wrapping object search can optionally start with a window + identifier with the following syntax: WinId::<window_id>. */ @@ -128,46 +128,38 @@ bool KvsObject_wrapper::init(KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams->at(i)->asString(s); if (!s.isEmpty()) { - int idx = s.indexOf("::"); - if( idx != -1 ) - { - szClass = s.left(idx); - szName = s.right(s.length() - idx - 2); - } - else - { - szClass = s; - szName = ""; - } - if(KviQString::equalCI(szClass,"WinId")) - { - if(pWidget) - { - pContext->warning(__tr2qs_ctx("The window identifier preceded by WinId must be the first object in the search path","objects")); - return false; - } - else - { - pWidget = g_pApp->findWindow(szName); - } - } - else - { - if(pWidget) - { - pWidget = findWidgetToWrap(!szClass.isEmpty() ? szClass.toUtf8().data() : "", !szName.isEmpty() ? szName.toUtf8().data() : "", pWidget); - } - else - { - pWidget = findTopLevelWidgetToWrap(!szClass.isEmpty() ? szClass.toUtf8().data() : "", !szName.isEmpty() ? szName.toUtf8().data() : ""); - } - } - if( !pWidget ) - { - pContext->warning(__tr2qs_ctx("Failed to find one of the wrap path widgets ('%Q::%Q')","objects"),&szClass,&szName); - return false; - } - } + int idx = s.indexOf("::"); + if( idx != -1 ) + { + szClass = s.left(idx); + szName = s.right(s.length() - idx - 2); + } else { + szClass = s; + szName = ""; + } + if(KviQString::equalCI(szClass,"WinId")) + { + if(pWidget) + { + pContext->warning(__tr2qs_ctx("The window identifier preceded by WinId must be the first object in the search path","objects")); + return false; + } else { + pWidget = g_pApp->findWindow(szName); + } + } else { + if(pWidget) + { + pWidget = findWidgetToWrap(!szClass.isEmpty() ? szClass.toUtf8().data() : "", !szName.isEmpty() ? szName.toUtf8().data() : "", pWidget); + } else { + pWidget = findTopLevelWidgetToWrap(!szClass.isEmpty() ? szClass.toUtf8().data() : "", !szName.isEmpty() ? szName.toUtf8().data() : ""); + } + } + if( !pWidget ) + { + pContext->warning(__tr2qs_ctx("Failed to find one of the wrap path widgets ('%Q::%Q')","objects"),&szClass,&szName); + return false; + } + } i++; } if( !pWidget ) @@ -178,6 +170,7 @@ bool KvsObject_wrapper::init(KviKvsRunTimeContext * pContext,KviKvsVariantList * setObject(pWidget,false); return true; } + QWidget *KvsObject_wrapper::findTopLevelWidgetToWrap(const QString szClass, const QString szName) { QWidgetList list = g_pApp->topLevelWidgets(); @@ -216,6 +209,3 @@ QWidget *KvsObject_wrapper::findWidgetToWrap(const QString szClass, const QStrin } return 0; } - - - diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index c3ef16822..a306aef2f 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -622,12 +622,6 @@ static bool objects_kvs_cmd_disconnect(KviKvsModuleCommandCall * c) return true; } - - - -// ASSASSINS! YOU MUST INDENT IT WELL :D - - static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) { /* @@ -662,8 +656,9 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) KVSO_PARAMETERS_BEGIN(cmd) KVSO_PARAMETER("print on current window",KVS_PT_BOOL,0,bFlag) KVSO_PARAMETERS_END(cmd) - if (bFlag) cmd->window()->output(80, "Objects dump:"); - QWidgetList list = g_pApp->topLevelWidgets(); + if (bFlag) + cmd->window()->output(80, "Objects dump:"); + QWidgetList list = g_pApp->topLevelWidgets(); KviCString spacing = ">"; QString szTemp; |
