# HG changeset patch # User insilmaril # Date 1157449633 0 # Node ID 7b74fa3772bf82c724e347a5407b9a568ed6f4c5 # Parent 3dc98c8843bc88a670da27c6f0526a7cfd3d74f8 Moved the qt4-port branch to HEAD diff -r 3dc98c8843bc -r 7b74fa3772bf aboutdialog.cpp --- a/aboutdialog.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/aboutdialog.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -1,5 +1,6 @@ -#include -#include +#include +#include +#include #include "aboutdialog.h" #include "version.h" @@ -18,9 +19,9 @@ mainLayout=new QVBoxLayout( this, 10); tabs=new QTabWidget (this); - credits=new AboutTextBrowser (this,"credits"); + credits=new AboutTextBrowser (parent,"credits"); - credits->setText ( + credits->setHtml( "
" "

VYM - View Your Mind

" "

A tool to put the things you have got in your mind into a map.

" @@ -52,11 +53,12 @@ credits->setFrameStyle( QFrame::Panel | QFrame::Plain ); tabs->addTab (credits,"Credits"); - license=new AboutTextBrowser (this,"license"); - //license->setTextFormat (PlainText); + license=new AboutTextBrowser (parent,"license"); license->setText ( + "
" "

VYM - View Your Mind

" - "

Copyright (C) 2004-2005 Uwe Drechsel

" + "

Copyright (C) 2004-2006 Uwe Drechsel

" + "
" "

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

" @@ -185,19 +187,9 @@ } -void AboutTextBrowser::setSource(const QString &name) +void AboutTextBrowser::setSource(const QUrl &url ) { - QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory(); - const QMimeSource *data = factory->data(name); - if (data) { - QTextBrowser::setSource(name); - } else { - QProcess *proc = new QProcess( this ); - proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" )); - proc->addArgument( name); - - if ( !proc->start() ) - if (mainWindow->settingsURL() ) - setSource(name); - } + QProcess *proc= new QProcess (); + proc->start( settings.value("/mainwindow/readerURL").toString(),QStringList ()<waitForStarted() &&mainWindow->settingsURL() ) setSource(url); } diff -r 3dc98c8843bc -r 7b74fa3772bf aboutdialog.h --- a/aboutdialog.h Tue Aug 01 09:30:57 2006 +0000 +++ b/aboutdialog.h Tue Sep 05 09:47:13 2006 +0000 @@ -1,12 +1,12 @@ #ifndef ABOUTDIALOG_H #define ABOUTDIALOG_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include class AboutTextBrowser; ///////////////////////////////////////////////////////////////////////////// @@ -22,9 +22,9 @@ AboutTextBrowser *credits; AboutTextBrowser *license; - QBoxLayout *mainLayout; - QBoxLayout *topLayout; - QBoxLayout *bottomLayout; + QLayout *mainLayout; + QLayout *topLayout; + QLayout *bottomLayout; QPushButton *okbutton; }; @@ -35,7 +35,7 @@ public: AboutTextBrowser(QWidget *parent, const char *name = 0); public slots: - void setSource(const QString &name); + virtual void setSource(const QUrl &url); }; #endif diff -r 3dc98c8843bc -r 7b74fa3772bf api.cpp --- a/api.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/api.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -126,9 +126,7 @@ int API::parInt (bool &ok,const uint &index) { if (checkParamIsInt (index)) - { return paramList[index].toInt (&ok, 10); - } ok=false; return 0; } diff -r 3dc98c8843bc -r 7b74fa3772bf branchobj.cpp --- a/branchobj.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/branchobj.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -14,6 +14,7 @@ ///////////////////////////////////////////////////////////////// BranchObj* BranchObj::itLast=NULL; +BranchObj* BranchObj::itFirst=NULL; BranchObj::BranchObj () :OrnamentedObj() @@ -24,14 +25,14 @@ depth=-1; } -BranchObj::BranchObj (QCanvas* c):OrnamentedObj (c) +BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c) { // cout << "Const BranchObj (c) called from MapCenterObj (c)\n"; parObj=NULL; canvas=c; } -BranchObj::BranchObj (QCanvas* c, LinkableMapObj* p):OrnamentedObj (c) +BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c) { // cout << "Const BranchObj (c,p)\n"; canvas=c; @@ -72,7 +73,7 @@ return angle == other.angle; } -int BranchObjPtrList::compareItems ( QPtrCollection::Item i, QPtrCollection::Item j) +int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j) { // Make sure PtrList::find works if (i==j) return 0; @@ -149,7 +150,7 @@ int BranchObj::getNum() { if (parObj) - return ((BranchObj*)(parObj))->getNum ((BranchObj*)(this)); + return ((BranchObj*)parObj)->getNum (this); else return 0; } @@ -158,9 +159,10 @@ { // keep current pointer in branch, // otherwise save might fail - int cur=branch.at(); + // FIXME is this _really_ still true? +// int cur=branch.at(); int ind=branch.findRef (bo); - branch.at(cur); +// branch.at(cur); return ind; } @@ -406,6 +408,7 @@ BranchObj* BranchObj::first() { itLast=NULL; + itFirst=this; return this; } @@ -416,15 +419,17 @@ BranchObj *po=(BranchObj*)(parObj); if (!itLast) - { // We are just beginning at the mapCenter + { if (bo) - { + { // We are just beginning, + // return first child itLast=this; return bo; } else { - itLast=NULL; + // No childs + itLast=this; return NULL; } } @@ -457,7 +462,7 @@ } } - // Try to find last child, we came from, in my own childs + // Try to find last child, where we came from, in my own childs bool searching=true; while (bo && searching) { @@ -476,6 +481,7 @@ { if (po) { + if (this==itFirst) return NULL; // Stop at starting point // go up itLast=this; lmo=po->next(); @@ -791,6 +797,11 @@ // save names of flags set s+=standardFlags->saveToDir(tmpdir,prefix,0); + // Save FloatImages + FloatImageObj *fio; + for (fio=floatimage.first(); fio; fio=floatimage.next() ) + s+=fio->saveToDir (tmpdir,prefix,offset); + // save note if (!note.isEmpty() ) s+=note.saveToDir(); @@ -800,14 +811,8 @@ for (bo=branch.first(); bo; bo=branch.next() ) s+=bo->saveToDir(tmpdir,prefix,offset); - // Save FloatImages - FloatImageObj *fio; - for (fio=floatimage.first(); fio; fio=floatimage.next() ) - s+=fio->saveToDir (tmpdir,prefix,offset); - // Save XLinks XLinkObj *xlo; - //FIXME exponential increase in xlinks... QString ol; // old link QString cl; // current link for (xlo=xlink.first(); xlo; xlo=xlink.next() ) @@ -877,7 +882,6 @@ calcBBoxSize(); positionBBox(); requestReposition(); - //FIXME undo needed } bool BranchObj::getIncludeImagesVer() @@ -891,7 +895,6 @@ calcBBoxSize(); positionBBox(); requestReposition(); - //FIXME undo needed } bool BranchObj::getIncludeImagesHor() @@ -925,7 +928,6 @@ positionBBox(); requestReposition(); return newfi; - //FIXME undo needed } LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio) @@ -941,7 +943,6 @@ positionBBox(); requestReposition(); return newfi; - // FIMXE undo needed } FloatImageObj* BranchObj::getFirstFloatImage () @@ -1150,7 +1151,7 @@ bool BranchObj::canMoveBranchUp() { - if (!parObj) return false; + if (!parObj || depth==1) return false; BranchObj* par=(BranchObj*)parObj; if (this==par->getFirstBranch()) return false; @@ -1158,23 +1159,24 @@ return true; } -BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself) +BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist { savePosInAngle(); int i=branch.find(bo1); + cout << "BO: i="<0) { // -1 if bo1 not found branch.at(i)->angle--; branch.at(i-1)->angle++; branch.sort(); - return branch.at(i-1); + return branch.at(i); } else - return branch.at(i); + return NULL; } bool BranchObj::canMoveBranchDown() { - if (!parObj) return false; + if (!parObj|| depth==1) return false; BranchObj* par=(BranchObj*)parObj; if (this==par->getLastBranch()) return false; @@ -1182,7 +1184,7 @@ return true; } -BranchObj* BranchObj::moveBranchDown(BranchObj* bo1) +BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist { savePosInAngle(); int i=branch.find(bo1); @@ -1193,9 +1195,9 @@ branch.at(i)->angle++; branch.at(j)->angle--; branch.sort(); - return branch.at(j); + return branch.at(i); } else - return branch.at(i); + return NULL; } BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos) @@ -1203,7 +1205,7 @@ // Find current parent and // remove pointer to myself there if (!dst) return NULL; - BranchObj *par=(BranchObj*)(parObj); + BranchObj *par=(BranchObj*)parObj; if (par) par->removeBranchPtr (this); else @@ -1248,7 +1250,7 @@ // If I am the mapcenter or a mainbranch, reposition heading if (depth<2) - { //FIXME ugly! optimize this move for MCO needed to initially position text in box... + { if (depth==1) // Calc angle to mapCenter if I am a mainbranch // needed for reordering the mainbranches clockwise @@ -1447,7 +1449,7 @@ if (!status.isEmpty()) mainWindow->statusMessage (status); // Update Toolbar - standardFlags->updateToolbar(); + updateFlagsToolbar(); // Update actions in mapeditor mapEditor->updateActions(); diff -r 3dc98c8843bc -r 7b74fa3772bf branchobj.h --- a/branchobj.h Tue Aug 01 09:30:57 2006 +0000 +++ b/branchobj.h Tue Sep 05 09:47:13 2006 +0000 @@ -5,10 +5,12 @@ #include "linkablemapobj.h" #include "ornamentedobj.h" #include "xlinkobj.h" +//Added by qt3to4: +#include -class BranchObjPtrList : public QPtrList +class BranchObjPtrList : public Q3PtrList { - virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j); + virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j); }; enum BranchModification {NewBranch, MovedBranch}; @@ -18,8 +20,8 @@ class BranchObj:public OrnamentedObj { public: BranchObj (); - BranchObj (QCanvas*); - BranchObj (QCanvas*, LinkableMapObj* parent); + BranchObj (Q3Canvas*); + BranchObj (Q3Canvas*, LinkableMapObj* parent); ~BranchObj (); bool operator< ( const BranchObj & ); bool operator== ( const BranchObj & ); @@ -122,9 +124,10 @@ protected: static BranchObj* itLast; // iterator for first(), next() + static BranchObj* itFirst; // first iterator for first(), next() BranchObjPtrList branch; // all child branches - QPtrList floatimage; // child images - QPtrList xlink; // xlinks to other branches + Q3PtrList floatimage; // child images + Q3PtrList xlink; // xlinks to other branches public: float angle; // used in mainbranch to reorder mainbranches protected: diff -r 3dc98c8843bc -r 7b74fa3772bf exportxhtmldialog.ui.h --- a/exportxhtmldialog.ui.h Tue Aug 01 09:30:57 2006 +0000 +++ b/exportxhtmldialog.ui.h Tue Sep 05 09:47:13 2006 +0000 @@ -1,3 +1,6 @@ +//Added by qt3to4: +#include +#include /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** @@ -22,42 +25,42 @@ void ExportXHTMLDialog::readSettings() { - dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.currentDirPath() ); + dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() ); lineEditDir->setText(dir); - if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes") + if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes") useImage=true; else useImage=false; imageButton->setChecked(useImage); - if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no")=="yes") + if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes") useTextColor=true; else useTextColor=false; textColorButton->setChecked(useTextColor); /* FIXME this was used in old html export, is not yet in new stylesheet - if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes") + if ( settings.readEntry ("/export/html/useHeading","no")=="yes") useHeading=true; else useHeading=false; checkBox4_2->setChecked(useHeading); */ - if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/saveSettingsInMap","no")=="yes") + if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes") saveSettingsInMap=true; else saveSettingsInMap=false; saveSettingsInMapButton->setChecked(saveSettingsInMap); - if ( settings.readEntry ("/vym/export/xhtml/showWarnings","yes")=="yes") + if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes") showWarnings=true; else showWarnings=false; warningsButton->setChecked(showWarnings); - if ( settings.readEntry ("/vym/export/xhtml/showOutput","no")=="yes") + if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes") showOutput=true; else showOutput=false; @@ -71,19 +74,19 @@ } else { xsl=settings.readLocalEntry - (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); + (filepath,"/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); css=settings.readLocalEntry - (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css"); + (filepath,"/export/xhtml/css","/usr/share/vym/styles/vym.css"); } lineEditXSL->setText(xsl); lineEditCSS->setText(css); prescript=settings.readLocalEntry - (filepath,"/vym/export/xhtml/prescript",""); + (filepath,"/export/xhtml/prescript",""); lineEditPreScript->setText (prescript); postscript=settings.readLocalEntry - (filepath,"/vym/export/xhtml/postscript",""); + (filepath,"/export/xhtml/postscript",""); lineEditPostScript->setText (postscript); if (!prescript.isEmpty() || !postscript.isEmpty()) @@ -112,8 +115,8 @@ void ExportXHTMLDialog::browseDirectoryPressed() { - QFileDialog fd( this, tr("VYM - Export HTML to directory")); - fd.setMode (QFileDialog::DirectoryOnly); + Q3FileDialog fd( this, tr("VYM - Export HTML to directory")); + fd.setMode (Q3FileDialog::DirectoryOnly); fd.setCaption(tr("VYM - Export HTML to directory")); fd.setModal (true); fd.show(); @@ -165,7 +168,7 @@ void ExportXHTMLDialog::browseCSSPressed() { - QFileDialog fd( this, tr("VYM - Path to CSS file")); + Q3FileDialog fd( this, tr("VYM - Path to CSS file")); fd.setModal (true); fd.addFilter ("Cascading Stylesheet (*.css)"); fd.show(); @@ -192,7 +195,7 @@ void ExportXHTMLDialog::browseXSLPressed() { - QFileDialog fd( this, tr("VYM - Path to XSL file")); + Q3FileDialog fd( this, tr("VYM - Path to XSL file")); fd.setModal (true); fd.addFilter ("Extensible Stylesheet Language (*.xsl)"); fd.show(); @@ -213,7 +216,7 @@ void ExportXHTMLDialog::browsePreExportButtonPressed() { - QFileDialog fd( this, tr("VYM - Path to pre export script")); + Q3FileDialog fd( this, tr("VYM - Path to pre export script")); fd.setModal (true); fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); fd.show(); @@ -229,7 +232,7 @@ void ExportXHTMLDialog::browsePostExportButtonPressed() { - QFileDialog fd( this, tr("VYM - Path to post export script")); + Q3FileDialog fd( this, tr("VYM - Path to post export script")); fd.setModal (true); fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); fd.show(); @@ -248,38 +251,38 @@ // Save options to settings file // (but don't save at destructor, which // is called for "cancel", too) - settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir); - settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript); - settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript); + settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir); + settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript); + settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript); if (useImage) - settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","yes"); + settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes"); else - settings.setLocalEntry (filepath,"/vym/export/xhtml/useImage","no"); + settings.setLocalEntry (filepath,"/export/xhtml/useImage","no"); if (useTextColor) - settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","yes"); + settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes"); else - settings.setLocalEntry (filepath,"/vym/export/xhtml/useTextColor","no"); + settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no"); if (showWarnings) - settings.writeEntry ("/vym/export/xhtml/showWarnings","yes"); + settings.writeEntry ("/export/xhtml/showWarnings","yes"); else - settings.writeEntry ("/vym/export/xhtml/showWarnings","no"); + settings.writeEntry ("/export/xhtml/showWarnings","no"); if (showOutput) - settings.writeEntry ("/vym/export/xhtml/showOutput","yes"); + settings.writeEntry ("/export/xhtml/showOutput","yes"); else - settings.writeEntry ("/vym/export/xhtml/showOutput","no"); + settings.writeEntry ("/export/xhtml/showOutput","no"); QString ipath; ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png"; if (!options.isOn ("local")) { settings.setLocalEntry - (filepath,"/vym/export/xhtml/xsl",xsl); + (filepath,"/export/xhtml/xsl",xsl); settings.setLocalEntry - (filepath,"/vym/export/xhtml/css",css); + (filepath,"/export/xhtml/css",css); } // Provide a smaller URL-icon to improve Layout @@ -291,19 +294,19 @@ if(!pm.save (dir + "flags/flag-url-16x16.png","PNG")) QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath)); if (!saveSettingsInMap) - settings.clearLocal("/vym/export/xhtml"); + settings.clearLocal("/export/xhtml"); else settings.setLocalEntry - (filepath,"/vym/export/xhtml/saveSettingsInMap","yes"); + (filepath,"/export/xhtml/saveSettingsInMap","yes"); // Copy CSS file QFile css_src (css); QFile css_dst (dir+"vym.css"); - if (!css_src.open ( IO_ReadOnly)) - QMessageBox::warning( 0, tr( "Warning" ),+tr("Could not open %1").arg(css)); + if (!css_src.open ( QIODevice::ReadOnly)) + QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css)); else { - if (!css_dst.open( IO_WriteOnly)) + if (!css_dst.open( QIODevice::WriteOnly)) QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css")); else { diff -r 3dc98c8843bc -r 7b74fa3772bf findwindow.cpp --- a/findwindow.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/findwindow.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -1,22 +1,26 @@ #include +//Added by qt3to4: +#include +#include +#include #include "findwindow.h" #include "version.h" FindWindow::FindWindow(QWidget* parent, const char* name) - : QGroupBox( 0, Horizontal, "Find", parent, name ) + : Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name ) { setCaption (__VYM " - " +tr("Find Text")); //resize (180,130); move (130,130); - setMargin( 100 ); + //FIXME not avail in QT4 setMargin( 100 ); - QVBoxLayout* box = new QVBoxLayout( layout() ); + Q3VBoxLayout* box = new Q3VBoxLayout( layout() ); - QHBoxLayout *row1 = new QHBoxLayout( box ); + Q3HBoxLayout *row1 = new Q3HBoxLayout( box ); row1->setMargin( 10 ); // Create a Label @@ -24,7 +28,7 @@ row1->addWidget( label ); // Create LineEdit (here QComboBox) - QHBoxLayout *row2 = new QHBoxLayout( box ); + Q3HBoxLayout *row2 = new Q3HBoxLayout( box ); row2->setMargin( 10 ); findcombo = new QComboBox( true, this ); findcombo->setMinimumWidth(150); @@ -36,7 +40,7 @@ //findcombo->insertItem( "Normal", -1 ); // Create Buttons - QHBoxLayout *row3 = new QHBoxLayout( box ); + Q3HBoxLayout *row3 = new Q3HBoxLayout( box ); row3->setMargin( 10 ); clearbutton = new QPushButton (tr("Clear"),this); connect ( clearbutton, SIGNAL( clicked() ), @@ -47,7 +51,7 @@ row3->addItem(si1); cancelbutton = new QPushButton (tr("Cancel"),this); - cancelbutton->setAccel (Key_Escape); + cancelbutton->setAccel (Qt::Key_Escape); connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); row3->addWidget (cancelbutton); diff -r 3dc98c8843bc -r 7b74fa3772bf findwindow.h --- a/findwindow.h Tue Aug 01 09:30:57 2006 +0000 +++ b/findwindow.h Tue Sep 05 09:47:13 2006 +0000 @@ -1,15 +1,15 @@ #ifndef FINDWINDOW_H #define FINDWINDOW_H -#include +#include #include #include -#include +#include #include #include -class FindWindow : public QGroupBox +class FindWindow : public Q3GroupBox { Q_OBJECT @@ -27,7 +27,7 @@ void somethingChanged(); // emit to mainwindow private: - QGroupBox *findbox; + Q3GroupBox *findbox; QComboBox *findcombo; QPushButton *clearbutton; QPushButton *findbutton; diff -r 3dc98c8843bc -r 7b74fa3772bf mapcenterobj.cpp --- a/mapcenterobj.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/mapcenterobj.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -13,7 +13,7 @@ init(); } -MapCenterObj::MapCenterObj(QCanvas* c) : BranchObj (c) +MapCenterObj::MapCenterObj(Q3Canvas* c) : BranchObj (c) { // cout << "Const MapCenterObj canvas="< + #include "branchobj.h" #include "xlinkobj.h" #include "version.h" @@ -9,7 +12,7 @@ class MapCenterObj:public BranchObj { public: MapCenterObj (); - MapCenterObj (QCanvas*); + MapCenterObj (Q3Canvas*); ~MapCenterObj (); void clear(); void init(); diff -r 3dc98c8843bc -r 7b74fa3772bf selection.cpp --- a/selection.cpp Tue Aug 01 09:30:57 2006 +0000 +++ b/selection.cpp Tue Sep 05 09:47:13 2006 +0000 @@ -5,21 +5,19 @@ { } -Selection::Selection(const Selection &other) -{ -} - Selection::~Selection() { } -void Selection::init() +void Selection::setMapCenter(MapCenterObj *mco) { - selectList.setAutoDelete(true); + mapCenter=mco; } void Selection::copy(const Selection &other) { + mapCenter=other.mapCenter; + selectList=other.selectList; } void Selection::clear() @@ -29,11 +27,29 @@ bool Selection::select(LinkableMapObj *lmo) { + clear(); + selectList.append (lmo); return false; } -void Selection::unselect(LinkableMapObj *lmo) +bool Selection::select (const QString &s) { + LinkableMapObj *lmo=mapCenter->findObjBySelect(s); + + // Finally select the found object + if (lmo) + { + clear(); + select (lmo); + return true; + } + return false; + +} + +void Selection::unselect() +{ + clear(); } bool Selection::isEmpty() @@ -45,3 +61,14 @@ { return selectList.count(); } + +QString Selection::getSelectString() +{ + // TODO multiselection (maybe separated by ";") + if (selectList.count()==1) + return selectList.first()->getSelectString(); + else + return""; +} + + diff -r 3dc98c8843bc -r 7b74fa3772bf selection.h --- a/selection.h Tue Aug 01 09:30:57 2006 +0000 +++ b/selection.h Tue Sep 05 09:47:13 2006 +0000 @@ -1,26 +1,32 @@ -#ifndef SELECTIONOBJ_H -#define SELECTIONOBJ_H +#ifndef SELECTION_H +#define SELECTION_H + +#include #include "linkablemapobj.h" -#include +#include "mapcenterobj.h" class Selection { public: Selection (); - Selection (const Selection&); ~Selection(); - void init(); void copy(const Selection&); void clear(); + void setMapCenter (MapCenterObj *); bool select (LinkableMapObj*); - void unselect (LinkableMapObj*); + bool select (const QString &); + void unselect (); bool isEmpty(); uint count(); + QString getSelectString(); + private: - QPtrList selectList; + void init(); + QList selectList; + MapCenterObj *mapCenter; }; #endif diff -r 3dc98c8843bc -r 7b74fa3772bf toolbars.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolbars.h Tue Sep 05 09:47:13 2006 +0000 @@ -0,0 +1,31 @@ +#ifndef TOOLBARS_H +#define TOOLBARS_H + +#include + +#include "settings.h" + +class ToolBar:public QToolBar +{ + Q_OBJECT + +public: + void loadSettings (const Settings &); + void saveSettings (const Settings &); + +private: +}; + +///////////////////////////////////////////////////////////////////////////// +class ToolBarSet +{ +public: + ToolBarSet(); + void loadSettings(const Settings &); + void saveSettings(const Settings &); + void add (QToolBar *); +private: + QList list; +}; + +#endif