-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Design for the About Dialog (#155)
- Loading branch information
Showing
6 changed files
with
376 additions
and
928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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" | ||
|
||
|
@@ -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)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -20,9 +20,6 @@ | |
#define ABOUTDIALOG_H | ||
|
||
#include <QDialog> | ||
#include <QEvent> | ||
|
||
class QTimer; | ||
|
||
namespace Ui { | ||
class AboutDialog; | ||
|
@@ -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 |
Oops, something went wrong.