diff --git a/src/backend/logger.h b/src/backend/logger.h index 844f2dc084299cd535abc27c073f0ec76ec5d5ae..4b86db7ad2ce7d84e8d9fd8ee7a34a842c227b75 100644 --- a/src/backend/logger.h +++ b/src/backend/logger.h @@ -7,6 +7,18 @@ #ifdef Q_OS_ANDROID #include <android/log.h> +#else +enum android_LogPriority { + ANDROID_LOG_UNKNOWN = 0, + ANDROID_LOG_DEFAULT, + ANDROID_LOG_VERBOSE, + ANDROID_LOG_DEBUG, + ANDROID_LOG_INFO, + ANDROID_LOG_WARN, + ANDROID_LOG_ERROR, + ANDROID_LOG_FATAL, + ANDROID_LOG_SILENT, +}; #endif class Logger : public QObject @@ -30,28 +42,35 @@ public: const char *file = context.file ? context.file : ""; const char *function = context.function ? context.function : ""; + enum android_LogPriority logPriority; + switch (type) { case QtDebugMsg: logPrefix = QStringLiteral("Debug: "); + logPriority = ANDROID_LOG_DEBUG; break; case QtInfoMsg: logPrefix = QStringLiteral("Info: "); + logPriority = ANDROID_LOG_INFO; break; case QtWarningMsg: logPrefix = QStringLiteral("Warning: "); + logPriority = ANDROID_LOG_WARN; break; case QtCriticalMsg: logPrefix = QStringLiteral("Critical: "); + logPriority = ANDROID_LOG_ERROR; break; case QtFatalMsg: logPrefix = QStringLiteral("Fatal: "); logSuffix = QStringLiteral(" (%1:%2, %3)").arg(file).arg(context.line).arg(function); + logPriority = ANDROID_LOG_FATAL; break; } newLog += logPrefix + localMsg + logSuffix + "\n"; #ifdef Q_OS_ANDROID - __android_log_print(ANDROID_LOG_DEBUG, "Qt_UI_Viewer", "%s", qPrintable(newLog)); + __android_log_print(logPriority, "Qt_UI_Viewer", "%s", qPrintable(newLog)); #else fprintf(stderr, "%s", qPrintable(newLog)); #endif diff --git a/src/backend/projectmanager.cpp b/src/backend/projectmanager.cpp index 90a1e042850a368fdbb0499a1587e8f64ec0c178..44d6ea5bfd9931d2abd0058b72ed81bd80e009c1 100644 --- a/src/backend/projectmanager.cpp +++ b/src/backend/projectmanager.cpp @@ -255,15 +255,6 @@ bool ProjectManager::runProjectInternal(const QByteArray &project) m_qmlEngine->addImportPath(importPath); } - QObject::connect(m_qmlEngine.data(), - &QQmlEngine::warnings, - this, - [&](const QList<QQmlError> &warnings) { - for (const auto &warning : warnings) { - qWarning() << warning.toString(); - } - }); - qDebug() << "Loading mainQmlUrl: " << mainQmlUrl.toString(); m_qmlComponent.reset(new QQmlComponent(m_qmlEngine.data()));