Remove macro usage for ads namespace

This commit is contained in:
Uwe Kindler 2017-02-23 22:26:13 +01:00
parent ca64286117
commit 842cef2675
30 changed files with 249 additions and 277 deletions

View File

@ -1,26 +1,2 @@
SOURCES += \
$$PWD/src/API.cpp \
$$PWD/src/MainContainerWidget.cpp \
$$PWD/src/SectionWidget.cpp \
$$PWD/src/SectionContent.cpp \
$$PWD/src/SectionTitleWidget.cpp \
$$PWD/src/SectionContentWidget.cpp \
$$PWD/src/DropOverlay.cpp \
$$PWD/src/FloatingWidget.cpp \
$$PWD/src/Internal.cpp \
$$PWD/src/Serialization.cpp \
$$PWD/src/ContainerWidget.cpp
HEADERS += \
$$PWD/include/ads/API.h \
$$PWD/include/ads/MainContainerWidget.h \
$$PWD/include/ads/SectionWidget.h \
$$PWD/include/ads/SectionContent.h \
$$PWD/include/ads/SectionTitleWidget.h \
$$PWD/include/ads/SectionContentWidget.h \
$$PWD/include/ads/DropOverlay.h \
$$PWD/include/ads/FloatingWidget.h \
$$PWD/include/ads/Internal.h \
$$PWD/include/ads/Serialization.h \
$$PWD/include/ads/ContainerWidget.h

View File

@ -34,4 +34,28 @@ windows {
RESOURCES += \
res/ads.qrc
include(AdvancedDockingSystem.pri)
SOURCES += \
$$PWD/src/API.cpp \
$$PWD/src/MainContainerWidget.cpp \
$$PWD/src/SectionWidget.cpp \
$$PWD/src/SectionContent.cpp \
$$PWD/src/SectionTitleWidget.cpp \
$$PWD/src/SectionContentWidget.cpp \
$$PWD/src/DropOverlay.cpp \
$$PWD/src/FloatingWidget.cpp \
$$PWD/src/Internal.cpp \
$$PWD/src/Serialization.cpp \
$$PWD/src/ContainerWidget.cpp
HEADERS += \
$$PWD/src/API.h \
$$PWD/src/MainContainerWidget.h \
$$PWD/src/SectionWidget.h \
$$PWD/src/SectionContent.h \
$$PWD/src/SectionTitleWidget.h \
$$PWD/src/SectionContentWidget.h \
$$PWD/src/DropOverlay.h \
$$PWD/src/FloatingWidget.h \
$$PWD/src/Internal.h \
$$PWD/src/Serialization.h \
$$PWD/src/ContainerWidget.h

View File

@ -17,17 +17,18 @@
******************************************************************************/
#include <ads/MainContainerWidget.h>
#include "ads/API.h"
#include "MainContainerWidget.h"
#include "API.h"
#include <QWidget>
#include <QSplitter>
#include <QLayout>
#include <QVariant>
#include "ads/SectionWidget.h"
#include "SectionWidget.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
static bool splitterContainsSectionWidget(QSplitter* splitter)
{
@ -108,4 +109,4 @@ QSplitter* findImmediateSplitter(QWidget* w)
return sp;
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -35,26 +35,6 @@ class QSplitter;
#define ADS_EXPORT_API
#endif
// Use namespace
// Disabled with Qt4, it makes problems with signals and slots.
#ifdef ADS_NAMESPACE_ENABLED
#define ADS_NAMESPACE_BEGIN namespace ads {
#define ADS_NAMESPACE_END }
#define ADS_NS ::ads
#else
#define ADS_NAMESPACE_BEGIN
#define ADS_NAMESPACE_END
#define ADS_NS
#endif
// Always enable "serialization" namespace.
// It is not required for signals and slots.
#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization {
#define ADS_NAMESPACE_SER_END }}
#define ADS_NS_SER ::ads::serialization
// Width of the native window frame border (based on OS).
#define ADS_WINDOW_FRAME_BORDER_WIDTH 7
// Beautiful C++ stuff.
#define ADS_Expects(cond)
@ -64,7 +44,8 @@ class QSplitter;
//#define ADS_ANIMATIONS_ENABLED 1
//#define ADS_ANIMATION_DURATION 150
ADS_NAMESPACE_BEGIN
namespace ads
{
class CMainContainerWidget;
class SectionWidget;
@ -86,5 +67,5 @@ void deleteEmptySplitter(CMainContainerWidget* container);
QSplitter* findParentSplitter(QWidget* w);
QSplitter* findImmediateSplitter(QWidget* w);
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -20,9 +20,9 @@
//============================================================================
// INCLUDES
//============================================================================
#include <ads/MainContainerWidget.h>
#include <ads/SectionContentWidget.h>
#include "ads/ContainerWidget.h"
#include "MainContainerWidget.h"
#include "SectionContentWidget.h"
#include "ContainerWidget.h"
#include <QDebug>
#include <QPaintEvent>
@ -38,11 +38,11 @@
#include <iostream>
#include "ads/Internal.h"
#include "ads/SectionWidget.h"
#include "ads/SectionTitleWidget.h"
#include "ads/DropOverlay.h"
#include "ads/Serialization.h"
#include "Internal.h"
#include "SectionWidget.h"
#include "SectionTitleWidget.h"
#include "DropOverlay.h"
#include "Serialization.h"
namespace ads
{
@ -97,7 +97,7 @@ void CContainerWidget::dropFloatingWidget(FloatingWidget* FloatingWidget,
if (sectionWidget)
{
auto dropOverlay = m_MainContainerWidget->sectionDropOverlay();
dropOverlay->setAllowedAreas(ADS_NS::AllAreas);
dropOverlay->setAllowedAreas(AllAreas);
dropArea = dropOverlay->showDropOverlay(sectionWidget);
if (dropArea != InvalidDropArea)
{

View File

@ -23,12 +23,12 @@
//============================================================================
#include <QFrame>
#include "ads/API.h"
#include "ads/Internal.h"
#include "ads/SectionContent.h"
#include "ads/FloatingWidget.h"
#include "ads/Serialization.h"
#include "ads/DropOverlay.h"
#include "API.h"
#include "Internal.h"
#include "SectionContent.h"
#include "FloatingWidget.h"
#include "Serialization.h"
#include "DropOverlay.h"
namespace ads
{

View File

@ -16,7 +16,7 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "ads/DropOverlay.h"
#include "DropOverlay.h"
#include <QPointer>
#include <QPaintEvent>
@ -32,7 +32,8 @@
#include <iostream>
ADS_NAMESPACE_BEGIN
namespace ads
{
// Helper /////////////////////////////////////////////////////////////
@ -240,23 +241,12 @@ void DropOverlay::paintEvent(QPaintEvent*)
std::cout << "CursorLocation: " << dropAreaUnderCursor() << std::endl;
switch (da)
{
case ADS_NS::TopDropArea:
r.setHeight(r.height() / 2);
break;
case ADS_NS::RightDropArea:
r.setX(r.width() / 2);
break;
case ADS_NS::BottomDropArea:
r.setY(r.height() / 2);
break;
case ADS_NS::LeftDropArea:
r.setWidth(r.width() / 2);
break;
case ADS_NS::CenterDropArea:
r = rect();
break;
default:
return;
case TopDropArea: r.setHeight(r.height() / 2); break;
case RightDropArea: r.setX(r.width() / 2); break;
case BottomDropArea: r.setY(r.height() / 2); break;
case LeftDropArea: r.setWidth(r.width() / 2); break;
case CenterDropArea: r = rect();break;
default: return;
}
QPainter painter(this);
QColor Color = palette().color(QPalette::Active, QPalette::Highlight);
@ -294,11 +284,11 @@ static int areaAlignment(const DropArea area)
{
switch (area)
{
case ADS_NS::TopDropArea: return (int) Qt::AlignHCenter | Qt::AlignBottom;
case ADS_NS::RightDropArea: return (int) Qt::AlignLeft | Qt::AlignVCenter;
case ADS_NS::BottomDropArea: return (int) Qt::AlignHCenter | Qt::AlignTop;
case ADS_NS::LeftDropArea: return (int) Qt::AlignRight | Qt::AlignVCenter;
case ADS_NS::CenterDropArea: return (int) Qt::AlignCenter;
case TopDropArea: return (int) Qt::AlignHCenter | Qt::AlignBottom;
case RightDropArea: return (int) Qt::AlignLeft | Qt::AlignVCenter;
case BottomDropArea: return (int) Qt::AlignHCenter | Qt::AlignTop;
case LeftDropArea: return (int) Qt::AlignRight | Qt::AlignVCenter;
case CenterDropArea: return (int) Qt::AlignCenter;
default: return Qt::AlignCenter;
}
}
@ -310,11 +300,11 @@ QPoint DropOverlayCross::areaGridPosition(const DropArea area)
{
switch (area)
{
case ADS_NS::TopDropArea: return QPoint(1, 2);
case ADS_NS::RightDropArea: return QPoint(2, 3);
case ADS_NS::BottomDropArea: return QPoint(3, 2);
case ADS_NS::LeftDropArea: return QPoint(2, 1);
case ADS_NS::CenterDropArea: return QPoint(2, 2);
case TopDropArea: return QPoint(1, 2);
case RightDropArea: return QPoint(2, 3);
case BottomDropArea: return QPoint(3, 2);
case LeftDropArea: return QPoint(2, 1);
case CenterDropArea: return QPoint(2, 2);
default: return QPoint();
}
}
@ -322,11 +312,11 @@ QPoint DropOverlayCross::areaGridPosition(const DropArea area)
{
switch (area)
{
case ADS_NS::TopDropArea: return QPoint(0, 2);
case ADS_NS::RightDropArea: return QPoint(2, 4);
case ADS_NS::BottomDropArea: return QPoint(4, 2);
case ADS_NS::LeftDropArea: return QPoint(2, 0);
case ADS_NS::CenterDropArea: return QPoint(2, 2);
case TopDropArea: return QPoint(0, 2);
case RightDropArea: return QPoint(2, 4);
case BottomDropArea: return QPoint(4, 2);
case LeftDropArea: return QPoint(2, 0);
case CenterDropArea: return QPoint(2, 2);
default: return QPoint();
}
}
@ -451,8 +441,8 @@ void DropOverlayCross::showEvent(QShowEvent*)
void DropOverlayCross::reset()
{
QList<DropArea> allAreas;
allAreas << ADS_NS::TopDropArea << ADS_NS::RightDropArea
<< ADS_NS::BottomDropArea << ADS_NS::LeftDropArea << ADS_NS::CenterDropArea;
allAreas << TopDropArea << RightDropArea
<< BottomDropArea << LeftDropArea << CenterDropArea;
const DropAreas allowedAreas = m_DropOverlay->allowedAreas();
// Update visibility of area widgets based on allowedAreas.
@ -468,4 +458,4 @@ void DropOverlayCross::reset()
}
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -23,9 +23,10 @@
#include <QFrame>
class QGridLayout;
#include "ads/API.h"
#include "API.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
class DropOverlayCross;
/*!
@ -115,5 +116,5 @@ private:
QGridLayout* m_GridLayout;
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,9 +16,7 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <ads/MainContainerWidget.h>
#include <ads/SectionContentWidget.h>
#include "ads/FloatingWidget.h"
#include "FloatingWidget.h"
#include <QBoxLayout>
#include <QPushButton>
@ -28,14 +26,17 @@
#include <QLabel>
#include <QGuiApplication>
#include "ads/SectionTitleWidget.h"
#include "ads/Internal.h"
#include "ads/SectionWidget.h"
#include "ads/ContainerWidget.h"
#include "SectionTitleWidget.h"
#include "Internal.h"
#include "SectionWidget.h"
#include "ContainerWidget.h"
#include "MainContainerWidget.h"
#include "SectionContentWidget.h"
#include <iostream>
ADS_NAMESPACE_BEGIN
namespace ads
{
unsigned int FloatingWidget::zOrderCounter = 0;
@ -400,7 +401,7 @@ void FloatingWidget::updateDropOverlays(const QPoint& GlobalPos)
SectionWidget* sectionwidget = TopContainer->sectionWidgetAt(GlobalPos);
if (sectionwidget)
{
SectionDropOverlay->setAllowedAreas(ADS_NS::AllAreas);
SectionDropOverlay->setAllowedAreas(AllAreas);
SectionDropOverlay->showDropOverlay(sectionwidget);
}
else
@ -420,5 +421,4 @@ void FloatingWidget::updateDropOverlays(const QPoint& GlobalPos)
}
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -21,10 +21,12 @@
#include <QFrame>
class QBoxLayout;
#include "ads/API.h"
#include "ads/SectionContent.h"
#include "API.h"
#include "SectionContent.h"
namespace ads
{
ADS_NAMESPACE_BEGIN
class CMainContainerWidget;
class SectionTitleWidget;
class CSectionContentWidget;
@ -110,5 +112,5 @@ private:
static unsigned int zOrderCounter;
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,9 +16,10 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "ads/Internal.h"
#include "Internal.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
InternalContentData::InternalContentData() :
titleWidget(NULL),
@ -30,4 +31,4 @@ InternalContentData::~InternalContentData()
{
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -20,15 +20,10 @@
#include <QSharedPointer>
#include <QWeakPointer>
#include "ads/API.h"
#include "API.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#else
#include "ads/SectionContent.h"
#endif
ADS_NAMESPACE_BEGIN
namespace ads
{
class SectionContent;
class SectionTitleWidget;
class CSectionContentWidget;
@ -63,5 +58,5 @@ public:
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,7 +16,8 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <ads/SectionContentWidget.h>
#include "SectionContentWidget.h"
#include <QDebug>
#include <QPaintEvent>
#include <QPainter>
@ -29,16 +30,17 @@
#include <QPoint>
#include <QApplication>
#include "ads/Internal.h"
#include "ads/SectionWidget.h"
#include "ads/SectionTitleWidget.h"
#include "ads/DropOverlay.h"
#include "ads/Serialization.h"
#include "Internal.h"
#include "SectionWidget.h"
#include "SectionTitleWidget.h"
#include "DropOverlay.h"
#include "Serialization.h"
#include <iostream>
#include "../include/ads/MainContainerWidget.h"
#include "MainContainerWidget.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
QSplitter* CMainContainerWidget::newSplitter(Qt::Orientation orientation, QWidget* parent)
@ -369,17 +371,17 @@ QMenu* CMainContainerWidget::createContextMenu() const
QByteArray CMainContainerWidget::saveState() const
{
ADS_NS_SER::InMemoryWriter writer;
InMemoryWriter writer;
// Hierarchy data.
const QByteArray hierarchyData = saveHierarchy();
if (!hierarchyData.isEmpty())
{
writer.write(ADS_NS_SER::ET_Hierarchy, hierarchyData);
writer.write(ET_Hierarchy, hierarchyData);
}
// SectionIndex data.
ADS_NS_SER::SectionIndexData sid;
SectionIndexData sid;
if (saveSectionIndex(sid))
{
writer.write(sid);
@ -395,13 +397,13 @@ bool CMainContainerWidget::restoreState(const QByteArray& data)
if (data.isEmpty())
return false;
ADS_NS_SER::InMemoryReader reader(data);
InMemoryReader reader(data);
if (!reader.initReadHeader())
return false;
// Basic hierarchy data.
QByteArray hierarchyData;
if (reader.read(ADS_NS_SER::ET_Hierarchy, hierarchyData))
if (reader.read(ET_Hierarchy, hierarchyData))
{
restoreHierarchy(hierarchyData);
}
@ -599,7 +601,7 @@ void CMainContainerWidget::saveSectionWidgets(QDataStream& out, QWidget* widget)
}
}
bool CMainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) const
bool CMainContainerWidget::saveSectionIndex(SectionIndexData& sid) const
{
if (m_Sections.count() <= 0)
return false;
@ -607,7 +609,7 @@ bool CMainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) c
sid.sectionsCount = m_Sections.count();
for (int i = 0; i < sid.sectionsCount; ++i)
{
ADS_NS_SER::SectionEntity se;
SectionEntity se;
se.x = mapFromGlobal(m_Sections[i]->parentWidget()->mapToGlobal(m_Sections[i]->pos())).x();
se.y = mapFromGlobal(m_Sections[i]->parentWidget()->mapToGlobal(m_Sections[i]->pos())).y();
se.width = m_Sections[i]->geometry().width();
@ -616,7 +618,7 @@ bool CMainContainerWidget::saveSectionIndex(ADS_NS_SER::SectionIndexData& sid) c
se.sectionContentsCount = m_Sections[i]->contents().count();
foreach (const SectionContent::RefPtr& sc, m_Sections[i]->contents())
{
ADS_NS_SER::SectionContentEntity sce;
SectionContentEntity sce;
sce.uniqueName = sc->uniqueName();
sce.visible = true;
sce.preferredIndex = m_Sections[i]->indexOfContent(sc);
@ -1014,7 +1016,7 @@ void CMainContainerWidget::moveFloatingWidget(const QPoint& TargetPos)
if (sectionwidget)
{
//qInfo() << "over sectionWidget";
m_SectionDropOverlay->setAllowedAreas(ADS_NS::AllAreas);
m_SectionDropOverlay->setAllowedAreas(AllAreas);
m_SectionDropOverlay->showDropOverlay(sectionwidget);
}
else
@ -1024,4 +1026,4 @@ void CMainContainerWidget::moveFloatingWidget(const QPoint& TargetPos)
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -27,15 +27,16 @@
class QPoint;
class QMenu;
#include "ads/API.h"
#include "ads/Internal.h"
#include "ads/SectionContent.h"
#include "ads/FloatingWidget.h"
#include "ads/Serialization.h"
#include "ads/DropOverlay.h"
#include "ads/ContainerWidget.h"
#include "API.h"
#include "Internal.h"
#include "SectionContent.h"
#include "FloatingWidget.h"
#include "Serialization.h"
#include "DropOverlay.h"
#include "ContainerWidget.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
class SectionWidget;
class DropOverlay;
class InternalContentData;
@ -143,7 +144,7 @@ private:
void saveFloatingWidgets(QDataStream& out) const;
void saveSectionWidgets(QDataStream& out, QWidget* widget) const;
bool saveSectionIndex(ADS_NS_SER::SectionIndexData &sid) const;
bool saveSectionIndex(SectionIndexData &sid) const;
bool restoreHierarchy(const QByteArray& data);
bool restoreFloatingWidgets(QDataStream& in, int version, QList<FloatingWidget*>& floatings);
@ -184,5 +185,5 @@ private:
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,15 +16,16 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <ads/MainContainerWidget.h>
#include "ads/SectionContent.h"
#include "MainContainerWidget.h"
#include "SectionContent.h"
#include <QWidget>
#include <QLabel>
#include "ads/Internal.h"
#include "Internal.h"
ADS_NAMESPACE_BEGIN
namespace ads
{
SectionContent::SectionContent() :
_uid(GetNextUid()),
@ -136,4 +137,4 @@ int SectionContent::GetNextUid()
return ++NextUid;
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -20,11 +20,15 @@
#include <QSharedPointer>
#include <QWeakPointer>
#include <QPointer>
class QWidget;
#include "ads/API.h"
#include "API.h"
namespace ads
{
ADS_NAMESPACE_BEGIN
class CMainContainerWidget;
class ADS_EXPORT_API SectionContent
@ -91,5 +95,5 @@ private:
static int GetNextUid();
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,10 +16,10 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <ads/MainContainerWidget.h>
#include "MainContainerWidget.h"
#include <QBoxLayout>
#include "../include/ads/SectionContentWidget.h"
#include "../include/ads/SectionTitleWidget.h"
#include "SectionContentWidget.h"
#include "SectionTitleWidget.h"
namespace ads
{

View File

@ -19,8 +19,8 @@
******************************************************************************/
#include <QFrame>
#include "ads/API.h"
#include "ads/SectionContent.h"
#include "API.h"
#include "SectionContent.h"
namespace ads
{

View File

@ -16,8 +16,8 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <ads/MainContainerWidget.h>
#include "ads/SectionTitleWidget.h"
#include "MainContainerWidget.h"
#include "SectionTitleWidget.h"
#include <QString>
#include <QApplication>
@ -32,14 +32,15 @@
#include <iostream>
#include "ads/Internal.h"
#include "ads/DropOverlay.h"
#include "ads/SectionContent.h"
#include "ads/SectionWidget.h"
#include "ads/FloatingWidget.h"
#include "Internal.h"
#include "DropOverlay.h"
#include "SectionContent.h"
#include "SectionWidget.h"
#include "FloatingWidget.h"
#include <iostream>
ADS_NAMESPACE_BEGIN
namespace ads
{
SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent) :
QFrame(parent),
@ -286,4 +287,4 @@ void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev)
QFrame::mouseMoveEvent(ev);
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -21,12 +21,14 @@
#include <QPoint>
#include <QFrame>
#include "ads/API.h"
#include "ads/SectionContent.h"
#include "API.h"
#include "SectionContent.h"
class QPushButton;
ADS_NAMESPACE_BEGIN
namespace ads
{
class CMainContainerWidget;
class SectionWidget;
class FloatingWidget;
@ -74,5 +76,5 @@ signals:
void clicked();
};
ADS_NAMESPACE_END
} // namepsace ads
#endif

View File

@ -16,7 +16,7 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "ads/SectionWidget.h"
#include "SectionWidget.h"
#include <QApplication>
#include <QBoxLayout>
@ -36,19 +36,16 @@
#include <iostream>
#if defined(ADS_ANIMATIONS_ENABLED)
#include <QGraphicsDropShadowEffect>
#endif
#include "Internal.h"
#include "DropOverlay.h"
#include "SectionContent.h"
#include "SectionTitleWidget.h"
#include "SectionContentWidget.h"
#include "FloatingWidget.h"
#include "MainContainerWidget.h"
#include "ads/Internal.h"
#include "ads/DropOverlay.h"
#include "ads/SectionContent.h"
#include "ads/SectionTitleWidget.h"
#include <ads/SectionContentWidget.h>
#include "ads/FloatingWidget.h"
#include <ads/MainContainerWidget.h>
ADS_NAMESPACE_BEGIN
namespace ads
{
SectionWidget::SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent) :
QFrame(parent),
@ -425,10 +422,6 @@ int SectionWidget::GetNextUid()
return ++NextUid;
}
bool SectionWidget::eventFilter(QObject *watched, QEvent *event)
{
}
/*****************************************************************************/
@ -499,4 +492,4 @@ void SectionWidgetTabsScrollArea::mouseMoveEvent(QMouseEvent* ev)
return;
}
ADS_NAMESPACE_END
} // namespace ads

View File

@ -22,17 +22,20 @@
#include <QList>
#include <QFrame>
#include <QScrollArea>
class QBoxLayout;
class QStackedLayout;
class QPushButton;
class QMenu;
#include "ads/API.h"
#include "ads/Internal.h"
#include "ads/SectionContent.h"
#include "ads/FloatingWidget.h"
#include "API.h"
#include "Internal.h"
#include "SectionContent.h"
#include "FloatingWidget.h"
namespace ads
{
ADS_NAMESPACE_BEGIN
class CMainContainerWidget;
class SectionTitleWidget;
class CSectionContentWidget;
@ -69,8 +72,6 @@ public:
int currentIndex() const;
void moveContent(int from, int to);
virtual bool eventFilter(QObject *watched, QEvent *event);
inline int contentCount() const {return m_ContentWidgets.size();}
protected:
@ -125,5 +126,5 @@ protected:
virtual void mouseMoveEvent(QMouseEvent* ev);
};
ADS_NAMESPACE_END
} // namespace ads
#endif

View File

@ -16,11 +16,12 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "ads/Serialization.h"
#include "Serialization.h"
#include <QDebug>
ADS_NAMESPACE_SER_BEGIN
namespace ads
{
/*
\namespace ads::serialization
@ -455,4 +456,4 @@ bool InMemoryReader::read(SectionIndexData& sid)
///////////////////////////////////////////////////////////////////////////////
ADS_NAMESPACE_SER_END
} // namespace ads

View File

@ -23,9 +23,10 @@
#include <QDataStream>
#include <QBuffer>
#include "ads/API.h"
#include "API.h"
ADS_NAMESPACE_SER_BEGIN
namespace ads
{
enum EntryType
{
@ -177,5 +178,5 @@ private:
OffsetsHeaderEntity _offsetsHeader;
};
ADS_NAMESPACE_SER_END
} // namespace ads
#endif

View File

@ -53,5 +53,5 @@ win32:CONFIG(release, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingS
else:win32:CONFIG(debug, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingSystem)
else:unix: LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/ -lAdvancedDockingSystem
INCLUDEPATH += $$PWD/../AdvancedDockingSystem/include
DEPENDPATH += $$PWD/../AdvancedDockingSystem/include
INCLUDEPATH += $$PWD/../AdvancedDockingSystem/src
DEPENDPATH += $$PWD/../AdvancedDockingSystem/src

View File

@ -13,7 +13,7 @@ SectionContentListModel::~SectionContentListModel()
{
}
void SectionContentListModel::init(ADS_NS::CMainContainerWidget* cw)
void SectionContentListModel::init(ads::CMainContainerWidget* cw)
{
beginResetModel();
_cw = cw;
@ -45,7 +45,7 @@ QVariant SectionContentListModel::data(const QModelIndex& index, int role) const
if (!index.isValid() || index.row() > rowCount(index) - 1)
return QVariant();
const ADS_NS::SectionContent::RefPtr sc = _contents.at(index.row());
const ads::SectionContent::RefPtr sc = _contents.at(index.row());
if (sc.isNull())
return QVariant();
@ -80,7 +80,7 @@ bool SectionContentListModel::removeRows(int row, int count, const QModelIndex&
for (int i = last; i >= first; --i)
{
const ADS_NS::SectionContent::RefPtr sc = _contents.at(i);
const ads::SectionContent::RefPtr sc = _contents.at(i);
_cw->removeSectionContent(sc);
_contents.removeAt(i);
}

View File

@ -5,12 +5,11 @@
#include <QList>
#include <QString>
#include <QAbstractTableModel>
#include "../../../AdvancedDockingSystem/include/ads/MainContainerWidget.h"
#include "ads/API.h"
#include "ads/SectionContent.h"
ADS_NAMESPACE_BEGIN
class CMainContainerWidget;
ADS_NAMESPACE_END
#include "MainContainerWidget.h"
#include "API.h"
#include "SectionContent.h"
namespace ads {class CMainContainerWidget;}
class SectionContentListModel : public QAbstractTableModel
{
@ -27,7 +26,7 @@ public:
SectionContentListModel(QObject* parent);
virtual ~SectionContentListModel();
void init(ADS_NS::CMainContainerWidget* cw);
void init(ads::CMainContainerWidget* cw);
virtual int columnCount(const QModelIndex &parent) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
@ -40,8 +39,8 @@ public:
private:
QHash<int, QString> _headers;
ADS_NS::CMainContainerWidget* _cw;
QList<ADS_NS::SectionContent::RefPtr> _contents;
ads::CMainContainerWidget* _cw;
QList<ads::SectionContent::RefPtr> _contents;
};
#endif

View File

@ -2,11 +2,11 @@
#define SECTIONCONTENTLISTWIDGET
#include <QDialog>
#include "../../../AdvancedDockingSystem/include/ads/MainContainerWidget.h"
#include "MainContainerWidget.h"
#include "ui_SectionContentListWidget.h"
#include "ads/API.h"
#include "ads/SectionContent.h"
#include "API.h"
#include "SectionContent.h"
class SectionContentListWidget : public QDialog
{
@ -16,7 +16,7 @@ public:
class Values
{
public:
ADS_NS::CMainContainerWidget* cw;
ads::CMainContainerWidget* cw;
};
SectionContentListWidget(QWidget* parent);

View File

@ -10,8 +10,8 @@
#include <QFileSystemModel>
#include <QBoxLayout>
#include "ads/SectionWidget.h"
#include "ads/DropOverlay.h"
#include "SectionWidget.h"
#include "DropOverlay.h"
#include "dialogs/SectionContentListWidget.h"
@ -21,7 +21,7 @@
static int CONTENT_COUNT = 0;
static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::CMainContainerWidget* container)
static ads::SectionContent::RefPtr createLongTextLabelSC(ads::CMainContainerWidget* container)
{
QWidget* w = new QWidget();
QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom);
@ -34,20 +34,20 @@ static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::CMainContain
bl->addWidget(l);
const int index = ++CONTENT_COUNT;
ADS_NS::SectionContent::RefPtr sc = ADS_NS::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Label %1").arg(index)), w);
ads::SectionContent::RefPtr sc = ads::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Label %1").arg(index)), w);
sc->setTitle("Ein Label " + QString::number(index));
return sc;
}
static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::CMainContainerWidget* container)
static ads::SectionContent::RefPtr createCalendarSC(ads::CMainContainerWidget* container)
{
QCalendarWidget* w = new QCalendarWidget();
const int index = ++CONTENT_COUNT;
return ADS_NS::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Calendar %1").arg(index)), w);
return ads::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Calendar %1").arg(index)), w);
}
static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC(ADS_NS::CMainContainerWidget* container)
static ads::SectionContent::RefPtr createFileSystemTreeSC(ads::CMainContainerWidget* container)
{
QTreeView* w = new QTreeView();
w->setFrameShape(QFrame::NoFrame);
@ -56,7 +56,7 @@ static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC(ADS_NS::CMainContai
// w->setModel(m);
const int index = ++CONTENT_COUNT;
return ADS_NS::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Filesystem %1").arg(index)), w);
return ads::SectionContent::newSectionContent(QString("uname-%1").arg(index), container, new IconTitleWidget(QIcon(), QString("Filesystem %1").arg(index)), w);
}
static void storeDataHelper(const QString& fname, const QByteArray& ba)
@ -93,7 +93,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionContentList, SIGNAL(triggered()), this, SLOT(showSectionContentListDialog()));
// ADS - Create main container (ContainerWidget).
_container = new ADS_NS::CMainContainerWidget();
_container = new ads::CMainContainerWidget();
connect(_container, SIGNAL(activeTabChanged(const SectionContent::RefPtr&, bool)), this, SLOT(onActiveTabChanged(const SectionContent::RefPtr&, bool)));
connect(_container, SIGNAL(sectionContentVisibilityChanged(SectionContent::RefPtr,bool)), this, SLOT(onSectionContentVisibilityChanged(SectionContent::RefPtr,bool)));
setCentralWidget(_container);
@ -117,35 +117,35 @@ void MainWindow::createContent()
{
// ADS - Adding some contents.
// Test #1: Use high-level public API
ADS_NS::CMainContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = nullptr;
ads::CMainContainerWidget* cw = _container;
ads::SectionWidget* sw = nullptr;
sw = _container->addSectionContent(createLongTextLabelSC(cw), nullptr, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), nullptr, ADS_NS::LeftDropArea);
sw = _container->addSectionContent(createFileSystemTreeSC(cw), nullptr, ADS_NS::BottomDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), nullptr, ADS_NS::BottomDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), nullptr, ads::CenterDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), nullptr, ads::LeftDropArea);
sw = _container->addSectionContent(createFileSystemTreeSC(cw), nullptr, ads::BottomDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), nullptr, ads::BottomDropArea);
/*_container->addSectionContent(createCalendarSC(_container));
_container->addSectionContent(createLongTextLabelSC(_container));
_container->addSectionContent(createLongTextLabelSC(_container));
_container->addSectionContent(createLongTextLabelSC(_container));
ADS_NS::SectionContent::RefPtr sc = createLongTextLabelSC(cw);
sc->setFlags(ADS_NS::SectionContent::AllFlags ^ ADS_NS::SectionContent::Closeable);
ads::SectionContent::RefPtr sc = createLongTextLabelSC(cw);
sc->setFlags(ads::SectionContent::AllFlags ^ ads::SectionContent::Closeable);
_container->addSectionContent(sc);*/
#if 0
// Issue #2: If the first drop is not into CenterDropArea, the application crashes.
ADS_NS::CMainContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = NULL;
ads::CMainContainerWidget* cw = _container;
ads::SectionWidget* sw = NULL;
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::LeftDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), sw, ADS_NS::LeftDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::RightDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::BottomDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::LeftDropArea);
sw = _container->addSectionContent(createCalendarSC(cw), sw, ads::LeftDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::CenterDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::RightDropArea);
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ads::BottomDropArea);
#endif
}
@ -159,7 +159,7 @@ void MainWindow::showSectionContentListDialog()
w.exec();
}
void MainWindow::onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bool active)
void MainWindow::onActiveTabChanged(const ads::SectionContent::RefPtr& sc, bool active)
{
Q_UNUSED(active);
IconTitleWidget* itw = dynamic_cast<IconTitleWidget*>(sc->titleWidgetContent());
@ -169,7 +169,7 @@ void MainWindow::onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bo
}
}
void MainWindow::onSectionContentVisibilityChanged(const ADS_NS::SectionContent::RefPtr& sc, bool visible)
void MainWindow::onSectionContentVisibilityChanged(const ads::SectionContent::RefPtr& sc, bool visible)
{
qDebug() << Q_FUNC_INFO << sc->uniqueName() << visible;
}

View File

@ -2,9 +2,9 @@
#define MAINWINDOW_H
#include <QMainWindow>
#include "../../AdvancedDockingSystem/include/ads/MainContainerWidget.h"
#include "ads/API.h"
#include "ads/SectionContent.h"
#include "../../AdvancedDockingSystem/src/MainContainerWidget.h"
#include "API.h"
#include "SectionContent.h"
namespace Ui {
class MainWindow;
@ -22,13 +22,8 @@ public slots:
void showSectionContentListDialog();
private slots:
#if QT_VERSION >= 0x050000
void onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bool active);
void onSectionContentVisibilityChanged(const ADS_NS::SectionContent::RefPtr& sc, bool visible);
#else
void onActiveTabChanged(const SectionContent::RefPtr& sc, bool active);
void onSectionContentVisibilityChanged(const SectionContent::RefPtr& sc, bool visible);
#endif
void onActiveTabChanged(const ads::SectionContent::RefPtr& sc, bool active);
void onSectionContentVisibilityChanged(const ads::SectionContent::RefPtr& sc, bool visible);
void onActionAddSectionContentTriggered();
protected:
@ -37,7 +32,7 @@ protected:
private:
Ui::MainWindow *ui;
ADS_NS::CMainContainerWidget* _container;
ads::CMainContainerWidget* _container;
void createContent();
};