aboutsummaryrefslogtreecommitdiff
path: root/src/about.cpp
blob: 8344283ad92842b9bf5f487a299a2a21ed9e8321 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "about.h"
#include "ui_about.h"
#include <QDesktopServices>
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
#include <QUrl>
#include <utils.h>

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

    //init
    appName             = QApplication::applicationName();
    appDescription      = "WhatsApp Web clinet for Linux Desktop";
    isOpenSource        = true;
    appAuthorName       = "Keshav Bhatt";
    appAuthorEmail      = "keshavnrj@gmail.com";
    appAuthorLink       = "http://ktechpit.com";
    donateLink          = "https://paypal.me/keshavnrj/5";
    moreAppsLink        = "https://snapcraft.io/search?q=keshavnrj";

    appSourceCodeLink   = "https://github.com/keshavbhatt/whatsie";
    appRateLink         = "snap://whatsie";


    ui->appNameDesc->setText(QString("<p style=' margin-top:12px; margin-bottom:12px; margin-left:0px;"
                             " margin-right:0px; -qt-block-indent:0; text-indent:0px;'>"
                             "<span style=' font-size:18pt;'>%1</span></p>"
                             "<p style=' margin-top:12px; margin-bottom:12px; margin-left:0px;"
                             " margin-right:0px; -qt-block-indent:0; text-indent:0px;'>"
                             "%2</p>").arg(appName,appDescription));

    ui->desc2->setText(QString("<p><span style=' font-weight:600;'>Designed &amp; Developed by:</span>"
                               " %1 </p><p><span style=' font-weight:600;'>"
                               "Developer Email address: </span>%2</p>"
                               "<p><span style=' font-weight:600;'>Developer Website:</span>"
                               " %3</p>").arg(appAuthorName,appAuthorEmail,appAuthorLink));


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

    ui->debugInfoText->setHtml(utils::appDebugInfo());

    ui->debugInfoText->hide();

    ui->debugInfoButton->setText(QObject::tr("Show Debug Info"));

    if(isOpenSource == false){
        ui->source_code->hide();
    }

    connect(ui->donate,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl(donateLink));
    });

    connect(ui->rate,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl(appRateLink));
    });
    connect(ui->more_apps,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl(moreAppsLink));
    });
    connect(ui->source_code,&QPushButton::clicked,[=](){
        QDesktopServices::openUrl(QUrl(appSourceCodeLink));
    });

    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"));

        this->resize(this->width(),this->minimumHeight());
    }else{
        ui->debugInfoText->show();
        ui->debugInfoButton->setText(QObject::tr("Hide Debug Info"));
        this->adjustSize();
    }

}