Removed more QT3 stuff. Drag & Drop not 100% functional at the moment
1.1 --- a/branchobj.cpp Mon Nov 20 12:12:05 2006 +0000
1.2 +++ b/branchobj.cpp Thu Nov 23 13:53:08 2006 +0000
1.3 @@ -8,6 +8,19 @@
1.4 extern FlagRowObj *standardFlagsDefault;
1.5
1.6
1.7 +/* FIXME not needed any longer in QT4
1.8 +int BranchObjPointrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
1.9 +{
1.10 + // Make sure PtrList::find works
1.11 + if (i==j) return 0;
1.12 +
1.13 + if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
1.14 + return 1;
1.15 + else
1.16 + return -1;
1.17 +}
1.18 +*/
1.19 +
1.20 /////////////////////////////////////////////////////////////////
1.21 // BranchObj
1.22 /////////////////////////////////////////////////////////////////
1.23 @@ -72,22 +85,8 @@
1.24 return angle == other.angle;
1.25 }
1.26
1.27 -int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
1.28 -{
1.29 - // Make sure PtrList::find works
1.30 - if (i==j) return 0;
1.31 -
1.32 - if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
1.33 - return 1;
1.34 - else
1.35 - return -1;
1.36 -}
1.37 -
1.38 void BranchObj::init ()
1.39 {
1.40 - branch.setAutoDelete (false);
1.41 - xlink.setAutoDelete (false);
1.42 -
1.43 if (parObj)
1.44 {
1.45 absPos=getRandPos();
1.46 @@ -110,12 +109,11 @@
1.47 OrnamentedObj::copy(other);
1.48
1.49 branch.clear();
1.50 - BranchObj* b;
1.51 - for (b=other->branch.first(); b;b=other->branch.next() )
1.52 + for (int i=0; i<other->branch.size(); ++i)
1.53 // Make deep copy of b
1.54 // Because addBranch again calls copy for the childs,
1.55 // Those will get a deep copy, too
1.56 - addBranch(b);
1.57 + addBranch(other->branch.at(i) );
1.58
1.59 for (int i=0; i<other->floatimage.size(); ++i)
1.60 addFloatImage (other->floatimage.at(i));
1.61 @@ -134,15 +132,10 @@
1.62 delete floatimage.takeFirst();
1.63
1.64 while (!xlink.isEmpty())
1.65 - deleteXLink (xlink.first() );
1.66 + delete xlink.takeFirst();
1.67
1.68 - BranchObj *bo;
1.69 while (!branch.isEmpty())
1.70 - {
1.71 - bo=branch.first();
1.72 - branch.removeFirst();
1.73 - delete (bo);
1.74 - }
1.75 + delete branch.takeFirst();
1.76 }
1.77
1.78 int BranchObj::getNum()
1.79 @@ -155,12 +148,7 @@
1.80
1.81 int BranchObj::getNum(BranchObj *bo)
1.82 {
1.83 - // keep current pointer in branch,
1.84 - // otherwise saveToDir will fail
1.85 - int cur=branch.at();
1.86 - int ind=branch.findRef (bo);
1.87 - branch.at(cur);
1.88 - return ind;
1.89 + return branch.indexOf (bo);
1.90 }
1.91
1.92 int BranchObj::getFloatImageNum(FloatImageObj *fio)
1.93 @@ -273,23 +261,18 @@
1.94
1.95 void BranchObj::toggleScroll()
1.96 {
1.97 - BranchObj *bo;
1.98 if (scrolled)
1.99 {
1.100 scrolled=false;
1.101 systemFlags->deactivate("scrolledright");
1.102 - for (bo=branch.first(); bo; bo=branch.next() )
1.103 - {
1.104 - bo->setVisibility(true);
1.105 - }
1.106 + for (int i=0; i<branch.size(); ++i)
1.107 + branch.at(i)->setVisibility(true);
1.108 } else
1.109 {
1.110 scrolled=true;
1.111 systemFlags->activate("scrolledright");
1.112 - for (bo=branch.first(); bo; bo=branch.next() )
1.113 - {
1.114 - bo->setVisibility(false);
1.115 - }
1.116 + for (int i=0; i<branch.size(); ++i)
1.117 + branch.at(i)->setVisibility(false);
1.118 }
1.119 calcBBoxSize();
1.120 positionBBox();
1.121 @@ -362,14 +345,13 @@
1.122 if (!scrolled && (depth < toDepth))
1.123 {
1.124 // Now go recursivly through all childs
1.125 - BranchObj* b;
1.126 - for (b=branch.first(); b;b=branch.next() )
1.127 - b->setVisibility (v,toDepth);
1.128 - for (int i=0; i<floatimage.size(); ++i)
1.129 + int i;
1.130 + for (i=0; i<branch.size(); ++i)
1.131 + branch.at(i)->setVisibility (v,toDepth);
1.132 + for (i=0; i<floatimage.size(); ++i)
1.133 floatimage.at(i)->setVisibility (v);
1.134 - XLinkObj* xlo;
1.135 - for (xlo=xlink.first(); xlo;xlo=xlink.next() )
1.136 - xlo->setVisibility ();
1.137 + for (i=0; i<xlink.size(); ++i)
1.138 + xlink.at(i)->setVisibility ();
1.139 }
1.140 } // depth <= toDepth
1.141 requestReposition();
1.142 @@ -396,9 +378,8 @@
1.143 void BranchObj::setColorChilds (QColor col)
1.144 {
1.145 OrnamentedObj::setColor (col);
1.146 - BranchObj *bo;
1.147 - for (bo=branch.first(); bo; bo=branch.next() )
1.148 - bo->setColorChilds(col);
1.149 + for (int i=0; i<branch.size(); ++i)
1.150 + branch.at(i)->setColorChilds(col);
1.151 }
1.152
1.153 BranchObj* BranchObj::first()
1.154 @@ -410,28 +391,35 @@
1.155
1.156 BranchObj* BranchObj::next()
1.157 {
1.158 + BranchObj *bo;
1.159 BranchObj *lmo;
1.160 - BranchObj *bo=branch.first();
1.161 - BranchObj *po=(BranchObj*)(parObj);
1.162 + BranchObj *po=(BranchObj*)parObj;
1.163 +
1.164 + if (branch.isEmpty())
1.165 + bo=NULL;
1.166 + else
1.167 + bo=branch.first();
1.168
1.169 if (!itLast)
1.170 {
1.171 + // no itLast, we are just beginning
1.172 if (bo)
1.173 - { // We are just beginning,
1.174 - // return first child
1.175 + {
1.176 + // we have childs, return first one
1.177 itLast=this;
1.178 return bo;
1.179 }
1.180 else
1.181 {
1.182 - // No childs
1.183 + // No childs, so there is no next
1.184 itLast=this;
1.185 return NULL;
1.186 }
1.187 }
1.188
1.189 - if (itLast==parObj)
1.190 - { // We come from above
1.191 + // We have an itLast
1.192 + if (itLast==po)
1.193 + { // We come from parent
1.194 if (bo)
1.195 {
1.196 // there are childs, go there
1.197 @@ -442,7 +430,7 @@
1.198 { // no childs, try to go up again
1.199 if (po)
1.200 {
1.201 - // go up
1.202 + // go back to parent and try to find next there
1.203 itLast=this;
1.204 lmo=po->next();
1.205 itLast=this;
1.206 @@ -451,22 +439,36 @@
1.207 }
1.208 else
1.209 {
1.210 - // can't go up, I am mapCenter
1.211 + // can't go up, I am mapCenter, no next
1.212 itLast=NULL;
1.213 return NULL;
1.214 }
1.215 }
1.216 }
1.217
1.218 + // We don't come from parent, but from brother or childs
1.219 +
1.220 // Try to find last child, where we came from, in my own childs
1.221 bool searching=true;
1.222 - while (bo && searching)
1.223 + int i=0;
1.224 + while (i<branch.size())
1.225 {
1.226 - if (itLast==bo) searching=false;
1.227 - bo=branch.next();
1.228 + // Try to find itLast in my own childs
1.229 + if (itLast==branch.at(i))
1.230 + {
1.231 + // ok, we come from my own childs
1.232 + //xyz //FIXME need to proceed to NEXT child or up again
1.233 + if (i<branch.size()-1)
1.234 + bo=branch.at(i+1);
1.235 + else
1.236 + bo=NULL;
1.237 + searching=false;
1.238 + i=branch.size();
1.239 + }
1.240 + ++i;
1.241 }
1.242 if (!searching)
1.243 - { // found lastLMO in my childs
1.244 + { // found itLast in my childs
1.245 if (bo)
1.246 {
1.247 // found a brother of lastLMO
1.248 @@ -494,12 +496,11 @@
1.249 }
1.250
1.251 // couldn't find last child, it must be a nephew of mine
1.252 - bo=branch.first();
1.253 - if (bo)
1.254 + if (branch.size()>0)
1.255 {
1.256 // proceed with my first child
1.257 itLast=this;
1.258 - return bo;
1.259 + return branch.first();
1.260 }
1.261 else
1.262 {
1.263 @@ -554,9 +555,8 @@
1.264 void BranchObj::moveBy (double x, double y)
1.265 {
1.266 OrnamentedObj::moveBy (x,y);
1.267 - BranchObj* b;
1.268 - for (b=branch.first(); b;b=branch.next() )
1.269 - b->moveBy (x,y);
1.270 + for (int i=0; i<branch.size(); ++i)
1.271 + branch.at(i)->moveBy (x,y);
1.272 positionBBox();
1.273 }
1.274
1.275 @@ -577,9 +577,8 @@
1.276 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1.277
1.278 // Update links to other branches
1.279 - XLinkObj *xlo;
1.280 - for (xlo=xlink.first(); xlo; xlo=xlink.next() )
1.281 - xlo->updateXLink();
1.282 + for (int i=0; i<xlink.size(); ++i)
1.283 + xlink.at(i)->updateXLink();
1.284 }
1.285
1.286 void BranchObj::calcBBoxSize()
1.287 @@ -673,11 +672,10 @@
1.288 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
1.289 {
1.290 // Search branches
1.291 - BranchObj *b;
1.292 LinkableMapObj *lmo;
1.293 - for (b=branch.first(); b; b=branch.next() )
1.294 + for (int i=0; i<branch.size(); ++i)
1.295 {
1.296 - lmo=b->findMapObj(p, excludeLMO);
1.297 + lmo=branch.at(i)->findMapObj(p, excludeLMO);
1.298 if (lmo != NULL) return lmo;
1.299 }
1.300
1.301 @@ -719,9 +717,8 @@
1.302 hidden=false;
1.303 }
1.304
1.305 - BranchObj *bo;
1.306 - for (bo=branch.first(); bo; bo=branch.next() )
1.307 - bo->setHideTmp (mode);
1.308 + for (int i=0; i<branch.size(); ++i)
1.309 + branch.at(i)->setHideTmp (mode);
1.310 }
1.311
1.312 bool BranchObj::hasHiddenExportParent(BranchObj *start)
1.313 @@ -805,17 +802,15 @@
1.314 s+=note.saveToDir();
1.315
1.316 // Save branches
1.317 - BranchObj *bo;
1.318 - for (bo=branch.first(); bo; bo=branch.next() )
1.319 - s+=bo->saveToDir(tmpdir,prefix,offset);
1.320 + for (int i=0; i<branch.size(); ++i)
1.321 + s+=branch.at(i)->saveToDir(tmpdir,prefix,offset);
1.322
1.323 // Save XLinks
1.324 - XLinkObj *xlo;
1.325 QString ol; // old link
1.326 QString cl; // current link
1.327 - for (xlo=xlink.first(); xlo; xlo=xlink.next() )
1.328 + for (int i=0; i<xlink.size(); ++i)
1.329 {
1.330 - cl=xlo->saveToDir();
1.331 + cl=xlink.at(i)->saveToDir();
1.332 if (cl!=ol)
1.333 {
1.334 s+=cl;
1.335 @@ -839,7 +834,7 @@
1.336
1.337 void BranchObj::removeXLinkRef (XLinkObj *xlo)
1.338 {
1.339 - xlink.remove (xlo);
1.340 + xlink.removeAt (xlink.indexOf(xlo));
1.341 }
1.342
1.343 void BranchObj::deleteXLink(XLinkObj *xlo)
1.344 @@ -868,10 +863,12 @@
1.345
1.346 BranchObj* BranchObj::XLinkTargetAt (int i)
1.347 {
1.348 - if (xlink.at(i))
1.349 - return xlink.at(i)->otherBranch (this);
1.350 - else
1.351 - return NULL;
1.352 + if (i>=0 && i<xlink.size())
1.353 + {
1.354 + if (xlink.at(i))
1.355 + return xlink.at(i)->otherBranch (this);
1.356 + }
1.357 + return NULL;
1.358 }
1.359
1.360 void BranchObj::setIncludeImagesVer(bool b)
1.361 @@ -975,13 +972,8 @@
1.362 void BranchObj::savePosInAngle ()
1.363 {
1.364 // Save position in angle
1.365 - BranchObj *b;
1.366 - int i=0;
1.367 - for (b=branch.first(); b; b=branch.next() )
1.368 - {
1.369 - b->angle=i;
1.370 - i++;
1.371 - }
1.372 + for (int i=0; i<branch.size(); ++i)
1.373 + branch.at(i)->angle=i;
1.374 }
1.375
1.376 void BranchObj::setDefAttr (BranchModification mod)
1.377 @@ -1055,7 +1047,7 @@
1.378 // Add new bo and resort branches
1.379 BranchObj *newbo=addBranch ();
1.380 newbo->angle=pos-0.5;
1.381 - branch.sort();
1.382 + //FIXME branch.sort();
1.383 return newbo;
1.384 }
1.385
1.386 @@ -1065,7 +1057,7 @@
1.387 // Add new bo and resort branches
1.388 bo->angle=pos-0.5;
1.389 BranchObj *newbo=addBranch (bo);
1.390 - branch.sort();
1.391 + //FIXME branch.sort();
1.392 return newbo;
1.393 }
1.394
1.395 @@ -1080,7 +1072,7 @@
1.396 bo->setDefAttr (MovedBranch);
1.397 if (scrolled) tmpUnscroll();
1.398 setLastSelectedBranch (bo);
1.399 - branch.sort();
1.400 + //FIXME branch.sort();
1.401 return bo;
1.402 }
1.403
1.404 @@ -1109,22 +1101,30 @@
1.405 // if bo is not in branch remove returns false, we
1.406 // don't care...
1.407
1.408 - if (branch.remove (bo))
1.409 + int i=branch.indexOf(bo);
1.410 + if (i>=0)
1.411 + {
1.412 delete (bo);
1.413 - else
1.414 + branch.removeAt (i);
1.415 + } else
1.416 qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
1.417 requestReposition();
1.418 }
1.419
1.420 void BranchObj::removeBranchPtr(BranchObj* bo)
1.421 {
1.422 - branch.remove (bo);
1.423 + int i=branch.indexOf(bo);
1.424 +
1.425 + if (i>=0)
1.426 + branch.removeAt (i);
1.427 + else
1.428 + qWarning ("BranchObj::removeBranchPtr tried to remove non existing branch?!\n");
1.429 requestReposition();
1.430 }
1.431
1.432 void BranchObj::setLastSelectedBranch (BranchObj* bo)
1.433 {
1.434 - lastSelectedBranch=branch.find(bo);
1.435 + lastSelectedBranch=branch.indexOf(bo);
1.436 }
1.437
1.438 BranchObj* BranchObj::getLastSelectedBranch ()
1.439 @@ -1147,9 +1147,12 @@
1.440 return branch.last();
1.441 }
1.442
1.443 -BranchObj* BranchObj::getBranchNum (const uint &i)
1.444 +BranchObj* BranchObj::getBranchNum (int i)
1.445 {
1.446 - return branch.at(i);
1.447 + if (i>=0 && i<branch.size())
1.448 + return branch.at(i);
1.449 + else
1.450 + return NULL;
1.451 }
1.452
1.453 bool BranchObj::canMoveBranchUp()
1.454 @@ -1165,12 +1168,12 @@
1.455 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
1.456 {
1.457 savePosInAngle();
1.458 - int i=branch.find(bo1);
1.459 + int i=branch.indexOf(bo1);
1.460 if (i>0)
1.461 { // -1 if bo1 not found
1.462 branch.at(i)->angle--;
1.463 branch.at(i-1)->angle++;
1.464 - branch.sort();
1.465 + //FIXME branch.sort();
1.466 return branch.at(i);
1.467 } else
1.468 return NULL;
1.469 @@ -1189,14 +1192,14 @@
1.470 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
1.471 {
1.472 savePosInAngle();
1.473 - int i=branch.find(bo1);
1.474 + int i=branch.indexOf(bo1);
1.475 int j;
1.476 - if (branch.next())
1.477 + if (i <branch.size())
1.478 {
1.479 - j = branch.at();
1.480 + j = i+1;
1.481 branch.at(i)->angle++;
1.482 branch.at(j)->angle--;
1.483 - branch.sort();
1.484 + //FIXME branch.sort();
1.485 return branch.at(i);
1.486 } else
1.487 return NULL;
1.488 @@ -1305,13 +1308,12 @@
1.489 ref2.setY(ref.y() );
1.490
1.491 // Align the childs depending on reference point
1.492 - BranchObj *b;
1.493 - for (b=branch.first(); b; b=branch.next() )
1.494 + for (int i=0; i<branch.size(); ++i)
1.495 {
1.496 - if (!b->isHidden())
1.497 + if (!branch.at(i)->isHidden())
1.498 {
1.499 - b->alignRelativeTo (ref2);
1.500 - ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
1.501 + branch.at(i)->alignRelativeTo (ref2);
1.502 + ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChilds().height() );
1.503 }
1.504 }
1.505 }
1.506 @@ -1340,7 +1342,7 @@
1.507
1.508 alignRelativeTo ( QPoint (absPos.x(),
1.509 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.510 - branch.sort();
1.511 + //FIXME branch.sort();
1.512 positionBBox(); // Reposition bbox and contents
1.513 } else
1.514 {
1.515 @@ -1354,11 +1356,8 @@
1.516 void BranchObj::unsetAllRepositionRequests()
1.517 {
1.518 repositionRequest=false;
1.519 - BranchObj *b;
1.520 - for (b=branch.first(); b; b=branch.next() )
1.521 - {
1.522 - b->unsetAllRepositionRequests();
1.523 - }
1.524 + for (int i=0; i<branch.size(); ++i)
1.525 + branch.at(i)->unsetAllRepositionRequests();
1.526 }
1.527
1.528
1.529 @@ -1368,10 +1367,9 @@
1.530
1.531 if (scrolled) return r;
1.532
1.533 - BranchObj* b;
1.534 - for (b=branch.first();b ;b=branch.next() )
1.535 - if (!b->isHidden())
1.536 - r=addBBox(b->getTotalBBox(),r);
1.537 + for (int i=0; i<branch.size(); ++i)
1.538 + if (!branch.at(i)->isHidden())
1.539 + r=addBBox(branch.at(i)->getTotalBBox(),r);
1.540
1.541 for (int i=0; i<floatimage.size(); ++i)
1.542 if (!floatimage.at(i)->isHidden())
1.543 @@ -1427,13 +1425,12 @@
1.544 // sum of heights
1.545 // maximum of widths
1.546 // minimum of y
1.547 - BranchObj* b;
1.548 - for (b=branch.first();b ;b=branch.next() )
1.549 + for (int i=0; i<branch.size(); ++i)
1.550 {
1.551 - if (!b->isHidden())
1.552 + if (!branch.at(i)->isHidden())
1.553 {
1.554 - b->calcBBoxSizeWithChilds();
1.555 - br=b->getBBoxSizeWithChilds();
1.556 + branch.at(i)->calcBBoxSizeWithChilds();
1.557 + br=branch.at(i)->getBBoxSizeWithChilds();
1.558 r.setWidth( max (br.width(), r.width() ));
1.559 r.setHeight(br.height() + r.height() );
1.560 if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
1.561 @@ -1478,7 +1475,7 @@
1.562 // Update Toolbar
1.563 updateFlagsToolbar();
1.564
1.565 - // Update actions in mapeditor
1.566 + // Update actions
1.567 mapEditor->updateActions();
1.568 }
1.569
2.1 --- a/branchobj.h Mon Nov 20 12:12:05 2006 +0000
2.2 +++ b/branchobj.h Thu Nov 23 13:53:08 2006 +0000
2.3 @@ -1,19 +1,12 @@
2.4 #ifndef BRANCHOBJ_H
2.5 #define BRANCHOBJ_H
2.6
2.7 -#include <Q3PtrList>
2.8 -
2.9 #include "floatimageobj.h"
2.10 #include "linkablemapobj.h"
2.11 #include "ornamentedobj.h"
2.12 #include "xlinkobj.h"
2.13
2.14
2.15 -class BranchObjPtrList : public Q3PtrList<BranchObj>
2.16 -{
2.17 - virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j);
2.18 -};
2.19 -
2.20 enum BranchModification {NewBranch, MovedBranch};
2.21 enum HideTmpMode {HideNone, HideExport};
2.22
2.23 @@ -106,7 +99,7 @@
2.24 virtual BranchObj* getLastSelectedBranch();
2.25 virtual BranchObj* getFirstBranch();
2.26 virtual BranchObj* getLastBranch();
2.27 - virtual BranchObj* getBranchNum(const uint &);
2.28 + virtual BranchObj* getBranchNum(int);
2.29 virtual bool canMoveBranchUp();
2.30 virtual BranchObj* moveBranchUp(BranchObj*);
2.31 virtual bool canMoveBranchDown();
2.32 @@ -127,9 +120,9 @@
2.33 protected:
2.34 static BranchObj* itLast; // iterator for first(), next()
2.35 static BranchObj* itFirst; // first iterator for first(), next()
2.36 - BranchObjPtrList branch; // all child branches
2.37 + QList<BranchObj*> branch; // all child branches
2.38 QList<FloatImageObj*> floatimage;// child images
2.39 - Q3PtrList<XLinkObj> xlink; // xlinks to other branches
2.40 + QList<XLinkObj*> xlink; // xlinks to other branches
2.41 public:
2.42 float angle; // used in mainbranch to reorder mainbranches
2.43 protected:
3.1 Binary file demos/todo.vym has changed
4.1 --- a/exporthtmldialog.ui.h Mon Nov 20 12:12:05 2006 +0000
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,218 +0,0 @@
4.4 -/****************************************************************************
4.5 -** ui.h extension file, included from the uic-generated form implementation.
4.6 -**
4.7 -** If you wish to add, delete or rename functions or slots use
4.8 -** Qt Designer which will update this file, preserving your code. Create an
4.9 -** init() function in place of a constructor, and a destroy() function in
4.10 -** place of a destructor.
4.11 -*****************************************************************************/
4.12 -
4.13 -
4.14 -extern Settings settings;
4.15 -
4.16 -void ExportHTMLDialog::init()
4.17 -{
4.18 - dir=settings.readEntry ("/vym/export/html/dir","" );
4.19 - lineEdit1->setText(dir);
4.20 -
4.21 - if ( settings.readEntry ("/vym/export/html/image","yes")=="yes")
4.22 - image=true;
4.23 - else
4.24 - image=false;
4.25 - checkBox4->setChecked(image);
4.26 -
4.27 - if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes")
4.28 - imageOnly=true;
4.29 - else
4.30 - imageOnly=false;
4.31 - checkBox5_2->setChecked(imageOnly);
4.32 -
4.33 - if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes")
4.34 - wikistyle=true;
4.35 - else
4.36 - wikistyle=false;
4.37 - checkBox5->setChecked(wikistyle);
4.38 -
4.39 - if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes")
4.40 - useHeading=true;
4.41 - else
4.42 - useHeading=false;
4.43 - checkBox4_2->setChecked(useHeading);
4.44 -
4.45 - if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes")
4.46 - useURLImage=true;
4.47 - else
4.48 - useURLImage=false;
4.49 - checkBox6->setChecked(useURLImage);
4.50 -
4.51 - if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes")
4.52 - showOutput=true;
4.53 - else
4.54 - showOutput=false;
4.55 - checkBox3->setChecked(showOutput);
4.56 -
4.57 - stylepath=settings.readEntry
4.58 - ("/vym/export/html/styles","styles");
4.59 - scriptpath=settings.readEntry
4.60 - ("/vym/export/html/scripts","scripts");
4.61 - xsl=settings.readEntry
4.62 - ("/vym/export/html/xsl","vym2html.xsl");
4.63 - css=settings.readEntry
4.64 - ("/vym/export/html/css","vym.css");
4.65 - script=settings.readEntry
4.66 - ("/vym/export/html/script","vym2html.sh");
4.67 -
4.68 - proc = new QProcess( this );
4.69 - connect( proc, SIGNAL(readyReadStdout()),
4.70 - this, SLOT(readOutput()) );
4.71 -
4.72 - dia=new ShowTextDialog ();
4.73 -}
4.74 -
4.75 -void ExportHTMLDialog::destroy()
4.76 -{
4.77 - delete (proc);
4.78 - delete (dia);
4.79 -}
4.80 -
4.81 -void ExportHTMLDialog::browseDirectory()
4.82 -{
4.83 - QFileDialog fd( this, tr("VYM - Export HTML to directory"));
4.84 - fd.setMode (QFileDialog::DirectoryOnly);
4.85 - fd.setCaption(tr("VYM - Export HTML to directory"));
4.86 - fd.setModal (true);
4.87 - fd.show();
4.88 -
4.89 - if ( fd.exec() == QDialog::Accepted )
4.90 - {
4.91 - dir=fd.selectedFile();
4.92 - lineEdit1->setText (dir );
4.93 - }
4.94 -}
4.95 -
4.96 -void ExportHTMLDialog::useWIKIpressed(bool b)
4.97 -{
4.98 - wikistyle=b;
4.99 -}
4.100 -
4.101 -void ExportHTMLDialog::includeImage(bool b)
4.102 -{
4.103 - image=b;
4.104 -}
4.105 -
4.106 -void ExportHTMLDialog::imgOnly(bool b)
4.107 -{
4.108 - imageOnly=b;
4.109 -}
4.110 -
4.111 -void ExportHTMLDialog::useHeadingPressed(bool b)
4.112 -{
4.113 - useHeading=b;
4.114 -}
4.115 -
4.116 -void ExportHTMLDialog::useURLImagePressed(bool b)
4.117 -{
4.118 - useURLImage=b;
4.119 -}
4.120 -
4.121 -void ExportHTMLDialog::showOut(bool b)
4.122 -{
4.123 - showOutput=b;
4.124 -}
4.125 -
4.126 -void ExportHTMLDialog::dirChanged()
4.127 -{
4.128 - dir=lineEdit1->text();
4.129 -}
4.130 -
4.131 -
4.132 -
4.133 -
4.134 -void ExportHTMLDialog::doExport (const QString &mapname)
4.135 -{
4.136 - // Save options to settings file
4.137 - // (but don't save at destructor, which
4.138 - // is called for "cancel", too)
4.139 - settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() );
4.140 -
4.141 - if (wikistyle)
4.142 - settings.writeEntry ("/vym/export/html/wiki","yes");
4.143 - else
4.144 - settings.writeEntry ("/vym/export/html/wiki","no");
4.145 -
4.146 - if (image)
4.147 - settings.writeEntry ("/vym/export/html/image","yes");
4.148 - else
4.149 - settings.writeEntry ("/vym/export/html/image","no");
4.150 -
4.151 - if (imageOnly)
4.152 - settings.writeEntry ("/vym/export/html/imageOnly","yes");
4.153 - else
4.154 - settings.writeEntry ("/vym/export/html/imageOnly","no");
4.155 -
4.156 - if (useHeading)
4.157 - settings.writeEntry ("/vym/export/html/useHeading","yes");
4.158 - else
4.159 - settings.writeEntry ("/vym/export/html/useHeading","no");
4.160 -
4.161 - if (showOutput)
4.162 - settings.writeEntry ("/vym/export/html/showOutput","yes");
4.163 - else
4.164 - settings.writeEntry ("/vym/export/html/showOutput","no");
4.165 -
4.166 - settings.writeEntry
4.167 - ("/vym/export/html/styles",stylepath);
4.168 - settings.writeEntry
4.169 - ("/vym/export/html/scripts",scriptpath);
4.170 - settings.writeEntry
4.171 - ("/vym/export/html/xsl",xsl);
4.172 - settings.writeEntry
4.173 - ("/vym/export/html/css",css);
4.174 - settings.writeEntry
4.175 - ("/vym/export/html/script",script);
4.176 -
4.177 - proc->addArgument (scriptpath + "/" + script );
4.178 - proc->addArgument(dir + maskPath(mapname) + ".xml");
4.179 - proc->addArgument("-sp=" + stylepath +"/" + xsl );
4.180 - proc->addArgument("-css=" + css );
4.181 - if (image) proc->addArgument("-image" );
4.182 - if (wikistyle) proc->addArgument("-wikistyle" );
4.183 - if (useHeading) proc->addArgument("-useURLHeading" );
4.184 - if (useURLImage)
4.185 - {
4.186 - proc->addArgument("-useURLImage" );
4.187 - QPixmap pm (flag_url_xpm);
4.188 - pm.save (dir + "/flags/url.png","PNG");
4.189 - }
4.190 -
4.191 - dia->append ("vym is executing: " + proc->arguments().join(" ") );
4.192 - if ( !proc->start() )
4.193 - {
4.194 - // error handling
4.195 - dia->show();
4.196 - QString s;
4.197 - QStringList list = proc->arguments();
4.198 - QStringList::Iterator it = list.begin();
4.199 - while( it != list.end() )
4.200 - {
4.201 - s+= ( *it ) + "\n";
4.202 - ++it;
4.203 - }
4.204 - QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s);
4.205 - } else
4.206 - if (showOutput) dia->exec();
4.207 -
4.208 -
4.209 -}
4.210 -
4.211 -
4.212 -QString ExportHTMLDialog::getDir()
4.213 -{
4.214 - return dir;
4.215 -}
4.216 -
4.217 -
4.218 -void ExportHTMLDialog::readOutput()
4.219 -{
4.220 - dia->append (proc->readStdout() );
4.221 -}
5.1 --- a/exportxhtmldialog.ui.h Mon Nov 20 12:12:05 2006 +0000
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,392 +0,0 @@
5.4 -//Added by qt3to4:
5.5 -#include <QPixmap>
5.6 -#include <QTextStream>
5.7 -/****************************************************************************
5.8 -** ui.h extension file, included from the uic-generated form implementation.
5.9 -**
5.10 -** If you wish to add, delete or rename functions or slots use
5.11 -** Qt Designer which will update this file, preserving your code. Create an
5.12 -** init() function in place of a constructor, and a destroy() function in
5.13 -** place of a destructor.
5.14 -*****************************************************************************/
5.15 -
5.16 -
5.17 -extern Settings settings;
5.18 -extern QDir vymBaseDir;
5.19 -extern Options options;
5.20 -
5.21 -void ExportXHTMLDialog::init()
5.22 -{
5.23 - filepath="";
5.24 - settingsChanged=false;
5.25 - scriptProc=new Process;
5.26 -}
5.27 -
5.28 -void ExportXHTMLDialog::readSettings()
5.29 -{
5.30 -
5.31 - dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() );
5.32 - lineEditDir->setText(dir);
5.33 -
5.34 - if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes")
5.35 - useImage=true;
5.36 - else
5.37 - useImage=false;
5.38 - imageButton->setChecked(useImage);
5.39 -
5.40 - if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes")
5.41 - useTextColor=true;
5.42 - else
5.43 - useTextColor=false;
5.44 - textColorButton->setChecked(useTextColor);
5.45 -
5.46 -/* FIXME this was used in old html export, is not yet in new stylesheet
5.47 - if ( settings.readEntry ("/export/html/useHeading","no")=="yes")
5.48 - useHeading=true;
5.49 - else
5.50 - useHeading=false;
5.51 - checkBox4_2->setChecked(useHeading);
5.52 -*/
5.53 -
5.54 - if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes")
5.55 - saveSettingsInMap=true;
5.56 - else
5.57 - saveSettingsInMap=false;
5.58 - saveSettingsInMapButton->setChecked(saveSettingsInMap);
5.59 -
5.60 - if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes")
5.61 - showWarnings=true;
5.62 - else
5.63 - showWarnings=false;
5.64 - warningsButton->setChecked(showWarnings);
5.65 -
5.66 - if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes")
5.67 - showOutput=true;
5.68 - else
5.69 - showOutput=false;
5.70 - outputButton->setChecked(showOutput);
5.71 -
5.72 - // For testing better use local styles
5.73 - if (options.isOn ("local"))
5.74 - {
5.75 - xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl";
5.76 - css=vymBaseDir.path()+"/styles/vym.css";
5.77 - } else
5.78 - {
5.79 - xsl=settings.readLocalEntry
5.80 - (filepath,"/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl");
5.81 - css=settings.readLocalEntry
5.82 - (filepath,"/export/xhtml/css","/usr/share/vym/styles/vym.css");
5.83 - }
5.84 - lineEditXSL->setText(xsl);
5.85 - lineEditCSS->setText(css);
5.86 -
5.87 - prescript=settings.readLocalEntry
5.88 - (filepath,"/export/xhtml/prescript","");
5.89 - lineEditPreScript->setText (prescript);
5.90 -
5.91 - postscript=settings.readLocalEntry
5.92 - (filepath,"/export/xhtml/postscript","");
5.93 - lineEditPostScript->setText (postscript);
5.94 -
5.95 - if (!prescript.isEmpty() || !postscript.isEmpty())
5.96 - {
5.97 - QMessageBox::warning( 0, tr( "Warning" ),tr(
5.98 - "The settings saved in the map "
5.99 - "would like to run scripts:\n\n"
5.100 - "%1\n\n"
5.101 - "Please check, if you really\n"
5.102 - "want to allow this in your system!").arg(prescript+" "+postscript));
5.103 -
5.104 - }
5.105 -}
5.106 -
5.107 -void ExportXHTMLDialog::destroy()
5.108 -{
5.109 -}
5.110 -
5.111 -void ExportXHTMLDialog::dirChanged()
5.112 -{
5.113 - dir=lineEditDir->text();
5.114 - if (dir.right(1)!="/")
5.115 - dir+="/";
5.116 - settingsChanged=true;
5.117 -}
5.118 -
5.119 -void ExportXHTMLDialog::browseDirectoryPressed()
5.120 -{
5.121 - Q3FileDialog fd( this, tr("VYM - Export HTML to directory"));
5.122 - fd.setMode (Q3FileDialog::DirectoryOnly);
5.123 - fd.setCaption(tr("VYM - Export HTML to directory"));
5.124 - fd.setModal (true);
5.125 - fd.show();
5.126 -
5.127 - if ( fd.exec() == QDialog::Accepted )
5.128 - {
5.129 - dir=fd.selectedFile();
5.130 - lineEditDir->setText (dir );
5.131 - settingsChanged=true;
5.132 - }
5.133 -}
5.134 -
5.135 -void ExportXHTMLDialog::imageButtonPressed(bool b)
5.136 -{
5.137 - useImage=b;
5.138 - settingsChanged=true;
5.139 -}
5.140 -
5.141 -void ExportXHTMLDialog::textcolorButtonPressed(bool b)
5.142 -{
5.143 - useTextColor=b;
5.144 - settingsChanged=true;
5.145 -}
5.146 -
5.147 -void ExportXHTMLDialog::saveSettingsInMapButtonPressed(bool b)
5.148 -{
5.149 - saveSettingsInMap=b;
5.150 - settingsChanged=true;
5.151 -}
5.152 -
5.153 -void ExportXHTMLDialog::warningsButtonPressed(bool b)
5.154 -{
5.155 - showWarnings=b;
5.156 - settingsChanged=true;
5.157 -}
5.158 -
5.159 -
5.160 -void ExportXHTMLDialog::outputButtonPressed(bool b)
5.161 -{
5.162 - showOutput=b;
5.163 - settingsChanged=true;
5.164 -}
5.165 -
5.166 -void ExportXHTMLDialog::cssChanged()
5.167 -{
5.168 - css=lineEditCSS->text();
5.169 - settingsChanged=true;
5.170 -}
5.171 -
5.172 -void ExportXHTMLDialog::browseCSSPressed()
5.173 -{
5.174 - Q3FileDialog fd( this, tr("VYM - Path to CSS file"));
5.175 - fd.setModal (true);
5.176 - fd.addFilter ("Cascading Stylesheet (*.css)");
5.177 - fd.show();
5.178 -
5.179 - if ( fd.exec() == QDialog::Accepted )
5.180 - {
5.181 - css=fd.selectedFile();
5.182 - lineEditCSS->setText (css );
5.183 - settingsChanged=true;
5.184 - }
5.185 -}
5.186 -
5.187 -void ExportXHTMLDialog::xslChanged()
5.188 -{
5.189 - xsl=lineEditXSL->text();
5.190 - settingsChanged=true;
5.191 -}
5.192 -
5.193 -void ExportXHTMLDialog::prescriptChanged()
5.194 -{
5.195 - prescript=lineEditPreScript->text();
5.196 - settingsChanged=true;
5.197 -}
5.198 -
5.199 -void ExportXHTMLDialog::browseXSLPressed()
5.200 -{
5.201 - Q3FileDialog fd( this, tr("VYM - Path to XSL file"));
5.202 - fd.setModal (true);
5.203 - fd.addFilter ("Extensible Stylesheet Language (*.xsl)");
5.204 - fd.show();
5.205 -
5.206 - if ( fd.exec() == QDialog::Accepted )
5.207 - {
5.208 - xsl=fd.selectedFile();
5.209 - lineEditXSL->setText (xsl );
5.210 - settingsChanged=true;
5.211 - }
5.212 -}
5.213 -
5.214 -void ExportXHTMLDialog::postscriptChanged()
5.215 -{
5.216 - postscript=lineEditPostScript->text();
5.217 - settingsChanged=true;
5.218 -}
5.219 -
5.220 -void ExportXHTMLDialog::browsePreExportButtonPressed()
5.221 -{
5.222 - Q3FileDialog fd( this, tr("VYM - Path to pre export script"));
5.223 - fd.setModal (true);
5.224 - fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
5.225 - fd.show();
5.226 -
5.227 - if ( fd.exec() == QDialog::Accepted )
5.228 - {
5.229 - prescript=fd.selectedFile();
5.230 - lineEditPreScript->setText (prescript );
5.231 - settingsChanged=true;
5.232 - }
5.233 -
5.234 -}
5.235 -
5.236 -void ExportXHTMLDialog::browsePostExportButtonPressed()
5.237 -{
5.238 - Q3FileDialog fd( this, tr("VYM - Path to post export script"));
5.239 - fd.setModal (true);
5.240 - fd.addFilter ("Scripts (*.sh *.pl *.py *.php)");
5.241 - fd.show();
5.242 -
5.243 - if ( fd.exec() == QDialog::Accepted )
5.244 - {
5.245 - postscript=fd.selectedFile();
5.246 - lineEditPostScript->setText (postscript );
5.247 - settingsChanged=true;
5.248 - }
5.249 -}
5.250 -
5.251 -
5.252 -void ExportXHTMLDialog::doExport (const QString &mapname)
5.253 -{
5.254 - // Save options to settings file
5.255 - // (but don't save at destructor, which
5.256 - // is called for "cancel", too)
5.257 - settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir);
5.258 - settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript);
5.259 - settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript);
5.260 -
5.261 - if (useImage)
5.262 - settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes");
5.263 - else
5.264 - settings.setLocalEntry (filepath,"/export/xhtml/useImage","no");
5.265 -
5.266 - if (useTextColor)
5.267 - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes");
5.268 - else
5.269 - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no");
5.270 -
5.271 - if (showWarnings)
5.272 - settings.writeEntry ("/export/xhtml/showWarnings","yes");
5.273 - else
5.274 - settings.writeEntry ("/export/xhtml/showWarnings","no");
5.275 -
5.276 - if (showOutput)
5.277 - settings.writeEntry ("/export/xhtml/showOutput","yes");
5.278 - else
5.279 - settings.writeEntry ("/export/xhtml/showOutput","no");
5.280 -
5.281 - QString ipath;
5.282 - ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png";
5.283 - if (!options.isOn ("local"))
5.284 - {
5.285 - settings.setLocalEntry
5.286 - (filepath,"/export/xhtml/xsl",xsl);
5.287 - settings.setLocalEntry
5.288 - (filepath,"/export/xhtml/css",css);
5.289 - }
5.290 -
5.291 - // Provide a smaller URL-icon to improve Layout
5.292 - QPixmap pm;
5.293 - if (!pm.load(ipath,"PNG") )
5.294 - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath));
5.295 -
5.296 -
5.297 - if(!pm.save (dir + "flags/flag-url-16x16.png","PNG"))
5.298 - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath));
5.299 - if (!saveSettingsInMap)
5.300 - settings.clearLocal("/export/xhtml");
5.301 - else
5.302 - settings.setLocalEntry
5.303 - (filepath,"/export/xhtml/saveSettingsInMap","yes");
5.304 -
5.305 - // Copy CSS file
5.306 - QFile css_src (css);
5.307 - QFile css_dst (dir+"vym.css");
5.308 - if (!css_src.open ( QIODevice::ReadOnly))
5.309 - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css));
5.310 - else
5.311 - {
5.312 - if (!css_dst.open( QIODevice::WriteOnly))
5.313 - QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css"));
5.314 - else
5.315 - {
5.316 -
5.317 - QTextStream tsout( &css_dst);
5.318 - QTextStream tsin ( &css_src);
5.319 - QString s= tsin.read();
5.320 - tsout << s;
5.321 - css_dst.close();
5.322 - }
5.323 - css_src.close();
5.324 - }
5.325 -
5.326 - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml");
5.327 -
5.328 - if (useImage)
5.329 - p.addStringParam ("imagemap","images/"+mapname+".png");
5.330 - if (useTextColor)
5.331 - p.addStringParam ("use.textcolor","1");
5.332 - p.addStringParam ("mapname",mapname+".vym");
5.333 -
5.334 - p.setOutputFile (dir+mapname+".html");
5.335 - p.setInputFile (dir+mapname+".xml");
5.336 - p.setXSLFile (xsl);
5.337 - p.process();
5.338 -
5.339 - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");
5.340 -
5.341 -}
5.342 -
5.343 -void ExportXHTMLDialog::setFilePath(const QString &s)
5.344 -{
5.345 - filepath=s;
5.346 -}
5.347 -
5.348 -void ExportXHTMLDialog::setMapName(const QString &s)
5.349 -{
5.350 - mapname=s;
5.351 -}
5.352 -
5.353 -QString ExportXHTMLDialog::getDir()
5.354 -{
5.355 - return dir;
5.356 -}
5.357 -
5.358 -bool ExportXHTMLDialog::warnings()
5.359 -{
5.360 - return showWarnings;
5.361 -}
5.362 -
5.363 -bool ExportXHTMLDialog::hasChanged()
5.364 -{
5.365 - return settingsChanged;
5.366 -}
5.367 -
5.368 -
5.369 -void ExportXHTMLDialog::runScript(QString spath, QString fpath)
5.370 -{
5.371 - spath.replace ("%f",fpath);
5.372 - QStringList args=QStringList::split (' ',spath,false);
5.373 -
5.374 - scriptProc->clearArguments();
5.375 - scriptProc->setArguments (args);
5.376 - p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );
5.377 - if (!scriptProc->start() )
5.378 - {
5.379 - QMessageBox::critical( 0, tr( "Critical Error" ),
5.380 - tr("Could not start %1").arg(spath) );
5.381 - } else
5.382 - {
5.383 - scriptProc->waitFinished();
5.384 - if (!scriptProc->normalExit() )
5.385 - QMessageBox::critical( 0, tr( "Critical Error" ),
5.386 - tr("%1 didn't exit normally").arg(spath) +
5.387 - scriptProc->getErrout() );
5.388 - else
5.389 - if (scriptProc->exitStatus()>0) showOutput=true;
5.390 -
5.391 - }
5.392 - p.addOutput ("\n");
5.393 - p.addOutput (scriptProc->getErrout());
5.394 - p.addOutput (scriptProc->getStdout());
5.395 -}
6.1 --- a/flagobj.cpp Mon Nov 20 12:12:05 2006 +0000
6.2 +++ b/flagobj.cpp Thu Nov 23 13:53:08 2006 +0000
6.3 @@ -1,6 +1,4 @@
6.4 #include "flagobj.h"
6.5 -//Added by qt3to4:
6.6 -#include <QPixmap>
6.7
6.8 /////////////////////////////////////////////////////////////////
6.9 // FlagObj
6.10 @@ -24,7 +22,7 @@
6.11
6.12 FlagObj::~FlagObj()
6.13 {
6.14 -// cout << "Destr FlagObj " << name << "\n";
6.15 +// cout << "Destr FlagObj " << name.ascii() << "\n";
6.16 if (icon) delete (icon);
6.17 }
6.18
7.1 --- a/flagrowobj.cpp Mon Nov 20 12:12:05 2006 +0000
7.2 +++ b/flagrowobj.cpp Thu Nov 23 13:53:08 2006 +0000
7.3 @@ -19,13 +19,13 @@
7.4
7.5 FlagRowObj::~FlagRowObj()
7.6 {
7.7 -// cout << "Destr FlagRowObj\n";
7.8 - flag.clear();
7.9 + // cout << "Destr FlagRowObj\n";
7.10 + while (!flag.isEmpty())
7.11 + delete flag.takeFirst();
7.12 }
7.13
7.14 void FlagRowObj::init ()
7.15 {
7.16 - flag.setAutoDelete (true);
7.17 parentRow=NULL;
7.18 showFlags=true;
7.19 }
7.20 @@ -35,9 +35,8 @@
7.21 MapObj::copy(other);
7.22 parentRow=other->parentRow;
7.23 flag.clear();
7.24 - FlagObj *fo;
7.25 - for (fo=other->flag.first(); fo; fo=other->flag.next() )
7.26 - addFlag (fo);
7.27 + for (int i=0; i<flag.size(); ++i)
7.28 + addFlag (flag.at(i));
7.29 }
7.30
7.31 void FlagRowObj::clone (FlagRowObj* pr)
7.32 @@ -55,11 +54,10 @@
7.33 {
7.34 MapObj::move(x,y);
7.35 int dx=0;
7.36 - FlagObj *fo;
7.37 - for (fo=flag.first(); fo; fo=flag.next() )
7.38 + for (int i=0; i<flag.size(); ++i)
7.39 {
7.40 - fo->move(x+dx,y);
7.41 - dx+=QSize(fo->getSize() ).width();
7.42 + flag.at(i)->move(x+dx,y);
7.43 + dx+=QSize(flag.at(i)->getSize() ).width();
7.44 }
7.45 }
7.46
7.47 @@ -71,9 +69,8 @@
7.48 void FlagRowObj::setVisibility (bool v)
7.49 {
7.50 MapObj::setVisibility(v);
7.51 - FlagObj *fo;
7.52 - for (fo=flag.first(); fo; fo=flag.next() )
7.53 - fo->setVisibility (v);
7.54 + for (int i=0; i<flag.size(); ++i)
7.55 + flag.at(i)->setVisibility (v);
7.56 }
7.57
7.58 FlagObj* FlagRowObj::addFlag (FlagObj *fo)
7.59 @@ -97,10 +94,9 @@
7.60 {
7.61 QSize size(0,0);
7.62 QSize boxsize(0,0);
7.63 - FlagObj *fo;
7.64 - for (fo=flag.first(); fo; fo=flag.next() )
7.65 + for (int i=0; i<flag.size(); ++i)
7.66 {
7.67 - size=fo->getSize();
7.68 + size=flag.at(i)->getSize();
7.69 // add widths
7.70 boxsize.setWidth(boxsize.width() + size.width() );
7.71 // maximize height
7.72 @@ -114,9 +110,8 @@
7.73 QString FlagRowObj::getFlagName (const QPoint &p)
7.74 {
7.75 if (!inBox (p)) return "";
7.76 - FlagObj *fo;
7.77 - for (fo=flag.first();fo; fo=flag.next() )
7.78 - if (fo->inBox (p)) return fo->getName();
7.79 + for (int i=0; i<flag.size(); ++i)
7.80 + if (flag.at(i)->inBox (p)) return flag.at(i)->getName();
7.81 return "";
7.82
7.83
7.84 @@ -211,9 +206,8 @@
7.85 {
7.86 if (!parentRow)
7.87 {
7.88 - FlagObj *fo;
7.89 - for (fo=flag.first();fo; fo=flag.next() )
7.90 - fo->deactivate();
7.91 + for (int i=0; i<flag.size(); ++i)
7.92 + flag.at(i)->deactivate();
7.93 } else
7.94 qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
7.95 }
7.96 @@ -226,10 +220,9 @@
7.97 QString g=keepfo->getGroup();
7.98 if (g!="undefined")
7.99 {
7.100 - FlagObj *fo;
7.101 - for (fo=flag.first();fo; fo=flag.next() )
7.102 - if (g==fo->getGroup() && keepfo!=fo)
7.103 - flag.remove(fo);
7.104 + for (int i=0; i<flag.size(); ++i)
7.105 + if (g==flag.at(i)->getGroup() && keepfo!=flag.at(i))
7.106 + flag.remove(flag.at(i));
7.107 }
7.108 }
7.109 }
7.110 @@ -254,32 +247,30 @@
7.111
7.112 void FlagRowObj::resetUsedCounter()
7.113 {
7.114 - FlagObj *fo;
7.115 - for (fo=flag.first();fo; fo=flag.next() )
7.116 - fo->setUsed (false);
7.117 + for (int i=0; i<flag.size(); ++i)
7.118 + flag.at(i)->setUsed (false);
7.119 }
7.120
7.121 QString FlagRowObj::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags)
7.122 {
7.123 // Build xml string
7.124 QString s;
7.125 - FlagObj *fo;
7.126 if (parentRow)
7.127 - for (fo=flag.first();fo; fo=flag.next() )
7.128 + for (int i=0; i<flag.size(); ++i)
7.129 {
7.130 // save flag to xml, if flag is set
7.131 - s+=valueElement("standardflag",fo->getName() );
7.132 + s+=valueElement("standardflag",flag.at(i)->getName() );
7.133
7.134 // and tell parentRow, that this flag is used
7.135 - parentRow->activate(fo->getName() );
7.136 + parentRow->activate(flag.at(i)->getName() );
7.137 }
7.138 else
7.139 // Save icons to dir, if verbose is set (xml export)
7.140 // and I am a parentRow
7.141 // and this flag is really used somewhere
7.142 if (writeflags)
7.143 - for (fo=flag.first();fo; fo=flag.next() )
7.144 - if (fo->isUsed()) fo->saveToDir (tmpdir,prefix);
7.145 + for (int i=0; i<flag.size(); ++i)
7.146 + if (flag.at(i)->isUsed()) flag.at(i)->saveToDir (tmpdir,prefix);
7.147 return s;
7.148
7.149 }
7.150 @@ -291,15 +282,14 @@
7.151
7.152 void FlagRowObj::updateToolbar()
7.153 {
7.154 - FlagObj *fo;
7.155 if (parentRow)
7.156 {
7.157 // We are just a branch, not the toolbar default
7.158 // but state has to be copied from ourselves to parentrow!
7.159 parentRow->deactivateAll();
7.160 // In parentRow activate all existing (==active) flags
7.161 - for (fo=flag.first();fo; fo=flag.next() )
7.162 - parentRow->activate(fo->getName());
7.163 + for (int i=0; i<flag.size(); ++i)
7.164 + parentRow->activate(flag.at(i)->getName());
7.165 parentRow->updateToolbar();
7.166 } else
7.167 {
7.168 @@ -307,19 +297,16 @@
7.169 if (toolbar)
7.170 {
7.171 // Update state of actions in toolbar
7.172 - for (fo=flag.first();fo; fo=flag.next() )
7.173 - fo->updateAction();
7.174 + for (int i=0; i<flag.size(); ++i)
7.175 + flag.at(i)->updateAction();
7.176 }
7.177 }
7.178 }
7.179
7.180 FlagObj* FlagRowObj::findFlag (const QString &name)
7.181 {
7.182 - FlagObj *fo;
7.183 - for (fo=flag.first();fo; fo=flag.next() )
7.184 - {
7.185 - if (fo->getName()==name) return fo;
7.186 - }
7.187 + for (int i=0; i<flag.size(); ++i)
7.188 + if (flag.at(i)->getName()==name) return flag.at(i);
7.189 return NULL;
7.190 }
7.191
8.1 --- a/flagrowobj.h Mon Nov 20 12:12:05 2006 +0000
8.2 +++ b/flagrowobj.h Thu Nov 23 13:53:08 2006 +0000
8.3 @@ -2,8 +2,6 @@
8.4 #define FLAGROWOBJ_H
8.5
8.6 #include <QMainWindow>
8.7 -//Added by qt3to4:
8.8 -#include <Q3PtrList>
8.9
8.10 #include "mapobj.h"
8.11 #include "flagobj.h"
8.12 @@ -40,7 +38,7 @@
8.13 private:
8.14 FlagRowObj* parentRow; // look for flags in this row
8.15 FlagObj* findFlag (const QString&);
8.16 - Q3PtrList <FlagObj> flag;
8.17 + QList <FlagObj*> flag;
8.18 QToolBar *toolbar;
8.19 QString name;
8.20 bool showFlags; // FloatObjects want to hide their flags
9.1 --- a/headingobj.cpp Mon Nov 20 12:12:05 2006 +0000
9.2 +++ b/headingobj.cpp Thu Nov 23 13:53:08 2006 +0000
9.3 @@ -18,12 +18,13 @@
9.4
9.5 HeadingObj::~HeadingObj()
9.6 {
9.7 - textline.clear();
9.8 +// cout << "Destr. HeadingObj "<<heading.ascii()<<endl;
9.9 + while (!textline.isEmpty())
9.10 + delete textline.takeFirst();
9.11 }
9.12
9.13 void HeadingObj::init()
9.14 {
9.15 - textline.setAutoDelete (TRUE);
9.16 textwidth=40;
9.17 color=QColor ("black");
9.18 font=QFont();
9.19 @@ -46,15 +47,14 @@
9.20 int h; // height of a textline
9.21 int ho; // offset of height while drawing all lines
9.22
9.23 - if (textline.first() )
9.24 + if (!textline.isEmpty() )
9.25 h=textline.first()->boundingRect().height();
9.26 else
9.27 h=2;
9.28 - Q3CanvasText *t;
9.29 ho=0;
9.30 - for (t=textline.first(); t; t=textline.next() )
9.31 + for (int i=0; i<textline.size(); ++i)
9.32 {
9.33 - t->move(x,y+ho);
9.34 + textline.at(i)->move(x,y+ho);
9.35 ho=ho+h;
9.36 }
9.37 }
9.38 @@ -80,12 +80,11 @@
9.39 // then no selection would be visible, thus we prevent it in ::setText()
9.40 if (!textline.isEmpty() )
9.41 {
9.42 - Q3CanvasText *t;
9.43 - for (t=textline.first(); t; t=textline.next() )
9.44 + for (int i=0; i<textline.size(); ++i)
9.45 {
9.46 - h+=t->boundingRect().height();
9.47 - if (w<t->boundingRect().width() )
9.48 - w=t->boundingRect().width();
9.49 + h+=textline.at(i)->boundingRect().height();
9.50 + if (w<textline.at(i)->boundingRect().width() )
9.51 + w=textline.at(i)->boundingRect().width();
9.52 }
9.53 }
9.54 bbox.setSize (QSize(w,h));
9.55 @@ -109,7 +108,8 @@
9.56 heading=s;
9.57
9.58 // remove old textlines and prepare generating new ones
9.59 - textline.clear();
9.60 + while (!textline.isEmpty())
9.61 + delete textline.takeFirst();
9.62
9.63 // prevent empty textline, so at least a small selection stays
9.64 // visible for this heading
9.65 @@ -220,9 +220,8 @@
9.66 if (color!=c)
9.67 {
9.68 color=c;
9.69 - Q3CanvasText *t;
9.70 - for (t=textline.first(); t; t=textline.next() )
9.71 - t->setColor(c);
9.72 + for (int i=0; i<textline.size(); ++i)
9.73 + textline.at(i)->setColor(c);
9.74 }
9.75 }
9.76
9.77 @@ -234,12 +233,11 @@
9.78 void HeadingObj::setVisibility (bool v)
9.79 {
9.80 MapObj::setVisibility(v);
9.81 - Q3CanvasText *t;
9.82 - for (t=textline.first(); t; t=textline.next() )
9.83 + for (int i=0; i<textline.size(); ++i)
9.84 if (v)
9.85 - t->show();
9.86 + textline.at(i)->show();
9.87 else
9.88 - t->hide();
9.89 + textline.at(i)->hide();
9.90 }
9.91
9.92 int HeadingObj::getHeight ()
10.1 --- a/headingobj.h Mon Nov 20 12:12:05 2006 +0000
10.2 +++ b/headingobj.h Thu Nov 23 13:53:08 2006 +0000
10.3 @@ -2,8 +2,6 @@
10.4 #define HEADINGOBJ_H
10.5
10.6 #include "mapobj.h"
10.7 -//Added by qt3to4:
10.8 -#include <Q3PtrList>
10.9
10.10 class HeadingObj:public MapObj {
10.11 public:
10.12 @@ -32,7 +30,7 @@
10.13 protected:
10.14 QString heading;
10.15 int textwidth; // width for formatting text
10.16 - Q3PtrList <Q3CanvasText> textline; // a part of e.g. the parabel
10.17 + QList <Q3CanvasText*> textline; // a part of e.g. the parabel
10.18 QColor color;
10.19 QFont font;
10.20 };
11.1 --- a/linkablemapobj.cpp Mon Nov 20 12:12:05 2006 +0000
11.2 +++ b/linkablemapobj.cpp Thu Nov 23 13:53:08 2006 +0000
11.3 @@ -45,7 +45,7 @@
11.4 delete (l);
11.5 break;
11.6 case StyleParabel:
11.7 - segment.clear();
11.8 + while (!segment.isEmpty()) delete segment.takeFirst();
11.9 break;
11.10 case StylePolyLine:
11.11 delete (p);
11.12 @@ -53,7 +53,7 @@
11.13 break;
11.14 case StylePolyParabel:
11.15 delete (p);
11.16 - segment.clear();
11.17 + while (!segment.isEmpty()) delete segment.takeFirst();
11.18 break;
11.19 default:
11.20 break;
11.21 @@ -76,7 +76,6 @@
11.22 thickness_start=8;
11.23 style=StyleUndef;
11.24 linkpos=LinkBottom;
11.25 - segment.setAutoDelete (TRUE);
11.26 arcsegs=13;
11.27 Q3PointArray pa(arcsegs*2+2);
11.28
11.29 @@ -198,8 +197,7 @@
11.30
11.31 LinkStyle LinkableMapObj::getDefLinkStyle ()
11.32 {
11.33 - if (!mapEditor) return StyleUndef;
11.34 -
11.35 + if (mapEditor==0) return StyleUndef;
11.36 LinkStyle ls=mapEditor->getMapLinkStyle();
11.37 switch (ls)
11.38 {
11.39 @@ -257,7 +255,7 @@
11.40 {
11.41 cl = new Q3CanvasLine(canvas);
11.42 cl->setPen( QPen(linkcolor, 1) );
11.43 - cl->setPoints( 0,0,i*10,100);
11.44 + cl->setPoints( i*5,0,i*10,100);
11.45 cl->setZ(Z_LINK);
11.46 if (visible)
11.47 cl->show();
11.48 @@ -305,7 +303,7 @@
11.49 {
11.50 cl = new Q3CanvasLine(canvas);
11.51 cl->setPen( QPen(linkcolor, 1) );
11.52 - cl->setPoints( 0,0,i*10,100);
11.53 + cl->setPoints( 5*i,0,i*10,100);
11.54 cl->setZ(Z_LINK);
11.55 if (visible)
11.56 cl->show();
11.57 @@ -360,15 +358,14 @@
11.58 {
11.59 linkcolor=col;
11.60 bottomline->setPen( QPen(linkcolor, 1) );
11.61 - Q3CanvasLine *cl;
11.62 switch (style)
11.63 {
11.64 case StyleLine:
11.65 l->setPen( QPen(col,1));
11.66 break;
11.67 case StyleParabel:
11.68 - for (cl=segment.first(); cl; cl=segment.next() )
11.69 - cl->setPen( QPen(col,1));
11.70 + for (int i=0; i<segment.size(); ++i)
11.71 + segment.at(i)->setPen( QPen(col,1));
11.72 break;
11.73 case StylePolyLine:
11.74 p->setBrush( QBrush(col));
11.75 @@ -376,8 +373,8 @@
11.76 break;
11.77 case StylePolyParabel:
11.78 p->setBrush( QBrush(col));
11.79 - for (cl=segment.first(); cl; cl=segment.next() )
11.80 - cl->setPen( QPen(col,1));
11.81 + for (int i=0; i<segment.size(); ++i)
11.82 + segment.at(i)->setPen( QPen(col,1));
11.83 break;
11.84 default:
11.85 break;
11.86 @@ -412,7 +409,6 @@
11.87
11.88 void LinkableMapObj::setVisibility (bool v)
11.89 {
11.90 - Q3CanvasLine* cl;
11.91 MapObj::setVisibility (v);
11.92 bool visnow=visible;
11.93
11.94 @@ -429,16 +425,16 @@
11.95 if (l) l->show();
11.96 break;
11.97 case StyleParabel:
11.98 - for (cl=segment.first(); cl; cl=segment.next() )
11.99 - cl->show();
11.100 + for (int i=0; i<segment.size(); ++i)
11.101 + segment.at(i)->show();
11.102 break;
11.103 case StylePolyLine:
11.104 if (p) p->show();
11.105 if (l) l->show();
11.106 break;
11.107 case StylePolyParabel:
11.108 - for (cl=segment.first(); cl; cl=segment.next() )
11.109 - cl->show();
11.110 + for (int i=0; i<segment.size(); ++i)
11.111 + segment.at(i)->show();
11.112 if (p) p->show();
11.113 break;
11.114 default:
11.115 @@ -453,16 +449,16 @@
11.116 if (l) l->hide();
11.117 break;
11.118 case StyleParabel:
11.119 - for (cl=segment.first(); cl; cl=segment.next() )
11.120 - cl->hide();
11.121 + for (int i=0; i<segment.size(); ++i)
11.122 + segment.at(i)->hide();
11.123 break;
11.124 case StylePolyLine:
11.125 if (p) p->hide();
11.126 if (l) l->hide();
11.127 break;
11.128 case StylePolyParabel:
11.129 - for (cl=segment.first(); cl; cl=segment.next() )
11.130 - cl->hide();
11.131 + for (int i=0; i<segment.size(); ++i)
11.132 + segment.at(i)->hide();
11.133 if (p) p->hide();
11.134 break;
11.135 default:
11.136 @@ -562,10 +558,6 @@
11.137 // "turning point" for drawing polygonal links
11.138 QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));
11.139
11.140 - Q3CanvasLine *cl;
11.141 -
11.142 - int i;
11.143 -
11.144 // Draw the link
11.145 switch (style)
11.146 {
11.147 @@ -577,12 +569,8 @@
11.148 break;
11.149 case StyleParabel:
11.150 parabel (pa0, p1x,p1y,p2x,p2y);
11.151 - i=0;
11.152 - for (cl=segment.first(); cl; cl=segment.next() )
11.153 - {
11.154 - cl->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y());
11.155 - i++;
11.156 - }
11.157 + for (int i=0; i<segment.size(); ++i)
11.158 + segment.at(i)->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y());
11.159 break;
11.160 case StylePolyLine:
11.161 pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
11.162 @@ -598,19 +586,15 @@
11.163 case StylePolyParabel:
11.164 parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
11.165 parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
11.166 - for (i=0;i<=arcsegs;i++)
11.167 + for (int i=0;i<=arcsegs;i++)
11.168 {
11.169 // Combine the arrays to a single one
11.170 pa0[i]=pa1[i];
11.171 pa0[i+arcsegs+1]=pa2[arcsegs-i];
11.172 }
11.173 p->setPoints (pa0);
11.174 - i=0;
11.175 - for (cl=segment.first(); cl; cl=segment.next() )
11.176 - {
11.177 - cl->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y());
11.178 - i++;
11.179 - }
11.180 + for (int i=0; i<segment.size(); ++i)
11.181 + segment.at(i)->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y());
11.182 break;
11.183 default:
11.184 break;
11.185 @@ -646,7 +630,7 @@
11.186 break;
11.187 } else
11.188 if (typ=="bo:")
11.189 - lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
11.190 + lmo=((BranchObj*)(lmo))->getBranchNum (num.toInt());
11.191 else
11.192 if (typ=="fi:")
11.193 lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
12.1 --- a/linkablemapobj.h Mon Nov 20 12:12:05 2006 +0000
12.2 +++ b/linkablemapobj.h Thu Nov 23 13:53:08 2006 +0000
12.3 @@ -7,7 +7,6 @@
12.4 #include "flagrowobj.h"
12.5 //Added by qt3to4:
12.6 #include <Q3PointArray>
12.7 -#include <Q3PtrList>
12.8
12.9 #define MAX_DEPTH 999
12.10
12.11 @@ -121,7 +120,7 @@
12.12 Q3CanvasLine* l; // line style
12.13 Q3CanvasPolygon* p; // poly styles
12.14 int arcsegs; // arc: number of segments
12.15 - Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
12.16 + QList <Q3CanvasLine*> segment; // a part of e.g. the parabel
12.17 Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
12.18 Q3PointArray pa1; // For drawing of PolyParabel
12.19 Q3PointArray pa2; // For drawing of PolyParabel
13.1 --- a/main.cpp Mon Nov 20 12:12:05 2006 +0000
13.2 +++ b/main.cpp Thu Nov 23 13:53:08 2006 +0000
13.3 @@ -10,9 +10,9 @@
13.4 // Global variables
13.5 TextEditor *textEditor; // used in Constr. of LinkableMapObj
13.6 // initialized in mainwindow
13.7 -QString vymName(__VYM_NAME);
13.8 -QString vymVersion(__VYM_VERSION);
13.9 -QString vymBuildDate(__VYM_BUILD_DATE);
13.10 +QString vymName;
13.11 +QString vymVersion;
13.12 +QString vymBuildDate;
13.13
13.14 Main *mainWindow; // used in BranchObj::select()
13.15 QString tmpVymDir; // All temp files go there, created in mainwindow
13.16 @@ -40,6 +40,10 @@
13.17
13.18 QApplication app(argc,argv);
13.19
13.20 + vymName=__VYM_NAME;
13.21 + vymVersion=__VYM_VERSION;
13.22 + vymBuildDate=__VYM_BUILD_DATE;
13.23 +
13.24
13.25 // Reading and initializing options commandline options
13.26 options.add ("version", SwitchOption, "v","version");
14.1 --- a/mainwindow.cpp Mon Nov 20 12:12:05 2006 +0000
14.2 +++ b/mainwindow.cpp Thu Nov 23 13:53:08 2006 +0000
14.3 @@ -3161,7 +3161,6 @@
14.4 // updateActions is also called when NoteEditor is closed
14.5 actionViewToggleNoteEditor->setOn (textEditor->showWithMain());
14.6
14.7 - QAction *a;
14.8 if (me->getMapLinkColorHint()==HeadingColor)
14.9 actionFormatLinkColorHint->setOn(true);
14.10 else
14.11 @@ -3281,8 +3280,8 @@
14.12 actionEditPaste->setEnabled (true);
14.13 else
14.14 actionEditPaste->setEnabled (false);
14.15 - for (a=actionListBranches.first();a;a=actionListBranches.next())
14.16 - a->setEnabled(true);
14.17 + for (int i=0; i<actionListBranches.size(); ++i)
14.18 + actionListBranches.at(i)->setEnabled(true);
14.19 actionEditDelete->setEnabled (true);
14.20 switch (selection->getFrameType())
14.21 {
14.22 @@ -3317,8 +3316,8 @@
14.23 actionEditCopy->setEnabled (true);
14.24 actionEditCut->setEnabled (true);
14.25 actionEditPaste->setEnabled (false);
14.26 - for (a=actionListBranches.first();a;a=actionListBranches.next())
14.27 - a->setEnabled(false);
14.28 + for (int i=0; i<actionListBranches.size(); ++i)
14.29 + actionListBranches.at(i)->setEnabled(false);
14.30 actionEditDelete->setEnabled (true);
14.31 actionFormatHideLinkUnselected->setOn
14.32 ( selection->getHideLinkUnselected());
14.33 @@ -3331,8 +3330,8 @@
14.34 actionEditCopy->setEnabled (false);
14.35 actionEditCut->setEnabled (false);
14.36 actionEditPaste->setEnabled (false);
14.37 - for (a=actionListBranches.first();a;a=actionListBranches.next())
14.38 - a->setEnabled(false);
14.39 + for (int i=0; i<actionListBranches.size(); ++i)
14.40 + actionListBranches.at(i)->setEnabled(false);
14.41
14.42 actionEditToggleScroll->setEnabled (false);
14.43 actionEditOpenURL->setEnabled (false);
15.1 --- a/mainwindow.h Mon Nov 20 12:12:05 2006 +0000
15.2 +++ b/mainwindow.h Thu Nov 23 13:53:08 2006 +0000
15.3 @@ -197,7 +197,7 @@
15.4
15.5 HistoryWindow *historyWindow;
15.6
15.7 - Q3PtrList <QAction> actionListBranches;
15.8 + QList <QAction*> actionListBranches;
15.9
15.10 QColor currentColor;
15.11
16.1 --- a/mapcenterobj.cpp Mon Nov 20 12:12:05 2006 +0000
16.2 +++ b/mapcenterobj.cpp Thu Nov 23 13:53:08 2006 +0000
16.3 @@ -1,4 +1,4 @@
16.4 -#include <qdatetime.h>
16.5 +#include <QDateTime>
16.6
16.7 #include "mapcenterobj.h"
16.8 #include "floatimageobj.h"
16.9 @@ -20,7 +20,7 @@
16.10
16.11 MapCenterObj::~MapCenterObj()
16.12 {
16.13 -// cout << "Destr MapCenterObj\n";
16.14 + cout << "Destr MapCenterObj\n";
16.15 }
16.16
16.17 void MapCenterObj::clear()
16.18 @@ -74,9 +74,8 @@
16.19 childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
16.20 childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
16.21 parPos=childPos;
16.22 - BranchObj *b;
16.23 - for (b=branch.first(); b; b=branch.next() )
16.24 - b->updateLink();
16.25 + for (int i=0; i<branch.size(); ++i)
16.26 + branch.at(i)->updateLink();
16.27 }
16.28
16.29 void MapCenterObj::updateRelPositions()
16.30 @@ -84,11 +83,10 @@
16.31 if (repositionRequest) unsetAllRepositionRequests();
16.32
16.33 // update relative Positions of branches and floats
16.34 - BranchObj *b;
16.35 - for (b=branch.first(); b; b=branch.next() )
16.36 + for (int i=0; i<branch.size(); ++i)
16.37 {
16.38 - b->setRelPos();
16.39 - b->setOrientation();
16.40 + branch.at(i)->setRelPos();
16.41 + branch.at(i)->setOrientation();
16.42 }
16.43
16.44 for (int i=0; i<floatimage.size(); ++i)
16.45 @@ -99,13 +97,12 @@
16.46
16.47 LinkableMapObj* MapCenterObj::findMapObj(QPoint p, LinkableMapObj *excludeLMO)
16.48 {
16.49 - BranchObj *bo;
16.50 LinkableMapObj *lmo;
16.51
16.52 // Search through child branches
16.53 - for (bo=branch.first(); bo; bo=branch.next() )
16.54 + for (int i=0; i<branch.size(); ++i)
16.55 {
16.56 - lmo = bo->findMapObj(p, excludeLMO);
16.57 + lmo = branch.at(i)->findMapObj(p, excludeLMO);
16.58 if (lmo!= NULL) return lmo;
16.59 }
16.60 // is p in MapCenter?
16.61 @@ -161,18 +158,16 @@
16.62 s+=note.saveToDir();
16.63
16.64 // Save branches
16.65 - BranchObj *bo;
16.66 - for (bo=branch.first(); bo; bo=branch.next() )
16.67 - s+=bo->saveToDir(tmpdir,prefix, offset);
16.68 + for (int i=0; i<branch.size(); ++i)
16.69 + s+=branch.at(i)->saveToDir(tmpdir,prefix, offset);
16.70
16.71 // Save FloatImages
16.72 for (int i=0; i<floatimage.size(); ++i)
16.73 s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
16.74
16.75 // Save XLinks
16.76 - XLinkObj *xlo;
16.77 - for (xlo=xlink.first(); xlo; xlo=xlink.next() )
16.78 - s+=xlo->saveToDir();
16.79 + for (int i=0;i<xlink.size(); ++i)
16.80 + s+=xlink.at(i)->saveToDir();
16.81
16.82 decIndent();
16.83 s+=endElement ("mapcenter");
17.1 --- a/mapeditor.cpp Mon Nov 20 12:12:05 2006 +0000
17.2 +++ b/mapeditor.cpp Thu Nov 23 13:53:08 2006 +0000
17.3 @@ -1,8 +1,6 @@
17.4 #include "mapeditor.h"
17.5
17.6 -#include <q3dragobject.h>
17.7 -#include <q3urloperator.h>
17.8 -#include <q3networkprotocol.h>
17.9 +//#include <q3urloperator.h>
17.10 #include <q3paintdevicemetrics.h>
17.11 #include <q3filedialog.h>
17.12
17.13 @@ -310,6 +308,7 @@
17.14 standardFlagsDefault->resetUsedCounter();
17.15
17.16 // Reset the counters before saving
17.17 + // TODO constr. of FIO creates lots of objects, better do this in some other way...
17.18 FloatImageObj (mapCanvas).resetSaveCounter();
17.19
17.20 // Build xml recursivly
17.21 @@ -3986,50 +3985,68 @@
17.22
17.23 void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event)
17.24 {
17.25 -
17.26 -// for (unsigned int i=0;event->format(i);i++) // Debug mime type
17.27 -// cerr << event->format(i) << endl;
17.28 -
17.29 - if (selection &&
17.30 - (typeid(*selection) == typeid(BranchObj)) ||
17.31 - (typeid(*selection) == typeid(MapCenterObj))) {
17.32 -
17.33 - // If QImageDrag can decode mime type
17.34 - if (Q3ImageDrag::canDecode(event)) {
17.35 - event->accept();
17.36 - return;
17.37 - }
17.38 -
17.39 - // If image are dragged from firefox
17.40 - if (event->provides("application/x-moz-file-promise-url") &&
17.41 - event->provides("application/x-moz-nativeimage")) {
17.42 - event->accept(true);
17.43 - return;
17.44 - }
17.45 -
17.46 - // If QUriDrag can decode mime type
17.47 - if (Q3UriDrag::canDecode(event)) {
17.48 - event->accept();
17.49 - return;
17.50 - }
17.51 -
17.52 + if (selection &&
17.53 + (typeid(*selection) == typeid(BranchObj)) ||
17.54 + (typeid(*selection) == typeid(MapCenterObj)))
17.55 + {
17.56 + if (event->mimeData()->hasFormat("image/png"))
17.57 + {
17.58 + cout <<"found png in dragenterevent\n";
17.59 + event->accept();
17.60 + return;
17.61 + }
17.62 +
17.63 + if (event->mimeData()->hasFormat("text/uri-list"))
17.64 + {
17.65 + cout <<"found uri-list in dragenterevent\n";
17.66 + event->accept();
17.67 + return;
17.68 + }
17.69 +
17.70 +/*
17.71 + // If QImageDrag can decode mime type
17.72 + if (Q3ImageDrag::canDecode(event))
17.73 + {
17.74 + cout << "dragenterevent q3imagedrag\n";
17.75 + event->accept();
17.76 + return;
17.77 + }
17.78 +*/
17.79 + // If image are dragged from firefox
17.80 + if (event->mimeData()->hasFormat("application/x-moz-file-promise-url") &&
17.81 + event->mimeData()->hasFormat("application/x-moz-nativeimage")) {
17.82 + event->accept(true);
17.83 + cout << "dragenterevent firefox\n";
17.84 + return;
17.85 + }
17.86 +/*
17.87 + // If QUriDrag can decode mime type
17.88 + if (Q3UriDrag::canDecode(event)) {
17.89 + event->accept();
17.90 + cout << "accepted uri drag\n";
17.91 + return;
17.92 + }
17.93 // If Uri are dragged from firefox
17.94 - if (event->provides("_NETSCAPE_URL")){
17.95 - event->accept();
17.96 - return;
17.97 - }
17.98 -
17.99 - // If QTextDrag can decode mime type
17.100 - if (Q3TextDrag::canDecode(event)) {
17.101 - event->accept();
17.102 - return;
17.103 - }
17.104 -
17.105 - }
17.106 - event->ignore();
17.107 + if (event->provides("_NETSCAPE_URL")){
17.108 + event->accept();
17.109 + cout << "dragenterevent NETSCAPE\n";
17.110 + return;
17.111 + }
17.112 +
17.113 + // If QTextDrag can decode mime type
17.114 + if (Q3TextDrag::canDecode(event)) {
17.115 + event->accept();
17.116 + cout << "dragenterevent textdrag\n";
17.117 + return;
17.118 + }
17.119 +*/
17.120 + }
17.121 + event->ignore();
17.122 }
17.123
17.124 -bool isUnicode16(const QByteArray &d)
17.125 +
17.126 +
17.127 +/* FIXME needed in QT4? bool isUnicode16(const QByteArray &d)
17.128 {
17.129 // TODO: make more precise check for unicode 16.
17.130 // Guess unicode16 if any of second bytes are zero
17.131 @@ -4038,7 +4055,8 @@
17.132 if (d.at(i*2+1)==0) return true;
17.133 return false;
17.134 }
17.135 -
17.136 +*/
17.137 +
17.138 void MapEditor::contentsDropEvent(QDropEvent *event)
17.139 {
17.140 if (selection &&
17.141 @@ -4046,32 +4064,30 @@
17.142 (typeid(*selection) == typeid(MapCenterObj)))
17.143 {
17.144 bool update=false;
17.145 - Q3StrList uris;
17.146 + QStringList uris;
17.147 + QList <QUrl> urls;
17.148 QString heading;
17.149 - if (event->provides("image/png"))
17.150 +
17.151 +
17.152 + if (event->mimeData()->hasFormat("image/png"))
17.153 {
17.154 - QPixmap pix;
17.155 - if (Q3ImageDrag::decode(event, pix))
17.156 - {
17.157 - addFloatImageInt(pix);
17.158 - event->accept();
17.159 - update=true;
17.160 - } else
17.161 - event->ignore();
17.162 -
17.163 - } else if (event->provides("application/x-moz-file-promise-url") &&
17.164 - event->provides("application/x-moz-nativeimage"))
17.165 + event->acceptProposedAction();
17.166 + addFloatImageInt(event->mimeData()->imageData().value<QPixmap>());
17.167 + cout << "Drop png...\n";
17.168 + } else if (event->mimeData()->hasFormat("application/x-moz-file-promise-url")&&
17.169 + event->mimeData()->hasFormat("application/x-moz-nativeimage"))
17.170 {
17.171 + cout << "Drop Mozilla...\n";
17.172 // Contains url to the img src in unicode16
17.173 QByteArray d = event->encodedData("application/x-moz-file-promise-url");
17.174 QString url = QString((const QChar*)d.data(),d.size()/2);
17.175 fetchImage(url);
17.176 - event->accept();
17.177 + event->acceptProposedAction();
17.178 update=true;
17.179 - } else if (event->provides ("text/uri-list"))
17.180 - { // Uris provided e.g. by konqueror
17.181 - Q3UriDrag::decode (event,uris);
17.182 - } else if (event->provides ("_NETSCAPE_URL"))
17.183 + } else if (event->mimeData()->hasUrls())
17.184 + {
17.185 + urls=event->mimeData()->urls();
17.186 + } /*else if (event->provides ("_NETSCAPE_URL"))
17.187 { // Uris provided by Mozilla
17.188 QStringList l = QStringList::split("\n", event->encodedData("_NETSCAPE_URL"));
17.189 uris.append(l[0]);
17.190 @@ -4104,7 +4120,13 @@
17.191 event->accept();
17.192 update= true;
17.193 }
17.194 -
17.195 + */
17.196 +
17.197 + for (int i=0; i<urls.size(); ++i)
17.198 + {
17.199 + cout << "Found URL: "<<urls.at(i).toString().ascii()<<endl;
17.200 + }
17.201 + /* FIXME not ported yet QSTRINGLIST has no next...
17.202 if (uris.count()>0)
17.203 {
17.204 QStringList files;
17.205 @@ -4140,7 +4162,7 @@
17.206 }
17.207 update=true;
17.208 }
17.209 -
17.210 + */
17.211 if (update)
17.212 {
17.213 //FIXME saveState has to be called earlier for each of the drops...
17.214 @@ -4159,6 +4181,7 @@
17.215 (typeid(*selection) == typeid(MapCenterObj)) )
17.216 {
17.217 BranchObj *bo=((BranchObj*)selection);
17.218 + qWarning ("Warning: Image added by drop event: no undo/redo so far.");
17.219 //FIXME XXX saveStateChangingPart(selection,QString("Add floatimage to %1").arg(getName(bo)));
17.220 //QString fn=fd->selectedFile();
17.221 //lastImageDir=fn.left(fn.findRev ("/"));
18.1 --- a/mapeditor.h Mon Nov 20 12:12:05 2006 +0000
18.2 +++ b/mapeditor.h Thu Nov 23 13:53:08 2006 +0000
18.3 @@ -190,7 +190,7 @@
18.4 virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
18.5 virtual void contentsMouseMoveEvent(QMouseEvent*);
18.6
18.7 - virtual void contentsDragEnterEvent(QDragEnterEvent *event);
18.8 + virtual void contentsDragEnterEvent(QDragEnterEvent *event);
18.9 virtual void contentsDropEvent(QDropEvent *event);
18.10 private:
18.11 Q3Canvas* mapCanvas;
19.1 --- a/selection.h Mon Nov 20 12:12:05 2006 +0000
19.2 +++ b/selection.h Thu Nov 23 13:53:08 2006 +0000
19.3 @@ -1,8 +1,6 @@
19.4 #ifndef SELECTION_H
19.5 #define SELECTION_H
19.6
19.7 -#include <q3ptrlist.h>
19.8 -
19.9 #include "linkablemapobj.h"
19.10 #include "mapcenterobj.h"
19.11
20.1 --- a/version.h Mon Nov 20 12:12:05 2006 +0000
20.2 +++ b/version.h Thu Nov 23 13:53:08 2006 +0000
20.3 @@ -5,7 +5,7 @@
20.4
20.5 #define __VYM_NAME "VYM"
20.6 #define __VYM_VERSION "1.8.59"
20.7 -#define __VYM_BUILD_DATE "November 20, 2006"
20.8 +#define __VYM_BUILD_DATE "November 23, 2006"
20.9
20.10
20.11 bool checkVersion(const QString &);
21.1 --- a/vym.pro Mon Nov 20 12:12:05 2006 +0000
21.2 +++ b/vym.pro Thu Nov 23 13:53:08 2006 +0000
21.3 @@ -3,7 +3,7 @@
21.4
21.5 CONFIG += qt warn_on release
21.6 CONFIG += x86 ppc
21.7 -ICON =vym.icns
21.8 +ICON =icons/vym.icns
21.9
21.10 QT += qt3support
21.11
22.1 --- a/xlinkobj.cpp Mon Nov 20 12:12:05 2006 +0000
22.2 +++ b/xlinkobj.cpp Thu Nov 23 13:53:08 2006 +0000
22.3 @@ -26,7 +26,7 @@
22.4
22.5 XLinkObj::~XLinkObj ()
22.6 {
22.7 - // cout << "Destr XLinkObj\n";
22.8 +// cout << "Destr XLinkObj\n";
22.9 if (xLinkState!=undefinedXLink)
22.10 deactivate();
22.11 delete (line);
23.1 --- a/xml.cpp Mon Nov 20 12:12:05 2006 +0000
23.2 +++ b/xml.cpp Thu Nov 23 13:53:08 2006 +0000
23.3 @@ -636,13 +636,13 @@
23.4 }
23.5
23.6 if (!a.value( "beginBranch").isEmpty() )
23.7 - {
23.8 + {
23.9 if (!a.value( "endBranch").isEmpty() )
23.10 {
23.11 LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
23.12 if (lmo && typeid (*lmo)==typeid (BranchObj))
23.13 {
23.14 - xlo->setBegin ((BranchObj*)(lmo));
23.15 + xlo->setBegin ((BranchObj*)lmo);
23.16 lmo=mc->findObjBySelect (a.value( "endBranch"));
23.17 if (lmo && typeid (*lmo)==typeid (BranchObj))
23.18 {