MainUI::MainUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainUI) { ui->setupUi(this); PORT = new PortStruct(); //backend data structure //Setup the line edit on the toolbar portOpened = new QLineEdit(this); ui->toolBar->addWidget(portOpened); //Setup the MakeFile editor formatting QFontMetrics metrics(ui->text_makefile->font()); ui->text_makefile->setTabStopWidth( 4 * metrics.width(' ') ); //4 spaces per tab (\t) ui->tabWidget->setEnabled(false); //Connect the signals/slots connect(ui->actionNewPort, SIGNAL(triggered(bool)), this, SLOT(slotNewPort()) ); connect(ui->actionLoad_Port, SIGNAL(triggered(bool)), this, SLOT(slotLoadPort()) ); // - makefile tab connect(ui->tool_make_save, SIGNAL(clicked()), this, SLOT(saveMakefile()) ); connect(ui->list_make_config, SIGNAL(itemSelectionChanged()), this, SLOT(makeOptChanged()) ); connect(ui->tool_make_replaceconf, SIGNAL(clicked()), this, SLOT(replaceMakeOpt()) ); connect(ui->tool_make_addconf, SIGNAL(clicked()), this, SLOT(addMakeOpt()) ); connect(ui->text_makefile, SIGNAL(textChanged()), this, SLOT(makefileChanged()) ); // - distinfo tab connect(ui->tool_dist_autogen, SIGNAL(clicked()), this, SLOT(generateDistInfo()) ); // - pkg-plist tab connect(ui->tool_plist_save, SIGNAL(clicked()), this, SLOT(savePkgPlist()) ); connect(ui->text_pkgplist, SIGNAL(textChanged()), this, SLOT(pkgplistChanged()) ); // - pkg-descr tab connect(ui->tool_desc_save, SIGNAL(clicked()), this, SLOT(savePkgDescr()) ); connect(ui->text_pkgdesc, SIGNAL(textChanged()), this, SLOT(pkgdescrChanged()) ); }
//======================>>> makefileMaker::saveProject <<<============================ void makefileMaker::saveProject (char *nameIn) { char n[300]; if (!changed) return; if (strlen(nameIn) > 296) strcpy(n,"BADFILE.tmp"); else strcpy(n,nameIn); int len = strlen(n); int ix; for (ix = len - 1 ; ix >= 0 ; --ix) { if (n[ix] == '.' || n[ix] == '/' || n[ix] == '\\') break; } if (n[ix] != '.') // user didn't supply extension strcat(n,".vpj"); ofstream prjf(n); //header char buff[40]; char date[20]; vGetLocalTime(buff); vGetLocalDate(date); prjf << "//=======================================================================\n"; prjf << "//@V@:Note: Project File generated by VIDE: "; prjf << "(" << buff << " " << date << ").\n"; prjf << "//CAUTION! Hand edit only if you know what you are doing!\n"; prjf << "//=======================================================================\n\n"; // Project Options prjf << SecProjOpts << endl; projOpts.erase(); // erase all options if (*ctags != 0) { char buff[fieldLen]; strcpy(buff,"ctags:"); strcat(buff,ctags); projOpts.insert(-1,buff); } for (int nxtOpts = 0 ; projOpts.list[nxtOpts] != 0 ; ++nxtOpts) prjf << projOpts.list[nxtOpts] << endl; prjf << SecProjOptsEnd << endl << endl; // Makefile name prjf << SecMakefile << endl; prjf << makeName << endl << endl; // Options prjf << SecOptions << endl; for (int nxtOptsa = 0 ; curOpts.list[nxtOptsa] != 0 ; ++nxtOptsa) prjf << curOpts.list[nxtOptsa] << endl; prjf << SecOptionsEnd << endl << endl; // HOMEV prjf << SecHomeV << endl; prjf << homeV << endl << endl; // 1) name of exe target file prjf << SecTarget << endl; prjf << exeName << endl << endl; // 2) object files prjf << SecObjFiles << endl; for (int ixa = 0 ; objFiles.list[ixa] != 0 ; ++ixa) { prjf << objFiles.list[ixa] << endl; } prjf << SecObjFilesEnd << endl << endl; // 3) compiler name prjf << SecCompiler << endl; prjf << cc << endl << endl; // 4) include dirs prjf << SecIncDirs << endl; for (int nxtid = 0 ; incDirs.list[nxtid] != 0 ; ++nxtid) prjf << incDirs.list[nxtid] << endl; prjf << SecIncDirsEnd << endl << endl; // 5) lib dirs prjf << SecLibDirs << endl; for (int ld = 0 ; libDirs.list[ld] != 0 ; ++ld) prjf << libDirs.list[ld] << endl; prjf << SecLibDirsEnd << endl << endl; // 6) defs prjf << SecDefs << endl; for (int ixb = 0 ; defsPool.list[ixb] != 0 ; ++ixb) prjf << defsPool.list[ixb] << endl; prjf << SecDefsPoolEnd << endl; for (int ixc = 0 ; curDefs.list[ixc] != 0 ; ++ixc) prjf << curDefs.list[ixc] << endl; prjf << SecDefsEnd << endl << endl; // 7) cflag prjf << SecCFlags << endl; prjf << cFlags << endl << endl; // 8) libflag prjf << SecLibFlags << endl; prjf << Libs << endl << endl; // src directory prjf << SecSrcDir << endl; prjf << SrcDir << endl << endl; // 9) object directory prjf << SecObjDir << endl; prjf << ObjDir << endl << endl; //10) bin directory prjf << SecBinDir << endl; prjf << BinDir << endl << endl; // User Targets prjf << endl << "//% User targets section. Following lines will be" << endl; prjf << "//% inserted into Makefile right after the generated cleanall target." << endl; prjf << "//% The Project File editor does not edit these lines - edit the .vpj" << endl; prjf << "//% directly. You should know what you are doing." << endl; prjf << SecUserTargets << endl; for (int lda = 0 ; userTargets.list[lda] != 0 ; ++lda) prjf << userTargets.list[lda] << endl; prjf << SecUserTargetsEnd << endl << endl; prjf.close(); saveMakefile(); // and always save the makefile, too. changed = false; }