From eef188c6cc953fcff9cf4491b0ae8256608caa14 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Tue, 23 Oct 2018 20:01:40 +0200 Subject: first draft for diceresult --- cli/main.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'cli/main.cpp') diff --git a/cli/main.cpp b/cli/main.cpp index dee3d05..30b05a3 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -242,6 +242,7 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF QString comment = parser.getComment(); QString error = parser.humanReadableError(); QStringList strLst; + QStringList listOfDiceResult; if(parser.hasIntegerResultNotInFirst()) { @@ -262,7 +263,41 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF } scalarText = QString("%1").arg(strLst.join(',')); } + if(!list.isEmpty()) + { + qDebug() << "list is not empty" << list.size(); + for(auto map : list) + { + qDebug() << "loop map"<< map.size(); + for(auto key : map.keys()) + { + qDebug() << "key: "< 1) + { + stringVal=QString("%1 [%2]").arg(total).arg(dicelist.join(',')); + listOfDiceResult << stringVal; + } + else + { + listOfDiceResult << QString::number(total); + } + } + } + } + } + qDebug() << listOfDiceResult; if(parser.hasStringResult()) { bool ok; @@ -277,6 +312,11 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF stringResult.replace(QStringLiteral("$%1").arg(i),(*it)); --i; } + for(auto it = strLst.rbegin(); it != strLst.rend() ; ++it) + { + stringResult.replace(QStringLiteral("µ%1").arg(i),(*it)); + --i; + } resultStr = stringResult; } -- cgit v1.2.3-70-g09d2 From 0586f25925f4db4a181c7d7d0a3925bb8a6daecf Mon Sep 17 00:00:00 2001 From: Renaud G Date: Wed, 24 Oct 2018 21:37:58 +0200 Subject: DiceParser: better display. --- cli/main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli/main.cpp') diff --git a/cli/main.cpp b/cli/main.cpp index 30b05a3..c40cff6 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -304,6 +304,7 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF QStringList allStringlist = parser.getAllStringResult(ok); QString stringResult = allStringlist.join(" ; "); stringResult.replace("%1",scalarText); + resultStr.replace("%2",diceList.trimmed()); stringResult.replace("%3",lastScalarText); int i = strLst.size(); @@ -312,6 +313,7 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF stringResult.replace(QStringLiteral("$%1").arg(i),(*it)); --i; } + i = strLst.size(); for(auto it = strLst.rbegin(); it != strLst.rend() ; ++it) { stringResult.replace(QStringLiteral("µ%1").arg(i),(*it)); -- cgit v1.2.3-70-g09d2 From 4a6b19b27866326fa069a422ed2c862ab9e9d4d2 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 27 Oct 2018 00:35:15 +0200 Subject: Get full result. --- cli/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/main.cpp') diff --git a/cli/main.cpp b/cli/main.cpp index c40cff6..7cf2b7b 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -232,8 +232,10 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF { parser.start(); QList list; + QList listFull; bool homogeneous = true; parser.getLastDiceResult(list,homogeneous); + parser.getDiceResultFromAllInstruction(listFull); bool allSameFaceCount, allSameColor; auto array = DisplayToolBox::diceToJson(list,allSameFaceCount,allSameColor); QString resultStr; @@ -313,7 +315,7 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF stringResult.replace(QStringLiteral("$%1").arg(i),(*it)); --i; } - i = strLst.size(); + i = listFull.size(); for(auto it = strLst.rbegin(); it != strLst.rend() ; ++it) { stringResult.replace(QStringLiteral("µ%1").arg(i),(*it)); -- cgit v1.2.3-70-g09d2