From 781460d6ac0785688f9b3fcbe470a35da159399a Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Mon, 11 Aug 2014 04:37:00 -0400 Subject: [PATCH 01/21] Cockatrice can now load images both with and without .full. Will need to clean-up bool stripped (used to determine .full suffix inclusion). --- cockatrice/src/carddatabase.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 79a225ece..b389e6ecb 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -135,14 +135,14 @@ void PictureLoader::processLoadQueue() mutex.unlock(); //The list of paths to the folders in which to search for images - QList picsPaths = QList() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName() + ".full"; + QList picsPaths = QList() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName(); QString setName=ptl.getSetName(); if(!setName.isEmpty()) { - picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full" - << _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full"; + picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + << _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName(); } QImage image; @@ -153,6 +153,12 @@ void PictureLoader::processLoadQueue() //Iterates through the list of paths, searching for images with the desired name with any QImageReader-supported extension for (int i = 0; i < picsPaths.length() && !found; i ++) { imgReader.setFileName(picsPaths.at(i)); + if (imgReader.read(&image)) { + emit imageLoaded(ptl.getCard(), image); + found = true; + break; + } + imgReader.setFileName(picsPaths.at(i) + ".full"); if (imgReader.read(&image)) { emit imageLoaded(ptl.getCard(), image); found = true; @@ -274,11 +280,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) return; } - QString suffix; - if (!cardBeingDownloaded.getStripped()) - suffix = ".full"; - - QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension); + QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + extension); if (!newPic.open(QIODevice::WriteOnly)) return; newPic.write(picData); From 484a6e8bdcaf24e95055f16cc1592a6aede67671 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 11 Aug 2014 10:50:55 +0200 Subject: [PATCH 02/21] Fix crash #202 --- cockatrice/src/carddragitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/carddragitem.cpp b/cockatrice/src/carddragitem.cpp index 0ddb91098..0ebab9a4b 100644 --- a/cockatrice/src/carddragitem.cpp +++ b/cockatrice/src/carddragitem.cpp @@ -84,7 +84,9 @@ void CardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) sc->removeItem(c); } } - currentZone->handleDropEvent(dragItemList, startZone, (sp - currentZone->scenePos()).toPoint()); + + if(currentZone) + currentZone->handleDropEvent(dragItemList, startZone, (sp - currentZone->scenePos()).toPoint()); event->accept(); } From a83e6cdf48b4008a374024c0efde716ecff98461 Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Mon, 11 Aug 2014 13:47:47 -0400 Subject: [PATCH 03/21] Removed unused variable, bool stripped, from classes and functions. --- cockatrice/src/carddatabase.cpp | 10 +++++----- cockatrice/src/carddatabase.h | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index b389e6ecb..b67f733d4 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -76,8 +76,8 @@ void SetList::sortByKey() qSort(begin(), end(), CompareFunctor()); } -PictureToLoad::PictureToLoad(CardInfo *_card, bool _stripped, bool _hq) - : card(_card), stripped(_stripped), setIndex(0), hq(_hq) +PictureToLoad::PictureToLoad(CardInfo *_card, bool _hq) + : card(_card), setIndex(0), hq(_hq) { if (card) { sortedSets = card->getSets(); @@ -308,11 +308,11 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) startNextPicDownload(); } -void PictureLoader::loadImage(CardInfo *card, bool stripped) +void PictureLoader::loadImage(CardInfo *card) { QMutexLocker locker(&mutex); - loadQueue.append(PictureToLoad(card, stripped)); + loadQueue.append(PictureToLoad(card)); emit startLoadQueue(); } @@ -938,7 +938,7 @@ void CardDatabase::cacheCardPixmaps(const QStringList &cardNames) void CardDatabase::loadImage(CardInfo *card) { - pictureLoader->loadImage(card, false); + pictureLoader->loadImage(card); } void CardDatabase::imageLoaded(CardInfo *card, QImage image) diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index 91abac59e..7cf944432 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -47,14 +47,12 @@ public: class PictureToLoad { private: CardInfo *card; - bool stripped; SetList sortedSets; int setIndex; bool hq; public: - PictureToLoad(CardInfo *_card = 0, bool _stripped = false, bool _hq = true); + PictureToLoad(CardInfo *_card = 0, bool _hq = true); CardInfo *getCard() const { return card; } - bool getStripped() const { return stripped; } QString getSetName() const; bool nextSet(); bool getHq() const { return hq; } @@ -79,7 +77,7 @@ public: void setPicsPath(const QString &path); void setPicDownload(bool _picDownload); void setPicDownloadHq(bool _picDownloadHq); - void loadImage(CardInfo *card, bool stripped); + void loadImage(CardInfo *card); private slots: void picDownloadFinished(QNetworkReply *reply); public slots: From b3812989817a3db9ea22eb6edcffa7a786c1f2a1 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Wed, 27 Aug 2014 21:25:11 +0100 Subject: [PATCH 04/21] Added 'auto connect' checkbox to connect dialog. When the main window becomes active for the first time and auto connect is set to true, it will call connectToServer at that point. --- cockatrice/src/dlg_connect.cpp | 40 +++++++++++++++++++++++++++++++- cockatrice/src/dlg_connect.h | 4 +++- cockatrice/src/settingscache.cpp | 8 +++++++ cockatrice/src/settingscache.h | 3 +++ cockatrice/src/window_main.cpp | 13 ++++++++++- cockatrice/src/window_main.h | 1 + 6 files changed, 66 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/dlg_connect.cpp b/cockatrice/src/dlg_connect.cpp index d1955d14c..f13b2f8f6 100644 --- a/cockatrice/src/dlg_connect.cpp +++ b/cockatrice/src/dlg_connect.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include "dlg_connect.h" DlgConnect::DlgConnect(QWidget *parent) @@ -32,6 +34,20 @@ DlgConnect::DlgConnect(QWidget *parent) savePasswordCheckBox = new QCheckBox(tr("&Save password")); savePasswordCheckBox->setChecked(settings.value("save_password", 1).toInt()); + //autoConnectCheckBox = new QCheckBox(tr("A&uto connect at start")); + autoConnectCheckBox = new QCheckBox("A&uto connect at start"); // TODO needs tr() + if(savePasswordCheckBox->isChecked()) + { + autoConnectCheckBox->setChecked(settings.value("auto_connect", 0).toInt()); + autoConnectCheckBox->setEnabled(true); + } else { + settings.setValue("auto_connect", 0); + autoConnectCheckBox->setChecked(0); + autoConnectCheckBox->setEnabled(false); + } + + connect(savePasswordCheckBox, SIGNAL(stateChanged(int)), this, SLOT(passwordSaved(int))); + QGridLayout *grid = new QGridLayout; grid->addWidget(hostLabel, 0, 0); grid->addWidget(hostEdit, 0, 1); @@ -42,10 +58,11 @@ DlgConnect::DlgConnect(QWidget *parent) grid->addWidget(passwordLabel, 3, 0); grid->addWidget(passwordEdit, 3, 1); grid->addWidget(savePasswordCheckBox, 4, 0, 1, 2); + grid->addWidget(autoConnectCheckBox, 5, 0, 1, 2); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(actCancel())); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(grid); @@ -57,6 +74,17 @@ DlgConnect::DlgConnect(QWidget *parent) setMinimumWidth(300); } +void DlgConnect::passwordSaved(int state) +{ + if(!savePasswordCheckBox->isChecked()) + { + autoConnectCheckBox->setChecked(0); + autoConnectCheckBox->setEnabled(false); + } else { + autoConnectCheckBox->setEnabled(true); + } +} + void DlgConnect::actOk() { QSettings settings; @@ -66,7 +94,17 @@ void DlgConnect::actOk() settings.setValue("playername", playernameEdit->text()); settings.setValue("password", savePasswordCheckBox->isChecked() ? passwordEdit->text() : QString()); settings.setValue("save_password", savePasswordCheckBox->isChecked() ? 1 : 0); + settings.setValue("auto_connect", autoConnectCheckBox->isChecked() ? 1 : 0); settings.endGroup(); accept(); } + +void DlgConnect::actCancel() +{ + QSettings settings; + settings.beginGroup("server"); + settings.setValue("auto_connect", autoConnectCheckBox->isChecked() ? 1 : 0); + settings.endGroup(); + reject(); +} diff --git a/cockatrice/src/dlg_connect.h b/cockatrice/src/dlg_connect.h index 87fe4ed9b..6f135aa0d 100644 --- a/cockatrice/src/dlg_connect.h +++ b/cockatrice/src/dlg_connect.h @@ -18,10 +18,12 @@ public: QString getPassword() const { return passwordEdit->text(); } private slots: void actOk(); + void actCancel(); + void passwordSaved(int state); private: QLabel *hostLabel, *portLabel, *playernameLabel, *passwordLabel; QLineEdit *hostEdit, *portEdit, *playernameEdit, *passwordEdit; - QCheckBox *savePasswordCheckBox; + QCheckBox *savePasswordCheckBox, *autoConnectCheckBox; }; #endif diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 5f504aa34..92c06041e 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -48,6 +48,8 @@ SettingsCache::SettingsCache() priceTagSource = settings->value("deckeditor/pricetagsource", 0).toInt(); ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool(); + + attemptAutoConnect = settings->value("server/auto_connect", 0).toInt() == 0 ? false : true; } void SettingsCache::setLang(const QString &_lang) @@ -267,6 +269,12 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry) settings->setValue("interface/main_window_geometry", mainWindowGeometry); } +void SettingsCache::setAutoConnect(const bool &_autoConnect) +{ + attemptAutoConnect = _autoConnect; + settings->value("server/auto_connect", attemptAutoConnect ? 1 : 0); +} + void SettingsCache::copyPath(const QString &src, const QString &dst) { // test source && return if inexistent diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index 3b4d612d5..b222a58bc 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -57,6 +57,7 @@ private: bool ignoreUnregisteredUsers; QString picUrl; QString picUrlHq; + bool attemptAutoConnect; public: SettingsCache(); const QByteArray &getMainWindowGeometry() const { return mainWindowGeometry; } @@ -93,6 +94,7 @@ public: QString getPicUrl() const { return picUrl; } QString getPicUrlHq() const { return picUrlHq; } void copyPath(const QString &src, const QString &dst); + bool getAutoConnect() const { return attemptAutoConnect; } public slots: void setMainWindowGeometry(const QByteArray &_mainWindowGeometry); void setLang(const QString &_lang); @@ -127,6 +129,7 @@ public slots: void setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers); void setPicUrl(const QString &_picUrl); void setPicUrlHq(const QString &_picUrlHq); + void setAutoConnect(const bool &_autoConnect); }; extern SettingsCache *settingsCache; diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 43b0624eb..51a094181 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -359,7 +359,7 @@ void MainWindow::createMenus() } MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), localServer(0) + : QMainWindow(parent), localServer(0), bHasActivated(false) { QPixmapCache::setCacheLimit(200000); @@ -417,5 +417,16 @@ void MainWindow::changeEvent(QEvent *event) { if (event->type() == QEvent::LanguageChange) retranslateUi(); + else if(event->type() == QEvent::ActivationChange) { + if(isActiveWindow() && !bHasActivated){ + bHasActivated = true; + if(settingsCache->getAutoConnect()) { + qDebug() << "Attempting auto-connect..."; + DlgConnect dlg(this); + client->connectToServer(dlg.getHost(), dlg.getPort(), dlg.getPlayerName(), dlg.getPassword()); + } + } + } + QMainWindow::changeEvent(event); } diff --git a/cockatrice/src/window_main.h b/cockatrice/src/window_main.h index 07ad1d712..e804bbe6b 100644 --- a/cockatrice/src/window_main.h +++ b/cockatrice/src/window_main.h @@ -71,6 +71,7 @@ private: QThread *clientThread; LocalServer *localServer; + bool bHasActivated; public: MainWindow(QWidget *parent = 0); ~MainWindow(); From ab83d6185a6b6e4017fc659e3b4636c3cd7910a6 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Fri, 29 Aug 2014 16:53:30 +0100 Subject: [PATCH 05/21] Used tr() function for auto-connect label. Changed formatting to adhere to coding style guidelines. 'Save Password' setting is now saved when cancelling the Connect dialog --- cockatrice/src/dlg_connect.cpp | 12 ++++++------ cockatrice/src/settingscache.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/dlg_connect.cpp b/cockatrice/src/dlg_connect.cpp index f13b2f8f6..152d62b9f 100644 --- a/cockatrice/src/dlg_connect.cpp +++ b/cockatrice/src/dlg_connect.cpp @@ -34,8 +34,7 @@ DlgConnect::DlgConnect(QWidget *parent) savePasswordCheckBox = new QCheckBox(tr("&Save password")); savePasswordCheckBox->setChecked(settings.value("save_password", 1).toInt()); - //autoConnectCheckBox = new QCheckBox(tr("A&uto connect at start")); - autoConnectCheckBox = new QCheckBox("A&uto connect at start"); // TODO needs tr() + autoConnectCheckBox = new QCheckBox(tr("A&uto connect at start")); if(savePasswordCheckBox->isChecked()) { autoConnectCheckBox->setChecked(settings.value("auto_connect", 0).toInt()); @@ -76,12 +75,11 @@ DlgConnect::DlgConnect(QWidget *parent) void DlgConnect::passwordSaved(int state) { - if(!savePasswordCheckBox->isChecked()) - { + if(savePasswordCheckBox->isChecked()) { + autoConnectCheckBox->setEnabled(true); + } else { autoConnectCheckBox->setChecked(0); autoConnectCheckBox->setEnabled(false); - } else { - autoConnectCheckBox->setEnabled(true); } } @@ -104,7 +102,9 @@ void DlgConnect::actCancel() { QSettings settings; settings.beginGroup("server"); + settings.setValue("save_password", savePasswordCheckBox->isChecked() ? 1 : 0); settings.setValue("auto_connect", autoConnectCheckBox->isChecked() ? 1 : 0); settings.endGroup(); + reject(); } diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 92c06041e..bc30a08b2 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -49,7 +49,7 @@ SettingsCache::SettingsCache() ignoreUnregisteredUsers = settings->value("chat/ignore_unregistered", false).toBool(); - attemptAutoConnect = settings->value("server/auto_connect", 0).toInt() == 0 ? false : true; + attemptAutoConnect = settings->value("server/auto_connect", 0).toBool(); } void SettingsCache::setLang(const QString &_lang) From f1b012c83dba205bb48a89572ec64d06967418bb Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Tue, 9 Sep 2014 17:30:37 +0100 Subject: [PATCH 06/21] Adding modified translation files --- cockatrice/translations/cockatrice_cs.ts | 51 +++++++------- cockatrice/translations/cockatrice_de.ts | 75 +++++++++++---------- cockatrice/translations/cockatrice_en.ts | 19 ++++-- cockatrice/translations/cockatrice_es.ts | 75 +++++++++++---------- cockatrice/translations/cockatrice_fr.ts | 55 ++++++++------- cockatrice/translations/cockatrice_gd.ts | 25 ++++--- cockatrice/translations/cockatrice_it.ts | 75 +++++++++++---------- cockatrice/translations/cockatrice_ja.ts | 55 ++++++++------- cockatrice/translations/cockatrice_pl.ts | 27 +++++--- cockatrice/translations/cockatrice_pt-br.ts | 45 +++++++------ cockatrice/translations/cockatrice_pt.ts | 75 +++++++++++---------- cockatrice/translations/cockatrice_ru.ts | 55 ++++++++------- cockatrice/translations/cockatrice_sk.ts | 19 ++++-- cockatrice/translations/cockatrice_sv.ts | 65 +++++++++--------- cockatrice/translations/cockatrice_zh_CN.ts | 19 ++++-- 15 files changed, 405 insertions(+), 330 deletions(-) diff --git a/cockatrice/translations/cockatrice_cs.ts b/cockatrice/translations/cockatrice_cs.ts index bfd7fb3be..7d9db9501 100644 --- a/cockatrice/translations/cockatrice_cs.ts +++ b/cockatrice/translations/cockatrice_cs.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Cesta k pozadí ruky: + Cesta k pozadí ruky: Path to stack background: - Cesta k pozadí stacku: + Cesta k pozadí stacku: Path to table background: - Cesta k pozadí stolu: + Cesta k pozadí stolu: Path to player info background: - Cesta k pozadí informací o uživateli: + Cesta k pozadí informací o uživateli: Path to picture of card back: - Cesta k rubu karet: + Cesta k rubu karet: @@ -1063,7 +1063,7 @@ This is only saved for moderators and cannot be seen by the banned person.DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - &Povolit zobrazovaní cen (použijí se data z blacklotusproject.com) + &Povolit zobrazovaní cen (použijí se data z blacklotusproject.com) @@ -1202,30 +1202,35 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: &Hostitel: - + &Port: &Port: - + Player &name: Jméno &hráče: - + P&assword: H&eslo: - + &Save password + + + A&uto connect at start + + &OK &OK @@ -1235,7 +1240,7 @@ This is only saved for moderators and cannot be seen by the banned person.&Zrušit - + Connect to server Připojit k serveru @@ -1636,7 +1641,7 @@ This is only saved for moderators and cannot be seen by the banned person. Your card database is invalid. Would you like to go back and set the correct path? - Cesta k databázi je neplatná. Chcete se vrátit a nastavit správnou? + Cesta k databázi je neplatná. Chcete se vrátit a nastavit správnou? @@ -2022,7 +2027,7 @@ Would you like to change your database location setting? Path to card database: - Karetní databáze: + Karetní databáze: @@ -2141,7 +2146,7 @@ Reason for shutdown: %1 Czech: - Čeština: + Čeština: Slovak: @@ -2204,7 +2209,7 @@ Reason for shutdown: %1 Invalid login data. - Nesprávné údaje uživatele. + Nesprávné údaje uživatele. @@ -2518,12 +2523,12 @@ Lokální verze je %1, verze serveru je %2. %1 has loaded a deck (%2). female - %1 nahrál balíček %2. + %1 nahrál balíček %2. %1 has loaded a deck (%2). male - %1 nahrál balíček %2. + %1 nahrál balíček %2. @@ -4624,7 +4629,7 @@ Lokální verze je %1, verze serveru je %2. Administration - Administrace + Administrace @@ -4933,7 +4938,7 @@ Prosím vložte jméno: Deck storage - Uložiště balíčků + Uložiště balíčků @@ -5218,14 +5223,14 @@ Prosím vložte jméno: TabServer Server - Server + Server TabUserLists User lists - Seznam uživatelů + Seznam uživatelů diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts index fedd2a5a9..ec90f35ab 100644 --- a/cockatrice/translations/cockatrice_de.ts +++ b/cockatrice/translations/cockatrice_de.ts @@ -1,6 +1,6 @@ - + @@ -66,23 +66,23 @@ Path to hand background: - Hintergrundbild für die Hand: + Hintergrundbild für die Hand: Path to stack background: - Hintergrundbild für den Stapel: + Hintergrundbild für den Stapel: Path to table background: - Hintergrundbild für das Spielfeld: + Hintergrundbild für das Spielfeld: Path to player info background: - Hintergrundbild für den Spielerbereich: + Hintergrundbild für den Spielerbereich: Path to picture of card back: - Pfad zum Bild der Kartenrückseite: + Pfad zum Bild der Kartenrückseite: @@ -1384,7 +1384,7 @@ Dies wird nur für Moderatoren gespeichert und kann von der gebannten Person nic DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Karten&preisfunktionen anschalten (benutzt Daten von blacklotusproject.com) + Karten&preisfunktionen anschalten (benutzt Daten von blacklotusproject.com) @@ -1545,30 +1545,35 @@ Dies wird nur für Moderatoren gespeichert und kann von der gebannten Person nic DlgConnect - + &Host: &Server: - + &Port: &Port: - + Player &name: Spieler&name: - + P&assword: P&asswort: - + &Save password Passwort &speichern + + + A&uto connect at start + + &OK &OK @@ -1578,7 +1583,7 @@ Dies wird nur für Moderatoren gespeichert und kann von der gebannten Person nic &Abbruch - + Connect to server Verbinde zum Server @@ -2030,7 +2035,7 @@ Dies wird nur für Moderatoren gespeichert und kann von der gebannten Person nic Your card database is invalid. Would you like to go back and set the correct path? - Ihre Kartendatenbank ist ungültig. Möchten Sie zurückgehen und den korrekten Pfad einstellen? + Ihre Kartendatenbank ist ungültig. Möchten Sie zurückgehen und den korrekten Pfad einstellen? @@ -2684,11 +2689,11 @@ Would you like to change your database location setting? Path to card database: - Pfad zur Kartendatenbank: + Pfad zur Kartendatenbank: Path to token database: - Pfad zur Spielsteindatenbank: + Pfad zur Spielsteindatenbank: @@ -2842,7 +2847,7 @@ Grund für die Abschaltung: %1 Czech: - Tschechisch: + Tschechisch: @@ -2904,7 +2909,7 @@ Grund für die Abschaltung: %1 Invalid login data. - Ungültige Anmeldedaten. + Ungültige Anmeldedaten. @@ -3709,12 +3714,12 @@ Lokale Version ist %1, Serverversion ist %2. %1 has loaded a deck (%2). female - %1 hat ein Deck geladen (%2). + %1 hat ein Deck geladen (%2). %1 has loaded a deck (%2). male - %1 hat ein Deck geladen (%2). + %1 hat ein Deck geladen (%2). @@ -4985,7 +4990,7 @@ Lokale Version ist %1, Serverversion ist %2. Ctrl+H - Ctrl+H + Ctrl+H @@ -5652,11 +5657,11 @@ Lokale Version ist %1, Serverversion ist %2. Cockatrice decks (*.cod) - Cockatrice Decks (*.cod) + Cockatrice Decks (*.cod) Plain text decks (*.dec *.mwDeck) - Text Decks (*.dec *.mwDeck) + Text Decks (*.dec *.mwDeck) @@ -5792,11 +5797,11 @@ Lokale Version ist %1, Serverversion ist %2. &OK - &OK + &OK &Cancel - &Abbrechen + &Abbrechen @@ -5847,7 +5852,7 @@ Lokale Version ist %1, Serverversion ist %2. Administration - Wartung + Wartung @@ -5897,7 +5902,7 @@ Lokale Version ist %1, Serverversion ist %2. &Search... - &Suchen... + &Suchen... @@ -5976,11 +5981,11 @@ Lokale Version ist %1, Serverversion ist %2. Return - Return + Return Enter - Enter + Enter @@ -5989,11 +5994,11 @@ Lokale Version ist %1, Serverversion ist %2. Ctrl+Return - Ctrl+Return + Ctrl+Return Ctrl+Enter - Ctrl+Enter + Ctrl+Enter @@ -6179,7 +6184,7 @@ Bitte geben Sie einen Namen ein: Deck storage - Deckspeicherplatz + Deckspeicherplatz @@ -6456,7 +6461,7 @@ Bitte geben Sie einen Namen ein: Game replays - Replays + Replays @@ -6504,7 +6509,7 @@ Bitte geben Sie einen Namen ein: TabServer Server - Server + Server @@ -6526,7 +6531,7 @@ Bitte geben Sie einen Namen ein: TabUserLists User lists - Benutzerlisten + Benutzerlisten diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts index ea397a188..4f52e8a19 100644 --- a/cockatrice/translations/cockatrice_en.ts +++ b/cockatrice/translations/cockatrice_en.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -725,32 +725,37 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: - + &Port: - + Player &name: - + P&assword: - + &Save password - + + A&uto connect at start + + + + Connect to server diff --git a/cockatrice/translations/cockatrice_es.ts b/cockatrice/translations/cockatrice_es.ts index 3a77a6c97..a9431d752 100644 --- a/cockatrice/translations/cockatrice_es.ts +++ b/cockatrice/translations/cockatrice_es.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Ruta a la imagen de fondo de la mano: + Ruta a la imagen de fondo de la mano: Path to stack background: - Ruta a la imagen de fondo de la pila: + Ruta a la imagen de fondo de la pila: Path to table background: - Ruta a la imagen de fondo de la mesa: + Ruta a la imagen de fondo de la mesa: Path to player info background: - Ruta a la imagen de fondo de la información del jugador: + Ruta a la imagen de fondo de la información del jugador: Path to picture of card back: - Ruta al reverso de las cartas: + Ruta al reverso de las cartas: @@ -1315,7 +1315,7 @@ Se almacenará unicamente para moderadores y no podrá ser visto por la persona DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Activar tag de &precios (usando datos de blacklotusproject.com) + Activar tag de &precios (usando datos de blacklotusproject.com) @@ -1461,30 +1461,35 @@ Se almacenará unicamente para moderadores y no podrá ser visto por la persona DlgConnect - + &Host: &Dirección: - + &Port: &Puerto: - + Player &name: &Nombre del jugador: - + P&assword: &Contraseña: - + &Save password &Guardar contraseña + + + A&uto connect at start + + &OK &Aceptar @@ -1494,7 +1499,7 @@ Se almacenará unicamente para moderadores y no podrá ser visto por la persona &Cancelar - + Connect to server Conectar con el servidor @@ -1911,7 +1916,7 @@ Se almacenará unicamente para moderadores y no podrá ser visto por la persona Your card database is invalid. Would you like to go back and set the correct path? - Tu base de datos de cartas es invalida. ¿Deseas volver y seleccionar la ruta correcta? + Tu base de datos de cartas es invalida. ¿Deseas volver y seleccionar la ruta correcta? @@ -2299,11 +2304,11 @@ Would you like to change your database location setting? Path to card database: - Ruta a la base de datos de las cartas: + Ruta a la base de datos de las cartas: Path to token database: - Ruta a la base de datos de fichas: + Ruta a la base de datos de fichas: @@ -2457,7 +2462,7 @@ Motivo para la desconexión: %1 Czech: - Checo: + Checo: @@ -2519,7 +2524,7 @@ Motivo para la desconexión: %1 Invalid login data. - Datos de conexión invalidos. + Datos de conexión invalidos. @@ -3107,12 +3112,12 @@ La versión local es %1, la versión remota es %2. %1 has loaded a deck (%2). female - %1 ha cargado el mazo %2. + %1 ha cargado el mazo %2. %1 has loaded a deck (%2). male - %1 ha cargado el mazo %2. + %1 ha cargado el mazo %2. @@ -4482,7 +4487,7 @@ La versión local es %1, la versión remota es %2. Ctrl+H - Ctrl+H + Ctrl+H @@ -4782,11 +4787,11 @@ La versión local es %1, la versión remota es %2. Cockatrice decks (*.cod) - Mazos de Cockatrice (*.cod) + Mazos de Cockatrice (*.cod) Plain text decks (*.dec *.mwDeck) - Archivos de texto plano (*.dec *.mwDeck) + Archivos de texto plano (*.dec *.mwDeck) @@ -4922,11 +4927,11 @@ La versión local es %1, la versión remota es %2. &OK - &Aceptar + &Aceptar &Cancel - &Cancelar + &Cancelar @@ -4973,7 +4978,7 @@ La versión local es %1, la versión remota es %2. Administration - Administración + Administración @@ -4999,7 +5004,7 @@ La versión local es %1, la versión remota es %2. TabDeckEditor &Search... - &Buscar... + &Buscar... @@ -5098,11 +5103,11 @@ La versión local es %1, la versión remota es %2. Return - Return + Return Enter - Enter + Enter @@ -5111,11 +5116,11 @@ La versión local es %1, la versión remota es %2. Ctrl+Return - Ctrl+Return + Ctrl+Return Ctrl+Enter - Ctrl+Enter + Ctrl+Enter @@ -5301,7 +5306,7 @@ Por favor, introduzca un nombre: Deck storage - Almacen de mazos + Almacen de mazos @@ -5550,7 +5555,7 @@ Por favor, introduzca un nombre: Game replays - Replays de partidas + Replays de partidas @@ -5598,14 +5603,14 @@ Por favor, introduzca un nombre: TabServer Server - Servidor + Servidor TabUserLists User lists - Lista de usuarios + Lista de usuarios diff --git a/cockatrice/translations/cockatrice_fr.ts b/cockatrice/translations/cockatrice_fr.ts index 6d205092a..8828b2b96 100644 --- a/cockatrice/translations/cockatrice_fr.ts +++ b/cockatrice/translations/cockatrice_fr.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Chemin pour les images de fond de main: + Chemin pour les images de fond de main: Path to stack background: - Chemin pour les images de fond de pile: + Chemin pour les images de fond de pile: Path to table background: - Chemin pour les images d'arrière-plan: + Chemin pour les images d'arrière-plan: Path to player info background: - Chemin pour les images de fond d'affichage d'informations: + Chemin pour les images de fond d'affichage d'informations: Path to picture of card back: - Chemin pour les images de dos des cartes: + Chemin pour les images de dos des cartes: @@ -1173,7 +1173,7 @@ Cette information ne sera consultable que par les modérateurs. DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Activer le guide de &prix des cartes (source : blacklotusproject.com) + Activer le guide de &prix des cartes (source : blacklotusproject.com) @@ -1319,30 +1319,35 @@ Cette information ne sera consultable que par les modérateurs. DlgConnect - + &Host: &Hôte: - + &Port: &Port: - + Player &name: &Nom du joueur: - + P&assword: Mot de p&asse: - + &Save password + + + A&uto connect at start + + &OK &OK @@ -1352,7 +1357,7 @@ Cette information ne sera consultable que par les modérateurs. &Annuler - + Connect to server Connexion au serveur @@ -1757,7 +1762,7 @@ Cette information ne sera consultable que par les modérateurs. Your card database is invalid. Would you like to go back and set the correct path? - Votre base de carte est invalide. Souhaitez-vous redéfinir le chemin d'accès? + Votre base de carte est invalide. Souhaitez-vous redéfinir le chemin d'accès? @@ -2152,7 +2157,7 @@ Would you like to change your database location setting? Path to card database: - Chemin vers la base de cartes: + Chemin vers la base de cartes: @@ -2248,7 +2253,7 @@ Would you like to change your database location setting? Invalid login data. - Information de connexion érronée. + Information de connexion érronée. @@ -2331,7 +2336,7 @@ Raison de la fermeture : %1 Czech: - Tchèque : + Tchèque : Slovak: @@ -2980,12 +2985,12 @@ La version la plus récente est %1, l'ancienne version est %2. %1 has loaded a deck (%2). female - %1 a chargé le deck %2. + %1 a chargé le deck %2. %1 has loaded a deck (%2). male - %1 a chargé le deck %2. + %1 a chargé le deck %2. @@ -4769,11 +4774,11 @@ La version la plus récente est %1, l'ancienne version est %2. &OK - &OK + &OK &Cancel - &Annuler + &Annuler @@ -4820,7 +4825,7 @@ La version la plus récente est %1, l'ancienne version est %2. Administration - Administration + Administration @@ -5148,7 +5153,7 @@ Entrez un nom s'il vous plaît: Deck storage - Stockage de deck + Stockage de deck @@ -5442,14 +5447,14 @@ Entrez un nom s'il vous plaît: TabServer Server - Serveur + Serveur TabUserLists User lists - Listes de l'utilisateur + Listes de l'utilisateur diff --git a/cockatrice/translations/cockatrice_gd.ts b/cockatrice/translations/cockatrice_gd.ts index 7003d25c7..e2a262e0d 100644 --- a/cockatrice/translations/cockatrice_gd.ts +++ b/cockatrice/translations/cockatrice_gd.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -755,30 +755,35 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: Ò&stair: - + &Port: &Port: - + Player &name: &Ainm a' chluicheadair: - + P&assword: &Facal-faire: - + &Save password + + + A&uto connect at start + + &OK &Ceart ma-thà @@ -788,7 +793,7 @@ This is only saved for moderators and cannot be seen by the banned person.&Sguir dheth - + Connect to server Dèan ceangal ris an fhrithealaiche @@ -3786,11 +3791,11 @@ Local version is %1, remote version is %2. &OK - &Ceart ma-thà + &Ceart ma-thà &Cancel - &Sguir dheth + &Sguir dheth @@ -4404,7 +4409,7 @@ Please enter a name: TabServer Server - Fhrithealaiche + Fhrithealaiche diff --git a/cockatrice/translations/cockatrice_it.ts b/cockatrice/translations/cockatrice_it.ts index 111a70965..bcaae287d 100644 --- a/cockatrice/translations/cockatrice_it.ts +++ b/cockatrice/translations/cockatrice_it.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Percorso sfondo della mano: + Percorso sfondo della mano: Path to stack background: - Percorso sfondo della pila: + Percorso sfondo della pila: Path to table background: - Percorso sfondo del tavolo: + Percorso sfondo del tavolo: Path to player info background: - Percorso sfondo info giocatore: + Percorso sfondo info giocatore: Path to picture of card back: - Percorso sfondo retro delle carte: + Percorso sfondo retro delle carte: @@ -959,7 +959,7 @@ Questo è solo visibile ai moderatori e non alla persona bannata. DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Abilita la &ricerca del costo (utilizzando i dati di blacklotusproject.com) + Abilita la &ricerca del costo (utilizzando i dati di blacklotusproject.com) @@ -1098,30 +1098,35 @@ Questo è solo visibile ai moderatori e non alla persona bannata. DlgConnect - + &Host: &Host: - + &Port: &Porta: - + Player &name: Nome &Giocatore: - + P&assword: P&assword: - + &Save password &Salva password + + + A&uto connect at start + + &OK &OK @@ -1131,7 +1136,7 @@ Questo è solo visibile ai moderatori e non alla persona bannata. &Annulla - + Connect to server Connetti al server @@ -1532,7 +1537,7 @@ Questo è solo visibile ai moderatori e non alla persona bannata. Your card database is invalid. Would you like to go back and set the correct path? - Il tuo database è invalido. Vuoi tornare indietro e impostare il percorso corretto? + Il tuo database è invalido. Vuoi tornare indietro e impostare il percorso corretto? @@ -1922,11 +1927,11 @@ Would you like to change your database location setting? Path to card database: - Percorso database delle carte: + Percorso database delle carte: Path to token database: - Percorso database pedine: + Percorso database pedine: @@ -2048,7 +2053,7 @@ Ragione dello spegnimento: %1 Czech: - Ceco: + Ceco: Slovak: @@ -2111,7 +2116,7 @@ Ragione dello spegnimento: %1 Invalid login data. - Dati login non validi. + Dati login non validi. @@ -2348,12 +2353,12 @@ La tua versione è la %1, la versione online è la %2. %1 has loaded a deck (%2). female - %1 ha aperto un mazzo %2. + %1 ha aperto un mazzo %2. %1 has loaded a deck (%2). male - %1 ha aperto un mazzo %2. + %1 ha aperto un mazzo %2. @@ -3792,7 +3797,7 @@ La tua versione è la %1, la versione online è la %2. Ctrl+H - Ctrl+H + Ctrl+H @@ -4134,11 +4139,11 @@ La tua versione è la %1, la versione online è la %2. Cockatrice decks (*.cod) - Mazzi Cockatrice (*.cod) + Mazzi Cockatrice (*.cod) Plain text decks (*.dec *.mwDeck) - Mazzi in formato testo (*.dec *.mwDeck) + Mazzi in formato testo (*.dec *.mwDeck) @@ -4267,11 +4272,11 @@ La tua versione è la %1, la versione online è la %2. &OK - &OK + &OK &Cancel - &Annulla + &Annulla @@ -4318,14 +4323,14 @@ La tua versione è la %1, la versione online è la %2. Administration - Amministrazione + Amministrazione TabDeckEditor &Search... - &Cerca... + &Cerca... @@ -4424,11 +4429,11 @@ La tua versione è la %1, la versione online è la %2. Return - Return + Return Enter - Invio + Invio @@ -4437,11 +4442,11 @@ La tua versione è la %1, la versione online è la %2. Ctrl+Return - Ctrl+Return + Ctrl+Return Ctrl+Enter - Ctrl+Invio + Ctrl+Invio @@ -4626,7 +4631,7 @@ Please enter a name: Deck storage - Cartella mazzi + Cartella mazzi @@ -4875,7 +4880,7 @@ Please enter a name: Game replays - Replay partite + Replay partite @@ -4915,14 +4920,14 @@ Please enter a name: TabServer Server - Server + Server TabUserLists User lists - Lista utenti + Lista utenti diff --git a/cockatrice/translations/cockatrice_ja.ts b/cockatrice/translations/cockatrice_ja.ts index a3e9da12d..388dfb50f 100644 --- a/cockatrice/translations/cockatrice_ja.ts +++ b/cockatrice/translations/cockatrice_ja.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - 手札の背景画像へのパス: + 手札の背景画像へのパス: Path to stack background: - スタックゾーンの背景画像へのパス: + スタックゾーンの背景画像へのパス: Path to table background: - テーブルの背景画像へのパス: + テーブルの背景画像へのパス: Path to player info background: - プレイヤー画像へのパス: + プレイヤー画像へのパス: Path to picture of card back: - カード背面画像へのパス: + カード背面画像へのパス: @@ -780,7 +780,7 @@ This is only saved for moderators and cannot be seen by the banned person.DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - 価格タグを表示可能に(blacklotusproject.comからのデータを使用) + 価格タグを表示可能に(blacklotusproject.comからのデータを使用) @@ -919,32 +919,37 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: ホストIP: - + &Port: ポート: - + Player &name: プレイヤーネーム: - + P&assword: パスワード: - + &Save password - + + A&uto connect at start + + + + Connect to server サーバーに接続 @@ -1309,7 +1314,7 @@ This is only saved for moderators and cannot be seen by the banned person. Your card database is invalid. Would you like to go back and set the correct path? - あなたのカードデータベースは無効です.前に戻って正しいパスを設定してください. + あなたのカードデータベースは無効です.前に戻って正しいパスを設定してください. @@ -1697,7 +1702,7 @@ Would you like to change your database location setting? Path to card database: - カードデータベースのパス: + カードデータベースのパス: @@ -1823,7 +1828,7 @@ Reason for shutdown: %1 Czech: - チェコ語: + チェコ語: Slovak: @@ -1886,7 +1891,7 @@ Reason for shutdown: %1 Invalid login data. - 無効なログインデータです. + 無効なログインデータです. @@ -3148,12 +3153,12 @@ Local version is %1, remote version is %2. %1 has loaded a deck (%2). female - %1はデッキ%2をロードしました. + %1はデッキ%2をロードしました. %1 has loaded a deck (%2). male - %1はデッキ%2をロードしました. + %1はデッキ%2をロードしました. @@ -4039,11 +4044,11 @@ Local version is %1, remote version is %2. &OK - OK + OK &Cancel - Cancel + Cancel @@ -4090,7 +4095,7 @@ Local version is %1, remote version is %2. Administration - 管理者 + 管理者 @@ -4399,7 +4404,7 @@ Please enter a name: Deck storage - デッキストレージ + デッキストレージ @@ -4692,14 +4697,14 @@ Please enter a name: TabServer Server - サーバー + サーバー TabUserLists User lists - ユーザーリスト + ユーザーリスト diff --git a/cockatrice/translations/cockatrice_pl.ts b/cockatrice/translations/cockatrice_pl.ts index 7b5e8bede..a47a06a78 100644 --- a/cockatrice/translations/cockatrice_pl.ts +++ b/cockatrice/translations/cockatrice_pl.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -670,7 +670,7 @@ This is only saved for moderators and cannot be seen by the banned person.DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Włącz oznaczenia &ceny (korzystając z danych z blacklotusproject.com) + Włącz oznaczenia &ceny (korzystając z danych z blacklotusproject.com) @@ -809,32 +809,37 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: - + &Port: - + Player &name: - + P&assword: - + &Save password - + + A&uto connect at start + + + + Connect to server @@ -1605,7 +1610,7 @@ Would you like to change your database location setting? Path to card database: - Ścieżka do bazy kart: + Ścieżka do bazy kart: @@ -4454,14 +4459,14 @@ Please enter a name: TabServer Server - Serwer + Serwer TabUserLists User lists - Lista użytkowników + Lista użytkowników diff --git a/cockatrice/translations/cockatrice_pt-br.ts b/cockatrice/translations/cockatrice_pt-br.ts index 44a33758d..ebc3ba18a 100644 --- a/cockatrice/translations/cockatrice_pt-br.ts +++ b/cockatrice/translations/cockatrice_pt-br.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Caminho para o fundo da mão: + Caminho para o fundo da mão: Path to stack background: - Caminho para o fundo da pilha: + Caminho para o fundo da pilha: Path to table background: - Caminho para o fundo da mesa: + Caminho para o fundo da mesa: Path to player info background: - Caminho para o fundo das informações do jogador: + Caminho para o fundo das informações do jogador: Path to picture of card back: - Caminho para a imagem do verso dos cards: + Caminho para a imagem do verso dos cards: @@ -1264,30 +1264,35 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: &Servidor: - + &Port: &Porta: - + Player &name: Nome do &jogador: - + P&assword: S&enha: - + &Save password + + + A&uto connect at start + + &OK &OK @@ -1297,7 +1302,7 @@ This is only saved for moderators and cannot be seen by the banned person.&Cancelar - + Connect to server Conectar ao servidor @@ -1702,7 +1707,7 @@ This is only saved for moderators and cannot be seen by the banned person. Your card database is invalid. Would you like to go back and set the correct path? - O seu banco de dados de cards é inválido. Você gostaria de voltar e corrigir o caminho? + O seu banco de dados de cards é inválido. Você gostaria de voltar e corrigir o caminho? @@ -2086,7 +2091,7 @@ Would you like to change your database location setting? Path to card database: - Caminho para o banco de dados dos cards: + Caminho para o banco de dados dos cards: @@ -2193,7 +2198,7 @@ Would you like to change your database location setting? Invalid login data. - Informações de login inválidas. + Informações de login inválidas. @@ -2882,7 +2887,7 @@ A versão local é %1 e a versão remota é %2. %1 has loaded a deck (%2). female - %1 carregou o deck %2. + %1 carregou o deck %2. %1 has loaded a deck (%2). @@ -4732,7 +4737,7 @@ A versão local é %1 e a versão remota é %2. Administration - Administração + Administração @@ -5060,7 +5065,7 @@ Por favor, entre um nome: Deck storage - Armazenamento de decks + Armazenamento de decks @@ -5353,14 +5358,14 @@ Por favor, entre um nome: TabServer Server - Servidor + Servidor TabUserLists User lists - Listas de usuários + Listas de usuários diff --git a/cockatrice/translations/cockatrice_pt.ts b/cockatrice/translations/cockatrice_pt.ts index 8364309f7..e9a2c17fa 100644 --- a/cockatrice/translations/cockatrice_pt.ts +++ b/cockatrice/translations/cockatrice_pt.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Directório da imagem de fundo da mão: + Directório da imagem de fundo da mão: Path to stack background: - Directório da imagem de fundo da pilha: + Directório da imagem de fundo da pilha: Path to table background: - Directório da imagem de fundo do campo de batalha: + Directório da imagem de fundo do campo de batalha: Path to player info background: - Directório da imagem de fundo da informação de jogador: + Directório da imagem de fundo da informação de jogador: Path to picture of card back: - Directório da imagem do verso da carta: + Directório da imagem do verso da carta: @@ -1181,7 +1181,7 @@ Isto apenas é guardado para os moderadores e não é visível para a pessoa ban DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - &Permitir função de tag de preços (utilizando informação de blacklotusproject.com) + &Permitir função de tag de preços (utilizando informação de blacklotusproject.com) @@ -1327,30 +1327,35 @@ Isto apenas é guardado para os moderadores e não é visível para a pessoa ban DlgConnect - + &Host: &Servidor: - + &Port: &Porta: - + Player &name: &Nome do jogador: - + P&assword: P&assword: - + &Save password &Guardar password + + + A&uto connect at start + + &OK &OK @@ -1360,7 +1365,7 @@ Isto apenas é guardado para os moderadores e não é visível para a pessoa ban &Cancelar - + Connect to server Ligar ao servidor @@ -1761,7 +1766,7 @@ Isto apenas é guardado para os moderadores e não é visível para a pessoa ban Your card database is invalid. Would you like to go back and set the correct path? - A sua base de dados é inválida. Gostaria de voltar atrás e corrigir o directório? + A sua base de dados é inválida. Gostaria de voltar atrás e corrigir o directório? @@ -2155,11 +2160,11 @@ Would you like to change your database location setting? Path to card database: - Directório da base de dados de cartas: + Directório da base de dados de cartas: Path to token database: - Directório da base de dados de fichas: + Directório da base de dados de fichas: @@ -2264,7 +2269,7 @@ Would you like to change your database location setting? Invalid login data. - Informação de login incorrecta. + Informação de login incorrecta. @@ -2339,7 +2344,7 @@ Motivo para o encerramento: %1 Czech: - Checo: + Checo: Slovak: @@ -3662,12 +3667,12 @@ Versão local é %1, versão remota é %2. %1 has loaded a deck (%2). female - %1 carregou o deck %2. + %1 carregou o deck %2. %1 has loaded a deck (%2). male - %1 carregou o deck %2. + %1 carregou o deck %2. @@ -4260,7 +4265,7 @@ Versão local é %1, versão remota é %2. Ctrl+H - Ctrl+H + Ctrl+H @@ -4622,11 +4627,11 @@ Versão local é %1, versão remota é %2. Cockatrice decks (*.cod) - Decks do Cockatrice (*.cod) + Decks do Cockatrice (*.cod) Plain text decks (*.dec *.mwDeck) - Decks baseados em texto simples (*.dec *.mwDeck) + Decks baseados em texto simples (*.dec *.mwDeck) @@ -4762,11 +4767,11 @@ Versão local é %1, versão remota é %2. &OK - &OK + &OK &Cancel - &Cancelar + &Cancelar @@ -4813,7 +4818,7 @@ Versão local é %1, versão remota é %2. Administration - Administração + Administração @@ -4839,7 +4844,7 @@ Versão local é %1, versão remota é %2. TabDeckEditor &Search... - &Procurar... + &Procurar... @@ -4938,11 +4943,11 @@ Versão local é %1, versão remota é %2. Return - Return + Return Enter - Enter + Enter @@ -4951,11 +4956,11 @@ Versão local é %1, versão remota é %2. Ctrl+Return - Ctrl+Return + Ctrl+Return Ctrl+Enter - Ctrl+Enter + Ctrl+Enter @@ -5141,7 +5146,7 @@ Por favor introduza um nome: Deck storage - Armazenamento de decks + Armazenamento de decks @@ -5390,7 +5395,7 @@ Por favor introduza um nome: Game replays - Replays de jogos + Replays de jogos @@ -5438,14 +5443,14 @@ Por favor introduza um nome: TabServer Server - Servidor + Servidor TabUserLists User lists - Lista de utilizadores + Lista de utilizadores diff --git a/cockatrice/translations/cockatrice_ru.ts b/cockatrice/translations/cockatrice_ru.ts index 9580ccd5d..881b7093c 100644 --- a/cockatrice/translations/cockatrice_ru.ts +++ b/cockatrice/translations/cockatrice_ru.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Рука: + Рука: Path to stack background: - Стек: + Стек: Path to table background: - Поле битвы: + Поле битвы: Path to player info background: - Панель игрока: + Панель игрока: Path to picture of card back: - Рубашки карт: + Рубашки карт: @@ -1091,7 +1091,7 @@ This is only saved for moderators and cannot be seen by the banned person.DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Подписывать &цены (по данным blacklotusproject.com) + Подписывать &цены (по данным blacklotusproject.com) @@ -1230,30 +1230,35 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: &Хост: - + &Port: &Порт: - + Player &name: &Ник: - + P&assword: П&ароль: - + &Save password + + + A&uto connect at start + + &OK &Ок @@ -1263,7 +1268,7 @@ This is only saved for moderators and cannot be seen by the banned person.&Отмена - + Connect to server Соединение @@ -1668,7 +1673,7 @@ This is only saved for moderators and cannot be seen by the banned person. Your card database is invalid. Would you like to go back and set the correct path? - База карт не найдена. Вернуться и задать правильный путь? + База карт не найдена. Вернуться и задать правильный путь? @@ -2058,7 +2063,7 @@ Would you like to change your database location setting? Path to card database: - Путь к базе карт: + Путь к базе карт: @@ -2179,7 +2184,7 @@ Reason for shutdown: %1 Czech: - Чешский: + Чешский: Slovak: @@ -2242,7 +2247,7 @@ Reason for shutdown: %1 Invalid login data. - Неверный логин/пароль. + Неверный логин/пароль. @@ -2852,12 +2857,12 @@ Local version is %1, remote version is %2. %1 has loaded a deck (%2). female - %1 загрузила колоду %2. + %1 загрузила колоду %2. %1 has loaded a deck (%2). male - %1 загрузил колоду %2. + %1 загрузил колоду %2. @@ -4653,11 +4658,11 @@ Local version is %1, remote version is %2. &OK - &Ок + &Ок &Cancel - &Отмена + &Отмена @@ -4704,7 +4709,7 @@ Local version is %1, remote version is %2. Administration - Администрирование + Администрирование @@ -4997,7 +5002,7 @@ Please enter a name: Deck storage - Хранилище колод + Хранилище колод @@ -5282,14 +5287,14 @@ Please enter a name: TabServer Server - Сервер + Сервер TabUserLists User lists - Панели пользователей + Панели пользователей diff --git a/cockatrice/translations/cockatrice_sk.ts b/cockatrice/translations/cockatrice_sk.ts index 7f8295f6a..7539da257 100644 --- a/cockatrice/translations/cockatrice_sk.ts +++ b/cockatrice/translations/cockatrice_sk.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -725,32 +725,37 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: - + &Port: - + Player &name: - + P&assword: - + &Save password - + + A&uto connect at start + + + + Connect to server diff --git a/cockatrice/translations/cockatrice_sv.ts b/cockatrice/translations/cockatrice_sv.ts index 8a402f35a..62e5378e8 100644 --- a/cockatrice/translations/cockatrice_sv.ts +++ b/cockatrice/translations/cockatrice_sv.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -43,23 +43,23 @@ Path to hand background: - Sökväg till handbakgrund: + Sökväg till handbakgrund: Path to stack background: - Sökväg till stapelbakgrund: + Sökväg till stapelbakgrund: Path to table background: - Sökväg till bordbakgrund: + Sökväg till bordbakgrund: Path to player info background: - Sökväg till spelarinfobakgrund: + Sökväg till spelarinfobakgrund: Path to picture of card back: - Sökväg till kortbaksidans bild: + Sökväg till kortbaksidans bild: @@ -923,7 +923,7 @@ Detta sparas endast för moderatorer och kan inte ses av den bannlysta personen. DeckEditorSettingsPage Enable &price tag feature (using data from blacklotusproject.com) - Aktivera &prislappsfunktionen (använder data från blacklotusproject.com) + Aktivera &prislappsfunktionen (använder data från blacklotusproject.com) @@ -1062,30 +1062,35 @@ Detta sparas endast för moderatorer och kan inte ses av den bannlysta personen. DlgConnect - + &Host: &Värd: - + &Port: &Port: - + Player &name: Spelar&namn: - + P&assword: &Lösenord: - + &Save password &Spara lösenord + + + A&uto connect at start + + &OK &OK @@ -1095,7 +1100,7 @@ Detta sparas endast för moderatorer och kan inte ses av den bannlysta personen. &Avbryt - + Connect to server Anslut till server @@ -1492,7 +1497,7 @@ Detta sparas endast för moderatorer och kan inte ses av den bannlysta personen. Your card database is invalid. Would you like to go back and set the correct path? - Din kortdatabas är ogiltig. Vill du gå tillbaka och ange den korrekta sökvägen? + Din kortdatabas är ogiltig. Vill du gå tillbaka och ange den korrekta sökvägen? @@ -1878,11 +1883,11 @@ Would you like to change your database location setting? Path to card database: - Sökväg till kortdatabas: + Sökväg till kortdatabas: Path to token database: - Sökväg till jetongdatabas: + Sökväg till jetongdatabas: @@ -2030,7 +2035,7 @@ Anledning till nedstängning: %1 Czech: - Tjeckiska: + Tjeckiska: @@ -2063,7 +2068,7 @@ Anledning till nedstängning: %1 Invalid login data. - Ogiltig inloggningsdata. + Ogiltig inloggningsdata. @@ -2280,12 +2285,12 @@ Lokal version är %1, avlägsen version är %2. %1 has loaded a deck (%2). female - %1 har laddat en lek (%2). + %1 har laddat en lek (%2). %1 has loaded a deck (%2). male - %1 har laddat en lek (%2). + %1 har laddat en lek (%2). @@ -4054,11 +4059,11 @@ Lokal version är %1, avlägsen version är %2. Cockatrice decks (*.cod) - Cockatricelekar (*.cod) + Cockatricelekar (*.cod) Plain text decks (*.dec *.mwDeck) - Klartextlekar (*.dec *.mwDeck) + Klartextlekar (*.dec *.mwDeck) @@ -4187,11 +4192,11 @@ Lokal version är %1, avlägsen version är %2. &OK - &OK + &OK &Cancel - &Avbryt + &Avbryt @@ -4238,14 +4243,14 @@ Lokal version är %1, avlägsen version är %2. Administration - Administration + Administration TabDeckEditor &Search... - &Sök... + &Sök... @@ -4529,7 +4534,7 @@ Please enter a name: Deck storage - Leklagring + Leklagring @@ -4778,7 +4783,7 @@ Please enter a name: Game replays - Spelrepriser + Spelrepriser @@ -4818,14 +4823,14 @@ Please enter a name: TabServer Server - Server + Server TabUserLists User lists - Användarlistor + Användarlistor diff --git a/cockatrice/translations/cockatrice_zh_CN.ts b/cockatrice/translations/cockatrice_zh_CN.ts index 04d26fcae..21ccff1a1 100644 --- a/cockatrice/translations/cockatrice_zh_CN.ts +++ b/cockatrice/translations/cockatrice_zh_CN.ts @@ -1,6 +1,6 @@ - + AbstractCounter @@ -725,32 +725,37 @@ This is only saved for moderators and cannot be seen by the banned person. DlgConnect - + &Host: - + &Port: - + Player &name: - + P&assword: - + &Save password - + + A&uto connect at start + + + + Connect to server From fefb6fc61212eff7dee87351434bacaab436d501 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Sat, 30 Aug 2014 18:27:45 +1000 Subject: [PATCH 07/21] Add sideboard helpers. --- cockatrice/src/keysignals.cpp | 4 ++++ cockatrice/src/keysignals.h | 1 + cockatrice/src/tab_deck_editor.cpp | 23 +++++++++++++++++++++++ cockatrice/src/tab_deck_editor.h | 1 + 4 files changed, 29 insertions(+) diff --git a/cockatrice/src/keysignals.cpp b/cockatrice/src/keysignals.cpp index 5db58cb5e..bbd94dbb4 100644 --- a/cockatrice/src/keysignals.cpp +++ b/cockatrice/src/keysignals.cpp @@ -56,6 +56,10 @@ bool KeySignals::eventFilter(QObject * /*object*/, QEvent *event) { && kevent->modifiers().testFlag(Qt::ControlModifier) ) emit onCtrlAltRBracket(); + break; + case Qt::Key_S: + emit onS(); + break; default: return false; diff --git a/cockatrice/src/keysignals.h b/cockatrice/src/keysignals.h index 693488c56..94c9dd39c 100644 --- a/cockatrice/src/keysignals.h +++ b/cockatrice/src/keysignals.h @@ -18,6 +18,7 @@ signals: void onCtrlAltEqual(); void onCtrlAltLBracket(); void onCtrlAltRBracket(); + void onS(); protected: virtual bool eventFilter(QObject *, QEvent *event); diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index c01389316..82a356d13 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -141,6 +141,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) #endif deckView->installEventFilter(&deckViewKeySignals); connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &))); + connect(deckView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actSwapCard())); + connect(&deckViewKeySignals, SIGNAL(onS()), this, SLOT(actSwapCard())); connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrement())); @@ -571,6 +573,27 @@ void TabDeckEditor::addCardHelper(QString zoneName) setModified(true); } +void TabDeckEditor::actSwapCard() +{ + const QModelIndex currentIndex = deckView->selectionModel()->currentIndex(); + if (!currentIndex.isValid()) + return; + const QString cardName = currentIndex.sibling(currentIndex.row(), 1).data().toString(); + const QModelIndex gparent = currentIndex.parent().parent(); + if (!gparent.isValid()) + return; + + const QString zoneName = gparent.sibling(gparent.row(), 1).data().toString(); + actDecrement(); + + const QString otherZoneName = zoneName == "Maindeck" ? "side" : "main"; + + QModelIndex newCardIndex = deckModel->addCard(cardName, otherZoneName); + recursiveExpand(newCardIndex); + deckView->setCurrentIndex(newCardIndex); + setModified(true); +} + void TabDeckEditor::actAddCard() { addCardHelper("main"); diff --git a/cockatrice/src/tab_deck_editor.h b/cockatrice/src/tab_deck_editor.h index b3ba8dcfe..dd3b56ac9 100644 --- a/cockatrice/src/tab_deck_editor.h +++ b/cockatrice/src/tab_deck_editor.h @@ -53,6 +53,7 @@ private slots: void actClearSearch(); + void actSwapCard(); void actAddCard(); void actAddCardToSideboard(); void actRemoveCard(); From 3cd6cc9195cb2ef3bd2a953201305a4f291ad8cb Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Mon, 15 Sep 2014 06:15:18 -0400 Subject: [PATCH 08/21] Added the location Oracle attempted to save cards.xml to the failure message. --- oracle/src/oraclewizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oracle/src/oraclewizard.cpp b/oracle/src/oraclewizard.cpp index c1c8b9829..6a5b2b798 100644 --- a/oracle/src/oraclewizard.cpp +++ b/oracle/src/oraclewizard.cpp @@ -432,7 +432,7 @@ bool SaveSetsPage::validatePage() ok = true; QMessageBox::information(this, tr("Success"), tr("The card database has been saved successfully.")); } else { - QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to the desired location.")); + QMessageBox::critical(this, tr("Error"), tr("The file could not be saved to %1").arg(fileName));; if (defaultPathCheckBox->isChecked()) defaultPathCheckBox->setChecked(false); } From 98e5211ad51805b5110412cf6b0778b67f252a54 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 15 Sep 2014 16:15:27 +0200 Subject: [PATCH 09/21] Fix oracle under windows --- cmake/NSIS.template.in | 16 ++++++++++------ oracle/src/oraclewizard.cpp | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index c04169c8b..5a931e196 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -51,13 +51,15 @@ Section "Application" SecApplication SectionEnd Section "Update configuration" SecUpdateConfig - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$APPDATA\Cockatrice\cards.xml" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$APPDATA\Cockatrice\decks" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$APPDATA\Cockatrice\pics" - WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$APPDATA\Cockatrice\sounds" + SetShellVarContext current + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "carddatabase" "$LOCALAPPDATA\Cockatrice\cards.xml" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "decks" "$LOCALAPPDATA\Cockatrice\decks" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\paths" "pics" "$LOCALAPPDATA\Cockatrice\pics" + WriteRegStr HKCU "Software\Cockatrice\Cockatrice\sound" "path" "$LOCALAPPDATA\Cockatrice\sounds" SectionEnd Section "Start menu item" SecStartMenu + SetShellVarContext all createDirectory "$SMPROGRAMS\Cockatrice" createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" '--debug-output' createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe" @@ -65,7 +67,7 @@ Section "Start menu item" SecStartMenu SectionEnd Section Uninstall -SetShellVarContext all + SetShellVarContext all RMDir /r "$INSTDIR\zonebg" RMDir /r "$INSTDIR\plugins" RMDir /r "$INSTDIR\sounds" @@ -83,8 +85,10 @@ SetShellVarContext all RMDir "$SMPROGRAMS\Cockatrice" - DeleteRegKey HKCU "Software\Cockatrice" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" + + SetShellVarContext current + DeleteRegKey HKCU "Software\Cockatrice" SectionEnd LangString DESC_SecApplication ${LANG_ENGLISH} "Cockatrice program files" diff --git a/oracle/src/oraclewizard.cpp b/oracle/src/oraclewizard.cpp index c1c8b9829..f0cb3351c 100644 --- a/oracle/src/oraclewizard.cpp +++ b/oracle/src/oraclewizard.cpp @@ -7,6 +7,7 @@ #endif #include #include +#include #include #include #include @@ -403,15 +404,13 @@ bool SaveSetsPage::validatePage() QStandardPaths::standardLocations(QStandardPaths::DataLocation).first(); #endif QSettings* settings = new QSettings(this); - QString savePath = settings->value("paths/carddatabase").toString(); - if (savePath.isEmpty()) { - QDir().mkpath(dataDir); - } + QString defaultPath = settings->value("paths/carddatabase").toString(); QString windowName = tr("Save card database"); QString fileType = tr("XML; card database (*.xml)"); + do { QString fileName; - if (savePath.isEmpty()) { + if (defaultPath.isEmpty()) { if (defaultPathCheckBox->isChecked()) fileName = dataDir + "/cards.xml"; else @@ -420,13 +419,19 @@ bool SaveSetsPage::validatePage() } else { if (defaultPathCheckBox->isChecked()) - fileName = savePath; + fileName = defaultPath; else - fileName = QFileDialog::getSaveFileName(this, windowName, savePath, fileType); + fileName = QFileDialog::getSaveFileName(this, windowName, defaultPath, fileType); } if (fileName.isEmpty()) { return false; } + + QFileInfo fi(fileName); + QDir fileDir(fi.path()); + if (!fileDir.exists() && !fileDir.mkpath(fileDir.absolutePath())) { + return false; + } if (wizard()->importer->saveToFile(fileName)) { ok = true; From 355de8fba4563912433ca9e143d3ed9949a7022a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 1 Oct 2014 20:21:22 +0200 Subject: [PATCH 10/21] Drop libgcrypt dependency for qt5 --- servatrice/CMakeLists.txt | 7 ++-- servatrice/src/passwordhasher.cpp | 63 ++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 42e2bb74a..925e96110 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -4,8 +4,6 @@ PROJECT(servatrice) -FIND_PACKAGE(Libgcrypt REQUIRED) - SET(servatrice_SOURCES src/main.cpp src/passwordhasher.cpp @@ -29,6 +27,10 @@ if(Qt4_FOUND) INCLUDE(${QT_USE_FILE}) include_directories(${QT_INCLUDES}) LIST(APPEND SERVATRICE_LIBS ${QT_LIBRARIES}) + + # Libgcrypt is required only with Qt4 to support SHA512 hashing + FIND_PACKAGE(Libgcrypt REQUIRED) + INCLUDE_DIRECTORIES(${LIBGCRYPT_INCLUDE_DIR}) endif() # qt5 stuff @@ -60,7 +62,6 @@ SET(QT_DONT_USE_QTGUI TRUE) # Include directories INCLUDE_DIRECTORIES(../common) -INCLUDE_DIRECTORIES(${LIBGCRYPT_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../common) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/servatrice/src/passwordhasher.cpp b/servatrice/src/passwordhasher.cpp index 0d8cda36e..554c8f2fe 100644 --- a/servatrice/src/passwordhasher.cpp +++ b/servatrice/src/passwordhasher.cpp @@ -1,32 +1,53 @@ #include "passwordhasher.h" -#include -#include -#include + +#if QT_VERSION < 0x050000 + #include + #include + #include +#else + #include +#endif void PasswordHasher::initialize() { - // These calls are required by libgcrypt before we use any of its functions. - gcry_check_version(0); - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); +#if QT_VERSION < 0x050000 + // These calls are required by libgcrypt before we use any of its functions. + gcry_check_version(0); + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); + gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif } +#if QT_VERSION < 0x050000 QString PasswordHasher::computeHash(const QString &password, const QString &salt) { - const int algo = GCRY_MD_SHA512; - const int rounds = 1000; + const int algo = GCRY_MD_SHA512; + const int rounds = 1000; - QByteArray passwordBuffer = (salt + password).toUtf8(); - int hashLen = gcry_md_get_algo_dlen(algo); - char *hash = new char[hashLen], *tmp = new char[hashLen]; - gcry_md_hash_buffer(algo, hash, passwordBuffer.data(), passwordBuffer.size()); - for (int i = 1; i < rounds; ++i) { - memcpy(tmp, hash, hashLen); - gcry_md_hash_buffer(algo, hash, tmp, hashLen); - } - QString hashedPass = salt + QString(QByteArray(hash, hashLen).toBase64()); - delete[] tmp; - delete[] hash; - return hashedPass; + QByteArray passwordBuffer = (salt + password).toUtf8(); + int hashLen = gcry_md_get_algo_dlen(algo); + char *hash = new char[hashLen], *tmp = new char[hashLen]; + gcry_md_hash_buffer(algo, hash, passwordBuffer.data(), passwordBuffer.size()); + for (int i = 1; i < rounds; ++i) { + memcpy(tmp, hash, hashLen); + gcry_md_hash_buffer(algo, hash, tmp, hashLen); + } + QString hashedPass = salt + QString(QByteArray(hash, hashLen).toBase64()); + delete[] tmp; + delete[] hash; + return hashedPass; } +#else +QString PasswordHasher::computeHash(const QString &password, const QString &salt) +{ + QCryptographicHash::Algorithm algo = QCryptographicHash::Sha512; + const int rounds = 1000; + QByteArray hash = (salt + password).toUtf8(); + for (int i = 0; i < rounds; ++i) { + hash = QCryptographicHash::hash(hash, algo); + } + QString hashedPass = salt + QString(hash.toBase64()); + return hashedPass; +} +#endif From 55b20343e9a159e0ae855c83b2f131a98659b14e Mon Sep 17 00:00:00 2001 From: Gavin Bisesi Date: Wed, 1 Oct 2014 16:30:19 -0400 Subject: [PATCH 11/21] Note that libgcrypt is needed only for qt4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d79addc6..f67c6fcc3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Dependencies: - [protobuf](http://code.google.com/p/protobuf/) - [CMake](http://www.cmake.org/) -The server requires an additional dependency: +The server requires an additional dependency when compiled under Qt4: - [libgcrypt](http://www.gnu.org/software/libgcrypt/) From 7afdff1b3b99df57cbc25220166ceba4a26b495e Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 08:34:21 +0200 Subject: [PATCH 12/21] Servatrice: install example ini and sql schema file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WIN: in the binary directory OSX: in the app bundle’s Resources subdirectory LINUX: in $PREFIX/share/servatrice --- servatrice/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 42e2bb74a..0cc1aacab 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -87,12 +87,18 @@ endif() if(UNIX) if(APPLE) INSTALL(TARGETS servatrice BUNDLE DESTINATION ./) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION ./servatrice.app/Contents/Resources/) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION ./servatrice.app/Contents/Resources/) else() # Assume linux INSTALL(TARGETS servatrice RUNTIME DESTINATION bin/) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION share/servatice/) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION share/servatice/) endif() elseif(WIN32) INSTALL(TARGETS servatrice RUNTIME DESTINATION ./) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION ./) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION ./) endif() if(APPLE) From 1f58f7d8482b36483e197fe0dc7e50e168e94c38 Mon Sep 17 00:00:00 2001 From: Antony Woods Date: Thu, 2 Oct 2014 08:48:04 +0100 Subject: [PATCH 13/21] Changed 'value' to 'setValue' on line 275 --- cockatrice/src/settingscache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index bc30a08b2..5821d3526 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -272,7 +272,7 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry) void SettingsCache::setAutoConnect(const bool &_autoConnect) { attemptAutoConnect = _autoConnect; - settings->value("server/auto_connect", attemptAutoConnect ? 1 : 0); + settings->setValue("server/auto_connect", attemptAutoConnect ? 1 : 0); } void SettingsCache::copyPath(const QString &src, const QString &dst) From a1b6600fe1412131d973ec065be17088db069b01 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 22:37:50 +0200 Subject: [PATCH 14/21] Servatrice: group all the use of QSettings in a single file and add a method to guess the path of servatrice.ini --- servatrice/CMakeLists.txt | 1 + servatrice/src/main.cpp | 17 +++++-- servatrice/src/servatrice.cpp | 82 ++++++++++++++++---------------- servatrice/src/servatrice.h | 4 +- servatrice/src/server_logger.cpp | 7 ++- servatrice/src/settingscache.cpp | 37 ++++++++++++++ servatrice/src/settingscache.h | 18 +++++++ 7 files changed, 113 insertions(+), 53 deletions(-) create mode 100644 servatrice/src/settingscache.cpp create mode 100644 servatrice/src/settingscache.h diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 224e10d22..7bdf47216 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -12,6 +12,7 @@ SET(servatrice_SOURCES src/servatrice_database_interface.cpp src/server_logger.cpp src/serversocketinterface.cpp + src/settingscache.cpp src/isl_interface.cpp ${VERSION_STRING_CPP} ) diff --git a/servatrice/src/main.cpp b/servatrice/src/main.cpp index d90e06349..b2feac425 100644 --- a/servatrice/src/main.cpp +++ b/servatrice/src/main.cpp @@ -22,11 +22,11 @@ #include #include #include -#include #include #include "passwordhasher.h" #include "servatrice.h" #include "server_logger.h" +#include "settingscache.h" #include "rng_sfmt.h" #include "version_string.h" #include @@ -37,6 +37,7 @@ RNG_Abstract *rng; ServerLogger *logger; QThread *loggerThread; +SettingsCache *settingsCache; /* Prototypes */ @@ -150,6 +151,10 @@ int main(int argc, char *argv[]) bool testRandom = args.contains("--test-random"); bool testHashFunction = args.contains("--test-hash"); bool logToConsole = args.contains("--log-to-console"); + QString configPath; + int hasConfigPath=args.indexOf("--config"); + if(hasConfigPath > -1 && args.count() > hasConfigPath + 1) + configPath = args.at(hasConfigPath + 1); qRegisterMetaType >("QList"); @@ -158,7 +163,9 @@ int main(int argc, char *argv[]) QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); #endif - QSettings *settings = new QSettings("servatrice.ini", QSettings::IniFormat); + configPath = SettingsCache::guessConfigurationPath(configPath); + std::cerr << "Using configuration file:" << configPath.toUtf8().data() << std::endl; + settingsCache = new SettingsCache(); loggerThread = new QThread; loggerThread->setObjectName("logger"); @@ -166,7 +173,7 @@ int main(int argc, char *argv[]) logger->moveToThread(loggerThread); loggerThread->start(); - QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settings->value("server/logfile").toString())); + QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile").toString())); #if QT_VERSION < 0x050000 if (logToConsole) @@ -209,7 +216,7 @@ int main(int argc, char *argv[]) if (testHashFunction) testHash(); - Servatrice *server = new Servatrice(settings); + Servatrice *server = new Servatrice(); QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()), Qt::QueuedConnection); int retval = 0; if (server->initServer()) { @@ -228,7 +235,7 @@ int main(int argc, char *argv[]) } delete rng; - delete settings; + delete settingsCache; logger->deleteLater(); loggerThread->wait(); diff --git a/servatrice/src/servatrice.cpp b/servatrice/src/servatrice.cpp index 4c9b4a067..8587148e4 100644 --- a/servatrice/src/servatrice.cpp +++ b/servatrice/src/servatrice.cpp @@ -18,7 +18,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include -#include #include #include #include @@ -28,6 +27,7 @@ #include "servatrice_database_interface.h" #include "servatrice_connection_pool.h" #include "server_room.h" +#include "settingscache.h" #include "serversocketinterface.h" #include "isl_interface.h" #include "server_logger.h" @@ -120,8 +120,8 @@ void Servatrice_IslServer::incomingConnection(int socketDescriptor) QMetaObject::invokeMethod(interface, "initServer", Qt::QueuedConnection); } -Servatrice::Servatrice(QSettings *_settings, QObject *parent) - : Server(true, parent), settings(_settings), uptime(0), shutdownTimer(0) +Servatrice::Servatrice(QObject *parent) + : Server(true, parent), uptime(0), shutdownTimer(0) { qRegisterMetaType("QSqlDatabase"); } @@ -134,11 +134,11 @@ Servatrice::~Servatrice() bool Servatrice::initServer() { - serverName = settings->value("server/name").toString(); - serverId = settings->value("server/id", 0).toInt(); - bool regServerOnly = settings->value("server/regonly", 0).toBool(); + serverName = settingsCache->value("server/name").toString(); + serverId = settingsCache->value("server/id", 0).toInt(); + bool regServerOnly = settingsCache->value("server/regonly", 0).toBool(); - const QString authenticationMethodStr = settings->value("authentication/method").toString(); + const QString authenticationMethodStr = settingsCache->value("authentication/method").toString(); if (authenticationMethodStr == "sql") { authenticationMethod = AuthenticationSql; } else { @@ -149,7 +149,7 @@ bool Servatrice::initServer() authenticationMethod = AuthenticationNone; } - QString dbTypeStr = settings->value("database/type").toString(); + QString dbTypeStr = settingsCache->value("database/type").toString(); if (dbTypeStr == "mysql") databaseType = DatabaseMySql; else @@ -159,14 +159,14 @@ bool Servatrice::initServer() setDatabaseInterface(servatriceDatabaseInterface); if (databaseType != DatabaseNone) { - settings->beginGroup("database"); - dbPrefix = settings->value("prefix").toString(); + settingsCache->beginGroup("database"); + dbPrefix = settingsCache->value("prefix").toString(); servatriceDatabaseInterface->initDatabase("QMYSQL", - settings->value("hostname").toString(), - settings->value("database").toString(), - settings->value("user").toString(), - settings->value("password").toString()); - settings->endGroup(); + settingsCache->value("hostname").toString(), + settingsCache->value("database").toString(), + settingsCache->value("user").toString(), + settingsCache->value("password").toString()); + settingsCache->endGroup(); updateServerList(); @@ -174,7 +174,7 @@ bool Servatrice::initServer() servatriceDatabaseInterface->clearSessionTables(); } - const QString roomMethod = settings->value("rooms/method").toString(); + const QString roomMethod = settingsCache->value("rooms/method").toString(); if (roomMethod == "sql") { QSqlQuery query(servatriceDatabaseInterface->getDatabase()); query.prepare("select id, name, descr, auto_join, join_message from " + dbPrefix + "_rooms order by id asc"); @@ -198,47 +198,47 @@ bool Servatrice::initServer() )); } } else { - int size = settings->beginReadArray("rooms/roomlist"); + int size = settingsCache->beginReadArray("rooms/roomlist"); for (int i = 0; i < size; ++i) { - settings->setArrayIndex(i); + settingsCache->setArrayIndex(i); QStringList gameTypes; - int size2 = settings->beginReadArray("game_types"); + int size2 = settingsCache->beginReadArray("game_types"); for (int j = 0; j < size2; ++j) { - settings->setArrayIndex(j); - gameTypes.append(settings->value("name").toString()); + settingsCache->setArrayIndex(j); + gameTypes.append(settingsCache->value("name").toString()); } - settings->endArray(); + settingsCache->endArray(); Server_Room *newRoom = new Server_Room( i, - settings->value("name").toString(), - settings->value("description").toString(), - settings->value("autojoin").toBool(), - settings->value("joinmessage").toString(), + settingsCache->value("name").toString(), + settingsCache->value("description").toString(), + settingsCache->value("autojoin").toBool(), + settingsCache->value("joinmessage").toString(), gameTypes, this ); addRoom(newRoom); } - settings->endArray(); + settingsCache->endArray(); } updateLoginMessage(); - maxGameInactivityTime = settings->value("game/max_game_inactivity_time").toInt(); - maxPlayerInactivityTime = settings->value("game/max_player_inactivity_time").toInt(); + maxGameInactivityTime = settingsCache->value("game/max_game_inactivity_time").toInt(); + maxPlayerInactivityTime = settingsCache->value("game/max_player_inactivity_time").toInt(); - maxUsersPerAddress = settings->value("security/max_users_per_address").toInt(); - messageCountingInterval = settings->value("security/message_counting_interval").toInt(); - maxMessageCountPerInterval = settings->value("security/max_message_count_per_interval").toInt(); - maxMessageSizePerInterval = settings->value("security/max_message_size_per_interval").toInt(); - maxGamesPerUser = settings->value("security/max_games_per_user").toInt(); + maxUsersPerAddress = settingsCache->value("security/max_users_per_address").toInt(); + messageCountingInterval = settingsCache->value("security/message_counting_interval").toInt(); + maxMessageCountPerInterval = settingsCache->value("security/max_message_count_per_interval").toInt(); + maxMessageSizePerInterval = settingsCache->value("security/max_message_size_per_interval").toInt(); + maxGamesPerUser = settingsCache->value("security/max_games_per_user").toInt(); - try { if (settings->value("servernetwork/active", 0).toInt()) { + try { if (settingsCache->value("servernetwork/active", 0).toInt()) { qDebug() << "Connecting to ISL network."; - const QString certFileName = settings->value("servernetwork/ssl_cert").toString(); - const QString keyFileName = settings->value("servernetwork/ssl_key").toString(); + const QString certFileName = settingsCache->value("servernetwork/ssl_cert").toString(); + const QString keyFileName = settingsCache->value("servernetwork/ssl_key").toString(); qDebug() << "Loading certificate..."; QFile certFile(certFileName); if (!certFile.open(QIODevice::ReadOnly)) @@ -282,7 +282,7 @@ bool Servatrice::initServer() QMetaObject::invokeMethod(interface, "initClient", Qt::BlockingQueuedConnection); } - const int networkPort = settings->value("servernetwork/port", 14747).toInt(); + const int networkPort = settingsCache->value("servernetwork/port", 14747).toInt(); qDebug() << "Starting ISL server on port" << networkPort; islServer = new Servatrice_IslServer(this, cert, key, this); @@ -299,7 +299,7 @@ bool Servatrice::initServer() connect(pingClock, SIGNAL(timeout()), this, SIGNAL(pingClockTimeout())); pingClock->start(1000); - int statusUpdateTime = settings->value("server/statusupdate").toInt(); + int statusUpdateTime = settingsCache->value("server/statusupdate").toInt(); statusUpdateClock = new QTimer(this); connect(statusUpdateClock, SIGNAL(timeout()), this, SLOT(statusUpdate())); if (statusUpdateTime != 0) { @@ -307,10 +307,10 @@ bool Servatrice::initServer() statusUpdateClock->start(statusUpdateTime); } - const int numberPools = settings->value("server/number_pools", 1).toInt(); + const int numberPools = settingsCache->value("server/number_pools", 1).toInt(); gameServer = new Servatrice_GameServer(this, numberPools, servatriceDatabaseInterface->getDatabase(), this); gameServer->setMaxPendingConnections(1000); - const int gamePort = settings->value("server/port", 4747).toInt(); + const int gamePort = settingsCache->value("server/port", 4747).toInt(); qDebug() << "Starting server on port" << gamePort; if (gameServer->listen(QHostAddress::Any, gamePort)) qDebug() << "Server listening."; diff --git a/servatrice/src/servatrice.h b/servatrice/src/servatrice.h index 2b991512f..86c36a5c3 100644 --- a/servatrice/src/servatrice.h +++ b/servatrice/src/servatrice.h @@ -32,7 +32,6 @@ Q_DECLARE_METATYPE(QSqlDatabase) -class QSettings; class QSqlQuery; class QTimer; @@ -106,7 +105,6 @@ private: mutable QMutex loginMessageMutex; QString loginMessage; QString dbPrefix; - QSettings *settings; Servatrice_DatabaseInterface *servatriceDatabaseInterface; int serverId; int uptime; @@ -128,7 +126,7 @@ public slots: void scheduleShutdown(const QString &reason, int minutes); void updateLoginMessage(); public: - Servatrice(QSettings *_settings, QObject *parent = 0); + Servatrice(QObject *parent = 0); ~Servatrice(); bool initServer(); QString getServerName() const { return serverName; } diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index a3e92affa..9d3a81a3c 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -1,9 +1,9 @@ #include "server_logger.h" +#include "settingscache.h" #include #include #include #include -#include #include #ifdef Q_OS_UNIX # include @@ -50,9 +50,8 @@ void ServerLogger::logMessage(QString message, void *caller) callerString = QString::number((qulonglong) caller, 16) + " "; //filter out all log entries based on values in configuration file - QSettings settings("servatrice.ini", QSettings::IniFormat); - bool shouldWeWriteLog = settings.value("server/writelog").toBool(); - QString logFilters = settings.value("server/logfilters").toString(); + bool shouldWeWriteLog = settingsCache->value("server/writelog").toBool(); + QString logFilters = settingsCache->value("server/logfilters").toString(); QStringList listlogFilters = logFilters.split(",", QString::SkipEmptyParts); bool shouldWeSkipLine = false; diff --git a/servatrice/src/settingscache.cpp b/servatrice/src/settingscache.cpp new file mode 100644 index 000000000..b8156b677 --- /dev/null +++ b/servatrice/src/settingscache.cpp @@ -0,0 +1,37 @@ +#include "settingscache.h" +#include +#include +#if QT_VERSION >= 0x050000 + #include +#else + #include +#endif + +QString SettingsCache::guessConfigurationPath(QString & specificPath) +{ + const QString fileName="servatrice.ini"; + QString guessFileName; + + // specific path + if(!specificPath.isEmpty() && QFile::exists(specificPath)) + return specificPath; + + // application directory path + guessFileName = QCoreApplication::applicationDirPath() + "/" + fileName; + if(QFile::exists(guessFileName)) + return guessFileName; + +#ifdef Q_OS_UNIX + // /etc + guessFileName = "/etc/" + fileName; + if(QFile::exists(guessFileName)) + return guessFileName; +#endif + +#if QT_VERSION >= 0x050000 + guessFileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + fileName; +#else + guessFileName = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + fileName; +#endif + return guessFileName; +} \ No newline at end of file diff --git a/servatrice/src/settingscache.h b/servatrice/src/settingscache.h new file mode 100644 index 000000000..945ab71fc --- /dev/null +++ b/servatrice/src/settingscache.h @@ -0,0 +1,18 @@ +#ifndef SERVATRICE_SETTINGSCACHE_H +#define SERVATRICE_SETTINGSCACHE_H + +#include +#include + +class SettingsCache : public QSettings { + Q_OBJECT +private: + QSettings *settings; +public: + SettingsCache(const QString & fileName="servatrice.ini", QSettings::Format format=QSettings::IniFormat, QObject * parent = 0) { }; + static QString guessConfigurationPath(QString & specificPath); +}; + +extern SettingsCache *settingsCache; + +#endif From 8b32e51cabec1b163ea491f8719dba4820e1ab69 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 22:46:46 +0200 Subject: [PATCH 15/21] win32 NSIS installer: uninstall servatrice* just avoid deleting servatrice.ini, if the user manually made one from the servatrice.ini.example --- cmake/NSIS.template.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 5a931e196..3784b1b04 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -75,12 +75,16 @@ Section Uninstall Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\cockatrice.exe" Delete "$INSTDIR\oracle.exe" + Delete "$INSTDIR\servatrice.exe" Delete "$INSTDIR\Usermanual.pdf" Delete "$INSTDIR\libprotobuf.lib" Delete "$INSTDIR\Qt*.dll" Delete "$INSTDIR\icu*.dll" Delete "$INSTDIR\qt.conf" Delete "$INSTDIR\qdebug.txt" + Delete "$INSTDIR\server.log" + Delete "$INSTDIR\servatrice.sql" + Delete "$INSTDIR\servatrice.ini.example" RMDir "$INSTDIR" RMDir "$SMPROGRAMS\Cockatrice" From 4b38187d2059c0b37c7021c4e5f064874497c117 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:00:17 +0200 Subject: [PATCH 16/21] Fix logfile option in servatrice.ini MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit servatrice was using hardcocded filename “server.log” even if a custom value was specified --- servatrice/src/main.cpp | 2 +- servatrice/src/server_logger.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/servatrice/src/main.cpp b/servatrice/src/main.cpp index b2feac425..b19282088 100644 --- a/servatrice/src/main.cpp +++ b/servatrice/src/main.cpp @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) logger->moveToThread(loggerThread); loggerThread->start(); - QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile").toString())); + QMetaObject::invokeMethod(logger, "startLog", Qt::BlockingQueuedConnection, Q_ARG(QString, settingsCache->value("server/logfile", QString("server.log")).toString())); #if QT_VERSION < 0x050000 if (logToConsole) diff --git a/servatrice/src/server_logger.cpp b/servatrice/src/server_logger.cpp index 9d3a81a3c..1a1e4bed4 100644 --- a/servatrice/src/server_logger.cpp +++ b/servatrice/src/server_logger.cpp @@ -26,7 +26,7 @@ ServerLogger::~ServerLogger() void ServerLogger::startLog(const QString &logFileName) { if (!logFileName.isEmpty()) { - logFile = new QFile("server.log", this); + logFile = new QFile(logFileName, this); logFile->open(QIODevice::Append); #ifdef Q_OS_UNIX ::socketpair(AF_UNIX, SOCK_STREAM, 0, sigHupFD); From b3480683697c1c0ff0fd1e7083e76b67104dc62d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:11:49 +0200 Subject: [PATCH 17/21] Servatrice: Add a default option for every config value add an empty room swell, if none had been defined in the config (or we are running with no config at all) --- servatrice/src/servatrice.cpp | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/servatrice/src/servatrice.cpp b/servatrice/src/servatrice.cpp index 8587148e4..c4590f5b5 100644 --- a/servatrice/src/servatrice.cpp +++ b/servatrice/src/servatrice.cpp @@ -134,7 +134,7 @@ Servatrice::~Servatrice() bool Servatrice::initServer() { - serverName = settingsCache->value("server/name").toString(); + serverName = settingsCache->value("server/name", "My Cockatrice server").toString(); serverId = settingsCache->value("server/id", 0).toInt(); bool regServerOnly = settingsCache->value("server/regonly", 0).toBool(); @@ -221,19 +221,35 @@ bool Servatrice::initServer() ); addRoom(newRoom); } + + if(size==0) + { + // no room defined in config, add a dummy one + Server_Room *newRoom = new Server_Room( + 0, + "General room", + "Play anything here.", + true, + "", + QStringList("Standard"), + this + ); + addRoom(newRoom); + } + settingsCache->endArray(); } updateLoginMessage(); - maxGameInactivityTime = settingsCache->value("game/max_game_inactivity_time").toInt(); - maxPlayerInactivityTime = settingsCache->value("game/max_player_inactivity_time").toInt(); + maxGameInactivityTime = settingsCache->value("game/max_game_inactivity_time", 120).toInt(); + maxPlayerInactivityTime = settingsCache->value("game/max_player_inactivity_time", 15).toInt(); - maxUsersPerAddress = settingsCache->value("security/max_users_per_address").toInt(); - messageCountingInterval = settingsCache->value("security/message_counting_interval").toInt(); - maxMessageCountPerInterval = settingsCache->value("security/max_message_count_per_interval").toInt(); - maxMessageSizePerInterval = settingsCache->value("security/max_message_size_per_interval").toInt(); - maxGamesPerUser = settingsCache->value("security/max_games_per_user").toInt(); + maxUsersPerAddress = settingsCache->value("security/max_users_per_address", 4).toInt(); + messageCountingInterval = settingsCache->value("security/message_counting_interval", 10).toInt(); + maxMessageCountPerInterval = settingsCache->value("security/max_message_count_per_interval", 10).toInt(); + maxMessageSizePerInterval = settingsCache->value("security/max_message_size_per_interval", 1000).toInt(); + maxGamesPerUser = settingsCache->value("security/max_games_per_user", 5).toInt(); try { if (settingsCache->value("servernetwork/active", 0).toInt()) { qDebug() << "Connecting to ISL network."; @@ -299,7 +315,7 @@ bool Servatrice::initServer() connect(pingClock, SIGNAL(timeout()), this, SIGNAL(pingClockTimeout())); pingClock->start(1000); - int statusUpdateTime = settingsCache->value("server/statusupdate").toInt(); + int statusUpdateTime = settingsCache->value("server/statusupdate", 15000).toInt(); statusUpdateClock = new QTimer(this); connect(statusUpdateClock, SIGNAL(timeout()), this, SLOT(statusUpdate())); if (statusUpdateTime != 0) { From 85a4a94ba3178558f347f24d82946bf2e774f21d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:26:25 +0200 Subject: [PATCH 18/21] win32: Avoid wiping server.log on upgrade --- cmake/NSIS.template.in | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 3784b1b04..093d6caa6 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -82,7 +82,6 @@ Section Uninstall Delete "$INSTDIR\icu*.dll" Delete "$INSTDIR\qt.conf" Delete "$INSTDIR\qdebug.txt" - Delete "$INSTDIR\server.log" Delete "$INSTDIR\servatrice.sql" Delete "$INSTDIR\servatrice.ini.example" RMDir "$INSTDIR" From 37eaeaae135ab5fae1e11ee957774c6fdba9b5ff Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:41:24 +0200 Subject: [PATCH 19/21] servatrice: as a third choice, check for a config in /etc/servatrice/ --- servatrice/src/settingscache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servatrice/src/settingscache.cpp b/servatrice/src/settingscache.cpp index b8156b677..35a31eb9d 100644 --- a/servatrice/src/settingscache.cpp +++ b/servatrice/src/settingscache.cpp @@ -23,7 +23,7 @@ QString SettingsCache::guessConfigurationPath(QString & specificPath) #ifdef Q_OS_UNIX // /etc - guessFileName = "/etc/" + fileName; + guessFileName = "/etc/servatrice/" + fileName; if(QFile::exists(guessFileName)) return guessFileName; #endif From 8d8ccaad7fb21495223a165d2d8d06c1d3b50609 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:42:51 +0200 Subject: [PATCH 20/21] use 4 spaces instead of tabs --- servatrice/src/settingscache.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/servatrice/src/settingscache.cpp b/servatrice/src/settingscache.cpp index 35a31eb9d..10984dd69 100644 --- a/servatrice/src/settingscache.cpp +++ b/servatrice/src/settingscache.cpp @@ -9,23 +9,23 @@ QString SettingsCache::guessConfigurationPath(QString & specificPath) { - const QString fileName="servatrice.ini"; - QString guessFileName; + const QString fileName="servatrice.ini"; + QString guessFileName; - // specific path - if(!specificPath.isEmpty() && QFile::exists(specificPath)) - return specificPath; + // specific path + if(!specificPath.isEmpty() && QFile::exists(specificPath)) + return specificPath; - // application directory path - guessFileName = QCoreApplication::applicationDirPath() + "/" + fileName; - if(QFile::exists(guessFileName)) - return guessFileName; + // application directory path + guessFileName = QCoreApplication::applicationDirPath() + "/" + fileName; + if(QFile::exists(guessFileName)) + return guessFileName; #ifdef Q_OS_UNIX - // /etc - guessFileName = "/etc/servatrice/" + fileName; - if(QFile::exists(guessFileName)) - return guessFileName; + // /etc + guessFileName = "/etc/servatrice/" + fileName; + if(QFile::exists(guessFileName)) + return guessFileName; #endif #if QT_VERSION >= 0x050000 From 871f5f7c9486923e114563621254f96aefaec7b0 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 2 Oct 2014 23:45:42 +0200 Subject: [PATCH 21/21] use qWarning instead of std::err --- servatrice/src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/servatrice/src/main.cpp b/servatrice/src/main.cpp index b19282088..49b06b279 100644 --- a/servatrice/src/main.cpp +++ b/servatrice/src/main.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -164,7 +165,7 @@ int main(int argc, char *argv[]) #endif configPath = SettingsCache::guessConfigurationPath(configPath); - std::cerr << "Using configuration file:" << configPath.toUtf8().data() << std::endl; + qWarning() << "Using configuration file: " << configPath; settingsCache = new SettingsCache(); loggerThread = new QThread;