Add a new type of "look" to the import widget. It is going to be used as the "upgrading..." view while a library is being upgraded.

This commit is contained in:
Luis Ángel San Martín 2018-03-12 21:43:24 +01:00
parent 910ec62d30
commit f8527b9a03
2 changed files with 31 additions and 15 deletions

View File

@ -42,8 +42,6 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget * par
normal->setPixmap(line);
glow->setPixmap(glowLine);
QHBoxLayout * layout = new QHBoxLayout();
layout->addWidget(normal,0,Qt::AlignVCenter);
@ -155,6 +153,7 @@ ImportWidget::ImportWidget(QWidget *parent) :
QPushButton * stop = new QPushButton(tr("stop"));
stop->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
stopButton = stop;
QVBoxLayout * layout = new QVBoxLayout(this);
QHBoxLayout * buttonLayout = new QHBoxLayout();
@ -192,7 +191,7 @@ ImportWidget::ImportWidget(QWidget *parent) :
layout->addLayout(buttonLayout,0);
layout->addSpacing(10);
layout->addStretch();
portadasLabel = new QLabel("<font color=\"#565959\">"+tr("Some of the comics being added...")+"</font>");
coversLabel = new QLabel("<font color=\"#565959\">"+tr("Some of the comics being added...")+"</font>");
hideButton = new QToolButton(this);
hideButton->setFixedSize(25,18);
@ -202,7 +201,7 @@ ImportWidget::ImportWidget(QWidget *parent) :
connect(hideButton,SIGNAL(toggled(bool)),this,SLOT(showCovers(bool)));
layout->addWidget(portadasLabel,0,Qt::AlignHCenter);
layout->addWidget(coversLabel,0,Qt::AlignHCenter);
layout->addWidget(coversViewContainer);
//layout->addStretch();
layout->addWidget(currentComicLabel,0,Qt::AlignHCenter);
@ -346,6 +345,11 @@ void ImportWidget::setImportLook()
iconLabel->setPixmap(QPixmap(":/images/importingIcon.png"));
text->setText("<font color=\"#495252\">"+tr("Importing comics")+"</font>");
textDescription->setText("<font color=\"#565959\">"+tr("<p>YACReaderLibrary is now creating a new library.</p><p>Create a library could take several minutes. You can stop the process and update the library later for completing the task.</p>")+"</font>");
stopButton->setVisible(true);
coversLabel->setVisible(true);
coversViewContainer->setVisible(true);
hideButton->setVisible(true);
}
void ImportWidget::setUpdateLook()
@ -353,6 +357,23 @@ void ImportWidget::setUpdateLook()
iconLabel->setPixmap(QPixmap(":/images/updatingIcon.png"));
text->setText("<font color=\"#495252\">"+tr("Updating the library")+"</font>");
textDescription->setText("<font color=\"#565959\">"+tr("<p>The current library is being updated. For faster updates, please, update your libraries frequently.</p><p>You can stop the process and continue updating this library later.</p>")+"</font>");
stopButton->setVisible(true);
coversLabel->setVisible(true);
coversViewContainer->setVisible(true);
hideButton->setVisible(true);
}
void ImportWidget::setUpgradeLook()
{
iconLabel->setPixmap(QPixmap(":/images/updatingIcon.png"));
text->setText("<font color=\"#495252\">"+tr("Upgrading the library")+"</font>");
textDescription->setText("<font color=\"#565959\">"+tr("<p>The current library is being upgraded, please wait.</p>")+"</font>");
stopButton->setVisible(false);
coversLabel->setVisible(false);
coversViewContainer->setVisible(false);
hideButton->setVisible(false);
}
void ImportWidget::clearScene()
@ -363,7 +384,7 @@ void ImportWidget::clearScene()
void ImportWidget::showCovers(bool hide)
{
portadasLabel->setHidden(hide);
coversLabel->setHidden(hide);
coversViewContainer->setHidden(hide);
}

View File

@ -1,16 +1,9 @@
#ifndef IMPORT_WIDGET_H
#define IMPORT_WIDGET_H
#include <QWidget>
class QLabel;
class QGraphicsView;
class QGraphicsScene;
class QElapsedTimer;
class QVBoxLayout;
class QToolButton;
class QResizeEvent;
class QPropertyAnimation;
#include <QtWidgets>
class ImportWidget : public QWidget
{
@ -28,11 +21,12 @@ public slots:
void clearScene();
void setImportLook();
void setUpdateLook();
void setUpgradeLook();
void showCovers(bool hide);
private:
QLabel * currentComicLabel;
QLabel * portadasLabel;
QLabel * coversLabel;
QLabel * iconLabel;
QLabel * text;
QLabel * textDescription;
@ -40,6 +34,7 @@ private:
QGraphicsView * coversView;
QGraphicsScene * coversScene;
QPropertyAnimation * scrollAnimation;
QPushButton * stopButton;
int previousWidth;
bool updatingCovers;