Commit 14b962f2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to qdebug categories

parent 43fd85d0
......@@ -33,6 +33,7 @@ set(gwenview_SRCS
thumbnailviewhelper.cpp
browsemainpage.cpp
)
ecm_qt_declare_logging_category(gwenview_SRCS HEADER gwenview_app_debug.h IDENTIFIER GWENVIEW_APP_LOG CATEGORY_NAME org.kde.kdegraphics.gwenview.app)
# need by GV_RETURN_VALUE_IF_FAIL
ecm_qt_declare_logging_category(gwenview_SRCS HEADER gwenview_lib_debug.h IDENTIFIER GWENVIEW_LIB_LOG CATEGORY_NAME org.kde.kdegraphics.gwenview.lib)
if (NOT GWENVIEW_SEMANTICINFO_BACKEND_NONE)
......
......@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Qt
#include <QMenu>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QPushButton>
#include <QFileDialog>
......@@ -187,12 +187,12 @@ void del(const QList<QUrl>& urlList, QWidget* parent)
void showMenuForDroppedUrls(QWidget* parent, const QList<QUrl>& urlList, const QUrl &destUrl)
{
if (urlList.isEmpty()) {
qWarning() << "urlList is empty!";
qCWarning(GWENVIEW_APP_LOG) << "urlList is empty!";
return;
}
if (!destUrl.isValid()) {
qWarning() << "destUrl is not valid!";
qCWarning(GWENVIEW_APP_LOG) << "destUrl is not valid!";
return;
}
......
......@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QPainterPath>
#include <QTimer>
#include <QToolButton>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QIcon>
// KDE
......@@ -223,7 +223,7 @@ void TagFilterWidget::updateTagSetFilter()
{
QModelIndex index = mTagComboBox->model()->index(mTagComboBox->currentIndex(), 0);
if (!index.isValid()) {
qWarning() << "Invalid index";
qCWarning(GWENVIEW_APP_LOG) << "Invalid index";
return;
}
SemanticInfoTag tag = index.data(TagModel::TagRole).toString();
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <QTreeView>
#include <QDir>
#include <QMimeData>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QStyleHints>
#include <QApplication>
......@@ -89,7 +89,7 @@ protected:
const QList<QUrl> urlList = KUrlMimeData::urlsFromMimeData(event->mimeData());
const QModelIndex index = indexAt(event->pos());
if (!index.isValid()) {
qWarning() << "Invalid index!";
qCWarning(GWENVIEW_APP_LOG) << "Invalid index!";
return;
}
const QUrl destUrl = static_cast<MODEL_CLASS*>(model())->urlForIndex(index);
......@@ -246,7 +246,7 @@ QModelIndex FolderViewContextManagerItem::findClosestIndex(const QModelIndex& pa
QUrl url = mModel->urlForIndex(index);
if (!url.isParentOf(wantedUrl)) {
qWarning() << url << "is not a parent of" << wantedUrl << "!";
qCWarning(GWENVIEW_APP_LOG) << url << "is not a parent of" << wantedUrl << "!";
return QModelIndex();
}
......@@ -285,7 +285,7 @@ QModelIndex FolderViewContextManagerItem::findRootIndex(const QUrl& wantedUrl)
}
}
if (!matchIndex.isValid()) {
qWarning() << "Found no root index for" << wantedUrl;
qCWarning(GWENVIEW_APP_LOG) << "Found no root index for" << wantedUrl;
}
return matchIndex;
}
......
......@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QToolButton>
#include <QWidgetAction>
#include <QTimer>
#include <QDebug>
#include "gwenview_app_debug.h"
// KDE
#include <KActionCollection>
......@@ -484,14 +484,14 @@ void FullScreenContent::showOptionsMenu()
QPoint pos;
QWidget* button = mOptionsAction->associatedWidgets().constFirst();
Q_ASSERT(button);
qWarning() << button << button->geometry();
qCWarning(GWENVIEW_APP_LOG) << button << button->geometry();
if (QApplication::isRightToLeft()) {
pos = button->mapToGlobal(button->rect().bottomLeft());
} else {
pos = button->mapToGlobal(button->rect().bottomRight());
pos.rx() -= menu.sizeHint().width();
}
qWarning() << pos;
qCWarning(GWENVIEW_APP_LOG) << pos;
menu.exec(pos);
}
......
......@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QImageWriter>
#include <QLabel>
#include <QMimeDatabase>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QSpacerItem>
#include <QSpinBox>
......@@ -495,7 +495,7 @@ void GvCore::setRating(const QUrl &url, int rating)
{
QModelIndex index = d->mDirModel->indexForUrl(url);
if (!index.isValid()) {
qWarning() << "invalid index!";
qCWarning(GWENVIEW_APP_LOG) << "invalid index!";
return;
}
d->mDirModel->setData(index, rating, SemanticInfoDirModel::RatingRole);
......
......@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Qt
#include <QApplication>
#include <QAction>
#include <QDebug>
#include "gwenview_app_debug.h"
// KDE
#include <KLocalizedString>
......@@ -56,7 +56,7 @@ namespace Gwenview
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......@@ -253,7 +253,7 @@ void ImageOpsContextManagerItem::crop()
}
RasterImageView* imageView = d->mMainWindow->viewMainPage()->imageView();
if (!imageView) {
qCritical() << "No ImageView available!";
qCCritical(GWENVIEW_APP_LOG) << "No ImageView available!";
return;
}
CropTool* tool = new CropTool(imageView);
......@@ -271,7 +271,7 @@ void ImageOpsContextManagerItem::startRedEyeReduction()
}
RasterImageView* view = d->mMainWindow->viewMainPage()->imageView();
if (!view) {
qCritical() << "No RasterImageView available!";
qCCritical(GWENVIEW_APP_LOG) << "No RasterImageView available!";
return;
}
RedEyeReductionTool* tool = new RedEyeReductionTool(view);
......@@ -295,7 +295,7 @@ void ImageOpsContextManagerItem::restoreDefaultImageViewTool()
{
RasterImageView* imageView = d->mMainWindow->viewMainPage()->imageView();
if (!imageView) {
qCritical() << "No RasterImageView available!";
qCCritical(GWENVIEW_APP_LOG) << "No RasterImageView available!";
return;
}
......
......@@ -49,7 +49,7 @@ namespace Gwenview
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......
......@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// KDE
#include <QAction>
#include <KActionCollection>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QUrl>
#include <KXMLGUIFactory>
#include <KDirLister>
......@@ -65,7 +65,7 @@ namespace Gwenview
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......@@ -170,11 +170,11 @@ private:
case VFLIP:
case TRANSPOSE:
case TRANSVERSE:
qWarning() << "Can't represent an orientation value of" << orientation << "as an angle (" << _url << ')';
qCWarning(GWENVIEW_APP_LOG) << "Can't represent an orientation value of" << orientation << "as an angle (" << _url << ')';
return 0;
}
#endif
//qWarning() << "Don't know how to handle an orientation value of" << orientation << '(' << _url << ')';
//qCWarning(GWENVIEW_APP_LOG) << "Don't know how to handle an orientation value of" << orientation << '(' << _url << ')';
return 0;
}
......@@ -298,7 +298,7 @@ void KIPIInterface::loadOnePlugin()
KIPI::Plugin* plugin = pluginInfo->plugin();
if (!plugin) {
qWarning() << "Plugin from library" << pluginInfo->library() << "failed to load";
qCWarning(GWENVIEW_APP_LOG) << "Plugin from library" << pluginInfo->library() << "failed to load";
continue;
}
......@@ -308,7 +308,7 @@ void KIPIInterface::loadOnePlugin()
KIPI::Category category = plugin->category(action);
if (!d->mMenuInfoMap.contains(category)) {
qWarning() << "Unknown category '" << category;
qCWarning(GWENVIEW_APP_LOG) << "Unknown category '" << category;
continue;
}
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "mainwindow.h"
#include "gwenview_app_debug.h"
#include <config-gwenview.h>
#include "dialogguard.h"
......@@ -117,7 +118,7 @@ namespace Gwenview
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......@@ -686,7 +687,7 @@ struct MainWindow::Private
if (action) {
action->setEnabled(enabled);
} else {
qWarning() << "Action" << name << "not found";
qCWarning(GWENVIEW_APP_LOG) << "Action" << name << "not found";
}
}
......@@ -1628,7 +1629,7 @@ void MainWindow::preloadNextUrl()
{
static bool disablePreload = qgetenv("GV_MAX_UNREFERENCED_IMAGES") == "0";
if (disablePreload) {
qDebug() << "Preloading disabled";
qCDebug(GWENVIEW_APP_LOG) << "Preloading disabled";
return;
}
QItemSelection selection = d->mContextManager->selectionModel()->selection();
......
......@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include "preloader.h"
// Qt
#include <QDebug>
#include "gwenview_app_debug.h"
// KDE
......@@ -36,7 +36,7 @@ namespace Gwenview
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <QLabel>
#include <QToolButton>
#include <QToolTip>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QIcon>
#include <QUrl>
......@@ -354,7 +354,7 @@ void SaveBar::triggerAction(const QString& action)
Q_ASSERT(pos < lst.size());
emit goToUrl(lst[pos]);
} else {
qWarning() << "Unknown action: " << action ;
qCWarning(GWENVIEW_APP_LOG) << "Unknown action: " << action ;
}
}
......
......@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
*/
// Self
#include "startmainpage.h"
#include "gwenview_app_debug.h"
#include <config-gwenview.h>
// Qt
......@@ -252,7 +252,7 @@ void StartMainPage::slotListViewActivated(const QModelIndex& index)
// Prevent dir lister error
if (!url.isValid()) {
qCritical() << "Tried to open an invalid url";
qCCritical(GWENVIEW_APP_LOG) << "Tried to open an invalid url";
return;
}
emit urlSelected(url);
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Qt
#include <QAction>
#include <QCursor>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QMenu>
// KDE
......@@ -48,7 +48,7 @@ struct ThumbnailViewHelperPrivate
{
QAction* action = mActionCollection->action(name);
if (!action) {
qWarning() << "Unknown action" << name;
qCWarning(GWENVIEW_APP_LOG) << "Unknown action" << name;
return;
}
if (action->isEnabled()) {
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <QShortcut>
#include <QToolButton>
#include <QVBoxLayout>
#include <QDebug>
#include "gwenview_app_debug.h"
#include <QMenu>
// KDE
......@@ -73,7 +73,7 @@ namespace Gwenview
#undef LOG
//#define ENABLE_LOG
#ifdef ENABLE_LOG
#define LOG(x) qDebug() << x
#define LOG(x) qCDebug(GWENVIEW_APP_LOG) << x
#else
#define LOG(x) ;
#endif
......@@ -384,7 +384,7 @@ struct ViewMainPagePrivate
{
QUrl url = view->url();
if (!url.isValid()) {
qWarning() << "View does not display any document!";
qCWarning(GWENVIEW_APP_LOG) << "View does not display any document!";
return QModelIndex();
}
......@@ -688,7 +688,7 @@ void ViewMainPage::openUrls(const QList<QUrl>& allUrls, const QUrl &currentUrl)
// Create view for remaining urls
for (const QUrl &url : qAsConst(urls)) {
if (d->mDocumentViews.count() >= MaxViewCount) {
qWarning() << "Too many documents to show";
qCWarning(GWENVIEW_APP_LOG) << "Too many documents to show";
break;
}
DocumentView* view = d->createDocumentView();
......@@ -750,7 +750,7 @@ void ViewMainPage::reload()
}
Document::Ptr doc = view->document();
if (!doc) {
qWarning() << "!doc";
qCWarning(GWENVIEW_APP_LOG) << "!doc";
return;
}
if (doc->isModified()) {
......
org.kde.kdegraphics.gwenview.lib gwenview lib (kdegraphics) IDENTIFIER [GWENVIEW_LIB_LOG]
org.kde.kdegraphics.gwenview.importer gwenview importer (kdegraphics) IDENTIFIER [GWENVIEW_IMPORTER_LOG]
org.kde.kdegraphics.gwenview.app gwenview app (kdegraphics) IDENTIFIER [GWENVIEW_APP_LOG]
......@@ -19,7 +19,7 @@ set(importer_SRCS
serializedurlmap.cpp
thumbnailpage.cpp
)
ecm_qt_declare_logging_category(importer_SRCS HEADER gwenview_importer_debug.h IDENTIFIER GWENVIEW_IMPORTER_LOG CATEGORY_NAME org.kde.kdegraphics.gwenview.importer)
ki18n_wrap_ui(importer_SRCS
dialogpage.ui
importerconfigdialog.ui
......
......@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
// Qt
// KDE
#include <QDebug>
#include "gwenview_importer_debug.h"
#include <KDirLister>
// Local
......
......@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QScopedPointer>
// KDE
#include <QDebug>
#include "gwenview_importer_debug.h"
#include <KFileItem>
#include <KIO/CopyJob>
#include <KIO/Job>
......@@ -53,7 +53,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
statJob = KIO::mostLocalUrl(url1);
KJobWidgets::setWindow(statJob, authWindow);
if (!statJob->exec()) {
qWarning() << "Unable to stat" << url1;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Unable to stat" << url1;
return false;
}
file1.reset(new QFile(statJob->mostLocalUrl().toLocalFile()));
......@@ -61,7 +61,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
fileJob = KIO::storedGet(url1, KIO::NoReload ,KIO::HideProgressInfo);
KJobWidgets::setWindow(fileJob, authWindow);
if (!fileJob->exec()) {
qWarning() << "Can't read" << url1;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Can't read" << url1;
return false;
}
file1Bytes = QByteArray(fileJob->data());
......@@ -69,7 +69,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
}
if (!file1->open(QIODevice::ReadOnly)) {
// Can't read url1, assume it's different from url2
qWarning() << "Can't read" << url1;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Can't read" << url1;
return false;
}
......@@ -77,7 +77,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
statJob = KIO::mostLocalUrl(url2);
KJobWidgets::setWindow(statJob, authWindow);
if (!statJob->exec()) {
qWarning() << "Unable to stat" << url2;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Unable to stat" << url2;
return false;
}
file2.reset(new QFile(statJob->mostLocalUrl().toLocalFile()));
......@@ -85,7 +85,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
fileJob = KIO::storedGet(url2, KIO::NoReload, KIO::HideProgressInfo);
KJobWidgets::setWindow(fileJob, authWindow);
if (!fileJob->exec()) {
qWarning() << "Can't read" << url2;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Can't read" << url2;
return false;
}
file2Bytes = QByteArray(fileJob->data());
......@@ -93,7 +93,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
}
if (!file2->open(QIODevice::ReadOnly)) {
// Can't read url2, assume it's different from url1
qWarning() << "Can't read" << url2;
qCWarning(GWENVIEW_IMPORTER_LOG) << "Can't read" << url2;
return false;
}
......@@ -109,7 +109,7 @@ bool contentsAreIdentical(const QUrl& url1, const QUrl& url2, QWidget* authWindo
if (file1->atEnd() && file2->atEnd()) {
return true;
} else {
qWarning() << "One file ended before the other";
qCWarning(GWENVIEW_IMPORTER_LOG) << "One file ended before the other";
return false;
}
}
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QStackedWidget>
// KDE
#include <QDebug>
#include "gwenview_importer_debug.h"
#include <KIO/DeleteJob>
#include <KMessageBox>
#include <KProtocolInfo>
......@@ -163,7 +163,7 @@ public:
{
KService::Ptr service = KService::serviceByDesktopName("org.kde.gwenview");
if (!service) {
qCritical() << "Could not find gwenview";
qCCritical(GWENVIEW_IMPORTER_LOG) << "Could not find gwenview";
} else {
KRun::runService(*service, {mThumbnailPage->destinationUrl()}, nullptr /* window */);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment