Use categorized logging

This commit is contained in:
Frederik Gladhorn 2014-09-11 19:36:01 +02:00
parent 50e3c1478a
commit 9d89739972
27 changed files with 153 additions and 105 deletions

View File

@ -96,6 +96,7 @@ set(okularcore_SRCS
core/misc.cpp
core/movie.cpp
core/observer.cpp
core/debug.cpp
core/page.cpp
core/pagecontroller.cpp
core/pagesize.cpp
@ -221,6 +222,7 @@ set(okularpart_SRCS
ui/annotationtools.cpp
ui/annotationwidgets.cpp
ui/bookmarklist.cpp
ui/debug_ui.cpp
ui/fileprinterpreview.cpp
ui/findbar.cpp
ui/formwidgets.cpp

View File

@ -421,7 +421,7 @@ ObjectRect::~ObjectRect()
else if ( m_objectType == SourceRef )
delete static_cast<Okular::SourceReference*>( m_object );
else
kDebug(OkularDebug).nospace() << "Object deletion not implemented for type '" << m_objectType << "'.";
qCDebug(OkularCoreDebug).nospace() << "Object deletion not implemented for type '" << m_objectType << "'.";
}
/** class AnnotationObjectRect **/

View File

@ -648,7 +648,7 @@ void RegularArea<NormalizedShape, Shape>::simplify()
}
}
#ifdef DEBUG_REGULARAREA
kDebug() << "from" << prev_end << "to" << this->count();
qCDebug(OkularCoreDebug) << "from" << prev_end << "to" << this->count();
#endif
}

View File

