mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
Printing Selector Bulk Editor (#5993)
* Bulk editing dialog. * Bulk editing dialog functionality. * Performance fixes, hide sets which can't offer any new cards, better dragging indicators. * Update count label. * Add a display for modified cards. * Include long setName in checkbox label * Fix drag & drop. * New layout updating? * Re-layout, add instruction label. * Qt version check. * Add buttons to clear and set all to preferred printing. * tr UI * Add the button to the print selector instead. * Qt5 compatibility stuff. * Qt5 compatibility stuff again. * Toggled works, I guess. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
f4569c513f
commit
53e27ff4d3
12 changed files with 848 additions and 9 deletions
104
cockatrice/src/dialogs/dlg_select_set_for_cards.h
Normal file
104
cockatrice/src/dialogs/dlg_select_set_for_cards.h
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
#ifndef DLG_SELECT_SET_FOR_CARDS_H
|
||||
#define DLG_SELECT_SET_FOR_CARDS_H
|
||||
|
||||
#include "../client/ui/widgets/general/layout_containers/flow_widget.h"
|
||||
#include "../deck/deck_list_model.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QListWidget>
|
||||
#include <QMap>
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class SetEntryWidget; // Forward declaration
|
||||
|
||||
class DlgSelectSetForCards : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgSelectSetForCards(QWidget *parent, DeckListModel *_model);
|
||||
void retranslateUi();
|
||||
void sortSetsByCount();
|
||||
QMap<QString, QStringList> getCardsForSets();
|
||||
QMap<QString, QStringList> getModifiedCards();
|
||||
QVBoxLayout *listLayout;
|
||||
QList<SetEntryWidget *> entry_widgets;
|
||||
QMap<QString, QStringList> cardsForSets;
|
||||
|
||||
signals:
|
||||
void widgetOrderChanged();
|
||||
void orderChanged();
|
||||
|
||||
public slots:
|
||||
void actOK();
|
||||
void actClear();
|
||||
void actSetAllToPreferred();
|
||||
void updateLayoutOrder();
|
||||
void updateCardLists();
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QLabel *instructionLabel;
|
||||
QScrollArea *scrollArea;
|
||||
QScrollArea *uneditedCardsArea;
|
||||
FlowWidget *uneditedCardsFlowWidget;
|
||||
QLabel *uneditedCardsLabel;
|
||||
QScrollArea *modifiedCardsArea;
|
||||
FlowWidget *modifiedCardsFlowWidget;
|
||||
QLabel *modifiedCardsLabel;
|
||||
QWidget *listContainer;
|
||||
QListWidget *listWidget;
|
||||
DeckListModel *model;
|
||||
QMap<QString, SetEntryWidget *> setEntries;
|
||||
QPushButton *clearButton;
|
||||
QPushButton *setAllToPreferredButton;
|
||||
|
||||
QMap<QString, int> getSetsForCards();
|
||||
};
|
||||
|
||||
class SetEntryWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SetEntryWidget(DlgSelectSetForCards *parent, const QString &setName, int count);
|
||||
void toggleExpansion();
|
||||
void checkVisibility();
|
||||
QStringList getAllCardsForSet();
|
||||
void populateCardList();
|
||||
void updateCardDisplayWidgets();
|
||||
bool isChecked() const;
|
||||
DlgSelectSetForCards *parent;
|
||||
QString setName;
|
||||
bool expanded;
|
||||
|
||||
public slots:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QCheckBox *checkBox;
|
||||
QPushButton *expandButton;
|
||||
QLabel *countLabel;
|
||||
QLabel *possibleCardsLabel;
|
||||
FlowWidget *cardListContainer;
|
||||
QLabel *alreadySelectedCardsLabel;
|
||||
FlowWidget *alreadySelectedCardListContainer;
|
||||
QVBoxLayout *cardListLayout;
|
||||
QStringList possibleCards;
|
||||
QStringList unusedCards;
|
||||
};
|
||||
|
||||
#endif // DLG_SELECT_SET_FOR_CARDS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue