From 210c48aa58c29df76ddf831cc901508f86f81162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 29 May 2013 16:57:10 +0200 Subject: [PATCH] a?adido widget para mostrar el progreso de borrado de c?mics. --- YACReaderLibrary/images.qrc | 9 ++ YACReaderLibrary/import_widget.cpp | 3 +- custom_widgets/custom_widgets.pri | 6 +- .../yacreader_deleting_progress.cpp | 106 ++++++++++++++++++ custom_widgets/yacreader_deleting_progress.h | 21 ++++ images/deleting_progress/icon.png | Bin 0 -> 292 bytes images/deleting_progress/imgBottomLeft.png | Bin 0 -> 281 bytes images/deleting_progress/imgBottomMiddle.png | Bin 0 -> 124 bytes images/deleting_progress/imgBottomRight.png | Bin 0 -> 288 bytes images/deleting_progress/imgLeftMiddle.png | Bin 0 -> 114 bytes images/deleting_progress/imgRightMiddle.png | Bin 0 -> 114 bytes images/deleting_progress/imgTopLeft.png | Bin 0 -> 123 bytes images/deleting_progress/imgTopMiddle.png | Bin 0 -> 113 bytes images/deleting_progress/imgTopRight.png | Bin 0 -> 123 bytes 14 files changed, 141 insertions(+), 4 deletions(-) create mode 100644 custom_widgets/yacreader_deleting_progress.cpp create mode 100644 custom_widgets/yacreader_deleting_progress.h create mode 100644 images/deleting_progress/icon.png create mode 100644 images/deleting_progress/imgBottomLeft.png create mode 100644 images/deleting_progress/imgBottomMiddle.png create mode 100644 images/deleting_progress/imgBottomRight.png create mode 100644 images/deleting_progress/imgLeftMiddle.png create mode 100644 images/deleting_progress/imgRightMiddle.png create mode 100644 images/deleting_progress/imgTopLeft.png create mode 100644 images/deleting_progress/imgTopMiddle.png create mode 100644 images/deleting_progress/imgTopRight.png diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index fd05573b..8da07fae 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -73,5 +73,14 @@ ../images/trash.png ../images/setReadButton.png ../images/openInYACReader.png + ../images/deleting_progress/imgTopLeft.png + ../images/deleting_progress/imgTopMiddle.png + ../images/deleting_progress/imgTopRight.png + ../images/deleting_progress/imgLeftMiddle.png + ../images/deleting_progress/imgRightMiddle.png + ../images/deleting_progress/imgBottomLeft.png + ../images/deleting_progress/imgBottomMiddle.png + ../images/deleting_progress/imgBottomRight.png + ../images/deleting_progress/icon.png \ No newline at end of file diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index 99445e73..d9ba0173 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -149,8 +149,7 @@ ImportWidget::ImportWidget(QWidget *parent) : coversViewLayout->setSpacing(0); QPushButton * stop = new QPushButton(tr("stop")); - stop->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); - stop->setMaximumWidth(100); + stop->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum); QVBoxLayout * layout = new QVBoxLayout(this); QHBoxLayout * buttonLayout = new QHBoxLayout(); diff --git a/custom_widgets/custom_widgets.pri b/custom_widgets/custom_widgets.pri index 7024ca1e..f895af48 100644 --- a/custom_widgets/custom_widgets.pri +++ b/custom_widgets/custom_widgets.pri @@ -12,7 +12,8 @@ HEADERS += $$PWD/help_about_dialog.h \ $$PWD/yacreader_spin_slider_widget.h \ $$PWD/yacreader_tool_bar_stretch.h \ $$PWD/yacreader_dark_menu.h \ - $$PWD/yacreader_titled_toolbar.h + $$PWD/yacreader_titled_toolbar.h \ + $$PWD/yacreader_deleting_progress.h SOURCES += $$PWD/help_about_dialog.cpp \ $$PWD/yacreader_field_edit.cpp \ @@ -25,4 +26,5 @@ SOURCES += $$PWD/help_about_dialog.cpp \ $$PWD/yacreader_spin_slider_widget.cpp \ $$PWD/yacreader_tool_bar_stretch.cpp \ $$PWD/yacreader_dark_menu.cpp \ - $$PWD/yacreader_titled_toolbar.cpp \ No newline at end of file + $$PWD/yacreader_titled_toolbar.cpp \ + $$PWD/yacreader_deleting_progress.cpp \ No newline at end of file diff --git a/custom_widgets/yacreader_deleting_progress.cpp b/custom_widgets/yacreader_deleting_progress.cpp new file mode 100644 index 00000000..e98b20a2 --- /dev/null +++ b/custom_widgets/yacreader_deleting_progress.cpp @@ -0,0 +1,106 @@ +#include "yacreader_deleting_progress.h" + +#include +#include +#include +#include +#include +#include + +YACReaderDeletingProgress::YACReaderDeletingProgress(QWidget *parent) : + QWidget(parent) +{ + QVBoxLayout * contentLayout = new QVBoxLayout(this); + + QLabel * iconLabel = new QLabel(); + QPixmap icon(":/images/deleting_progress/icon.png"); + iconLabel->setPixmap(icon); + iconLabel->setStyleSheet(tr("QLabel {padding:0px; margin:0px;}")); + + QLabel * title = new QLabel(tr("Please wait, deleting in progress...")); + + title->setStyleSheet(tr("QLabel {color:#ABABAB; padding:0 0 0 0px; margin:0px; font-size:18px; font-weight:bold;}")); + + QProgressBar * progressBar = new QProgressBar(); + + progressBar->setTextVisible(false); + progressBar->setFixedHeight(6); + progressBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); + progressBar->setRange (0,10); + progressBar->setValue(5); + progressBar->setStyleSheet( + "QProgressBar { border: none; border-radius: 3px; background: #ABABAB; margin:0; margin-left:16; margin-right:16px;}" + "QProgressBar::chunk {background-color: #FFC745; border: none; border-radius: 3px;}"); + + QPushButton * button = new QPushButton(tr("cancel")); + + button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + + contentLayout->addSpacing(16); + contentLayout->addWidget(iconLabel,0,Qt::AlignHCenter); + contentLayout->addSpacing(11); + contentLayout->addWidget(title,0,Qt::AlignHCenter); + contentLayout->addSpacing(13); + contentLayout->addWidget(progressBar); + contentLayout->addSpacing(13); + contentLayout->addWidget(button,0,Qt::AlignHCenter); + contentLayout->addSpacing(18); + + contentLayout->setMargin(0); + + setLayout(contentLayout); + + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); +} + +void YACReaderDeletingProgress::paintEvent(QPaintEvent * event) +{ + int borderTop, borderRight, borderBottom, borderLeft; + + QPixmap pL(":/images/deleting_progress/imgTopLeft.png"); + QPixmap pM(":/images/deleting_progress/imgTopMiddle.png"); + QPixmap pR(":/images/deleting_progress/imgTopRight.png"); + + QPixmap pLM(":/images/deleting_progress/imgLeftMiddle.png"); + + QPixmap pRM(":/images/deleting_progress/imgRightMiddle.png"); + + QPixmap pBL(":/images/deleting_progress/imgBottomLeft.png"); + QPixmap pBM(":/images/deleting_progress/imgBottomMiddle.png"); + QPixmap pBR(":/images/deleting_progress/imgBottomRight.png"); + + borderTop = pL.height(); + borderRight = pRM.width(); + borderBottom = pBM.height(); + borderLeft = pLM.width(); + + int width = this->width()-borderRight-borderLeft; + int height = this->height()-borderTop-borderBottom; + + QPainter painter(this); + + //corners + painter.drawPixmap(0,0,pL); + painter.drawPixmap(this->width()-borderRight,0,pR); + painter.drawPixmap(0,this->height()-pBL.height(),pBL); + painter.drawPixmap(this->width()-pBR.width(),this->height()-borderBottom,pBR); + + //middle + painter.drawPixmap(borderRight,0,width,borderTop,pM); + painter.drawPixmap(0,borderTop,borderLeft,height,pLM); + painter.drawPixmap(width+borderLeft,borderTop,borderRight,height,pRM); + painter.drawPixmap(pBR.width(),height+borderTop,this->width()-pBR.width()-pBL.width(),pBR.height(),pBM); + + //center + painter.fillRect(borderLeft,borderTop,width,height,QColor("#FAFAFA")); + + QWidget::paintEvent(event); + + resize( sizeHint() ); +} + + +QSize YACReaderDeletingProgress::sizeHint() const +{ + return QSize(410,184); +} diff --git a/custom_widgets/yacreader_deleting_progress.h b/custom_widgets/yacreader_deleting_progress.h new file mode 100644 index 00000000..44cf04ff --- /dev/null +++ b/custom_widgets/yacreader_deleting_progress.h @@ -0,0 +1,21 @@ +#ifndef YACREADER_DELETING_PROGRESS_H +#define YACREADER_DELETING_PROGRESS_H + +#include + +class YACReaderDeletingProgress : public QWidget +{ + Q_OBJECT +public: + explicit YACReaderDeletingProgress(QWidget *parent = 0); + QSize sizeHint() const; +signals: + +public slots: + +protected: + void paintEvent(QPaintEvent *); + +}; + +#endif // YACREADER_DELETING_PROGRESS_H diff --git a/images/deleting_progress/icon.png b/images/deleting_progress/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..707741906f2235b0596ed4d0834e4ddbb32604e3 GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^@<6P|!3HERbR04SQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JijH}@IEGZ*N=i{+S`)W-7o*2f=8a5(r|cO%9=UMg0-F<; zWapM0^BPMoc${GLagmsG-a)QIeMv(rhcnBB8%+-PYYqr|DQtbeFs3Q+h)Y-ahe)3u z8`o*U(gse=S+)Y!7cSmoc91z?!XRes@HYB9kUlJHu%OVcNLPMmgW%eVKmOU=jY}0C zXEaG~t#M%B)?6uUX+A;APU_9#Y5h@lSwB}iMKElqU9?y}>nVRm&VA;ZY3!FSF!C>W fc9_wjfssKY(D>+`*$N3jA2E2k`njxgN@xNAg8glm literal 0 HcmV?d00001 diff --git a/images/deleting_progress/imgBottomLeft.png b/images/deleting_progress/imgBottomLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..9c2f77ecc83c8348b154f07eb78a51a49ece64cf GIT binary patch literal 281 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xc6+)whE&{2N&o_uBsm4M+CM)&PLAJS_xE_~%!aOi%pc_y z{*}GHwstm81%vREf80mr-@bLL%us;QVb+g^8>P?B&1EmNWR7H(7RY8OJk-q2Kkspo zF;Bytzg!*p7M7M@?P`C0QB{1tfoUU)z-`9DcaM&C_bbdk)3Z$C$-4Lj6Br+UeSO{j z*52yx%!!GKetdjf$`cQA73mo} bG%zx7&#m+PGIY%u6{1-oD!M|6H_V+Po~-c70G$JIEGZ*O8W8j_4Rr+HiZNJ4F^=x6h5*ZdBn_Nz;Gvy Vb@BqYzyP3122WQ%mvv4FO#mxRCOQBB literal 0 HcmV?d00001 diff --git a/images/deleting_progress/imgBottomRight.png b/images/deleting_progress/imgBottomRight.png new file mode 100644 index 0000000000000000000000000000000000000000..c33e6aee07866d4192953dac5e867384d662c4bc GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X4tcsbhE&{2`tkMk_4=3}H#evAOG-$bX`I2{AvsgxLqqlV zcd^Vt_Zxobcl3uBy1O4&Q~1i+@t@&iJzI?5jh)5M6;}xVc-WQ{{NusF=I0J8T@&r`Tb@k8U}fi7AzZCsS>JibOnJ978H@C8Z=JBrqk#DO_XZFkoPq$zZ!m>`WC8U}fi7AzZCsS>JibOnJ978H@B_$*zY+y^OQ%GatFkoQHW$@ja+3yFGXYh3O Kb6Mw<&;$U^Z5>kp literal 0 HcmV?d00001 diff --git a/images/deleting_progress/imgTopLeft.png b/images/deleting_progress/imgTopLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..ea44e3547a932a883503e428033782f20dbedaae GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^%s|YDSr z1<%~X^wgl##FWaylc_d9MY5hQjv*Ddl2Q^9Ca@%FDojgb6WZVSLtUVlfklErxSh#= U{f&=nfC?ErUHx3vIVCg!0Q(Lhf&c&j literal 0 HcmV?d00001 diff --git a/images/deleting_progress/imgTopMiddle.png b/images/deleting_progress/imgTopMiddle.png new file mode 100644 index 0000000000000000000000000000000000000000..a4ad99048a7a4a69fbed2294f1c6a89cbfc0d11c GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^j6lr9!2~459xE0ADajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MZ%sgjv*Ddl5Xs;w?91FJfDGyhe7BcE0gtV_a8uM22WQ% Jmvv4FO#sS-9*O_} literal 0 HcmV?d00001 diff --git a/images/deleting_progress/imgTopRight.png b/images/deleting_progress/imgTopRight.png new file mode 100644 index 0000000000000000000000000000000000000000..c528653e38eae91236c34f0c78b3bde7a6337a73 GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^%s|YDSr z1<%~X^wgl##FWaylc_d9MY5hQjv*DdlF||qJ}@WADWoMZJ~DUsBhg{c#3I2UdWBhO T`!@OcK!psRu6{1-oD!M<{pBGE literal 0 HcmV?d00001