[qet] [1491] Elements collection now have a title and an icon.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1491
Author:   xavier
Date:     2012-02-06 23:13:39 +0100 (Mon, 06 Feb 2012)
Log Message:
-----------
Elements collection now have a title and an icon.

Modified Paths:
--------------
    branches/0.3/sources/elementscollection.cpp
    branches/0.3/sources/elementscollection.h
    branches/0.3/sources/qetapp.cpp
    branches/0.3/sources/qetproject.cpp

Modified: branches/0.3/sources/elementscollection.cpp
===================================================================
--- branches/0.3/sources/elementscollection.cpp	2012-02-06 21:21:43 UTC (rev 1490)
+++ branches/0.3/sources/elementscollection.cpp	2012-02-06 22:13:39 UTC (rev 1491)
@@ -37,6 +37,38 @@
 }
 
 /**
+	@return the title for this collection
+*/
+QString ElementsCollection::title() const {
+	return(title_);
+}
+
+/**
+	@param title New title for this collection
+*/
+void ElementsCollection::setTitle(const QString &title) {
+	if (title_ == title) return;
+	title_ = title;
+	emit(elementsCollectionChanged(this));
+}
+
+/**
+	@return the icon for this collection
+*/
+QIcon ElementsCollection::icon() const {
+	return(icon_);
+}
+
+/**
+	@param icon the icon for this collection
+*/
+void ElementsCollection::setIcon(const QIcon &icon) {
+	if (icon_.cacheKey() == icon.cacheKey()) return;
+	icon_ = icon;
+	emit(elementsCollectionChanged(this));
+}
+
+/**
 	@return toujours true
 */
 bool ElementsCollection::isCollection() const {

Modified: branches/0.3/sources/elementscollection.h
===================================================================
--- branches/0.3/sources/elementscollection.h	2012-02-06 21:21:43 UTC (rev 1490)
+++ branches/0.3/sources/elementscollection.h	2012-02-06 22:13:39 UTC (rev 1491)
@@ -18,6 +18,7 @@
 #ifndef ELEMENTS_COLLECTION_H
 #define ELEMENTS_COLLECTION_H
 #include <QtCore>
+#include <QIcon>
 #include "elementscollectionitem.h"
 class QETProject;
 class ElementsCategory;
@@ -41,6 +42,10 @@
 	
 	// Implementations de methodes virtuelles pures des classes parentes
 	public:
+	virtual QString title() const;
+	virtual void setTitle(const QString &);
+	virtual QIcon icon() const;
+	virtual void setIcon(const QIcon &);
 	virtual bool isCollection() const;
 	virtual bool isRootCategory() const;
 	virtual bool isCategory()  const;
@@ -87,8 +92,15 @@
 	virtual ElementsCollectionCache *cache() const;
 	virtual void setCache(ElementsCollectionCache *);
 	
+	signals:
+	void elementsCollectionChanged(ElementsCollection *);
+	
 	// attributs
 	protected:
+	/// Title to be used when referring to this collection
+	QString title_;
+	/// Icon to be displayed when representing this collection
+	QIcon icon_;
 	/// Protocole utilise pour acceder a cette collection
 	QString protocol_;
 	/// Projet auquel appartient cette collection

Modified: branches/0.3/sources/qetapp.cpp
===================================================================
--- branches/0.3/sources/qetapp.cpp	2012-02-06 21:21:43 UTC (rev 1490)
+++ branches/0.3/sources/qetapp.cpp	2012-02-06 22:13:39 UTC (rev 1491)
@@ -256,6 +256,8 @@
 ElementsCollection *QETApp::commonElementsCollection() {
 	if (!common_collection) {
 		common_collection = new FileElementsCollection(QETApp::commonElementsDir());
+		common_collection -> setTitle(tr("Collection QET"));
+		common_collection -> setIcon(QIcon(":/ico/16x16/qet.png"));
 		common_collection -> setProtocol("common");
 		common_collection -> setCache(collections_cache_);
 	}
@@ -268,6 +270,8 @@
 ElementsCollection *QETApp::customElementsCollection() {
 	if (!custom_collection) {
 		custom_collection = new FileElementsCollection(QETApp::customElementsDir());
+		custom_collection -> setTitle(tr("Collection utilisateur"));
+		custom_collection -> setIcon(QIcon(":/ico/16x16/go-home.png"));
 		custom_collection -> setProtocol("custom");
 		custom_collection -> setCache(collections_cache_);
 	}

Modified: branches/0.3/sources/qetproject.cpp
===================================================================
--- branches/0.3/sources/qetproject.cpp	2012-02-06 21:21:43 UTC (rev 1490)
+++ branches/0.3/sources/qetproject.cpp	2012-02-06 22:13:39 UTC (rev 1491)
@@ -981,6 +981,7 @@
 		// sinon lit cette collection
 		collection_ = new XmlElementsCollection(collection_root);
 	}
+	collection_ -> setTitle(tr("Collection embarqu\351e"));
 	collection_ -> setProtocol("embed");
 	collection_ -> setProject(this);
 	connect(collection_, SIGNAL(written()), this, SLOT(componentWritten()));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/