mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
gwenview: log debug messages to special area
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a4017a3a68
commit
39b4708812
13 changed files with 59 additions and 179 deletions
|
@ -10,6 +10,8 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5003)
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
|
@ -52,15 +52,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct ImageOpsContextManagerItem::Private
|
struct ImageOpsContextManagerItem::Private
|
||||||
{
|
{
|
||||||
ImageOpsContextManagerItem* q;
|
ImageOpsContextManagerItem* q;
|
||||||
|
|
|
@ -51,15 +51,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This widget is capable of showing multiple lines of key/value pairs.
|
* This widget is capable of showing multiple lines of key/value pairs.
|
||||||
*/
|
*/
|
||||||
|
@ -284,12 +275,12 @@ InfoContextManagerItem::~InfoContextManagerItem()
|
||||||
|
|
||||||
void InfoContextManagerItem::updateSideBarContent()
|
void InfoContextManagerItem::updateSideBarContent()
|
||||||
{
|
{
|
||||||
LOG("updateSideBarContent");
|
kDebug() << "updateSideBarContent";
|
||||||
if (!d->mGroup->isVisible()) {
|
if (!d->mGroup->isVisible()) {
|
||||||
LOG("updateSideBarContent: not visible, not updating");
|
kDebug() << "updateSideBarContent: not visible, not updating";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG("updateSideBarContent: really updating");
|
kDebug() << "updateSideBarContent: really updating";
|
||||||
|
|
||||||
KFileItemList itemList = contextManager()->selectedFileItemList();
|
KFileItemList itemList = contextManager()->selectedFileItemList();
|
||||||
if (itemList.count() == 0) {
|
if (itemList.count() == 0) {
|
||||||
|
|
|
@ -98,15 +98,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const int BROWSE_PRELOAD_DELAY = 1000;
|
static const int BROWSE_PRELOAD_DELAY = 1000;
|
||||||
static const int VIEW_PRELOAD_DELAY = 100;
|
static const int VIEW_PRELOAD_DELAY = 100;
|
||||||
|
|
||||||
|
|
|
@ -32,15 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct PreloaderPrivate
|
struct PreloaderPrivate
|
||||||
{
|
{
|
||||||
Preloader* q;
|
Preloader* q;
|
||||||
|
@ -70,7 +61,7 @@ Preloader::~Preloader()
|
||||||
|
|
||||||
void Preloader::preload(const KUrl& url, const QSize& size)
|
void Preloader::preload(const KUrl& url, const QSize& size)
|
||||||
{
|
{
|
||||||
LOG("url=" << url);
|
kDebug() << "url=" << url;
|
||||||
if (d->mDocument) {
|
if (d->mDocument) {
|
||||||
disconnect(d->mDocument.data(), 0, this, 0);
|
disconnect(d->mDocument.data(), 0, this, 0);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +72,7 @@ void Preloader::preload(const KUrl& url, const QSize& size)
|
||||||
SLOT(doPreload()));
|
SLOT(doPreload()));
|
||||||
|
|
||||||
if (d->mDocument->size().isValid()) {
|
if (d->mDocument->size().isValid()) {
|
||||||
LOG("size is already available");
|
kDebug() << "size is already available";
|
||||||
doPreload();
|
doPreload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,13 +84,13 @@ void Preloader::doPreload()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->mDocument->loadingState() == Document::LoadingFailed) {
|
if (d->mDocument->loadingState() == Document::LoadingFailed) {
|
||||||
LOG("loading failed");
|
kDebug() << "loading failed";
|
||||||
d->forgetDocument();
|
d->forgetDocument();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->mDocument->size().isValid()) {
|
if (!d->mDocument->size().isValid()) {
|
||||||
LOG("size not available yet");
|
kDebug() << "size not available yet";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,10 +100,10 @@ void Preloader::doPreload()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (zoom < Document::maxDownSampledZoom()) {
|
if (zoom < Document::maxDownSampledZoom()) {
|
||||||
LOG("preloading down sampled, zoom=" << zoom);
|
kDebug() << "preloading down sampled, zoom=" << zoom;
|
||||||
d->mDocument->prepareDownSampledImageForZoom(zoom);
|
d->mDocument->prepareDownSampledImageForZoom(zoom);
|
||||||
} else {
|
} else {
|
||||||
LOG("preloading full image");
|
kDebug() << "preloading full image";
|
||||||
d->mDocument->startLoadingFullImage();
|
d->mDocument->startLoadingFullImage();
|
||||||
}
|
}
|
||||||
d->forgetDocument();
|
d->forgetDocument();
|
||||||
|
|
|
@ -61,15 +61,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const int ViewMainPage::MaxViewCount = 6;
|
const int ViewMainPage::MaxViewCount = 6;
|
||||||
|
|
||||||
static QString rgba(const QColor &color)
|
static QString rgba(const QColor &color)
|
||||||
|
@ -584,7 +575,7 @@ KUrl ViewMainPage::url() const
|
||||||
Document::Ptr ViewMainPage::currentDocument() const
|
Document::Ptr ViewMainPage::currentDocument() const
|
||||||
{
|
{
|
||||||
if (!d->currentView()) {
|
if (!d->currentView()) {
|
||||||
LOG("!d->documentView()");
|
kDebug() << "!d->documentView()";
|
||||||
return Document::Ptr();
|
return Document::Ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,17 +45,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
|
|
||||||
static void logQueue(DocumentPrivate* d)
|
static void logQueue(DocumentPrivate* d)
|
||||||
{
|
{
|
||||||
#define PREFIX " QUEUE: "
|
#define PREFIX " QUEUE: "
|
||||||
|
@ -78,15 +67,9 @@ static void logQueue(DocumentPrivate* d)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LOG_QUEUE(msg, d) \
|
#define LOG_QUEUE(msg, d) \
|
||||||
LOG(msg); \
|
kDebug() << msg; \
|
||||||
logQueue(d)
|
logQueue(d)
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define LOG_QUEUE(msg, d)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//- DocumentPrivate ---------------------------------------
|
//- DocumentPrivate ---------------------------------------
|
||||||
void DocumentPrivate::scheduleImageLoading(int invertedZoom)
|
void DocumentPrivate::scheduleImageLoading(int invertedZoom)
|
||||||
{
|
{
|
||||||
|
@ -97,10 +80,10 @@ void DocumentPrivate::scheduleImageLoading(int invertedZoom)
|
||||||
|
|
||||||
void DocumentPrivate::scheduleImageDownSampling(int invertedZoom)
|
void DocumentPrivate::scheduleImageDownSampling(int invertedZoom)
|
||||||
{
|
{
|
||||||
LOG("invertedZoom=" << invertedZoom);
|
kDebug() << "invertedZoom=" << invertedZoom;
|
||||||
DownSamplingJob* job = qobject_cast<DownSamplingJob*>(mCurrentJob.data());
|
DownSamplingJob* job = qobject_cast<DownSamplingJob*>(mCurrentJob.data());
|
||||||
if (job && job->mInvertedZoom == invertedZoom) {
|
if (job && job->mInvertedZoom == invertedZoom) {
|
||||||
LOG("Current job is already doing it");
|
kDebug() << "Current job is already doing it";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +96,10 @@ void DocumentPrivate::scheduleImageDownSampling(int invertedZoom)
|
||||||
}
|
}
|
||||||
if (job->mInvertedZoom == invertedZoom) {
|
if (job->mInvertedZoom == invertedZoom) {
|
||||||
// Already scheduled, nothing to do
|
// Already scheduled, nothing to do
|
||||||
LOG("Already scheduled");
|
kDebug() << "Already scheduled";
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
LOG("Removing downsampling job");
|
kDebug() << "Removing downsampling job";
|
||||||
mJobQueue.erase(it);
|
mJobQueue.erase(it);
|
||||||
delete job;
|
delete job;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +218,7 @@ Document::LoadingState Document::loadingState() const
|
||||||
void Document::switchToImpl(AbstractDocumentImpl* impl)
|
void Document::switchToImpl(AbstractDocumentImpl* impl)
|
||||||
{
|
{
|
||||||
Q_ASSERT(impl);
|
Q_ASSERT(impl);
|
||||||
LOG("old impl:" << d->mImpl << "new impl:" << impl);
|
kDebug() << "old impl:" << d->mImpl << "new impl:" << impl;
|
||||||
if (d->mImpl) {
|
if (d->mImpl) {
|
||||||
d->mImpl->deleteLater();
|
d->mImpl->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -437,11 +420,11 @@ bool Document::prepareDownSampledImageForZoom(qreal zoom)
|
||||||
|
|
||||||
int invertedZoom = invertedZoomForZoom(zoom);
|
int invertedZoom = invertedZoomForZoom(zoom);
|
||||||
if (d->mDownSampledImageMap.contains(invertedZoom)) {
|
if (d->mDownSampledImageMap.contains(invertedZoom)) {
|
||||||
LOG("downSampledImageForZoom=" << zoom << "invertedZoom=" << invertedZoom << "ready");
|
kDebug() << "downSampledImageForZoom=" << zoom << "invertedZoom=" << invertedZoom << "ready";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("downSampledImageForZoom=" << zoom << "invertedZoom=" << invertedZoom << "not ready");
|
kDebug() << "downSampledImageForZoom=" << zoom << "invertedZoom=" << invertedZoom << "not ready";
|
||||||
if (loadingState() == LoadingFailed) {
|
if (loadingState() == LoadingFailed) {
|
||||||
kWarning() << "Image has failed to load, not doing anything";
|
kWarning() << "Image has failed to load, not doing anything";
|
||||||
return false;
|
return false;
|
||||||
|
@ -510,7 +493,7 @@ void Document::stopAnimation()
|
||||||
|
|
||||||
void Document::enqueueJob(DocumentJob* job)
|
void Document::enqueueJob(DocumentJob* job)
|
||||||
{
|
{
|
||||||
LOG("job=" << job);
|
kDebug() << "job=" << job;
|
||||||
job->setDocument(Ptr(this));
|
job->setDocument(Ptr(this));
|
||||||
connect(job, SIGNAL(finished(KJob*)),
|
connect(job, SIGNAL(finished(KJob*)),
|
||||||
SLOT(slotJobFinished(KJob*)));
|
SLOT(slotJobFinished(KJob*)));
|
||||||
|
@ -518,7 +501,7 @@ void Document::enqueueJob(DocumentJob* job)
|
||||||
d->mJobQueue.enqueue(job);
|
d->mJobQueue.enqueue(job);
|
||||||
} else {
|
} else {
|
||||||
d->mCurrentJob = job;
|
d->mCurrentJob = job;
|
||||||
LOG("Starting first job");
|
kDebug() << "Starting first job";
|
||||||
job->start();
|
job->start();
|
||||||
busyChanged(d->mUrl, true);
|
busyChanged(d->mUrl, true);
|
||||||
}
|
}
|
||||||
|
@ -527,16 +510,16 @@ void Document::enqueueJob(DocumentJob* job)
|
||||||
|
|
||||||
void Document::slotJobFinished(KJob* job)
|
void Document::slotJobFinished(KJob* job)
|
||||||
{
|
{
|
||||||
LOG("job=" << job);
|
kDebug() << "job=" << job;
|
||||||
GV_RETURN_IF_FAIL(job == d->mCurrentJob.data());
|
GV_RETURN_IF_FAIL(job == d->mCurrentJob.data());
|
||||||
|
|
||||||
if (d->mJobQueue.isEmpty()) {
|
if (d->mJobQueue.isEmpty()) {
|
||||||
LOG("All done");
|
kDebug() << "All done";
|
||||||
d->mCurrentJob.clear();
|
d->mCurrentJob.clear();
|
||||||
busyChanged(d->mUrl, false);
|
busyChanged(d->mUrl, false);
|
||||||
allTasksDone();
|
allTasksDone();
|
||||||
} else {
|
} else {
|
||||||
LOG("Starting next job");
|
kDebug() << "Starting next job";
|
||||||
d->mCurrentJob = d->mJobQueue.dequeue();
|
d->mCurrentJob = d->mJobQueue.dequeue();
|
||||||
GV_RETURN_IF_FAIL(d->mCurrentJob);
|
GV_RETURN_IF_FAIL(d->mCurrentJob);
|
||||||
d->mCurrentJob.data()->start();
|
d->mCurrentJob.data()->start();
|
||||||
|
|
|
@ -35,15 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline int getMaxUnreferencedImages()
|
inline int getMaxUnreferencedImages()
|
||||||
{
|
{
|
||||||
int defaultValue = 3;
|
int defaultValue = 3;
|
||||||
|
@ -109,16 +100,14 @@ struct DocumentFactoryPrivate
|
||||||
unreferencedIt = unreferencedImages.erase(unreferencedIt))
|
unreferencedIt = unreferencedImages.erase(unreferencedIt))
|
||||||
{
|
{
|
||||||
KUrl url = unreferencedIt.value();
|
KUrl url = unreferencedIt.value();
|
||||||
LOG("Collecting" << url);
|
kDebug() << "Collecting" << url;
|
||||||
it = map.find(url);
|
it = map.find(url);
|
||||||
Q_ASSERT(it != map.end());
|
Q_ASSERT(it != map.end());
|
||||||
delete it.value();
|
delete it.value();
|
||||||
map.erase(it);
|
map.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
logDocumentMap(map);
|
logDocumentMap(map);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void logDocumentMap(const DocumentMap& map)
|
void logDocumentMap(const DocumentMap& map)
|
||||||
|
@ -168,7 +157,7 @@ Document::Ptr DocumentFactory::load(const KUrl& url)
|
||||||
DocumentMap::Iterator it = d->mDocumentMap.find(url);
|
DocumentMap::Iterator it = d->mDocumentMap.find(url);
|
||||||
|
|
||||||
if (it != d->mDocumentMap.end()) {
|
if (it != d->mDocumentMap.end()) {
|
||||||
LOG(url.fileName() << "url in mDocumentMap");
|
kDebug() << url.fileName() << "url in mDocumentMap";
|
||||||
info = it.value();
|
info = it.value();
|
||||||
info->mLastAccess = QDateTime::currentDateTime();
|
info->mLastAccess = QDateTime::currentDateTime();
|
||||||
return info->mDocument;
|
return info->mDocument;
|
||||||
|
@ -177,7 +166,7 @@ Document::Ptr DocumentFactory::load(const KUrl& url)
|
||||||
// At this point we couldn't find the document in the map
|
// At this point we couldn't find the document in the map
|
||||||
|
|
||||||
// Start loading the document
|
// Start loading the document
|
||||||
LOG(url.fileName() << "loading");
|
kDebug() << url.fileName() << "loading";
|
||||||
Document* doc = new Document(url);
|
Document* doc = new Document(url);
|
||||||
connect(doc, SIGNAL(loaded(KUrl)),
|
connect(doc, SIGNAL(loaded(KUrl)),
|
||||||
SLOT(slotLoaded(KUrl)));
|
SLOT(slotLoaded(KUrl)));
|
||||||
|
|
|
@ -56,15 +56,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const int HEADER_SIZE = 256;
|
const int HEADER_SIZE = 256;
|
||||||
|
|
||||||
struct LoadingDocumentImplPrivate
|
struct LoadingDocumentImplPrivate
|
||||||
|
@ -102,8 +93,7 @@ struct LoadingDocumentImplPrivate
|
||||||
mimeType = KMimeType::findByContent(mData)->name();
|
mimeType = KMimeType::findByContent(mData)->name();
|
||||||
}
|
}
|
||||||
MimeTypeUtils::Kind kind = MimeTypeUtils::mimeTypeKind(mimeType);
|
MimeTypeUtils::Kind kind = MimeTypeUtils::mimeTypeKind(mimeType);
|
||||||
LOG("mimeType:" << mimeType);
|
kDebug() << "mimeType:" << mimeType << ", kind:" << kind;
|
||||||
LOG("kind:" << kind);
|
|
||||||
q->setDocumentKind(kind);
|
q->setDocumentKind(kind);
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
@ -151,7 +141,7 @@ struct LoadingDocumentImplPrivate
|
||||||
|
|
||||||
void startImageDataLoading()
|
void startImageDataLoading()
|
||||||
{
|
{
|
||||||
LOG("");
|
kDebug() << "Starting image loading";
|
||||||
Q_ASSERT(mMetaInfoLoaded);
|
Q_ASSERT(mMetaInfoLoaded);
|
||||||
Q_ASSERT(mImageDataInvertedZoom != 0);
|
Q_ASSERT(mImageDataInvertedZoom != 0);
|
||||||
Q_ASSERT(!mImageDataFutureWatcher->isRunning());
|
Q_ASSERT(!mImageDataFutureWatcher->isRunning());
|
||||||
|
@ -165,7 +155,7 @@ struct LoadingDocumentImplPrivate
|
||||||
|
|
||||||
bool loadMetaInfo()
|
bool loadMetaInfo()
|
||||||
{
|
{
|
||||||
LOG("mFormatHint" << mFormatHint);
|
kDebug() << "mFormatHint" << mFormatHint;
|
||||||
QBuffer buffer;
|
QBuffer buffer;
|
||||||
buffer.setBuffer(&mData);
|
buffer.setBuffer(&mData);
|
||||||
buffer.open(QIODevice::ReadOnly);
|
buffer.open(QIODevice::ReadOnly);
|
||||||
|
@ -191,10 +181,10 @@ struct LoadingDocumentImplPrivate
|
||||||
|
|
||||||
mFormat = reader.format();
|
mFormat = reader.format();
|
||||||
|
|
||||||
LOG("mFormat" << mFormat);
|
kDebug() << "mFormat" << mFormat;
|
||||||
GV_RETURN_VALUE_IF_FAIL(!mFormat.isEmpty(), false);
|
GV_RETURN_VALUE_IF_FAIL(!mFormat.isEmpty(), false);
|
||||||
|
|
||||||
LOG("mImageSize" << mImageSize);
|
kDebug() << "mImageSize" << mImageSize;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +196,7 @@ struct LoadingDocumentImplPrivate
|
||||||
buffer.open(QIODevice::ReadOnly);
|
buffer.open(QIODevice::ReadOnly);
|
||||||
QImageReader reader(&buffer, mFormat);
|
QImageReader reader(&buffer, mFormat);
|
||||||
|
|
||||||
LOG("mImageDataInvertedZoom=" << mImageDataInvertedZoom);
|
kDebug() << "mImageDataInvertedZoom=" << mImageDataInvertedZoom;
|
||||||
if (mImageSize.isValid()
|
if (mImageSize.isValid()
|
||||||
&& mImageDataInvertedZoom != 1
|
&& mImageDataInvertedZoom != 1
|
||||||
&& reader.supportsOption(QImageIOHandler::ScaledSize)
|
&& reader.supportsOption(QImageIOHandler::ScaledSize)
|
||||||
|
@ -215,16 +205,16 @@ struct LoadingDocumentImplPrivate
|
||||||
// image size
|
// image size
|
||||||
QSize size = reader.size() / mImageDataInvertedZoom;
|
QSize size = reader.size() / mImageDataInvertedZoom;
|
||||||
if (!size.isEmpty()) {
|
if (!size.isEmpty()) {
|
||||||
LOG("Setting scaled size to" << size);
|
kDebug() << "Setting scaled size to" << size;
|
||||||
reader.setScaledSize(size);
|
reader.setScaledSize(size);
|
||||||
} else {
|
} else {
|
||||||
LOG("Not setting scaled size as it is empty" << size);
|
kDebug() << "Not setting scaled size as it is empty" << size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = reader.read(&mImage);
|
bool ok = reader.read(&mImage);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
LOG("QImageReader::read() failed");
|
kDebug() << "QImageReader::read() failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +222,7 @@ struct LoadingDocumentImplPrivate
|
||||||
&& reader.nextImageDelay() > 0 // Assume delay == 0 <=> only one frame
|
&& reader.nextImageDelay() > 0 // Assume delay == 0 <=> only one frame
|
||||||
) {
|
) {
|
||||||
if (reader.imageCount() > 0) {
|
if (reader.imageCount() > 0) {
|
||||||
LOG("Really an animated image");
|
kDebug() << "Really an animated image";
|
||||||
mAnimated = true;
|
mAnimated = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -247,10 +237,10 @@ struct LoadingDocumentImplPrivate
|
||||||
* Decoding the next frame is the only reliable way I found to
|
* Decoding the next frame is the only reliable way I found to
|
||||||
* detect an animated images
|
* detect an animated images
|
||||||
*/
|
*/
|
||||||
LOG("May be an animated image. delay:" << reader.nextImageDelay());
|
kDebug() << "May be an animated image. delay:" << reader.nextImageDelay();
|
||||||
QImage nextImage;
|
QImage nextImage;
|
||||||
if (reader.read(&nextImage)) {
|
if (reader.read(&nextImage)) {
|
||||||
LOG("Really an animated image (more than one frame)");
|
kDebug() << "Really an animated image (more than one frame)";
|
||||||
mAnimated = true;
|
mAnimated = true;
|
||||||
} else {
|
} else {
|
||||||
kWarning() << q->document()->url() << "is not really an animated image (only one frame)";
|
kWarning() << q->document()->url() << "is not really an animated image (only one frame)";
|
||||||
|
@ -272,7 +262,6 @@ LoadingDocumentImpl::LoadingDocumentImpl(Document* document)
|
||||||
|
|
||||||
LoadingDocumentImpl::~LoadingDocumentImpl()
|
LoadingDocumentImpl::~LoadingDocumentImpl()
|
||||||
{
|
{
|
||||||
LOG("");
|
|
||||||
// Disconnect watchers to make sure they do not trigger further work
|
// Disconnect watchers to make sure they do not trigger further work
|
||||||
if (d->mMetaInfoFutureWatcher) {
|
if (d->mMetaInfoFutureWatcher) {
|
||||||
d->mMetaInfoFutureWatcher->disconnect();
|
d->mMetaInfoFutureWatcher->disconnect();
|
||||||
|
@ -327,11 +316,11 @@ void LoadingDocumentImpl::init()
|
||||||
void LoadingDocumentImpl::loadImage(int invertedZoom)
|
void LoadingDocumentImpl::loadImage(int invertedZoom)
|
||||||
{
|
{
|
||||||
if (d->mImageDataInvertedZoom == invertedZoom) {
|
if (d->mImageDataInvertedZoom == invertedZoom) {
|
||||||
LOG("Already loading an image at invertedZoom=" << invertedZoom);
|
kDebug() << "Already loading an image at invertedZoom=" << invertedZoom;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (d->mImageDataInvertedZoom == 1) {
|
if (d->mImageDataInvertedZoom == 1) {
|
||||||
LOG("Ignoring request: we are loading a full image");
|
kDebug() << "Ignoring request: we are loading a full image";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (d->mImageDataFutureWatcher) {
|
if (d->mImageDataFutureWatcher) {
|
||||||
|
@ -388,7 +377,7 @@ Document::LoadingState LoadingDocumentImpl::loadingState() const
|
||||||
|
|
||||||
void LoadingDocumentImpl::slotMetaInfoLoaded()
|
void LoadingDocumentImpl::slotMetaInfoLoaded()
|
||||||
{
|
{
|
||||||
LOG("");
|
kDebug() << "Meta information loaded";
|
||||||
Q_ASSERT(!d->mMetaInfoFutureWatcher->isRunning());
|
Q_ASSERT(!d->mMetaInfoFutureWatcher->isRunning());
|
||||||
if (!d->mMetaInfoFutureWatcher->result()) {
|
if (!d->mMetaInfoFutureWatcher->result()) {
|
||||||
setDocumentErrorString(
|
setDocumentErrorString(
|
||||||
|
@ -417,7 +406,7 @@ void LoadingDocumentImpl::slotMetaInfoLoaded()
|
||||||
|
|
||||||
void LoadingDocumentImpl::slotImageLoaded()
|
void LoadingDocumentImpl::slotImageLoaded()
|
||||||
{
|
{
|
||||||
LOG("");
|
kDebug() << "Image loaded";
|
||||||
if (d->mImage.isNull()) {
|
if (d->mImage.isNull()) {
|
||||||
setDocumentErrorString(
|
setDocumentErrorString(
|
||||||
i18nc("@info", "Loading image failed.")
|
i18nc("@info", "Loading image failed.")
|
||||||
|
@ -444,14 +433,14 @@ void LoadingDocumentImpl::slotImageLoaded()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->mImageDataInvertedZoom != 1 && d->mImage.size() != d->mImageSize) {
|
if (d->mImageDataInvertedZoom != 1 && d->mImage.size() != d->mImageSize) {
|
||||||
LOG("Loaded a down sampled image");
|
kDebug() << "Loaded a down sampled image";
|
||||||
d->mDownSampledImageLoaded = true;
|
d->mDownSampledImageLoaded = true;
|
||||||
// We loaded a down sampled image
|
// We loaded a down sampled image
|
||||||
setDocumentDownSampledImage(d->mImage, d->mImageDataInvertedZoom);
|
setDocumentDownSampledImage(d->mImage, d->mImageDataInvertedZoom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("Loaded a full image");
|
kDebug() << "Loaded a full image";
|
||||||
setDocumentImage(d->mImage);
|
setDocumentImage(d->mImage);
|
||||||
DocumentLoadedImpl* impl;
|
DocumentLoadedImpl* impl;
|
||||||
impl = new DocumentLoadedImpl(
|
impl = new DocumentLoadedImpl(
|
||||||
|
|
|
@ -62,15 +62,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const qreal REAL_DELTA = 0.001;
|
static const qreal REAL_DELTA = 0.001;
|
||||||
static const qreal MAXIMUM_ZOOM_VALUE = qreal(DocumentView::MaximumZoom);
|
static const qreal MAXIMUM_ZOOM_VALUE = qreal(DocumentView::MaximumZoom);
|
||||||
|
|
||||||
|
@ -346,7 +337,7 @@ void DocumentView::createAdapterForDocument()
|
||||||
const MimeTypeUtils::Kind documentKind = d->mDocument->kind();
|
const MimeTypeUtils::Kind documentKind = d->mDocument->kind();
|
||||||
if (d->mAdapter && documentKind == d->mAdapter->kind() && documentKind != MimeTypeUtils::KIND_UNKNOWN) {
|
if (d->mAdapter && documentKind == d->mAdapter->kind() && documentKind != MimeTypeUtils::KIND_UNKNOWN) {
|
||||||
// Do not reuse for KIND_UNKNOWN: we may need to change the message
|
// Do not reuse for KIND_UNKNOWN: we may need to change the message
|
||||||
LOG("Reusing current adapter");
|
kDebug() << "Reusing current adapter";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AbstractDocumentViewAdapter* adapter = 0;
|
AbstractDocumentViewAdapter* adapter = 0;
|
||||||
|
|
|
@ -30,15 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include <lib/document/document.h>
|
#include <lib/document/document.h>
|
||||||
#include <lib/paintutils.h>
|
#include <lib/paintutils.h>
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -92,7 +83,7 @@ void ImageScaler::setTransformationMode(Qt::TransformationMode mode)
|
||||||
|
|
||||||
void ImageScaler::setDestinationRegion(const QRegion& region)
|
void ImageScaler::setDestinationRegion(const QRegion& region)
|
||||||
{
|
{
|
||||||
LOG(region);
|
kDebug() << region;
|
||||||
d->mRegion = region;
|
d->mRegion = region;
|
||||||
if (d->mRegion.isEmpty()) {
|
if (d->mRegion.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -107,21 +98,21 @@ void ImageScaler::doScale()
|
||||||
{
|
{
|
||||||
if (d->mZoom < Document::maxDownSampledZoom()) {
|
if (d->mZoom < Document::maxDownSampledZoom()) {
|
||||||
if (!d->mDocument->prepareDownSampledImageForZoom(d->mZoom)) {
|
if (!d->mDocument->prepareDownSampledImageForZoom(d->mZoom)) {
|
||||||
LOG("Asked for a down sampled image");
|
kDebug() << "Asked for a down sampled image";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (d->mDocument->image().isNull()) {
|
} else if (d->mDocument->image().isNull()) {
|
||||||
LOG("Asked for the full image");
|
kDebug() << "Asked for the full image";
|
||||||
d->mDocument->startLoadingFullImage();
|
d->mDocument->startLoadingFullImage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("Starting");
|
kDebug() << "Starting";
|
||||||
Q_FOREACH(const QRect & rect, d->mRegion.rects()) {
|
Q_FOREACH(const QRect & rect, d->mRegion.rects()) {
|
||||||
LOG(rect);
|
kDebug() << rect;
|
||||||
scaleRect(rect);
|
scaleRect(rect);
|
||||||
}
|
}
|
||||||
LOG("Done");
|
kDebug() << "Done";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageScaler::scaleRect(const QRect& rect)
|
void ImageScaler::scaleRect(const QRect& rect)
|
||||||
|
|
|
@ -37,15 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
Stopped,
|
Stopped,
|
||||||
Started,
|
Started,
|
||||||
|
@ -135,7 +126,7 @@ struct SlideShowPrivate
|
||||||
|
|
||||||
void doStart()
|
void doStart()
|
||||||
{
|
{
|
||||||
LOG("mState = Started");
|
kDebug() << "mState = Started";
|
||||||
mTimer->start();
|
mTimer->start();
|
||||||
mState = Started;
|
mState = Started;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +201,7 @@ void SlideShow::setInterval(int intervalInSeconds)
|
||||||
|
|
||||||
void SlideShow::stop()
|
void SlideShow::stop()
|
||||||
{
|
{
|
||||||
LOG("Stopping timer");
|
kDebug() << "Stopping timer";
|
||||||
d->mTimer->stop();
|
d->mTimer->stop();
|
||||||
d->mState = Stopped;
|
d->mState = Stopped;
|
||||||
stateChanged(false);
|
stateChanged(false);
|
||||||
|
@ -218,7 +209,6 @@ void SlideShow::stop()
|
||||||
|
|
||||||
void SlideShow::resumeAndGoToNextUrl()
|
void SlideShow::resumeAndGoToNextUrl()
|
||||||
{
|
{
|
||||||
LOG("");
|
|
||||||
if (d->mState == WaitForEndOfUrl) {
|
if (d->mState == WaitForEndOfUrl) {
|
||||||
goToNextUrl();
|
goToNextUrl();
|
||||||
}
|
}
|
||||||
|
@ -226,9 +216,8 @@ void SlideShow::resumeAndGoToNextUrl()
|
||||||
|
|
||||||
void SlideShow::goToNextUrl()
|
void SlideShow::goToNextUrl()
|
||||||
{
|
{
|
||||||
LOG("");
|
|
||||||
KUrl url = d->findNextUrl();
|
KUrl url = d->findNextUrl();
|
||||||
LOG("url:" << url);
|
kDebug() << "Next url:" << url;
|
||||||
if (!url.isValid()) {
|
if (!url.isValid()) {
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
|
@ -238,7 +227,7 @@ void SlideShow::goToNextUrl()
|
||||||
|
|
||||||
void SlideShow::setCurrentUrl(const KUrl& url)
|
void SlideShow::setCurrentUrl(const KUrl& url)
|
||||||
{
|
{
|
||||||
LOG(url);
|
kDebug() << "Current url" << url;
|
||||||
if (d->mCurrentUrl == url) {
|
if (d->mCurrentUrl == url) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
namespace Gwenview
|
namespace Gwenview
|
||||||
{
|
{
|
||||||
|
|
||||||
#undef ENABLE_LOG
|
|
||||||
#undef LOG
|
|
||||||
//#define ENABLE_LOG
|
|
||||||
#ifdef ENABLE_LOG
|
|
||||||
#define LOG(x) kDebug() << x
|
|
||||||
#else
|
|
||||||
#define LOG(x) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** How many msec to wait before starting to smooth thumbnails */
|
/** How many msec to wait before starting to smooth thumbnails */
|
||||||
static const int THUMBNAIL_DELAY = 500;
|
static const int THUMBNAIL_DELAY = 500;
|
||||||
|
|
||||||
|
@ -73,7 +64,7 @@ static const QSize maxThumbSize(ThumbnailView::MaxThumbnailSize, ThumbnailView::
|
||||||
static KFileItem fileItemForIndex(const QModelIndex& index)
|
static KFileItem fileItemForIndex(const QModelIndex& index)
|
||||||
{
|
{
|
||||||
if (!index.isValid()) {
|
if (!index.isValid()) {
|
||||||
LOG("Invalid index");
|
kDebug() << "Invalid index";
|
||||||
return KFileItem();
|
return KFileItem();
|
||||||
}
|
}
|
||||||
QVariant data = index.data(KDirModel::FileItemRole);
|
QVariant data = index.data(KDirModel::FileItemRole);
|
||||||
|
@ -562,7 +553,7 @@ QPixmap ThumbnailView::thumbnailForIndex(const QModelIndex& index, QSize* fullSi
|
||||||
{
|
{
|
||||||
KFileItem item = fileItemForIndex(index);
|
KFileItem item = fileItemForIndex(index);
|
||||||
if (item.isNull()) {
|
if (item.isNull()) {
|
||||||
LOG("Invalid item");
|
kDebug() << "Invalid item";
|
||||||
if (fullSize) {
|
if (fullSize) {
|
||||||
*fullSize = QSize();
|
*fullSize = QSize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue