diff options
| author | Victor Tran <vicr12345@gmail.com> | 2018-10-13 19:11:46 +1100 |
|---|---|---|
| committer | Victor Tran <vicr12345@gmail.com> | 2018-10-13 19:11:46 +1100 |
| commit | 88837708068dbbaa6c965a8026ddf80487b2d7d8 (patch) | |
| tree | a34bb6d45aedc2d8ac8d8c98e4abb57d89b88337 /installer/licensewidget.cpp | |
| parent | a6bf3d213523f73bf889ccaaf787a107c3d52774 (diff) | |
| download | theInstaller-88837708068dbbaa6c965a8026ddf80487b2d7d8.tar.gz theInstaller-88837708068dbbaa6c965a8026ddf80487b2d7d8.tar.bz2 theInstaller-88837708068dbbaa6c965a8026ddf80487b2d7d8.zip | |
Add licenses
Diffstat (limited to 'installer/licensewidget.cpp')
| -rw-r--r-- | installer/licensewidget.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/installer/licensewidget.cpp b/installer/licensewidget.cpp new file mode 100644 index 0000000..8a0a516 --- /dev/null +++ b/installer/licensewidget.cpp @@ -0,0 +1,78 @@ +#include "licensewidget.h" +#include "ui_licensewidget.h" + +#include <QPropertyAnimation> +#include <QDesktopServices> + +LicenseWidget::LicenseWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::LicenseWidget) +{ + ui->setupUi(this); +} + +LicenseWidget::~LicenseWidget() +{ + delete ui; +} + +void LicenseWidget::show(QString title, QString text) { + ui->titleWidget->setText(title); + ui->license->setHtml(text); + + this->setGeometry(parentWidget()->width(), 0, parentWidget()->width(), parentWidget()->height()); + + QWidget::show(); + + QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); + anim->setStartValue(this->geometry()); + anim->setEndValue(QRect(0, 0, this->width(), this->height())); + anim->setDuration(500); + anim->setEasingCurve(QEasingCurve::OutCubic); + anim->start(QPropertyAnimation::DeleteWhenStopped); + + coverWidget = new QWidget(this->parentWidget()); + coverWidget->setGeometry(0, 0, this->width(), this->height()); + coverWidget->setPalette(this->palette()); + coverWidget->setAutoFillBackground(true); + + opacityEffect = new QGraphicsOpacityEffect(coverWidget); + coverWidget->setGraphicsEffect(opacityEffect); + opacityEffect->setOpacity(0); + coverWidget->show(); + + coverWidget->raise(); + this->raise(); + + QPropertyAnimation* opac = new QPropertyAnimation(opacityEffect, "opacity"); + opac->setStartValue((qreal) 0); + opac->setEndValue((qreal) 1); + opac->setDuration(500); + opac->setEasingCurve(QEasingCurve::OutCubic); + opac->start(QPropertyAnimation::DeleteWhenStopped); +} + +void LicenseWidget::on_backButton_clicked() +{ + QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); + anim->setStartValue(this->geometry()); + anim->setEndValue(QRect(this->width(), 0, this->width(), this->height())); + anim->setDuration(500); + anim->setEasingCurve(QEasingCurve::OutCubic); + anim->start(QPropertyAnimation::DeleteWhenStopped); + + QPropertyAnimation* opac = new QPropertyAnimation(opacityEffect, "opacity"); + opac->setStartValue((qreal) 1); + opac->setEndValue((qreal) 0); + opac->setDuration(500); + opac->setEasingCurve(QEasingCurve::OutCubic); + opac->start(QPropertyAnimation::DeleteWhenStopped); + connect(opac, &QPropertyAnimation::finished, [=] { + coverWidget->deleteLater(); + }); +} + +void LicenseWidget::on_license_anchorClicked(const QUrl &arg1) +{ + QDesktopServices::openUrl(arg1); +} |
