History

Started group functions.

NeetBhagat committed 9 years ago

Commit dd913461 parent ead0d422 files · +71 −1Browse files

Showing the changes to libraries/script-engine/src/ConsoleScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/ConsoleScriptingInterface.cpp+63−1
@@ -22,7 +22,10 @@ void ConsoleScriptingInterface::info(QString message) { · 21 unmodified lines
2222 }
2323 }
2424
25−void ConsoleScriptingInterface::log(QString message) {
25+void ConsoleScriptingInterface::log(QString message) {
26+ /*if (!listgrp.isEmpty()){
27+ listgrp.append(qMakePair(currentGroupSelection, message));
28+ }*/
2629 if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) {
2730 scriptEngine->scriptPrintedMessage(message);
2831 }
@@ -130,3 +133,62 @@ void ConsoleScriptingInterface::clear() { · 101 unmodified lines
130133 scriptEngine->clearConsole();
131134 }
132135 }
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+}