remove logging categories

This commit is contained in:
Tobias Fella 2020-04-10 17:28:26 +02:00
parent 451a40f9b8
commit 2c798db7c1
6 changed files with 8 additions and 43 deletions

View File

@ -1,25 +0,0 @@
/**
* Copyright 2020 Tobias Fella <fella@posteo.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(ALLIGATOR)

View File

@ -26,7 +26,6 @@
#include "database.h" #include "database.h"
#include "alligatorsettings.h" #include "alligatorsettings.h"
#include "alligator-debug.h"
#define TRUE_OR_RETURN(x) if(!x) return false; #define TRUE_OR_RETURN(x) if(!x) return false;
@ -36,18 +35,18 @@ Database::Database()
QString databasePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QString databasePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir(databasePath).mkpath(databasePath); QDir(databasePath).mkpath(databasePath);
db.setDatabaseName(databasePath + QStringLiteral("/database.db3")); db.setDatabaseName(databasePath + QStringLiteral("/database.db3"));
qCDebug(ALLIGATOR) << "Opening database " << databasePath << "/database.db3"; qDebug() << "Opening database " << databasePath << "/database.db3";
db.open(); db.open();
if(!migrate()) { if(!migrate()) {
qCCritical(ALLIGATOR) << "Failed to migrate the database"; qCritical() << "Failed to migrate the database";
} }
cleanup(); cleanup();
} }
bool Database::migrate() { bool Database::migrate() {
qCDebug(ALLIGATOR) << "Migrating database"; qDebug() << "Migrating database";
if(version() < 1) TRUE_OR_RETURN(migrateTo1()); if(version() < 1) TRUE_OR_RETURN(migrateTo1());
return true; return true;
} }
@ -69,9 +68,9 @@ bool Database::execute(QString query) {
bool Database::execute(QSqlQuery &query) { bool Database::execute(QSqlQuery &query) {
if(!query.exec()) { if(!query.exec()) {
qCWarning(ALLIGATOR) << "Failed to execute SQL Query"; qWarning() << "Failed to execute SQL Query";
qCWarning(ALLIGATOR) << query.lastQuery(); qWarning() << query.lastQuery();
qCWarning(ALLIGATOR) << query.lastError(); qWarning() << query.lastError();
return false; return false;
} }
return true; return true;
@ -84,10 +83,10 @@ int Database::version() {
if(query.next()) { if(query.next()) {
bool ok; bool ok;
int value = query.value(0).toInt(&ok); int value = query.value(0).toInt(&ok);
qCDebug(ALLIGATOR) << "Database version " << value; qDebug() << "Database version " << value;
if(ok) return value; if(ok) return value;
} else { } else {
qCCritical(ALLIGATOR) << "Failed to check database version"; qCritical() << "Failed to check database version";
} }
return -1; return -1;
} }

View File

@ -25,8 +25,6 @@
#include "fetcher.h" #include "fetcher.h"
#include "database.h" #include "database.h"
#include "alligator-debug.h"
EntryListModel::EntryListModel(QObject *parent) EntryListModel::EntryListModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View File

@ -24,8 +24,6 @@
#include "fetcher.h" #include "fetcher.h"
#include "database.h" #include "database.h"
#include "alligator-debug.h"
FeedListModel::FeedListModel(QObject *parent) FeedListModel::FeedListModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View File

@ -25,7 +25,6 @@
#include "fetcher.h" #include "fetcher.h"
#include "database.h" #include "database.h"
#include "alligator-debug.h"
Fetcher::Fetcher() { Fetcher::Fetcher() {
} }

View File

@ -31,10 +31,6 @@
#include "alligatorsettings.h" #include "alligatorsettings.h"
#include "feed.h" #include "feed.h"
#include "alligator-debug.h"
Q_LOGGING_CATEGORY(ALLIGATOR, "alligator");
Q_DECL_EXPORT int main(int argc, char *argv[]) Q_DECL_EXPORT int main(int argc, char *argv[])
{ {
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);