From ac988968b3c214c357196c042451ea6566bf8829 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 2 Dec 2021 13:41:05 -0500 Subject: [PATCH] Add warn and error to script API --- include/mainwindow.h | 2 ++ src/mainwindow_scriptapi.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/mainwindow.h b/include/mainwindow.h index 8a2579fe..5fd80f18 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -121,6 +121,8 @@ public: Q_INVOKABLE void setTimeout(QJSValue callback, int milliseconds); void invokeCallback(QJSValue callback); Q_INVOKABLE void log(QString message); + Q_INVOKABLE void warn(QString message); + Q_INVOKABLE void error(QString message); Q_INVOKABLE QList getMetatileLayerOrder(); Q_INVOKABLE void setMetatileLayerOrder(QList order); Q_INVOKABLE QList getMetatileLayerOpacity(); diff --git a/src/mainwindow_scriptapi.cpp b/src/mainwindow_scriptapi.cpp index 3144794a..605fb155 100644 --- a/src/mainwindow_scriptapi.cpp +++ b/src/mainwindow_scriptapi.cpp @@ -651,6 +651,14 @@ void MainWindow::log(QString message) { logInfo(message); } +void MainWindow::warn(QString message) { + logWarn(message); +} + +void MainWindow::error(QString message) { + logError(message); +} + QList MainWindow::getMetatileLayerOrder() { if (!this->editor || !this->editor->map) return QList();