mirror of https://github.com/procxx/kepka.git
				
				
				
			Info button replaced by userpic in single column layout.
Icons for file inline results never display a download icon. Using !lastMsg->detached() to detect that all new messages are loaded.
This commit is contained in:
		
							parent
							
								
									00367ec07a
								
							
						
					
					
						commit
						03bbb2269d
					
				|  | @ -399,7 +399,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org | |||
| "lng_preview_loading" = "Getting Link Info..."; | ||||
| 
 | ||||
| "lng_profile_chat_unaccessible" = "Group is unaccessible"; | ||||
| "lng_topbar_info" = "Info"; | ||||
| "lng_profile_about_section" = "About"; | ||||
| "lng_profile_description_section" = "Description"; | ||||
| "lng_profile_settings_section" = "Settings"; | ||||
|  | @ -899,6 +898,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org | |||
| 
 | ||||
| "lng_full_name" = "{first_name} {last_name}"; | ||||
| 
 | ||||
| // Not used | ||||
| 
 | ||||
| "lng_topbar_info" = "Info"; | ||||
| 
 | ||||
| // Wnd specific | ||||
| 
 | ||||
| "lng_wnd_choose_program_menu" = "Choose Default Program..."; | ||||
|  |  | |||
|  | @ -2515,3 +2515,8 @@ toastFg: #FFF; | |||
| toastPadding: margins(19px, 13px, 19px, 12px); | ||||
| toastFadeInDuration: 200; | ||||
| toastFadeOutDuration: 1000; | ||||
| 
 | ||||
| infoButton: PeerAvatarButton { | ||||
| 	size: topBarHeight; | ||||
| 	photoSize: 42px; | ||||
| } | ||||
|  |  | |||
|  | @ -405,3 +405,8 @@ InputField { | |||
| 	iconSprite: sprite; | ||||
| 	iconPosition: point; | ||||
| } | ||||
| 
 | ||||
