add autostart timer display, bad word game name check gui
This commit is contained in:
@@ -56,13 +56,20 @@ changeContentDialogImpl::changeContentDialogImpl(QWidget *parent, ConfigFile *co
|
||||
lineEdit->setMaxLength(12);
|
||||
}
|
||||
break;
|
||||
case CHANGE_INET_GAME_NAME: {
|
||||
case CHANGE_INET_GAME_NAME_IN_USE: {
|
||||
label_Message->setText(tr("There is already a game with your choosen game name.\nPlease choose another one!"));
|
||||
label_lineLabel->setText(tr("Game name:"));
|
||||
lineEdit->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str()));
|
||||
lineEdit->setMaxLength(48);
|
||||
}
|
||||
break;
|
||||
case CHANGE_INET_BAD_GAME_NAME: {
|
||||
label_Message->setText(tr("There is a forbidden word in your choosen game name.\nPlease choose another one!"));
|
||||
label_lineLabel->setText(tr("Game name:"));
|
||||
lineEdit->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str()));
|
||||
lineEdit->setMaxLength(48);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
connect(this, SIGNAL(accepted ()), this, SLOT(saveContent()));
|
||||
@@ -88,7 +95,8 @@ void changeContentDialogImpl::saveContent() {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHANGE_INET_GAME_NAME: {
|
||||
case CHANGE_INET_BAD_GAME_NAME:
|
||||
case CHANGE_INET_GAME_NAME_IN_USE: {
|
||||
if(checkBox->isChecked()) {
|
||||
myConfig->writeConfigString("InternetGameName", lineEdit->text().toUtf8().constData());
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
enum DialogType { CHANGE_HUMAN_PLAYER_NAME=0, CHANGE_NICK_ALREADY_IN_USE, CHANGE_NICK_INVALID, CHANGE_INET_GAME_NAME };
|
||||
enum DialogType { CHANGE_HUMAN_PLAYER_NAME=0, CHANGE_NICK_ALREADY_IN_USE, CHANGE_NICK_INVALID, CHANGE_INET_BAD_GAME_NAME, CHANGE_INET_GAME_NAME_IN_USE };
|
||||
|
||||
class ConfigFile;
|
||||
|
||||
|
||||
@@ -159,10 +159,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<widget class="QScrollArea" name="scrollArea_gameInfos">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>252</width>
|
||||
<height>174</height>
|
||||
</size>
|
||||
</property>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using namespace std;
|
||||
|
||||
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false), autoStartTimerCounter(0)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -50,6 +50,8 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
waitStartGameMsgBoxTimer->setSingleShot(TRUE);
|
||||
blinkingButtonAnimationTimer = new QTimer(this);
|
||||
blinkingButtonAnimationTimer->setInterval(1000);
|
||||
autoStartTimer = new QTimer(this);
|
||||
autoStartTimer->setInterval(1000);
|
||||
showInfoMsgBoxTimer = new QTimer(this);
|
||||
showInfoMsgBoxTimer->setSingleShot(TRUE);
|
||||
|
||||
@@ -63,6 +65,20 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
disabledStartButtonColor = pushButton_StartGame->palette().button().color();
|
||||
disabledStartButtonTextColor = pushButton_StartGame->palette().buttonText().color();
|
||||
|
||||
//prepare overlay
|
||||
autoStartTimerOverlay = new QLabel(scrollArea_gameInfos);
|
||||
autoStartTimerOverlay->hide();
|
||||
autoStartTimerOverlay->setWordWrap(TRUE);
|
||||
autoStartTimerOverlay->setMaximumWidth(180);
|
||||
autoStartTimerOverlay->setMinimumWidth(180);
|
||||
autoStartTimerOverlay->setTextFormat(Qt::RichText);
|
||||
autoStartTimerOverlay->setAlignment(Qt::AlignCenter);
|
||||
autoStartTimerOverlay->setAutoFillBackground(TRUE);
|
||||
autoStartTimerOverlay->setFrameStyle(QFrame::StyledPanel);
|
||||
QPalette p;
|
||||
p.setColor(QPalette::Background, QColor(255, 255, 255, 210));
|
||||
autoStartTimerOverlay->setPalette(p);
|
||||
|
||||
|
||||
myGameListModel = new QStandardItemModel(this);
|
||||
myGameListSortFilterProxyModel = new MyGameListSortFilterProxyModel(this);
|
||||
@@ -125,6 +141,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
|
||||
connect( waitStartGameMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showWaitStartGameMsgBox() ));
|
||||
connect( blinkingButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimation() ));
|
||||
connect( autoStartTimer, SIGNAL(timeout()), this, SLOT( updateAutoStartTimer() ));
|
||||
connect( showInfoMsgBoxTimer, SIGNAL(timeout()), this, SLOT( showInfoMsgBox() ));
|
||||
connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int)));
|
||||
connect( comboBox_nickListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNickListFilter(int)));
|
||||
@@ -137,10 +154,12 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
lineEdit_ChatInput->installEventFilter(this);
|
||||
|
||||
clearDialog();
|
||||
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::exec()
|
||||
{
|
||||
|
||||
if(myConfig->readConfigInt("UseLobbyChat")) {
|
||||
groupBox_lobbyChat->show();
|
||||
}
|
||||
@@ -162,7 +181,6 @@ void gameLobbyDialogImpl::exec()
|
||||
|
||||
waitStartGameMsgBoxTimer->stop();
|
||||
waitStartGameMsgBox->hide();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -856,6 +874,7 @@ void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerNa
|
||||
}
|
||||
else {
|
||||
myW->getMySDLPlayer()->playSound("onlinegameready", 0);
|
||||
showAutoStartTimer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1526,3 +1545,25 @@ void gameLobbyDialogImpl::searchForPlayerRegExpChanged()
|
||||
myNickListSortFilterProxyModel->setFilterRegExp(regExp);
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::showAutoStartTimer()
|
||||
{
|
||||
|
||||
autoStartTimerOverlay->show();
|
||||
autoStartTimerOverlay->setGeometry(((scrollArea_gameInfos->geometry().width()-180)/2), ((scrollArea_gameInfos->geometry().height()-50)/2), 180, 50);
|
||||
autoStartTimerOverlay->setText(tr("The game will start in<br><b>%1</b> seconds.").arg(6));
|
||||
autoStartTimerCounter = 6;
|
||||
autoStartTimer->start(1000);
|
||||
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::updateAutoStartTimer()
|
||||
{
|
||||
--autoStartTimerCounter;
|
||||
if(autoStartTimerCounter) {
|
||||
autoStartTimerOverlay->setText(tr("The game will start in<br><b>%1</b> seconds.").arg(autoStartTimerCounter));
|
||||
}
|
||||
else {
|
||||
autoStartTimer->stop();
|
||||
autoStartTimerOverlay->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@ public slots:
|
||||
void putPlayerOnIgnoreList();
|
||||
bool playerIsOnIgnoreList(unsigned playerid);
|
||||
void searchForPlayerRegExpChanged();
|
||||
void showAutoStartTimer();
|
||||
void updateAutoStartTimer();
|
||||
|
||||
private:
|
||||
|
||||
@@ -132,6 +134,7 @@ private:
|
||||
QTimer *waitStartGameMsgBoxTimer;
|
||||
QTimer *blinkingButtonAnimationTimer;
|
||||
QTimer *showInfoMsgBoxTimer;
|
||||
QTimer *autoStartTimer;
|
||||
bool blinkingButtonAnimationState;
|
||||
QColor defaultStartButtonColor;
|
||||
QColor defaultStartButtonTextColor;
|
||||
@@ -155,6 +158,9 @@ private:
|
||||
QItemSelectionModel *myNickListSelectionModel;
|
||||
MyNickListSortFilterProxyModel *myNickListSortFilterProxyModel;
|
||||
|
||||
QLabel *autoStartTimerOverlay;
|
||||
int autoStartTimerCounter;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
|
||||
@@ -863,8 +863,15 @@ void startWindowImpl::networkNotification(int notificationId)
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case NTF_NET_JOIN_GAME_NAME_IN_USE:
|
||||
case NTF_NET_JOIN_GAME_BAD_NAME:
|
||||
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_INET_GAME_NAME);
|
||||
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_INET_BAD_GAME_NAME);
|
||||
dialog.exec();
|
||||
if(dialog.result() == QDialog::Accepted) {
|
||||
myGameLobbyDialog->pushButton_CreateGame->click();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NTF_NET_JOIN_GAME_BAD_NAME:
|
||||
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_INET_GAME_NAME_IN_USE);
|
||||
dialog.exec();
|
||||
if(dialog.result() == QDialog::Accepted) {
|
||||
myGameLobbyDialog->pushButton_CreateGame->click();
|
||||
|
||||
Reference in New Issue
Block a user