mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Fix comic properties dialog sizing
This commit is contained in:
parent
cfc5b57213
commit
1596aa2347
@ -5,7 +5,6 @@
|
||||
#include "yacreader_field_edit.h"
|
||||
#include "yacreader_field_plain_text_edit.h"
|
||||
#include "db_helper.h"
|
||||
//#include "yacreader_busy_widget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QApplication>
|
||||
@ -26,7 +25,6 @@ using namespace YACReader;
|
||||
PropertiesDialog::PropertiesDialog(QWidget *parent)
|
||||
: QDialog(parent), updated(false)
|
||||
{
|
||||
|
||||
createCoverBox();
|
||||
createGeneralInfoBox();
|
||||
createAuthorsBox();
|
||||
@ -35,43 +33,47 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
|
||||
createPlotBox();
|
||||
|
||||
createTabBar();
|
||||
auto rootLayout = new QGridLayout;
|
||||
|
||||
cover = new QLabel();
|
||||
|
||||
mainLayout = new QGridLayout;
|
||||
// mainLayout->addWidget(coverBox,0,0);
|
||||
mainLayout->addWidget(tabBar, 0, 1);
|
||||
mainLayout->setColumnStretch(1, 1);
|
||||
/*mainLayout->addWidget(authorsBox,1,1);
|
||||
mainLayout->addWidget(publishingBox,2,1);*/
|
||||
mainLayout->addWidget(buttonBox, 1, 1, Qt::AlignBottom);
|
||||
mainLayout->addWidget(tabBar, 0, 0);
|
||||
mainLayout->addWidget(buttonBox, 1, 0, Qt::AlignBottom);
|
||||
|
||||
mainWidget = new QWidget(this);
|
||||
mainWidget->setAutoFillBackground(true);
|
||||
mainWidget->setFixedSize(470, 444);
|
||||
mainWidget->setLayout(mainLayout);
|
||||
mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
rootLayout->setHorizontalSpacing(0);
|
||||
rootLayout->setVerticalSpacing(0);
|
||||
|
||||
rootLayout->addWidget(cover, 0, 0, Qt::AlignTop);
|
||||
rootLayout->addWidget(mainWidget, 0, 1);
|
||||
|
||||
rootLayout->setColumnStretch(0, 0);
|
||||
rootLayout->setColumnStretch(1, 1);
|
||||
|
||||
QScreen *screen = parent != nullptr ? parent->window()->screen() : nullptr;
|
||||
if (screen == nullptr) {
|
||||
screen = QApplication::screens().constFirst();
|
||||
}
|
||||
|
||||
int heightDesktopResolution = screen->geometry().height();
|
||||
int widthDesktopResolution = screen->geometry().width();
|
||||
int sHeight, sWidth;
|
||||
sHeight = static_cast<int>(heightDesktopResolution * 0.65);
|
||||
sWidth = static_cast<int>(sHeight * 1.4);
|
||||
// setCover(QPixmap(":/images/notCover.png"));
|
||||
this->setLayout(rootLayout);
|
||||
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
rootLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
rootLayout->addWidget(coverBox, 0, 0, Qt::AlignBottom);
|
||||
|
||||
this->move(QPoint((widthDesktopResolution - sWidth) / 2, ((heightDesktopResolution - sHeight) - 40) / 2));
|
||||
setModal(true);
|
||||
|
||||
setFixedSize(sizeHint());
|
||||
mainWidget->move(280, 0);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
}
|
||||
|
||||
QSize PropertiesDialog::sizeHint() const
|
||||
{
|
||||
return QSize(750, 444);
|
||||
return QSize(800, 444);
|
||||
}
|
||||
|
||||
void PropertiesDialog::createTabBar()
|
||||
@ -85,13 +87,13 @@ void PropertiesDialog::createTabBar()
|
||||
|
||||
void PropertiesDialog::createCoverBox()
|
||||
{
|
||||
coverBox = new QWidget(this);
|
||||
coverBox = new QWidget;
|
||||
|
||||
auto layout = new QHBoxLayout;
|
||||
|
||||
QLabel *label = new QLabel(tr("Cover page"));
|
||||
label->setStyleSheet("QLabel {color: white; font-weight:bold; font-size:14px;}");
|
||||
layout->addWidget(label);
|
||||
layout->addWidget(label, 0, Qt::AlignVCenter);
|
||||
layout->addStretch();
|
||||
|
||||
coverPageEdit = new YACReaderFieldEdit();
|
||||
@ -107,40 +109,29 @@ void PropertiesDialog::createCoverBox()
|
||||
|
||||
coverPageNumberLabel->setStyleSheet("QLabel {color: white; font-weight:bold; font-size:14px;}");
|
||||
|
||||
layout->addWidget(showPreviousCoverPageButton);
|
||||
layout->addWidget(showPreviousCoverPageButton, 0, Qt::AlignVCenter);
|
||||
layout->addSpacing(5);
|
||||
layout->addWidget(coverPageNumberLabel);
|
||||
layout->addWidget(coverPageNumberLabel, 0, Qt::AlignVCenter);
|
||||
layout->addSpacing(5);
|
||||
layout->addWidget(showNextCoverPageButton);
|
||||
layout->addWidget(showNextCoverPageButton, 0, Qt::AlignVCenter);
|
||||
|
||||
coverPageEdit->setStyleSheet("QLineEdit {border:none;}");
|
||||
layout->setSpacing(0);
|
||||
|
||||
coverBox->setLayout(layout);
|
||||
|
||||
coverBox->setFixedWidth(280);
|
||||
coverBox->move(0, 444 - 28);
|
||||
layout->setContentsMargins(5, 4, 5, 0);
|
||||
coverBox->setFixedHeight(28);
|
||||
layout->setContentsMargins(5, 2, 5, 2);
|
||||
|
||||
// busyIndicator = new YACReaderBusyWidget(this);
|
||||
// busyIndicator->move((280-busyIndicator->width())/2,(444-busyIndicator->height()-28)/2);
|
||||
// busyIndicator->hide();
|
||||
QPalette p(palette());
|
||||
p.setColor(QPalette::Window, QColor(0, 0, 0, 200));
|
||||
coverBox->setAutoFillBackground(true);
|
||||
coverBox->setPalette(p);
|
||||
|
||||
connect(showPreviousCoverPageButton, &QAbstractButton::clicked, this, &PropertiesDialog::loadPreviousCover);
|
||||
connect(showNextCoverPageButton, &QAbstractButton::clicked, this, &PropertiesDialog::loadNextCover);
|
||||
}
|
||||
|
||||
QFrame *createLine()
|
||||
{
|
||||
QFrame *line = new QFrame();
|
||||
line->setObjectName(QString::fromUtf8("line"));
|
||||
// line->setGeometry(QRect(320, 150, 118, 3));
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void PropertiesDialog::createGeneralInfoBox()
|
||||
{
|
||||
generalInfoBox = new QWidget;
|
||||
@ -148,7 +139,7 @@ void PropertiesDialog::createGeneralInfoBox()
|
||||
auto generalInfoLayout = new QFormLayout;
|
||||
|
||||
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
// generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
|
||||
generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
|
||||
generalInfoLayout->addRow(tr("Title:"), title = new YACReaderFieldEdit());
|
||||
|
||||
auto number = new QHBoxLayout;
|
||||
@ -185,9 +176,6 @@ void PropertiesDialog::createGeneralInfoBox()
|
||||
|
||||
generalInfoLayout->addRow(tr("Size:"), size = new QLabel("size"));
|
||||
|
||||
// generalInfoLayout->addRow(tr("Comic Vine link:"), comicVineLink = new QLabel("..."));
|
||||
// generalInfoLayout->addRow(bottom);
|
||||
|
||||
auto main = new QVBoxLayout;
|
||||
main->addLayout(generalInfoLayout);
|
||||
main->addStretch();
|
||||
@ -203,7 +191,6 @@ void PropertiesDialog::createAuthorsBox()
|
||||
|
||||
auto authorsLayout = new QVBoxLayout;
|
||||
|
||||
// authorsLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
|
||||
auto h1 = new QHBoxLayout;
|
||||
auto vl1 = new QVBoxLayout;
|
||||
auto vr1 = new QVBoxLayout;
|
||||
@ -213,8 +200,7 @@ void PropertiesDialog::createAuthorsBox()
|
||||
vr1->addWidget(new QLabel(tr("Penciller(s):")));
|
||||
vr1->addWidget(penciller = new YACReaderFieldPlainTextEdit());
|
||||
h1->addLayout(vr1);
|
||||
// authorsLayout->addRow(tr("Writer(s):"), new YACReaderFieldPlainTextEdit());
|
||||
// authorsLayout->addRow(tr("Penciller(s):"), new YACReaderFieldPlainTextEdit());
|
||||
|
||||
auto h2 = new QHBoxLayout;
|
||||
auto vl2 = new QVBoxLayout;
|
||||
auto vr2 = new QVBoxLayout;
|
||||
@ -225,9 +211,6 @@ void PropertiesDialog::createAuthorsBox()
|
||||
vr2->addWidget(colorist = new YACReaderFieldPlainTextEdit());
|
||||
h2->addLayout(vr2);
|
||||
|
||||
// authorsLayout->addRow(tr("Inker(s):"), new YACReaderFieldPlainTextEdit());
|
||||
// authorsLayout->addRow(tr("Colorist(s):"), new YACReaderFieldPlainTextEdit());
|
||||
|
||||
auto h3 = new QHBoxLayout;
|
||||
auto vl3 = new QVBoxLayout;
|
||||
auto vr3 = new QVBoxLayout;
|
||||
@ -237,8 +220,6 @@ void PropertiesDialog::createAuthorsBox()
|
||||
vr3->addWidget(new QLabel(tr("Cover Artist(s):")));
|
||||
vr3->addWidget(coverArtist = new YACReaderFieldPlainTextEdit());
|
||||
h3->addLayout(vr3);
|
||||
// authorsLayout->addRow(tr("Letterer(es):"), new YACReaderFieldPlainTextEdit());
|
||||
// authorsLayout->addRow(tr("Cover Artist(s):"), new YACReaderFieldPlainTextEdit());
|
||||
|
||||
authorsLayout->addLayout(h1);
|
||||
authorsLayout->addLayout(h2);
|
||||
@ -628,11 +609,15 @@ void PropertiesDialog::setMultipleCover()
|
||||
last = last.scaledToHeight(444, Qt::SmoothTransformation);
|
||||
|
||||
coverImage = QPixmap::fromImage(blurred(last.toImage(), QRect(0, 0, last.width(), last.height()), 15));
|
||||
|
||||
cover->setPixmap(coverImage);
|
||||
}
|
||||
|
||||
void PropertiesDialog::setCover(const QPixmap &coverI)
|
||||
{
|
||||
coverImage = coverI.scaledToHeight(444, Qt::SmoothTransformation);
|
||||
|
||||
cover->setPixmap(coverImage);
|
||||
}
|
||||
|
||||
void PropertiesDialog::setFilename(const QString &nameString)
|
||||
@ -895,16 +880,6 @@ void PropertiesDialog::closeEvent(QCloseEvent *e)
|
||||
void PropertiesDialog::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QDialog::paintEvent(event);
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
p.drawPixmap(0, 0, coverImage);
|
||||
|
||||
// QPixmap shadow(":/images/social_dialog/shadow.png");
|
||||
// p.drawPixmap(280-shadow.width(),0,shadow.width(),444,shadow);
|
||||
p.drawLine(279, 0, 279, 444);
|
||||
if (sequentialEditing)
|
||||
p.fillRect(0, 444 - 28, 280, 28, QColor(0, 0, 0, 153));
|
||||
}
|
||||
|
||||
void PropertiesDialog::updateCoverPageNumberLabel(int n)
|
||||
@ -929,7 +904,6 @@ void PropertiesDialog::loadNextCover()
|
||||
}
|
||||
|
||||
showPreviousCoverPageButton->setEnabled(true);
|
||||
// busyIndicator->show();
|
||||
if (current + 1 != comics[currentComicIndex].info.coverPage)
|
||||
coverChanged = true;
|
||||
else
|
||||
@ -952,7 +926,6 @@ void PropertiesDialog::loadPreviousCover()
|
||||
}
|
||||
|
||||
showNextCoverPageButton->setEnabled(true);
|
||||
// busyIndicator->show();
|
||||
if (current - 1 != comics[currentComicIndex].info.coverPage.toInt())
|
||||
coverChanged = true;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user