mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
refactor and comments
This commit is contained in:
parent
6a4b41425e
commit
205f569566
2 changed files with 31 additions and 4 deletions
|
|
@ -13,7 +13,10 @@
|
|||
#include <QTextStream>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(parent), deckList(nullptr)
|
||||
/**
|
||||
* Creates the main layout and connects the signals that are common to all versions of this window
|
||||
*/
|
||||
void DlgLoadDeckFromClipboard::createMainLayout()
|
||||
{
|
||||
contentsEdit = new QPlainTextEdit;
|
||||
|
||||
|
|
@ -38,7 +41,6 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(pa
|
|||
|
||||
setLayout(mainLayout);
|
||||
|
||||
setWindowTitle(tr("Load deck from clipboard"));
|
||||
resize(500, 500);
|
||||
|
||||
actRefresh();
|
||||
|
|
@ -46,6 +48,18 @@ DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(pa
|
|||
refreshShortcuts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the dialog window for the "Load deck from clipboard" action
|
||||
*
|
||||
* @param parent The parent widget
|
||||
*/
|
||||
DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(QWidget *parent) : QDialog(parent), deckList(nullptr)
|
||||
{
|
||||
createMainLayout();
|
||||
|
||||
setWindowTitle(tr("Load deck from clipboard"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the contents of the DeckList into a String
|
||||
* @param deckList The deck to load
|
||||
|
|
@ -60,14 +74,18 @@ static QString deckListToString(const DeckLoader *deckList)
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a dialogue window that already has the contents of the deck loaded into the textEdit
|
||||
* Creates the dialog window for the "Edit deck in clipboard" action
|
||||
*
|
||||
* @param deck The deck to load
|
||||
* @param deck The existing deck in the deck editor
|
||||
* @param parent The parent widget
|
||||
*/
|
||||
DlgLoadDeckFromClipboard::DlgLoadDeckFromClipboard(const DeckLoader &deck, QWidget *parent)
|
||||
: DlgLoadDeckFromClipboard(parent)
|
||||
{
|
||||
createMainLayout();
|
||||
|
||||
setWindowTitle(tr("Edit deck in clipboard"));
|
||||
|
||||
deckList = new DeckLoader(deck);
|
||||
deckList->setParent(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ class DeckLoader;
|
|||
class QPlainTextEdit;
|
||||
class QPushButton;
|
||||
|
||||
/**
|
||||
* Dialog window for actions that involve loading decks from text input.
|
||||
*/
|
||||
class DlgLoadDeckFromClipboard : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -17,11 +20,17 @@ private slots:
|
|||
void refreshShortcuts();
|
||||
|
||||
private:
|
||||
/**
|
||||
* before actOK has been called, null deckList indicates "load deck from clipboard" action, and nonnull deckList
|
||||
* indicates "edit deck in clipboard" action
|
||||
*/
|
||||
DeckLoader *deckList;
|
||||
QPlainTextEdit *contentsEdit;
|
||||
QPushButton *refreshButton;
|
||||
QCheckBox *loadSetNameAndNumberCheckBox;
|
||||
|
||||
void createMainLayout();
|
||||
|
||||
public:
|
||||
explicit DlgLoadDeckFromClipboard(QWidget *parent = nullptr);
|
||||
explicit DlgLoadDeckFromClipboard(const DeckLoader &deck, QWidget *parent = nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue