eb0afcee7c8dcc42157d9f363659b399a0d53492
[dhcpcd-ui] / src / dhcpcd-qt / dhcpcd-about.cpp
1 #include <QDialog>
2 #include <QIcon>
3 #include <QLabel>
4 #include <QPixmap>
5 #include <QPushButton>
6 #include <QVBoxLayout>
7
8 #include "config.h"
9 #include "dhcpcd-about.h"
10 #include "dhcpcd-qt.h"
11
12 DhcpcdAbout::DhcpcdAbout(DhcpcdQt *parent)
13     : QDialog(NULL)
14 {
15         QVBoxLayout *layout;
16
17         this->parent = parent;
18         resize(300, 200);
19         setWindowTitle("About dhcpcd-qt");
20         layout = new QVBoxLayout(this);
21
22         QIcon icon = DhcpcdQt::getIcon("status", "network-transmit-receive");
23         QPixmap picon = icon.pixmap(48, 48);
24         iconLabel = new QLabel(this);
25         iconLabel->setAlignment(Qt::AlignCenter);
26         iconLabel->setPixmap(picon);
27         layout->addWidget(iconLabel);
28
29         aboutLabel = new QLabel("<h1>Network Configurator "  VERSION "</h1>", this);
30         aboutLabel->setAlignment(Qt::AlignCenter);
31         layout->addWidget(aboutLabel);
32         partLabel = new QLabel("Part of the dhcpcd project", this);
33         partLabel->setAlignment(Qt::AlignCenter);
34         layout->addWidget(partLabel);
35         copyrightLabel = new QLabel("Copyright (c) 2009-2014 Roy Marples", this);
36         copyrightLabel->setAlignment(Qt::AlignCenter);
37         layout->addWidget(copyrightLabel);
38         urlLabel = new QLabel(
39             "<a href=\"http://roy.marples.name/projects/dhcpcd\">"
40             "dhcpcd Website"
41             "</a>",
42             this);
43         urlLabel->setAlignment(Qt::AlignCenter);
44         urlLabel->setOpenExternalLinks(true);
45         layout->addWidget(urlLabel);
46
47         closeButton = new QPushButton("Close", this);
48         closeButton->setIcon(QIcon::fromTheme("window-close"));
49         layout->addWidget(closeButton);
50         connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
51 }
52
53 void DhcpcdAbout::closeEvent(QCloseEvent *e)
54 {
55
56         parent->dialogClosed(this);
57         QDialog::closeEvent(e);
58 }