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 00000000..70774190 Binary files /dev/null and b/images/deleting_progress/icon.png differ diff --git a/images/deleting_progress/imgBottomLeft.png b/images/deleting_progress/imgBottomLeft.png new file mode 100644 index 00000000..9c2f77ec Binary files /dev/null and b/images/deleting_progress/imgBottomLeft.png differ diff --git a/images/deleting_progress/imgBottomMiddle.png b/images/deleting_progress/imgBottomMiddle.png new file mode 100644 index 00000000..da7fbc49 Binary files /dev/null and b/images/deleting_progress/imgBottomMiddle.png differ diff --git a/images/deleting_progress/imgBottomRight.png b/images/deleting_progress/imgBottomRight.png new file mode 100644 index 00000000..c33e6aee Binary files /dev/null and b/images/deleting_progress/imgBottomRight.png differ diff --git a/images/deleting_progress/imgLeftMiddle.png b/images/deleting_progress/imgLeftMiddle.png new file mode 100644 index 00000000..84cb9241 Binary files /dev/null and b/images/deleting_progress/imgLeftMiddle.png differ diff --git a/images/deleting_progress/imgRightMiddle.png b/images/deleting_progress/imgRightMiddle.png new file mode 100644 index 00000000..f29c1b1e Binary files /dev/null and b/images/deleting_progress/imgRightMiddle.png differ diff --git a/images/deleting_progress/imgTopLeft.png b/images/deleting_progress/imgTopLeft.png new file mode 100644 index 00000000..ea44e354 Binary files /dev/null and b/images/deleting_progress/imgTopLeft.png differ diff --git a/images/deleting_progress/imgTopMiddle.png b/images/deleting_progress/imgTopMiddle.png new file mode 100644 index 00000000..a4ad9904 Binary files /dev/null and b/images/deleting_progress/imgTopMiddle.png differ diff --git a/images/deleting_progress/imgTopRight.png b/images/deleting_progress/imgTopRight.png new file mode 100644 index 00000000..c528653e Binary files /dev/null and b/images/deleting_progress/imgTopRight.png differ