void BOM::sPopulateMenu(QMenu *menuThis) { menuThis->addAction(tr("View"), this, SLOT(sView())); if ((_mode == cNew) || (_mode == cEdit)) { menuThis->addAction(tr("Edit"), this, SLOT(sEdit())); menuThis->addAction(tr("Expire"), this, SLOT(sExpire())); menuThis->addAction(tr("Replace"), this, SLOT(sReplace())); if (_metrics->boolean("AllowBOMItemDelete")) { menuThis->addSeparator(); menuThis->addAction(tr("Delete"), this, SLOT(sDelete())); } menuThis->addSeparator(); menuThis->addAction(tr("Move Up"), this, SLOT(sMoveUp())); menuThis->addAction(tr("Move Down"), this, SLOT(sMoveDown())); } }
viewCheckRun::viewCheckRun(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); connect(_check, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(sHandleItemSelection())); connect(_bankaccnt, SIGNAL(newID(int)), this, SLOT(sFillList())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_newMiscCheck, SIGNAL(clicked()), this, SLOT(sNewMiscCheck())); connect(_postCheck, SIGNAL(clicked()), this, SLOT(sPost())); connect(_prepareCheckRun,SIGNAL(clicked()), this, SLOT(sPrepareCheckRun())); connect(_replace, SIGNAL(clicked()), this, SLOT(sReplace())); connect(_replaceAll, SIGNAL(clicked()), this, SLOT(sReplaceAll())); connect(_vendorgroup, SIGNAL(updated()), this, SLOT(sFillList())); connect(_vendorgroup, SIGNAL(updated()), this, SLOT(sHandleVendorGroup())); connect(_void, SIGNAL(clicked()), this, SLOT(sVoid())); _check->addColumn(tr("Void"), _ynColumn, Qt::AlignCenter,true, "checkhead_void"); _check->addColumn(tr("Misc."), _ynColumn, Qt::AlignCenter,true, "checkhead_misc" ); _check->addColumn(tr("Prt'd"), _ynColumn, Qt::AlignCenter,true, "checkhead_printed" ); _check->addColumn(tr("Chk./Voucher/RA #"),_itemColumn, Qt::AlignCenter,true, "number" ); _check->addColumn(tr("Recipient/Invc./CM #"), -1, Qt::AlignLeft, true, "description" ); _check->addColumn(tr("Check Date") , _dateColumn, Qt::AlignCenter,true, "checkdate" ); _check->addColumn(tr("Amount"), _moneyColumn, Qt::AlignRight, true, "amount" ); _check->addColumn(tr("Currency"), _currencyColumn, Qt::AlignLeft, true, "currAbbr" ); if (_metrics->boolean("ACHEnabled")) _check->addColumn(tr("ACH Batch"), _orderColumn, Qt::AlignLeft, true, "checkhead_ach_batch" ); if (omfgThis->singleCurrency()) _check->hideColumn("curr_concat"); connect(omfgThis, SIGNAL(checksUpdated(int, int, bool)), this, SLOT(sFillList(int))); sFillList(); }
void UI_Dump_f(void) { string sFinalOutput; vector <string> vStripEdFiles; #define OUTPUT sFinalOutput+= #define OUTPUTSTRIP vStripEdFiles[vStripEdFiles.size()-1] += OUTPUT("### UI_Dump(): Top\n"); for (ReferencesAndPackages_t::iterator it = ReferencesAndPackage.begin(); it!=ReferencesAndPackage.end(); ++it) { if ( (*it).second.size()>1) { OUTPUT(va("!!!DUP: Ref \"%s\" exists in:\n",(*it).first.c_str())); StringSet_t &Set = (*it).second; for (StringSet_t::iterator itS = Set.begin(); itS!=Set.end(); ++itS) { OUTPUT(va("%s\n",(*itS).c_str())); } } } OUTPUT("\nSP Package Reference list:\n"); for (StringSet_t::iterator itS = MenusUsed.begin(); itS!=MenusUsed.end(); ++itS) { OUTPUT(va("%s\n",(*itS).c_str())); } OUTPUT("\nBad Text list:\n"); for (References_t::iterator itBad=BadReferences.begin(); itBad!=BadReferences.end();++itBad) { Reference_t &BadReference = (*itBad); OUTPUT(va("File: %30s \"%s\"\n",BadReference.sMenu.c_str(), BadReference.sString.c_str())); } OUTPUT("\nAdding bad references to final correction list...\n"); for (itBad=BadReferences.begin(); itBad!=BadReferences.end();++itBad) { Reference_t &BadReference = (*itBad); EnterRef("", BadReference.sString.c_str(), BadReference.sMenu.c_str() ); } OUTPUT("\nFinal correction list:\n"); // qboolean bIsMulti = !!strstr((*CorrectionData.begin()).sMenuFile.c_str(),"jk2mp"); // actually do the find/replace... // for (CorrectionData_t::iterator itCorrectionData = CorrectionData.begin(); itCorrectionData != CorrectionData.end(); ++itCorrectionData) { CorrectionDataItem_t &CorrectionDataItem = (*itCorrectionData); if (CorrectionDataItem.sTextToFind.c_str()[0] && CorrectionDataItem.sTextToReplaceWith.c_str()[0]) { OUTPUT( va("Load File: \"%s\", find \"%s\", replace with \"%s\"\n", CorrectionDataItem.sMenuFile.c_str(), CorrectionDataItem.sTextToFind.c_str(), CorrectionDataItem.sTextToReplaceWith.c_str() ) ); // if (strstr(CorrectionDataItem.sTextToReplaceWith.c_str(),"START_A_NEW_GAME")) // { // int z=1; // } assert( CorrectionDataItem.sTextToReplaceWith.c_str()[0] ); string sReplace( CorrectionDataItem.sTextToReplaceWith.c_str() ); sReplace.insert(1,"_"); sReplace.insert(1,CorrectionDataItem.sStripEdFileRef.c_str()); DoFileFindReplace( CorrectionDataItem.sMenuFile.c_str(), CorrectionDataItem.sTextToFind.c_str(), sReplace.c_str()//CorrectionDataItem.sTextToReplaceWith.c_str() ); } } // scan in all SP files into one huge string, so I can pick out any foreign translations to add in when generating // new StripEd files... // char **ppsFiles; char *buffers[1000]; // max # SP files, well-OTT. int iNumFiles; int i; string sStripFiles; // scan for shader files ppsFiles = FS_ListFiles( "strip", ".sp", &iNumFiles ); if ( !ppsFiles || !iNumFiles ) { assert(0); } else { // load files... // for (i=0; i<iNumFiles; i++) { char sFilename[MAX_QPATH]; Com_sprintf( sFilename, sizeof( sFilename ), "strip/%s", ppsFiles[i] ); OutputDebugString( va("...loading '%s'\n", sFilename ) ); int iLen = FS_ReadFile( sFilename, (void **)&buffers[i] ); if ( iLen<1 ) { assert(0);//Com_Error( ERR_DROP, "Couldn't load %s", filename ); } } // free up memory... // FS_FreeFileList( ppsFiles ); // build single large buffer and free up buffers as we go... // // ( free in reverse order, so the temp files are all dumped ) for ( i=iNumFiles-1; i>=0; i-- ) { sStripFiles += buffers[i]; sStripFiles += "\r\n"; FS_FreeFile( buffers[i] ); } } int iIndex=0; for (itCorrectionData = CorrectionData.begin(); itCorrectionData != CorrectionData.end(); ++itCorrectionData) { CorrectionDataItem_t &CorrectionDataItem = (*itCorrectionData); if (CorrectionDataItem.sStripEdReference.c_str()[0] // skip over duplicate-resolving entries // && CorrectionDataItem.sStripEdText.c_str()[0] // ) { string strAnyForeignStringsFound; // will be entire line plus CR string strNotes; // will be just the bit within quotes LPCSTR psFoundExisting; int iInitialSearchPos = 0; while (iInitialSearchPos < sStripFiles.size() && (strAnyForeignStringsFound.empty() || strNotes.empty()) ) { if ( (psFoundExisting = strstr( sStripFiles.c_str()+iInitialSearchPos, va("\"%s\"",CorrectionDataItem.sStripEdText.c_str()))) != NULL ) { // see if we can find any NOTES entry above this... // LPCSTR p; if (strNotes.empty()) { p = psFoundExisting; while (p > sStripFiles.c_str() && *p!='{') { if (!strnicmp(p,"NOTES",5) && isspace(p[-1]) && isspace(p[5])) { p = strchr(p,'"'); if (!p++) break; while (*p != '"') strNotes += *p++; break; } p--; } } // now search for any foreign versions we already have translated... // if (strAnyForeignStringsFound.empty()) { p = psFoundExisting; LPCSTR psNextBrace = strchr(p,'}'); assert(psNextBrace); if (psNextBrace) { for (int i=2; i<10; i++) { LPCSTR psForeign = strstr(p,va("TEXT_LANGUAGE%d",i)); if (psForeign && psForeign < psNextBrace) { strAnyForeignStringsFound += " "; while (*psForeign != '\n' && *psForeign != '\0') { strAnyForeignStringsFound += *psForeign++; } strAnyForeignStringsFound += "\n"; } } } } iInitialSearchPos = psFoundExisting - sStripFiles.c_str(); iInitialSearchPos++; // one past, so we don't re-find ourselves } else { break; } } if (!strNotes.empty()) { strNotes = va(" NOTES \"%s\"\n",strNotes.c_str()); } // now do output... // if (!(iIndex%256)) { string s; vStripEdFiles.push_back(s); OUTPUTSTRIP( va( "VERSION 1\n" "CONFIG W:\\bin\\striped.cfg\n" "ID %d\n" "REFERENCE MENUS%d\n" "DESCRIPTION \"menu text\"\n" "COUNT 256\n", // count will need correcting for last one 250 + (iIndex/256), // 250 range seems to be unused iIndex/256 ) ); // OUTPUTSTRIP( va("REFERENCE %s\n", va("%sMENUS%d",bIsMulti?"MP":"SP",iIndex/256)) ); // OUTPUTSTRIP( va("REFERENCE %s\n", va( "MENUS%d",iIndex/256)) ); } OUTPUTSTRIP( va( "INDEX %d\n" "{\n" " REFERENCE %s\n" "%s" " TEXT_LANGUAGE1 \"%s\"\n" "%s" "}\n", iIndex%256, CorrectionDataItem.sStripEdReference.c_str(), (strNotes.empty()?"":strNotes.c_str()), CorrectionDataItem.sStripEdText.c_str(), strAnyForeignStringsFound.c_str() ) ); iIndex++; } } OUTPUT("### UI_Dump(): Bottom\n"); SendStringToNotepad(sFinalOutput.c_str(), "temp.txt"); // output the SP files... // for (i=0; i<vStripEdFiles.size(); i++) { // need to make local string, because ingame va() is crippled to 2 depths... // char sName[MAX_PATH]; sprintf(sName,"Source\\StarWars\\code\\base\\strip\\MENUS%d.sp",i); SendStringToNotepad(vStripEdFiles[i].c_str(), sName); } }
/********************************************************************************* bool CQuoteUnit::DoReplace(const TDVCHAR** ppReplace, const TDVCHAR* pStart, CTDVString* oResult, int* pCurrentSmileyCount) Author: Mark Howitt Created: 21/06/2004 Inputs: ppReplace - The text to parse for replacement. pStart - A pointer to the start position of the replacement string. Outputs: oResult - The string to add the replacement text to. pCurrentSmileyCount - a pointer to a count, so we can track the smiley limits Returns: true if we found a opening or closing quote tag, false if not Purpose: Parses for quote tags. NOTE!!! There is currently no checking to make sure there are matching opening and closing tags! Due to the fact that we have attributes within the open tag, it makes parsing for correct xml structure very difficult. *********************************************************************************/ bool CQuoteUnit::DoReplace(const TDVCHAR** ppReplace, const TDVCHAR* pStart, CTDVString* oResult, int* pCurrentSmileyCount) { // Make a string copy of the replace CTDVString sReplace(*ppReplace); // Now see if we've got an open or close quote tag! bool bFoundQuote = false; if (sReplace.Find("<quote") == 0) { // Make sure it has a closing bracket and it comes before the closing tag! int iEndBracket = sReplace.Find(">"); if (iEndBracket == -1) { // No closing bracket for the open tag! return false; } if (iEndBracket == 6) { // We've just got a bog standard open quote tag! *oResult << "<QUOTE>"; *ppReplace += 7; } else { // We've got a closing bracket before the closing tag! It's an open tag with attributes! // Mkae sure we put it all into upper case! *oResult << "<QUOTE"; CTDVString sTemp = sReplace.Mid(6,iEndBracket - 6); CTDVString sEscaped; int iFirst = 0, iCount = 0; // Find the PostID info if any int iPostPos = sTemp.Find("postid='"); if (iPostPos > -1) { // Found a user name attribute, add it to the result string iFirst = iPostPos + 8; iCount = sTemp.Find("'",iFirst) - iPostPos - 8; if (iCount > 0) { sEscaped = sTemp.Mid(iFirst,iCount); CXMLObject::EscapeAllXML(&sEscaped); *oResult << " POSTID='" << sEscaped << "'"; } } // Find the user info if any int iUserPos = sTemp.Find("user='******'",iFirst) - iUserPos - 6; if (iCount > 0) { sEscaped = sTemp.Mid(iFirst,iCount); CXMLObject::EscapeAllXML(&sEscaped); *oResult << " USER='******'"; } } // Find the username if any int iUserIDPos = sTemp.Find("userid='"); if (iUserIDPos > -1) { // Found a userid attribute, put it into the result string iFirst = iUserIDPos + 8; iCount = sTemp.Find("'",iFirst) - iUserIDPos - 8; if (iCount > 0) { sEscaped = sTemp.Mid(iFirst,iCount); CXMLObject::EscapeAllXML(&sEscaped); *oResult << " USERID='" << sEscaped << "'"; } } // Close the open tag and Update the pointer position *oResult << ">"; *ppReplace += iEndBracket + 1; } // Increment the number of open tags m_iOpenTags++; bFoundQuote = true; } else if (sReplace.Find("</quote>") == 0) { // Copy the close tag into the result string and move the pointer on *oResult << "</QUOTE>"; *ppReplace += 8; m_iOpenTags--; bFoundQuote = true; } // Return saying if we've found and replaced a quote return bFoundQuote; }