summaryrefslogtreecommitdiffstats
path: root/src/client/informationdialog/informationdialog.cpp
blob: 275259be9282b3a837112ca0ca458bb3ab757a75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "informationdialog.h"
#include <QNetworkInterface>
#include <QHostInfo>

InformationDialog::InformationDialog()  : QDialog()
{

	/* widgets */
	_lblTitle = new QLabel(tr("<h1>system information</h1>"));
	_tableWidget = new QWidget();

	/* layouts */
	_layout = new QVBoxLayout();
	_tableLayout = new QFormLayout();

	/* */
	_tableWidget->setLayout(_tableLayout);
	_layout->addWidget(_lblTitle);
	_layout->addWidget(_tableWidget);
	this->setLayout(_layout);

	initTable();

	qDebug() << "create information dialog";
}

void InformationDialog::initTable()
{
	/* NETWORK*/
	/* hostnames */
	_tableLayout->addRow(new QLabel(tr("hostname")), new QLabel(QHostInfo::localHostName()));
	/* ips */
	for (QHostAddress a : QNetworkInterface::allAddresses()) {
		if (a == QHostAddress::Null || a == QHostAddress::Broadcast || a == QHostAddress::LocalHost || a == QHostAddress::AnyIPv6)
			continue;

		QString ip = a.toString();

		QLabel* label = new QLabel(tr("IP") );
		QLabel* value = new QLabel(ip);
		_tableLayout->addRow(label, value);
	}

	/* TODO: Add other information */
}