#include "SUPERVGUI_Main.h"
#include "SUPERVGUI_Library.h"
#include "SUPERVGUI.h"
-#include "QAD_Tools.h"
-#include "QAD_FileDlg.h"
+
+#include "CAM_Application.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_FileDlg.h"
+#include "SUIT_Session.h"
+#include "SUIT_Tools.h"
#include "SALOME_NamingService.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#include <qlabel.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qtextstream.h>
SUPERVGUI_Service::SUPERVGUI_Service(SALOME_NamingService* ns):
- QDialog(QAD_Application::getDesktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ QDialog(SUIT_Session::session()->activeApplication()->desktop(), 0, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
naming(ns), myMFile(0)
{
setSizeGripEnabled( true );
return;
}
- QAD_ResourceMgr* aResMgr = QAD_Desktop::createResourceManager();
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
SALOME_ModuleCatalog::ListOfComponents_var lComponents = (*aModuleCatalog)->GetComponentList();
long nbComp = lComponents->length();
myComponentItem->setSelectable(false);
QString aIconName = C->component_icone();
if (!aIconName.isEmpty()) {
- QString resDir = aResMgr->findFile(aIconName, C->componentname()) ;
- if (resDir) {
- resDir = QAD_Tools::addSlash(resDir);
- QPixmap aIcone(resDir + aIconName);
+ QString resFilePath = aResMgr->path(aResMgr->resSection(), C->componentname(), aIconName) ;
+ if ( resFilePath ) {
+ QPixmap aIcone(resFilePath);
QIconSet aIconSet(aIcone);
myComponentItem->setPixmap(0, aIconSet.pixmap(QIconSet::Small, QIconSet::Normal));
} else {
}
void SUPERVGUI_Service::addComputeNode() {
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
+ CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication());
+ if ( !anApp ) return;
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if (aMain==0) {
QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
} else if (!aMain->isEditable()) {
const char* service = item->text(0).latin1();
const char* interface = item->parent()->text(0).latin1();
const char* component = item->parent()->parent()->text(0).latin1();
- SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(aDesktop->getComponentName(component));
+ SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(anApp->moduleName(component));
if ( myComponent == NULL ) {
QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
}
}
void SUPERVGUI_Service::addFactoryNode() {
- QAD_Desktop* aDesktop = QAD_Application::getDesktop();
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUIT_Desktop* aDesktop = SUIT_Session::session()->activeApplication()->desktop();
+ CAM_Application* anApp = ( CAM_Application* )(SUIT_Session::session()->activeApplication());
+ if ( !anApp ) return;
+
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if (aMain==0) {
QMessageBox::warning(aDesktop, tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
} else if (!aMain->isEditable()) {
if (item->isSelected()) {
const char* service = item->text(0).latin1();
const char* interface = item->parent()->text(0).latin1();
- const char* component = aDesktop->getComponentName(item->parent()->parent()->text(0).latin1());
+ const char* component = anApp->moduleName(item->parent()->parent()->text(0).latin1());
SALOME_ModuleCatalog::Acomponent_ptr myComponent = (*aModuleCatalog)->GetComponent(component);
if (myComponent==NULL) {
QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CHOOSE_SERVICE"));
void SUPERVGUI_Service::addInlineNode() {
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if (aMain==0) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
}
else if (!aMain->isEditable()) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
}
else {
int aSel = myTypeCombo->currentItem();
}
void SUPERVGUI_Service::addMacroNode() {
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if (aMain==0) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NO_SUPERVISION_WINDOW"));
}
else if (!aMain->isEditable()) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
}
else {
if ( myMFile ) {
addNode( aNode, aDummyEndNode, myX, myY );
}
else {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NONODE_TOADD"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NONODE_TOADD"));
}
}
}
return;
}
- QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- "",
- "*.xml",
- tr("MSG_GRAPH_INSERT"),
- true);
+ QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(),
+ "",
+ "*.xml",
+ tr("MSG_GRAPH_INSERT"),
+ true);
if (aFileName.isEmpty()) return;
myMacroPane->clear();
myMFile = new QFile(aFileName);
if (!myMFile->open(IO_ReadOnly)) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"),
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"),
tr("MSG_CANT_LOADSCRIPT"));
delete myMFile; myMFile = 0;
return;
QTextStream* aStream = new QTextStream(myMFile);
if (aStream->atEnd()) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"),
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"),
tr("MSG_EMTY_FILE"));
delete aStream;
myMFile->close();
void SUPERVGUI_Service::showEvent(QShowEvent* theEvent) {
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if (aMain && (!aMain->isArrayShown())) {
aMain->getArrayView()->viewportToContents(0, 0, myX, myY);
//aMain->getGraph()->viewportToContents(0, 0, myX, myY);
* Load existing Python script
*/
void SUPERVGUI_PythonEditPane::loadFile() {
- QString aFileName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- "",
- "*.py",
- tr("TIT_LOADSCRIPT"),
- true);
+ QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(),
+ "",
+ "*.py",
+ tr("TIT_LOADSCRIPT"),
+ true);
if (aFileName.isEmpty()) return;
QFile aFile( aFileName );
if (!aFile.open(IO_ReadOnly)) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"),
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"),
tr("MSG_CANT_LOADSCRIPT"));
return;
}
QTextStream aFileReader(&aFile);
if ( aFileReader.atEnd() ) {
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_EMTY_FILE"));
+ QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_EMTY_FILE"));
aFile.close();
return;
}
* Edit Python dialog
*/
SUPERVGUI_EditPythonDlg::SUPERVGUI_EditPythonDlg( bool isLoop )
- :QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ :QDialog(SUIT_Session::session()->activeApplication()->desktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
setSizeGripEnabled( true );
setCaption(tr("TIT_FUNC_PYTHON"));
* PS theEndNode is passed only for Loop and Switch nodes (EndLoop and EndSwitch)
*/
void SUPERVGUI_Service::addNode( SUPERV::CNode_var theNode, SUPERV::INode_var theEndNode, int& theX, int& theY ) {
- SUPERVGUI_Main* aMain = Supervision.getMain();
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+
+ SUPERVGUI_Main* aMain = aSupMod->getMain();
if ( !CORBA::is_nil( theNode ) && aMain ) {