mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 17:02:15 -07:00
Pivot to a view options toolbar.
This commit is contained in:
parent
d05185327a
commit
af75cfcd89
7 changed files with 195 additions and 0 deletions
|
|
@ -103,6 +103,8 @@ set(cockatrice_SOURCES
|
|||
src/client/ui/widgets/printing_selector/printing_selector_card_search_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_view_options_toolbar_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_view_options_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
|
||||
src/client/network/release_channel.cpp
|
||||
src/server/remote/remote_client.cpp
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "printing_selector_card_search_widget.h"
|
||||
#include "printing_selector_card_selection_widget.h"
|
||||
#include "printing_selector_card_sorting_widget.h"
|
||||
#include "printing_selector_view_options_toolbar_widget.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
|
|
@ -19,6 +20,9 @@ PrintingSelector::PrintingSelector(QWidget *parent,
|
|||
setLayout(layout);
|
||||
widgetLoadingBufferTimer = new QTimer(this);
|
||||
|
||||
viewOptionsToolbar = new PrintingSelectorViewOptionsToolbarWidget(this, this);
|
||||
layout->addWidget(viewOptionsToolbar);
|
||||
|
||||
sortToolBar = new PrintingSelectorCardSortingWidget(this);
|
||||
layout->addWidget(sortToolBar);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
class PrintingSelectorCardSearchWidget;
|
||||
class PrintingSelectorCardSelectionWidget;
|
||||
class PrintingSelectorCardSortingWidget;
|
||||
class PrintingSelectorViewOptionsToolbarWidget;
|
||||
class TabDeckEditor;
|
||||
class PrintingSelector : public QWidget
|
||||
{
|
||||
|
|
@ -35,6 +36,7 @@ public slots:
|
|||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
PrintingSelectorViewOptionsToolbarWidget *viewOptionsToolbar;
|
||||
PrintingSelectorCardSortingWidget *sortToolBar;
|
||||
PrintingSelectorCardSearchWidget *searchBar;
|
||||
FlowWidget *flowWidget;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
#include "printing_selector_view_options_toolbar_widget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
PrintingSelectorViewOptionsToolbarWidget::PrintingSelectorViewOptionsToolbarWidget(
|
||||
QWidget *_parent,
|
||||
PrintingSelector *_printingSelector)
|
||||
: QWidget(_parent), printingSelector(_printingSelector)
|
||||
{
|
||||
layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
|
||||
expandedWidget = new QWidget(this);
|
||||
QVBoxLayout *expandedLayout = new QVBoxLayout(expandedWidget);
|
||||
expandedLayout->setContentsMargins(0, 0, 0, 0);
|
||||
expandedLayout->setSpacing(0);
|
||||
|
||||
collapseButton = new QPushButton("▼", this);
|
||||
collapseButton->setFixedSize(20, 20);
|
||||
collapseButton->setToolTip("Collapse");
|
||||
collapseButton->setStyleSheet("border: none;");
|
||||
connect(collapseButton, &QPushButton::clicked, this, &PrintingSelectorViewOptionsToolbarWidget::collapse);
|
||||
expandedLayout->addWidget(collapseButton, 0, Qt::AlignLeft);
|
||||
|
||||
viewOptions = new PrintingSelectorViewOptionsWidget(expandedWidget);
|
||||
expandedLayout->addWidget(viewOptions);
|
||||
|
||||
expandedWidget->setLayout(expandedLayout);
|
||||
|
||||
collapsedWidget = new QWidget(this);
|
||||
QHBoxLayout *collapsedLayout = new QHBoxLayout(collapsedWidget);
|
||||
collapsedLayout->setContentsMargins(5, 0, 5, 0);
|
||||
collapsedLayout->setSpacing(0);
|
||||
|
||||
expandButton = new QPushButton("▲", this);
|
||||
expandButton->setFixedSize(20, 20);
|
||||
expandButton->setToolTip("Expand");
|
||||
expandButton->setStyleSheet("border: none;");
|
||||
connect(expandButton, &QPushButton::clicked, this, &PrintingSelectorViewOptionsToolbarWidget::expand);
|
||||
collapsedLayout->addWidget(expandButton);
|
||||
|
||||
QLabel *collapsedLabel = new QLabel(tr("Display Options"), this);
|
||||
collapsedLayout->addWidget(collapsedLabel);
|
||||
|
||||
collapsedWidget->setLayout(collapsedLayout);
|
||||
|
||||
stackedWidget = new QStackedWidget(this);
|
||||
stackedWidget->addWidget(expandedWidget);
|
||||
stackedWidget->addWidget(collapsedWidget);
|
||||
|
||||
layout->addWidget(stackedWidget);
|
||||
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
|
||||
stackedWidget->setCurrentWidget(expandedWidget);
|
||||
|
||||
connect(stackedWidget, &QStackedWidget::currentChanged, this,
|
||||
&PrintingSelectorViewOptionsToolbarWidget::onWidgetChanged);
|
||||
}
|
||||
|
||||
void PrintingSelectorViewOptionsToolbarWidget::collapse()
|
||||
{
|
||||
stackedWidget->setCurrentWidget(collapsedWidget);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void PrintingSelectorViewOptionsToolbarWidget::expand()
|
||||
{
|
||||
stackedWidget->setCurrentWidget(expandedWidget);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
// Handle Geometry Update
|
||||
void PrintingSelectorViewOptionsToolbarWidget::onWidgetChanged(int)
|
||||
{
|
||||
updateGeometry();
|
||||
if (parentWidget() && parentWidget()->layout()) {
|
||||
parentWidget()->layout()->invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
// Size Hints
|
||||
QSize PrintingSelectorViewOptionsToolbarWidget::sizeHint() const
|
||||
{
|
||||
return stackedWidget->currentWidget()->sizeHint();
|
||||
}
|
||||
|
||||
QSize PrintingSelectorViewOptionsToolbarWidget::minimumSizeHint() const
|
||||
{
|
||||
return stackedWidget->currentWidget()->minimumSizeHint();
|
||||
}
|
||||
|
||||
PrintingSelectorViewOptionsWidget* PrintingSelectorViewOptionsToolbarWidget::getViewOptionsWidget() const
|
||||
{
|
||||
return viewOptions;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
#define PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
|
||||
#include "printing_selector.h"
|
||||
#include "printing_selector_view_options_widget.h"
|
||||
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
|
||||
class PrintingSelectorViewOptionsToolbarWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrintingSelectorViewOptionsToolbarWidget(QWidget *parent, PrintingSelector *printingSelector);
|
||||
void collapse();
|
||||
void expand();
|
||||
void onWidgetChanged(int);
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
PrintingSelectorViewOptionsWidget *getViewOptionsWidget() const;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
PrintingSelector *printingSelector;
|
||||
PrintingSelectorViewOptionsWidget *viewOptions;
|
||||
QWidget *expandedWidget;
|
||||
QPushButton *collapseButton;
|
||||
QWidget *collapsedWidget;
|
||||
QPushButton *expandButton;
|
||||
QStackedWidget *stackedWidget;
|
||||
};
|
||||
|
||||
#endif // PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#include "printing_selector_view_options_widget.h"
|
||||
|
||||
PrintingSelectorViewOptionsWidget::PrintingSelectorViewOptionsWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::ScrollBarPolicy::ScrollBarAlwaysOff, Qt::ScrollBarPolicy::ScrollBarAsNeeded);
|
||||
|
||||
sortCheckBox = new QCheckBox(flowWidget);
|
||||
sortCheckBox->setText(tr("Display Sorting Options"));
|
||||
searchCheckBox = new QCheckBox(flowWidget);
|
||||
searchCheckBox->setText(tr("Display Search Bar"));
|
||||
cardSizeCheckBox = new QCheckBox(flowWidget);
|
||||
cardSizeCheckBox->setText(tr("Display Card Size Slider"));
|
||||
navigationCheckBox = new QCheckBox(flowWidget);
|
||||
navigationCheckBox->setText(tr("Display Navigation Buttons"));
|
||||
|
||||
flowWidget->addWidget(sortCheckBox);
|
||||
flowWidget->addWidget(searchCheckBox);
|
||||
flowWidget->addWidget(cardSizeCheckBox);
|
||||
flowWidget->addWidget(navigationCheckBox);
|
||||
|
||||
layout->addWidget(flowWidget);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
#define PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
|
||||
#include "../general/layout_containers/flow_widget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class PrintingSelectorViewOptionsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrintingSelectorViewOptionsWidget(QWidget *parent);
|
||||
|
||||
private:
|
||||
QHBoxLayout *layout;
|
||||
FlowWidget *flowWidget;
|
||||
QCheckBox *sortCheckBox;
|
||||
QCheckBox *searchCheckBox;
|
||||
QCheckBox *cardSizeCheckBox;
|
||||
QCheckBox *navigationCheckBox;
|
||||
};
|
||||
|
||||
#endif // PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue