[Option][JSON] Always show top bar userpic
This commit is contained in:
		
							parent
							
								
									19a528b9bb
								
							
						
					
					
						commit
						5a29707a28
					
				
					 2 changed files with 17 additions and 5 deletions
				
			
		| 
						 | 
					@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
#include "history/view/history_view_top_bar_widget.h"
 | 
					#include "history/view/history_view_top_bar_widget.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "kotato/kotato_settings.h"
 | 
				
			||||||
#include "history/history.h"
 | 
					#include "history/history.h"
 | 
				
			||||||
#include "history/view/history_view_send_action.h"
 | 
					#include "history/view/history_view_send_action.h"
 | 
				
			||||||
#include "boxes/add_contact_box.h"
 | 
					#include "boxes/add_contact_box.h"
 | 
				
			||||||
| 
						 | 
					@ -987,7 +988,11 @@ void TopBarWidget::updateControlsGeometry() {
 | 
				
			||||||
		_cancelChoose->moveToLeft(_leftTaken, otherButtonsTop);
 | 
							_cancelChoose->moveToLeft(_leftTaken, otherButtonsTop);
 | 
				
			||||||
		_leftTaken += _cancelChoose->width();
 | 
							_leftTaken += _cancelChoose->width();
 | 
				
			||||||
	} else if (_back->isHidden()) {
 | 
						} else if (_back->isHidden()) {
 | 
				
			||||||
		_leftTaken = st::topBarArrowPadding.right();
 | 
							if (::Kotato::JsonSettings::GetBool("always_show_top_userpic")) {
 | 
				
			||||||
 | 
								_leftTaken = st::topBarActionSkip;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								_leftTaken = st::topBarArrowPadding.right();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		_leftTaken = anim::interpolate(
 | 
							_leftTaken = anim::interpolate(
 | 
				
			||||||
			0,
 | 
								0,
 | 
				
			||||||
| 
						 | 
					@ -996,14 +1001,18 @@ void TopBarWidget::updateControlsGeometry() {
 | 
				
			||||||
		_back->moveToLeft(_leftTaken, backButtonTop);
 | 
							_back->moveToLeft(_leftTaken, backButtonTop);
 | 
				
			||||||
		_leftTaken += _back->width();
 | 
							_leftTaken += _back->width();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (_info && !_info->isHidden()) {
 | 
					
 | 
				
			||||||
		_info->moveToLeft(_leftTaken, otherButtonsTop);
 | 
						if (!_back->isHidden() || ::Kotato::JsonSettings::GetBool("always_show_top_userpic")) {
 | 
				
			||||||
		_leftTaken += _info->width();
 | 
							if (_info && !_info->isHidden()) {
 | 
				
			||||||
 | 
								_info->moveToLeft(_leftTaken, otherButtonsTop);
 | 
				
			||||||
 | 
								_leftTaken += _info->width();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else if (_activeChat.key.topic()
 | 
						} else if (_activeChat.key.topic()
 | 
				
			||||||
		|| _activeChat.section == Section::ChatsList) {
 | 
							|| _activeChat.section == Section::ChatsList) {
 | 
				
			||||||
		_leftTaken += st::normalFont->spacew;
 | 
							_leftTaken += st::normalFont->spacew;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (_searchField) {
 | 
						if (_searchField) {
 | 
				
			||||||
		const auto fieldLeft = _leftTaken;
 | 
							const auto fieldLeft = _leftTaken;
 | 
				
			||||||
		const auto fieldTop = searchFieldTop
 | 
							const auto fieldTop = searchFieldTop
 | 
				
			||||||
| 
						 | 
					@ -1090,7 +1099,7 @@ void TopBarWidget::updateControlsVisibility() {
 | 
				
			||||||
	_cancelChoose->setVisible(_chooseForReportReason.has_value());
 | 
						_cancelChoose->setVisible(_chooseForReportReason.has_value());
 | 
				
			||||||
	if (_info) {
 | 
						if (_info) {
 | 
				
			||||||
		_info->setVisible(!_chooseForReportReason
 | 
							_info->setVisible(!_chooseForReportReason
 | 
				
			||||||
			&& (isOneColumn || !_primaryWindow));
 | 
								&& (::Kotato::JsonSettings::GetBool("always_show_top_userpic") || isOneColumn || !_primaryWindow));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (_unreadBadge) {
 | 
						if (_unreadBadge) {
 | 
				
			||||||
		_unreadBadge->setVisible(!_chooseForReportReason);
 | 
							_unreadBadge->setVisible(!_chooseForReportReason);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -333,6 +333,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
 | 
				
			||||||
		.type = SettingType::IntSetting,
 | 
							.type = SettingType::IntSetting,
 | 
				
			||||||
		.defaultValue = 20,
 | 
							.defaultValue = 20,
 | 
				
			||||||
		.limitHandler = IntLimit(0, 200, 20), }},
 | 
							.limitHandler = IntLimit(0, 200, 20), }},
 | 
				
			||||||
 | 
						{ "always_show_top_userpic", {
 | 
				
			||||||
 | 
							.type = SettingType::BoolSetting,
 | 
				
			||||||
 | 
							.defaultValue = false, }},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using OldOptionKey = QString;
 | 
					using OldOptionKey = QString;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue