From 69ec917b86e591166dd2ed8d7bdc998461cc2cd0 Mon Sep 17 00:00:00 2001 From: Nils Achtergarde Date: Sat, 30 Dec 2017 22:12:12 +0100 Subject: recommit of 1db778e4481eeab3e65d157240fbe963a8113f49 (tabbed about dialog with translator file seperated, but of the encoding of the TRANSLATOR file still has to be taken care of) --- aboutdialog.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ aboutdialog.h | 62 ++++++++++++++++++++++++++++++++++++ gpg4usb.pro | 4 ++- mainwindow.cpp | 39 +---------------------- mainwindow.h | 1 + release/TRANSLATORS | 11 +++++++ settingsdialog.h | 1 - 7 files changed, 170 insertions(+), 40 deletions(-) create mode 100644 aboutdialog.cpp create mode 100644 aboutdialog.h create mode 100644 release/TRANSLATORS diff --git a/aboutdialog.cpp b/aboutdialog.cpp new file mode 100644 index 0000000..3362342 --- /dev/null +++ b/aboutdialog.cpp @@ -0,0 +1,92 @@ +/* + * aboutdialog.cpp + * + * Copyright 2008 gpg4usb-team + * + * This file is part of gpg4usb. + * + * Gpg4usb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gpg4usb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gpg4usb. If not, see + */ + +#include "aboutdialog.h" + +AboutDialog::AboutDialog(QWidget *parent) + : QDialog(parent) +{ + this->setWindowTitle(tr("About ")+ qApp->applicationName()); + + QTabWidget *tabWidget = new QTabWidget; + InfoTab *infoTab = new InfoTab; + TranslatorsTab *translatorsTab = new TranslatorsTab; + + tabWidget->addTab(infoTab, tr("General")); + tabWidget->addTab(translatorsTab, tr("Translators")); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(close())); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(tabWidget); + mainLayout->addWidget(buttonBox); + setLayout(mainLayout); + + this->exec(); +} + +InfoTab::InfoTab(QWidget *parent) + : QWidget(parent) +{ + QPixmap *pixmap = new QPixmap(":gpg4usb-logo.png"); + QString *text = new QString("

" + qApp->applicationName() + " " + + qApp->applicationVersion() + "

" + + tr("
This application allows simple encryption
" + "and decryption of text messages or files.
" + "It's licensed under the GPL v3

" + "Developer:
" + "Bene, Heimer, Juergen, Nils, Ubbo

" + "If you have any questions or suggestions have a look
" + "at our " + "contact page or send a mail to our
mailing list at" + " gpg4usb@gzehn.de.") + tr("

Built with Qt ") + qVersion() + + tr(" and GPGME ") + GpgME::GpgContext::getGpgmeVersion() +"
"); + + QGridLayout *layout = new QGridLayout(); + QLabel *pixmapLabel = new QLabel(); + pixmapLabel->setPixmap(*pixmap); + layout->addWidget(pixmapLabel, 0, 0, 1, -1, Qt::AlignCenter); + QLabel *aboutLabel = new QLabel(); + aboutLabel->setText(*text); + aboutLabel->setOpenExternalLinks(true); + layout->addWidget(aboutLabel, 1, 0, 1, -1); + layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum, + QSizePolicy::Fixed), 2, 1, 1, 1); + + setLayout(layout); +} + +TranslatorsTab::TranslatorsTab(QWidget *parent) + : QWidget(parent) +{ + QFile translatorsFile; + translatorsFile.setFileName(qApp->applicationDirPath()+"/TRANSLATORS"); + translatorsFile.open(QIODevice::ReadOnly); + QByteArray inBuffer = translatorsFile.readAll(); + + QLabel *label = new QLabel(inBuffer); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->addWidget(label); + + setLayout(mainLayout); +} + diff --git a/aboutdialog.h b/aboutdialog.h new file mode 100644 index 0000000..865da96 --- /dev/null +++ b/aboutdialog.h @@ -0,0 +1,62 @@ +/* + * aboutdialog.h + * + * Copyright 2008 gpg4usb-team + * + * This file is part of gpg4usb. + * + * Gpg4usb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Gpg4usb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gpg4usb. If not, see + */ + +#ifndef __ABOUTDIALOG_H__ +#define __ABOUTDIALOG_H__ + +#include +#include +#include + +#include "gpgcontext.h" + +QT_BEGIN_NAMESPACE +class QVBoxLayout; +class QLabel; +class QTabWidget; +QT_END_NAMESPACE + +class InfoTab : public QWidget + { + Q_OBJECT + + public: + InfoTab(QWidget *parent = 0); + }; + + class TranslatorsTab : public QWidget + { + Q_OBJECT + + public: + TranslatorsTab(QWidget *parent = 0); + }; + +class AboutDialog : public QDialog +{ + Q_OBJECT + +public: + AboutDialog(QWidget *parent = 0); +}; + +#endif // __ABOUTDIALOG_H__ + diff --git a/gpg4usb.pro b/gpg4usb.pro index 87fa331..fa6a049 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -33,6 +33,7 @@ HEADERS += attachments.h \ textedit.h \ editorpage.h \ quitdialog.h \ + aboutdialog.h \ keyserverimportdialog.h \ verifynotification.h \ verifydetailsdialog.h \ @@ -59,7 +60,8 @@ SOURCES += attachments.cpp \ textedit.cpp \ editorpage.cpp \ quitdialog.cpp \ - keyserverimportdialog.cpp \ + aboutdialog.cpp \ + keyserverimportdialog.cpp \ verifynotification.cpp \ verifydetailsdialog.cpp \ verifykeydetailbox.cpp \ diff --git a/mainwindow.cpp b/mainwindow.cpp index 57afedd..67e090a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -636,44 +636,7 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::slotAbout() { - QPixmap *pixmap = new QPixmap(":gpg4usb-logo.png"); - QString *title = new QString(tr("About") +" "+ qApp->applicationName()); - QString *text = new QString("

