Skip to content

Commit

Permalink
New Design for the About Dialog (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
mominul authored Aug 25, 2020
1 parent fc95f35 commit 19622a6
Show file tree
Hide file tree
Showing 6 changed files with 376 additions and 928 deletions.
1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ sudo make install
* Mehdi Hasan Khan, for originally developing and maintaining Avro Keyboard.
* Rifat Nabi, for porting Avro Phonetic to Javascript.
* https://github.com/sarim[Sarim Khan], for writing ibus-avro.
* https://github.com/saaiful[Saiful Islam], for the icon.
* https://github.com/alex-spataru/QSimpleUpdater[QSimpleUpdater], for providing update mechanism.


Expand Down
59 changes: 7 additions & 52 deletions src/frontend/AboutDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OpenBangla Keyboard
* Copyright (C) 2016 Muhammad Mominul Huque <[email protected]>
* Copyright (C) 2020 Muhammad Mominul Huque <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <QTimer>
#include <QDesktopServices>
#include <QUrl>
#include "AboutDialog.h"
#include "ui_AboutDialog.h"

Expand All @@ -30,65 +30,20 @@ AboutDialog::AboutDialog(QWidget *parent) :

// Set version
ui->labelVer->setText(PROJECT_VERSION);

timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(scroll()));
timer->setInterval(30);
timer->start();

ui->txtLicense->setVisible(false);
ui->labelDesc->installEventFilter(this);
}

AboutDialog::~AboutDialog() {
delete ui;
delete timer;
}

void AboutDialog::scroll() {
QPoint point;
point.setX(ui->labelDesc->x());
if (ui->labelDesc->y() != -780) {
point.setY(ui->labelDesc->y() - 1);
ui->labelDesc->move(point);
} else {
point.setY(300);
ui->labelDesc->move(point);
}
}

void AboutDialog::showEvent(QShowEvent *event) {
QDialog::showEvent(event);
ui->labelDesc->move(ui->labelDesc->x(), 300);
}

void AboutDialog::on_btnClose_clicked() {
this->close();
}

void AboutDialog::on_btnLicense_toggled(bool checked) {
ui->txtLicense->setVisible(checked);
ui->labelDesc->setVisible(!checked);
if (checked) {
timer->stop();
} else {
timer->start();
}
void AboutDialog::on_lblWebsite_linkActivated(const QString &link) {
QDesktopServices::openUrl(QUrl(link));
}

bool AboutDialog::eventFilter(QObject *object, QEvent *event) {
if (object == ui->labelDesc) {
switch (event->type()) {
case QEvent::Enter:timer->stop();
break;
case QEvent::Leave:timer->start();
break;
default:break;
}
}
return QObject::eventFilter(object, event);
void AboutDialog::on_lblContrib_linkActivated(const QString &link) {
QDesktopServices::openUrl(QUrl(link));
}

void AboutDialog::on_labelDesc_linkActivated(const QString &link) {
void AboutDialog::on_lblLicense_linkActivated(const QString &link) {
QDesktopServices::openUrl(QUrl(link));
}
22 changes: 4 additions & 18 deletions src/frontend/AboutDialog.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* OpenBangla Keyboard
* Copyright (C) 2016 Muhammad Mominul Huque <[email protected]>
* Copyright (C) 2020 Muhammad Mominul Huque <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -20,9 +20,6 @@
#define ABOUTDIALOG_H

#include <QDialog>
#include <QEvent>

class QTimer;

namespace Ui {
class AboutDialog;
Expand All @@ -36,25 +33,14 @@ Q_OBJECT

~AboutDialog() override;

protected:
bool eventFilter(QObject *object, QEvent *event) override;

void showEvent(QShowEvent *event) override;

private slots:

void scroll();

void on_btnClose_clicked();

void on_btnLicense_toggled(bool checked);

void on_labelDesc_linkActivated(const QString &link);
void on_lblWebsite_linkActivated(const QString &link);
void on_lblContrib_linkActivated(const QString &link);
void on_lblLicense_linkActivated(const QString &link);

private:
Ui::AboutDialog *ui;

QTimer *timer;
};

#endif // ABOUTDIALOG_H
Loading

0 comments on commit 19622a6

Please sign in to comment.