summaryrefslogtreecommitdiffstats
path: root/quanta/components/framewizard/visualframeeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/components/framewizard/visualframeeditor.cpp')
-rw-r--r--quanta/components/framewizard/visualframeeditor.cpp134
1 files changed, 67 insertions, 67 deletions
diff --git a/quanta/components/framewizard/visualframeeditor.cpp b/quanta/components/framewizard/visualframeeditor.cpp
index 3871ac61..db52da97 100644
--- a/quanta/components/framewizard/visualframeeditor.cpp
+++ b/quanta/components/framewizard/visualframeeditor.cpp
@@ -17,8 +17,8 @@
#include "visualframeeditor.h"
-#include <qobjectlist.h>
-#include <qsplitter.h>
+#include <tqobjectlist.h>
+#include <tqsplitter.h>
//#include <kdebug.h>
#include "qextfileinfo.h"
@@ -28,13 +28,13 @@ static int cancelledPixels(int n){
return (n-1)*6;
}
-QMap<QString, QValueList< int > > SIZES;
+TQMap<TQString, TQValueList< int > > SIZES;
static int splitterIdNumber = 0;
-VisualFrameEditor::VisualFrameEditor(QWidget * parent, const char * name) : QHBox(parent,name){
+VisualFrameEditor::VisualFrameEditor(TQWidget * parent, const char * name) : TQHBox(parent,name){
m_internalTree = new tree;
- m_internalTree->root()->atts()->setGeometry(QRect(0,0,510,422));
+ m_internalTree->root()->atts()->setGeometry(TQRect(0,0,510,422));
m_firstInsertedSA = 0L;
m_markupLanguage = HTML;
}
@@ -44,11 +44,11 @@ VisualFrameEditor::~VisualFrameEditor(){
delete m_firstInsertedSA;
}
-void VisualFrameEditor::setGeometries(const QString &l){
+void VisualFrameEditor::setGeometries(const TQString &l){
int cP = cancelledPixels(m_internalTree->findNode(l)->countChildren());
- QRect newGeometry(m_internalTree->findNode(l)->atts()->geometry());
- QPtrList<treeNode> list=m_internalTree->findNode(l)->childrenList();
- QPtrListIterator<treeNode> it( list );
+ TQRect newGeometry(m_internalTree->findNode(l)->atts()->geometry());
+ TQPtrList<treeNode> list=m_internalTree->findNode(l)->childrenList();
+ TQPtrListIterator<treeNode> it( list );
treeNode *node;
if(m_internalTree->findNode(l)->splitType() == VERTICAL){
int dummyDimension=m_internalTree->findNode(l)->atts()->geometry().width()-cP;
@@ -69,14 +69,14 @@ void VisualFrameEditor::setGeometries(const QString &l){
}
}
-void VisualFrameEditor::split(const QString &l, int n, SplitType type) {
+void VisualFrameEditor::split(const TQString &l, int n, SplitType type) {
if(l==m_internalTree->root()->label()){
m_internalTree->root()->setSplitType(type);
for(int i = 1; i<=n; i++) m_internalTree->addChildNode(l);
setGeometries(l);
}
else {
- QString parentLabel=m_internalTree->findNode(l)->parentLabel();
+ TQString parentLabel=m_internalTree->findNode(l)->parentLabel();
SplitType parentSplit=m_internalTree->findNode(parentLabel)->splitType();
if( parentSplit != type ) {
m_internalTree->findNode(l)->setSplitType(type);
@@ -91,7 +91,7 @@ void VisualFrameEditor::split(const QString &l, int n, SplitType type) {
}
}
-void VisualFrameEditor::loadExistingStructure(const QStringList &list){
+void VisualFrameEditor::loadExistingStructure(const TQStringList &list){
if(!list.isEmpty()) {
m_existingStructure = list;
m_existingStructure.remove("</frameset>");//closure tag not needed
@@ -99,8 +99,8 @@ void VisualFrameEditor::loadExistingStructure(const QStringList &list){
}
}
-QStringList VisualFrameEditor::convertAsterisks(const QString &s,int d){
- QStringList list=QStringList::split(",",s);
+TQStringList VisualFrameEditor::convertAsterisks(const TQString &s,int d){
+ TQStringList list=TQStringList::split(",",s);
int leftPercentage = 100;
int leftPercentageDistributedAmongAsterisks=0;
int weightAsteriskCounter=0;
@@ -108,7 +108,7 @@ QStringList VisualFrameEditor::convertAsterisks(const QString &s,int d){
// example cols="40%,5*,*"
// then every asterisk must be assigned a percentage of 10% so the real percentage
// notation is cols="40%,50%,10%"
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
if(!(*it).contains("%") && !(*it).contains("*")) leftPercentage -= ( (*it).toInt()*100 )/d;
if((*it).contains("%")) leftPercentage -= (*it).section("%",0,0).toInt();
if((*it).contains("*")) {
@@ -124,38 +124,38 @@ QStringList VisualFrameEditor::convertAsterisks(const QString &s,int d){
// NB: I valori delle percentuali generati da if .. else possono non corrispondere
// a quelli effettivamente generati dal metodo build che opera un'altra normalizzazione.
// In genere la differenza �dell' 1%
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
if((*it).contains("*")){
int weight= (*it).section("*",0,0).toInt();
if(weight==0) weight=1;
int newPercentage = weight*leftPercentageDistributedAmongAsterisks;
- (*it)=(QString::number(newPercentage,10)+"%");
+ (*it)=(TQString::number(newPercentage,10)+"%");
leftPercentage-=newPercentage;
}
}
return list;
}
-void VisualFrameEditor::buildInternalTree(const QString &parent){
- QString line = m_existingStructure.first();
+void VisualFrameEditor::buildInternalTree(const TQString &parent){
+ TQString line = m_existingStructure.first();
if(line.contains("<frameset")) {
if(line.contains("rows")) {
split(parent,(line.contains(",")+1),HORIZONTAL);
- QRegExp pattern("rows\\s*=\"([\\s\\d%,\\*]*)\"");
+ TQRegExp pattern("rows\\s*=\"([\\s\\d%,\\*]*)\"");
pattern.search(line);
- QRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
- QStringList percentages = convertAsterisks(pattern.cap(1),dummy.height());
+ TQRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ TQStringList percentages = convertAsterisks(pattern.cap(1),dummy.height());
int dummyDimension=dummy.height()-cancelledPixels(line.contains(",")+1);
- QPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
- QPtrListIterator<treeNode> it( list );
+ TQPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ TQPtrListIterator<treeNode> it( list );
treeNode *node;
while ( (node = it.current()) != 0 ) {
++it;
- QRect newGeometry(dummy);
+ TQRect newGeometry(dummy);
double newDimension;
if(percentages.first().contains("%"))
newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
@@ -168,20 +168,20 @@ void VisualFrameEditor::buildInternalTree(const QString &parent){
else
if(line.contains("cols")) {
split(parent,(line.contains(",")+1),VERTICAL);
- QRegExp pattern("cols\\s*=\"([\\s\\d%,\\*]*)\"");
+ TQRegExp pattern("cols\\s*=\"([\\s\\d%,\\*]*)\"");
pattern.search(line);
- QRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
- QStringList percentages = convertAsterisks(pattern.cap(1),dummy.width());
+ TQRect dummy=m_internalTree->findNode(parent)->atts()->geometry();
+ TQStringList percentages = convertAsterisks(pattern.cap(1),dummy.width());
int dummyDimension=dummy.width()-cancelledPixels(line.contains(",")+1);
- QPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
- QPtrListIterator<treeNode> it( list );
+ TQPtrList<treeNode> list=m_internalTree->findNode(parent)->childrenList();
+ TQPtrListIterator<treeNode> it( list );
treeNode *node;
while ( (node = it.current()) != 0 ) {
++it;
- QRect newGeometry(dummy);
+ TQRect newGeometry(dummy);
double newDimension;
if(percentages.first().contains("%"))
newDimension=(dummyDimension*(percentages.first().remove("%").toInt()))/100.0;
@@ -200,11 +200,11 @@ void VisualFrameEditor::buildInternalTree(const QString &parent){
}
}
else {
- QMap<QString,QString> attributeMap;
- if( line.contains( QRegExp("\\s+noresize") ) ) attributeMap["noresize"] = "noresize";
- else attributeMap["noresize"] = QString::null;
+ TQMap<TQString,TQString> attributeMap;
+ if( line.contains( TQRegExp("\\s+noresize") ) ) attributeMap["noresize"] = "noresize";
+ else attributeMap["noresize"] = TQString::null;
- QRegExp srcPattern("\\s+src\\s*=\\s*\"([%-\\w\\s\\./_\\+\\d]*)\""); //search for files
+ TQRegExp srcPattern("\\s+src\\s*=\\s*\"([%-\\w\\s\\./_\\+\\d]*)\""); //search for files
if(srcPattern.search(line) !=-1 ) {
KURL pathToConvert, basePath;
pathToConvert.setPath(srcPattern.cap(1));
@@ -213,12 +213,12 @@ void VisualFrameEditor::buildInternalTree(const QString &parent){
line.remove(srcPattern);//we don't need to operate on this anymore
}
- QRegExp pattern("\\s+(\\w+\\s*=\\s*\"[\\w\\s\\./_\\+\\d]*\")");
+ TQRegExp pattern("\\s+(\\w+\\s*=\\s*\"[\\w\\s\\./_\\+\\d]*\")");
int pos = 0;
while ( pos >= 0 ) {
pos = pattern.search( line, pos );
- attributeMap[ pattern.cap(1).section( QRegExp("=\\s*\"") ,0,0) ] = pattern.cap(1).section(QRegExp("=\\s*\""),1,1).remove("\"");
+ attributeMap[ pattern.cap(1).section( TQRegExp("=\\s*\"") ,0,0) ] = pattern.cap(1).section(TQRegExp("=\\s*\""),1,1).remove("\"");
if ( pos >= 0 ) pos += pattern.matchedLength();
}
m_internalTree->findNode(parent)->atts()->setAllAttributes(attributeMap);
@@ -226,14 +226,14 @@ void VisualFrameEditor::buildInternalTree(const QString &parent){
}
}
-void VisualFrameEditor::paintEvent ( QPaintEvent * ){
+void VisualFrameEditor::paintEvent ( TQPaintEvent * ){
hide();
delete m_firstInsertedSA;
m_firstInsertedSA = 0L;
- QObjectList* splitterList = queryList("QSplitter");
+ TQObjectList* splitterList = queryList("TQSplitter");
for (uint i = 0; i < splitterList->count(); i++) {
- QObject* o = splitterList->at(i);
+ TQObject* o = splitterList->at(i);
removeChild(o); //this will delete all childr of "o"
}
@@ -243,24 +243,24 @@ void VisualFrameEditor::paintEvent ( QPaintEvent * ){
show();
}
-void VisualFrameEditor::removeNode(const QString &l){
+void VisualFrameEditor::removeNode(const TQString &l){
if( l == m_internalTree->root()->label() ) m_internalTree->reset();//trying to remove root node is equivalent to reinitialize
else {
- QString parentLabel=m_internalTree->findNode(l)->parentLabel();
+ TQString parentLabel=m_internalTree->findNode(l)->parentLabel();
if(m_internalTree->findNode(parentLabel)->countChildren()>=3)
m_internalTree->removeChildNode(parentLabel,l,true);
else {
m_internalTree->removeChildNode(parentLabel,l,true);
if( !m_internalTree->findNode(parentLabel)->firstChild()->hasChildren() ){ //final nodes
- QMap<QString,QString> map = m_internalTree->findNode(parentLabel)->firstChild()->atts()->attributeMap();
+ TQMap<TQString,TQString> map = m_internalTree->findNode(parentLabel)->firstChild()->atts()->attributeMap();
m_internalTree->findNode(parentLabel)->removeChildren();
m_internalTree->findNode(parentLabel)->atts()->setAllAttributes( map ) ;
m_internalTree->findNode(parentLabel)->setSplitType(NONE);
}
else {
- QPtrList<treeNode> list = m_internalTree->findNode(parentLabel)->firstChild()->childrenList();
+ TQPtrList<treeNode> list = m_internalTree->findNode(parentLabel)->firstChild()->childrenList();
if( parentLabel != m_internalTree->root()->label() ) {
- QString grandParentLabel = m_internalTree->findNode(parentLabel)->parentLabel();
+ TQString grandParentLabel = m_internalTree->findNode(parentLabel)->parentLabel();
m_internalTree->removeChildNode( parentLabel,m_internalTree->findNode(parentLabel)->firstChild()->label(),false );
m_internalTree->removeChildNode( grandParentLabel ,parentLabel, true );
treeNode *node;
@@ -283,14 +283,14 @@ void VisualFrameEditor::removeNode(const QString &l){
}
}
-void VisualFrameEditor::drawGUI(treeNode *n, QWidget* parent){
+void VisualFrameEditor::drawGUI(treeNode *n, TQWidget* parent){
if(n->hasChildren()) {
- QString splitterName("splitter"+QString::number(++splitterIdNumber,10));
- QSplitter *splitter = new QSplitter(parent,splitterName);
+ TQString splitterName("splitter"+TQString::number(++splitterIdNumber,10));
+ TQSplitter *splitter = new TQSplitter(parent,splitterName);
if(SIZES.contains(splitterName)) splitter->setSizes( SIZES[splitterName] );
switch( n->splitType() ){
- case VERTICAL : splitter->setOrientation(QSplitter::Horizontal);break;
- case HORIZONTAL : splitter->setOrientation(QSplitter::Vertical);break;
+ case VERTICAL : splitter->setOrientation(TQSplitter::Horizontal);break;
+ case HORIZONTAL : splitter->setOrientation(TQSplitter::Vertical);break;
default:break;
}
n->firstChild();
@@ -301,19 +301,19 @@ void VisualFrameEditor::drawGUI(treeNode *n, QWidget* parent){
}
else {
SelectableArea *sa=new SelectableArea(parent,n->label());
- if(parent->isA("QSplitter")) dynamic_cast<QSplitter *>(parent)->setResizeMode(sa->view(),QSplitter::KeepSize );
+ if(parent->isA("TQSplitter")) dynamic_cast<TQSplitter *>(parent)->setResizeMode(sa->view(),TQSplitter::KeepSize );
else
if(!m_firstInsertedSA) m_firstInsertedSA = sa;
sa->view()->setGeometry(n->atts()->geometry());
sa->setIdLabel( n->label() );
sa->setSource( n->atts()->src() );
- connect(sa, SIGNAL(Resized(QRect)), m_internalTree->findNode(sa->idLabel())->atts(), SLOT(setGeometry(QRect)));
- connect(sa, SIGNAL(selected(const QString &)),this, SIGNAL(areaSelected(const QString &)));
+ connect(sa, TQT_SIGNAL(Resized(TQRect)), m_internalTree->findNode(sa->idLabel())->atts(), TQT_SLOT(setGeometry(TQRect)));
+ connect(sa, TQT_SIGNAL(selected(const TQString &)),this, TQT_SIGNAL(areaSelected(const TQString &)));
}
}
-QString VisualFrameEditor::createFrameTag(areaAttribute *a){
- QString Src(a->attributeValue("src")),
+TQString VisualFrameEditor::createFrameTag(areaAttribute *a){
+ TQString Src(a->attributeValue("src")),
Longdesc(a->attributeValue("longdesc")),
Name(a->attributeValue("name")),
Scrolling(a->attributeValue("scrolling")),
@@ -326,7 +326,7 @@ QString VisualFrameEditor::createFrameTag(areaAttribute *a){
Marginwidth(a->attributeValue("marginwidth")),
Marginheight(a->attributeValue("marginheight"));
- QString tagBegin="<frame",
+ TQString tagBegin="<frame",
tagEnd,
tagMiddle;
@@ -362,9 +362,9 @@ QString VisualFrameEditor::createFrameTag(areaAttribute *a){
return tagBegin+tagMiddle+tagEnd;
}
-QString VisualFrameEditor::RCvalue(treeNode *n) {
- QString s;
- QMap<int,int> dimMap;
+TQString VisualFrameEditor::RCvalue(treeNode *n) {
+ TQString s;
+ TQMap<int,int> dimMap;
double percentage = 100.0;
int remainingPercentage=100;
int child_number = n->countChildren();
@@ -390,14 +390,14 @@ QString VisualFrameEditor::RCvalue(treeNode *n) {
for(int i=1;i<=child_number-1;++i) {
remainingPercentage-=proxInt(dimMap[i]*percentage);
- s+=QString::number(proxInt(dimMap[i]*percentage),10);
+ s+=TQString::number(proxInt(dimMap[i]*percentage),10);
s+="%,";
}
- return s+=(QString::number(remainingPercentage,10)+"%");
+ return s+=(TQString::number(remainingPercentage,10)+"%");
}
-static QStringList nonFormattedStructure;
+static TQStringList nonFormattedStructure;
void VisualFrameEditor::createStructure(treeNode* n){
if(n==m_internalTree->root() && !n->hasChildren()) return;
@@ -417,10 +417,10 @@ void VisualFrameEditor::createStructure(treeNode* n){
else nonFormattedStructure.append(createFrameTag(n->atts()));
}
-QString VisualFrameEditor::formatStructure(){
- QString s;
+TQString VisualFrameEditor::formatStructure(){
+ TQString s;
int tabNum = 0;
- for ( QStringList::Iterator it = nonFormattedStructure.begin(); it != nonFormattedStructure.end(); ++it ) {
+ for ( TQStringList::Iterator it = nonFormattedStructure.begin(); it != nonFormattedStructure.end(); ++it ) {
if((*it).contains("<frameset")) tabNum++;
else
if((*it).contains("</frameset>")) {
@@ -434,13 +434,13 @@ QString VisualFrameEditor::formatStructure(){
return s;
}
-QString VisualFrameEditor::framesetStructure() {
+TQString VisualFrameEditor::framesetStructure() {
m_internalTree->refreshGeometries(m_internalTree->root());
createStructure(m_internalTree->root());
return formatStructure();
}
-void VisualFrameEditor::setMarkupLanguage(const QString& s){
+void VisualFrameEditor::setMarkupLanguage(const TQString& s){
if( s.contains("xhtml",false)!=0 ) m_markupLanguage = XHTML;
else
if( s.contains("html",false)!=0 ) m_markupLanguage = HTML;