mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
Don't allow top-level folder widget to be hidden anymore.
This commit is contained in:
parent
36dcdc966e
commit
bbfdbe78d5
5 changed files with 16 additions and 6 deletions
|
|
@ -27,7 +27,9 @@ BannerWidget::BannerWidget(QWidget *parent, const QString &text, Qt::Orientation
|
||||||
void BannerWidget::mousePressEvent(QMouseEvent *event)
|
void BannerWidget::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::mousePressEvent(event);
|
QWidget::mousePressEvent(event);
|
||||||
|
if (clickable) {
|
||||||
emit buddyVisibilityChanged();
|
emit buddyVisibilityChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BannerWidget::setText(const QString &text) const
|
void BannerWidget::setText(const QString &text) const
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ public:
|
||||||
{
|
{
|
||||||
return bannerLabel->text();
|
return bannerLabel->text();
|
||||||
}
|
}
|
||||||
|
void setClickable(bool _clickable)
|
||||||
|
{
|
||||||
|
clickable = _clickable;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
@ -32,6 +36,7 @@ private:
|
||||||
Qt::Orientation gradientOrientation;
|
Qt::Orientation gradientOrientation;
|
||||||
int transparency; // Transparency percentage for the gradient
|
int transparency; // Transparency percentage for the gradient
|
||||||
QWidget *buddy;
|
QWidget *buddy;
|
||||||
|
bool clickable = true;
|
||||||
signals:
|
signals:
|
||||||
void buddyVisibilityChanged();
|
void buddyVisibilityChanged();
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,15 @@
|
||||||
VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
||||||
QString _filePath)
|
QString _filePath,
|
||||||
|
bool canBeHidden)
|
||||||
: QWidget(parent), visualDeckStorageWidget(_visualDeckStorageWidget), filePath(_filePath)
|
: QWidget(parent), visualDeckStorageWidget(_visualDeckStorageWidget), filePath(_filePath)
|
||||||
{
|
{
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
header = new BannerWidget(this, "");
|
header = new BannerWidget(this, "");
|
||||||
|
header->setClickable(canBeHidden);
|
||||||
layout->addWidget(header);
|
layout->addWidget(header);
|
||||||
|
|
||||||
container = new QWidget(this);
|
container = new QWidget(this);
|
||||||
|
|
@ -123,7 +125,7 @@ bool VisualDeckStorageFolderDisplayWidget::checkVisibility()
|
||||||
void VisualDeckStorageFolderDisplayWidget::createWidgetsForFolders()
|
void VisualDeckStorageFolderDisplayWidget::createWidgetsForFolders()
|
||||||
{
|
{
|
||||||
for (const QString &dir : getAllSubFolders()) {
|
for (const QString &dir : getAllSubFolders()) {
|
||||||
auto *display = new VisualDeckStorageFolderDisplayWidget(this, visualDeckStorageWidget, dir);
|
auto *display = new VisualDeckStorageFolderDisplayWidget(this, visualDeckStorageWidget, dir, true);
|
||||||
containerLayout->addWidget(display);
|
containerLayout->addWidget(display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ class VisualDeckStorageFolderDisplayWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
VisualDeckStorageFolderDisplayWidget(QWidget *parent,
|
VisualDeckStorageFolderDisplayWidget(QWidget *parent,
|
||||||
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
VisualDeckStorageWidget *_visualDeckStorageWidget,
|
||||||
QString _filePath);
|
QString _filePath,
|
||||||
|
bool canBeHidden);
|
||||||
void refreshUi();
|
void refreshUi();
|
||||||
void createWidgetsForFiles();
|
void createWidgetsForFiles();
|
||||||
void createWidgetsForFolders();
|
void createWidgetsForFolders();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
||||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().getDeckPath());
|
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().getDeckPath(), false);
|
||||||
|
|
||||||
scrollArea->setWidget(folderWidget);
|
scrollArea->setWidget(folderWidget);
|
||||||
scrollArea->setWidgetResizable(true);
|
scrollArea->setWidgetResizable(true);
|
||||||
|
|
@ -92,7 +92,7 @@ void VisualDeckStorageWidget::deckPreviewDoubleClickedEvent(QMouseEvent *event,
|
||||||
|
|
||||||
void VisualDeckStorageWidget::refreshBannerCards()
|
void VisualDeckStorageWidget::refreshBannerCards()
|
||||||
{
|
{
|
||||||
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().getDeckPath());
|
folderWidget = new VisualDeckStorageFolderDisplayWidget(this, this, SettingsCache::instance().getDeckPath(), false);
|
||||||
scrollArea->setWidget(folderWidget);
|
scrollArea->setWidget(folderWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue