Rename 'unjoinable' games to 'unavailable'

This commit is contained in:
Daenyth 2011-12-04 12:25:51 -05:00
parent edd429d874
commit 86ae8a47a8
4 changed files with 14 additions and 14 deletions

View file

@ -29,10 +29,10 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
gameListView->header()->hideSection(1);
gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
showUnjoinableGamesCheckBox = new QCheckBox;
showUnavailableGamesCheckBox = new QCheckBox;
QVBoxLayout *filterLayout = new QVBoxLayout;
filterLayout->addWidget(showUnjoinableGamesCheckBox);
filterLayout->addWidget(showUnavailableGamesCheckBox);
if (room)
createButton = new QPushButton;
@ -63,15 +63,15 @@ GameSelector::GameSelector(AbstractClient *_client, TabSupervisor *_tabSuperviso
setMinimumWidth((qreal) (gameListView->columnWidth(0) * gameListModel->columnCount()) / 1.5);
setMinimumHeight(200);
connect(showUnjoinableGamesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showUnjoinableGamesChanged(int)));
connect(showUnavailableGamesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showUnavailableGamesChanged(int)));
connect(createButton, SIGNAL(clicked()), this, SLOT(actCreate()));
connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin()));
connect(spectateButton, SIGNAL(clicked()), this, SLOT(actJoin()));
}
void GameSelector::showUnjoinableGamesChanged(int state)
void GameSelector::showUnavailableGamesChanged(int state)
{
gameListProxyModel->setUnjoinableGamesVisible(state);
gameListProxyModel->setUnavailableGamesVisible(state);
}
void GameSelector::actCreate()
@ -130,7 +130,7 @@ void GameSelector::actJoin()
void GameSelector::retranslateUi()
{
setTitle(tr("Games"));
showUnjoinableGamesCheckBox->setText(tr("Show u&njoinable games"));
showUnavailableGamesCheckBox->setText(tr("Show u&navailable games"));
if (createButton)
createButton->setText(tr("C&reate"));
joinButton->setText(tr("&Join"));

View file

@ -18,7 +18,7 @@ class TabRoom;
class GameSelector : public QGroupBox {
Q_OBJECT
private slots:
void showUnjoinableGamesChanged(int state);
void showUnavailableGamesChanged(int state);
void actCreate();
void actJoin();
void checkResponse(ResponseCode response);
@ -33,7 +33,7 @@ private:
GamesModel *gameListModel;
GamesProxyModel *gameListProxyModel;
QPushButton *createButton, *joinButton, *spectateButton;
QCheckBox *showUnjoinableGamesCheckBox;
QCheckBox *showUnavailableGamesCheckBox;
public:
GameSelector(AbstractClient *_client, TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent = 0);
void retranslateUi();

View file

@ -107,14 +107,14 @@ void GamesModel::updateGameList(ServerInfo_Game *_game)
}
GamesProxyModel::GamesProxyModel(QObject *parent, ServerInfo_User *_ownUser)
: QSortFilterProxyModel(parent), ownUser(_ownUser), unjoinableGamesVisible(false)
: QSortFilterProxyModel(parent), ownUser(_ownUser), unavailableGamesVisible(false)
{
setDynamicSortFilter(true);
}
void GamesProxyModel::setUnjoinableGamesVisible(bool _unjoinableGamesVisible)
void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible)
{
unjoinableGamesVisible = _unjoinableGamesVisible;
unavailableGamesVisible = _unavailableGamesVisible;
invalidateFilter();
}
@ -125,7 +125,7 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &/*sourc
return false;
ServerInfo_Game *game = model->getGame(sourceRow);
if (!unjoinableGamesVisible) {
if (!unavailableGamesVisible) {
if (game->getPlayerCount() == game->getMaxPlayers())
return false;
if (game->getStarted())

View file

@ -31,10 +31,10 @@ class GamesProxyModel : public QSortFilterProxyModel {
Q_OBJECT
private:
ServerInfo_User *ownUser;
bool unjoinableGamesVisible;
bool unavailableGamesVisible;
public:
GamesProxyModel(QObject *parent = 0, ServerInfo_User *_ownUser = 0);
void setUnjoinableGamesVisible(bool _unjoinableGamesVisible);
void setUnavailableGamesVisible(bool _unavailableGamesVisible);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
};