Showing the changes to libraries/script-engine/src/ConsoleScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -23,15 +23,12 @@ void ConsoleScriptingInterface::info(QString message) { · 22 unmodified lines | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | void ConsoleScriptingInterface::log(QString message) { |
| 26 | − /*if (!listgrp.isEmpty()){ | |
| 27 | − listgrp.append(qMakePair(currentGroupSelection, message)); | |
| 28 | − }*/ | |
| 29 | − /*_listOfGroupData.append(qMakePair(_selectedGroup, message)); | |
| 30 | − if (!_listOfGroupData.isEmpty()) { | |
| 31 | − showdata(_selectedGroup, message); | |
| 32 | − }*/ | |
| 33 | − if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) { | |
| 34 | − scriptEngine->scriptPrintedMessage(message); | |
| 26 | + if (_isGroupEnd) { | |
| 27 | + if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) { | |
| 28 | + scriptEngine->scriptPrintedMessage(message); | |
| 29 | + } | |
| 30 | + } else { | |
| 31 | + consoleGroupLog(_selectedGroup, message); | |
| 35 | 32 | } |
| 36 | 33 | } |
| 37 | 34 | |
| @@ -142,62 +139,51 @@ void ConsoleScriptingInterface::clear() { · 104 unmodified lines | ||
| 142 | 139 | } |
| 143 | 140 | |
| 144 | 141 | void ConsoleScriptingInterface::group(QString groupName) { |
| 145 | − _listOfGroupData.append(qMakePair(GROUP, groupName)); | |
| 146 | 142 | _selectedGroup = groupName; |
| 147 | − showdata(GROUP, groupName); | |
| 143 | + consoleGroupLog(GROUP, groupName); | |
| 148 | 144 | } |
| 149 | 145 | |
| 150 | 146 | void ConsoleScriptingInterface::groupCollapsed(QString groupName) { |
| 151 | − _listOfGroupData.append(qMakePair(GROUPCOLLAPSED, groupName)); | |
| 152 | 147 | _selectedGroup = groupName; |
| 153 | − showdata(GROUPCOLLAPSED, groupName); | |
| 154 | −} | |
| 155 | − | |
| 156 | −void ConsoleScriptingInterface::consoleLog(QString message) { | |
| 157 | − _listOfGroupData.append(qMakePair(_selectedGroup, message)); | |
| 158 | − if (!_listOfGroupData.isEmpty()) { | |
| 159 | − showdata(_selectedGroup, message); | |
| 160 | − } | |
| 148 | + consoleGroupLog(GROUPCOLLAPSED, groupName); | |
| 161 | 149 | } |
| 162 | 150 | |
| 163 | 151 | void ConsoleScriptingInterface::groupEnd() { |
| 164 | − _listOfGroupData.append(qMakePair(_selectedGroup, GROUPEND)); | |
| 165 | − showdata(_selectedGroup, GROUPEND); | |
| 152 | + consoleGroupLog(_selectedGroup, GROUPEND); | |
| 166 | 153 | } |
| 167 | 154 | |
| 168 | −void ConsoleScriptingInterface::showdata(QString currentGroup, QString groupName) { | |
| 155 | +void ConsoleScriptingInterface::consoleGroupLog(QString currentGroup, QString groupName) { | |
| 169 | 156 | QPair<QString, QString> groupData; |
| 170 | − QString firstGroupData; | |
| 171 | − | |
| 172 | − for (int index = 0; index<_listOfGroupData.count(); index++) { | |
| 173 | − groupData = _listOfGroupData.at(index); | |
| 174 | − firstGroupData = groupData.first; | |
| 175 | − if (groupData.first == GROUP || groupData.first == GROUPCOLLAPSED) { | |
| 176 | − firstGroupData = groupData.second; | |
| 177 | − if (_isSameLevel) { | |
| 178 | − _addSpace = _addSpace.mid(0, _addSpace.length() - 3); | |
| 179 | − } | |
| 180 | − _addSpace += " "; //add inner groupcollapsed | |
| 157 | + QString groupKeyName; | |
| 181 | 158 | |
| 182 | − if (groupData.first == GROUPCOLLAPSED) { | |
| 183 | − QString space = _addSpace.mid(0, _addSpace.length() - 1); | |
| 184 | − debug(space + groupData.second); | |
| 185 | − } else { | |
| 186 | − debug(_addSpace + groupData.second); | |
| 187 | − } | |
| 188 | − _isSameLevel = false; | |
| 189 | − } else if (groupData.second == GROUPEND) { | |
| 159 | + groupData = qMakePair(currentGroup, groupName); | |
| 160 | + groupKeyName = groupData.first; | |
| 161 | + if (groupData.first == GROUP || groupData.first == GROUPCOLLAPSED) { | |
| 162 | + groupKeyName = groupData.second; | |
| 163 | + if (_isSameLevel) { | |
| 190 | 164 | _addSpace = _addSpace.mid(0, _addSpace.length() - 3); |
| 165 | + } | |
| 166 | + if (_isGroupEnd) { | |
| 167 | + _addSpace = ""; | |
| 168 | + _isGroupEnd = false; | |
| 191 | 169 | } else { |
| 192 | − if (groupData.first == firstGroupData && groupData.first != GROUPCOLLAPSED && groupData.first != GROUP && groupData.second != GROUPEND) { | |
| 193 | − if (!_isSameLevel) { | |
| 194 | − _addSpace += " "; //2 space inner element | |
| 195 | − _isSameLevel = true; //same level log entry | |
| 196 | − } | |
| 197 | − debug(_addSpace + groupData.second); | |
| 170 | + _addSpace += " "; | |
| 171 | + } | |
| 172 | + debug(_addSpace.mid(0, _addSpace.length() - 1) + groupData.second); | |
| 173 | + _isSameLevel = false; | |
| 174 | + } else { | |
| 175 | + if (groupData.first == groupKeyName && groupData.first != GROUPCOLLAPSED && groupData.first != GROUP && groupData.second != GROUPEND) { | |
| 176 | + if (!_isSameLevel) { | |
| 177 | + _addSpace += " "; //space inner element | |
| 178 | + _isSameLevel = true; //same level log entry | |
| 198 | 179 | } |
| 180 | + debug(_addSpace + groupData.second); | |
| 181 | + } | |
| 182 | + } | |
| 183 | + if (groupData.second == GROUPEND) { | |
| 184 | + _addSpace = _addSpace.mid(0, _addSpace.length() - 3); | |
| 185 | + if (_addSpace.length() == 0) { | |
| 186 | + _isGroupEnd = true; | |
| 199 | 187 | } |
| 200 | 188 | } |
| 201 | − _listOfGroupData.removeOne(qMakePair(currentGroup, groupName)); | |
| 202 | − | |
| 203 | 189 | } |