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
8eeec5ac
Commit
8eeec5ac
authored
May 22, 2015
by
poixen
Browse files
Merge pull request #1087 from poixen/room_type
Added game type to tab title
parents
544666a3
7ac0f6f4
Changes
2
Show whitespace changes
Inline
Side-by-side
cockatrice/src/tab_game.cpp
View file @
8eeec5ac
...
@@ -359,6 +359,9 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
...
@@ -359,6 +359,9 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
splitter
->
restoreState
(
settingsCache
->
getTabGameSplitterSizes
());
splitter
->
restoreState
(
settingsCache
->
getTabGameSplitterSizes
());
messageLog
->
logReplayStarted
(
gameInfo
.
game_id
());
messageLog
->
logReplayStarted
(
gameInfo
.
game_id
());
for
(
int
i
=
gameInfo
.
game_types_size
()
-
1
;
i
>=
0
;
i
--
)
gameTypes
.
append
(
roomGameTypes
.
find
(
gameInfo
.
game_types
(
i
)).
value
());
}
}
TabGame
::
TabGame
(
TabSupervisor
*
_tabSupervisor
,
QList
<
AbstractClient
*>
&
_clients
,
const
Event_GameJoined
&
event
,
const
QMap
<
int
,
QString
>
&
_roomGameTypes
)
TabGame
::
TabGame
(
TabSupervisor
*
_tabSupervisor
,
QList
<
AbstractClient
*>
&
_clients
,
const
Event_GameJoined
&
event
,
const
QMap
<
int
,
QString
>
&
_roomGameTypes
)
...
@@ -490,6 +493,9 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
...
@@ -490,6 +493,9 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
splitter
->
restoreState
(
settingsCache
->
getTabGameSplitterSizes
());
splitter
->
restoreState
(
settingsCache
->
getTabGameSplitterSizes
());
messageLog
->
logGameJoined
(
gameInfo
.
game_id
());
messageLog
->
logGameJoined
(
gameInfo
.
game_id
());
for
(
int
i
=
gameInfo
.
game_types_size
()
-
1
;
i
>=
0
;
i
--
)
gameTypes
.
append
(
roomGameTypes
.
find
(
gameInfo
.
game_types
(
i
)).
value
());
}
}
void
TabGame
::
addMentionTag
(
QString
value
)
{
void
TabGame
::
addMentionTag
(
QString
value
)
{
...
@@ -1159,10 +1165,32 @@ CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) co
...
@@ -1159,10 +1165,32 @@ CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) co
QString
TabGame
::
getTabText
()
const
QString
TabGame
::
getTabText
()
const
{
{
QString
gameTypeInfo
;
if
(
gameTypes
.
size
()
!=
0
)
{
gameTypeInfo
=
gameTypes
.
at
(
0
);
if
(
gameTypes
.
size
()
>
1
)
gameTypeInfo
.
append
(
"..."
);
}
QString
gameDesc
(
gameInfo
.
description
().
c_str
());
QString
gameId
(
QString
::
number
(
gameInfo
.
game_id
()));
QString
tabText
;
if
(
replay
)
if
(
replay
)
return
tr
(
"Replay %1: %2"
).
arg
(
gameInfo
.
game_id
()).
arg
(
QString
::
fromStdString
(
gameInfo
.
description
()));
tabText
.
append
(
tr
(
"REPLAY "
));
if
(
!
gameTypeInfo
.
isEmpty
())
tabText
.
append
(
gameTypeInfo
+
" "
);
if
(
!
gameDesc
.
isEmpty
())
{
if
(
gameDesc
.
length
()
>=
15
)
tabText
.
append
(
"| "
+
gameDesc
.
left
(
15
)
+
"... "
);
else
else
return
tr
(
"Game %1: %2"
).
arg
(
gameInfo
.
game_id
()).
arg
(
QString
::
fromStdString
(
gameInfo
.
description
()));
tabText
.
append
(
"| "
+
gameDesc
+
" "
);
}
if
(
!
tabText
.
isEmpty
())
tabText
.
append
(
"| "
);
tabText
.
append
(
"#"
+
gameId
);
return
tabText
;
}
}
Player
*
TabGame
::
getActiveLocalPlayer
()
const
Player
*
TabGame
::
getActiveLocalPlayer
()
const
...
...
cockatrice/src/tab_game.h
View file @
8eeec5ac
...
@@ -115,6 +115,7 @@ private:
...
@@ -115,6 +115,7 @@ private:
int
activePlayer
;
int
activePlayer
;
CardItem
*
activeCard
;
CardItem
*
activeCard
;
bool
gameClosed
;
bool
gameClosed
;
QStringList
gameTypes
;
// Replay related members
// Replay related members
GameReplay
*
replay
;
GameReplay
*
replay
;
...
...
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