mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Remove Two methods of ElementsLocation
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4389 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -371,42 +371,6 @@ QString ElementsLocation::toString() const {
|
|||||||
return(result);
|
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
|
* @brief ElementsLocation::isElement
|
||||||
* @return true if this location represent an element
|
* @return true if this location represent an element
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ class ElementsLocation
|
|||||||
void setProject(QETProject *);
|
void setProject(QETProject *);
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
void fromString(const QString &);
|
|
||||||
static ElementsLocation locationFromString(const QString &);
|
|
||||||
|
|
||||||
bool isElement() const;
|
bool isElement() const;
|
||||||
bool isDirectory() const;
|
bool isDirectory() const;
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void DiagramEventAddElement::addElement()
|
|||||||
if (m_integrate_path.isEmpty())
|
if (m_integrate_path.isEmpty())
|
||||||
element = ElementFactory::Instance() -> createElement(m_location, 0, &state);
|
element = ElementFactory::Instance() -> createElement(m_location, 0, &state);
|
||||||
else
|
else
|
||||||
element = ElementFactory::Instance() -> createElement(ElementsLocation::locationFromString(m_integrate_path), 0, &state);
|
element = ElementFactory::Instance() -> createElement(ElementsLocation(m_integrate_path), 0, &state);
|
||||||
|
|
||||||
//Build failed
|
//Build failed
|
||||||
if (state)
|
if (state)
|
||||||
|
|||||||
@@ -279,11 +279,12 @@ void DiagramView::dropEvent(QDropEvent *e) {
|
|||||||
Handle the drop of an element.
|
Handle the drop of an element.
|
||||||
@param e the QDropEvent describing the current drag'n drop
|
@param e the QDropEvent describing the current drag'n drop
|
||||||
*/
|
*/
|
||||||
void DiagramView::handleElementDrop(QDropEvent *e) {
|
void DiagramView::handleElementDrop(QDropEvent *e)
|
||||||
|
{
|
||||||
//fetch the element location from the drop event
|
//fetch the element location from the drop event
|
||||||
QString elmt_path = e -> mimeData() -> text();
|
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);
|
ElementsCollectionItem *dropped_item = QETApp::collectionItem(location);
|
||||||
|
|||||||
@@ -152,7 +152,8 @@ void ElementsPanel::dragEnterEvent(QDragEnterEvent *e) {
|
|||||||
/**
|
/**
|
||||||
Gere le mouvement lors d'un drag'n drop
|
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
|
// scrolle lorsque le curseur est pres des bords
|
||||||
int limit = 40;
|
int limit = 40;
|
||||||
QScrollBar *scroll_bar = verticalScrollBar();
|
QScrollBar *scroll_bar = verticalScrollBar();
|
||||||
@@ -172,7 +173,7 @@ void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recupere la source (categorie ou element) pour le deplacement / la copie
|
// recupere la source (categorie ou element) pour le deplacement / la copie
|
||||||
ElementsLocation dropped_location = ElementsLocation::locationFromString(e -> mimeData() -> text());
|
ElementsLocation dropped_location = ElementsLocation(e -> mimeData() -> text());
|
||||||
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
|
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
|
||||||
if (!source_item) {
|
if (!source_item) {
|
||||||
e -> ignore();
|
e -> ignore();
|
||||||
@@ -205,7 +206,8 @@ void ElementsPanel::dragMoveEvent(QDragMoveEvent *e) {
|
|||||||
Gere le depot lors d'un drag'n drop
|
Gere le depot lors d'un drag'n drop
|
||||||
@param e QDropEvent decrivant le depot
|
@param e QDropEvent decrivant le depot
|
||||||
*/
|
*/
|
||||||
void ElementsPanel::dropEvent(QDropEvent *e) {
|
void ElementsPanel::dropEvent(QDropEvent *e)
|
||||||
|
{
|
||||||
// recupere la categorie cible pour le deplacement / la copie
|
// recupere la categorie cible pour le deplacement / la copie
|
||||||
ElementsCategory *target_category = categoryForPos(e -> pos());
|
ElementsCategory *target_category = categoryForPos(e -> pos());
|
||||||
if (!target_category) {
|
if (!target_category) {
|
||||||
@@ -214,7 +216,7 @@ void ElementsPanel::dropEvent(QDropEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recupere la source (categorie ou element) pour le deplacement / la copie
|
// recupere la source (categorie ou element) pour le deplacement / la copie
|
||||||
ElementsLocation dropped_location = ElementsLocation::locationFromString(e -> mimeData() -> text());
|
ElementsLocation dropped_location = ElementsLocation(e -> mimeData() -> text());
|
||||||
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
|
ElementsCollectionItem *source_item = QETApp::collectionItem(dropped_location, false);
|
||||||
if (!source_item) {
|
if (!source_item) {
|
||||||
e -> ignore();
|
e -> ignore();
|
||||||
|
|||||||
@@ -716,7 +716,7 @@ QString QETProject::integrateElement(const QString &elmt_path, MoveElementsHandl
|
|||||||
ElementsCategory *integ_cat = integrationCategory();
|
ElementsCategory *integ_cat = integrationCategory();
|
||||||
|
|
||||||
// accede a l'element a integrer
|
// 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;
|
ElementDefinition *integ_elmt = integ_item ? integ_item -> toElement() : 0;
|
||||||
if (!integ_item || !integ_elmt)
|
if (!integ_item || !integ_elmt)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user