2021-04-29 07:49:08 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (C) 2021 Edelhirsch Software GmbH
|
2023-04-06 10:15:03 +02:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2021-04-29 07:49:08 +02:00
|
|
|
*****************************************************************************/
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2022-07-14 14:26:45 +02:00
|
|
|
#include "DashboardPage.h"
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
#include "Box.h"
|
|
|
|
#include "BoxWithButtons.h"
|
|
|
|
#include "UsageDiagram.h"
|
2021-11-19 15:02:57 +01:00
|
|
|
#include "LightDisplay.h"
|
2022-07-14 14:35:57 +02:00
|
|
|
#include "GridBox.h"
|
2021-04-26 06:22:35 +02:00
|
|
|
#include "MyDevices.h"
|
|
|
|
#include "TopBar.h"
|
2021-08-04 18:55:18 +02:00
|
|
|
#include "UsageBox.h"
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
#include <QskBoxBorderColors.h>
|
|
|
|
#include <QskBoxBorderMetrics.h>
|
|
|
|
#include <QskBoxShapeMetrics.h>
|
|
|
|
#include <QskGridBox.h>
|
|
|
|
#include <QskSetup.h>
|
|
|
|
#include <QskSkin.h>
|
|
|
|
#include <QskTextLabel.h>
|
2021-04-26 08:16:06 +02:00
|
|
|
#include <QskQuick.h>
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
2022-07-14 14:26:45 +02:00
|
|
|
QSK_SUBCONTROL( DashboardPage, Panel )
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class IndoorTemperature : public BoxWithButtons
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
IndoorTemperature( QQuickItem* parent = nullptr )
|
2022-12-17 11:06:47 +01:00
|
|
|
: BoxWithButtons( "Indoor Temperature", "+", 24, {}, true, parent )
|
2021-08-04 18:55:18 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Humidity : public BoxWithButtons
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Humidity( QQuickItem* parent = nullptr )
|
2022-12-17 11:06:47 +01:00
|
|
|
: BoxWithButtons( "Humidity", {}, 30, "%", false, parent )
|
2021-08-04 18:55:18 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class LightIntensity : public Box
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LightIntensity( QQuickItem* parent = nullptr )
|
|
|
|
: Box( "Light intensity", parent )
|
|
|
|
{
|
2021-11-19 15:02:57 +01:00
|
|
|
addSpacer( 5 );
|
|
|
|
auto* lightDisplay = new LightDisplay( this );
|
|
|
|
lightDisplay->setValue( 50.0 );
|
2021-08-04 18:55:18 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-07-14 14:26:45 +02:00
|
|
|
DashboardPage::DashboardPage( QQuickItem* parent )
|
2021-08-04 09:31:16 +02:00
|
|
|
: QskLinearBox( Qt::Vertical, parent )
|
2021-04-26 06:22:35 +02:00
|
|
|
{
|
2021-08-04 15:06:04 +02:00
|
|
|
setPanel( true );
|
2022-07-14 14:26:45 +02:00
|
|
|
setSubcontrolProxy( QskBox::Panel, DashboardPage::Panel );
|
2021-08-04 15:06:04 +02:00
|
|
|
|
2021-04-26 06:22:35 +02:00
|
|
|
setAutoAddChildren( false );
|
|
|
|
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
|
|
|
setDefaultAlignment( Qt::AlignTop );
|
|
|
|
setSpacing( 24 );
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
auto topBar = new TopBar();
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
auto gridBox = new MainContentGridBox();
|
2021-04-26 06:22:35 +02:00
|
|
|
gridBox->setPanel( true );
|
|
|
|
gridBox->setSpacing( 15 );
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
gridBox->addItem( new UsageBox(), 0, 0, 2, 1 );
|
|
|
|
gridBox->addItem( new IndoorTemperature(), 0, 1 );
|
|
|
|
gridBox->addItem( new Humidity(), 1, 1 );
|
|
|
|
gridBox->addItem( new MyDevices(), 0, 2, 2, 1 );
|
2022-07-14 14:43:21 +02:00
|
|
|
gridBox->addItem( new UsageDiagramBox( QString(), new UsageDiagram ), 2, 0, 0, 2 );
|
2021-08-04 18:55:18 +02:00
|
|
|
gridBox->addItem( new LightIntensity(), 2, 2 );
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
gridBox->setColumnStretchFactor( 0, 37 ); // factors add up to 100
|
|
|
|
gridBox->setColumnStretchFactor( 1, 37 );
|
|
|
|
gridBox->setColumnStretchFactor( 2, 26 );
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
addItem( topBar );
|
|
|
|
addItem( gridBox );
|
2021-04-26 06:22:35 +02:00
|
|
|
}
|
2021-04-26 08:43:46 +02:00
|
|
|
|
2022-07-14 14:26:45 +02:00
|
|
|
#include "moc_DashboardPage.cpp"
|