From 38a28d855115b5a49ec8c291b9f53f065c1155b1 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 12 Jan 2017 18:04:21 +0100 Subject: [PATCH] Using qInfo/qDebug as relevant --- QtClient/JoplinQtClient/application.cpp | 15 ++++----------- QtClient/JoplinQtClient/database.cpp | 2 +- QtClient/JoplinQtClient/synchronizer.cpp | 10 ++++------ QtClient/JoplinQtClient/webapi.cpp | 2 +- QtClient/JoplinQtClient/window.cpp | 4 ++-- QtClient/evernote-import/main.cpp | 2 +- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/QtClient/JoplinQtClient/application.cpp b/QtClient/JoplinQtClient/application.cpp index 6fc68ea4e..471923c84 100755 --- a/QtClient/JoplinQtClient/application.cpp +++ b/QtClient/JoplinQtClient/application.cpp @@ -28,9 +28,9 @@ Application::Application(int &argc, char **argv) : QCoreApplication::setOrganizationDomain(jop::ORG_DOMAIN); QCoreApplication::setApplicationName(jop::APP_NAME); - qDebug() << "Config dir:" << paths::configDir(); - qDebug() << "Database file:" << paths::databaseFile(); - qDebug() << "SSL:" << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionNumber(); + qInfo() << "Config dir:" << paths::configDir(); + qInfo() << "Database file:" << paths::databaseFile(); + qInfo() << "SSL:" << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionNumber(); jop::db().initialize(paths::databaseFile()); @@ -118,7 +118,7 @@ void Application::api_requestDone(const QJsonObject& response, const QString& ta view_.showPage("login"); } else { QString sessionId = response.value("id").toString(); - qDebug() << "Got session" << sessionId; + qInfo() << "Got session" << sessionId; Settings settings; settings.setValue("session.id", sessionId); afterSessionInitialization(); @@ -130,12 +130,8 @@ void Application::api_requestDone(const QJsonObject& response, const QString& ta } void Application::dispatcher_loginClicked(const QString &apiBaseUrl, const QString &email, const QString &password) { - qDebug() << apiBaseUrl << email << password; - view_.emitSignal("loginStarted"); - //dispatcher().emitLoginStarted(); - QString newBaseUrl = filters::apiBaseUrl(apiBaseUrl); Settings settings; @@ -197,7 +193,6 @@ void Application::afterSessionInitialization() { Settings settings; QString sessionId = settings.value("session.id").toString(); - qDebug() << "Session:" << sessionId; api_.setBaseUrl(settings.value("api.baseUrl").toString()); api_.setSessionId(sessionId); synchronizer_.api().setBaseUrl(settings.value("api.baseUrl").toString()); @@ -230,8 +225,6 @@ void Application::view_addFolderButtonClicked() { // q.exec(); // emit jop::dispatcher().folderCreated("test"); - - //qDebug() << "Added" << q.lastInsertId().toString(); } void Application::view_syncButtonClicked() { diff --git a/QtClient/JoplinQtClient/database.cpp b/QtClient/JoplinQtClient/database.cpp index 24beb847c..54b581fa7 100755 --- a/QtClient/JoplinQtClient/database.cpp +++ b/QtClient/JoplinQtClient/database.cpp @@ -17,7 +17,7 @@ void Database::initialize(const QString &path) { if (!db_.open()) { qFatal("Error: connection with database fail"); } else { - qDebug() << "Database: connection ok"; + qInfo() << "Database: connection ok"; } upgrade(); diff --git a/QtClient/JoplinQtClient/synchronizer.cpp b/QtClient/JoplinQtClient/synchronizer.cpp index 069274042..9823dee90 100755 --- a/QtClient/JoplinQtClient/synchronizer.cpp +++ b/QtClient/JoplinQtClient/synchronizer.cpp @@ -22,7 +22,7 @@ void Synchronizer::start() { return; } - qDebug() << "Starting synchronizer..."; + qInfo() << "Starting synchronizer..."; switchState(UploadingChanges); } @@ -103,7 +103,7 @@ void Synchronizer::switchState(Synchronizer::SynchronizationState state) { state_ = state; - qDebug() << "Switching synchronizer state to" << state; + qInfo() << "Switching synchronizer state to" << state; if (state == Idle) { @@ -127,8 +127,6 @@ void Synchronizer::switchState(Synchronizer::SynchronizationState state) { QString itemId = change.value("item_id").toString(); Change::Type type = (Change::Type)change.value("type").toInt(); - qDebug() << itemId << itemType << type; - if (itemType == jop::FoldersTable) { if (type == Change::Create) { @@ -207,7 +205,7 @@ void Synchronizer::api_requestDone(const QJsonObject& response, const QString& t if (parts.size() == 3) arg1 = parts[2]; if (parts.size() == 4) arg2 = parts[3]; - qDebug() << "WebApi: done" << category << action << arg1 << arg2; + qInfo() << "WebApi: done" << category << action << arg1 << arg2; QString error = ""; @@ -225,7 +223,7 @@ void Synchronizer::api_requestDone(const QJsonObject& response, const QString& t uploadsRemaining_--; if (error == "") { - qDebug() << "Synced folder" << arg1; + qInfo() << "Synced folder" << arg1; if (action == "putFolder") { Change::disposeByItemId(arg1); diff --git a/QtClient/JoplinQtClient/webapi.cpp b/QtClient/JoplinQtClient/webapi.cpp index f1bc36ace..0ce095d1f 100755 --- a/QtClient/JoplinQtClient/webapi.cpp +++ b/QtClient/JoplinQtClient/webapi.cpp @@ -163,7 +163,7 @@ void WebApi::request_finished(QNetworkReply *reply) { } void WebApi::request_error(QNetworkReply::NetworkError e) { - qDebug() << "Network error" << e; + qWarning() << "Network error" << e; } void jop::WebApi::setBaseUrl(const QString &v) { diff --git a/QtClient/JoplinQtClient/window.cpp b/QtClient/JoplinQtClient/window.cpp index 580cd1bc5..5ce2ba860 100755 --- a/QtClient/JoplinQtClient/window.cpp +++ b/QtClient/JoplinQtClient/window.cpp @@ -15,7 +15,7 @@ void Window::emitSignal(const QString &name, const QVariantList &args) { QString nameCopy(name); nameCopy = nameCopy.left(1).toUpper() + nameCopy.right(nameCopy.length() - 1); nameCopy = "emit" + nameCopy; - qDebug() << "Going to call" << nameCopy; + qDebug() << "Going to call QML:" << nameCopy; QObject* o = (QObject*)rootObject(); if (args.size() == 0) { QMetaObject::invokeMethod(o, nameCopy.toStdString().c_str(), Q_RETURN_ARG(QVariant, returnedValue)); @@ -26,6 +26,6 @@ void Window::emitSignal(const QString &name, const QVariantList &args) { } else if (args.size() == 3) { QMetaObject::invokeMethod(o, nameCopy.toStdString().c_str(), Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, args[0]), Q_ARG(QVariant, args[1]), Q_ARG(QVariant, args[2])); } else { - qCritical() << "Window::emitSignal: add support for more args!" << args.size(); + qFatal("Window::emitSignal: add support for more args!"); } } diff --git a/QtClient/evernote-import/main.cpp b/QtClient/evernote-import/main.cpp index 92cbdd078..fd5dbcc7e 100755 --- a/QtClient/evernote-import/main.cpp +++ b/QtClient/evernote-import/main.cpp @@ -367,7 +367,7 @@ int main(int argc, char *argv[]) { qWarning() << "Error: connection with database fail"; return 1; } else { - qDebug() << "Database: connection ok"; + qInfo() << "Database: connection ok"; } // TODO: REMOVE REMOVE REMOVE