X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fgenericgui%2FGenericGui.cxx;h=5094c4b68c4be8443c7ca159953ae84eb93204dc;hb=b650689526ac3855bba42c076b9b0a9df289372f;hp=11f87b006f099f59331246ef9e847aa6a19ae124;hpb=38f45f6fcf8afb03fef53ba6fb0f2ebf3e0ef0bb;p=modules%2Fyacs.git diff --git a/src/genericgui/GenericGui.cxx b/src/genericgui/GenericGui.cxx index 11f87b006..5094c4b68 100644 --- a/src/genericgui/GenericGui.cxx +++ b/src/genericgui/GenericGui.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 CEA/DEN, EDF R&D +// Copyright (C) 2006-2014 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -240,8 +240,8 @@ void GenericGui::createActions() tr("Load Schema to run"), tr("Load a schema for run"), 0, _parent, false, this, SLOT(onLoadAndRunSchema())); - _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job for watch"), QIcon("icons:batch.png"), - tr("Choose Batch Job for watch"), tr("Choose Batch Job for watch"), + _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr("Choose Batch Job to watch"), QIcon("icons:batch.png"), + tr("Choose Batch Job to watch"), tr("Choose Batch Job to watch"), 0, _parent, false, this, SLOT(onChooseBatchJob())); _startResumeAct = _wrapper->createAction(getMenuId(), tr("Start or Resume Schema execution"), QIcon("icons:suspend_resume.png"), @@ -1213,6 +1213,7 @@ void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc) { DEBTRACE("GenericGui::setLoadedPresentation"); QtGuiContext::getQtCurrent()->setLoadingPresentation(true); + map nodesToMove; map presNodes = _loader->getPrsData(proc); if (!presNodes.empty()) { @@ -1230,11 +1231,38 @@ void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc) inode->setWidth(pres._width); inode->setHeight(pres._height); inode->setExpanded(pres._expanded); - inode->setExpandedPos(QPointF(pres._expx, pres._expy)); + QPointF anExpandedPos = QPointF(pres._expx, pres._expy); + if (anExpandedPos.isNull()) + anExpandedPos = inode->pos(); + inode->setExpandedPos(anExpandedPos); inode->setExpandedWH(pres._expWidth, pres._expHeight); inode->setShownState(shownState(pres._shownState)); + + // collect nodes to correct it's Y-position if this collides with parent's header + if (inode->getParent() ) { + qreal anX = inode->x(); + qreal anY = inode->y(); + if (inode->getShownState() == shrinkHidden) { + anX = inode->getExpandedX(); + anY = inode->getExpandedY(); + } + if (anY < inode->getParent()->getHeaderBottom()) + nodesToMove[inode] = QPointF(anX, inode->getParent()->getHeaderBottom()+1); + } } } + QtGuiContext::getQtCurrent()->setLoadingPresentation(false); + + //after loading of presentation: + + //move nodes because of progress bar, if any was added + map::iterator it = nodesToMove.begin(); + for (; it!= nodesToMove.end(); ++it) + { + (*it).first->setTopLeft((*it).second); + } + + //update links if (Scene::_autoComputeLinks) _guiEditor->rebuildLinks(); else @@ -1244,8 +1272,6 @@ void GenericGui::setLoadedPresentation(YACS::ENGINE::Proc* proc) SceneComposedNodeItem *proc = dynamic_cast(item); proc->updateLinks(); } - - QtGuiContext::getQtCurrent()->setLoadingPresentation(false); } // ----------------------------------------------------------------------------- @@ -1276,7 +1302,7 @@ void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeL { DEBTRACE(logger->getStr()); } - QString fn=QString::fromStdString(filename); + QString fn=QString::fromUtf8(filename.c_str()); if(edit) createContext(proc, fn, "", true); else @@ -1316,11 +1342,11 @@ void GenericGui::onImportSchema() if (!fi.exists() && fi.suffix() != "xml") fn += ".xml"; - DEBTRACE("file loaded : " <load(fn.toLatin1()); + proc = _loader->load(fn.toUtf8().constData()); } catch (...) { } @@ -1514,12 +1540,12 @@ void GenericGui::onExportSchema() } if (fn.isEmpty()) return; - DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString()); + DEBTRACE("GenericGui::onExportSchema: " << fn.toUtf8().constData()); //to be sure that all pending changes are effective _parent->setFocus(); QtGuiContext::getQtCurrent()->setFileName(fn); VisitorSaveGuiSchema aWriter(proc); - aWriter.openFileSchema( fn.toStdString() ); + aWriter.openFileSchema( fn.toUtf8().constData() ); aWriter.visitProc(); aWriter.closeFileSchema(); QtGuiContext::getQtCurrent()->setNotSaved(false); @@ -1540,10 +1566,10 @@ void GenericGui::onExportSchemaAs() QString fn = getSaveFileName(fo); if (fn.isEmpty()) return; - DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toStdString()); + DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toUtf8().constData()); QtGuiContext::getQtCurrent()->setFileName(fn); VisitorSaveGuiSchema aWriter(proc); - aWriter.openFileSchema(fn.toStdString()); + aWriter.openFileSchema(fn.toUtf8().constData()); aWriter.visitProc(); aWriter.closeFileSchema(); _isSaved = true;