Merge branch 'master' into custom-zones

This commit is contained in:
Basile Clement 2025-05-07 01:46:58 +02:00 committed by GitHub
commit d90e4a99ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 411 additions and 72 deletions

View file

@ -356,7 +356,7 @@ void TabEdhRecMain::processAverageDeckResponse(QJsonObject reply)
{
EdhrecAverageDeckApiResponse deckData;
deckData.fromJson(reply);
tabSupervisor->addVisualDeckEditorTab(deckData.deck.deckLoader);
tabSupervisor->openDeckInNewTab(deckData.deck.deckLoader);
}
void TabEdhRecMain::prettyPrintJson(const QJsonValue &value, int indentLevel)

View file

@ -590,7 +590,7 @@ void TabSupervisor::actTabDeckStorage(bool checked)
void TabSupervisor::openTabDeckStorage()
{
tabDeckStorage = new TabDeckStorage(this, client, userInfo);
connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
myAddTab(tabDeckStorage, aTabDeckStorage);
connect(tabDeckStorage, &Tab::closed, this, [this] {
tabDeckStorage = nullptr;
@ -691,7 +691,7 @@ void TabSupervisor::gameJoined(const Event_GameJoined &event)
auto *tab = new TabGame(this, QList<AbstractClient *>() << client, event, roomGameTypes);
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
connect(tab, &TabGame::openMessageDialog, this, &TabSupervisor::addMessageTab);
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
myAddTab(tab);
gameTabs.insert(event.game_info().game_id(), tab);
setCurrentWidget(tab);
@ -701,7 +701,7 @@ void TabSupervisor::localGameJoined(const Event_GameJoined &event)
{
auto *tab = new TabGame(this, localClients, event, QMap<int, QString>());
connect(tab, &TabGame::gameClosing, this, &TabSupervisor::gameLeft);
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
connect(tab, &TabGame::openDeckEditor, this, &TabSupervisor::openDeckInNewTab);
myAddTab(tab);
gameTabs.insert(event.game_info().game_id(), tab);
setCurrentWidget(tab);
@ -807,6 +807,29 @@ void TabSupervisor::talkLeft(TabMessage *tab)
removeTab(indexOf(tab));
}
/**
* Creates a new deck editor tab and loads the deck into it.
* Creates either a classic or visual deck editor tab depending on settings
* @param deckToOpen The deck to open in the tab. Creates a copy of the DeckLoader instance.
*/
void TabSupervisor::openDeckInNewTab(const DeckLoader *deckToOpen)
{
int type = SettingsCache::instance().getDefaultDeckEditorType();
switch (type) {
case ClassicDeckEditor:
addDeckEditorTab(deckToOpen);
break;
case VisualDeckEditor:
addVisualDeckEditorTab(deckToOpen);
break;
default:
qCWarning(TabSupervisorLog) << "Unknown DeckEditorType [" << type
<< "]; opening ClassicDeckEditor as fallback";
addDeckEditorTab(deckToOpen);
break;
}
}
/**
* Creates a new deck editor tab
* @param deckToOpen The deck to open in the tab. Creates a copy of the DeckLoader instance.

View file

@ -75,6 +75,14 @@ protected:
class TabSupervisor : public QTabWidget
{
Q_OBJECT
public:
enum DeckEditorType
{
ClassicDeckEditor,
VisualDeckEditor
};
private:
ServerInfo_User *userInfo;
AbstractClient *client;
@ -152,6 +160,7 @@ signals:
void showWindowIfHidden();
public slots:
void openDeckInNewTab(const DeckLoader *deckToOpen);
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
TabDeckEditorVisual *addVisualDeckEditorTab(const DeckLoader *deckToOpen);
TabVisualDatabaseDisplay *addVisualDatabaseDisplayTab();

View file

@ -12,7 +12,7 @@
TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor)
: Tab(_tabSupervisor), visualDeckStorageWidget(new VisualDeckStorageWidget(this))
{
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::addVisualDeckEditorTab);
connect(this, &TabDeckStorageVisual::openDeckEditor, tabSupervisor, &TabSupervisor::openDeckInNewTab);
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckLoadRequested, this,
&TabDeckStorageVisual::actOpenLocalDeck);
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::openDeckEditor, this,

View file

@ -66,7 +66,7 @@ void ManaSymbolWidget::loadManaIcon()
QString filename = "theme:icons/mana/";
if (symbol == "W" || symbol == "U" || symbol == "B" || symbol == "R" || symbol == "G") {
filename += symbol + ".svg";
filename += symbol;
}
manaIcon = QPixmap(filename);

View file

@ -64,6 +64,12 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT
});
}
CardInfoPictureWidget::~CardInfoPictureWidget()
{
enlargedPixmapWidget->hide();
enlargedPixmapWidget->deleteLater();
}
/**
* @brief Sets the card to be displayed and updates the pixmap.
* @param card A shared pointer to the card information (CardInfoPtr).
@ -341,6 +347,12 @@ void CardInfoPictureWidget::mousePressEvent(QMouseEvent *event)
emit cardClicked();
}
void CardInfoPictureWidget::hideEvent(QHideEvent *event)
{
enlargedPixmapWidget->hide();
QWidget::hideEvent(event);
}
QMenu *CardInfoPictureWidget::createRightClickMenu()
{
auto *cardMenu = new QMenu(this);

View file

@ -21,6 +21,7 @@ public:
explicit CardInfoPictureWidget(QWidget *parent = nullptr,
bool hoverToZoomEnabled = false,
bool raiseOnEnter = false);
~CardInfoPictureWidget();
CardInfoPtr getInfo()
{
return info;
@ -52,6 +53,7 @@ protected:
void moveEvent(QMoveEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void hideEvent(QHideEvent *event) override;
void loadPixmap();
[[nodiscard]] const QPixmap &getResizedPixmap() const
{

View file

@ -63,6 +63,9 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
destroyCheckBox = new QCheckBox(tr("&Destroy token when it leaves the table"));
destroyCheckBox->setChecked(true);
faceDownCheckBox = new QCheckBox(tr("Create face-down (Only hides name)"));
connect(faceDownCheckBox, &QCheckBox::toggled, this, &DlgCreateToken::faceDownCheckBoxToggled);
QGridLayout *grid = new QGridLayout;
grid->addWidget(nameLabel, 0, 0);
grid->addWidget(nameEdit, 0, 1);
@ -73,6 +76,7 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
grid->addWidget(annotationLabel, 3, 0);
grid->addWidget(annotationEdit, 3, 1);
grid->addWidget(destroyCheckBox, 4, 0, 1, 2);
grid->addWidget(faceDownCheckBox, 5, 0, 1, 2);
QGroupBox *tokenDataGroupBox = new QGroupBox(tr("Token data"));
tokenDataGroupBox->setLayout(grid);
@ -155,6 +159,21 @@ void DlgCreateToken::closeEvent(QCloseEvent *event)
SettingsCache::instance().setTokenDialogGeometry(saveGeometry());
}
void DlgCreateToken::faceDownCheckBoxToggled(bool checked)
{
if (checked) {
colorEdit->setCurrentIndex(6);
colorEdit->setEnabled(false);
ptEdit->clear();
ptEdit->clearFocus();
ptEdit->setEnabled(false);
} else {
colorEdit->setEnabled(true);
ptEdit->setEnabled(true);
annotationEdit->setEnabled(true);
}
}
void DlgCreateToken::tokenSelectionChanged(const QModelIndex &current, const QModelIndex & /*previous*/)
{
const QModelIndex realIndex = cardDatabaseDisplayModel->mapToSource(current);
@ -230,5 +249,6 @@ TokenInfo DlgCreateToken::getTokenInfo() const
.color = colorEdit->itemData(colorEdit->currentIndex()).toString(),
.pt = ptEdit->text(),
.annotation = annotationEdit->text(),
.destroy = destroyCheckBox->isChecked()};
.destroy = destroyCheckBox->isChecked(),
.faceDown = faceDownCheckBox->isChecked()};
}

