Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
2e3e6c55
Commit
2e3e6c55
authored
Jul 14, 2015
by
Fabio Bas
Browse files
Updated with latest changes from #1243
parent
87c70466
Changes
6
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/chatview.cpp
View file @
2e3e6c55
...
@@ -166,6 +166,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
...
@@ -166,6 +166,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
cursor
.
setCharFormat
(
messageFormat
);
cursor
.
setCharFormat
(
messageFormat
);
bool
mentionEnabled
=
settingsCache
->
getChatMention
();
bool
mentionEnabled
=
settingsCache
->
getChatMention
();
highlightedWords
=
settingsCache
->
getHighlightWords
().
split
(
' '
,
QString
::
SkipEmptyParts
);
// parse the message
// parse the message
while
(
message
.
size
())
while
(
message
.
size
())
{
{
...
@@ -318,16 +320,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
...
@@ -318,16 +320,8 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, QString &send
void
ChatView
::
checkWord
(
QTextCursor
&
cursor
,
QString
&
message
)
void
ChatView
::
checkWord
(
QTextCursor
&
cursor
,
QString
&
message
)
{
{
// extract the first word
// extract the first word
int
firstSpace
=
message
.
indexOf
(
' '
);
QString
rest
;
QString
fullWordUpToSpaceOrEnd
;
QString
fullWordUpToSpaceOrEnd
=
extractNextWord
(
message
,
rest
);
if
(
firstSpace
==
-
1
)
{
fullWordUpToSpaceOrEnd
=
message
;
message
.
clear
();
}
else
{
fullWordUpToSpaceOrEnd
=
message
.
mid
(
0
,
firstSpace
);
message
=
message
.
mid
(
firstSpace
);
}
// check urls
// check urls
if
(
fullWordUpToSpaceOrEnd
.
startsWith
(
"http://"
,
Qt
::
CaseInsensitive
)
||
if
(
fullWordUpToSpaceOrEnd
.
startsWith
(
"http://"
,
Qt
::
CaseInsensitive
)
||
...
@@ -338,30 +332,60 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
...
@@ -338,30 +332,60 @@ void ChatView::checkWord(QTextCursor &cursor, QString &message)
if
(
qUrl
.
isValid
())
if
(
qUrl
.
isValid
())
{
{
appendUrlTag
(
cursor
,
fullWordUpToSpaceOrEnd
);
appendUrlTag
(
cursor
,
fullWordUpToSpaceOrEnd
);
cursor
.
insertText
(
rest
,
defaultFormat
);
return
;
return
;
}
}
}
}
// check word mentions
// check word mentions
const
QStringList
highlightedWords
=
settingsCache
->
getHighlightWords
();
foreach
(
QString
word
,
highlightedWords
)
foreach
(
QString
word
,
highlightedWords
)
{
{
if
(
fullWordUpToSpaceOrEnd
.
compare
(
word
,
Qt
::
CaseInsensitive
)
==
0
)
if
(
fullWordUpToSpaceOrEnd
.
compare
(
word
,
Qt
::
CaseInsensitive
)
==
0
)
{
{
// You have received a valid mention of custom word!!
// You have received a valid mention of custom word!!
mention
Format
.
setBackground
(
QBrush
(
getCustom
Mention
Color
()));
highlight
Format
.
setBackground
(
QBrush
(
getCustom
Highlight
Color
()));
mention
Format
.
setForeground
(
settingsCache
->
getChat
Mention
Foreground
()
?
QBrush
(
Qt
::
white
)
:
QBrush
(
Qt
::
black
));
highlight
Format
.
setForeground
(
settingsCache
->
getChat
Highlight
Foreground
()
?
QBrush
(
Qt
::
white
)
:
QBrush
(
Qt
::
black
));
cursor
.
insertText
(
fullWordUpToSpaceOrEnd
,
mention
Format
);
cursor
.
insertText
(
fullWordUpToSpaceOrEnd
,
highlight
Format
);
cursor
.
setCharFormat
(
defaultFormat
);
cursor
.
setCharFormat
(
defaultFormat
);
cursor
.
insertText
(
rest
,
defaultFormat
);
QApplication
::
alert
(
this
);
QApplication
::
alert
(
this
);
return
;
return
;
}
}
}
}
// not a special word; just print it
// not a special word; just print it
cursor
.
insertText
(
fullWordUpToSpaceOrEnd
,
defaultFormat
);
cursor
.
insertText
(
fullWordUpToSpaceOrEnd
+
rest
,
defaultFormat
);
}
}
QString
ChatView
::
extractNextWord
(
QString
&
message
,
QString
&
rest
)
{
// get the first next space and extract the word
QString
word
;
int
firstSpace
=
message
.
indexOf
(
' '
);
if
(
firstSpace
==
-
1
)
{
word
=
message
;
message
.
clear
();
}
else
{
word
=
message
.
mid
(
0
,
firstSpace
);
message
=
message
.
mid
(
firstSpace
);
}
// remove any punctution from the end and pass it separately
for
(
int
len
=
word
.
size
()
-
1
;
len
>=
0
;
--
len
)
{
if
(
word
.
at
(
len
).
isLetterOrNumber
())
{
rest
=
word
.
mid
(
len
+
1
);
return
word
.
mid
(
0
,
len
+
1
);
}
}
rest
=
word
;
return
QString
();
}
bool
ChatView
::
isModeratorSendingGlobal
(
QFlags
<
ServerInfo_User
::
UserLevelFlag
>
userLevelFlag
,
QString
message
)
bool
ChatView
::
isModeratorSendingGlobal
(
QFlags
<
ServerInfo_User
::
UserLevelFlag
>
userLevelFlag
,
QString
message
)
{
{
int
userLevel
=
QString
::
number
(
userLevelFlag
).
toInt
();
int
userLevel
=
QString
::
number
(
userLevelFlag
).
toInt
();
...
@@ -387,13 +411,18 @@ void ChatView::showSystemPopup(QString &sender) {
...
@@ -387,13 +411,18 @@ void ChatView::showSystemPopup(QString &sender) {
emit
showMentionPopup
(
sender
);
emit
showMentionPopup
(
sender
);
}
}
QColor
ChatView
::
getCustomMentionColor
()
{
QColor
ChatView
::
getCustomMentionColor
()
{
QColor
customColor
;
QColor
customColor
;
customColor
.
setNamedColor
(
"#"
+
settingsCache
->
getChatMentionColor
());
customColor
.
setNamedColor
(
"#"
+
settingsCache
->
getChatMentionColor
());
return
customColor
.
isValid
()
?
customColor
:
DEFAULT_MENTION_COLOR
;
return
customColor
.
isValid
()
?
customColor
:
DEFAULT_MENTION_COLOR
;
}
}
QColor
ChatView
::
getCustomHighlightColor
()
{
QColor
customColor
;
customColor
.
setNamedColor
(
"#"
+
settingsCache
->
getChatHighlightColor
());
return
customColor
.
isValid
()
?
customColor
:
DEFAULT_MENTION_COLOR
;
}
/**
/**
Returns the correct case version of the provided username, if no correct casing version
Returns the correct case version of the provided username, if no correct casing version
was found then the provided name is not available and will return an empty QString.
was found then the provided name is not available and will return an empty QString.
...
...
cockatrice/src/chatview.h
View file @
2e3e6c55
...
@@ -27,8 +27,10 @@ private:
...
@@ -27,8 +27,10 @@ private:
QString
userName
;
QString
userName
;
QString
mention
;
QString
mention
;
QTextCharFormat
mentionFormat
;
QTextCharFormat
mentionFormat
;
QTextCharFormat
highlightFormat
;
QTextCharFormat
mentionFormatOtherUser
;
QTextCharFormat
mentionFormatOtherUser
;
QTextCharFormat
defaultFormat
;
QTextCharFormat
defaultFormat
;
QStringList
highlightedWords
;
bool
evenNumber
;
bool
evenNumber
;
bool
showTimestamps
;
bool
showTimestamps
;
HoveredItemType
hoveredItemType
;
HoveredItemType
hoveredItemType
;
...
@@ -41,12 +43,14 @@ private:
...
@@ -41,12 +43,14 @@ private:
QString
getNameFromUserList
(
QMap
<
QString
,
UserListTWI
*>
&
userList
,
QString
&
userName
);
QString
getNameFromUserList
(
QMap
<
QString
,
UserListTWI
*>
&
userList
,
QString
&
userName
);
bool
isFullMentionAValidUser
(
QMap
<
QString
,
UserListTWI
*>
&
userList
,
QString
userNameToMatch
);
bool
isFullMentionAValidUser
(
QMap
<
QString
,
UserListTWI
*>
&
userList
,
QString
userNameToMatch
);
QColor
getCustomMentionColor
();
QColor
getCustomMentionColor
();
QColor
getCustomHighlightColor
();
bool
shouldShowSystemPopup
();
bool
shouldShowSystemPopup
();
void
showSystemPopup
(
QString
&
sender
);
void
showSystemPopup
(
QString
&
sender
);
bool
isModeratorSendingGlobal
(
QFlags
<
ServerInfo_User
::
UserLevelFlag
>
userLevelFlag
,
QString
message
);
bool
isModeratorSendingGlobal
(
QFlags
<
ServerInfo_User
::
UserLevelFlag
>
userLevelFlag
,
QString
message
);
void
checkTag
(
QTextCursor
&
cursor
,
QString
&
message
);
void
checkTag
(
QTextCursor
&
cursor
,
QString
&
message
);
void
checkMention
(
QTextCursor
&
cursor
,
QString
&
message
,
QString
&
sender
,
UserLevelFlags
userLevel
);
void
checkMention
(
QTextCursor
&
cursor
,
QString
&
message
,
QString
&
sender
,
UserLevelFlags
userLevel
);
void
checkWord
(
QTextCursor
&
cursor
,
QString
&
message
);
void
checkWord
(
QTextCursor
&
cursor
,
QString
&
message
);
QString
extractNextWord
(
QString
&
message
,
QString
&
rest
);
private
slots
:
private
slots
:
void
openLink
(
const
QUrl
&
link
);
void
openLink
(
const
QUrl
&
link
);
void
actMessageClicked
();
void
actMessageClicked
();
...
...
cockatrice/src/dlg_settings.cpp
View file @
2e3e6c55
...
@@ -580,6 +580,9 @@ MessagesSettingsPage::MessagesSettingsPage()
...
@@ -580,6 +580,9 @@ MessagesSettingsPage::MessagesSettingsPage()
invertMentionForeground
.
setChecked
(
settingsCache
->
getChatMentionForeground
());
invertMentionForeground
.
setChecked
(
settingsCache
->
getChatMentionForeground
());
connect
(
&
invertMentionForeground
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
updateTextColor
(
int
)));
connect
(
&
invertMentionForeground
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
updateTextColor
(
int
)));
invertHighlightForeground
.
setChecked
(
settingsCache
->
getChatHighlightForeground
());
connect
(
&
invertHighlightForeground
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
updateTextHighlightColor
(
int
)));
mentionColor
=
new
QLineEdit
();
mentionColor
=
new
QLineEdit
();
mentionColor
->
setText
(
settingsCache
->
getChatMentionColor
());
mentionColor
->
setText
(
settingsCache
->
getChatMentionColor
());
updateMentionPreview
();
updateMentionPreview
();
...
@@ -592,8 +595,8 @@ MessagesSettingsPage::MessagesSettingsPage()
...
@@ -592,8 +595,8 @@ MessagesSettingsPage::MessagesSettingsPage()
connect
(
&
mentionPopups
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setShowMentionPopups
(
int
)));
connect
(
&
mentionPopups
,
SIGNAL
(
stateChanged
(
int
)),
settingsCache
,
SLOT
(
setShowMentionPopups
(
int
)));
customAlertString
=
new
QLineEdit
();
customAlertString
=
new
QLineEdit
();
customAlertString
->
setPlaceholderText
(
"Word1
,
Word2
,
Word3"
);
customAlertString
->
setPlaceholderText
(
"Word1 Word2 Word3"
);
customAlertString
->
setText
(
settingsCache
->
getHighlightWords
()
.
join
(
", "
)
);
customAlertString
->
setText
(
settingsCache
->
getHighlightWords
());
connect
(
customAlertString
,
SIGNAL
(
textChanged
(
QString
)),
settingsCache
,
SLOT
(
setHighlightWords
(
QString
)));
connect
(
customAlertString
,
SIGNAL
(
textChanged
(
QString
)),
settingsCache
,
SLOT
(
setHighlightWords
(
QString
)));
QGridLayout
*
chatGrid
=
new
QGridLayout
;
QGridLayout
*
chatGrid
=
new
QGridLayout
;
...
@@ -608,9 +611,17 @@ MessagesSettingsPage::MessagesSettingsPage()
...
@@ -608,9 +611,17 @@ MessagesSettingsPage::MessagesSettingsPage()
chatGroupBox
=
new
QGroupBox
;
chatGroupBox
=
new
QGroupBox
;
chatGroupBox
->
setLayout
(
chatGrid
);
chatGroupBox
->
setLayout
(
chatGrid
);
highlightColor
=
new
QLineEdit
();
highlightColor
->
setText
(
settingsCache
->
getChatHighlightColor
());
updateHighlightPreview
();
connect
(
highlightColor
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
updateHighlightColor
(
QString
)));
QGridLayout
*
highlightNotice
=
new
QGridLayout
;
QGridLayout
*
highlightNotice
=
new
QGridLayout
;
highlightNotice
->
addWidget
(
highlightColor
,
0
,
2
);
highlightNotice
->
addWidget
(
&
invertHighlightForeground
,
0
,
1
);
highlightNotice
->
addWidget
(
&
hexHighlightLabel
,
1
,
2
);
highlightNotice
->
addWidget
(
customAlertString
,
0
,
0
);
highlightNotice
->
addWidget
(
customAlertString
,
0
,
0
);
highlightNotice
->
addWidget
(
&
customAlertStringLabel
,
1
,
0
);
highlightNotice
->
addWidget
(
&
customAlertStringLabel
,
1
,
0
);
highlightGroupBox
=
new
QGroupBox
;
highlightGroupBox
=
new
QGroupBox
;
highlightGroupBox
->
setLayout
(
highlightNotice
);
highlightGroupBox
->
setLayout
(
highlightNotice
);
...
@@ -660,16 +671,35 @@ void MessagesSettingsPage::updateColor(const QString &value) {
...
@@ -660,16 +671,35 @@ void MessagesSettingsPage::updateColor(const QString &value) {
}
}
}
}
void
MessagesSettingsPage
::
updateHighlightColor
(
const
QString
&
value
)
{
QColor
colorToSet
;
colorToSet
.
setNamedColor
(
"#"
+
value
);
if
(
colorToSet
.
isValid
())
{
settingsCache
->
setChatHighlightColor
(
value
);
updateHighlightPreview
();
}
}
void
MessagesSettingsPage
::
updateTextColor
(
int
value
)
{
void
MessagesSettingsPage
::
updateTextColor
(
int
value
)
{
settingsCache
->
setChatMentionForeground
(
value
);
settingsCache
->
setChatMentionForeground
(
value
);
updateMentionPreview
();
updateMentionPreview
();
}
}
void
MessagesSettingsPage
::
updateTextHighlightColor
(
int
value
)
{
settingsCache
->
setChatHighlightForeground
(
value
);
updateHighlightPreview
();
}
void
MessagesSettingsPage
::
updateMentionPreview
()
{
void
MessagesSettingsPage
::
updateMentionPreview
()
{
mentionColor
->
setStyleSheet
(
"QLineEdit{background:#"
+
settingsCache
->
getChatMentionColor
()
+
mentionColor
->
setStyleSheet
(
"QLineEdit{background:#"
+
settingsCache
->
getChatMentionColor
()
+
";color: "
+
(
settingsCache
->
getChatMentionForeground
()
?
"white"
:
"black"
)
+
";}"
);
";color: "
+
(
settingsCache
->
getChatMentionForeground
()
?
"white"
:
"black"
)
+
";}"
);
}
}
void
MessagesSettingsPage
::
updateHighlightPreview
()
{
highlightColor
->
setStyleSheet
(
"QLineEdit{background:#"
+
settingsCache
->
getChatHighlightColor
()
+
";color: "
+
(
settingsCache
->
getChatHighlightForeground
()
?
"white"
:
"black"
)
+
";}"
);
}
void
MessagesSettingsPage
::
storeSettings
()
void
MessagesSettingsPage
::
storeSettings
()
{
{
QSettings
settings
;
QSettings
settings
;
...
@@ -703,14 +733,15 @@ void MessagesSettingsPage::retranslateUi()
...
@@ -703,14 +733,15 @@ void MessagesSettingsPage::retranslateUi()
highlightGroupBox
->
setTitle
(
tr
(
"Custom alert words"
));
highlightGroupBox
->
setTitle
(
tr
(
"Custom alert words"
));
chatMentionCheckBox
.
setText
(
tr
(
"Enable chat mentions"
));
chatMentionCheckBox
.
setText
(
tr
(
"Enable chat mentions"
));
messageShortcuts
->
setTitle
(
tr
(
"In-game message macros"
));
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"
));
ignoreUnregUsersMainChat
.
setText
(
tr
(
"Ignore chat room messages sent by unregistered users."
));
ignoreUnregUserMessages
.
setText
(
tr
(
"Ignore private messages sent by unregistered users"
));
ignoreUnregUserMessages
.
setText
(
tr
(
"Ignore private messages sent by unregistered users."
));
invertMentionForeground
.
setText
(
tr
(
"Invert text color"
));
invertMentionForeground
.
setText
(
tr
(
"Invert text color"
));
messagePopups
.
setText
(
tr
(
"Enable desktop notifications for private messages."
));
invertHighlightForeground
.
setText
(
tr
(
"Invert text color"
));
messagePopups
.
setText
(
tr
(
"Enable desktop notifications for private messages"
));
mentionPopups
.
setText
(
tr
(
"Enable desktop notification for mentions."
));
mentionPopups
.
setText
(
tr
(
"Enable desktop notification for mentions."
));
hexLabel
.
setText
(
tr
(
"(Color is hexadecimal)"
));
hexLabel
.
setText
(
tr
(
"(Color is hexadecimal)"
));
customAlertStringLabel
.
setText
(
tr
(
"(Seperate each word with a comma, words are case insensitive)"
));
hexHighlightLabel
.
setText
(
tr
(
"(Color is hexadecimal)"
));
customAlertStringLabel
.
setText
(
tr
(
"(Seperate each word with a space, words are case insensitive)"
));
}
}
...
...
cockatrice/src/dlg_settings.h
View file @
2e3e6c55
...
@@ -160,13 +160,16 @@ private slots:
...
@@ -160,13 +160,16 @@ private slots:
void
actAdd
();
void
actAdd
();
void
actRemove
();
void
actRemove
();
void
updateColor
(
const
QString
&
value
);
void
updateColor
(
const
QString
&
value
);
void
updateHighlightColor
(
const
QString
&
value
);
void
updateTextColor
(
int
value
);
void
updateTextColor
(
int
value
);
void
updateTextHighlightColor
(
int
value
);
private:
private:
QListWidget
*
messageList
;
QListWidget
*
messageList
;
QAction
*
aAdd
;
QAction
*
aAdd
;
QAction
*
aRemove
;
QAction
*
aRemove
;
QCheckBox
chatMentionCheckBox
;
QCheckBox
chatMentionCheckBox
;
QCheckBox
invertMentionForeground
;
QCheckBox
invertMentionForeground
;
QCheckBox
invertHighlightForeground
;
QCheckBox
ignoreUnregUsersMainChat
;
QCheckBox
ignoreUnregUsersMainChat
;
QCheckBox
ignoreUnregUserMessages
;
QCheckBox
ignoreUnregUserMessages
;
QCheckBox
messagePopups
;
QCheckBox
messagePopups
;
...
@@ -175,12 +178,15 @@ private:
...
@@ -175,12 +178,15 @@ private:
QGroupBox
*
highlightGroupBox
;
QGroupBox
*
highlightGroupBox
;
QGroupBox
*
messageShortcuts
;
QGroupBox
*
messageShortcuts
;
QLineEdit
*
mentionColor
;
QLineEdit
*
mentionColor
;
QLineEdit
*
highlightColor
;
QLineEdit
*
customAlertString
;
QLineEdit
*
customAlertString
;
QLabel
hexLabel
;
QLabel
hexLabel
;
QLabel
hexHighlightLabel
;
QLabel
customAlertStringLabel
;
QLabel
customAlertStringLabel
;
void
storeSettings
();
void
storeSettings
();
void
updateMentionPreview
();
void
updateMentionPreview
();
void
updateHighlightPreview
();
};
};
class
SoundSettingsPage
:
public
AbstractSettingsPage
{
class
SoundSettingsPage
:
public
AbstractSettingsPage
{
...
...
cockatrice/src/settingscache.cpp
View file @
2e3e6c55
...
@@ -56,7 +56,9 @@ SettingsCache::SettingsCache()
...
@@ -56,7 +56,9 @@ SettingsCache::SettingsCache()
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
tapAnimation
=
settings
->
value
(
"cards/tapanimation"
,
true
).
toBool
();
chatMention
=
settings
->
value
(
"chat/mention"
,
true
).
toBool
();
chatMention
=
settings
->
value
(
"chat/mention"
,
true
).
toBool
();
chatMentionForeground
=
settings
->
value
(
"chat/mentionforeground"
,
true
).
toBool
();
chatMentionForeground
=
settings
->
value
(
"chat/mentionforeground"
,
true
).
toBool
();
chatHighlightForeground
=
settings
->
value
(
"chat/highlightforeground"
,
true
).
toBool
();
chatMentionColor
=
settings
->
value
(
"chat/mentioncolor"
,
"A6120D"
).
toString
();
chatMentionColor
=
settings
->
value
(
"chat/mentioncolor"
,
"A6120D"
).
toString
();
chatHighlightColor
=
settings
->
value
(
"chat/highlightcolor"
,
"A6120D"
).
toString
();
zoneViewSortByName
=
settings
->
value
(
"zoneview/sortbyname"
,
true
).
toBool
();
zoneViewSortByName
=
settings
->
value
(
"zoneview/sortbyname"
,
true
).
toBool
();
zoneViewSortByType
=
settings
->
value
(
"zoneview/sortbytype"
,
true
).
toBool
();
zoneViewSortByType
=
settings
->
value
(
"zoneview/sortbytype"
,
true
).
toBool
();
...
@@ -83,7 +85,7 @@ SettingsCache::SettingsCache()
...
@@ -83,7 +85,7 @@ SettingsCache::SettingsCache()
cardInfoViewMode
=
settings
->
value
(
"cards/cardinfoviewmode"
,
0
).
toInt
();
cardInfoViewMode
=
settings
->
value
(
"cards/cardinfoviewmode"
,
0
).
toInt
();
highlightWords
=
settings
->
value
(
"personal/highlightWords"
,
QString
List
()).
toString
List
();
highlightWords
=
settings
->
value
(
"personal/highlightWords"
,
QString
()).
toString
();
}
}
void
SettingsCache
::
setCardInfoViewMode
(
const
int
_viewMode
)
{
void
SettingsCache
::
setCardInfoViewMode
(
const
int
_viewMode
)
{
...
@@ -92,8 +94,7 @@ void SettingsCache::setCardInfoViewMode(const int _viewMode) {
...
@@ -92,8 +94,7 @@ void SettingsCache::setCardInfoViewMode(const int _viewMode) {
}
}
void
SettingsCache
::
setHighlightWords
(
const
QString
&
_highlightWords
)
{
void
SettingsCache
::
setHighlightWords
(
const
QString
&
_highlightWords
)
{
// Words are seperated by a comma and you can not use spaces in words
highlightWords
=
_highlightWords
;
highlightWords
=
_highlightWords
.
simplified
().
replace
(
" "
,
""
).
split
(
","
);
settings
->
setValue
(
"personal/highlightWords"
,
highlightWords
);
settings
->
setValue
(
"personal/highlightWords"
,
highlightWords
);
}
}
...
@@ -322,11 +323,21 @@ void SettingsCache::setChatMentionForeground(int _chatMentionForeground) {
...
@@ -322,11 +323,21 @@ void SettingsCache::setChatMentionForeground(int _chatMentionForeground) {
settings
->
setValue
(
"chat/mentionforeground"
,
chatMentionForeground
);
settings
->
setValue
(
"chat/mentionforeground"
,
chatMentionForeground
);
}
}
void
SettingsCache
::
setChatHighlightForeground
(
int
_chatHighlightForeground
)
{
chatHighlightForeground
=
_chatHighlightForeground
;
settings
->
setValue
(
"chat/highlightforeground"
,
chatHighlightForeground
);
}
void
SettingsCache
::
setChatMentionColor
(
const
QString
&
_chatMentionColor
)
{
void
SettingsCache
::
setChatMentionColor
(
const
QString
&
_chatMentionColor
)
{
chatMentionColor
=
_chatMentionColor
;
chatMentionColor
=
_chatMentionColor
;
settings
->
setValue
(
"chat/mentioncolor"
,
chatMentionColor
);
settings
->
setValue
(
"chat/mentioncolor"
,
chatMentionColor
);
}
}
void
SettingsCache
::
setChatHighlightColor
(
const
QString
&
_chatHighlightColor
)
{
chatHighlightColor
=
_chatHighlightColor
;
settings
->
setValue
(
"chat/highlightcolor"
,
chatHighlightColor
);
}
void
SettingsCache
::
setZoneViewSortByName
(
int
_zoneViewSortByName
)
void
SettingsCache
::
setZoneViewSortByName
(
int
_zoneViewSortByName
)
{
{
zoneViewSortByName
=
_zoneViewSortByName
;
zoneViewSortByName
=
_zoneViewSortByName
;
...
...
cockatrice/src/settingscache.h
View file @
2e3e6c55
...
@@ -65,7 +65,9 @@ private:
...
@@ -65,7 +65,9 @@ private:
bool
tapAnimation
;
bool
tapAnimation
;
bool
chatMention
;
bool
chatMention
;
QString
chatMentionColor
;
QString
chatMentionColor
;
QString
chatHighlightColor
;
bool
chatMentionForeground
;
bool
chatMentionForeground
;
bool
chatHighlightForeground
;
bool
zoneViewSortByName
,
zoneViewSortByType
,
zoneViewPileView
;
bool
zoneViewSortByName
,
zoneViewSortByType
,
zoneViewPileView
;
bool
soundEnabled
;
bool
soundEnabled
;
QString
soundPath
;
QString
soundPath
;
...
@@ -85,7 +87,7 @@ private:
...
@@ -85,7 +87,7 @@ private:
bool
leftJustified
;
bool
leftJustified
;
int
masterVolume
;
int
masterVolume
;
int
cardInfoViewMode
;
int
cardInfoViewMode
;
QString
List
highlightWords
;
QString
highlightWords
;
public:
public:
SettingsCache
();
SettingsCache
();
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
...
@@ -101,6 +103,7 @@ public:
...
@@ -101,6 +103,7 @@ public:
QString
getPlayerBgPath
()
const
{
return
playerBgPath
;
}
QString
getPlayerBgPath
()
const
{
return
playerBgPath
;
}
QString
getCardBackPicturePath
()
const
{
return
cardBackPicturePath
;
}
QString
getCardBackPicturePath
()
const
{
return
cardBackPicturePath
;
}
QString
getChatMentionColor
()
const
{
return
chatMentionColor
;
}
QString
getChatMentionColor
()
const
{
return
chatMentionColor
;
}
QString
getChatHighlightColor
()
const
{
return
chatHighlightColor
;
}
bool
getPicDownload
()
const
{
return
picDownload
;
}
bool
getPicDownload
()
const
{
return
picDownload
;
}
bool
getPicDownloadHq
()
const
{
return
picDownloadHq
;
}
bool
getPicDownloadHq
()
const
{
return
picDownloadHq
;
}
bool
getNotificationsEnabled
()
const
{
return
notificationsEnabled
;
}
bool
getNotificationsEnabled
()
const
{
return
notificationsEnabled
;
}
...
@@ -118,6 +121,7 @@ public:
...
@@ -118,6 +121,7 @@ public:
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
bool
getTapAnimation
()
const
{
return
tapAnimation
;
}
bool
getChatMention
()
const
{
return
chatMention
;
}
bool
getChatMention
()
const
{
return
chatMention
;
}
bool
getChatMentionForeground
()
const
{
return
chatMentionForeground
;
}
bool
getChatMentionForeground
()
const
{
return
chatMentionForeground
;
}
bool
getChatHighlightForeground
()
const
{
return
chatHighlightForeground
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByName
()
const
{
return
zoneViewSortByName
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
bool
getZoneViewSortByType
()
const
{
return
zoneViewSortByType
;
}
/**
/**
...
@@ -144,7 +148,7 @@ public:
...
@@ -144,7 +148,7 @@ public:
int
getMasterVolume
()
const
{
return
masterVolume
;
}
int
getMasterVolume
()
const
{
return
masterVolume
;
}
int
getCardInfoViewMode
()
const
{
return
cardInfoViewMode
;
}
int
getCardInfoViewMode
()
const
{
return
cardInfoViewMode
;
}
QStringList
getCountries
()
const
;
QStringList
getCountries
()
const
;
QString
List
getHighlightWords
()
const
{
return
highlightWords
;
}
QString
getHighlightWords
()
const
{
return
highlightWords
;
}
public
slots
:
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
void
setLang
(
const
QString
&
_lang
);
...
@@ -159,6 +163,7 @@ public slots:
...
@@ -159,6 +163,7 @@ public slots:
void
setPlayerBgPath
(
const
QString
&
_playerBgPath
);
void
setPlayerBgPath
(
const
QString
&
_playerBgPath
);
void
setCardBackPicturePath
(
const
QString
&
_cardBackPicturePath
);
void
setCardBackPicturePath
(
const
QString
&
_cardBackPicturePath
);
void
setChatMentionColor
(
const
QString
&
_chatMentionColor
);
void
setChatMentionColor
(
const
QString
&
_chatMentionColor
);
void
setChatHighlightColor
(
const
QString
&
_chatHighlightColor
);
void
setPicDownload
(
int
_picDownload
);
void
setPicDownload
(
int
_picDownload
);
void
setPicDownloadHq
(
int
_picDownloadHq
);
void
setPicDownloadHq
(
int
_picDownloadHq
);
void
setNotificationsEnabled
(
int
_notificationsEnabled
);
void
setNotificationsEnabled
(
int
_notificationsEnabled
);
...
@@ -175,6 +180,7 @@ public slots:
...
@@ -175,6 +180,7 @@ public slots:
void
setTapAnimation
(
int
_tapAnimation
);
void
setTapAnimation
(
int
_tapAnimation
);
void
setChatMention
(
int
_chatMention
);
void
setChatMention
(
int
_chatMention
);
void
setChatMentionForeground
(
int
_chatMentionForeground
);
void
setChatMentionForeground
(
int
_chatMentionForeground
);
void
setChatHighlightForeground
(
int
_chatHighlightForeground
);
void
setZoneViewSortByName
(
int
_zoneViewSortByName
);
void
setZoneViewSortByName
(
int
_zoneViewSortByName
);
void
setZoneViewSortByType
(
int
_zoneViewSortByType
);
void
setZoneViewSortByType
(
int
_zoneViewSortByType
);
void
setZoneViewPileView
(
int
_zoneViewPileView
);
void
setZoneViewPileView
(
int
_zoneViewPileView
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment