2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Colors added in palette for selected messages.

User names in groups, text and links in messages and names
in files and shared contacts not can have different colors
in plain inbox / outbox messages and in selected messages.

Now we can use a separate color for selected parts in Text.
This commit is contained in:
John Preston
2017-02-09 16:46:14 +03:00
parent cce99a96ac
commit 8e3274cd8f
7 changed files with 158 additions and 67 deletions

View File

@@ -60,20 +60,6 @@ ImagePtr generateUserpicImage(const style::icon &icon) {
} // namespace
style::color peerColor(int index) {
static style::color peerColors[kUserColorsCount] = {
st::historyPeer1NameFg,
st::historyPeer2NameFg,
st::historyPeer3NameFg,
st::historyPeer4NameFg,
st::historyPeer5NameFg,
st::historyPeer6NameFg,
st::historyPeer7NameFg,
st::historyPeer8NameFg,
};
return peerColors[index];
}
style::color peerUserpicColor(int index) {
static style::color peerColors[kUserColorsCount] = {
st::historyPeer1UserpicBg,
@@ -248,11 +234,9 @@ using UpdateFlag = Notify::PeerUpdate::Flag;
NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats;
NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings;
PeerData::PeerData(const PeerId &id) : id(id)
, colorIndex(peerColorIndex(id))
, color(peerColor(colorIndex)) {
PeerData::PeerData(const PeerId &id) : id(id), _colorIndex(peerColorIndex(id)) {
nameText.setText(st::msgNameStyle, QString(), _textNameOptions);
_userpicEmpty.set(colorIndex, QString());
_userpicEmpty.set(_colorIndex, QString());
}
void PeerData::updateNameDelayed(const QString &newName, const QString &newNameOrPhone, const QString &newUsername) {
@@ -274,7 +258,7 @@ void PeerData::updateNameDelayed(const QString &newName, const QString &newNameO
name = newName;
nameText.setText(st::msgNameStyle, name, _textNameOptions);
if (!_userpic) {
_userpicEmpty.set(colorIndex, name);
_userpicEmpty.set(_colorIndex, name);
}
Notify::PeerUpdate update(this);
@@ -309,7 +293,7 @@ void PeerData::updateNameDelayed(const QString &newName, const QString &newNameO
void PeerData::setUserpic(ImagePtr userpic) {
_userpic = userpic;
if (!_userpic || !_userpic->loaded()) {
_userpicEmpty.set(colorIndex, name);
_userpicEmpty.set(_colorIndex, name);
} else {
_userpicEmpty.clear();
}