View file

@ -24,6 +24,7 @@ struct TokenInfo
QString pt;
QString annotation;
bool destroy = true;
bool faceDown = false;
};
class DlgCreateToken : public QDialog
@ -36,6 +37,7 @@ public:
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void faceDownCheckBoxToggled(bool checked);
void tokenSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
void updateSearch(const QString &search);
void actChooseTokenFromAll(bool checked);
@ -51,6 +53,7 @@ private:
QComboBox *colorEdit;
QLineEdit *nameEdit, *ptEdit, *annotationEdit;
QCheckBox *destroyCheckBox;
QCheckBox *faceDownCheckBox;
QRadioButton *chooseTokenFromAllRadioButton, *chooseTokenFromDeckRadioButton;
CardInfoPictureWidget *pic;
QTreeView *chooseTokenView;

View file

@ -4,6 +4,7 @@
#include "../client/network/release_channel.h"
#include "../client/network/spoiler_background_updater.h"
#include "../client/sound_engine.h"
#include "../client/tabs/tab_supervisor.h"
#include "../client/ui/picture_loader/picture_loader.h"
#include "../client/ui/theme_manager.h"
#include "../deck/custom_line_edit.h"
@ -629,6 +630,10 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
connect(&closeEmptyCardViewCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setCloseEmptyCardView);
focusCardViewSearchBarCheckBox.setChecked(SettingsCache::instance().getFocusCardViewSearchBar());
connect(&focusCardViewSearchBarCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setFocusCardViewSearchBar);
annotateTokensCheckBox.setChecked(SettingsCache::instance().getAnnotateTokens());
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setAnnotateTokens);
@ -642,8 +647,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
generalGrid->addWidget(&clickPlaysAllSelectedCheckBox, 1, 0);
generalGrid->addWidget(&playToStackCheckBox, 2, 0);
generalGrid->addWidget(&closeEmptyCardViewCheckBox, 3, 0);
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
generalGrid->addWidget(&useTearOffMenusCheckBox, 5, 0);
generalGrid->addWidget(&focusCardViewSearchBarCheckBox, 4, 0);
generalGrid->addWidget(&annotateTokensCheckBox, 5, 0);
generalGrid->addWidget(&useTearOffMenusCheckBox, 6, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
@ -699,12 +705,20 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
index == visualDeckStoragePromptForConversionIndexAlways);
});
defaultDeckEditorTypeSelector.addItem(""); // these will be set in retranslateUI
defaultDeckEditorTypeSelector.addItem("");
defaultDeckEditorTypeSelector.setCurrentIndex(SettingsCache::instance().getDefaultDeckEditorType());
connect(&defaultDeckEditorTypeSelector, QOverload<int>::of(&QComboBox::currentIndexChanged),
&SettingsCache::instance(), &SettingsCache::setDefaultDeckEditorType);
auto *deckEditorGrid = new QGridLayout;
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
deckEditorGrid->addWidget(&visualDeckStorageInGameCheckBox, 1, 0);
deckEditorGrid->addWidget(&visualDeckStorageSelectionAnimationCheckBox, 2, 0);
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionLabel, 3, 0);
deckEditorGrid->addWidget(&visualDeckStoragePromptForConversionSelector, 3, 1);
deckEditorGrid->addWidget(&defaultDeckEditorTypeLabel, 4, 0);
deckEditorGrid->addWidget(&defaultDeckEditorTypeSelector, 4, 1);
deckEditorGroupBox = new QGroupBox;
deckEditorGroupBox->setLayout(deckEditorGrid);
@ -754,6 +768,7 @@ void UserInterfaceSettingsPage::retranslateUi()
clickPlaysAllSelectedCheckBox.setText(tr("&Clicking plays all selected cards (instead of just the clicked card)"));
playToStackCheckBox.setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
closeEmptyCardViewCheckBox.setText(tr("Close card view window when last card is removed"));
focusCardViewSearchBarCheckBox.setText(tr("Auto focus search bar when card view window is opened"));
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
useTearOffMenusCheckBox.setText(tr("Use tear-off menus, allowing right click menus to persist on screen"));
notificationsGroupBox->setTitle(tr("Notifications settings"));
@ -774,6 +789,9 @@ void UserInterfaceSettingsPage::retranslateUi()
tr("ask to convert to .cod"));
visualDeckStoragePromptForConversionSelector.setItemText(visualDeckStoragePromptForConversionIndexAlways,
tr("always convert to .cod"));
defaultDeckEditorTypeLabel.setText(tr("Default deck editor type"));
defaultDeckEditorTypeSelector.setItemText(TabSupervisor::ClassicDeckEditor, tr("Classic Deck Editor"));
defaultDeckEditorTypeSelector.setItemText(TabSupervisor::VisualDeckEditor, tr("Visual Deck Editor"));
replayGroupBox->setTitle(tr("Replay settings"));
rewindBufferingMsLabel.setText(tr("Buffer time for backwards skip via shortcut:"));
rewindBufferingMsBox.setSuffix(" ms");

View file

@ -147,6 +147,7 @@ private:
QCheckBox clickPlaysAllSelectedCheckBox;
QCheckBox playToStackCheckBox;
QCheckBox closeEmptyCardViewCheckBox;
QCheckBox focusCardViewSearchBarCheckBox;
QCheckBox annotateTokensCheckBox;
QCheckBox useTearOffMenusCheckBox;
QCheckBox tapAnimationCheckBox;
@ -155,6 +156,8 @@ private:
QComboBox visualDeckStoragePromptForConversionSelector;
QCheckBox visualDeckStorageInGameCheckBox;
QCheckBox visualDeckStorageSelectionAnimationCheckBox;
QLabel defaultDeckEditorTypeLabel;
QComboBox defaultDeckEditorTypeSelector;
QLabel rewindBufferingMsLabel;
QSpinBox rewindBufferingMsBox;
QGroupBox *generalGroupBox;

View file

@ -3,23 +3,40 @@
#include "../settings/cache_settings.h"
#include "../utility/logger.h"
#include <QClipboard>
#include <QPlainTextEdit>
#include <QPushButton>
#include <QRegularExpression>
#include <QVBoxLayout>
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
{
logArea = new QPlainTextEdit;
logArea->setReadOnly(true);
auto *mainLayout = new QVBoxLayout;
mainLayout->setSpacing(3);
mainLayout->setContentsMargins(20, 20, 20, 6);
mainLayout->addWidget(logArea);
auto *bottomLayout = new QHBoxLayout;
coClearLog = new QCheckBox;
coClearLog->setText(tr("Clear log when closing"));
coClearLog->setChecked(SettingsCache::instance().servers().getClearDebugLogStatus(false));
connect(coClearLog, &QCheckBox::toggled, this, &DlgViewLog::actCheckBoxChanged);
mainLayout->addWidget(coClearLog);
copyToClipboardButton = new QPushButton;
copyToClipboardButton->setText(tr("Copy to clipboard"));
copyToClipboardButton->setAutoDefault(false);
connect(copyToClipboardButton, &QPushButton::clicked, this, &DlgViewLog::actCopyToClipboard);
bottomLayout->addWidget(coClearLog);
bottomLayout->addStretch();
bottomLayout->addWidget(copyToClipboardButton);
mainLayout->addLayout(bottomLayout);
setLayout(mainLayout);
@ -27,7 +44,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
resize(800, 500);
loadInitialLogBuffer();
connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::logEntryAdded);
connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::appendLogEntry);
}
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
@ -35,16 +52,26 @@ void DlgViewLog::actCheckBoxChanged(bool abNewValue)
SettingsCache::instance().servers().setClearDebugLogStatus(abNewValue);
}
void DlgViewLog::actCopyToClipboard()
{
QApplication::clipboard()->setText(logArea->toPlainText());
}
void DlgViewLog::loadInitialLogBuffer()
{
QList<QString> logBuffer = Logger::getInstance().getLogBuffer();
for (const QString &message : logBuffer)
logEntryAdded(message);
appendLogEntry(message);
}
void DlgViewLog::logEntryAdded(QString message)
void DlgViewLog::appendLogEntry(const QString &message)
{
logArea->appendPlainText(message);
static auto colorEscapeCodePattern = QRegularExpression("\033\\[\\d+m");
QString sanitizedMessage = message;
sanitizedMessage.replace(colorEscapeCodePattern, "");
logArea->appendPlainText(sanitizedMessage);
}
void DlgViewLog::closeEvent(QCloseEvent * /* event */)

