1.1 --- a/branchobj.cpp Thu Nov 23 16:18:26 2006 +0000
1.2 +++ b/branchobj.cpp Fri Dec 08 20:18:56 2006 +0000
1.3 @@ -37,25 +37,25 @@
1.4 depth=-1;
1.5 }
1.6
1.7 -BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c)
1.8 +BranchObj::BranchObj (QGraphicsScene* s):OrnamentedObj (s)
1.9 {
1.10 -// cout << "Const BranchObj (c) called from MapCenterObj (c)\n";
1.11 +// cout << "Const BranchObj (s) called from MapCenterObj (s)\n";
1.12 parObj=NULL;
1.13 - canvas=c;
1.14 + scene=s;
1.15 }
1.16
1.17 -BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
1.18 +BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)
1.19 {
1.20 -// cout << "Const BranchObj (c,p)\n";
1.21 - canvas=c;
1.22 +// cout << "Const BranchObj (s,p)\n";
1.23 + scene=s;
1.24 setParObj (p);
1.25 depth=p->getDepth()+1;
1.26 if (depth==1)
1.27 // Calc angle to mapCenter if I am a mainbranch
1.28 // needed for reordering the mainbranches clockwise
1.29 // around mapcenter
1.30 - angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1.31 - (int)(y() - parObj->getChildPos().y() ) ) );
1.32 + angle=getAngle (QPointF (x() - parObj->getChildPos().x() ,
1.33 + (y() - parObj->getChildPos().y() ) ) );
1.34 init();
1.35 }
1.36
1.37 @@ -93,7 +93,7 @@
1.38 absPos+=parObj->getChildPos();
1.39 }
1.40
1.41 - lastSelectedBranch=-1;
1.42 + lastSelectedBranch=0;
1.43
1.44 setChildObj(this);
1.45
1.46 @@ -171,7 +171,7 @@
1.47 return xlink.count();
1.48 }
1.49
1.50 -void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
1.51 +void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPointF m, int off)
1.52 {
1.53 // Temporary link to lmo
1.54 // m is position of mouse pointer
1.55 @@ -202,17 +202,17 @@
1.56 if (depth==1)
1.57 { // new parent is the mapcenter itself
1.58
1.59 - QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
1.60 + QPointF p= normalise ( QPointF (m.x() - o->getChildPos().x(),
1.61 m.y() - o->getChildPos().y() ));
1.62 if (p.x()<0) p.setX( p.x()-bbox.width() );
1.63 move2RelPos (p);
1.64 } else
1.65 {
1.66 - int y;
1.67 + qreal y;
1.68 if (off==0)
1.69 {
1.70 // new parent is just a branch, link to it
1.71 - QRect t=o->getBBoxSizeWithChilds();
1.72 + QRectF t=o->getBBoxSizeWithChilds();
1.73 if (o->getLastBranch())
1.74 y=t.y() + t.height() ;
1.75 else
1.76 @@ -547,7 +547,7 @@
1.77 positionBBox();
1.78 }
1.79
1.80 -void BranchObj::move (QPoint p)
1.81 +void BranchObj::move (QPointF p)
1.82 {
1.83 move (p.x(), p.y());
1.84 }
1.85 @@ -560,7 +560,7 @@
1.86 positionBBox();
1.87 }
1.88
1.89 -void BranchObj::moveBy (QPoint p)
1.90 +void BranchObj::moveBy (QPointF p)
1.91 {
1.92 moveBy (p.x(), p.y());
1.93 }
1.94 @@ -568,13 +568,13 @@
1.95
1.96 void BranchObj::positionBBox()
1.97 {
1.98 - QPoint ap=getAbsPos();
1.99 + QPointF ap=getAbsPos();
1.100 bbox.moveTopLeft (ap);
1.101 positionContents();
1.102 setSelBox();
1.103
1.104 // set the frame
1.105 - frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1.106 + frame->setRect(QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1.107
1.108 // Update links to other branches
1.109 for (int i=0; i<xlink.size(); ++i)
1.110 @@ -583,17 +583,17 @@
1.111
1.112 void BranchObj::calcBBoxSize()
1.113 {
1.114 - QSize heading_r=heading->getSize();
1.115 - int heading_w=(int) heading_r.width() ;
1.116 - int heading_h=(int) heading_r.height() ;
1.117 - QSize sysflags_r=systemFlags->getSize();
1.118 - int sysflags_h=sysflags_r.height();
1.119 - int sysflags_w=sysflags_r.width();
1.120 - QSize stanflags_r=standardFlags->getSize();
1.121 - int stanflags_h=stanflags_r.height();
1.122 - int stanflags_w=stanflags_r.width();
1.123 - int w;
1.124 - int h;
1.125 + QSizeF heading_r=heading->getSize();
1.126 + qreal heading_w=(qreal) heading_r.width() ;
1.127 + qreal heading_h=(qreal) heading_r.height() ;
1.128 + QSizeF sysflags_r=systemFlags->getSize();
1.129 + qreal sysflags_h=sysflags_r.height();
1.130 + qreal sysflags_w=sysflags_r.width();
1.131 + QSizeF stanflags_r=standardFlags->getSize();
1.132 + qreal stanflags_h=stanflags_r.height();
1.133 + qreal stanflags_w=stanflags_r.width();
1.134 + qreal w;
1.135 + qreal h;
1.136
1.137 // set width to sum of all widths
1.138 w=heading_w + sysflags_w + stanflags_w;
1.139 @@ -602,13 +602,13 @@
1.140 h=max (h,heading_h);
1.141
1.142 // Save the dimension of flags and heading
1.143 - ornamentsBBox.setSize ( QSize(w,h));
1.144 + ornamentsBBox.setSize ( QSizeF(w,h));
1.145
1.146 // clickBox includes Flags and Heading
1.147 clickBox.setSize (ornamentsBBox.size() );
1.148
1.149 // Floatimages
1.150 - QPoint rp;
1.151 + QPointF rp;
1.152
1.153 topPad=botPad=leftPad=rightPad=0;
1.154 if (includeImagesVer || includeImagesHor)
1.155 @@ -652,7 +652,7 @@
1.156 h+=frame->getBorder();
1.157
1.158 // Finally set size
1.159 - bbox.setSize (QSize (w,h));
1.160 + bbox.setSize (QSizeF (w,h));
1.161 }
1.162
1.163 void BranchObj::setDockPos()
1.164 @@ -660,16 +660,16 @@
1.165 // Sets childpos and parpos depending on orientation
1.166 if (getOrientation()==OrientLeftOfCenter )
1.167 {
1.168 - childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
1.169 - parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
1.170 + childPos=QPointF (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
1.171 + parPos=QPointF (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
1.172 } else
1.173 {
1.174 - childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
1.175 - parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
1.176 + childPos=QPointF (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
1.177 + parPos=QPointF (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
1.178 }
1.179 }
1.180
1.181 -LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
1.182 +LinkableMapObj* BranchObj::findMapObj(QPointF p, LinkableMapObj* excludeLMO)
1.183 {
1.184 // Search branches
1.185 LinkableMapObj *lmo;
1.186 @@ -735,7 +735,7 @@
1.187 return false;
1.188 }
1.189
1.190 -QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
1.191 +QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
1.192 {
1.193 if (hidden) return "";
1.194
1.195 @@ -757,10 +757,10 @@
1.196 if (!((BranchObj*)(parObj))->isScrolled() )
1.197 {
1.198 areaAttr=
1.199 - attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
1.200 - attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
1.201 - attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
1.202 - attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
1.203 + attribut("x1",QString().setNum(absPos.x()-offset.x())) +
1.204 + attribut("y1",QString().setNum(absPos.y()-offset.y())) +
1.205 + attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
1.206 + attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
1.207
1.208 } else
1.209 areaAttr="";
1.210 @@ -913,7 +913,7 @@
1.211
1.212 FloatImageObj* BranchObj::addFloatImage ()
1.213 {
1.214 - FloatImageObj *newfi=new FloatImageObj (canvas,this);
1.215 + FloatImageObj *newfi=new FloatImageObj (scene,this);
1.216 floatimage.append (newfi);
1.217 if (hasScrolledParent(this) )
1.218 newfi->setVisibility (false);
1.219 @@ -929,7 +929,7 @@
1.220
1.221 FloatImageObj* BranchObj::addFloatImage (FloatImageObj *fio)
1.222 {
1.223 - FloatImageObj *newfi=new FloatImageObj (canvas,this);
1.224 + FloatImageObj *newfi=new FloatImageObj (scene,this);
1.225 floatimage.append (newfi);
1.226 newfi->copy (fio);
1.227 if (hasScrolledParent(this) )
1.228 @@ -1000,7 +1000,7 @@
1.229
1.230 BranchObj* BranchObj::addBranch()
1.231 {
1.232 - BranchObj* newbo=new BranchObj(canvas,this);
1.233 + BranchObj* newbo=new BranchObj(scene,this);
1.234 branch.append (newbo);
1.235 newbo->setParObj(this);
1.236 newbo->setDefAttr(NewBranch);
1.237 @@ -1016,7 +1016,7 @@
1.238
1.239 BranchObj* BranchObj::addBranch(BranchObj* bo)
1.240 {
1.241 - BranchObj* newbo=new BranchObj(canvas,this);
1.242 + BranchObj* newbo=new BranchObj(scene,this);
1.243 branch.append (newbo);
1.244 newbo->copy(bo);
1.245 newbo->setParObj(this);
1.246 @@ -1129,22 +1129,25 @@
1.247
1.248 BranchObj* BranchObj::getLastSelectedBranch ()
1.249 {
1.250 - if (lastSelectedBranch>=0)
1.251 - {
1.252 - BranchObj* bo=branch.at(lastSelectedBranch);
1.253 - if (bo) return bo;
1.254 - }
1.255 - return branch.first();
1.256 + if (lastSelectedBranch>=0 && branch.size()>0)
1.257 + return branch.at(lastSelectedBranch);
1.258 + return NULL;
1.259 }
1.260
1.261 BranchObj* BranchObj::getFirstBranch ()
1.262 {
1.263 - return branch.first();
1.264 + if (branch.size()>0)
1.265 + return branch.first();
1.266 + else
1.267 + return NULL;
1.268 }
1.269
1.270 BranchObj* BranchObj::getLastBranch ()
1.271 {
1.272 - return branch.last();
1.273 + if (branch.size()>0)
1.274 + return branch.last();
1.275 + else
1.276 + return NULL;
1.277 }
1.278
1.279 BranchObj* BranchObj::getBranchNum (int i)
1.280 @@ -1238,9 +1241,9 @@
1.281 }
1.282 }
1.283
1.284 -void BranchObj::alignRelativeTo (QPoint ref)
1.285 +void BranchObj::alignRelativeTo (QPointF ref)
1.286 {
1.287 - int th = bboxTotal.height();
1.288 + qreal th = bboxTotal.height();
1.289 // TODO testing
1.290 /*
1.291 cout << "BO::alignRelTo "<<getHeading().ascii()<<endl;
1.292 @@ -1269,7 +1272,7 @@
1.293 // Calc angle to mapCenter if I am a mainbranch
1.294 // needed for reordering the mainbranches clockwise
1.295 // around mapcenter
1.296 - angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ),
1.297 + angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ),
1.298 (int)(y() - parObj->getChildPos().y() ) ) );
1.299 }
1.300 }
1.301 @@ -1296,7 +1299,7 @@
1.302 if (scrolled) return;
1.303
1.304 // Set reference point for alignment of childs
1.305 - QPoint ref2;
1.306 + QPointF ref2;
1.307 if (orientation==OrientLeftOfCenter)
1.308 ref2.setX(bbox.topLeft().x() - linkwidth);
1.309 else
1.310 @@ -1336,11 +1339,11 @@
1.311 // changes its height,
1.312 // all upper LMOs have to change, too.
1.313 calcBBoxSizeWithChilds();
1.314 - updateLink(); // This update is needed if the canvas is resized
1.315 + updateLink(); // This update is needed if the scene is resized
1.316 // due to excessive moving of a FIO
1.317 // FIXME really needed? reposition is also called from updateLink...
1.318
1.319 - alignRelativeTo ( QPoint (absPos.x(),
1.320 + alignRelativeTo ( QPointF (absPos.x(),
1.321 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.322 //FIXME branch.sort();
1.323 positionBBox(); // Reposition bbox and contents
1.324 @@ -1348,7 +1351,7 @@
1.325 {
1.326 // This is only important for moving branches:
1.327 // For editing a branch it isn't called...
1.328 - alignRelativeTo ( QPoint (absPos.x(),
1.329 + alignRelativeTo ( QPointF (absPos.x(),
1.330 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
1.331 }
1.332 }
1.333 @@ -1361,9 +1364,9 @@
1.334 }
1.335
1.336
1.337 -QRect BranchObj::getTotalBBox()
1.338 +QRectF BranchObj::getTotalBBox()
1.339 {
1.340 - QRect r=bbox;
1.341 + QRectF r=bbox;
1.342
1.343 if (scrolled) return r;
1.344
1.345 @@ -1378,7 +1381,7 @@
1.346 return r;
1.347 }
1.348
1.349 -QRect BranchObj::getBBoxSizeWithChilds()
1.350 +QRectF BranchObj::getBBoxSizeWithChilds()
1.351 {
1.352 return bboxTotal;
1.353 }
1.354 @@ -1419,8 +1422,8 @@
1.355 return;
1.356 }
1.357
1.358 - QRect r(0,0,0,0);
1.359 - QRect br;
1.360 + QRectF r(0,0,0,0);
1.361 + QRectF br;
1.362 // Now calculate recursivly
1.363 // sum of heights
1.364 // maximum of widths
2.1 --- a/branchobj.h Thu Nov 23 16:18:26 2006 +0000
2.2 +++ b/branchobj.h Fri Dec 08 20:18:56 2006 +0000
2.3 @@ -14,8 +14,8 @@
2.4 class BranchObj:public OrnamentedObj {
2.5 public:
2.6 BranchObj ();
2.7 - BranchObj (Q3Canvas*);
2.8 - BranchObj (Q3Canvas*, LinkableMapObj* parent);
2.9 + BranchObj (QGraphicsScene*);
2.10 + BranchObj (QGraphicsScene*, LinkableMapObj* parent);
2.11 ~BranchObj ();
2.12 bool operator< ( const BranchObj & );
2.13 bool operator== ( const BranchObj & );
2.14 @@ -28,7 +28,7 @@
2.15 virtual int countBranches();
2.16 virtual int countFloatImages();
2.17 virtual int countXLinks();
2.18 - virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
2.19 + virtual void setParObjTmp (LinkableMapObj*,QPointF,int);// Only for moving Obj around
2.20 virtual void unsetParObjTmp(); // reuse original ParObj
2.21
2.22 virtual void unScroll();
2.23 @@ -50,19 +50,19 @@
2.24
2.25 virtual void positionContents();
2.26 virtual void move (double x,double y);
2.27 - virtual void move (QPoint);
2.28 + virtual void move (QPointF);
2.29 virtual void moveBy (double x,double y);
2.30 - virtual void moveBy (QPoint);
2.31 + virtual void moveBy (QPointF);
2.32 virtual void positionBBox();
2.33 virtual void calcBBoxSize();
2.34 virtual void setDockPos();
2.35 - virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
2.36 + virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
2.37 virtual void setHeading (QString);
2.38
2.39 virtual void setHideTmp (HideTmpMode);
2.40 virtual bool hasHiddenExportParent (BranchObj*);
2.41
2.42 - virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
2.43 + virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
2.44 virtual void addXLink (XLinkObj*);
2.45 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
2.46 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
2.47 @@ -105,12 +105,12 @@
2.48 virtual bool canMoveBranchDown();
2.49 virtual BranchObj* moveBranchDown(BranchObj*);
2.50 virtual BranchObj* moveBranchTo (BranchObj*, int);
2.51 - virtual void alignRelativeTo(const QPoint );
2.52 + virtual void alignRelativeTo(const QPointF );
2.53 virtual void reposition();
2.54 virtual void unsetAllRepositionRequests();
2.55
2.56 - virtual QRect getTotalBBox(); // return BBox including childs
2.57 - virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
2.58 + virtual QRectF getTotalBBox(); // return BBox including childs
2.59 + virtual QRectF getBBoxSizeWithChilds(); // return size of BBox including childs
2.60 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
2.61
2.62 virtual void select();
3.1 Binary file demos/todo.vym has changed
4.1 --- a/exportxhtmldialog.cpp Thu Nov 23 16:18:26 2006 +0000
4.2 +++ b/exportxhtmldialog.cpp Fri Dec 08 20:18:56 2006 +0000
4.3 @@ -386,17 +386,16 @@
4.4 spath.replace ("%f",fpath);
4.5 QStringList args=QStringList::split (' ',spath,false);
4.6
4.7 - scriptProc->clearArguments();
4.8 - scriptProc->setArguments (args);
4.9 - p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") );
4.10 - if (!scriptProc->start() )
4.11 + p.addOutput ("vym is executing: \n" + spath+" "+args.join(" ") );
4.12 + scriptProc->start (spath,args);
4.13 + if (!scriptProc->waitForStarted() )
4.14 {
4.15 QMessageBox::critical( 0, tr( "Critical Error" ),
4.16 tr("Could not start %1").arg(spath) );
4.17 } else
4.18 {
4.19 scriptProc->waitFinished();
4.20 - if (!scriptProc->normalExit() )
4.21 + if (scriptProc->exitStatus()!=QProcess::NormalExit )
4.22 QMessageBox::critical( 0, tr( "Critical Error" ),
4.23 tr("%1 didn't exit normally").arg(spath) +
4.24 scriptProc->getErrout() );
5.1 --- a/file.cpp Thu Nov 23 16:18:26 2006 +0000
5.2 +++ b/file.cpp Fri Dec 08 20:18:56 2006 +0000
5.3 @@ -1,6 +1,4 @@
5.4 -#include <qobject.h>
5.5 -#include <qmessagebox.h>
5.6 -//Added by qt3to4:
5.7 +#include <QMessageBox>
5.8 #include <QPixmap>
5.9 #include <QLabel>
5.10 #include <QTextStream>
5.11 @@ -141,15 +139,15 @@
5.12 ErrorCode err=success;
5.13
5.14 // zip the temporary directory
5.15 + QStringList args;
5.16 Process *zipProc=new Process ();
5.17 - zipProc->clearArguments();
5.18 - zipProc->setWorkingDirectory (QDir(zipDir));
5.19 - zipProc->addArgument ("zip");
5.20 - zipProc->addArgument ("-r");
5.21 - zipProc->addArgument (zipName);
5.22 - zipProc->addArgument (".");
5.23 + zipProc->setWorkingDirectory (zipDir.path());
5.24 + args <<"-r";
5.25 + args <<zipName;
5.26 + args <<".";
5.27
5.28 - if (!zipProc->start() )
5.29 + zipProc->start ("zip",args);
5.30 + if (!zipProc->waitForStarted() )
5.31 {
5.32 // zip could not be started
5.33 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
5.34 @@ -158,8 +156,8 @@
5.35 } else
5.36 {
5.37 // zip could be started
5.38 - zipProc->waitFinished();
5.39 - if (!zipProc->normalExit() )
5.40 + zipProc->waitForFinished();
5.41 + if (zipProc->exitStatus()!=QProcess::NormalExit )
5.42 {
5.43 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
5.44 QObject::tr("zip didn't exit normally")+
5.45 @@ -167,10 +165,10 @@
5.46 err=aborted;
5.47 } else
5.48 {
5.49 - if (zipProc->exitStatus()>0)
5.50 + if (zipProc->exitCode()>0)
5.51 {
5.52 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
5.53 - QString("zip exit code: %1").arg(zipProc->exitStatus() )+
5.54 + QString("zip exit code: %1").arg(zipProc->exitCode() )+
5.55 "\n" + zipProc->getErrout() );
5.56 err=aborted;
5.57 }
5.58 @@ -184,16 +182,16 @@
5.59 ErrorCode err=success;
5.60
5.61 // Try to unzip file
5.62 + QStringList args;
5.63 Process *zipProc=new Process ();
5.64 - zipProc->clearArguments();
5.65 - zipProc->setWorkingDirectory (zipDir);
5.66 - zipProc->addArgument ("unzip");
5.67 - zipProc->addArgument ("-o"); // overwrite existing files!
5.68 - zipProc->addArgument (zipName );
5.69 - zipProc->addArgument ("-d");
5.70 - zipProc->addArgument (zipDir.path());
5.71 + zipProc->setWorkingDirectory (zipDir.path());
5.72 + args << "-o"; // overwrite existing files!
5.73 + args << zipName ;
5.74 + args << "-d";
5.75 + args << zipDir.path();
5.76
5.77 - if (!zipProc->start() )
5.78 + zipProc->start ("unzip",args);
5.79 + if (!zipProc->waitForStarted() )
5.80 {
5.81 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
5.82 QObject::tr("Couldn't start unzip to decompress data."));
5.83 @@ -201,8 +199,8 @@
5.84
5.85 } else
5.86 {
5.87 - zipProc->waitFinished();
5.88 - if (!zipProc->normalExit() )
5.89 + zipProc->waitForFinished();
5.90 + if (zipProc->exitStatus()!=QProcess::NormalExit )
5.91 {
5.92 QMessageBox::critical( 0,QObject::tr( "Critical Error" ),
5.93 QObject::tr("unzip didn't exit normally") +
5.94 @@ -210,7 +208,7 @@
5.95 err=aborted;
5.96 } else
5.97 {
5.98 - if (zipProc->exitStatus()>0)
5.99 + if (zipProc->exitCode()>0)
5.100 {
5.101 if (zipProc->exitStatus()==9)
5.102 // no zipped file, but maybe .xml or old version? Try again.
5.103 @@ -218,7 +216,7 @@
5.104 else
5.105 {
5.106 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
5.107 - QString("unzip exit code: %1").arg(zipProc->exitStatus() ) +
5.108 + QString("unzip exit code: %1").arg(zipProc->exitCode() ) +
5.109 zipProc->getErrout() );
5.110 err=aborted;
5.111 }
6.1 --- a/flagobj.cpp Thu Nov 23 16:18:26 2006 +0000
6.2 +++ b/flagobj.cpp Fri Dec 08 20:18:56 2006 +0000
6.3 @@ -9,9 +9,9 @@
6.4 init ();
6.5 }
6.6
6.7 -FlagObj::FlagObj(Q3Canvas* c):MapObj(c)
6.8 +FlagObj::FlagObj(QGraphicsScene* s):MapObj(s)
6.9 {
6.10 -// cout << "Const FlagObj canvas="<<c<<endl;
6.11 +// cout << "Const FlagObj this="<<this<<" scene="<<s<<endl;
6.12 init ();
6.13 }
6.14
6.15 @@ -22,7 +22,7 @@
6.16
6.17 FlagObj::~FlagObj()
6.18 {
6.19 -// cout << "Destr FlagObj " << name.ascii() << "\n";
6.20 +// cout << "Destr FlagObj this="<<this <<" " << name.ascii() << "\n";
6.21 if (icon) delete (icon);
6.22 }
6.23
6.24 @@ -32,8 +32,8 @@
6.25 name="undefined";
6.26 group="undefined";
6.27
6.28 - icon=new ImageObj (canvas);
6.29 - icon->move (absPos.x(), absPos.y() );
6.30 + icon=new ImageObj (scene);
6.31 + icon->setPos (absPos.x(), absPos.y() );
6.32 state=false;
6.33 action=NULL;
6.34 }
6.35 @@ -53,7 +53,7 @@
6.36 void FlagObj::move(double x, double y)
6.37 {
6.38 MapObj::move(x,y);
6.39 - icon->move(x,y);
6.40 + icon->setPos(x,y);
6.41 positionBBox();
6.42 }
6.43
6.44 @@ -117,7 +117,7 @@
6.45
6.46 QPixmap FlagObj::getPixmap()
6.47 {
6.48 - return icon->getPixmap();
6.49 + return icon->pixmap();
6.50 }
6.51
6.52 void FlagObj::setAction (QAction* a)
6.53 @@ -150,6 +150,8 @@
6.54 if (visible)
6.55 {
6.56 icon->setVisibility (true);
6.57 + //icon->setPos (100,100);
6.58 + //icon->setPos (rand()%100,rand()%130);
6.59 calcBBoxSize();
6.60 }
6.61 }
6.62 @@ -191,12 +193,12 @@
6.63 {
6.64 if (visible && state)
6.65 {
6.66 - bbox.setSize ( QSize(
6.67 + bbox.setSize ( QSizeF(
6.68 icon->boundingRect().width(),
6.69 icon->boundingRect().height() ) );
6.70 } else
6.71 {
6.72 - bbox.setSize (QSize(0,0));
6.73 + bbox.setSize (QSizeF(0,0));
6.74 }
6.75 clickBox.setSize (bbox.size());
6.76 }
7.1 --- a/flagobj.h Thu Nov 23 16:18:26 2006 +0000
7.2 +++ b/flagobj.h Fri Dec 08 20:18:56 2006 +0000
7.3 @@ -2,9 +2,7 @@
7.4 #define FLAGOBJ_H
7.5
7.6
7.7 -#include <q3canvas.h>
7.8 -#include <qaction.h>
7.9 -//Added by qt3to4:
7.10 +#include <QAction>
7.11 #include <QPixmap>
7.12
7.13 #include "mapobj.h"
7.14 @@ -14,7 +12,7 @@
7.15 class FlagObj:public MapObj {
7.16 public:
7.17 FlagObj ();
7.18 - FlagObj (Q3Canvas*);
7.19 + FlagObj (QGraphicsScene*);
7.20 FlagObj (FlagObj*);
7.21 ~FlagObj ();
7.22 virtual void init ();
8.1 --- a/flagrowobj.cpp Thu Nov 23 16:18:26 2006 +0000
8.2 +++ b/flagrowobj.cpp Fri Dec 08 20:18:56 2006 +0000
8.3 @@ -11,9 +11,9 @@
8.4 init ();
8.5 }
8.6
8.7 -FlagRowObj::FlagRowObj(Q3Canvas* c):MapObj(c)
8.8 +FlagRowObj::FlagRowObj(QGraphicsScene* s):MapObj(s)
8.9 {
8.10 -// cout << "Const FlagRowObj\n";
8.11 +// cout << "Const FlagRowObj (s)\n";
8.12 init ();
8.13 }
8.14
8.15 @@ -53,11 +53,11 @@
8.16 void FlagRowObj::move(double x, double y)
8.17 {
8.18 MapObj::move(x,y);
8.19 - int dx=0;
8.20 + qreal dx=0;
8.21 for (int i=0; i<flag.size(); ++i)
8.22 {
8.23 flag.at(i)->move(x+dx,y);
8.24 - dx+=QSize(flag.at(i)->getSize() ).width();
8.25 + dx+=QSizeF(flag.at(i)->getSize() ).width();
8.26 }
8.27 }
8.28
8.29 @@ -75,9 +75,9 @@
8.30
8.31 FlagObj* FlagRowObj::addFlag (FlagObj *fo)
8.32 {
8.33 - FlagObj *newfo=new FlagObj (canvas);
8.34 + FlagObj *newfo=new FlagObj (scene);
8.35 + newfo->copy (fo); // create a deep copy of fo
8.36 newfo->move (absPos.x() + bbox.width(), absPos.y() );
8.37 - newfo->copy (fo); // create a deep copy of fo
8.38 flag.append(newfo);
8.39 calcBBoxSize();
8.40 positionBBox();
8.41 @@ -92,8 +92,8 @@
8.42
8.43 void FlagRowObj::calcBBoxSize()
8.44 {
8.45 - QSize size(0,0);
8.46 - QSize boxsize(0,0);
8.47 + QSizeF size(0,0);
8.48 + QSizeF boxsize(0,0);
8.49 for (int i=0; i<flag.size(); ++i)
8.50 {
8.51 size=flag.at(i)->getSize();
8.52 @@ -107,7 +107,7 @@
8.53 clickBox.setSize (boxsize);
8.54 }
8.55
8.56 -QString FlagRowObj::getFlagName (const QPoint &p)
8.57 +QString FlagRowObj::getFlagName (const QPointF &p)
8.58 {
8.59 if (!inBox (p)) return "";
8.60 for (int i=0; i<flag.size(); ++i)
8.61 @@ -135,6 +135,7 @@
8.62 // FlagObj is here, it will be active, too.
8.63 // Deactivate it by removing it from this row.
8.64 flag.remove (fo);
8.65 + delete (fo);
8.66 } else
8.67 {
8.68 // FlagObj is not present in this row.
8.69 @@ -197,7 +198,11 @@
8.70 void FlagRowObj::deactivate (const QString &foname)
8.71 {
8.72 FlagObj *fo=findFlag (foname);
8.73 - if (fo) flag.remove(fo);
8.74 + if (fo)
8.75 + {
8.76 + flag.remove(fo);
8.77 + delete (fo);
8.78 + }
8.79 calcBBoxSize();
8.80 positionBBox();
8.81 }
8.82 @@ -207,7 +212,7 @@
8.83 if (!parentRow)
8.84 {
8.85 for (int i=0; i<flag.size(); ++i)
8.86 - flag.at(i)->deactivate();
8.87 + if (flag.at(i)->isActive()) flag.at(i)->deactivate();
8.88 } else
8.89 qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows");
8.90 }
8.91 @@ -222,7 +227,11 @@
8.92 {
8.93 for (int i=0; i<flag.size(); ++i)
8.94 if (g==flag.at(i)->getGroup() && keepfo!=flag.at(i))
8.95 + {
8.96 flag.remove(flag.at(i));
8.97 + //FIXME also delete flags
8.98 + //and better only delete flags that are really set
8.99 + }
8.100 }
8.101 }
8.102 }
9.1 --- a/flagrowobj.h Thu Nov 23 16:18:26 2006 +0000
9.2 +++ b/flagrowobj.h Fri Dec 08 20:18:56 2006 +0000
9.3 @@ -9,7 +9,7 @@
9.4 class FlagRowObj:public QObject,public MapObj {
9.5 public:
9.6 FlagRowObj ();
9.7 - FlagRowObj (Q3Canvas*);
9.8 + FlagRowObj (QGraphicsScene *);
9.9 ~FlagRowObj ();
9.10 virtual void init ();
9.11 virtual void copy (FlagRowObj*);
9.12 @@ -20,7 +20,7 @@
9.13 virtual FlagObj* addFlag (FlagObj *fo); // make deep copy of FlagObj
9.14 virtual void positionBBox();
9.15 virtual void calcBBoxSize();
9.16 - virtual QString getFlagName (const QPoint &p); // Find flag by position
9.17 + virtual QString getFlagName (const QPointF &p); // Find flag by position
9.18 bool isActive(const QString&);
9.19 void toggle (const QString&,bool);
9.20 void activate(const QString&);
10.1 --- a/floatimageobj.cpp Thu Nov 23 16:18:26 2006 +0000
10.2 +++ b/floatimageobj.cpp Fri Dec 08 20:18:56 2006 +0000
10.3 @@ -1,8 +1,8 @@
10.4 +#include <QImageReader>
10.5 +#include <QPixmap>
10.6 +
10.7 #include "floatimageobj.h"
10.8 #include "branchobj.h"
10.9 -//Added by qt3to4:
10.10 -#include <QPixmap>
10.11 -
10.12
10.13 /////////////////////////////////////////////////////////////////
10.14 // FloatImageObj
10.15 @@ -19,15 +19,15 @@
10.16 depth=-1;
10.17 }
10.18
10.19 -FloatImageObj::FloatImageObj (Q3Canvas* c):FloatObj(c)
10.20 +FloatImageObj::FloatImageObj (QGraphicsScene* s):FloatObj(s)
10.21 {
10.22 - // cout << "Const FloatImageObj (c) called from MapCenterObj (c)\n";
10.23 + // cout << "Const FloatImageObj (s) called from MapCenterObj (s)\n";
10.24 setParObj (this);
10.25 init();
10.26 depth=-1;
10.27 }
10.28
10.29 -FloatImageObj::FloatImageObj (Q3Canvas* c, OrnamentedObj* p):FloatObj(c,p)
10.30 +FloatImageObj::FloatImageObj (QGraphicsScene *s, OrnamentedObj* p):FloatObj(s,p)
10.31 {
10.32 // cout << "Const FloatImageObj (c,p)\n";
10.33 init();
10.34 @@ -41,13 +41,12 @@
10.35
10.36 void FloatImageObj::init ()
10.37 {
10.38 - icon=new ImageObj (canvas);
10.39 - icon->move (absPos.x(), absPos.y() );
10.40 + icon=new ImageObj (scene);
10.41 + icon->setPos (absPos.x(), absPos.y() );
10.42 icon->setVisibility (true);
10.43 - setZ (Z_FLOATIMG);
10.44 - bbox.setSize (QSize(icon->size().width(), icon->size().height()));
10.45 - clickBox.setSize (QSize(icon->size().width(), icon->size().height()));
10.46 - filename="";
10.47 + setZValue (Z_FLOATIMG);
10.48 + bbox.setSize (QSizeF(icon->boundingRect().width(), icon->boundingRect().height()));
10.49 + clickBox.setSize (QSizeF(icon->boundingRect().width(), icon->boundingRect().height()));filename="";
10.50 originalFilename="no original name available";
10.51 filetype="";
10.52 saveInMap=true;
10.53 @@ -68,35 +67,41 @@
10.54 positionBBox();
10.55 }
10.56
10.57 -void FloatImageObj::setZ (const int &i)
10.58 +void FloatImageObj::setZValue (const int &i)
10.59 {
10.60 - icon->setZ (i);
10.61 + icon->setZValue (i);
10.62 zPlane=i;
10.63 }
10.64
10.65 int FloatImageObj::z ()
10.66 {
10.67 - return qRound (icon->z());
10.68 + return qRound (icon->zValue());
10.69 }
10.70
10.71 void FloatImageObj::load (const QPixmap &pixmap)
10.72 {
10.73 - icon->load(pixmap);
10.74 - bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
10.75 - clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
10.76 - positionBBox();
10.77 - filetype="PNG";
10.78 - filename="No filename given";
10.79 + icon->load(pixmap);
10.80 + bbox.setSize (QSizeF(icon->boundingRect().width()+8, icon->boundingRect().height()+8));
10.81 + clickBox.setSize (QSizeF(icon->boundingRect().width()+8, icon->boundingRect().height()+8));
10.82 + selbox->setRect(0,0,clickBox.width(),clickBox.height());
10.83 + positionBBox();
10.84 + filetype="PNG";
10.85 + filename="No filename given";
10.86 }
10.87
10.88 bool FloatImageObj::load (const QString &fn)
10.89 {
10.90 - if( icon->load (fn))
10.91 + QImageReader reader (fn);
10.92 + QImage img;
10.93 +
10.94 + if( reader.read (&img))
10.95 {
10.96 - bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
10.97 + icon->setPixmap(QPixmap::fromImage(img));
10.98 + bbox.setSize (QSizeF(icon->boundingRect().width()+8, icon->boundingRect().height()+8));
10.99 + selbox->setRect(0,0,clickBox.width(),clickBox.height());
10.100 positionBBox();
10.101 filename=fn;
10.102 -//FIXME QT3 was filetype=QPixmap::imageFormat (fn);
10.103 + filetype=reader.format();
10.104 setOriginalFilename (fn);
10.105 return true;
10.106 } else
10.107 @@ -135,18 +140,19 @@
10.108 void FloatImageObj::move (double x, double y)
10.109 {
10.110 FloatObj::move(x,y);
10.111 - icon->move (x+4,y+4);
10.112 + icon->setPos (x+4,y+4);
10.113 positionBBox();
10.114 }
10.115
10.116 -void FloatImageObj::move (QPoint p)
10.117 +void FloatImageObj::move (QPointF p)
10.118 {
10.119 - move (p.x(), p.y());
10.120 + OrnamentedObj::move (p.x(),p.y());
10.121 }
10.122
10.123 void FloatImageObj::positionBBox()
10.124 {
10.125 clickBox=bbox;
10.126 + setSelBox();
10.127 }
10.128
10.129 void FloatImageObj::calcBBoxSize()
10.130 @@ -206,12 +212,12 @@
10.131 }
10.132
10.133
10.134 -QRect FloatImageObj::getTotalBBox()
10.135 +QRectF FloatImageObj::getTotalBBox()
10.136 {
10.137 return bbox;
10.138 }
10.139
10.140 -QRect FloatImageObj::getBBoxSizeWithChilds()
10.141 +QRectF FloatImageObj::getBBoxSizeWithChilds()
10.142 {
10.143 //FIXME abstract in linkablemapobj.h, not calculated
10.144 return bboxTotal;
11.1 --- a/floatimageobj.h Thu Nov 23 16:18:26 2006 +0000
11.2 +++ b/floatimageobj.h Fri Dec 08 20:18:56 2006 +0000
11.3 @@ -9,12 +9,12 @@
11.4 class FloatImageObj:public FloatObj {
11.5 public:
11.6 FloatImageObj ();
11.7 - FloatImageObj (Q3Canvas*);
11.8 - FloatImageObj (Q3Canvas*, OrnamentedObj* parent);
11.9 + FloatImageObj (QGraphicsScene*);
11.10 + FloatImageObj (QGraphicsScene*, OrnamentedObj* parent);
11.11 ~FloatImageObj ();
11.12 virtual void init ();
11.13 virtual void copy (FloatImageObj*);
11.14 - virtual void setZ (const int&);
11.15 + virtual void setZValue (const int&);
11.16 virtual int z();
11.17
11.18 virtual void load (const QPixmap &);
11.19 @@ -24,11 +24,11 @@
11.20 virtual QString getOriginalFilename();
11.21 virtual void setVisibility(bool); // set vis. for w
11.22 virtual void move (double x,double y);
11.23 - virtual void move (QPoint);
11.24 + virtual void move (QPointF);
11.25 virtual void positionBBox();
11.26 virtual void calcBBoxSize();
11.27 - virtual QRect getTotalBBox(); // return BBox including childs
11.28 - virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
11.29 + virtual QRectF getTotalBBox(); // return BBox including childs
11.30 + virtual QRectF getBBoxSizeWithChilds(); // return size of BBox including childs
11.31 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
11.32 virtual QString saveToDir(const QString &,const QString&);
11.33 virtual void resetSaveCounter();
12.1 --- a/floatobj.cpp Thu Nov 23 16:18:26 2006 +0000
12.2 +++ b/floatobj.cpp Fri Dec 08 20:18:56 2006 +0000
12.3 @@ -14,17 +14,17 @@
12.4 depth=-1;
12.5 }
12.6
12.7 -FloatObj::FloatObj (Q3Canvas* c):OrnamentedObj(c)
12.8 +FloatObj::FloatObj (QGraphicsScene* s):OrnamentedObj(s)
12.9 {
12.10 -// cout << "Const FloatObj (c) called from MapCenterObj (c)\n";
12.11 +// cout << "Const FloatObj (s) called from MapCenterObj (s)\n";
12.12 setParObj (this);
12.13 init();
12.14 depth=-1;
12.15 }
12.16
12.17 -FloatObj::FloatObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
12.18 +FloatObj::FloatObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)
12.19 {
12.20 -// cout << "Const FloatObj (c,p)\n";
12.21 +// cout << "Const FloatObj (s,p)\n";
12.22 setParObj (p);
12.23 depth=p->getDepth()+1;
12.24 init();
12.25 @@ -50,12 +50,12 @@
12.26 setVisibility (other->visible);
12.27 }
12.28
12.29 -void FloatObj::setZ(const int &i)
12.30 +void FloatObj::setZValue(const int &i)
12.31 {
12.32 zPlane=i;
12.33 }
12.34
12.35 -int FloatObj::z()
12.36 +int FloatObj::zValue()
12.37 {
12.38 return zPlane;
12.39 }
12.40 @@ -73,12 +73,14 @@
12.41 void FloatObj::move (double x, double y)
12.42 {
12.43 MapObj::move(x,y);
12.44 - selbox->move(x,y);
12.45 + //selbox->setPos(x,y);
12.46 + selbox->rect().moveTo (QPointF (x,y));
12.47 }
12.48
12.49 -void FloatObj::move (QPoint p)
12.50 +void FloatObj::move (QPointF p)
12.51 {
12.52 - move (p.x(), p.y());
12.53 + MapObj::move (p);
12.54 + selbox->rect().moveTo (p);
12.55 }
12.56
12.57 void FloatObj::setDockPos()
12.58 @@ -93,12 +95,12 @@
12.59 updateLink();
12.60 }
12.61
12.62 -QRect FloatObj::getTotalBBox()
12.63 +QRectF FloatObj::getTotalBBox()
12.64 {
12.65 return bbox;
12.66 }
12.67
12.68 -QRect FloatObj::getBBoxSizeWithChilds()
12.69 +QRectF FloatObj::getBBoxSizeWithChilds()
12.70 {
12.71 return bboxTotal;
12.72 }
13.1 --- a/floatobj.h Thu Nov 23 16:18:26 2006 +0000
13.2 +++ b/floatobj.h Fri Dec 08 20:18:56 2006 +0000
13.3 @@ -7,24 +7,24 @@
13.4 class FloatObj:public OrnamentedObj {
13.5 public:
13.6 FloatObj ();
13.7 - FloatObj (Q3Canvas*);
13.8 - FloatObj (Q3Canvas*, LinkableMapObj* parent);
13.9 + FloatObj (QGraphicsScene*);
13.10 + FloatObj (QGraphicsScene*, LinkableMapObj* parent);
13.11 ~FloatObj ();
13.12 virtual void init ();
13.13 virtual void copy (FloatObj*);
13.14 virtual bool load (const QString&)=0;
13.15 - virtual void setZ(const int&); // set zPlane
13.16 - virtual int z();
13.17 + virtual void setZValue(const int&); // set zPlane
13.18 + virtual int zValue();
13.19 virtual void setFloatExport (const bool &);
13.20 virtual bool getFloatExport ();
13.21
13.22 virtual void move (double,double);
13.23 - virtual void move (QPoint);
13.24 + virtual void move (QPointF);
13.25 virtual void setDockPos();
13.26 virtual void reposition();
13.27
13.28 - virtual QRect getTotalBBox(); // return BBox including childs
13.29 - virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
13.30 + virtual QRectF getTotalBBox(); // return BBox including childs
13.31 + virtual QRectF getBBoxSizeWithChilds(); // return size of BBox including childs
13.32
13.33 virtual void resetSaveCounter()=0;
13.34
14.1 --- a/frameobj.cpp Thu Nov 23 16:18:26 2006 +0000
14.2 +++ b/frameobj.cpp Fri Dec 08 20:18:56 2006 +0000
14.3 @@ -11,7 +11,7 @@
14.4 init ();
14.5 }
14.6
14.7 -FrameObj::FrameObj(Q3Canvas* c) :MapObj(c)
14.8 +FrameObj::FrameObj(QGraphicsScene *s) :MapObj(s)
14.9 {
14.10 // cout << "Const FrameObj\n";
14.11 init ();
14.12 @@ -49,7 +49,7 @@
14.13 case NoFrame:
14.14 break;
14.15 case Rectangle:
14.16 - rectFrame->move (x,y);
14.17 + rectFrame->setPos (x,y);
14.18 break;
14.19 }
14.20 }
14.21 @@ -67,7 +67,7 @@
14.22 {
14.23 }
14.24
14.25 -void FrameObj::setRect(const QRect &r)
14.26 +void FrameObj::setRect(const QRectF &r)
14.27 {
14.28 bbox=r;
14.29 switch (type)
14.30 @@ -75,9 +75,7 @@
14.31 case NoFrame:
14.32 break;
14.33 case Rectangle:
14.34 - rectFrame->setX (bbox.x() );
14.35 - rectFrame->setY (bbox.y() );
14.36 - rectFrame->setSize (bbox.width(),bbox.height() );
14.37 + rectFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
14.38 break;
14.39 }
14.40 }
14.41 @@ -117,10 +115,9 @@
14.42 break;
14.43 case Rectangle:
14.44 border=10;
14.45 - rectFrame = new Q3CanvasRectangle (canvas);
14.46 - rectFrame->setZ(Z_FRAME);
14.47 - rectFrame->setBrush( QColor("white") );
14.48 - rectFrame->setPen( QPen(QColor("black") ));
14.49 + rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(QColor("black") ), QColor("white"));
14.50 + rectFrame->setZValue(Z_FRAME);
14.51 +
14.52 break;
14.53 }
14.54 setVisibility (visible);
15.1 --- a/frameobj.h Thu Nov 23 16:18:26 2006 +0000
15.2 +++ b/frameobj.h Fri Dec 08 20:18:56 2006 +0000
15.3 @@ -8,7 +8,7 @@
15.4 class FrameObj:public MapObj {
15.5 public:
15.6 FrameObj();
15.7 - FrameObj(Q3Canvas*);
15.8 + FrameObj(QGraphicsScene*);
15.9 ~FrameObj();
15.10 void init();
15.11 void clear();
15.12 @@ -16,7 +16,7 @@
15.13 void moveBy (double x,double y); // move to relative Position
15.14 void positionBBox();
15.15 void calcBBoxSize();
15.16 - void setRect (const QRect &); // set dimensions
15.17 + void setRect (const QRectF &); // set dimensions
15.18 int getBorder();
15.19 FrameType getFrameType ();
15.20 QString getFrameTypeName ();
15.21 @@ -26,7 +26,7 @@
15.22
15.23 protected:
15.24 FrameType type;
15.25 - Q3CanvasRectangle* rectFrame;
15.26 + QGraphicsRectItem * rectFrame;
15.27 int border; // distance text - frame
15.28 };
15.29 #endif
16.1 --- a/headingobj.cpp Thu Nov 23 16:18:26 2006 +0000
16.2 +++ b/headingobj.cpp Fri Dec 08 20:18:56 2006 +0000
16.3 @@ -10,9 +10,9 @@
16.4 init ();
16.5 }
16.6
16.7 -HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
16.8 +HeadingObj::HeadingObj(QGraphicsScene *s) :MapObj(s)
16.9 {
16.10 -// cout << "Const HeadingObj\n";
16.11 +// cout << "Const HeadingObj (s)\n";
16.12 init ();
16.13 }
16.14
16.15 @@ -44,8 +44,8 @@
16.16 {
16.17 MapObj::move(x,y);
16.18
16.19 - int h; // height of a textline
16.20 - int ho; // offset of height while drawing all lines
16.21 + qreal h; // height of a textline
16.22 + qreal ho; // offset of height while drawing all lines
16.23
16.24 if (!textline.isEmpty() )
16.25 h=textline.first()->boundingRect().height();
16.26 @@ -54,7 +54,7 @@
16.27 ho=0;
16.28 for (int i=0; i<textline.size(); ++i)
16.29 {
16.30 - textline.at(i)->move(x,y+ho);
16.31 + textline.at(i)->setPos(x,y+ho);
16.32 ho=ho+h;
16.33 }
16.34 }
16.35 @@ -73,8 +73,8 @@
16.36
16.37 void HeadingObj::calcBBoxSize()
16.38 {
16.39 - int w=0;
16.40 - int h=0;
16.41 + qreal w=0;
16.42 + qreal h=0;
16.43 // Using Backspace an empty heading might easily be created, then there
16.44 // would be textline.first()==NULL This can be worked around by the following, but
16.45 // then no selection would be visible, thus we prevent it in ::setText()
16.46 @@ -87,18 +87,17 @@
16.47 w=textline.at(i)->boundingRect().width();
16.48 }
16.49 }
16.50 - bbox.setSize (QSize(w,h));
16.51 + bbox.setSize (QSizeF(w,h));
16.52 }
16.53
16.54 -Q3CanvasText* HeadingObj::newLine(QString s)
16.55 +QGraphicsTextItem* HeadingObj::newLine(QString s)
16.56 {
16.57 - Q3CanvasText *t;
16.58 - t = new Q3CanvasText(canvas);
16.59 + QGraphicsTextItem *t=scene->addText("");
16.60 t->setFont (font);
16.61 - t->setColor (color);
16.62 - t->setZ(Z_TEXT);
16.63 - t->setText(s);
16.64 - t->setTextFlags(Qt::AlignLeft);
16.65 + t->setZValue(Z_TEXT);
16.66 + t->setDefaultTextColor(color);
16.67 + t->setPlainText(s);
16.68 + //t->setTextFlags(Qt::AlignLeft);
16.69 t->show();
16.70 return t;
16.71 }
16.72 @@ -221,7 +220,7 @@
16.73 {
16.74 color=c;
16.75 for (int i=0; i<textline.size(); ++i)
16.76 - textline.at(i)->setColor(c);
16.77 + textline.at(i)->setDefaultTextColor(c);
16.78 }
16.79 }
16.80
16.81 @@ -240,12 +239,12 @@
16.82 textline.at(i)->hide();
16.83 }
16.84
16.85 -int HeadingObj::getHeight ()
16.86 +qreal HeadingObj::getHeight ()
16.87 {
16.88 return bbox.height();
16.89 }
16.90
16.91 -int HeadingObj::getWidth()
16.92 +qreal HeadingObj::getWidth()
16.93 {
16.94 return bbox.width();
16.95 }
17.1 --- a/headingobj.h Thu Nov 23 16:18:26 2006 +0000
17.2 +++ b/headingobj.h Fri Dec 08 20:18:56 2006 +0000
17.3 @@ -6,7 +6,7 @@
17.4 class HeadingObj:public MapObj {
17.5 public:
17.6 HeadingObj();
17.7 - HeadingObj(Q3Canvas*);
17.8 + HeadingObj(QGraphicsScene*);
17.9 virtual ~HeadingObj();
17.10 virtual void init();
17.11 virtual void copy(HeadingObj*);
17.12 @@ -15,7 +15,7 @@
17.13 virtual void positionBBox();
17.14 virtual void calcBBoxSize();
17.15 private:
17.16 - Q3CanvasText* newLine(QString); // generate new textline
17.17 + QGraphicsTextItem* newLine(QString); // generate new textline
17.18 public:
17.19 virtual void setText(QString);
17.20 virtual QString text();
17.21 @@ -24,13 +24,13 @@
17.22 virtual void setColor(QColor);
17.23 virtual QColor getColor();
17.24 virtual void setVisibility(bool);
17.25 - virtual int getHeight();
17.26 - virtual int getWidth();
17.27 + virtual qreal getHeight();
17.28 + virtual qreal getWidth();
17.29
17.30 protected:
17.31 QString heading;
17.32 int textwidth; // width for formatting text
17.33 - QList <Q3CanvasText*> textline; // a part of e.g. the parabel
17.34 + QList <QGraphicsTextItem*> textline; // a part of e.g. the parabel
17.35 QColor color;
17.36 QFont font;
17.37 };
18.1 --- a/imageobj.cpp Thu Nov 23 16:18:26 2006 +0000
18.2 +++ b/imageobj.cpp Fri Dec 08 20:18:56 2006 +0000
18.3 @@ -1,16 +1,17 @@
18.4 #include "imageobj.h"
18.5 -//Added by qt3to4:
18.6 -#include <QPixmap>
18.7 +#include "mapobj.h"
18.8
18.9 /////////////////////////////////////////////////////////////////
18.10 // ImageObj
18.11 /////////////////////////////////////////////////////////////////
18.12 -ImageObj::ImageObj( Q3Canvas *canvas )
18.13 - : Q3CanvasRectangle( canvas )
18.14 +ImageObj::ImageObj( QGraphicsScene *scene) : QGraphicsPixmapItem (NULL,scene )
18.15 {
18.16 -// cout << "Const ImageObj (canvas)\n";
18.17 - setZ(Z_ICON);
18.18 - type=undef;
18.19 +// cout << "Const ImageObj (scene)\n";
18.20 +
18.21 + setShapeMode (QGraphicsPixmapItem::BoundingRectShape);
18.22 + setZValue(Z_ICON);
18.23 + mapScene=scene;
18.24 + hide();
18.25 }
18.26
18.27 ImageObj::~ImageObj()
18.28 @@ -20,13 +21,9 @@
18.29
18.30 void ImageObj::copy(ImageObj* other)
18.31 {
18.32 - setSize (other->width(), other->height() );
18.33 setVisibility (other->isVisible() );
18.34 - type=other->type;
18.35 -// if (type==qimage)
18.36 - image=other->image;
18.37 -// if (type==qpixmap)
18.38 - pixmap=other->pixmap;
18.39 + setPixmap (other->QGraphicsPixmapItem::pixmap());
18.40 + setPos (other->pos());
18.41 }
18.42
18.43 void ImageObj::setVisibility (bool v)
18.44 @@ -39,64 +36,24 @@
18.45
18.46 void ImageObj::save(const QString &fn, const char *format)
18.47 {
18.48 - switch (type)
18.49 - {
18.50 - case undef: qWarning("Warning: ImageObj::save() type=undef");break;
18.51 - case qimage: image.save (fn,format,-1);break;
18.52 - case qpixmap: pixmap.save (fn,format,-1);break;
18.53 - }
18.54 + pixmap().save (fn,format,-1);
18.55 }
18.56
18.57 bool ImageObj::load (const QString &fn)
18.58 {
18.59 - if (!image.load( fn) )
18.60 - //cout << "Fatal Error in ImageObj::load ("<<fn<<")\n";
18.61 - return false;
18.62 - setSize( image.width(), image.height() );
18.63 - type=qimage;
18.64 + QPixmap pixmap;
18.65 + if (pixmap.load (fn))
18.66 + {
18.67 + setPixmap (pixmap);
18.68 + return true;
18.69 + }
18.70 + return false;
18.71 +}
18.72
18.73 -#if !defined(Q_WS_QWS)
18.74 - pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
18.75 -#endif
18.76 +bool ImageObj::load (const QPixmap &pm)
18.77 +{
18.78 + setPixmap (pm);
18.79 return true;
18.80 }
18.81
18.82 -bool ImageObj::load (QPixmap pm)
18.83 -{
18.84 -#if !defined(Q_WS_QWS)
18.85 - //pixmap.convertFromImage(image, OrderedAlphaDither);
18.86 - type=qpixmap;
18.87 - pixmap=pm;
18.88 - setSize( pm.width(), pm.height() );
18.89 -#else
18.90 - type=qimage;
18.91 - image=pm;
18.92 - setSize( image.width(), image.height() );
18.93 -#endif
18.94 - return true;
18.95 -}
18.96
18.97 -void ImageObj::setImage(QImage img)
18.98 -{
18.99 - type=qimage;
18.100 - image=img;
18.101 - pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
18.102 -}
18.103 -
18.104 -QPixmap ImageObj::getPixmap()
18.105 -{
18.106 - return pixmap;
18.107 -}
18.108 -
18.109 -void ImageObj::drawShape( QPainter &p )
18.110 -{
18.111 -// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
18.112 -// but on other platforms, we need to use a QPixmap.
18.113 -#if defined(Q_WS_QWS)
18.114 - p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
18.115 -#else
18.116 - p.drawPixmap( int(x()), int(y()), pixmap );
18.117 -#endif
18.118 -}
18.119 -
18.120 -
19.1 --- a/imageobj.h Thu Nov 23 16:18:26 2006 +0000
19.2 +++ b/imageobj.h Fri Dec 08 20:18:56 2006 +0000
19.3 @@ -1,33 +1,20 @@
19.4 #ifndef IMAGEOBJ_H
19.5 #define IMAGEOBJ_H
19.6
19.7 -#include <qimage.h>
19.8 -#include <q3canvas.h>
19.9 -#include <qpainter.h>
19.10 -//Added by qt3to4:
19.11 -#include <QPixmap>
19.12 +#include <QGraphicsScene>
19.13 +#include <QGraphicsPixmapItem>
19.14
19.15 -#include "mapobj.h"
19.16 -
19.17 -enum ImageType {qimage,qpixmap,undef};
19.18 -
19.19 -class ImageObj: public Q3CanvasRectangle
19.20 +class ImageObj: public QGraphicsPixmapItem
19.21 {
19.22 public:
19.23 - ImageObj( Q3Canvas *canvas );
19.24 + ImageObj( QGraphicsScene *);
19.25 ~ImageObj();
19.26 - virtual void copy (ImageObj*);
19.27 - virtual void setVisibility(bool);
19.28 + void copy (ImageObj*);
19.29 + void setVisibility(bool);
19.30 void save (const QString &, const char *);
19.31 bool load (const QString &);
19.32 - bool load (QPixmap);
19.33 - void setImage(QImage img);
19.34 - QPixmap getPixmap();
19.35 -protected:
19.36 - void drawShape( QPainter & );
19.37 + bool load (const QPixmap &);
19.38 private:
19.39 - QImage image;
19.40 - QPixmap pixmap;
19.41 - ImageType type;
19.42 + QGraphicsScene *mapScene;
19.43 };
19.44 #endif
20.1 --- a/linkablemapobj.cpp Thu Nov 23 16:18:26 2006 +0000
20.2 +++ b/linkablemapobj.cpp Fri Dec 08 20:18:56 2006 +0000
20.3 @@ -4,10 +4,6 @@
20.4 #include "branchobj.h"
20.5 #include "mapeditor.h"
20.6
20.7 -//Added by qt3to4:
20.8 -#include <Q3PointArray>
20.9 -
20.10 -
20.11 /////////////////////////////////////////////////////////////////
20.12 // LinkableMapObj
20.13 /////////////////////////////////////////////////////////////////
20.14 @@ -18,13 +14,13 @@
20.15 init ();
20.16 }
20.17
20.18 -LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c)
20.19 +LinkableMapObj::LinkableMapObj(QGraphicsScene* s) :MapObj(s)
20.20 {
20.21 -// cout << "Const LinkableMapObj\n";
20.22 +// cout << "Const LinkableMapObj (s)\n";
20.23 init ();
20.24 }
20.25
20.26 -LinkableMapObj::LinkableMapObj (LinkableMapObj* lmo) : MapObj (lmo->canvas)
20.27 +LinkableMapObj::LinkableMapObj (LinkableMapObj* lmo) : MapObj (lmo->scene)
20.28 {
20.29 copy (lmo);
20.30 }
20.31 @@ -49,11 +45,9 @@
20.32 break;
20.33 case StylePolyLine:
20.34 delete (p);
20.35 - delete (l);
20.36 break;
20.37 case StylePolyParabel:
20.38 delete (p);
20.39 - while (!segment.isEmpty()) delete segment.takeFirst();
20.40 break;
20.41 default:
20.42 break;
20.43 @@ -67,8 +61,8 @@
20.44 childObj=NULL;
20.45 parObj=NULL;
20.46 parObjTmpBuf=NULL;
20.47 - parPos=QPoint(0,0);
20.48 - childPos=QPoint(0,0);
20.49 + parPos=QPointF(0,0);
20.50 + childPos=QPointF(0,0);
20.51 link2ParPos=false;
20.52 l=NULL;
20.53 orientation=OrientUndef;
20.54 @@ -77,18 +71,18 @@
20.55 style=StyleUndef;
20.56 linkpos=LinkBottom;
20.57 arcsegs=13;
20.58 - Q3PointArray pa(arcsegs*2+2);
20.59
20.60 - bottomline=new Q3CanvasLine(canvas);
20.61 - bottomline->setPen( QPen(linkcolor, 1) );
20.62 - bottomline->setZ(Z_LINK);
20.63 +// FIXME instead of linkcolor pen.color() could be used
20.64 + pen.setWidth (1);
20.65 + pen.setColor (linkcolor);
20.66 + pen.setCapStyle ( Qt::RoundCap );
20.67 + bottomline=scene->addLine(QLineF(1,1,1,1),pen);
20.68 + bottomline->setZValue(Z_LINK);
20.69 bottomline->show();
20.70
20.71 // Prepare showing the selection of a MapObj
20.72 - selbox = new Q3CanvasRectangle (canvas);
20.73 - selbox->setZ(Z_SELBOX);
20.74 - selbox->setBrush( QColor(255,255,0) );
20.75 - selbox->setPen( QPen(QColor(255,255,0) ));
20.76 + selbox = scene->addRect(QRectF(0,0,0,0), QPen(QColor(255,255,0) ), QColor(255,255,0));
20.77 + selbox->setZValue(Z_SELBOX);
20.78 selbox->hide();
20.79 selected=false;
20.80
20.81 @@ -97,12 +91,12 @@
20.82 topPad=botPad=leftPad=rightPad=0;
20.83
20.84 // initialize frame
20.85 - frame = new FrameObj (canvas);
20.86 + frame = new FrameObj (scene);
20.87
20.88 repositionRequest=false;
20.89
20.90 // Rel Positions
20.91 - relPos=QPoint(0,0);
20.92 + relPos=QPointF(0,0);
20.93 useRelPos=false;
20.94 useOrientation=true;
20.95 }
20.96 @@ -129,7 +123,7 @@
20.97 mapEditor=parObj->getMapEditor();
20.98 }
20.99
20.100 -void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPoint,int)
20.101 +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int)
20.102 {
20.103 }
20.104
20.105 @@ -161,7 +155,7 @@
20.106 }
20.107 }
20.108
20.109 -void LinkableMapObj::setRelPos(const QPoint &p)
20.110 +void LinkableMapObj::setRelPos(const QPointF &p)
20.111 {
20.112 relPos=p;
20.113 if (parObj)
20.114 @@ -174,23 +168,23 @@
20.115 }
20.116 }
20.117
20.118 -QPoint LinkableMapObj::getRelPos()
20.119 +QPointF LinkableMapObj::getRelPos()
20.120 {
20.121 - if (!parObj) return QPoint();
20.122 + if (!parObj) return QPointF();
20.123 return relPos;
20.124 }
20.125
20.126 -int LinkableMapObj::getTopPad()
20.127 +qreal LinkableMapObj::getTopPad()
20.128 {
20.129 return topPad;
20.130 }
20.131
20.132 -int LinkableMapObj::getLeftPad()
20.133 +qreal LinkableMapObj::getLeftPad()
20.134 {
20.135 return leftPad;
20.136 }
20.137
20.138 -int LinkableMapObj::getRightPad()
20.139 +qreal LinkableMapObj::getRightPad()
20.140 {
20.141 return rightPad;
20.142 }
20.143 @@ -234,29 +228,25 @@
20.144
20.145 if (childObj!=NULL && parObj != NULL)
20.146 {
20.147 - int i;
20.148 - Q3CanvasLine* cl;
20.149 + QGraphicsLineItem *cl;
20.150 switch (style)
20.151 {
20.152 case StyleUndef:
20.153 bottomline->hide();
20.154 break;
20.155 case StyleLine:
20.156 - l = new Q3CanvasLine(canvas);
20.157 - l->setPen( QPen(linkcolor, 1) );
20.158 - l->setZ(Z_LINK);
20.159 + l = scene->addLine(QLineF(1,1,1,1),pen);
20.160 + l->setZValue(Z_LINK);
20.161 if (visible)
20.162 l->show();
20.163 else
20.164 l->hide();
20.165 break;
20.166 case StyleParabel:
20.167 - for (i=0;i<arcsegs;i++)
20.168 + for (int i=0;i<arcsegs;i++)
20.169 {
20.170 - cl = new Q3CanvasLine(canvas);
20.171 - cl->setPen( QPen(linkcolor, 1) );
20.172 - cl->setPoints( i*5,0,i*10,100);
20.173 - cl->setZ(Z_LINK);
20.174 + cl = scene->addLine(QLineF(i*5,0,i*10,100),pen);
20.175 + cl->setZValue(Z_LINK);
20.176 if (visible)
20.177 cl->show();
20.178 else
20.179 @@ -266,28 +256,17 @@
20.180 pa0.resize (arcsegs+1);
20.181 break;
20.182 case StylePolyLine:
20.183 - p = new Q3CanvasPolygon(canvas);
20.184 - p->setBrush( linkcolor );
20.185 - p->setZ(Z_LINK);
20.186 + p =scene->addPolygon(QPolygonF(),pen,linkcolor);
20.187 + p->setZValue(Z_LINK);
20.188 if (visible)
20.189 p->show();
20.190 else
20.191 p->hide();
20.192 pa0.resize (3);
20.193 - // TODO a bit awkward: draw the lines additionally to polygon, to avoid
20.194 - // missing pixels, when polygon is extremly flat
20.195 - l = new Q3CanvasLine(canvas);
20.196 - l->setPen( QPen(linkcolor, 1) );
20.197 - l->setZ(Z_LINK);
20.198 - if (visible)
20.199 - l->show();
20.200 - else
20.201 - l->hide();
20.202 break;
20.203 case StylePolyParabel:
20.204 - p = new Q3CanvasPolygon(canvas);
20.205 - p->setBrush( linkcolor );
20.206 - p->setZ(Z_LINK);
20.207 + p = scene->addPolygon(QPolygonF(),pen,linkcolor);
20.208 + p->setZValue(Z_LINK);
20.209 if (visible)
20.210 p->show();
20.211 else
20.212 @@ -295,22 +274,6 @@
20.213 pa0.resize (arcsegs*2+2);
20.214 pa1.resize (arcsegs+1);
20.215 pa2.resize (arcsegs+1);
20.216 -
20.217 - // TODO a bit awkward: draw the lines additionally
20.218 - // to polygon, to avoid missing pixels,
20.219 - // if polygon is extremly flat
20.220 - for (i=0;i<arcsegs;i++)
20.221 - {
20.222 - cl = new Q3CanvasLine(canvas);
20.223 - cl->setPen( QPen(linkcolor, 1) );
20.224 - cl->setPoints( 5*i,0,i*10,100);
20.225 - cl->setZ(Z_LINK);
20.226 - if (visible)
20.227 - cl->show();
20.228 - else
20.229 - cl->hide();
20.230 - segment.append(cl);
20.231 - }
20.232 break;
20.233 default:
20.234 break;
20.235 @@ -357,24 +320,22 @@
20.236 void LinkableMapObj::setLinkColor(QColor col)
20.237 {
20.238 linkcolor=col;
20.239 - bottomline->setPen( QPen(linkcolor, 1) );
20.240 + pen.setColor(col);
20.241 + bottomline->setPen( pen );
20.242 switch (style)
20.243 {
20.244 case StyleLine:
20.245 - l->setPen( QPen(col,1));
20.246 + l->setPen( pen);
20.247 break;
20.248 case StyleParabel:
20.249 for (int i=0; i<segment.size(); ++i)
20.250 - segment.at(i)->setPen( QPen(col,1));
20.251 + segment.at(i)->setPen( pen);
20.252 break;
20.253 case StylePolyLine:
20.254 p->setBrush( QBrush(col));
20.255 - l->setPen( QPen(col,1));
20.256 break;
20.257 case StylePolyParabel:
20.258 p->setBrush( QBrush(col));
20.259 - for (int i=0; i<segment.size(); ++i)
20.260 - segment.at(i)->setPen( QPen(col,1));
20.261 break;
20.262 default:
20.263 break;
20.264 @@ -430,11 +391,8 @@
20.265 break;
20.266 case StylePolyLine:
20.267 if (p) p->show();
20.268 - if (l) l->show();
20.269 break;
20.270 case StylePolyParabel:
20.271 - for (int i=0; i<segment.size(); ++i)
20.272 - segment.at(i)->show();
20.273 if (p) p->show();
20.274 break;
20.275 default:
20.276 @@ -454,11 +412,8 @@
20.277 break;
20.278 case StylePolyLine:
20.279 if (p) p->hide();
20.280 - if (l) l->hide();
20.281 break;
20.282 case StylePolyParabel:
20.283 - for (int i=0; i<segment.size(); ++i)
20.284 - segment.at(i)->hide();
20.285 if (p) p->hide();
20.286 break;
20.287 default:
20.288 @@ -484,7 +439,7 @@
20.289 else
20.290 {
20.291 // calc orientation depending on position rel to parent
20.292 - if (absPos.x() < QPoint(parObj->getChildPos() ).x() )
20.293 + if (absPos.x() < QPointF(parObj->getChildPos() ).x() )
20.294 orientation=OrientLeftOfCenter;
20.295 else
20.296 orientation=OrientRightOfCenter;
20.297 @@ -527,12 +482,12 @@
20.298 double p2x,p2y; // Set P2 Before setting
20.299 if (!link2ParPos)
20.300 {
20.301 - p2x=QPoint( parObj->getChildPos() ).x(); // P1, we have to look at
20.302 - p2y=QPoint( parObj->getChildPos() ).y(); // orientation
20.303 + p2x=QPointF( parObj->getChildPos() ).x(); // P1, we have to look at
20.304 + p2y=QPointF( parObj->getChildPos() ).y(); // orientation
20.305 } else
20.306 {
20.307 - p2x=QPoint( parObj->getParPos() ).x();
20.308 - p2y=QPoint( parObj->getParPos() ).y();
20.309 + p2x=QPointF( parObj->getParPos() ).x();
20.310 + p2y=QPointF( parObj->getParPos() ).y();
20.311 }
20.312
20.313 setDockPos(); // Call overloaded method
20.314 @@ -545,10 +500,10 @@
20.315 double vy=p2y - p1y;
20.316
20.317 // Draw the horizontal line below heading (from ChildPos to ParPos)
20.318 - bottomline->setPoints (qRound(childPos.x()),
20.319 + bottomline->setLine (QLine (qRound(childPos.x()),
20.320 qRound(childPos.y()),
20.321 qRound(p1x),
20.322 - qRound(p1y) );
20.323 + qRound(p1y) ));
20.324
20.325 double a; // angle
20.326 if (vx > -0.000001 && vx < 0.000001)
20.327 @@ -556,45 +511,38 @@
20.328 else
20.329 a=atan( vy / vx );
20.330 // "turning point" for drawing polygonal links
20.331 - QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));
20.332 + QPointF tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start));
20.333
20.334 // Draw the link
20.335 switch (style)
20.336 {
20.337 case StyleLine:
20.338 - l->setPoints( qRound (parPos.x()),
20.339 + l->setLine( QLine(qRound (parPos.x()),
20.340 qRound(parPos.y()),
20.341 qRound(p2x),
20.342 - qRound(p2y) );
20.343 + qRound(p2y) ));
20.344 break;
20.345 case StyleParabel:
20.346 parabel (pa0, p1x,p1y,p2x,p2y);
20.347 for (int i=0; i<segment.size(); ++i)
20.348 - segment.at(i)->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y());
20.349 + segment.at(i)->setLine(QLineF( pa0.at(i).x(), pa0.at(i).y(),pa0.at(i+1).x(),pa0.at(i+1).y()));
20.350 break;
20.351 case StylePolyLine:
20.352 - pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
20.353 - pa0[1]=QPoint (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
20.354 - pa0[2]=QPoint (qRound (parPos.x()), qRound(parPos.y()) );
20.355 - p->setPoints (pa0);
20.356 - // here too, draw line to avoid missing pixels
20.357 - l->setPoints( qRound (parPos.x()),
20.358 - qRound(parPos.y()),
20.359 - qRound(p2x),
20.360 - qRound(p2y) );
20.361 + pa0.clear();
20.362 + pa0<<QPointF (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
20.363 + pa0<<QPointF (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
20.364 + pa0<<QPointF (qRound (parPos.x()), qRound(parPos.y()) );
20.365 + p->setPolygon(QPolygonF (pa0));
20.366 break;
20.367 case StylePolyParabel:
20.368 parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
20.369 parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
20.370 + pa0.clear();
20.371 for (int i=0;i<=arcsegs;i++)
20.372 - {
20.373 - // Combine the arrays to a single one
20.374 - pa0[i]=pa1[i];
20.375 - pa0[i+arcsegs+1]=pa2[arcsegs-i];
20.376 - }
20.377 - p->setPoints (pa0);
20.378 - for (int i=0; i<segment.size(); ++i)
20.379 - segment.at(i)->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y());
20.380 + pa0 << QPointF (pa1.at(i));
20.381 + for (int i=0;i<=arcsegs;i++)
20.382 + pa0 << QPointF (pa2.at(arcsegs-i));
20.383 + p->setPolygon(QPolygonF (pa0));
20.384 break;
20.385 default:
20.386 break;
20.387 @@ -644,12 +592,12 @@
20.388 return lmo;
20.389 }
20.390
20.391 -QPoint LinkableMapObj::getChildPos()
20.392 +QPointF LinkableMapObj::getChildPos()
20.393 {
20.394 return childPos;
20.395 }
20.396
20.397 -QPoint LinkableMapObj::getParPos()
20.398 +QPointF LinkableMapObj::getParPos()
20.399 {
20.400 return parPos;
20.401 }
20.402 @@ -683,16 +631,16 @@
20.403 return mapEditor;
20.404 }
20.405
20.406 -QPoint LinkableMapObj::getRandPos()
20.407 +QPointF LinkableMapObj::getRandPos()
20.408 {
20.409 // Choose a random position with given distance to parent:
20.410 double a=rand()%360 * 2 * M_PI / 360;
20.411 - return QPoint ( (int)( + 150*cos (a)),
20.412 + return QPointF ( (int)( + 150*cos (a)),
20.413 (int)( + 150*sin (a)));
20.414 }
20.415
20.416 /*
20.417 -void LinkableMapObj::alignRelativeTo (QPoint ref)
20.418 +void LinkableMapObj::alignRelativeTo (QPointF ref)
20.419 {
20.420 // Overloaded, only called for BO, FIO, ...
20.421 // FIXME not needed?
20.422 @@ -702,7 +650,7 @@
20.423 void LinkableMapObj::reposition()
20.424 {
20.425 cout << "LMO::reposition\n";
20.426 - // FIXME not needed? Is overloaded in BranchObj...
20.427 + // FIXME LMO::reposition not needed? Is overloaded in BranchObj...
20.428 /*
20.429 if (depth==0)
20.430 {
20.431 @@ -710,14 +658,14 @@
20.432 // all upper LMOs have to change, too.
20.433 calcBBoxSizeWithChilds();
20.434
20.435 - alignRelativeTo ( QPoint (absPos.x(),
20.436 + alignRelativeTo ( QPointF (absPos.x(),
20.437 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
20.438 } else
20.439 {
20.440 // This is only important for moving branches:
20.441 // For editing a branch it isn't called...
20.442 cout << " reposition to abs "<<absPos<<endl;
20.443 - alignRelativeTo ( QPoint (absPos.x(),
20.444 + alignRelativeTo ( QPointF (absPos.x(),
20.445 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
20.446 }
20.447 */
20.448 @@ -762,9 +710,7 @@
20.449
20.450 void LinkableMapObj::setSelBox()
20.451 {
20.452 - selbox->setX (clickBox.x() );
20.453 - selbox->setY (clickBox.y() );
20.454 - selbox->setSize (clickBox.width(), clickBox.height() );
20.455 + selbox->setRect (clickBox);
20.456 }
20.457
20.458 void LinkableMapObj::select()
20.459 @@ -785,7 +731,7 @@
20.460 setVisibility (visible);
20.461 }
20.462
20.463 -void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y)
20.464 +void LinkableMapObj::parabel (QPolygonF &ya, double p1x, double p1y, double p2x, double p2y)
20.465
20.466 {
20.467 double vx=p2x - p1x; // V=P2-P1
20.468 @@ -802,13 +748,13 @@
20.469 else
20.470 m=(vy / (vx*vx));
20.471 dx=vx/(arcsegs);
20.472 - int i;
20.473 - ya.setPoint (0,QPoint (qRound(p1x),qRound(p1y)));
20.474 - for (i=1;i<=arcsegs;i++)
20.475 + ya.clear();
20.476 + ya<<QPointF (qRound(p1x),qRound(p1y));
20.477 + for (int i=1;i<=arcsegs;i++)
20.478 {
20.479 pnx=p1x+dx;
20.480 pny=m*(pnx-parPos.x())*(pnx-parPos.x())+parPos.y();
20.481 - ya.setPoint (i,QPoint (qRound(pnx),qRound(pny)));
20.482 + ya<<QPointF (qRound(pnx),qRound(pny));
20.483 p1x=pnx;
20.484 p1y=pny;
20.485 }
21.1 --- a/linkablemapobj.h Thu Nov 23 16:18:26 2006 +0000
21.2 +++ b/linkablemapobj.h Fri Dec 08 20:18:56 2006 +0000
21.3 @@ -5,8 +5,7 @@
21.4 #include "noteobj.h"
21.5 #include "headingobj.h"
21.6 #include "flagrowobj.h"
21.7 -//Added by qt3to4:
21.8 -#include <Q3PointArray>
21.9 +
21.10
21.11 #define MAX_DEPTH 999
21.12
21.13 @@ -25,7 +24,7 @@
21.14 Q_OBJECT
21.15 public:
21.16 LinkableMapObj ();
21.17 - LinkableMapObj (Q3Canvas*);
21.18 + LinkableMapObj (QGraphicsScene*);
21.19 LinkableMapObj (LinkableMapObj*);
21.20 ~LinkableMapObj ();
21.21 virtual void delLink();
21.22 @@ -33,20 +32,20 @@
21.23 virtual void copy (LinkableMapObj*);
21.24 void setChildObj (LinkableMapObj*);
21.25 virtual void setParObj (LinkableMapObj*);
21.26 - virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
21.27 + virtual void setParObjTmp (LinkableMapObj*,QPointF,int); // Only for moving Obj around
21.28 virtual void unsetParObjTmp(); // reuse original ParObj
21.29 virtual bool hasParObjTmp();
21.30
21.31 virtual void setUseRelPos (const bool&);
21.32 virtual void setRelPos(); // set relPos to current parentPos
21.33 - virtual void setRelPos(const QPoint&);
21.34 - virtual QPoint getRelPos();
21.35 + virtual void setRelPos(const QPointF&);
21.36 + virtual QPointF getRelPos();
21.37 virtual void setUseOrientation (const bool &);
21.38
21.39
21.40 - virtual int getTopPad();
21.41 - virtual int getLeftPad();
21.42 - virtual int getRightPad();
21.43 + virtual qreal getTopPad();
21.44 + virtual qreal getLeftPad();
21.45 + virtual qreal getRightPad();
21.46 LinkStyle getDefLinkStyle();
21.47 void setLinkStyle(LinkStyle);
21.48 LinkStyle getLinkStyle();
21.49 @@ -70,71 +69,72 @@
21.50 LinkableMapObj* getParObj(); // returns pointer to toObj
21.51 virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
21.52 virtual void setDockPos()=0; // sets childPos and parPos
21.53 - QPoint getChildPos(); // returns pos where childs dock
21.54 - QPoint getParPos(); // returns pos where parents dock
21.55 + QPointF getChildPos(); // returns pos where childs dock
21.56 + QPointF getParPos(); // returns pos where parents dock
21.57 LinkOrient getOrientation(); // get orientation
21.58 virtual int getDepth(); // return depth
21.59 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
21.60 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
21.61 - virtual QPoint getRandPos(); // make randomised position
21.62 + virtual QPointF getRandPos(); // make randomised position
21.63
21.64 - //virtual void alignRelativeTo(const QPoint );
21.65 + //virtual void alignRelativeTo(const QPointF );
21.66 virtual void reposition();
21.67 virtual void requestReposition(); // do reposition after next user event
21.68 virtual void forceReposition(); // to force a reposition now (outside
21.69 // of mapeditor e.g. in noteeditor
21.70 virtual bool repositionRequested();
21.71
21.72 - //virtual QRect getTotalBBox(); // return BBox including childs
21.73 - //virtual QRect getBBoxSizeWithChilds();// return size of BBox including childs
21.74 + //virtual QRectF getTotalBBox(); // return BBox including childs
21.75 + //virtual QRectF getBBoxSizeWithChilds();// return size of BBox including childs
21.76 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
21.77
21.78 virtual void setSelBox();
21.79 virtual void select();
21.80 virtual void unselect();
21.81 virtual QString getSelectString()=0;
21.82 - //virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data to XML
21.83 + //virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data to XML
21.84
21.85 protected:
21.86 - void parabel(Q3PointArray &,double,double,double,double); // Create Parabel connecting two points
21.87 + void parabel(QPolygonF &,double,double,double,double); // Create Parabel connecting two points
21.88 QString getLinkAttr();
21.89
21.90 - QPoint childPos;
21.91 - QPoint parPos;
21.92 + QPointF childPos;
21.93 + QPointF parPos;
21.94 bool link2ParPos; // While moving around, sometimes link to parent
21.95 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
21.96 LinkOrient orientation;
21.97 - int linkwidth; // width of a link
21.98 + qreal linkwidth; // width of a link
21.99 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
21.100 - QRect bboxTotal; // bounding box including childs
21.101 + QRectF bboxTotal; // bounding box including childs
21.102
21.103 LinkableMapObj* childObj;
21.104 LinkableMapObj* parObj;
21.105 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
21.106 - int bottomlineY; // vertical offset of dockpos to pos
21.107 + qreal bottomlineY; // vertical offset of dockpos to pos
21.108
21.109 int thickness_start; // for StylePoly*
21.110 LinkStyle style; // Current style
21.111 LinkPos linkpos; // Link at bottom of object or middle of height
21.112 QColor linkcolor; // Link color
21.113 - Q3CanvasLine* l; // line style
21.114 - Q3CanvasPolygon* p; // poly styles
21.115 + QPen pen;
21.116 + QGraphicsLineItem* l; // line style
21.117 + QGraphicsPolygonItem* p; // poly styles
21.118 int arcsegs; // arc: number of segments
21.119 - QList <Q3CanvasLine*> segment; // a part of e.g. the parabel
21.120 - Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
21.121 - Q3PointArray pa1; // For drawing of PolyParabel
21.122 - Q3PointArray pa2; // For drawing of PolyParabel
21.123 - Q3CanvasLine* bottomline; // on bottom of BBox
21.124 + QList <QGraphicsLineItem*> segment; // a part of e.g. the parabel
21.125 + QPolygonF pa0; // For drawing of PolyParabel and PolyLine
21.126 + QPolygonF pa1; // For drawing of PolyParabel
21.127 + QPolygonF pa2; // For drawing of PolyParabel
21.128 + QGraphicsLineItem* bottomline; // on bottom of BBox
21.129 bool repositionRequest; //
21.130
21.131 bool selected; // Used for marking the selection
21.132 bool hideLinkUnselected; // to hide links if unselected
21.133 - Q3CanvasRectangle* selbox;
21.134 + QGraphicsRectItem* selbox;
21.135 FrameObj *frame; // frame around object
21.136 - int topPad, botPad,
21.137 + qreal topPad, botPad,
21.138 leftPad, rightPad; // padding within bbox
21.139
21.140 - QPoint relPos; // position relative to childPos of parent
21.141 + QPointF relPos; // position relative to childPos of parent
21.142 bool useRelPos;
21.143 bool useOrientation;
21.144 };
22.1 --- a/mainwindow.cpp Thu Nov 23 16:18:26 2006 +0000
22.2 +++ b/mainwindow.cpp Fri Dec 08 20:18:56 2006 +0000
22.3 @@ -169,9 +169,10 @@
22.4 // Save Settings
22.5 settings.setValue ( "/mainwindow/geometry/size", size() );
22.6 settings.setValue ( "/mainwindow/geometry/pos", pos() );
22.7 -
22.8 settings.setValue ("/mainwindow/state",saveState(0));
22.9
22.10 + settings.setValue ("/mainwindow/view/AntiAlias",actionViewToggleAntiAlias->isOn());
22.11 + settings.setValue ("/mainwindow/view/SmoothPixmapTransform",actionViewToggleSmoothPixmapTransform->isOn());
22.12 settings.setValue( "/version/version", vymVersion );
22.13 settings.setValue( "/version/builddate", vymBuildDate );
22.14
22.15 @@ -891,6 +892,12 @@
22.16 formatMenu->addAction (a);
22.17 connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackColor() ) );
22.18 actionFormatBackColor=a;
22.19 +
22.20 + a= new QAction( pix, tr( "Set &Background image" )+QString("..."), this );
22.21 + a->setStatusTip (tr( "Set Background image" ));
22.22 + formatMenu->addAction (a);
22.23 + connect( a, SIGNAL( triggered() ), this, SLOT( formatSelectBackImage() ) );
22.24 + actionFormatBackImage=a;
22.25 }
22.26
22.27 // View Actions
22.28 @@ -946,14 +953,30 @@
22.29 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
22.30 actionViewToggleHistoryWindow=a;
22.31
22.32 + a = new QAction(tr( "Antialiasing","View action" ),this );
22.33 + a->setStatusTip ( tr( "Antialiasing" ));
22.34 + a->setToggleAction(true);
22.35 + a->setOn (settings.value("/mainwindow/view/AntiAlias",true).toBool());
22.36 + viewMenu->addAction (a);
22.37 + connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) );
22.38 + actionViewToggleAntiAlias=a;
22.39 +
22.40 + a = new QAction(tr( "Smooth pixmap transformations","View action" ),this );
22.41 + a->setStatusTip (a->text());
22.42 + a->setToggleAction(true);
22.43 + a->setOn (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
22.44 + viewMenu->addAction (a);
22.45 + connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) );
22.46 + actionViewToggleSmoothPixmapTransform=a;
22.47 +
22.48 a = new QAction(tr( "Next Window","View action" ), this);
22.49 - a->setStatusTip ( tr( "&Next Window" ) );
22.50 + a->setStatusTip (a->text());
22.51 a->setShortcut (Qt::ALT + Qt::Key_N );
22.52 viewMenu->addAction (a);
22.53 connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
22.54
22.55 a = new QAction (tr( "Previous Window","View action" ), this );
22.56 - a->setStatusTip (tr( "&Previous Window" ));
22.57 + a->setStatusTip (a->text());
22.58 a->setShortcut (Qt::ALT + Qt::Key_P );
22.59 viewMenu->addAction (a);
22.60 connect( a, SIGNAL( triggered() ), this, SLOT(windowPreviousEditor() ) );
22.61 @@ -1041,7 +1064,7 @@
22.62 standardFlagsDefault->setName ("standardFlagsDef");
22.63 standardFlagsDefault->setToolBar (tb);
22.64
22.65 - fo->load(QPixmap(flagsPath+"flag-exclamationmark.png"));
22.66 + fo->load(flagsPath+"flag-exclamationmark.png");
22.67 fo->setName ("exclamationmark");
22.68 fo->setGroup("standard-mark");
22.69 QAction *a=new QAction (fo->getPixmap(),fo->getName(),this);
22.70 @@ -1053,7 +1076,7 @@
22.71 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.72 standardFlagsDefault->addFlag (fo); // makes deep copy
22.73
22.74 - fo->load(QPixmap(flagsPath+"flag-questionmark.png"));
22.75 + fo->load(flagsPath+"flag-questionmark.png");
22.76 fo->setName("questionmark");
22.77 fo->setGroup("standard-mark");
22.78 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.79 @@ -1065,7 +1088,7 @@
22.80 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.81 standardFlagsDefault->addFlag (fo);
22.82
22.83 - fo->load(QPixmap(flagsPath+"flag-hook-green.png"));
22.84 + fo->load(flagsPath+"flag-hook-green.png");
22.85 fo->setName("hook-green");
22.86 fo->setGroup("standard-hook");
22.87 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.88 @@ -1077,7 +1100,7 @@
22.89 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.90 standardFlagsDefault->addFlag (fo);
22.91
22.92 - fo->load(QPixmap(flagsPath+"flag-cross-red.png"));
22.93 + fo->load(flagsPath+"flag-cross-red.png");
22.94 fo->setName("cross-red");
22.95 fo->setGroup("standard-hook");
22.96 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.97 @@ -1089,7 +1112,7 @@
22.98 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.99 standardFlagsDefault->addFlag (fo);
22.100
22.101 - fo->load(QPixmap(flagsPath+"flag-stopsign.png"));
22.102 + fo->load(flagsPath+"flag-stopsign.png");
22.103 fo->setName("stopsign");
22.104 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.105 tb->addAction (a);
22.106 @@ -1100,7 +1123,7 @@
22.107 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.108 standardFlagsDefault->addFlag (fo);
22.109
22.110 - fo->load(QPixmap(flagsPath+"flag-smiley-good.png"));
22.111 + fo->load(flagsPath+"flag-smiley-good.png");
22.112 fo->setName("smiley-good");
22.113 fo->setGroup("standard-smiley");
22.114 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.115 @@ -1112,7 +1135,7 @@
22.116 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.117 standardFlagsDefault->addFlag (fo);
22.118
22.119 - fo->load(QPixmap(flagsPath+"flag-smiley-sad.png"));
22.120 + fo->load(flagsPath+"flag-smiley-sad.png");
22.121 fo->setName("smiley-sad");
22.122 fo->setGroup("standard-smiley");
22.123 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.124 @@ -1124,7 +1147,7 @@
22.125 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.126 standardFlagsDefault->addFlag (fo);
22.127
22.128 - fo->load(QPixmap(flagsPath+"flag-smiley-omg.png"));
22.129 + fo->load(flagsPath+"flag-smiley-omg.png");
22.130 // Original omg.png (in KDE emoticons)
22.131 fo->setName("smiley-omg");
22.132 fo->setGroup("standard-smiley");
22.133 @@ -1137,7 +1160,7 @@
22.134 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.135 standardFlagsDefault->addFlag (fo);
22.136
22.137 - fo->load(QPixmap(flagsPath+"flag-kalarm.png"));
22.138 + fo->load(flagsPath+"flag-kalarm.png");
22.139 fo->setName("clock");
22.140 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.141 tb->addAction (a);
22.142 @@ -1148,7 +1171,7 @@
22.143 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.144 standardFlagsDefault->addFlag (fo);
22.145
22.146 - fo->load(QPixmap(flagsPath+"flag-phone.png"));
22.147 + fo->load(flagsPath+"flag-phone.png");
22.148 fo->setName("phone");
22.149 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.150 tb->addAction (a);
22.151 @@ -1159,7 +1182,7 @@
22.152 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.153 standardFlagsDefault->addFlag (fo);
22.154
22.155 - fo->load(QPixmap(flagsPath+"flag-lamp.png"));
22.156 + fo->load(flagsPath+"flag-lamp.png");
22.157 fo->setName("lamp");
22.158 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.159 tb->addAction (a);
22.160 @@ -1170,7 +1193,7 @@
22.161 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.162 standardFlagsDefault->addFlag (fo);
22.163
22.164 - fo->load(QPixmap(flagsPath+"flag-arrow-up.png"));
22.165 + fo->load(flagsPath+"flag-arrow-up.png");
22.166 fo->setName("arrow-up");
22.167 fo->setGroup("standard-arrow");
22.168 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.169 @@ -1182,7 +1205,7 @@
22.170 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.171 standardFlagsDefault->addFlag (fo);
22.172
22.173 - fo->load(QPixmap(flagsPath+"flag-arrow-down.png"));
22.174 + fo->load(flagsPath+"flag-arrow-down.png");
22.175 fo->setName("arrow-down");
22.176 fo->setGroup("standard-arrow");
22.177 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.178 @@ -1194,7 +1217,7 @@
22.179 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.180 standardFlagsDefault->addFlag (fo);
22.181
22.182 - fo->load(QPixmap(flagsPath+"flag-arrow-2up.png"));
22.183 + fo->load(flagsPath+"flag-arrow-2up.png");
22.184 fo->setName("2arrow-up");
22.185 fo->setGroup("standard-arrow");
22.186 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.187 @@ -1206,7 +1229,7 @@
22.188 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.189 standardFlagsDefault->addFlag (fo);
22.190
22.191 - fo->load(QPixmap(flagsPath+"flag-arrow-2down.png"));
22.192 + fo->load(flagsPath+"flag-arrow-2down.png");
22.193 fo->setName("2arrow-down");
22.194 fo->setGroup("standard-arrow");
22.195 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.196 @@ -1218,7 +1241,7 @@
22.197 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.198 standardFlagsDefault->addFlag (fo);
22.199
22.200 - fo->load(QPixmap(flagsPath+"flag-thumb-up.png"));
22.201 + fo->load(flagsPath+"flag-thumb-up.png");
22.202 fo->setName("thumb-up");
22.203 fo->setGroup("standard-thumb");
22.204 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.205 @@ -1230,7 +1253,7 @@
22.206 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.207 standardFlagsDefault->addFlag (fo);
22.208
22.209 - fo->load(QPixmap(flagsPath+"flag-thumb-down.png"));
22.210 + fo->load(flagsPath+"flag-thumb-down.png");
22.211 fo->setName("thumb-down");
22.212 fo->setGroup("standard-thumb");
22.213 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.214 @@ -1242,7 +1265,7 @@
22.215 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.216 standardFlagsDefault->addFlag (fo);
22.217
22.218 - fo->load(QPixmap(flagsPath+"flag-rose.png"));
22.219 + fo->load(flagsPath+"flag-rose.png");
22.220 fo->setName("rose");
22.221 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.222 tb->addAction (a);
22.223 @@ -1253,7 +1276,7 @@
22.224 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.225 standardFlagsDefault->addFlag (fo);
22.226
22.227 - fo->load(QPixmap(flagsPath+"flag-heart.png"));
22.228 + fo->load(flagsPath+"flag-heart.png");
22.229 fo->setName("heart");
22.230 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.231 tb->addAction (a);
22.232 @@ -1263,7 +1286,7 @@
22.233 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.234 standardFlagsDefault->addFlag (fo);
22.235
22.236 - fo->load(QPixmap(flagsPath+"flag-present.png"));
22.237 + fo->load(flagsPath+"flag-present.png");
22.238 fo->setName("present");
22.239 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.240 tb->addAction (a);
22.241 @@ -1274,7 +1297,7 @@
22.242 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.243 standardFlagsDefault->addFlag (fo);
22.244
22.245 - fo->load(QPixmap(flagsPath+"flag-flash.png"));
22.246 + fo->load(flagsPath+"flag-flash.png");
22.247 fo->setName("flash");
22.248 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.249 tb->addAction (a);
22.250 @@ -1285,7 +1308,7 @@
22.251 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.252 standardFlagsDefault->addFlag (fo);
22.253
22.254 - fo->load(QPixmap(flagsPath+"flag-info.png"));
22.255 + fo->load(flagsPath+"flag-info.png");
22.256 // Original: xsldbg_output.png
22.257 fo->setName("info");
22.258 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.259 @@ -1297,7 +1320,7 @@
22.260 connect (a, SIGNAL( triggered() ), this, SLOT( standardFlagChanged() ) );
22.261 standardFlagsDefault->addFlag (fo);
22.262
22.263 - fo->load(QPixmap(flagsPath+"flag-lifebelt.png"));
22.264 + fo->load(flagsPath+"flag-lifebelt.png");
22.265 // Original khelpcenter.png
22.266 fo->setName("lifebelt");
22.267 a=new QAction (fo->getPixmap(),fo->getName(),this);
22.268 @@ -1507,6 +1530,7 @@
22.269 actionFormatLinkColorHint->addTo( canvasContextMenu );
22.270 actionFormatLinkColor->addTo( canvasContextMenu );
22.271 actionFormatBackColor->addTo( canvasContextMenu );
22.272 + actionFormatBackImage->addTo( canvasContextMenu );
22.273
22.274 // Menu for last opened files
22.275 // Create actions
22.276 @@ -1620,12 +1644,15 @@
22.277 void Main::fileNew()
22.278 {
22.279 QString fn="unnamed";
22.280 - MapEditor* medit = new MapEditor ( NULL);
22.281 - tabWidget->addTab (medit,fn);
22.282 - tabWidget->showPage(medit);
22.283 - medit->viewport()->setFocus();
22.284 + MapEditor* me = new MapEditor ( NULL);
22.285 + tabWidget->addTab (me,fn);
22.286 + tabWidget->showPage(me);
22.287 + me->viewport()->setFocus();
22.288 + me->setAntiAlias (actionViewToggleAntiAlias->isOn());
22.289 + me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
22.290 +
22.291 // For the very first map we do not have flagrows yet...
22.292 - medit->select("mc:");
22.293 + me->select("mc:");
22.294 }
22.295
22.296 ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
22.297 @@ -1692,6 +1719,8 @@
22.298 tabWidget->addTab (me,fn);
22.299 tabIndex=tabWidget->indexOf (me);
22.300 tabWidget->setCurrentPage (tabIndex);
22.301 + me->setAntiAlias (actionViewToggleAntiAlias->isOn());
22.302 + me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
22.303 }
22.304
22.305 // Check, if file exists (important for creating new files
22.306 @@ -2629,7 +2658,7 @@
22.307 if (ok)
22.308 {
22.309 #if defined(Q_OS_MACX)
22.310 - p = currentMapEditor()->mapToGlobal( currentMapEditor()->worldMatrix().map( p));
22.311 + p=currentMapEditor()->mapTo (this,p);
22.312 QDialog *d =new QDialog(NULL);
22.313 QLineEdit *le=new QLineEdit (d);
22.314 d->setWindowFlags (Qt::FramelessWindowHint);
22.315 @@ -2645,7 +2674,7 @@
22.316 delete (d);
22.317 editHeadingFinished();
22.318 #else
22.319 - p = currentMapEditor()->mapTo(this, currentMapEditor()->worldMatrix().map( p));
22.320 + p=currentMapEditor()->mapTo (this,p);
22.321 lineedit->setGeometry(p.x(),p.y(),230,25);
22.322 lineedit->setText(s);
22.323 lineedit->setCursorPosition(1);
22.324 @@ -3011,6 +3040,12 @@
22.325 currentMapEditor()->selectMapBackgroundColor();
22.326 }
22.327
22.328 +void Main::formatSelectBackImage()
22.329 +{
22.330 + if (currentMapEditor())
22.331 + currentMapEditor()->selectMapBackgroundImage();
22.332 +}
22.333 +
22.334 void Main::formatSelectLinkColor()
22.335 {
22.336 if (currentMapEditor())
22.337 @@ -3058,7 +3093,7 @@
22.338 {
22.339 QMatrix m;
22.340 m.reset();
22.341 - currentMapEditor()->setWorldMatrix( m );
22.342 + currentMapEditor()->setMatrix( m );
22.343 currentMapEditor()->setViewCenter();
22.344 currentMapEditor()->adjustCanvasSize();
22.345 }
22.346 @@ -3068,9 +3103,9 @@
22.347 {
22.348 if (currentMapEditor())
22.349 {
22.350 - QMatrix m = currentMapEditor()->worldMatrix();
22.351 + QMatrix m = currentMapEditor()->matrix();
22.352 m.scale( 1.25, 1.25 );
22.353 - currentMapEditor()->setWorldMatrix( m );
22.354 + currentMapEditor()->setMatrix( m );
22.355 currentMapEditor()->setViewCenter();
22.356 currentMapEditor()->adjustCanvasSize();
22.357 }
22.358 @@ -3080,9 +3115,9 @@
22.359 {
22.360 if (currentMapEditor())
22.361 {
22.362 - QMatrix m = currentMapEditor()->worldMatrix();
22.363 + QMatrix m = currentMapEditor()->matrix();
22.364 m.scale( 0.8, 0.8 );
22.365 - currentMapEditor()->setWorldMatrix( m );
22.366 + currentMapEditor()->setMatrix( m );
22.367 currentMapEditor()->setViewCenter();
22.368 currentMapEditor()->adjustCanvasSize();
22.369 }
22.370 @@ -3142,6 +3177,31 @@
22.371
22.372 }
22.373
22.374 +void Main::windowToggleAntiAlias()
22.375 +{
22.376 + bool b=actionViewToggleAntiAlias->isOn();
22.377 + MapEditor *me;
22.378 + for (int i=0;i<tabWidget->count();i++)
22.379 + {
22.380 +
22.381 + me=(MapEditor*)tabWidget->page(i);
22.382 + me->setAntiAlias(b);
22.383 + }
22.384 +
22.385 +}
22.386 +
22.387 +void Main::windowToggleSmoothPixmap()
22.388 +{
22.389 + bool b=actionViewToggleSmoothPixmapTransform->isOn();
22.390 + MapEditor *me;
22.391 + for (int i=0;i<tabWidget->count();i++)
22.392 + {
22.393 +
22.394 + me=(MapEditor*)tabWidget->page(i);
22.395 + me->setSmoothPixmap(b);
22.396 + }
22.397 +}
22.398 +
22.399 void Main::updateHistory(SimpleSettings &undoSet)
22.400 {
22.401 historyWindow->update (undoSet);
22.402 @@ -3457,12 +3517,12 @@
22.403 }
22.404
22.405 QString docpath=docdir.path()+"/"+docname;
22.406 + QStringList args;
22.407 Process *pdfProc = new Process();
22.408 - pdfProc->clearArguments();
22.409 - pdfProc->addArgument( settings.value("/mainwindow/readerPDF").toString());
22.410 - pdfProc->addArgument( docpath);
22.411 -
22.412 - if ( !pdfProc->start() )
22.413 + args <<docpath;
22.414 +
22.415 + pdfProc->start( settings.value("/mainwindow/readerPDF").toString());
22.416 + if ( !pdfProc->waitForStarted() )
22.417 {
22.418 // error handling
22.419 QMessageBox::warning(0,
23.1 --- a/mainwindow.h Thu Nov 23 16:18:26 2006 +0000
23.2 +++ b/mainwindow.h Fri Dec 08 20:18:56 2006 +0000
23.3 @@ -143,6 +143,7 @@
23.4 void formatLinkStylePolyLine();
23.5 void formatLinkStylePolyParabel();
23.6 void formatSelectBackColor();
23.7 + void formatSelectBackImage();
23.8 void formatSelectLinkColor();
23.9 void formatToggleLinkColorHint();
23.10 void formatFrameNone();
23.11 @@ -163,6 +164,8 @@
23.12 void windowToggleNoteEditor();
23.13 void windowToggleHistory();
23.14 void updateHistory(SimpleSettings &);
23.15 + void windowToggleAntiAlias();
23.16 + void windowToggleSmoothPixmap();
23.17 void updateNoteFlag();
23.18 void updateActions();
23.19 ModMode getModMode();
23.20 @@ -249,6 +252,7 @@
23.21 QAction* actionFormatColorSubtree;
23.22 QAction* actionFormatLinkColorHint;
23.23 QAction* actionFormatBackColor;
23.24 + QAction* actionFormatBackImage;
23.25 QAction* actionFormatLinkColor;
23.26 QAction *actionFormatIncludeImagesVer;
23.27 QAction *actionFormatIncludeImagesHor;
23.28 @@ -271,6 +275,8 @@
23.29
23.30 QAction *actionViewToggleNoteEditor;
23.31 QAction *actionViewToggleHistoryWindow;
23.32 + QAction *actionViewToggleAntiAlias;
23.33 + QAction *actionViewToggleSmoothPixmapTransform;
23.34
23.35 QAction* actionSettingsAutoEdit;
23.36 QAction* actionSettingsAutoSelectHeading;
24.1 --- a/mapcenterobj.cpp Thu Nov 23 16:18:26 2006 +0000
24.2 +++ b/mapcenterobj.cpp Fri Dec 08 20:18:56 2006 +0000
24.3 @@ -12,9 +12,9 @@
24.4 init();
24.5 }
24.6
24.7 -MapCenterObj::MapCenterObj(Q3Canvas* c) : BranchObj (c)
24.8 +MapCenterObj::MapCenterObj(QGraphicsScene* s) : BranchObj (s)
24.9 {
24.10 -// cout << "Const MapCenterObj canvas="<<c<<"\n";
24.11 +// cout << "Const MapCenterObj canvas="<<s<<"\n";
24.12 init();
24.13 }
24.14
24.15 @@ -95,7 +95,7 @@
24.16 if (repositionRequest) reposition();
24.17 }
24.18
24.19 -LinkableMapObj* MapCenterObj::findMapObj(QPoint p, LinkableMapObj *excludeLMO)
24.20 +LinkableMapObj* MapCenterObj::findMapObj(QPointF p, LinkableMapObj *excludeLMO)
24.21 {
24.22 LinkableMapObj *lmo;
24.23
24.24 @@ -116,16 +116,16 @@
24.25 return NULL;
24.26 }
24.27
24.28 -QString MapCenterObj::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPoint &offset)
24.29 +QString MapCenterObj::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
24.30 {
24.31 QString s,a;
24.32
24.33 // save area, if not scrolled
24.34 QString areaAttr=
24.35 - attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
24.36 - attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
24.37 - attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
24.38 - attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
24.39 + attribut("x1",QString().setNum(absPos.x()-offset.x())) +
24.40 + attribut("y1",QString().setNum(absPos.y()-offset.y())) +
24.41 + attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
24.42 + attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
24.43
24.44 // Providing an ID for a branch makes export to XHTML easier
24.45 QString idAttr;
25.1 --- a/mapcenterobj.h Thu Nov 23 16:18:26 2006 +0000
25.2 +++ b/mapcenterobj.h Fri Dec 08 20:18:56 2006 +0000
25.3 @@ -10,7 +10,7 @@
25.4 class MapCenterObj:public BranchObj {
25.5 public:
25.6 MapCenterObj ();
25.7 - MapCenterObj (Q3Canvas*);
25.8 + MapCenterObj (QGraphicsScene *);
25.9 ~MapCenterObj ();
25.10 void clear();
25.11 void init();
25.12 @@ -20,8 +20,8 @@
25.13 virtual void moveAllBy (double,double);
25.14 virtual void updateLink();
25.15 virtual void updateRelPositions();
25.16 - LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
25.17 - virtual QString saveToDir (const QString&,const QString&,int, const QPoint&);// Save data recursivly to tempdir
25.18 + LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
25.19 + virtual QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
25.20 void setVersion(const QString &);
25.21 void setAuthor (const QString &);
25.22 QString getAuthor ();
26.1 --- a/mapeditor.cpp Thu Nov 23 16:18:26 2006 +0000
26.2 +++ b/mapeditor.cpp Fri Dec 08 20:18:56 2006 +0000
26.3 @@ -1,5 +1,9 @@
26.4 #include "mapeditor.h"
26.5
26.6 +#include <q3dragobject.h>
26.7 +#include <q3urloperator.h>
26.8 +#include <q3networkprotocol.h>
26.9 +#include <q3paintdevicemetrics.h>
26.10 #include <q3filedialog.h>
26.11
26.12 #include <iostream>
26.13 @@ -53,30 +57,34 @@
26.14
26.15 ///////////////////////////////////////////////////////////////////////
26.16 ///////////////////////////////////////////////////////////////////////
26.17 -MapEditor::MapEditor(
26.18 - QWidget* parent, const char* name, Qt::WFlags f) :
26.19 - Q3CanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
26.20 +MapEditor::MapEditor( QWidget* parent) :
26.21 + QGraphicsView(parent), urlOperator(0), imageBuffer(0)
26.22 {
26.23 //cout << "Constructor ME "<<this<<endl;
26.24 mapNum++;
26.25
26.26 viewport()->setAcceptDrops(true);
26.27
26.28 - mapCanvas = new Q3Canvas(width(),height());
26.29 - mapCanvas->setAdvancePeriod(30);
26.30 - mapCanvas->setBackgroundColor (Qt::white);
26.31 -
26.32 - setCanvas (mapCanvas);
26.33 + mapScene= new QGraphicsScene(parent);
26.34 + //mapScene= new QGraphicsScene(QRectF(0,0,width(),height()), parent);
26.35 + mapScene->setBackgroundBrush (QBrush(Qt::white, Qt::SolidPattern));
26.36 +
26.37 +
26.38 + setScene (mapScene);
26.39
26.40 + /* FIXME not needed in QT4?
26.41 + // Maybe check QAbstractScrollArea...
26.42 // Always show scroll bars (automatic would flicker sometimes)
26.43 - setVScrollBarMode ( Q3ScrollView::AlwaysOn );
26.44 - setHScrollBarMode ( Q3ScrollView::AlwaysOn );
26.45 -
26.46 - mapCenter = new MapCenterObj(mapCanvas);
26.47 + setVScrollBarMode ( QScrollView::AlwaysOn );
26.48 + setHScrollBarMode ( QScrollView::AlwaysOn );
26.49 + */
26.50 +
26.51 + mapCenter = new MapCenterObj(mapScene);
26.52 mapCenter->setVisibility (true);
26.53 mapCenter->setMapEditor (this);
26.54 mapCenter->setHeading (tr("New Map","Heading of mapcenter in new map"));
26.55 - mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->height()/2);
26.56 + //mapCenter->move(mapScene->width()/2-mapCenter->width()/2,mapScene->height()/2-mapCenter->height()/2);
26.57 + mapCenter->move(0,0);
26.58
26.59 printer=NULL;
26.60
26.61 @@ -157,60 +165,64 @@
26.62 return mapCenter;
26.63 }
26.64
26.65 -Q3Canvas* MapEditor::getCanvas()
26.66 +QGraphicsScene * MapEditor::getScene()
26.67 {
26.68 - return mapCanvas;
26.69 + return mapScene;
26.70 }
26.71
26.72 void MapEditor::adjustCanvasSize()
26.73 {
26.74 - // To adjust the canvas to map, viewport size and position, we have to
26.75 +
26.76 +/* FIXME QT4 probably not needed any longer!
26.77 +
26.78 + // To adjust the scene to map, viewport size and position, we have to
26.79 // do some coordinate magic...
26.80 //
26.81 // Get rectangle of (scroll-)view.
26.82 - // We want to be in canvas coords, so
26.83 + // We want to be in scene coords, so
26.84 // we map. Important if view is zoomed...
26.85 - QRect view = inverseWorldMatrix().mapRect( QRect( contentsX(), contentsY(),
26.86 + QRectF view = inverseWorldMatrix().mapRect( QRectF( contentsX(), contentsY(),
26.87 visibleWidth(), visibleHeight()) );
26.88
26.89 - // Now we need the bounding box of view AND map to calc the correct canvas size.
26.90 + // Now we need the bounding box of view AND map to calc the correct scene size.
26.91 // Why? Because if the map itself is moved out of view, the view has to be enlarged
26.92 // to avoid jumping aroung...
26.93 - QRect map=mapCenter->getTotalBBox();
26.94 + QRectF map=mapCenter->getTotalBBox();
26.95
26.96 // right edge - left edge
26.97 int cw= max(map.x() + map.width(), view.x() + view.width()) - min(map.x(), view.x());
26.98 int ch= max(map.y() + map.height(), view.y() + view.height()) - min(map.y(), view.y());
26.99
26.100
26.101 - if ( (cw!=mapCanvas->width()) || (ch!=mapCanvas->height()) ||
26.102 - !mapCanvas->onCanvas (map.topLeft()) || !mapCanvas->onCanvas (map.bottomRight())
26.103 + if ( (cw!=mapScene->width()) || (ch!=mapScene->height()) ||
26.104 + !mapScene->onCanvas (map.topLeft()) || !mapScene->onCanvas (map.bottomRight())
26.105 )
26.106 {
26.107 - // move the map on canvas (in order to not move it on screen) this is neccessary
26.108 - // a) if topleft corner of canvas is left or above topleft corner of view and also left of
26.109 + // move the map on scene (in order to not move it on screen) this is neccessary
26.110 + // a) if topleft corner of scene is left or above topleft corner of view and also left of
26.111 // above topleft corner of map. E.g. if map is completly inside view, but it would be possible
26.112 - // to scroll to an empty area of canvas to the left.
26.113 - // b) if topleft corner of map left of or above topleft of canvas
26.114 + // to scroll to an empty area of scene to the left.
26.115 + // b) if topleft corner of map left of or above topleft of scene
26.116 int dx=0;
26.117 int dy=0;
26.118
26.119 - if (cw > mapCanvas->width() )
26.120 + if (cw > mapScene->width() )
26.121 {
26.122 if (map.x()<0) dx=-map.x();
26.123 }
26.124 - if (cw < mapCanvas->width() )
26.125 + if (cw < mapScene->width() )
26.126 dx=-min (view.x(),map.x());
26.127 - if (ch > mapCanvas->height() )
26.128 + if (ch > mapScene->height() )
26.129 {
26.130 if (map.y()<0) dy=-map.y();
26.131 }
26.132 - if (ch < mapCanvas->height() )
26.133 + if (ch < mapScene->height() )
26.134 {
26.135 dy=-min (view.y(),map.y());
26.136 }
26.137 // We really have to resize now. Let's go...
26.138 - mapCanvas->resize (cw,ch);
26.139 + // FIXME old code mapScene->resize (cw,ch);
26.140 + mapScene->setSceneRect (QRectFF(0,0,cw,ch));
26.141 if ( (dx!=0) || (dy!=0) )
26.142 {
26.143 mapCenter->moveAllBy(dx,dy);
26.144 @@ -221,6 +233,8 @@
26.145 scrollBy (dx,dy);
26.146 }
26.147 }
26.148 +
26.149 + */
26.150 }
26.151
26.152 bool MapEditor::isRepositionBlocked()
26.153 @@ -257,12 +271,12 @@
26.154 d.mkdir (tmpMapDir);
26.155 }
26.156
26.157 -QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSel)
26.158 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel)
26.159 {
26.160 // tmpdir temporary directory to which data will be written
26.161 // prefix mapname, which will be appended to images etc.
26.162 // writeflags Only write flags for "real" save of map, not undo
26.163 - // offset offset of bbox of whole map in canvas.
26.164 + // offset offset of bbox of whole map in scene.
26.165 // Needed for XML export
26.166
26.167 // Save Header
26.168 @@ -293,7 +307,7 @@
26.169 mapAttr+= attribut("author",mapCenter->getAuthor()) +
26.170 attribut("comment",mapCenter->getComment()) +
26.171 attribut("date",mapCenter->getDate()) +
26.172 - attribut("backgroundColor", mapCanvas->backgroundColor().name() ) +
26.173 + attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) +
26.174 attribut("linkStyle", ls ) +
26.175 attribut("linkColor", defLinkColor.name() ) +
26.176 attribut("defXLinkColor", defXLinkColor.name() ) +
26.177 @@ -307,7 +321,7 @@
26.178
26.179 // Reset the counters before saving
26.180 // TODO constr. of FIO creates lots of objects, better do this in some other way...
26.181 - FloatImageObj (mapCanvas).resetSaveCounter();
26.182 + FloatImageObj (mapScene).resetSaveCounter();
26.183
26.184 // Build xml recursivly
26.185 if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
26.186 @@ -447,7 +461,7 @@
26.187
26.188 // Save depending on how much needs to be saved
26.189 if (saveSel)
26.190 - backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),saveSel);
26.191 + backupXML=saveToDir (bakMapDir,mapName+"-",false, QPointF (),saveSel);
26.192
26.193 QString undoCommand="";
26.194 if (savemode==UndoCommand)
26.195 @@ -496,8 +510,8 @@
26.196 if (saveSel) cout << " saveSel="<<saveSel->getSelectString().ascii()<<endl;
26.197 cout << " ---------------------------"<<endl;
26.198
26.199 + mainWindow->updateHistory (undoSet);
26.200 setChanged();
26.201 - mainWindow->updateHistory (undoSet);
26.202 updateActions();
26.203 }
26.204
26.205 @@ -1136,9 +1150,9 @@
26.206
26.207 QString saveFile;
26.208 if (savemode==CompleteMap || selection==NULL)
26.209 - saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),NULL);
26.210 + saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
26.211 else
26.212 - saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),selection);
26.213 + saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),selection);
26.214
26.215 if (!saveStringToDisk(fileDir+fname,saveFile))
26.216 return 1;
26.217 @@ -1172,7 +1186,7 @@
26.218 printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
26.219 }
26.220
26.221 - QRect totalBBox=mapCenter->getTotalBBox();
26.222 + QRectF totalBBox=mapCenter->getTotalBBox();
26.223
26.224 // Try to set orientation automagically
26.225 // Note: Interpretation of generated postscript is amibiguous, if
26.226 @@ -1201,15 +1215,18 @@
26.227
26.228 // Handle sizes of map and paper:
26.229 //
26.230 - // setWindow defines which part of the canvas will be transformed
26.231 + // setWindow defines which part of the scene will be transformed
26.232 // setViewport defines area on paper in device coordinates (dpi)
26.233 // e.g. (0,50,700,700) is upper part on A4
26.234 // see also /usr/lib/qt3/doc/html/coordsys.html
26.235
26.236 - double paperAspect = (double)printer->width() / (double)printer->height();
26.237 + Q3PaintDeviceMetrics metrics (printer);
26.238 +
26.239 + double paperAspect = (double)metrics.width() / (double)metrics.height();
26.240 double mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
26.241
26.242 - QRect mapRect=totalBBox;
26.243 + QRectF mapRect=totalBBox;
26.244 +/* FIXME todo for QT4
26.245 Q3CanvasRectangle *frame=NULL;
26.246 Q3CanvasText *footerFN=NULL;
26.247 Q3CanvasText *footerDate=NULL;
26.248 @@ -1221,32 +1238,31 @@
26.249 // Print frame around map
26.250 mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10,
26.251 totalBBox.width()+20, totalBBox.height()+20);
26.252 - frame=new Q3CanvasRectangle (mapRect,mapCanvas);
26.253 + frame=new Q3CanvasRectangle (mapRect,mapScene);
26.254 frame->setBrush (QColor(Qt::white));
26.255 frame->setPen (QColor(Qt::black));
26.256 frame->setZ(0);
26.257 frame->show();
26.258 }
26.259 - /* TODO remove after testing
26.260 - QCanvasLine *l=new QCanvasLine (mapCanvas);
26.261 - l->setPoints (0,0,mapRect.width(),mapRect.height());
26.262 - l->setPen (QPen(QColor(black), 1));
26.263 - l->setZ (200);
26.264 - l->show();
26.265 - */
26.266 + // TODO remove after testing
26.267 + //QCanvasLine *l=new QCanvasLine (mapScene);
26.268 + //l->setPoints (0,0,mapRect.width(),mapRect.height());
26.269 + //l->setPen (QPen(QColor(black), 1));
26.270 + //l->setZ (200);
26.271 + //l->show();
26.272
26.273 if (printFooter)
26.274 {
26.275 // Print footer below map
26.276 QFont font;
26.277 font.setPointSize(10);
26.278 - footerFN=new Q3CanvasText (mapCanvas);
26.279 + footerFN=new Q3CanvasText (mapScene);
26.280 footerFN->setText ("VYM - " + fileName);
26.281 footerFN->setFont(font);
26.282 footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
26.283 footerFN->setZ(Z_TEXT);
26.284 footerFN->show();
26.285 - footerDate=new Q3CanvasText (mapCanvas);
26.286 + footerDate=new Q3CanvasText (mapScene);
26.287 footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
26.288 footerDate->setFont(font);
26.289 footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
26.290 @@ -1258,19 +1274,21 @@
26.291 {
26.292 pp.setWindow (mapRect);
26.293 }
26.294 +*/
26.295
26.296 if (mapAspect>=paperAspect)
26.297 {
26.298 // Fit horizontally to paper width
26.299 - pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) );
26.300 + pp.setViewport(0,0, metrics.width(),(int)(metrics.width()/mapAspect) );
26.301 } else
26.302 {
26.303 // Fit vertically to paper height
26.304 - pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height());
26.305 + pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height());
26.306 }
26.307
26.308 - mapCanvas->drawArea(mapRect, &pp); // draw Canvas to printer
26.309 -
26.310 + mapScene->render(&pp); // draw scene to printer
26.311 +
26.312 +/*
26.313 // Delete Frame and footer
26.314 if (footerFN)
26.315 {
26.316 @@ -1278,6 +1296,7 @@
26.317 delete (footerDate);
26.318 }
26.319 if (frame) delete (frame);
26.320 +*/
26.321
26.322 // Restore selection
26.323 if (oldselection)
26.324 @@ -1291,9 +1310,20 @@
26.325 }
26.326 }
26.327
26.328 +void MapEditor::setAntiAlias (bool b)
26.329 +{
26.330 + setRenderHint(QPainter::Antialiasing,b);
26.331 +}
26.332 +
26.333 +void MapEditor::setSmoothPixmap(bool b)
26.334 +{
26.335 + setRenderHint(QPainter::SmoothPixmapTransform,b);
26.336 +}
26.337 +
26.338 QPixmap MapEditor::getPixmap()
26.339 {
26.340 - QRect mapRect=mapCenter->getTotalBBox();
26.341 +/* FIXME not ported yet to QT4
26.342 + QRectF mapRect=mapCenter->getTotalBBox();
26.343 QPixmap pix (mapRect.size());
26.344 QPainter pp (&pix);
26.345
26.346 @@ -1307,7 +1337,7 @@
26.347
26.348 pp.setWindow (mapRect);
26.349
26.350 - mapCanvas->drawArea(mapRect, &pp); // draw Canvas to painter
26.351 + mapScene->drawArea(mapRect, &pp); // draw scene to painter
26.352
26.353
26.354 // Restore selection
26.355 @@ -1318,6 +1348,8 @@
26.356 }
26.357
26.358 return pix;
26.359 +*/
26.360 +return QPixmap();
26.361 }
26.362
26.363 void MapEditor::setHideTmpMode (HideTmpMode mode)
26.364 @@ -1326,7 +1358,7 @@
26.365 mapCenter->setHideTmp (hidemode);
26.366 mapCenter->reposition();
26.367 adjustCanvasSize();
26.368 - canvas()->update();
26.369 + scene()->update();
26.370 }
26.371
26.372 HideTmpMode MapEditor::getHideTmpMode()
26.373 @@ -1424,7 +1456,7 @@
26.374 {
26.375 // write to directory
26.376 QString clipfile="part";
26.377 - QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPoint(),selection);
26.378 + QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPointF(),selection);
26.379 QFile file;
26.380
26.381 file.setName ( clipboardDir + "/"+clipfile+".xml");
26.382 @@ -1505,8 +1537,8 @@
26.383 undoSet.setEntry ("/history/curStep",QString::number(curStep));
26.384 undoSet.writeSettings(histPath);
26.385
26.386 + mainWindow->updateHistory (undoSet);
26.387 updateActions();
26.388 - mainWindow->updateHistory (undoSet);
26.389
26.390 /* TODO remove testing
26.391 cout << "ME::redo() end\n";
26.392 @@ -1747,11 +1779,11 @@
26.393 {
26.394 if (selection)
26.395 {
26.396 - QString ps=qpointToString (selection->getAbsPos());
26.397 + QString ps=qpointfToString (selection->getAbsPos());
26.398 QString s=selection->getSelectString();
26.399 saveState(
26.400 s, "move "+ps,
26.401 - s, "move "+qpointToString (QPoint (x,y)),
26.402 + s, "move "+qpointfToString (QPointF (x,y)),
26.403 QString("Move %1 to %2").arg(getName(selection)).arg(ps));
26.404 selection->move(x,y);
26.405 mapCenter->reposition();
26.406 @@ -1766,11 +1798,11 @@
26.407 typeid(*selection) == typeid(MapCenterObj) ||
26.408 typeid(*selection) == typeid (FloatImageObj)))
26.409 {
26.410 - QString ps=qpointToString (selection->getRelPos());
26.411 + QString ps=qpointfToString (selection->getRelPos());
26.412 QString s=selection->getSelectString();
26.413 saveState(
26.414 s, "moveRel "+ps,
26.415 - s, "moveRel "+qpointToString (QPoint (x,y)),
26.416 + s, "moveRel "+qpointfToString (QPointF (x,y)),
26.417 QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
26.418 ((OrnamentedObj*)selection)->move2RelPos (x,y);
26.419 mapCenter->reposition();
26.420 @@ -1822,9 +1854,7 @@
26.421 {
26.422 ok=true;
26.423 ensureSelectionVisible();
26.424 - p = ((BranchObj*)selection)->getAbsPos();
26.425 - p.setX (p.x() - contentsX());
26.426 - p.setY (p.y() - contentsY() + ((BranchObj*)selection)->height()/2);
26.427 + p=mapFromScene(selection->getAbsPos());
26.428 return ((BranchObj*)selection)->getHeading();
26.429 }
26.430 ok=false;
26.431 @@ -1967,7 +1997,7 @@
26.432 // We accept no MapCenterObj here, so we _have_ a parent
26.433 {
26.434 BranchObj* bo = (BranchObj*) selection;
26.435 - QPoint p=bo->getRelPos();
26.436 + QPointF p=bo->getRelPos();
26.437
26.438
26.439 BranchObj *parbo=(BranchObj*)(selection->getParObj());
26.440 @@ -2443,29 +2473,67 @@
26.441 }
26.442 }
26.443
26.444 +void MapEditor::selectMapBackgroundImage ()
26.445 +{
26.446 + Q3FileDialog *fd=new Q3FileDialog( this);
26.447 + fd->setMode (Q3FileDialog::ExistingFile);
26.448 + fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
26.449 + ImagePreview *p =new ImagePreview (fd);
26.450 + fd->setContentsPreviewEnabled( TRUE );
26.451 + fd->setContentsPreview( p, p );
26.452 + fd->setPreviewMode( Q3FileDialog::Contents );
26.453 + fd->setCaption(vymName+" - " +tr("Load background image"));
26.454 + fd->setDir (lastImageDir);
26.455 + fd->show();
26.456 +
26.457 + if ( fd->exec() == QDialog::Accepted )
26.458 + {
26.459 + // FIXME in QT4 use: lastImageDir=fd->directory();
26.460 + lastImageDir=QDir (fd->dirPath());
26.461 + setMapBackgroundImage (fd->selectedFile());
26.462 + }
26.463 +}
26.464 +
26.465 +void MapEditor::setMapBackgroundImage (const QString &fn)
26.466 +{
26.467 + QColor oldcol=mapScene->backgroundBrush().color();
26.468 + /*
26.469 + saveState(
26.470 + selection,
26.471 + QString ("setMapBackgroundImage (%1)").arg(oldcol.name()),
26.472 + selection,
26.473 + QString ("setMapBackgroundImage (%1)").arg(col.name()),
26.474 + QString("Set background color of map to %1").arg(col.name()));
26.475 + */
26.476 + cout << "Trying to load "<<fn.ascii()<<endl;
26.477 + QBrush brush;
26.478 + brush.setTextureImage (QPixmap (fn));
26.479 + mapScene->setBackgroundBrush(brush);
26.480 +}
26.481 +
26.482 void MapEditor::selectMapBackgroundColor()
26.483 {
26.484 - QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
26.485 + QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), this );
26.486 if ( !col.isValid() ) return;
26.487 - setBackgroundColor( col );
26.488 + setMapBackgroundColor( col );
26.489 }
26.490
26.491
26.492 void MapEditor::setMapBackgroundColor(QColor col)
26.493 {
26.494 - QColor oldcol=mapCanvas->backgroundColor();
26.495 + QColor oldcol=mapScene->backgroundBrush().color();
26.496 saveState(
26.497 selection,
26.498 QString ("setMapBackgroundColor (%1)").arg(oldcol.name()),
26.499 selection,
26.500 QString ("setMapBackgroundColor (%1)").arg(col.name()),
26.501 QString("Set background color of map to %1").arg(col.name()));
26.502 - mapCanvas->setBackgroundColor (col);
26.503 + mapScene->setBackgroundBrush(col);
26.504 }
26.505
26.506 QColor MapEditor::getMapBackgroundColor()
26.507 {
26.508 - return mapCanvas->backgroundColor();
26.509 + return mapScene->backgroundBrush().color();
26.510 }
26.511
26.512 QColor MapEditor::getCurrentHeadingColor()
26.513 @@ -2557,9 +2625,10 @@
26.514
26.515 void MapEditor::setViewCenter()
26.516 {
26.517 - // transform to CanvasView Coord:
26.518 - QPoint p=worldMatrix().map(movingCenter);
26.519 - center ( p.x(), p.y());
26.520 + // transform to sceneView Coord:
26.521 + QPointF p=matrix().map(movingCenter);
26.522 + //FIXME not ported yet to QT4 (center ist TextStream there)
26.523 + //center ( p.x(), p.y());
26.524 }
26.525
26.526
26.527 @@ -2756,7 +2825,7 @@
26.528 updateActions();
26.529 mapCenter->reposition();
26.530 adjustCanvasSize();
26.531 - canvas()->update();
26.532 + scene()->update();
26.533 }
26.534 }
26.535 }
26.536 @@ -2778,7 +2847,7 @@
26.537 updateActions();
26.538 mapCenter->reposition();
26.539 adjustCanvasSize();
26.540 - canvas()->update();
26.541 + scene()->update();
26.542 }
26.543 }
26.544
26.545 @@ -2802,7 +2871,7 @@
26.546 updateActions();
26.547 mapCenter->reposition();
26.548 adjustCanvasSize();
26.549 - canvas()->update();
26.550 + scene()->update();
26.551 }
26.552 }
26.553
26.554 @@ -2848,7 +2917,7 @@
26.555 {
26.556 BranchObj* bo=(BranchObj*)selection;
26.557 BranchObj* par=(BranchObj*)(bo->getParObj());
26.558 - QPoint p=bo->getRelPos();
26.559 + QPointF p=bo->getRelPos();
26.560 saveStateChangingPart(
26.561 selection->getParObj(),
26.562 selection,
26.563 @@ -2892,11 +2961,7 @@
26.564
26.565 // Calc some stats
26.566 QString stats;
26.567 - int i=0;
26.568 - Q3CanvasItemList l=canvas()->allItems();
26.569 - for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
26.570 - i++;
26.571 - stats+=QString ("%1 items on canvas\n").arg (i,6);
26.572 + stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
26.573
26.574 uint b=0;
26.575 uint f=0;
26.576 @@ -3109,7 +3174,7 @@
26.577 );
26.578 bo->toggleScroll();
26.579 adjustCanvasSize();
26.580 - canvas()->update();
26.581 + scene()->update();
26.582 }
26.583 }
26.584
26.585 @@ -3171,7 +3236,7 @@
26.586
26.587 mapCenter->reposition();
26.588 adjustCanvasSize();
26.589 - canvas()->update();
26.590 + scene()->update();
26.591 }
26.592 delete (p);
26.593 delete (fd);
26.594 @@ -3335,7 +3400,7 @@
26.595 importDirInt (bo,QDir(fd->selectedFile()) );
26.596 mapCenter->reposition();
26.597 adjustCanvasSize();
26.598 - canvas()->update();
26.599 + scene()->update();
26.600 }
26.601 }
26.602 }
26.603 @@ -3386,17 +3451,6 @@
26.604
26.605 void MapEditor::testFunction()
26.606 {
26.607 - cout << "MapEditor::testFunction() called\n";
26.608 -
26.609 - if (selection &&
26.610 - (typeid(*selection) == typeid(BranchObj)) ||
26.611 - (typeid(*selection) == typeid(MapCenterObj)) )
26.612 - {
26.613 - BranchObj* bo=(BranchObj*)selection;
26.614 - cout << bo->getHeading().ascii() <<" is scrolled: "<<bo->isScrolled()<<endl;
26.615 - }
26.616 - return;
26.617 -
26.618 WarningDialog dia;
26.619 dia.showCancelButton (true);
26.620 dia.setText("This is a longer \nWarning");
26.621 @@ -3415,18 +3469,18 @@
26.622 {
26.623 setHideTmpMode (HideExport);
26.624 mapCenter->calcBBoxSizeWithChilds();
26.625 - QRect totalBBox=mapCenter->getTotalBBox();
26.626 - QRect mapRect=totalBBox;
26.627 + QRectF totalBBox=mapCenter->getTotalBBox();
26.628 + QRectF mapRect=totalBBox;
26.629 QCanvasRectangle *frame=NULL;
26.630
26.631 cout << " map has =("<<totalBBox.x()<<","<<totalBBox.y()<<","<<totalBBox.width()<<","<<totalBBox.height()<<")\n";
26.632
26.633 mapRect.setRect (totalBBox.x(), totalBBox.y(),
26.634 totalBBox.width(), totalBBox.height());
26.635 - frame=new QCanvasRectangle (mapRect,mapCanvas);
26.636 + frame=new QCanvasRectangle (mapRect,mapScene);
26.637 frame->setBrush (QColor(white));
26.638 frame->setPen (QColor(black));
26.639 - frame->setZ(0);
26.640 + frame->setZValue(0);
26.641 frame->show();
26.642 }
26.643 else
26.644 @@ -3442,32 +3496,35 @@
26.645 if (selection)
26.646 {
26.647 LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
26.648 - QPoint p;
26.649 + QPointF p;
26.650 if (selection->getOrientation() == OrientLeftOfCenter)
26.651 - p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
26.652 - else
26.653 - p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
26.654 - ensureVisible (p.x(), p.y() );
26.655 + p= matrix().map(QPointF (lmo->x(),lmo->y()));
26.656 + else
26.657 + p= matrix().map(QPointF (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
26.658 + ensureVisible (QRectF(p.x(), p.y(),0,0 ));
26.659 +
26.660 }
26.661
26.662 }
26.663
26.664 void MapEditor::updateViewCenter()
26.665 {
26.666 +/* FIXME still to port to QT4 inverseworldmatrix
26.667 // Update movingCenter, so that we can zoom comfortably later
26.668 - QRect rc = QRect( contentsX(), contentsY(),
26.669 + QRectF rc = QRectF( contentsX(), contentsY(),
26.670 visibleWidth(), visibleHeight() );
26.671 - QRect canvasRect = inverseWorldMatrix().mapRect(rc);
26.672 + QRectF canvasRect = inverseWorldMatrix().mapRect(rc);
26.673 movingCenter.setX((canvasRect.right() + canvasRect.left())/2);
26.674 movingCenter.setY((canvasRect.top() + canvasRect.bottom())/2);
26.675 + */
26.676 }
26.677
26.678 -void MapEditor::contentsContextMenuEvent ( QContextMenuEvent * e )
26.679 +void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
26.680 {
26.681 // Lineedits are already closed by preceding
26.682 // mouseEvent, we don't need to close here.
26.683
26.684 - QPoint p = inverseWorldMatrix().map(e->pos());
26.685 + QPointF p = mapToScene(e->pos());
26.686 LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
26.687
26.688 if (lmo)
26.689 @@ -3499,7 +3556,7 @@
26.690 }
26.691 } else
26.692 { // No MapObj found, we are on the Canvas itself
26.693 - // Context Menu on Canvas
26.694 + // Context Menu on scene
26.695 updateActions();
26.696 canvasContextMenu->popup(e->globalPos() );
26.697 }
26.698 @@ -3534,7 +3591,7 @@
26.699 setCursor (Qt::ArrowCursor);
26.700 }
26.701
26.702 -void MapEditor::contentsMousePressEvent(QMouseEvent* e)
26.703 +void MapEditor::mousePressEvent(QMouseEvent* e)
26.704 {
26.705 // Ignore right clicks, these will go to context menus
26.706 if (e->button() == Qt::RightButton )
26.707 @@ -3543,7 +3600,7 @@
26.708 return;
26.709 }
26.710
26.711 - QPoint p = inverseWorldMatrix().map(e->pos());
26.712 + QPointF p = mapToScene(e->pos());
26.713 LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
26.714
26.715 e->accept();
26.716 @@ -3602,7 +3659,7 @@
26.717 {
26.718 drawingLink=true;
26.719 linkingObj_src=bo_begin;
26.720 - tmpXLink=new XLinkObj (mapCanvas);
26.721 + tmpXLink=new XLinkObj (mapScene);
26.722 tmpXLink->setBegin (bo_begin);
26.723 tmpXLink->setEnd (p);
26.724 tmpXLink->setColor(defXLinkColor);
26.725 @@ -3649,27 +3706,31 @@
26.726 toggleScroll();
26.727 updateActions();
26.728 } else
26.729 - { // No MapObj found, we are on the Canvas itself
26.730 - // Left Button move Pos of CanvasView
26.731 + { // No MapObj found, we are on the scene itself
26.732 + // Left Button move Pos of sceneView
26.733 if (e->button() == Qt::LeftButton )
26.734 {
26.735 movingObj=NULL; // move Content not Obj
26.736 movingObj_start=e->globalPos();
26.737 - movingCont_start=QPoint (contentsX(), contentsY() );
26.738 - movingVec=QPoint(0,0);
26.739 + // FIXME not ported to QT4 yet (move canvasView)
26.740 + //movingCont_start=QPointF (contentsX(), contentsY() );
26.741 + movingCont_start=QPointF (
26.742 + horizontalScrollBar()->value(),
26.743 + verticalScrollBar()->value());
26.744 + movingVec=QPointF(0,0);
26.745 setCursor(HandOpenCursor);
26.746 }
26.747 }
26.748 }
26.749
26.750 -void MapEditor::contentsMouseMoveEvent(QMouseEvent* e)
26.751 +void MapEditor::mouseMoveEvent(QMouseEvent* e)
26.752 {
26.753 - QPoint p = inverseWorldMatrix().map(e->pos());
26.754 + QPointF p = mapToScene(e->pos());
26.755
26.756 // Move the selected MapObj
26.757 if ( selection && movingObj)
26.758 {
26.759 - // To avoid jumping of the CanvasView, only
26.760 + // To avoid jumping of the sceneView, only
26.761 // ensureSelectionVisible, if not tmp linked
26.762 if (!selection->hasParObjTmp())
26.763 ensureSelectionVisible ();
26.764 @@ -3691,7 +3752,7 @@
26.765 FloatObj *fo=(FloatObj*)selection;
26.766 fo->move (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
26.767 fo->setRelPos();
26.768 - fo->reposition();
26.769 + fo->updateLink(); //no need for reposition, if we update link here
26.770
26.771 // Relink float to new mapcenter or branch, if shift is pressed
26.772 // Only relink, if selection really has a new parent
26.773 @@ -3703,7 +3764,8 @@
26.774 {
26.775 if (typeid(*fo) == typeid(FloatImageObj))
26.776 {
26.777 - //TODO undocom
26.778 + //FIXME undocom for relinking of floats
26.779 +
26.780 //saveStateComplete(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
26.781 FloatImageObj *fio=(FloatImageObj*)(fo);
26.782 ((BranchObj*)(lmo))->addFloatImage (fio);
26.783 @@ -3769,7 +3831,7 @@
26.784
26.785 } // no FloatImageObj
26.786
26.787 - canvas()->update();
26.788 + scene()->update();
26.789 return;
26.790 } // selection && moving_obj
26.791
26.792 @@ -3780,22 +3842,25 @@
26.793 tmpXLink->updateXLink();
26.794 }
26.795
26.796 - // Move CanvasView
26.797 - if (!movingObj && !pickingColor &&!drawingLink)
26.798 + // Move sceneView
26.799 + //if (!movingObj && !pickingColor &&!drawingLink && e->button() == Qt::LeftButton )
26.800 + if (e->buttons() == Qt::LeftButton )
26.801 {
26.802 - QPoint p=e->globalPos();
26.803 + QPointF p=e->globalPos();
26.804 movingVec.setX(-p.x() + movingObj_start.x() );
26.805 movingVec.setY(-p.y() + movingObj_start.y() );
26.806 - setContentsPos( movingCont_start.x() + movingVec.x(),
26.807 - movingCont_start.y() + movingVec.y());
26.808 -
26.809 - updateViewCenter();
26.810 + // FIXME not ported to QT4 yet (move canvasView)
26.811 + //setContentsPos( movingCont_start.x() + movingVec.x(),
26.812 + //movingCont_start.y() + movingVec.y();
26.813 + horizontalScrollBar()->setSliderPosition((int)( movingCont_start.x()+movingVec.x() ));
26.814 + verticalScrollBar()->setSliderPosition((int)( movingCont_start.y()+movingVec.y() ) );
26.815 }
26.816 }
26.817
26.818
26.819 -void MapEditor::contentsMouseReleaseEvent(QMouseEvent* e)
26.820 +void MapEditor::mouseReleaseEvent(QMouseEvent* e)
26.821 {
26.822 + QPointF p = mapToScene(e->pos());
26.823 LinkableMapObj *dst;
26.824 // Have we been picking color?
26.825 if (pickingColor)
26.826 @@ -3803,7 +3868,7 @@
26.827 pickingColor=false;
26.828 setCursor (Qt::ArrowCursor);
26.829 // Check if we are over another branch
26.830 - dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
26.831 + dst=mapCenter->findMapObj(p, NULL);
26.832 if (dst && selection)
26.833 {
26.834 if (e->state() & Qt::ShiftModifier)
26.835 @@ -3825,7 +3890,7 @@
26.836 {
26.837 drawingLink=false;
26.838 // Check if we are over another branch
26.839 - dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
26.840 + dst=mapCenter->findMapObj(p, NULL);
26.841 if (dst && selection)
26.842 {
26.843 tmpXLink->setEnd ( ((BranchObj*)(dst)) );
26.844 @@ -3847,8 +3912,8 @@
26.845 {
26.846 // Moved FloatObj. Maybe we need to reposition
26.847 FloatImageObj *fo=(FloatImageObj*)selection;
26.848 - QString pold=qpointToString(movingObj_orgRelPos);
26.849 - QString pnow=qpointToString(fo->getRelPos());
26.850 + QString pold=qpointfToString(movingObj_orgRelPos);
26.851 + QString pnow=qpointfToString(fo->getRelPos());
26.852 saveState(
26.853 selection,
26.854 "moveRel "+pold,
26.855 @@ -3863,7 +3928,7 @@
26.856
26.857 // Check if we are over another branch, but ignore
26.858 // any found LMOs, which are FloatObjs
26.859 - dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ),
26.860 + dst=mapCenter->findMapObj(mapToScene(e->pos() ),
26.861 ((LinkableMapObj*)selection) );
26.862
26.863 if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj)))
26.864 @@ -3878,7 +3943,7 @@
26.865 { // A branch was moved
26.866
26.867 // save the position in case we link to mapcenter
26.868 - QPoint savePos=QPoint (selection->x(),selection->y() );
26.869 + QPointF savePos=QPointF (selection->x(),selection->y() );
26.870
26.871 // Reset the temporary drawn link to the original one
26.872 ((LinkableMapObj*)selection)->unsetParObjTmp();
26.873 @@ -3934,9 +3999,9 @@
26.874 // Therefor reposition and then use string of old selection, too
26.875 mapCenter->reposition();
26.876
26.877 - QString ps=qpointToString ( ((BranchObj*)selection)->getRelPos() );
26.878 + QString ps=qpointfToString ( ((BranchObj*)selection)->getRelPos() );
26.879 saveState(
26.880 - selection->getSelectString(), "moveRel "+qpointToString(movingObj_orgRelPos),
26.881 + selection->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos),
26.882 preSelStr, "moveRel "+ps,
26.883 QString("Move %1 to relative position %2").arg(getName(selection)).arg(ps));
26.884
26.885 @@ -3944,9 +4009,9 @@
26.886 // Draw the original link, before selection was moved around
26.887 mapCenter->reposition();
26.888 }
26.889 - // Finally resize canvas, if needed
26.890 + // Finally resize scene, if needed
26.891 adjustCanvasSize();
26.892 - canvas()->update();
26.893 + scene()->update();
26.894 movingObj=NULL;
26.895
26.896 // Just make sure, that actions are still ok,e.g. the move branch up/down buttons...
26.897 @@ -3957,11 +4022,11 @@
26.898
26.899 }
26.900
26.901 -void MapEditor::contentsMouseDoubleClickEvent(QMouseEvent* e)
26.902 +void MapEditor::mouseDoubleClickEvent(QMouseEvent* e)
26.903 {
26.904 if (e->button() == Qt::LeftButton )
26.905 {
26.906 - QPoint p = inverseWorldMatrix().map(e->pos());
26.907 + QPointF p = mapToScene(e->pos());
26.908 LinkableMapObj *lmo=mapCenter->findMapObj(p, NULL);
26.909 if (lmo) { // MapObj was found
26.910 // First select the MapObj than edit heading
26.911 @@ -3975,74 +4040,57 @@
26.912
26.913 void MapEditor::resizeEvent (QResizeEvent* e)
26.914 {
26.915 - Q3CanvasView::resizeEvent( e );
26.916 + QGraphicsView::resizeEvent( e );
26.917 adjustCanvasSize();
26.918 }
26.919
26.920 void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event)
26.921 {
26.922 - if (selection &&
26.923 - (typeid(*selection) == typeid(BranchObj)) ||
26.924 - (typeid(*selection) == typeid(MapCenterObj)))
26.925 - {
26.926 - if (event->mimeData()->hasFormat("image/png"))
26.927 - {
26.928 - cout <<"found png in dragenterevent\n";
26.929 - event->accept();
26.930 - return;
26.931 - }
26.932 -
26.933 - if (event->mimeData()->hasFormat("text/uri-list"))
26.934 - {
26.935 - cout <<"found uri-list in dragenterevent\n";
26.936 - event->accept();
26.937 - return;
26.938 - }
26.939 -
26.940 -/*
26.941 - // If QImageDrag can decode mime type
26.942 - if (Q3ImageDrag::canDecode(event))
26.943 - {
26.944 - cout << "dragenterevent q3imagedrag\n";
26.945 - event->accept();
26.946 - return;
26.947 - }
26.948 -*/
26.949 - // If image are dragged from firefox
26.950 - if (event->mimeData()->hasFormat("application/x-moz-file-promise-url") &&
26.951 - event->mimeData()->hasFormat("application/x-moz-nativeimage")) {
26.952 - event->accept(true);
26.953 - cout << "dragenterevent firefox\n";
26.954 - return;
26.955 - }
26.956 -/*
26.957 - // If QUriDrag can decode mime type
26.958 - if (Q3UriDrag::canDecode(event)) {
26.959 - event->accept();
26.960 - cout << "accepted uri drag\n";
26.961 - return;
26.962 - }
26.963 + //FIXME not ported to QT4 yet
26.964 +
26.965 +// for (unsigned int i=0;event->format(i);i++) // Debug mime type
26.966 +// cerr << event->format(i) << endl;
26.967 +
26.968 + if (selection &&
26.969 + (typeid(*selection) == typeid(BranchObj)) ||
26.970 + (typeid(*selection) == typeid(MapCenterObj))) {
26.971 +
26.972 + // If QImageDrag can decode mime type
26.973 + if (Q3ImageDrag::canDecode(event)) {
26.974 + event->accept();
26.975 + return;
26.976 + }
26.977 +
26.978 + // If image are dragged from firefox
26.979 + if (event->provides("application/x-moz-file-promise-url") &&
26.980 + event->provides("application/x-moz-nativeimage")) {
26.981 + event->accept(true);
26.982 + return;
26.983 + }
26.984 +
26.985 + // If QUriDrag can decode mime type
26.986 + if (Q3UriDrag::canDecode(event)) {
26.987 + event->accept();
26.988 + return;
26.989 + }
26.990 +
26.991 // If Uri are dragged from firefox
26.992 - if (event->provides("_NETSCAPE_URL")){
26.993 - event->accept();
26.994 - cout << "dragenterevent NETSCAPE\n";
26.995 - return;
26.996 - }
26.997 -
26.998 - // If QTextDrag can decode mime type
26.999 - if (Q3TextDrag::canDecode(event)) {
26.1000 - event->accept();
26.1001 - cout << "dragenterevent textdrag\n";
26.1002 - return;
26.1003 - }
26.1004 -*/
26.1005 - }
26.1006 - event->ignore();
26.1007 + if (event->provides("_NETSCAPE_URL")){
26.1008 + event->accept();
26.1009 + return;
26.1010 + }
26.1011 +
26.1012 + // If QTextDrag can decode mime type
26.1013 + if (Q3TextDrag::canDecode(event)) {
26.1014 + event->accept();
26.1015 + return;
26.1016 + }
26.1017 +
26.1018 + }
26.1019 + event->ignore();
26.1020 }
26.1021
26.1022 -
26.1023 -
26.1024 -/* FIXME needed in QT4? bool isUnicode16(const QByteArray &d)
26.1025 +bool isUnicode16(const QByteArray &d)
26.1026 {
26.1027 // TODO: make more precise check for unicode 16.
26.1028 // Guess unicode16 if any of second bytes are zero
26.1029 @@ -4051,17 +4099,16 @@
26.1030 if (d.at(i*2+1)==0) return true;
26.1031 return false;
26.1032 }
26.1033 -*/
26.1034 -
26.1035 +
26.1036 void MapEditor::contentsDropEvent(QDropEvent *event)
26.1037 {
26.1038 + //FIXME not ported to QT4 yet
26.1039 if (selection &&
26.1040 (typeid(*selection) == typeid(BranchObj)) ||
26.1041 (typeid(*selection) == typeid(MapCenterObj)))
26.1042 {
26.1043 bool update=false;
26.1044 QStringList uris;
26.1045 - QList <QUrl> urls;
26.1046 QString heading;
26.1047
26.1048
26.1049 @@ -4069,21 +4116,34 @@
26.1050 {
26.1051 event->acceptProposedAction();
26.1052 addFloatImageInt(event->mimeData()->imageData().value<QPixmap>());
26.1053 - cout << "Drop png...\n";
26.1054 - } else if (event->mimeData()->hasFormat("application/x-moz-file-promise-url")&&
26.1055 - event->mimeData()->hasFormat("application/x-moz-nativeimage"))
26.1056 + cout << "accepted drop\n";
26.1057 + }
26.1058 +
26.1059 + /*
26.1060 + if (event->provides("image/png"))
26.1061 {
26.1062 - cout << "Drop Mozilla...\n";
26.1063 + QPixmap pix;
26.1064 + if (Q3ImageDrag::decode(event, pix))
26.1065 + {
26.1066 + addFloatImageInt(pix);
26.1067 + event->accept();
26.1068 + update=true;
26.1069 + } else
26.1070 + event->ignore();
26.1071 +
26.1072 + } else if (event->provides("application/x-moz-file-promise-url") &&
26.1073 + event->provides("application/x-moz-nativeimage"))
26.1074 + {
26.1075 // Contains url to the img src in unicode16
26.1076 QByteArray d = event->encodedData("application/x-moz-file-promise-url");
26.1077 QString url = QString((const QChar*)d.data(),d.size()/2);
26.1078 - //FIXME fetchImage(url);
26.1079 - event->acceptProposedAction();
26.1080 + fetchImage(url);
26.1081 + event->accept();
26.1082 update=true;
26.1083 - } else if (event->mimeData()->hasUrls())
26.1084 - {
26.1085 - urls=event->mimeData()->urls();
26.1086 - } /*else if (event->provides ("_NETSCAPE_URL"))
26.1087 + } else if (event->provides ("text/uri-list"))
26.1088 + { // Uris provided e.g. by konqueror
26.1089 + Q3UriDrag::decode (event,uris);
26.1090 + } else if (event->provides ("_NETSCAPE_URL"))
26.1091 { // Uris provided by Mozilla
26.1092 QStringList l = QStringList::split("\n", event->encodedData("_NETSCAPE_URL"));
26.1093 uris.append(l[0]);
26.1094 @@ -4118,10 +4178,6 @@
26.1095 }
26.1096 */
26.1097
26.1098 - for (int i=0; i<urls.size(); ++i)
26.1099 - {
26.1100 - cout << "Found URL: "<<urls.at(i).toString().ascii()<<endl;
26.1101 - }
26.1102 /* FIXME not ported yet QSTRINGLIST has no next...
26.1103 if (uris.count()>0)
26.1104 {
26.1105 @@ -4165,7 +4221,7 @@
26.1106 //saveStateComplete("Drop Event"); //TODO undo Command
26.1107 mapCenter->reposition();
26.1108 adjustCanvasSize();
26.1109 - canvas()->update();
26.1110 + scene()->update();
26.1111 }
26.1112 }
26.1113 }
26.1114 @@ -4177,7 +4233,6 @@
26.1115 (typeid(*selection) == typeid(MapCenterObj)) )
26.1116 {
26.1117 BranchObj *bo=((BranchObj*)selection);
26.1118 - qWarning ("Warning: Image added by drop event: no undo/redo so far.");
26.1119 //FIXME XXX saveStateChangingPart(selection,QString("Add floatimage to %1").arg(getName(bo)));
26.1120 //QString fn=fd->selectedFile();
26.1121 //lastImageDir=fn.left(fn.findRev ("/"));
26.1122 @@ -4186,13 +4241,12 @@
26.1123 fio->setOriginalFilename("Image added by Drag and Drop");
26.1124 mapCenter->reposition();
26.1125 adjustCanvasSize();
26.1126 - canvas()->update();
26.1127 + scene()->update();
26.1128 }
26.1129 }
26.1130
26.1131
26.1132 -//void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/)
26.1133 -/* FIXME not needed in QT4
26.1134 +void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/)
26.1135 {
26.1136 if (!imageBuffer) imageBuffer = new QBuffer();
26.1137 if (!imageBuffer->isOpen()) {
26.1138 @@ -4235,5 +4289,3 @@
26.1139 this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *)));
26.1140 urlOperator->get();
26.1141 }
26.1142 -
26.1143 -*/
27.1 --- a/mapeditor.h Thu Nov 23 16:18:26 2006 +0000
27.2 +++ b/mapeditor.h Fri Dec 08 20:18:56 2006 +0000
27.3 @@ -1,8 +1,8 @@
27.4 #ifndef MAPEDITOR_H
27.5 #define MAPEDITOR_H
27.6
27.7 -#include <q3canvas.h>
27.8 #include <QBuffer>
27.9 +#include <QGraphicsView>
27.10
27.11 #include "mapcenterobj.h"
27.12 #include "file.h"
27.13 @@ -10,22 +10,24 @@
27.14 #include "selection.h"
27.15 #include "settings.h"
27.16
27.17 +class Q3NetworkOperation;
27.18 +class Q3UrlOperator;
27.19
27.20 -class MapEditor : public Q3CanvasView , public xmlObj {
27.21 +class MapEditor : public QGraphicsView, public xmlObj {
27.22 Q_OBJECT
27.23
27.24 public:
27.25 - MapEditor(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
27.26 + MapEditor(QWidget* parent=0);
27.27 ~MapEditor();
27.28 MapCenterObj* getMapCenter();
27.29 - Q3Canvas* getCanvas();
27.30 + QGraphicsScene * getScene();
27.31 void adjustCanvasSize();// adjust canvas size to map and scrollview
27.32 bool isRepositionBlocked(); // block while load or undo
27.33
27.34 private:
27.35 QString getName(LinkableMapObj*); // Get e.g. heading or filename
27.36 void makeTmpDirs(); // create temporary directories
27.37 - QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
27.38 + QString saveToDir(const QString&,const QString &,bool, const QPointF &,LinkableMapObj*);
27.39 void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
27.40 void saveStateRemovingPart (LinkableMapObj *, const QString &);
27.41 void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
27.42 @@ -37,12 +39,11 @@
27.43 void addFloatImageInt(const QPixmap &img);
27.44
27.45 private slots:
27.46 -//FIXME not needed QT4 void fetchImage(const QString &img);
27.47 -//FIXME not needed QT4 void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
27.48 -//FIXME not needed QT4 void imageDataFinished(Q3NetworkOperation *);
27.49 + void fetchImage(const QString &img);
27.50 + void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
27.51 + void imageDataFinished(Q3NetworkOperation *);
27.52
27.53 public:
27.54 - void toggleHistoryWindow();
27.55 bool isDefault(); // false, if map was changed once
27.56 bool isUnsaved(); // save necessary
27.57 bool hasChanged(); // undo possible
27.58 @@ -60,6 +61,8 @@
27.59 void setZipped(bool); // save map zipped
27.60 bool saveZipped(); // 1 if file will be saved zipped
27.61 void print(); // print canvas
27.62 + void setAntiAlias (bool);
27.63 + void setSmoothPixmap(bool);
27.64 private:
27.65 QPixmap getPixmap();
27.66 void setHideTmpMode (HideTmpMode); // temporary hide stuff
27.67 @@ -116,6 +119,8 @@
27.68 void selectRightBranch();
27.69 void selectFirstBranch();
27.70 void selectLastBranch();
27.71 + void selectMapBackgroundImage();
27.72 + void setMapBackgroundImage(const QString &);
27.73 void selectMapBackgroundColor();
27.74 void setMapBackgroundColor(QColor);
27.75 QColor getMapBackgroundColor();
27.76 @@ -180,18 +185,18 @@
27.77 protected:
27.78 void ensureSelectionVisible();
27.79 virtual void updateViewCenter(); // needed for zooming
27.80 - virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
27.81 + virtual void contextMenuEvent ( QContextMenuEvent *e );
27.82 virtual void keyPressEvent(QKeyEvent*);
27.83 virtual void keyReleaseEvent(QKeyEvent*);
27.84 - virtual void contentsMousePressEvent(QMouseEvent*);
27.85 - virtual void contentsMouseReleaseEvent(QMouseEvent*);
27.86 - virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
27.87 - virtual void contentsMouseMoveEvent(QMouseEvent*);
27.88 + virtual void mousePressEvent(QMouseEvent*);
27.89 + virtual void mouseReleaseEvent(QMouseEvent*);
27.90 + virtual void mouseDoubleClickEvent(QMouseEvent*);
27.91 + virtual void mouseMoveEvent(QMouseEvent*);
27.92
27.93 - virtual void contentsDragEnterEvent(QDragEnterEvent *event);
27.94 + virtual void contentsDragEnterEvent(QDragEnterEvent *event);
27.95 virtual void contentsDropEvent(QDropEvent *event);
27.96 private:
27.97 - Q3Canvas* mapCanvas;
27.98 + QGraphicsScene *mapScene;
27.99 MapCenterObj* mapCenter;
27.100
27.101 bool adjustCanvasRequested; // collect requests until end of user event
27.102 @@ -217,12 +222,12 @@
27.103 LinkableMapObj* selectionLast; // last selection
27.104 MapObj* movingObj; // moving a MapObj
27.105 MapObj* linkingObj_src; // part of a link
27.106 - QPoint movingObj_orgPos; // org. pos of mouse before move
27.107 - QPoint movingObj_orgRelPos; // org. relative pos of mouse before move
27.108 - QPoint movingObj_start; // rel. pos of mouse to absPos
27.109 - QPoint movingCont_start; // inital pos of moving Content or
27.110 - QPoint movingVec; // how far has Content moved
27.111 - QPoint movingCenter; // used when zooming
27.112 + QPointF movingObj_orgPos; // org. pos of mouse before move
27.113 + QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
27.114 + QPointF movingObj_start; // rel. pos of mouse to absPos
27.115 + QPointF movingCont_start; // inital pos of moving Content or
27.116 + QPointF movingVec; // how far has Content moved
27.117 + QPointF movingCenter; // used when zooming
27.118 QPrinter* printer; // Printing
27.119
27.120 bool mapDefault; // Flag if map is untouched
28.1 --- a/mapobj.cpp Thu Nov 23 16:18:26 2006 +0000
28.2 +++ b/mapobj.cpp Fri Dec 08 20:18:56 2006 +0000
28.3 @@ -6,15 +6,15 @@
28.4 /////////////////////////////////////////////////////////////////
28.5 MapObj::MapObj ()
28.6 {
28.7 - //qWarning ( "Const MapObj (): Please set canvas somehow!!!");
28.8 - canvas=NULL;
28.9 + //qWarning ( "Const MapObj (): Please set scene somehow!!!");
28.10 + scene=NULL;
28.11 init ();
28.12 }
28.13
28.14 -MapObj::MapObj (Q3Canvas* c)
28.15 +MapObj::MapObj (QGraphicsScene *s)
28.16 {
28.17 // cout << "Const MapObj\n";
28.18 - canvas=c;
28.19 + scene=s;
28.20 init ();
28.21 }
28.22
28.23 @@ -32,91 +32,101 @@
28.24
28.25 void MapObj::init ()
28.26 {
28.27 - absPos=QPoint(0,0);
28.28 + absPos=QPointF(0,0);
28.29 visible=true;
28.30 }
28.31
28.32 void MapObj::copy(MapObj* other)
28.33 {
28.34 -// canvas=other->canvas; // already set in constr. of child, use that one...
28.35 +// scene=other->scene; // already set in constr. of child, use that one...
28.36 absPos=other->absPos;
28.37 bbox.setX (other->bbox.x() );
28.38 bbox.setY (other->bbox.y() );
28.39 - bbox.setSize (QSize(other->bbox.width(), other->bbox.height() ) );
28.40 + bbox.setSize (QSizeF(other->bbox.width(), other->bbox.height() ) );
28.41 }
28.42
28.43 -Q3Canvas* MapObj::getCanvas()
28.44 +QGraphicsScene* MapObj::getScene()
28.45 {
28.46 - return canvas;
28.47 + return scene;
28.48 }
28.49
28.50 -int MapObj::x()
28.51 +qreal MapObj::x()
28.52 {
28.53 return absPos.x();
28.54 }
28.55
28.56 -int MapObj::y()
28.57 +qreal MapObj::y()
28.58 {
28.59 return absPos.y();
28.60 }
28.61
28.62 -int MapObj::width()
28.63 +qreal MapObj::width()
28.64 {
28.65 return bbox.width();
28.66 }
28.67
28.68 -int MapObj::height()
28.69 +qreal MapObj::height()
28.70 {
28.71 return bbox.height();
28.72 }
28.73
28.74 -QPoint MapObj::getAbsPos()
28.75 +QPointF MapObj::getAbsPos()
28.76 {
28.77 return absPos;
28.78 }
28.79
28.80 QString MapObj::getPos()
28.81 {
28.82 - return qpointToString(absPos);
28.83 + return qpointfToString(absPos);
28.84 }
28.85
28.86 void MapObj::move (double x, double y)
28.87 {
28.88 - int xi=static_cast <int> (x);
28.89 - int yi=static_cast <int> (y);
28.90 - absPos.setX( xi);
28.91 - absPos.setY( yi);
28.92 - bbox.moveTopLeft(QPoint(xi,yi));
28.93 - clickBox.moveTopLeft(QPoint(xi,yi));
28.94 + absPos.setX( x);
28.95 + absPos.setY( y);
28.96 + bbox.moveTo(QPointF(x,y));
28.97 + clickBox.moveTo(QPointF(x,y));
28.98 +}
28.99 +
28.100 +void MapObj::move (QPointF p)
28.101 +{
28.102 + absPos=p;
28.103 + bbox.moveTo (p);
28.104 + clickBox.moveTo (p);
28.105 }
28.106
28.107 void MapObj::moveBy (double x, double y)
28.108 {
28.109 - int ix=(int)x;
28.110 - int iy=(int)y;
28.111 MapObj::move (x+absPos.x(),y+absPos.y() );
28.112 - bbox.moveBy (ix,iy);
28.113 - clickBox.moveBy (ix,iy);
28.114 + bbox.moveTo (bbox.x()+x,bbox.y()+y);
28.115 + clickBox.moveTo (clickBox.x()+x,clickBox.y()+y);
28.116 }
28.117
28.118 -bool MapObj::inBox(const QPoint &p)
28.119 +bool MapObj::inBox(const QPointF &p)
28.120 {
28.121 +/* FIXME testing QT4 only
28.122 + cout << "MO::inBox "<<p<<" "<<
28.123 + clickBox.left()<<","<<
28.124 + clickBox.right()<<","<<
28.125 + clickBox.top()<<","<<
28.126 + clickBox.bottom()<<endl;
28.127 + */
28.128 if (p.x() >= clickBox.left() && p.x() <= clickBox.right()
28.129 && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
28.130 return true;
28.131 return false;
28.132 }
28.133
28.134 -QRect MapObj::getBBox()
28.135 +QRectF MapObj::getBBox()
28.136 {
28.137 return bbox;
28.138 }
28.139
28.140 -QRect MapObj::addBBox(QRect r1, QRect r2)
28.141 +QRectF MapObj::addBBox(QRectF r1, QRectF r2)
28.142 {
28.143 - // Find smallest QRect containing given rectangles
28.144 + // Find smallest QRectF containing given rectangles
28.145
28.146 - QRect n;
28.147 + QRectF n;
28.148 // Set left border
28.149 if (r1.left() <= r2.left() )
28.150 n.setLeft(r1.left() );
28.151 @@ -143,7 +153,7 @@
28.152 return n;
28.153 }
28.154
28.155 -QSize MapObj::getSize()
28.156 +QSizeF MapObj::getSize()
28.157 {
28.158 return bbox.size();
28.159 }
29.1 --- a/mapobj.h Thu Nov 23 16:18:26 2006 +0000
29.2 +++ b/mapobj.h Fri Dec 08 20:18:56 2006 +0000
29.3 @@ -1,7 +1,8 @@
29.4 #ifndef MAPOBJ_H
29.5 #define MAPOBJ_H
29.6
29.7 -#include <q3canvas.h>
29.8 +#include <QGraphicsScene>
29.9 +#include <QGraphicsItem>
29.10 #include <iostream>
29.11
29.12 #include "misc.h"
29.13 @@ -20,33 +21,34 @@
29.14 class MapObj:public xmlObj {
29.15 public:
29.16 MapObj ();
29.17 - MapObj (Q3Canvas*);
29.18 + MapObj (QGraphicsScene*);
29.19 MapObj (MapObj*);
29.20 virtual ~MapObj ();
29.21 virtual void init ();
29.22 virtual void copy (MapObj*);
29.23 - virtual Q3Canvas* getCanvas();
29.24 - virtual int x();
29.25 - virtual int y();
29.26 - virtual int width();
29.27 - virtual int height();
29.28 - virtual QPoint getAbsPos();
29.29 + virtual QGraphicsScene* getScene();
29.30 + virtual qreal x();
29.31 + virtual qreal y();
29.32 + virtual qreal width();
29.33 + virtual qreal height();
29.34 + virtual QPointF getAbsPos();
29.35 virtual QString getPos(); // Return position as string (x,y)
29.36 virtual void move (double x,double y); // move to absolute Position
29.37 + virtual void move (QPointF p);
29.38 virtual void moveBy (double x,double y); // move to relative Position
29.39 - virtual bool inBox(const QPoint&); // Check if Point is within clickbox
29.40 - virtual QRect getBBox(); // returns bounding box
29.41 - virtual QRect addBBox(QRect,QRect); // returns bbox which includes both boxes
29.42 - virtual QSize getSize(); // returns size of bounding box
29.43 + virtual bool inBox(const QPointF&); // Check if Point is within clickbox
29.44 + virtual QRectF getBBox(); // returns bounding box
29.45 + virtual QRectF addBBox(QRectF,QRectF); // returns bbox which includes both boxes
29.46 + virtual QSizeF getSize(); // returns size of bounding box
29.47 virtual bool isVisibleObj();
29.48 virtual void setVisibility(bool);
29.49 virtual void positionBBox()=0;
29.50 virtual void calcBBoxSize()=0;
29.51 protected:
29.52 - Q3Canvas* canvas;
29.53 - QRect bbox; // bounding box of MO itself
29.54 - QRect clickBox; // area where mouseclicks are found
29.55 - QPoint absPos; // Position on canvas
29.56 + QGraphicsScene* scene;
29.57 + QRectF bbox; // bounding box of MO itself
29.58 + QRectF clickBox; // area where mouseclicks are found
29.59 + QPointF absPos; // Position on canvas
29.60 bool visible;
29.61 };
29.62
30.1 --- a/misc.cpp Thu Nov 23 16:18:26 2006 +0000
30.2 +++ b/misc.cpp Fri Dec 08 20:18:56 2006 +0000
30.3 @@ -11,13 +11,25 @@
30.4 return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
30.5 }
30.6
30.7 +QString qpointfToString (const QPointF &p)
30.8 +{
30.9 +// FIXME check this QT4
30.10 + return "(" + QString("%1").arg(p.x()) +","+ QString ("%1").arg (p.y()) +")";
30.11 +}
30.12 +
30.13 ostream &operator<< (ostream &stream, QPoint const &p)
30.14 {
30.15 stream << "("<<p.x()<<","<<p.y()<<")";
30.16 return stream;
30.17 }
30.18
30.19 -float getAngle(const QPoint &p)
30.20 +ostream &operator<< (ostream &stream, QPointF const &p)
30.21 +{
30.22 + stream << "("<<p.x()<<","<<p.y()<<")";
30.23 + return stream;
30.24 +}
30.25 +
30.26 +qreal getAngle(const QPointF &p)
30.27 {
30.28 // Calculate angle of vector to y-axis
30.29 if (p.y()==0)
30.30 @@ -29,24 +41,24 @@
30.31 } else
30.32 {
30.33 if (p.y()>0)
30.34 - return (float)(M_PI - atan ( (double)(p.x()) / (double)(p.y()) ) );
30.35 + return (qreal)(M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
30.36 else
30.37 if (p.x()<0)
30.38 - return (float)( 2*M_PI - atan ( (double)(p.x()) / (double)(p.y()) ) );
30.39 + return (qreal)( 2*M_PI - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
30.40 else
30.41 - return (float)( - atan ( (double)(p.x()) / (double)(p.y()) ) );
30.42 + return (qreal)( - atan ( (qreal)(p.x()) / (qreal)(p.y()) ) );
30.43 }
30.44 }
30.45
30.46 -QPoint normalise(const QPoint &p)
30.47 +QPointF normalise(const QPointF &p)
30.48 {
30.49 // Calculate normalised position (fixed length)
30.50
30.51 - double px=p.x();
30.52 - double py=p.y();
30.53 - double x;
30.54 - double y;
30.55 - double r=150;
30.56 + qreal px=p.x();
30.57 + qreal py=p.y();
30.58 + qreal x;
30.59 + qreal y;
30.60 + qreal r=150;
30.61
30.62 if (px==0)
30.63 {
30.64 @@ -57,8 +69,8 @@
30.65 y=-r;
30.66 } else
30.67 {
30.68 - double sign;
30.69 - double a;
30.70 + qreal sign;
30.71 + qreal a;
30.72 if (px>0)
30.73 sign=1;
30.74 else
30.75 @@ -87,7 +99,8 @@
30.76 return r;
30.77 }
30.78
30.79 -int max(int a, int b)
30.80 +
30.81 +qreal max(qreal a, qreal b)
30.82 {
30.83 if (a>b)
30.84 return a;
31.1 --- a/misc.h Thu Nov 23 16:18:26 2006 +0000
31.2 +++ b/misc.h Fri Dec 08 20:18:56 2006 +0000
31.3 @@ -10,11 +10,13 @@
31.4
31.5 /////////////////////////////////////////////////////////////////////////////
31.6 QString qpointToString (const QPoint &p);
31.7 +QString qpointfToString (const QPointF &p);
31.8 extern ostream &operator<< (ostream &stream, QPoint const &p);
31.9 -float getAngle(const QPoint &);
31.10 -QPoint normalise (const QPoint &);
31.11 +extern ostream &operator<< (ostream &stream, QPointF const &p);
31.12 +qreal getAngle(const QPointF &);
31.13 +QPointF normalise (const QPointF &);
31.14 QString quotemeta(const QString&);
31.15 -int max (int,int);
31.16 +qreal max (qreal,qreal);
31.17 class BranchObj;
31.18 class MapEditor;
31.19
32.1 --- a/options.cpp Thu Nov 23 16:18:26 2006 +0000
32.2 +++ b/options.cpp Fri Dec 08 20:18:56 2006 +0000
32.3 @@ -1,7 +1,8 @@
32.4 #include "options.h"
32.5 +
32.6 #include <iostream>
32.7 +#include <QApplication>
32.8
32.9 -#include <qapplication.h>
32.10
32.11 using namespace std;
32.12
32.13 @@ -16,6 +17,14 @@
32.14 active=false;
32.15 }
32.16
32.17 +Option::Option (const QString &n, const OptionType &t, const QString &s, const QString &l)
32.18 +{
32.19 + sName="-"+s;
32.20 + lName="--"+l;
32.21 + type=t;
32.22 + name=n;
32.23 +}
32.24 +
32.25 void Option::set(const QString &n, const OptionType &t, const QString &s, const QString &l)
32.26 {
32.27 sName="-"+s;
32.28 @@ -40,7 +49,7 @@
32.29 {
32.30 QStringList arglist;
32.31 int i=0;
32.32 - while (i<qApp->argc())
32.33 + while ( i < qApp->argc())
32.34 {
32.35 arglist.append (qApp->argv()[i]);
32.36 i++;
32.37 @@ -52,37 +61,32 @@
32.38
32.39 // Work through rest of options
32.40 bool isFile;
32.41 - OptionList::iterator itopt;
32.42 - QStringList::iterator itarg;
32.43 - itarg=arglist.begin();
32.44 - while (itarg!=arglist.end())
32.45 + for (i=0; i< arglist.size(); ++i)
32.46 {
32.47 isFile=true;
32.48 - if ((*itarg).left(1)=="-")
32.49 + if (arglist[i].left(1)=="-")
32.50 {
32.51 // Compare given option to all defined options
32.52 - itopt=optlist.begin();
32.53 - while (itopt!=optlist.end())
32.54 + for (int j=0; j < optlist.size(); ++j)
32.55 {
32.56 - if ((*itarg)==(*itopt).getShort() ||
32.57 - (*itarg)==(*itopt).getLong())
32.58 + if (arglist.at(i)==optlist.value(j).getShort() ||
32.59 + arglist.at(i)==optlist.value(j).getLong())
32.60 {
32.61 - (*itopt).setActive();
32.62 + optlist[j].setActive();
32.63 isFile=false;
32.64 - if ((*itopt).getType()==StringOption)
32.65 + if (optlist[j].getType()==StringOption)
32.66 {
32.67 - itarg++;
32.68 - if (itarg==arglist.end())
32.69 + i++;
32.70 + if (i==arglist.size())
32.71 {
32.72 - cout << "Error: argument to option missing\n";
32.73 + qWarning ("Error: argument to option missing");
32.74 return 1;
32.75 }
32.76 - (*itopt).setArg (*itarg);
32.77 + optlist[j].setArg (arglist[i]);
32.78 isFile=false;
32.79 }
32.80 break;
32.81 }
32.82 - itopt++;
32.83 }
32.84 if (isFile)
32.85 {
32.86 @@ -90,12 +94,16 @@
32.87 return 1;
32.88 }
32.89 } else
32.90 - filelist.append (*itarg);
32.91 - itarg++;
32.92 + filelist.append (arglist[i]);
32.93 }
32.94 return 0;
32.95 }
32.96
32.97 +void Options::add (Option o)
32.98 +{
32.99 + optlist.append (o);
32.100 +}
32.101 +
32.102 void Options::add (const QString &n, const OptionType &t=SwitchOption, const QString &s="", const QString &l="")
32.103 {
32.104 Option o;
32.105 @@ -125,20 +133,15 @@
32.106
32.107 bool Options::isOn(const QString &s)
32.108 {
32.109 - OptionList::iterator it;
32.110 - for ( it = optlist.begin(); it != optlist.end(); ++it )
32.111 - if ((*it).getName()==s && (*it).isActive() )
32.112 + for (int i=0; i<optlist.size(); ++i)
32.113 + if (optlist[i].getName()==s && optlist[i].isActive() )
32.114 return true;
32.115 return false;
32.116 }
32.117
32.118 QString Options::getArg(const QString &s)
32.119 {
32.120 - OptionList::iterator it;
32.121 - for ( it = optlist.begin(); it != optlist.end(); ++it )
32.122 - {
32.123 - if ((*it).getName()==s)
32.124 - return (*it).getArg();
32.125 - }
32.126 - return "";
32.127 + for (int i=0; i<optlist.size(); ++i)
32.128 + if (optlist[i].getName()==s) return optlist[i].getArg();
32.129 + return QString();
32.130 }
33.1 --- a/options.h Thu Nov 23 16:18:26 2006 +0000
33.2 +++ b/options.h Fri Dec 08 20:18:56 2006 +0000
33.3 @@ -1,10 +1,7 @@
33.4 #ifndef OPTIONS_H
33.5 #define OPTIONS_H
33.6
33.7 -#include <qstring.h>
33.8 -#include <qstringlist.h>
33.9 -//Added by qt3to4:
33.10 -#include <Q3ValueList>
33.11 +#include <QStringList>
33.12
33.13 enum OptionType {SwitchOption,StringOption};
33.14
33.15 @@ -12,6 +9,7 @@
33.16 {
33.17 public:
33.18 Option();
33.19 + Option(const QString &, const OptionType &, const QString &, const QString &);
33.20 void set (const QString &, const OptionType &, const QString &, const QString &);
33.21 QString getName();
33.22 QString getShort();
33.23 @@ -31,14 +29,12 @@
33.24 };
33.25
33.26
33.27 -
33.28 -typedef Q3ValueList <Option> OptionList;
33.29 -
33.30 class Options
33.31 {
33.32 public:
33.33 Options();
33.34 int parse();
33.35 + void add (Option );
33.36 void add (const QString &,const OptionType &, const QString &, const QString&);
33.37 void setHelpText(const QString&);
33.38 QString getHelpText();
33.39 @@ -51,7 +47,7 @@
33.40 QString progname;
33.41 QString helptext;
33.42 QStringList filelist;
33.43 - OptionList optlist;
33.44 + QList <Option> optlist;
33.45 };
33.46
33.47 #endif
34.1 --- a/ornamentedobj.cpp Thu Nov 23 16:18:26 2006 +0000
34.2 +++ b/ornamentedobj.cpp Fri Dec 08 20:18:56 2006 +0000
34.3 @@ -18,13 +18,13 @@
34.4 init ();
34.5 }
34.6
34.7 -OrnamentedObj::OrnamentedObj(Q3Canvas* c) :LinkableMapObj(c)
34.8 +OrnamentedObj::OrnamentedObj(QGraphicsScene* s) :LinkableMapObj(s)
34.9 {
34.10 -// cout << "Const OrnamentedObj\n";
34.11 +// cout << "Const OrnamentedObj (s)\n";
34.12 init ();
34.13 }
34.14
34.15 -OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->canvas)
34.16 +OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->scene)
34.17 {
34.18 copy (lmo);
34.19 }
34.20 @@ -40,17 +40,17 @@
34.21
34.22 void OrnamentedObj::init ()
34.23 {
34.24 - heading = new HeadingObj(canvas);
34.25 + heading = new HeadingObj(scene);
34.26 heading->move (absPos.x(), absPos.y());
34.27
34.28 note.setNote("");
34.29 note.setFontHint (textEditor->getFontHintDefault() );
34.30
34.31 - systemFlags=new FlagRowObj(canvas);
34.32 + systemFlags=new FlagRowObj(scene);
34.33 systemFlags->clone(systemFlagsDefault);
34.34 systemFlags->setName ("systemFlags");
34.35
34.36 - standardFlags=new FlagRowObj(canvas);
34.37 + standardFlags=new FlagRowObj(scene);
34.38 standardFlags->clone(standardFlagsDefault);
34.39 standardFlags->setName ("standardFlags");
34.40
34.41 @@ -123,8 +123,8 @@
34.42 );
34.43 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
34.44
34.45 - ornamentsBBox.moveTopLeft ( QPoint ((int)(ox+x),(int)(oy+y)));
34.46 - clickBox.moveTopLeft (QPoint ((int)(ox + x), (int)(oy + y)));
34.47 + ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
34.48 + clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
34.49 }
34.50
34.51 void OrnamentedObj::move (double x, double y)
34.52 @@ -135,7 +135,7 @@
34.53 requestReposition();
34.54 }
34.55
34.56 -void OrnamentedObj::move (QPoint p)
34.57 +void OrnamentedObj::move (QPointF p)
34.58 {
34.59 move (p.x(), p.y());
34.60 }
34.61 @@ -152,22 +152,22 @@
34.62 requestReposition();
34.63 }
34.64
34.65 -void OrnamentedObj::moveBy (QPoint p)
34.66 +void OrnamentedObj::moveBy (QPointF p)
34.67 {
34.68 moveBy (p.x(), p.y());
34.69 }
34.70
34.71 void OrnamentedObj::move2RelPos(double x, double y)
34.72 {
34.73 - setRelPos (QPoint((int)x,(int)y));
34.74 + setRelPos (QPointF((int)x,(int)y));
34.75 if (parObj)
34.76 {
34.77 - QPoint p=parObj->getChildPos();
34.78 + QPointF p=parObj->getChildPos();
34.79 move (p.x()+x, p.y() +y);
34.80 }
34.81 }
34.82
34.83 -void OrnamentedObj::move2RelPos(QPoint p)
34.84 +void OrnamentedObj::move2RelPos(QPointF p)
34.85 {
34.86 move2RelPos (p.x(),p.y());
34.87 }
34.88 @@ -299,7 +299,7 @@
34.89 return standardFlags->isActive(f);
34.90 }
34.91
34.92 -QString OrnamentedObj::getSystemFlagName(const QPoint &p)
34.93 +QString OrnamentedObj::getSystemFlagName(const QPointF &p)
34.94 {
34.95 return systemFlags->getFlagName(p);
34.96 }
34.97 @@ -362,14 +362,14 @@
34.98
34.99 if (depth==0)
34.100 posAttr=
34.101 - attribut("absPosX",QString().setNum(absPos.x(),10)) +
34.102 - attribut("absPosY",QString().setNum(absPos.y(),10));
34.103 + attribut("absPosX",QString().setNum(absPos.x())) +
34.104 + attribut("absPosY",QString().setNum(absPos.y()));
34.105 else
34.106 {
34.107 if (depth==1 || typeid (*this)==typeid (FloatImageObj))
34.108 posAttr=
34.109 - attribut("relPosX",QString().setNum(relPos.x(),10)) +
34.110 - attribut("relPosY",QString().setNum(relPos.y(),10));
34.111 + attribut("relPosX",QString().setNum(relPos.x())) +
34.112 + attribut("relPosY",QString().setNum(relPos.y()));
34.113 else
34.114 posAttr="";
34.115 }
35.1 --- a/ornamentedobj.h Thu Nov 23 16:18:26 2006 +0000
35.2 +++ b/ornamentedobj.h Fri Dec 08 20:18:56 2006 +0000
35.3 @@ -6,7 +6,7 @@
35.4 class OrnamentedObj:public LinkableMapObj {
35.5 public:
35.6 OrnamentedObj ();
35.7 - OrnamentedObj (Q3Canvas*);
35.8 + OrnamentedObj (QGraphicsScene*);
35.9 OrnamentedObj (OrnamentedObj*);
35.10 ~OrnamentedObj ();
35.11 virtual void init ();
35.12 @@ -18,10 +18,10 @@
35.13 QColor getColor (); // get color of heading
35.14 virtual void positionContents();
35.15 virtual void move (double,double);
35.16 - virtual void move (QPoint);
35.17 + virtual void move (QPointF);
35.18 virtual void moveBy (double,double);
35.19 - virtual void moveBy (QPoint);
35.20 - virtual void move2RelPos (QPoint); // move relativly to parent^
35.21 + virtual void moveBy (QPointF);
35.22 + virtual void move2RelPos (QPointF); // move relativly to parent^
35.23 virtual void move2RelPos (double,double);
35.24 virtual void setNote(QString); // set note
35.25 virtual void setNote(NoteObj); // set note
35.26 @@ -37,7 +37,7 @@
35.27 virtual void activateStandardFlag(QString);
35.28 virtual void deactivateStandardFlag(QString);
35.29 virtual bool isSetStandardFlag(QString);
35.30 - virtual QString getSystemFlagName (const QPoint &p);
35.31 + virtual QString getSystemFlagName (const QPointF &p);
35.32 virtual bool isActiveFlag(const QString&); // check if flag is set
35.33 virtual void updateNoteFlag();
35.34 virtual void updateFlagsToolbar();
35.35 @@ -51,7 +51,7 @@
35.36 NoteObj note; // Notes
35.37 FlagRowObj *systemFlags; // System Flags
35.38 FlagRowObj *standardFlags; // Standard Flags
35.39 - QRect ornamentsBBox; // bbox of flags and heading
35.40 + QRectF ornamentsBBox; // bbox of flags and heading
35.41 QString url; // url to external doc
35.42 QString vymLink; // path to another map
35.43 bool hideExport; // hide in exports if set
36.1 --- a/process.cpp Thu Nov 23 16:18:26 2006 +0000
36.2 +++ b/process.cpp Fri Dec 08 20:18:56 2006 +0000
36.3 @@ -5,9 +5,9 @@
36.4 /////////////////////////////////////////////////////////////////
36.5 Process::Process()
36.6 {
36.7 - connect( this, SIGNAL(readyReadStderr()),
36.8 + connect( this, SIGNAL(readyReadStandardError()),
36.9 this, SLOT(readProcErrout()) );
36.10 - connect( this, SIGNAL(readyReadStdout()),
36.11 + connect( this, SIGNAL(readyReadStandardOutput()),
36.12 this, SLOT(readProcStdout()) );
36.13 clear();
36.14 }
36.15 @@ -24,7 +24,7 @@
36.16
36.17 void Process::waitFinished()
36.18 {
36.19 - while (isRunning())
36.20 + while (state()==QProcess::Running)
36.21 {
36.22 // FIXME use some kind of sleep here...
36.23 system ("sleep 1");
36.24 @@ -33,12 +33,12 @@
36.25
36.26 void Process::readProcErrout()
36.27 {
36.28 - errOut+=readStderr();
36.29 + errOut+=readAllStandardError();
36.30 }
36.31
36.32 void Process::readProcStdout()
36.33 {
36.34 - stdOut+=readStdout();
36.35 + stdOut+=readAllStandardOutput();
36.36 }
36.37
36.38 QString Process::getErrout()
37.1 --- a/process.h Thu Nov 23 16:18:26 2006 +0000
37.2 +++ b/process.h Fri Dec 08 20:18:56 2006 +0000
37.3 @@ -1,13 +1,13 @@
37.4 #ifndef PROCESS_H
37.5 #define PROCESS_H
37.6
37.7 -#include <q3process.h>
37.8 -#include <qstring.h>
37.9 +#include <QProcess>
37.10 +#include <QString>
37.11
37.12
37.13 using namespace std;
37.14
37.15 -class Process:public Q3Process
37.16 +class Process:public QProcess
37.17 {
37.18 Q_OBJECT
37.19 public:
38.1 --- a/version.h Thu Nov 23 16:18:26 2006 +0000
38.2 +++ b/version.h Fri Dec 08 20:18:56 2006 +0000
38.3 @@ -4,8 +4,8 @@
38.4 #include <QString>
38.5
38.6 #define __VYM_NAME "VYM"
38.7 -#define __VYM_VERSION "1.8.59"
38.8 -#define __VYM_BUILD_DATE "November 23, 2006"
38.9 +#define __VYM_VERSION "1.8.61"
38.10 +#define __VYM_BUILD_DATE "December 8, 2006"
38.11
38.12
38.13 bool checkVersion(const QString &);
39.1 --- a/xlinkobj.cpp Thu Nov 23 16:18:26 2006 +0000
39.2 +++ b/xlinkobj.cpp Fri Dec 08 20:18:56 2006 +0000
39.3 @@ -1,8 +1,6 @@
39.4 #include "xlinkobj.h"
39.5 #include "branchobj.h"
39.6 #include "mapeditor.h"
39.7 -//Added by qt3to4:
39.8 -#include <Q3PointArray>
39.9
39.10
39.11 /////////////////////////////////////////////////////////////////
39.12 @@ -17,9 +15,9 @@
39.13 init();
39.14 }
39.15
39.16 -XLinkObj::XLinkObj (Q3Canvas* c):MapObj(c)
39.17 +XLinkObj::XLinkObj (QGraphicsScene* s):MapObj(s)
39.18 {
39.19 - // cout << "Const XLinkObj (c) called from MapCenterObj (c)\n";
39.20 + // cout << "Const XLinkObj (s) called from MapCenterObj (s)\n";
39.21 init();
39.22 }
39.23
39.24 @@ -42,15 +40,14 @@
39.25 xLinkState=undefinedXLink;
39.26
39.27 color=QColor (180,180,180);
39.28 - line=new Q3CanvasLine (canvas);
39.29 width=1;
39.30 - line->setPen (QPen(color, width));
39.31 - line->setZ (Z_XLINK);
39.32 -
39.33 - poly=new Q3CanvasPolygon (canvas);
39.34 - poly->setBrush( color );
39.35 - poly->setZ (Z_XLINK);
39.36 -
39.37 + pen.setColor (color);
39.38 + pen.setWidth (width);
39.39 + pen.setCapStyle ( Qt::RoundCap );
39.40 + line=scene->addLine(QLineF(1,1,1,1),pen);
39.41 + line->setZValue (Z_XLINK);
39.42 + poly=scene->addPolygon(QPolygonF(),pen,color);
39.43 + poly->setZValue (Z_XLINK);
39.44 setVisibility (false);
39.45 }
39.46
39.47 @@ -62,6 +59,7 @@
39.48 beginBranch=other->beginBranch;
39.49 endBranch=other->endBranch;
39.50 width=other->width;
39.51 +
39.52 }
39.53
39.54 void XLinkObj::setBegin (BranchObj *bo)
39.55 @@ -97,27 +95,29 @@
39.56 void XLinkObj::setWidth (int w)
39.57 {
39.58 width=w;
39.59 + pen.setWidth (w);
39.60 setColor (color);
39.61 }
39.62
39.63 int XLinkObj::getWidth()
39.64 {
39.65 - return width;
39.66 + return pen.width();
39.67 }
39.68
39.69 void XLinkObj::setColor(QColor c)
39.70 {
39.71 color=c;
39.72 - line->setPen (QPen(color, width));
39.73 + pen.setColor (c);
39.74 + line->setPen (pen);
39.75 poly->setBrush( color );
39.76 }
39.77
39.78 QColor XLinkObj::getColor()
39.79 {
39.80 - return color;
39.81 + return pen.color();
39.82 }
39.83
39.84 -void XLinkObj::setEnd (QPoint p)
39.85 +void XLinkObj::setEnd (QPointF p)
39.86 {
39.87 endPos=p;
39.88 }
39.89 @@ -160,8 +160,8 @@
39.90
39.91 void XLinkObj::updateXLink()
39.92 {
39.93 - QPoint a,b;
39.94 - Q3PointArray pa (3);
39.95 + QPointF a,b;
39.96 + QPolygonF pa;
39.97 if (visBranch)
39.98 {
39.99 // Only one of the linked branches is visible
39.100 @@ -169,20 +169,20 @@
39.101 if (visBranch->getOrientation()==OrientRightOfCenter)
39.102 {
39.103 b.setX (b.x()+25);
39.104 - pa.putPoints (0,3,
39.105 - b.x(),b.y(),
39.106 - b.x()-arrowSize,b.y()-arrowSize,
39.107 - b.x()-arrowSize,b.y()+arrowSize
39.108 - );
39.109 - poly->setPoints (pa);
39.110 +
39.111 + pa.clear();
39.112 + pa<< QPointF(b.x(),b.y())<<
39.113 + QPointF(b.x()-arrowSize,b.y()-arrowSize)<<
39.114 + QPointF(b.x()-arrowSize,b.y()+arrowSize);
39.115 + poly->setPolygon(pa);
39.116 } else
39.117 {
39.118 b.setX (b.x()-25);
39.119 - pa.putPoints (0,3,
39.120 - b.x(),b.y(),
39.121 - b.x()+arrowSize,b.y()-arrowSize,
39.122 - b.x()+arrowSize,b.y()+arrowSize);
39.123 - poly->setPoints (pa);
39.124 + pa.clear();
39.125 + pa<< QPointF(b.x(),b.y())<<
39.126 + QPointF(b.x()+arrowSize,b.y()-arrowSize)<<
39.127 + QPointF(b.x()+arrowSize,b.y()+arrowSize);
39.128 + poly->setPolygon (pa);
39.129 }
39.130 } else
39.131 {
39.132 @@ -201,7 +201,7 @@
39.133 }
39.134
39.135
39.136 - if (line->startPoint()==a && line->endPoint()==b && !visBranch)
39.137 + if (line->line().p1()==a && line->line().p2()==b && !visBranch)
39.138 {
39.139 // update is called from both branches, so only
39.140 // update if something has changed
39.141 @@ -211,8 +211,8 @@
39.142 {
39.143 beginPos=a;
39.144 endPos=b;
39.145 - line->setPen (QPen(color, width));
39.146 - line->setPoints (a.x(), a.y(), b.x(), b.y());
39.147 + line->setPen (pen);
39.148 + line->setLine(a.x(), a.y(), b.x(), b.y());
39.149 }
39.150 }
39.151
40.1 --- a/xlinkobj.h Thu Nov 23 16:18:26 2006 +0000
40.2 +++ b/xlinkobj.h Fri Dec 08 20:18:56 2006 +0000
40.3 @@ -9,14 +9,14 @@
40.4 class XLinkObj:public MapObj {
40.5 public:
40.6 XLinkObj ();
40.7 - XLinkObj (Q3Canvas*);
40.8 + XLinkObj (QGraphicsScene*);
40.9 ~XLinkObj ();
40.10 virtual void init ();
40.11 virtual void copy (XLinkObj*);
40.12 void setBegin (BranchObj*);
40.13 BranchObj* getBegin();
40.14 void setEnd (BranchObj*);
40.15 - void setEnd (QPoint);
40.16 + void setEnd (QPointF);
40.17 BranchObj* getEnd();
40.18 void setColor(QColor);
40.19 QColor getColor();
40.20 @@ -35,16 +35,17 @@
40.21
40.22 private:
40.23 static int arrowSize;
40.24 + QPen pen;
40.25 QColor color;
40.26 int width;
40.27 - Q3CanvasLine *line;
40.28 - Q3CanvasPolygon *poly;
40.29 + QGraphicsLineItem *line;
40.30 + QGraphicsPolygonItem *poly;
40.31 BranchObj *beginBranch;
40.32 BranchObj *endBranch;
40.33 BranchObj *visBranch; // the "visible" part of a partially scrolled link
40.34 XLinkState xLinkState; // init during drawing or active
40.35 - QPoint beginPos;
40.36 - QPoint endPos;
40.37 + QPointF beginPos;
40.38 + QPointF endPos;
40.39 };
40.40
40.41 #endif
41.1 --- a/xml.cpp Thu Nov 23 16:18:26 2006 +0000
41.2 +++ b/xml.cpp Fri Dec 08 20:18:56 2006 +0000
41.3 @@ -87,7 +87,7 @@
41.4 if (!atts.value( "backgroundColor").isEmpty() )
41.5 {
41.6 col.setNamedColor(atts.value("backgroundColor"));
41.7 - mc->getCanvas()->setBackgroundColor(col);
41.8 + mc->getScene()->setBackgroundBrush(col);
41.9 }
41.10 if (!atts.value( "linkColorHint").isEmpty() )
41.11 {
41.12 @@ -590,7 +590,7 @@
41.13 lastFloat->setFloatExport (false);
41.14 }
41.15 if (!a.value( "zPlane").isEmpty() )
41.16 - lastFloat->setZ (a.value("zPlane").toInt ());
41.17 + lastFloat->setZValue (a.value("zPlane").toInt ());
41.18 int x,y;
41.19 bool okx,oky;
41.20 if (!a.value( "relPosX").isEmpty() )
41.21 @@ -627,7 +627,7 @@
41.22 QColor col;
41.23 bool okx;
41.24 bool success=false;
41.25 - XLinkObj *xlo=new XLinkObj (mc->getCanvas());
41.26 + XLinkObj *xlo=new XLinkObj (mc->getScene());
41.27 if (!a.value( "color").isEmpty() )
41.28 {
41.29 col.setNamedColor(a.value("color"));
42.1 --- a/xsltproc.cpp Thu Nov 23 16:18:26 2006 +0000
42.2 +++ b/xsltproc.cpp Fri Dec 08 20:18:56 2006 +0000
42.3 @@ -47,34 +47,34 @@
42.4 void XSLTProc::process()
42.5 {
42.6 ShowTextDialog dia;
42.7 + QStringList args;
42.8 Process *xsltProc=new Process ();
42.9 - xsltProc->clearArguments();
42.10 - xsltProc->addArgument (xsltprocessor);
42.11
42.12 QStringList::Iterator itk;
42.13 QStringList::Iterator itv=stringParamVal.begin();
42.14
42.15 for ( itk = stringParamKey.begin(); itk != stringParamKey.end(); ++itk )
42.16 {
42.17 - xsltProc->addArgument ("--stringparam");
42.18 - xsltProc->addArgument (*itk);
42.19 - xsltProc->addArgument (*itv);
42.20 + args << "--stringparam";
42.21 + args << *itk;
42.22 + args << *itv;
42.23 ++itv;
42.24 }
42.25
42.26 - xsltProc->addArgument ("--output");
42.27 - xsltProc->addArgument (outputFile);
42.28 - xsltProc->addArgument (xslFile);
42.29 - xsltProc->addArgument (inputFile);
42.30 - dia.append ("vym is executing: \n" + xsltProc->arguments().join(" ") );
42.31 - if (!xsltProc->start() )
42.32 + args << "--output";
42.33 + args << outputFile;
42.34 + args << xslFile;
42.35 + args << inputFile;
42.36 + dia.append ("vym is executing: \n" + xsltprocessor+" "+args.join(" ") );
42.37 + xsltProc->start(xsltprocessor,args);
42.38 + if (!xsltProc->waitForStarted() )
42.39 {
42.40 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
42.41 QObject::tr("Could not start %1").arg(xsltprocessor) );
42.42 } else
42.43 {
42.44 xsltProc->waitFinished();
42.45 - if (!xsltProc->normalExit() )
42.46 + if (xsltProc->exitStatus()!=QProcess::NormalExit )
42.47 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
42.48 QObject::tr("%1 didn't exit normally").arg(xsltprocessor) +
42.49 xsltProc->getErrout() );