mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 01:31:30 -05:00
Add Case Sensitive option for Lobby Notify.
This commit is contained in:
parent
dea776a61a
commit
d0482707c5
@ -38,8 +38,9 @@ ChatLobbyUserNotify::ChatLobbyUserNotify(QObject *parent) :
|
||||
|
||||
_bCheckForNickName = Settings->valueFromGroup(_group, "CheckForNickName", true).toBool();
|
||||
_bCountUnRead = Settings->valueFromGroup(_group, "CountUnRead", true).toBool();
|
||||
_bCountSpecificText = Settings->valueFromGroup(_group, "CountSpecificText").toBool();
|
||||
_textToNotify = Settings->valueFromGroup(_group, "TextToNotify").toStringList();
|
||||
_bCountSpecificText = Settings->valueFromGroup(_group, "CountSpecificText", false).toBool();
|
||||
_textToNotify = Settings->valueFromGroup(_group, "TextToNotify").toStringList();
|
||||
_bTextCaseSensitive = Settings->valueFromGroup(_group, "TextCaseSensitive", false).toBool();
|
||||
}
|
||||
|
||||
bool ChatLobbyUserNotify::hasSetting(QString *name, QString *group)
|
||||
@ -88,6 +89,14 @@ void ChatLobbyUserNotify::setTextToNotify(QString value)
|
||||
setTextToNotify(list);
|
||||
}
|
||||
|
||||
void ChatLobbyUserNotify::setTextCaseSensitive(bool value)
|
||||
{
|
||||
if (_bTextCaseSensitive != value) {
|
||||
_bTextCaseSensitive = value;
|
||||
Settings->setValueToGroup(_group, "TextCaseSensitive", value);
|
||||
}
|
||||
}
|
||||
|
||||
QIcon ChatLobbyUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/chat_32.png");
|
||||
@ -249,12 +258,12 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
|
||||
bGetNickName = checkWord(msg, QString::fromUtf8(details.mNickname.c_str()));
|
||||
}
|
||||
|
||||
bool bFoundTextToNotify = false;
|
||||
bool bFoundTextToNotify = false;
|
||||
|
||||
if(_bCountSpecificText)
|
||||
for (QStringList::Iterator it = _textToNotify.begin(); it != _textToNotify.end(); ++it) {
|
||||
bFoundTextToNotify |= checkWord(msg, (*it));
|
||||
}
|
||||
if(_bCountSpecificText)
|
||||
for (QStringList::Iterator it = _textToNotify.begin(); it != _textToNotify.end(); ++it) {
|
||||
bFoundTextToNotify |= checkWord(msg, (*it));
|
||||
}
|
||||
|
||||
if ((bGetNickName || bFoundTextToNotify || _bCountUnRead)){
|
||||
QString strAnchor = time.toString(Qt::ISODate);
|
||||
@ -272,7 +281,7 @@ bool ChatLobbyUserNotify::checkWord(QString message, QString word)
|
||||
{
|
||||
bool bFound = false;
|
||||
int nFound = -1;
|
||||
if (((nFound=message.indexOf(word)) != -1)
|
||||
if (((nFound=message.indexOf(word,0,_bTextCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)) != -1)
|
||||
&& (!word.isEmpty())) {
|
||||
QString eow=" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="; // end of word
|
||||
bool bFirstCharEOW = (nFound==0)?true:(eow.indexOf(message.at(nFound-1)) != -1);
|
||||
|
@ -55,11 +55,13 @@ public:
|
||||
bool isCheckForNickName() { return _bCheckForNickName;}
|
||||
void setCountUnRead(bool value);
|
||||
bool isCountUnRead() { return _bCountUnRead;}
|
||||
void setCountSpecificText(bool value);
|
||||
bool isCountSpecificText() { return _bCountSpecificText;}
|
||||
void setTextToNotify(QStringList);
|
||||
void setCountSpecificText(bool value);
|
||||
bool isCountSpecificText() { return _bCountSpecificText;}
|
||||
void setTextToNotify(QStringList);
|
||||
void setTextToNotify(QString);
|
||||
QString textToNotify() { return _textToNotify.join("\n");}
|
||||
void setTextCaseSensitive(bool value);
|
||||
bool isTextCaseSensitive() {return _bTextCaseSensitive;}
|
||||
|
||||
signals:
|
||||
void countChanged(ChatLobbyId id, unsigned int count);
|
||||
@ -84,10 +86,12 @@ private:
|
||||
typedef std::map<QString, MsgData> msg_map;
|
||||
typedef std::map<ChatLobbyId, msg_map> lobby_map;
|
||||
lobby_map _listMsg;
|
||||
QStringList _textToNotify;
|
||||
bool _bCheckForNickName;
|
||||
|
||||
bool _bCountUnRead;
|
||||
bool _bCountSpecificText;
|
||||
bool _bCheckForNickName;
|
||||
bool _bCountSpecificText;
|
||||
QStringList _textToNotify;
|
||||
bool _bTextCaseSensitive;
|
||||
};
|
||||
|
||||
#endif // CHATLOBBYUSERNOTIFY_H
|
||||
|
@ -44,7 +44,7 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
|
||||
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
|
||||
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
|
||||
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool))) ;
|
||||
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool)));
|
||||
|
||||
ui.notify_Blogs->hide();
|
||||
|
||||
@ -257,6 +257,7 @@ NotifyPage::save(QString &/*errmsg*/)
|
||||
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
|
||||
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
|
||||
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
|
||||
mChatLobbyUserNotify->setTextCaseSensitive(ui.chatLobbies_TextCaseSensitive->isChecked());
|
||||
}
|
||||
load();
|
||||
return true;
|
||||
@ -348,11 +349,12 @@ void NotifyPage::load()
|
||||
notifyToggled();
|
||||
|
||||
if (mChatLobbyUserNotify){
|
||||
ui.chatLobbies_TextToNotify->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
|
||||
ui.chatLobbies_CountFollowingText->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
|
||||
ui.chatLobbies_CountUnRead->setChecked(mChatLobbyUserNotify->isCountUnRead());
|
||||
ui.chatLobbies_CheckNickName->setChecked(mChatLobbyUserNotify->isCheckForNickName());
|
||||
ui.chatLobbies_CountFollowingText->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
|
||||
ui.chatLobbies_TextToNotify->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
|
||||
ui.chatLobbies_TextToNotify->setPlainText(mChatLobbyUserNotify->textToNotify());
|
||||
ui.chatLobbies_TextCaseSensitive->setChecked(mChatLobbyUserNotify->isTextCaseSensitive());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="NotifyPageVLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
@ -20,21 +20,30 @@
|
||||
<attribute name="title">
|
||||
<string>Feed</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<layout class="QVBoxLayout" name="tabFeedVLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="notify_ForumNewMsg">
|
||||
<widget class="QGroupBox" name="newsFeedGroupBox">
|
||||
<property name="title">
|
||||
<string>News Feed</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="notify_ForumNewMsgHLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="notify_VLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notify_Peers">
|
||||
<property name="text">
|
||||
@ -104,7 +113,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<layout class="QVBoxLayout" name="testFeedVLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="testFeedButton">
|
||||
<property name="text">
|
||||
@ -113,7 +122,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="testFeedVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -135,7 +144,7 @@
|
||||
<property name="title">
|
||||
<string>Message</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<layout class="QVBoxLayout" name="messageGroupBoxVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="message_ConnectAttempt">
|
||||
<property name="text">
|
||||
@ -147,7 +156,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="tabFeedVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -165,7 +174,7 @@
|
||||
<attribute name="title">
|
||||
<string>Toasters</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<layout class="QVBoxLayout" name="tabToastersVLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonDisableAll">
|
||||
<property name="toolTip">
|
||||
@ -180,11 +189,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="toasterGroupBox">
|
||||
<property name="title">
|
||||
<string>Toasters</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QVBoxLayout" name="toasterGroupBoxVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
@ -192,9 +201,9 @@
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="popup_HLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<layout class="QVBoxLayout" name="popupVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="popup_Connect">
|
||||
<property name="text">
|
||||
@ -250,7 +259,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<layout class="QVBoxLayout" name="testToasterVLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="testToasterButton">
|
||||
<property name="text">
|
||||
@ -259,7 +268,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<spacer name="testToasterVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -276,7 +285,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="positionGLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelToasterPosition">
|
||||
<property name="sizePolicy">
|
||||
@ -355,7 +364,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<spacer name="tabToastersVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -376,7 +385,7 @@
|
||||
<attribute name="title">
|
||||
<string>Systray</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<layout class="QVBoxLayout" name="tabSystrayVLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="trayNotifyGroupBox">
|
||||
<property name="title">
|
||||
@ -390,7 +399,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<widget class="QGroupBox" name="systrayMessageGroupBox">
|
||||
<property name="title">
|
||||
<string>Systray message</string>
|
||||
</property>
|
||||
@ -413,7 +422,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<spacer name="tabSystrayVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -431,7 +440,7 @@
|
||||
<attribute name="title">
|
||||
<string>Chat Lobbies</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<layout class="QVBoxLayout" name="tabChatLobbiesVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chatLobbies_CountUnRead">
|
||||
<property name="text">
|
||||
@ -457,7 +466,17 @@
|
||||
<widget class="QPlainTextEdit" name="chatLobbies_TextToNotify"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<widget class="QCheckBox" name="chatLobbies_TextCaseSensitive">
|
||||
<property name="toolTip">
|
||||
<string>Checked, if the identity and the text above occurences must be in the same case to trigger count.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Case sensitive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="tabChatLobbiesVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user