mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Elements collection now have a title and an icon.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1491 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -36,6 +36,38 @@ ElementsCollection::ElementsCollection(ElementsCollectionItem *parent) :
|
||||
ElementsCollection::~ElementsCollection() {
|
||||
}
|
||||
|
||||
/**
|
||||
@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
|
||||
*/
|
||||
|
||||
@@ -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 @@ class ElementsCollection : public ElementsCollectionItem {
|
||||
|
||||
// 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 @@ class ElementsCollection : public ElementsCollectionItem {
|
||||
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
|
||||
|
||||
@@ -256,6 +256,8 @@ void QETApp::newElementEditor() {
|
||||
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::commonElementsCollection() {
|
||||
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_);
|
||||
}
|
||||
|
||||
@@ -981,6 +981,7 @@ void QETProject::readElementsCollectionXml() {
|
||||
// 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()));
|
||||
|
||||
Reference in New Issue
Block a user