From f0f5ef7b87d8d5c1a0c59f0e0410474155c1019c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Fri, 28 Sep 2018 11:15:32 +0200 Subject: need for gui is not conditionnal add flag NO_PAINTER_OPERATOR --- cli/main.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'cli/main.cpp') diff --git a/cli/main.cpp b/cli/main.cpp index a165451..dee3d05 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -27,9 +27,14 @@ #include #include #include -#include #include +#ifdef PAINTER_OP +#include +#else +#include +#endif + #include "displaytoolbox.h" #include "diceparser.h" #include "highlightdice.h" @@ -49,7 +54,11 @@ QTextStream out(stdout, QIODevice::WriteOnly); bool markdown = false; +#ifdef PAINTER_OP enum EXPORTFORMAT {TERMINAL, SVG, IMAGE, MARKDOWN, JSON, BOT}; +#else +enum EXPORTFORMAT {TERMINAL, SVG, MARKDOWN, JSON, BOT}; +#endif int returnValue = 0; @@ -89,11 +98,12 @@ QString diceToMarkdown(QJsonArray array,bool withColor,bool allSameColor,bool al return result.join(' '); } } - +#ifdef PAINTER_OP void displayImage(QString scalarText, QString resultStr,QJsonArray array, bool withColor, QString cmd, QString comment, bool allSameFaceCount,bool allSameColor) { out << DisplayToolBox::makeImage( scalarText, resultStr, array, withColor, cmd, comment, allSameFaceCount, allSameColor); } +#endif void displayJSon(QString scalarText, QString resultStr,QJsonArray array, bool withColor, QString cmd, QString error, QString comment, bool allSameFaceCount,bool allSameColor) { Q_UNUSED(withColor); @@ -278,7 +288,11 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF } else { + #ifdef PAINTER_OP format = IMAGE; + #else + format = MARKDOWN; + #endif } if(!error.isEmpty()) { @@ -300,9 +314,11 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF case JSON: displayJSon(scalarText, resultStr, array, withColor, cmd, error, comment, allSameFaceCount, allSameColor); break; + #ifdef PAINTER_OP case IMAGE: displayImage(scalarText, resultStr, array, withColor, cmd, comment, allSameFaceCount, allSameColor); break; + #endif } if(!treeFile.isEmpty()) { @@ -325,7 +341,11 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF #include int main(int argc, char *argv[]) { +#ifdef PAINTER_OP QGuiApplication a(argc, argv); +#else + QCoreApplication a(argc, argv); +#endif QStringList commands; QString cmd; -- cgit v1.2.3-70-g09d2