mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-24 05:22:06 +08:00
Moved include files from include to src directory
This commit is contained in:
parent
5dc935f650
commit
ca64286117
@ -1,90 +1,90 @@
|
|||||||
#ifndef ADS_API_H
|
#ifndef ADS_API_H
|
||||||
#define ADS_API_H
|
#define ADS_API_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
class QWidget;
|
class QWidget;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
|
||||||
// DLL Export API
|
// DLL Export API
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#if defined(ADS_IMPORT)
|
#if defined(ADS_IMPORT)
|
||||||
#define ADS_EXPORT_API
|
#define ADS_EXPORT_API
|
||||||
#elif defined(ADS_EXPORT)
|
#elif defined(ADS_EXPORT)
|
||||||
#define ADS_EXPORT_API __declspec(dllexport)
|
#define ADS_EXPORT_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define ADS_EXPORT_API __declspec(dllimport)
|
#define ADS_EXPORT_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define ADS_EXPORT_API
|
#define ADS_EXPORT_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use namespace
|
// Use namespace
|
||||||
// Disabled with Qt4, it makes problems with signals and slots.
|
// Disabled with Qt4, it makes problems with signals and slots.
|
||||||
#ifdef ADS_NAMESPACE_ENABLED
|
#ifdef ADS_NAMESPACE_ENABLED
|
||||||
#define ADS_NAMESPACE_BEGIN namespace ads {
|
#define ADS_NAMESPACE_BEGIN namespace ads {
|
||||||
#define ADS_NAMESPACE_END }
|
#define ADS_NAMESPACE_END }
|
||||||
#define ADS_NS ::ads
|
#define ADS_NS ::ads
|
||||||
#else
|
#else
|
||||||
#define ADS_NAMESPACE_BEGIN
|
#define ADS_NAMESPACE_BEGIN
|
||||||
#define ADS_NAMESPACE_END
|
#define ADS_NAMESPACE_END
|
||||||
#define ADS_NS
|
#define ADS_NS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Always enable "serialization" namespace.
|
// Always enable "serialization" namespace.
|
||||||
// It is not required for signals and slots.
|
// It is not required for signals and slots.
|
||||||
#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization {
|
#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization {
|
||||||
#define ADS_NAMESPACE_SER_END }}
|
#define ADS_NAMESPACE_SER_END }}
|
||||||
#define ADS_NS_SER ::ads::serialization
|
#define ADS_NS_SER ::ads::serialization
|
||||||
|
|
||||||
// Width of the native window frame border (based on OS).
|
// Width of the native window frame border (based on OS).
|
||||||
#define ADS_WINDOW_FRAME_BORDER_WIDTH 7
|
#define ADS_WINDOW_FRAME_BORDER_WIDTH 7
|
||||||
|
|
||||||
// Beautiful C++ stuff.
|
// Beautiful C++ stuff.
|
||||||
#define ADS_Expects(cond)
|
#define ADS_Expects(cond)
|
||||||
#define ADS_Ensures(cond)
|
#define ADS_Ensures(cond)
|
||||||
|
|
||||||
// Indicates whether ADS should include animations.
|
// Indicates whether ADS should include animations.
|
||||||
//#define ADS_ANIMATIONS_ENABLED 1
|
//#define ADS_ANIMATIONS_ENABLED 1
|
||||||
//#define ADS_ANIMATION_DURATION 150
|
//#define ADS_ANIMATION_DURATION 150
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
|
|
||||||
enum DropArea
|
enum DropArea
|
||||||
{
|
{
|
||||||
InvalidDropArea = 0,
|
InvalidDropArea = 0,
|
||||||
TopDropArea = 1,
|
TopDropArea = 1,
|
||||||
RightDropArea = 2,
|
RightDropArea = 2,
|
||||||
BottomDropArea = 4,
|
BottomDropArea = 4,
|
||||||
LeftDropArea = 8,
|
LeftDropArea = 8,
|
||||||
CenterDropArea = 16,
|
CenterDropArea = 16,
|
||||||
|
|
||||||
OuterAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea,
|
OuterAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea,
|
||||||
AllAreas = OuterAreas | CenterDropArea
|
AllAreas = OuterAreas | CenterDropArea
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(DropAreas, DropArea)
|
Q_DECLARE_FLAGS(DropAreas, DropArea)
|
||||||
|
|
||||||
void deleteEmptySplitter(CMainContainerWidget* container);
|
void deleteEmptySplitter(CMainContainerWidget* container);
|
||||||
QSplitter* findParentSplitter(QWidget* w);
|
QSplitter* findParentSplitter(QWidget* w);
|
||||||
QSplitter* findImmediateSplitter(QWidget* w);
|
QSplitter* findImmediateSplitter(QWidget* w);
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,129 +1,129 @@
|
|||||||
#ifndef ContainerWidgetH
|
#ifndef ContainerWidgetH
|
||||||
#define ContainerWidgetH
|
#define ContainerWidgetH
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// INCLUDES
|
// INCLUDES
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/Internal.h"
|
#include "ads/Internal.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
#include "ads/FloatingWidget.h"
|
#include "ads/FloatingWidget.h"
|
||||||
#include "ads/Serialization.h"
|
#include "ads/Serialization.h"
|
||||||
#include "ads/DropOverlay.h"
|
#include "ads/DropOverlay.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
class DropOverlay;
|
class DropOverlay;
|
||||||
class InternalContentData;
|
class InternalContentData;
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
class CContainerWidget : public QFrame
|
class CContainerWidget : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class SectionContent;
|
friend class SectionContent;
|
||||||
friend class SectionWidget;
|
friend class SectionWidget;
|
||||||
friend class FloatingWidget;
|
friend class FloatingWidget;
|
||||||
friend class SectionTitleWidget;
|
friend class SectionTitleWidget;
|
||||||
friend class ContainerWidgetPrivate;
|
friend class ContainerWidgetPrivate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CContainerWidget(CMainContainerWidget* MainContainerWidget, QWidget *parent = nullptr);
|
explicit CContainerWidget(CMainContainerWidget* MainContainerWidget, QWidget *parent = nullptr);
|
||||||
virtual ~CContainerWidget();
|
virtual ~CContainerWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current zOrderIndex
|
* Returns the current zOrderIndex
|
||||||
*/
|
*/
|
||||||
virtual unsigned int zOrderIndex() const;
|
virtual unsigned int zOrderIndex() const;
|
||||||
|
|
||||||
void dropFloatingWidget(FloatingWidget* FloatingWidget,
|
void dropFloatingWidget(FloatingWidget* FloatingWidget,
|
||||||
const QPoint& TargetPos);
|
const QPoint& TargetPos);
|
||||||
|
|
||||||
SectionWidget* sectionWidgetAt(const QPoint& GlobalPos) const;
|
SectionWidget* sectionWidgetAt(const QPoint& GlobalPos) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true if this container widgets z order index is
|
* This function returns true if this container widgets z order index is
|
||||||
* higher than the index of the container widget given in Other parameter
|
* higher than the index of the container widget given in Other parameter
|
||||||
*/
|
*/
|
||||||
bool isInFrontOf(CContainerWidget* Other) const;
|
bool isInFrontOf(CContainerWidget* Other) const;
|
||||||
|
|
||||||
SectionWidget* dropContent(const InternalContentData& data, SectionWidget* targetSection, DropArea area, bool autoActive = true);
|
SectionWidget* dropContent(const InternalContentData& data, SectionWidget* targetSection, DropArea area, bool autoActive = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Adds the section-content <em>sc</em> to this container-widget into the section-widget <em>sw</em>.
|
* Adds the section-content <em>sc</em> to this container-widget into the section-widget <em>sw</em>.
|
||||||
* If <em>sw</em> is not NULL, the <em>area</em> is used to indicate how the content should be arranged.
|
* If <em>sw</em> is not NULL, the <em>area</em> is used to indicate how the content should be arranged.
|
||||||
* Returns a pointer to the SectionWidget of the added SectionContent. Do not use it for anything else than adding more
|
* Returns a pointer to the SectionWidget of the added SectionContent. Do not use it for anything else than adding more
|
||||||
* SectionContent elements with this method.
|
* SectionContent elements with this method.
|
||||||
*/
|
*/
|
||||||
SectionWidget* addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw = NULL, DropArea area = CenterDropArea);
|
SectionWidget* addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw = NULL, DropArea area = CenterDropArea);
|
||||||
|
|
||||||
void dumpLayout();
|
void dumpLayout();
|
||||||
|
|
||||||
CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;}
|
CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;}
|
||||||
|
|
||||||
void addSectionWidget(SectionWidget* section);
|
void addSectionWidget(SectionWidget* section);
|
||||||
|
|
||||||
void takeSection(SectionWidget* Widget);
|
void takeSection(SectionWidget* Widget);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/*!
|
/*!
|
||||||
* Emits whenever the "isActiveTab" state of a SectionContent changes.
|
* Emits whenever the "isActiveTab" state of a SectionContent changes.
|
||||||
* Whenever the users sets another tab as active, this signal gets invoked
|
* Whenever the users sets another tab as active, this signal gets invoked
|
||||||
* for the old tab and the new active tab (the order is unspecified).
|
* for the old tab and the new active tab (the order is unspecified).
|
||||||
*/
|
*/
|
||||||
void activeTabChanged(const SectionContent::RefPtr& sc, bool active);
|
void activeTabChanged(const SectionContent::RefPtr& sc, bool active);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dropIntoContainer(FloatingWidget* FloatingWidget, DropArea area);
|
void dropIntoContainer(FloatingWidget* FloatingWidget, DropArea area);
|
||||||
void dropIntoSection(FloatingWidget* FloatingWidget, SectionWidget* targetSection, DropArea area);
|
void dropIntoSection(FloatingWidget* FloatingWidget, SectionWidget* targetSection, DropArea area);
|
||||||
virtual bool event(QEvent *e) override;
|
virtual bool event(QEvent *e) override;
|
||||||
SectionWidget* newSectionWidget();
|
SectionWidget* newSectionWidget();
|
||||||
SectionWidget* dropContentOuterHelper(QLayout* l, const InternalContentData& data, Qt::Orientation orientation, bool append);
|
SectionWidget* dropContentOuterHelper(QLayout* l, const InternalContentData& data, Qt::Orientation orientation, bool append);
|
||||||
SectionWidget* insertNewSectionWidget(const InternalContentData& data,
|
SectionWidget* insertNewSectionWidget(const InternalContentData& data,
|
||||||
SectionWidget* targetSection, SectionWidget* ret, Qt::Orientation Orientation, int InsertIndexOffset);
|
SectionWidget* targetSection, SectionWidget* ret, Qt::Orientation Orientation, int InsertIndexOffset);
|
||||||
|
|
||||||
QList<SectionWidget*> m_Sections;
|
QList<SectionWidget*> m_Sections;
|
||||||
// Layout stuff
|
// Layout stuff
|
||||||
QGridLayout* m_MainLayout = nullptr;
|
QGridLayout* m_MainLayout = nullptr;
|
||||||
Qt::Orientation m_Orientation = Qt::Horizontal;
|
Qt::Orientation m_Orientation = Qt::Horizontal;
|
||||||
QPointer<QSplitter> m_Splitter; // $mfreiholz: I'd like to remove this variable entirely,
|
QPointer<QSplitter> m_Splitter; // $mfreiholz: I'd like to remove this variable entirely,
|
||||||
// because it changes during user interaction anyway.
|
// because it changes during user interaction anyway.
|
||||||
|
|
||||||
CMainContainerWidget* m_MainContainerWidget = 0;
|
CMainContainerWidget* m_MainContainerWidget = 0;
|
||||||
unsigned int m_zOrderIndex = 0;
|
unsigned int m_zOrderIndex = 0;
|
||||||
static unsigned int zOrderCounter;
|
static unsigned int zOrderCounter;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dropChildSections(QWidget* Parent);
|
void dropChildSections(QWidget* Parent);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onActiveTabChanged();
|
void onActiveTabChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#endif // ContainerWidgetH
|
#endif // ContainerWidgetH
|
@ -1,119 +1,119 @@
|
|||||||
#ifndef DROP_OVERLAY_H
|
#ifndef DROP_OVERLAY_H
|
||||||
#define DROP_OVERLAY_H
|
#define DROP_OVERLAY_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class DropOverlayCross;
|
class DropOverlayCross;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* DropOverlay paints a translucent rectangle over another widget. The geometry
|
* DropOverlay paints a translucent rectangle over another widget. The geometry
|
||||||
* of the rectangle is based on the mouse location.
|
* of the rectangle is based on the mouse location.
|
||||||
*/
|
*/
|
||||||
class ADS_EXPORT_API DropOverlay : public QFrame
|
class ADS_EXPORT_API DropOverlay : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class DropOverlayCross;
|
friend class DropOverlayCross;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum eMode
|
enum eMode
|
||||||
{
|
{
|
||||||
ModeSectionOverlay,
|
ModeSectionOverlay,
|
||||||
ModeContainerOverlay
|
ModeContainerOverlay
|
||||||
};
|
};
|
||||||
|
|
||||||
DropOverlay(QWidget* parent, eMode Mode = ModeSectionOverlay);
|
DropOverlay(QWidget* parent, eMode Mode = ModeSectionOverlay);
|
||||||
virtual ~DropOverlay();
|
virtual ~DropOverlay();
|
||||||
|
|
||||||
void setAllowedAreas(DropAreas areas);
|
void setAllowedAreas(DropAreas areas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns flags with all allowed drop areas
|
* Returns flags with all allowed drop areas
|
||||||
*/
|
*/
|
||||||
DropAreas allowedAreas() const;
|
DropAreas allowedAreas() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the drop area under the current cursor location
|
* Returns the drop area under the current cursor location
|
||||||
*/
|
*/
|
||||||
DropArea dropAreaUnderCursor() const;
|
DropArea dropAreaUnderCursor() const;
|
||||||
|
|
||||||
DropArea showDropOverlay(QWidget* target);
|
DropArea showDropOverlay(QWidget* target);
|
||||||
void showDropOverlay(QWidget* target, const QRect& targetAreaRect);
|
void showDropOverlay(QWidget* target, const QRect& targetAreaRect);
|
||||||
void hideDropOverlay();
|
void hideDropOverlay();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a drop indicator widget for the given drop area
|
* Creates a drop indicator widget for the given drop area
|
||||||
*/
|
*/
|
||||||
static QWidget* createDropIndicatorWidget(DropArea dropArea);
|
static QWidget* createDropIndicatorWidget(DropArea dropArea);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *e);
|
virtual void paintEvent(QPaintEvent *e);
|
||||||
virtual void showEvent(QShowEvent* e);
|
virtual void showEvent(QShowEvent* e);
|
||||||
virtual void hideEvent(QHideEvent* e);
|
virtual void hideEvent(QHideEvent* e);
|
||||||
virtual void resizeEvent(QResizeEvent* e);
|
virtual void resizeEvent(QResizeEvent* e);
|
||||||
virtual void moveEvent(QMoveEvent* e);
|
virtual void moveEvent(QMoveEvent* e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DropAreas _allowedAreas;
|
DropAreas _allowedAreas;
|
||||||
DropOverlayCross* _cross;
|
DropOverlayCross* _cross;
|
||||||
QPointer<QWidget> _target;
|
QPointer<QWidget> _target;
|
||||||
QRect _targetRect;
|
QRect _targetRect;
|
||||||
DropArea _lastLocation;
|
DropArea _lastLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* DropOverlayCross shows a cross with 5 different drop area possibilities.
|
* DropOverlayCross shows a cross with 5 different drop area possibilities.
|
||||||
* I could have handled everything inside DropOverlay, but because of some
|
* I could have handled everything inside DropOverlay, but because of some
|
||||||
* styling issues it's better to have a separate class for the cross.
|
* styling issues it's better to have a separate class for the cross.
|
||||||
*/
|
*/
|
||||||
class DropOverlayCross : public QWidget
|
class DropOverlayCross : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class DropOverlay;
|
friend class DropOverlay;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DropOverlayCross(DropOverlay* overlay);
|
DropOverlayCross(DropOverlay* overlay);
|
||||||
virtual ~DropOverlayCross();
|
virtual ~DropOverlayCross();
|
||||||
|
|
||||||
DropArea cursorLocation() const;
|
DropArea cursorLocation() const;
|
||||||
void setupOverlayCross(DropOverlay::eMode Mode);
|
void setupOverlayCross(DropOverlay::eMode Mode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent* e);
|
virtual void showEvent(QShowEvent* e);
|
||||||
void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
|
void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reset();
|
void reset();
|
||||||
QPoint areaGridPosition(const DropArea area);
|
QPoint areaGridPosition(const DropArea area);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DropOverlay::eMode m_Mode = DropOverlay::ModeSectionOverlay;
|
DropOverlay::eMode m_Mode = DropOverlay::ModeSectionOverlay;
|
||||||
DropOverlay* m_DropOverlay;
|
DropOverlay* m_DropOverlay;
|
||||||
QHash<DropArea, QWidget*> m_DropIndicatorWidgets;
|
QHash<DropArea, QWidget*> m_DropIndicatorWidgets;
|
||||||
QGridLayout* m_GridLayout;
|
QGridLayout* m_GridLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,114 +1,114 @@
|
|||||||
#ifndef FLOATINGWIDGET_H
|
#ifndef FLOATINGWIDGET_H
|
||||||
#define FLOATINGWIDGET_H
|
#define FLOATINGWIDGET_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
class SectionTitleWidget;
|
class SectionTitleWidget;
|
||||||
class CSectionContentWidget;
|
class CSectionContentWidget;
|
||||||
class InternalContentData;
|
class InternalContentData;
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
class CContainerWidget;
|
class CContainerWidget;
|
||||||
class FloatingWidget;
|
class FloatingWidget;
|
||||||
|
|
||||||
class CFloatingTitleWidget : public QFrame
|
class CFloatingTitleWidget : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QPoint m_DragStartPosition;
|
QPoint m_DragStartPosition;
|
||||||
QPoint m_DragStartMousePosition;
|
QPoint m_DragStartMousePosition;
|
||||||
FloatingWidget* floatingWidget() const;
|
FloatingWidget* floatingWidget() const;
|
||||||
CMainContainerWidget* mainContainerWidget() const;
|
CMainContainerWidget* mainContainerWidget() const;
|
||||||
void moveFloatingWidget(QMouseEvent* ev);
|
void moveFloatingWidget(QMouseEvent* ev);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onMaximizeButtonClicked();
|
void onMaximizeButtonClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent* ev);
|
virtual void mousePressEvent(QMouseEvent* ev);
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFloatingTitleWidget(SectionContent::Flags Flags, FloatingWidget* Parent);
|
CFloatingTitleWidget(SectionContent::Flags Flags, FloatingWidget* Parent);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closeButtonClicked();
|
void closeButtonClicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// FloatingWidget holds and displays SectionContent as a floating window.
|
// FloatingWidget holds and displays SectionContent as a floating window.
|
||||||
// It can be resized, moved and dropped back into a SectionWidget.
|
// It can be resized, moved and dropped back into a SectionWidget.
|
||||||
class FloatingWidget : public QWidget
|
class FloatingWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class CMainContainerWidget;
|
friend class CMainContainerWidget;
|
||||||
friend class CFloatingTitleWidget;
|
friend class CFloatingTitleWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FloatingWidget(CMainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent = NULL);
|
FloatingWidget(CMainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent = NULL);
|
||||||
FloatingWidget(CMainContainerWidget* container, SectionWidget* sectionWidget);
|
FloatingWidget(CMainContainerWidget* container, SectionWidget* sectionWidget);
|
||||||
virtual ~FloatingWidget();
|
virtual ~FloatingWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current zOrderIndex
|
* Returns the current zOrderIndex
|
||||||
*/
|
*/
|
||||||
unsigned int zOrderIndex() const;
|
unsigned int zOrderIndex() const;
|
||||||
|
|
||||||
CContainerWidget* containerWidget() const {return m_ContainerWidget;}
|
CContainerWidget* containerWidget() const {return m_ContainerWidget;}
|
||||||
CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;}
|
CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;}
|
||||||
|
|
||||||
public://private:
|
public://private:
|
||||||
bool takeContent(InternalContentData& data);
|
bool takeContent(InternalContentData& data);
|
||||||
|
|
||||||
void startFloating(const QPoint& Pos);
|
void startFloating(const QPoint& Pos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void changeEvent(QEvent *event) override;
|
virtual void changeEvent(QEvent *event) override;
|
||||||
virtual void moveEvent(QMoveEvent *event) override;
|
virtual void moveEvent(QMoveEvent *event) override;
|
||||||
virtual bool event(QEvent *e);
|
virtual bool event(QEvent *e);
|
||||||
void titleMouseReleaseEvent();
|
void titleMouseReleaseEvent();
|
||||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
void updateDropOverlays(const QPoint& GlobalPos);
|
void updateDropOverlays(const QPoint& GlobalPos);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCloseButtonClicked();
|
void onCloseButtonClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setDraggingActive(bool Active);
|
void setDraggingActive(bool Active);
|
||||||
|
|
||||||
CMainContainerWidget* m_MainContainerWidget;
|
CMainContainerWidget* m_MainContainerWidget;
|
||||||
CContainerWidget* m_ContainerWidget;
|
CContainerWidget* m_ContainerWidget;
|
||||||
CContainerWidget* m_DropContainer;
|
CContainerWidget* m_DropContainer;
|
||||||
bool m_DraggingActive = false;
|
bool m_DraggingActive = false;
|
||||||
unsigned int m_zOrderIndex = 0;
|
unsigned int m_zOrderIndex = 0;
|
||||||
QPoint m_DragStartPosition;
|
QPoint m_DragStartPosition;
|
||||||
QPoint m_DragStartMousePosition;
|
QPoint m_DragStartMousePosition;
|
||||||
static unsigned int zOrderCounter;
|
static unsigned int zOrderCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,67 +1,67 @@
|
|||||||
#ifndef ADS_INTERNAL_HEADER
|
#ifndef ADS_INTERNAL_HEADER
|
||||||
#define ADS_INTERNAL_HEADER
|
#define ADS_INTERNAL_HEADER
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
#else
|
#else
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class SectionContent;
|
class SectionContent;
|
||||||
class SectionTitleWidget;
|
class SectionTitleWidget;
|
||||||
class CSectionContentWidget;
|
class CSectionContentWidget;
|
||||||
|
|
||||||
|
|
||||||
class InternalContentData
|
class InternalContentData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<InternalContentData> RefPtr;
|
typedef QSharedPointer<InternalContentData> RefPtr;
|
||||||
typedef QWeakPointer<InternalContentData> WeakPtr;
|
typedef QWeakPointer<InternalContentData> WeakPtr;
|
||||||
|
|
||||||
InternalContentData();
|
InternalContentData();
|
||||||
~InternalContentData();
|
~InternalContentData();
|
||||||
|
|
||||||
QSharedPointer<SectionContent> content;
|
QSharedPointer<SectionContent> content;
|
||||||
SectionTitleWidget* titleWidget;
|
SectionTitleWidget* titleWidget;
|
||||||
CSectionContentWidget* contentWidget;
|
CSectionContentWidget* contentWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class HiddenSectionItem
|
class HiddenSectionItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HiddenSectionItem() :
|
HiddenSectionItem() :
|
||||||
preferredSectionId(-1),
|
preferredSectionId(-1),
|
||||||
preferredSectionIndex(-1)
|
preferredSectionIndex(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int preferredSectionId;
|
int preferredSectionId;
|
||||||
int preferredSectionIndex;
|
int preferredSectionIndex;
|
||||||
InternalContentData data;
|
InternalContentData data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,95 +1,95 @@
|
|||||||
#ifndef SECTIONCONTENT_H
|
#ifndef SECTIONCONTENT_H
|
||||||
#define SECTIONCONTENT_H
|
#define SECTIONCONTENT_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
|
|
||||||
class ADS_EXPORT_API SectionContent
|
class ADS_EXPORT_API SectionContent
|
||||||
{
|
{
|
||||||
friend class CMainContainerWidget;
|
friend class CMainContainerWidget;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SectionContent();
|
SectionContent();
|
||||||
SectionContent(const SectionContent&);
|
SectionContent(const SectionContent&);
|
||||||
SectionContent& operator=(const SectionContent&);
|
SectionContent& operator=(const SectionContent&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<SectionContent> RefPtr;
|
typedef QSharedPointer<SectionContent> RefPtr;
|
||||||
typedef QWeakPointer<SectionContent> WeakPtr;
|
typedef QWeakPointer<SectionContent> WeakPtr;
|
||||||
|
|
||||||
enum Flag
|
enum Flag
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Closeable = 1,
|
Closeable = 1,
|
||||||
Maximizable = 2,
|
Maximizable = 2,
|
||||||
AllFlags = Closeable | Maximizable
|
AllFlags = Closeable | Maximizable
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
Q_DECLARE_FLAGS(Flags, Flag)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Creates new content, associates it to <em>container</em> and takes ownership of
|
* Creates new content, associates it to <em>container</em> and takes ownership of
|
||||||
* <em>title</em>- and <em>content</em>- widgets.
|
* <em>title</em>- and <em>content</em>- widgets.
|
||||||
* \param uniqueName An unique identifier across the entire process.
|
* \param uniqueName An unique identifier across the entire process.
|
||||||
* \param container The parent ContainerWidget in which this content will be active.
|
* \param container The parent ContainerWidget in which this content will be active.
|
||||||
* \param title The widget to use as title.
|
* \param title The widget to use as title.
|
||||||
* \param content The widget to use as content.
|
* \param content The widget to use as content.
|
||||||
* \return May return a invalid ref-pointer in case of invalid parameters.
|
* \return May return a invalid ref-pointer in case of invalid parameters.
|
||||||
*/
|
*/
|
||||||
static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content);
|
static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content);
|
||||||
|
|
||||||
virtual ~SectionContent();
|
virtual ~SectionContent();
|
||||||
int uid() const;
|
int uid() const;
|
||||||
QString uniqueName() const;
|
QString uniqueName() const;
|
||||||
CMainContainerWidget* containerWidget() const;
|
CMainContainerWidget* containerWidget() const;
|
||||||
QWidget* titleWidgetContent() const;
|
QWidget* titleWidgetContent() const;
|
||||||
QWidget* contentWidget() const;
|
QWidget* contentWidget() const;
|
||||||
Flags flags() const;
|
Flags flags() const;
|
||||||
|
|
||||||
QString visibleTitle() const;
|
QString visibleTitle() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
void setTitle(const QString& title);
|
void setTitle(const QString& title);
|
||||||
void setFlags(const Flags f);
|
void setFlags(const Flags f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int _uid;
|
const int _uid;
|
||||||
QString _uniqueName;
|
QString _uniqueName;
|
||||||
|
|
||||||
QPointer<CMainContainerWidget> m_MainContainerWidget;
|
QPointer<CMainContainerWidget> m_MainContainerWidget;
|
||||||
QPointer<QWidget> m_TitleWidgetContent;
|
QPointer<QWidget> m_TitleWidgetContent;
|
||||||
QPointer<QWidget> m_ContentWidget;
|
QPointer<QWidget> m_ContentWidget;
|
||||||
|
|
||||||
// Optional attributes
|
// Optional attributes
|
||||||
QString _title;
|
QString _title;
|
||||||
Flags _flags;
|
Flags _flags;
|
||||||
|
|
||||||
/* Note: This method could be a problem in static build environment
|
/* Note: This method could be a problem in static build environment
|
||||||
* since it may begin with 0 for every module which uses ADS.
|
* since it may begin with 0 for every module which uses ADS.
|
||||||
*/
|
*/
|
||||||
static int GetNextUid();
|
static int GetNextUid();
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,85 +1,85 @@
|
|||||||
#ifndef SECTION_CONTENT_WIDGET_H
|
#ifndef SECTION_CONTENT_WIDGET_H
|
||||||
#define SECTION_CONTENT_WIDGET_H
|
#define SECTION_CONTENT_WIDGET_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
class SectionTitleWidget;
|
class SectionTitleWidget;
|
||||||
|
|
||||||
|
|
||||||
struct SectionContentWidgetPrivate;
|
struct SectionContentWidgetPrivate;
|
||||||
|
|
||||||
|
|
||||||
class CSectionContentWidget : public QFrame
|
class CSectionContentWidget : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
SectionContentWidgetPrivate* d;
|
SectionContentWidgetPrivate* d;
|
||||||
friend class SectionContentWidgetPrivate;
|
friend class SectionContentWidgetPrivate;
|
||||||
friend class CMainContainerWidget;
|
friend class CMainContainerWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Flag
|
enum Flag
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Closeable = 1,
|
Closeable = 1,
|
||||||
Maximizable = 2,
|
Maximizable = 2,
|
||||||
AllFlags = Closeable | Maximizable
|
AllFlags = Closeable | Maximizable
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
Q_DECLARE_FLAGS(Flags, Flag)
|
||||||
|
|
||||||
CSectionContentWidget(SectionContent::RefPtr c = SectionContent::RefPtr(), QWidget* parent = 0);
|
CSectionContentWidget(SectionContent::RefPtr c = SectionContent::RefPtr(), QWidget* parent = 0);
|
||||||
virtual ~CSectionContentWidget();
|
virtual ~CSectionContentWidget();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Creates new content, associates it to <em>container</em> and takes ownership of
|
* Creates new content, associates it to <em>container</em> and takes ownership of
|
||||||
* <em>title</em>- and <em>content</em>- widgets.
|
* <em>title</em>- and <em>content</em>- widgets.
|
||||||
* \param uniqueName An unique identifier across the entire process.
|
* \param uniqueName An unique identifier across the entire process.
|
||||||
* \param container The parent ContainerWidget in which this content will be active.
|
* \param container The parent ContainerWidget in which this content will be active.
|
||||||
* \param title The widget to use as title.
|
* \param title The widget to use as title.
|
||||||
* \param content The widget to use as content.
|
* \param content The widget to use as content.
|
||||||
* \return May return a invalid ref-pointer in case of invalid parameters.
|
* \return May return a invalid ref-pointer in case of invalid parameters.
|
||||||
*/
|
*/
|
||||||
static CSectionContentWidget* newSectionContent(const QString& uniqueName,
|
static CSectionContentWidget* newSectionContent(const QString& uniqueName,
|
||||||
CMainContainerWidget* container, QWidget* title, QWidget* content);
|
CMainContainerWidget* container, QWidget* title, QWidget* content);
|
||||||
|
|
||||||
int uid() const;
|
int uid() const;
|
||||||
QString uniqueName() const;
|
QString uniqueName() const;
|
||||||
CMainContainerWidget* containerWidget() const;
|
CMainContainerWidget* containerWidget() const;
|
||||||
QWidget* titleWidgetContent() const;
|
QWidget* titleWidgetContent() const;
|
||||||
QWidget* contentWidget() const;
|
QWidget* contentWidget() const;
|
||||||
Flags flags() const;
|
Flags flags() const;
|
||||||
|
|
||||||
QString visibleTitle() const;
|
QString visibleTitle() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
void setTitle(const QString& title);
|
void setTitle(const QString& title);
|
||||||
void setFlags(const Flags f);
|
void setFlags(const Flags f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SectionContent::RefPtr _content;
|
SectionContent::RefPtr _content;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
#endif
|
#endif
|
@ -1,78 +1,78 @@
|
|||||||
#ifndef SECTION_TITLE_WIDGET_H
|
#ifndef SECTION_TITLE_WIDGET_H
|
||||||
#define SECTION_TITLE_WIDGET_H
|
#define SECTION_TITLE_WIDGET_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
class SectionWidget;
|
class SectionWidget;
|
||||||
class FloatingWidget;
|
class FloatingWidget;
|
||||||
|
|
||||||
class SectionTitleWidget : public QFrame
|
class SectionTitleWidget : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged)
|
Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged)
|
||||||
|
|
||||||
friend class CMainContainerWidget;
|
friend class CMainContainerWidget;
|
||||||
friend class SectionWidget;
|
friend class SectionWidget;
|
||||||
friend class CContainerWidget;
|
friend class CContainerWidget;
|
||||||
|
|
||||||
SectionContent::RefPtr m_Content;
|
SectionContent::RefPtr m_Content;
|
||||||
|
|
||||||
// Drag & Drop (Floating)
|
// Drag & Drop (Floating)
|
||||||
QPoint m_DragStartMousePosition;
|
QPoint m_DragStartMousePosition;
|
||||||
QPoint m_DragStartGlobalMousePosition;
|
QPoint m_DragStartGlobalMousePosition;
|
||||||
QPoint m_DragStartPosition;
|
QPoint m_DragStartPosition;
|
||||||
|
|
||||||
// Drag & Drop (Title/Tabs)
|
// Drag & Drop (Title/Tabs)
|
||||||
bool m_TabMoving;
|
bool m_TabMoving;
|
||||||
|
|
||||||
// Property values
|
// Property values
|
||||||
bool m_IsActiveTab;
|
bool m_IsActiveTab;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent);
|
SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent);
|
||||||
virtual ~SectionTitleWidget();
|
virtual ~SectionTitleWidget();
|
||||||
|
|
||||||
bool isActiveTab() const;
|
bool isActiveTab() const;
|
||||||
void setActiveTab(bool active);
|
void setActiveTab(bool active);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent* ev);
|
virtual void mousePressEvent(QMouseEvent* ev);
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget);
|
void startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget);
|
||||||
void moveTab(QMouseEvent* ev);
|
void moveTab(QMouseEvent* ev);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activeTabChanged();
|
void activeTabChanged();
|
||||||
void clicked();
|
void clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,129 +1,129 @@
|
|||||||
#ifndef SECTION_WIDGET_H
|
#ifndef SECTION_WIDGET_H
|
||||||
#define SECTION_WIDGET_H
|
#define SECTION_WIDGET_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
class QStackedLayout;
|
class QStackedLayout;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/Internal.h"
|
#include "ads/Internal.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
#include "ads/FloatingWidget.h"
|
#include "ads/FloatingWidget.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class CMainContainerWidget;
|
class CMainContainerWidget;
|
||||||
class SectionTitleWidget;
|
class SectionTitleWidget;
|
||||||
class CSectionContentWidget;
|
class CSectionContentWidget;
|
||||||
|
|
||||||
// SectionWidget manages multiple instances of SectionContent.
|
// SectionWidget manages multiple instances of SectionContent.
|
||||||
// It displays a title TAB, which is clickable and will switch to
|
// It displays a title TAB, which is clickable and will switch to
|
||||||
// the contents associated to the title when clicked.
|
// the contents associated to the title when clicked.
|
||||||
class ADS_EXPORT_API SectionWidget : public QFrame
|
class ADS_EXPORT_API SectionWidget : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class CMainContainerWidget;
|
friend class CMainContainerWidget;
|
||||||
friend class CContainerWidget;
|
friend class CContainerWidget;
|
||||||
|
|
||||||
explicit SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent);
|
explicit SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~SectionWidget();
|
virtual ~SectionWidget();
|
||||||
|
|
||||||
int uid() const;
|
int uid() const;
|
||||||
CContainerWidget* containerWidget() const;
|
CContainerWidget* containerWidget() const;
|
||||||
|
|
||||||
QRect titleAreaGeometry() const;
|
QRect titleAreaGeometry() const;
|
||||||
QRect contentAreaGeometry() const;
|
QRect contentAreaGeometry() const;
|
||||||
|
|
||||||
const QList<SectionContent::RefPtr>& contents() const { return m_Contents; }
|
const QList<SectionContent::RefPtr>& contents() const { return m_Contents; }
|
||||||
void addContent(const SectionContent::RefPtr& c);
|
void addContent(const SectionContent::RefPtr& c);
|
||||||
void addContent(const InternalContentData& data, bool autoActivate);
|
void addContent(const InternalContentData& data, bool autoActivate);
|
||||||
bool takeContent(int uid, InternalContentData& data);
|
bool takeContent(int uid, InternalContentData& data);
|
||||||
bool takeContentAt(int Index, InternalContentData& data);
|
bool takeContentAt(int Index, InternalContentData& data);
|
||||||
int indexOfContent(const SectionContent::RefPtr& c) const;
|
int indexOfContent(const SectionContent::RefPtr& c) const;
|
||||||
int indexOfContentByUid(int uid) const;
|
int indexOfContentByUid(int uid) const;
|
||||||
int indexOfContentByTitlePos(const QPoint& pos, QWidget* exclude = NULL) const;
|
int indexOfContentByTitlePos(const QPoint& pos, QWidget* exclude = NULL) const;
|
||||||
|
|
||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
void moveContent(int from, int to);
|
void moveContent(int from, int to);
|
||||||
|
|
||||||
virtual bool eventFilter(QObject *watched, QEvent *event);
|
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
inline int contentCount() const {return m_ContentWidgets.size();}
|
inline int contentCount() const {return m_ContentWidgets.size();}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent*);
|
virtual void showEvent(QShowEvent*);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSectionTitleClicked();
|
void onSectionTitleClicked();
|
||||||
void onCloseButtonClicked();
|
void onCloseButtonClicked();
|
||||||
void onTabsMenuActionTriggered(bool);
|
void onTabsMenuActionTriggered(bool);
|
||||||
void updateTabsMenu();
|
void updateTabsMenu();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int _uid;
|
const int _uid;
|
||||||
QPointer<CMainContainerWidget> m_MainContainerWidget;
|
QPointer<CMainContainerWidget> m_MainContainerWidget;
|
||||||
QList<SectionContent::RefPtr> m_Contents;
|
QList<SectionContent::RefPtr> m_Contents;
|
||||||
QList<SectionTitleWidget*> m_TitleWidgets;
|
QList<SectionTitleWidget*> m_TitleWidgets;
|
||||||
QList<CSectionContentWidget*> m_ContentWidgets;
|
QList<CSectionContentWidget*> m_ContentWidgets;
|
||||||
|
|
||||||
QBoxLayout* _topLayout;
|
QBoxLayout* _topLayout;
|
||||||
QScrollArea* _tabsScrollArea;
|
QScrollArea* _tabsScrollArea;
|
||||||
QWidget* _tabsContainerWidget;
|
QWidget* _tabsContainerWidget;
|
||||||
QBoxLayout* _tabsLayout;
|
QBoxLayout* _tabsLayout;
|
||||||
QPushButton* _tabsMenuButton;
|
QPushButton* _tabsMenuButton;
|
||||||
QPushButton* _closeButton;
|
QPushButton* _closeButton;
|
||||||
int _tabsLayoutInitCount; // used for calculations on _tabsLayout modification calls.
|
int _tabsLayoutInitCount; // used for calculations on _tabsLayout modification calls.
|
||||||
|
|
||||||
QStackedLayout *_contentsLayout;
|
QStackedLayout *_contentsLayout;
|
||||||
|
|
||||||
QPoint _mousePressPoint;
|
QPoint _mousePressPoint;
|
||||||
SectionContent::RefPtr _mousePressContent;
|
SectionContent::RefPtr _mousePressContent;
|
||||||
SectionTitleWidget* _mousePressTitleWidget;
|
SectionTitleWidget* _mousePressTitleWidget;
|
||||||
|
|
||||||
static int GetNextUid();
|
static int GetNextUid();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Custom scrollable implementation for tabs */
|
/* Custom scrollable implementation for tabs */
|
||||||
class SectionWidgetTabsScrollArea : public QScrollArea
|
class SectionWidgetTabsScrollArea : public QScrollArea
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionWidgetTabsScrollArea(SectionWidget* sectionWidget, QWidget* parent = NULL);
|
SectionWidgetTabsScrollArea(SectionWidget* sectionWidget, QWidget* parent = NULL);
|
||||||
virtual ~SectionWidgetTabsScrollArea();
|
virtual ~SectionWidgetTabsScrollArea();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPoint _dragStartPos;
|
QPoint _dragStartPos;
|
||||||
QPointer<FloatingWidget> _fw;
|
QPointer<FloatingWidget> _fw;
|
||||||
virtual void wheelEvent(QWheelEvent*);
|
virtual void wheelEvent(QWheelEvent*);
|
||||||
virtual void mousePressEvent(QMouseEvent* ev);
|
virtual void mousePressEvent(QMouseEvent* ev);
|
||||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
#endif
|
#endif
|
@ -1,181 +1,181 @@
|
|||||||
#ifndef ADS_SERIALIZATION_H
|
#ifndef ADS_SERIALIZATION_H
|
||||||
#define ADS_SERIALIZATION_H
|
#define ADS_SERIALIZATION_H
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** QtAdcancedDockingSystem
|
** QtAdcancedDockingSystem
|
||||||
** Copyright (C) 2017 Uwe Kindler
|
** Copyright (C) 2017 Uwe Kindler
|
||||||
**
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** This program is distributed in the hope that it will be useful,
|
** This program is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
|
||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_SER_BEGIN
|
ADS_NAMESPACE_SER_BEGIN
|
||||||
|
|
||||||
enum EntryType
|
enum EntryType
|
||||||
{
|
{
|
||||||
ET_Unknown = 0x00000000,
|
ET_Unknown = 0x00000000,
|
||||||
ET_Hierarchy = 0x00000001,
|
ET_Hierarchy = 0x00000001,
|
||||||
ET_SectionIndex = 0x00000002,
|
ET_SectionIndex = 0x00000002,
|
||||||
|
|
||||||
// Begin of custom entry types (e.g. CustomType + 42)
|
// Begin of custom entry types (e.g. CustomType + 42)
|
||||||
ET_Custom = 0x0000ffff
|
ET_Custom = 0x0000ffff
|
||||||
};
|
};
|
||||||
|
|
||||||
class ADS_EXPORT_API HeaderEntity
|
class ADS_EXPORT_API HeaderEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static qint32 MAGIC;
|
static qint32 MAGIC;
|
||||||
static qint32 MAJOR_VERSION;
|
static qint32 MAJOR_VERSION;
|
||||||
static qint32 MINOR_VERSION;
|
static qint32 MINOR_VERSION;
|
||||||
|
|
||||||
HeaderEntity();
|
HeaderEntity();
|
||||||
qint32 magic;
|
qint32 magic;
|
||||||
qint32 majorVersion;
|
qint32 majorVersion;
|
||||||
qint32 minorVersion;
|
qint32 minorVersion;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const HeaderEntity& data);
|
QDataStream& operator<<(QDataStream& out, const HeaderEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, HeaderEntity& data);
|
QDataStream& operator>>(QDataStream& in, HeaderEntity& data);
|
||||||
|
|
||||||
|
|
||||||
class ADS_EXPORT_API OffsetsHeaderEntity
|
class ADS_EXPORT_API OffsetsHeaderEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OffsetsHeaderEntity();
|
OffsetsHeaderEntity();
|
||||||
|
|
||||||
qint64 entriesCount;
|
qint64 entriesCount;
|
||||||
QList<class OffsetsHeaderEntryEntity> entries;
|
QList<class OffsetsHeaderEntryEntity> entries;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntity& data);
|
QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntity& data);
|
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntity& data);
|
||||||
|
|
||||||
|
|
||||||
class ADS_EXPORT_API OffsetsHeaderEntryEntity
|
class ADS_EXPORT_API OffsetsHeaderEntryEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OffsetsHeaderEntryEntity();
|
OffsetsHeaderEntryEntity();
|
||||||
qint32 type;
|
qint32 type;
|
||||||
qint64 offset;
|
qint64 offset;
|
||||||
qint64 contentSize;
|
qint64 contentSize;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntryEntity& data);
|
QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntryEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntryEntity& data);
|
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntryEntity& data);
|
||||||
|
|
||||||
|
|
||||||
class ADS_EXPORT_API SectionEntity
|
class ADS_EXPORT_API SectionEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionEntity();
|
SectionEntity();
|
||||||
qint32 x;
|
qint32 x;
|
||||||
qint32 y;
|
qint32 y;
|
||||||
qint32 width;
|
qint32 width;
|
||||||
qint32 height;
|
qint32 height;
|
||||||
qint32 currentIndex;
|
qint32 currentIndex;
|
||||||
qint32 sectionContentsCount;
|
qint32 sectionContentsCount;
|
||||||
QList<class SectionContentEntity> sectionContents;
|
QList<class SectionContentEntity> sectionContents;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const SectionEntity& data);
|
QDataStream& operator<<(QDataStream& out, const SectionEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, SectionEntity& data);
|
QDataStream& operator>>(QDataStream& in, SectionEntity& data);
|
||||||
|
|
||||||
|
|
||||||
class ADS_EXPORT_API SectionContentEntity
|
class ADS_EXPORT_API SectionContentEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionContentEntity();
|
SectionContentEntity();
|
||||||
QString uniqueName;
|
QString uniqueName;
|
||||||
bool visible;
|
bool visible;
|
||||||
qint32 preferredIndex;
|
qint32 preferredIndex;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const SectionContentEntity& data);
|
QDataStream& operator<<(QDataStream& out, const SectionContentEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, SectionContentEntity& data);
|
QDataStream& operator>>(QDataStream& in, SectionContentEntity& data);
|
||||||
|
|
||||||
|
|
||||||
class ADS_EXPORT_API FloatingContentEntity
|
class ADS_EXPORT_API FloatingContentEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FloatingContentEntity();
|
FloatingContentEntity();
|
||||||
QString uniqueName;
|
QString uniqueName;
|
||||||
qint32 xpos;
|
qint32 xpos;
|
||||||
qint32 ypos;
|
qint32 ypos;
|
||||||
qint32 width;
|
qint32 width;
|
||||||
qint32 height;
|
qint32 height;
|
||||||
bool visible;
|
bool visible;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const FloatingContentEntity& data);
|
QDataStream& operator<<(QDataStream& out, const FloatingContentEntity& data);
|
||||||
QDataStream& operator>>(QDataStream& in, FloatingContentEntity& data);
|
QDataStream& operator>>(QDataStream& in, FloatingContentEntity& data);
|
||||||
|
|
||||||
|
|
||||||
// Type: OffsetHeaderEntry::Hierarchy
|
// Type: OffsetHeaderEntry::Hierarchy
|
||||||
class ADS_EXPORT_API HierarchyData
|
class ADS_EXPORT_API HierarchyData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HierarchyData();
|
HierarchyData();
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const HierarchyData& data);
|
QDataStream& operator<<(QDataStream& out, const HierarchyData& data);
|
||||||
QDataStream& operator>>(QDataStream& in, HierarchyData& data);
|
QDataStream& operator>>(QDataStream& in, HierarchyData& data);
|
||||||
|
|
||||||
|
|
||||||
// Type: OffsetHeaderEntry::SectionIndex
|
// Type: OffsetHeaderEntry::SectionIndex
|
||||||
class ADS_EXPORT_API SectionIndexData
|
class ADS_EXPORT_API SectionIndexData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionIndexData();
|
SectionIndexData();
|
||||||
qint32 sectionsCount;
|
qint32 sectionsCount;
|
||||||
QList<SectionEntity> sections;
|
QList<SectionEntity> sections;
|
||||||
};
|
};
|
||||||
QDataStream& operator<<(QDataStream& out, const SectionIndexData& data);
|
QDataStream& operator<<(QDataStream& out, const SectionIndexData& data);
|
||||||
QDataStream& operator>>(QDataStream& in, SectionIndexData& data);
|
QDataStream& operator>>(QDataStream& in, SectionIndexData& data);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The InMemoryWriter class writes into a QByteArray.
|
* \brief The InMemoryWriter class writes into a QByteArray.
|
||||||
*/
|
*/
|
||||||
class ADS_EXPORT_API InMemoryWriter
|
class ADS_EXPORT_API InMemoryWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InMemoryWriter();
|
InMemoryWriter();
|
||||||
bool write(qint32 entryType, const QByteArray& data);
|
bool write(qint32 entryType, const QByteArray& data);
|
||||||
bool write(const SectionIndexData& data);
|
bool write(const SectionIndexData& data);
|
||||||
QByteArray toByteArray() const;
|
QByteArray toByteArray() const;
|
||||||
qint32 offsetsCount() const { return _offsetsHeader.entriesCount; }
|
qint32 offsetsCount() const { return _offsetsHeader.entriesCount; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QBuffer _contentBuffer;
|
QBuffer _contentBuffer;
|
||||||
OffsetsHeaderEntity _offsetsHeader;
|
OffsetsHeaderEntity _offsetsHeader;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The InMemoryReader class
|
* \brief The InMemoryReader class
|
||||||
*/
|
*/
|
||||||
class ADS_EXPORT_API InMemoryReader
|
class ADS_EXPORT_API InMemoryReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InMemoryReader(const QByteArray& data);
|
InMemoryReader(const QByteArray& data);
|
||||||
bool initReadHeader();
|
bool initReadHeader();
|
||||||
bool read(qint32 entryType, QByteArray &data);
|
bool read(qint32 entryType, QByteArray &data);
|
||||||
bool read(SectionIndexData& sid);
|
bool read(SectionIndexData& sid);
|
||||||
qint32 offsetsCount() const { return _offsetsHeader.entriesCount; }
|
qint32 offsetsCount() const { return _offsetsHeader.entriesCount; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray _data;
|
QByteArray _data;
|
||||||
OffsetsHeaderEntity _offsetsHeader;
|
OffsetsHeaderEntity _offsetsHeader;
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_SER_END
|
ADS_NAMESPACE_SER_END
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user