Using qInfo/qDebug as relevant

pull/41/head
Laurent Cozic 2017-01-12 18:04:21 +01:00
parent 4e549695cf
commit 38a28d8551
6 changed files with 13 additions and 22 deletions

View File

@ -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() {

View File

@ -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();

View File

@ -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);

View File

@ -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) {

View File

@ -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!");
}
}

View File

@ -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