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
86ae8a47
Commit
86ae8a47
authored
Dec 04, 2011
by
Daenyth
Browse files
Rename 'unjoinable' games to 'unavailable'
parent
edd429d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/gameselector.cpp
View file @
86ae8a47
...
@@ -29,10 +29,10 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
...
@@ -29,10 +29,10 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
gameListView
->
header
()
->
hideSection
(
1
);
gameListView
->
header
()
->
hideSection
(
1
);
gameListView
->
header
()
->
setResizeMode
(
1
,
QHeaderView
::
ResizeToContents
);
gameListView
->
header
()
->
setResizeMode
(
1
,
QHeaderView
::
ResizeToContents
);
showUn
join
ableGamesCheckBox
=
new
QCheckBox
;
showUn
avail
ableGamesCheckBox
=
new
QCheckBox
;
QVBoxLayout
*
filterLayout
=
new
QVBoxLayout
;
QVBoxLayout
*
filterLayout
=
new
QVBoxLayout
;
filterLayout
->
addWidget
(
showUn
join
ableGamesCheckBox
);
filterLayout
->
addWidget
(
showUn
avail
ableGamesCheckBox
);
if
(
room
)
if
(
room
)
createButton
=
new
QPushButton
;
createButton
=
new
QPushButton
;
...
@@ -63,15 +63,15 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
...
@@ -63,15 +63,15 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
setMinimumWidth
((
qreal
)
(
gameListView
->
columnWidth
(
0
)
*
gameListModel
->
columnCount
())
/
1.5
);
setMinimumWidth
((
qreal
)
(
gameListView
->
columnWidth
(
0
)
*
gameListModel
->
columnCount
())
/
1.5
);
setMinimumHeight
(
200
);
setMinimumHeight
(
200
);
connect
(
showUn
join
ableGamesCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
showUn
join
ableGamesChanged
(
int
)));
connect
(
showUn
avail
ableGamesCheckBox
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
showUn
avail
ableGamesChanged
(
int
)));
connect
(
createButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actCreate
()));
connect
(
createButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actCreate
()));
connect
(
joinButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actJoin
()));
connect
(
joinButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actJoin
()));
connect
(
spectateButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actJoin
()));
connect
(
spectateButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
actJoin
()));
}
}
void
GameSelector
::
showUn
join
ableGamesChanged
(
int
state
)
void
GameSelector
::
showUn
avail
ableGamesChanged
(
int
state
)
{
{
gameListProxyModel
->
setUn
join
ableGamesVisible
(
state
);
gameListProxyModel
->
setUn
avail
ableGamesVisible
(
state
);
}
}
void
GameSelector
::
actCreate
()
void
GameSelector
::
actCreate
()
...
@@ -130,7 +130,7 @@ void GameSelector::actJoin()
...
@@ -130,7 +130,7 @@ void GameSelector::actJoin()
void
GameSelector
::
retranslateUi
()
void
GameSelector
::
retranslateUi
()
{
{
setTitle
(
tr
(
"Games"
));
setTitle
(
tr
(
"Games"
));
showUn
join
ableGamesCheckBox
->
setText
(
tr
(
"Show u&n
join
able games"
));
showUn
avail
ableGamesCheckBox
->
setText
(
tr
(
"Show u&n
avail
able games"
));
if
(
createButton
)
if
(
createButton
)
createButton
->
setText
(
tr
(
"C&reate"
));
createButton
->
setText
(
tr
(
"C&reate"
));
joinButton
->
setText
(
tr
(
"&Join"
));
joinButton
->
setText
(
tr
(
"&Join"
));
...
...
cockatrice/src/gameselector.h
View file @
86ae8a47
...
@@ -18,7 +18,7 @@ class TabRoom;
...
@@ -18,7 +18,7 @@ class TabRoom;
class
GameSelector
:
public
QGroupBox
{
class
GameSelector
:
public
QGroupBox
{
Q_OBJECT
Q_OBJECT
private
slots
:
private
slots
:
void
showUn
join
ableGamesChanged
(
int
state
);
void
showUn
avail
ableGamesChanged
(
int
state
);
void
actCreate
();
void
actCreate
();
void
actJoin
();
void
actJoin
();
void
checkResponse
(
ResponseCode
response
);
void
checkResponse
(
ResponseCode
response
);
...
@@ -33,7 +33,7 @@ private:
...
@@ -33,7 +33,7 @@ private:
GamesModel
*
gameListModel
;
GamesModel
*
gameListModel
;
GamesProxyModel
*
gameListProxyModel
;
GamesProxyModel
*
gameListProxyModel
;
QPushButton
*
createButton
,
*
joinButton
,
*
spectateButton
;
QPushButton
*
createButton
,
*
joinButton
,
*
spectateButton
;
QCheckBox
*
showUn
join
ableGamesCheckBox
;
QCheckBox
*
showUn
avail
ableGamesCheckBox
;
public:
public:
GameSelector
(
AbstractClient
*
_client
,
TabSupervisor
*
_tabSupervisor
,
TabRoom
*
_room
,
const
QMap
<
int
,
QString
>
&
_rooms
,
const
QMap
<
int
,
GameTypeMap
>
&
_gameTypes
,
QWidget
*
parent
=
0
);
GameSelector
(
AbstractClient
*
_client
,
TabSupervisor
*
_tabSupervisor
,
TabRoom
*
_room
,
const
QMap
<
int
,
QString
>
&
_rooms
,
const
QMap
<
int
,
GameTypeMap
>
&
_gameTypes
,
QWidget
*
parent
=
0
);
void
retranslateUi
();
void
retranslateUi
();
...
...
cockatrice/src/gamesmodel.cpp
View file @
86ae8a47
...
@@ -107,14 +107,14 @@ void GamesModel::updateGameList(ServerInfo_Game *_game)
...
@@ -107,14 +107,14 @@ void GamesModel::updateGameList(ServerInfo_Game *_game)
}
}
GamesProxyModel
::
GamesProxyModel
(
QObject
*
parent
,
ServerInfo_User
*
_ownUser
)
GamesProxyModel
::
GamesProxyModel
(
QObject
*
parent
,
ServerInfo_User
*
_ownUser
)
:
QSortFilterProxyModel
(
parent
),
ownUser
(
_ownUser
),
un
join
ableGamesVisible
(
false
)
:
QSortFilterProxyModel
(
parent
),
ownUser
(
_ownUser
),
un
avail
ableGamesVisible
(
false
)
{
{
setDynamicSortFilter
(
true
);
setDynamicSortFilter
(
true
);
}
}
void
GamesProxyModel
::
setUn
join
ableGamesVisible
(
bool
_un
join
ableGamesVisible
)
void
GamesProxyModel
::
setUn
avail
ableGamesVisible
(
bool
_un
avail
ableGamesVisible
)
{
{
un
join
ableGamesVisible
=
_un
join
ableGamesVisible
;
un
avail
ableGamesVisible
=
_un
avail
ableGamesVisible
;
invalidateFilter
();
invalidateFilter
();
}
}
...
@@ -125,7 +125,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
...
@@ -125,7 +125,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return
false
;
return
false
;
ServerInfo_Game
*
game
=
model
->
getGame
(
sourceRow
);
ServerInfo_Game
*
game
=
model
->
getGame
(
sourceRow
);
if
(
!
un
join
ableGamesVisible
)
{
if
(
!
un
avail
ableGamesVisible
)
{
if
(
game
->
getPlayerCount
()
==
game
->
getMaxPlayers
())
if
(
game
->
getPlayerCount
()
==
game
->
getMaxPlayers
())
return
false
;
return
false
;
if
(
game
->
getStarted
())
if
(
game
->
getStarted
())
...
...
cockatrice/src/gamesmodel.h
View file @
86ae8a47
...
@@ -31,10 +31,10 @@ class GamesProxyModel : public QSortFilterProxyModel {
...
@@ -31,10 +31,10 @@ class GamesProxyModel : public QSortFilterProxyModel {
Q_OBJECT
Q_OBJECT
private:
private:
ServerInfo_User
*
ownUser
;
ServerInfo_User
*
ownUser
;
bool
un
join
ableGamesVisible
;
bool
un
avail
ableGamesVisible
;
public:
public:
GamesProxyModel
(
QObject
*
parent
=
0
,
ServerInfo_User
*
_ownUser
=
0
);
GamesProxyModel
(
QObject
*
parent
=
0
,
ServerInfo_User
*
_ownUser
=
0
);
void
setUn
join
ableGamesVisible
(
bool
_un
join
ableGamesVisible
);
void
setUn
avail
ableGamesVisible
(
bool
_un
avail
ableGamesVisible
);
protected:
protected:
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
bool
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
;
};
};
...
...
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