ui: a colour per server, one letter in small avatars, one channel icon
Servers took their colour from a palette of people's colours by a hash of the name, so two of the three sample servers were the same blue. vm::servers::tints gives each server, in the rail's order, a colour from ten hues around the wheel: its name's, or the next free one when an earlier server has it. The rail, Home, search, live rooms and the server chats in the chat lists use it. A server icon at most half as wide as its avatar (TeamSpeak's 16 px ones) is drawn at twice its size, sharp, on that colour instead of stretched. Avatars under 28 px show one letter (Images.first-letter, as Slint cannot cut a string). Channels show the speaker (Icons.channel) everywhere the hash or the volume icon stood for one, and tab titles, notifications and subtitles name them without a '#' (vm::chat::tab_title; private chats keep '@'). Member rows showed everyone's talk power as a bare number. They now show a muted hand, "Needs talk power to speak", only on those whose channel needs more than they have and who are no talker (vm::tree::cannot_talk); the member card keeps the number. The sample's Raid Night needs 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
1 parent
65ff5f6693
commit
14ea206521
26 files changed
+320
-95
No files matched your search
@@ -1,4 +1,5 @@
|
||||
//! Emoji: images for the `Images` global, and the picker's rows.
|
||||
//! Emoji: images for the `Images` global (and an avatar's one letter), and
|
||||
//! the picker's rows.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -7,6 +8,7 @@ use slint::{ComponentHandle, Model, ModelRc, VecModel};
|
||||
use crate::app::{Emoji, EmojiCell, EmojiRow, Images, MainWindow};
|
||||
use crate::emoji::{self, PickerEmoji};
|
||||
use crate::images;
|
||||
use crate::vm::avatar;
|
||||
|
||||
/// Rows of `columns` cells.
|
||||
fn rows(emoji: Vec<PickerEmoji>, columns: usize) -> Vec<EmojiRow> {
|
||||
@@ -38,6 +40,7 @@ pub(super) fn wire(ui: &MainWindow) {
|
||||
let images_global = ui.global::<Images>();
|
||||
images_global.on_emoji(|key| images::emoji(&key));
|
||||
images_global.on_emoji_text(|key| emoji::text_of(&key).into());
|
||||
images_global.on_first_letter(|initials| avatar::first_letter(&initials).into());
|
||||
let global = ui.global::<Emoji>();
|
||||
let weak = ui.as_weak();
|
||||
global.on_load(move || {
|
||||
|
||||
Reference in new issue
Block a user