From df08b6e4d2529d37a87462bc9bd05572fa3f0117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 24 May 2013 11:19:24 +0200 Subject: [PATCH] a?adido bot?n que permite mostrar u ocultar las portadas de los c?mics siendo importados.. --- YACReaderLibrary/images.qrc | 2 ++ YACReaderLibrary/import_widget.cpp | 28 +++++++++++++++++++++++++++- YACReaderLibrary/import_widget.h | 9 +++++++++ images/hiddenCovers.png | Bin 0 -> 446 bytes images/shownCovers.png | Bin 0 -> 445 bytes 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 images/hiddenCovers.png create mode 100644 images/shownCovers.png diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index 3579057f..c5a2bafa 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -68,5 +68,7 @@ ../images/clearSearch.png ../images/iconSearch.png ../images/readRibbon.png + ../images/shownCovers.png + ../images/hiddenCovers.png \ No newline at end of file diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index f323b6bd..99445e73 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include @@ -113,7 +115,9 @@ ImportWidget::ImportWidget(QWidget *parent) : textDescription->setMaximumWidth(330); currentComicLabel = new QLabel("..."); + coversViewContainer = new QWidget(this); QVBoxLayout * coversViewLayout = new QVBoxLayout; + coversViewContainer->setLayout(coversViewLayout); coversView = new QGraphicsView(); //coversView->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); coversView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -185,8 +189,17 @@ ImportWidget::ImportWidget(QWidget *parent) : layout->addSpacing(10); layout->addStretch(); portadasLabel = new QLabel(""+tr("Some of the comics being added...")+""); + + hideButton = new QToolButton(this); + hideButton->setFixedSize(25,18); + hideButton->setStyleSheet("QToolButton {background: url(\":/images/shownCovers.png\"); border:none;}" + " QToolButton:checked {background:url(\":/images/hiddenCovers.png\"); border:none;}"); + hideButton->setCheckable(true); + + connect(hideButton,SIGNAL(toggled(bool)),this,SLOT(showCovers(bool))); + layout->addWidget(portadasLabel,0,Qt::AlignHCenter); - layout->addLayout(coversViewLayout); + layout->addWidget(coversViewContainer); //layout->addStretch(); layout->addWidget(currentComicLabel,0,Qt::AlignHCenter); layout->setContentsMargins(0,layout->contentsMargins().top(),0,layout->contentsMargins().bottom()); @@ -357,4 +370,17 @@ void ImportWidget::clearScene() { +} + +void ImportWidget::showCovers(bool hide) +{ + portadasLabel->setHidden(hide); + coversViewContainer->setHidden(hide); +} + +void ImportWidget::resizeEvent(QResizeEvent * event) +{ + hideButton->move(event->size().width()-hideButton->width()- (currentComicLabel->height()/2),event->size().height()-hideButton->height()- (currentComicLabel->height()/2)); + + QWidget::resizeEvent(event); } \ No newline at end of file diff --git a/YACReaderLibrary/import_widget.h b/YACReaderLibrary/import_widget.h index 5597a1e3..60cba3d6 100644 --- a/YACReaderLibrary/import_widget.h +++ b/YACReaderLibrary/import_widget.h @@ -7,6 +7,9 @@ class QLabel; class QGraphicsView; class QGraphicsScene; class QElapsedTimer; +class QVBoxLayout; +class QToolButton; +class QResizeEvent; class ImportWidget : public QWidget { @@ -25,18 +28,24 @@ public slots: void clearScene(); void setImportLook(); void setUpdateLook(); + void showCovers(bool hide); private: QLabel * currentComicLabel; QLabel * portadasLabel; QLabel * iconLabel; QLabel * text; QLabel * textDescription; + QWidget * coversViewContainer; QGraphicsView * coversView; QGraphicsScene * coversScene; int previousWidth; bool updatingCovers; QElapsedTimer * elapsedTimer; quint64 i; + + QToolButton * hideButton; + + void resizeEvent(QResizeEvent * event); }; diff --git a/images/hiddenCovers.png b/images/hiddenCovers.png new file mode 100644 index 0000000000000000000000000000000000000000..8689db16a75f17af347b34ab2f6fd958cb3a8c4e GIT binary patch literal 446 zcmV;v0YUzWP)P000sQ1^@s6t}b<;0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzU`a$lRCwB)Rnd*YFbr)X2IvSKq4$qO zGr@%kjt%aZfa?Un1aK3;P0)Vu4w)17H}8&2eCLqP;u{cCXkPKX27cE&v+QMaIplR?l9 z1Wai-_Ar0Id0dCJm7>0!;sy^68$+ImANGBs@?h3`*mp7fI4X?qjiYk442WVaQkkWn z#Lka6^eMe!y{E_;N$P|{Ddfv>71Fg(d&s608#q2#)&XTqNuiwAnx9Mr<2$CDyOGhW z67ERCz5E#)L&|f1M)V8+e#VJJ@?NThSOV`~T7xX8L6$Ex$OkpZZnV|2TF+|r*4?=Y ok5;5dD{AVYN9&q;wEhGb09-1PYflyc#{d8T07*qoM6N<$f|UKeP000sQ1^@s6t}b<;0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzUr9tkRCwB)Re^DXFbu?824Dn6pc51( zs53#c0c{sZS)d6MB%L7X1h7Fe0wXX&Uw7h8btMD&JDoXO*30rEZ;}YU+BU`Pn-;bej*S` zqjALik>+U~YtM@MGLBoNaM&60Bz%kS6PJgwK49O)@RKMherg<5s%3%?);yOv^b4_1 zXB@_uUa8(oWKASZ#Gwe}D{&2^YoSSzO&@HKcokV!Bx6pB77sMYJ2%K-w$+PTuWI$y-MIyi nmgh&yYwF=g>l%Bsegzl+Ihm4ckgl(E00000NkvXXu0mjfntQmE literal 0 HcmV?d00001