init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
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 "data/data_statistics_chart.h"
|
||||
#include "ui/abstract_button.h"
|
||||
|
||||
namespace Ui {
|
||||
class RippleAnimation;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Statistic {
|
||||
|
||||
void PaintDetails(
|
||||
QPainter &p,
|
||||
const Data::StatisticalChart::Line &line,
|
||||
int absoluteValue,
|
||||
const QRect &rect);
|
||||
|
||||
class PointDetailsWidget : public Ui::AbstractButton {
|
||||
public:
|
||||
PointDetailsWidget(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
const Data::StatisticalChart &chartData,
|
||||
bool zoomEnabled);
|
||||
|
||||
[[nodiscard]] int xIndex() const;
|
||||
void setXIndex(int xIndex);
|
||||
void setAlpha(float64 alpha);
|
||||
[[nodiscard]] float64 alpha() const;
|
||||
void setLineAlpha(int lineId, float64 alpha);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
|
||||
private:
|
||||
const bool _zoomEnabled;
|
||||
const Data::StatisticalChart &_chartData;
|
||||
const style::TextStyle &_textStyle;
|
||||
const style::TextStyle &_headerStyle;
|
||||
Ui::Text::String _header;
|
||||
QImage _valueIcon;
|
||||
|
||||
void invalidateCache();
|
||||
|
||||
[[nodiscard]] int lineYAt(int index) const;
|
||||
|
||||
void resizeHeight();
|
||||
|
||||
struct Line final {
|
||||
int id = 0;
|
||||
Ui::Text::String name;
|
||||
Ui::Text::String value;
|
||||
Ui::Text::String percentage;
|
||||
QColor valueColor;
|
||||
float64 alpha = 1.;
|
||||
};
|
||||
|
||||
bool _hasPositiveValues = true;
|
||||
|
||||
int _maxPercentageWidth = 0;
|
||||
|
||||
QRect _innerRect;
|
||||
QRect _textRect;
|
||||
QImage _arrow;
|
||||
|
||||
QImage _cache;
|
||||
|
||||
int _xIndex = -1;
|
||||
float64 _alpha = 1.;
|
||||
|
||||
std::vector<Line> _lines;
|
||||
|
||||
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Statistic
|
||||
Reference in New Issue
Block a user