mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 07:50:04 +02:00
Merge pull request #9251 from ZappoMan/removeLogSpam
debug window enhancements
This commit is contained in:
commit
c6be02dc40
2 changed files with 29 additions and 4 deletions
|
@ -704,6 +704,15 @@ Menu::Menu() {
|
||||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
||||||
qApp, SLOT(toggleLogDialog()));
|
qApp, SLOT(toggleLogDialog()));
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...");
|
||||||
|
connect(action, &QAction::triggered, [] {
|
||||||
|
auto scriptEngines = DependencyManager::get<ScriptEngines>();
|
||||||
|
QUrl defaultScriptsLoc = defaultScriptsLocation();
|
||||||
|
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/debugging/debugWindow.js");
|
||||||
|
scriptEngines->loadScript(defaultScriptsLoc.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Developer > Stats
|
// Developer > Stats
|
||||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats);
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
// Set up the qml ui
|
// Set up the qml ui
|
||||||
var qml = Script.resolvePath('debugWindow.qml');
|
var qml = Script.resolvePath('debugWindow.qml');
|
||||||
|
@ -19,18 +20,33 @@ var window = new OverlayWindow({
|
||||||
window.setPosition(25, 50);
|
window.setPosition(25, 50);
|
||||||
window.closed.connect(function() { Script.stop(); });
|
window.closed.connect(function() { Script.stop(); });
|
||||||
|
|
||||||
|
var getFormattedDate = function() {
|
||||||
|
var date = new Date();
|
||||||
|
return date.getMonth() + "/" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||||
|
};
|
||||||
|
|
||||||
|
var sendToLogWindow = function(type, message, scriptFileName) {
|
||||||
|
var typeFormatted = "";
|
||||||
|
if (type) {
|
||||||
|
typeFormatted = type + " - ";
|
||||||
|
}
|
||||||
|
window.sendToQml("[" + getFormattedDate() + "] " + "[" + scriptFileName + "] " + typeFormatted + message);
|
||||||
|
};
|
||||||
|
|
||||||
ScriptDiscoveryService.printedMessage.connect(function(message, scriptFileName) {
|
ScriptDiscoveryService.printedMessage.connect(function(message, scriptFileName) {
|
||||||
window.sendToQml("[" + scriptFileName + "] " + message);
|
sendToLogWindow("", message, scriptFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
ScriptDiscoveryService.warningMessage.connect(function(message, scriptFileName) {
|
ScriptDiscoveryService.warningMessage.connect(function(message, scriptFileName) {
|
||||||
window.sendToQml("[" + scriptFileName + "] WARNING - " + message);
|
sendToLogWindow("WARNING", message, scriptFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
ScriptDiscoveryService.errorMessage.connect(function(message, scriptFileName) {
|
ScriptDiscoveryService.errorMessage.connect(function(message, scriptFileName) {
|
||||||
window.sendToQml("[" + scriptFileName + "] ERROR - " + message);
|
sendToLogWindow("ERROR", message, scriptFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
ScriptDiscoveryService.infoMessage.connect(function(message, scriptFileName) {
|
ScriptDiscoveryService.infoMessage.connect(function(message, scriptFileName) {
|
||||||
window.sendToQml("[" + scriptFileName + "] INFO - " + message);
|
sendToLogWindow("INFO", message, scriptFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}()); // END LOCAL_SCOPE
|
Loading…
Reference in a new issue