summaryrefslogtreecommitdiffstats
path: root/src/client/informationdialog/informationdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/informationdialog/informationdialog.cpp')
-rw-r--r--src/client/informationdialog/informationdialog.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/client/informationdialog/informationdialog.cpp b/src/client/informationdialog/informationdialog.cpp
index fb3e87c..ff96641 100644
--- a/src/client/informationdialog/informationdialog.cpp
+++ b/src/client/informationdialog/informationdialog.cpp
@@ -1,19 +1,23 @@
#include "informationdialog.h"
+
#include <QNetworkInterface>
#include <QHostInfo>
#include <QDir>
#include <QDirIterator>
+#include <QLayout>
+#include <QFormLayout>
+#include <QLabel>
InformationDialog::InformationDialog() : QDialog()
{
/* widgets */
- _lblTitle = new QLabel(tr("<h1>system information</h1>"));
- _tableWidget = new QWidget();
+ _lblTitle = new QLabel(tr("<h1>system information</h1>"), this);
+ _tableWidget = new QWidget(this);
/* layouts */
- _layout = new QVBoxLayout();
- _tableLayout = new QFormLayout();
+ _layout = new QVBoxLayout(this);
+ _tableLayout = new QFormLayout(this);
/* */
_tableWidget->setLayout(_tableLayout);
@@ -30,11 +34,12 @@ void InformationDialog::initTable()
{
/* NETWORK*/
/* hostnames */
- _tableLayout->addRow(new QLabel("<b>" + tr("hostname") + "</b>"), new QLabel(QHostInfo::localHostName()));
+ _tableLayout->addRow(new QLabel("<b>" + tr("hostname") + "</b>", this),
+ new QLabel(QHostInfo::localHostName(), this));
/* ips */
QStringList interfaceFilter;
QString bridgeDevicePath("/sys/devices/virtual/net/");
- QDirIterator it(bridgeDevicePath, QStringList() << "brif", QDir::Dirs, QDirIterator::Subdirectories);
+ QDirIterator it(bridgeDevicePath, QStringList("brif"), QDir::Dirs, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
QDir dir = it.filePath();
@@ -42,16 +47,16 @@ void InformationDialog::initTable()
interfaceFilter += dir.entryList();
}
- for (QNetworkInterface interface : QNetworkInterface::allInterfaces()) {
+ for (const auto& interface : QNetworkInterface::allInterfaces()) {
if (interfaceFilter.contains(interface.name()) || interface.flags().testFlag(QNetworkInterface::IsLoopBack)) {
qDebug() << "interface filtered: " << interface.name();
continue;
}
- _tableLayout->addRow("<u><b>" + interface.name() + "</b></u>", new QLabel(""));
+ _tableLayout->addRow("<u><b>" + interface.name() + "</b></u>", new QLabel(this));
- for (QNetworkAddressEntry entry : interface.addressEntries()) {
+ for (const auto &entry : interface.addressEntries()) {
QLabel* label;
QLabel* value;
QHostAddress hostAddr = entry.ip();
@@ -61,18 +66,17 @@ void InformationDialog::initTable()
continue;
if (hostAddr.protocol() == QAbstractSocket::IPv6Protocol) {
- label = new QLabel("IPv6");
- value = new QLabel(hostAddr.toString().split("%").first());
+ label = new QLabel("IPv6", this);
+ value = new QLabel(hostAddr.toString().split("%").first(), this);
} else {
- label = new QLabel("IPv4");
- value = new QLabel(hostAddr.toString());
+ label = new QLabel("IPv4", this);
+ value = new QLabel(hostAddr.toString(), this);
}
_tableLayout->addRow(label, value);
}
- _tableLayout->addRow("MAC", new QLabel(interface.hardwareAddress()));
+ _tableLayout->addRow("MAC", new QLabel(interface.hardwareAddress(), this));
}
/* TODO: Add other information */
-}
-
+} \ No newline at end of file