/** * file->save */ static EWL_CALLBACK_DEFN(save) { /* check for ever saved, request info */ if( active_project->dirty ) { file_project_save(active_project); active_project->dirty = false; } }
int main(int argc, char *argv[]) { // debug_new::PrintTrace PrintingOn; // merely activates logging of new/delete //print arguments std::cout << "Argument list with "<<argc<<" arguments\n"; for (int i=0; i<argc; i++) { std::cout << argv[i] <<"\n"; } //first argument is the filename of this program containing the current working directory //second argument is *.mod filename which needs to be opened at startup //testmatrix(); QApplication a( argc, argv ); //a.QApplication::setGraphicsSystem("raster"); //important to fix a bug in QT with scaling of pen sizes //QTranslator tor( 0 ); // set the location where your .qm files are in load() below as the last parameter instead of "." // for development, use "/" to use the english original as // .qm files are stored in the base project directory. //tor.load( QString("eelsmodel.") + QTextCodec::locale(), "." ); // a.installTranslator( &tor ); /* uncomment the following line, if you want a Windows 95 look*/ //a.setStyle(QApplication::WindowsStyle); //create menu, toolbar and init the workspace MenuEelsmodel* mymainwindow=new MenuEelsmodel(); global_menueelsmodel=mymainwindow; //store the workspace global_workspaceptr=mymainwindow->getworkspaceptr(); //init the eelsmodel class Eelsmodel* myeelsmodel=new Eelsmodel(global_workspaceptr,"version 4.1"); //and store a global pointer global_eelsmodelptr=myeelsmodel; //show the window //a.setMainWidget( mymainwindow ); mymainwindow->show(); mymainwindow->showMaximized(); //make connections between menu and eelsmodel program QObject::connect(mymainwindow, SIGNAL(file_new()),myeelsmodel, SLOT(newspectrum()) ); QObject::connect(mymainwindow, SIGNAL(model_componentmaintenance()),myeelsmodel, SLOT(componentmaintenance()) ); QObject::connect(mymainwindow, SIGNAL(model_newmodel()),myeelsmodel, SLOT(newmodel()) ); QObject::connect(mymainwindow, SIGNAL(model_detector()),myeelsmodel, SLOT(slot_model_detector()) ); QObject::connect(mymainwindow, SIGNAL(file_open_msa()),myeelsmodel, SLOT(openmsa()) ); QObject::connect(mymainwindow, SIGNAL(file_open_DM()),myeelsmodel, SLOT(openDM()) ); QObject::connect(mymainwindow, SIGNAL(model_iterativefit()),myeelsmodel, SLOT(iterativefit()) ); QObject::connect(mymainwindow, SIGNAL(edit_undoselection()),myeelsmodel, SLOT(undoselection()) ); QObject::connect(mymainwindow, SIGNAL(edit_exclude()),myeelsmodel, SLOT(exclude()) ); QObject::connect(mymainwindow, SIGNAL(edit_resetexclude()),myeelsmodel, SLOT(resetexclude()) ); QObject::connect(mymainwindow, SIGNAL(file_project_open()),myeelsmodel, SLOT(slot_open_project()) ); QObject::connect(mymainwindow, SIGNAL(file_project_save()),myeelsmodel, SLOT(slot_save_project()) ); QObject::connect(mymainwindow, SIGNAL(file_model_save()),myeelsmodel, SLOT(slot_save_model()) ); QObject::connect(mymainwindow, SIGNAL(file_report_save()),myeelsmodel, SLOT((slot_save_report())) ); QObject::connect(mymainwindow, SIGNAL(file_save_as()),myeelsmodel, SLOT(slot_save_as()) ); QObject::connect(myeelsmodel, SIGNAL(enablemodel(bool)),mymainwindow, SLOT(slot_enable_model(bool))); Hello myhello; //=new Hello(); //(void*) myhello;//supress unused warning if (argc>1) { //get a *.mod file from the arguments std::string arg1=argv[0]; //contains program directory+program name std::string arg2=argv[1]; //contains argument ideally a *.mod filename to open global_eelsmodelptr->slot_open_project_from_filename(arg2); } const int result=a.exec(); //delete the pointers we have //if (myhello!=0) delete(myhello); //the hello window is deleted by itself when pressing done //if (mymainwindow!=0) delete(mymainwindow); //if (myeelsmodel!=0) delete(myeelsmodel); return result; }