summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/client/connect.ui33
-rw-r--r--gui/client/toolbar.ui2
-rw-r--r--icons/dark-green-check-mark.svg10
-rw-r--r--pvsclient.qrc2
-rw-r--r--src/client/connectwindow/connectwindow.cpp50
5 files changed, 92 insertions, 5 deletions
diff --git a/gui/client/connect.ui b/gui/client/connect.ui
index 1cb873c..a7cb621 100644
--- a/gui/client/connect.ui
+++ b/gui/client/connect.ui
@@ -66,8 +66,8 @@
<widget class="QLabel" name="lblError">
<property name="geometry">
<rect>
- <x>10</x>
- <y>70</y>
+ <x>20</x>
+ <y>80</y>
<width>381</width>
<height>21</height>
</rect>
@@ -108,7 +108,34 @@
<bool>false</bool>
</property>
</widget>
+ <widget class="QLabel" name="lblCheckmark">
+ <property name="geometry">
+ <rect>
+ <x>120</x>
+ <y>0</y>
+ <width>221</width>
+ <height>121</height>
+ </rect>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="../../pvsclient.qrc">:/dark-green-check-mark.svg</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
</widget>
- <resources/>
+ <resources>
+ <include location="../../pvsclient.qrc"/>
+ </resources>
<connections/>
</ui>
diff --git a/gui/client/toolbar.ui b/gui/client/toolbar.ui
index 199eef2..3e39e16 100644
--- a/gui/client/toolbar.ui
+++ b/gui/client/toolbar.ui
@@ -100,7 +100,7 @@ QCheckBox::indicator:checked:pressed {
<string>Menu</string>
</property>
<property name="text">
- <string notr="true">Menu</string>
+ <string>Menu</string>
</property>
</widget>
</item>
diff --git a/icons/dark-green-check-mark.svg b/icons/dark-green-check-mark.svg
new file mode 100644
index 0000000..01c2436
--- /dev/null
+++ b/icons/dark-green-check-mark.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0"?><svg width="320" height="320" xmlns="http://www.w3.org/2000/svg">
+ <title>Green Check Mark</title>
+
+ <g>
+ <title>Layer 1</title>
+ <g id="layer1">
+ <path fill="#007f00" fill-rule="evenodd" stroke-width="0.25pt" id="path3129" d="m21,208l100,90l180,-180l-35,-35l-145,145l-60,-60l-40,40z"/>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/pvsclient.qrc b/pvsclient.qrc
index 2979d52..f4cf621 100644
--- a/pvsclient.qrc
+++ b/pvsclient.qrc
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
+ <file
+ alias="dark-green-check-mark.svg">icons/dark-green-check-mark.svg</file>
<file alias="darrow16.svg">icons/darrow16.svg</file>
<file alias="ok16.svg">icons/ok16.svg</file>
diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp
index 5215a32..61d375d 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -16,6 +16,10 @@
#define UDPBUFSIZ 9000
#define SALT_LEN 18
+/**
+ * Initialize Connection Window.
+ * @param parent
+ */
ConnectWindow::ConnectWindow(QWidget *parent) :
QWidget(parent), _ui(new Ui::ConnectWindow), _connected(false),
_timerDiscover(0), _timerHide(0), _connection(NULL), _state(Idle),
@@ -36,8 +40,9 @@ ConnectWindow::ConnectWindow(QWidget *parent) :
if (tries == 0)
qFatal("Could not bind to any UDP port for server discovery.");
}
- connect(&_discoverySocket, SIGNAL(readyRead()), this, SLOT(onUdpReadyRead()));
+ connect(&_discoverySocket, SIGNAL(readyRead()), this, SLOT(onUdpReadyRead()));
this->setState(Idle);
+ lblCheckmark->hide();
}
ConnectWindow::~ConnectWindow()
@@ -45,6 +50,11 @@ ConnectWindow::~ConnectWindow()
}
+/**
+ * Set Client as Connected (true) or Disconnected (false).
+ * After settings updateState() is called.
+ * @param connected
+ */
void ConnectWindow::setConnected(const bool connected)
{
_connected = connected;
@@ -57,6 +67,11 @@ void ConnectWindow::setConnected(const bool connected)
}
}
+/**
+ * Set current state of Client.
+ * After setting state updateState() is called.
+ * @param state
+ */
void ConnectWindow::setState(const ConnectionState state)
{
if (_state != state)
@@ -66,12 +81,16 @@ void ConnectWindow::setState(const ConnectionState state)
}
}
+/**
+ * Handle changes in state and update window.
+ */
void ConnectWindow::updateState()
{
_ui->txtName->setEnabled(_state == Idle && !_connected);
if (_connected)
{
+ _ui->lblCheckmark->setVisible(true);
_ui->cmdOK->setEnabled(true);
_ui->cmdOK->setText(tr("&Disconnect"));
_ui->lblStatus->setText(tr("Connected."));
@@ -177,18 +196,27 @@ void ConnectWindow::timerEvent(QTimerEvent* event)
killTimer(_timerHide);
_timerHide = 0;
this->hide();
+ lblCheckmark->hide();
}
else
// Unknown/Old timer id, kill it
killTimer(event->timerId());
}
+/**
+ * Close Event e and hide window.
+ * @param e
+ */
void ConnectWindow::closeEvent(QCloseEvent *e)
{
e->ignore();
this->hide();
}
+/**
+ * Gives the keyboard input focus to the input line.
+ * @param event
+ */
void ConnectWindow::showEvent(QShowEvent* event)
{
_ui->txtName->setFocus();
@@ -198,6 +226,11 @@ void ConnectWindow::showEvent(QShowEvent* event)
* Slots
*/
+/**
+ * Handle click on Connect/Disconnect button.
+ * If already connected --> Stop/disconnect.
+ * Else scanning for given sessionId.
+ */
void ConnectWindow::onOkClick()
{
if (_timerHide)
@@ -223,11 +256,18 @@ void ConnectWindow::onOkClick()
}
}
+/**
+ * Handle click on Cancel/Hide Button.
+ * Just hide the window.
+ */
void ConnectWindow::onCancelClick()
{
this->hide();
}
+/**
+ * Handle incoming service discovery packets.
+ */
void ConnectWindow::onUdpReadyRead()
{
char data[UDPBUFSIZ];
@@ -271,6 +311,10 @@ void ConnectWindow::onUdpReadyRead()
}
}
+/**
+ * Handle connection state changes and update member variables describing state.
+ * @param state
+ */
void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state)
{
bool reset = (_state == Scanning);
@@ -289,6 +333,10 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state
}
}
+/**
+ * Set _connection = NULL.
+ * @param connection
+ */
void ConnectWindow::onConnectionClosed(QObject* connection)
{
_connection = NULL;