mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02: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:
parent
4fe4509885
commit
10fcaa09d1
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user