Merge remote-tracking branch 'upstream/master' into cmake_qt5

This commit is contained in:
Fabio Bas 2014-07-03 16:40:04 +02:00
commit e9895d643f
9 changed files with 30 additions and 6 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ tags
build* build*
*.qm *.qm
.directory .directory
mysql.cnf

View file

@ -15,7 +15,7 @@ RemoteClient::RemoteClient(QObject *parent)
: AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0) : AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0)
{ {
timer = new QTimer(this); timer = new QTimer(this);
timer->setInterval(1000); timer->setInterval(9000);
connect(timer, SIGNAL(timeout()), this, SLOT(ping())); connect(timer, SIGNAL(timeout()), this, SLOT(ping()));
socket = new QTcpSocket(this); socket = new QTcpSocket(this);
@ -23,7 +23,7 @@ RemoteClient::RemoteClient(QObject *parent)
connect(socket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(socket, SIGNAL(connected()), this, SLOT(slotConnected()));
connect(socket, SIGNAL(readyRead()), this, SLOT(readData())); connect(socket, SIGNAL(readyRead()), this, SLOT(readData()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError)));
connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, SLOT(processServerIdentificationEvent(const Event_ServerIdentification &))); connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, SLOT(processServerIdentificationEvent(const Event_ServerIdentification &)));
connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, SLOT(processConnectionClosedEvent(Event_ConnectionClosed))); connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, SLOT(processConnectionClosedEvent(Event_ConnectionClosed)));
connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, SLOT(doConnectToServer(QString, unsigned int, QString, QString))); connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, SLOT(doConnectToServer(QString, unsigned int, QString, QString)));
@ -47,12 +47,12 @@ void RemoteClient::slotConnected()
{ {
timeRunning = lastDataReceived = 0; timeRunning = lastDataReceived = 0;
timer->start(); timer->start();
// dirty hack to be compatible with v14 server // dirty hack to be compatible with v14 server
sendCommandContainer(CommandContainer()); sendCommandContainer(CommandContainer());
getNewCmdId(); getNewCmdId();
// end of hack // end of hack
setStatus(StatusAwaitingWelcome); setStatus(StatusAwaitingWelcome);
} }
@ -208,7 +208,7 @@ void RemoteClient::ping()
pend->deleteLater(); pend->deleteLater();
} }
} }
int maxTime = timeRunning - lastDataReceived; int maxTime = timeRunning - lastDataReceived;
emit maxPingTime(maxTime, maxTimeout); emit maxPingTime(maxTime, maxTimeout);
if (maxTime >= maxTimeout) { if (maxTime >= maxTimeout) {

View file

@ -34,6 +34,10 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
retranslateUi(); retranslateUi();
setLayout(vbox); setLayout(vbox);
setFocusProxy(sayEdit);
chatView->setFocusProxy(sayEdit);
sayEdit->setFocus();
} }
TabMessage::~TabMessage() TabMessage::~TabMessage()

View file

@ -9,6 +9,7 @@
#include <QLabel> #include <QLabel>
#include <QToolButton> #include <QToolButton>
#include <QSplitter> #include <QSplitter>
#include <QTimer>
#include "tab_supervisor.h" #include "tab_supervisor.h"
#include "tab_room.h" #include "tab_room.h"
#include "tab_userlists.h" #include "tab_userlists.h"
@ -97,6 +98,10 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
const int gameListSize = info.game_list_size(); const int gameListSize = info.game_list_size();
for (int i = 0; i < gameListSize; ++i) for (int i = 0; i < gameListSize; ++i)
gameSelector->processGameInfo(info.game_list(i)); gameSelector->processGameInfo(info.game_list(i));
setFocusProxy(sayEdit);
chatView->setFocusProxy(sayEdit);
QTimer::singleShot(0, sayEdit, SLOT(setFocus()));
} }
TabRoom::~TabRoom() TabRoom::~TabRoom()

View file

@ -241,7 +241,7 @@ void MainWindow::loginError(Response::ResponseCode r, QString reasonStr, quint32
{ {
switch (r) { switch (r) {
case Response::RespWrongPassword: case Response::RespWrongPassword:
QMessageBox::critical(this, tr("Error"), tr("Invalid login data.")); QMessageBox::critical(this, tr("Error"), tr("Incorrect username or password. Please check your authentication information and try again."));
break; break;
case Response::RespWouldOverwriteOldSession: case Response::RespWouldOverwriteOldSession:
QMessageBox::critical(this, tr("Error"), tr("There is already an active session using this user name.\nPlease close that session first and re-login.")); QMessageBox::critical(this, tr("Error"), tr("There is already an active session using this user name.\nPlease close that session first and re-login."));

View file

@ -201,6 +201,11 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
cardText = map.contains("text") ? map.value("text").toString() : QString(""); cardText = map.contains("text") ? map.value("text").toString() : QString("");
cardId = map.contains("multiverseid") ? map.value("multiverseid").toInt() : 0; cardId = map.contains("multiverseid") ? map.value("multiverseid").toInt() : 0;
cardLoyalty = map.contains("loyalty") ? map.value("loyalty").toInt() : 0; cardLoyalty = map.contains("loyalty") ? map.value("loyalty").toInt() : 0;
// Distinguish Vanguard cards from regular cards of the same name.
if (map.value("layout") == "vanguard") {
cardName += " Avatar";
}
} }
CardInfo *card = addCard(set->getShortName(), cardName, false, cardId, cardCost, cardType, cardPT, cardLoyalty, cardText.split("\n")); CardInfo *card = addCard(set->getShortName(), cardName, false, cardId, cardCost, cardType, cardPT, cardLoyalty, cardText.split("\n"));

View file

@ -0,0 +1,3 @@
#!/bin/bash
# SCHEDULE WITH CRONTAB BASED ON TIME PERIOD REPLAYS SHOULD BE SAVED UNTIL (EX: SCHEDULE ONCE A WEEK TO KEEP A WEEKS WORTH OF REPLAYS IN THE DB)
mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays;truncate table servatrice.cockatrice_replays_access'

View file

@ -0,0 +1,3 @@
#!/bin/bash
# SCHEDULE WITH CRONTAB TO RUN ONCE A MONTH
mysql --defaults-file=./mysql.cnf -h localhost -e "delete from servatrice.cockatrice_sessions where start_time < DATE_SUB(now(), INTERVAL 1 MONTH)"

View file

@ -0,0 +1,3 @@
[client]
user={db_username}
password={db_password}