Commit 82ca261e authored by Gavin Bises's avatar Gavin Bises
Browse files

Merge remote-tracking branch 'origin/master' into mention_color

Conflicts:
	cockatrice/src/dlg_settings.cpp
	cockatrice/src/dlg_settings.h
parents 3f2c5700 a08fc046
......@@ -570,7 +570,9 @@ MessagesSettingsPage::MessagesSettingsPage()
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
ignoreUnregUserMessages.setChecked(settingsCache->getIgnoreUnregisteredUserMessages());
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUserMessages(int)));
invertMentionForeground.setChecked(settingsCache->getChatMentionForeground());
connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));
......@@ -586,7 +588,7 @@ MessagesSettingsPage::MessagesSettingsPage()
chatGrid->addWidget(mentionColor, 0, 2);
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
chatGrid->addWidget(&hexLabel, 1, 2);
chatGrid->addWidget(&ignoreUnregUserMessages, 2, 0);
chatGroupBox = new QGroupBox;
chatGroupBox->setLayout(chatGrid);
......@@ -678,6 +680,8 @@ void MessagesSettingsPage::retranslateUi()
chatMentionCheckBox.setText(tr("Enable chat mentions"));
messageShortcuts->setTitle(tr("In-game message macros"));
ignoreUnregUsersMainChat.setText(tr("Ignore unregistered users in main chat"));
ignoreUnregUsersMainChat.setText(tr("Ignore chat room messages sent by unregistered users."));
ignoreUnregUserMessages.setText(tr("Ignore private messages sent by unregistered users."));
invertMentionForeground.setText(tr("Invert text color"));
hexLabel.setText(tr("(Color is hexadecimal)"));
}
......
......@@ -163,8 +163,9 @@ private:
QAction *aAdd;
QAction *aRemove;
QCheckBox chatMentionCheckBox;
QCheckBox ignoreUnregUsersMainChat;
QCheckBox invertMentionForeground;
QCheckBox ignoreUnregUsersMainChat;
QCheckBox ignoreUnregUserMessages;
QGroupBox *chatGroupBox;
QGroupBox *messageShortcuts;
QLineEdit *mentionColor;
......
......@@ -59,6 +59,7 @@ SettingsCache::SettingsCache()
priceTagSource = settings->value("deckeditor/pricetagsource", 0).toInt();
ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool();
ignoreUnregisteredUserMessages = settings->value("chat/ignore_unregistered_messages", false).toBool();
attemptAutoConnect = settings->value("server/auto_connect", 0).toBool();
}
......@@ -305,6 +306,12 @@ void SettingsCache::setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers)
settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers);
}
void SettingsCache::setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages)
{
ignoreUnregisteredUserMessages = _ignoreUnregisteredUserMessages;
settings->setValue("chat/ignore_unregistered_messages", ignoreUnregisteredUserMessages);
}
void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
{
mainWindowGeometry = _mainWindowGeometry;
......
......@@ -36,6 +36,7 @@ signals:
void soundPathChanged();
void priceTagFeatureChanged(int enabled);
void ignoreUnregisteredUsersChanged();
void ignoreUnregisteredUserMessagesChanged();
void pixmapCacheSizeChanged(int newSizeInMBs);
private:
QSettings *settings;
......@@ -65,6 +66,7 @@ private:
bool priceTagFeature;
int priceTagSource;
bool ignoreUnregisteredUsers;
bool ignoreUnregisteredUserMessages;
QString picUrl;
QString picUrlHq;
QString picUrlFallback;
......@@ -112,6 +114,7 @@ public:
bool getPriceTagFeature() const { return priceTagFeature; }
int getPriceTagSource() const { return priceTagSource; }
bool getIgnoreUnregisteredUsers() const { return ignoreUnregisteredUsers; }
bool getIgnoreUnregisteredUserMessages() const { return ignoreUnregisteredUserMessages; }
QString getPicUrl() const { return picUrl; }
QString getPicUrlHq() const { return picUrlHq; }
QString getPicUrlFallback() const { return picUrlFallback; }
......@@ -155,6 +158,7 @@ public slots:
void setPriceTagFeature(int _priceTagFeature);
void setPriceTagSource(int _priceTagSource);
void setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers);
void setIgnoreUnregisteredUserMessages(int _ignoreUnregisteredUserMessages);
void setPicUrl(const QString &_picUrl);
void setPicUrlHq(const QString &_picUrlHq);
void setPicUrlFallback(const QString &_picUrlFallback);
......
......@@ -446,11 +446,21 @@ void TabSupervisor::processGameEventContainer(const GameEventContainer &cont)
void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
{
TabMessage *tab = messageTabs.value(QString::fromStdString(event.sender_name()));
QString senderName = QString::fromStdString(event.sender_name());
TabMessage *tab = messageTabs.value(senderName);
if (!tab)
tab = messageTabs.value(QString::fromStdString(event.receiver_name()));
if (!tab)
if (!tab) {
UserListTWI *twi = tabUserLists->getAllUsersList()->getUsers().value(senderName);
if (twi) {
UserLevelFlags userLevel = UserLevelFlags(twi->getUserInfo().user_level());
if (settingsCache->getIgnoreUnregisteredUserMessages() &&
!userLevel.testFlag(ServerInfo_User::IsRegistered))
// Flags are additive, so reg/mod/admin are all IsRegistered
return;
}
tab = addMessageTab(QString::fromStdString(event.sender_name()), false);
}
if (!tab)
return;
tab->processUserMessageEvent(event);
......
......@@ -118,7 +118,6 @@ void ZoneViewZone::reorganizeCards()
typeRow++; // add below current card
else { // if no match then move card to next column
typeColumn++;
longestRow = qMax(typeRow, longestRow);
typeRow = 0;
}
}
......@@ -128,6 +127,7 @@ void ZoneViewZone::reorganizeCards()
qreal y = typeRow * CARD_HEIGHT / 3;
c->setPos(x + 5, y + 5);
c->setRealZValue(i);
longestRow = qMax(typeRow, longestRow);
}
} else {
for (int i = 0; i < cardCount; i++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment