File indexing completed on 2024-05-12 04:41:11

0001 /* AtCore KDE Libary for 3D Printers
0002     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003     SPDX-FileCopyrightText: 2017-2018 Chris Rizzitello <rizzitello@kde.org>
0004 */
0005 
0006 #include <QCoreApplication>
0007 #include <QLabel>
0008 #include <QLayout>
0009 #include <QPushButton>
0010 #include <QString>
0011 #include <QStyle>
0012 
0013 #include "about.h"
0014 
0015 About::About(QWidget *parent)
0016     : QDialog(parent)
0017 {
0018     setWindowTitle(QStringLiteral("About Atcore"));
0019     setWindowIcon(QIcon::fromTheme(QStringLiteral("help-about"), style()->standardIcon(QStyle::SP_MessageBoxInformation)));
0020 
0021     auto lbl_version = new QLabel(tr("Version: %1").arg(QCoreApplication::applicationVersion()), this);
0022     auto lbl_qt_version = new QLabel(tr("Using Qt: %1").arg(QString::fromLatin1(qVersion())), this);
0023     auto lbl_authors = new QLabel(tr("Authors:\n"
0024                                      "  Chris Rizzitello <rizzitello@kde.org>\n"
0025                                      "  Patrick José Pereira <patrickjp@kde.org>\n"
0026                                      "  Lays Rodrigues <lays.rodrigues@kde.org>\n"
0027                                      "  Tomaz Canabrava <tcanabrava@kde.org>"),
0028                                   this);
0029 
0030     auto lbl_icon = new QLabel(this);
0031     lbl_icon->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
0032     lbl_icon->setScaledContents(true);
0033     lbl_icon->setPixmap(QPixmap(QStringLiteral(":/icon/atcore")));
0034 
0035     auto btn_close = new QPushButton(tr("Close"), this);
0036     connect(btn_close, &QPushButton::clicked, this, &QDialog::close);
0037 
0038     auto versionInfo = new QVBoxLayout;
0039     versionInfo->addWidget(lbl_version);
0040     versionInfo->addWidget(lbl_qt_version);
0041 
0042     auto topLayout = new QVBoxLayout;
0043     topLayout->setContentsMargins(0, 0, 0, 0);
0044     topLayout->addWidget(lbl_icon);
0045     topLayout->addItem(versionInfo);
0046 
0047     auto mainLayout = new QVBoxLayout;
0048     mainLayout->addItem(topLayout);
0049     mainLayout->addWidget(lbl_authors);
0050     mainLayout->addWidget(btn_close);
0051 
0052     setLayout(mainLayout);
0053 }