Make the about dialogs more similar.
[dhcpcd-ui] / src / dhcpcd-qt / dhcpcd-about.cpp
index 11b44a2ded866dc2ad89657ed844e476591725c2..d900102e931445a8e96c11b2a894029153bd916a 100644 (file)
  */
 
 #include <QDialog>
+#include <QHBoxLayout>
 #include <QIcon>
 #include <QLabel>
 #include <QPixmap>
 #include <QPushButton>
+#include <QSpacerItem>
 #include <QVBoxLayout>
 
 #include "config.h"
 #include "dhcpcd-qt.h"
 
 DhcpcdAbout::DhcpcdAbout(DhcpcdQt *parent)
-    : QDialog(NULL)
+    : QDialog(parent)
 {
-       QVBoxLayout *layout;
-
        this->parent = parent;
+       QVBoxLayout *layout;
        resize(300, 200);
-       setWindowTitle("About dhcpcd-qt");
+       setWindowIcon(DhcpcdQt::getIcon("status", "network-transmit-receive"));
+       setWindowTitle(tr("About Network Configurator"));
+       QPoint p = QCursor::pos();
+       move(p.x(), p.y());
+
        layout = new QVBoxLayout(this);
 
        QIcon icon = DhcpcdQt::getIcon("status", "network-transmit-receive");
-       QPixmap picon = icon.pixmap(48, 48);
+       QPixmap picon = icon.pixmap(32, 32);
        iconLabel = new QLabel(this);
        iconLabel->setAlignment(Qt::AlignCenter);
        iconLabel->setPixmap(picon);
@@ -55,7 +60,7 @@ DhcpcdAbout::DhcpcdAbout(DhcpcdQt *parent)
        aboutLabel = new QLabel("<h1>Network Configurator "  VERSION "</h1>", this);
        aboutLabel->setAlignment(Qt::AlignCenter);
        layout->addWidget(aboutLabel);
-       partLabel = new QLabel("Part of the dhcpcd project", this);
+       partLabel = new QLabel(tr("Part of the dhcpcd project"), this);
        partLabel->setAlignment(Qt::AlignCenter);
        layout->addWidget(partLabel);
        copyrightLabel = new QLabel("Copyright (c) 2009-2014 Roy Marples", this);
@@ -70,9 +75,12 @@ DhcpcdAbout::DhcpcdAbout(DhcpcdQt *parent)
        urlLabel->setOpenExternalLinks(true);
        layout->addWidget(urlLabel);
 
-       closeButton = new QPushButton("Close", this);
+       QHBoxLayout *hbox = new QHBoxLayout();
+       layout->addLayout(hbox);
+       hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
+       closeButton = new QPushButton(tr("Close"));
        closeButton->setIcon(QIcon::fromTheme("window-close"));
-       layout->addWidget(closeButton);
+       hbox->addWidget(closeButton);
        connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 }