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
475c54bf
Commit
475c54bf
authored
Jul 26, 2015
by
Zach H
Browse files
fix 1032 merge conflicts
parent
e318b703
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_creategame.cpp
View file @
475c54bf
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include
<QSet>
#include
<QSet>
#include
"dlg_creategame.h"
#include
"dlg_creategame.h"
#include
"tab_room.h"
#include
"tab_room.h"
#include
"settingscache.h"
#include
"pending_command.h"
#include
"pending_command.h"
#include
"pb/room_commands.pb.h"
#include
"pb/room_commands.pb.h"
...
@@ -45,6 +46,7 @@ void DlgCreateGame::sharedCtor()
...
@@ -45,6 +46,7 @@ void DlgCreateGame::sharedCtor()
QCheckBox
*
gameTypeCheckBox
=
new
QCheckBox
(
gameTypeIterator
.
value
());
QCheckBox
*
gameTypeCheckBox
=
new
QCheckBox
(
gameTypeIterator
.
value
());
gameTypeLayout
->
addWidget
(
gameTypeCheckBox
);
gameTypeLayout
->
addWidget
(
gameTypeCheckBox
);
gameTypeCheckBoxes
.
insert
(
gameTypeIterator
.
key
(),
gameTypeCheckBox
);
gameTypeCheckBoxes
.
insert
(
gameTypeIterator
.
key
(),
gameTypeCheckBox
);
gameTypeCheckBoxes
[
gameTypeIterator
.
key
()]
->
setChecked
((
settingsCache
->
getGameTypes
().
contains
(
gameTypeIterator
.
value
()
+
", "
)
?
true
:
false
));
}
}
QGroupBox
*
gameTypeGroupBox
=
new
QGroupBox
(
tr
(
"Game type"
));
QGroupBox
*
gameTypeGroupBox
=
new
QGroupBox
(
tr
(
"Game type"
));
gameTypeGroupBox
->
setLayout
(
gameTypeLayout
);
gameTypeGroupBox
->
setLayout
(
gameTypeLayout
);
...
@@ -109,8 +111,20 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
...
@@ -109,8 +111,20 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
{
{
sharedCtor
();
sharedCtor
();
descriptionEdit
->
setText
(
settingsCache
->
getGameDescription
());
maxPlayersEdit
->
setValue
(
settingsCache
->
getMaxPlayers
());
onlyBuddiesCheckBox
->
setChecked
(
settingsCache
->
getOnlyBuddies
());
onlyRegisteredCheckBox
->
setChecked
(
settingsCache
->
getOnlyRegistered
());
spectatorsAllowedCheckBox
->
setChecked
(
settingsCache
->
getSpectatorsAllowed
());
spectatorsNeedPasswordCheckBox
->
setChecked
(
settingsCache
->
getSpectatorsNeedPassword
());
spectatorsCanTalkCheckBox
->
setChecked
(
settingsCache
->
getSpectatorsCanTalk
());
spectatorsSeeEverythingCheckBox
->
setChecked
(
settingsCache
->
getSpectatorsCanSeeEverything
());
clearButton
=
new
QPushButton
(
tr
(
"&Clear"
));
buttonBox
->
addButton
(
QDialogButtonBox
::
Cancel
);
buttonBox
->
addButton
(
QDialogButtonBox
::
Cancel
);
buttonBox
->
addButton
(
clearButton
,
QDialogButtonBox
::
ActionRole
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
actOK
()));
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
actOK
()));
connect
(
clearButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actReset
()));
setWindowTitle
(
tr
(
"Create game"
));
setWindowTitle
(
tr
(
"Create game"
));
}
}
...
@@ -157,8 +171,41 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
...
@@ -157,8 +171,41 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
setWindowTitle
(
tr
(
"Game information"
));
setWindowTitle
(
tr
(
"Game information"
));
}
}
void
DlgCreateGame
::
actReset
()
{
descriptionEdit
->
setText
(
""
);
maxPlayersEdit
->
setValue
(
2
);
passwordEdit
->
setText
(
""
);
onlyBuddiesCheckBox
->
setChecked
(
false
);
onlyRegisteredCheckBox
->
setChecked
(
true
);
spectatorsAllowedCheckBox
->
setChecked
(
true
);
spectatorsNeedPasswordCheckBox
->
setChecked
(
false
);
spectatorsCanTalkCheckBox
->
setChecked
(
false
);
spectatorsSeeEverythingCheckBox
->
setChecked
(
false
);
QMapIterator
<
int
,
QCheckBox
*>
gameTypeCheckBoxIterator
(
gameTypeCheckBoxes
);
while
(
gameTypeCheckBoxIterator
.
hasNext
())
{
gameTypeCheckBoxIterator
.
next
();
gameTypeCheckBoxIterator
.
value
()
->
setChecked
(
false
);
}
descriptionEdit
->
setFocus
();
}
void
DlgCreateGame
::
actOK
()
void
DlgCreateGame
::
actOK
()
{
{
settingsCache
->
setGameDescription
(
descriptionEdit
->
text
());
settingsCache
->
setMaxPlayers
(
maxPlayersEdit
->
value
());
settingsCache
->
setOnlyBuddies
(
onlyBuddiesCheckBox
->
isChecked
());
settingsCache
->
setOnlyRegistered
(
onlyRegisteredCheckBox
->
isChecked
());
settingsCache
->
setSpectatorsAllowed
(
spectatorsAllowedCheckBox
->
isChecked
());
settingsCache
->
setSpectatorsNeedPassword
(
spectatorsNeedPasswordCheckBox
->
isChecked
());
settingsCache
->
setSpectatorsCanTalk
(
spectatorsCanTalkCheckBox
->
isChecked
());
settingsCache
->
setSpectatorsCanSeeEverything
(
spectatorsSeeEverythingCheckBox
->
isChecked
());
Command_CreateGame
cmd
;
Command_CreateGame
cmd
;
cmd
.
set_description
(
descriptionEdit
->
text
().
simplified
().
toStdString
());
cmd
.
set_description
(
descriptionEdit
->
text
().
simplified
().
toStdString
());
cmd
.
set_password
(
passwordEdit
->
text
().
toStdString
());
cmd
.
set_password
(
passwordEdit
->
text
().
toStdString
());
...
@@ -170,13 +217,17 @@ void DlgCreateGame::actOK()
...
@@ -170,13 +217,17 @@ void DlgCreateGame::actOK()
cmd
.
set_spectators_can_talk
(
spectatorsCanTalkCheckBox
->
isChecked
());
cmd
.
set_spectators_can_talk
(
spectatorsCanTalkCheckBox
->
isChecked
());
cmd
.
set_spectators_see_everything
(
spectatorsSeeEverythingCheckBox
->
isChecked
());
cmd
.
set_spectators_see_everything
(
spectatorsSeeEverythingCheckBox
->
isChecked
());
QString
gameTypes
=
QString
();
QMapIterator
<
int
,
QCheckBox
*>
gameTypeCheckBoxIterator
(
gameTypeCheckBoxes
);
QMapIterator
<
int
,
QCheckBox
*>
gameTypeCheckBoxIterator
(
gameTypeCheckBoxes
);
while
(
gameTypeCheckBoxIterator
.
hasNext
())
{
while
(
gameTypeCheckBoxIterator
.
hasNext
())
{
gameTypeCheckBoxIterator
.
next
();
gameTypeCheckBoxIterator
.
next
();
if
(
gameTypeCheckBoxIterator
.
value
()
->
isChecked
())
if
(
gameTypeCheckBoxIterator
.
value
()
->
isChecked
())
{
cmd
.
add_game_type_ids
(
gameTypeCheckBoxIterator
.
key
());
cmd
.
add_game_type_ids
(
gameTypeCheckBoxIterator
.
key
());
gameTypes
+=
gameTypeCheckBoxIterator
.
value
()
->
text
()
+
", "
;
}
}
}
settingsCache
->
setGameTypes
(
gameTypes
);
PendingCommand
*
pend
=
room
->
prepareRoomCommand
(
cmd
);
PendingCommand
*
pend
=
room
->
prepareRoomCommand
(
cmd
);
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
checkResponse
(
Response
)));
connect
(
pend
,
SIGNAL
(
finished
(
Response
,
CommandContainer
,
QVariant
)),
this
,
SLOT
(
checkResponse
(
Response
)));
room
->
sendRoomCommand
(
pend
);
room
->
sendRoomCommand
(
pend
);
...
...
cockatrice/src/dlg_creategame.h
View file @
475c54bf
...
@@ -23,6 +23,7 @@ public:
...
@@ -23,6 +23,7 @@ public:
DlgCreateGame
(
const
ServerInfo_Game
&
game
,
const
QMap
<
int
,
QString
>
&
_gameTypes
,
QWidget
*
parent
=
0
);
DlgCreateGame
(
const
ServerInfo_Game
&
game
,
const
QMap
<
int
,
QString
>
&
_gameTypes
,
QWidget
*
parent
=
0
);
private
slots
:
private
slots
:
void
actOK
();
void
actOK
();
void
actReset
();
void
checkResponse
(
const
Response
&
response
);
void
checkResponse
(
const
Response
&
response
);
void
spectatorsAllowedChanged
(
int
state
);
void
spectatorsAllowedChanged
(
int
state
);
private:
private:
...
@@ -37,6 +38,7 @@ private:
...
@@ -37,6 +38,7 @@ private:
QCheckBox
*
onlyBuddiesCheckBox
,
*
onlyRegisteredCheckBox
;
QCheckBox
*
onlyBuddiesCheckBox
,
*
onlyRegisteredCheckBox
;
QCheckBox
*
spectatorsAllowedCheckBox
,
*
spectatorsNeedPasswordCheckBox
,
*
spectatorsCanTalkCheckBox
,
*
spectatorsSeeEverythingCheckBox
;
QCheckBox
*
spectatorsAllowedCheckBox
,
*
spectatorsNeedPasswordCheckBox
,
*
spectatorsCanTalkCheckBox
,
*
spectatorsSeeEverythingCheckBox
;
QDialogButtonBox
*
buttonBox
;
QDialogButtonBox
*
buttonBox
;
QPushButton
*
clearButton
;
void
sharedCtor
();
void
sharedCtor
();
};
};
...
...
cockatrice/src/settingscache.cpp
View file @
475c54bf
...
@@ -86,6 +86,16 @@ SettingsCache::SettingsCache()
...
@@ -86,6 +86,16 @@ SettingsCache::SettingsCache()
cardInfoViewMode
=
settings
->
value
(
"cards/cardinfoviewmode"
,
0
).
toInt
();
cardInfoViewMode
=
settings
->
value
(
"cards/cardinfoviewmode"
,
0
).
toInt
();
highlightWords
=
settings
->
value
(
"personal/highlightWords"
,
QString
()).
toString
();
highlightWords
=
settings
->
value
(
"personal/highlightWords"
,
QString
()).
toString
();
gameDescription
=
settings
->
value
(
"game/gamedescription"
,
""
).
toString
();
maxPlayers
=
settings
->
value
(
"game/maxplayers"
,
2
).
toInt
();
gameTypes
=
settings
->
value
(
"game/gametypes"
,
""
).
toString
();
onlyBuddies
=
settings
->
value
(
"game/onlybuddies"
,
false
).
toBool
();
onlyRegistered
=
settings
->
value
(
"game/onlyregistered"
,
true
).
toBool
();
spectatorsAllowed
=
settings
->
value
(
"game/spectatorsallowed"
,
true
).
toBool
();
spectatorsNeedPassword
=
settings
->
value
(
"game/spectatorsneedpassword"
,
false
).
toBool
();
spectatorsCanTalk
=
settings
->
value
(
"game/spectatorscantalk"
,
false
).
toBool
();
spectatorsCanSeeEverything
=
settings
->
value
(
"game/spectatorscanseeeverything"
,
false
).
toBool
();
}
}
void
SettingsCache
::
setCardInfoViewMode
(
const
int
_viewMode
)
{
void
SettingsCache
::
setCardInfoViewMode
(
const
int
_viewMode
)
{
...
@@ -443,4 +453,58 @@ QStringList SettingsCache::getCountries() const
...
@@ -443,4 +453,58 @@ QStringList SettingsCache::getCountries() const
<<
"vn"
<<
"vu"
<<
"wf"
<<
"ws"
<<
"ye"
<<
"yt"
<<
"za"
<<
"zm"
<<
"zw"
;
<<
"vn"
<<
"vu"
<<
"wf"
<<
"ws"
<<
"ye"
<<
"yt"
<<
"za"
<<
"zm"
<<
"zw"
;
return
countries
;
return
countries
;
}
void
SettingsCache
::
setGameDescription
(
const
QString
_gameDescription
)
{
gameDescription
=
_gameDescription
;
settings
->
setValue
(
"game/gamedescription"
,
gameDescription
);
}
void
SettingsCache
::
setMaxPlayers
(
const
int
_maxPlayers
)
{
maxPlayers
=
_maxPlayers
;
settings
->
setValue
(
"game/maxplayers"
,
maxPlayers
);
}
void
SettingsCache
::
setGameTypes
(
const
QString
_gameTypes
)
{
gameTypes
=
_gameTypes
;
settings
->
setValue
(
"game/gametypes"
,
gameTypes
);
}
void
SettingsCache
::
setOnlyBuddies
(
const
bool
_onlyBuddies
)
{
onlyBuddies
=
_onlyBuddies
;
settings
->
setValue
(
"game/onlybuddies"
,
onlyBuddies
);
}
void
SettingsCache
::
setOnlyRegistered
(
const
bool
_onlyRegistered
)
{
onlyRegistered
=
_onlyRegistered
;
settings
->
setValue
(
"game/onlyregistered"
,
onlyRegistered
);
}
void
SettingsCache
::
setSpectatorsAllowed
(
const
bool
_spectatorsAllowed
)
{
spectatorsAllowed
=
_spectatorsAllowed
;
settings
->
setValue
(
"game/spectatorsallowed"
,
spectatorsAllowed
);
}
void
SettingsCache
::
setSpectatorsNeedPassword
(
const
bool
_spectatorsNeedPassword
)
{
spectatorsNeedPassword
=
_spectatorsNeedPassword
;
settings
->
setValue
(
"game/spectatorsneedpassword"
,
spectatorsNeedPassword
);
}
void
SettingsCache
::
setSpectatorsCanTalk
(
const
bool
_spectatorsCanTalk
)
{
spectatorsCanTalk
=
_spectatorsCanTalk
;
settings
->
setValue
(
"game/spectatorscantalk"
,
spectatorsCanTalk
);
}
void
SettingsCache
::
setSpectatorsCanSeeEverything
(
const
bool
_spectatorsCanSeeEverything
)
{
spectatorsCanSeeEverything
=
_spectatorsCanSeeEverything
;
settings
->
setValue
(
"game/spectatorscanseeeverything"
,
spectatorsCanSeeEverything
);
}
}
\ No newline at end of file
cockatrice/src/settingscache.h
View file @
475c54bf
...
@@ -88,6 +88,15 @@ private:
...
@@ -88,6 +88,15 @@ private:
int
masterVolume
;
int
masterVolume
;
int
cardInfoViewMode
;
int
cardInfoViewMode
;
QString
highlightWords
;
QString
highlightWords
;
QString
gameDescription
;
int
maxPlayers
;
QString
gameTypes
;
bool
onlyBuddies
;
bool
onlyRegistered
;
bool
spectatorsAllowed
;
bool
spectatorsNeedPassword
;
bool
spectatorsCanTalk
;
bool
spectatorsCanSeeEverything
;
public:
public:
SettingsCache
();
SettingsCache
();
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
const
QByteArray
&
getMainWindowGeometry
()
const
{
return
mainWindowGeometry
;
}
...
@@ -149,6 +158,15 @@ public:
...
@@ -149,6 +158,15 @@ public:
int
getCardInfoViewMode
()
const
{
return
cardInfoViewMode
;
}
int
getCardInfoViewMode
()
const
{
return
cardInfoViewMode
;
}
QStringList
getCountries
()
const
;
QStringList
getCountries
()
const
;
QString
getHighlightWords
()
const
{
return
highlightWords
;
}
QString
getHighlightWords
()
const
{
return
highlightWords
;
}
QString
getGameDescription
()
const
{
return
gameDescription
;
}
int
getMaxPlayers
()
const
{
return
maxPlayers
;
}
QString
getGameTypes
()
const
{
return
gameTypes
;
}
bool
getOnlyBuddies
()
const
{
return
onlyBuddies
;
}
bool
getOnlyRegistered
()
const
{
return
onlyRegistered
;
}
bool
getSpectatorsAllowed
()
const
{
return
spectatorsAllowed
;
}
bool
getSpectatorsNeedPassword
()
const
{
return
spectatorsNeedPassword
;
}
bool
getSpectatorsCanTalk
()
const
{
return
spectatorsCanTalk
;
}
bool
getSpectatorsCanSeeEverything
()
const
{
return
spectatorsCanSeeEverything
;
}
public
slots
:
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
void
setLang
(
const
QString
&
_lang
);
...
@@ -203,6 +221,15 @@ public slots:
...
@@ -203,6 +221,15 @@ public slots:
void
setMasterVolume
(
const
int
_masterVolume
);
void
setMasterVolume
(
const
int
_masterVolume
);
void
setCardInfoViewMode
(
const
int
_viewMode
);
void
setCardInfoViewMode
(
const
int
_viewMode
);
void
setHighlightWords
(
const
QString
&
_highlightWords
);
void
setHighlightWords
(
const
QString
&
_highlightWords
);
void
setGameDescription
(
const
QString
_gameDescription
);
void
setMaxPlayers
(
const
int
_maxPlayers
);
void
setGameTypes
(
const
QString
_gameTypes
);
void
setOnlyBuddies
(
const
bool
_onlyBuddies
);
void
setOnlyRegistered
(
const
bool
_onlyRegistered
);
void
setSpectatorsAllowed
(
const
bool
_spectatorsAllowed
);
void
setSpectatorsNeedPassword
(
const
bool
_spectatorsNeedPassword
);
void
setSpectatorsCanTalk
(
const
bool
_spectatorsCanTalk
);
void
setSpectatorsCanSeeEverything
(
const
bool
_spectatorsCanSeeEverything
);
};
};
extern
SettingsCache
*
settingsCache
;
extern
SettingsCache
*
settingsCache
;
...
...
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