From e1d0eb38da344f61dcb1e19b07d3c592053984be Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 6 Mar 2020 23:03:30 +0100 Subject: [PATCH] add debug header --- src/alligator-debug.h | 25 +++++++++++++++++++++++++ src/feedListModel.cpp | 5 +---- src/main.cpp | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 src/alligator-debug.h diff --git a/src/alligator-debug.h b/src/alligator-debug.h new file mode 100644 index 00000000..bc698f51 --- /dev/null +++ b/src/alligator-debug.h @@ -0,0 +1,25 @@ +/** + * Copyright 2020 Tobias Fella + * + * 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 . + */ + +#pragma once + +#include + +Q_DECLARE_LOGGING_CATEGORY(ALLIGATOR) diff --git a/src/feedListModel.cpp b/src/feedListModel.cpp index c1e6319e..ce1b9276 100644 --- a/src/feedListModel.cpp +++ b/src/feedListModel.cpp @@ -28,8 +28,6 @@ #include "feedListModel.h" #include "fetcher.h" -#include - FeedListModel::FeedListModel(QObject *parent) : QAbstractListModel(parent) { @@ -70,8 +68,7 @@ void FeedListModel::addFeed(QString url) query.prepare(QStringLiteral("SELECT name FROM Feeds WHERE url=:url;")); query.bindValue(QStringLiteral(":url"), url); query.exec(); - if(!query.next()) - std::cout << "Query empty" << std::endl; + query.next() for(int i = 0; i < feeds.length(); i++) { if(feeds[i].url() == url) { feeds.removeAt(i); diff --git a/src/main.cpp b/src/main.cpp index 63a2e5be..d73a9131 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,6 +30,10 @@ #include "entryListModel.h" #include "feedListModel.h" +#include "alligator-debug.h" + +Q_LOGGING_CATEGORY(ALLIGATOR, "alligator"); + Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);