← Back to team overview

yade-dev team mailing list archive

[svn] r1492 - in trunk: gui/qt3 pkg/lattice/PreProcessor

 

Author: cosurgi
Date: 2008-08-22 00:21:27 +0200 (Fri, 22 Aug 2008)
New Revision: 1492

Modified:
   trunk/gui/qt3/QtFileGenerator.cpp
   trunk/gui/qt3/SimulationController.cpp
   trunk/pkg/lattice/PreProcessor/LatticeExample.cpp
Log:
fix crashes of this->parentWidget()->parentWidget() in UI



Modified: trunk/gui/qt3/QtFileGenerator.cpp
===================================================================
--- trunk/gui/qt3/QtFileGenerator.cpp	2008-08-20 22:01:22 UTC (rev 1491)
+++ trunk/gui/qt3/QtFileGenerator.cpp	2008-08-21 22:21:27 UTC (rev 1492)
@@ -95,7 +95,13 @@
 	std::vector<string> filters;
 	filters.push_back("Yade Binary File (*.yade)");
 	filters.push_back("XML Yade File (*.xml)");
-	string fileName = FileDialog::getSaveFileName(".", filters , "Choose a file to save", this->parentWidget()->parentWidget(),selectedFilter );
+	string fileName = FileDialog::getSaveFileName(".", filters , "Choose a file to save", 
+		#ifdef USE_WORKSPACE
+			this->parentWidget()->parentWidget()
+		#else
+			NULL
+		#endif
+	,selectedFilter );
 
 	if (fileName.size()!=0 && selectedFilter == "XML Yade File (*.xml)" && fileName!="/" )
 	{
@@ -320,7 +326,13 @@
 	std::vector<string> filters;
 	filters.push_back("XML Yade File (*.xml)");
 	string title = "Save FileGenerator \"" + fg->getClassName() + "\" configuration";
-	string fileName = FileDialog::getSaveFileName(".", filters, title, this->parentWidget()->parentWidget(), selectedFilter );
+	string fileName = FileDialog::getSaveFileName(".", filters, title, 
+		#ifdef USE_WORKSPACE
+			this->parentWidget()->parentWidget()
+		#else
+			NULL
+		#endif
+	, selectedFilter );
 
 	if ( 	   fileName.size()!=0
 		&& (selectedFilter == "XML Yade File (*.xml)") 
@@ -337,7 +349,13 @@
 	}
 	else
 	{
-		shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new MessageDialog("Save failed - bad file extension.",this->parentWidget()->parentWidget()));
+		shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new MessageDialog("Save failed - bad file extension.",
+		#ifdef USE_WORKSPACE
+			this->parentWidget()->parentWidget()
+		#else
+			NULL
+		#endif
+		));
 		md->exec(); 
 	}
 }

Modified: trunk/gui/qt3/SimulationController.cpp
===================================================================
--- trunk/gui/qt3/SimulationController.cpp	2008-08-20 22:01:22 UTC (rev 1491)
+++ trunk/gui/qt3/SimulationController.cpp	2008-08-21 22:21:27 UTC (rev 1492)
@@ -200,7 +200,13 @@
 	}
 	else
 	{
-		shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new MessageDialog("Save aborted (check file extension).",this->parentWidget()->parentWidget()));
+		shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new MessageDialog("Save aborted (check file extension).",
+		#ifdef USE_WORKSPACE
+			this->parentWidget()->parentWidget()
+		#else
+			NULL
+		#endif
+		));
 		md->exec(); 
 	}
 }

Modified: trunk/pkg/lattice/PreProcessor/LatticeExample.cpp
===================================================================
--- trunk/pkg/lattice/PreProcessor/LatticeExample.cpp	2008-08-20 22:01:22 UTC (rev 1491)
+++ trunk/pkg/lattice/PreProcessor/LatticeExample.cpp	2008-08-21 22:21:27 UTC (rev 1492)
@@ -568,7 +568,7 @@
 			int del3_ind[4];
 			while(del3.GetIndexSet(del3_i++,del3_ind))
 			{
-				if(shouldTerminate()) return "";
+				if(shouldTerminate()) return false;
 				setProgress((float)del3_i/(float)del3.GetSimplexQuantity());
 				shared_ptr<Body> beam;
 
@@ -591,7 +591,8 @@
 #else
 	if(use_Delaunay) // create beams, Delaunay not avauilable
 	{
-		return "ERROR:\n\nYade was compiled without full installation of wildmagic-dev (Wm3 foundation library), can't use Delaunay. Please disable option use_Delaunay or compile yade with full wm3 library installed. Don't forget CPPPATH=/usr/include/wm3 scons parameter.";
+		message = "ERROR:\n\nYade was compiled without full installation of wildmagic-dev (Wm3 foundation library), can't use Delaunay. Please disable option use_Delaunay or compile yade with full wm3 library installed. Don't forget CPPPATH=/usr/include/wm3 scons parameter.";
+		return false;
 	}
 #endif
 	else
@@ -612,7 +613,7 @@
 		
 		for( ; bi2!=biEnd ; ++bi2 )
 		{
-			if(shouldTerminate()) return "";
+			if(shouldTerminate()) return false;
 
 			Body* bodyB = (*bi2).get(); // all other nodes
 			// warning - I'm assuming that there are ONLY Nodes in the rootBody
@@ -653,7 +654,7 @@
                 int node2Id=-1; Real len2=100000;
                 for(  ; bi!=biEnd ; ++bi )  // loop over all nodes, to find those closest to strainRecorder_node1 and strainRecorder_node2
                 {
-			if(shouldTerminate()) return "";
+			if(shouldTerminate()) return false;
 
                         Body* body = (*bi).get();
                         LatticeNodeParameters* node = YADE_CAST<LatticeNodeParameters*>(body->physicalParameters.get());
@@ -677,7 +678,7 @@
                 int node4Id=-1; Real len2=100000;
                 for(  ; bi!=biEnd ; ++bi )  // loop over all nodes, to find those closest to measurePoisson_node3 and measurePoisson_node4
                 {
-			if(shouldTerminate()) return "";
+			if(shouldTerminate()) return false;
 
                         Body* body = (*bi).get();
                         LatticeNodeParameters* node = YADE_CAST<LatticeNodeParameters*>(body->physicalParameters.get());
@@ -698,7 +699,7 @@
         biEnd = bc.end();
         for(  ; bi!=biEnd ; ++bi )  // loop over all newly created beams ...
         {
-		if(shouldTerminate()) return "";
+		if(shouldTerminate()) return false;
 
                 shared_ptr<Body> b = *bi;
                 rootBody->bodies->insert(b); // .. to insert them into rootBody
@@ -732,7 +733,7 @@
 		
 		for(  ; bi!=biEnd ; ++bi )  // loop over all beams
 		{
-			if(shouldTerminate()) return "";
+			if(shouldTerminate()) return false;
 
 			Body* body = (*bi).get();
 			if( ! ( body->getGroupMask() & beamGroupMask ) )
@@ -752,7 +753,7 @@
 		int current = 0;
 		for(  ; bi!=biEnd ; ++bi )  // loop over all beams
 		{
-			if(shouldTerminate()) return "";
+			if(shouldTerminate()) return false;
 
 			if( ++current % 100 == 0 )
 			{