qskinny/examples/iotdashboard/StoragePage.h

51 lines
1.4 KiB
C
Raw Normal View History

2023-01-02 09:42:41 +01:00
/******************************************************************************
2023-01-05 17:08:50 +01:00
* Copyright (C) 2022 Edelhirsch Software GmbH
2023-04-06 10:15:03 +02:00
* SPDX-License-Identifier: BSD-3-Clause
2023-01-02 09:42:41 +01:00
*****************************************************************************/
#pragma once
2023-01-05 17:08:50 +01:00
#include <QVector>
2023-01-02 09:42:41 +01:00
#include <QskLinearBox.h>
2023-01-05 17:08:50 +01:00
#include <memory>
2023-01-02 09:42:41 +01:00
2023-01-05 17:08:50 +01:00
class QQuickItem;
2023-01-02 09:42:41 +01:00
2023-01-05 17:08:50 +01:00
class StoragePage final : public QskLinearBox
{
2023-01-02 09:42:41 +01:00
public:
QSK_SUBCONTROLS( Panel )
2023-01-05 17:08:50 +01:00
explicit StoragePage( QQuickItem* parent = nullptr );
private:
struct Storage
{
struct Media
{
qreal pictures = 0;
qreal music = 0;
qreal videos = 0;
qreal documents = 0;
qreal others = 0;
inline constexpr bool operator==( const Media& rhs ) const noexcept
{
return pictures == rhs.pictures && music == rhs.music && videos == rhs.videos &&
documents == rhs.documents && others == rhs.others;
}
inline constexpr qreal free() const noexcept
{
return 1.0 - pictures - music - videos - documents - others;
}
};
QString title;
QString description;
2023-01-05 19:29:43 +01:00
Media distribution;
2023-01-05 17:08:50 +01:00
};
2023-01-02 09:42:41 +01:00
2023-01-05 19:29:43 +01:00
void addRow( const QString& title, const QString& description,
qreal pictures, qreal music, qreal videos, qreal documents, qreal others );
2023-01-02 09:42:41 +01:00
};