Replaced std:cout based debug output with qDebug()

This commit is contained in:
Uwe Kindler 2017-03-28 12:01:27 +02:00
parent aa8a52b845
commit 9af86c4136
13 changed files with 137 additions and 103 deletions

View File

@ -1 +0,0 @@
theme: jekyll-theme-midnight

View File

@ -1,6 +1,7 @@
#include <QString> #include <QString>
#include <QFile> #include <QFile>
#include <QApplication> #include <QApplication>
#include <QDebug>
#include "mainwindow.h" #include "mainwindow.h"
@ -15,11 +16,39 @@ static void initStyleSheet(QApplication& a)
} }
} }
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
switch (type) {
case QtDebugMsg:
fprintf(stdout, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtInfoMsg:
fprintf(stdout, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
abort();
}
fflush(stderr);
fflush(stdout);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(true); a.setQuitOnLastWindowClosed(true);
initStyleSheet(a); initStyleSheet(a);
qInstallMessageHandler(myMessageOutput);
qDebug() << "Message handler test";
MainWindow mw; MainWindow mw;
mw.show(); mw.show();

View File

@ -24,21 +24,25 @@
static int CONTENT_COUNT = 0; static int CONTENT_COUNT = 0;
static ads::CDockWidget* createLongTextLabelDockWidget(QMenu* ViewMenu) static ads::CDockWidget* createLongTextLabelDockWidget(QMenu* ViewMenu)
{ {
static int LabelCount = 0; static int LabelCount = 0;
QLabel* l = new QLabel(); QLabel* l = new QLabel();
l->setWordWrap(true); l->setWordWrap(true);
l->setAlignment(Qt::AlignTop | Qt::AlignLeft); l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
l->setText(QString("Label %1 %2 - Lorem Ipsum ist ein einfacher Demo-Text für die Print- " l->setText(QString("Label %1 %2 - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
"und Schriftindustrie. Lorem Ipsum ist in der Industrie bereits der " "Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque "
"Standard Demo-Text seit 1500, als ein unbekannter Schriftsteller eine " "penatibus et magnis dis parturient montes, nascetur ridiculus mus. "
"Hand voll Wörter nahm und diese durcheinander warf um ein Musterbuch zu " "Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. "
"erstellen. Es hat nicht nur 5 Jahrhunderte überlebt, sondern auch in " "Nulla consequat massa quis enim. Donec pede justo, fringilla vel, "
"Spruch in die elektronische Schriftbearbeitung geschafft (bemerke, nahezu " "aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, "
"unverändert). Bekannt wurde es 1960, mit dem erscheinen von Letrase, " "imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede "
"welches Passagen von Lorem Ipsum enhielt, so wie Desktop Software wie " "mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum "
"Aldus PageMaker - ebenfalls mit Lorem Ipsum.") "semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, "
"porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, "
"dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla "
"ut metus varius laoreet.")
.arg(LabelCount) .arg(LabelCount)
.arg(QTime::currentTime().toString("hh:mm:ss:zzz"))); .arg(QTime::currentTime().toString("hh:mm:ss:zzz")));
@ -49,6 +53,7 @@ static ads::CDockWidget* createLongTextLabelDockWidget(QMenu* ViewMenu)
return DockWidget; return DockWidget;
} }
static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu) static ads::CDockWidget* createCalendarDockWidget(QMenu* ViewMenu)
{ {
static int CalendarCount = 0; static int CalendarCount = 0;

View File

@ -48,7 +48,6 @@
#include "DockManager.h" #include "DockManager.h"
#include "DockOverlay.h" #include "DockOverlay.h"
#include <iostream>
namespace ads namespace ads
{ {
@ -83,7 +82,6 @@ public:
protected: protected:
virtual void wheelEvent(QWheelEvent* Event) override virtual void wheelEvent(QWheelEvent* Event) override
{ {
std::cout << "CTabsScrollArea::wheelEvent" << std::endl;
Event->accept(); Event->accept();
const int direction = Event->angleDelta().y(); const int direction = Event->angleDelta().y();
if (direction < 0) if (direction < 0)
@ -117,7 +115,7 @@ protected:
{ {
if (ev->button() == Qt::LeftButton) if (ev->button() == Qt::LeftButton)
{ {
std::cout << "CTabsScrollArea::mouseReleaseEvent" << std::endl; qDebug() << "CTabsScrollArea::mouseReleaseEvent";
ev->accept(); ev->accept();
m_FloatingWidget = nullptr; m_FloatingWidget = nullptr;
m_DragStartMousePos = QPoint(); m_DragStartMousePos = QPoint();
@ -154,7 +152,7 @@ protected:
if (!this->geometry().contains(ev->pos())) if (!this->geometry().contains(ev->pos()))
{ {
std::cout << "CTabsScrollArea::startFloating" << std::endl; qDebug() << "CTabsScrollArea::startFloating";
startFloating(m_DragStartMousePos); startFloating(m_DragStartMousePos);
auto Overlay = m_DockArea->dockManager()->containerOverlay(); auto Overlay = m_DockArea->dockManager()->containerOverlay();
Overlay->setAllowedAreas(OuterDockAreas); Overlay->setAllowedAreas(OuterDockAreas);
@ -404,7 +402,7 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
//============================================================================ //============================================================================
CDockAreaWidget::~CDockAreaWidget() CDockAreaWidget::~CDockAreaWidget()
{ {
std::cout << "~CDockAreaWidget()" << std::endl; qDebug() << "~CDockAreaWidget()";
delete d; delete d;
} }
@ -465,7 +463,7 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
//============================================================================ //============================================================================
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
{ {
std::cout << "CDockAreaWidget::removeDockWidget" << std::endl; qDebug() << "CDockAreaWidget::removeDockWidget";
d->ContentsLayout->removeWidget(DockWidget); d->ContentsLayout->removeWidget(DockWidget);
auto TitleBar = DockWidget->titleBar(); auto TitleBar = DockWidget->titleBar();
TitleBar->hide(); TitleBar->hide();
@ -478,7 +476,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
CDockContainerWidget* DockContainer = dockContainer(); CDockContainerWidget* DockContainer = dockContainer();
if (d->ContentsLayout->isEmpty()) if (d->ContentsLayout->isEmpty())
{ {
std::cout << "Dock Area empty" << std::endl; qDebug() << "Dock Area empty";
dockContainer()->removeDockArea(this); dockContainer()->removeDockArea(this);
this->deleteLater();; this->deleteLater();;
} }
@ -720,8 +718,8 @@ void CDockAreaWidget::onDockWidgetViewToggled(bool Open)
void CDockAreaWidget::saveState(QDataStream& stream) const void CDockAreaWidget::saveState(QDataStream& stream) const
{ {
stream << d->ContentsLayout->count() << d->ContentsLayout->currentIndex(); stream << d->ContentsLayout->count() << d->ContentsLayout->currentIndex();
std::cout << "CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count() qDebug() << "CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
<< " CurrentIndex: " << d->ContentsLayout->currentIndex() << std::endl; << " CurrentIndex: " << d->ContentsLayout->currentIndex();
for (int i = 0; i < d->ContentsLayout->count(); ++i) for (int i = 0; i < d->ContentsLayout->count(); ++i)
{ {
dockWidget(i)->saveState(stream); dockWidget(i)->saveState(stream);

View File

@ -35,6 +35,7 @@
#include <QGridLayout> #include <QGridLayout>
#include <QPointer> #include <QPointer>
#include <QVariant> #include <QVariant>
#include <QDebug>
#include "DockManager.h" #include "DockManager.h"
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
@ -45,7 +46,6 @@
#include "ads_globals.h" #include "ads_globals.h"
#include "DockSplitter.h" #include "DockSplitter.h"
#include <iostream>
namespace ads namespace ads
{ {
@ -314,8 +314,8 @@ void DockContainerWidgetPrivate::saveChildNodesState(QDataStream& stream, QWidge
if (Splitter) if (Splitter)
{ {
stream << internal::SplitterMarker << Splitter->orientation() << Splitter->count(); stream << internal::SplitterMarker << Splitter->orientation() << Splitter->count();
std::cout << "NodeSplitter orient: " << Splitter->orientation() qDebug() << "NodeSplitter orient: " << Splitter->orientation()
<< " WidgetCont: " << Splitter->count() << std::endl; << " WidgetCont: " << Splitter->count();
for (int i = 0; i < Splitter->count(); ++i) for (int i = 0; i < Splitter->count(); ++i)
{ {
saveChildNodesState(stream, Splitter->widget(i)); saveChildNodesState(stream, Splitter->widget(i));
@ -341,8 +341,8 @@ bool DockContainerWidgetPrivate::restoreSplitter(QDataStream& stream,
int Orientation; int Orientation;
int WidgetCount; int WidgetCount;
stream >> Orientation >> WidgetCount; stream >> Orientation >> WidgetCount;
std::cout << "Restore NodeSplitter Orientation: " << Orientation << qDebug() << "Restore NodeSplitter Orientation: " << Orientation <<
" WidgetCount: " << WidgetCount << std::endl; " WidgetCount: " << WidgetCount;
QSplitter* Splitter = nullptr; QSplitter* Splitter = nullptr;
if (!Testing) if (!Testing)
{ {
@ -362,8 +362,8 @@ bool DockContainerWidgetPrivate::restoreSplitter(QDataStream& stream,
continue; continue;
} }
std::cout << "ChildNode isVisible " << ChildNode->isVisible() qDebug() << "ChildNode isVisible " << ChildNode->isVisible()
<< " isVisibleTo " << ChildNode->isVisibleTo(Splitter) << std::endl; << " isVisibleTo " << ChildNode->isVisibleTo(Splitter);
Splitter->addWidget(ChildNode); Splitter->addWidget(ChildNode);
Visible |= ChildNode->isVisibleTo(Splitter); Visible |= ChildNode->isVisibleTo(Splitter);
} }
@ -399,8 +399,8 @@ bool DockContainerWidgetPrivate::restoreDockArea(QDataStream& stream,
int Tabs; int Tabs;
int CurrentIndex; int CurrentIndex;
stream >> Tabs >> CurrentIndex; stream >> Tabs >> CurrentIndex;
std::cout << "Restore NodeDockArea Tabs: " << Tabs << " CurrentIndex: " qDebug() << "Restore NodeDockArea Tabs: " << Tabs << " CurrentIndex: "
<< CurrentIndex << std::endl; << CurrentIndex;
CDockAreaWidget* DockArea = nullptr; CDockAreaWidget* DockArea = nullptr;
if (!Testing) if (!Testing)
@ -420,8 +420,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(QDataStream& stream,
QString ObjectName; QString ObjectName;
bool Closed; bool Closed;
stream >> ObjectName >> Closed; stream >> ObjectName >> Closed;
std::cout << "Restore DockWidget " << ObjectName.toStdString() << " Closed: " qDebug() << "Restore DockWidget " << ObjectName << " Closed: " << Closed;
<< Closed << std::endl;
CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName); CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName);
if (!DockWidget || Testing) if (!DockWidget || Testing)
@ -429,8 +428,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(QDataStream& stream,
continue; continue;
} }
std::cout << "Dock Widget found - parent " << DockWidget->parent() qDebug() << "Dock Widget found - parent " << DockWidget->parent();
<< std::endl;
DockArea->addDockWidget(DockWidget); DockArea->addDockWidget(DockWidget);
DockWidget->toggleView(!Closed); DockWidget->toggleView(!Closed);
DockWidget->setProperty("dirty", false); DockWidget->setProperty("dirty", false);
@ -536,8 +534,8 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
buf.fill(' ', level * 4); buf.fill(' ', level * 4);
if (Splitter) if (Splitter)
{ {
std::cout << buf.toStdString() << "Splitter " << ((Splitter->orientation() == Qt::Vertical) qDebug("%sSplitter %s", (const char*)buf, (Splitter->orientation() == Qt::Vertical)
? "-" : "|") << std::endl; ? "-" : "|");
for (int i = 0; i < Splitter->count(); ++i) for (int i = 0; i < Splitter->count(); ++i)
{ {
dumpRecursive(level + 1, Splitter->widget(i)); dumpRecursive(level + 1, Splitter->widget(i));
@ -550,7 +548,7 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
{ {
return; return;
} }
std::cout << buf.toStdString() << "DockArea" << std::endl; qDebug("%sDockArea", (const char*)buf);
} }
#endif #endif
} }
@ -574,12 +572,12 @@ CDockAreaWidget* DockContainerWidgetPrivate::dockWidgetIntoDockArea(DockWidgetAr
int index = TargetAreaSplitter ->indexOf(TargetDockArea); int index = TargetAreaSplitter ->indexOf(TargetDockArea);
if (TargetAreaSplitter->orientation() == InsertParam.orientation()) if (TargetAreaSplitter->orientation() == InsertParam.orientation())
{ {
std::cout << "TargetAreaSplitter->orientation() == InsertParam.orientation()" << std::endl; qDebug() << "TargetAreaSplitter->orientation() == InsertParam.orientation()";
TargetAreaSplitter->insertWidget(index + InsertParam.insertOffset(), NewDockArea); TargetAreaSplitter->insertWidget(index + InsertParam.insertOffset(), NewDockArea);
} }
else else
{ {
std::cout << "TargetAreaSplitter->orientation() != InsertParam.orientation()" << std::endl; qDebug() << "TargetAreaSplitter->orientation() != InsertParam.orientation()";
QSplitter* NewSplitter = internal::newSplitter(InsertParam.orientation()); QSplitter* NewSplitter = internal::newSplitter(InsertParam.orientation());
NewSplitter->addWidget(TargetDockArea); NewSplitter->addWidget(TargetDockArea);
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append()); insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
@ -696,7 +694,7 @@ void CDockContainerWidget::addDockArea(CDockAreaWidget* DockAreaWidget,
//============================================================================ //============================================================================
void CDockContainerWidget::removeDockArea(CDockAreaWidget* area) void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
{ {
std::cout << "CDockContainerWidget::removeDockArea" << std::endl; qDebug() << "CDockContainerWidget::removeDockArea";
d->DockAreas.removeAll(area); d->DockAreas.removeAll(area);
QSplitter* Splitter = internal::findParent<QSplitter*>(area); QSplitter* Splitter = internal::findParent<QSplitter*>(area);
area->setParent(0); area->setParent(0);
@ -708,7 +706,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
// It the splitter contains only one single widget, then we do not need // It the splitter contains only one single widget, then we do not need
// it anymore and can replace it with its content // it anymore and can replace it with its content
std::cout << "Replacing splitter with content" << std::endl; qDebug() << "Replacing splitter with content";
QWidget* widget = Splitter->widget(0); QWidget* widget = Splitter->widget(0);
widget->setParent(this); widget->setParent(this);
QSplitter* ParentSplitter = internal::findParent<QSplitter*>(Splitter); QSplitter* ParentSplitter = internal::findParent<QSplitter*>(Splitter);
@ -759,7 +757,7 @@ int CDockContainerWidget::dockAreaCount() const
void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWidget, void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWidget,
const QPoint& TargetPos) const QPoint& TargetPos)
{ {
std::cout << "CDockContainerWidget::dropFloatingWidget" << std::endl; qDebug() << "CDockContainerWidget::dropFloatingWidget";
CDockAreaWidget* DockArea = dockAreaAt(TargetPos); CDockAreaWidget* DockArea = dockAreaAt(TargetPos);
auto dropArea = InvalidDockWidgetArea; auto dropArea = InvalidDockWidgetArea;
if (DockArea) if (DockArea)
@ -769,7 +767,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
dropArea = dropOverlay->showOverlay(DockArea); dropArea = dropOverlay->showOverlay(DockArea);
if (dropArea != InvalidDockWidgetArea) if (dropArea != InvalidDockWidgetArea)
{ {
std::cout << "Dock Area Drop Content: " << dropArea << std::endl; qDebug() << "Dock Area Drop Content: " << dropArea;
d->dropIntoSection(FloatingWidget, DockArea, dropArea); d->dropIntoSection(FloatingWidget, DockArea, dropArea);
} }
} }
@ -778,7 +776,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
if (InvalidDockWidgetArea == dropArea) if (InvalidDockWidgetArea == dropArea)
{ {
dropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor(); dropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
std::cout << "Container Drop Content: " << dropArea << std::endl; qDebug() << "Container Drop Content: " << dropArea;
if (dropArea != InvalidDockWidgetArea) if (dropArea != InvalidDockWidgetArea)
{ {
d->dropIntoContainer(FloatingWidget, dropArea); d->dropIntoContainer(FloatingWidget, dropArea);
@ -806,8 +804,8 @@ QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
//============================================================================ //============================================================================
void CDockContainerWidget::saveState(QDataStream& stream) const void CDockContainerWidget::saveState(QDataStream& stream) const
{ {
std::cout << "CDockContainerWidget::saveState isFloating " qDebug() << "CDockContainerWidget::saveState isFloating "
<< isFloating() << std::endl; << isFloating();
stream << internal::ContainerMarker; stream << internal::ContainerMarker;
stream << isFloating(); stream << isFloating();
if (isFloating()) if (isFloating())
@ -832,7 +830,7 @@ bool CDockContainerWidget::restoreState(QDataStream& stream, bool Testing)
} }
stream >> IsFloating; stream >> IsFloating;
std::cout << "Restore CDockContainerWidget Floating" << IsFloating << std::endl; qDebug() << "Restore CDockContainerWidget Floating" << IsFloating;
QWidget* NewRootSplitter; QWidget* NewRootSplitter;
if (!Testing) if (!Testing)
@ -842,7 +840,7 @@ bool CDockContainerWidget::restoreState(QDataStream& stream, bool Testing)
if (IsFloating) if (IsFloating)
{ {
std::cout << "Restore floating widget" << std::endl; qDebug() << "Restore floating widget";
QByteArray Geometry; QByteArray Geometry;
stream >> Geometry; stream >> Geometry;
if (!Testing) if (!Testing)

View File

@ -34,8 +34,7 @@
#include <QList> #include <QList>
#include <QMap> #include <QMap>
#include <QVariant> #include <QVariant>
#include <QDebug>
#include <iostream>
#include "FloatingDockContainer.h" #include "FloatingDockContainer.h"
#include "DockOverlay.h" #include "DockOverlay.h"
@ -64,11 +63,6 @@ struct DockManagerPrivate
*/ */
DockManagerPrivate(CDockManager* _public); DockManagerPrivate(CDockManager* _public);
/**
* Restores a non existing container from stream
*/
bool restoreContainer(QDataStream& Stream);
/** /**
* Checks if the given data stream is a valid docking system state * Checks if the given data stream is a valid docking system state
* file. * file.
@ -95,15 +89,6 @@ DockManagerPrivate::DockManagerPrivate(CDockManager* _public) :
} }
//============================================================================
bool DockManagerPrivate::restoreContainer(QDataStream& Stream)
{
std::cout << "restoreContainer" << std::endl;
CFloatingDockContainer* FloatingWidget = new CFloatingDockContainer(_this);
return true;
}
//============================================================================ //============================================================================
bool DockManagerPrivate::checkFormat(const QByteArray &state, int version) bool DockManagerPrivate::checkFormat(const QByteArray &state, int version)
{ {
@ -127,7 +112,6 @@ bool DockManagerPrivate::checkFormat(const QByteArray &state, int version)
int Result = true; int Result = true;
int ContainerCount; int ContainerCount;
stream >> ContainerCount; stream >> ContainerCount;
std::cout << "ContainerCount " << ContainerCount << std::endl;
int i; int i;
for (i = 0; i < ContainerCount; ++i) for (i = 0; i < ContainerCount; ++i)
{ {
@ -152,7 +136,7 @@ bool DockManagerPrivate::restoreContainer(int Index, QDataStream& stream, bool T
} }
else else
{ {
std::cout << "d->Containers[i]->restoreState " << Index << std::endl; qDebug() << "d->Containers[i]->restoreState ";
return Containers[Index]->restoreState(stream, internal::Restore); return Containers[Index]->restoreState(stream, internal::Restore);
} }
} }
@ -181,7 +165,7 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
int Result = true; int Result = true;
int ContainerCount; int ContainerCount;
stream >> ContainerCount; stream >> ContainerCount;
std::cout << "ContainerCount " << ContainerCount << std::endl; qDebug() << "ContainerCount " << ContainerCount;
int i; int i;
for (i = 0; i < ContainerCount; ++i) for (i = 0; i < ContainerCount; ++i)
{ {
@ -236,8 +220,7 @@ CDockManager::~CDockManager()
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget) void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
{ {
d->FloatingWidgets.append(FloatingWidget); d->FloatingWidgets.append(FloatingWidget);
std::cout << "d->FloatingWidgets.count() " << d->FloatingWidgets.count() qDebug() << "d->FloatingWidgets.count() " << d->FloatingWidgets.count();
<< std::endl;
} }
@ -322,7 +305,7 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
{ {
if (!d->checkFormat(state, version)) if (!d->checkFormat(state, version))
{ {
std::cout << "checkFormat: Error checking format!!!!!!!" << std::endl; qDebug() << "checkFormat: Error checking format!!!!!!!";
return false; return false;
} }
@ -333,7 +316,7 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
if (!d->restoreState(state, version)) if (!d->restoreState(state, version))
{ {
std::cout << "restoreState: Error restoring state!!!!!!!" << std::endl; qDebug() << "restoreState: Error restoring state!!!!!!!";
return false; return false;
} }

View File

@ -34,8 +34,6 @@
#include <QtGlobal> #include <QtGlobal>
#include <QDebug> #include <QDebug>
#include <iostream>
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
namespace ads namespace ads
@ -314,12 +312,10 @@ DockWidgetArea CDockOverlay::showOverlay(QWidget* target)
{ {
if (d->TargetWidget == target) if (d->TargetWidget == target)
{ {
qInfo() << "_target == target";
// Hint: We could update geometry of overlay here. // Hint: We could update geometry of overlay here.
DockWidgetArea da = dropAreaUnderCursor(); DockWidgetArea da = dropAreaUnderCursor();
if (da != d->LastLocation) if (da != d->LastLocation)
{ {
qInfo() << "repaint()";
repaint(); repaint();
d->LastLocation = da; d->LastLocation = da;
} }
@ -342,7 +338,6 @@ DockWidgetArea CDockOverlay::showOverlay(QWidget* target)
//============================================================================ //============================================================================
void CDockOverlay::hideOverlay() void CDockOverlay::hideOverlay()
{ {
qInfo() << "hideDockOverlay() _fullAreaDrop = false";
hide(); hide();
d->TargetWidget.clear(); d->TargetWidget.clear();
d->TargetRect = QRect(); d->TargetRect = QRect();

View File

@ -10,7 +10,7 @@
//============================================================================ //============================================================================
#include <DockSplitter.h> #include <DockSplitter.h>
#include <iostream> #include <QDebug>
namespace ads namespace ads
{ {
@ -18,7 +18,7 @@ namespace ads
//============================================================================ //============================================================================
CDockSplitter::~CDockSplitter() CDockSplitter::~CDockSplitter()
{ {
std::cout << "~CDockSplitter" << std::endl; qDebug() << "~CDockSplitter";
} }
} // namespace ads } // namespace ads

View File

@ -0,0 +1,32 @@
/*******************************************************************************
** QtAdcancedDockingSystem
** Copyright (C) 2017 Uwe Kindler
**
** 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 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
//============================================================================
/// \file DockStateSerialization.cpp
/// \author Uwe Kindler
/// \date 26.02.2017
/// \brief Serialization related data, constants and stuff
//============================================================================
//============================================================================
// INCLUDES
//============================================================================
#include "DockStateSerialization.h"

View File

@ -23,7 +23,7 @@
/// \file DockStateSerialization.h /// \file DockStateSerialization.h
/// \author Uwe Kindler /// \author Uwe Kindler
/// \date 26.02.2017 /// \date 26.02.2017
/// \brief /// \brief Declaration of serialization related data, constants and stuff
//============================================================================ //============================================================================

View File

@ -37,8 +37,7 @@
#include <QTextStream> #include <QTextStream>
#include <QPointer> #include <QPointer>
#include <QEvent> #include <QEvent>
#include <QDebug>
#include <iostream>
#include "DockWidgetTitleBar.h" #include "DockWidgetTitleBar.h"
#include "DockContainerWidget.h" #include "DockContainerWidget.h"
@ -227,7 +226,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
//============================================================================ //============================================================================
CDockWidget::~CDockWidget() CDockWidget::~CDockWidget()
{ {
std::cout << "~CDockWidget()" << std::endl; qDebug() << "~CDockWidget()";
delete d; delete d;
} }
@ -367,8 +366,7 @@ void CDockWidget::setDockArea(CDockAreaWidget* DockArea)
void CDockWidget::saveState(QDataStream& stream) const void CDockWidget::saveState(QDataStream& stream) const
{ {
stream << internal::DockWidgetMarker; stream << internal::DockWidgetMarker;
std::cout << "CDockWidget::saveState " << objectName().toStdString() qDebug() << "CDockWidget::saveState " << objectName() << " closed " << d->Closed;
<< " closed " << d->Closed << std::endl;
stream << objectName() << d->Closed; stream << objectName() << d->Closed;
} }

View File

@ -36,8 +36,7 @@
#include <QStyle> #include <QStyle>
#include <QApplication> #include <QApplication>
#include <QSplitter> #include <QSplitter>
#include <QDebug>
#include <iostream>
#include "ads_globals.h" #include "ads_globals.h"
#include "DockWidget.h" #include "DockWidget.h"
@ -161,9 +160,9 @@ void DockWidgetTitleBarPrivate::moveTab(QMouseEvent* ev)
//============================================================================ //============================================================================
bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos) bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos)
{ {
std::cout << "isFloating " << DockWidget->dockContainer()->isFloating() << std::endl; qDebug() << "isFloating " << DockWidget->dockContainer()->isFloating();
std::cout << "areaCount " << DockWidget->dockContainer()->dockAreaCount() << std::endl; qDebug() << "areaCount " << DockWidget->dockContainer()->dockAreaCount();
std::cout << "widgetCount " << DockWidget->dockAreaWidget()->count() << std::endl; qDebug() << "widgetCount " << DockWidget->dockAreaWidget()->count();
// if this is the last dock widget inside of this floating widget, // if this is the last dock widget inside of this floating widget,
// then it does not make any sense, to make if floating because // then it does not make any sense, to make if floating because
// it is already floating // it is already floating
@ -174,7 +173,7 @@ bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos)
return false; return false;
} }
std::cout << "startFloating" << std::endl; qDebug() << "startFloating";
DragState = DraggingFloatingWidget; DragState = DraggingFloatingWidget;
QSize Size = DockArea->size(); QSize Size = DockArea->size();
CFloatingDockContainer* FloatingWidget = nullptr; CFloatingDockContainer* FloatingWidget = nullptr;
@ -185,7 +184,7 @@ bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos)
} }
else else
{ {
std::cout << "DockWidgetTitleBarPrivate::startFloating DockArea" << std::endl; qDebug() << "DockWidgetTitleBarPrivate::startFloating DockArea";
// If section widget has only one content widget, we can move the complete // If section widget has only one content widget, we can move the complete
// dock area into floating widget // dock area into floating widget
auto splitter = internal::findParent<QSplitter*>(DockArea); auto splitter = internal::findParent<QSplitter*>(DockArea);
@ -213,7 +212,7 @@ CDockWidgetTitleBar::CDockWidgetTitleBar(CDockWidget* DockWidget, QWidget *paren
//============================================================================ //============================================================================
CDockWidgetTitleBar::~CDockWidgetTitleBar() CDockWidgetTitleBar::~CDockWidgetTitleBar()
{ {
std::cout << "~CDockWidgetTitleBar()" << std::endl; qDebug() << "~CDockWidgetTitleBar()";
delete d; delete d;
} }
@ -223,7 +222,7 @@ void CDockWidgetTitleBar::mousePressEvent(QMouseEvent* ev)
{ {
if (ev->button() == Qt::LeftButton) if (ev->button() == Qt::LeftButton)
{ {
std::cout << "CDockWidgetTitleBar::mousePressEvent" << std::endl; qDebug() << "CDockWidgetTitleBar::mousePressEvent";
ev->accept(); ev->accept();
d->DragStartMousePosition = ev->pos(); d->DragStartMousePosition = ev->pos();
d->DragState = DraggingMousePressed; d->DragState = DraggingMousePressed;
@ -237,7 +236,7 @@ void CDockWidgetTitleBar::mousePressEvent(QMouseEvent* ev)
//============================================================================ //============================================================================
void CDockWidgetTitleBar::mouseReleaseEvent(QMouseEvent* ev) void CDockWidgetTitleBar::mouseReleaseEvent(QMouseEvent* ev)
{ {
std::cout << "CDockWidgetTitleBar::mouseReleaseEvent" << std::endl; qDebug() << "CDockWidgetTitleBar::mouseReleaseEvent";
// End of tab moving, change order now // End of tab moving, change order now
if (d->isDraggingState(DraggingTab) && d->DockArea) if (d->isDraggingState(DraggingTab) && d->DockArea)
{ {
@ -249,7 +248,7 @@ void CDockWidgetTitleBar::mouseReleaseEvent(QMouseEvent* ev)
{ {
toIndex = d->DockArea->count() - 1; toIndex = d->DockArea->count() - 1;
} }
std::cout << "Move tab from " << fromIndex << " to " << toIndex << std::endl; qDebug() << "Move tab from " << fromIndex << " to " << toIndex;
d->DockArea->reorderDockWidget(fromIndex, toIndex); d->DockArea->reorderDockWidget(fromIndex, toIndex);
} }

View File

@ -35,8 +35,7 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QPointer> #include <QPointer>
#include <QAction> #include <QAction>
#include <QDebug>
#include <iostream>
#include "DockContainerWidget.h" #include "DockContainerWidget.h"
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
@ -92,7 +91,6 @@ void FloatingDockContainerPrivate::titleMouseReleaseEvent()
return; return;
} }
std::cout << "Dropped" << std::endl;
DropContainer->dropFloatingWidget(_this, QCursor::pos()); DropContainer->dropFloatingWidget(_this, QCursor::pos());
DockManager->containerOverlay()->hideOverlay(); DockManager->containerOverlay()->hideOverlay();
DockManager->dockAreaOverlay()->hideOverlay(); DockManager->dockAreaOverlay()->hideOverlay();
@ -214,7 +212,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget* DockWidget) :
//============================================================================ //============================================================================
CFloatingDockContainer::~CFloatingDockContainer() CFloatingDockContainer::~CFloatingDockContainer()
{ {
std::cout << "~CFloatingDockContainer" << std::endl; qDebug() << "~CFloatingDockContainer";
if (d->DockManager) if (d->DockManager)
{ {
d->DockManager->removeFloatingWidget(this); d->DockManager->removeFloatingWidget(this);
@ -236,7 +234,7 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
QWidget::changeEvent(event); QWidget::changeEvent(event);
if ((event->type() == QEvent::ActivationChange) && isActiveWindow()) if ((event->type() == QEvent::ActivationChange) && isActiveWindow())
{ {
std::cout << "FloatingWidget::changeEvent QEvent::ActivationChange " << std::endl; qDebug() << "FloatingWidget::changeEvent QEvent::ActivationChange ";
d->zOrderIndex = ++zOrderCounter; d->zOrderIndex = ++zOrderCounter;
return; return;
} }
@ -311,18 +309,18 @@ bool CFloatingDockContainer::event(QEvent *e)
{ {
if (QGuiApplication::mouseButtons() == Qt::LeftButton) if (QGuiApplication::mouseButtons() == Qt::LeftButton)
{ {
std::cout << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type() << std::endl; qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
d->setDraggingActive(true); d->setDraggingActive(true);
} }
} }
else if (e->type() == QEvent::NonClientAreaMouseButtonDblClick) else if (e->type() == QEvent::NonClientAreaMouseButtonDblClick)
{ {
std::cout << "FloatingWidget::event QEvent::NonClientAreaMouseButtonDblClick" << std::endl; qDebug() << "FloatingWidget::event QEvent::NonClientAreaMouseButtonDblClick";
d->setDraggingActive(false); d->setDraggingActive(false);
} }
else if ((e->type() == QEvent::NonClientAreaMouseButtonRelease) && d->DraggingActive) else if ((e->type() == QEvent::NonClientAreaMouseButtonRelease) && d->DraggingActive)
{ {
std::cout << "FloatingWidget::event QEvent::NonClientAreaMouseButtonRelease" << std::endl; qDebug() << "FloatingWidget::event QEvent::NonClientAreaMouseButtonRelease";
d->titleMouseReleaseEvent(); d->titleMouseReleaseEvent();
} }
@ -335,7 +333,7 @@ bool CFloatingDockContainer::eventFilter(QObject *watched, QEvent *event)
{ {
if (event->type() == QEvent::MouseButtonRelease && d->DraggingActive) if (event->type() == QEvent::MouseButtonRelease && d->DraggingActive)
{ {
std::cout << "FloatingWidget::eventFilter QEvent::MouseButtonRelease" << std::endl; qDebug() << "FloatingWidget::eventFilter QEvent::MouseButtonRelease";
d->titleMouseReleaseEvent(); d->titleMouseReleaseEvent();
} }
@ -367,7 +365,7 @@ void CFloatingDockContainer::moveFloating()
//============================================================================ //============================================================================
void CFloatingDockContainer::onDockAreasAddedOrRemoved() void CFloatingDockContainer::onDockAreasAddedOrRemoved()
{ {
std::cout << "CFloatingDockContainer::onDockAreasAddedOrRemoved()" << std::endl; qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
if (d->DockContainer->dockAreaCount() == 1) if (d->DockContainer->dockAreaCount() == 1)
{ {
d->SingleDockArea = d->DockContainer->dockArea(0); d->SingleDockArea = d->DockContainer->dockArea(0);