aboutsummaryrefslogtreecommitdiff
path: root/src/about.cpp
blob: b48c7e2c407a47a0c1bbce821737ba0dffe5b93d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "about.h"
#include "ui_about.h"
#include <QDesktopServices>
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
#include <QTimer>
#include <QUrl>
#include <utils.h>

About::About(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::About)
{
    ui->setupUi(this);

    ui->debugInfoText->setHtml(utils::appDebugInfo());
    ui->debugInfoText->hide();
    ui->debugInfoButton->setText(QObject::tr("Show Debug Info"));


    ui->version->setText("Version: "+QApplication::applicationVersion());

    connect(ui->donate,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl("https://paypal.me/keshavnrj/10"));
    });

    connect(ui->rate,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl("snap://whatsie"));
    });
    connect(ui->more_apps,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl("https://snapcraft.io/search?q=keshavnrj"));
    });
    connect(ui->source_code,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl("https://github.com/keshavbhatt/whatsie"));
    });

    setWindowTitle(QApplication::applicationName() +" | About");

    ui->centerWidget->hide();

    QGraphicsOpacityEffect *eff = new QGraphicsOpacityEffect(this);
    ui->centerWidget->setGraphicsEffect(eff);
    QPropertyAnimation *a = new QPropertyAnimation(eff,"opacity");
    a->setDuration(1000);
    a->setStartValue(0);
    a->setEndValue(1);
    a->setEasingCurve(QEasingCurve::InCurve);
    a->start(QPropertyAnimation::DeleteWhenStopped);
    ui->centerWidget->show();
}

About::~About()
{
    delete ui;
}

void About::on_debugInfoButton_clicked()
{
    if(ui->debugInfoText->isVisible()){
        ui->debugInfoText->hide();
        ui->debugInfoButton->setText(QObject::tr("Show Debug Info"));
        //update geometry after above loop is finished
        QTimer::singleShot(300,this,[=]{
            this->resize(this->width(),this->minimumHeight());
        });
    }else{
        ui->debugInfoText->show();
        ui->debugInfoButton->setText(QObject::tr("Hide Debug Info"));
        this->adjustSize();
    }

}