summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-05-05 18:21:02 +0200
committerBjörn Hagemeister2014-05-05 18:21:02 +0200
commit1f493bb8bab4829c6ccecde410a5504f8686b27b (patch)
tree88e2a4309a55fb1735a442afe166aa034d0b7e77
parentReniced the ui. Made styles more readable. (diff)
downloadpvs2-1f493bb8bab4829c6ccecde410a5504f8686b27b.tar.gz
pvs2-1f493bb8bab4829c6ccecde410a5504f8686b27b.tar.xz
pvs2-1f493bb8bab4829c6ccecde410a5504f8686b27b.zip
Adding flashy Symbol for working connection of client to server.
And commenting class ConnectionWindow from client.
-rw-r--r--gui/client/connect.ui33
-rw-r--r--gui/client/toolbar.ui16
-rw-r--r--icons/dark-green-check-mark.svg10
-rw-r--r--pvsclient.qrc2
-rw-r--r--src/client/connectwindow/connectwindow.cpp54
5 files changed, 105 insertions, 10 deletions
diff --git a/gui/client/connect.ui b/gui/client/connect.ui
index c702123..d334924 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 8f32658..93d2dc9 100644
--- a/gui/client/toolbar.ui
+++ b/gui/client/toolbar.ui
@@ -67,7 +67,16 @@ QCheckBox::indicator:checked:pressed {
</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="margin">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -83,7 +92,7 @@ QCheckBox::indicator:checked:pressed {
<widget class="QPushButton" name="cmdMenu">
<property name="minimumSize">
<size>
- <width>68</width>
+ <width>84</width>
<height>0</height>
</size>
</property>
@@ -91,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>
@@ -168,7 +177,6 @@ p, li { white-space: pre-wrap; }
</widget>
<resources>
<include location="../../pvsclient.qrc"/>
- <include location="../../pvsclient.qrc"/>
</resources>
<connections/>
</ui>
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 ca01404..07a1a76 100644
--- a/src/client/connectwindow/connectwindow.cpp
+++ b/src/client/connectwindow/connectwindow.cpp
@@ -17,12 +17,16 @@
#define UDPBUFSIZ 9000
#define SALT_LEN 18
+/**
+ * Initialize Connection Window.
+ * @param parent
+ */
ConnectWindow::ConnectWindow(QWidget *parent) :
QDialog(parent), _connected(false), _timerDiscover(0), _timerHide(0), _connection(NULL), _state(Idle),
_hashErrorCount(0), _hashSslErrorCount(0), _certErrorCount(0), _ipErrorCount(0), _discoveryInterval(800)
{
- setupUi(this);
- //
+ setupUi(this);
+ //
connect(cmdOK, SIGNAL(clicked()), this, SLOT(onOkClick()));
connect(cmdCancel, SIGNAL(clicked()), this, SLOT(onCancelClick()));
int tries = 10;
@@ -34,8 +38,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()
@@ -43,6 +48,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;
@@ -55,6 +65,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)
@@ -64,12 +79,16 @@ void ConnectWindow::setState(const ConnectionState state)
}
}
+/**
+ * Handle changes in state and update window.
+ */
void ConnectWindow::updateState()
{
txtName->setEnabled(_state == Idle && !_connected);
if (_connected)
{
+ lblCheckmark->setVisible(true);
cmdOK->setEnabled(true);
cmdOK->setText(tr("&Disconnect"));
lblStatus->setText(tr("Connected."));
@@ -175,18 +194,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)
{
txtName->setFocus();
@@ -196,6 +224,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)
@@ -221,11 +254,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];
@@ -269,6 +309,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);
@@ -287,6 +331,10 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state
}
}
+/**
+ * Set _connection = NULL.
+ * @param connection
+ */
void ConnectWindow::onConnectionClosed(QObject* connection)
{
_connection = NULL;