Playing with dbus, fixed name of TW translation file
authorinsilmaril
Mon, 27 Jul 2009 12:53:17 +0000
changeset 7849db215a4ad53
parent 783 85dec6a8c12c
child 785 5987f9f15bac
Playing with dbus, fixed name of TW translation file
mapeditor.h
tex/vym.changelog
vym.pro
vymmodel.cpp
vymmodel.h
     1.1 --- a/mapeditor.h	Mon Jul 27 12:53:17 2009 +0000
     1.2 +++ b/mapeditor.h	Mon Jul 27 12:53:17 2009 +0000
     1.3 @@ -50,12 +50,14 @@
     1.4  
     1.5  public:
     1.6      void print();				//!< Print the map
     1.7 +	QRectF getTotalBBox();		//!< Bounding box of all items in map
     1.8 +	QPixmap getPixmap();		//!< Get a pixmap of the map
     1.9  	void setAntiAlias (bool);	//!< Set or unset antialiasing
    1.10  	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
    1.11  public:
    1.12  	TreeItem *findMapItem (QPointF p,TreeItem *exclude);	//! find item in map at position p. Ignore item exclude 
    1.13  
    1.14 -	AttributeTable* attributeTable();
    1.15 +	AttributeTable* attributeTable();	// FIXME-3
    1.16      void testFunction1();				// just testing new stuff
    1.17      void testFunction2();				// just testing new stuff
    1.18  
     2.1 --- a/tex/vym.changelog	Mon Jul 27 12:53:17 2009 +0000
     2.2 +++ b/tex/vym.changelog	Mon Jul 27 12:53:17 2009 +0000
     2.3 @@ -1,3 +1,10 @@
     2.4 +-------------------------------------------------------------------
     2.5 +Wed Jul 22 21:51:04 CEST 2009 - uwedr@suse.de
     2.6 +
     2.7 +- Bugfix: relinking a branch to a scrolled branch doesn't unscroll
     2.8 +          anymore
     2.9 +- Bugfix: Importing KDE bookmarks with empty folders doesn't
    2.10 +          scroll these folders anymore
    2.11  -------------------------------------------------------------------
    2.12  Thu Apr  2 11:56:17 CEST 2009 - uwedr@suse.de
    2.13  
     3.1 --- a/vym.pro	Mon Jul 27 12:53:17 2009 +0000
     3.2 +++ b/vym.pro	Mon Jul 27 12:53:17 2009 +0000
     3.3 @@ -32,7 +32,7 @@
     3.4  
     3.5  HEADERS	+= \
     3.6  	aboutdialog.h \
     3.7 -	adaptor.h \
     3.8 +	adaptormodel.h \
     3.9  	animpoint.h \
    3.10  	attribute.h \
    3.11  #	attributedelegate.h\
    3.12 @@ -93,7 +93,7 @@
    3.13  
    3.14  SOURCES	+= \
    3.15  	aboutdialog.cpp \
    3.16 -	adaptor.cpp \
    3.17 +	adaptormodel.cpp \
    3.18  	animpoint.cpp \
    3.19  	attribute.cpp \
    3.20  #	attributedelegate.cpp \
     4.1 --- a/vymmodel.cpp	Mon Jul 27 12:53:17 2009 +0000
     4.2 +++ b/vymmodel.cpp	Mon Jul 27 12:53:17 2009 +0000
     4.3 @@ -49,7 +49,7 @@
     4.4  
     4.5  int VymModel::mapNum=0;	// make instance
     4.6  
     4.7 -VymModel::VymModel() 
     4.8 +VymModel::VymModel()
     4.9  {
    4.10  //    cout << "Const VymModel\n";
    4.11  	init();
    4.12 @@ -151,11 +151,11 @@
    4.13  	//  addMapCenter();  FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene
    4.14  
    4.15  	//Initialize DBUS
    4.16 -	//new CarAdaptor(car);
    4.17 +	adaptorModel=new AdaptorModel(this);	// Created and not deleted as documented in Qt
    4.18 +	//adaptor->setModel (this);
    4.19      //connection.registerObject("/Car", car);
    4.20 -    dbusConnection.registerService("org.insilmaril.vym");
    4.21 -
    4.22 -
    4.23 +    dbusConnection.registerService("org.insilmaril.VymModel");
    4.24 +    dbusConnection.sessionBus().registerObject ("/Object1",this);
    4.25  }
    4.26  
    4.27  void VymModel::makeTmpDirectories()
    4.28 @@ -168,7 +168,7 @@
    4.29  }
    4.30  
    4.31  
    4.32 -MapEditor* VymModel::getMapEditor()	// FIXME-2 VM better return favourite editor here
    4.33 +MapEditor* VymModel::getMapEditor()	// FIXME-3 VM better return favourite editor here
    4.34  {
    4.35  	return mapEditor;
    4.36  }
    4.37 @@ -1503,6 +1503,15 @@
    4.38  	}
    4.39  }
    4.40  
    4.41 +QString VymModel::getHeading()
    4.42 +{
    4.43 +	TreeItem *selti=getSelectedItem();
    4.44 +	if (selti)
    4.45 +		return selti->getHeading();
    4.46 +	else	
    4.47 +		return QString();
    4.48 +}
    4.49 +
    4.50  BranchItem* VymModel::findText (QString s, bool cs)   
    4.51  {
    4.52  	QTextDocument::FindFlags flags=0;
    4.53 @@ -3717,6 +3726,7 @@
    4.54  
    4.55  void VymModel::exportImage(QString fname, bool askName, QString format)
    4.56  {
    4.57 +/* FIXME-2 export as image, but directly from mapEditor?!
    4.58  	if (fname=="")
    4.59  	{
    4.60  		fname=getMapName()+".png";
    4.61 @@ -3740,9 +3750,10 @@
    4.62  	}
    4.63  
    4.64  	setExportMode (true);
    4.65 -	QPixmap pix (getPixmap());
    4.66 +	QPixmap pix (mapEditor->getPixmap());
    4.67  	pix.save(fname, format);
    4.68  	setExportMode (false);
    4.69 +*/	
    4.70  }
    4.71  
    4.72  
    4.73 @@ -3761,8 +3772,8 @@
    4.74  	// Create subdirectories
    4.75  	makeSubDirs (dir);
    4.76  
    4.77 -	// write to directory
    4.78 -	QString saveFile=saveToDir (dir,mapName+"-",true,getTotalBBox().topLeft() ,NULL);
    4.79 +	// write to directory	//FIXME-4 check totalBBox here...
    4.80 +	QString saveFile=saveToDir (dir,mapName+"-",true,mapEditor->getTotalBBox().topLeft() ,NULL); 
    4.81  	QFile file;
    4.82  
    4.83  	file.setName ( dir + "/"+mapName+".xml");
    4.84 @@ -4008,27 +4019,6 @@
    4.85  }
    4.86  */
    4.87  
    4.88 -QPixmap VymModel::getPixmap()
    4.89 -{
    4.90 -	QRectF mapRect=getTotalBBox();
    4.91 -	QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+1);
    4.92 -	QPainter pp (&pix);
    4.93 -	
    4.94 -	pp.setRenderHints(mapEditor->renderHints());
    4.95 -
    4.96 -	// Don't print the visualisation of selection
    4.97 -	unselect();
    4.98 -
    4.99 -	mapScene->render (	&pp, 
   4.100 -		QRectF(0,0,mapRect.width()+2,mapRect.height()+2),
   4.101 -		QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() ));
   4.102 -
   4.103 -	// Restore selection
   4.104 -	reselect();
   4.105 -	
   4.106 -	return pix;
   4.107 -}
   4.108 -
   4.109  
   4.110  void VymModel::setMapLinkStyle (const QString & s)
   4.111  {
   4.112 @@ -4483,8 +4473,16 @@
   4.113      }
   4.114  }
   4.115  
   4.116 -
   4.117 -
   4.118 +/* FIXME-3
   4.119 +QDBusVariant VymModel::query (const QString &query)
   4.120 +{
   4.121 +	TreeItem *selti=getSelectedItem();
   4.122 +	if (selti)
   4.123 +		return QDBusVariant (selti->getHeading());
   4.124 +	else
   4.125 +		return QDBusVariant ("Nothing selected.");
   4.126 +}
   4.127 +*/
   4.128  
   4.129  void VymModel::selectMapSelectionColor()
   4.130  {
   4.131 @@ -4559,17 +4557,6 @@
   4.132  	// FIXME-3 needed? scene()->update();
   4.133  }
   4.134  
   4.135 -
   4.136 -QRectF VymModel::getTotalBBox()	//FIXME-2
   4.137 -{
   4.138 -	QRectF r;
   4.139 -/*
   4.140 -	for (int i=0;i<rootItem->branchCount(); i++)
   4.141 -		r=addBBox (rootItem->getBranchNum(i)->getTotalBBox(), r);
   4.142 -*/ 
   4.143 -	return r;	
   4.144 -}
   4.145 -
   4.146  //////////////////////////////////////////////
   4.147  // Selection related
   4.148  //////////////////////////////////////////////
     5.1 --- a/vymmodel.h	Mon Jul 27 12:53:17 2009 +0000
     5.2 +++ b/vymmodel.h	Mon Jul 27 12:53:17 2009 +0000
     5.3 @@ -3,8 +3,11 @@
     5.4  
     5.5  #include <QGraphicsScene>
     5.6  #include <QtNetwork>
     5.7 -#include <QtDBus/QDBusConnection>
     5.8  
     5.9 +#include <QtDBus/QDBusAbstractAdaptor>
    5.10 +#include <QtDBus/QDBusVariant>
    5.11 +
    5.12 +#include "adaptormodel.h"
    5.13  #include "file.h"
    5.14  #include "imageitem.h"
    5.15  #include "mapeditor.h"
    5.16 @@ -15,14 +18,15 @@
    5.17  class BranchItem;
    5.18  class MapEditor;
    5.19  
    5.20 -class VymModel : public TreeModel {		
    5.21 +class VymModel :  public TreeModel {		
    5.22  	Q_OBJECT
    5.23 +	Q_CLASSINFO("D-Bus Interface", "org.insilmaril.vym.VymModel-h")
    5.24 +
    5.25  
    5.26  ////////////////////////////////////////////
    5.27  // General housekeeping
    5.28  ////////////////////////////////////////////
    5.29  private:
    5.30 -	QGraphicsScene *mapScene;
    5.31  	QString version;	//!< version string saved in vym file
    5.32  	QString author;
    5.33  	QString comment;
    5.34 @@ -215,6 +219,8 @@
    5.35  ////////////////////////////////////////////
    5.36  // unsorted so far
    5.37  ////////////////////////////////////////////
    5.38 +private:
    5.39 +	QGraphicsScene *mapScene;
    5.40  public:
    5.41  	void setScene(QGraphicsScene *s);
    5.42  	QGraphicsScene *getScene();
    5.43 @@ -236,13 +242,13 @@
    5.44  	int branchCount();
    5.45  
    5.46  public:	
    5.47 -	void setHeading(const QString &);		//!< Set heading of branch	
    5.48 -//	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
    5.49 +	void setHeading(const QString &);		//!< Set heading of item	
    5.50 +	QString getHeading ();					//!< Get heading of item
    5.51  
    5.52  private:
    5.53 -	BranchItem* findCurrent;		// next object in find process
    5.54 -	BranchItem* findPrevious;		// next object in find process
    5.55 -	bool EOFind;				// true, if search failed
    5.56 +	BranchItem* findCurrent;				// next object in find process
    5.57 +	BranchItem* findPrevious;				// next object in find process
    5.58 +	bool EOFind;							// true, if search failed
    5.59  public:
    5.60      BranchItem* findText(QString,bool);		// Find object
    5.61      void findReset();						// Reset Search
    5.62 @@ -272,17 +278,17 @@
    5.63  private:	
    5.64      void pasteNoSave(const int &n);		//!< paste clipboard to branch
    5.65  public:	
    5.66 -    void paste();		//!< Paste clipboard to branch and backup
    5.67 -    void cut();			//!< Cut to clipboard (and copy)
    5.68 +    void paste();			//!< Paste clipboard to branch and backup
    5.69 +    void cut();				//!< Cut to clipboard (and copy)
    5.70  
    5.71 -    void moveUp();	//!< Move branch up
    5.72 -    void moveDown();	//!< Move branch down
    5.73 +    void moveUp();			//!< Move branch up
    5.74 +    void moveDown();		//!< Move branch down
    5.75  	void sortChildren();	//!< Sort children lexically
    5.76  
    5.77  	// The create methods are used to quickly parse a XML file
    5.78  	BranchItem* createMapCenter();				//!< Create MapCenter 
    5.79  	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
    5.80 -	ImageItem* createImage(BranchItem *dst);		//!< Create image
    5.81 +	ImageItem* createImage(BranchItem *dst);	//!< Create image
    5.82  
    5.83  	/*! \brief Add new mapcenter
    5.84  
    5.85 @@ -421,7 +427,6 @@
    5.86  	void updateNoteFlag();				//!< Signal origination in TextEditor
    5.87      void updateRelPositions();
    5.88  
    5.89 -	QRectF getTotalBBox();
    5.90  	void reposition();					//!< Call reposition for all MCOs
    5.91  	void setHideTmpMode (TreeItem::HideTmpMode mode);	
    5.92  
    5.93 @@ -444,9 +449,6 @@
    5.94  	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
    5.95  	LinkableMapObj::Style linkstyle;		// default style for links
    5.96  
    5.97 -private:
    5.98 -    QPixmap getPixmap();
    5.99 -
   5.100  public:
   5.101  	void setMapLinkStyle (const QString &);	// Set style of link
   5.102  	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
   5.103 @@ -531,9 +533,12 @@
   5.104  	void readData();
   5.105  	void displayNetworkError (QAbstractSocket::SocketError);
   5.106  
   5.107 -private:	
   5.108 -	void displayClientError(QAbstractSocket::SocketError socketError);
   5.109 +////////////////////////////////////////////
   5.110 +// DBUS related 
   5.111 +////////////////////////////////////////////
   5.112  
   5.113 +private:
   5.114 +AdaptorModel *adaptorModel; //FIXME-3
   5.115  
   5.116  ////////////////////////////////////////////
   5.117  // Selection related