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

@@ -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();
};