| PeerAvatarButton { | ||||
| 	size: number; | ||||
| 	photoSize: number; | ||||
| } | ||||
|  |  | |||
|  | @ -182,6 +182,7 @@ void RowPainter::paint(Painter &p, const Row *row, int w, bool active, bool sele | |||
| 				unread += h->unreadCount; | ||||
| 			} | ||||
| 		} | ||||
| 		int texttop = st::dlgPaddingVer + st::dlgFont->height + st::dlgSep; | ||||
| 		if (unread) { | ||||
| 			QString unreadStr = QString::number(unread); | ||||
| 			int unreadWidth = st::dlgUnreadFont->width(unreadStr); | ||||
|  | @ -190,7 +191,7 @@ void RowPainter::paint(Painter &p, const Row *row, int w, bool active, bool sele | |||
| 			accumulate_max(unreadRectWidth, unreadRectHeight); | ||||
| 
 | ||||
| 			int unreadRectLeft = w - st::dlgPaddingHor - unreadRectWidth; | ||||
| 			int unreadRectTop = st::dlgHeight - st::dlgPaddingVer - unreadRectHeight; | ||||
| 			int unreadRectTop = texttop + st::dlgHistFont->ascent - st::dlgUnreadFont->ascent - st::dlgUnreadTop; | ||||
| 			lastWidth -= unreadRectWidth + st::dlgUnreadPaddingHor; | ||||
| 
 | ||||
| 			paintUnreadBadge(p, QRect(unreadRectLeft, unreadRectTop, unreadRectWidth, unreadRectHeight), active, history->mute); | ||||
|  | @ -200,10 +201,10 @@ void RowPainter::paint(Painter &p, const Row *row, int w, bool active, bool sele | |||
| 			p.drawText(unreadRectLeft + (unreadRectWidth - unreadWidth) / 2, unreadRectTop + st::dlgUnreadTop + st::dlgUnreadFont->ascent, unreadStr); | ||||
| 		} | ||||
| 		if (history->typing.isEmpty() && history->sendActions.isEmpty()) { | ||||
| 			item->drawInDialog(p, QRect(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, lastWidth, st::dlgFont->height), active, history->textCachedFor, history->lastItemTextCache); | ||||
| 			item->drawInDialog(p, QRect(nameleft, texttop, lastWidth, st::dlgFont->height), active, history->textCachedFor, history->lastItemTextCache); | ||||
| 		} else { | ||||
| 			p.setPen(active ? st::dlgActiveColor : st::dlgSystemColor); | ||||
| 			history->typingText.drawElided(p, nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, lastWidth); | ||||
| 			history->typingText.drawElided(p, nameleft, texttop, lastWidth); | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
|  | @ -212,8 +213,8 @@ void RowPainter::paint(Painter &p, const FakeRow *row, int w, bool active, bool | |||
| 	auto item = row->item(); | ||||
| 	auto history = item->history(); | ||||
| 	paintRow(p, history, item, w, active, selected, onlyBackground, [&p, row, active, item](int nameleft, int namewidth) { | ||||
| 		int32 lastWidth = namewidth; | ||||
| 		item->drawInDialog(p, QRect(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, lastWidth, st::dlgFont->height), active, row->_cacheFor, row->_cache); | ||||
| 		int lastWidth = namewidth, texttop = st::dlgPaddingVer + st::dlgFont->height + st::dlgSep; | ||||
| 		item->drawInDialog(p, QRect(nameleft, texttop, lastWidth, st::dlgFont->height), active, row->_cacheFor, row->_cache); | ||||
| 	}); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1566,7 +1566,7 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice, const QVector<MTPM | |||
| 		asChannelHistory()->checkJoinedMessage(); | ||||
| 		asChannelHistory()->checkMaxReadMessageDate(); | ||||
| 	} | ||||
| 	if (newLoaded && !lastMsg) setLastMessage(lastImportantMessage()); | ||||
| 	checkLastMsg(); | ||||
| } | ||||
| 
 | ||||
| void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPMessageGroup> *collapsed) { | ||||
|  | @ -1574,7 +1574,9 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPM | |||
| 
 | ||||
| 	if (slice.isEmpty()) { | ||||
| 		newLoaded = true; | ||||
| 		if (!lastMsg) setLastMessage(lastImportantMessage()); | ||||
| 		if (!lastMsg) { | ||||
| 			setLastMessage(lastImportantMessage()); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	t_assert(!isBuildingFrontBlock()); | ||||
|  | @ -1632,6 +1634,17 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPM | |||
| 	} | ||||
| 
 | ||||
| 	if (isChannel()) asChannelHistory()->checkJoinedMessage(); | ||||
| 	checkLastMsg(); | ||||
| } | ||||
| 
 | ||||
| void History::checkLastMsg() { | ||||
| 	if (lastMsg) { | ||||
| 		if (!newLoaded && !lastMsg->detached() && (!isChannel() || asChannelHistory()->onlyImportant())) { | ||||
| 			newLoaded = true; | ||||
| 		} | ||||
| 	} else if (newLoaded) { | ||||
| 		setLastMessage(lastImportantMessage()); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| int History::countUnread(MsgId upTo) { | ||||
|  |  | |||
|  | @ -518,6 +518,9 @@ protected: | |||
| 
 | ||||
| private: | ||||
| 
 | ||||
| 	// After adding a new history slice check the lastMsg and newLoaded.
 | ||||
| 	void checkLastMsg(); | ||||
| 
 | ||||
| 	enum class Flag { | ||||
| 		f_has_pending_resized_items = (1 << 0), | ||||
| 		f_pending_resize            = (1 << 1), | ||||
|  |  | |||
|  | @ -731,7 +731,7 @@ void File::paint(Painter &p, const QRect &clip, uint32 selection, const PaintCon | |||
| 		icon = st::msgFileInPause; | ||||
| 	} else if (radial || document->loading()) { | ||||
| 		icon = st::msgFileInCancel; | ||||
| 	} else if (document->loaded()) { | ||||
| 	} else if (true || document->loaded()) { | ||||
| 		if (document->isImage()) { | ||||
| 			icon = st::msgFileInImage; | ||||
| 		} else if (document->voice() || document->song()) { | ||||
|  |  | |||
|  | @ -110,6 +110,7 @@ std_::unique_ptr<ItemBase> ItemBase::createLayout(Result *result, bool forceThum | |||
| 	case Type::Sticker: return std_::make_unique<internal::Sticker>(result); break; | ||||
| 	case Type::Gif: return std_::make_unique<internal::Gif>(result); break; | ||||
| 	case Type::Article: | ||||
| 	case Type::Geo: | ||||
| 	case Type::Venue: return std_::make_unique<internal::Article>(result, forceThumb); break; | ||||
| 	case Type::Contact: return std_::make_unique<internal::Contact>(result); break; | ||||
| 	} | ||||
|  |  | |||
|  | @ -74,6 +74,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult | |||
| 		result->insert(qsl("article"), Result::Type::Article); | ||||
| 		result->insert(qsl("contact"), Result::Type::Contact); | ||||
| 		result->insert(qsl("venue"), Result::Type::Venue); | ||||
| 		result->insert(qsl("geo"), Result::Type::Geo); | ||||
| 		return result.release(); | ||||
| 	})() }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w) | |||
| , _forward(this, lang(lng_selected_forward), st::topBarActionButton) | ||||
| , _delete(this, lang(lng_selected_delete), st::topBarActionButton) | ||||
| , _selectionButtonsWidth(_clearSelection.width() + _forward.width() + _delete.width()), _forwardDeleteWidth(qMax(_forward.textWidth(), _delete.textWidth())) | ||||
| , _info(this, lang(lng_topbar_info), st::topBarButton) | ||||
| , _info(this, nullptr, st::infoButton) | ||||
| , _edit(this, lang(lng_profile_edit_contact), st::topBarButton) | ||||
| , _leaveGroup(this, lang(lng_profile_delete_and_exit), st::topBarButton) | ||||
| , _addContact(this, lang(lng_profile_add_contact), st::topBarButton) | ||||
|  | @ -362,6 +362,7 @@ void TopBarWidget::showAll() { | |||
| 		} | ||||
| 		if (h && !o && !p && _clearSelection.isHidden()) { | ||||
| 			if (Adaptive::OneColumn()) { | ||||
| 				_info.setPeer(h); | ||||
| 				_info.show(); | ||||
| 			} else { | ||||
| 				_info.hide(); | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org | |||
| #include "profilewidget.h" | ||||
| #include "overviewwidget.h" | ||||
| #include "playerwidget.h" | ||||
| #include "ui/buttons/peer_avatar_button.h" | ||||
| 
 | ||||
| class Window; | ||||
| class ApiWrap; | ||||
|  | @ -111,7 +112,7 @@ private: | |||
| 	FlatButton _forward, _delete; | ||||
| 	int32 _selectionButtonsWidth, _forwardDeleteWidth; | ||||
| 
 | ||||
| 	FlatButton _info; | ||||
| 	PeerAvatarButton _info; | ||||
| 	FlatButton _edit, _leaveGroup, _addContact, _deleteContact; | ||||
| 	FlatButton _mediaType; | ||||
| 
 | ||||
|  |  | |||
|  | @ -214,7 +214,7 @@ void UserData::setPhoto(const MTPUserProfilePhoto &p) { // see Local::readPeer a | |||
| 	default: { | ||||
| 		newPhotoId = 0; | ||||
| 		if (id == ServiceUserId) { | ||||
| 			if (_userpic->isNull()) { | ||||
| 			if (_userpic.v() == userDefPhoto(colorIndex).v()) { | ||||
| 				newPhoto = ImagePtr(QPixmap::fromImage(App::wnd()->iconLarge().scaledToWidth(160, Qt::SmoothTransformation), Qt::ColorOnly), "PNG"); | ||||
| 			} | ||||
| 		} else { | ||||
|  |  | |||
|  | @ -128,6 +128,7 @@ SOURCES += \ | |||
|     ./SourceFiles/mtproto/rpc_sender.cpp \ | ||||
|     ./SourceFiles/mtproto/scheme_auto.cpp \ | ||||
|     ./SourceFiles/mtproto/session.cpp \ | ||||
|     ./SourceFiles/ui/buttons/peer_avatar_button.cpp \ | ||||
|     ./SourceFiles/ui/toast/toast.cpp \ | ||||
|     ./SourceFiles/ui/toast/toast_manager.cpp \ | ||||
|     ./SourceFiles/ui/toast/toast_widget.cpp \ | ||||
|  | @ -236,6 +237,7 @@ HEADERS += \ | |||
|     ./SourceFiles/mtproto/scheme_auto.h \ | ||||
|     ./SourceFiles/mtproto/session.h \ | ||||
|     ./SourceFiles/pspecific.h \ | ||||
|     ./SourceFiles/ui/buttons/peer_avatar_button.h \ | ||||
|     ./SourceFiles/ui/toast/toast.h \ | ||||
|     ./SourceFiles/ui/toast/toast_manager.h \ | ||||
|     ./SourceFiles/ui/toast/toast_widget.h \ | ||||
|  |  | |||
|  | @ -1165,8 +1165,10 @@ | |||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">NotUsing</PrecompiledHeader> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="ui\buttons\peer_avatar_button.cpp" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <CustomBuild Include="ui\buttons\peer_avatar_button.h" /> | ||||
|     <CustomBuild Include="SourceFiles\pspecific_winrt.h"> | ||||
|       <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs> | ||||
|       <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing pspecific_winrt.h...</Message> | ||||
|  |  | |||
|  | @ -64,6 +64,9 @@ | |||
|     <Filter Include="dialogs"> | ||||
|       <UniqueIdentifier>{405e59c2-0800-4f73-b975-1749c8c36e87}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|     <Filter Include="ui\buttons"> | ||||
|       <UniqueIdentifier>{24292a88-6707-4070-b2d2-8b53acd5cdd0}</UniqueIdentifier> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="SourceFiles\main.cpp"> | ||||
|  | @ -1029,6 +1032,9 @@ | |||
|     <ClCompile Include="SourceFiles\dialogs\dialogs_indexed_list.cpp"> | ||||
|       <Filter>dialogs</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="ui\buttons\peer_avatar_button.cpp"> | ||||
|       <Filter>ui\buttons</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="SourceFiles\stdafx.h"> | ||||
|  | @ -1408,6 +1414,9 @@ | |||
|     <CustomBuild Include="SourceFiles\ui\toast\toast_manager.h"> | ||||
|       <Filter>ui\toast</Filter> | ||||
|     </CustomBuild> | ||||
|     <CustomBuild Include="ui\buttons\peer_avatar_button.h"> | ||||
|       <Filter>ui\buttons</Filter> | ||||
|     </CustomBuild> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="Resources\langs\lang_it.strings"> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue