# HG changeset patch # User insilmaril # Date 1248699197 0 # Node ID 9db215a4ad53c987ec03e021b3e335b4c5511583 # Parent 85dec6a8c12ce52bbc8de757ab46fc1c890e979e Playing with dbus, fixed name of TW translation file diff -r 85dec6a8c12c -r 9db215a4ad53 mapeditor.h --- a/mapeditor.h Mon Jul 27 12:53:17 2009 +0000 +++ b/mapeditor.h Mon Jul 27 12:53:17 2009 +0000 @@ -50,12 +50,14 @@ public: void print(); //!< Print the map + QRectF getTotalBBox(); //!< Bounding box of all items in map + QPixmap getPixmap(); //!< Get a pixmap of the map void setAntiAlias (bool); //!< Set or unset antialiasing void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps public: TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude - AttributeTable* attributeTable(); + AttributeTable* attributeTable(); // FIXME-3 void testFunction1(); // just testing new stuff void testFunction2(); // just testing new stuff diff -r 85dec6a8c12c -r 9db215a4ad53 tex/vym.changelog --- a/tex/vym.changelog Mon Jul 27 12:53:17 2009 +0000 +++ b/tex/vym.changelog Mon Jul 27 12:53:17 2009 +0000 @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jul 22 21:51:04 CEST 2009 - uwedr@suse.de + +- Bugfix: relinking a branch to a scrolled branch doesn't unscroll + anymore +- Bugfix: Importing KDE bookmarks with empty folders doesn't + scroll these folders anymore ------------------------------------------------------------------- Thu Apr 2 11:56:17 CEST 2009 - uwedr@suse.de diff -r 85dec6a8c12c -r 9db215a4ad53 vym.pro --- a/vym.pro Mon Jul 27 12:53:17 2009 +0000 +++ b/vym.pro Mon Jul 27 12:53:17 2009 +0000 @@ -32,7 +32,7 @@ HEADERS += \ aboutdialog.h \ - adaptor.h \ + adaptormodel.h \ animpoint.h \ attribute.h \ # attributedelegate.h\ @@ -93,7 +93,7 @@ SOURCES += \ aboutdialog.cpp \ - adaptor.cpp \ + adaptormodel.cpp \ animpoint.cpp \ attribute.cpp \ # attributedelegate.cpp \ diff -r 85dec6a8c12c -r 9db215a4ad53 vymmodel.cpp --- a/vymmodel.cpp Mon Jul 27 12:53:17 2009 +0000 +++ b/vymmodel.cpp Mon Jul 27 12:53:17 2009 +0000 @@ -49,7 +49,7 @@ int VymModel::mapNum=0; // make instance -VymModel::VymModel() +VymModel::VymModel() { // cout << "Const VymModel\n"; init(); @@ -151,11 +151,11 @@ // addMapCenter(); FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene //Initialize DBUS - //new CarAdaptor(car); + adaptorModel=new AdaptorModel(this); // Created and not deleted as documented in Qt + //adaptor->setModel (this); //connection.registerObject("/Car", car); - dbusConnection.registerService("org.insilmaril.vym"); - - + dbusConnection.registerService("org.insilmaril.VymModel"); + dbusConnection.sessionBus().registerObject ("/Object1",this); } void VymModel::makeTmpDirectories() @@ -168,7 +168,7 @@ } -MapEditor* VymModel::getMapEditor() // FIXME-2 VM better return favourite editor here +MapEditor* VymModel::getMapEditor() // FIXME-3 VM better return favourite editor here { return mapEditor; } @@ -1503,6 +1503,15 @@ } } +QString VymModel::getHeading() +{ + TreeItem *selti=getSelectedItem(); + if (selti) + return selti->getHeading(); + else + return QString(); +} + BranchItem* VymModel::findText (QString s, bool cs) { QTextDocument::FindFlags flags=0; @@ -3717,6 +3726,7 @@ void VymModel::exportImage(QString fname, bool askName, QString format) { +/* FIXME-2 export as image, but directly from mapEditor?! if (fname=="") { fname=getMapName()+".png"; @@ -3740,9 +3750,10 @@ } setExportMode (true); - QPixmap pix (getPixmap()); + QPixmap pix (mapEditor->getPixmap()); pix.save(fname, format); setExportMode (false); +*/ } @@ -3761,8 +3772,8 @@ // Create subdirectories makeSubDirs (dir); - // write to directory - QString saveFile=saveToDir (dir,mapName+"-",true,getTotalBBox().topLeft() ,NULL); + // write to directory //FIXME-4 check totalBBox here... + QString saveFile=saveToDir (dir,mapName+"-",true,mapEditor->getTotalBBox().topLeft() ,NULL); QFile file; file.setName ( dir + "/"+mapName+".xml"); @@ -4008,27 +4019,6 @@ } */ -QPixmap VymModel::getPixmap() -{ - QRectF mapRect=getTotalBBox(); - QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+1); - QPainter pp (&pix); - - pp.setRenderHints(mapEditor->renderHints()); - - // Don't print the visualisation of selection - unselect(); - - mapScene->render ( &pp, - QRectF(0,0,mapRect.width()+2,mapRect.height()+2), - QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() )); - - // Restore selection - reselect(); - - return pix; -} - void VymModel::setMapLinkStyle (const QString & s) { @@ -4483,8 +4473,16 @@ } } - - +/* FIXME-3 +QDBusVariant VymModel::query (const QString &query) +{ + TreeItem *selti=getSelectedItem(); + if (selti) + return QDBusVariant (selti->getHeading()); + else + return QDBusVariant ("Nothing selected."); +} +*/ void VymModel::selectMapSelectionColor() { @@ -4559,17 +4557,6 @@ // FIXME-3 needed? scene()->update(); } - -QRectF VymModel::getTotalBBox() //FIXME-2 -{ - QRectF r; -/* - for (int i=0;ibranchCount(); i++) - r=addBBox (rootItem->getBranchNum(i)->getTotalBBox(), r); -*/ - return r; -} - ////////////////////////////////////////////// // Selection related ////////////////////////////////////////////// diff -r 85dec6a8c12c -r 9db215a4ad53 vymmodel.h --- a/vymmodel.h Mon Jul 27 12:53:17 2009 +0000 +++ b/vymmodel.h Mon Jul 27 12:53:17 2009 +0000 @@ -3,8 +3,11 @@ #include #include -#include +#include +#include + +#include "adaptormodel.h" #include "file.h" #include "imageitem.h" #include "mapeditor.h" @@ -15,14 +18,15 @@ class BranchItem; class MapEditor; -class VymModel : public TreeModel { +class VymModel : public TreeModel { Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.insilmaril.vym.VymModel-h") + //////////////////////////////////////////// // General housekeeping //////////////////////////////////////////// private: - QGraphicsScene *mapScene; QString version; //!< version string saved in vym file QString author; QString comment; @@ -215,6 +219,8 @@ //////////////////////////////////////////// // unsorted so far //////////////////////////////////////////// +private: + QGraphicsScene *mapScene; public: void setScene(QGraphicsScene *s); QGraphicsScene *getScene(); @@ -236,13 +242,13 @@ int branchCount(); public: - void setHeading(const QString &); //!< Set heading of branch -// QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch + void setHeading(const QString &); //!< Set heading of item + QString getHeading (); //!< Get heading of item private: - BranchItem* findCurrent; // next object in find process - BranchItem* findPrevious; // next object in find process - bool EOFind; // true, if search failed + BranchItem* findCurrent; // next object in find process + BranchItem* findPrevious; // next object in find process + bool EOFind; // true, if search failed public: BranchItem* findText(QString,bool); // Find object void findReset(); // Reset Search @@ -272,17 +278,17 @@ private: void pasteNoSave(const int &n); //!< paste clipboard to branch public: - void paste(); //!< Paste clipboard to branch and backup - void cut(); //!< Cut to clipboard (and copy) + void paste(); //!< Paste clipboard to branch and backup + void cut(); //!< Cut to clipboard (and copy) - void moveUp(); //!< Move branch up - void moveDown(); //!< Move branch down + void moveUp(); //!< Move branch up + void moveDown(); //!< Move branch down void sortChildren(); //!< Sort children lexically // The create methods are used to quickly parse a XML file BranchItem* createMapCenter(); //!< Create MapCenter BranchItem* createBranch(BranchItem *dst); //!< Create Branch - ImageItem* createImage(BranchItem *dst); //!< Create image + ImageItem* createImage(BranchItem *dst); //!< Create image /*! \brief Add new mapcenter @@ -421,7 +427,6 @@ void updateNoteFlag(); //!< Signal origination in TextEditor void updateRelPositions(); - QRectF getTotalBBox(); void reposition(); //!< Call reposition for all MCOs void setHideTmpMode (TreeItem::HideTmpMode mode); @@ -444,9 +449,6 @@ LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color LinkableMapObj::Style linkstyle; // default style for links -private: - QPixmap getPixmap(); - public: void setMapLinkStyle (const QString &); // Set style of link LinkableMapObj::Style getMapLinkStyle (); // requested in LMO @@ -531,9 +533,12 @@ void readData(); void displayNetworkError (QAbstractSocket::SocketError); -private: - void displayClientError(QAbstractSocket::SocketError socketError); +//////////////////////////////////////////// +// DBUS related +//////////////////////////////////////////// +private: +AdaptorModel *adaptorModel; //FIXME-3 //////////////////////////////////////////// // Selection related