summaryrefslogtreecommitdiffstats
path: root/src/client/informationdialog
diff options
context:
space:
mode:
authorChristian Klinger2016-09-29 13:39:46 +0200
committerChristian Klinger2016-09-29 13:39:46 +0200
commit3ccce005ff16a1eed262e194402fa27b00c56ec3 (patch)
tree5036c819f5c5f5279cc16ba76c8249b9b9090083 /src/client/informationdialog
parent[client] removed some old code regarding settings. (diff)
downloadpvs2-3ccce005ff16a1eed262e194402fa27b00c56ec3.tar.gz
pvs2-3ccce005ff16a1eed262e194402fa27b00c56ec3.tar.xz
pvs2-3ccce005ff16a1eed262e194402fa27b00c56ec3.zip
added an information dialog that displays ip and hostname.
Diffstat (limited to 'src/client/informationdialog')
-rw-r--r--src/client/informationdialog/informationdialog.cpp43
-rw-r--r--src/client/informationdialog/informationdialog.h26
2 files changed, 69 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 */
+}
+
diff --git a/src/client/informationdialog/informationdialog.h b/src/client/informationdialog/informationdialog.h
new file mode 100644
index 0000000..6bbf41c
--- /dev/null
+++ b/src/client/informationdialog/informationdialog.h
@@ -0,0 +1,26 @@
+#ifndef INFORMATION_DIALOG_H
+#define INFORMATION_DIALOG_H
+#include <QDialog>
+#include <QLayout>
+#include <QFormLayout>
+#include <QLabel>
+#include <QDebug>
+#include <QStringList>
+
+
+class InformationDialog : public QDialog {
+
+ private:
+ QLayout* _layout;
+ QFormLayout* _tableLayout;
+ QLabel* _lblTitle;
+ QWidget* _tableWidget;
+
+ void initTable();
+
+ public:
+ InformationDialog();
+
+};
+
+#endif