mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added dummy box for creating giveaway.
This commit is contained in:
parent
e00016312e
commit
5b0c48bb52
5 changed files with 110 additions and 2 deletions
|
@ -824,6 +824,8 @@ PRIVATE
|
||||||
history/history_view_highlight_manager.h
|
history/history_view_highlight_manager.h
|
||||||
history/history_widget.cpp
|
history/history_widget.cpp
|
||||||
history/history_widget.h
|
history/history_widget.h
|
||||||
|
info/boosts/create_giveaway_box.cpp
|
||||||
|
info/boosts/create_giveaway_box.h
|
||||||
info/boosts/info_boosts_inner_widget.cpp
|
info/boosts/info_boosts_inner_widget.cpp
|
||||||
info/boosts/info_boosts_inner_widget.h
|
info/boosts/info_boosts_inner_widget.h
|
||||||
info/boosts/info_boosts_widget.cpp
|
info/boosts/info_boosts_widget.cpp
|
||||||
|
|
81
Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp
Normal file
81
Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
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 "info/boosts/create_giveaway_box.h"
|
||||||
|
|
||||||
|
#include "boxes/peers/edit_participants_box.h" // ParticipantsBoxController
|
||||||
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
|
#include "info/info_controller.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "ui/layers/generic_box.h"
|
||||||
|
#include "ui/widgets/labels.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class MembersListController : public ParticipantsBoxController {
|
||||||
|
public:
|
||||||
|
using ParticipantsBoxController::ParticipantsBoxController;
|
||||||
|
|
||||||
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
std::unique_ptr<PeerListRow> createRow(
|
||||||
|
not_null<PeerData*> participant) const override;
|
||||||
|
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void MembersListController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
|
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<PeerListRow> MembersListController::createRow(
|
||||||
|
not_null<PeerData*> participant) const {
|
||||||
|
const auto user = participant->asUser();
|
||||||
|
if (!user || user->isInaccessible() || user->isBot() || user->isSelf()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return std::make_unique<PeerListRow>(participant);
|
||||||
|
}
|
||||||
|
|
||||||
|
base::unique_qptr<Ui::PopupMenu> MembersListController::rowContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<PeerListRow*> row) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void CreateGiveawayBox(
|
||||||
|
not_null<Ui::GenericBox*> box,
|
||||||
|
not_null<Info::Controller*> controller,
|
||||||
|
not_null<PeerData*> peer) {
|
||||||
|
box->addButton(tr::lng_box_ok(), [=] {
|
||||||
|
auto initBox = [=](not_null<PeerListBox*> peersBox) {
|
||||||
|
peersBox->setTitle(tr::lng_giveaway_award_option());
|
||||||
|
peersBox->addButton(tr::lng_settings_save(), [=] {
|
||||||
|
const auto selected = peersBox->collectSelectedRows();
|
||||||
|
peersBox->closeBox();
|
||||||
|
});
|
||||||
|
peersBox->addButton(tr::lng_cancel(), [=] {
|
||||||
|
peersBox->closeBox();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
box->uiShow()->showBox(
|
||||||
|
Box<PeerListBox>(
|
||||||
|
std::make_unique<MembersListController>(
|
||||||
|
controller,
|
||||||
|
peer,
|
||||||
|
ParticipantsRole::Members),
|
||||||
|
std::move(initBox)),
|
||||||
|
Ui::LayerOption::KeepOther);
|
||||||
|
});
|
||||||
|
}
|
23
Telegram/SourceFiles/info/boosts/create_giveaway_box.h
Normal file
23
Telegram/SourceFiles/info/boosts/create_giveaway_box.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
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 Info {
|
||||||
|
class Controller;
|
||||||
|
} // namespace Info
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class GenericBox;
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
void CreateGiveawayBox(
|
||||||
|
not_null<Ui::GenericBox*> box,
|
||||||
|
not_null<Info::Controller*> controller,
|
||||||
|
not_null<PeerData*> peer);
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "api/api_statistics.h"
|
#include "api/api_statistics.h"
|
||||||
#include "boxes/peers/edit_peer_invite_link.h"
|
#include "boxes/peers/edit_peer_invite_link.h"
|
||||||
|
#include "info/boosts/create_giveaway_box.h"
|
||||||
#include "info/boosts/info_boosts_widget.h"
|
#include "info/boosts/info_boosts_widget.h"
|
||||||
#include "info/info_controller.h"
|
#include "info/info_controller.h"
|
||||||
#include "info/profile/info_profile_icon.h"
|
#include "info/profile/info_profile_icon.h"
|
||||||
|
@ -178,6 +179,7 @@ void FillShareLink(
|
||||||
|
|
||||||
void FillGetBoostsButton(
|
void FillGetBoostsButton(
|
||||||
not_null<Ui::VerticalLayout*> content,
|
not_null<Ui::VerticalLayout*> content,
|
||||||
|
not_null<Controller*> controller,
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<PeerData*> peer) {
|
not_null<PeerData*> peer) {
|
||||||
const auto &st = st::getBoostsButton;
|
const auto &st = st::getBoostsButton;
|
||||||
|
@ -188,6 +190,7 @@ void FillGetBoostsButton(
|
||||||
tr::lng_boosts_get_boosts(),
|
tr::lng_boosts_get_boosts(),
|
||||||
st));
|
st));
|
||||||
button->setClickedCallback([=] {
|
button->setClickedCallback([=] {
|
||||||
|
show->showBox(Box(CreateGiveawayBox, controller, peer));
|
||||||
});
|
});
|
||||||
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||||
button,
|
button,
|
||||||
|
@ -291,7 +294,7 @@ void InnerWidget::fill() {
|
||||||
::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext());
|
::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext());
|
||||||
|
|
||||||
::Settings::AddSkip(inner);
|
::Settings::AddSkip(inner);
|
||||||
FillGetBoostsButton(inner, _show, _peer);
|
FillGetBoostsButton(inner, _controller, _show, _peer);
|
||||||
::Settings::AddSkip(inner);
|
::Settings::AddSkip(inner);
|
||||||
::Settings::AddDividerText(inner, tr::lng_boosts_get_boosts_subtext());
|
::Settings::AddDividerText(inner, tr::lng_boosts_get_boosts_subtext());
|
||||||
|
|
||||||
|
|
|
@ -118,4 +118,3 @@ std::shared_ptr<Info::Memento> Make(not_null<PeerData*> peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Info::Boosts
|
} // namespace Info::Boosts
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue