Included french in vym.pro
authorinsilmaril
Mon, 07 Jan 2008 14:52:49 +0000
changeset 636f83abc1f75b4
parent 635 459f0a2d5485
child 637 0ff5fc89dc5c
Included french in vym.pro
aboutdialog.cpp
attribute.cpp
attribute.h
     1.1 --- a/aboutdialog.cpp	Mon Dec 17 15:40:14 2007 +0000
     1.2 +++ b/aboutdialog.cpp	Mon Jan 07 14:52:49 2008 +0000
     1.3 @@ -39,19 +39,44 @@
     1.4  				"<ul>"
     1.5  					"<li>Please ask general questions about vym  on "
     1.6  				"<a href=\"mailto:vym-forum@lists.sourceforge.net\">vym-forum</a></li>"
     1.7 -				"<li>Subscribe/Unsubscribe and archives can be found  <a href=\"https://sourceforge.net/mail/?group_id=127802\">here</a></li>"
     1.8 +				"<li>Subscribe/Unsubscribe and archives can be found  "
     1.9 +				"<a href=\"https://sourceforge.net/mail/?group_id=127802\">here</a></li>"
    1.10  				"</ul>"
    1.11  		"</ul>"		
    1.12  	"<li> Credits " 
    1.13  	"<ul>"
    1.14 -	"<li>Peter Adams for documentation proofreading and polishing</li>"
    1.15 -	"<li>Jakob Hilmer for image drag and drop in 1.8.1, &quot;About vym&quot; window patch </li>"
    1.16 -	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export and help with XML processing in general</li>"
    1.17 -	"<li>Debianization by Christoph Thielecke and Steffen Joeris</li>"
    1.18 -	"<li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a> for <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
    1.19 -	"<li>Olaf Hering for support with my Powerbook</li>"
    1.20 -	"<li>All the guys at Trolltech for their Qt toolkit</li>"
    1.21 -	"<li>All the guys at SuSE for their Linux and support, e.g. to get Linux running on PowerPC and also Macbooks</li>"
    1.22 +	"<li>Documentation"
    1.23 +	"  <ul>"
    1.24 +	"    <li>Peter Adams: documentation proofreading and polishing</li>"
    1.25 +	"  </ul>"
    1.26 +	"</li>"
    1.27 +	"<li>Translation"
    1.28 +	"  <ul>"
    1.29 +	"    <li>Spanish: <a href=\"http://ieee.udistrital.edu.co/aclibre\">"
    1.30 +	"                 ACLibre (Academia y Conocimiento Libre)</a> </li>"
    1.31 +	"    <li>French: Philippe Caillaud</li>"
    1.32 +	"  </ul>"
    1.33 +	"</li>"
    1.34 +	"<li> Patches"
    1.35 +	"  <ul>"
    1.36 +	"    <li>Konstantin Goudkov: sort branches</li>"
    1.37 +	"    <li>Jakob Hilmer: image drag and drop in 1.8.1, &quot;About vym&quot; window patch </li>"
    1.38 +	"    <li>Xavier Oswald, Christoph Thielecke and Steffen Joeris: Debian packaging</li>"
    1.39 +	"    <li>Andrew Ng, Juha Ruotsalainen and Thomas Kriener: Windows</li>"
    1.40 +	"    <li>Matt from <a href=\"http://www.satbp.com\">www.satbp.com</a>: "
    1.41 +	"        <a href=\"http://www.taskjuggler.org\">Taskjuggler</a> export</li>"
    1.42 +	"    <li>Thomas Schraitle for the stylesheet"  
    1.43 +	"        used for XHTML-export and help with XML processing in general</li>"
    1.44 +	"  </ul>"
    1.45 +	"</li>"
    1.46 +	"<li> General"
    1.47 +	"  <ul>"
    1.48 +	"    <li>Olaf Hering for support with my Powerbook</li>"
    1.49 +	"    <li>All the guys at Trolltech for their Qt toolkit</li>"
    1.50 +	"    <li>All the guys at SuSE for their Linux and support,"
    1.51 +	"        e.g. to get Linux running on PowerPC and also Macbooks</li>"
    1.52 +	"  </ul>"
    1.53 +	"</li>"
    1.54  	"</ul>"
    1.55  	"</li>");
    1.56      credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
     2.1 --- a/attribute.cpp	Mon Dec 17 15:40:14 2007 +0000
     2.2 +++ b/attribute.cpp	Mon Jan 07 14:52:49 2008 +0000
     2.3 @@ -1,34 +1,135 @@
     2.4 +#include <iostream>
     2.5 +
     2.6  #include "attribute.h"
     2.7  
     2.8 +using namespace std;
     2.9 +
    2.10 +extern bool debug;
    2.11 +
    2.12  Attribute::Attribute()
    2.13  {
    2.14 -	key="";
    2.15 -	value="";
    2.16 +	table=NULL;
    2.17 +	definition=NULL;
    2.18  }
    2.19  
    2.20 -void Attribute::setKey (const QString &k)
    2.21 +void Attribute::setKey (const QString &k, const AttributeType &t)
    2.22  {
    2.23 -	key=k;
    2.24 +	if (!table)
    2.25 +	{
    2.26 +		qWarning (QString("Attribute::setKey (%1)  No table defined!\n").arg(k).ascii());
    2.27 +		return;	
    2.28 +	}
    2.29 +	
    2.30 +	if (!definition)
    2.31 +	{
    2.32 +		definition=table->getDef(k);
    2.33 +		if (!definition)
    2.34 +		{
    2.35 +			table->addKey (k,t);
    2.36 +			return;	
    2.37 +		}
    2.38 +	}	
    2.39 +	qWarning (QString("Attribute::setKey (%1)  attribute already defined!\n").arg(k).ascii());
    2.40  }
    2.41  
    2.42  QString Attribute::getKey ()
    2.43  {
    2.44 -	return key;
    2.45 +	if (!table)
    2.46 +	{
    2.47 +		qWarning ("Attribute::getKey ()  No table defined!");
    2.48 +		return QString();	
    2.49 +	}
    2.50 +	if (!definition)
    2.51 +	{
    2.52 +		qWarning ("Attribute::getKey ()  No attribute defined!");
    2.53 +		return QString ();	
    2.54 +	}	
    2.55 +	return definition->getKey();
    2.56  }
    2.57  
    2.58  void Attribute::setValue(const QString &v)
    2.59  {
    2.60 -	value=v;
    2.61 +	if (!table)
    2.62 +	{
    2.63 +		qWarning (QString ("Attribute::setValue (%1)  No table defined!").arg(v));
    2.64 +		return;	
    2.65 +	}
    2.66 +	if (!definition)
    2.67 +	{
    2.68 +		qWarning (QString ("Attribute::setValue (%1)  No attribute defined!").arg(v));
    2.69 +		return;	
    2.70 +	}	
    2.71 +	definition->setValue (v);
    2.72  }
    2.73  
    2.74 -QString Attribute::getValue()
    2.75 +QVariant Attribute::getValue()
    2.76  {
    2.77 -	return value;
    2.78 +	if (!table)
    2.79 +	{
    2.80 +		qWarning ("Attribute::getValue  No table defined!");
    2.81 +		return QString();	
    2.82 +	}
    2.83 +	if (!definition)
    2.84 +	{
    2.85 +		qWarning ("Attribute::getValue  No attribute defined!");
    2.86 +		return QString();	
    2.87 +	}	
    2.88 +	QVariant v= definition->getValue();
    2.89 +	return v;
    2.90 +}
    2.91 +
    2.92 +void Attribute::setType (const AttributeType &t)
    2.93 +{
    2.94 +	if (!table)
    2.95 +	{
    2.96 +		qWarning ("Attribute::setType  No table defined!");
    2.97 +		return;
    2.98 +	}
    2.99 +	if (!definition)
   2.100 +	{
   2.101 +		qWarning ("Attribute::setType  No attribute defined!");
   2.102 +		return; 
   2.103 +	}	
   2.104 +	definition->setType (t);
   2.105 +}
   2.106 +
   2.107 +AttributeType Attribute::getType()
   2.108 +{
   2.109 +	if (!table)
   2.110 +	{
   2.111 +		qWarning ("Attribute::getType  No table defined!");
   2.112 +		return Undefined;	
   2.113 +	}
   2.114 +	if (!definition)
   2.115 +	{
   2.116 +		qWarning ("Attribute::getType  No attribute defined!");
   2.117 +		return Undefined;	
   2.118 +	}	
   2.119 +	return definition->getType();
   2.120 +}
   2.121 +
   2.122 +QString Attribute::getTypeString()
   2.123 +{
   2.124 +	if (!table)
   2.125 +	{
   2.126 +		qWarning ("Attribute::getTypeString  No table defined!");
   2.127 +		return "Undefined";	
   2.128 +	}
   2.129 +	if (!definition)
   2.130 +	{
   2.131 +		qWarning ("Attribute::getTypeString  No attribute defined!");
   2.132 +		return "Undefined";	
   2.133 +	}	
   2.134 +	return definition->getTypeString();
   2.135  }
   2.136  
   2.137  void Attribute::setTable (AttributeTable *at)
   2.138  {
   2.139 -	table=at;
   2.140 +	if (at)
   2.141 +		table=at;
   2.142 +	 else
   2.143 +		qWarning ("Attribute::setTable  table==NULL");
   2.144 +	
   2.145  }
   2.146  
   2.147  AttributeTable* Attribute::getTable()
   2.148 @@ -38,76 +139,142 @@
   2.149  
   2.150  QString Attribute::getDataXML()
   2.151  {
   2.152 -	return valueElement ("attribute",key,value);
   2.153 +	QString a=beginElement ("attribute");
   2.154 +	a+=attribut ("key",getKey());
   2.155 +	a+=attribut ("value",getValue().toString() );
   2.156 +	a+=attribut ("type",getTypeString () );
   2.157 +	return a;
   2.158  }
   2.159  
   2.160  
   2.161  ///////////////////////////////////////////////////////////////
   2.162 +AttributeDef::AttributeDef()
   2.163 +{
   2.164 +}
   2.165 +
   2.166 +AttributeDef::~AttributeDef()
   2.167 +{
   2.168 +}
   2.169 +
   2.170 +void AttributeDef::setType (const AttributeType &t)
   2.171 +{
   2.172 +	type=t;
   2.173 +}
   2.174 +
   2.175 +AttributeType AttributeDef::getType ()
   2.176 +{
   2.177 +	return type;
   2.178 +}
   2.179 +
   2.180 +QString AttributeDef::getTypeString ()
   2.181 +{
   2.182 +	if (type==StringList)
   2.183 +		return "StringList";
   2.184 +	else if (type==FreeString)
   2.185 +		return "FreeString";
   2.186 +	else if (type==UniqueString)
   2.187 +		return "UniqueString";
   2.188 +	return "Undefined";
   2.189 +}
   2.190 +
   2.191 +void AttributeDef::setKey (const QString &k)
   2.192 +{
   2.193 +	key=k;
   2.194 +}
   2.195 +
   2.196 +void AttributeDef::setValue (const QString &v)
   2.197 +{
   2.198 +}
   2.199 +
   2.200 +void AttributeDef::setValue (const QVariant &v)
   2.201 +{
   2.202 +	if (type==Undefined)
   2.203 +		qWarning ("AttributeDef::setValue  No type defined!");
   2.204 +	else if (type==StringList)
   2.205 +		value=v;
   2.206 +	else if (type==UniqueString)
   2.207 +		value=v;
   2.208 +	else
   2.209 +		qWarning ("AttributeDef::setValue Unknown type???");
   2.210 +		
   2.211 +}
   2.212 +
   2.213 +QVariant AttributeDef::getValue ()
   2.214 +{
   2.215 +	return QVariant ();
   2.216 +}
   2.217 +
   2.218 +QString AttributeDef::getKey ()
   2.219 +{
   2.220 +	return key;
   2.221 +}
   2.222 +
   2.223 +///////////////////////////////////////////////////////////////
   2.224  AttributeTable::AttributeTable()
   2.225  {
   2.226 -	clear();
   2.227  }
   2.228  
   2.229  AttributeTable::~AttributeTable()
   2.230  {
   2.231 +	clear();
   2.232  }
   2.233  
   2.234  void AttributeTable::clear ()
   2.235  {
   2.236 -	keys.clear();
   2.237 -	values.clear();
   2.238 +	attdefs.clear();
   2.239  }
   2.240  
   2.241 -void AttributeTable::addKey (const QString &k)
   2.242 +AttributeDef* AttributeTable::addKey (const QString &k, const AttributeType &t)
   2.243  {
   2.244 -	if (!keys.contains (k) )
   2.245 +	for (int i=0; i<attdefs.count();++i)
   2.246  	{
   2.247 -		keys.append (k);
   2.248 -		values.append (QStringList() );
   2.249 +		if (attdefs.at(i)->getKey()==k )
   2.250 +		{
   2.251 +			qWarning (QString ("AttributeTable::addKey (%1) already in table\n").arg(k).ascii());
   2.252 +			return NULL;
   2.253 +		}
   2.254  	}
   2.255 +	AttributeDef *ad=new AttributeDef;
   2.256 +	ad->setKey (k);
   2.257 +	ad->setType (t);
   2.258 +	attdefs.append (ad);
   2.259 +	return ad;
   2.260  }
   2.261  
   2.262  void AttributeTable::removeKey (const QString &k)
   2.263  {
   2.264 -	int i=keys.indexOf (k);
   2.265 -	if (i>=0)
   2.266 +	for (int i=0; i<attdefs.count();++i)
   2.267  	{
   2.268 -		keys.removeAt(i);
   2.269 -		values.removeAt(i);
   2.270 +		if (attdefs.at(i)->getKey()==k )
   2.271 +		{
   2.272 +			
   2.273 +			delete (attdefs.at(i));
   2.274 +			attdefs.removeAt (i);
   2.275 +			return ;
   2.276 +		}
   2.277  	}
   2.278 +	qWarning (QString ("AttributeTable::removeKey (%1) key not in table\n").arg(k).ascii());
   2.279 +}
   2.280 +
   2.281 +AttributeDef* AttributeTable::getDef(const QString &k)
   2.282 +{
   2.283 +	for (int i=0; i<attdefs.count();++i)
   2.284 +		if (attdefs.at(i)->getKey()==k ) return attdefs.at(i);
   2.285 +	qWarning (QString ("AttributeTable::getDef (%1) key not in table\n").arg(k).ascii());
   2.286 +	return NULL;	
   2.287  }
   2.288  
   2.289  int AttributeTable::countKeys()
   2.290  {
   2.291 -	return keys.count();
   2.292 -}
   2.293 -
   2.294 -void AttributeTable::addValue (const QString &k, const QString &v)
   2.295 -{
   2.296 -	int i=keys.indexOf (k);
   2.297 -	if (i<0)
   2.298 -	{
   2.299 -		keys.append (k);
   2.300 -		values.append (QStringList (v));
   2.301 -	} else
   2.302 -	{
   2.303 -		int j=values.at(i).indexOf(k);
   2.304 -		if (j<0) values[i].append (QString(v));
   2.305 -	}
   2.306 +	return attdefs.count();
   2.307  }
   2.308  
   2.309  QStringList AttributeTable::getKeys ()
   2.310  {
   2.311 -	return keys;
   2.312 -}
   2.313 -
   2.314 -QStringList AttributeTable::getValues(const QString &k)
   2.315 -{
   2.316 -	int i=keys.indexOf (k);
   2.317 -	if (i>=0)
   2.318 -		return values.at(i);
   2.319 -	else
   2.320 -		return QStringList();
   2.321 +	QStringList kl;
   2.322 +	for (int i=0; i<attdefs.count();i++)
   2.323 +		kl.append (attdefs.at(i)->getKey());
   2.324 +	return kl;
   2.325  }
   2.326  
   2.327  QString AttributeTable::getDataXML()
     3.1 --- a/attribute.h	Mon Dec 17 15:40:14 2007 +0000
     3.2 +++ b/attribute.h	Mon Jan 07 14:52:49 2008 +0000
     3.3 @@ -2,50 +2,85 @@
     3.4  #define ATTRIBUTE_H
     3.5  
     3.6  #include <QStringList>
     3.7 +#include <QVariant>
     3.8  
     3.9  #include "xmlobj.h"
    3.10  
    3.11  class AttributeTable;
    3.12 +class AttributeDef;
    3.13  
    3.14 -/*! \brief A key and a value
    3.15 +enum AttributeType {
    3.16 +	Undefined,	//!< Undefined type
    3.17 +	StringList, //!< List of strings, one can be attribute value
    3.18 +	FreeString,	//!< Any string can be attribute value, not unique
    3.19 +	UniqueString//!< UniqueString, e.g. for IDs
    3.20 +};
    3.21 +
    3.22 +/*! \brief A key and a value 
    3.23 +    The data itself is stored in Attribute Definitions (AttributeDef). A list of these tables
    3.24 +	AttributeTable is maintained for every MapEditor.
    3.25  */
    3.26 -
    3.27  class Attribute:public XMLObj {
    3.28  public:
    3.29  	Attribute();
    3.30 -	void setKey (const QString &k);
    3.31 +	void setKey (const QString &k, const AttributeType &t);
    3.32  	QString getKey ();
    3.33  	void setValue (const QString &v);
    3.34 -	QString getValue();
    3.35 +	QVariant getValue ();
    3.36 +	void setType (const AttributeType &t);
    3.37 +	AttributeType getType ();
    3.38 +	QString getTypeString ();
    3.39  	void setTable (AttributeTable *at);
    3.40  	AttributeTable* getTable();
    3.41  	QString getDataXML();
    3.42  protected:
    3.43 +	AttributeTable *table;
    3.44 +	AttributeDef *definition;
    3.45 +	QString freeString;		//!< String value for type FreeString
    3.46 +};
    3.47 +
    3.48 +
    3.49 +/*! \brief 
    3.50 +	Attribute definition, defines possible values and type of attribute.
    3.51 +*/
    3.52 +class AttributeDef {
    3.53 +public:
    3.54 +	AttributeDef();
    3.55 +	~AttributeDef();
    3.56 +	void setType (const AttributeType &t);
    3.57 +	AttributeType getType();
    3.58 +	QString getTypeString ();
    3.59 +	void setKey (const QString &k);
    3.60 +	QString getKey ();
    3.61 +	void setValue (const QString &v);
    3.62 +	void setValue (const QVariant &v);
    3.63 +	QVariant getValue ();
    3.64 +private:
    3.65  	QString key;
    3.66 -	QString value;
    3.67 -	AttributeTable *table;
    3.68 +	AttributeType type;
    3.69 +
    3.70 +	QVariant value;				//!< value (except FreeString, FreeInt ...
    3.71  };
    3.72  
    3.73  /*! \brief A table containing a list of keys and each of these keys has
    3.74     a list of default values. The keys and the values for each key are
    3.75     unique.
    3.76  */
    3.77 +
    3.78  class AttributeTable:public XMLObj{
    3.79  public:
    3.80  	AttributeTable();
    3.81  	~AttributeTable();
    3.82  	void clear();
    3.83 -	void addKey (const QString &k);		//!< Adds a key to the table
    3.84 +	AttributeDef* addKey (const QString &k, const AttributeType &t);	//!< Adds a key to the table
    3.85  	void removeKey (const QString &k);	//!< Removes key and its default values
    3.86 +	AttributeDef* getDef(const QString &k);	//!< Get defintion of attribute
    3.87  	int countKeys();					//!< Return number of keys
    3.88 -	void addValue (const QString &k, const QString &v);	//!< Adds key and value
    3.89  	QStringList getKeys ();
    3.90 -	QStringList getValues(const QString &k);
    3.91  	QString getDataXML();
    3.92  
    3.93  protected:
    3.94 -	QStringList keys;
    3.95 -	QList <QStringList> values;
    3.96 +	QList <AttributeDef*> attdefs;
    3.97  };
    3.98  
    3.99