Added dummy class for stack chart view.

This commit is contained in:
23rd 2023-08-28 00:44:50 +03:00 committed by John Preston
parent 11b932707c
commit b55d2008c0
5 changed files with 124 additions and 0 deletions

View File

@ -1300,6 +1300,8 @@ PRIVATE
statistics/view/chart_view_factory.h
statistics/view/linear_chart_view.cpp
statistics/view/linear_chart_view.h
statistics/view/stack_chart_view.cpp
statistics/view/stack_chart_view.h
storage/details/storage_file_utilities.cpp
storage/details/storage_file_utilities.h
storage/details/storage_settings_scheme.cpp

View File

@ -16,6 +16,7 @@ struct Limits final {
enum class ChartViewType {
Linear,
Stack,
};
} // namespace Statistic

View File

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "statistics/statistics_common.h"
#include "statistics/view/linear_chart_view.h"
#include "statistics/view/stack_chart_view.h"
namespace Statistic {
@ -17,6 +18,9 @@ std::unique_ptr<AbstractChartView> CreateChartView(ChartViewType type) {
case ChartViewType::Linear: {
return std::make_unique<LinearChartView>();
} break;
case ChartViewType::Stack: {
return std::make_unique<StackChartView>();
} break;
default: Unexpected("Type in Statistic::CreateChartView.");
}
}

View File

@ -0,0 +1,61 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "statistics/view/stack_chart_view.h"
namespace Statistic {
namespace {
} // namespace
StackChartView::StackChartView() = default;
StackChartView::~StackChartView() = default;
void StackChartView::paint(
QPainter &p,
const Data::StatisticalChart &chartData,
const Limits &xIndices,
const Limits &xPercentageLimits,
const Limits &heightLimits,
const QRect &rect,
bool footer) {
}
void StackChartView::paintSelectedXIndex(
QPainter &p,
const Data::StatisticalChart &chartData,
const Limits &xPercentageLimits,
const Limits &heightLimits,
const QRect &rect,
int selectedXIndex) {
}
void StackChartView::setEnabled(int id, bool enabled, crl::time now) {
}
bool StackChartView::isFinished() const {
return true;
}
bool StackChartView::isEnabled(int id) const {
return true;
}
float64 StackChartView::alpha(int id) const {
return 1.0;
}
AbstractChartView::HeightLimits StackChartView::heightLimits(
Data::StatisticalChart &chartData,
Limits xIndices) {
return {};
}
void StackChartView::tick(crl::time now) {
}
} // namespace Statistic

View File

@ -0,0 +1,56 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "statistics/statistics_common.h"
#include "statistics/view/abstract_chart_view.h"
namespace Data {
struct StatisticalChart;
} // namespace Data
namespace Statistic {
struct Limits;
class StackChartView final : public AbstractChartView {
public:
StackChartView();
~StackChartView() override final;
void paint(
QPainter &p,
const Data::StatisticalChart &chartData,
const Limits &xIndices,
const Limits &xPercentageLimits,
const Limits &heightLimits,
const QRect &rect,
bool footer) override;
void paintSelectedXIndex(
QPainter &p,
const Data::StatisticalChart &chartData,
const Limits &xPercentageLimits,
const Limits &heightLimits,
const QRect &rect,
int selectedXIndex) override;
void setEnabled(int id, bool enabled, crl::time now) override;
[[nodiscard]] bool isEnabled(int id) const override;
[[nodiscard]] bool isFinished() const override;
[[nodiscard]] float64 alpha(int id) const override;
[[nodiscard]] HeightLimits heightLimits(
Data::StatisticalChart &chartData,
Limits xIndices) override;
void tick(crl::time now) override;
};
} // namespace Statistic