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()->hideSection(1);
gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents); gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
showUnjoinableGamesCheckBox = new QCheckBox; showUnavailableGamesCheckBox = new QCheckBox;
QVBoxLayout *filterLayout = new QVBoxLayout; QVBoxLayout *filterLayout = new QVBoxLayout;
filterLayout->addWidget(showUnjoinableGamesCheckBox); filterLayout->addWidget(showUnavailableGamesCheckBox);
if (room) if (room)
createButton = new QPushButton; createButton = new QPushButton;
@ -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(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(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::showUnjoinableGamesChanged(int state) void GameSelector::showUnavailableGamesChanged(int state)
{ {
gameListProxyModel->setUnjoinableGamesVisible(state); gameListProxyModel->setUnavailableGamesVisible(state);
} }
void GameSelector::actCreate() void GameSelector::actCreate()
@ -130,7 +130,7 @@ void GameSelector::actJoin()
void GameSelector::retranslateUi() void GameSelector::retranslateUi()
{ {
setTitle(tr("Games")); setTitle(tr("Games"));
showUnjoinableGamesCheckBox->setText(tr("Show u&njoinable games")); showUnavailableGamesCheckBox->setText(tr("Show u&navailable games"));
if (createButton) if (createButton)
createButton->setText(tr("C&reate")); createButton->setText(tr("C&reate"));
joinButton->setText(tr("&Join")); joinButton->setText(tr("&Join"));

View file

@ -18,7 +18,7 @@ class TabRoom;
class GameSelector : public QGroupBox { class GameSelector : public QGroupBox {
Q_OBJECT Q_OBJECT
private slots: private slots:
void showUnjoinableGamesChanged(int state); void showUnavailableGamesChanged(int state);
void actCreate(); void actCreate();
void actJoin(); void actJoin();
void checkResponse(ResponseCode response); void checkResponse(ResponseCode response);
@ -33,7 +33,7 @@ private:
GamesModel *gameListModel; GamesModel *gameListModel;
GamesProxyModel *gameListProxyModel; GamesProxyModel *gameListProxyModel;
QPushButton *createButton, *joinButton, *spectateButton; QPushButton *createButton, *joinButton, *spectateButton;
QCheckBox *showUnjoinableGamesCheckBox; QCheckBox *showUnavailableGamesCheckBox;
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();

View file

@ -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), unjoinableGamesVisible(false) : QSortFilterProxyModel(parent), ownUser(_ownUser), unavailableGamesVisible(false)
{ {
setDynamicSortFilter(true); setDynamicSortFilter(true);
} }
void GamesProxyModel::setUnjoinableGamesVisible(bool _unjoinableGamesVisible) void GamesProxyModel::setUnavailableGamesVisible(bool _unavailableGamesVisible)
{ {
unjoinableGamesVisible = _unjoinableGamesVisible; unavailableGamesVisible = _unavailableGamesVisible;
invalidateFilter(); invalidateFilter();
} }
@ -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 (!unjoinableGamesVisible) { if (!unavailableGamesVisible) {
if (game->getPlayerCount() == game->getMaxPlayers()) if (game->getPlayerCount() == game->getMaxPlayers())
return false; return false;
if (game->getStarted()) if (game->getStarted())

View file

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