[qet] [2694] folio report can only be linked to inverted folio report

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


Revision: 2694
Author:   blacksun
Date:     2014-01-01 20:21:10 +0100 (Wed, 01 Jan 2014)
Log Message:
-----------
folio report can only be linked to inverted folio report

Modified Paths:
--------------
    trunk/elements/renvoi/next_folio.elmt
    trunk/elements/renvoi/previous_folio.elmt
    trunk/sources/factory/elementfactory.cpp
    trunk/sources/qetgraphicsitem/conductor.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetgraphicsitem/reportelement.cpp
    trunk/sources/qetgraphicsitem/reportelement.h
    trunk/sources/ui/elementpropertieswidget.cpp
    trunk/sources/ui/folioreportproperties.cpp

Modified: trunk/elements/renvoi/next_folio.elmt
===================================================================
--- trunk/elements/renvoi/next_folio.elmt	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/elements/renvoi/next_folio.elmt	2014-01-01 19:21:10 UTC (rev 2694)
@@ -1,5 +1,5 @@
 <definition width="40" version="0.3" hotspot_x="18" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
-link_type="folio_report">
+link_type="next_report">
     <names>
         <name lang="ar">الصفحة التالية</name>
         <name lang="de">Nächste Seite</name>

Modified: trunk/elements/renvoi/previous_folio.elmt
===================================================================
--- trunk/elements/renvoi/previous_folio.elmt	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/elements/renvoi/previous_folio.elmt	2014-01-01 19:21:10 UTC (rev 2694)
@@ -1,5 +1,5 @@
 <definition width="70" version="0.3" hotspot_x="49" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
-link_type="folio_report">
+link_type="previous_report">
     <names>
         <name lang="ar">الصفحة السابقة</name>
         <name lang="de">Vorherige Seite</name>

Modified: trunk/sources/factory/elementfactory.cpp
===================================================================
--- trunk/sources/factory/elementfactory.cpp	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/factory/elementfactory.cpp	2014-01-01 19:21:10 UTC (rev 2694)
@@ -45,7 +45,7 @@
 
 	if (element_definition->xml().hasAttribute("link_type")) {
 		QString link_type = element_definition->xml().attribute("link_type");
-		if (link_type == "folio_report") return (new ReportElement(location, qgi, s, state));
+		if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
 	}
 	//default if nothing match for link_type
 	return (new SimpleElement(location, qgi, s, state));

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2014-01-01 19:21:10 UTC (rev 2694)
@@ -1382,7 +1382,7 @@
  */
 Terminal * Conductor::relatedPotentialTerminal (Terminal *t) {
 	//terminal must have a folio report parent.
-	if (t->parentElement()->linkType() & Element::Report) {
+	if (t->parentElement()->linkType() & Element::AllReport) {
 		QList <Element *> elmt_list = t->parentElement()->linkedElements();
 		if (!elmt_list.isEmpty()) {
 			return (elmt_list.first()->terminals().first());

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/qetgraphicsitem/element.h	2014-01-01 19:21:10 UTC (rev 2694)
@@ -46,12 +46,14 @@
 	// this enum is use to know the kind of element and
 	// to use flag for element provider class
 	enum {Simple = 1,
-		  Report = 2,
-		  Master = 4,
-		  SlaveNO = 8,
-		  SlaveNC = 16,
-		  AllSlave = 24,
-		  Bornier = 32};
+		  NextReport = 2,
+		  PreviousReport = 4,
+		  AllReport = 6,
+		  Master = 8,
+		  SlaveNO = 16,
+		  SlaveNC = 32,
+		  AllSlave = 48,
+		  Bornier = 64};
 	
 	protected:
 	QList <Element *> connected_elements;

Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp	2014-01-01 19:21:10 UTC (rev 2694)
@@ -20,10 +20,12 @@
 #include "diagramposition.h"
 #include "qetproject.h"
 
-ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
+ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, Diagram *s, int *state) :
 	CustomElement(location, qgi, s, state)
 {
 	texts().at(0)->setNoEditable();
+	link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
+	link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
 }
 
 ReportElement::~ReportElement() {
@@ -43,8 +45,8 @@
 		if (connected_elements.first() == elmt) i = false;
 	}
 
-	//ensure elmt is a report
-	if (elmt->linkType() == Report && i) {
+	//ensure elmt is a inverse report of this element
+	if ((elmt->linkType() == inverse_report) && i) {
 		unlinkAllElements();
 		connected_elements << elmt;
 		connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
@@ -81,7 +83,7 @@
  * @return the kind of link type
  */
 int ReportElement::linkType() const {
-	return Report;
+	return link_type_;
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/reportelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.h	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/qetgraphicsitem/reportelement.h	2014-01-01 19:21:10 UTC (rev 2694)
@@ -30,13 +30,15 @@
 	Q_OBJECT
 
 	public  :
-	explicit ReportElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+	explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
 	~ReportElement();
 	virtual void linkToElement(Element *);
 	virtual void unlinkAllElements();
 	virtual int linkType() const;
 
 	private:
+	int link_type_;
+	int inverse_report;
 
 	signals:
 

Modified: trunk/sources/ui/elementpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/elementpropertieswidget.cpp	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/ui/elementpropertieswidget.cpp	2014-01-01 19:21:10 UTC (rev 2694)
@@ -93,10 +93,14 @@
 	switch (element_ -> linkType()) {
 		case Element::Simple:
 			break;
-		case Element::Report:
+		case Element::NextReport:
 			frp_ = new FolioReportProperties(element_, this);
 			tab_ -> addTab(frp_, tr("Report de folio"));
 			break;
+		case Element::PreviousReport:
+			frp_ = new FolioReportProperties(element_, this);
+			tab_ -> addTab(frp_, tr("Report de folio"));
+			break;
 		case Element::Master:
 			break;
 		case Element::SlaveNC:

Modified: trunk/sources/ui/folioreportproperties.cpp
===================================================================
--- trunk/sources/ui/folioreportproperties.cpp	2014-01-01 16:39:01 UTC (rev 2693)
+++ trunk/sources/ui/folioreportproperties.cpp	2014-01-01 19:21:10 UTC (rev 2694)
@@ -36,8 +36,10 @@
  * @brief FolioReportProperties::BuildRadioList : build the radio list for each available folio report
  */
 void FolioReportProperties::BuildRadioList() {
+	//Research the invert report of @element_
+	int rep = element_->linkType() == Element::NextReport? Element::PreviousReport : Element::NextReport;
 	ElementProvider ep(element_->diagram()->project(), element_->diagram());
-	QList <Element *> elmt_list = ep.freeElement(Element::Report);
+	QList <Element *> elmt_list = ep.freeElement(rep);
 
 	foreach (Element *elmt, elmt_list) {
 		if (elmt != element_) {


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