mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add setting for username display style (#2891)
This commit is contained in:
parent
91b0170241
commit
eb8ddfc1d3
|
@ -3,6 +3,7 @@
|
|||
## Unversioned
|
||||
|
||||
- Major: Added ability to toggle visibility of Channel Tabs - This can be done by right-clicking the tab area or pressing the keyboard shortcut (default: Ctrl+U). (#2600)
|
||||
- Minor: Add setting for username style (#2889, #2891)
|
||||
- Minor: Searching for users in the viewer list now searches anywhere in the user's name. (#2861)
|
||||
- Minor: Added moderation buttons to search popup when searching in a split with moderation mode enabled. (#2148, #2803)
|
||||
- Minor: Made "#channel" in `/mentions` tab show in usercards and in the search popup. (#2802)
|
||||
|
|
|
@ -674,11 +674,7 @@ void TwitchMessageBuilder::appendUsername()
|
|||
// The full string that will be rendered in the chat widget
|
||||
QString usernameText;
|
||||
|
||||
pajlada::Settings::Setting<int> usernameDisplayMode(
|
||||
"/appearance/messages/usernameDisplayMode",
|
||||
UsernameDisplayMode::UsernameAndLocalizedName);
|
||||
|
||||
switch (usernameDisplayMode.getValue())
|
||||
switch (getSettings()->usernameDisplayMode.getValue())
|
||||
{
|
||||
case UsernameDisplayMode::Username: {
|
||||
usernameText = username;
|
||||
|
|
|
@ -28,12 +28,6 @@ struct TwitchEmoteOccurence {
|
|||
class TwitchMessageBuilder : public SharedMessageBuilder
|
||||
{
|
||||
public:
|
||||
enum UsernameDisplayMode : int {
|
||||
Username = 1, // Username
|
||||
LocalizedName = 2, // Localized name
|
||||
UsernameAndLocalizedName = 3, // Username (Localized name)
|
||||
};
|
||||
|
||||
TwitchMessageBuilder() = delete;
|
||||
|
||||
explicit TwitchMessageBuilder(Channel *_channel,
|
||||
|
|
|
@ -52,6 +52,11 @@ private:
|
|||
|
||||
ConcurrentSettings &getCSettings();
|
||||
|
||||
enum UsernameDisplayMode : int {
|
||||
Username = 1, // Username
|
||||
LocalizedName = 2, // Localized name
|
||||
UsernameAndLocalizedName = 3, // Username (Localized name)
|
||||
};
|
||||
/// Settings which are availlable for reading and writing on the gui thread.
|
||||
// These settings are still accessed concurrently in the code but it is bad practice.
|
||||
class Settings : public ABSettings, public ConcurrentSettings
|
||||
|
@ -88,6 +93,9 @@ public:
|
|||
"/appearance/messages/hideDeletionActions", false};
|
||||
BoolSetting colorizeNicknames = {"/appearance/messages/colorizeNicknames",
|
||||
true};
|
||||
EnumSetting<UsernameDisplayMode> usernameDisplayMode = {
|
||||
"/appearance/messages/usernameDisplayMode",
|
||||
UsernameDisplayMode::UsernameAndLocalizedName};
|
||||
|
||||
IntSetting tabDirection = {"/appearance/tabDirection",
|
||||
NotebookTabDirection::Horizontal};
|
||||
|
|
|
@ -612,6 +612,19 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
|||
layout.addCheckbox("Color @usernames", s.colorUsernames);
|
||||
layout.addCheckbox("Try to find usernames without @ prefix",
|
||||
s.findAllUsernames);
|
||||
const QStringList usernameDisplayModes = {"Username", "Localized name",
|
||||
"Username and localized name"};
|
||||
|
||||
layout.addDropdown<std::underlying_type<UsernameDisplayMode>::type>(
|
||||
"Username style", usernameDisplayModes, s.usernameDisplayMode,
|
||||
[usernameDisplayModes](auto val) {
|
||||
return usernameDisplayModes.at(val - 1);
|
||||
// UsernameDisplayMode enum indexes from 1
|
||||
},
|
||||
[](auto args) {
|
||||
return args.index + 1;
|
||||
},
|
||||
false);
|
||||
layout.addDropdown<float>(
|
||||
"Username font weight", {"50", "Default", "75", "100"}, s.boldScale,
|
||||
[](auto val) {
|
||||
|
|
Loading…
Reference in a new issue