" + qApp->applicationName() + " " - + qApp->applicationVersion() + "

" - + tr("
This application allows simple encryption
" - "and decryption of text messages or files.
" - "It's licensed under the GPL v3

" - "Developer:
" - "Bene, Heimer, Juergen, Nils, Ubbo

" - "Translation:
" - "%1

" - "If you have any questions or suggestions have a look
" - "at our " - "contact page or send a mail to our
mailing list at" - " gpg4usb@gzehn.de.").arg("Viriato/Phol (es),
Serse (it), Russell (my),
Alessandro (pt_br), Kirill (ru), Tom (vi)") - + tr("

Built with Qt ") + qVersion() - + tr(" and GPGME ") + GpgME::GpgContext::getGpgmeVersion() +"
"); - - QDialog *dialog = new QDialog(this); - dialog->setWindowTitle(*title); - QPushButton *closeButton = new QPushButton(tr("&Close")); - connect(closeButton, SIGNAL(clicked()), dialog, SLOT(close())); - - QGridLayout *layout = new QGridLayout(dialog); - QLabel *pixmapLabel = new QLabel(); - pixmapLabel->setPixmap(*pixmap); - layout->addWidget(pixmapLabel, 0, 0, 1, -1, Qt::AlignCenter); - QLabel *aboutLabel = new QLabel(); - aboutLabel->setText(*text); - aboutLabel->setOpenExternalLinks(true); - layout->addWidget(aboutLabel, 1, 0, 1, -1); - layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum, - QSizePolicy::Fixed), 2, 1, 1, 1); - layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 0, 1, 1); - layout->addWidget(closeButton, 3, 1, 1, 1); - layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1); - - dialog->exec(); + new AboutDialog(this); } void MainWindow::slotOpenTranslate() diff --git a/mainwindow.h b/mainwindow.h index 39415b2..2d1c043 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -28,6 +28,7 @@ #include "textedit.h" #include "fileencryptiondialog.h" #include "settingsdialog.h" +#include "aboutdialog.h" #include "verifynotification.h" #include "findwidget.h" #include "wizard.h" diff --git a/release/TRANSLATORS b/release/TRANSLATORS new file mode 100644 index 0000000..ec4a869 --- /dev/null +++ b/release/TRANSLATORS @@ -0,0 +1,11 @@ +Viriato/Phol (es) +Russell (my) +Alessandro (pt_br) +Kirill (ru) +Tom (vi) +Jedi (zh_tw) +Åke (sv) +Bogaczm (pl) +Ahmad (ar) +Elad (he) +Chen (zh) diff --git a/settingsdialog.h b/settingsdialog.h index 5efa1a4..20bb4d2 100755 --- a/settingsdialog.h +++ b/settingsdialog.h @@ -36,7 +36,6 @@ class QHBoxLayout; class QVBoxLayout; class QComboBox; class QCheckBox; -class QSettings; class QDebug; class QSettings; class QApplication; -- cgit v1.2.3