mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
Added option in chat settings
This commit is contained in:
parent
d5c8f45ab9
commit
0aef6ecc94
5 changed files with 25 additions and 3 deletions
|
|
@ -133,9 +133,11 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
if (!sender.isEmpty()) {
|
||||
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
|
||||
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel).toImage(), QString::number(pixelSize) + "_" + QString::number((int) userLevel));
|
||||
QMap<QString, UserListTWI *> buddyList = tabSupervisor->getUserListsTab()->getBuddyList()->getUsers();
|
||||
if (buddyList.contains(sender))
|
||||
cursor.insertImage(PixmapGenerator::generatePixmap(pixelSize, ":/resources/buddy_icon.svg").toImage());
|
||||
if (settingsCache->getShowBuddyIcon()) {
|
||||
QMap<QString, UserListTWI *> buddyList = tabSupervisor->getUserListsTab()->getBuddyList()->getUsers();
|
||||
if (buddyList.contains(sender))
|
||||
cursor.insertImage(PixmapGenerator::generatePixmap(pixelSize, ":/resources/buddy_icon.svg").toImage());
|
||||
}
|
||||
cursor.insertText(" ");
|
||||
}
|
||||
cursor.setCharFormat(senderFormat);
|
||||
|
|
|
|||
|
|
@ -578,9 +578,13 @@ MessagesSettingsPage::MessagesSettingsPage()
|
|||
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
|
||||
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
|
||||
|
||||
showBuddyIcon.setChecked(settingsCache->getShowBuddyIcon());
|
||||
connect(&showBuddyIcon, SIGNAL(stateChanged(int)), settingsCache, SLOT(setShowBuddyIcon(int)));
|
||||
|
||||
QGridLayout *chatGrid = new QGridLayout;
|
||||
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
|
||||
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
|
||||
chatGrid->addWidget(&showBuddyIcon, 2, 0);
|
||||
chatGroupBox = new QGroupBox;
|
||||
chatGroupBox->setLayout(chatGrid);
|
||||
|
||||
|
|
@ -651,6 +655,7 @@ void MessagesSettingsPage::retranslateUi()
|
|||
aRemove->setText(tr("&Remove"));
|
||||
chatGroupBox->setTitle(tr("Chat settings"));
|
||||
chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
|
||||
showBuddyIcon.setText(tr("Show buddy Icon"));
|
||||
messageShortcuts->setTitle(tr("In-game message macros"));
|
||||
ignoreUnregUsersMainChat.setText(tr("Ignore unregistered users in main chat"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ private:
|
|||
QAction *aRemove;
|
||||
QCheckBox chatMentionCheckBox;
|
||||
QCheckBox ignoreUnregUsersMainChat;
|
||||
QCheckBox showBuddyIcon;
|
||||
QGroupBox *chatGroupBox;
|
||||
QGroupBox *messageShortcuts;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ SettingsCache::SettingsCache()
|
|||
|
||||
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
|
||||
|
||||
showBuddyIcon = settings->value("chat/showbuddyicon", true).toBool();
|
||||
|
||||
attemptAutoConnect = settings->value("server/auto_connect", 0).toBool();
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +246,11 @@ void SettingsCache::setChatMention(int _chatMention) {
|
|||
settings->setValue("chat/mention", chatMention);
|
||||
}
|
||||
|
||||
void SettingsCache::setShowBuddyIcon(int _showBuddyIcon) {
|
||||
showBuddyIcon = _showBuddyIcon;
|
||||
settings->setValue("chat/showbuddyicon", showBuddyIcon);
|
||||
}
|
||||
|
||||
void SettingsCache::setZoneViewSortByName(int _zoneViewSortByName)
|
||||
{
|
||||
zoneViewSortByName = _zoneViewSortByName;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ private:
|
|||
int minPlayersForMultiColumnLayout;
|
||||
bool tapAnimation;
|
||||
bool chatMention;
|
||||
bool showBuddyIcon;
|
||||
bool zoneViewSortByName, zoneViewSortByType, zoneViewPileView, zoneViewShuffle;
|
||||
bool soundEnabled;
|
||||
QString soundPath;
|
||||
|
|
@ -96,6 +97,11 @@ public:
|
|||
int getMinPlayersForMultiColumnLayout() const { return minPlayersForMultiColumnLayout; }
|
||||
bool getTapAnimation() const { return tapAnimation; }
|
||||
bool getChatMention() const { return chatMention; }
|
||||
/**
|
||||
Returns if the buddy icon should be displayed in chat.
|
||||
@return buddyIcon if the buddy icon should be displayed in chat.
|
||||
*/
|
||||
bool getShowBuddyIcon() const { return showBuddyIcon; }
|
||||
bool getZoneViewSortByName() const { return zoneViewSortByName; }
|
||||
bool getZoneViewSortByType() const { return zoneViewSortByType; }
|
||||
/**
|
||||
|
|
@ -146,6 +152,7 @@ public slots:
|
|||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||
void setTapAnimation(int _tapAnimation);
|
||||
void setChatMention(int _chatMention);
|
||||
void setShowBuddyIcon(int _showBuddyIcon);
|
||||
void setZoneViewSortByName(int _zoneViewSortByName);
|
||||
void setZoneViewSortByType(int _zoneViewSortByType);
|
||||
void setZoneViewPileView(int _zoneViewPileView);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue