[qet] [4389] Remove Two methods of ElementsLocation |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4389
Author: blacksun
Date: 2016-03-20 16:54:28 +0100 (Sun, 20 Mar 2016)
Log Message:
-----------
Remove Two methods of ElementsLocation
Modified Paths:
--------------
trunk/sources/ElementsCollection/elementslocation.cpp
trunk/sources/ElementsCollection/elementslocation.h
trunk/sources/diagramevent/diagrameventaddelement.cpp
trunk/sources/diagramview.cpp
trunk/sources/elementspanel.cpp
trunk/sources/qetproject.cpp
Modified: trunk/sources/ElementsCollection/elementslocation.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementslocation.cpp 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/ElementsCollection/elementslocation.cpp 2016-03-20 15:54:28 UTC (rev 4389)
@@ -372,42 +372,6 @@
}
/**
- Charge l'emplacemant a partir d'une chaine de caractere du type
- project42+embed://foo/bar/thing.elmt
- @param string Une chaine de caracteres representant l'emplacement
-*/
-void ElementsLocation::fromString(const QString &string) {
- QRegExp embedded("^project([0-9]+)\\+(embed:\\/\\/.*)$", Qt::CaseInsensitive);
- if (embedded.exactMatch(string)) {
- bool conv_ok = false;
- uint project_id = embedded.capturedTexts().at(1).toUInt(&conv_ok);
- if (conv_ok) {
- QETProject *the_project = QETApp::project(project_id);
- if (the_project) {
- m_collection_path = embedded.capturedTexts().at(2);
- m_project = the_project;
- return;
- }
- }
- }
-
- // fallback : le chemin devient la chaine complete et aucun projet n'est utilise
- m_collection_path = string;
- m_project = 0;
-}
-
-/**
- @param string Une chaine de caracteres representant l'emplacement
- @return un emplacemant a partir d'une chaine de caractere du type
- project42+embed://foo/bar/thing.elmt
-*/
-ElementsLocation ElementsLocation::locationFromString(const QString &string) {
- ElementsLocation location;
- location.fromString(string);
- return(location);
-}
-
-/**
* @brief ElementsLocation::isElement
* @return true if this location represent an element
*/
Modified: trunk/sources/ElementsCollection/elementslocation.h
===================================================================
--- trunk/sources/ElementsCollection/elementslocation.h 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/ElementsCollection/elementslocation.h 2016-03-20 15:54:28 UTC (rev 4389)
@@ -57,8 +57,6 @@
void setProject(QETProject *);
bool isNull() const;
QString toString() const;
- void fromString(const QString &);
- static ElementsLocation locationFromString(const QString &);
bool isElement() const;
bool isDirectory() const;
Modified: trunk/sources/diagramevent/diagrameventaddelement.cpp
===================================================================
--- trunk/sources/diagramevent/diagrameventaddelement.cpp 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/diagramevent/diagrameventaddelement.cpp 2016-03-20 15:54:28 UTC (rev 4389)
@@ -210,7 +210,7 @@
if (m_integrate_path.isEmpty())
element = ElementFactory::Instance() -> createElement(m_location, 0, &state);
else
- element = ElementFactory::Instance() -> createElement(ElementsLocation::locationFromString(m_integrate_path), 0, &state);
+ element = ElementFactory::Instance() -> createElement(ElementsLocation(m_integrate_path), 0, &state);
//Build failed
if (state)
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/diagramview.cpp 2016-03-20 15:54:28 UTC (rev 4389)
@@ -279,13 +279,14 @@
Handle the drop of an element.
@param e the QDropEvent describing the current drag'n drop
*/
-void DiagramView::handleElementDrop(QDropEvent *e) {
- // fetch the element location from the drop event
+void DiagramView::handleElementDrop(QDropEvent *e)
+{
+ //fetch the element location from the drop event
QString elmt_path = e -> mimeData() -> text();
- ElementsLocation location(ElementsLocation::locationFromString(elmt_path));
+ ElementsLocation location(elmt_path);
- // verifie qu'il existe un element correspondant a cet emplacement
+ // verifie qu'il existe un element correspondant a cet emplacement
ElementsCollectionItem *dropped_item = QETApp::collectionItem(location);
if (!dropped_item) return;
Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/elementspanel.cpp 2016-03-20 15:54:28 UTC (rev 4389)
@@ -152,7 +152,8 @@
/**
Gere le mouvement lors d'un drag'n drop
*/
-void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) {
+void ElementsPanel::dragMoveEvent(QDragMoveEvent *e)
+{
// scrolle lorsque le curseur est pres des bords
int limit = 40;
QScrollBar *scroll_bar = verticalScrollBar();
@@ -171,8 +172,8 @@
return;
}
- // recupere la source (categorie ou element) pour le deplacement / la copie
- ElementsLocation dropped_location = ElementsLocation::locationFromString(e -> mimeData() -> text());
+ // recupere la source (categorie ou element) pour le deplacement / la copie
+ ElementsLocation dropped_location = ElementsLocation(e -> mimeData() -> text());
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
if (!source_item) {
e -> ignore();
@@ -205,16 +206,17 @@
Gere le depot lors d'un drag'n drop
@param e QDropEvent decrivant le depot
*/
-void ElementsPanel::dropEvent(QDropEvent *e) {
- // recupere la categorie cible pour le deplacement / la copie
+void ElementsPanel::dropEvent(QDropEvent *e)
+{
+ // recupere la categorie cible pour le deplacement / la copie
ElementsCategory *target_category = categoryForPos(e -> pos());
if (!target_category) {
e -> ignore();
return;
}
- // recupere la source (categorie ou element) pour le deplacement / la copie
- ElementsLocation dropped_location = ElementsLocation::locationFromString(e -> mimeData() -> text());
+ // recupere la source (categorie ou element) pour le deplacement / la copie
+ ElementsLocation dropped_location = ElementsLocation(e -> mimeData() -> text());
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
if (!source_item) {
e -> ignore();
Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp 2016-03-19 14:18:00 UTC (rev 4388)
+++ trunk/sources/qetproject.cpp 2016-03-20 15:54:28 UTC (rev 4389)
@@ -716,7 +716,7 @@
ElementsCategory *integ_cat = integrationCategory();
// accede a l'element a integrer
- ElementsCollectionItem *integ_item = QETApp::collectionItem(ElementsLocation::locationFromString(elmt_path));
+ ElementsCollectionItem *integ_item = QETApp::collectionItem(ElementsLocation(elmt_path));
ElementDefinition *integ_elmt = integ_item ? integ_item -> toElement() : 0;
if (!integ_item || !integ_elmt)
{