mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added line with converted currency amount to point details widget.
This commit is contained in:
parent
d3cd3bb0a4
commit
5dd974f2ab
4 changed files with 30 additions and 7 deletions
|
@ -5017,6 +5017,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_channel_earn_learn_close" = "Got it";
|
||||
"lng_channel_earn_chart_top_hours" = "Ad impressions";
|
||||
"lng_channel_earn_chart_revenue" = "Ad revenue";
|
||||
"lng_channel_earn_chart_overriden_detail_currency" = "Revenue in TON";
|
||||
"lng_channel_earn_chart_overriden_detail_usd" = "Revenue in USD";
|
||||
|
||||
"lng_contact_add" = "Add";
|
||||
"lng_contact_send_message" = "message";
|
||||
|
|
|
@ -430,7 +430,7 @@ void InnerWidget::fill() {
|
|||
object_ptr<Statistic::ChartWidget>(container),
|
||||
st::statisticsLayerMargins);
|
||||
|
||||
widget->setChartData(data.topHoursGraph.chart, Type::Linear);
|
||||
widget->setChartData(data.topHoursGraph.chart, Type::Bar);
|
||||
widget->setTitle(tr::lng_channel_earn_chart_top_hours());
|
||||
}
|
||||
if (data.revenueGraph.chart) {
|
||||
|
|
|
@ -42,7 +42,7 @@ void ChartRulersView::setChartData(
|
|||
return FormatF(value / float64(Data::kEarnMultiplier));
|
||||
};
|
||||
_rightCustomCaption = [=, rate = chartData.currencyRate](float64 v) {
|
||||
return Info::ChannelEarn::ToUsd(v, rate).mid(1);
|
||||
return Info::ChannelEarn::ToUsd(v, rate);
|
||||
};
|
||||
_rightPen = QPen(st::windowSubTextFg);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "statistics/widgets/point_details_widget.h"
|
||||
|
||||
#include "data/data_channel_earn.h" // Data::kEarnMultiplier.
|
||||
#include "info/channel_statistics/earn/earn_format.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "statistics/statistics_common.h"
|
||||
#include "statistics/statistics_format_values.h"
|
||||
#include "statistics/view/stack_linear_chart_common.h"
|
||||
|
@ -237,7 +239,7 @@ void PointDetailsWidget::setLineAlpha(int lineId, float64 alpha) {
|
|||
void PointDetailsWidget::resizeHeight() {
|
||||
resize(
|
||||
width(),
|
||||
lineYAt(_chartData.lines.size())
|
||||
lineYAt(_chartData.lines.size() + (_chartData.currencyRate ? 1 : 0))
|
||||
+ st::statisticsDetailsPopupMargins.bottom());
|
||||
}
|
||||
|
||||
|
@ -282,11 +284,30 @@ void PointDetailsWidget::setXIndex(int xIndex) {
|
|||
textLine.name.setText(_textStyle, dataLine.name);
|
||||
textLine.value.setText(
|
||||
_textStyle,
|
||||
_chartData.currencyRate
|
||||
? QString::number(dataLine.y[xIndex] / multiplier)
|
||||
: QString("%L1").arg(dataLine.y[xIndex]));
|
||||
QString("%L1").arg(dataLine.y[xIndex]));
|
||||
hasPositiveValues |= (dataLine.y[xIndex] > 0);
|
||||
textLine.valueColor = QColor(dataLine.color);
|
||||
if (_chartData.currencyRate) {
|
||||
auto copy = Line();
|
||||
copy.id = dataLine.id * 100;
|
||||
copy.valueColor = QColor(dataLine.color);
|
||||
copy.name.setText(
|
||||
_textStyle,
|
||||
tr::lng_channel_earn_chart_overriden_detail_currency(
|
||||
tr::now));
|
||||
copy.value.setText(
|
||||
_textStyle,
|
||||
QString::number(dataLine.y[xIndex] / multiplier));
|
||||
_lines.push_back(std::move(copy));
|
||||
textLine.name.setText(
|
||||
_textStyle,
|
||||
tr::lng_channel_earn_chart_overriden_detail_usd(tr::now));
|
||||
textLine.value.setText(
|
||||
_textStyle,
|
||||
Info::ChannelEarn::ToUsd(
|
||||
dataLine.y[xIndex],
|
||||
_chartData.currencyRate));
|
||||
}
|
||||
_lines.push_back(std::move(textLine));
|
||||
}
|
||||
const auto clickable = _zoomEnabled && hasPositiveValues;
|
||||
|
@ -387,7 +408,7 @@ void PointDetailsWidget::paintEvent(QPaintEvent *e) {
|
|||
.outerWidth = _textRect.width(),
|
||||
.availableWidth = valueWidth,
|
||||
};
|
||||
if (_valueIcon) {
|
||||
if (!i && _valueIcon) {
|
||||
_valueIcon->paint(
|
||||
p,
|
||||
valueContext.position.x() - _valueIcon->width(),
|
||||
|
|
Loading…
Add table
Reference in a new issue