Removed Ui::show from ParticipantsBoxController.
This commit is contained in:
		
							parent
							
								
									e44b37e654
								
							
						
					
					
						commit
						093d2ae99b
					
				
					 2 changed files with 18 additions and 12 deletions
				
			
		| 
						 | 
					@ -1017,15 +1017,14 @@ void ParticipantsBoxController::addNewItem() {
 | 
				
			||||||
		box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
 | 
							box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_addBox = Ui::show(
 | 
						_addBox = showBox(
 | 
				
			||||||
		Box<PeerListBox>(
 | 
							Box<PeerListBox>(
 | 
				
			||||||
			std::make_unique<AddSpecialBoxController>(
 | 
								std::make_unique<AddSpecialBoxController>(
 | 
				
			||||||
				_peer,
 | 
									_peer,
 | 
				
			||||||
				_role,
 | 
									_role,
 | 
				
			||||||
				adminDone,
 | 
									adminDone,
 | 
				
			||||||
				restrictedDone),
 | 
									restrictedDone),
 | 
				
			||||||
			initBox),
 | 
								initBox));
 | 
				
			||||||
		Ui::LayerOption::KeepOther);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::addNewParticipants() {
 | 
					void ParticipantsBoxController::addNewParticipants() {
 | 
				
			||||||
| 
						 | 
					@ -1052,7 +1051,7 @@ void ParticipantsBoxController::addNewParticipants() {
 | 
				
			||||||
			channel,
 | 
								channel,
 | 
				
			||||||
			{ already.begin(), already.end() });
 | 
								{ already.begin(), already.end() });
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		Ui::show(Box<MaxInviteBox>(channel), Ui::LayerOption::KeepOther);
 | 
							showBox(Box<MaxInviteBox>(channel));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1204,6 +1203,13 @@ void ParticipantsBoxController::prepare() {
 | 
				
			||||||
	delegate()->peerListRefreshRows();
 | 
						delegate()->peerListRefreshRows();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QPointer<Ui::BoxContent> ParticipantsBoxController::showBox(
 | 
				
			||||||
 | 
							object_ptr<Ui::BoxContent> box) const {
 | 
				
			||||||
 | 
						const auto weak = Ui::MakeWeak(box.data());
 | 
				
			||||||
 | 
						delegate()->peerListShowBox(std::move(box), Ui::LayerOption::KeepOther);
 | 
				
			||||||
 | 
						return weak;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
 | 
					void ParticipantsBoxController::prepareChatRows(not_null<ChatData*> chat) {
 | 
				
			||||||
	if (_role == Role::Profile || _role == Role::Members) {
 | 
						if (_role == Role::Profile || _role == Role::Members) {
 | 
				
			||||||
		_onlineSorter = std::make_unique<ParticipantsOnlineSorter>(
 | 
							_onlineSorter = std::make_unique<ParticipantsOnlineSorter>(
 | 
				
			||||||
| 
						 | 
					@ -1615,7 +1621,7 @@ void ParticipantsBoxController::showAdmin(not_null<UserData*> user) {
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
							box->setSaveCallback(SaveAdminCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
 | 
						_editParticipantBox = showBox(std::move(box));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::editAdminDone(
 | 
					void ParticipantsBoxController::editAdminDone(
 | 
				
			||||||
| 
						 | 
					@ -1669,7 +1675,7 @@ void ParticipantsBoxController::showRestricted(not_null<UserData*> user) {
 | 
				
			||||||
		box->setSaveCallback(
 | 
							box->setSaveCallback(
 | 
				
			||||||
			SaveRestrictedCallback(_peer, user, done, fail));
 | 
								SaveRestrictedCallback(_peer, user, done, fail));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_editParticipantBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
 | 
						_editParticipantBox = showBox(std::move(box));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::editRestrictedDone(
 | 
					void ParticipantsBoxController::editRestrictedDone(
 | 
				
			||||||
| 
						 | 
					@ -1717,15 +1723,14 @@ void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant)
 | 
				
			||||||
			tr::now,
 | 
								tr::now,
 | 
				
			||||||
			lt_user,
 | 
								lt_user,
 | 
				
			||||||
			user ? user->firstName : participant->name);
 | 
								user ? user->firstName : participant->name);
 | 
				
			||||||
	_editBox = Ui::show(
 | 
						_editBox = showBox(
 | 
				
			||||||
		Ui::MakeConfirmBox({
 | 
							Ui::MakeConfirmBox({
 | 
				
			||||||
			.text = text,
 | 
								.text = text,
 | 
				
			||||||
			.confirmed = crl::guard(this, [=] {
 | 
								.confirmed = crl::guard(this, [=] {
 | 
				
			||||||
				kickParticipantSure(participant);
 | 
									kickParticipantSure(participant);
 | 
				
			||||||
			}),
 | 
								}),
 | 
				
			||||||
			.confirmText = tr::lng_box_remove(),
 | 
								.confirmText = tr::lng_box_remove(),
 | 
				
			||||||
		}),
 | 
							}));
 | 
				
			||||||
		Ui::LayerOption::KeepOther);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::unkickParticipant(not_null<UserData*> user) {
 | 
					void ParticipantsBoxController::unkickParticipant(not_null<UserData*> user) {
 | 
				
			||||||
| 
						 | 
					@ -1762,7 +1767,7 @@ void ParticipantsBoxController::kickParticipantSure(
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
 | 
					void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
 | 
				
			||||||
	_editBox = Ui::show(
 | 
						_editBox = showBox(
 | 
				
			||||||
		Ui::MakeConfirmBox({
 | 
							Ui::MakeConfirmBox({
 | 
				
			||||||
			.text = tr::lng_profile_sure_remove_admin(
 | 
								.text = tr::lng_profile_sure_remove_admin(
 | 
				
			||||||
				tr::now,
 | 
									tr::now,
 | 
				
			||||||
| 
						 | 
					@ -1770,8 +1775,7 @@ void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
 | 
				
			||||||
				user->firstName),
 | 
									user->firstName),
 | 
				
			||||||
			.confirmed = crl::guard(this, [=] { removeAdminSure(user); }),
 | 
								.confirmed = crl::guard(this, [=] { removeAdminSure(user); }),
 | 
				
			||||||
			.confirmText = tr::lng_box_remove(),
 | 
								.confirmText = tr::lng_box_remove(),
 | 
				
			||||||
		}),
 | 
							}));
 | 
				
			||||||
		Ui::LayerOption::KeepOther);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ParticipantsBoxController::removeAdminSure(not_null<UserData*> user) {
 | 
					void ParticipantsBoxController::removeAdminSure(not_null<UserData*> user) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -221,6 +221,8 @@ private:
 | 
				
			||||||
		Role role,
 | 
							Role role,
 | 
				
			||||||
		not_null<ParticipantsAdditionalData*> additional);
 | 
							not_null<ParticipantsAdditionalData*> additional);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						QPointer<Ui::BoxContent> showBox(object_ptr<Ui::BoxContent> box) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void prepareChatRows(not_null<ChatData*> chat);
 | 
						void prepareChatRows(not_null<ChatData*> chat);
 | 
				
			||||||
	void rebuildChatRows(not_null<ChatData*> chat);
 | 
						void rebuildChatRows(not_null<ChatData*> chat);
 | 
				
			||||||
	void rebuildChatParticipants(not_null<ChatData*> chat);
 | 
						void rebuildChatParticipants(not_null<ChatData*> chat);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue