Moved "Ignore messages from unregistered users"

Relocated to the chat settings tab.
This commit is contained in:
Matt Lowe 2015-01-20 20:02:36 +01:00
parent 6dfaa81a53
commit b9c537bf47
6 changed files with 11 additions and 23 deletions

View file

@ -574,8 +574,13 @@ MessagesSettingsPage::MessagesSettingsPage()
chatMentionCheckBox.setChecked(settingsCache->getChatMention()); chatMentionCheckBox.setChecked(settingsCache->getChatMention());
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int))); connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
QGridLayout *chatGrid = new QGridLayout; QGridLayout *chatGrid = new QGridLayout;
chatGrid->addWidget(&chatMentionCheckBox, 0, 0); chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
chatGroupBox = new QGroupBox; chatGroupBox = new QGroupBox;
chatGroupBox->setLayout(chatGrid); chatGroupBox->setLayout(chatGrid);
@ -647,6 +652,7 @@ void MessagesSettingsPage::retranslateUi()
chatGroupBox->setTitle(tr("Chat settings")); chatGroupBox->setTitle(tr("Chat settings"));
chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)")); chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
messageShortcuts->setTitle(tr("In-game message macros")); messageShortcuts->setTitle(tr("In-game message macros"));
ignoreUnregUsersMainChat.setText(tr("Ignore unregisterd users in main chat"));
} }
DlgSettings::DlgSettings(QWidget *parent) DlgSettings::DlgSettings(QWidget *parent)

View file

@ -161,6 +161,7 @@ private:
QAction *aAdd; QAction *aAdd;
QAction *aRemove; QAction *aRemove;
QCheckBox chatMentionCheckBox; QCheckBox chatMentionCheckBox;
QCheckBox ignoreUnregUsersMainChat;
QGroupBox *chatGroupBox; QGroupBox *chatGroupBox;
QGroupBox *messageShortcuts; QGroupBox *messageShortcuts;

View file

@ -293,11 +293,10 @@ void SettingsCache::setPriceTagSource(int _priceTagSource)
settings->setValue("deckeditor/pricetagsource", priceTagSource); settings->setValue("deckeditor/pricetagsource", priceTagSource);
} }
void SettingsCache::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers) void SettingsCache::setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers)
{ {
ignoreUnregisteredUsers = _ignoreUnregisteredUsers; ignoreUnregisteredUsers = _ignoreUnregisteredUsers;
settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers); settings->setValue("chat/ignore_unregistered", ignoreUnregisteredUsers);
emit ignoreUnregisteredUsersChanged();
} }
void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry) void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)

View file

@ -154,7 +154,7 @@ public slots:
void setSoundPath(const QString &_soundPath); void setSoundPath(const QString &_soundPath);
void setPriceTagFeature(int _priceTagFeature); void setPriceTagFeature(int _priceTagFeature);
void setPriceTagSource(int _priceTagSource); void setPriceTagSource(int _priceTagSource);
void setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers); void setIgnoreUnregisteredUsers(int _ignoreUnregisteredUsers);
void setPicUrl(const QString &_picUrl); void setPicUrl(const QString &_picUrl);
void setPicUrlHq(const QString &_picUrlHq); void setPicUrlHq(const QString &_picUrlHq);
void setPicUrlFallback(const QString &_picUrlFallback); void setPicUrlFallback(const QString &_picUrlFallback);

View file

@ -52,15 +52,12 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage())); connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
QMenu *chatSettingsMenu = new QMenu(this); QMenu *chatSettingsMenu = new QMenu(this);
aIgnoreUnregisteredUsers = chatSettingsMenu->addAction(QString());
aIgnoreUnregisteredUsers->setCheckable(true);
connect(aIgnoreUnregisteredUsers, SIGNAL(triggered()), this, SLOT(actIgnoreUnregisteredUsers()));
chatSettingsMenu->addSeparator();
aClearChat = chatSettingsMenu->addAction(QString()); aClearChat = chatSettingsMenu->addAction(QString());
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat())); connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat()));
chatSettingsMenu->addSeparator();
aOpenChatSettings = chatSettingsMenu->addAction(QString()); aOpenChatSettings = chatSettingsMenu->addAction(QString());
connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings())); connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings()));
@ -124,7 +121,6 @@ void TabRoom::retranslateUi()
chatGroupBox->setTitle(tr("Chat")); chatGroupBox->setTitle(tr("Chat"));
roomMenu->setTitle(tr("&Room")); roomMenu->setTitle(tr("&Room"));
aLeaveRoom->setText(tr("&Leave room")); aLeaveRoom->setText(tr("&Leave room"));
aIgnoreUnregisteredUsers->setText(tr("&Ignore unregistered users in chat"));
aClearChat->setText(tr("&Clear chat")); aClearChat->setText(tr("&Clear chat"));
aOpenChatSettings->setText(tr("Chat Settings...")); aOpenChatSettings->setText(tr("Chat Settings..."));
} }
@ -174,17 +170,6 @@ void TabRoom::actLeaveRoom()
deleteLater(); deleteLater();
} }
void TabRoom::actIgnoreUnregisteredUsers()
{
aIgnoreUnregisteredUsers->setChecked(!aIgnoreUnregisteredUsers->isChecked());
settingsCache->setIgnoreUnregisteredUsers(!settingsCache->getIgnoreUnregisteredUsers());
}
void TabRoom::ignoreUnregisteredUsersChanged()
{
aIgnoreUnregisteredUsers->setChecked(settingsCache->getIgnoreUnregisteredUsers());
}
void TabRoom::actClearChat() { void TabRoom::actClearChat() {
chatView->clearChat(); chatView->clearChat();
} }

View file

@ -43,7 +43,6 @@ private:
QMenu *roomMenu; QMenu *roomMenu;
QAction *aLeaveRoom; QAction *aLeaveRoom;
QAction *aIgnoreUnregisteredUsers;
QAction *aOpenChatSettings; QAction *aOpenChatSettings;
QAction * aClearChat; QAction * aClearChat;
QString sanitizeHtml(QString dirty) const; QString sanitizeHtml(QString dirty) const;
@ -54,10 +53,8 @@ private slots:
void sendMessage(); void sendMessage();
void sayFinished(const Response &response); void sayFinished(const Response &response);
void actLeaveRoom(); void actLeaveRoom();
void actIgnoreUnregisteredUsers();
void actClearChat(); void actClearChat();
void actOpenChatSettings(); void actOpenChatSettings();
void ignoreUnregisteredUsersChanged();
void addMentionTag(QString mentionTag); void addMentionTag(QString mentionTag);
void processListGamesEvent(const Event_ListGames &event); void processListGamesEvent(const Event_ListGames &event);