@ -110,7 +110,7 @@ int AudioPlayerPrivate::newId() const
bool AudioPlayerPrivate::play( const SoundInfo& si )
{
kDebug() ;
qCDebug(OkularCoreDebug) ;
PlayData * data = new PlayData();
data->m_output = new Phonon::AudioOutput( Phonon::NotificationCategory );
data->m_output->setVolume( si.volume );
@ -124,7 +124,7 @@ bool AudioPlayerPrivate::play( const SoundInfo& si )
case Sound::External:
{
QString url = si.sound->url();
kDebug(OkularDebug) << "External," << url;
qCDebug(OkularCoreDebug) << "External," << url;
if ( !url.isEmpty() )
{
int newid = newId();
@ -148,10 +148,10 @@ bool AudioPlayerPrivate::play( const SoundInfo& si )
case Sound::Embedded:
{
QByteArray filedata = si.sound->data();
kDebug(OkularDebug) << "Embedded," << filedata.length();
qCDebug(OkularCoreDebug) << "Embedded," << filedata.length();
if ( !filedata.isEmpty() )
{
kDebug(OkularDebug) << "Mediaobject:" << data->m_mediaobject;
qCDebug(OkularCoreDebug) << "Mediaobject:" << data->m_mediaobject;
int newid = newId();
m_mapper.setMapping( data->m_mediaobject, newid );
data->m_buffer = new QBuffer();
@ -171,7 +171,7 @@ bool AudioPlayerPrivate::play( const SoundInfo& si )
if ( data )
{
QObject::connect( data->m_mediaobject, SIGNAL(finished()), &m_mapper, SLOT(map()) );
kDebug(OkularDebug) << "PLAY";
qCDebug(OkularCoreDebug) << "PLAY";
data->play();
m_state = AudioPlayer::PlayingState;
}
@ -205,7 +205,7 @@ void AudioPlayerPrivate::finished( int id )
m_playing.erase( it );
m_state = AudioPlayer::StoppedState;
}
kDebug(OkularDebug) << "finished," << m_playing.count();
qCDebug(OkularCoreDebug) << "finished," << m_playing.count();
}
@ -235,7 +235,7 @@ void AudioPlayer::playSound( const Sound * sound, const SoundAction * linksound
if ( sound->soundType() == Sound::External && !d->m_currentDocument.isLocalFile() )
return;
kDebug() ;
qCDebug(OkularCoreDebug) ;
SoundInfo si( sound, linksound );
// if the mix flag of the new sound is false, then the currently playing

12
core/debug.cpp Normal file
View File

@ -0,0 +1,12 @@
/***************************************************************************
* Copyright (C) 2014 by Frederik Gladhorn <gladhorn@kde.org> *
* *
* 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) any later version. *
***************************************************************************/
#include "debug_p.h"
Q_LOGGING_CATEGORY(OkularCoreDebug, "org.kde.okular.core")

View File

@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
* Copyright (C) 2014 by Frederik Gladhorn <gladhorn@kde.org> *
* *
* 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 *
@ -7,9 +8,11 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _OKUAR_DEBUG_P_H_
#define _OKUAR_DEBUG_P_H_
#ifndef OKULAR_DEBUG_P_H
#define OKULAR_DEBUG_P_H
#define OkularDebug 4700
#include <QtCore/qloggingcategory.h>
Q_DECLARE_LOGGING_CATEGORY(OkularCoreDebug)
#endif

View File

@ -358,7 +358,7 @@ void DocumentPrivate::cleanupPixmapMemory( qulonglong memoryToFree )
if ( !p ) // No pixmap to remove
break;
kDebug().nospace() << "Evicting cache pixmap observer=" << p->observer << " page=" << p->page;
qCDebug(OkularCoreDebug).nospace() << "Evicting cache pixmap observer=" << p->observer << " page=" << p->page;
// m_allocatedPixmapsTotalMemory can't underflow because we always add or remove
// the memory used by the AllocatedPixmap so at most it can reach zero
@ -609,7 +609,7 @@ void DocumentPrivate::loadDocumentInfo()
// note: load data and stores it internally (document or pages). observers
// are still uninitialized at this point so don't access them
{
//kDebug(OkularDebug).nospace() << "Using '" << d->m_xmlFileName << "' as document info file.";
//qCDebug(OkularCoreDebug).nospace() << "Using '" << d->m_xmlFileName << "' as document info file.";
if ( m_xmlFileName.isEmpty() )
return;
@ -626,7 +626,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
QDomDocument doc( "documentInfo" );
if ( !doc.setContent( &infoFile ) )
{
kDebug(OkularDebug) << "Can't load XML pair! Check for broken xml.";
qCDebug(OkularCoreDebug) << "Can't load XML pair! Check for broken xml.";
infoFile.close();
return;
}
@ -807,7 +807,7 @@ bool DocumentPrivate::openRelativeFile( const QString & fileName )
if ( absFileName.isEmpty() )
return false;
kDebug(OkularDebug).nospace() << "openDocument: '" << absFileName << "'";
qCDebug(OkularCoreDebug).nospace() << "openDocument: '" << absFileName << "'";
emit m_parent->openUrl( absFileName );
return true;
@ -818,7 +818,7 @@ Generator * DocumentPrivate::loadGeneratorLibrary( const KService::Ptr &service
KPluginFactory *factory = KPluginLoader( service->library() ).factory();
if ( !factory )
{
kWarning(OkularDebug).nospace() << "Invalid plugin factory for " << service->library() << "!";
kWarning(OkularCoreDebug).nospace() << "Invalid plugin factory for " << service->library() << "!";
return 0;
}
@ -946,7 +946,7 @@ Document::OpenResult DocumentPrivate::openDocumentInternal( const KService::Ptr&
QApplication::setOverrideCursor( Qt::WaitCursor );
const QSizeF dpi = Utils::realDpi(m_widget);
kDebug() << "Output DPI:" << dpi;
qCDebug(OkularCoreDebug) << "Output DPI:" << dpi;
m_generator->setDPI(dpi);
Document::OpenResult openResult = Document::OpenError;
@ -1171,7 +1171,7 @@ void DocumentPrivate::performModifyPageAnnotation( int page, Annotation * annota
}
// Redraw everything, including ExternallyDrawn annotations
kDebug(OkularDebug) << "Refreshing Pixmaps";
qCDebug(OkularCoreDebug) << "Refreshing Pixmaps";
refreshPixmaps( page );
}
@ -1360,7 +1360,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
else if ( !r->d->mForce && r->preload() && qAbs( r->pageNumber() - currentViewportPage ) >= maxDistance )
{
m_pixmapRequestsStack.pop_back();
//kDebug() << "Ignoring request that doesn't fit in cache";
//qCDebug(OkularCoreDebug) << "Ignoring request that doesn't fit in cache";
delete r;
}
// Ignore requests for pixmaps that are already being generated
@ -1373,7 +1373,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
else if ( !tilesManager && m_generator->hasFeature( Generator::TiledRendering ) && (long)r->width() * (long)r->height() > 8000000L )
{
// if the image is too big. start using tiles
kDebug(OkularDebug).nospace() << "Start using tiles on page " << r->pageNumber()
qCDebug(OkularCoreDebug).nospace() << "Start using tiles on page " << r->pageNumber()
<< " (" << r->width() << "x" << r->height() << " px);";
// fill the tiles manager with the last rendered pixmap
@ -1428,7 +1428,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
// If the requested area is below 6000000 pixels, switch off the tile manager
else if ( tilesManager && (long)r->width() * (long)r->height() < 6000000L )
{
kDebug(OkularDebug).nospace() << "Stop using tiles on page " << r->pageNumber()
qCDebug(OkularCoreDebug).nospace() << "Stop using tiles on page " << r->pageNumber()
<< " (" << r->width() << "x" << r->height() << " px);";
// page is too small. stop using tiles.
@ -1442,9 +1442,9 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
m_pixmapRequestsStack.pop_back();
if ( !m_warnedOutOfMemory )
{
kWarning(OkularDebug).nospace() << "Running out of memory on page " << r->pageNumber()
kWarning(OkularCoreDebug).nospace() << "Running out of memory on page " << r->pageNumber()
<< " (" << r->width() << "x" << r->height() << " px);";
kWarning(OkularDebug) << "this message will be reported only once.";
kWarning(OkularCoreDebug) << "this message will be reported only once.";
m_warnedOutOfMemory = true;
}
delete r;
@ -1477,7 +1477,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
if ( m_generator->canGeneratePixmap() )
{
QRect requestRect = !request->isTile() ? QRect(0, 0, request->width(), request->height() ) : request->normalizedRect().geometry( request->width(), request->height() );
kDebug(OkularDebug).nospace() << "sending request observer=" << request->observer() << " " <<requestRect.width() << "x" << requestRect.height() << "@" << request->pageNumber() << " async == " << request->asynchronous() << " isTile == " << request->isTile();
qCDebug(OkularCoreDebug).nospace() << "sending request observer=" << request->observer() << " " <<requestRect.width() << "x" << requestRect.height() << "@" << request->pageNumber() << " async == " << request->asynchronous() << " isTile == " << request->isTile();
m_pixmapRequestsStack.removeAll ( request );
if ( tm )
@ -2209,7 +2209,7 @@ Document::OpenResult Document::openDocument( const QString & docFile, const KUrl
if (offers.isEmpty())
{
emit error( i18n( "Can not find a plugin which is able to handle the document being passed." ), -1 );
kWarning(OkularDebug).nospace() << "No plugin for mimetype '" << mime.name() << "'.";
kWarning(OkularCoreDebug).nospace() << "No plugin for mimetype '" << mime.name() << "'.";
return OpenError;
}
int hRank=0;
@ -2915,7 +2915,7 @@ void Document::requestPixmaps( const QLinkedList< PixmapRequest * > & requests,
{
// set the 'page field' (see PixmapRequest) and check if it is valid
PixmapRequest * request = *rIt;
kDebug(OkularDebug).nospace() << "request observer=" << request->observer() << " " <<request->width() << "x" << request->height() << "@" << request->pageNumber();
qCDebug(OkularCoreDebug).nospace() << "request observer=" << request->observer() << " " <<request->width() << "x" << request->height() << "@" << request->pageNumber();
if ( d->m_pagesVector.value( request->pageNumber() ) == 0 )
{
// skip requests referencing an invalid page (must not happen)
@ -3037,7 +3037,7 @@ void Document::prepareToModifyAnnotationProperties( Annotation * annotation )
Q_ASSERT(d->m_prevPropsOfAnnotBeingModified.isNull());
if (!d->m_prevPropsOfAnnotBeingModified.isNull())
{
kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties has already been called since last call to Document::modifyPageAnnotationProperties";
kError(OkularCoreDebug) << "Error: Document::prepareToModifyAnnotationProperties has already been called since last call to Document::modifyPageAnnotationProperties";
return;
}
d->m_prevPropsOfAnnotBeingModified = annotation->getAnnotationPropertiesDomNode();
@ -3048,7 +3048,7 @@ void Document::modifyPageAnnotationProperties( int page, Annotation * annotation
Q_ASSERT(!d->m_prevPropsOfAnnotBeingModified.isNull());
if (d->m_prevPropsOfAnnotBeingModified.isNull())
{
kError(OkularDebug) << "Error: Document::prepareToModifyAnnotationProperties must be called before Annotation is modified";
kError(OkularCoreDebug) << "Error: Document::prepareToModifyAnnotationProperties must be called before Annotation is modified";
return;
}
QDomNode prevProps = d->m_prevPropsOfAnnotBeingModified;
@ -3210,12 +3210,12 @@ void Document::setViewport( const DocumentViewport & viewport, DocumentObserver
{
if ( !viewport.isValid() )
{
kDebug(OkularDebug) << "invalid viewport:" << viewport.toString();
qCDebug(OkularCoreDebug) << "invalid viewport:" << viewport.toString();
return;
}
if ( viewport.pageNumber >= int(d->m_pagesVector.count()) )
{
//kDebug(OkularDebug) << "viewport out of document:" << viewport.toString();
//qCDebug(OkularCoreDebug) << "viewport out of document:" << viewport.toString();
return;
}
@ -3223,7 +3223,7 @@ void Document::setViewport( const DocumentViewport & viewport, DocumentObserver
DocumentViewport & oldViewport = *d->m_viewportIterator;
// disabled by enrico on 2005-03-18 (less debug output)
//if ( viewport == oldViewport )
// kDebug(OkularDebug) << "setViewport with the same viewport.";
// qCDebug(OkularCoreDebug) << "setViewport with the same viewport.";
const int oldPageNumber = oldViewport.pageNumber;
@ -3631,7 +3631,7 @@ void Document::processAction( const Action * action )
// first open filename if link is pointing outside this document
if ( go->isExternal() && !d->openRelativeFile( go->fileName() ) )
{
kWarning(OkularDebug).nospace() << "Action: Error opening '" << go->fileName() << "'.";
kWarning(OkularCoreDebug).nospace() << "Action: Error opening '" << go->fileName() << "'.";
return;
}
else
@ -3820,14 +3820,14 @@ void Document::processSourceReference( const SourceReference * ref )
const KUrl url( d->giveAbsolutePath( ref->fileName() ) );
if ( !url.isLocalFile() )
{
kDebug(OkularDebug) << url.url() << "is not a local file.";
qCDebug(OkularCoreDebug) << url.url() << "is not a local file.";
return;
}
const QString absFileName = url.toLocalFile();
if ( !QFile::exists( absFileName ) )
{
kDebug(OkularDebug) << "No such file:" << absFileName;
qCDebug(OkularCoreDebug) << "No such file:" << absFileName;
return;
}
@ -4293,8 +4293,8 @@ bool Document::saveDocumentArchive( const QString &fileName )
}
else
{
kWarning(OkularDebug) << "saveChanges failed: " << errorText;
kDebug(OkularDebug) << "Falling back to saving a copy of the original file";
kWarning(OkularCoreDebug) << "saveChanges failed: " << errorText;
qCDebug(OkularCoreDebug) << "Falling back to saving a copy of the original file";
}
}
@ -4369,7 +4369,7 @@ void DocumentPrivate::requestDone( PixmapRequest * req )
#ifndef NDEBUG
if ( !m_generator->canGeneratePixmap() )
kDebug(OkularDebug) << "requestDone with generator not in READY state.";
qCDebug(OkularCoreDebug) << "requestDone with generator not in READY state.";
#endif
// [MEM] 1.1 find and remove a previous entry for the same page and id
@ -4405,7 +4405,7 @@ void DocumentPrivate::requestDone( PixmapRequest * req )
}
#ifndef NDEBUG
else
kWarning(OkularDebug) << "Receiving a done request for the defunct observer" << observer;
kWarning(OkularCoreDebug) << "Receiving a done request for the defunct observer" << observer;
#endif
// 3. delete request
@ -4512,7 +4512,7 @@ void DocumentPrivate::setRotationInternal( int r, bool notify )
foreachObserverD( notifySetup( m_pagesVector, DocumentObserver::NewLayoutForPages ) );
foreachObserverD( notifyContentsCleared( DocumentObserver::Pixmap | DocumentObserver::Highlights | DocumentObserver::Annotations ) );
}
kDebug(OkularDebug) << "Rotated:" << r;
qCDebug(OkularCoreDebug) << "Rotated:" << r;
}
void Document::setPageSize( const PageSize &size )
@ -4542,7 +4542,7 @@ void Document::setPageSize( const PageSize &size )
foreachObserver( notifySetup( d->m_pagesVector, DocumentObserver::NewLayoutForPages ) );
foreachObserver( notifyContentsCleared( DocumentObserver::Pixmap | DocumentObserver::Highlights ) );
kDebug(OkularDebug) << "New PageSize id:" << sizeid;
qCDebug(OkularCoreDebug) << "New PageSize id:" << sizeid;
}

View File

@ -229,33 +229,33 @@ EditTextCommand::EditTextCommand( const QString & newContents,
// If There was a selection then edit was not a simple single character backspace, delete, or insert
if (m_prevCursorPos != m_prevAnchorPos)
{
kDebug(OkularDebug) << "OtherEdit, selection";
qCDebug(OkularCoreDebug) << "OtherEdit, selection";
m_editType = OtherEdit;
}
else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
newContentsLeftOfCursor() == oldContentsLeftOfCursor().left(oldContentsLeftOfCursor().length() - 1) &&
oldContentsLeftOfCursor().right(1) != "\n" )
{
kDebug(OkularDebug) << "CharBackspace";
qCDebug(OkularCoreDebug) << "CharBackspace";
m_editType = CharBackspace;
}
else if ( newContentsLeftOfCursor() == oldContentsLeftOfCursor() &&
newContentsRightOfCursor() == oldContentsRightOfCursor().right(oldContentsRightOfCursor().length() - 1) &&
oldContentsRightOfCursor().left(1) != "\n" )
{
kDebug(OkularDebug) << "CharDelete";
qCDebug(OkularCoreDebug) << "CharDelete";
m_editType = CharDelete;
}
else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
newContentsLeftOfCursor().left( newContentsLeftOfCursor().length() - 1) == oldContentsLeftOfCursor() &&
newContentsLeftOfCursor().right(1) != "\n" )
{
kDebug(OkularDebug) << "CharInsert";
qCDebug(OkularCoreDebug) << "CharInsert";
m_editType = CharInsert;
}
else
{
kDebug(OkularDebug) << "OtherEdit";
qCDebug(OkularCoreDebug) << "OtherEdit";
m_editType = OtherEdit;
}
}

View File

@ -96,14 +96,14 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
} else if ( inputFileInfo.suffix() == "ps" && printer.outputFormat() == QPrinter::PdfFormat && ps2pdfAvailable() ) {
exe = "ps2pdf";
argList << fileList[0] << printer.outputFileName();
kDebug(OkularDebug) << "Executing" << exe << "with arguments" << argList;
qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute( exe, argList );
#pragma message("KF5: Fix PostScript printing")
// } else if ( inputFileInfo.suffix() == "pdf" && printer.outputFormat() == QPrinter::PostScriptFormat && pdf2psAvailable() ) {
// exe = "pdf2ps";
// argList << fileList[0] << printer.outputFileName();
// kDebug(OkularDebug) << "Executing" << exe << "with arguments" << argList;
// qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
// ret = KProcess::execute( exe, argList );
} else {
ret = -5;
@ -135,7 +135,7 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
bool useCupsOptions = cupsAvailable();
argList = printArguments( printer, fileDeletePolicy, pageSelectPolicy,
useCupsOptions, pageRange, exe, documentOrientation ) << fileList;
kDebug(OkularDebug) << "Executing" << exe << "with arguments" << argList;
qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute( exe, argList );

View File

@ -48,7 +48,7 @@ void TextSelection::end( const NormalizedPoint & p )
int dir1 = d->direction;
d->direction = (p.y - d->cur[0].y < 0 || (p.y - d->cur[0].y == 0 && p.x - d->cur[0].x < 0));
if (d->direction != dir1)
kDebug(OkularDebug) << "changing direction in selection";
qCDebug(OkularCoreDebug) << "changing direction in selection";
d->cur[1] = p;
}

View File

@ -67,7 +67,7 @@ Movie::Movie( const QString& fileName, const QByteArray &data )
d->m_tmp->write( data );
d->m_tmp->flush();
}
else kDebug(OkularDebug) << "Failed to create temporary file for video data.";
else qCDebug(OkularCoreDebug) << "Failed to create temporary file for video data.";
}
Movie::~Movie()

View File

@ -667,7 +667,7 @@ bool Page::removeAnnotation( Annotation * annotation )
it = m_rects.erase( it );
rectfound = true;
}
kDebug(OkularDebug) << "removed annotation:" << annotation->uniqueName();
qCDebug(OkularCoreDebug) << "removed annotation:" << annotation->uniqueName();
annotation->d_ptr->m_page = 0;
m_annotations.erase( aIt );
break;
@ -820,13 +820,13 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
if ( annotation )
{
m_doc->performAddPageAnnotation(m_number, annotation);
kDebug(OkularDebug) << "restored annot:" << annotation->uniqueName();
qCDebug(OkularCoreDebug) << "restored annot:" << annotation->uniqueName();
}
else
kWarning(OkularDebug).nospace() << "page (" << m_number << "): can't restore an annotation from XML.";
kWarning(OkularCoreDebug).nospace() << "page (" << m_number << "): can't restore an annotation from XML.";
}
#ifdef PAGE_PROFILE
kDebug(OkularDebug).nospace() << "annots: XML Load time: " << time.elapsed() << "ms";
qCDebug(OkularCoreDebug).nospace() << "annots: XML Load time: " << time.elapsed() << "ms";
#endif
}
// parse formList child element
@ -917,7 +917,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
QDomElement annElement = document.createElement( "annotation" );
AnnotationUtils::storeAnnotation( a, annElement, document );
annotListElement.appendChild( annElement );
kDebug(OkularDebug) << "save annotation:" << a->uniqueName();
qCDebug(OkularCoreDebug) << "save annotation:" << a->uniqueName();
}
}

View File

@ -94,7 +94,7 @@ void ExecutorKJS::execute( const QString &script )
int errLine;
if ( !KJSInterpreter::normalizeCode( script, &script2, &errLine, &errMsg ) )
{
kWarning(OkularDebug) << "Parse error during normalization!";
kWarning(OkularCoreDebug) << "Parse error during normalization!";
script2 = script;
}
#endif
@ -104,10 +104,10 @@ void ExecutorKJS::execute( const QString &script )
KJSContext* ctx = d->m_interpreter->globalContext();
if ( result.isException() || ctx->hasException() )
{
kDebug(OkularDebug) << "JS exception" << result.errorMessage();
qCDebug(OkularCoreDebug) << "JS exception" << result.errorMessage();
}
else
{
kDebug(OkularDebug) << "result:" << result.value().toString( ctx );
qCDebug(OkularCoreDebug) << "result:" << result.value().toString( ctx );
}
}

View File

@ -97,7 +97,7 @@ static void clearConsole()
static void outputToConsole( const QString &cMessage )
{
kDebug(OkularDebug) << "CONSOLE:" << cMessage;
qCDebug(OkularCoreDebug) << "CONSOLE:" << cMessage;
}
#endif /* OKULAR_JS_CONSOLE */

View File

@ -62,7 +62,7 @@ static void fieldSetReadOnly( KJSContext *context, void *object, KJSObject value
Q_UNUSED( context );
Q_UNUSED( object );
Q_UNUSED( value );
kDebug(OkularDebug) << "Not implemented: setting readonly property";
qCDebug(OkularCoreDebug) << "Not implemented: setting readonly property";
#endif
}
@ -123,7 +123,7 @@ static KJSObject fieldGetValue( KJSContext *context, void *object )
value = g_fieldCache->value( field );
else
value = KJSString("");
kDebug(OkularDebug) << "Getting the value of a readonly field" << field->name() << ":" << value.toString( context );
qCDebug(OkularCoreDebug) << "Getting the value of a readonly field" << field->name() << ":" << value.toString( context );
return value;
}
@ -163,7 +163,7 @@ static void fieldSetValue( KJSContext *context, void *object, KJSObject value )
if ( field->isReadOnly() )
{
// ### throw exception?
kDebug(OkularDebug) << "Trying to change the readonly field" << field->name() << "to" << value.toString( context );
qCDebug(OkularCoreDebug) << "Trying to change the readonly field" << field->name() << "to" << value.toString( context );
g_fieldCache->insert( field, value );
return;
}

View File

@ -45,7 +45,7 @@ Scripter::~Scripter()
QString Scripter::execute( ScriptType type, const QString &script )
{
kDebug(OkularDebug) << "executing the script:";
qCDebug(OkularCoreDebug) << "executing the script:";
#if 0
if ( script.length() < 1000 )
qDebug() << script;

View File

@ -879,7 +879,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalForward( int searchID, const Q
int min=qMin(queryLeft,len-offset);
{
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << str.midRef(offset, min) << ":" << _query.midRef(j, min);
qCDebug(OkularCoreDebug) << str.midRef(offset, min) << ":" << _query.midRef(j, min);
#endif
// we have equal (or less than) area of the query left as the length of the current
// entity
@ -891,7 +891,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalForward( int searchID, const Q
// we need to get back to query start
// and continue the search from this place
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << "\tnot matched";
qCDebug(OkularCoreDebug) << "\tnot matched";
#endif
j = 0;
queryLeft=query.length();
@ -908,7 +908,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalForward( int searchID, const Q
// subtract the length of the current entity from
// the left length of the query
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << "\tmatched";
qCDebug(OkularCoreDebug) << "\tmatched";
#endif
j += min;
queryLeft -= min;
@ -995,7 +995,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
int min=qMin(queryLeft,offset);
{
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << str.midRef(offset-min, min) << " : " << _query.midRef(j-min, min);
qCDebug(OkularCoreDebug) << str.midRef(offset-min, min) << " : " << _query.midRef(j-min, min);
#endif
// we have equal (or less than) area of the query left as the length of the current
// entity
@ -1008,7 +1008,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
// we need to get back to query start
// and continue the search from this place
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << "\tnot matched";
qCDebug(OkularCoreDebug) << "\tnot matched";
#endif
j = query.length();
@ -1026,7 +1026,7 @@ RegularAreaRect* TextPagePrivate::findTextInternalBackward( int searchID, const
// subtract the length of the current entity from
// the left length of the query
#ifdef DEBUG_TEXTPAGE
kDebug(OkularDebug) << "\tmatched";
qCDebug(OkularCoreDebug) << "\tmatched";
#endif
j -= min;
queryLeft -= min;

View File

@ -78,7 +78,7 @@ double Utils::realDpiX()
{
const QDesktopWidget* w = QApplication::desktop();
if (w->width() > 0 && w->widthMM() > 0) {
kDebug() << "Pix:" << w->width() << "MM:" << w->widthMM();
qCDebug(OkularCoreDebug) << "Pix:" << w->width() << "MM:" << w->widthMM();
return (double(w->width()) * 25.4) / double(w->widthMM());
} else {
return dpiX();
@ -89,7 +89,7 @@ double Utils::realDpiY()
{
const QDesktopWidget* w = QApplication::desktop();
if (w->height() > 0 && w->heightMM() > 0) {
kDebug() << "Pix:" << w->height() << "MM:" << w->heightMM();
qCDebug(OkularCoreDebug) << "Pix:" << w->height() << "MM:" << w->heightMM();
return (double(w->height()) * 25.4) / double(w->heightMM());
} else {
return dpiY();
@ -129,13 +129,13 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen)
if (selectedOutput)
{
kDebug() << "Found widget at output #" << selectedOutput->id();
qCDebug(OkularCoreDebug) << "Found widget at output #" << selectedOutput->id();
QRect outputRect(selectedOutput->pos(),selectedOutput->currentMode()->size());
QSize szMM = selectedOutput->sizeMm();
kDebug() << "Output size is (mm) " << szMM;
kDebug() << "Output rect is " << outputRect;
qCDebug(OkularCoreDebug) << "Output size is (mm) " << szMM;
qCDebug(OkularCoreDebug) << "Output rect is " << outputRect;
if (selectedOutput->edid()) {
kDebug() << "EDID WxH (cm): " << selectedOutput->edid()->width() << 'x' << selectedOutput->edid()->height();
qCDebug(OkularCoreDebug) << "EDID WxH (cm): " << selectedOutput->edid()->width() << 'x' << selectedOutput->edid()->height();
}
if (szMM.width() > 0 && szMM.height() > 0 && outputRect.width() > 0 && outputRect.height() > 0
&& selectedOutput->edid()
@ -147,24 +147,24 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen)
static_cast<qreal>(outputRect.height())*25.4/szMM.height());
if (!selectedOutput->isHorizontal())
{
kDebug() << "Output is vertical, transposing DPI rect";
qCDebug(OkularCoreDebug) << "Output is vertical, transposing DPI rect";
res.transpose();
}
if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) {
return res;
} else {
kDebug() << "KScreen calculation returned a non square dpi." << res << ". Falling back";
qCDebug(OkularCoreDebug) << "KScreen calculation returned a non square dpi." << res << ". Falling back";
}
}
}
else
{
kDebug() << "Didn't find a KScreen selectedOutput to calculate DPI. Falling back";
qCDebug(OkularCoreDebug) << "Didn't find a KScreen selectedOutput to calculate DPI. Falling back";
}
}
else
{
kDebug() << "Didn't find a KScreen config to calculate DPI. Falling back";
qCDebug(OkularCoreDebug) << "Didn't find a KScreen config to calculate DPI. Falling back";
}
#endif
}
@ -174,14 +174,14 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen)
if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) {
return res;
} else {
kDebug() << "QDesktopWidget calculation returned a non square dpi." << res << ". Falling back";
qCDebug(OkularCoreDebug) << "QDesktopWidget calculation returned a non square dpi." << res << ". Falling back";
}
res = QSizeF(dpiX(), dpiY());
if (qAbs(res.width() - res.height()) / qMin(res.height(), res.width()) < 0.05) {
return res;
} else {
kDebug() << "QX11Info returned a non square dpi." << res << ". Falling back";
qCDebug(OkularCoreDebug) << "QX11Info returned a non square dpi." << res << ". Falling back";
}
res = QSizeF(72, 72);
@ -358,7 +358,7 @@ got_bottom:
image->width(), image->height() );
#ifdef BBOX_DEBUG
kDebug() << "Computed bounding box" << bbox << "in" << time.elapsed() << "ms";
qCDebug(OkularCoreDebug) << "Computed bounding box" << bbox << "in" << time.elapsed() << "ms";
#endif
return bbox;

View File

@ -95,9 +95,9 @@ AnnotsPropertiesDialog::AnnotsPropertiesDialog( QWidget *parent, Okular::Documen
//END
#if 0
kDebug() << "Annotation details:";
kDebug().nospace() << " => unique name: '" << ann->uniqueName() << "'";
kDebug() << " => flags:" << QString::number( m_annot->flags(), 2 );
qCDebug(OkularUiDebug) << "Annotation details:";
qCDebug(OkularUiDebug).nospace() << " => unique name: '" << ann->uniqueName() << "'";
qCDebug(OkularUiDebug) << " => flags:" << QString::number( m_annot->flags(), 2 );
#endif
resize( sizeHint() );

View File

@ -321,8 +321,8 @@ QList<QTreeWidgetItem*> createItems( const KUrl& baseurl, const KBookmark::List&
QList<QTreeWidgetItem*> ret;
foreach ( const KBookmark& bm, bmlist )
{
// kDebug().nospace() << "checking '" << tmp << "'";
// kDebug().nospace() << " vs '" << baseurl << "'";
// qCDebug(OkularUiDebug).nospace() << "checking '" << tmp << "'";
// qCDebug(OkularUiDebug).nospace() << " vs '" << baseurl << "'";
// TODO check that bm and baseurl are the same (#ref excluded)
QTreeWidgetItem * item = new BookmarkItem( bm );
ret.append( item );

12
ui/debug_ui.cpp Normal file
View File

@ -0,0 +1,12 @@
/***************************************************************************
* Copyright (C) 2014 by Frederik Gladhorn <gladhorn@kde.org> *
* *
* 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) any later version. *
***************************************************************************/
#include "debug_ui.h"
Q_LOGGING_CATEGORY(OkularUiDebug, "org.kde.okular.ui")

18
ui/debug_ui.h Normal file
View File

@ -0,0 +1,18 @@
/***************************************************************************
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
* Copyright (C) 2014 by Frederik Gladhorn <gladhorn@kde.org> *
* *
* 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) any later version. *
***************************************************************************/
#ifndef OKULAR_DEBUG_UI_P_H
#define OKULAR_DEBUG_UI_P_H
#include <QtCore/qloggingcategory.h>
Q_DECLARE_LOGGING_CATEGORY(OkularUiDebug)
#endif

View File

@ -23,6 +23,7 @@
// local includes
#include "core/form.h"
#include "core/document.h"
#include "debug_ui.h"
FormWidgetsController::FormWidgetsController( Okular::Document *doc )
: QObject( doc ), m_doc( doc )
@ -93,7 +94,7 @@ QButtonGroup* FormWidgetsController::registerRadioButton( QAbstractButton *butto
const QList< int >::const_iterator idsIt = qFind( (*it).ids, id );
if ( idsIt != (*it).ids.constEnd() )
{
kDebug(4700) << "Adding id" << id << "To group including" << (*it).ids;
qDebug(OkularUiDebug) << "Adding id" << id << "To group including" << (*it).ids;
(*it).group->addButton( button );
(*it).group->setId( button, id );
return (*it).group;

View File

@ -143,7 +143,7 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
QString latexExecutable = KStandardDirs::findExe("latex");
if (latexExecutable.isEmpty())
{
kDebug() << "Could not find latex!";
qCDebug(OkularUiDebug) << "Could not find latex!";
delete tempFile;
fileName = QString();
return LatexNotFound;
@ -167,7 +167,7 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
QString dvipngExecutable = KStandardDirs::findExe("dvipng");
if (dvipngExecutable.isEmpty())
{
kDebug() << "Could not find dvipng!";
qCDebug(OkularUiDebug) << "Could not find dvipng!";
fileName = QString();
return DvipngNotFound;
}

View File

@ -911,7 +911,7 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup
PageViewItem * item = new PageViewItem( *setIt );
d->items.push_back( item );
#ifdef PAGEVIEW_DEBUG
kDebug().nospace() << "cropped geom for " << d->items.last()->pageNumber() << " is " << d->items.last()->croppedGeometry();
qCDebug(OkularUiDebug).nospace() << "cropped geom for " << d->items.last()->pageNumber() << " is " << d->items.last()->croppedGeometry();
#endif
const QLinkedList< Okular::FormField * > pageFields = (*setIt)->formFields();
QLinkedList< Okular::FormField * >::const_iterator ffIt = pageFields.constBegin(), ffEnd = pageFields.constEnd();
@ -1148,7 +1148,7 @@ void PageView::slotRealNotifyViewportChanged( bool smoothMove )
return;
}
#ifdef PAGEVIEW_DEBUG
kDebug() << "document viewport changed";
qCDebug(OkularUiDebug) << "document viewport changed";
#endif
// relayout in "Single Pages" mode or if a relayout is pending
d->blockPixmapsRequest = true;
@ -1253,7 +1253,7 @@ void PageView::notifyPageChanged( int pageNumber, int changedFlags )
if ( changedFlags & DocumentObserver::BoundingBox )
{
#ifdef PAGEVIEW_DEBUG
kDebug() << "BoundingBox change on page" << pageNumber;
qCDebug(OkularUiDebug) << "BoundingBox change on page" << pageNumber;
#endif
slotRelayoutPages();
slotRequestVisiblePixmaps(); // TODO: slotRelayoutPages() may have done this already!
@ -1427,7 +1427,7 @@ void PageView::paintEvent(QPaintEvent *pe)
return;
#ifdef PAGEVIEW_DEBUG
kDebug() << "paintevent" << contentsRect;
qCDebug(OkularUiDebug) << "paintevent" << contentsRect;
#endif
// create the screen painter. a pixel painted at contentsX,contentsY
@ -1474,7 +1474,7 @@ void PageView::paintEvent(QPaintEvent *pe)
continue;
}
#ifdef PAGEVIEW_DEBUG
kDebug() << contentsRect;
qCDebug(OkularUiDebug) << contentsRect;
#endif
// note: this check will take care of all things requiring alpha blending (not only selection)
@ -3166,7 +3166,7 @@ QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start
affectedItemsSet.insert( item->pageNumber() );
}
#ifdef PAGEVIEW_DEBUG
kDebug() << ">>>> item selected by mouse:" << affectedItemsSet.count();
qCDebug(OkularUiDebug) << ">>>> item selected by mouse:" << affectedItemsSet.count();
#endif
if ( !affectedItemsSet.isEmpty() )
@ -3191,7 +3191,7 @@ QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start
for ( int i = min; i <= max; ++i )
affectedItemsIds.append( i );
#ifdef PAGEVIEW_DEBUG
kDebug() << ">>>> pages:" << affectedItemsIds;
qCDebug(OkularUiDebug) << ">>>> pages:" << affectedItemsIds;
#endif
firstpage = affectedItemsIds.first();
@ -3370,7 +3370,7 @@ void PageView::updateItemSize( PageViewItem * item, int colWidth, int rowHeight
width *= ( crop.right - crop.left );
height *= ( crop.bottom - crop.top );
#ifdef PAGEVIEW_DEBUG
kDebug() << "Cropped page" << okularPage->number() << "to" << crop
qCDebug(OkularUiDebug) << "Cropped page" << okularPage->number() << "to" << crop
<< "width" << width << "height" << height << "by bbox" << okularPage->boundingBox();
#endif
}
@ -3426,7 +3426,7 @@ void PageView::updateItemSize( PageViewItem * item, int colWidth, int rowHeight
}
#ifndef NDEBUG
else
kDebug() << "calling updateItemSize with unrecognized d->zoomMode!";
qCDebug(OkularUiDebug) << "calling updateItemSize with unrecognized d->zoomMode!";
#endif
}
@ -3572,7 +3572,7 @@ Okular::RegularAreaRect * PageView::textSelectionForItem( PageViewItem * item, c
Okular::RegularAreaRect * selectionArea = okularPage->textArea( &mouseTextSelectionInfo );
#ifdef PAGEVIEW_DEBUG
kDebug().nospace() << "text areas (" << okularPage->number() << "): " << ( selectionArea ? QString::number( selectionArea->count() ) : "(none)" );
qCDebug(OkularUiDebug).nospace() << "text areas (" << okularPage->number() << "): " << ( selectionArea ? QString::number( selectionArea->count() ) : "(none)" );
#endif
return selectionArea;
}

View File

@ -185,7 +185,7 @@ class PickPointEngine : public AnnotatorEngine
rect.top = qMin(startpoint.y,point.y);
rect.right = qMax(startpoint.x,point.x);
rect.bottom = qMax(startpoint.y,point.y);
kDebug().nospace() << "xyScale=" << xscale << "," << yscale;
qCDebug(OkularUiDebug).nospace() << "xyScale=" << xscale << "," << yscale;
static int padding = 2;
const QFontMetricsF mf(ta->textFont());
const QRectF rcf = mf.boundingRect( Okular::NormalizedRect( rect.left, rect.top, 1.0, 1.0 ).geometry( (int)pagewidth, (int)pageheight ).adjusted( padding, padding, -padding, -padding ),

View File

@ -818,7 +818,7 @@ void PresentationWidget::paintEvent( QPaintEvent * pe )
void PresentationWidget::resizeEvent( QResizeEvent *re )
{
// kDebug() << re->oldSize() << "=>" << re->size();
// qCDebug(OkularUiDebug) << re->oldSize() << "=>" << re->size();
if ( re->oldSize() == QSize( -1, -1 ) )
return;
@ -1246,7 +1246,7 @@ void PresentationWidget::recalcGeometry()
Okular::Settings::setSlidesScreen( -2 );
}
const QRect screenGeom = desktop->screenGeometry( screen );
// kDebug() << screen << "=>" << screenGeom;
// qCDebug(OkularUiDebug) << screen << "=>" << screenGeom;
m_screen = screen;
setGeometry( screenGeom );
}
@ -1502,7 +1502,7 @@ void PresentationWidget::setScreen( int newScreen )
{
const QRect screenGeom = QApplication::desktop()->screenGeometry( newScreen );
const QSize oldSize = size();
// kDebug() << newScreen << "=>" << screenGeom;
// qCDebug(OkularUiDebug) << newScreen << "=>" << screenGeom;
m_screen = newScreen;
setGeometry( screenGeom );