diff options
Diffstat (limited to 'src/client/informationdialog/informationdialog.cpp')
-rw-r--r-- | src/client/informationdialog/informationdialog.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/client/informationdialog/informationdialog.cpp b/src/client/informationdialog/informationdialog.cpp new file mode 100644 index 0000000..bc53ee9 --- /dev/null +++ b/src/client/informationdialog/informationdialog.cpp @@ -0,0 +1,43 @@ +#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()) { + + QString ip = a.toString(); + if (ip == "::1" || ip == "127.0.0.1") { continue;} + + QLabel* label = new QLabel(tr("IP") ); + QLabel* value = new QLabel(ip); + _tableLayout->addRow(label, value); + } + + /* TODO: Add other information */ +} + |