View file

@ -19,11 +19,13 @@ protected:
private:
QPlainTextEdit *logArea;
QCheckBox *coClearLog;
QPushButton *copyToClipboardButton;
void loadInitialLogBuffer();
private slots:
void logEntryAdded(QString message);
void appendLogEntry(const QString &message);
void actCheckBoxChanged(bool abNewValue);
void actCopyToClipboard();
};
#endif

View file

@ -39,6 +39,8 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item,
prepareGeometryChange();
update();
});
connect(item, &QObject::destroyed, this, &AbstractCardDragItem::deleteLater);
}
AbstractCardDragItem::~AbstractCardDragItem()

View file

@ -47,10 +47,25 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
cursorZone = zoneViewZone;
else if (cardZone)
cursorZone = cardZone;
if (!cursorZone)
return;
// Always update the current zone, even if its null, to cancel the drag
// instead of dropping cards into an non-intuitive location.
currentZone = cursorZone;
if (!cursorZone) {
// Avoid the cards getting stuck visually when not over
// any zone.
QPointF newPos = cursorScenePos - hotSpot;
if (newPos != pos()) {
for (int i = 0; i < childDrags.size(); i++)
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
setPos(newPos);
}
return;
}
QPointF zonePos = currentZone->scenePos();
QPointF cursorPosInZone = cursorScenePos - zonePos;

