[qet] [1500] Elements panel: replaced embedded collections original titles with simpler ones. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1500
Author: xavier
Date: 2012-02-12 18:19:01 +0100 (Sun, 12 Feb 2012)
Log Message:
-----------
Elements panel: replaced embedded collections original titles with simpler ones.
Modified Paths:
--------------
branches/0.3/sources/elementspanel.cpp
branches/0.3/sources/qetproject.cpp
branches/0.3/sources/xmlelementscollection.cpp
branches/0.3/sources/xmlelementscollection.h
Modified: branches/0.3/sources/elementspanel.cpp
===================================================================
--- branches/0.3/sources/elementspanel.cpp 2012-02-12 17:17:44 UTC (rev 1499)
+++ branches/0.3/sources/elementspanel.cpp 2012-02-12 17:19:01 UTC (rev 1500)
@@ -400,12 +400,14 @@
if (TitleBlockTemplatesCollection *tbt_collection = project -> embeddedTitleBlockTemplatesCollection()) {
if (QTreeWidgetItem *tbt_collection_qtwi = itemForTemplatesCollection(tbt_collection)) {
+ tbt_collection_qtwi -> setText(0, tr("Cartouches embarqu\xE9s"));
if (first_add) tbt_collection_qtwi -> setExpanded(true);
}
}
if (ElementsCollection *elmt_collection = project -> embeddedCollection()) {
if (QTreeWidgetItem *elmt_collection_qtwi = itemForElementsCollection(elmt_collection)) {
+ elmt_collection_qtwi -> setText(0, tr("Collection embarqu\xE9e"));
if (first_add) elmt_collection_qtwi -> setExpanded(true);
}
}
Modified: branches/0.3/sources/qetproject.cpp
===================================================================
--- branches/0.3/sources/qetproject.cpp 2012-02-12 17:17:44 UTC (rev 1499)
+++ branches/0.3/sources/qetproject.cpp 2012-02-12 17:19:01 UTC (rev 1500)
@@ -981,7 +981,6 @@
// 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()));
Modified: branches/0.3/sources/xmlelementscollection.cpp
===================================================================
--- branches/0.3/sources/xmlelementscollection.cpp 2012-02-12 17:17:44 UTC (rev 1499)
+++ branches/0.3/sources/xmlelementscollection.cpp 2012-02-12 17:19:01 UTC (rev 1500)
@@ -18,6 +18,7 @@
#include "xmlelementscollection.h"
#include "xmlelementscategory.h"
#include "qetproject.h"
+#include "qetapp.h"
/**
Construit une collection vide
@@ -55,6 +56,35 @@
deleteContent();
}
+QString XmlElementsCollection::title() const {
+ if (!title_.isEmpty()) return(title_);
+
+ // if the title attribute is empty, we generate a suitable one using the
+ // parent project
+ QString final_title;
+ if (project_) {
+ QString project_title = project_ -> title();
+ if (project_title.isEmpty()) {
+ final_title = QString(
+ tr(
+ "Collection du projet sans titre (id %1)",
+ "Elements collection title when the parent project has an empty title -- %1 is the project internal id"
+ )
+ );
+ final_title = final_title.arg(QETApp::projectId(project_));
+ } else {
+ final_title = QString(
+ tr(
+ "Collection du projet \"%1\"",
+ "Elements collection title when the project has a suitable title -- %1 is the project title"
+ )
+ );
+ final_title = final_title.arg(project_title);
+ }
+ }
+ return(final_title);
+}
+
ElementsCategory *XmlElementsCollection::rootCategory() {
return(root);
}
Modified: branches/0.3/sources/xmlelementscollection.h
===================================================================
--- branches/0.3/sources/xmlelementscollection.h 2012-02-12 17:17:44 UTC (rev 1499)
+++ branches/0.3/sources/xmlelementscollection.h 2012-02-12 17:19:01 UTC (rev 1500)
@@ -38,6 +38,7 @@
// methodes
public:
+ virtual QString title() const;
virtual ElementsCategory *rootCategory();
virtual bool hasFilePath();
virtual QString filePath();