Move action from button to menu.

This commit is contained in:
Lukas Brübach 2025-06-11 03:26:40 +02:00
parent 366b90f267
commit 9f19ba83bd
6 changed files with 15 additions and 12 deletions

View file

@ -51,6 +51,9 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
connect(aSaveDeckToClipboardRawNoSetInfo, &QAction::triggered, deckEditor, connect(aSaveDeckToClipboardRawNoSetInfo, &QAction::triggered, deckEditor,
&AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo); &AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo);
aFetchCardPrices = new QAction(QString(), this);
connect(aFetchCardPrices, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actFetchCardPrices);
aPrintDeck = new QAction(QString(), this); aPrintDeck = new QAction(QString(), this);
connect(aPrintDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actPrintDeck); connect(aPrintDeck, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::actPrintDeck);
@ -96,6 +99,7 @@ DeckEditorMenu::DeckEditorMenu(AbstractTabDeckEditor *parent) : QMenu(parent), d
addMenu(editDeckInClipboardMenu); addMenu(editDeckInClipboardMenu);
addMenu(saveDeckToClipboardMenu); addMenu(saveDeckToClipboardMenu);
addSeparator(); addSeparator();
addAction(aFetchCardPrices);
addAction(aPrintDeck); addAction(aPrintDeck);
addMenu(analyzeDeckMenu); addMenu(analyzeDeckMenu);
addSeparator(); addSeparator();
@ -119,6 +123,7 @@ void DeckEditorMenu::setSaveStatus(bool newStatus)
aSaveDeckToClipboardRaw->setEnabled(newStatus); aSaveDeckToClipboardRaw->setEnabled(newStatus);
aSaveDeckToClipboardRawNoSetInfo->setEnabled(newStatus); aSaveDeckToClipboardRawNoSetInfo->setEnabled(newStatus);
saveDeckToClipboardMenu->setEnabled(newStatus); saveDeckToClipboardMenu->setEnabled(newStatus);
aFetchCardPrices->setEnabled(newStatus);
aPrintDeck->setEnabled(newStatus); aPrintDeck->setEnabled(newStatus);
analyzeDeckMenu->setEnabled(newStatus); analyzeDeckMenu->setEnabled(newStatus);
} }
@ -164,6 +169,7 @@ void DeckEditorMenu::retranslateUi()
aSaveDeckToClipboardRaw->setText(tr("Not Annotated")); aSaveDeckToClipboardRaw->setText(tr("Not Annotated"));
aSaveDeckToClipboardRawNoSetInfo->setText(tr("Not Annotated (No set info)")); aSaveDeckToClipboardRawNoSetInfo->setText(tr("Not Annotated (No set info)"));
aFetchCardPrices->setText(tr("Fetch card prices..."));
aPrintDeck->setText(tr("&Print deck...")); aPrintDeck->setText(tr("&Print deck..."));
analyzeDeckMenu->setTitle(tr("&Send deck to online service")); analyzeDeckMenu->setTitle(tr("&Send deck to online service"));

View file

@ -16,7 +16,7 @@ public:
QAction *aNewDeck, *aLoadDeck, *aClearRecents, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard, QAction *aNewDeck, *aLoadDeck, *aClearRecents, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard,
*aEditDeckInClipboard, *aEditDeckInClipboardRaw, *aSaveDeckToClipboard, *aSaveDeckToClipboardNoSetInfo, *aEditDeckInClipboard, *aEditDeckInClipboardRaw, *aSaveDeckToClipboard, *aSaveDeckToClipboardNoSetInfo,
*aSaveDeckToClipboardRaw, *aSaveDeckToClipboardRawNoSetInfo, *aPrintDeck, *aExportDeckDecklist, *aSaveDeckToClipboardRaw, *aSaveDeckToClipboardRawNoSetInfo, *aFetchCardPrices, *aPrintDeck, *aExportDeckDecklist,
*aExportDeckDecklistXyz, *aAnalyzeDeckDeckstats, *aAnalyzeDeckTappedout, *aClose; *aExportDeckDecklistXyz, *aAnalyzeDeckDeckstats, *aAnalyzeDeckTappedout, *aClose;
QMenu *loadRecentDeckMenu, *analyzeDeckMenu, *editDeckInClipboardMenu, *saveDeckToClipboardMenu; QMenu *loadRecentDeckMenu, *analyzeDeckMenu, *editDeckInClipboardMenu, *saveDeckToClipboardMenu;

View file

@ -4,6 +4,7 @@
#include "../../client/tapped_out_interface.h" #include "../../client/tapped_out_interface.h"
#include "../../client/ui/widgets/cards/card_info_frame_widget.h" #include "../../client/ui/widgets/cards/card_info_frame_widget.h"
#include "../../deck/deck_stats_interface.h" #include "../../deck/deck_stats_interface.h"
#include "../../dialogs/dlg_get_card_prices.h"
#include "../../dialogs/dlg_load_deck.h" #include "../../dialogs/dlg_load_deck.h"
#include "../../dialogs/dlg_load_deck_from_clipboard.h" #include "../../dialogs/dlg_load_deck_from_clipboard.h"
#include "../../game/cards/card_database_manager.h" #include "../../game/cards/card_database_manager.h"
@ -413,6 +414,12 @@ void AbstractTabDeckEditor::actLoadDeckFromClipboard()
deckMenu->setSaveStatus(true); deckMenu->setSaveStatus(true);
} }
void AbstractTabDeckEditor::actFetchCardPrices()
{
auto pricesDialog = new DlgGetCardPrices(this, deckDockWidget->deckModel);
pricesDialog->exec();
}
void AbstractTabDeckEditor::editDeckInClipboard(bool annotated) void AbstractTabDeckEditor::editDeckInClipboard(bool annotated)
{ {
DlgEditDeckInClipboard dlg(*getDeckList(), annotated, this); DlgEditDeckInClipboard dlg(*getDeckList(), annotated, this);

View file

@ -94,6 +94,7 @@ protected slots:
bool actSaveDeck(); bool actSaveDeck();
virtual bool actSaveDeckAs(); virtual bool actSaveDeckAs();
virtual void actLoadDeckFromClipboard(); virtual void actLoadDeckFromClipboard();
void actFetchCardPrices();
void actEditDeckInClipboard(); void actEditDeckInClipboard();
void actEditDeckInClipboardRaw(); void actEditDeckInClipboardRaw();
void actSaveDeckToClipboard(); void actSaveDeckToClipboard();

View file

@ -1,6 +1,5 @@
#include "deck_editor_deck_dock_widget.h" #include "deck_editor_deck_dock_widget.h"
#include "../../../../dialogs/dlg_get_card_prices.h"
#include "../../../../game/cards/card_database_manager.h" #include "../../../../game/cards/card_database_manager.h"
#include "../../../../settings/cache_settings.h" #include "../../../../settings/cache_settings.h"
@ -145,14 +144,6 @@ void DeckEditorDeckDockWidget::createDeckDock()
upperLayout->addWidget(deckTagsDisplayWidget, 3, 1); upperLayout->addWidget(deckTagsDisplayWidget, 3, 1);
cardPricesButton = new QPushButton(this);
connect(cardPricesButton, &QPushButton::clicked, this, [this]() {
auto pricesDialog = new DlgGetCardPrices(this, deckModel);
pricesDialog->exec();
});
upperLayout->addWidget(cardPricesButton, 4, 1);
hashLabel1 = new QLabel(); hashLabel1 = new QLabel();
hashLabel1->setObjectName("hashLabel1"); hashLabel1->setObjectName("hashLabel1");
auto *hashSizePolicy = new QSizePolicy(); auto *hashSizePolicy = new QSizePolicy();
@ -575,7 +566,6 @@ void DeckEditorDeckDockWidget::retranslateUi()
showBannerCardCheckBox->setText(tr("Show banner card selection menu")); showBannerCardCheckBox->setText(tr("Show banner card selection menu"));
showTagsWidgetCheckBox->setText(tr("Show tags selection menu")); showTagsWidgetCheckBox->setText(tr("Show tags selection menu"));
commentsLabel->setText(tr("&Comments:")); commentsLabel->setText(tr("&Comments:"));
cardPricesButton->setText(tr("Fetch Card Prices"));
hashLabel1->setText(tr("Hash:")); hashLabel1->setText(tr("Hash:"));
aIncrement->setText(tr("&Increment number")); aIncrement->setText(tr("&Increment number"));

View file

@ -64,7 +64,6 @@ private:
QTextEdit *commentsEdit; QTextEdit *commentsEdit;
QLabel *bannerCardLabel; QLabel *bannerCardLabel;
DeckPreviewDeckTagsDisplayWidget *deckTagsDisplayWidget; DeckPreviewDeckTagsDisplayWidget *deckTagsDisplayWidget;
QPushButton *cardPricesButton;
QLabel *hashLabel1; QLabel *hashLabel1;
LineEditUnfocusable *hashLabel; LineEditUnfocusable *hashLabel;