From 88837708068dbbaa6c965a8026ddf80487b2d7d8 Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Sat, 13 Oct 2018 19:11:46 +1100 Subject: Add licenses --- installer/licensewidget.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 installer/licensewidget.cpp (limited to 'installer/licensewidget.cpp') 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 +#include + +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); +} -- cgit v1.2.3