From 10fcaa09d12dc3d4b7ee4f6c50956f2ae289a127 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 20 Mar 2016 15:54:28 +0000 Subject: [PATCH] Remove Two methods of ElementsLocation git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4389 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- .../ElementsCollection/elementslocation.cpp | 36 ------------------- sources/ElementsCollection/elementslocation.h | 2 -- .../diagramevent/diagrameventaddelement.cpp | 2 +- sources/diagramview.cpp | 9 ++--- sources/elementspanel.cpp | 16 +++++---- sources/qetproject.cpp | 2 +- 6 files changed, 16 insertions(+), 51 deletions(-) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 06e9123ea..5451213ac 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -371,42 +371,6 @@ QString ElementsLocation::toString() const { return(result); } -/** - 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 diff --git a/sources/ElementsCollection/elementslocation.h b/sources/ElementsCollection/elementslocation.h index 6c606328c..68b4622c8 100644 --- a/sources/ElementsCollection/elementslocation.h +++ b/sources/ElementsCollection/elementslocation.h @@ -57,8 +57,6 @@ class ElementsLocation void setProject(QETProject *); bool isNull() const; QString toString() const; - void fromString(const QString &); - static ElementsLocation locationFromString(const QString &); bool isElement() const; bool isDirectory() const; diff --git a/sources/diagramevent/diagrameventaddelement.cpp b/sources/diagramevent/diagrameventaddelement.cpp index 12ab93fd5..e7c5707ac 100644 --- a/sources/diagramevent/diagrameventaddelement.cpp +++ b/sources/diagramevent/diagrameventaddelement.cpp @@ -210,7 +210,7 @@ void DiagramEventAddElement::addElement() 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) diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index b1502954f..d59674be5 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -279,13 +279,14 @@ void DiagramView::dropEvent(QDropEvent *e) { 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; diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index 53b7c9036..9d2620583 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -152,7 +152,8 @@ void ElementsPanel::dragEnterEvent(QDragEnterEvent *e) { /** 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 @@ void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) { 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 @@ void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) { 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(); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index c898319aa..5cbde89c3 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -716,7 +716,7 @@ QString QETProject::integrateElement(const QString &elmt_path, MoveElementsHandl 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) {