Changeset 9161d47 in OpenModelica
- Timestamp:
- 2006-05-15T16:06:49+02:00 (18 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 6aeb3843
- Parents:
- a46c6e4
- Location:
- OMNotebook/OMNotebookQT4
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
OMNotebook/OMNotebookQT4/cellcommands.cpp
r9c7355a9 r9161d47 59 59 //STD Headers 60 60 #include <exception> 61 #include <stdexcept> 61 62 62 63 //IAEX Headers … … 139 140 // 2006-01-30 AF, add exception 140 141 string str = string("AddCellCommand(), Exception: \n") + e.what(); 141 throw exception( str.c_str() );142 throw runtime_error( str.c_str() ); 142 143 } 143 144 } … … 195 196 // 2006-01-30 AF, add exception 196 197 string str = string("CreateNewCommand(), Exception: \n") + e.what(); 197 throw exception( str.c_str() );198 throw runtime_error( str.c_str() ); 198 199 } 199 200 } … … 283 284 // 2006-01-30 AF, add message box 284 285 string str = string("DeleteCurrentCellsCommand(), Exception: \n") + e.what(); 285 throw exception( str.c_str() );286 throw runtime_error( str.c_str() ); 286 287 } 287 288 } … … 329 330 // 2006-01-30 AF, add exception 330 331 string str = string("PasteCellsCommand(), Exception: \n") + e.what(); 331 throw exception( str.c_str() );332 throw runtime_error( str.c_str() ); 332 333 } 333 334 } … … 459 460 { 460 461 // ERROR 461 throw exception("Unknown cell");462 throw runtime_error("Unknown cell"); 462 463 } 463 464 } … … 507 508 // 2006-01-30 AF, add exception 508 509 string str = string("DeleteSelectedCellsCommand(), Exception: \n") + e.what(); 509 throw exception( str.c_str() );510 throw runtime_error( str.c_str() ); 510 511 } 511 512 } … … 557 558 // 2006-01-30 AF, add exception 558 559 string str = string("ChangeStyleOnSelectedCellsCommand(), Exception: \n") + e.what(); 559 throw exception( str.c_str() );560 throw runtime_error( str.c_str() ); 560 561 } 561 562 } … … 575 576 // 2006-01-30 AF, add exception 576 577 string str = string("ChangeStyleOnCurrentCellCommand(), Exception: \n") + e.what(); 577 throw exception( str.c_str() );578 throw runtime_error( str.c_str() ); 578 579 } 579 580 } … … 603 604 // 2006-01-30 AF, add exception 604 605 string str = string("MakeGroupCellCommand(), Exception: \n") + e.what(); 605 throw exception( str.c_str() );606 throw runtime_error( str.c_str() ); 606 607 607 608 } … … 633 634 { 634 635 if( !(*c_iter)->hasChilds() ) 635 throw exception( "No children" );636 throw runtime_error( "No children" ); 636 637 637 638 // get child … … 697 698 { 698 699 string str = string("UngroupCellCommand(), Exception: ") + e.what(); 699 throw exception( str.c_str() );700 throw runtime_error( str.c_str() ); 700 701 } 701 702 } … … 759 760 { 760 761 string str = string("SplitCellCommand(), Exception: ") + e.what(); 761 throw exception( str.c_str() );762 throw runtime_error( str.c_str() ); 762 763 } 763 764 } -
OMNotebook/OMNotebookQT4/cellfactory.cpp
r9c7355a9 r9161d47 113 113 text->setStyle( cstyle ); 114 114 else 115 throw exception("No Input style defened, the inputcell may not work correctly, please define a Input style in stylesheet.xml");115 throw runtime_error("No Input style defened, the inputcell may not work correctly, please define a Input style in stylesheet.xml"); 116 116 } 117 117 catch( exception e ) -
OMNotebook/OMNotebookQT4/cellparserfactory.cpp
r968d4b96 r9161d47 90 90 else 91 91 { 92 throw exception("Can only open files ending with .onb or .nb,\n(can open old OMNotebooks file that ends with .xml)");92 throw runtime_error("Can only open files ending with .onb or .nb,\n(can open old OMNotebooks file that ends with .xml)"); 93 93 } 94 94 } -
OMNotebook/OMNotebookQT4/commandcompletion.cpp
r4938bf2 r9161d47 57 57 //STD Headers 58 58 #include <exception> 59 #include <stdexcept> 59 60 #include <iostream> 60 61 #include <cstdlib> … … 105 106 { 106 107 string tmp = "Could not open file: " + filename.toStdString(); 107 throw exception( tmp.c_str() );108 throw runtime_error( tmp.c_str() ); 108 109 } 109 110 … … 114 115 filename.toStdString() + 115 116 " Probably some syntax error in the xml file"; 116 throw exception( tmp.c_str() );117 throw runtime_error( tmp.c_str() ); 117 118 } 118 119 file.close(); … … 388 389 { 389 390 if( !item ) 390 throw exception( "ParseCommand... No ITEM set" );391 throw runtime_error( "ParseCommand... No ITEM set" ); 391 392 392 393 while( !node.isNull() ) -
OMNotebook/OMNotebookQT4/cursorcommands.h
r4938bf2 r9161d47 108 108 // 2006-01-30 AF, add exception 109 109 string str = string("CursorMoveUpCommand(), Exception: ") + e.what(); 110 throw exception( str.c_str() );110 throw runtime_error( str.c_str() ); 111 111 } 112 112 } … … 162 162 // 2006-01-30 AF, add exception 163 163 string str = string("CursorMoveDownCommand(), Exception: ") + e.what(); 164 throw exception( str.c_str() );164 throw runtime_error( str.c_str() ); 165 165 } 166 166 } … … 217 217 // 2006-01-30 AF, add exception 218 218 string str = string("CursorMoveAfterCommand(), Exception: ") + e.what(); 219 throw exception( str.c_str() );219 throw runtime_error( str.c_str() ); 220 220 } 221 221 } -
OMNotebook/OMNotebookQT4/inputcell.cpp
ra46c6e4 r9161d47 1507 1507 { 1508 1508 if(!hasDelegate()) 1509 throw exception("No delegate.");1509 throw runtime_error("No delegate."); 1510 1510 1511 1511 return delegate_; -
OMNotebook/OMNotebookQT4/notebookcommands.h
r9c7355a9 r9161d47 183 183 { 184 184 string msg = "Could not save documet to file: " + filename_.toStdString(); 185 throw exception( msg.c_str() );185 throw runtime_error( msg.c_str() ); 186 186 } 187 187 } … … 190 190 // 2006-01-30 AF, add exception 191 191 string str = string("SaveDocumentCommand(), Exception: ") + e.what(); 192 throw exception( str.c_str() );192 throw runtime_error( str.c_str() ); 193 193 } 194 194 } … … 219 219 { 220 220 string msg = string("OpenFileCommand(), Exception:\r\n") + e.what(); 221 throw exception( msg.c_str() );221 throw runtime_error( msg.c_str() ); 222 222 } 223 223 } … … 252 252 { 253 253 string msg = string("OpenOldFileCommand(), Exception:\r\n") + e.what(); 254 throw exception( msg.c_str() );254 throw runtime_error( msg.c_str() ); 255 255 } 256 256 } … … 292 292 { 293 293 string msg = string("PrintDocumentCommand(), Exception:\r\n") + e.what(); 294 throw exception( msg.c_str() );294 throw runtime_error( msg.c_str() ); 295 295 } 296 296 } … … 323 323 // 2006-01-30 AF, add exception 324 324 string str = string("CloseFileCommand(), Exception: ") + e.what(); 325 throw exception( str.c_str() );325 throw runtime_error( str.c_str() ); 326 326 } 327 327 } … … 353 353 // 2006-01-30 AF, add exception 354 354 string str = string("NewFileCommand(), Exception: ") + e.what(); 355 throw exception( str.c_str() );355 throw runtime_error( str.c_str() ); 356 356 } 357 357 } … … 385 385 { 386 386 string msg = "Could not export text to file: " + filename_.toStdString(); 387 throw exception( msg.c_str() );387 throw runtime_error( msg.c_str() ); 388 388 } 389 389 … … 394 394 // 2006-01-30 AF, add exception 395 395 string str = string("ExportToPureText(), Exception: ") + e.what(); 396 throw exception( str.c_str() );396 throw runtime_error( str.c_str() ); 397 397 } 398 398 } … … 435 435 { 436 436 string str = string("EvalSelectedCells(), Exception: ") + e.what(); 437 throw exception( str.c_str() );437 throw runtime_error( str.c_str() ); 438 438 } 439 439 } … … 487 487 { 488 488 string str = string("UpdateChapterCounters(), Exception: ") + e.what(); 489 throw exception( str.c_str() );489 throw runtime_error( str.c_str() ); 490 490 } 491 491 } -
OMNotebook/OMNotebookQT4/notebooksocket.cpp
r9c7355a9 r9161d47 84 84 85 85 // something is wrong, throw exception 86 throw exception( "Unable to connect OR start server" );86 throw runtime_error( "Unable to connect OR start server" ); 87 87 } 88 88 … … 104 104 if( socket_->state() == QAbstractSocket::ConnectedState ) 105 105 if( !socket_->waitForDisconnected( 5000 )) 106 throw exception( "Unable to disconnect socket from host" );106 throw runtime_error( "Unable to disconnect socket from host" ); 107 107 } 108 108 … … 153 153 } 154 154 155 throw exception( "Didn't found correct server" );155 throw runtime_error( "Didn't found correct server" ); 156 156 } 157 157 -
OMNotebook/OMNotebookQT4/omc_communicator.cpp
r4938bf2 r9161d47 237 237 // 2006-02-02 AF, Added throw exception 238 238 string msg = string("OMC-ERROR in function call: ") + fnCall.toStdString(); 239 throw exception( msg.c_str() );239 throw runtime_error( msg.c_str() ); 240 240 } 241 241 … … 258 258 { 259 259 // 2006-02-02 AF, Added throw exception 260 throw exception("OMC is not responding");260 throw runtime_error("OMC is not responding"); 261 261 } 262 262 else -
OMNotebook/OMNotebookQT4/omcinteractiveenvironment.cpp
r9c7355a9 r9161d47 213 213 { 214 214 // 2006-02-28 AF, use environment varable to find omc.exe 215 string drmodelica( getenv( "OPENMODELICAHOME" ) );216 if( drmodelica.empty() )217 throw std:: exception( "Could not find environment variable OPENMODELICAHOME" );215 string OMCPath( getenv( "OPENMODELICAHOME" ) ); 216 if( OMCPath.empty() ) 217 throw std::runtime_error( "Could not find environment variable OPENMODELICAHOME" ); 218 218 219 219 // location of omc in openmodelica folder 220 220 QDir dir; 221 if( dir.exists( QString(drmodelica.c_str()) + "\\bin\\omc.exe" ) ) 222 drmodelica += "\\bin\\"; 223 else if( dir.exists( QString(drmodelica.c_str()) + "\\omc.exe" ) ) 224 drmodelica; 221 #ifdef WIN32 222 if( dir.exists( QString(OMCPath.c_str()) + "\\bin\\omc.exe" ) ) 223 OMCPath += "\\bin\\"; 224 else if( dir.exists( QString(OMCPath.c_str()) + "\\omc.exe" ) ) 225 OMCPath; 225 226 else if( dir.exists( "omc.exe" )) 226 drmodelica= "";227 OMCPath = ""; 227 228 else 228 229 { 229 230 string msg = "Unable to find OMC, searched in:\n" + 230 drmodelica+ "\\bin\\\n" +231 drmodelica+ "\n" +231 OMCPath + "\\bin\\\n" + 232 OMCPath + "\n" + 232 233 dir.absolutePath().toStdString(); 233 234 234 throw std:: exception( msg.c_str() );235 throw std::runtime_error( msg.c_str() ); 235 236 } 237 #else /* unix */ 238 if( dir.exists( QString(OMCPath.c_str()) + "/bin/omc" ) ) 239 OMCPath += "/bin/"; 240 else if( dir.exists( QString(OMCPath.c_str()) + "/omc" ) ) 241 OMCPath; 242 else if( dir.exists( "omc.exe" )) 243 OMCPath = ""; 244 else 245 { 246 string msg = "Unable to find OMC, searched in:\n" + 247 OMCPath + "/bin/\n" + 248 OMCPath + "\n" + 249 dir.absolutePath().toStdString(); 250 251 throw std::runtime_error( msg.c_str() ); 252 } 253 #endif 236 254 237 255 … … 239 257 QString omc; 240 258 #ifdef WIN32 241 omc = QString( drmodelica.c_str() ) + "omc.exe";259 omc = QString( OMCPath.c_str() ) + "omc.exe"; 242 260 #else 243 omc = QString( drmodelica.c_str() ) + "omc";261 omc = QString( OMCPath.c_str() ) + "omc"; 244 262 #endif 245 263 … … 254 272 255 273 // give time to start up.. 256 SleeperThread::msleep( 500 ); 257 258 if( QProcess::Running == omcProcess->state() ) 274 if( omcProcess->waitForStarted(2000) ) 259 275 flag = true; 260 276 else … … 282 298 283 299 if( !flag ) 284 throw std:: exception("Was unable to start OMC");300 throw std::runtime_error("Was unable to start OMC"); 285 301 286 302 */ -
OMNotebook/OMNotebookQT4/openmodelicahighlighter.cpp
ra46c6e4 r9161d47 62 62 //STD Headers 63 63 #include <exception> 64 #include <stdexcept> 64 65 #include <iostream> 65 66 … … 344 345 { 345 346 string tmp = "Could not open " + filename_.toStdString(); 346 throw exception( tmp.c_str() );347 throw runtime_error( tmp.c_str() ); 347 348 } 348 349 … … 352 353 353 354 string tmp = "Could not understand content of " + filename_.toStdString(); 354 throw exception( tmp.c_str() );355 throw runtime_error( tmp.c_str() ); 355 356 } 356 357 file.close(); -
OMNotebook/OMNotebookQT4/stylesheet.cpp
r673590f r9161d47 61 61 //STD Headers 62 62 #include <exception> 63 #include <stdexcept> 63 64 #include <iostream> 64 65 #include <cstdlib> … … 103 104 // 2005-10-03 AF, thorw exception insted of exit 104 105 string tmp = "Could not open file: " + filename.toStdString(); 105 throw exception( tmp.c_str() );106 throw runtime_error( tmp.c_str() ); 106 107 } 107 108 … … 115 116 filename.toStdString() + 116 117 " Probably some syntax error in the xml file"; 117 throw exception( tmp.c_str() );118 throw runtime_error( tmp.c_str() ); 118 119 } 119 120 file.close(); … … 278 279 { 279 280 if( !item ) 280 throw exception( "STYLESHEET TRAVERSE... No ITEM SET!!" );281 throw runtime_error( "STYLESHEET TRAVERSE... No ITEM SET!!" ); 281 282 282 283 while( !node.isNull() ) -
OMNotebook/OMNotebookQT4/textcursorcommands.cpp
r673590f r9161d47 53 53 * \brief Describes different textcursor commands 54 54 */ 55 56 55 57 56 //QT Headers … … 548 547 { 549 548 string str = string("Could not open image: ") + filepath_.toStdString().c_str(); 550 throw exception( str.c_str() );549 throw runtime_error( str.c_str() ); 551 550 } 552 551 } -
OMNotebook/OMNotebookQT4/updatelinkvisitor.cpp
r4938bf2 r9161d47 53 53 //STD Headers 54 54 #include <exception> 55 #include <stdexcept> 55 56 56 57 //QT Headers … … 88 89 { 89 90 string msg = "UpdateLink, old or new dir don't exists."; 90 throw exception( msg.c_str() );91 throw runtime_error( msg.c_str() ); 91 92 } 92 93 } … … 145 146 // this should never happen! 146 147 string msg = "Error, found no end of linkpath"; 147 throw exception( msg.c_str() );148 throw runtime_error( msg.c_str() ); 148 149 break; 149 150 } -
OMNotebook/OMNotebookQT4/xmlparser.cpp
r673590f r9161d47 135 135 { 136 136 string msg = "Could not open " + filename_.toStdString(); 137 throw exception( msg.c_str() );137 throw runtime_error( msg.c_str() ); 138 138 } 139 139 … … 142 142 file.close(); 143 143 string msg = "Could not understand content of " + filename_.toStdString(); 144 throw exception( msg.c_str() );144 throw runtime_error( msg.c_str() ); 145 145 } 146 146 file.close(); … … 183 183 string msg = "Wrong root node (" + root.toElement().tagName().toStdString() + 184 184 ") in file " + filename_.toStdString(); 185 throw exception( msg.c_str() );185 throw runtime_error( msg.c_str() ); 186 186 } 187 187 … … 213 213 { 214 214 string msg = "File " + filename_.toStdString() + " is empty"; 215 throw exception( msg.c_str() );215 throw runtime_error( msg.c_str() ); 216 216 } 217 217 … … 237 237 string msg = "Wrong root node (" + root.toElement().tagName().toStdString() + 238 238 ") in file " + filename_.toStdString() + " (Old File)"; 239 throw exception( msg.c_str() );239 throw runtime_error( msg.c_str() ); 240 240 } 241 241 … … 292 292 { 293 293 string msg = "Unknow tag name: " + element.tagName().toStdString() + ", in file " + filename_.toStdString(); 294 throw exception( msg.c_str() );294 throw runtime_error( msg.c_str() ); 295 295 } 296 296 } … … 332 332 groupcell->setClosed( false ); 333 333 else 334 throw exception( "Unknown closed value in group cell" );334 throw runtime_error( "Unknown closed value in group cell" ); 335 335 336 336 parent->addChild( groupcell ); … … 380 380 { 381 381 string msg = "Unknown tagname " + e.tagName().toStdString() + ", in text cell"; 382 throw exception( msg.c_str() );382 throw runtime_error( msg.c_str() ); 383 383 } 384 384 } … … 450 450 { 451 451 string msg = "Unknown tagname " + e.tagName().toStdString() + ", in input cell"; 452 throw exception( msg.c_str() );452 throw runtime_error( msg.c_str() ); 453 453 } 454 454 } … … 468 468 inputcell->setClosed( false ); 469 469 else 470 throw exception( "Unknown closed value in inputcell" );470 throw runtime_error( "Unknown closed value in inputcell" ); 471 471 472 472 parent->addChild( inputcell ); … … 493 493 QString imagename = element.attribute( XML_NAME, "" ); 494 494 if( imagename.isEmpty() || imagename.isNull() ) 495 throw exception( "No name in image tag" );495 throw runtime_error( "No name in image tag" ); 496 496 497 497 // Get saved image data … … 527 527 { 528 528 string msg = "Unknown typeid of parent cell"; 529 throw exception( msg.c_str() );529 throw runtime_error( msg.c_str() ); 530 530 } 531 531 } … … 533 533 { 534 534 string msg = "Error creating image: <"+ imagename.toStdString() +">"; 535 throw exception( msg.c_str() );535 throw runtime_error( msg.c_str() ); 536 536 } 537 537 } … … 587 587 { 588 588 string msg = "Unknown tag: <"+ e.tagName().toStdString() +">"; 589 throw exception( msg.c_str() );589 throw runtime_error( msg.c_str() ); 590 590 } 591 591 }
Note: See TracChangeset
for help on using the changeset viewer.