updated go to flow visual style

This commit is contained in:
Luis Ángel San Martín 2015-12-11 20:59:18 +01:00
parent d68604c1c1
commit 405cfc864d
19 changed files with 53 additions and 83 deletions

View File

@ -34,7 +34,6 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
worker = new PageLoader(&mutexGoToFlow);
flow = new YACReaderFlow(this,flowType);
flow->setReflectionEffect(PictureFlow::PlainReflection);
imageSize = Configuration::getConfiguration().getGotoSlideSize();
@ -46,23 +45,14 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(showSlide(unsigned int)));
mainLayout->insertWidget(0,flow);
mainLayout->setStretchFactor(flow,1);
mainLayout->addWidget(flow);
toolBar->raise();
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
//install eventFilter
//flow->installEventFilter(this);
/*edit->installEventFilter(this);
centerButton->installEventFilter(this);
goToButton->installEventFilter(this);
connect(edit,SIGNAL(returnPressed()),goToButton,SIGNAL(clicked()));*/
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
this->setCursor(QCursor(Qt::ArrowCursor));
}
GoToFlow::~GoToFlow()
{
delete flow;
@ -84,6 +74,15 @@ void GoToFlow::keyPressEvent(QKeyEvent *event)
GoToFlowWidget::keyPressEvent(event);
}
void GoToFlow::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
toolBar->move(0, event->size().height() - toolBar->height());
toolBar->setFixedWidth(width());
}
void GoToFlow::centerSlide(int slide)
{
if(flow->centerIndex()!=slide)

View File

@ -48,20 +48,21 @@ private:
virtual void wheelEvent(QWheelEvent * event);
QMutex mutexGoToFlow;
private slots:
void preload();
void updateImageData();
private slots:
void preload();
void updateImageData();
void resizeEvent(QResizeEvent *event);
public slots:
void centerSlide(int slide);
void reset();
void setNumSlides(unsigned int slides);
void setImageReady(int index,const QByteArray & image);
void setFlowType(FlowType flowType);
void updateSize();
void updateConfig(QSettings * settings);
public slots:
void centerSlide(int slide);
void reset();
void setNumSlides(unsigned int slides);
void setImageReady(int index,const QByteArray & image);
void setFlowType(FlowType flowType);
void updateSize();
void updateConfig(QSettings * settings);
signals:
void goToPage(unsigned int page);
void goToPage(unsigned int page);
};
//-----------------------------------------------------------------------------

View File

@ -28,10 +28,10 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(setCenterIndex(unsigned int)));
mainLayout->insertWidget(0,flow);
mainLayout->setStretchFactor(flow,1);
mainLayout->addWidget(flow);
toolBar->raise();
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
this->setCursor(QCursor(Qt::ArrowCursor));
}
@ -156,3 +156,11 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event)
GoToFlowWidget::keyPressEvent(event);
}
void GoToFlowGL::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
toolBar->move(0, event->size().height() - toolBar->height());
toolBar->setFixedWidth(width());
}

View File

@ -32,6 +32,7 @@ signals:
private:
YACReaderPageFlowGL * flow;
void keyPressEvent(QKeyEvent* event);
void resizeEvent(QResizeEvent *event);
//Comic * comic;
QSize imageSize;
};

View File

@ -5,50 +5,25 @@
GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
:QWidget(parent)
{
//fondo
QBoxLayout * background = new QHBoxLayout(this);
QLabel * imgBottomLeft = new QLabel(this);
QLabel * imgBottomRight = new QLabel(this);
QLabel * imgBottomMiddle = new QLabel(this);
QPixmap pBL(":/images/imgBottomLeft.png");
QPixmap pBM(":/images/imgBottomMiddle.png");
QPixmap pBR(":/images/imgBottomRight.png");
imgBottomLeft->setPixmap(pBL);
imgBottomRight->setPixmap(pBR);
imgBottomMiddle->setPixmap(pBM);
imgBottomMiddle->setScaledContents(true);
//imgTop->setStyleSheet("background-image: url(:/images/numPagesLabel.png); width: 100%; height:100%; background-repeat: none; border: none");
background->addWidget(imgBottomLeft);
background->addWidget(imgBottomMiddle);
background->addWidget(imgBottomRight);
background->setStretchFactor(imgBottomLeft,0);
background->setStretchFactor(imgBottomMiddle,1);
background->setStretchFactor(imgBottomRight,0);
background->setMargin(0);
background->setSpacing(0);
//elementos interactivos
//QVBoxLayout * mainLayout = new QVBoxLayout;
QVBoxLayout * mainLayout = new QVBoxLayout;
bar = new QWidget(this);
QHBoxLayout * bottom = new QHBoxLayout(bar);
bottom->addStretch();
bottom->addWidget(new QLabel(tr("Page : "),bar));
bottom->addWidget(new QLabel("<b>" + tr("Page : ") + "</b>",bar));
bottom->addWidget(edit = new QLineEdit(bar));
v = new QIntValidator(bar);
v->setBottom(1);
edit->setValidator(v);
edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
edit->setStyleSheet("background-image: url(:/images/imgEdit.png); width: 100%; height:100%; background-repeat: none; border: none; padding: 3px; color: white;");
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-color: white; font-weight:bold}");
QPixmap p(":/images/imgEdit.png");
edit->setFixedSize(54,50);
edit->setAttribute(Qt::WA_MacShowFocusRect,false);
edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
//edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
//edit->resize(QSize(54,50));
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
edit->setAutoFillBackground(false);
//edit->setAutoFillBackground(false);
connect(edit,SIGNAL(returnPressed()),this,SLOT(goTo()));
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
@ -58,7 +33,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
//centerButton->setIcon(QIcon(":/images/center.png"));
centerButton->setStyleSheet(centerButtonCSS);
centerButton->setFixedSize(26,50);
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide()));
bottom->addWidget(centerButton);
@ -79,17 +54,21 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
bottom->setSpacing(0);
bar->setLayout(bottom);
//mainLayout->addWidget(bar);
setLayout(background);
bar->setGeometry(QRect(0,0,400,50));
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout->addWidget(bar);
setLayout(mainLayout);
setFixedHeight(50);
}
void GoToFlowToolBar::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.fillRect(0,0,width(),height(),QColor("#BB000000"));
painter.fillRect(0,0,width(),height(),QColor("#99000000"));
}
void GoToFlowToolBar::setPage(int pageNumber)
@ -102,14 +81,6 @@ void GoToFlowToolBar::setTop(int numPages)
v->setTop(numPages);
}
void GoToFlowToolBar::resizeEvent(QResizeEvent * event)
{
bar->setGeometry(QRect(0,(event->size().height()-50)+((50-bar->height())/2),event->size().width(),50));
QWidget::resizeEvent(event);
}
void GoToFlowToolBar::goTo()
{
if(edit->text().toInt()!=0)

View File

@ -16,7 +16,6 @@ class GoToFlowToolBar : public QWidget
QPushButton * centerButton;
QPushButton * goToButton;
QWidget * bar;
void resizeEvent(QResizeEvent * event);
void paintEvent(QPaintEvent *);
public:

View File

@ -17,8 +17,6 @@ GoToFlowWidget::GoToFlowWidget(QWidget * parent)
toolBar = new GoToFlowToolBar(this);
mainLayout->addWidget(toolBar);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);

View File

@ -13,13 +13,6 @@
<file>../images/close.png</file>
<file>../images/up.png</file>
<file>../images/down.png</file>
<file>../images/imgTopLeft.png</file>
<file>../images/imgTopMiddle.png</file>
<file>../images/imgTopRight.png</file>
<file>../images/imgBottomLeft.png</file>
<file>../images/imgBottomMiddle.png</file>
<file>../images/imgBottomRight.png</file>
<file>../images/imgEdit.png</file>
<file>../images/imgCenterSlide.png</file>
<file>../images/imgGoToSlide.png</file>
<file>../images/imgCenterSlidePressed.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 940 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B