diff --git a/YACReader/goto_flow.cpp b/YACReader/goto_flow.cpp index dd72adf0..fdb17057 100644 --- a/YACReader/goto_flow.cpp +++ b/YACReader/goto_flow.cpp @@ -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(5*imageSize.width()),static_cast(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(5*imageSize.width()),toolBar->height() + static_cast(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) diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index eb2c2112..6609b854 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -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); }; //----------------------------------------------------------------------------- diff --git a/YACReader/goto_flow_gl.cpp b/YACReader/goto_flow_gl.cpp index 8404d3d6..0612540a 100644 --- a/YACReader/goto_flow_gl.cpp +++ b/YACReader/goto_flow_gl.cpp @@ -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(5*imageSize.width()),static_cast(imageSize.height()*1.7)); + resize(static_cast(5*imageSize.width()),toolBar->height() + static_cast(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()); +} diff --git a/YACReader/goto_flow_gl.h b/YACReader/goto_flow_gl.h index 5b6ed1b5..31bd65e0 100644 --- a/YACReader/goto_flow_gl.h +++ b/YACReader/goto_flow_gl.h @@ -32,6 +32,7 @@ signals: private: YACReaderPageFlowGL * flow; void keyPressEvent(QKeyEvent* event); + void resizeEvent(QResizeEvent *event); //Comic * comic; QSize imageSize; }; diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 9b891446..49195624 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -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("" + tr("Page : ") + "",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) diff --git a/YACReader/goto_flow_toolbar.h b/YACReader/goto_flow_toolbar.h index aafbe857..cdd5bad7 100644 --- a/YACReader/goto_flow_toolbar.h +++ b/YACReader/goto_flow_toolbar.h @@ -16,7 +16,6 @@ class GoToFlowToolBar : public QWidget QPushButton * centerButton; QPushButton * goToButton; QWidget * bar; - void resizeEvent(QResizeEvent * event); void paintEvent(QPaintEvent *); public: diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index 5441b662..83487b62 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -17,8 +17,6 @@ GoToFlowWidget::GoToFlowWidget(QWidget * parent) toolBar = new GoToFlowToolBar(this); - mainLayout->addWidget(toolBar); - mainLayout->setMargin(0); mainLayout->setSpacing(0); diff --git a/YACReader/yacreader_images.qrc b/YACReader/yacreader_images.qrc index f576763d..6eaed151 100644 --- a/YACReader/yacreader_images.qrc +++ b/YACReader/yacreader_images.qrc @@ -13,13 +13,6 @@ ../images/close.png ../images/up.png ../images/down.png - ../images/imgTopLeft.png - ../images/imgTopMiddle.png - ../images/imgTopRight.png - ../images/imgBottomLeft.png - ../images/imgBottomMiddle.png - ../images/imgBottomRight.png - ../images/imgEdit.png ../images/imgCenterSlide.png ../images/imgGoToSlide.png ../images/imgCenterSlidePressed.png diff --git a/images/imgBottomLeft.png b/images/imgBottomLeft.png deleted file mode 100644 index 27fa1709..00000000 Binary files a/images/imgBottomLeft.png and /dev/null differ diff --git a/images/imgBottomMiddle.png b/images/imgBottomMiddle.png deleted file mode 100644 index 142bf3ac..00000000 Binary files a/images/imgBottomMiddle.png and /dev/null differ diff --git a/images/imgBottomRight.png b/images/imgBottomRight.png deleted file mode 100644 index e9417476..00000000 Binary files a/images/imgBottomRight.png and /dev/null differ diff --git a/images/imgCenterSlide.png b/images/imgCenterSlide.png index 4e531b98..0c50ca86 100644 Binary files a/images/imgCenterSlide.png and b/images/imgCenterSlide.png differ diff --git a/images/imgCenterSlidePressed.png b/images/imgCenterSlidePressed.png index 53ce692b..66b47ed2 100644 Binary files a/images/imgCenterSlidePressed.png and b/images/imgCenterSlidePressed.png differ diff --git a/images/imgEdit.png b/images/imgEdit.png deleted file mode 100644 index c18d8ec9..00000000 Binary files a/images/imgEdit.png and /dev/null differ diff --git a/images/imgGoToSlide.png b/images/imgGoToSlide.png index 9a31acba..3187cfc5 100644 Binary files a/images/imgGoToSlide.png and b/images/imgGoToSlide.png differ diff --git a/images/imgGoToSlidePressed.png b/images/imgGoToSlidePressed.png index f7f5370c..76f5b0b1 100644 Binary files a/images/imgGoToSlidePressed.png and b/images/imgGoToSlidePressed.png differ diff --git a/images/imgTopLeft.png b/images/imgTopLeft.png deleted file mode 100644 index 57c0ee49..00000000 Binary files a/images/imgTopLeft.png and /dev/null differ diff --git a/images/imgTopMiddle.png b/images/imgTopMiddle.png deleted file mode 100644 index 9d23bef8..00000000 Binary files a/images/imgTopMiddle.png and /dev/null differ diff --git a/images/imgTopRight.png b/images/imgTopRight.png deleted file mode 100644 index d20ae2a9..00000000 Binary files a/images/imgTopRight.png and /dev/null differ