From 27bd00bec835988b3f5631bf8cf9e97048aad026 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 29 Jun 2014 18:06:39 +0200 Subject: [PATCH 1/9] Direct chat: ensure focus is on the input line; fixes #113 --- cockatrice/src/tab_message.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cockatrice/src/tab_message.cpp b/cockatrice/src/tab_message.cpp index 80a56154..eec46bb9 100644 --- a/cockatrice/src/tab_message.cpp +++ b/cockatrice/src/tab_message.cpp @@ -34,6 +34,10 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, c retranslateUi(); setLayout(vbox); + + setFocusProxy(sayEdit); + chatView->setFocusProxy(sayEdit); + sayEdit->setFocus(); } TabMessage::~TabMessage() From d86fa410df8cdcca08fb00c5a48efecfbe616391 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 29 Jun 2014 19:16:31 +0200 Subject: [PATCH 2/9] Chat room: ensure focus on the input line --- cockatrice/src/tab_room.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cockatrice/src/tab_room.cpp b/cockatrice/src/tab_room.cpp index 79673e0f..2af3dd1e 100644 --- a/cockatrice/src/tab_room.cpp +++ b/cockatrice/src/tab_room.cpp @@ -97,6 +97,10 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI const int gameListSize = info.game_list_size(); for (int i = 0; i < gameListSize; ++i) gameSelector->processGameInfo(info.game_list(i)); + + setFocusProxy(sayEdit); + chatView->setFocusProxy(sayEdit); + sayEdit->setFocus(); } TabRoom::~TabRoom() From 4d6f46b06ec766d5135180abbb468eaa51668398 Mon Sep 17 00:00:00 2001 From: Daenyth Date: Sun, 29 Jun 2014 14:46:06 -0400 Subject: [PATCH 3/9] Change client ping send interval to 9 sec --- cockatrice/src/remoteclient.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/remoteclient.cpp b/cockatrice/src/remoteclient.cpp index 0eae13ab..e0d3d860 100644 --- a/cockatrice/src/remoteclient.cpp +++ b/cockatrice/src/remoteclient.cpp @@ -15,7 +15,7 @@ RemoteClient::RemoteClient(QObject *parent) : AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0) { timer = new QTimer(this); - timer->setInterval(1000); + timer->setInterval(9000); connect(timer, SIGNAL(timeout()), this, SLOT(ping())); socket = new QTcpSocket(this); @@ -23,7 +23,7 @@ RemoteClient::RemoteClient(QObject *parent) connect(socket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(socket, SIGNAL(readyRead()), this, SLOT(readData())); 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(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))); @@ -47,12 +47,12 @@ void RemoteClient::slotConnected() { timeRunning = lastDataReceived = 0; timer->start(); - + // dirty hack to be compatible with v14 server sendCommandContainer(CommandContainer()); getNewCmdId(); // end of hack - + setStatus(StatusAwaitingWelcome); } @@ -208,7 +208,7 @@ void RemoteClient::ping() pend->deleteLater(); } } - + int maxTime = timeRunning - lastDataReceived; emit maxPingTime(maxTime, maxTimeout); if (maxTime >= maxTimeout) { From f730dca14c84d9f764f66c825418d973058c1f7a Mon Sep 17 00:00:00 2001 From: arxanas Date: Tue, 1 Jul 2014 02:29:25 -0400 Subject: [PATCH 4/9] Fix #155: Vanguard card names no longer conflict with regular card names. --- oracle/src/oracleimporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index 70972d92..241924e3 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -197,6 +197,11 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data) cardText = map.contains("text") ? map.value("text").toString() : QString(""); cardId = map.contains("multiverseid") ? map.value("multiverseid").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")); From fb4a7b327478056aba254e71e25baa908139a4b0 Mon Sep 17 00:00:00 2001 From: Gavin Bisesi Date: Tue, 1 Jul 2014 12:04:33 -0400 Subject: [PATCH 5/9] Give more friendly login error message --- cockatrice/src/window_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index f5dc2684..7890d63a 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -241,7 +241,7 @@ void MainWindow::loginError(Response::ResponseCode r, QString reasonStr, quint32 { switch (r) { 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; 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.")); From 2b55170110ea9162dcf3695b50cd9d1128a24a99 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Tue, 1 Jul 2014 13:11:52 -0400 Subject: [PATCH 6/9] DB Maint Scripts External shell script to help maintain the cockatrice database tables. --- servatrice/scripts/maint_replays | 6 ++++++ servatrice/scripts/maint_sessions | 7 +++++++ servatrice/scripts/mysql.cnf | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 servatrice/scripts/maint_replays create mode 100644 servatrice/scripts/maint_sessions create mode 100644 servatrice/scripts/mysql.cnf diff --git a/servatrice/scripts/maint_replays b/servatrice/scripts/maint_replays new file mode 100644 index 00000000..b1326d9b --- /dev/null +++ b/servatrice/scripts/maint_replays @@ -0,0 +1,6 @@ +#!/bin/bash +#RUN THIS SCRIPT TO REMOVE ALL COCKATRICE REPLAYS FROM THE DATABASE +#--CAN BE SCHEDULED WITH CRONTAB + +mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays' +mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays_access' diff --git a/servatrice/scripts/maint_sessions b/servatrice/scripts/maint_sessions new file mode 100644 index 00000000..1fabd68f --- /dev/null +++ b/servatrice/scripts/maint_sessions @@ -0,0 +1,7 @@ +#!/bin/bash +#REPLACE THE --date="1 month ago" WITH THE TIME FRAME TO CLEAR UP +#EX: --date="1 day ago" (FOR SINGLE DAY) +#--CAN BE SCHEDULED WITH CRONTAB + +DATE=$(date +%Y-%m --date="1 month ago") +mysql --defaults-file=./mysql.cnf -h localhost -e "delete from servatrice.cockatrice_sessions where start_time like \"${DATE}%\"" diff --git a/servatrice/scripts/mysql.cnf b/servatrice/scripts/mysql.cnf new file mode 100644 index 00000000..e5d901be --- /dev/null +++ b/servatrice/scripts/mysql.cnf @@ -0,0 +1,3 @@ +[client] +user={db_username} +password={db_password} From b27873667b87e55a4df1dc27aa7cf71cafbbc820 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Wed, 2 Jul 2014 11:11:17 -0400 Subject: [PATCH 7/9] Optimization Updates for performance improvements per request --- servatrice/scripts/maint_replays | 7 ++----- servatrice/scripts/maint_sessions | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/servatrice/scripts/maint_replays b/servatrice/scripts/maint_replays index b1326d9b..1ce1b400 100644 --- a/servatrice/scripts/maint_replays +++ b/servatrice/scripts/maint_replays @@ -1,6 +1,3 @@ #!/bin/bash -#RUN THIS SCRIPT TO REMOVE ALL COCKATRICE REPLAYS FROM THE DATABASE -#--CAN BE SCHEDULED WITH CRONTAB - -mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays' -mysql --defaults-file=./mysql.cnf -h localhost -e 'truncate table servatrice.cockatrice_replays_access' +# 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' diff --git a/servatrice/scripts/maint_sessions b/servatrice/scripts/maint_sessions index 1fabd68f..2c41da6d 100644 --- a/servatrice/scripts/maint_sessions +++ b/servatrice/scripts/maint_sessions @@ -1,7 +1,3 @@ #!/bin/bash -#REPLACE THE --date="1 month ago" WITH THE TIME FRAME TO CLEAR UP -#EX: --date="1 day ago" (FOR SINGLE DAY) -#--CAN BE SCHEDULED WITH CRONTAB - -DATE=$(date +%Y-%m --date="1 month ago") -mysql --defaults-file=./mysql.cnf -h localhost -e "delete from servatrice.cockatrice_sessions where start_time like \"${DATE}%\"" +# 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)" From 9ba74fee5c16b0e1d625947066bd4a64c31afa2c Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Wed, 2 Jul 2014 13:23:50 -0400 Subject: [PATCH 8/9] Example Update Renamed mysql configuration file to include example extension and set git to ignore mysql.cnf per request. --- .gitignore | 1 + servatrice/scripts/{mysql.cnf => mysql.cnf.example} | 0 2 files changed, 1 insertion(+) rename servatrice/scripts/{mysql.cnf => mysql.cnf.example} (100%) diff --git a/.gitignore b/.gitignore index 1753f78c..df1a5c9f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tags build* *.qm .directory +mysql.cnf diff --git a/servatrice/scripts/mysql.cnf b/servatrice/scripts/mysql.cnf.example similarity index 100% rename from servatrice/scripts/mysql.cnf rename to servatrice/scripts/mysql.cnf.example From 6f18e3692dbddb2f4efca9f02374a76e3a51fa6b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 3 Jul 2014 15:45:13 +0200 Subject: [PATCH 9/9] Chat room: ensure the line input has focus when the window gets created --- cockatrice/src/tab_room.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/tab_room.cpp b/cockatrice/src/tab_room.cpp index 2af3dd1e..a7514e79 100644 --- a/cockatrice/src/tab_room.cpp +++ b/cockatrice/src/tab_room.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "tab_supervisor.h" #include "tab_room.h" #include "tab_userlists.h" @@ -100,7 +101,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI setFocusProxy(sayEdit); chatView->setFocusProxy(sayEdit); - sayEdit->setFocus(); + QTimer::singleShot(0, sayEdit, SLOT(setFocus())); } TabRoom::~TabRoom()