mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-22 17:39:05 -08:00
[VDE] Placeholder image for deck view if deck is empty (#6516)
* [VDE] A stab at things Took 14 minutes Took 10 minutes Took 5 minutes Took 4 minutes Took 41 seconds Took 10 minutes Took 3 minutes * [VDE] Use placeholder image for deck view if deck is empty. Took 15 minutes Took 9 seconds Took 5 seconds * Sort CMakeList correctly. Took 35 seconds Took 23 seconds * Visibility updates got lost in the rebase. Took 7 minutes * Same treatment for printing selector. Took 42 minutes * Actually add file. Took 4 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -203,6 +203,7 @@ set(cockatrice_SOURCES
|
||||
src/interface/widgets/printing_selector/printing_selector.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_display_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_overlay_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_placeholder_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_search_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_selection_widget.cpp
|
||||
src/interface/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
|
||||
@@ -228,6 +229,7 @@ set(cockatrice_SOURCES
|
||||
src/interface/widgets/utility/sequence_edit.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_color_filter_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_filter_save_load_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_filter_toolbar_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_format_legality_filter_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_main_type_filter_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_name_filter_widget.cpp
|
||||
@@ -236,6 +238,7 @@ set(cockatrice_SOURCES
|
||||
src/interface/widgets/visual_database_display/visual_database_display_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_filter_display_widget.cpp
|
||||
src/interface/widgets/visual_deck_editor/visual_deck_display_options_widget.cpp
|
||||
src/interface/widgets/visual_deck_editor/visual_deck_editor_placeholder_widget.cpp
|
||||
src/interface/widgets/visual_deck_editor/visual_deck_editor_sample_hand_widget.cpp
|
||||
src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp
|
||||
src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_filter_widget.cpp
|
||||
@@ -317,8 +320,6 @@ set(cockatrice_SOURCES
|
||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_bracket_navigation_widget.h
|
||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.cpp
|
||||
src/interface/widgets/tabs/api/edhrec/display/commander/edhrec_commander_api_response_budget_navigation_widget.h
|
||||
src/interface/widgets/visual_database_display/visual_database_display_filter_toolbar_widget.cpp
|
||||
src/interface/widgets/visual_database_display/visual_database_display_filter_toolbar_widget.h
|
||||
)
|
||||
|
||||
add_subdirectory(sounds)
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
<file>resources/icons/mana/W.svg</file>
|
||||
|
||||
<file>resources/backgrounds/home.png</file>
|
||||
<file>resources/backgrounds/card_triplet.svg</file>
|
||||
<file>resources/backgrounds/placeholder_printing_selector.svg</file>
|
||||
|
||||
<file>resources/config/general.svg</file>
|
||||
<file>resources/config/appearance.svg</file>
|
||||
|
||||
31
cockatrice/resources/backgrounds/card_triplet.svg
Normal file
31
cockatrice/resources/backgrounds/card_triplet.svg
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
version="1.1"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
width="250"
|
||||
id="svg13"
|
||||
height="231.66667"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs13" />
|
||||
<g
|
||||
transform="matrix(1.705559,0,0,1.705559,-18.310328,-4.2419088)"
|
||||
id="g13">
|
||||
<path
|
||||
d="M 90.069854,3.479957 C 89.356513,1.2235709 86.980392,-0.01102897 84.723451,0.70218215 L 3.4767601,26.377781 C 1.2199188,27.090982 -0.01486587,29.46663 0.69839437,31.723116 L 33.512365,135.52112 c 0.713341,2.25639 3.089462,3.49099 5.346403,2.77777 l 81.246672,-25.6756 c 2.25684,-0.71319 3.49163,-3.08884 2.77837,-5.34533 L 90.074852,3.479957 Z"
|
||||
style="display:none;fill:#ffffff;stroke:#000000;stroke-width:1"
|
||||
id="path1" />
|
||||
<path
|
||||
d="m 110.61293,7.4983294 c -0.36657,-2.337853 -2.53055,-3.9150142 -4.86886,-3.5484627 L 21.563382,17.14452 c -2.338314,0.366502 -3.915784,2.529976 -3.549207,4.867929 L 34.876507,129.55893 c 0.366577,2.33786 2.530549,3.91502 4.868863,3.54847 l 84.18069,-13.19466 c 2.33831,-0.3665 3.91578,-2.52997 3.5492,-4.86793 L 110.61093,7.4983294 Z"
|
||||
style="fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path4" />
|
||||
<path
|
||||
d="m 130.53623,15.555064 c 0,-2.366441 -1.89356,-4.259575 -4.26046,-4.259575 H 41.067426 c -2.366905,0 -4.260468,1.893134 -4.260468,4.259575 V 124.41102 c 0,2.36644 1.893563,4.25957 4.260468,4.25957 h 85.208344 c 2.3669,0 4.26046,-1.89313 4.26046,-4.25957 z"
|
||||
style="fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path7" />
|
||||
<path
|
||||
d="m 149.43988,26.480639 c 0.38018,-2.335754 -1.1846,-4.508374 -3.52082,-4.88852 L 61.817351,7.9076636 C 59.481136,7.5275576 57.308066,9.0920839 56.927894,11.427736 L 39.439773,118.87426 c -0.380182,2.33576 1.184602,4.50838 3.520816,4.88852 l 84.102711,13.68346 c 2.33622,0.38011 4.50929,-1.18442 4.88946,-3.52007 L 149.43688,26.479639 Z"
|
||||
style="display:inline;fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path10" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.-->
|
||||
<svg
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="172.65051"
|
||||
id="svg13"
|
||||
height="213.30714"
|
||||
xml:space="preserve"
|
||||
xmlns="http://www.w3.org/2000/svg"><defs
|
||||
id="defs13" /><g
|
||||
transform="matrix(1.705559,0,0,1.705559,-97.653345,-68.741256)"
|
||||
id="g13"><path
|
||||
d="m 151.48519,45.063813 c 0,-2.366441 -1.89356,-4.259575 -4.26046,-4.259575 H 62.016385 c -2.366905,0 -4.260468,1.893134 -4.260468,4.259575 V 153.91977 c 0,2.36644 1.893563,4.25957 4.260468,4.25957 h 85.208345 c 2.3669,0 4.26046,-1.89313 4.26046,-4.25957 z"
|
||||
style="fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path7" /><path
|
||||
d="m 154.70135,48.441704 c 0,-2.366441 -1.89356,-4.259575 -4.26046,-4.259575 H 65.232545 c -2.366905,0 -4.260468,1.893134 -4.260468,4.259575 V 157.29767 c 0,2.36644 1.893563,4.25957 4.260468,4.25957 h 85.208345 c 2.3669,0 4.26046,-1.89313 4.26046,-4.25957 z"
|
||||
style="fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path7-5" /><path
|
||||
d="m 157.98403,51.75453 c 0,-2.366441 -1.89356,-4.259575 -4.26046,-4.259575 H 68.515228 c -2.366905,0 -4.260468,1.893134 -4.260468,4.259575 v 108.85596 c 0,2.36644 1.893563,4.25957 4.260468,4.25957 h 85.208342 c 2.3669,0 4.26046,-1.89313 4.26046,-4.25957 z"
|
||||
style="fill:#7f7f7f;fill-opacity:1;stroke:#000000;stroke-width:1"
|
||||
id="path7-6" /></g><path
|
||||
d="m 196.24576,207.42361 c 0,0.11213 0,0.22413 0,0.33621 -0.0498,4.54511 -4.18399,7.63329 -8.72909,7.63329 h -12.19086 c -3.29988,0 -5.97713,2.67727 -5.97713,5.97712 0,0.4234 0.0498,0.83433 0.12449,1.23279 0.26149,1.27014 0.80939,2.49046 1.34485,3.72325 0.75959,1.71843 1.50674,3.4244 1.50674,5.22998 0,3.95986 -2.68971,7.55859 -6.64956,7.72046 -0.43583,0.0128 -0.87166,0.025 -1.31995,0.025 -17.60761,0 -31.878,-14.27038 -31.878,-31.878 0,-17.60761 14.28284,-31.878 31.89046,-31.878 17.60762,0 31.87801,14.27039 31.87801,31.878 z m -47.81703,3.98475 c 0,-2.20407 -1.78067,-3.98475 -3.98473,-3.98475 -2.20407,0 -3.98477,1.78068 -3.98477,3.98475 0,2.20406 1.7807,3.98475 3.98477,3.98475 2.20406,0 3.98473,-1.78069 3.98473,-3.98475 z m 0,-11.95426 c 2.20407,0 3.98477,-1.78068 3.98477,-3.98475 0,-2.20407 -1.7807,-3.98475 -3.98477,-3.98475 -2.20405,0 -3.98473,1.78068 -3.98473,3.98475 0,2.20407 1.78068,3.98475 3.98473,3.98475 z m 19.92376,-11.95424 c 0,-2.20408 -1.78068,-3.98477 -3.98473,-3.98477 -2.20407,0 -3.98477,1.78069 -3.98477,3.98477 0,2.20405 1.7807,3.98474 3.98477,3.98474 2.20405,0 3.98473,-1.78069 3.98473,-3.98474 z m 11.95426,11.95424 c 2.20407,0 3.98475,-1.78068 3.98475,-3.98475 0,-2.20407 -1.78068,-3.98475 -3.98475,-3.98475 -2.20406,0 -3.98475,1.78068 -3.98475,3.98475 0,2.20407 1.78069,3.98475 3.98475,3.98475 z"
|
||||
id="path1"
|
||||
style="display:none;fill:#3b3b3b;fill-opacity:1;stroke:#000000;stroke-width:2.53798;stroke-dasharray:none;stroke-opacity:1" /><path
|
||||
d="M 126.20915,54.574783 82.324247,83.8512 c -5.76807,3.845383 -9.435059,10.089163 -10.029703,16.90777 12.348823,2.53716 22.081191,12.26955 24.638191,24.63819 6.838435,-0.59465 13.062395,-4.26163 16.907775,-10.0297 l 29.2566,-43.904722 c 1.32804,-2.001984 2.04162,-4.340923 2.04162,-6.75915 0,-6.719506 -5.45092,-12.170428 -12.17043,-12.170428 -2.3984,0 -4.75718,0.713573 -6.75915,2.041623 z M 88.052677,131.81933 c 0,-12.26953 -9.930593,-22.20012 -22.200138,-22.20012 -12.269532,0 -22.200126,9.93059 -22.200126,22.20012 0,0.77305 0.03966,1.54609 0.118929,2.2993 0.356787,3.46877 -2.021792,7.21505 -5.510393,7.21505 h -0.951431 c -3.508409,0 -6.342895,2.83447 -6.342895,6.3429 0,3.5084 2.834486,6.34289 6.342895,6.34289 h 28.543021 c 12.269545,0 22.200138,-9.93059 22.200138,-22.20014 z"
|
||||
id="path1-2"
|
||||
style="fill:#202225;fill-opacity:1;stroke-width:0.198215" /></svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -8,6 +8,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_placeholder_widget.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QScrollBar>
|
||||
@@ -34,6 +35,8 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
|
||||
placeholderWidget = new PrintingSelectorPlaceholderWidget(this);
|
||||
|
||||
sortToolBar = new PrintingSelectorCardSortingWidget(this);
|
||||
sortToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
|
||||
@@ -70,8 +73,13 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
|
||||
|
||||
layout->addWidget(sortAndOptionsContainer);
|
||||
|
||||
layout->addWidget(placeholderWidget);
|
||||
layout->addWidget(flowWidget);
|
||||
|
||||
// Initially show placeholder, hide flowWidget
|
||||
placeholderWidget->setVisible(true);
|
||||
flowWidget->setVisible(false);
|
||||
|
||||
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this, deckStateManager);
|
||||
cardSelectionBar->setVisible(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
layout->addWidget(cardSelectionBar);
|
||||
@@ -139,7 +147,16 @@ void PrintingSelector::updateDisplay()
|
||||
widgetLoadingBufferTimer->deleteLater();
|
||||
widgetLoadingBufferTimer = new QTimer(this);
|
||||
flowWidget->clearLayout();
|
||||
if (selectedCard != nullptr) {
|
||||
|
||||
if (selectedCard.isNull()) {
|
||||
// Show placeholder, hide flowWidget
|
||||
placeholderWidget->setVisible(true);
|
||||
flowWidget->setVisible(false);
|
||||
setWindowTitle(tr("Printing Selector"));
|
||||
} else {
|
||||
// Hide placeholder, show flowWidget
|
||||
placeholderWidget->setVisible(false);
|
||||
flowWidget->setVisible(true);
|
||||
setWindowTitle(selectedCard->getName());
|
||||
}
|
||||
getAllSetsForCurrentCard();
|
||||
@@ -153,6 +170,8 @@ void PrintingSelector::updateDisplay()
|
||||
void PrintingSelector::setCard(const CardInfoPtr &newCard)
|
||||
{
|
||||
if (newCard.isNull()) {
|
||||
selectedCard = newCard;
|
||||
updateDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -229,4 +248,4 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
||||
void PrintingSelector::toggleVisibilityNavigationButtons(bool _state)
|
||||
{
|
||||
cardSelectionBar->setVisible(_state);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "../cards/card_size_widget.h"
|
||||
#include "../general/layout_containers/flow_widget.h"
|
||||
#include "../quick_settings/settings_button_widget.h"
|
||||
#include "printing_selector_placeholder_widget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
@@ -70,6 +71,7 @@ private:
|
||||
QCheckBox *navigationCheckBox;
|
||||
PrintingSelectorCardSortingWidget *sortToolBar;
|
||||
PrintingSelectorCardSearchWidget *searchBar;
|
||||
PrintingSelectorPlaceholderWidget *placeholderWidget;
|
||||
FlowWidget *flowWidget;
|
||||
CardSizeWidget *cardSizeWidget;
|
||||
PrintingSelectorCardSelectionWidget *cardSelectionBar;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "printing_selector_placeholder_widget.h"
|
||||
|
||||
PrintingSelectorPlaceholderWidget::PrintingSelectorPlaceholderWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setAlignment(Qt::AlignCenter);
|
||||
setLayout(mainLayout);
|
||||
|
||||
// Image label with the background image
|
||||
imageLabel = new QLabel(this);
|
||||
imageLabel->setAlignment(Qt::AlignCenter);
|
||||
imageLabel->setStyleSheet(R"(
|
||||
QLabel {
|
||||
background-image: url(theme:backgrounds/placeholder_printing_selector.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
)");
|
||||
imageLabel->setFixedSize(300, 300);
|
||||
|
||||
textLabel = new QLabel(this);
|
||||
textLabel->setAlignment(Qt::AlignCenter);
|
||||
textLabel->setWordWrap(true);
|
||||
textLabel->setStyleSheet(R"(
|
||||
QLabel {
|
||||
color: palette(mid);
|
||||
font-size: 14px;
|
||||
padding: 10px;
|
||||
}
|
||||
)");
|
||||
|
||||
mainLayout->addWidget(imageLabel);
|
||||
mainLayout->addWidget(textLabel);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void PrintingSelectorPlaceholderWidget::retranslateUi()
|
||||
{
|
||||
textLabel->setText(tr("Select a card to view its available printings"));
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef COCKATRICE_PRINTING_SELECTOR_PLACEHOLDER_WIDGET_H
|
||||
#define COCKATRICE_PRINTING_SELECTOR_PLACEHOLDER_WIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class PrintingSelectorPlaceholderWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrintingSelectorPlaceholderWidget(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
QVBoxLayout *mainLayout;
|
||||
QLabel *imageLabel;
|
||||
QLabel *textLabel;
|
||||
|
||||
void retranslateUi();
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_PRINTING_SELECTOR_PLACEHOLDER_WIDGET_H
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "visual_deck_editor_placeholder_widget.h"
|
||||
|
||||
VisualDeckEditorPlaceholderWidget::VisualDeckEditorPlaceholderWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setAlignment(Qt::AlignCenter);
|
||||
setLayout(mainLayout);
|
||||
|
||||
// Image label with the background image
|
||||
imageLabel = new QLabel(this);
|
||||
imageLabel->setAlignment(Qt::AlignCenter);
|
||||
imageLabel->setStyleSheet(R"(
|
||||
QLabel {
|
||||
background-image: url(theme:backgrounds/card_triplet.svg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
)");
|
||||
imageLabel->setFixedSize(300, 300);
|
||||
|
||||
textLabel = new QLabel(this);
|
||||
textLabel->setAlignment(Qt::AlignCenter);
|
||||
textLabel->setWordWrap(true);
|
||||
textLabel->setStyleSheet(R"(
|
||||
QLabel {
|
||||
color: palette(mid);
|
||||
font-size: 14px;
|
||||
padding: 10px;
|
||||
}
|
||||
)");
|
||||
|
||||
mainLayout->addWidget(imageLabel);
|
||||
mainLayout->addWidget(textLabel);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void VisualDeckEditorPlaceholderWidget::retranslateUi()
|
||||
{
|
||||
textLabel->setText(tr("Add cards using the search bar or database tab to have them appear here"));
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef COCKATRICE_VISUAL_DECK_EDITOR_PLACEHOLDER_WIDGET_H
|
||||
#define COCKATRICE_VISUAL_DECK_EDITOR_PLACEHOLDER_WIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class VisualDeckEditorPlaceholderWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VisualDeckEditorPlaceholderWidget(QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
|
||||
private:
|
||||
QVBoxLayout *mainLayout;
|
||||
QLabel *imageLabel;
|
||||
QLabel *textLabel;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_VISUAL_DECK_EDITOR_PLACEHOLDER_WIDGET_H
|
||||
@@ -59,6 +59,7 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
|
||||
&VisualDeckEditorWidget::onSelectionChanged);
|
||||
}
|
||||
|
||||
updatePlaceholderVisibility();
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
@@ -180,8 +181,14 @@ void VisualDeckEditorWidget::initializeScrollAreaAndZoneContainer()
|
||||
|
||||
zoneContainer = new QWidget(scrollArea);
|
||||
zoneContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
zoneContainer->setObjectName("zoneContainer");
|
||||
zoneContainerLayout = new QVBoxLayout(zoneContainer);
|
||||
zoneContainer->setLayout(zoneContainerLayout);
|
||||
|
||||
// Create placeholder widget
|
||||
placeholderWidget = new VisualDeckEditorPlaceholderWidget(zoneContainer);
|
||||
zoneContainerLayout->addWidget(placeholderWidget);
|
||||
|
||||
scrollArea->addScrollBarWidget(zoneContainer, Qt::AlignHCenter);
|
||||
scrollArea->setWidget(zoneContainer);
|
||||
}
|
||||
@@ -200,6 +207,17 @@ void VisualDeckEditorWidget::retranslateUi()
|
||||
searchPushButton->setText(tr("Quick search and add card"));
|
||||
searchPushButton->setToolTip(tr("Search for closest match in the database (with auto-suggestions) and add "
|
||||
"preferred printing to the deck on pressing enter"));
|
||||
|
||||
if (placeholderWidget) {
|
||||
placeholderWidget->retranslateUi();
|
||||
}
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::updatePlaceholderVisibility()
|
||||
{
|
||||
if (placeholderWidget) {
|
||||
placeholderWidget->setVisible(indexToWidgetMap.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================================================================
|
||||
@@ -250,6 +268,7 @@ void VisualDeckEditorWidget::constructZoneWidgetsFromDeckListModel()
|
||||
|
||||
constructZoneWidgetForIndex(persistent);
|
||||
}
|
||||
updatePlaceholderVisibility();
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::updateZoneWidgets()
|
||||
@@ -264,6 +283,7 @@ void VisualDeckEditorWidget::clearAllDisplayWidgets()
|
||||
indexToWidgetMap.remove(idx);
|
||||
delete displayWidget;
|
||||
}
|
||||
updatePlaceholderVisibility();
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::cleanupInvalidZones(DeckCardZoneDisplayWidget *displayWidget)
|
||||
@@ -275,6 +295,7 @@ void VisualDeckEditorWidget::cleanupInvalidZones(DeckCardZoneDisplayWidget *disp
|
||||
}
|
||||
}
|
||||
delete displayWidget;
|
||||
updatePlaceholderVisibility();
|
||||
}
|
||||
|
||||
// =====================================================================================================================
|
||||
@@ -294,6 +315,7 @@ void VisualDeckEditorWidget::onCardAddition(const QModelIndex &parent, int first
|
||||
constructZoneWidgetForIndex(index);
|
||||
}
|
||||
}
|
||||
updatePlaceholderVisibility();
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::onCardRemoval(const QModelIndex &parent, int first, int last)
|
||||
@@ -308,6 +330,7 @@ void VisualDeckEditorWidget::onCardRemoval(const QModelIndex &parent, int first,
|
||||
indexToWidgetMap.remove(idx);
|
||||
}
|
||||
}
|
||||
updatePlaceholderVisibility();
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::decklistModelReset()
|
||||
@@ -390,4 +413,4 @@ void VisualDeckEditorWidget::onSelectionChanged(const QItemSelection &selected,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "../cards/card_size_widget.h"
|
||||
#include "../general/layout_containers/overlap_control_widget.h"
|
||||
#include "../quick_settings/settings_button_widget.h"
|
||||
#include "visual_deck_editor_placeholder_widget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QListWidget>
|
||||
@@ -44,6 +45,7 @@ public:
|
||||
|
||||
void setSelectionModel(QItemSelectionModel *model);
|
||||
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void updatePlaceholderVisibility();
|
||||
QItemSelectionModel *getSelectionModel() const
|
||||
{
|
||||
return selectionModel;
|
||||
@@ -96,6 +98,7 @@ private:
|
||||
QScrollArea *scrollArea;
|
||||
QWidget *zoneContainer;
|
||||
QVBoxLayout *zoneContainerLayout;
|
||||
VisualDeckEditorPlaceholderWidget *placeholderWidget;
|
||||
// OverlapControlWidget *overlapControlWidget;
|
||||
QHash<QPersistentModelIndex, QWidget *> indexToWidgetMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user