View file

@ -1864,6 +1864,7 @@ void Player::actCreateAnotherToken()
cmd.set_pt(lastTokenInfo.pt.toStdString());
cmd.set_annotation(lastTokenInfo.annotation.toStdString());
cmd.set_destroy_on_zone_change(lastTokenInfo.destroy);
cmd.set_face_down(lastTokenInfo.faceDown);
cmd.set_x(-1);
cmd.set_y(lastTokenTableRow);
@ -2075,6 +2076,8 @@ void Player::createCard(const CardItem *sourceCard,
break;
case CardRelation::TransformInto:
// allow cards to directly transform on stack
cmd.set_zone(sourceCard->getZone()->getName() == "stack" ? "stack" : "table");
// Transform card zone changes are handled server-side
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
cmd.set_target_card_id(sourceCard->getId());
@ -2240,10 +2243,10 @@ void Player::eventCreateToken(const Event_CreateToken &event)
CardItem *card = new CardItem(this, nullptr, QString::fromStdString(event.card_name()),
QString::fromStdString(event.card_provider_id()), event.card_id());
// use db PT if not provided in event
// use db PT if not provided in event and not face-down
if (!QString::fromStdString(event.pt()).isEmpty()) {
card->setPT(QString::fromStdString(event.pt()));
} else {
} else if (!event.face_down()) {
CardInfoPtr dbCard = card->getInfo();
if (dbCard) {
card->setPT(dbCard->getPowTough());
@ -2252,8 +2255,9 @@ void Player::eventCreateToken(const Event_CreateToken &event)
card->setColor(QString::fromStdString(event.color()));
card->setAnnotation(QString::fromStdString(event.annotation()));
card->setDestroyOnZoneChange(event.destroy_on_zone_change());
card->setFaceDown(event.face_down());
emit logCreateToken(this, card->getName(), card->getPT());
emit logCreateToken(this, card->getName(), card->getPT(), card->getFaceDown());
zone->addCard(card, true, event.x(), event.y());
}

View file

@ -128,7 +128,7 @@ signals:
Player *targetPlayer,
QString targetCard,
bool _playerTarget);
void logCreateToken(Player *player, QString cardName, QString pt);
void logCreateToken(Player *player, QString cardName, QString pt, bool faceDown);
void logDrawCards(Player *player, int number, bool deckIsEmpty);
void logUndoDraw(Player *player, QString cardName);
void logMoveCard(Player *player, CardItem *card, CardZone *startZone, int oldX, CardZone *targetZone, int newX);

View file

@ -56,6 +56,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
if (SettingsCache::instance().getFocusCardViewSearchBar()) {
this->setActive(true);
searchEdit.setFocus();
}
QGraphicsProxyWidget *searchEditProxy = new QGraphicsProxyWidget;
searchEditProxy->setWidget(&searchEdit);
searchEditProxy->setZValue(2000000007);

View file

@ -216,12 +216,16 @@ void MessageLogWidget::logCreateArrow(Player *player,
}
}
void MessageLogWidget::logCreateToken(Player *player, QString cardName, QString pt)
void MessageLogWidget::logCreateToken(Player *player, QString cardName, QString pt, bool faceDown)
{
appendHtmlServerMessage(tr("%1 creates token: %2%3.")
.arg(sanitizeHtml(player->getName()))
.arg(cardLink(std::move(cardName)))
.arg(pt.isEmpty() ? QString() : QString(" (%1)").arg(sanitizeHtml(pt))));
if (faceDown) {
appendHtmlServerMessage(tr("%1 creates a face down token.").arg(sanitizeHtml(player->getName())));
} else {
appendHtmlServerMessage(tr("%1 creates token: %2%3.")
.arg(sanitizeHtml(player->getName()))
.arg(cardLink(std::move(cardName)))
.arg(pt.isEmpty() ? QString() : QString(" (%1)").arg(sanitizeHtml(pt))));
}
}
void MessageLogWidget::logDeckSelect(Player *player, QString deckHash, int sideboardSize)

View file

@ -41,7 +41,7 @@ public slots:
Player *targetPlayer,
QString targetCard,
bool playerTarget);
void logCreateToken(Player *player, QString cardName, QString pt);
void logCreateToken(Player *player, QString cardName, QString pt, bool faceDown);
void logDeckSelect(Player *player, QString deckHash, int sideboardSize);
void logDestroyCard(Player *player, QString cardName);
void logDrawCards(Player *player, int number, bool deckIsEmpty);

View file

@ -251,6 +251,7 @@ SettingsCache::SettingsCache()
cardViewInitialRowsMax = settings->value("interface/cardViewInitialRowsMax", 14).toInt();
cardViewExpandedRowsMax = settings->value("interface/cardViewExpandedRowsMax", 20).toInt();
closeEmptyCardView = settings->value("interface/closeEmptyCardView", true).toBool();
focusCardViewSearchBar = settings->value("interface/focusCardViewSearchBar", true).toBool();
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
@ -285,6 +286,7 @@ SettingsCache::SettingsCache()
visualDeckStorageInGame = settings->value("interface/visualdeckstorageingame", true).toBool();
visualDeckStorageSelectionAnimation =
settings->value("interface/visualdeckstorageselectionanimation", true).toBool();
defaultDeckEditorType = settings->value("interface/defaultDeckEditorType", 1).toInt();
visualDatabaseDisplayFilterToMostRecentSetsEnabled =
settings->value("interface/visualdatabasedisplayfiltertomostrecentsetsenabled", true).toBool();
visualDatabaseDisplayFilterToMostRecentSetsAmount =
@ -369,6 +371,12 @@ void SettingsCache::setCloseEmptyCardView(QT_STATE_CHANGED_T value)
settings->setValue("interface/closeEmptyCardView", closeEmptyCardView);
}
void SettingsCache::setFocusCardViewSearchBar(QT_STATE_CHANGED_T value)
{
focusCardViewSearchBar = value;
settings->setValue("interface/focusCardViewSearchBar", focusCardViewSearchBar);
}
void SettingsCache::setKnownMissingFeatures(const QString &_knownMissingFeatures)
{
knownMissingFeatures = _knownMissingFeatures;
@ -791,6 +799,12 @@ void SettingsCache::setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T va
emit visualDeckStorageSelectionAnimationChanged(visualDeckStorageSelectionAnimation);
}
void SettingsCache::setDefaultDeckEditorType(int value)
{
defaultDeckEditorType = value;
settings->setValue("interface/defaultDeckEditorType", defaultDeckEditorType);
}
void SettingsCache::setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(QT_STATE_CHANGED_T _enabled)
{
visualDatabaseDisplayFilterToMostRecentSetsEnabled = _enabled;

View file

@ -153,6 +153,7 @@ private:
bool visualDeckStorageAlwaysConvert;
bool visualDeckStorageInGame;
bool visualDeckStorageSelectionAnimation;
int defaultDeckEditorType;
bool visualDatabaseDisplayFilterToMostRecentSetsEnabled;
int visualDatabaseDisplayFilterToMostRecentSetsAmount;
bool horizontalHand;
@ -183,6 +184,7 @@ private:
int cardViewInitialRowsMax;
int cardViewExpandedRowsMax;
bool closeEmptyCardView;
bool focusCardViewSearchBar;
int pixmapCacheSize;
int networkCacheSize;
int redirectCacheTtl;
@ -488,6 +490,10 @@ public:
{
return visualDeckStorageSelectionAnimation;
}
int getDefaultDeckEditorType() const
{
return defaultDeckEditorType;
}
bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
{
return visualDatabaseDisplayFilterToMostRecentSetsEnabled;
@ -694,6 +700,7 @@ public:
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
void setCardViewExpandedRowsMax(int value);
void setCloseEmptyCardView(QT_STATE_CHANGED_T value);
void setFocusCardViewSearchBar(QT_STATE_CHANGED_T value);
QString getClientID()
{
return clientID;
@ -722,6 +729,10 @@ public:
{
return closeEmptyCardView;
}
bool getFocusCardViewSearchBar() const
{
return focusCardViewSearchBar;
}
ShortcutsSettings &shortcuts() const
{
return *shortcutsSettings;
@ -839,6 +850,7 @@ public slots:
void setVisualDeckStorageAlwaysConvert(bool _visualDeckStorageAlwaysConvert);
void setVisualDeckStorageInGame(QT_STATE_CHANGED_T value);
void setVisualDeckStorageSelectionAnimation(QT_STATE_CHANGED_T value);
void setDefaultDeckEditorType(int value);
void setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(QT_STATE_CHANGED_T _enabled);
void setVisualDatabaseDisplayFilterToMostRecentSetsAmount(int _amount);
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);

View file

@ -81,12 +81,12 @@ void Logger::closeLogfileSession()
fileHandle.close();
}
void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString message)
void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString &message)
{
QMetaObject::invokeMethod(this, "internalLog", Qt::QueuedConnection, Q_ARG(const QString &, message));
}
void Logger::internalLog(QString message)
void Logger::internalLog(const QString &message)
{
QMutexLocker locker(&mutex);

View file

@ -28,7 +28,7 @@ public:
}
void logToFile(bool enabled);
void log(QtMsgType type, const QMessageLogContext &ctx, QString message);
void log(QtMsgType type, const QMessageLogContext &ctx, const QString &message);
QString getClientVersion();
QString getClientOperatingSystem();
QString getSystemArchitecture();
@ -57,10 +57,10 @@ protected:
void closeLogfileSession();
protected slots:
void internalLog(QString message);
void internalLog(const QString &message);
signals:
void logEntryAdded(QString message);
void logEntryAdded(const QString &message);
};
#endif

View file

@ -203,7 +203,7 @@ Controlla se la cartella è valida e prova ancora.</translation>
<message>
<location filename="src/dialogs/dlg_settings.cpp" line="550"/>
<source>Minimum overlap percentage of cards on the stack and in vertical hand</source>
<translation>Sovrapposizione % minima delle carte in pila e nella mano verticale</translation>
<translation>Sovrapposizione % minima delle carte in pila e nella mano verticale:</translation>
</message>
<message>
<location filename="src/dialogs/dlg_settings.cpp" line="551"/>
@ -2770,13 +2770,13 @@ Per favore, visitate la pagina di download per aggiornare manualmente.</translat
<location filename="src/dialogs/dlg_update.cpp" line="154"/>
<location filename="src/dialogs/dlg_update.cpp" line="165"/>
<source>Released</source>
<translation>Rilasciato</translation>
<translation>Data di rilascio</translation>
</message>
<message>
<location filename="src/dialogs/dlg_update.cpp" line="155"/>
<location filename="src/dialogs/dlg_update.cpp" line="166"/>
<source>Changelog</source>
<translation>Cambiamenti della versione</translation>
<translation>Changelog</translation>
</message>
<message>
<location filename="src/dialogs/dlg_update.cpp" line="156"/>
@ -2789,13 +2789,14 @@ Per favore, visitate la pagina di download per aggiornare manualmente.</translat
You may have to manually download the new version.</source>
<oldsource>Unfortunately there are no download packages available for your operating system.
You may have to build from source yourself.</oldsource>
<translation type="unfinished"/>
<translation>Purtroppo l&apos;aggiornamento automatico non è riuscito a trovare una versione compatibile.
Dovrai scaricare la nuova versione manualmente.</translation>
</message>
<message>
<location filename="src/dialogs/dlg_update.cpp" line="171"/>
<source>Please check the &lt;a href=&quot;%1&quot;&gt;releases page&lt;/a&gt; on our Github and download the build for your system.</source>
<oldsource>Please check the download page manually and visit the wiki for instructions on compiling.</oldsource>
<translation type="unfinished"/>
<translation>Per favore, controlla la &lt;a href=&quot;%1&quot;&gt;pagina delle release&lt;/a&gt; sul nostro Github e scarica la versione giusta per il tuo sistema.</translation>
</message>
<message>
<location filename="src/dialogs/dlg_update.cpp" line="208"/>
@ -3668,7 +3669,7 @@ La tua versione è la %1, la versione online è la %2.</translation>
<message>
<location filename="src/client/ui/window_main.cpp" line="660"/>
<source>Start &amp;local game...</source>
<translation>Inizia &amp;partita in locale...</translation>
<translation>Inizia partita in &amp;locale...</translation>
</message>
<message>
<location filename="src/client/ui/window_main.cpp" line="661"/>
@ -3688,7 +3689,7 @@ La tua versione è la %1, la versione online è la %2.</translation>
<message>
<location filename="src/client/ui/window_main.cpp" line="664"/>
<source>&amp;Restore password...</source>
<translation>&amp;Recupera password...</translation>
<translation>Recupera &amp;password...</translation>
</message>
<message>
<location filename="src/client/ui/window_main.cpp" line="665"/>
@ -3713,7 +3714,7 @@ La tua versione è la %1, la versione online è la %2.</translation>
<message>
<location filename="src/client/ui/window_main.cpp" line="675"/>
<source>C&amp;ard Database</source>
<translation>&amp;Database delle carte</translation>
<translation>&amp;Database carte</translation>
</message>
<message>
<location filename="src/client/ui/window_main.cpp" line="676"/>
@ -3916,7 +3917,7 @@ Scopri metodi alternativi per visualizzare i set o disabilitare set ed effetti n
<message>
<location filename="src/client/ui/window_main.cpp" line="1226"/>
<source>An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.</source>
<translation type="unfinished"/>
<translation>Si è verificato un errore nel cercare di scrivere al processo. Ad esempio, il processo potrebbe non essere in esecuzione, o potrebbe aver chiuso il suo canale di input.</translation>
</message>
<message>
<location filename="src/client/ui/window_main.cpp" line="1230"/>
@ -5850,7 +5851,7 @@ Il database delle carte verrà ricaricato.</translation>
<message>
<location filename="src/server/remote/remote_replay_list_tree_widget.cpp" line="157"/>
<source>Time started</source>
<translation>Inizio tempo</translation>
<translation>Inizio</translation>
</message>
<message>
<location filename="src/server/remote/remote_replay_list_tree_widget.cpp" line="159"/>
@ -7122,7 +7123,7 @@ Più informazioni inserisci, più specifici saranno i risultati.</translation>
<message>
<location filename="src/client/tabs/tab_supervisor.cpp" line="178"/>
<source>Deck Editor</source>
<translation>Editor dei mazzi</translation>
<translation>&amp;Editor dei mazzi</translation>
</message>
<message>
<location filename="src/client/tabs/tab_supervisor.cpp" line="179"/>
@ -7142,12 +7143,12 @@ Più informazioni inserisci, più specifici saranno i risultati.</translation>
<message>
<location filename="src/client/tabs/tab_supervisor.cpp" line="182"/>
<source>Deck Storage</source>
<translation>Archivio mazzi</translation>
<translation>&amp;Archivio mazzi</translation>
</message>
<message>
<location filename="src/client/tabs/tab_supervisor.cpp" line="183"/>
<source>Game Replays</source>
<translation>Replay partite</translation>
<translation>&amp;Replay partite</translation>
</message>
<message>
<location filename="src/client/tabs/tab_supervisor.cpp" line="184"/>
@ -8299,12 +8300,12 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u
<location filename="src/settings/shortcuts_settings.h" line="176"/>
<source>Analyze Deck (deckstats.net)</source>
<oldsource>Analyze Deck</oldsource>
<translation>Analizza Mazzo (deckstats.net)</translation>
<translation>Analizza mazzo (deckstats.net)</translation>
</message>
<message>
<location filename="src/settings/shortcuts_settings.h" line="180"/>
<source>Analyze Deck (tappedout.net)</source>
<translation>Analizza Mazzo (tappedout.net)</translation>
<translation>Analizza mazzo (tappedout.net)</translation>
</message>
<message>
<location filename="src/settings/shortcuts_settings.h" line="183"/>
@ -8496,7 +8497,7 @@ Se pregato di evitare di continuare questa attività o potrebbero venire presi u
<location filename="src/settings/shortcuts_settings.h" line="301"/>
<location filename="src/settings/shortcuts_settings.h" line="346"/>
<source>Set Red Counters...</source>
<translation>Imposta Contatore Rosso...</translation>
<translation>Imposta Segnalino Rosso...</translation>
</message>
<message>
<location filename="src/settings/shortcuts_settings.h" line="304"/>