diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro
index fa4ec132..6feddf8c 100644
--- a/YACReader/YACReader.pro
+++ b/YACReader/YACReader.pro
@@ -45,13 +45,14 @@ HEADERS += comic.h \
translator.h \
goto_flow_gl.h \
goto_flow_widget.h \
+ page_label_widget.h \
../common/pictureflow.h \
../common/custom_widgets.h \
../common/check_new_version.h \
../common/qnaturalsorting.h \
../common/yacreader_flow_gl.h \
../common/yacreader_global.h \
- ../common/onstart_flow_selection_dialog.h
+ ../common/onstart_flow_selection_dialog.h
SOURCES += comic.cpp \
configuration.cpp \
@@ -69,6 +70,7 @@ SOURCES += comic.cpp \
translator.cpp \
goto_flow_gl.cpp \
goto_flow_widget.cpp \
+ page_label_widget.cpp \
../common/pictureflow.cpp \
../common/custom_widgets.cpp \
../common/check_new_version.cpp \
diff --git a/YACReader/images.qrc b/YACReader/images.qrc
index f706cebb..317f771a 100644
--- a/YACReader/images.qrc
+++ b/YACReader/images.qrc
@@ -35,6 +35,7 @@
../images/dictionary.png
../images/alwaysOnTop.png
../images/adjustToFullSize.png
+ ../images/numPagesLabel.png
../images/helpImages/open.png
../images/helpImages/openFolder.png
../images/helpImages/next.png
diff --git a/YACReader/page_label_widget.cpp b/YACReader/page_label_widget.cpp
new file mode 100644
index 00000000..5cc04bfd
--- /dev/null
+++ b/YACReader/page_label_widget.cpp
@@ -0,0 +1,94 @@
+#include "page_label_widget.h"
+
+#include
+#include
+#include
+
+PageLabelWidget::PageLabelWidget(QWidget * parent)
+ :QWidget(parent)
+ {
+ animation = new QPropertyAnimation(this,"pos");
+ animation->setDuration(150);
+
+
+ imgLabel = new QLabel(this);
+ QPixmap p(":/images/numPagesLabel.png");
+ imgLabel->resize(p.size());
+ imgLabel->setPixmap(QPixmap(":/images/numPagesLabel.png"));
+
+ textLabel = new QLabel(this);
+ textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
+ textLabel->setStyleSheet("QLabel { color : white; }");
+ //informationLabel->setAutoFillBackground(true);
+ //textLabel->setFont(QFont("courier new bold", 12));
+ //textLabel->resize(100,25);
+
+ textLabel->setGeometry(imgLabel->geometry());
+
+ /*QSize size = textLabel->sizeHint();
+
+ int w = width(); // returns screen width
+ int h = height(); // returns screen height
+ int mw = size.width();
+ int mh = size.height();
+ int cw = (w-mw)/2;
+ int ch = 0;
+ textLabel->move(cw,ch);*/
+ }
+
+void PageLabelWidget::show()
+{
+ if(this->pos().y() <= 0 && animation->state()!=QPropertyAnimation::Running)
+ {
+ QWidget * parent = dynamic_cast(this->parent());
+ if(parent == 0)
+ {
+ return;
+ }
+
+ QWidget::show();
+ //connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
+ animation->disconnect();
+
+ animation->setStartValue(QPoint((parent->geometry().size().width()-this->width())/2,-this->height()));
+ animation->setEndValue(QPoint((parent->geometry().size().width()-this->width())/2,0));
+ animation->start();
+ }
+}
+
+void PageLabelWidget::hide()
+{
+
+ if(this->pos().y() >= 0 && animation->state()!=QPropertyAnimation::Running)
+ {
+ QWidget * parent = dynamic_cast(this->parent());
+ if(parent == 0)
+ {
+ return;
+ }
+ //connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
+ animation->setStartValue(QPoint((parent->geometry().size().width()-this->width())/2,0));
+ animation->setEndValue(QPoint((parent->geometry().size().width()-this->width())/2,-this->height()));
+ animation->start();
+ }
+}
+
+void PageLabelWidget::setText(const QString & text)
+{
+ textLabel->setText(text);
+ QRect geom = imgLabel->geometry();
+ QSize size = geom.size();
+ size.setHeight(size.height() - 10); //TODO remove this amazing magic number
+ geom.setSize(size);
+ textLabel->setGeometry(geom);
+}
+
+/*void PageLabelWidget::resizeEvent(QResizeEvent * event)
+{
+ move(QPoint((((QWidget *) parent())->geometry().size().width()-this->width())/2,0));
+}*/
+
+void PageLabelWidget::updatePosition()
+{
+ move(QPoint((((QWidget *) parent())->geometry().size().width()-this->width())/2,this->pos().y()));
+}
\ No newline at end of file
diff --git a/YACReader/page_label_widget.h b/YACReader/page_label_widget.h
new file mode 100644
index 00000000..3d83b193
--- /dev/null
+++ b/YACReader/page_label_widget.h
@@ -0,0 +1,29 @@
+#ifndef PAGE_LABEL_WIDGET_H
+#define PAGE_LABEL_WIDGET_H
+
+#include
+
+class QLabel;
+class QPropertyAnimation;
+
+class PageLabelWidget : public QWidget
+{
+Q_OBJECT
+private:
+ QLabel * imgLabel;
+ QLabel * textLabel;
+ QPropertyAnimation * animation;
+
+ //void resizeEvent(QResizeEvent * event);
+
+public:
+ PageLabelWidget(QWidget * parent);
+
+public slots:
+ void show();
+ void hide();
+ void setText(const QString & text);
+ void updatePosition();
+};
+
+#endif
\ No newline at end of file
diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp
index ee28cf0d..34df22b9 100644
--- a/YACReader/viewer.cpp
+++ b/YACReader/viewer.cpp
@@ -9,6 +9,7 @@
#include "goto_dialog.h"
#include "translator.h"
#include "onstart_flow_selection_dialog.h"
+#include "page_label_widget.h"
#include
#include
@@ -56,12 +57,8 @@ drag(false)
content->setMouseTracking(true);
setMouseTracking(true);
- informationLabel = new QLabel(this);
- informationLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
- informationLabel->setAutoFillBackground(true);
- informationLabel->setFont(QFont("courier new", 12));
+ informationLabel = new PageLabelWidget(this);
informationLabel->hide();
- informationLabel->resize(100,25);
showCursor();
@@ -160,6 +157,8 @@ void Viewer::open(QString pathFile)
//render->update();
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
+
+ informationLabel->setText("...");
}
void Viewer::showMessageErrorOpening()
@@ -171,12 +170,14 @@ void Viewer::next()
{
direction = 1;
render->nextPage();
+ updateInformation();
}
void Viewer::prev()
{
direction = -1;
render->previousPage();
+ updateInformation();
}
void Viewer::showGoToDialog()
{
@@ -407,7 +408,7 @@ void Viewer::resizeEvent(QResizeEvent * event)
{
updateContentSize();
goToFlow->move(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
- informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
+ informationLabel->updatePosition();
QScrollArea::resizeEvent(event);
}
@@ -487,7 +488,7 @@ void Viewer::hideMagnifyingGlass()
void Viewer::informationSwitch()
{
information?informationLabel->hide():informationLabel->show();
- informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
+ //informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
information=!information;
//TODO it shouldn't be neccesary
informationLabel->adjustSize();
diff --git a/YACReader/viewer.h b/YACReader/viewer.h
index 72dc508a..91d30203 100644
--- a/YACReader/viewer.h
+++ b/YACReader/viewer.h
@@ -26,6 +26,7 @@ class GoToDialog;
class YACReaderTranslator;
class GoToFlowWidget;
class Bookmarks;
+class PageLabelWidget;
class Viewer : public QScrollArea
{
@@ -80,7 +81,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
private:
bool information;
bool doublePage;
- QLabel * informationLabel;
+ PageLabelWidget * informationLabel;
//QTimer * scroller;
QPropertyAnimation * verticalScroller;
int posByStep;
diff --git a/images/numPagesLabel.png b/images/numPagesLabel.png
new file mode 100644
index 00000000..54ca6241
Binary files /dev/null and b/images/numPagesLabel.png differ