summaryrefslogtreecommitdiffstats
path: root/src/server/connectionframe/connectionframe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/connectionframe/connectionframe.cpp')
-rw-r--r--src/server/connectionframe/connectionframe.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp
index 90d72da..205433b 100644
--- a/src/server/connectionframe/connectionframe.cpp
+++ b/src/server/connectionframe/connectionframe.cpp
@@ -15,6 +15,7 @@
#include "connectionframe.h"
+#include "../mainwindow/mainwindow.h"
#include "../net/client.h"
#include <QPixmap>
#include <QImage>
@@ -59,14 +60,17 @@ static QString style_disconnected(
static QIcon *term = NULL, *cam = NULL, *eye = NULL, *lock = NULL;
+bool ConnectionFrame::paintDisabled = false;
+
/**
* Initialize frame for connected client.
* @param parent
* @param width
* @param height
*/
-ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) :
- QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _isSelected(false), _isTutor(false)
+ConnectionFrame::ConnectionFrame(MainWindow* main, QWidget *parent) :
+ QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _isSelected(false), _isTutor(false),
+ _mainWindow(main)
{
//defines the ui-stuff
@@ -116,7 +120,6 @@ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) :
_mainLayout->addWidget(_lblUserName);
_mainLayout->addWidget(_lblHostName);
this->setLayout(_mainLayout);
- this->setSize(width, height);
this->updateAppearance();
this->updateLabels();
}
@@ -129,6 +132,25 @@ ConnectionFrame::~ConnectionFrame()
_iconLayout->deleteLater();
}
+void ConnectionFrame::setGridPosition(const QPoint& pos)
+{
+ _gridPosition = pos;
+ updateGeometry();
+}
+
+void ConnectionFrame::setGridPosition(int x, int y)
+{
+ setGridPosition(QPoint(x, y));
+}
+
+void ConnectionFrame::updateGeometry()
+{
+ const QRect rect = _mainWindow->calcFrameGeometry(this);
+ setGeometry(rect);
+ if (this->_client == NULL)
+ showDefaultThumb();
+}
+
/**
* Add icon to connection frame.
* @param icon
@@ -145,18 +167,6 @@ QLabel* ConnectionFrame::addIcon(const QIcon* icon)
}
/**
- * Set size of connectionFrame.
- * @param width
- * @param height
- */
-void ConnectionFrame::setSize(int width, int height)
-{
- this->resize(width, height);
- if (this->_client == NULL)
- showDefaultThumb();
-}
-
-/**
* Assign client to connectionFrame.
* Set hostName, userName and tutor status to display.
* @param client
@@ -216,7 +226,7 @@ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event)
QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor));
// Only recognize a move if the distance is larger than _startDragDistance
if ((this->pos() - _previousPosition).manhattanLength() > _startDragDistance ) {
- emit frameMoved(true, this);
+ emit frameMoved(this);
} else {
qDebug("Clicked");
move(_previousPosition);
@@ -292,6 +302,9 @@ void ConnectionFrame::mouseDoubleClickEvent(QMouseEvent* event)
*/
void ConnectionFrame::paintEvent(QPaintEvent *event)
{
+ if (ConnectionFrame::paintDisabled) {
+ return;
+ }
QGroupBox::paintEvent(event);
if (_remoteScreen.isNull()) {
return;