diff --git a/export-html.cpp b/export-html.cpp
index 48c257c05..724745a40 100644
--- a/export-html.cpp
+++ b/export-html.cpp
@@ -4,7 +4,6 @@
#include
#include
#include
-#include
#include "core/qt-gui.h"
#include "core/qthelper.h"
@@ -43,12 +42,12 @@ int main(int argc, char **argv)
QString output = parser.value(outputDirectoryOption);
if (source.isEmpty() || output.isEmpty()) {
- qDebug() << "need --source and --output";
+ report_info("need --source and --output");
exit(1);
}
int ret = parse_file(qPrintable(source), &divelog);
if (ret) {
- fprintf(stderr, "parse_file returned %d\n", ret);
+ report_info("parse_file returned %d", ret);
exit(1);
}
diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp
index 835258b74..baf53aab6 100644
--- a/subsurface-desktop-main.cpp
+++ b/subsurface-desktop-main.cpp
@@ -123,11 +123,11 @@ int main(int argc, char **argv)
void validateGL()
{
- QString quickBackend = qgetenv("QT_QUICK_BACKEND");
+ std::string quickBackend = qgetenv("QT_QUICK_BACKEND").toStdString();
/* on macOS with Qt6 (maybe others), things only work with the software backend */
#if defined(Q_OS_MACOS) && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
- if (quickBackend.isEmpty()) {
- quickBackend = QStringLiteral("software");
+ if (quickBackend.empty()) {
+ quickBackend = "software";
qputenv("QT_QUICK_BACKEND", "software");
}
#endif
@@ -135,12 +135,11 @@ void validateGL()
* only validate OpenGL; for everything else print out and return.
* https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations.html
*/
- if (!quickBackend.isEmpty()) {
+ if (!quickBackend.empty()) {
if (verbose) {
- qDebug() << QStringLiteral(VALIDATE_GL_PREFIX
- "'QT_QUICK_BACKEND' is set to '%1'. "
- "Skipping validation.")
- .arg(quickBackend);
+ report_info(VALIDATE_GL_PREFIX
+ "'QT_QUICK_BACKEND' is set to '%s'. "
+ "Skipping validation.", quickBackend.c_str());
}
return;
}
@@ -158,7 +157,7 @@ void validateGL()
goto exit;
}
if (verbose)
- qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "created OpenGLContext.");
+ report_info(VALIDATE_GL_PREFIX "created OpenGLContext.");
ctx.makeCurrent(&surface);
func = ctx.functions();
if (!func) {
@@ -166,18 +165,18 @@ void validateGL()
goto exit;
}
if (verbose)
- qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "obtained QOpenGLFunctions.");
+ report_info(VALIDATE_GL_PREFIX "obtained QOpenGLFunctions.");
// detect version for legacy profiles
verChar = (const char *)func->glGetString(GL_VERSION);
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");
+ report_error(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;
@@ -196,7 +195,7 @@ void validateGL()
goto exit;
}
if (verbose)
- qDebug() << QStringLiteral(VALIDATE_GL_PREFIX "detected OpenGL version %1.%2.").arg(verMajor).arg(verMinor);
+ report_info(VALIDATE_GL_PREFIX "detected OpenGL version %d.%d.", verMajor, verMinor);
if (verMajor * 10 + verMinor < 21) { // set 2.1 as the minimal version
glError = "OpenGL 2.1 or later is required";
goto exit;
@@ -206,7 +205,7 @@ exit:
ctx.makeCurrent(NULL);
surface.destroy();
if (glError) {
- qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError);
+ report_error(VALIDATE_GL_PREFIX "WARNING: %s. Using a software renderer!", glError);
QQuickWindow::setSceneGraphBackend("software");
}
}
diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp
index cc9f95a11..020bf1f8a 100644
--- a/subsurface-mobile-main.cpp
+++ b/subsurface-mobile-main.cpp
@@ -33,7 +33,6 @@
int main(int argc, char **argv)
{
- int i;
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
@@ -45,7 +44,7 @@ int main(int argc, char **argv)
subsurface_console_init();
- for (i = 1; i < arguments.length(); i++) {
+ for (int i = 1; i < arguments.length(); i++) {
QString a = arguments.at(i);
if (!a.isEmpty() && a.at(0) == '-') {
parse_argument(qPrintable(a));