mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 01:42:15 -07:00
Move the "Next/Previous" card buttons to their own widget.
This commit is contained in:
parent
059c23f8f4
commit
9d0d62a72d
4 changed files with 52 additions and 16 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../../../../settings/cache_settings.h"
|
#include "../../../../settings/cache_settings.h"
|
||||||
#include "../../../../utility/card_set_comparator.h"
|
#include "../../../../utility/card_set_comparator.h"
|
||||||
#include "printing_selector_card_display_widget.h"
|
#include "printing_selector_card_display_widget.h"
|
||||||
|
#include "printing_selector_card_selection_widget.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -77,18 +78,7 @@ PrintingSelector::PrintingSelector(QWidget *parent,
|
||||||
|
|
||||||
layout->addWidget(cardSizeWidget);
|
layout->addWidget(cardSizeWidget);
|
||||||
|
|
||||||
cardSelectionBar = new QWidget(this);
|
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this);
|
||||||
cardSelectionBarLayout = new QHBoxLayout(cardSelectionBar);
|
|
||||||
previousCardButton = new QPushButton(cardSelectionBar);
|
|
||||||
previousCardButton->setText(tr("Previous Card"));
|
|
||||||
connect(previousCardButton, &QPushButton::clicked, this, &PrintingSelector::selectPreviousCard);
|
|
||||||
nextCardButton = new QPushButton(cardSelectionBar);
|
|
||||||
nextCardButton->setText(tr("Next Card"));
|
|
||||||
connect(nextCardButton, &QPushButton::clicked, this, &PrintingSelector::selectNextCard);
|
|
||||||
|
|
||||||
cardSelectionBarLayout->addWidget(previousCardButton);
|
|
||||||
cardSelectionBarLayout->addWidget(nextCardButton);
|
|
||||||
|
|
||||||
layout->addWidget(cardSelectionBar);
|
layout->addWidget(cardSelectionBar);
|
||||||
|
|
||||||
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#define BATCH_SIZE 10
|
#define BATCH_SIZE 10
|
||||||
|
|
||||||
|
class PrintingSelectorCardSelectionWidget;
|
||||||
class TabDeckEditor;
|
class TabDeckEditor;
|
||||||
class PrintingSelector : public QWidget
|
class PrintingSelector : public QWidget
|
||||||
{
|
{
|
||||||
|
|
@ -54,10 +55,7 @@ private:
|
||||||
QHBoxLayout *cardSizeLayout;
|
QHBoxLayout *cardSizeLayout;
|
||||||
QLabel *cardSizeLabel;
|
QLabel *cardSizeLabel;
|
||||||
QSlider *cardSizeSlider;
|
QSlider *cardSizeSlider;
|
||||||
QWidget *cardSelectionBar;
|
PrintingSelectorCardSelectionWidget *cardSelectionBar;
|
||||||
QHBoxLayout *cardSelectionBarLayout;
|
|
||||||
QPushButton *previousCardButton;
|
|
||||||
QPushButton *nextCardButton;
|
|
||||||
TabDeckEditor *deckEditor;
|
TabDeckEditor *deckEditor;
|
||||||
DeckListModel *deckModel;
|
DeckListModel *deckModel;
|
||||||
QTreeView *deckView;
|
QTreeView *deckView;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include "printing_selector_card_selection_widget.h"
|
||||||
|
|
||||||
|
PrintingSelectorCardSelectionWidget::PrintingSelectorCardSelectionWidget(PrintingSelector *parent) : parent(parent)
|
||||||
|
{
|
||||||
|
cardSelectionBarLayout = new QHBoxLayout(this);
|
||||||
|
previousCardButton = new QPushButton(this);
|
||||||
|
previousCardButton->setText(tr("Previous Card"));
|
||||||
|
|
||||||
|
nextCardButton = new QPushButton(this);
|
||||||
|
nextCardButton->setText(tr("Next Card"));
|
||||||
|
|
||||||
|
connectSignals();
|
||||||
|
|
||||||
|
cardSelectionBarLayout->addWidget(previousCardButton);
|
||||||
|
cardSelectionBarLayout->addWidget(nextCardButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintingSelectorCardSelectionWidget::connectSignals()
|
||||||
|
{
|
||||||
|
connect(previousCardButton, &QPushButton::clicked, parent, &PrintingSelector::selectPreviousCard);
|
||||||
|
connect(nextCardButton, &QPushButton::clicked, parent, &PrintingSelector::selectNextCard);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef PRINTING_SELECTOR_CARD_SELECTION_WIDGET_H
|
||||||
|
#define PRINTING_SELECTOR_CARD_SELECTION_WIDGET_H
|
||||||
|
|
||||||
|
#include "printing_selector.h"
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class PrintingSelectorCardSelectionWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PrintingSelectorCardSelectionWidget(PrintingSelector *parent);
|
||||||
|
|
||||||
|
void connectSignals();
|
||||||
|
|
||||||
|
private:
|
||||||
|
PrintingSelector *parent;
|
||||||
|
QHBoxLayout *cardSelectionBarLayout;
|
||||||
|
QPushButton *previousCardButton;
|
||||||
|
QPushButton *nextCardButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PRINTING_SELECTOR_CARD_SELECTION_WIDGET_H
|
||||||
Loading…
Add table
Add a link
Reference in a new issue