mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
game tab: added splitter for manual size control of text boxes
This commit is contained in:
parent
0b22f73095
commit
5f46b5cd41
6 changed files with 36 additions and 61 deletions
|
|
@ -11,13 +11,8 @@
|
|||
#include "settingscache.h"
|
||||
|
||||
CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlags flags)
|
||||
: QFrame(parent, flags), pixmapWidth(160), aspectRatio((qreal) CARD_HEIGHT / (qreal) CARD_WIDTH), minimized(false), mode(_mode), minimizeButton(0), info(0)
|
||||
: QFrame(parent, flags), pixmapWidth(160), aspectRatio((qreal) CARD_HEIGHT / (qreal) CARD_WIDTH), minimized(false), mode(_mode), info(0)
|
||||
{
|
||||
if (mode == ModeGameTab) {
|
||||
minimizeButton = new QPushButton(QIcon(style()->standardIcon(QStyle::SP_ArrowUp)), QString());
|
||||
connect(minimizeButton, SIGNAL(clicked()), this, SLOT(minimizeClicked()));
|
||||
}
|
||||
|
||||
cardPicture = new QLabel;
|
||||
cardPicture->setAlignment(Qt::AlignCenter);
|
||||
|
||||
|
|
@ -38,8 +33,6 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
|
|||
|
||||
QGridLayout *grid = new QGridLayout(this);
|
||||
int row = 0;
|
||||
if (mode == ModeGameTab)
|
||||
grid->addWidget(minimizeButton, row++, 1, 1, 1, Qt::AlignRight);
|
||||
grid->addWidget(cardPicture, row++, 0, 1, 2);
|
||||
grid->addWidget(nameLabel1, row, 0);
|
||||
grid->addWidget(nameLabel2, row++, 1);
|
||||
|
|
@ -58,43 +51,15 @@ CardInfoWidget::CardInfoWidget(ResizeMode _mode, QWidget *parent, Qt::WindowFlag
|
|||
|
||||
retranslateUi();
|
||||
setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||
setMinimumHeight(350);
|
||||
if (mode == ModeGameTab) {
|
||||
textLabel->setFixedHeight(100);
|
||||
setFixedWidth(sizeHint().width());
|
||||
setMinimized(settingsCache->getCardInfoMinimized());
|
||||
setMaximumHeight(580);
|
||||
} else if (mode == ModePopUp)
|
||||
setFixedWidth(350);
|
||||
else
|
||||
setFixedWidth(250);
|
||||
if (mode != ModeDeckEditor)
|
||||
setFixedHeight(sizeHint().height());
|
||||
}
|
||||
|
||||
void CardInfoWidget::minimizeClicked()
|
||||
{
|
||||
setMinimized(!minimized);
|
||||
settingsCache->setCardInfoMinimized(minimized);
|
||||
}
|
||||
|
||||
void CardInfoWidget::setMinimized(bool _minimized)
|
||||
{
|
||||
minimized = _minimized;
|
||||
|
||||
cardPicture->setVisible(!minimized);
|
||||
nameLabel2->setVisible(!minimized);
|
||||
nameLabel1->setVisible(!minimized);
|
||||
manacostLabel1->setVisible(!minimized);
|
||||
manacostLabel2->setVisible(!minimized);
|
||||
cardtypeLabel1->setVisible(!minimized);
|
||||
cardtypeLabel2->setVisible(!minimized);
|
||||
powtoughLabel1->setVisible(!minimized);
|
||||
powtoughLabel2->setVisible(!minimized);
|
||||
textLabel->setVisible(!minimized);
|
||||
|
||||
if (minimizeButton)
|
||||
minimizeButton->setIcon(style()->standardIcon(minimized ? QStyle::SP_ArrowDown : QStyle::SP_ArrowUp));
|
||||
|
||||
setFixedHeight(sizeHint().height());
|
||||
}
|
||||
|
||||
void CardInfoWidget::setCard(CardInfo *card)
|
||||
|
|
@ -147,7 +112,7 @@ void CardInfoWidget::retranslateUi()
|
|||
|
||||
void CardInfoWidget::resizeEvent(QResizeEvent * /*event*/)
|
||||
{
|
||||
if (mode == ModeDeckEditor) {
|
||||
if ((mode == ModeDeckEditor) || (mode == ModeGameTab)) {
|
||||
pixmapWidth = qMin(width() * 0.95, (height() - 200) / aspectRatio);
|
||||
updatePixmap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue