diff options
-rw-r--r-- | subsurface-desktop-main.cpp | 49 | ||||
-rw-r--r-- | subsurface-helper.cpp | 2 | ||||
-rw-r--r-- | subsurface-mobile-main.cpp | 25 |
3 files changed, 41 insertions, 35 deletions
diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index 8cb6ffa50..5ccd9951c 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -2,28 +2,28 @@ /* main.c */ #include <locale.h> #include <stdio.h> -#include <string.h> #include <stdlib.h> +#include <string.h> #include <time.h> +#include "core/color.h" +#include "core/downloadfromdcthread.h" // for fill_computer_list #include "core/qt-gui.h" +#include "core/qthelper.h" #include "core/subsurfacestartup.h" +#include "desktop-widgets/diveplanner.h" #include "desktop-widgets/mainwindow.h" +#include "desktop-widgets/preferences/preferencesdialog.h" #include "desktop-widgets/tab-widgets/maintab.h" #include "profile-widget/profilewidget2.h" -#include "desktop-widgets/preferences/preferencesdialog.h" -#include "desktop-widgets/diveplanner.h" -#include "core/color.h" -#include "core/qthelper.h" -#include "core/downloadfromdcthread.h" // for fill_computer_list -#include <QStringList> #include <QApplication> #include <QLoggingCategory> -#include <QOpenGLContext> #include <QOffscreenSurface> +#include <QOpenGLContext> #include <QOpenGLFunctions> #include <QQuickWindow> +#include <QStringList> #include <git2.h> static bool filesOnCommandLine = false; @@ -127,7 +127,7 @@ bool haveFilesOnCommandLine() return filesOnCommandLine; } -#define VALIDATE_GL_PREFIX "validateGL(): " +#define VALIDATE_GL_PREFIX "validateGL(): " void validateGL() { @@ -138,8 +138,10 @@ void validateGL() */ if (!quickBackend.isEmpty()) { if (verbose) { - qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "'QT_QUICK_BACKEND' is set to '%1'. " - "Skipping validation.").arg(quickBackend); + qDebug() << QStringLiteral(VALIDATE_GL_PREFIX + "'QT_QUICK_BACKEND' is set to '%1'. " + "Skipping validation.") + .arg(quickBackend); } return; } @@ -171,12 +173,13 @@ void validateGL() if (verChar) { // detect GLES, show a warning and return early as we don't handle it's versioning if (strstr(verChar, " ES ") != NULL) { - qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: Detected OpenGL ES!\n" - "Attempting to run with the available profile!\n" - "If this fails try manually setting the environment variable\n" - "'QT_QUICK_BACKEND' with the value of 'software'\n" - "before running Subsurface!\n"); - return; + qWarning() << QStringLiteral(VALIDATE_GL_PREFIX + "WARNING: Detected OpenGL ES!\n" + "Attempting to run with the available profile!\n" + "If this fails try manually setting the environment variable\n" + "'QT_QUICK_BACKEND' with the value of 'software'\n" + "before running Subsurface!\n"); + return; } int min, maj; if (sscanf(verChar, "%d.%d", &maj, &min) == 2) { @@ -205,10 +208,12 @@ exit: surface.destroy(); if (glError) { #if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) - qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "ERROR: %1.\n" - "Cannot automatically fallback to a software renderer!\n" - "Set the environment variable 'QT_QUICK_BACKEND' with the value of 'software'\n" - "before running Subsurface!\n").arg(glError); + qWarning() << QStringLiteral(VALIDATE_GL_PREFIX + "ERROR: %1.\n" + "Cannot automatically fallback to a software renderer!\n" + "Set the environment variable 'QT_QUICK_BACKEND' with the value of 'software'\n" + "before running Subsurface!\n") + .arg(glError); exit(0); #else qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError); @@ -218,7 +223,7 @@ exit: } // install this message handler primarily so that the Windows build can log to files -void messageHandler(QtMsgType type, const QMessageLogContext&, const QString &msg) +void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg) { QByteArray localMsg = msg.toUtf8(); switch (type) { diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index 42fc075d2..e55425abf 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -74,7 +74,7 @@ void run_ui() // To work around this we need to manually copy the components at install time // to Contents/Frameworks/qml and make sure that we add the correct import path QStringList importPathList = engine.importPathList(); - Q_FOREACH(QString importPath, importPathList) { + Q_FOREACH (QString importPath, importPathList) { if (importPath.contains("MacOS")) engine.addImportPath(importPath.replace("MacOS", "Frameworks")); } diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp index 91bfd65d9..d62314e14 100644 --- a/subsurface-mobile-main.cpp +++ b/subsurface-mobile-main.cpp @@ -2,20 +2,20 @@ /* main.c */ #include <locale.h> #include <stdio.h> -#include <string.h> #include <stdlib.h> +#include <string.h> #include <time.h> -#include "core/qt-gui.h" -#include "core/subsurfacestartup.h" #include "core/color.h" -#include "core/qthelper.h" #include "core/downloadfromdcthread.h" +#include "core/qt-gui.h" +#include "core/qthelper.h" +#include "core/subsurfacestartup.h" -#include <QStringList> #include <QApplication> -#include <QLoggingCategory> #include <QLocale> +#include <QLoggingCategory> +#include <QStringList> #include <git2.h> // Implementation of STP logging @@ -38,11 +38,11 @@ void log_stp(const char *ident, QString *buf) stpDuration.start(); } if (ident) - stpText += QString("STP ") \ - .append(QString::number(stpDuration.elapsed())) \ - .append(" ms, ") \ - .append(ident) \ - .append("\n"); + stpText += QString("STP ") + .append(QString::number(stpDuration.elapsed())) + .append(" ms, ") + .append(ident) + .append("\n"); if (buf) { *buf += "---------- startup timer ----------\n"; *buf += stpText; @@ -115,7 +115,8 @@ int main(int argc, char **argv) return 0; } -void set_non_bt_addresses() { +void set_non_bt_addresses() +{ #if defined(Q_OS_ANDROID) connectionListModel.addAddress("FTDI"); #elif defined(Q_OS_LINUX) // since this is in the else, it does NOT include Android |