diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 130aca8bc..8d488831d 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1278,6 +1278,8 @@ PRIVATE settings/settings_type.h settings/settings_websites.cpp settings/settings_websites.h + statistics/statistics_box.cpp + statistics/statistics_box.h storage/details/storage_file_utilities.cpp storage/details/storage_file_utilities.h storage/details/storage_settings_scheme.cpp diff --git a/Telegram/SourceFiles/statistics/statistics_box.cpp b/Telegram/SourceFiles/statistics/statistics_box.cpp new file mode 100644 index 000000000..3c6457813 --- /dev/null +++ b/Telegram/SourceFiles/statistics/statistics_box.cpp @@ -0,0 +1,19 @@ +/* +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/statistics_box.h" + +#include "data/data_peer.h" +#include "lang/lang_keys.h" +#include "ui/layers/generic_box.h" + +namespace { +} // namespace + +void StatisticsBox(not_null box, not_null peer) { + box->setTitle(tr::lng_stats_title()); +} diff --git a/Telegram/SourceFiles/statistics/statistics_box.h b/Telegram/SourceFiles/statistics/statistics_box.h new file mode 100644 index 000000000..5578cb3bc --- /dev/null +++ b/Telegram/SourceFiles/statistics/statistics_box.h @@ -0,0 +1,16 @@ +/* +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 + +class PeerData; + +namespace Ui { +class GenericBox; +} // namespace Ui + +void StatisticsBox(not_null box, not_null peer); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 7727ecc9b..052c2484f 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -85,6 +85,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "export/export_manager.h" #include "boxes/peers/edit_peer_info_box.h" +#include "statistics/statistics_box.h" #include "styles/style_chat.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" @@ -999,12 +1000,17 @@ void Filler::addManageChat() { } void Filler::addViewStatistics() { +#ifdef _DEBUG if (const auto channel = _peer->asChannel()) { if (channel->flags() & ChannelDataFlag::CanGetStatistics) { + const auto navigation = _controller; + const auto peer = _peer; _addAction(tr::lng_stats_title(tr::now), [=] { + navigation->show(Box(StatisticsBox, peer)); }, nullptr); } } +#endif } void Filler::addCreatePoll() {