From b2e0f946c6be39a1cf6d1333bae53a4ba9d4d302 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Sun, 16 Nov 2025 23:17:18 +0100 Subject: [PATCH 01/14] Add logging categories to HiPS and StelProperties --- src/core/StelPropertyMgr.cpp | 9 ++++----- src/core/StelPropertyMgr.hpp | 12 ++++++++++++ src/core/modules/HipsMgr.cpp | 6 ++++-- src/core/modules/HipsMgr.hpp | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/core/StelPropertyMgr.cpp b/src/core/StelPropertyMgr.cpp index 97e441a76cfb3..ff3cf7d1ecaf8 100644 --- a/src/core/StelPropertyMgr.cpp +++ b/src/core/StelPropertyMgr.cpp @@ -2,6 +2,8 @@ #include #include +Q_LOGGING_CATEGORY(Property,"stel.Properties", QtInfoMsg) + StelProperty::StelProperty(const QString &id, QObject *target, const QMetaProperty& prop) : id(id), target(target), prop(prop) { @@ -120,10 +122,7 @@ StelProperty* StelPropertyMgr::getProperty(const QString &id, const bool noWarni void StelPropertyMgr::onStelPropChanged(const QVariant &val) { StelProperty* prop = qobject_cast(sender()); -#ifndef NDEBUG - if (qApp->property("verbose") == true) - qDebug()<<"StelProperty"<getId()<<"changed, value"<getId()<<"changed, value"< #include #include "StelApp.hpp" +#include + +Q_DECLARE_LOGGING_CATEGORY(Property) class StelProperty; @@ -31,6 +34,11 @@ class StelProperty; //! This is required for some connections such as in the UI. //! The intended use is to subclass this class and implement the onPropertyChanged() slot, //! re-emitting the "changed" event with a type-converted value. +//! +//! @note You can finetune the amount of Property-related messages in the logfile by configuring the logging category stel.Properties. +//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Properties.debug=true. +//! By default, only Info and more severe messages are displayed. + class StelPropertyProxy : public QObject { Q_OBJECT @@ -217,6 +225,10 @@ protected slots: //! @note Good candidates for a StelProperty are properties that do not change too often. This includes most settings //! configurable through the GUI. Bad examples are properties which potentially change very often (e.g. each frame), such as the //! current view vector, field of view etc. They may cause considerable overhead if used, and therefore should be avoided. +//! +//! @note For debugging, you can finetune the amount of messages written to the logfile. +//! In environment variable QT_LOGGING_RULES, set stel.Properties.debug=true to see property changes. +//! //! @sa StelPropertyMgr, StelDialog, StelAction class StelProperty : public QObject { diff --git a/src/core/modules/HipsMgr.cpp b/src/core/modules/HipsMgr.cpp index 2cacca9c859e5..c782af33842d8 100644 --- a/src/core/modules/HipsMgr.cpp +++ b/src/core/modules/HipsMgr.cpp @@ -29,6 +29,8 @@ #include #include +Q_LOGGING_CATEGORY(HiPS,"stel.HiPS", QtInfoMsg) + HipsMgr::HipsMgr() { setObjectName("HipsMgr"); @@ -167,7 +169,7 @@ void HipsMgr::init() void HipsMgr::restoreVisibleSurveys() { - //qDebug() << "HipsMgr::restoreVisibleSurveys()"; + qCDebug(HiPS) << "HipsMgr::restoreVisibleSurveys()"; QSettings* conf = StelApp::getInstance().getSettings(); conf->beginGroup("hips"); @@ -179,7 +181,7 @@ void HipsMgr::restoreVisibleSurveys() QString url = conf->value("url").toString(); if (!url.isEmpty()) { - // qDebug() << "HiPS: Restore visible survey:" << url; + qCDebug(HiPS) << "HiPS: Restore visible survey:" << url; HipsSurveyP survey=getSurveyByUrl(url); if (survey) survey->setVisible(true); diff --git a/src/core/modules/HipsMgr.hpp b/src/core/modules/HipsMgr.hpp index 0099a63b40e20..aa3523c839f03 100644 --- a/src/core/modules/HipsMgr.hpp +++ b/src/core/modules/HipsMgr.hpp @@ -22,8 +22,22 @@ #include "StelModule.hpp" #include "StelHips.hpp" +#include #include + +//! @class HiPSMgr +//! This class controls display of Hierarchical Progressive Surveys (HiPS), all-sky surveys in a particular format +//! defined by the International Virtual Observatory Alliance. A full description of the format can be found on the +//! IVOA website. (https://www.ivoa.net/documents/HiPS/20170519/REC-HIPS-1.0-20170519.pdf) +//! Stellarium supports only image-based surveys. +//! +//! @note You can finetune the amount of HiPS-related messages in the logfile by configuring the logging category stel.HiPS. +//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.HiPS.debug=true. +//! By default, only Info and more severe messages are displayed. + +Q_DECLARE_LOGGING_CATEGORY(HiPS) + class HipsMgr : public StelModule { Q_OBJECT From 574a9b287c3ecf7131b84bf0d4ea48eeff4540dc Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Mon, 17 Nov 2025 18:00:22 +0100 Subject: [PATCH 02/14] Add logging category stel.Media - CLI option --verbose no longer adds Multimedia messages --- guide/ch_advanced_use.tex | 2 +- src/core/StelAudioMgr.cpp | 23 +-- src/core/StelVideoMgr.cpp | 301 +++++++++++++++----------------------- src/core/StelVideoMgr.hpp | 9 +- 4 files changed, 139 insertions(+), 196 deletions(-) diff --git a/guide/ch_advanced_use.tex b/guide/ch_advanced_use.tex index ed5cf11d8340e..a44d4ecd49053 100644 --- a/guide/ch_advanced_use.tex +++ b/guide/ch_advanced_use.tex @@ -571,7 +571,7 @@ \section{Command Line Options} -\/-spout or -S & all or sky & Act as Spout sender (See section \ref{sec:CommandLineOptions:Special:Spout}).% \footnote{\label{FN:WinOnly}On Windows only}\textsuperscript{,}\footnote{This function requires running in OpenGL mode.}\\ -\/-spout-name & name & Use \texttt{name} as name of the Spout sender. Default name: \texttt{Stellarium}.\footref{FN:WinOnly}\\\midrule --\/-verbose & & Even more diagnostic output in logfile (esp.\ multimedia handling)\\ +-\/-verbose & & Even more diagnostic output in logfile (esp.\ location handling)\\ -\/-dump-opengl-details or -d & {[}none{]} & Dump information about OpenGL support to logfile. Use this is you have graphics problems and want to send a bug report. \\\midrule -\/-angle-mode or -a & {[}none{]} & Use ANGLE as OpenGL ES2 rendering engine (autodetect Direct3D version).\footref{FN:WinOnly}\textsuperscript{,}\footnote{\label{FN:Qt5only}Qt5-based Stellarium versions only}\\ diff --git a/src/core/StelAudioMgr.cpp b/src/core/StelAudioMgr.cpp index ae2bd27ec1208..99a348f5ae6eb 100644 --- a/src/core/StelAudioMgr.cpp +++ b/src/core/StelAudioMgr.cpp @@ -17,6 +17,7 @@ */ #include "StelAudioMgr.hpp" +#include "StelVideoMgr.hpp" #include #include @@ -53,13 +54,13 @@ void StelAudioMgr::loadSound(const QString& filename, const QString& id) { if (!enabled) { - qWarning() << "Not loading sound -- audio system disabled by configuration."; + qCWarning(Media) << "Not loading sound -- audio system disabled by configuration."; return; } if (audioObjects.contains(id)) { - qWarning() << "Audio object with ID" << id << "already exists, dropping it"; + qCWarning(Media) << "Audio object with ID" << id << "already exists, dropping it"; dropSound(id); } @@ -95,10 +96,10 @@ void StelAudioMgr::playSound(const QString& id) audioObjects[id]->play(); } else - qDebug() << "StelAudioMgr: Cannot play sound, " << id << "not correctly loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot play sound, " << id << "not correctly loaded."; } else - qDebug() << "StelAudioMgr: Cannot play sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot play sound, " << id << "not loaded."; } void StelAudioMgr::pauseSound(const QString& id) @@ -111,10 +112,10 @@ void StelAudioMgr::pauseSound(const QString& id) if (audioObjects[id]!=nullptr) audioObjects[id]->pause(); else - qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "not correctly loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot pause sound, " << id << "not correctly loaded."; } else - qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot pause sound, " << id << "not loaded."; } void StelAudioMgr::stopSound(const QString& id) @@ -127,10 +128,10 @@ void StelAudioMgr::stopSound(const QString& id) if (audioObjects[id]!=nullptr) audioObjects[id]->stop(); else - qDebug() << "StelAudioMgr: Cannot stop sound, " << id << "not correctly loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot stop sound, " << id << "not correctly loaded."; } else - qDebug() << "StelAudioMgr: Cannot stop sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot stop sound, " << id << "not loaded."; } void StelAudioMgr::dropSound(const QString& id) @@ -140,7 +141,7 @@ void StelAudioMgr::dropSound(const QString& id) if (!audioObjects.contains(id)) { - qDebug() << "StelAudioMgr: Cannot drop sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot drop sound, " << id << "not loaded."; return; } if (audioObjects[id]!=nullptr) @@ -159,7 +160,7 @@ qint64 StelAudioMgr::position(const QString& id) if (!audioObjects.contains(id)) { - qDebug() << "StelAudioMgr: Cannot report position for sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot report position for sound, " << id << "not loaded."; return(-1); } if (audioObjects[id]!=nullptr) @@ -176,7 +177,7 @@ qint64 StelAudioMgr::duration(const QString& id) if (!audioObjects.contains(id)) { - qDebug() << "StelAudioMgr: Cannot report duration for sound, " << id << "not loaded."; + qCWarning(Media) << "StelAudioMgr: Cannot report duration for sound, " << id << "not loaded."; return(-1); } if (audioObjects[id]!=nullptr) diff --git a/src/core/StelVideoMgr.cpp b/src/core/StelVideoMgr.cpp index e7681e91c5181..1c883300c7b45 100644 --- a/src/core/StelVideoMgr.cpp +++ b/src/core/StelVideoMgr.cpp @@ -35,22 +35,19 @@ #endif #endif +Q_LOGGING_CATEGORY(Media,"stel.Media", QtInfoMsg) StelVideoMgr::StelVideoMgr(bool withAudio) : StelModule(), audioEnabled(withAudio) { setObjectName("StelVideoMgr"); #ifdef ENABLE_MEDIA // in case the property has not been set, getProperty() returns invalid. - verbose= (qApp->property("verbose") == true); #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) - if (verbose) - { - QMediaFormat fmt=QMediaFormat(); - qDebug() << "StelVideoMgr: Supported file formats: " << fmt.supportedFileFormats(QMediaFormat::Decode); - qDebug() << "StelVideoMgr: Supported video codecs: " << fmt.supportedVideoCodecs(QMediaFormat::Decode); - if (audioEnabled) - qDebug() << "StelVideoMgr: Supported audio codecs: " << fmt.supportedAudioCodecs(QMediaFormat::Decode); - } + QMediaFormat fmt=QMediaFormat(); + qCDebug(Media) << "StelVideoMgr: Supported file formats: " << fmt.supportedFileFormats(QMediaFormat::Decode); + qCDebug(Media) << "StelVideoMgr: Supported video codecs: " << fmt.supportedVideoCodecs(QMediaFormat::Decode); + if (audioEnabled) + qCDebug(Media) << "StelVideoMgr: Supported audio codecs: " << fmt.supportedAudioCodecs(QMediaFormat::Decode); #endif #endif } @@ -80,7 +77,7 @@ void StelVideoMgr::loadVideo(const QString& filename, const QString& id, const f { if (videoObjects.contains(id)) { - qWarning() << "[StelVideoMgr] Video object with ID" << id << "already exists, dropping it"; + qCWarning(Media) << "[StelVideoMgr] Video object with ID" << id << "already exists, dropping it"; dropVideo(id); } @@ -160,28 +157,25 @@ void StelVideoMgr::loadVideo(const QString& filename, const QString& id, const f QMediaContent content(QUrl::fromLocalFile(QFileInfo(filename).absoluteFilePath())); videoObjects[id]->player->setMedia(content); #endif - if (verbose) - { #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) - qDebug() << "Loading " << url; + qCDebug(Media) << "Loading " << url; #elif (QT_VERSION>=QT_VERSION_CHECK(5,14,0)) - qDebug() << "Loading " << content.request().url(); + qCDebug(Media) << "Loading " << content.request().url(); #else - qDebug() << "Loading " << content.canonicalUrl(); + qCDebug(Media) << "Loading " << content.canonicalUrl(); #endif - qDebug() << "Media Resources queried from player:"; - qDebug() << "\tSTATUS: " << videoObjects[id]->player->mediaStatus(); + qCDebug(Media) << "Media Resources queried from player:"; + qCDebug(Media) << "\tSTATUS: " << videoObjects[id]->player->mediaStatus(); #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) - qDebug() << "\tFile: " << videoObjects[id]->player->source(); + qCDebug(Media) << "\tFile: " << videoObjects[id]->player->source(); #elif (QT_VERSION>=QT_VERSION_CHECK(5,14,0)) - qDebug() << "\tFile: " << videoObjects[id]->player->currentMedia().request().url(); + qCDebug(Media) << "\tFile: " << videoObjects[id]->player->currentMedia().request().url(); #else - qDebug() << "\tFile: " << videoObjects[id]->player->currentMedia().canonicalUrl(); + qCDebug(Media) << "\tFile: " << videoObjects[id]->player->currentMedia().canonicalUrl(); #endif - } -// qDebug() << "scene->addItem..."; +// qCDebug(Media) << "scene->addItem..."; StelMainView::getInstance().scene()->addItem(videoObjects[id]->videoItem); -// qDebug() << "scene->addItem OK"; +// qCDebug(Media) << "scene->addItem OK"; videoObjects[id]->videoItem->setPos(x, y); // DEFAULT SIZE: show a tiny frame. This gets updated to native resolution as soon as resolution becomes known. Needed? @@ -191,25 +185,22 @@ void StelVideoMgr::loadVideo(const QString& filename, const QString& id, const f // This may be no longer required. But please keep the block here for testing/reactivation if necessary. // if (! videoObjects[id]->player->isSeekable()) // { -// qDebug() << "Not Seekable!"; -// if (verbose) -// qDebug() << "Blocking load ..."; +// qCDebug(Media) << "Not Seekable!"; +// qCDebug(Media) << "Blocking load ..."; // QEventLoop loop; // QTimer timer; -// qDebug() << "Not Seekable: setSingleShot"; +// qCDebug(Media) << "Not Seekable: setSingleShot"; // timer.setSingleShot(true); // timer.setInterval(5000); // 5 seconds, may be too long? -// qDebug() << "Not Seekable: connect..."; +// qCDebug(Media) << "Not Seekable: connect..."; // loop.connect(&timer, SIGNAL (timeout()), &loop, SLOT (quit()) ); // loop.connect(videoObjects[id]->player, SIGNAL (seekableChanged(bool)), &loop, SLOT (quit())); -// qDebug() << "Not Seekable: loop..."; +// qCDebug(Media) << "Not Seekable: loop..."; // loop.exec(); -// if (verbose) -// qDebug() << "Blocking load finished, should be seekable now or 5s are over."; +// qCDebug(Media) << "Blocking load finished, should be seekable now or 5s are over."; // } - if (verbose) - qDebug() << "Loaded video" << id << "for pos " << x << "/" << y << "Size" << videoObjects[id]->videoItem->size(); + qCDebug(Media) << "Loaded video" << id << "for pos " << x << "/" << y << "Size" << videoObjects[id]->videoItem->size(); videoObjects[id]->player->setPosition(0); // This should force triggering a metadataAvailable() with resolution update. if (show) videoObjects[id]->player->play(); @@ -248,15 +239,13 @@ void StelVideoMgr::playVideo(const QString& id, const bool keepVisibleAtEnd) videoObjects[id]->player->play(); #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) videoObjects[id]->videoItem->show(); - if (verbose) - qDebug() << "StelVideoMgr::playVideo(): playing " << id << videoObjects[id]->player->playbackState() << " - media: " << videoObjects[id]->player->mediaStatus(); + qCDebug(Media) << "StelVideoMgr::playVideo(): playing " << id << videoObjects[id]->player->playbackState() << " - media: " << videoObjects[id]->player->mediaStatus(); #else - if (verbose) - qDebug() << "StelVideoMgr::playVideo(): playing " << id << videoObjects[id]->player->state() << " - media: " << videoObjects[id]->player->mediaStatus(); + qCDebug(Media) << "StelVideoMgr::playVideo(): playing " << id << videoObjects[id]->player->state() << " - media: " << videoObjects[id]->player->mediaStatus(); #endif } } - else qDebug() << "StelVideoMgr::playVideo(" << id << "): no such video"; + else qCWarning(Media) << "StelVideoMgr::playVideo(" << id << "): no such video"; } @@ -277,8 +266,7 @@ void StelVideoMgr::playVideo(const QString& id, const bool keepVisibleAtEnd) void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, float atCenterX, float atCenterY, float finalSizeX, float finalSizeY, float popupDuration, bool frozenInTransition) { - if (verbose) - qDebug() << "\n\n====Configuring playVideoPopout(): " << id; + qCDebug(Media) << "\n\n====Configuring playVideoPopout(): " << id; if (videoObjects.contains(id)) { videoObjects[id]->keepVisible=frozenInTransition; @@ -291,7 +279,7 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, if (videoObjects[id]->player->state() == QMediaPlayer::PlayingState) #endif { - qDebug() << "playVideoPopout(): stop the playing video"; + qCDebug(Media) << "playVideoPopout(): stop the playing video"; videoObjects[id]->player->stop(); } @@ -300,30 +288,27 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, // if finalSizeX or finalSizeY <= 1 we scale proportional to mainview! // Note that finalSizeX or finalSizeY thus cannot be set to 1.0, i.e. single-pixel rows/columns! // This is likely not tragic, else set to 1.0001 - int viewportWidth=StelMainView::getInstance().size().width(); - int viewportHeight=StelMainView::getInstance().size().height(); + const int viewportWidth=StelMainView::getInstance().size().width(); + const int viewportHeight=StelMainView::getInstance().size().height(); if (finalSizeX>0 && finalSizeX<=1) finalSizeX*=viewportWidth; if (finalSizeY>0 && finalSizeY<=1) finalSizeY*=viewportHeight; - if (verbose) - qDebug() << "playVideoPopout() finalSize: "<< finalSizeX << "x" << finalSizeY; + qCDebug(Media) << "playVideoPopout() finalSize: "<< finalSizeX << "x" << finalSizeY; QSize videoSize=videoObjects[id]->resolution; - if (verbose) - qDebug() << "playVideoPopout(): video resolution detected=" << videoSize; + qCDebug(Media) << "playVideoPopout(): video resolution detected=" << videoSize; if (!videoSize.isValid() && (finalSizeX==-1 || finalSizeY==-1)) { // This should not happen, is a real problem. - qDebug() << "StelVideoMgr::playVideoPopout()" << id << ": size (resolution) not yet determined, cannot resize with -1 argument. Sorry, command stops here..."; + qCWarning(Media) << "StelVideoMgr::playVideoPopout()" << id << ": size (resolution) not yet determined, cannot resize with -1 argument. Sorry, command stops here..."; return; } - float aspectRatio=static_cast(videoSize.width())/static_cast(videoSize.height()); - if (verbose) - qDebug() << "StelVideoMgr::playVideoPopout(): computed aspect ratio:" << aspectRatio; + const float aspectRatio=static_cast(videoSize.width())/static_cast(videoSize.height()); + qCDebug(Media) << "StelVideoMgr::playVideoPopout(): computed aspect ratio:" << aspectRatio; if (finalSizeX!=-1.0f && finalSizeY!=-1.0f) videoObjects[id]->videoItem->setAspectRatioMode(Qt::IgnoreAspectRatio); else @@ -339,8 +324,7 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, else if (finalSizeX==-1.0f) finalSizeX=finalSizeY*aspectRatio; } - if (verbose) - qDebug() << "StelVideoMgr::playVideoPopout(): Resetting target frame size to :" << finalSizeX << "x" << finalSizeY; + qCDebug(Media) << "StelVideoMgr::playVideoPopout(): Resetting target frame size to :" << finalSizeX << "x" << finalSizeY; videoObjects[id]->targetFrameSize= QSizeF(finalSizeX, finalSizeY); // size in Pixels // (2) start position: @@ -349,8 +333,7 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, if (fromY>0 && fromY<1) fromY *= static_cast(viewportHeight); videoObjects[id]->popupOrigin= QPointF(fromX, fromY); // Pixel coordinates of popout point. - if (verbose) - qDebug() << "StelVideoMgr::playVideoPopout(): Resetting start position to :" << fromX << "/" << fromY; + qCDebug(Media) << "StelVideoMgr::playVideoPopout(): Resetting start position to :" << fromX << "/" << fromY; // (3) center of target frame @@ -359,8 +342,7 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, if (atCenterY>0 && atCenterY<1) atCenterY *= static_cast(viewportHeight); videoObjects[id]->popupTargetCenter= QPointF(atCenterX, atCenterY); // Pixel coordinates of frame center - if (verbose) - qDebug() << "StelVideoMgr::playVideoPopout(): Resetting target position to :" << atCenterX << "/" << atCenterY; + qCDebug(Media) << "StelVideoMgr::playVideoPopout(): Resetting target position to :" << atCenterX << "/" << atCenterY; // (4) configure fader videoObjects[id]->fader.setDuration(1000.0f*popupDuration); @@ -373,11 +355,10 @@ void StelVideoMgr::playVideoPopout(const QString& id, float fromX, float fromY, videoObjects[id]->player->setPosition(0); videoObjects[id]->player->play(); - if (verbose) - qDebug() << "StelVideoMgr::playVideoPopout(): fader triggered."; + qCDebug(Media) << "StelVideoMgr::playVideoPopout(): fader triggered."; } } - else qDebug() << "StelVideoMgr::playVideoPopout(" << id << "): no such video"; + else qCWarning(Media) << "StelVideoMgr::playVideoPopout(" << id << "): no such video"; } @@ -395,12 +376,11 @@ void StelVideoMgr::pauseVideo(const QString& id) #endif videoObjects[id]->player->play(); - if (verbose) - qDebug() << "StelVideoMgr::pauseVideo() ..."; + qCDebug(Media) << "StelVideoMgr::pauseVideo() ..."; videoObjects[id]->player->pause(); } } - else qDebug() << "StelVideoMgr::pauseVideo()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::pauseVideo()" << id << ": no such video"; } void StelVideoMgr::stopVideo(const QString& id) @@ -412,13 +392,12 @@ void StelVideoMgr::stopVideo(const QString& id) videoObjects[id]->player->stop(); } } - else qDebug() << "StelVideoMgr::stopVideo()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::stopVideo()" << id << ": no such video"; } void StelVideoMgr::seekVideo(const QString& id, const qint64 ms, bool pause) { - if (verbose) - qDebug() << "StelVideoMgr::seekVideo: " << id << " to:" << ms << (pause ? " (pausing)" : " (playing)"); + qCDebug(Media) << "StelVideoMgr::seekVideo: " << id << " to:" << ms << (pause ? " (pausing)" : " (playing)"); if (videoObjects.contains(id)) { if (videoObjects[id]->player!=nullptr) @@ -430,7 +409,7 @@ void StelVideoMgr::seekVideo(const QString& id, const qint64 ms, bool pause) } else { - qDebug() << "[StelVideoMgr] Cannot seek media source" << id; + qCWarning(Media) << "[StelVideoMgr] Cannot seek media source" << id; } // visual update only happens if we play. So even with pause set, we must play to freeze the frame! videoObjects[id]->player->play(); @@ -438,7 +417,7 @@ void StelVideoMgr::seekVideo(const QString& id, const qint64 ms, bool pause) videoObjects[id]->player->pause(); } } - else qDebug() << "StelVideoMgr::seekVideo()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::seekVideo()" << id << ": no such video"; } void StelVideoMgr::dropVideo(const QString& id) @@ -447,8 +426,7 @@ void StelVideoMgr::dropVideo(const QString& id) return; if (videoObjects[id]->player!=nullptr) { - if (verbose) - qDebug() << "About to drop (unload) video " << id << "(" << videoObjects[id]->player->mediaStatus() << ")"; + qCDebug(Media) << "About to drop (unload) video " << id << "(" << videoObjects[id]->player->mediaStatus() << ")"; videoObjects[id]->player->stop(); StelMainView::getInstance().scene()->removeItem(videoObjects[id]->videoItem); delete videoObjects[id]->player; @@ -461,12 +439,12 @@ void StelVideoMgr::dropVideo(const QString& id) } } -// setVideoXY(100, 200, false): absolute, as before -// setVideoXY(100, 200, true): shift 100 right, 200 down -// setVideoXY(0.5, 0.25, false): (on fullHD), set to (960/270) -// setVideoXY(0.5, 0.25, true): (on fullHD), shift by (960/270) -// setVideoXY(600, 0.25, false): (on fullHD), set to (600/270) -// setVideoXY(600, 0.25, true): (on fullHD), shift by (600/270) +// setVideoXY(id, 100, 200, false): absolute, as before +// setVideoXY(id, 100, 200, true): shift 100 right, 200 down +// setVideoXY(id, 0.5, 0.25, false): (on fullHD), set to (960/270) +// setVideoXY(id, 0.5, 0.25, true): (on fullHD), shift by (960/270) +// setVideoXY(id, 600, 0.25, false): (on fullHD), set to (600/270) +// setVideoXY(id, 600, 0.25, true): (on fullHD), shift by (600/270) void StelVideoMgr::setVideoXY(const QString& id, const float x, const float y, const bool relative) { if (videoObjects.contains(id)) @@ -489,11 +467,10 @@ void StelVideoMgr::setVideoXY(const QString& id, const float x, const float y, c } else videoObjects[id]->videoItem->setPos(newX, newY); - if (verbose) - qDebug() << "Setting video XY= " << newX << "/" << newY << (relative? "(relative)":""); + qCDebug(Media) << "Setting video XY= " << newX << "/" << newY << (relative? "(relative)":""); } } - else qDebug() << "StelVideoMgr::setVideoXY()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::setVideoXY()" << id << ": no such video"; } void StelVideoMgr::setVideoAlpha(const QString& id, const float alpha) @@ -505,7 +482,7 @@ void StelVideoMgr::setVideoAlpha(const QString& id, const float alpha) videoObjects[id]->videoItem->setOpacity(alpha); } } - else qDebug() << "StelVideoMgr::setVideoAlpha()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::setVideoAlpha()" << id << ": no such video"; } void StelVideoMgr::resizeVideo(const QString& id, float w, float h) @@ -526,21 +503,18 @@ void StelVideoMgr::resizeVideo(const QString& id, float w, float h) h*=static_cast(viewportHeight); QSize videoSize=videoObjects[id]->resolution; - if (verbose) - qDebug() << "resizeVideo(): old resolution=" << videoSize; + qCDebug(Media) << "resizeVideo(): old resolution=" << videoSize; if (!videoSize.isValid() && (w==-1 || h==-1)) { - if (verbose) - qDebug() << "StelVideoMgr::resizeVideo()" << id << ": size not yet determined, cannot resize with -1 argument. We do that in next update()."; + qCDebug(Media) << "StelVideoMgr::resizeVideo()" << id << ": size not yet determined, cannot resize with -1 argument. We do that in next update()."; // mark necessity of deferred resize. videoObjects[id]->needResize=true; videoObjects[id]->targetFrameSize=QSizeF(w, h); // w|h can be -1 or >1, no longer 0<(w|h)<1. return; } float aspectRatio=static_cast(videoSize.width())/static_cast(videoSize.height()); - if (verbose) - qDebug() << "aspect ratio:" << aspectRatio; // 1 for invalid size. + qCDebug(Media) << "aspect ratio:" << aspectRatio; // 1 for invalid size. if (w!=-1.0f && h!=-1.0f) videoObjects[id]->videoItem->setAspectRatioMode(Qt::IgnoreAspectRatio); else @@ -556,14 +530,13 @@ void StelVideoMgr::resizeVideo(const QString& id, float w, float h) else if (w==-1.0f) w=h*aspectRatio; } - if (verbose) - qDebug() << "Resizing to:" << w << "x" << h; + qCDebug(Media) << "Resizing to:" << w << "x" << h; videoObjects[id]->targetFrameSize=QSizeF(w, h); // w|h cannot be -1 or >1 here. videoObjects[id]->videoItem->setSize(QSizeF(w, h)); videoObjects[id]->needResize=false; } } - else qDebug() << "StelVideoMgr::resizeVideo()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::resizeVideo()" << id << ": no such video"; } void StelVideoMgr::showVideo(const QString& id, const bool show) @@ -575,7 +548,7 @@ void StelVideoMgr::showVideo(const QString& id, const bool show) videoObjects[id]->videoItem->setVisible(show); } } - else qDebug() << "StelVideoMgr::showVideo()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::showVideo()" << id << ": no such video"; } qint64 StelVideoMgr::getVideoDuration(const QString& id) const @@ -584,7 +557,7 @@ qint64 StelVideoMgr::getVideoDuration(const QString& id) const { return videoObjects[id]->duration; } - else qDebug() << "StelVideoMgr::getDuration()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getDuration()" << id << ": no such video"; return -1; } @@ -594,7 +567,7 @@ qint64 StelVideoMgr::getVideoPosition(const QString& id) const { return videoObjects[id]->player->position(); } - else qDebug() << "StelVideoMgr::getPosition()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getPosition()" << id << ": no such video"; return -1; } @@ -605,7 +578,7 @@ QSize StelVideoMgr::getVideoResolution(const QString& id) const { return videoObjects[id]->resolution; } - else qDebug() << "StelVideoMgr::getResolution()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getResolution()" << id << ": no such video"; return QSize(); } @@ -618,7 +591,7 @@ int StelVideoMgr::getVideoWidth(const QString& id) const else return -1; } - else qDebug() << "StelVideoMgr::getWidth()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getWidth()" << id << ": no such video"; return -1; } @@ -631,7 +604,7 @@ int StelVideoMgr::getVideoHeight(const QString& id) const else return -1; } - else qDebug() << "StelVideoMgr::getHeight()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getHeight()" << id << ": no such video"; return -1; } @@ -651,7 +624,7 @@ void StelVideoMgr::muteVideo(const QString& id, bool mute) #endif } } - else qDebug() << "StelVideoMgr::mute()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::mute()" << id << ": no such video"; } void StelVideoMgr::setVideoVolume(const QString& id, int newVolume) @@ -669,7 +642,7 @@ void StelVideoMgr::setVideoVolume(const QString& id, int newVolume) #endif } } - else qDebug() << "StelVideoMgr::setVolume()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::setVolume()" << id << ": no such video"; } int StelVideoMgr::getVideoVolume(const QString& id) const @@ -689,7 +662,7 @@ int StelVideoMgr::getVideoVolume(const QString& id) const #endif } } - else qDebug() << "StelVideoMgr::getVolume()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::getVolume()" << id << ": no such video"; return volume; } @@ -707,7 +680,7 @@ bool StelVideoMgr::isVideoPlaying(const QString& id) const #endif } } - else qDebug() << "StelVideoMgr::isPlaying()" << id << ": no such video"; + else qCWarning(Media) << "StelVideoMgr::isPlaying()" << id << ": no such video"; return playing; } @@ -717,38 +690,34 @@ bool StelVideoMgr::isVideoPlaying(const QString& id) const */ void StelVideoMgr::handleAudioAvailableChanged(bool available) { - if (verbose) - qDebug() << "StelVideoMgr: " << this->sender()->property("Stel_id").toString() << ": Audio is now available:" << available; + qCDebug(Media) << "StelVideoMgr: " << this->sender()->property("Stel_id").toString() << ": Audio is now available:" << available; } #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) void StelVideoMgr::handleBufferProgressChanged(float filled) { - if (verbose) - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": Buffer filled (fraction):" << filled; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": Buffer filled (fraction):" << filled; } void StelVideoMgr::handleErrorMsg(QMediaPlayer::Error error, const QString &errorString) { - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": error:" << error << ":" << errorString; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": error:" << error << ":" << errorString; } #else // It seems this is never called in practice. void StelVideoMgr::handleBufferStatusChanged(int percentFilled) { - if (verbose) - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": Buffer filled (%):" << percentFilled; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": Buffer filled (%):" << percentFilled; } void StelVideoMgr::handleError(QMediaPlayer::Error error) { - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": error:" << error; + qCWarning(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": error:" << error; } #endif void StelVideoMgr::handleDurationChanged(qint64 duration) { const QString id=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": Duration changed to:" << duration; + qCDebug(Media) << "StelVideoMgr: " << id << ": Duration changed to:" << duration; if (videoObjects.contains(id)) { videoObjects[id]->duration=duration; @@ -761,14 +730,12 @@ void StelVideoMgr::handleDurationChanged(qint64 duration) void StelVideoMgr::handleMediaStatusChanged(QMediaPlayer::MediaStatus status) // debug-log messages { QString id=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": MediaStatus changed to:" << status; + qCDebug(Media) << "StelVideoMgr: " << id << ": MediaStatus changed to:" << status; } void StelVideoMgr::handleMutedChanged(bool muted) { - if (verbose) - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": mute changed:" << muted; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": mute changed:" << muted; } @@ -777,13 +744,13 @@ void StelVideoMgr::handleMutedChanged(bool muted) void StelVideoMgr::handlePositionChanged(qint64 position) { QString senderId=QObject::sender()->property("Stel_id").toString(); - qDebug() << "StelVideoMgr: " << senderId << ": position changed to (ms):" << position; + qCDebug(Media) << "StelVideoMgr: " << senderId << ": position changed to (ms):" << position; // We could deal with the keep-visible here, however this is not called often enough by default, and we have update anyways if ((position==videoObjects[senderId]->duration) && (videoObjects[senderId]->keepVisible)) { videoObjects[senderId]->player->setPosition(videoObjects[senderId]->duration - 1); videoObjects[senderId]->player->pause(); - qDebug() << " ---> paused at end as requested" ; + qCDebug(Media) << " ---> paused at end as requested" ; } } */ @@ -791,8 +758,7 @@ void StelVideoMgr::handlePositionChanged(qint64 position) // USELESS? void StelVideoMgr::handleSeekableChanged(bool seekable) { - if (verbose) - qDebug() << "StelVideoMgr: handleSeekableChanged()" << QObject::sender()->property("Stel_id").toString() << ": seekable changed to:" << seekable; + qCDebug(Media) << "StelVideoMgr: handleSeekableChanged()" << QObject::sender()->property("Stel_id").toString() << ": seekable changed to:" << seekable; } #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) void StelVideoMgr::handleStateChanged(QMediaPlayer::PlaybackState state) @@ -801,16 +767,14 @@ void StelVideoMgr::handleStateChanged(QMediaPlayer::State state) #endif { QString senderId=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << senderId << ": state changed to:" << state - << "(Media Status: " << videoObjects[senderId]->player->mediaStatus() << ")"; + qCDebug(Media) << "StelVideoMgr: " << senderId << ": state changed to:" << state + << "(Media Status: " << videoObjects[senderId]->player->mediaStatus() << ")"; } void StelVideoMgr::handleVideoAvailableChanged(bool videoAvailable) { QString senderId=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << senderId << ": Video available:" << videoAvailable; + qCDebug(Media) << "StelVideoMgr: " << senderId << ": Video available:" << videoAvailable; // Sometimes it appears the video has not fully loaded when popup stars, and the movie is not shown. // Maybe force showing here? --> NO, breaks our own logic... //videoObjects[senderId]->videoItem->setVisible(videoAvailable); @@ -818,61 +782,53 @@ void StelVideoMgr::handleVideoAvailableChanged(bool videoAvailable) void StelVideoMgr::handleVolumeChanged(int volume) { - if (verbose) - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": volume changed to:" << volume; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": volume changed to:" << volume; } #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void StelVideoMgr::handleMetaDataChanged() { QString id=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": Metadata changed (global notification)."; + qCDebug(Media) << "StelVideoMgr: " << id << ": Metadata changed (global notification)."; if (videoObjects.contains(id)) { const QMediaMetaData metaData=videoObjects[id]->player->metaData(); - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": Following metadata are available:"; + qCDebug(Media) << "StelVideoMgr: " << id << ": Following metadata are available:"; for (const auto& mdKey : metaData.keys()) { QString key = metaData.stringValue(mdKey); - if (verbose) - qDebug() << "\t" << mdKey << "==>" << key; + qCDebug(Media) << "\t" << mdKey << "==>" << key; if ((key=="Resolution")) { - if (verbose) - qDebug() << "StelVideoMgr: Resolution becomes available: " << metaData.stringValue(mdKey); + qCDebug(Media) << "StelVideoMgr: Resolution becomes available: " << metaData.stringValue(mdKey); videoObjects[id]->resolution=metaData.value(mdKey).toSize(); } } } else - qDebug() << "StelVideoMgr::handleMetaDataChanged()" << id << ": no such video - this is absurd."; + qCWarning(Media) << "StelVideoMgr::handleMetaDataChanged()" << id << ": no such video - this is absurd."; } void StelVideoMgr::handleSourceChanged(const QUrl &media) { - if (verbose) - qDebug() << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": source changed to:" << media; + qCDebug(Media) << "StelVideoMgr: " << QObject::sender()->property("Stel_id").toString() << ": source changed to:" << media; } #else void StelVideoMgr::handleAvailabilityChanged(bool available) { - if (verbose) - qDebug() << "StelVideoMgr::handleAvailabilityChanged(bool) " << QObject::sender()->property("Stel_id").toString() << ": available:" << available; + qCDebug(Media) << "StelVideoMgr::handleAvailabilityChanged(bool) " << QObject::sender()->property("Stel_id").toString() << ": available:" << available; } void StelVideoMgr::handleAvailabilityChanged(QMultimedia::AvailabilityStatus availability) { - if (verbose) - qDebug() << "StelVideoMgr::availabilityChanged(QMultimedia::AvailabilityStatus) " << QObject::sender()->property("Stel_id").toString() << ": availability:" << availability; + qCDebug(Media) << "StelVideoMgr::availabilityChanged(QMultimedia::AvailabilityStatus) " << QObject::sender()->property("Stel_id").toString() << ": availability:" << availability; } // The signal sequence (at least on Windows7/MinGW/Qt5.4) seems to be: -// metadatachanged() as soon as video has been loaded. But Result: no metadata. +// metadataChanged() as soon as video has been loaded. But Result: no metadata. // After media has started playing and frame is already growing, // audioAvailable() (but no audio in this movie...) // videoAvailable() (true) @@ -887,32 +843,28 @@ void StelVideoMgr::handleAvailabilityChanged(QMultimedia::AvailabilityStatus ava void StelVideoMgr::handleMetaDataChanged() { QString id=QObject::sender()->property("Stel_id").toString(); - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": Metadata changed (global notification)."; + qCDebug(Media) << "StelVideoMgr: " << id << ": Metadata changed (global notification)."; if (videoObjects.contains(id) && videoObjects[id]->player->isMetaDataAvailable()) { - if (verbose) - qDebug() << "StelVideoMgr: " << id << ": Following metadata are available:"; + qCDebug(Media) << "StelVideoMgr: " << id << ": Following metadata are available:"; const QStringList metadataList=videoObjects[id]->player->availableMetaData(); for (const auto& md : metadataList) { QString key = md.toLocal8Bit().constData(); - if (verbose) - qDebug() << "\t" << key << "==>" << videoObjects[id]->player->metaData(key); + qCDebug(Media) << "\t" << key << "==>" << videoObjects[id]->player->metaData(key); if ((key=="Resolution") && !(videoObjects[id]->resolution.isValid())) { - if (verbose) - qDebug() << "StelVideoMgr: Resolution becomes available: " << videoObjects[id]->player->metaData(key).toSize(); + qCDebug(Media) << "StelVideoMgr: Resolution becomes available: " << videoObjects[id]->player->metaData(key).toSize(); videoObjects[id]->resolution=videoObjects[id]->player->metaData(key).toSize(); } } } - else if (videoObjects.contains(id) && !(videoObjects[id]->player->isMetaDataAvailable()) &&verbose) - qDebug() << "StelVideoMgr::handleMetaDataChanged()" << id << ": no metadata now."; + else if (videoObjects.contains(id) && !(videoObjects[id]->player->isMetaDataAvailable())) + qCDebug(Media) << "StelVideoMgr::handleMetaDataChanged()" << id << ": no metadata now."; else - qDebug() << "StelVideoMgr::handleMetaDataChanged()" << id << ": no such video - this is absurd."; + qCWarning(Media) << "StelVideoMgr::handleMetaDataChanged()" << id << ": no such video - this is absurd."; } #endif @@ -923,12 +875,10 @@ void StelVideoMgr::update(double deltaTime) { QMediaPlayer::MediaStatus mediaStatus = (*voIter)->player->mediaStatus(); QString id=voIter.key(); - // Maybe we have verbose as int with levels of verbosity, and output the next line with verbose>=2? - if (verbose) #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) - qDebug() << "StelVideoMgr::update() for" << id << ": PlayerState:" << (*voIter)->player->playbackState() << "MediaStatus: " << mediaStatus; + qCDebug(Media) << "StelVideoMgr::update() for" << id << ": PlayerState:" << (*voIter)->player->playbackState() << "MediaStatus: " << mediaStatus; #else - qDebug() << "StelVideoMgr::update() for" << id << ": PlayerState:" << (*voIter)->player->state() << "MediaStatus: " << mediaStatus; + qCDebug(Media) << "StelVideoMgr::update() for" << id << ": PlayerState:" << (*voIter)->player->state() << "MediaStatus: " << mediaStatus; #endif // fader must be updated here, else the video may not be visible when not yet fully loaded? @@ -945,8 +895,7 @@ void StelVideoMgr::update(double deltaTime) case QMediaPlayer::InvalidMedia: case QMediaPlayer::LoadingMedia: case QMediaPlayer::StalledMedia: - if (verbose) - qDebug() << "StelVideoMgr::update(): " << id << mediaStatus << "\t==> no further update action"; + qCDebug(Media) << "StelVideoMgr::update(): " << id << mediaStatus << "\t==> no further update action"; continue; case QMediaPlayer::LoadedMedia: case QMediaPlayer::BufferingMedia: @@ -968,8 +917,7 @@ void StelVideoMgr::update(double deltaTime) { if ( ((*voIter)->keepVisible) && ((*voIter)->duration > 0) && ((*voIter)->player->position() >= ((*voIter)->duration - 250)) ) { - if (verbose) - qDebug() << "update(): pausing" << id << "at end"; + qCDebug(Media) << "update(): pausing" << id << "at end"; (*voIter)->player->pause(); } @@ -990,8 +938,7 @@ void StelVideoMgr::update(double deltaTime) QPointF frameXY=frameCenter - 0.5*QPointF(currentFrameSize.width(), currentFrameSize.height()); (*voIter)->videoItem->setPos(frameXY); (*voIter)->videoItem->setSize(currentFrameSize); - if (verbose) - qDebug() << "StelVideoMgr::update(): Video" << id << "at" << (*voIter)->player->position() + qCDebug(Media) << "StelVideoMgr::update(): Video" << id << "at" << (*voIter)->player->position() #if (QT_VERSION>=QT_VERSION_CHECK(6,0,0)) << ", player state=" << (*voIter)->player->playbackState() << ", media status=" << (*voIter)->player->mediaStatus(); #else @@ -1007,20 +954,16 @@ void StelVideoMgr::update(double deltaTime) // // But this even can happen if MediaStatus==BufferedMedia, i.e. fully loaded. Really a shame! // // TODO: check with every version of Qt whether this can still happen. // // SILLY! Of course if Stellarium framerate > video framerate... -// if (verbose) -// { -// qDebug() << "StelVideoMgr::update(): player state" << (*voIter)->player->state() << "with MediaStatus" << mediaStatus; -// qDebug() << "This should not be: video should play but position" << newPos << "does not increase? Bumping video."; -// } +// qCDebug(Media) << "StelVideoMgr::update(): player state" << (*voIter)->player->state() << "with MediaStatus" << mediaStatus; +// qCDebug(Media) << "This should not be: video should play but position" << newPos << "does not increase? Bumping video."; // //(*voIter)->player->stop(); // GZ Dec2: Do we really need to stop? // (*voIter)->player->setPosition(newPos+1); // GZ Dec2 flipped 2 lines. // (*voIter)->player->play(); -// qDebug() << "We had an issue with a stuck mediaplayer, should play again!"; +// qCWarning(Media) << "We had an issue with a stuck mediaplayer, should play again!"; // } (*voIter)->lastPos=newPos; - if (verbose) - qDebug() << "StelVideoMgr::update(): fader at " << (*voIter)->fader.getInterstate() << "; update frame size " << currentFrameSize << "to XY" << frameXY; + qCDebug(Media) << "StelVideoMgr::update(): fader at " << (*voIter)->fader.getInterstate() << "; update frame size " << currentFrameSize << "to XY" << frameXY; // if we want still videos during transition, we must grow/shrink paused, and run only when reached full size. // We must detect a frame close to end, pause there, and trigger the fader back to 0. @@ -1034,14 +977,12 @@ void StelVideoMgr::update(double deltaTime) } else if ((*voIter)->fader.getInterstate()<1.0f) { - if (verbose) - qDebug() << "StelVideoMgr::update(): not fully grown: pausing video at start or end!"; + qCDebug(Media) << "StelVideoMgr::update(): not fully grown: pausing video at start or end!"; (*voIter)->player->pause(); } else if (((*voIter)->duration > 0) && ((*voIter)->player->position() >= ((*voIter)->duration - 250))) // allow stop 250ms before end. 100ms was too short! { - if (verbose) - qDebug() << "StelVideoMgr::update(): position " << (*voIter)->player->position() << "close to end of duration " << (*voIter)->duration << "--> pause and shutdown with fader "; + qCDebug(Media) << "StelVideoMgr::update(): position " << (*voIter)->player->position() << "close to end of duration " << (*voIter)->duration << "--> pause and shutdown with fader "; (*voIter)->player->pause(); // TBD: If we set some very last frame position here, it takes a very long while to seek (may disturb/flicker!) // (*voIter)->player->setPosition((*voIter)->duration-10); @@ -1053,8 +994,7 @@ void StelVideoMgr::update(double deltaTime) else if (((*voIter)->player->state() != QMediaPlayer::PlayingState)) #endif { - if (verbose) - qDebug() << "StelVideoMgr::update(): fully grown: play!"; + qCDebug(Media) << "StelVideoMgr::update(): fully grown: play!"; (*voIter)->player->play(); } } @@ -1072,16 +1012,14 @@ void StelVideoMgr::update(double deltaTime) (*voIter)->player->play(); if (( ((*voIter)->duration > 0) && ((*voIter)->player->position() >= ((*voIter)->duration - (*voIter)->fader.getDuration() - 200)))) { - if (verbose) - qDebug() << "StelVideoMgr::update(): position " << (*voIter)->player->position() << "close to end of duration " << (*voIter)->duration << - "minus fader duration " << (*voIter)->fader.getDuration() << "--> shutdown with fader "; + qCDebug(Media) << "StelVideoMgr::update(): position " << (*voIter)->player->position() << "close to end of duration " << (*voIter)->duration << + "minus fader duration " << (*voIter)->fader.getDuration() << "--> shutdown with fader "; (*voIter)->fader=false; // trigger shutdown (sending again does not disturb) } } else // interstate==0: end of everything. { - if (verbose) - qDebug() << "StelVideoMgr::update(): Stopping at Interstate " << (*voIter)->fader.getInterstate(); + qCDebug(Media) << "StelVideoMgr::update(): Stopping at Interstate " << (*voIter)->fader.getInterstate(); (*voIter)->player->stop(); // immediately hides video window. (*voIter)->simplePlay=true; // reset } @@ -1090,11 +1028,10 @@ void StelVideoMgr::update(double deltaTime) } - #else void StelVideoMgr::loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha) { - qWarning() << "[StelVideoMgr] This build of Stellarium does not support video - cannot load video" << QDir::toNativeSeparators(filename) << id << x << y << show << alpha; + qCWarning(Media) << "[StelVideoMgr] This build of Stellarium does not support video - cannot load video" << QDir::toNativeSeparators(filename) << id << x << y << show << alpha; } StelVideoMgr::~StelVideoMgr() {;} void StelVideoMgr::update(double){;} diff --git a/src/core/StelVideoMgr.hpp b/src/core/StelVideoMgr.hpp index cdbe27b3a648d..56129fc5a50cc 100644 --- a/src/core/StelVideoMgr.hpp +++ b/src/core/StelVideoMgr.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef ENABLE_MEDIA #include #include @@ -107,7 +108,12 @@ class QGraphicsVideoItem; //! and non-appearing video frame, this seems to be https://bugreports.qt.io/browse/QTBUG-39567. //! This occurred on an Intel NUC5i3 with SSD, so loading the file should not be much of an issue. //! -//! To help in debugging scripts, this module can be quite verbose in the logfile if Stellarium is called with the command-line argument "--verbose". +//! @note You can finetune the amount of media-related messages in the logfile by configuring the logging category stel.Media. +//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Media.debug=true. +//! By default, only Info and more severe messages are displayed. + + +Q_DECLARE_LOGGING_CATEGORY(Media) class StelVideoMgr : public StelModule { @@ -284,7 +290,6 @@ private slots: int lastPos; //!< This should not be required: We must track a bug in QtMultimedia where the QMediaPlayer is in playing state but does not progress the video position. In update() we try to let it run again. } VideoPlayer; QMap videoObjects; - bool verbose; //!< true to write many more log entries (useful for script debugging) Activate with command-line option "--verbose" #endif bool audioEnabled; //!< Allow audio output. May be disabled by command line or config arguments. }; From e311d217d41dcd8eb61d7ad39e51943bd6656fd0 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Mon, 17 Nov 2025 18:11:00 +0100 Subject: [PATCH 03/14] Add logging category stel.Scripting - allows finetuning of log messages - promoted genuine errors to warnings --- src/scripting/ScreenImageMgr.cpp | 3 +- src/scripting/StelMainScriptAPI.cpp | 46 ++++++++------- src/scripting/StelMainScriptAPI.hpp | 8 +++ src/scripting/StelScriptMgr.cpp | 90 ++++++++++++++--------------- src/scripting/StelScriptMgr.hpp | 7 ++- src/scripting/StelScriptOutput.cpp | 15 ++--- src/scripting/V3d.cpp | 4 +- 7 files changed, 93 insertions(+), 80 deletions(-) diff --git a/src/scripting/ScreenImageMgr.cpp b/src/scripting/ScreenImageMgr.cpp index e719052516cd6..fc104aa2d447a 100644 --- a/src/scripting/ScreenImageMgr.cpp +++ b/src/scripting/ScreenImageMgr.cpp @@ -26,6 +26,7 @@ #include "StelCore.hpp" #include "StelModuleMgr.hpp" #include "StelModule.hpp" +#include "StelMainScriptAPI.hpp" #include #include @@ -253,7 +254,7 @@ void ScreenImageMgr::createScreenImage(const QString& id, const QString& filenam } else { - qWarning() << "Failed to create ScreenImage" << id << ": file not found: " << filename; + qCWarning(Scripting) << "Failed to create ScreenImage" << id << ": file not found: " << filename; } } diff --git a/src/scripting/StelMainScriptAPI.cpp b/src/scripting/StelMainScriptAPI.cpp index 79264e19b5b9a..87c7745ae0b4e 100644 --- a/src/scripting/StelMainScriptAPI.cpp +++ b/src/scripting/StelMainScriptAPI.cpp @@ -72,6 +72,8 @@ #include +Q_LOGGING_CATEGORY(Scripting,"stel.Scripting", QtInfoMsg) + StelMainScriptAPI::StelMainScriptAPI(QObject *parent) : QObject(parent) { if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr)) @@ -134,7 +136,7 @@ Color StelMainScriptAPI::color(const QString &cstr) if(qcol.isValid()) res.set( static_cast(qcol.redF()), static_cast(qcol.greenF()), static_cast(qcol.blueF()) ); else - qWarning() << "Color: invalid color name: " << cstr; + qCWarning(Scripting) << "Color: invalid color name: " << cstr; return res; } #endif @@ -290,7 +292,7 @@ void StelMainScriptAPI::setObserverLocation(const QString &id, double duration) if (loc.isValid()) core->moveObserverTo(loc, duration); else - qWarning() << "core.setObserverLocation: location" << id << "invalid, not changing location:" << loc.serializeToLine(); + qCWarning(Scripting) << "core.setObserverLocation: location" << id << "invalid, not changing location:" << loc.serializeToLine(); } QString StelMainScriptAPI::getObserverLocation() @@ -363,9 +365,9 @@ void StelMainScriptAPI::screenshot(const QString& prefix, bool invert, const QSt QString realDir(""); if ((!dir.isEmpty()) && (!StelApp::getInstance().getScriptMgr().getFlagAllowExternalScreenshotDir())) { - qWarning() << "SCRIPT CONFIGURATION ISSUE: the script wants to store a screenshot" << prefix << "." << format << "to an external directory " << dir; - qWarning() << " To enable this, check the settings in the script console"; - qWarning() << " or set entry scripts/flag_allow_screenshots_dir=true in config.ini."; + qCWarning(Scripting) << "SCRIPT CONFIGURATION ISSUE: the script wants to store a screenshot" << prefix << "." << format << "to an external directory " << dir; + qCWarning(Scripting) << " To enable this, check the settings in the script console"; + qCWarning(Scripting) << " or set entry scripts/flag_allow_screenshots_dir=true in config.ini."; } else realDir=dir; @@ -378,7 +380,7 @@ void StelMainScriptAPI::screenshot(const QString& prefix, bool invert, const QSt // Check requested against set image format. if ((!format.isEmpty()) && (StelMainView::getInstance().getScreenshotFormat() != format)) { - qWarning() << "Screenshot format" << format << "not supported. Not saving screenshot."; + qCWarning(Scripting) << "Screenshot format" << format << "not supported. Not saving screenshot."; return; } @@ -475,9 +477,9 @@ void StelMainScriptAPI::setSkyCulture(const QString& id) GETSTELMODULE(StelObjectMgr)->unSelect(); // mistake-proofing! if (!StelApp::getInstance().getSkyCultureMgr().getSkyCultureListIDs().contains(id)) { - qDebug().noquote() << "Could not find skyculture" << id << ". Please check your script."; + qCWarning(Scripting).noquote() << "Could not find skyculture" << id << ". Please check your script."; if (id.startsWith("western", Qt::CaseInsensitive)) - qDebug() << "Western skycultures have been renamed to modern_*. Please update your scripts."; + qCWarning(Scripting) << "Western skycultures have been renamed to modern_*. Please update your scripts."; } else emit requestSetSkyCulture(id); @@ -576,7 +578,7 @@ void StelMainScriptAPI::loadSkyImage(const QString& id, const QString& filename, frameType=StelCore::FrameAltAz; else if (frame!="EqJ2000") { - qDebug() << "StelMainScriptAPI::loadSkyImage(): unknown frame type " << frame << " requested -- Using Equatorial J2000"; + qCWarning(Scripting) << "StelMainScriptAPI::loadSkyImage(): unknown frame type " << frame << " requested -- Using Equatorial J2000"; } emit requestLoadSkyImage(id, path, lon0, lat0, lon1, lat1, lon2, lat2, lon3, lat3, minRes, maxBright, visible, frameType, withAberration); @@ -653,7 +655,7 @@ void StelMainScriptAPI::loadSound(const QString& filename, const QString& id) QString path = StelFileMgr::findFile("scripts/" + filename); if (path.isEmpty()) { - qWarning() << "cannot play sound" << QDir::toNativeSeparators(filename); + qCWarning(Scripting) << "cannot play sound" << QDir::toNativeSeparators(filename); return; } @@ -695,7 +697,7 @@ void StelMainScriptAPI::loadVideo(const QString& filename, const QString& id, fl QString path = StelFileMgr::findFile("scripts/" + filename); if (path.isEmpty()) { - qWarning() << "cannot play video" << QDir::toNativeSeparators(filename); + qCWarning(Scripting) << "cannot play video" << QDir::toNativeSeparators(filename); return; } @@ -785,7 +787,7 @@ void StelMainScriptAPI::setScriptRate(double r) void StelMainScriptAPI::pauseScript() { #ifdef ENABLE_SCRIPT_QML - qDebug() << "NOTE: pauseScript() is no longer supported. Ignoring."; + qCWarning(Scripting) << "NOTE: pauseScript() is no longer supported. Ignoring."; #else return StelApp::getInstance().getScriptMgr().pauseScript(); #endif @@ -804,7 +806,7 @@ void StelMainScriptAPI::setSelectedObjectInfo(const QString& level) else if (level == "Custom") StelApp::getInstance().getGui()->setInfoTextFilters(GETSTELMODULE(StelObjectMgr)->getCustomInfoStrings()); else - qWarning() << "setSelectedObjectInfo unknown level string \"" << level << "\""; + qCWarning(Scripting) << "setSelectedObjectInfo unknown level string \"" << level << "\""; } void StelMainScriptAPI::exit() @@ -824,7 +826,7 @@ QStringList StelMainScriptAPI::getPropertyList() void StelMainScriptAPI::debug(const QString& s) { - qDebug() << "script: " << s; + qCDebug(Scripting) << "script: " << s; StelApp::getInstance().getScriptMgr().debug(s); } @@ -959,7 +961,7 @@ double StelMainScriptAPI::jdFromDateString(const QString& dt, const QString& spe unit = yearLength; else { - qWarning() << "StelMainScriptAPI::setDate - unknown time unit:" << unitString; + qCWarning(Scripting) << "StelMainScriptAPI::setDate - unknown time unit:" << unitString; unit = 0; } @@ -972,7 +974,7 @@ double StelMainScriptAPI::jdFromDateString(const QString& dt, const QString& spe return jd; } - qWarning() << "StelMainScriptAPI::jdFromDateString error: date string" << dt << "not recognised, returning \"now\""; + qCWarning(Scripting) << "StelMainScriptAPI::jdFromDateString error: date string" << dt << "not recognised, returning \"now\""; return StelUtils::getJDFromSystem(); } @@ -994,13 +996,13 @@ void StelMainScriptAPI::waitFor(const QString& dt, const QString& spec) double timeRate = getTimeRate(); if (timeRate == 0.) { - qDebug() << "waitFor() called with no time passing - would be infinite. Not waiting!"; + qCWarning(Scripting) << "waitFor() called with no time passing - would be infinite. Not waiting!"; return; } int interval=qRound(1000*deltaJD*86400/timeRate); if (interval<=0) { - qDebug() << "waitFor() called, but negative interval (time exceeded before starting timer). Not waiting!"; + qCWarning(Scripting) << "waitFor() called, but negative interval (time exceeded before starting timer). Not waiting!"; return; } StelScriptMgr* scriptMgr = &StelApp::getInstance().getScriptMgr(); @@ -1186,7 +1188,7 @@ void StelMainScriptAPI::clear(const QString& state) const int stateInt = stateMap.value(state.toLower(), 0); if (stateInt == 0) { - qWarning() << "State for command clear(" << state << ") not known"; + qCWarning(Scripting) << "State for command clear(" << state << ") not known"; } else { @@ -1411,11 +1413,11 @@ void StelMainScriptAPI::moveToRaDec(const QString& ra, const QString& dec, float Vec3d aimUp; if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(dDec)> (0.9*M_PI/2.0)) ) { - //qDebug() << "ATTENTION: Aiming into pole!"; - //qDebug() << "\tdRa=" << dRa << "dDec=" << dDec; + //qCDebug(Scripting) << "ATTENTION: Aiming into pole!"; + //qCDebug(Scripting) << "\tdRa=" << dRa << "dDec=" << dDec; aimUp=//core->equinoxEquToJ2000( Vec3d(-cos(dRa), -sin(dRa), 0.) * (dDec>0. ? 1. : -1. ); //, StelCore::RefractionOff); - //qDebug() << "\taimUp=" << aimUp; + //qCDebug(Scripting) << "\taimUp=" << aimUp; } else aimUp=core->equinoxEquToJ2000(Vec3d(0., 0., 1.), StelCore::RefractionOff); diff --git a/src/scripting/StelMainScriptAPI.hpp b/src/scripting/StelMainScriptAPI.hpp index 3ff44940c369e..c8c81a88d90e0 100644 --- a/src/scripting/StelMainScriptAPI.hpp +++ b/src/scripting/StelMainScriptAPI.hpp @@ -32,12 +32,20 @@ class QScriptEngine; +Q_DECLARE_LOGGING_CATEGORY(Scripting) + + //! Provide script API for Stellarium global functions. Public slots in this class //! may be used in Stellarium scripts, and are accessed as member function to the //! "core" scripting object. Module-specific functions, such as setting and clearing //! of display flags (e.g. LandscapeMgr::setFlagAtmosphere) can be accessed directly //! via the scripting object with the class name, e.g. by using the scripting command: //! LandscapeMgr.setFlagAtmosphere(true); +//! +//! @note You can finetune the amount of scripting-related messages in the logfile by configuring the logging category stel.Scripting. +//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Scripting.debug=true. +//! By default, only Info and more severe messages are displayed. + class StelMainScriptAPI : public QObject { Q_OBJECT diff --git a/src/scripting/StelScriptMgr.cpp b/src/scripting/StelScriptMgr.cpp index cf01d4fb58be2..93d171f57fbb9 100644 --- a/src/scripting/StelScriptMgr.cpp +++ b/src/scripting/StelScriptMgr.cpp @@ -159,7 +159,7 @@ static QScriptValue vec3fGetB(QScriptContext* context, QScriptEngine *engine) static QScriptValue vec3fSetR(QScriptContext* context, QScriptEngine *engine) { Q_UNUSED(engine) - qDebug() << "setR() does not work. Create a new Color."; + qCDebug(Scripting) << "setR() does not work. Create a new Color."; QScriptValue callee = context->callee(); if (context->argumentCount() == 1) // writing? callee.setProperty("r", context->argument(0)); @@ -168,8 +168,8 @@ static QScriptValue vec3fSetR(QScriptContext* context, QScriptEngine *engine) // This does not work. static QScriptValue vec3fSetG(QScriptContext* context, QScriptEngine *engine) { - qDebug() << "setG() does not work. Create a new Color."; - //qDebug() << "setG called. argcount=" << context->argumentCount() << "value=" << context->argument(0).toNumber(); + qCDebug(Scripting) << "setG() does not work. Create a new Color."; + //qCDebug(Scripting) << "setG called. argcount=" << context->argumentCount() << "value=" << context->argument(0).toNumber(); //Q_UNUSED(engine) QScriptValue callee = context->callee(); if (context->argumentCount() == 1) // writing? @@ -180,7 +180,7 @@ static QScriptValue vec3fSetG(QScriptContext* context, QScriptEngine *engine) static QScriptValue vec3fSetB(QScriptContext* context, QScriptEngine *engine) { Q_UNUSED(engine) - qDebug() << "setB() does not work. Create a new Color."; + qCDebug(Scripting) << "setB() does not work. Create a new Color."; QScriptValue callee = context->callee(); if (context->argumentCount() == 1) // writing? callee.setProperty("b", context->argument(0)); @@ -305,21 +305,21 @@ QScriptValue vec3dToString(QScriptContext* context, QScriptEngine *engine) QScriptValue getX(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); return that.property( "r", QScriptValue::ResolveLocal ); } QScriptValue getY(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); return that.property( "g", QScriptValue::ResolveLocal ); } QScriptValue getZ(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); return that.property( "b", QScriptValue::ResolveLocal ); @@ -327,7 +327,7 @@ QScriptValue getZ(QScriptContext* context, QScriptEngine *engine) QScriptValue setX(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); that.setProperty("r", context->argument(0).toNumber()); @@ -335,7 +335,7 @@ QScriptValue setX(QScriptContext* context, QScriptEngine *engine) } QScriptValue setY(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); that.setProperty("g", context->argument(0).toNumber()); @@ -343,7 +343,7 @@ QScriptValue setY(QScriptContext* context, QScriptEngine *engine) } QScriptValue setZ(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; Q_UNUSED(engine) QScriptValue that = context->thisObject(); that.setProperty("b", context->argument(0).toNumber()); @@ -352,7 +352,7 @@ QScriptValue setZ(QScriptContext* context, QScriptEngine *engine) void vec3dFromScriptValue(const QScriptValue& obj, Vec3d& c) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; c[0] = obj.property("r").toNumber(); c[1] = obj.property("g").toNumber(); c[2] = obj.property("b").toNumber(); @@ -360,7 +360,7 @@ void vec3dFromScriptValue(const QScriptValue& obj, Vec3d& c) QScriptValue vec3dToScriptValue(QScriptEngine *engine, const Vec3d& v) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use V3d."; QScriptValue obj = engine->newObject(); obj.setProperty("r", QScriptValue(engine, static_cast(v[0]))); obj.setProperty("g", QScriptValue(engine, static_cast(v[1]))); @@ -377,7 +377,7 @@ QScriptValue vec3dToScriptValue(QScriptEngine *engine, const Vec3d& v) QScriptValue createVec3d(QScriptContext* context, QScriptEngine *engine) { - qWarning() << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use core.vec3d() or a V3d object."; + qCWarning(Scripting) << "The Vec3d script object is deprecated and will not work in future versions of Stellarium. Use core.vec3d() or a V3d object."; Vec3d c; switch( context->argumentCount() ) { @@ -417,8 +417,8 @@ class StelScriptEngineAgent : public QScriptEngineAgent explicit StelScriptEngineAgent(QScriptEngine *engine); ~StelScriptEngineAgent() override {} - void setPauseScript(bool pause) { qWarning() << "setPauseScript() is deprecated and will no longer be available in future versions of Stellarium."; isPaused=pause; } - bool getPauseScript() { qWarning() << "getPauseScript() is deprecated and will no longer be available in future versions of Stellarium."; return isPaused; } + void setPauseScript(bool pause) { qCWarning(Scripting) << "setPauseScript() is deprecated and will no longer be available in future versions of Stellarium."; isPaused=pause; } + bool getPauseScript() { qCWarning(Scripting) << "getPauseScript() is deprecated and will no longer be available in future versions of Stellarium."; return isPaused; } void positionChange(qint64 scriptId, int lineNumber, int columnNumber) override; @@ -601,7 +601,7 @@ QString StelScriptMgr::getHeaderSingleLineCommentText(const QString& s, const QS { QString msg = QString("Script file %1 could not be opened for reading").arg(QDir::toNativeSeparators(s)); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; return QString(); } @@ -701,7 +701,7 @@ QString StelScriptMgr::getDescription(const QString& s) { QString msg = QString("Script file %1 could not be opened for reading").arg(QDir::toNativeSeparators(s)); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; return QString(); } @@ -760,7 +760,7 @@ bool StelScriptMgr::runPreprocessedScript(const QString &preprocessedScript, con { QString msg = QString("ERROR: there is already a script running, please wait until it's over."); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; return false; } @@ -834,7 +834,7 @@ bool StelScriptMgr::prepareScript( QString &script, const QString &fileName, con { QString msg = QString("Could not find script file %1").arg(QDir::toNativeSeparators(fileName)); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; return false; } @@ -845,7 +845,7 @@ bool StelScriptMgr::prepareScript( QString &script, const QString &fileName, con { QString msg = QString("Cannot open script: %1").arg(QDir::toNativeSeparators(fileName)); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; return false; } @@ -883,7 +883,7 @@ void StelScriptMgr::stopScript() GETSTELMODULE(ScreenImageMgr)->deleteAllImages(); QString msg = QString("INFO: asking running script to exit"); emit scriptDebug(msg); - //qDebug() << msg; + //qCDebug(Scripting) << msg; } else mutex.unlock(); // all was OK, no script was running. @@ -898,7 +898,7 @@ void StelScriptMgr::stopScript() } QString msg = QString("INFO: asking running script to exit"); emit scriptDebug(msg); - //qDebug() << msg; + //qCDebug(Scripting) << msg; engine->abortEvaluation(); } // "Script finished..." is emitted after return from engine->evaluate(). @@ -907,7 +907,7 @@ void StelScriptMgr::stopScript() void StelScriptMgr::setScriptRate(double r) { - //qDebug() << "StelScriptMgr::setScriptRate(" << r << ")"; + qCDebug(Scripting) << "StelScriptMgr::setScriptRate(" << r << ")"; #ifdef ENABLE_SCRIPT_QML if (mutex.tryLock()) { @@ -938,9 +938,9 @@ void StelScriptMgr::setScriptRate(double r) void StelScriptMgr::pauseScript() { #ifdef ENABLE_SCRIPT_QML - qWarning() << "pauseScript() is no longer available and does nothing."; + qCWarning(Scripting) << "pauseScript() is no longer available and does nothing."; #else - qWarning() << "pauseScript() is deprecated and will no longer be available in future versions of Stellarium."; + qCWarning(Scripting) << "pauseScript() is deprecated and will no longer be available in future versions of Stellarium."; emit scriptPaused(); agent->setPauseScript(true); #endif @@ -949,9 +949,9 @@ void StelScriptMgr::pauseScript() void StelScriptMgr::resumeScript() { #ifdef ENABLE_SCRIPT_QML - qWarning() << "resumeScript() is no longer available and does nothing."; + qCWarning(Scripting) << "resumeScript() is no longer available and does nothing."; #else - qWarning() << "resumeScript() is deprecated and will no longer be available in future versions of Stellarium."; + qCWarning(Scripting) << "resumeScript() is deprecated and will no longer be available in future versions of Stellarium."; agent->setPauseScript(false); #endif } @@ -997,9 +997,9 @@ void StelScriptMgr::scriptEnded() {QJSValue::URIError, "URI"}}; QString msg = QString("script error: '%1' @ line %2: %3").arg(errorMap.value(result.errorType()), result.property("lineNumber").toString(), result.toString()); emit scriptDebug(msg); - qWarning() << msg; - qWarning() << "Error name:" << result.property("name").toString() << "message" << result.property("message").toString() - << "fileName" << result.property("fileName").toString() << "lineNumber" << result.property("lineNumber").toString() << "stack" << result.property("stack").toString(); + qCWarning(Scripting) << msg; + qCWarning(Scripting) << "Error name:" << result.property("name").toString() << "message" << result.property("message").toString() + << "fileName" << result.property("fileName").toString() << "lineNumber" << result.property("lineNumber").toString() << "stack" << result.property("stack").toString(); } mutex.unlock(); #else @@ -1009,7 +1009,7 @@ void StelScriptMgr::scriptEnded() QString realPos = lookup( outputPos ); QString msg = QString("script error: \"%1\" @ line %2").arg(engine->uncaughtException().toString(), realPos); emit scriptDebug(msg); - qWarning() << msg; + qCWarning(Scripting) << msg; } #endif GETSTELMODULE(StelMovementMgr)->setMovementSpeedFactor(1.0); @@ -1087,7 +1087,7 @@ void StelScriptMgr::expand(const QString fileName, const QString &input, QString if (incPath.isEmpty()) { QString fail = scriptDir + "/" + incName; - qWarning() << "File not found! Let's check standard scripts directory..."; + qCWarning(Scripting) << "File not found! Let's check standard scripts directory..."; // OK, file is not exists in relative path; Let's check standard scripts directory incPath = StelFileMgr::findFile("scripts/" + incName); @@ -1096,7 +1096,7 @@ void StelScriptMgr::expand(const QString fileName, const QString &input, QString { fail += " or scripts/" + incName; emit scriptDebug(QString("WARNING: could not find script include file: %1").arg(QDir::toNativeSeparators(incName))); - qWarning() << "Could not find script include file: " << QDir::toNativeSeparators(incName); + qCWarning(Scripting) << "Could not find script include file: " << QDir::toNativeSeparators(incName); if( errLoc == -1 ) errLoc = output.length(); output += line + " // <<< " + fail + " not found\n"; outline++; @@ -1116,7 +1116,7 @@ void StelScriptMgr::expand(const QString fileName, const QString &input, QString bool ok = fic.open(QIODevice::ReadOnly); if (ok) { - qWarning() << "script include: " << QDir::toNativeSeparators(incPath); + qCWarning(Scripting) << "script include: " << QDir::toNativeSeparators(incPath); QString aText = QString::fromUtf8(fic.readAll()); expand( incPath, aText, output, scriptDir, errLoc ); fic.close(); @@ -1124,7 +1124,7 @@ void StelScriptMgr::expand(const QString fileName, const QString &input, QString else { emit scriptDebug(QString("WARNING: could not open script include file for reading: %1").arg(QDir::toNativeSeparators(incPath))); - qWarning() << "Could not open script include file for reading: " << QDir::toNativeSeparators(incPath); + qCWarning(Scripting) << "Could not open script include file for reading: " << QDir::toNativeSeparators(incPath); if( errLoc == -1 ) errLoc = output.length(); output += line + " // <<< " + incPath + ": cannot open\n"; outline++; @@ -1140,18 +1140,14 @@ void StelScriptMgr::expand(const QString fileName, const QString &input, QString } num2loc.insert( outline, QPair(fileName, curline) ); - // Do we need this any more? (WL, 2020-04-10) - if (qApp->property("verbose")==true) + // Debug to find stupid errors. The line usually reported may be off due to the preprocess stage. + const QStringList outputList=output.split('\n'); + qCDebug(Scripting) << "Script after preprocessing:"; + int lineIdx=0; + for (const auto& line : outputList) { - // Debug to find stupid errors. The line usually reported may be off due to the preprocess stage. - const QStringList outputList=output.split('\n'); - qDebug() << "Script after preprocessing:"; - int lineIdx=0; - for (const auto& line : outputList) - { - qDebug() << lineIdx << ":" << line; - lineIdx++; - } + qCDebug(Scripting) << lineIdx << ":" << line; + lineIdx++; } return; } @@ -1167,7 +1163,7 @@ QString StelScriptMgr::lookup( int outputPos ) QString path = i.value().first; int inputEnd = i.value().second; int inputPos = outputPos - outputEnd + inputEnd; - // qDebug() << outputPos << " maps to " << path << ":" << inputPos; + // qCDebug(Scripting) << outputPos << " maps to " << path << ":" << inputPos; QString msg; if (path.isEmpty()) msg = QString( "%1" ).arg(inputPos); diff --git a/src/scripting/StelScriptMgr.hpp b/src/scripting/StelScriptMgr.hpp index 5bf3dca3efa22..619c6b51f2928 100644 --- a/src/scripting/StelScriptMgr.hpp +++ b/src/scripting/StelScriptMgr.hpp @@ -49,6 +49,11 @@ class ScriptConsole; //! Notes on migration from QtScript to QJSEngine //! - The old engine had isEvaluating(). We must use a mutex for the same idea. //! - There is no script.pause() function. We can only stop a running script. +//! +//! @note You can finetune the amount of scripting-related messages in the logfile by configuring the logging category stel.Scripting. +//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Scripting.debug=true. +//! By default, only Info and more severe messages are displayed. + class StelScriptMgr : public QObject { Q_OBJECT @@ -82,7 +87,7 @@ friend class ScriptConsole; // Pre-processor functions //! Preprocess script, esp. process include instructions. - //! if the command line option --verbose has been given, + //! If logging level is set to stel.Scripting.debug, //! this dumps the preprocessed script with line numbers attached to log. //! This helps to understand the line number given by the usual error message. bool preprocessScript(const QString fileName, const QString& input, QString& output, const QString& scriptDir, int &errLoc); diff --git a/src/scripting/StelScriptOutput.cpp b/src/scripting/StelScriptOutput.cpp index d78dcceb2c8d3..78d3cae199bed 100644 --- a/src/scripting/StelScriptOutput.cpp +++ b/src/scripting/StelScriptOutput.cpp @@ -22,6 +22,7 @@ #include #include "StelScriptOutput.hpp" #include "StelApp.hpp" +#include "StelMainScriptAPI.hpp" // Init static variables. QFile StelScriptOutput::outputFile; @@ -31,7 +32,7 @@ void StelScriptOutput::init(const QString& outputFilePath) { outputFile.setFileName(outputFilePath); if (!outputFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text | QIODevice::Unbuffered)) - qDebug() << "ERROR: Cannot open file" << outputFilePath; + qCWarning(Scripting) << "ERROR: Cannot open file" << outputFilePath; } void StelScriptOutput::deinit() @@ -64,15 +65,15 @@ void StelScriptOutput::saveOutputAs(const QString &name) if (name.contains("config.ini")) { - qWarning() << "SCRIPTING ERROR: You are trying to overwrite config.ini. Ignoring."; + qCWarning(Scripting) << "SCRIPTING ERROR: You are trying to overwrite config.ini. Ignoring."; return; } if (!okToSaveToAbsolutePath && ((newFileNameInfo.isAbsolute() || (name.contains(".."))))) // The last condition may include dangerous/malicious paths { - qWarning() << "SCRIPTING CONFIGURATION ISSUE: You are trying to save to an absolute pathname or move up in directories."; - qWarning() << " To enable this, check the settings in the script console"; - qWarning() << " or edit config.ini and set [scripts]/flag_allow_write_absolute_path=true"; + qCWarning(Scripting) << "SCRIPTING CONFIGURATION ISSUE: You are trying to save to an absolute pathname or move up in directories."; + qCWarning(Scripting) << " To enable this, check the settings in the script console"; + qCWarning(Scripting) << " or edit config.ini and set [scripts]/flag_allow_write_absolute_path=true"; asFile.setFileName(dir.absolutePath() + "/" + newFileNameInfo.fileName()); } else if (okToSaveToAbsolutePath && (newFileNameInfo.isAbsolute())) @@ -86,10 +87,10 @@ void StelScriptOutput::saveOutputAs(const QString &name) if (!asFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text | QIODevice::Unbuffered)) { - qDebug() << "ERROR: Cannot open file" << asFile.fileName(); + qCWarning(Scripting) << "ERROR: Cannot open file" << asFile.fileName(); return; } - qDebug() << "saving copy of output.txt to " << asFile.fileName(); + qCDebug(Scripting) << "saving copy of output.txt to " << asFile.fileName(); asFile.write(outputText.toUtf8()); asFile.close(); } diff --git a/src/scripting/V3d.cpp b/src/scripting/V3d.cpp index fa56cee1af926..938299eea5e95 100644 --- a/src/scripting/V3d.cpp +++ b/src/scripting/V3d.cpp @@ -18,11 +18,11 @@ */ #include "V3d.hpp" +#include "StelMainScriptAPI.hpp" #include #include -#include V3d::V3d(const V3d &other) : QObject() // copy constructor { @@ -100,7 +100,7 @@ Color::Color(QString hexColor) : QObject() } else { - qWarning() << "Bad color string: " << hexColor; + qCWarning(Scripting) << "Bad color string: " << hexColor; m_r=m_g=m_b=0.; } } From f08b14e19c809ec8c3772521fc38bc0824b76ff6 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Mon, 17 Nov 2025 23:54:00 +0100 Subject: [PATCH 04/14] Add logging category stel.Atmosphere - for Atmosphere-related log messages - Default is QtInfoMsg, qDebug() only when configured --- src/core/modules/Atmosphere.hpp | 2 ++ src/core/modules/AtmospherePreetham.cpp | 9 +++++---- src/core/modules/AtmosphereShowMySky.cpp | 12 +++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/modules/Atmosphere.hpp b/src/core/modules/Atmosphere.hpp index 102209dce4206..8bbff08d14cc9 100644 --- a/src/core/modules/Atmosphere.hpp +++ b/src/core/modules/Atmosphere.hpp @@ -34,6 +34,8 @@ class StelLocation; class StelCore; class Planet; +Q_DECLARE_LOGGING_CATEGORY(Atmo) + class Atmosphere { public: diff --git a/src/core/modules/AtmospherePreetham.cpp b/src/core/modules/AtmospherePreetham.cpp index a1531874dcd0c..efc196cffb224 100644 --- a/src/core/modules/AtmospherePreetham.cpp +++ b/src/core/modules/AtmospherePreetham.cpp @@ -23,7 +23,7 @@ #include "StelApp.hpp" #include "StelProjector.hpp" #include "StelToneReproducer.hpp" -#include "StelTextureMgr.hpp" +//#include "StelTextureMgr.hpp" #include "StelCore.hpp" #include "StelPainter.hpp" #include "Skylight.hpp" @@ -33,6 +33,7 @@ #include #include +Q_LOGGING_CATEGORY(Atmo,"stel.Atmosphere", QtInfoMsg) AtmospherePreetham::AtmospherePreetham(Skylight& sky) : viewport(0,0,0,0) @@ -59,7 +60,7 @@ AtmospherePreetham::AtmospherePreetham(Skylight& sky) } if (!vShader.log().isEmpty()) { - qWarning() << "Warnings while compiling Preetham atmosphere vertex shader: " << vShader.log(); + qCWarning(Atmo) << "Warnings while compiling Preetham atmosphere vertex shader: " << vShader.log(); } QOpenGLShader fShader(QOpenGLShader::Fragment); if (!fShader.compileSourceCode( @@ -74,7 +75,7 @@ AtmospherePreetham::AtmospherePreetham(Skylight& sky) } if (!fShader.log().isEmpty()) { - qWarning() << "Warnings while compiling Preetham atmosphere fragment shader: " << vShader.log(); + qCWarning(Atmo) << "Warnings while compiling Preetham atmosphere fragment shader: " << vShader.log(); } atmoShaderProgram = new QOpenGLShaderProgram(); atmoShaderProgram->addShader(&vShader); @@ -229,7 +230,7 @@ void AtmospherePreetham::computeColor(StelCore* core, const double JD, const Pla Vec3d moonPos = sunPos; // Calculate the atmosphere RGB for each point of the grid. We can use abbreviated numbers here. - // qDebug("touch at %f\tnow at %f (%f)\n", touch_angle, separation_angle, separation_angle/touch_angle); + // qCDebug(Atmo, "touch at %f\tnow at %f (%f)\n", touch_angle, separation_angle, separation_angle/touch_angle); // bright stars should be visible at total eclipse // TODO: correct for atmospheric diffusion // TODO: use better coverage function (non-linear) diff --git a/src/core/modules/AtmosphereShowMySky.cpp b/src/core/modules/AtmosphereShowMySky.cpp index 946c90dc09f63..18efb3b83f63a 100644 --- a/src/core/modules/AtmosphereShowMySky.cpp +++ b/src/core/modules/AtmosphereShowMySky.cpp @@ -246,12 +246,12 @@ void AtmosphereShowMySky::loadShaders() { if(!success) { - qCritical("Error while compiling %s: %s", what, shader.log().toLatin1().constData()); + qCCritical(Atmo, "Error while compiling %s: %s", what, shader.log().toLatin1().constData()); throw InitFailure("Shader compilation failed"); } if(!shader.log().isEmpty()) { - qWarning("Warnings while compiling %s: %s", what, shader.log().toLatin1().constData()); + qCWarning(Atmo, "Warnings while compiling %s: %s", what, shader.log().toLatin1().constData()); } }; @@ -413,7 +413,7 @@ AtmosphereShowMySky::AtmosphereShowMySky(const double initialAltitude) { atmoRes = reducedResolution; if (reducedResolution>1) - qDebug() << "Atmosphere runs with statically reduced resolution:" << reducedResolution; + qCDebug(Atmo) << "Atmosphere runs with statically reduced resolution:" << reducedResolution; } resolveFunctions(); @@ -425,7 +425,7 @@ AtmosphereShowMySky::AtmosphereShowMySky(const double initialAltitude) if(!gl) throw InitFailure(q_("Failed to get OpenGL 3.3 support functions")); - qDebug() << "Will load CalcMySky atmosphere model from" << pathToData; + qCDebug(Atmo) << "Will load CalcMySky atmosphere model from" << pathToData; skySettings_.reset(new SkySettings); auto& settings = *static_cast(skySettings_.get()); settings.altitude_ = initialAltitude; @@ -657,9 +657,7 @@ bool AtmosphereShowMySky::dynamicResolution(StelProjectorP prj, Vec3d &currPos, if (prevRes!=atmoRes) { resizeRenderTarget(width, height); - bool verbose=qApp->property("verbose").toBool(); - if (verbose) - qDebug() << "dynResTimer" << dynResTimer << "atmoRes" << atmoRes << "changeOfView" << changeOfView.norm() << changeOfView; + qCDebug(Atmo) << "dynResTimer" << dynResTimer << "atmoRes" << atmoRes << "changeOfView" << changeOfView.norm() << changeOfView; } // At reduced resolution, we hurry to redraw - at full resolution, we have time. dynResTimer=timeout?17:5; From ebec7d130d0a8d02f748f28b332454fa98f38684 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Mon, 17 Nov 2025 23:57:48 +0100 Subject: [PATCH 05/14] Add logging category stel.Texture - for Texture-related log messages - Default is QtInfoMsg, qDebug() only when configured --- src/core/StelTexture.cpp | 32 ++++++++++++++++---------------- src/core/StelTexture.hpp | 3 +++ src/core/StelTextureMgr.cpp | 22 +++++++++++----------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/core/StelTexture.cpp b/src/core/StelTexture.cpp index 93195226fc253..fdc5b4a9edfd8 100644 --- a/src/core/StelTexture.cpp +++ b/src/core/StelTexture.cpp @@ -39,6 +39,8 @@ # define GL_TEXTURE_MAX_ANISOTROPY 0x84FE #endif +Q_LOGGING_CATEGORY(Tex,"stel.Texture", QtInfoMsg) + // Let's try to keep 120 FPS even if textures are loaded every frame // (60 FPS if all the other computations take the same time per frame). constexpr double MAX_LOAD_NANOSEC_PER_FRAME = 1e9 / 120; @@ -68,8 +70,8 @@ StelTexture::~StelTexture() if (gl->glIsTexture(id)==GL_FALSE) { GLenum err = gl->glGetError(); - qWarning() << "StelTexture::~StelTexture() tried to delete invalid texture with ID=" - << id << "Current GL ERROR status is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")"; + qCWarning(Tex) << "StelTexture::~StelTexture() tried to delete invalid texture with ID=" + << id << "Current GL ERROR status is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")"; } else { @@ -79,15 +81,14 @@ StelTexture::~StelTexture() glSize = 0; } #ifndef NDEBUG - if (qApp->property("verbose") == true) - qDebug() << "Deleted StelTexture" << id << ", total memory usage " - << textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB"; + qCDebug(Tex) << "Deleted StelTexture" << id << ", total memory usage " + << textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB"; #endif id = 0; } else if (id) { - qWarning()<<"Cannot delete texture"<1) - qDebug() << "decimated texture width: " << image.width() << "/" << decimate << "->" << width; + qCDebug(Tex) << "decimated texture width: " << image.width() << "/" << decimate << "->" << width; #endif if(width != image.width() || height != image.height()) { if (decimate == 1 || width > glInfo.maxTextureSize || height > glInfo.maxTextureSize) - qWarning().nospace() << "Got a texture with too large dimensions: " - << image.width() << "x" << image.height() - << ", while maximum size is " << glInfo.maxTextureSize - << ". Shrinking to fit in the limit."; + qCWarning(Tex).nospace() << "Got a texture with too large dimensions: " + << image.width() << "x" << image.height() + << ", while maximum size is " << glInfo.maxTextureSize + << ". Shrinking to fit in the limit."; image = image.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } @@ -510,10 +511,9 @@ bool StelTexture::glLoad(const GLData& data) textureMgr->idMap.insert(id,sharedFromThis()); #ifndef NDEBUG - if (qApp->property("verbose") == true) - qDebug() << "StelTexture" << id << "of size" << width << u8"×" << height - << "uploaded, total memory usage " - << textureMgr->glMemoryUsage / (1024.0 * 1024.0) << "MB"; + qCDebug(Tex) << "StelTexture" << id << "of size" << width << u8"×" << height + << "uploaded, total memory usage " + << textureMgr->glMemoryUsage / (1024.0 * 1024.0) << "MB"; #endif // Report success of texture loading diff --git a/src/core/StelTexture.hpp b/src/core/StelTexture.hpp index e24b9531ff30d..ec33acc95d5c3 100644 --- a/src/core/StelTexture.hpp +++ b/src/core/StelTexture.hpp @@ -25,6 +25,7 @@ #include #include #include +#include class QFile; class StelTextureMgr; @@ -35,6 +36,8 @@ template class QFuture; #define GL_CLAMP_TO_EDGE 0x812F #endif +Q_DECLARE_LOGGING_CATEGORY(Tex) + //! @class StelTexture //! Base texture class. For creating an instance, use StelTextureMgr::createTexture() and StelTextureMgr::createTextureThread() //! @sa StelTextureSP diff --git a/src/core/StelTextureMgr.cpp b/src/core/StelTextureMgr.cpp index 5173c8a8412ce..cfab2e2083be3 100644 --- a/src/core/StelTextureMgr.cpp +++ b/src/core/StelTextureMgr.cpp @@ -45,7 +45,7 @@ StelTextureMgr::StelTextureMgr(QObject *parent) QOpenGLContext* ctx = QOpenGLContext::currentContext(); ctx->functions()->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize); if (maxTexSize<8192) - qDebug() << "Max texture size:" << maxTexSize; + qCDebug(Tex) << "Max texture size:" << maxTexSize; StelTexture::textureMgr = this; connect(&StelMainView::getInstance(), &StelMainView::frameFinished, this, &StelTextureMgr::onFrameFinished); @@ -59,7 +59,7 @@ StelTextureSP StelTextureMgr::createTexture(const QString& afilename, const Stel if(!file.exists()) { canPath=""; // code name for "utterly broken texture" - qWarning()<<"Texture"<fullPath << "needs rescaling to 16x16 ..."; + qCWarning(Tex) << "Undersize texture image" << tex->fullPath << "needs rescaling to 16x16 ..."; image=image.scaled(qMax(image.width(), 16), qMax(image.height(), 16), Qt::IgnoreAspectRatio, Qt::FastTransformation); } // Try to use a texture image even if of excessive size. if ((image.width()>maxTexSize) || (image.height()>maxTexSize)) { - qWarning() << "Oversize texture image" << tex->fullPath << "needs rescaling to" << qMin(image.width(), maxTexSize) << "x" << qMin(image.height(), maxTexSize) << "..."; + qCWarning(Tex) << "Oversize texture image" << tex->fullPath << "needs rescaling to" << qMin(image.width(), maxTexSize) << "x" << qMin(image.height(), maxTexSize) << "..."; image=image.scaled(qMin(image.width(), maxTexSize), qMin(image.height(), maxTexSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } @@ -126,17 +126,17 @@ StelTextureSP StelTextureMgr::createTexture(const QString& afilename, const Stel ".*.*.*.*" }; image=QImage(chess_xpm); - qWarning() << "Unclear error: " << tex->getErrorMessage(); + qCWarning(Tex) << "Unclear error: " << tex->getErrorMessage(); if (tex->glLoad(image)) { - qWarning() << "Now using checkerboard texture instead of " << tex->fullPath; + qCWarning(Tex) << "Now using checkerboard texture instead of " << tex->fullPath; textureCache.insert(canPath,tex); return tex; } else { - qWarning() << "Cannot load any texture for" << tex->fullPath << ":" << tex->getErrorMessage(); + qCWarning(Tex) << "Cannot load any texture for" << tex->fullPath << ":" << tex->getErrorMessage(); return StelTextureSP(); } } @@ -157,7 +157,7 @@ StelTextureSP StelTextureMgr::createTextureThread(const QString& url, const Stel if(canPath.isEmpty()) //file does not exist { - qWarning()<<"Texture"<getErrorMessage(); + qCWarning(Tex)<getErrorMessage(); return StelTextureSP(); } } @@ -262,7 +262,7 @@ StelTextureSP StelTextureMgr::getDitheringTexture(const int samplerToBindTo) } else { - qWarning() << "Failed to wrap dither pattern texture:" << ditheringTexture->getErrorMessage(); + qCWarning(Tex) << "Failed to wrap dither pattern texture:" << ditheringTexture->getErrorMessage(); return StelTextureSP(); } } From ee51316a02101173957be0e5cca290cb18d66eb0 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Tue, 18 Nov 2025 18:32:14 +0100 Subject: [PATCH 06/14] Add logging categories stel.GPS and stel.LocIP - for GPS-related and IP-related log messages by StelLocationMgr - Default is QtInfoMsg, qDebug() only when configured --- src/core/StelLocationMgr.cpp | 271 +++++++++++++++-------------------- src/core/StelLocationMgr.hpp | 13 ++ 2 files changed, 126 insertions(+), 158 deletions(-) diff --git a/src/core/StelLocationMgr.cpp b/src/core/StelLocationMgr.cpp index 538f707bb7f2e..fcae684438666 100644 --- a/src/core/StelLocationMgr.cpp +++ b/src/core/StelLocationMgr.cpp @@ -47,6 +47,9 @@ #include #endif +Q_LOGGING_CATEGORY(GPS,"stel.GPS", QtInfoMsg) +Q_LOGGING_CATEGORY(LocIP,"stel.LocIP", QtInfoMsg) + TimezoneNameMap StelLocationMgr::locationDBToIANAtranslations; QList StelLocationMgr::regions; @@ -64,8 +67,7 @@ LibGPSLookupHelper::LibGPSLookupHelper(QObject *parent) QString gpsdPort=conf->value("gui/gpsd_port", DEFAULT_GPSD_PORT).toString(); timer.setSingleShot(false); - if (qApp->property("verbose").toBool()) - qDebug() << "Opening GPSD connection to" << gpsdHostname << ":" << gpsdPort; + qCDebug(GPS) << "Opening GPSD connection to" << gpsdHostname << ":" << gpsdPort; // Example almost straight from http://www.catb.org/gpsd/client-howto.html gps_rec = new gpsmm(gpsdHostname.toUtf8(), gpsdPort.toUtf8()); if(gps_rec->is_open()) @@ -77,7 +79,7 @@ LibGPSLookupHelper::LibGPSLookupHelper(QObject *parent) connect(&timer, SIGNAL(timeout()), this, SLOT(query())); } else - qWarning()<<"libGPS lookup not ready, GPSD probably not running."; + qCWarning(GPS)<<"libGPS lookup not ready, GPSD probably not running."; } LibGPSLookupHelper::~LibGPSLookupHelper() @@ -101,8 +103,6 @@ void LibGPSLookupHelper::setPeriodicQuery(int interval) } void LibGPSLookupHelper::query() { - bool verbose=qApp->property("verbose").toBool(); - if(!ready) { emit queryError("GPSD helper not ready"); @@ -116,12 +116,11 @@ void LibGPSLookupHelper::query() while (tries<10) { tries++; - if (verbose) - qDebug() << "query(): tries=" << tries; + qCDebug(GPS) << "query(): tries=" << tries; if (!gps_rec->waiting(750000)) // argument usec. wait 0.75 sec. (example had 50s) { - qDebug() << " - waiting timed out after 0.75sec."; + qCInfo(GPS) << " - waiting timed out after 0.75sec."; continue; } @@ -137,7 +136,7 @@ void LibGPSLookupHelper::query() // if (newdata->status==0) // no fix? // { // // This can happen indoors. -// qDebug() << "GPS has no fix."; +// qCDebug(GPS) << "GPS has no fix."; // emit queryError("GPSD query: No Fix."); // return; // } @@ -155,49 +154,45 @@ void LibGPSLookupHelper::query() fixmode=newdata->fix.mode; // 0:not_seen, 1:no_fix, 2:2Dfix(no alt), 3:3Dfix(perfect) - if (verbose) - qDebug() << "GPSD newdata->fix.mode=" << fixmode; + qCDebug(GPS) << "GPSD newdata->fix.mode=" << fixmode; if (fixmode==0) { // This may come just after creation of the GPSDhelper. // It seems to take some time to fill the data. - if (verbose) - qDebug() << "GPSD seems not ready yet. Retry."; + qCDebug(GPS) << "GPSD seems not ready yet. Retry."; continue; } - if (verbose) - { - //qDebug() << "newdata->online=" << newdata->online; - qDebug() << "Solution from " << newdata->satellites_used << "out of " << newdata->satellites_visible << " visible Satellites."; - dop_t dop=newdata->dop; + //qCDebug(GPS) << "newdata->online=" << newdata->online; + qCDebug(GPS) << "Solution from " << newdata->satellites_used << "out of " << newdata->satellites_visible << " visible Satellites."; + dop_t dop=newdata->dop; #if GPSD_API_MAJOR_VERSION < 9 - qDebug() << "GPSD data: Long" << newdata->fix.longitude << "Lat" << newdata->fix.latitude << "Alt" << newdata->fix.altitude; + qCDebug(GPS) << "GPSD data: Long" << newdata->fix.longitude << "Lat" << newdata->fix.latitude << "Alt" << newdata->fix.altitude; #else - qDebug() << "GPSD data: Long" << newdata->fix.longitude << "Lat" << newdata->fix.latitude << "Alt" << newdata->fix.altHAE; + qCDebug(GPS) << "GPSD data: Long" << newdata->fix.longitude << "Lat" << newdata->fix.latitude << "Alt" << newdata->fix.altHAE; #endif - qDebug() << "Dilution of Precision:"; - qDebug() << " - xdop:" << dop.xdop << "ydop:" << dop.ydop; - qDebug() << " - pdop:" << dop.pdop << "hdop:" << dop.hdop; - qDebug() << " - vdop:" << dop.vdop << "tdop:" << dop.tdop << "gdop:" << dop.gdop; - // GPSD API 8.0: - // * Remove epe from gps_data_t, it duplicates gps_fix_t eph - // * Added sep (estimated spherical error, 3D) - // Details: https://github.com/Stellarium/stellarium/issues/733 - // #if GPSD_API_MAJOR_VERSION >= 8 - // qDebug() << "Spherical Position Error (sep):" << newdata->fix.sep; - // #else - // qDebug() << "Spherical Position Error (epe):" << newdata->epe; - // #endif - } + qCDebug(GPS) << "Dilution of Precision:"; + qCDebug(GPS) << " - xdop:" << dop.xdop << "ydop:" << dop.ydop; + qCDebug(GPS) << " - pdop:" << dop.pdop << "hdop:" << dop.hdop; + qCDebug(GPS) << " - vdop:" << dop.vdop << "tdop:" << dop.tdop << "gdop:" << dop.gdop; + // GPSD API 8.0: + // * Remove epe from gps_data_t, it duplicates gps_fix_t eph + // * Added sep (estimated spherical error, 3D) + // Details: https://github.com/Stellarium/stellarium/issues/733 + // #if GPSD_API_MAJOR_VERSION >= 8 + // qCDebug(GPS) << "Spherical Position Error (sep):" << newdata->fix.sep; + // #else + // qCDebug(GPS) << "Spherical Position Error (epe):" << newdata->epe; + // #endif + loc.setLongitude(static_cast (newdata->fix.longitude)); loc.setLatitude (static_cast (newdata->fix.latitude)); // Frequently hdop, vdop and satellite counts are NaN. Sometimes they show OK. This is minor issue. - if ((verbose) && (fixmode<3)) + if (fixmode<3) { - qDebug() << "GPSDfix " << fixmode << ": Location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); - qDebug() << " Estimated HDOP " << newdata->dop.hdop << "m from " << newdata->satellites_used << "(of" << newdata->satellites_visible << "visible) satellites"; + qCDebug(GPS) << "GPSDfix " << fixmode << ": Location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); + qCDebug(GPS) << " Estimated HDOP " << newdata->dop.hdop << "m from " << newdata->satellites_used << "(of" << newdata->satellites_visible << "visible) satellites"; } else { @@ -206,11 +201,8 @@ void LibGPSLookupHelper::query() #else loc.altitude=static_cast(newdata->fix.altHAE); #endif - if (verbose) - { - qDebug() << "GPSDfix " << fixmode << ": Location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); - qDebug() << " Estimated HDOP " << newdata->dop.hdop << "m, VDOP " << newdata->dop.vdop << "m from " << newdata->satellites_used << "(of" << newdata->satellites_visible << "visible) satellites"; - } + qCDebug(GPS) << "GPSDfix " << fixmode << ": Location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); + qCDebug(GPS) << " Estimated HDOP " << newdata->dop.hdop << "m, VDOP " << newdata->dop.vdop << "m from " << newdata->satellites_used << "(of" << newdata->satellites_visible << "visible) satellites"; break; // escape from the tries loop } } @@ -221,12 +213,11 @@ void LibGPSLookupHelper::query() emit queryError("GPSD: Could not get valid position."); return; } - if ((verbose) && (fixmode<3)) + if (fixmode<3) { - qDebug() << "Fix only quality " << fixmode << " after " << tries << " tries"; + qCInfo(GPS) << "Fix only quality " << fixmode << " after " << tries << " tries"; } - if (verbose) - qDebug() << "GPSD location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); + qCDebug(GPS) << "GPSD location" << QString("lat %1, long %2, alt %3").arg(loc.getLatitude()).arg(loc.getLongitude()).arg(loc.altitude); loc.role = 'X'; emit queryFinished(loc); @@ -367,18 +358,14 @@ void NMEALookupHelper::setPeriodicQuery(int interval) void NMEALookupHelper::nmeaUpdated(const QGeoPositionInfo &update) { - bool verbose=qApp->property("verbose").toBool(); - if (verbose) - qDebug() << "NMEA updated"; + qCDebug(GPS) << "NMEA updated"; QGeoCoordinate coord=update.coordinate(); QDateTime timestamp=update.timestamp(); - if (verbose) - { - qDebug() << " - time: " << timestamp.toString(); - qDebug() << " - location: Long=" << coord.longitude() << " Lat=" << coord.latitude() << " Alt=" << coord.altitude(); - } + qCDebug(GPS) << " - time: " << timestamp.toString(); + qCDebug(GPS) << " - location: Long=" << coord.longitude() << " Lat=" << coord.latitude() << " Alt=" << coord.altitude(); + if (update.isValid()) // emit queryFinished(loc) with new location { StelLocation loc; @@ -391,8 +378,7 @@ void NMEALookupHelper::nmeaUpdated(const QGeoPositionInfo &update) } else { - if (verbose) - qDebug() << "(This position update was an invalid package)"; + qCWarning(GPS) << "(This position update was an invalid package)"; emit queryError("NMEA update: invalid package"); } } @@ -956,61 +942,57 @@ bool StelLocationMgr::deleteUserLocation(const QString& id) // lookup location from OS location service or IP address. void StelLocationMgr::locationFromIP() { -// TODO: Find out how to properly setup geoclue2 on Linux, then reactivate. + // TODO: Find out how to properly setup geoclue2 on Linux, then reactivate. #ifdef Q_OS_WIN #if (QT_VERSION>=QT_VERSION_CHECK(6,6,0)) - QLocationPermission locationPermission; - // Try to get high-precision location first - locationPermission.setAccuracy(QLocationPermission::Precise); - qApp->requestPermission(locationPermission, [&locationPermission](const QPermission &permission) { - if (permission.status() == Qt::PermissionStatus::Denied) - { - // Fall back to configure low-precision - locationPermission.setAccuracy(QLocationPermission::Approximate); - } - }); - qApp->requestPermission(locationPermission, [this](const QPermission &permission) { - if ((permission.status() == Qt::PermissionStatus::Granted) - && qGeoPositionInfoSource - && (qGeoPositionInfoSource->supportedPositioningMethods() & QGeoPositionInfoSource::AllPositioningMethods)) - { - if (qApp->property("verbose").toBool()) - { - qDebug() << "permission granted, doing OS service lookup for location..."; - qDebug() << "Location provider:" << qGeoPositionInfoSource->sourceName(); - qDebug() << "Location provider supported caps:" << qGeoPositionInfoSource->supportedPositioningMethods(); - } - // Trigger the actual Qt Location lookup from OS - qGeoPositionInfoSource->requestUpdate(); - if (qApp->property("verbose").toBool()) - qDebug() << "permission granted, doing OS service lookup for location... postRequest "; - } + QLocationPermission locationPermission; + // Try to get high-precision location first + locationPermission.setAccuracy(QLocationPermission::Precise); + qApp->requestPermission(locationPermission, [&locationPermission](const QPermission &permission) { + if (permission.status() == Qt::PermissionStatus::Denied) + { + // Fall back to configure low-precision + locationPermission.setAccuracy(QLocationPermission::Approximate); + } + }); + qApp->requestPermission(locationPermission, [this](const QPermission &permission) { + if ((permission.status() == Qt::PermissionStatus::Granted) + && qGeoPositionInfoSource + && (qGeoPositionInfoSource->supportedPositioningMethods() & QGeoPositionInfoSource::AllPositioningMethods)) + { + qCDebug(LocIP) << "permission granted, doing OS service lookup for location..."; + qCDebug(LocIP) << "Location provider:" << qGeoPositionInfoSource->sourceName(); + qCDebug(LocIP) << "Location provider supported caps:" << qGeoPositionInfoSource->supportedPositioningMethods(); + + // Trigger the actual Qt Location lookup from OS + qGeoPositionInfoSource->requestUpdate(); + qCDebug(LocIP) << "permission granted, doing OS service lookup for location... postRequest "; + } #else if (qGeoPositionInfoSource && (qGeoPositionInfoSource->supportedPositioningMethods() & QGeoPositionInfoSource::AllPositioningMethods)) - { - qDebug() << "Doing OS service lookup for location..."; - // Trigger the actual Qt Location lookup from OS - qGeoPositionInfoSource->requestUpdate(); - qDebug() << "Doing OS service lookup for location... postRequest "; - } + { + qCDebug(LocIP) << "Doing OS service lookup for location..."; + // Trigger the actual Qt Location lookup from OS + qGeoPositionInfoSource->requestUpdate(); + qCDebug(LocIP) << "Doing OS service lookup for location... postRequest "; + } #endif - else - { + else + { #endif // OLD METHOD - if (qApp->property("verbose").toBool()) - qDebug() << "permission not granted or no QGeoPositionInfoSource, doing freegeoIP service lookup for location"; - - QSettings* conf = StelApp::getInstance().getSettings(); - QNetworkRequest req( QUrl( conf->value("main/geoip_api_url", "https://freegeoip.stellarium.org/json/").toString() ) ); - req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); - req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); - QNetworkReply* networkReply=StelApp::getInstance().getNetworkAccessManager()->get(req); - connect(networkReply, SIGNAL(finished()), this, SLOT(changeLocationFromNetworkLookup())); + qCDebug(LocIP) << "permission not granted or no QGeoPositionInfoSource, doing freegeoIP service lookup for location"; + + QSettings* conf = StelApp::getInstance().getSettings(); + QNetworkRequest req( QUrl( conf->value("main/geoip_api_url", "https://freegeoip.stellarium.org/json/").toString() ) ); + req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); + QNetworkReply* networkReply=StelApp::getInstance().getNetworkAccessManager()->get(req); + connect(networkReply, SIGNAL(finished()), this, SLOT(changeLocationFromNetworkLookup())); #ifdef Q_OS_WIN - } + } #if (QT_VERSION>=QT_VERSION_CHECK(6,6,0)) - }); +}); #endif #endif } @@ -1057,8 +1039,6 @@ void StelLocationMgr::positionUpdatedFromOS(const QGeoPositionInfo &info) #ifdef ENABLE_GPS void StelLocationMgr::locationFromGPS(int interval) { - const bool verbose=qApp->property("verbose").toBool(); - #ifdef ENABLE_LIBGPS if(!libGpsHelper) { @@ -1080,20 +1060,18 @@ void StelLocationMgr::locationFromGPS(int interval) // It seems better to also destroy it after finish of queries here and in case of non-readiness below. if (interval==0) { - if (verbose) - qDebug() << "Deactivating and deleting LibGPShelper..."; + qCDebug(GPS) << "Deactivating and deleting LibGPShelper..."; delete libGpsHelper; libGpsHelper=nullptr; emit gpsQueryFinished(true); // signal "successful operation", avoid showing any error in GUI. - if (verbose) - qDebug() << "Deactivating and deleting LibGPShelper... DONE"; + qCDebug(GPS) << "Deactivating and deleting LibGPShelper... DONE"; } } return; } else { - qDebug() << "LibGPSHelper not ready. Attempting a direct NMEA connection instead."; + qCWarning(GPS) << "LibGPSHelper not ready. Attempting a direct NMEA connection instead."; delete libGpsHelper; libGpsHelper=nullptr; } @@ -1101,11 +1079,9 @@ void StelLocationMgr::locationFromGPS(int interval) //If positionSource is working and we are switching off, don't create a nmeaHelper. (Not critical, just no need to handle one failed lookup.) if(!nmeaHelper && !positionSource) { - if (verbose) - qDebug() << "Creating new NMEAhelper..."; + qCDebug(GPS) << "Creating new NMEAhelper..."; nmeaHelper = new NMEALookupHelper(this); - if (verbose) - qDebug() << "Creating new NMEAhelper...done"; + qCDebug(GPS) << "Creating new NMEAhelper...done"; } if(nmeaHelper && nmeaHelper->isReady()) { @@ -1118,13 +1094,11 @@ void StelLocationMgr::locationFromGPS(int interval) nmeaHelper->setPeriodicQuery(interval); if (interval==0) { - if (verbose) - qDebug() << "Deactivating and deleting NMEAhelper..."; + qCDebug(GPS) << "Deactivating and deleting NMEAhelper..."; delete nmeaHelper; nmeaHelper=nullptr; emit gpsQueryFinished(true); // signal "successful operation", avoid showing any error in GUI. - if (verbose) - qDebug() << "Deactivating and deleting NMEAhelper... DONE"; + qCDebug(GPS) << "Deactivating and deleting NMEAhelper... DONE"; } } return; @@ -1132,41 +1106,33 @@ void StelLocationMgr::locationFromGPS(int interval) else { // something went wrong. However, a dysfunctional nmeaHelper may still exist, better delete it. - if (verbose) - qDebug() << "nmeaHelper not ready. Something went wrong."; + qCDebug(GPS) << "nmeaHelper not ready. Something went wrong."; if (nmeaHelper) { delete nmeaHelper; nmeaHelper=nullptr; } } - if (verbose) - { - qDebug() << "Neither GPSD nor NMEAhelper. Try QGeoPositionInfoSource, one of"; - qDebug() << QGeoPositionInfoSource::availableSources(); - } + qCDebug(GPS) << "Neither GPSD nor NMEAhelper. Try QGeoPositionInfoSource, one of"; + qCDebug(GPS) << QGeoPositionInfoSource::availableSources(); // TBD: Here we may later load a particular preferred source (OS dependent!) configured in config.ini. if (!positionSource && (QGeoPositionInfoSource::availableSources().length()>0)) positionSource = QGeoPositionInfoSource::createDefaultSource(this); if (positionSource && (positionSource->supportedPositioningMethods() & QGeoPositionInfoSource::AllPositioningMethods)) { - if (verbose) - qDebug() << "Our QGeoPositionInfoSource is:" << positionSource->sourceName(); + qCDebug(GPS) << "Our QGeoPositionInfoSource is:" << positionSource->sourceName(); if (interval) { - if (verbose) - qDebug() << "Setting up new positionSource..."; - qDebug() << positionSource->supportedPositioningMethods(); + qCDebug(GPS) << "Setting up new positionSource..."; + qCDebug(GPS) << positionSource->supportedPositioningMethods(); positionSource->setUpdateInterval(interval); connect(positionSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); positionSource->startUpdates(); - if (verbose) - qDebug() << "Setting up new positionSource...done"; + qCDebug(GPS) << "Setting up new positionSource...done"; } else { - if (verbose) - qDebug() << "Deactivating and deleting gps..."; + qCDebug(GPS) << "Deactivating and deleting positionSource..."; positionSource->stopUpdates(); delete positionSource; positionSource=nullptr; @@ -1176,7 +1142,7 @@ void StelLocationMgr::locationFromGPS(int interval) else { if (positionSource) - qWarning() << "positionSource" << positionSource->sourceName() << "does not provide data. Giving up."; + qCWarning(GPS) << "positionSource" << positionSource->sourceName() << "does not provide data. Giving up."; emit gpsQueryFinished(false); } @@ -1186,7 +1152,6 @@ void StelLocationMgr::locationFromGPS(int interval) // uwes-ufo's new solution for QtPosition void StelLocationMgr::positionUpdated(QGeoPositionInfo info) { - const bool verbose=qApp->property("verbose").toBool(); StelLocation loc; if (info.isValid()) { @@ -1200,8 +1165,7 @@ void StelLocationMgr::positionUpdated(QGeoPositionInfo info) else { // something went wrong. However, a dysfunctional positionSource may still exist, better delete it. - if (verbose) - qWarning() << "GPS not ready. Something went wrong."; + qCWarning(GPS) << "GPS not ready. Something went wrong."; positionSource->stopUpdates(); delete positionSource; positionSource=nullptr; @@ -1212,7 +1176,6 @@ void StelLocationMgr::positionUpdated(QGeoPositionInfo info) void StelLocationMgr::changeLocationFromGPSQuery(const StelLocation &locin) { - const bool verbose=qApp->property("verbose").toBool(); StelCore *core=StelApp::getInstance().getCore(); StelLocation loc=locin; const float latitude = loc.getLatitude(); @@ -1234,16 +1197,12 @@ void StelLocationMgr::changeLocationFromGPSQuery(const StelLocation &locin) } core->moveObserverTo(loc, 0.0, 0.0, landscapeAutoName); if (nmeaHelper) - { - if (verbose) - qDebug() << "Change location from NMEA... successful. NMEAhelper stays active."; - } - if (verbose) - { - qDebug() << "Location in progress: Long=" << longitude << " Lat=" << latitude << " Alt" << loc.altitude; - qDebug() << "New location named " << loc.name; - qDebug() << "queryOK, resetting GUI"; - } + qCDebug(GPS) << "Change location from NMEA... successful. NMEAhelper stays active."; + + qCDebug(GPS) << "Location in progress: Long=" << longitude << " Lat=" << latitude << " Alt" << loc.altitude; + qCDebug(GPS) << "New location named " << loc.name; + qCDebug(GPS) << "queryOK, resetting GUI"; + emit gpsQueryFinished(true); } @@ -1267,7 +1226,6 @@ void StelLocationMgr::gpsQueryError(const QString &err) // slot that receives IP-based location data from the network. void StelLocationMgr::changeLocationFromNetworkLookup() { - const bool verbose=qApp->property("verbose").toBool(); StelCore *core=StelApp::getInstance().getCore(); QNetworkReply* networkReply = qobject_cast(sender()); if (!networkReply) @@ -1292,7 +1250,7 @@ void StelLocationMgr::changeLocationFromNetworkLookup() double latitude=locMap.value("latitude").toDouble(); double longitude=locMap.value("longitude").toDouble(); - qInfo() << "Got location" << QString("%1, %2, %3 (%4, %5; %6)").arg(ipCity, ipRegion, ipCountry).arg(latitude).arg(longitude).arg(ipTimeZone) << "for IP" << locMap.value("ip").toString(); + qCInfo(LocIP) << "Got location" << QString("%1, %2, %3 (%4, %5; %6)").arg(ipCity, ipRegion, ipCountry).arg(latitude).arg(longitude).arg(ipTimeZone) << "for IP" << locMap.value("ip").toString(); if (latitude==0.0 && longitude==0.0 && ipTimeZone.isEmpty() && ipCountry.isEmpty() && ipCountryCode.isEmpty()) throw std::runtime_error("IP lookup provided bogus result."); @@ -1318,20 +1276,17 @@ void StelLocationMgr::changeLocationFromNetworkLookup() while (it.hasNext()) { it.next(); const double distanceKm=it.value().distanceKm(longitude, latitude); - if (verbose) - qDebug() << "Close location: " << it.value().name << " -- " << int(distanceKm) << "km"; + qCDebug(LocIP) << "Close location: " << it.value().name << " -- " << int(distanceKm) << "km"; if (distanceKm < minDistanceKm) { minDistanceKm=distanceKm; candLoc=it.value(); - if (verbose) - qDebug() << "-- TAKEN!"; + qCDebug(LocIP) << "-- TAKEN!"; } } if (candLoc.isValid() && closeLocations.size()>0) { - if (verbose) - qInfo() << "Closest known place:" << candLoc.name << "at" << candLoc.distanceKm(longitude, latitude) << "km"; + qCInfo(LocIP) << "Closest known place:" << candLoc.name << "at" << candLoc.distanceKm(longitude, latitude) << "km"; // Consider result valid only in a meaningful distance. Light pollution is changing rapidly. // Try 25 km, YMMV. if (minDistanceKm < 25) @@ -1373,8 +1328,8 @@ void StelLocationMgr::changeLocationFromNetworkLookup() } catch (const std::exception& e) { - qWarning() << "Failure getting IP-based location: answer is in not acceptable format! Error:" << e.what(); - qWarning() << "Moving to the fallback location"; + qCWarning(LocIP) << "Failure getting IP-based location: answer is in not acceptable format! Error:" << e.what(); + qCWarning(LocIP) << "Moving to the fallback location"; core->moveObserverTo(getLastResortLocation(), 0.0, 0.0, "guereins"); // Answer is not in JSON format! A possible block by DNS server or firewall } } diff --git a/src/core/StelLocationMgr.hpp b/src/core/StelLocationMgr.hpp index 3c7b4162e0964..1f45f786cb89f 100644 --- a/src/core/StelLocationMgr.hpp +++ b/src/core/StelLocationMgr.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "VecMath.hpp" typedef QList LocationList; @@ -42,8 +43,20 @@ typedef struct class GPSLookupHelper; + //! @class StelLocationMgr //! Manage the list of available location. +//! +//! @note You can finetune the amount of GPS-related messages in the logfile by configuring the logging category stel.GPS. +//! Likewise, for IP-based location lookup, we use the logging category stel.LocIP. +//! If your GPS device seems not to work, try to get more log otput by setting environment variable +//! QT_LOGGING_RULES=*.debug=false;stel.GPS.debug=true;stel.LocIP.info=false. +//! This will also silence most output of IP-related location queries. +//! By default, only Info and more severe messages are displayed. + +Q_DECLARE_LOGGING_CATEGORY(GPS) +Q_DECLARE_LOGGING_CATEGORY(LocIP) + class StelLocationMgr : public QObject { Q_OBJECT From de659056affd4771a86b58b0eda56e1005d6ef97 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Tue, 18 Nov 2025 18:33:13 +0100 Subject: [PATCH 07/14] replace --verbose option by LogCategory --- src/StelMainView.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StelMainView.cpp b/src/StelMainView.cpp index 1bc280d238a4c..1dc7cc78d3058 100644 --- a/src/StelMainView.cpp +++ b/src/StelMainView.cpp @@ -1010,9 +1010,10 @@ void StelMainView::init() // I doubt this will have any effect on framerate, but may cause problems elsewhere? QThread::currentThread()->setPriority(QThread::HighestPriority); + #ifndef NDEBUG // Get an overview of module callOrders - if (qApp->property("verbose")==true) + if (mainview().isDebugEnabled()) { StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionDraw); StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionUpdate); From 46a4f7d51b9ebf04ccd2ccd7428f2f2c05e6bdb3 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Tue, 18 Nov 2025 18:54:36 +0100 Subject: [PATCH 08/14] Remove a message --- plugins/AngleMeasure/src/AngleMeasure.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/AngleMeasure/src/AngleMeasure.cpp b/plugins/AngleMeasure/src/AngleMeasure.cpp index 5636ac1754dd9..f63603eec5d82 100644 --- a/plugins/AngleMeasure/src/AngleMeasure.cpp +++ b/plugins/AngleMeasure/src/AngleMeasure.cpp @@ -330,9 +330,6 @@ void improveClickMatch(StelProjectorP prj, double x, double y, Vec3d &v) prj->project(v,win); double dx = x - win.v[0]; double dy = y - win.v[1]; - bool verbose=qApp->property("verbose").toBool(); - if (verbose) - qDebug() << "Nick Fedoseev patch: improve click match" << dx << dy; prj->unProject(x+dx,y+dy,v); } From 5a3b6d0b011ffc77edb4cfb415c94176777e6473 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Tue, 18 Nov 2025 19:17:35 +0100 Subject: [PATCH 09/14] SUG: Describe logging categories - also remove info about --verbose option --- guide/ch_advanced_use.tex | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/guide/ch_advanced_use.tex b/guide/ch_advanced_use.tex index a44d4ecd49053..12805b7eda7ac 100644 --- a/guide/ch_advanced_use.tex +++ b/guide/ch_advanced_use.tex @@ -468,8 +468,7 @@ \subsubsection{NMEA Device} group (or whichever group owns your serial port). Better yet, use \program{gpsd} (see above).} -If GPS lookup fails, run Stellarium with the \texttt{--verbose} option and -see the logfile for diagnostic messages. +If GPS lookup fails, see section~\ref{sec:Environment:Logfile} to enable more diagnostic messages in the logfile. \paragraph{Bluetooth GPS} Most smartphones provide GPS and Bluetooth hardware. You can install a virtual COM port in your Windows Bluetooth @@ -571,7 +570,6 @@ \section{Command Line Options} -\/-spout or -S & all or sky & Act as Spout sender (See section \ref{sec:CommandLineOptions:Special:Spout}).% \footnote{\label{FN:WinOnly}On Windows only}\textsuperscript{,}\footnote{This function requires running in OpenGL mode.}\\ -\/-spout-name & name & Use \texttt{name} as name of the Spout sender. Default name: \texttt{Stellarium}.\footref{FN:WinOnly}\\\midrule --\/-verbose & & Even more diagnostic output in logfile (esp.\ location handling)\\ -\/-dump-opengl-details or -d & {[}none{]} & Dump information about OpenGL support to logfile. Use this is you have graphics problems and want to send a bug report. \\\midrule -\/-angle-mode or -a & {[}none{]} & Use ANGLE as OpenGL ES2 rendering engine (autodetect Direct3D version).\footref{FN:WinOnly}\textsuperscript{,}\footnote{\label{FN:Qt5only}Qt5-based Stellarium versions only}\\ @@ -653,9 +651,23 @@ \subsection{Logfile tweaks} \label{sec:Environment:Logfile} The amount of logging messages in Qt-based programs can be tuned by setting an environment variable \texttt{QT\_LOGGING\_RULES}. -For example, to remove all ``Debug'' messages, set it to \texttt{*.debug=false}. To remove even the ``Info'' messages, add \texttt{;*.info=false}. (Combine several rules with semicola.) +For example, to remove all ``Debug'' messages, set it to \texttt{*.debug=false;}. To remove even the ``Info'' messages, add \texttt{*.info=false;}. (Close each rule, also the last, with semicolon!) If you experience operating trouble, make sure you allow all messages, i.e., set these entries shown here to \texttt{true} (or delete the variable). +Some modules can be finetuned with respect to the amount of logging. +Most users won't ever want to see the ugly details, so debug is deactivated by default for: +\begin{description} +\item[\texttt{stel.GPS}] GPS related issues. +\item[\texttt{stel.LocIP}] IP-based location queries. +\item[\texttt{stel.Texture}] Texture handling. +\item[\texttt{stel.Atmosphere}] Atmosphere related messages. +\item[\texttt{stel.Scripting}] scripting related messages. +\item[\texttt{stel.Media}] Multimedia related messages. +\item[\texttt{stel.HiPS}] HiPS related messages. +\item[\texttt{stel.Properties}] StelProperty related messages. +\end{description} + +If you suspect issues with your computer, add those entries as shown above, e.g., add \texttt{stel.GPS.debug=true;}. More information can be found online\footnote{\scriptsize{\url{https://doc.qt.io/qt-6/qloggingcategory.html}, \url{https://doc.qt.io/qt-6/debug.html}}}. From 8ea29e73f2931726ad0b5640456e2bf471fd6506 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Tue, 18 Nov 2025 19:18:15 +0100 Subject: [PATCH 10/14] Remove --verbose CLI option - replaced by Logging Categories --- src/CLIProcessor.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/CLIProcessor.cpp b/src/CLIProcessor.cpp index b7a1e0dba0f24..f2f8114228ed0 100644 --- a/src/CLIProcessor.cpp +++ b/src/CLIProcessor.cpp @@ -104,8 +104,6 @@ void CLIProcessor::parseCLIArgsPreConfig(const QStringList& argList) << "--config-file (or -c) : Use an alternative name for the config file\n" << "--log-file (or -l) : Use an alternative name for the log file\n" << "--user-dir (or -u) : Use an alternative user data directory\n" - << "--verbose : Even more diagnostic output in logfile \n" - << " (esp. multimedia handling)\n" << "--opengl-compat (or -C) : Request OpenGL Compatibility profile\n" << " May help for certain driver configurations.\n" << "--low-graphics (or -L) : Force low-graphics mode\n" @@ -154,9 +152,6 @@ void CLIProcessor::parseCLIArgsPreConfig(const QStringList& argList) exit(0); } - if (argsGetOption(argList, "", "--verbose")) - qApp->setProperty("verbose", true); - #ifdef Q_OS_WIN if (argsGetOption(argList, "-F", "--no-screensaver")) qApp->setProperty("onetime_inhibit_screensaver", true); From 5cd4b83f533aa9ea1af73627b6d2a024f1dd88a8 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Thu, 20 Nov 2025 01:19:55 +0100 Subject: [PATCH 11/14] SUG: extend description of logging finetuning --- guide/ch_advanced_use.tex | 60 +++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/guide/ch_advanced_use.tex b/guide/ch_advanced_use.tex index 12805b7eda7ac..f8c5f791a4b79 100644 --- a/guide/ch_advanced_use.tex +++ b/guide/ch_advanced_use.tex @@ -627,9 +627,11 @@ \section{Environment Variables} Some command-line options can be set permanently by storing them into environment variables. How to set them depends on the respective -operating system. Calling the respective options on the command line -still overrides an environment variable (apart from -\texttt{STEL\_OPTS}). +operating system. + +\paragraph{Windows} +Press the start menu, search for ``environment variable''. Use the command to change user variables. +After setting, you can call Stellarium via its menu entry or desktop links. This may be especially helpful on Windows systems with older graphics cards which may not fully be compatible with OpenGL. Here we recommend @@ -637,25 +639,51 @@ \section{Environment Variables} you can set the environment variable once and forget about the problems. +\paragraph{Linux} +You will usually set such variables at the end of your \file{\textasciitilde{}/.bashrc} file. +Open this with a text editor and add, near the end, +\begin{configfile} +export STEL_OPTS=-platform xcb --single-buffer +\end{configfile} +This forces use of the X11 platform plugin which may work better than \texttt{wayland} on older systems. + +Calling the respective options on the command line +still overrides an environment variable (apart from +\texttt{STEL\_OPTS}). + + \begin{description} -\item[STEL\_OPTS] may contain a default commandline with options in the syntax of the table above. -\item[STEL\_USERDIR] may contain the path to a user data directory +\item[\texttt{STEL\_OPTS}] may contain a default commandline with options in the syntax of the table above. Also some Qt settings can only be tweaked with this. +For example, users of international keyboards with \key{Alt Gr} key may want to use +\begin{commands}[\scriptsize] +STEL_OPTS=-platform windows:altgr,fontengine=freetype --single-buffer +\end{commands} +The \texttt{-platform} parameter is part of Qt. Its second argument, \texttt{fontengine}, selects a different font engine (i.e., some fonts may look better with it). +The other argument, \texttt{-\,-single-buffer}, is a setting that influences Stellarium (see table above). +\item[\texttt{STEL\_USERDIR}] may contain the path to a user data directory deviating from the default (see section \ref{sec:Directories}). -\item[QT\_OPENGL]\footref{FN:WinOnly} May be one of \texttt{desktop} (native OpenGL for your GPU, recommended), +\item[\texttt{QT\_OPENGL}]\footref{FN:WinOnly} May be one of \texttt{desktop} (native OpenGL for your GPU, recommended), \texttt{angle}\footref{FN:Qt5only} or \texttt{software}. The last activates pure software rendering using the MESA OpenGL library. Note that command line options take precedence over this environment variable. -\item[QT\_ANGLE\_PLATFORM]\footref{FN:WinOnly}\textsuperscript{,}\footref{FN:Qt5only} May be one of \texttt{d3d9} (DirectX~9) or \texttt{d3d11} (DirectX~11), +\item[\texttt{QT\_ANGLE\_PLATFORM}]\footref{FN:WinOnly}\textsuperscript{,}\footref{FN:Qt5only} May be one of \texttt{d3d9} (DirectX~9) or \texttt{d3d11} (DirectX~11), or \texttt{warp} for another software-only solution. Note that command line options take precedence over this environment variable. \end{description} \subsection{Logfile tweaks} \label{sec:Environment:Logfile} -The amount of logging messages in Qt-based programs can be tuned by setting an environment variable \texttt{QT\_LOGGING\_RULES}. -For example, to remove all ``Debug'' messages, set it to \texttt{*.debug=false;}. To remove even the ``Info'' messages, add \texttt{*.info=false;}. (Close each rule, also the last, with semicolon!) +Qt based programs can wrote log files where status messages of varying severity can be written. There are categories +\texttt{debug} (only of developer interest), +\texttt{info} (informational), +\texttt{warning} (something unexpected), +\texttt{critical} (usually connected to some real failure) and +\texttt{fatal} (program must fail here). +The amount of logging messages can be tuned by setting the environment variable \texttt{QT\_LOGGING\_RULES}. +For example, to remove all \texttt{debug} messages, set it to \texttt{*.debug=false;}. +To remove even the \texttt{info} messages, add \texttt{*.info=false;}. (Close each rule, also the last, with semicolon!) If you experience operating trouble, make sure you allow all messages, i.e., set these entries shown here to \texttt{true} (or delete the variable). -Some modules can be finetuned with respect to the amount of logging. -Most users won't ever want to see the ugly details, so debug is deactivated by default for: +Some modules\newFeature{25.4} can be individually finetuned with respect to the amount of logging. +Most users won't ever want to see the ugly details, so \texttt{debug} is deactivated by default for: \begin{description} \item[\texttt{stel.GPS}] GPS related issues. \item[\texttt{stel.LocIP}] IP-based location queries. @@ -667,7 +695,15 @@ \subsection{Logfile tweaks} \item[\texttt{stel.Properties}] StelProperty related messages. \end{description} -If you suspect issues with your computer, add those entries as shown above, e.g., add \texttt{stel.GPS.debug=true;}. +If you suspect issues with some features on your computer, add those entries as shown above, e.g., to hunt down issues with a GPS device: +\begin{configfile} +QT_LOGGING_RULES=*.debug=false;stel.GPS.debug=true; +\end{configfile} +or if you are developing scripts and videos don't play, try if this helps: +\begin{configfile} +QT_LOGGING_RULES=*.debug=false;stel.Media.debug=true; +\end{configfile} + More information can be found online\footnote{\scriptsize{\url{https://doc.qt.io/qt-6/qloggingcategory.html}, \url{https://doc.qt.io/qt-6/debug.html}}}. From 0056f909a3ecfcfbe77074c688f5e3e221ea0a55 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Thu, 20 Nov 2025 11:52:51 +0100 Subject: [PATCH 12/14] SUG: amendments --- guide/ch_advanced_use.tex | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/guide/ch_advanced_use.tex b/guide/ch_advanced_use.tex index f8c5f791a4b79..aadcce249daf1 100644 --- a/guide/ch_advanced_use.tex +++ b/guide/ch_advanced_use.tex @@ -590,6 +590,8 @@ \section{Command Line Options} can also set an environment variable \file{STEL\_OPTS} with your default options. +Calling the respective options on the command line overrides settings from environment variables (apart from \texttt{STEL\_OPTS}). + \subsection{Examples} \label{sec:CommandLineOptions:Examples} @@ -625,11 +627,12 @@ \subsection{Examples} \section{Environment Variables} \label{sec:Environment} -Some command-line options can be set permanently by storing them into +Some command-line options or settings can be set permanently by storing them into environment variables. How to set them depends on the respective operating system. -\paragraph{Windows} +\begin{description} +\item[Windows] Press the start menu, search for ``environment variable''. Use the command to change user variables. After setting, you can call Stellarium via its menu entry or desktop links. @@ -639,44 +642,44 @@ \section{Environment Variables} you can set the environment variable once and forget about the problems. -\paragraph{Linux} +\item[Linux, macOS] You will usually set such variables at the end of your \file{\textasciitilde{}/.bashrc} file. Open this with a text editor and add, near the end, \begin{configfile} -export STEL_OPTS=-platform xcb --single-buffer +export STEL_OPTS="-platform xcb --single-buffer" \end{configfile} This forces use of the X11 platform plugin which may work better than \texttt{wayland} on older systems. +\end{description} -Calling the respective options on the command line -still overrides an environment variable (apart from -\texttt{STEL\_OPTS}). +\noindent These environment variables are important: \begin{description} -\item[\texttt{STEL\_OPTS}] may contain a default commandline with options in the syntax of the table above. Also some Qt settings can only be tweaked with this. -For example, users of international keyboards with \key{Alt Gr} key may want to use +\item[{STEL\_OPTS}] may contain a default commandline with options in the syntax of the table above. Also some Qt settings can only be tweaked with this. +For example, Windows users of international keyboards with \key{Alt Gr} key may want to use \begin{commands}[\scriptsize] STEL_OPTS=-platform windows:altgr,fontengine=freetype --single-buffer \end{commands} The \texttt{-platform} parameter is part of Qt. Its second argument, \texttt{fontengine}, selects a different font engine (i.e., some fonts may look better with it). The other argument, \texttt{-\,-single-buffer}, is a setting that influences Stellarium (see table above). -\item[\texttt{STEL\_USERDIR}] may contain the path to a user data directory +\item[{STEL\_USERDIR}] may contain the path to a user data directory deviating from the default (see section \ref{sec:Directories}). -\item[\texttt{QT\_OPENGL}]\footref{FN:WinOnly} May be one of \texttt{desktop} (native OpenGL for your GPU, recommended), +\item[{QT\_OPENGL}]\footref{FN:WinOnly} May be one of \texttt{desktop} (native OpenGL for your GPU, recommended), \texttt{angle}\footref{FN:Qt5only} or \texttt{software}. The last activates pure software rendering using the MESA OpenGL library. Note that command line options take precedence over this environment variable. -\item[\texttt{QT\_ANGLE\_PLATFORM}]\footref{FN:WinOnly}\textsuperscript{,}\footref{FN:Qt5only} May be one of \texttt{d3d9} (DirectX~9) or \texttt{d3d11} (DirectX~11), +\item[{QT\_ANGLE\_PLATFORM}]\footref{FN:WinOnly}\textsuperscript{,}\footref{FN:Qt5only} May be one of \texttt{d3d9} (DirectX~9) or \texttt{d3d11} (DirectX~11), or \texttt{warp} for another software-only solution. Note that command line options take precedence over this environment variable. \end{description} \subsection{Logfile tweaks} \label{sec:Environment:Logfile} -Qt based programs can wrote log files where status messages of varying severity can be written. There are categories -\texttt{debug} (only of developer interest), +Qt based programs can write log files where status messages of varying severity can be +written\footnote{\scriptsize{\url{https://doc.qt.io/qt-6/qloggingcategory.html}, \url{https://doc.qt.io/qt-6/debug.html}}}. There are categories +\texttt{debug} (usually only of developer interest), \texttt{info} (informational), \texttt{warning} (something unexpected), \texttt{critical} (usually connected to some real failure) and -\texttt{fatal} (program must fail here). +\texttt{fatal} (program fails (usually exits) here). The amount of logging messages can be tuned by setting the environment variable \texttt{QT\_LOGGING\_RULES}. For example, to remove all \texttt{debug} messages, set it to \texttt{*.debug=false;}. To remove even the \texttt{info} messages, add \texttt{*.info=false;}. (Close each rule, also the last, with semicolon!) @@ -704,8 +707,6 @@ \subsection{Logfile tweaks} QT_LOGGING_RULES=*.debug=false;stel.Media.debug=true; \end{configfile} -More information can be found online\footnote{\scriptsize{\url{https://doc.qt.io/qt-6/qloggingcategory.html}, \url{https://doc.qt.io/qt-6/debug.html}}}. - \section{GUI Customizations} From 22a16b148242bddc02ae27020cede49a1853eb6f Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Thu, 20 Nov 2025 14:46:55 +0100 Subject: [PATCH 13/14] Docfixes --- src/core/StelLocationMgr.hpp | 2 +- src/core/StelPropertyMgr.hpp | 7 ++++--- src/core/StelVideoMgr.hpp | 2 +- src/core/modules/HipsMgr.hpp | 2 +- src/scripting/StelMainScriptAPI.hpp | 2 +- src/scripting/StelScriptMgr.hpp | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/StelLocationMgr.hpp b/src/core/StelLocationMgr.hpp index 1f45f786cb89f..73b90f9d4f786 100644 --- a/src/core/StelLocationMgr.hpp +++ b/src/core/StelLocationMgr.hpp @@ -50,7 +50,7 @@ class GPSLookupHelper; //! @note You can finetune the amount of GPS-related messages in the logfile by configuring the logging category stel.GPS. //! Likewise, for IP-based location lookup, we use the logging category stel.LocIP. //! If your GPS device seems not to work, try to get more log otput by setting environment variable -//! QT_LOGGING_RULES=*.debug=false;stel.GPS.debug=true;stel.LocIP.info=false. +//! QT_LOGGING_RULES="*.debug=false;stel.GPS.debug=true;stel.LocIP.info=false;". //! This will also silence most output of IP-related location queries. //! By default, only Info and more severe messages are displayed. diff --git a/src/core/StelPropertyMgr.hpp b/src/core/StelPropertyMgr.hpp index e0916286e2200..2a560a2011584 100644 --- a/src/core/StelPropertyMgr.hpp +++ b/src/core/StelPropertyMgr.hpp @@ -36,7 +36,7 @@ class StelProperty; //! re-emitting the "changed" event with a type-converted value. //! //! @note You can finetune the amount of Property-related messages in the logfile by configuring the logging category stel.Properties. -//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Properties.debug=true. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.Properties.debug=true;". //! By default, only Info and more severe messages are displayed. class StelPropertyProxy : public QObject @@ -226,8 +226,9 @@ protected slots: //! configurable through the GUI. Bad examples are properties which potentially change very often (e.g. each frame), such as the //! current view vector, field of view etc. They may cause considerable overhead if used, and therefore should be avoided. //! -//! @note For debugging, you can finetune the amount of messages written to the logfile. -//! In environment variable QT_LOGGING_RULES, set stel.Properties.debug=true to see property changes. +//! @note You can finetune the amount of Property-related messages in the logfile by configuring the logging category stel.Properties. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.Properties.debug=true;". +//! By default, only Info and more severe messages are displayed. //! //! @sa StelPropertyMgr, StelDialog, StelAction class StelProperty : public QObject diff --git a/src/core/StelVideoMgr.hpp b/src/core/StelVideoMgr.hpp index 56129fc5a50cc..37fbb47525ad9 100644 --- a/src/core/StelVideoMgr.hpp +++ b/src/core/StelVideoMgr.hpp @@ -109,7 +109,7 @@ class QGraphicsVideoItem; //! This occurred on an Intel NUC5i3 with SSD, so loading the file should not be much of an issue. //! //! @note You can finetune the amount of media-related messages in the logfile by configuring the logging category stel.Media. -//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Media.debug=true. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.Media.debug=true;". //! By default, only Info and more severe messages are displayed. diff --git a/src/core/modules/HipsMgr.hpp b/src/core/modules/HipsMgr.hpp index aa3523c839f03..91bea9e8fb135 100644 --- a/src/core/modules/HipsMgr.hpp +++ b/src/core/modules/HipsMgr.hpp @@ -33,7 +33,7 @@ //! Stellarium supports only image-based surveys. //! //! @note You can finetune the amount of HiPS-related messages in the logfile by configuring the logging category stel.HiPS. -//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.HiPS.debug=true. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.HiPS.debug=true;". //! By default, only Info and more severe messages are displayed. Q_DECLARE_LOGGING_CATEGORY(HiPS) diff --git a/src/scripting/StelMainScriptAPI.hpp b/src/scripting/StelMainScriptAPI.hpp index c8c81a88d90e0..4640bcb11c13e 100644 --- a/src/scripting/StelMainScriptAPI.hpp +++ b/src/scripting/StelMainScriptAPI.hpp @@ -43,7 +43,7 @@ Q_DECLARE_LOGGING_CATEGORY(Scripting) //! LandscapeMgr.setFlagAtmosphere(true); //! //! @note You can finetune the amount of scripting-related messages in the logfile by configuring the logging category stel.Scripting. -//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Scripting.debug=true. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.Scripting.debug=true;". //! By default, only Info and more severe messages are displayed. class StelMainScriptAPI : public QObject diff --git a/src/scripting/StelScriptMgr.hpp b/src/scripting/StelScriptMgr.hpp index 619c6b51f2928..657fa789f11ad 100644 --- a/src/scripting/StelScriptMgr.hpp +++ b/src/scripting/StelScriptMgr.hpp @@ -51,7 +51,7 @@ class ScriptConsole; //! - There is no script.pause() function. We can only stop a running script. //! //! @note You can finetune the amount of scripting-related messages in the logfile by configuring the logging category stel.Scripting. -//! For this, e.g. set environment variable QT_LOGGING_RULES=*.debug=false;stel.Scripting.debug=true. +//! For this, e.g. set environment variable QT_LOGGING_RULES="*.debug=false;stel.Scripting.debug=true;". //! By default, only Info and more severe messages are displayed. class StelScriptMgr : public QObject From 165e2015468ed15ab492736b618e9c1dcf653eae Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Thu, 20 Nov 2025 14:47:16 +0100 Subject: [PATCH 14/14] remove unneeded header inclusion --- src/core/modules/AtmospherePreetham.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/modules/AtmospherePreetham.cpp b/src/core/modules/AtmospherePreetham.cpp index efc196cffb224..3e7ccfd4e8181 100644 --- a/src/core/modules/AtmospherePreetham.cpp +++ b/src/core/modules/AtmospherePreetham.cpp @@ -23,7 +23,6 @@ #include "StelApp.hpp" #include "StelProjector.hpp" #include "StelToneReproducer.hpp" -//#include "StelTextureMgr.hpp" #include "StelCore.hpp" #include "StelPainter.hpp" #include "Skylight.hpp"