Commit 75b11492 authored by Laurent Montel's avatar Laurent Montel 😁

Add debug categories

parent fb9f02ed
......@@ -29,7 +29,7 @@ set(KDE_APPLICATIONS_VERSION_MICRO "70")
set(KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
set(PROJECT_VERSION ${KDE_APPLICATIONS_VERSION})
set(KF5_VERSION "5.23.0")
set(KF5_VERSION "5.30.0")
find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
......@@ -44,8 +44,9 @@ include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
find_package(Qt5 5.4 CONFIG REQUIRED Core Widgets)
find_package(Qt5 5.7 CONFIG REQUIRED Core Widgets)
find_package(KF5 ${KF5_VERSION} REQUIRED
XmlGui # For app
KIO # For part
......@@ -55,11 +56,14 @@ find_package(KF5DocTools) # Optional, not needed on Windows for example.
add_definitions(-DTRANSLATION_DOMAIN=\"filelight\")
include_directories(src/)
include_directories(src)
add_subdirectory(src)
add_subdirectory(misc)
if (KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
install( FILES filelight.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
org.kde.filelight filelight IDENTIFIER [FILELIGHT_LOG]
......@@ -40,6 +40,8 @@ set(filelight_SRCS
mainWindow.cpp
main.cpp
)
ecm_qt_declare_logging_category(filelight_SRCS HEADER filelight_debug.h IDENTIFIER FILELIGHT_LOG CATEGORY_NAME org.kde.filelight)
set(filelight_ICONS
${CMAKE_CURRENT_SOURCE_DIR}/../misc/16-apps-filelight.png
${CMAKE_CURRENT_SOURCE_DIR}/../misc/32-apps-filelight.png
......
......@@ -25,7 +25,6 @@
#include <QByteArray> //qstrdup
#include <QFile> //decodeName()
#include <QDebug>
#include <QLocale>
#include <KFormat>
......
......@@ -20,7 +20,7 @@
***********************************************************************/
#include "historyAction.h"
#include "filelight_debug.h"
#include <KActionCollection>
#include <KConfig>
#include <KConfigGroup>
......@@ -30,7 +30,6 @@
#include <QIcon>
#include <QAction>
#include <QDebug>
inline HistoryAction::HistoryAction(const QIcon& icon, const QString& text, KActionCollection* ac)
: QAction(icon, text, ac)
......@@ -117,7 +116,7 @@ void HistoryCollection::save(KConfigGroup &configgroup)
void HistoryCollection::restore(const KConfigGroup &configgroup)
{
if (!m_b || !m_f) {
qWarning() << "what the actual fuck";
qCWarning(FILELIGHT_LOG) << "what the actual fuck";
return;
}
......
......@@ -24,6 +24,7 @@
#include "Config.h"
#include "fileTree.h"
#include "scan.h"
#include "filelight_debug.h"
#include <QStorageInfo>
#include <QElapsedTimer>
......@@ -82,7 +83,7 @@ LocalLister::run()
//recursively scan the requested path
const QByteArray path = QFile::encodeName(m_path);
Folder *tree = scan(path, path);
qDebug() << "Scan completed in" << (timer.elapsed()/1000);
qCDebug(FILELIGHT_LOG) << "Scan completed in" << (timer.elapsed()/1000);
//delete the list of trees useful for this scan,
//in a successful scan the contents would now be transferred to 'tree'
......@@ -90,13 +91,13 @@ LocalLister::run()
if (m_parent->m_abort) //scan was cancelled
{
qDebug() << "Scan successfully aborted";
qCDebug(FILELIGHT_LOG) << "Scan successfully aborted";
delete tree;
tree = nullptr;
}
qDebug() << "Emitting signal to cache results ...";
qCDebug(FILELIGHT_LOG) << "Emitting signal to cache results ...";
emit branchCompleted(tree);
qDebug() << "Thread terminating ...";
qCDebug(FILELIGHT_LOG) << "Thread terminating ...";
}
#ifndef S_BLKSIZE
......@@ -212,7 +213,7 @@ LocalLister::scan(const QByteArray &path, const QByteArray &dirname)
{
if (new_path == folder->name8Bit())
{
qDebug() << "Tree pre-completed: " << folder->decodedName();
qCDebug(FILELIGHT_LOG) << "Tree pre-completed: " << folder->decodedName();
d = folder;
m_trees->removeAll(folder);
m_parent->m_files += folder->children();
......@@ -256,8 +257,8 @@ void LocalLister::readMounts()
}
}
qDebug() << "Found the following remote filesystems: " << s_remoteMounts;
qDebug() << "Found the following local filesystems: " << s_localMounts;
qCDebug(FILELIGHT_LOG) << "Found the following remote filesystems: " << s_remoteMounts;
qCDebug(FILELIGHT_LOG) << "Found the following local filesystems: " << s_localMounts;
}
}//namespace Filelight
......
......@@ -30,7 +30,6 @@
#include <QLabel>
#include <QPainter>
#include <QDebug>
#include <QFontDatabase>
......
......@@ -25,6 +25,7 @@
#include <QFontMetrics> //ctor
#include <QPainter>
#include <QBrush>
#include "filelight_debug.h"
#include <KCursor> //make()
#include <KLocalizedString>
......@@ -252,7 +253,7 @@ bool RadialMap::Map::resize(const QRect &rect)
void RadialMap::Map::colorise()
{
if (!m_signature || m_signature->isEmpty()) {
qDebug() << "no signature yet";
qCDebug(FILELIGHT_LOG) << "no signature yet";
return;
}
......
......@@ -22,6 +22,7 @@
#include "remoteLister.h"
#include "fileTree.h"
#include "scan.h"
#include "filelight_debug.h"
#include <KDirLister>
......@@ -58,7 +59,7 @@ struct Store {
{
/// returns the next store available for scanning
qDebug() << "propagate: " << url;
qCDebug(FILELIGHT_LOG) << "propagate: " << url;
if (parent) {
parent->folder->append(folder);
......@@ -100,7 +101,7 @@ RemoteLister::~RemoteLister()
void RemoteLister::onCanceled()
{
qDebug() << "Canceled";
qCDebug(FILELIGHT_LOG) << "Canceled";
emit branchCompleted(nullptr);
deleteLater();
}
......@@ -146,11 +147,11 @@ void RemoteLister::onCompleted()
currentStore->stores.erase(first);
//this returns _immediately_
qDebug() << "scanning: " << url;
qCDebug(FILELIGHT_LOG) << "scanning: " << url;
openUrl(url);
}
else {
qDebug() << "I think we're done";
qCDebug(FILELIGHT_LOG) << "I think we're done";
Q_ASSERT(m_root == m_store);
emit branchCompleted(m_store->folder);
......
......@@ -24,6 +24,7 @@
#include "remoteLister.h"
#include "fileTree.h"
#include "localLister.h"
#include "filelight_debug.h"
#include <QGuiApplication>
#include <QCursor>
......@@ -47,7 +48,7 @@ ScanManager::ScanManager(QObject *parent)
ScanManager::~ScanManager()
{
if (m_thread) {
qDebug() << "Attempting to abort scan operation...";
qCDebug(FILELIGHT_LOG) << "Attempting to abort scan operation...";
m_abort = true;
m_thread->wait();
}
......@@ -66,7 +67,7 @@ bool ScanManager::start(const QUrl &url)
//url is guaranteed clean and safe
qDebug() << "Scan requested for: " << url;
qCDebug(FILELIGHT_LOG) << "Scan requested for: " << url;
if (running()) {
qWarning() << "Tried to launch two concurrent scans, aborting old one...";
......@@ -109,7 +110,7 @@ bool ScanManager::start(const QUrl &url)
if (path.startsWith(cachePath)) { //then whole tree already scanned
//find a pointer to the requested branch
qDebug() << "Cache-(a)hit: " << cachePath;
qCDebug(FILELIGHT_LOG) << "Cache-(a)hit: " << cachePath;
QVector<QStringRef> split = path.midRef(cachePath.length()).split(QLatin1Char('/'));
Folder *d = folder;
......@@ -137,7 +138,7 @@ bool ScanManager::start(const QUrl &url)
delete trees;
//we found a completed tree, thus no need to scan
qDebug() << "Found cache-handle, generating map..";
qCDebug(FILELIGHT_LOG) << "Found cache-handle, generating map..";
emit branchCacheHit(d);
......@@ -150,7 +151,7 @@ bool ScanManager::start(const QUrl &url)
break; //do a full scan
}
} else if (cachePath.startsWith(path)) { //then part of the requested tree is already scanned
qDebug() << "Cache-(b)hit: " << cachePath;
qCDebug(FILELIGHT_LOG) << "Cache-(b)hit: " << cachePath;
it.remove();
trees->append(folder);
}
......@@ -193,9 +194,9 @@ void ScanManager::cacheTree(Folder *tree)
QMutexLocker locker(&m_mutex); // This gets released once it is destroyed.
if (m_thread) {
qDebug() << "Waiting for thread to terminate ...";
qCDebug(FILELIGHT_LOG) << "Waiting for thread to terminate ...";
m_thread->wait();
qDebug() << "Thread terminated!";
qCDebug(FILELIGHT_LOG) << "Thread terminated!";
delete m_thread; //note the lister deletes itself
m_thread = nullptr;
}
......
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