Changeset 4866dd6 in subsurface


Ignore:
Timestamp:
Jun 17, 2017, 11:23:41 PM (6 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
2b01ab7
Parents:
b2b51c8
Message:

QML UI: show debug output in the App Log

We have unified the debug output to the console and to the App Log, let's
use it consistently everywhere.

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qmlmanager.cpp

    rb2b51c8 r4866dd6  
    8686        m_lastDevicePixelRatio = qApp->devicePixelRatio();
    8787        connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
    88         qDebug() << "Starting" << getUserAgent();
    89         qDebug() << QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion());
     88        appendTextToLog("Starting " + getUserAgent());
     89        appendTextToLog(QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()));
    9090        setStartPageText(tr("Starting..."));
    9191        setShowPin(false);
     
    118118        stateText.append((unsaved_changes() ? QLatin1Literal("") : QLatin1Literal("no ")) + QLatin1Literal("unsaved changes"));
    119119        appendTextToLog(stateText);
    120         qDebug() << QString::number(timer.elapsed() / 1000.0,'f', 3) << ":" << stateText;
    121120
    122121        if (!alreadySaving && state == Qt::ApplicationInactive && unsaved_changes()) {
     
    374373        setStartPageText(RED_FONT + tr("Cannot open cloud storage: Error creating https connection") + END_FONT);
    375374        Q_FOREACH (QSslError e, errors) {
    376                 qDebug() << e.errorString();
     375                appendTextToLog(e.errorString());
    377376        }
    378377        reply->abort();
     
    384383{
    385384        QString errorString = reply->errorString();
    386         qDebug() << "handleError" << nError << errorString;
     385        appendTextToLog(QStringLiteral("handleError ") + nError + QStringLiteral(": ") + errorString);
    387386        setStartPageText(RED_FONT + tr("Cannot open cloud storage: %1").arg(errorString) + END_FONT);
    388387        reply->abort();
     
    443442        int error;
    444443        if (check_git_sha(fileNamePrt.data(), &git, &branch) == 0) {
    445                 qDebug() << "local cache was current, no need to modify dive list";
    446444                appendTextToLog("Cloud sync shows local cache was current");
    447445                goto successful_exit;
     
    593591                newDate.setTimeSpec(Qt::UTC);
    594592                if (!newDate.isValid()) {
    595                         qDebug() << "unable to parse date" << date << "with the given format" << format;
     593                        appendTextToLog("unable to parse date " + date + " with the given format " + format);
    596594                        QRegularExpression isoDate("\\d+-\\d+-\\d+[^\\d]+\\d+:\\d+");
    597595                        if (date.contains(isoDate)) {
     
    671669                        return true;
    672670                }
    673                 qDebug() << "none of our parsing attempts worked for the date string";
     671                appendTextToLog("none of our parsing attempts worked for the date string");
    674672        }
    675673        return false;
     
    705703                        } else {
    706704                                appendTextToLog("couldn't get GPS location in time");
    707                                 qDebug() << "still don't have a position - will need to implement some sort of callback";
    708705                        }
    709706                } else {
     
    750747                        d->dc.samples = 0;
    751748                } else {
    752                         qDebug() << "changing the duration on a dive that wasn't manually added - Uh-oh";
     749                        appendTextToLog("Cannot change the duration on a dive that wasn't manually added");
    753750                }
    754751                return true;
     
    792789
    793790        if (!d) {
    794                 qDebug() << "don't touch this... no dive";
     791                appendTextToLog("cannot commit changes: no dive");
    795792                return;
    796793        }
     
    955952                                s.setDefaultFilename(filename);
    956953                                s.setDefaultFileBehavior(LOCAL_DEFAULT_FILE);
    957                                 qDebug() << "setting default file to" << filename;
    958954                        }
    959955                } else if (!loadFromCloud()) {
     
    10241020{
    10251021        if (!deletedDive || deletedDive->id != id) {
    1026                 qDebug() << "can't find the deleted dive";
     1022                appendTextToLog("Trying to undo delete but can't find the deleted dive");
    10271023                return false;
    10281024        }
     
    10521048        struct dive *d = get_dive_by_uniq_id(id);
    10531049        if (!d) {
    1054                 qDebug() << "oops, trying to delete non-existing dive";
     1050                appendTextToLog("trying to delete non-existing dive");
    10551051                return;
    10561052        }
     
    11811177void QMLManager::setLocationServiceAvailable(bool locationServiceAvailable)
    11821178{
    1183         qDebug() << "location service is" << (locationServiceAvailable ? "available" : "not available");
     1179        appendTextToLog(QStringLiteral("location service is ") + (locationServiceAvailable ? QStringLiteral("available") : QStringLiteral("not available")));
    11841180        m_locationServiceAvailable = locationServiceAvailable;
    11851181        emit locationServiceAvailableChanged();
     
    12001196        m_verboseEnabled = verboseMode;
    12011197        verbose = verboseMode;
    1202         qDebug() << "verbose is" << verbose;
     1198        appendTextToLog(QStringLiteral("verbose is ") + (verbose ? QStringLiteral("on") : QStringLiteral("off")));
    12031199        emit verboseEnabledChanged();
    12041200}
Note: See TracChangeset for help on using the changeset viewer.