Mercurial > hg > forks > UniversalIndentGUI
changeset 85:7328bb113688
Feature Request ID 1673549 : The order of the indenter call paramters for input file, output file and options[file] is now selectable in three states: pio, ipo, iop.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@258 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Sun, 04 Mar 2007 19:44:54 +0000 |
parents | feb598110766 |
children | ef8117b84a85 |
files | src/indenthandler.cpp src/indenthandler.h |
diffstat | 2 files changed, 37 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/indenthandler.cpp Wed Feb 28 21:52:47 2007 +0000 +++ b/src/indenthandler.cpp Sun Mar 04 19:44:54 2007 +0000 @@ -87,6 +87,16 @@ Q_ASSERT_X( !outputFileName.isEmpty(), "callIndenter", "outputFileName is empty" ); Q_ASSERT_X( !indenterFileName.isEmpty(), "callIndenter", "indenterFileName is empty" ); + QString formattedSourceCode; + bool wineInstalled = true; + QString indentCallString; + QString parameterInputFile; + QString parameterOuputFile; + QString parameterParamterFile; + QProcess indentProcess; + QString processReturnString; + bool indenterExecutableExists = false; + // generate the parameter string that will be save to the indenters config file QString parameterString = getParameterString(); @@ -94,33 +104,40 @@ writeConfigFile( parameterString ); } - QString formattedSourceCode; - bool wineInstalled = true; - // only add point to file extension if the string is not empty if ( !inputFileExtension.isEmpty() ) { inputFileExtension = "." + inputFileExtension; } + QFile::remove(dataDirctoryStr + inputFileName + inputFileExtension); + QFile outSrcFile(dataDirctoryStr + inputFileName + inputFileExtension); + parameterInputFile = " " + inputFileParameter + inputFileName + inputFileExtension; - QFile::remove(dataDirctoryStr + inputFileName + inputFileExtension); - QFile outSrcFile(dataDirctoryStr + inputFileName + inputFileExtension); - QString indentCallString = inputFileParameter + inputFileName + inputFileExtension; + if ( outputFileParameter != "none" ) { + parameterOuputFile = " " + outputFileParameter + outputFileName + inputFileExtension; + } // If the config file name is empty it is assumed that all parameters are sent via command line call if ( configFilename.isEmpty() ) { - indentCallString += " " + parameterString; + parameterParamterFile = " " + parameterString; + } + // if needed add the parameter to the indenter call string where the config file can be found + else { + parameterParamterFile = " " + useCfgFileParameter + configFilename; } - if ( outputFileParameter != "none" ) { - indentCallString += " "+ outputFileParameter + outputFileName + inputFileExtension; - } - - QProcess indentProcess; - QString processReturnString; + // Assemble indenter call string for parameters according to the set order. + if ( parameterOrder == "ipo" ) { + indentCallString = parameterInputFile + parameterParamterFile + parameterOuputFile; + } + else if ( parameterOrder == "pio" ) { + indentCallString = parameterParamterFile + parameterInputFile + parameterOuputFile; + } + else { + indentCallString = parameterInputFile + parameterOuputFile + parameterParamterFile; + } // Test if the indenter executable exists. If not show a dialog box once and return // the unformatted source code. Else continue calling the indenter. - bool indenterExecutableExists = false; #if defined(Q_OS_WIN32) indenterExecutableExists = QFile::exists(dataDirctoryStr + indenterFileName+".exe"); #else @@ -137,16 +154,11 @@ // generate the indenter call string either for win32 or other systems #if defined(Q_OS_WIN32) - indentCallString = dataDirctoryStr + indenterFileName +".exe "+ indentCallString; + indentCallString = dataDirctoryStr + indenterFileName +".exe"+ indentCallString; #else - indentCallString = "./" + indenterFileName +" "+ indentCallString; + indentCallString = "./" + indenterFileName + indentCallString; #endif - // if needed add the parameter to the indenter call string where the config file can be found - if ( !useCfgFileParameter.isEmpty() ) { - indentCallString += " "+ useCfgFileParameter + configFilename; - } - // write the source code to the input file for the indenter outSrcFile.open( QFile::ReadWrite | QFile::Text ); outSrcFile.write( sourceCode.toUtf8() ); @@ -500,6 +512,9 @@ cfgFileParameterEnding = "\n"; } + // Read the parameter order. Possible values are (p=parameter[file] i=inputfile o=outputfile) + // pio, ipo, iop + parameterOrder = indenterSettings->value(" header/parameterOrder", "pio").toString(); inputFileParameter = indenterSettings->value(" header/inputFileParameter").toString(); inputFileName = indenterSettings->value(" header/inputFileName").toString(); outputFileParameter = indenterSettings->value(" header/outputFileParameter").toString();
--- a/src/indenthandler.h Wed Feb 28 21:52:47 2007 +0000 +++ b/src/indenthandler.h Sun Mar 04 19:44:54 2007 +0000 @@ -122,6 +122,7 @@ QString indenterFileName; QString dataDirctoryStr; QStringList indenterIniFileList; + QString parameterOrder; QString configFilename; QString cfgFileParameterEnding; QString inputFileParameter;