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
10aa1374
Commit
10aa1374
authored
Jan 20, 2015
by
Gavin Bisesi
Browse files
Merge pull request #562 from poixen/chat_click_mentions
Click tag mentions
parents
fe53d6d6
222105be
Changes
6
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/chatview.cpp
View file @
10aa1374
...
@@ -249,12 +249,22 @@ void ChatView::mousePressEvent(QMouseEvent *event)
...
@@ -249,12 +249,22 @@ void ChatView::mousePressEvent(QMouseEvent *event)
break
;
break
;
}
}
case
HoveredUser
:
{
case
HoveredUser
:
{
if
(
event
->
button
()
=
=
Qt
::
Right
Button
)
{
if
(
event
->
button
()
!
=
Qt
::
Mid
Button
)
{
const
int
delimiterIndex
=
hoveredContent
.
indexOf
(
"_"
);
const
int
delimiterIndex
=
hoveredContent
.
indexOf
(
"_"
);
UserLevelFlags
userLevel
(
hoveredContent
.
left
(
delimiterIndex
).
toInt
());
const
QString
userName
=
hoveredContent
.
mid
(
delimiterIndex
+
1
);
const
QString
userName
=
hoveredContent
.
mid
(
delimiterIndex
+
1
);
switch
(
event
->
button
())
{
userContextMenu
->
showContextMenu
(
event
->
globalPos
(),
userName
,
userLevel
);
case
Qt
::
RightButton
:{
UserLevelFlags
userLevel
(
hoveredContent
.
left
(
delimiterIndex
).
toInt
());
userContextMenu
->
showContextMenu
(
event
->
globalPos
(),
userName
,
userLevel
);
break
;
}
case
Qt
::
LeftButton
:{
emit
addMentionTag
(
"@"
+
userName
);
break
;
}
default:
break
;
}
}
}
break
;
break
;
}
}
...
...
cockatrice/src/chatview.h
View file @
10aa1374
...
@@ -49,6 +49,7 @@ signals:
...
@@ -49,6 +49,7 @@ signals:
void
cardNameHovered
(
QString
cardName
);
void
cardNameHovered
(
QString
cardName
);
void
showCardInfoPopup
(
QPoint
pos
,
QString
cardName
);
void
showCardInfoPopup
(
QPoint
pos
,
QString
cardName
);
void
deleteCardInfoPopup
(
QString
cardName
);
void
deleteCardInfoPopup
(
QString
cardName
);
void
addMentionTag
(
QString
mentionTag
);
};
};
#endif
#endif
cockatrice/src/tab_game.cpp
View file @
10aa1374
...
@@ -418,6 +418,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
...
@@ -418,6 +418,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
connect
(
messageLog
,
SIGNAL
(
cardNameHovered
(
QString
)),
cardInfo
,
SLOT
(
setCard
(
QString
)));
connect
(
messageLog
,
SIGNAL
(
cardNameHovered
(
QString
)),
cardInfo
,
SLOT
(
setCard
(
QString
)));
connect
(
messageLog
,
SIGNAL
(
showCardInfoPopup
(
QPoint
,
QString
)),
this
,
SLOT
(
showCardInfoPopup
(
QPoint
,
QString
)));
connect
(
messageLog
,
SIGNAL
(
showCardInfoPopup
(
QPoint
,
QString
)),
this
,
SLOT
(
showCardInfoPopup
(
QPoint
,
QString
)));
connect
(
messageLog
,
SIGNAL
(
deleteCardInfoPopup
(
QString
)),
this
,
SLOT
(
deleteCardInfoPopup
(
QString
)));
connect
(
messageLog
,
SIGNAL
(
deleteCardInfoPopup
(
QString
)),
this
,
SLOT
(
deleteCardInfoPopup
(
QString
)));
connect
(
messageLog
,
SIGNAL
(
addMentionTag
(
QString
)),
this
,
SLOT
(
addMentionTag
(
QString
)));
sayLabel
=
new
QLabel
;
sayLabel
=
new
QLabel
;
sayEdit
=
new
QLineEdit
;
sayEdit
=
new
QLineEdit
;
sayLabel
->
setBuddy
(
sayEdit
);
sayLabel
->
setBuddy
(
sayEdit
);
...
@@ -507,6 +508,11 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
...
@@ -507,6 +508,11 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
messageLog
->
logGameJoined
(
gameInfo
.
game_id
());
messageLog
->
logGameJoined
(
gameInfo
.
game_id
());
}
}
void
TabGame
::
addMentionTag
(
QString
value
)
{
sayEdit
->
insert
(
value
+
" "
);
sayEdit
->
setFocus
();
}
TabGame
::~
TabGame
()
TabGame
::~
TabGame
()
{
{
delete
replay
;
delete
replay
;
...
...
cockatrice/src/tab_game.h
View file @
10aa1374
...
@@ -195,6 +195,8 @@ private slots:
...
@@ -195,6 +195,8 @@ private slots:
void
actPhaseAction
();
void
actPhaseAction
();
void
actNextPhase
();
void
actNextPhase
();
void
actNextTurn
();
void
actNextTurn
();
void
addMentionTag
(
QString
value
);
public:
public:
TabGame
(
TabSupervisor
*
_tabSupervisor
,
QList
<
AbstractClient
*>
&
_clients
,
const
Event_GameJoined
&
event
,
const
QMap
<
int
,
QString
>
&
_roomGameTypes
);
TabGame
(
TabSupervisor
*
_tabSupervisor
,
QList
<
AbstractClient
*>
&
_clients
,
const
Event_GameJoined
&
event
,
const
QMap
<
int
,
QString
>
&
_roomGameTypes
);
TabGame
(
TabSupervisor
*
_tabSupervisor
,
GameReplay
*
replay
);
TabGame
(
TabSupervisor
*
_tabSupervisor
,
GameReplay
*
replay
);
...
...
cockatrice/src/tab_room.cpp
View file @
10aa1374
...
@@ -45,6 +45,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
...
@@ -45,6 +45,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
connect
(
chatView
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)),
this
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)));
connect
(
chatView
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)),
this
,
SIGNAL
(
openMessageDialog
(
QString
,
bool
)));
connect
(
chatView
,
SIGNAL
(
showCardInfoPopup
(
QPoint
,
QString
)),
this
,
SLOT
(
showCardInfoPopup
(
QPoint
,
QString
)));
connect
(
chatView
,
SIGNAL
(
showCardInfoPopup
(
QPoint
,
QString
)),
this
,
SLOT
(
showCardInfoPopup
(
QPoint
,
QString
)));
connect
(
chatView
,
SIGNAL
(
deleteCardInfoPopup
(
QString
)),
this
,
SLOT
(
deleteCardInfoPopup
(
QString
)));
connect
(
chatView
,
SIGNAL
(
deleteCardInfoPopup
(
QString
)),
this
,
SLOT
(
deleteCardInfoPopup
(
QString
)));
connect
(
chatView
,
SIGNAL
(
addMentionTag
(
QString
)),
this
,
SLOT
(
addMentionTag
(
QString
)));
sayLabel
=
new
QLabel
;
sayLabel
=
new
QLabel
;
sayEdit
=
new
QLineEdit
;
sayEdit
=
new
QLineEdit
;
sayLabel
->
setBuddy
(
sayEdit
);
sayLabel
->
setBuddy
(
sayEdit
);
...
@@ -239,6 +240,11 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
...
@@ -239,6 +240,11 @@ void TabRoom::processRoomSayEvent(const Event_RoomSay &event)
emit
userEvent
(
false
);
emit
userEvent
(
false
);
}
}
void
TabRoom
::
addMentionTag
(
QString
mentionTag
)
{
sayEdit
->
insert
(
mentionTag
+
" "
);
sayEdit
->
setFocus
();
}
PendingCommand
*
TabRoom
::
prepareRoomCommand
(
const
::
google
::
protobuf
::
Message
&
cmd
)
PendingCommand
*
TabRoom
::
prepareRoomCommand
(
const
::
google
::
protobuf
::
Message
&
cmd
)
{
{
return
client
->
prepareRoomCommand
(
cmd
,
roomId
);
return
client
->
prepareRoomCommand
(
cmd
,
roomId
);
...
...
cockatrice/src/tab_room.h
View file @
10aa1374
...
@@ -58,6 +58,7 @@ private slots:
...
@@ -58,6 +58,7 @@ private slots:
void
actClearChat
();
void
actClearChat
();
void
actOpenChatSettings
();
void
actOpenChatSettings
();
void
ignoreUnregisteredUsersChanged
();
void
ignoreUnregisteredUsersChanged
();
void
addMentionTag
(
QString
mentionTag
);
void
processListGamesEvent
(
const
Event_ListGames
&
event
);
void
processListGamesEvent
(
const
Event_ListGames
&
event
);
void
processJoinRoomEvent
(
const
Event_JoinRoom
&
event
);
void
processJoinRoomEvent
(
const
Event_JoinRoom
&
event
);
...
...
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