summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Klinger2016-09-29 13:39:46 +0200
committerChristian Klinger2016-09-29 13:39:46 +0200
commit3ccce005ff16a1eed262e194402fa27b00c56ec3 (patch)
tree5036c819f5c5f5279cc16ba76c8249b9b9090083
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.
-rw-r--r--src/client/informationdialog/informationdialog.cpp43
-rw-r--r--src/client/informationdialog/informationdialog.h26
-rw-r--r--src/client/toolbar/toolbar.cpp9
-rw-r--r--src/client/toolbar/toolbar.h2
4 files changed, 80 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
diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp
index da27fd5..0b97f31 100644
--- a/src/client/toolbar/toolbar.cpp
+++ b/src/client/toolbar/toolbar.cpp
@@ -12,6 +12,7 @@
#include "../vnc/vncwindow.h"
#include "../vnc/vncserver.h"
#include "../util/util.h"
+#include "../informationdialog/informationdialog.h"
#include "toolbar.h"
#include "ui_toolbar.h"
@@ -153,12 +154,14 @@ void Toolbar::initMenu() {
_acnConnect = new QAction(tr("&Connect..."), this);
_acnDisconnect = new QAction(tr("&Disconnect"), this);
_acnDisconnect->setEnabled(false);
+ _acnInformation = new QAction(tr("&Information..."), this);
_acnAbout= new QAction(tr("&What's this?"), this);
_acnQuit = new QAction(tr("&Quit"), this);
_menu->addAction(_acnConnect);
_menu->addAction(_acnDisconnect);
_menu->addSeparator();
+ _menu->addAction(_acnInformation);
_menu->addAction(_acnAbout);
_menu->addSeparator();
_menu->addAction(_acnQuit);
@@ -174,6 +177,7 @@ void Toolbar::initMenu() {
connect(_menu, SIGNAL(aboutToHide()), this, SLOT(hideBar()));
connect(_acnConnect, SIGNAL(triggered()), _connectWindow, SLOT(doShow()));
connect(_acnDisconnect, SIGNAL(triggered()), _connectWindow, SLOT(DoDisconnect()));
+ connect(_acnInformation, SIGNAL(triggered()), this, SLOT(showInformationDialog()));
connect(_acnAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
connect(_acnQuit, SIGNAL(triggered()), this, SLOT(exit()));
}
@@ -436,6 +440,10 @@ void Toolbar::showAboutDialog()
msgBox.exec();
}
+void Toolbar::showInformationDialog() {
+ InformationDialog* d = new InformationDialog();
+ d->exec();
+}
/***************************************************************************//**
* This slot shows the toolbar. Used after a hideBar().
*/
@@ -474,3 +482,4 @@ void Toolbar::onBtnLockDesktop() {
void Toolbar::enableLockBtn() {
_ui->btnLockDesktop->setEnabled(true);
}
+
diff --git a/src/client/toolbar/toolbar.h b/src/client/toolbar/toolbar.h
index 3b95181..fe2eb0b 100644
--- a/src/client/toolbar/toolbar.h
+++ b/src/client/toolbar/toolbar.h
@@ -42,6 +42,7 @@ private:
QMenu *_menu;
QAction *_acnDisconnect;
QAction *_acnConnect;
+ QAction *_acnInformation;
QAction *_acnAbout;
QAction *_acnQuit;
ConnectWindow *_connectWindow;
@@ -75,6 +76,7 @@ private slots:
void showBar();
void hideBar();
void showAboutDialog();
+ void showInformationDialog();
void enableLockBtn();
};