Showing the changes to libraries/script-engine/src/ConsoleScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -22,7 +22,10 @@ void ConsoleScriptingInterface::info(QString message) { · 21 unmodified lines | |||
| 22 | } | 22 | } |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | void ConsoleScriptingInterface::log(QString message) { | 25 | void ConsoleScriptingInterface::log(QString message) { |
| 26 | /*if (!listgrp.isEmpty()){ | ||
| 27 | listgrp.append(qMakePair(currentGroupSelection, message)); | ||
| 28 | }*/ | ||
| 26 | if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) { | 29 | if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) { |
| 27 | scriptEngine->scriptPrintedMessage(message); | 30 | scriptEngine->scriptPrintedMessage(message); |
| 28 | } | 31 | } |
| @@ -130,3 +133,62 @@ void ConsoleScriptingInterface::clear() { · 101 unmodified lines | |||
| 130 | scriptEngine->clearConsole(); | 133 | scriptEngine->clearConsole(); |
| 131 | } | 134 | } |
| 132 | } | 135 | } |
| 136 | |||
| 137 | void ConsoleScriptingInterface::group(QString groupName) { | ||
| 138 | listgrp.append(qMakePair(defaultGroupName, groupName)); | ||
| 139 | currentGroupSelection = groupName; | ||
| 140 | } | ||
| 141 | |||
| 142 | void ConsoleScriptingInterface::groupCollapsed(QString groupName) { | ||
| 143 | listgrp.append(qMakePair(defaultGroupCollapseName, groupName)); | ||
| 144 | currentGroupSelection = groupName; | ||
| 145 | } | ||
| 146 | |||
| 147 | void ConsoleScriptingInterface::consoleLog(QString groupName) { | ||
| 148 | if (!listgrp.isEmpty()){ | ||
| 149 | listgrp.append(qMakePair(currentGroupSelection, groupName)); | ||
| 150 | } | ||
| 151 | } | ||
| 152 | |||
| 153 | int collapseCount = 0; | ||
| 154 | QString addSpace = " "; | ||
| 155 | void ConsoleScriptingInterface::groupEnd() { | ||
| 156 | QString endGroup= "endGroup"; | ||
| 157 | listgrp.append(qMakePair(currentGroupSelection, endGroup)); | ||
| 158 | //currentGroupSelection = groupName; | ||
| 159 | } | ||
| 160 | |||
| 161 | void show(){ | ||
| 162 | QString tmp; | ||
| 163 | QPair<QString, QString> pair; | ||
| 164 | for (int i = 0; i<listgrp.count(); i++) { | ||
| 165 | pair = listgrp.at(i); | ||
| 166 | if (pair.first == "group") { | ||
| 167 | tmp = pair.second; | ||
| 168 | addSpace = ""; | ||
| 169 | debug(pair.second); | ||
| 170 | } | ||
| 171 | else if (pair.first == "groupCollapse") { | ||
| 172 | tmp = pair.second; | ||
| 173 | int count = 0; | ||
| 174 | addSpace = collapseCount == 0 ? "\t" : " "; | ||
| 175 | while (count<collapseCount) { | ||
| 176 | addSpace += '\t\t'; | ||
| 177 | count++; | ||
| 178 | } | ||
| 179 | collapseCount++; | ||
| 180 | pair.second = addSpace + pair.second; | ||
| 181 | debug(pair.second); | ||
| 182 | } | ||
| 183 | else { | ||
| 184 | if (pair.first == tmp) { | ||
| 185 | pair.second = addSpace + pair.second; | ||
| 186 | debug(pair.second); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | } | ||
| 190 | addSpace = ""; | ||
| 191 | tmp = ""; | ||
| 192 | collapseCount = 0; | ||
| 193 | listgrp.clear(); | ||
| 194 | } | ||