mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Whitespace cleanup main/helper files
Again, entirely script based. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
afe7e847d6
commit
00c0f94d8c
3 changed files with 41 additions and 35 deletions
|
@ -2,28 +2,28 @@
|
||||||
/* main.c */
|
/* main.c */
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "core/color.h"
|
||||||
|
#include "core/downloadfromdcthread.h" // for fill_computer_list
|
||||||
#include "core/qt-gui.h"
|
#include "core/qt-gui.h"
|
||||||
|
#include "core/qthelper.h"
|
||||||
#include "core/subsurfacestartup.h"
|
#include "core/subsurfacestartup.h"
|
||||||
|
#include "desktop-widgets/diveplanner.h"
|
||||||
#include "desktop-widgets/mainwindow.h"
|
#include "desktop-widgets/mainwindow.h"
|
||||||
|
#include "desktop-widgets/preferences/preferencesdialog.h"
|
||||||
#include "desktop-widgets/tab-widgets/maintab.h"
|
#include "desktop-widgets/tab-widgets/maintab.h"
|
||||||
#include "profile-widget/profilewidget2.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 <QApplication>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QOpenGLContext>
|
|
||||||
#include <QOffscreenSurface>
|
#include <QOffscreenSurface>
|
||||||
|
#include <QOpenGLContext>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
#include <QStringList>
|
||||||
#include <git2.h>
|
#include <git2.h>
|
||||||
|
|
||||||
static bool filesOnCommandLine = false;
|
static bool filesOnCommandLine = false;
|
||||||
|
@ -127,7 +127,7 @@ bool haveFilesOnCommandLine()
|
||||||
return filesOnCommandLine;
|
return filesOnCommandLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VALIDATE_GL_PREFIX "validateGL(): "
|
#define VALIDATE_GL_PREFIX "validateGL(): "
|
||||||
|
|
||||||
void validateGL()
|
void validateGL()
|
||||||
{
|
{
|
||||||
|
@ -138,8 +138,10 @@ void validateGL()
|
||||||
*/
|
*/
|
||||||
if (!quickBackend.isEmpty()) {
|
if (!quickBackend.isEmpty()) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "'QT_QUICK_BACKEND' is set to '%1'. "
|
qDebug() << QStringLiteral(VALIDATE_GL_PREFIX
|
||||||
"Skipping validation.").arg(quickBackend);
|
"'QT_QUICK_BACKEND' is set to '%1'. "
|
||||||
|
"Skipping validation.")
|
||||||
|
.arg(quickBackend);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -171,12 +173,13 @@ void validateGL()
|
||||||
if (verChar) {
|
if (verChar) {
|
||||||
// detect GLES, show a warning and return early as we don't handle it's versioning
|
// detect GLES, show a warning and return early as we don't handle it's versioning
|
||||||
if (strstr(verChar, " ES ") != NULL) {
|
if (strstr(verChar, " ES ") != NULL) {
|
||||||
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: Detected OpenGL ES!\n"
|
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX
|
||||||
"Attempting to run with the available profile!\n"
|
"WARNING: Detected OpenGL ES!\n"
|
||||||
"If this fails try manually setting the environment variable\n"
|
"Attempting to run with the available profile!\n"
|
||||||
"'QT_QUICK_BACKEND' with the value of 'software'\n"
|
"If this fails try manually setting the environment variable\n"
|
||||||
"before running Subsurface!\n");
|
"'QT_QUICK_BACKEND' with the value of 'software'\n"
|
||||||
return;
|
"before running Subsurface!\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
int min, maj;
|
int min, maj;
|
||||||
if (sscanf(verChar, "%d.%d", &maj, &min) == 2) {
|
if (sscanf(verChar, "%d.%d", &maj, &min) == 2) {
|
||||||
|
@ -205,10 +208,12 @@ exit:
|
||||||
surface.destroy();
|
surface.destroy();
|
||||||
if (glError) {
|
if (glError) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||||
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "ERROR: %1.\n"
|
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX
|
||||||
"Cannot automatically fallback to a software renderer!\n"
|
"ERROR: %1.\n"
|
||||||
"Set the environment variable 'QT_QUICK_BACKEND' with the value of 'software'\n"
|
"Cannot automatically fallback to a software renderer!\n"
|
||||||
"before running Subsurface!\n").arg(glError);
|
"Set the environment variable 'QT_QUICK_BACKEND' with the value of 'software'\n"
|
||||||
|
"before running Subsurface!\n")
|
||||||
|
.arg(glError);
|
||||||
exit(0);
|
exit(0);
|
||||||
#else
|
#else
|
||||||
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError);
|
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
|
// 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();
|
QByteArray localMsg = msg.toUtf8();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ void run_ui()
|
||||||
// To work around this we need to manually copy the components at install time
|
// 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
|
// to Contents/Frameworks/qml and make sure that we add the correct import path
|
||||||
QStringList importPathList = engine.importPathList();
|
QStringList importPathList = engine.importPathList();
|
||||||
Q_FOREACH(QString importPath, importPathList) {
|
Q_FOREACH (QString importPath, importPathList) {
|
||||||
if (importPath.contains("MacOS"))
|
if (importPath.contains("MacOS"))
|
||||||
engine.addImportPath(importPath.replace("MacOS", "Frameworks"));
|
engine.addImportPath(importPath.replace("MacOS", "Frameworks"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,20 +2,20 @@
|
||||||
/* main.c */
|
/* main.c */
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "core/qt-gui.h"
|
|
||||||
#include "core/subsurfacestartup.h"
|
|
||||||
#include "core/color.h"
|
#include "core/color.h"
|
||||||
#include "core/qthelper.h"
|
|
||||||
#include "core/downloadfromdcthread.h"
|
#include "core/downloadfromdcthread.h"
|
||||||
|
#include "core/qt-gui.h"
|
||||||
|
#include "core/qthelper.h"
|
||||||
|
#include "core/subsurfacestartup.h"
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QStringList>
|
||||||
#include <git2.h>
|
#include <git2.h>
|
||||||
|
|
||||||
// Implementation of STP logging
|
// Implementation of STP logging
|
||||||
|
@ -38,11 +38,11 @@ void log_stp(const char *ident, QString *buf)
|
||||||
stpDuration.start();
|
stpDuration.start();
|
||||||
}
|
}
|
||||||
if (ident)
|
if (ident)
|
||||||
stpText += QString("STP ") \
|
stpText += QString("STP ")
|
||||||
.append(QString::number(stpDuration.elapsed())) \
|
.append(QString::number(stpDuration.elapsed()))
|
||||||
.append(" ms, ") \
|
.append(" ms, ")
|
||||||
.append(ident) \
|
.append(ident)
|
||||||
.append("\n");
|
.append("\n");
|
||||||
if (buf) {
|
if (buf) {
|
||||||
*buf += "---------- startup timer ----------\n";
|
*buf += "---------- startup timer ----------\n";
|
||||||
*buf += stpText;
|
*buf += stpText;
|
||||||
|
@ -115,7 +115,8 @@ int main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_non_bt_addresses() {
|
void set_non_bt_addresses()
|
||||||
|
{
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
connectionListModel.addAddress("FTDI");
|
connectionListModel.addAddress("FTDI");
|
||||||
#elif defined(Q_OS_LINUX) // since this is in the else, it does NOT include Android
|
#elif defined(Q_OS_LINUX) // since this is in the else, it does NOT include Android
|
||||||
|
|
Loading…
Reference in a new issue