mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
add option for not annotated
This commit is contained in:
parent
d24da0ba62
commit
767292d063
7 changed files with 51 additions and 18 deletions
|
|
@ -33,6 +33,9 @@ DeckEditorMenu::DeckEditorMenu(QWidget *parent, AbstractTabDeckEditor *_deckEdit
|
|||
aEditDeckInClipboard = new QAction(QString(), this);
|
||||
connect(aEditDeckInClipboard, SIGNAL(triggered()), deckEditor, SLOT(actEditDeckInClipboard()));
|
||||
|
||||
aEditDeckInClipboardRaw = new QAction(QString(), this);
|
||||
connect(aEditDeckInClipboardRaw, SIGNAL(triggered()), deckEditor, SLOT(actEditDeckInClipboardRaw()));
|
||||
|
||||
aSaveDeckToClipboard = new QAction(QString(), this);
|
||||
connect(aSaveDeckToClipboard, SIGNAL(triggered()), deckEditor, SLOT(actSaveDeckToClipboard()));
|
||||
|
||||
|
|
@ -67,6 +70,10 @@ DeckEditorMenu::DeckEditorMenu(QWidget *parent, AbstractTabDeckEditor *_deckEdit
|
|||
aClose = new QAction(QString(), this);
|
||||
connect(aClose, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::closeRequest);
|
||||
|
||||
editDeckInClipboardMenu = new QMenu(this);
|
||||
editDeckInClipboardMenu->addAction(aEditDeckInClipboard);
|
||||
editDeckInClipboardMenu->addAction(aEditDeckInClipboardRaw);
|
||||
|
||||
saveDeckToClipboardMenu = new QMenu(this);
|
||||
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboard);
|
||||
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardNoSetNameAndNumber);
|
||||
|
|
@ -80,7 +87,7 @@ DeckEditorMenu::DeckEditorMenu(QWidget *parent, AbstractTabDeckEditor *_deckEdit
|
|||
addAction(aSaveDeckAs);
|
||||
addSeparator();
|
||||
addAction(aLoadDeckFromClipboard);
|
||||
addAction(aEditDeckInClipboard);
|
||||
addMenu(editDeckInClipboardMenu);
|
||||
addMenu(saveDeckToClipboardMenu);
|
||||
addSeparator();
|
||||
addAction(aPrintDeck);
|
||||
|
|
@ -139,7 +146,10 @@ void DeckEditorMenu::retranslateUi()
|
|||
aSaveDeckAs->setText(tr("Save deck &as..."));
|
||||
|
||||
aLoadDeckFromClipboard->setText(tr("Load deck from cl&ipboard..."));
|
||||
aEditDeckInClipboard->setText(tr("Edit deck in clipboard"));
|
||||
|
||||
editDeckInClipboardMenu->setTitle(tr("Edit deck in clipboard"));
|
||||
aEditDeckInClipboard->setText(tr("Annotated"));
|
||||
aEditDeckInClipboardRaw->setText(tr("Not Annotated"));
|
||||
|
||||
saveDeckToClipboardMenu->setTitle(tr("Save deck to clipboard"));
|
||||
aSaveDeckToClipboard->setText(tr("Annotated"));
|
||||
|
|
@ -167,6 +177,7 @@ void DeckEditorMenu::refreshShortcuts()
|
|||
aSaveDeckAs->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aSaveDeckAs"));
|
||||
aLoadDeckFromClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aLoadDeckFromClipboard"));
|
||||
aEditDeckInClipboard->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aEditDeckInClipboard"));
|
||||
aEditDeckInClipboardRaw->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aEditDeckInClipboardRaw"));
|
||||
aPrintDeck->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aPrintDeck"));
|
||||
aAnalyzeDeckDeckstats->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aAnalyzeDeck"));
|
||||
aClose->setShortcuts(shortcuts.getShortcut("TabDeckEditor/aClose"));
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ public:
|
|||
|
||||
AbstractTabDeckEditor *deckEditor;
|
||||
|
||||
QAction *aNewDeck, *aLoadDeck, *aClearRecents, *aSaveDeck, *aSaveDeckAs, *aEditDeckInClipboard,
|
||||
*aLoadDeckFromClipboard, *aSaveDeckToClipboard, *aSaveDeckToClipboardNoSetNameAndNumber,
|
||||
QAction *aNewDeck, *aLoadDeck, *aClearRecents, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard,
|
||||
*aEditDeckInClipboard, *aEditDeckInClipboardRaw, *aSaveDeckToClipboard, *aSaveDeckToClipboardNoSetNameAndNumber,
|
||||
*aSaveDeckToClipboardRaw, *aSaveDeckToClipboardRawNoSetNameAndNumber, *aPrintDeck, *aExportDeckDecklist,
|
||||
*aAnalyzeDeckDeckstats, *aAnalyzeDeckTappedout, *aClose;
|
||||
QMenu *loadRecentDeckMenu, *analyzeDeckMenu, *saveDeckToClipboardMenu;
|
||||
QMenu *loadRecentDeckMenu, *analyzeDeckMenu, *editDeckInClipboardMenu, *saveDeckToClipboardMenu;
|
||||
|
||||
void setSaveStatus(bool newStatus);
|
||||
|
||||
|
|
|
|||
|
|
@ -394,9 +394,9 @@ void AbstractTabDeckEditor::actLoadDeckFromClipboard()
|
|||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
void AbstractTabDeckEditor::actEditDeckInClipboard()
|
||||
void AbstractTabDeckEditor::editDeckInClipboard(bool annotated)
|
||||
{
|
||||
DlgEditDeckInClipboard dlg(*getDeckList(), this);
|
||||
DlgEditDeckInClipboard dlg(*getDeckList(), annotated, this);
|
||||
if (!dlg.exec())
|
||||
return;
|
||||
|
||||
|
|
@ -406,6 +406,16 @@ void AbstractTabDeckEditor::actEditDeckInClipboard()
|
|||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
void AbstractTabDeckEditor::actEditDeckInClipboard()
|
||||
{
|
||||
editDeckInClipboard(true);
|
||||
}
|
||||
|
||||
void AbstractTabDeckEditor::actEditDeckInClipboardRaw()
|
||||
{
|
||||
editDeckInClipboard(false);
|
||||
}
|
||||
|
||||
void AbstractTabDeckEditor::actSaveDeckToClipboard()
|
||||
{
|
||||
getDeckList()->saveToClipboard(true, true);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ protected slots:
|
|||
bool actSaveDeckAs();
|
||||
virtual void actLoadDeckFromClipboard();
|
||||
void actEditDeckInClipboard();
|
||||
void actEditDeckInClipboardRaw();
|
||||
void actSaveDeckToClipboard();
|
||||
void actSaveDeckToClipboardNoSetNameAndNumber();
|
||||
void actSaveDeckToClipboardRaw();
|
||||
|
|
@ -115,6 +116,9 @@ protected slots:
|
|||
virtual void dockVisibleTriggered() = 0;
|
||||
virtual void dockFloatingTriggered() = 0;
|
||||
|
||||
private:
|
||||
void editDeckInClipboard(bool annotated);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Enum for selecting deck open location
|
||||
|
|
|
|||
|
|
@ -134,11 +134,12 @@ void DlgLoadDeckFromClipboard::actOK()
|
|||
/**
|
||||
* Creates the dialog window for the "Edit deck in clipboard" action
|
||||
*
|
||||
* @param deckList The existing deck in the deck editor.
|
||||
* @param deckList The existing deck in the deck editor. Copies the instance
|
||||
* @param _annotated Whether to add annotations to the text that is loaded from the deck
|
||||
* @param parent The parent widget
|
||||
*/
|
||||
DlgEditDeckInClipboard::DlgEditDeckInClipboard(const DeckLoader &deckList, QWidget *parent)
|
||||
: AbstractDlgDeckTextEdit(parent)
|
||||
DlgEditDeckInClipboard::DlgEditDeckInClipboard(const DeckLoader &deckList, bool _annotated, QWidget *parent)
|
||||
: AbstractDlgDeckTextEdit(parent), annotated(_annotated)
|
||||
{
|
||||
setWindowTitle(tr("Edit deck in clipboard"));
|
||||
|
||||
|
|
@ -149,21 +150,22 @@ DlgEditDeckInClipboard::DlgEditDeckInClipboard(const DeckLoader &deckList, QWidg
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the contents of the DeckList into a String
|
||||
* Loads the contents of the DeckList into a String. Always loads it with addSetNameAndNumber=true
|
||||
* @param deckList The deck to load
|
||||
* @param addComments Whether to add annotations
|
||||
* @return A QString
|
||||
*/
|
||||
static QString deckListToString(const DeckLoader *deckList)
|
||||
static QString deckListToString(const DeckLoader *deckList, bool addComments)
|
||||
{
|
||||
QString buffer;
|
||||
QTextStream stream(&buffer);
|
||||
deckList->saveToStream_Plain(stream);
|
||||
deckList->saveToStream_Plain(stream, addComments);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void DlgEditDeckInClipboard::actRefresh()
|
||||
{
|
||||
setText(deckListToString(deckLoader));
|
||||
setText(deckListToString(deckLoader, annotated));
|
||||
}
|
||||
|
||||
void DlgEditDeckInClipboard::actOK()
|
||||
|
|
|
|||
|
|
@ -78,9 +78,10 @@ protected slots:
|
|||
|
||||
private:
|
||||
DeckLoader *deckLoader;
|
||||
bool annotated;
|
||||
|
||||
public:
|
||||
explicit DlgEditDeckInClipboard(const DeckLoader &deckList, QWidget *parent = nullptr);
|
||||
explicit DlgEditDeckInClipboard(const DeckLoader &deckList, bool _annotated, QWidget *parent = nullptr);
|
||||
|
||||
DeckLoader *getDeckList() const override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -206,9 +206,14 @@ private:
|
|||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
|
||||
parseSequenceString("Ctrl+Shift+V"),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aEditDeckInClipboard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Deck in Clipboard"),
|
||||
parseSequenceString(""),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aEditDeckInClipboard",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Deck in Clipboard, Annotated"),
|
||||
parseSequenceString(""),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aEditDeckInClipboardRaw",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Deck in Clipboard"),
|
||||
parseSequenceString(""),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
{"TabDeckEditor/aNewDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "New Deck"),
|
||||
parseSequenceString("Ctrl+N"),
|
||||
ShortcutGroup::Deck_Editor)},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue