Commit 9f03f67e authored by David Faure's avatar David Faure
Browse files

Fix compilation with color-collection debug output enabled.

kpColorCollection lives in a separate library so it can't use kpLogMisc
from the executable
parent 48b4004e
......@@ -55,6 +55,8 @@ struct ColorNode
//---------------------------------------------------------------------
Q_LOGGING_CATEGORY(kpLogColorCollection, "kp.colorCollection")
//BEGIN kpColorCollectionPrivate
class kpColorCollectionPrivate
{
......@@ -126,7 +128,7 @@ kpColorCollection::open(const QUrl &url, QWidget *parent)
if (url.isEmpty () || !KIO::NetAccess::download (url, tempPaletteFilePath, parent))
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\tcould not download";
qCDebug(kpLogColorCollection) << "\tcould not download";
#endif
::CouldNotOpenDialog (url, parent);
return false;
......@@ -139,7 +141,7 @@ kpColorCollection::open(const QUrl &url, QWidget *parent)
!paletteFile.open(QIODevice::ReadOnly))
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\tcould not open qfile";
qCDebug(kpLogColorCollection) << "\tcould not open qfile";
#endif
KIO::NetAccess::removeTempFile (tempPaletteFilePath);
::CouldNotOpenDialog (url, parent);
......@@ -211,13 +213,13 @@ bool
kpColorCollection::openKDE(const QString &name, QWidget *parent)
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "name=" << name;
qCDebug(kpLogColorCollection) << "name=" << name;
#endif
if (name.isEmpty())
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "name.isEmpty";
qCDebug(kpLogColorCollection) << "name.isEmpty";
#endif
::CouldNotOpenKDEDialog (name, parent);
return false;
......@@ -228,7 +230,7 @@ kpColorCollection::openKDE(const QString &name, QWidget *parent)
if (filename.isEmpty())
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "could not find file";
qCDebug(kpLogColorCollection) << "could not find file";
#endif
::CouldNotOpenKDEDialog (name, parent);
return false;
......@@ -238,14 +240,14 @@ kpColorCollection::openKDE(const QString &name, QWidget *parent)
if (!open (QUrl::fromLocalFile (filename), parent))
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "could not open";
qCDebug(kpLogColorCollection) << "could not open";
#endif
return false;
}
d->name = name;
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "opened";
qCDebug(kpLogColorCollection) << "opened";
#endif
return true;
}
......@@ -316,7 +318,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
atomicFileWriter.cancelWriting ();
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\treturning false because could not open QSaveFile"
qCDebug(kpLogColorCollection) << "\treturning false because could not open QSaveFile"
<< " error=" << atomicFileWriter.error ();
#endif
::CouldNotSaveDialog (url, parent);
......@@ -333,7 +335,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
atomicFileWriter.cancelWriting ();
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\tcould not close QSaveFile";
qCDebug(kpLogColorCollection) << "\tcould not close QSaveFile";
#endif
::CouldNotSaveDialog (url, parent);
return false;
......@@ -349,7 +351,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
if (!tempFile.open ())
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\treturning false because could not open tempFile";
qCDebug(kpLogColorCollection) << "\treturning false because could not open tempFile";
#endif
::CouldNotSaveDialog (url, parent);
return false;
......@@ -362,7 +364,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
// stops working after close() is called.
const QString tempFileName = tempFile.fileName ();
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\ttempFileName='" << tempFileName << "'";
qCDebug(kpLogColorCollection) << "\ttempFileName='" << tempFileName << "'";
#endif
Q_ASSERT (!tempFileName.isEmpty ());
......@@ -370,7 +372,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
if (tempFile.error () != QFile::NoError)
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\treturning false because could not close";
qCDebug(kpLogColorCollection) << "\treturning false because could not close";
#endif
::CouldNotSaveDialog (url, parent);
return false;
......@@ -383,7 +385,7 @@ kpColorCollection::saveAs(const QUrl &url, bool showOverwritePrompt,
if (!KIO::NetAccess::upload (tempFileName, url, parent))
{
#if DEBUG_KP_COLOR_COLLECTION
qCDebug(kpLogMisc) << "\treturning false because could not upload";
qCDebug(kpLogColorCollection) << "\treturning false because could not upload";
#endif
::CouldNotSaveDialog (url, parent);
return false;
......
......@@ -137,7 +137,7 @@ void kpColorCellsBase::setRowColumnCounts (int rows, int columns)
const int oldRows = rowCount (), oldCols = columnCount ();
const int newRows = rows, newCols = columns;
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "oldRows=" << oldRows << "oldCols=" << oldCols
qCDebug(kpLogColorCollection) << "oldRows=" << oldRows << "oldCols=" << oldCols
<< "newRows=" << newRows << "newCols=" << newCols;
#endif
......@@ -383,7 +383,7 @@ int kpColorCellsBase::positionToCell(const QPoint &pos, bool ignoreBorders,
const int r = indexAt (pos).row (), c = indexAt (pos).column ();
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "r=" << r << "c=" << c;
qCDebug(kpLogColorCollection) << "r=" << r << "c=" << c;
#endif
if (r == -1 || c == -1)
......@@ -421,14 +421,14 @@ void kpColorCellsBase::mouseMoveEvent( QMouseEvent *e )
if (cell != -1)
{
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "beginning drag from cell=" << cell
qCDebug(kpLogColorCollection) << "beginning drag from cell=" << cell
<< "color: isValid=" << d->colors [cell].isValid ()
<< " rgba=" << (int *) d->colors [cell].rgba();
#endif
Q_ASSERT (d->colors[cell].isValid());
KColorMimeData::createDrag(d->colors[cell], this)->start(Qt::CopyAction | Qt::MoveAction);
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "finished drag";
qCDebug(kpLogColorCollection) << "finished drag";
#endif
}
}
......@@ -459,7 +459,7 @@ static void SetDropAction (QWidget *self, QDropEvent *event)
void kpColorCellsBase::dragEnterEvent( QDragEnterEvent *event)
{
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "kpColorCellsBase::dragEnterEvent() acceptDrags="
qCDebug(kpLogColorCollection) << "kpColorCellsBase::dragEnterEvent() acceptDrags="
<< d->acceptDrags
<< " canDecode=" << KColorMimeData::canDecode(event->mimeData());
#endif
......@@ -472,7 +472,7 @@ void kpColorCellsBase::dragEnterEvent( QDragEnterEvent *event)
void kpColorCellsBase::dragMoveEvent (QDragMoveEvent *event)
{
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "kpColorCellsBase::dragMoveEvent() acceptDrags="
qCDebug(kpLogColorCollection) << "kpColorCellsBase::dragMoveEvent() acceptDrags="
<< d->acceptDrags
<< " canDecode=" << KColorMimeData::canDecode(event->mimeData());
#endif
......@@ -490,7 +490,7 @@ void kpColorCellsBase::dropEvent( QDropEvent *event)
positionToCell (d->mousePos, true) :
-1;
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "kpColorCellsBase::dropEvent()"
qCDebug(kpLogColorCollection) << "kpColorCellsBase::dropEvent()"
<< "color: rgba=" << (const int *) c.rgba () << "isValid=" << c.isValid()
<< "source=" << event->source () << "dragSourceCell=" << dragSourceCell;
#endif
......@@ -499,7 +499,7 @@ void kpColorCellsBase::dropEvent( QDropEvent *event)
int cell = positionToCell(event->pos(), true, true/*allow empty cell*/);
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "\tcell=" << cell;
qCDebug(kpLogColorCollection) << "\tcell=" << cell;
#endif
// TODO: I believe kdelibs forgets to do this.
if (cell == -1)
......@@ -513,7 +513,7 @@ void kpColorCellsBase::dropEvent( QDropEvent *event)
setColor(cell,c);
#if DEBUG_KP_COLOR_CELLS_BASE
qCDebug(kpLogMisc) << "\tdropAction=" << event->dropAction ()
qCDebug(kpLogColorCollection) << "\tdropAction=" << event->dropAction ()
<< "destOldColor.rgba=" << (const int *) destOldColor.rgba ();
#endif
if (event->dropAction () == Qt::MoveAction && dragSourceCell != -1) {
......
......@@ -37,6 +37,9 @@
#include <kolourpaint_lgpl_export.h>
#include <QTableWidget>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(kpLogColorCollection)
/**
* A table of editable color cells.
......
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