From 00c0f94d8c8623aa97f3f5c44a79bd8e53c8fd94 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 25 Jul 2018 18:36:40 -0700 Subject: [PATCH] Whitespace cleanup main/helper files Again, entirely script based. Signed-off-by: Dirk Hohndel --- subsurface-desktop-main.cpp | 49 ++++++++++++++++++++----------------- subsurface-helper.cpp | 2 +- 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 #include -#include #include +#include #include +#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 #include #include -#include #include +#include #include #include +#include #include 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 #include -#include #include +#include #include -#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 #include -#include #include +#include +#include #include // 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