mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:24:02 +02:00
Update group functionality by removing consoleLog method from consoleScriptingInterfaceClass.
This commit is contained in:
parent
e6a5930365
commit
71bff04ce0
2 changed files with 39 additions and 54 deletions
|
@ -23,15 +23,12 @@ void ConsoleScriptingInterface::info(QString message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleScriptingInterface::log(QString message) {
|
void ConsoleScriptingInterface::log(QString message) {
|
||||||
/*if (!listgrp.isEmpty()){
|
if (_isGroupEnd) {
|
||||||
listgrp.append(qMakePair(currentGroupSelection, message));
|
if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) {
|
||||||
}*/
|
scriptEngine->scriptPrintedMessage(message);
|
||||||
/*_listOfGroupData.append(qMakePair(_selectedGroup, message));
|
}
|
||||||
if (!_listOfGroupData.isEmpty()) {
|
} else {
|
||||||
showdata(_selectedGroup, message);
|
consoleGroupLog(_selectedGroup, message);
|
||||||
}*/
|
|
||||||
if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) {
|
|
||||||
scriptEngine->scriptPrintedMessage(message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,62 +139,51 @@ void ConsoleScriptingInterface::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleScriptingInterface::group(QString groupName) {
|
void ConsoleScriptingInterface::group(QString groupName) {
|
||||||
_listOfGroupData.append(qMakePair(GROUP, groupName));
|
|
||||||
_selectedGroup = groupName;
|
_selectedGroup = groupName;
|
||||||
showdata(GROUP, groupName);
|
consoleGroupLog(GROUP, groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleScriptingInterface::groupCollapsed(QString groupName) {
|
void ConsoleScriptingInterface::groupCollapsed(QString groupName) {
|
||||||
_listOfGroupData.append(qMakePair(GROUPCOLLAPSED, groupName));
|
|
||||||
_selectedGroup = groupName;
|
_selectedGroup = groupName;
|
||||||
showdata(GROUPCOLLAPSED, groupName);
|
consoleGroupLog(GROUPCOLLAPSED, groupName);
|
||||||
}
|
|
||||||
|
|
||||||
void ConsoleScriptingInterface::consoleLog(QString message) {
|
|
||||||
_listOfGroupData.append(qMakePair(_selectedGroup, message));
|
|
||||||
if (!_listOfGroupData.isEmpty()) {
|
|
||||||
showdata(_selectedGroup, message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleScriptingInterface::groupEnd() {
|
void ConsoleScriptingInterface::groupEnd() {
|
||||||
_listOfGroupData.append(qMakePair(_selectedGroup, GROUPEND));
|
consoleGroupLog(_selectedGroup, GROUPEND);
|
||||||
showdata(_selectedGroup, GROUPEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleScriptingInterface::showdata(QString currentGroup, QString groupName) {
|
void ConsoleScriptingInterface::consoleGroupLog(QString currentGroup, QString groupName) {
|
||||||
QPair<QString, QString> groupData;
|
QPair<QString, QString> groupData;
|
||||||
QString firstGroupData;
|
QString groupKeyName;
|
||||||
|
|
||||||
for (int index = 0; index<_listOfGroupData.count(); index++) {
|
groupData = qMakePair(currentGroup, groupName);
|
||||||
groupData = _listOfGroupData.at(index);
|
groupKeyName = groupData.first;
|
||||||
firstGroupData = groupData.first;
|
if (groupData.first == GROUP || groupData.first == GROUPCOLLAPSED) {
|
||||||
if (groupData.first == GROUP || groupData.first == GROUPCOLLAPSED) {
|
groupKeyName = groupData.second;
|
||||||
firstGroupData = groupData.second;
|
if (_isSameLevel) {
|
||||||
if (_isSameLevel) {
|
|
||||||
_addSpace = _addSpace.mid(0, _addSpace.length() - 3);
|
|
||||||
}
|
|
||||||
_addSpace += " "; //add inner groupcollapsed
|
|
||||||
|
|
||||||
if (groupData.first == GROUPCOLLAPSED) {
|
|
||||||
QString space = _addSpace.mid(0, _addSpace.length() - 1);
|
|
||||||
debug(space + groupData.second);
|
|
||||||
} else {
|
|
||||||
debug(_addSpace + groupData.second);
|
|
||||||
}
|
|
||||||
_isSameLevel = false;
|
|
||||||
} else if (groupData.second == GROUPEND) {
|
|
||||||
_addSpace = _addSpace.mid(0, _addSpace.length() - 3);
|
_addSpace = _addSpace.mid(0, _addSpace.length() - 3);
|
||||||
|
}
|
||||||
|
if (_isGroupEnd) {
|
||||||
|
_addSpace = "";
|
||||||
|
_isGroupEnd = false;
|
||||||
} else {
|
} else {
|
||||||
if (groupData.first == firstGroupData && groupData.first != GROUPCOLLAPSED && groupData.first != GROUP && groupData.second != GROUPEND) {
|
_addSpace += " ";
|
||||||
if (!_isSameLevel) {
|
}
|
||||||
_addSpace += " "; //2 space inner element
|
debug(_addSpace.mid(0, _addSpace.length() - 1) + groupData.second);
|
||||||
_isSameLevel = true; //same level log entry
|
_isSameLevel = false;
|
||||||
}
|
} else {
|
||||||
debug(_addSpace + groupData.second);
|
if (groupData.first == groupKeyName && groupData.first != GROUPCOLLAPSED && groupData.first != GROUP && groupData.second != GROUPEND) {
|
||||||
|
if (!_isSameLevel) {
|
||||||
|
_addSpace += " "; //space inner element
|
||||||
|
_isSameLevel = true; //same level log entry
|
||||||
}
|
}
|
||||||
|
debug(_addSpace + groupData.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupData.second == GROUPEND) {
|
||||||
|
_addSpace = _addSpace.mid(0, _addSpace.length() - 3);
|
||||||
|
if (_addSpace.length() == 0) {
|
||||||
|
_isGroupEnd = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_listOfGroupData.removeOne(qMakePair(currentGroup, groupName));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,8 @@ public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void group(QString groupName);
|
void group(QString groupName);
|
||||||
void groupCollapsed(QString groupName);
|
void groupCollapsed(QString groupName);
|
||||||
void groupEnd();
|
void groupEnd();
|
||||||
void consoleLog(QString message);
|
void consoleGroupLog(QString currentGroup, QString groupName);
|
||||||
void showdata(QString currentGroup, QString groupName);
|
|
||||||
public:
|
public:
|
||||||
QString secondsToString(qint64 seconds);
|
QString secondsToString(qint64 seconds);
|
||||||
bool isInteger(const std::string & s);
|
bool isInteger(const std::string & s);
|
||||||
|
@ -58,7 +57,7 @@ private:
|
||||||
const QString GROUPEND = "groupEnd";
|
const QString GROUPEND = "groupEnd";
|
||||||
bool _isSameLevel = false;
|
bool _isSameLevel = false;
|
||||||
QString _addSpace = "";
|
QString _addSpace = "";
|
||||||
QList<QPair<QString, QString> > _listOfGroupData;
|
bool _isGroupEnd = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ConsoleScriptingInterface_h
|
#endif // hifi_ConsoleScriptingInterface_h
|
||||||
|
|
Loading…
Reference in a new issue