/*************************************************************************** * This file is part of netctl-gui * * * * netctl-gui 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. * * * * netctl-gui 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 netctl-gui. If not, see http://www.gnu.org/licenses/ * ***************************************************************************/ #include "aboutwindow.h" #include "ui_aboutwindow.h" #include #include #include #include "version.h" AboutWindow::AboutWindow(QWidget *parent, const bool debugCmd) : QMainWindow(parent), ui(new Ui::AboutWindow), debug(debugCmd) { ui->setupUi(this); createUi(); } AboutWindow::~AboutWindow() { if (debug) qDebug() << "[AboutWindow]" << "[~AboutWindow]"; delete uiAbout; delete ui; } void AboutWindow::createText() { if (debug) qDebug() << "[AboutWindow]" << "[createText]"; uiAbout->label_name->setText(QString(NAME)); uiAbout->label_version->setText(QApplication::translate("AboutWindow", "Version %1\n(build date %2)") .arg(QString(VERSION)).arg(QString(BUILD_DATE))); uiAbout->label_description->setText(QApplication::translate("AboutWindow", "Qt-based graphical interface for netctl.")); uiAbout->label_links->setText(QApplication::translate("AboutWindow", "Links:") + QString("
") + QString("%2
").arg(QString(HOMEPAGE)).arg(QApplication::translate("AboutWindow", "Homepage")) + QString("%2
").arg(QString(REPOSITORY)).arg(QApplication::translate("AboutWindow", "Repository")) + QString("%2
").arg(QString(BUGTRACKER)).arg(QApplication::translate("AboutWindow", "Bugtracker")) + QString("%2
").arg(QString(TRANSLATION)).arg(QApplication::translate("AboutWindow", "Translation issue")) +\ QString("%2").arg(QString(AUR_PACKAGES)).arg(QApplication::translate("AboutWindow", "AUR packages"))); uiAbout->label_license->setText(QString("© %1 %2
").arg(QString(DATE)).arg(QString(AUTHOR)) + QApplication::translate("AboutWindow", "This software is licensed under %1").arg(QString(LICENSE)) + QString("
")); } void AboutWindow::createUi() { if (debug) qDebug() << "[AboutWindow]" << "[createUi]"; QWidget *aboutWidget = new QWidget(); uiAbout = new Ui::About; uiAbout->setupUi(aboutWidget); ui->verticalLayout->addWidget(aboutWidget); createText(); QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox->addButton(QDialogButtonBox::Close); ui->verticalLayout->addWidget(buttonBox); connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close())); } // ESC press event void AboutWindow::keyPressEvent(QKeyEvent *pressedKey) { if (debug) qDebug() << "[AboutWindow]" << "[keyPressEvent]"; if (pressedKey->key() == Qt::Key_Escape) close(); }