Refactorings to improve code, started to refactor secion content

This commit is contained in:
Uwe Kindler
2017-02-22 22:33:48 +01:00
parent 938afb7357
commit ad49745b18
22 changed files with 301 additions and 140 deletions

View File

@@ -21,7 +21,7 @@
static int CONTENT_COUNT = 0;
static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::MainContainerWidget* container)
static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::CMainContainerWidget* container)
{
QWidget* w = new QWidget();
QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom);
@@ -39,7 +39,7 @@ static ADS_NS::SectionContent::RefPtr createLongTextLabelSC(ADS_NS::MainContaine
return sc;
}
static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::MainContainerWidget* container)
static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::CMainContainerWidget* container)
{
QCalendarWidget* w = new QCalendarWidget();
@@ -47,7 +47,7 @@ static ADS_NS::SectionContent::RefPtr createCalendarSC(ADS_NS::MainContainerWidg
return ADS_NS::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::MainContainerWidget* container)
static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC(ADS_NS::CMainContainerWidget* container)
{
QTreeView* w = new QTreeView();
w->setFrameShape(QFrame::NoFrame);
@@ -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::MainContainerWidget();
_container = new ADS_NS::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,7 +117,7 @@ void MainWindow::createContent()
{
// ADS - Adding some contents.
// Test #1: Use high-level public API
ADS_NS::MainContainerWidget* cw = _container;
ADS_NS::CMainContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = nullptr;
sw = _container->addSectionContent(createLongTextLabelSC(cw), nullptr, ADS_NS::CenterDropArea);
@@ -136,7 +136,7 @@ void MainWindow::createContent()
#if 0
// Issue #2: If the first drop is not into CenterDropArea, the application crashes.
ADS_NS::MainContainerWidget* cw = _container;
ADS_NS::CMainContainerWidget* cw = _container;
ADS_NS::SectionWidget* sw = NULL;
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::LeftDropArea);
@@ -162,7 +162,7 @@ void MainWindow::showSectionContentListDialog()
void MainWindow::onActiveTabChanged(const ADS_NS::SectionContent::RefPtr& sc, bool active)
{
Q_UNUSED(active);
IconTitleWidget* itw = dynamic_cast<IconTitleWidget*>(sc->titleWidget());
IconTitleWidget* itw = dynamic_cast<IconTitleWidget*>(sc->titleWidgetContent());
if (itw)
{
itw->polishUpdate();