IOT dashboard: Move some classes around

This commit is contained in:
Peter Hartmann 2022-07-14 14:35:57 +02:00 committed by uwerat
parent 520bb0a429
commit cfab871ad8
8 changed files with 152 additions and 15 deletions

View File

@ -9,6 +9,7 @@
#include "BoxWithButtons.h"
#include "UsageDiagram.h"
#include "LightDisplay.h"
#include "GridBox.h"
#include "MyDevices.h"
#include "PieChart.h"
#include "TopBar.h"
@ -26,7 +27,6 @@
#include <QTimer>
QSK_SUBCONTROL( DashboardPage, Panel )
QSK_SUBCONTROL( MainContentGridBox, Panel )
namespace
{

View File

@ -8,20 +8,6 @@
#include <QskGridBox.h>
#include <QskLinearBox.h>
class MainContentGridBox : public QskGridBox
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
MainContentGridBox( QQuickItem* parent = nullptr )
: QskGridBox( parent )
{
setSubcontrolProxy( QskGridBox::Panel, Panel );
}
};
class DashboardPage : public QskLinearBox
{
Q_OBJECT

View File

@ -0,0 +1,10 @@
/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "GridBox.h"
QSK_SUBCONTROL( MainContentGridBox, Panel )
#include "moc_GridBox.cpp"

View File

@ -0,0 +1,23 @@
/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
#include <QskGridBox.h>
#include <QskLinearBox.h>
class MainContentGridBox : public QskGridBox
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
MainContentGridBox( QQuickItem* parent = nullptr )
: QskGridBox( parent )
{
setSubcontrolProxy( QskGridBox::Panel, Panel );
}
};

View File

@ -0,0 +1,91 @@
/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "RoomsPage.h"
#include "Box.h"
#include "BoxWithButtons.h"
#include "GridBox.h"
#include "LightDisplay.h"
#include "MyDevices.h"
#include "PieChart.h"
#include "TopBar.h"
#include "UsageBox.h"
#include "UsageDiagram.h"
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
#include <QskBoxShapeMetrics.h>
#include <QskGridBox.h>
#include <QskSetup.h>
#include <QskSkin.h>
#include <QskTextLabel.h>
#include <QskQuick.h>
#include <QTimer>
QSK_SUBCONTROL( RoomsPage, Panel )
namespace
{
class IndoorTemperature : public BoxWithButtons
{
public:
IndoorTemperature( QQuickItem* parent = nullptr )
: BoxWithButtons( "Indoor Temperature", "+24", true, parent )
{
}
};
class Humidity : public BoxWithButtons
{
public:
Humidity( QQuickItem* parent = nullptr )
: BoxWithButtons( "Humidity", "30%", false, parent )
{
}
};
class LightIntensity : public Box
{
public:
LightIntensity( QQuickItem* parent = nullptr )
: Box( "Light intensity", parent )
{
addSpacer( 5 );
auto* lightDisplay = new LightDisplay( this );
lightDisplay->setValue( 50.0 );
}
};
}
RoomsPage::RoomsPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
setPanel( true );
setSubcontrolProxy( QskBox::Panel, RoomsPage::Panel );
setAutoAddChildren( false );
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
setDefaultAlignment( Qt::AlignTop );
setSpacing( 24 );
auto topBar = new TopBar();
auto gridBox = new MainContentGridBox();
gridBox->setPanel( true );
gridBox->setSpacing( 15 );
gridBox->addItem( new UsageBox(), 0, 0, 2, 1 );
gridBox->setColumnStretchFactor( 0, 37 ); // factors add up to 100
gridBox->setColumnStretchFactor( 1, 37 );
gridBox->setColumnStretchFactor( 2, 26 );
addItem( topBar );
addItem( gridBox );
}
#include "moc_RoomsPage.cpp"

View File

@ -0,0 +1,22 @@
/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
#include <QskGridBox.h>
#include <QskLinearBox.h>
class RoomsPage : public QskLinearBox
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
RoomsPage( QQuickItem* parent );
private:
QList< QskLinearBox* > m_columns;
};

View File

@ -11,6 +11,7 @@
#include "CircularProgressBarSkinlet.h"
#include "Diagram.h"
#include "DiagramSkinlet.h"
#include "GridBox.h"
#include "LightDisplay.h"
#include "LightDisplaySkinlet.h"
#include "DashboardPage.h"

View File

@ -12,6 +12,7 @@ SOURCES += \
Diagram.cpp \
DiagramSkinlet.cpp \
GraphicProvider.cpp \
GridBox.cpp \
LightDisplaySkinlet.cpp \
LightDisplay.cpp \
MainItem.cpp \
@ -20,6 +21,7 @@ SOURCES += \
PieChart.cpp \
PieChartPainted.cpp \
PieChartSkinlet.cpp \
RoomsPage.cpp \
RoundedIcon.cpp \
ShadowedBox.cpp \
Skin.cpp \
@ -43,6 +45,7 @@ HEADERS += \
Diagram.h \
DiagramSkinlet.h \
GraphicProvider.h \
GridBox.h \
LightDisplaySkinlet.h \
LightDisplay.h \
DashboardPage.h \
@ -53,6 +56,7 @@ HEADERS += \
PieChart.h \
PieChartPainted.h \
PieChartSkinlet.h \
RoomsPage.h \
RoundedIcon.h \
ShadowedBox.h \
Skin.h \