summaryrefslogtreecommitdiffstats
path: root/src/server/connectionframe/connectionframe.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-04-30 18:26:54 +0200
committerManuel Schneider2014-04-30 18:26:54 +0200
commitaead62193f935db3251606358dd4ef1a80cbc83f (patch)
treee4c68d8687b4a0ca4c1218439277cd5d8923d045 /src/server/connectionframe/connectionframe.cpp
parentMerge branch 'bastelstube' (diff)
downloadpvs2-aead62193f935db3251606358dd4ef1a80cbc83f.tar.gz
pvs2-aead62193f935db3251606358dd4ef1a80cbc83f.tar.xz
pvs2-aead62193f935db3251606358dd4ef1a80cbc83f.zip
Reniced the ui. Made styles more readable.
Diffstat (limited to 'src/server/connectionframe/connectionframe.cpp')
-rw-r--r--src/server/connectionframe/connectionframe.cpp55
1 files changed, 40 insertions, 15 deletions
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp
index b5b754f..1c7eaff 100644
--- a/src/server/connectionframe/connectionframe.cpp
+++ b/src/server/connectionframe/connectionframe.cpp
@@ -20,9 +20,28 @@
#include <QImage>
#include <cassert>
-static QIcon *term = NULL, *cam = NULL, *eye = NULL;
+static QString style_student(
+ "QLabel{ background-color: #919191; border-radius: 2px; color: black;} \
+ QGroupBox { background-color: #919191; margin: 2px; border-radius: 4px}"
+);
+static QString style_tutor(
+ "QLabel{ background-color: #70C670; border-radius: 2px; color: black;} \
+ QGroupBox { background-color: #70C670; margin: 2px; border-radius: 4px}"
+);
+static QString style_selectedStudent(
+ "QLabel{ background-color: #6C8CD5; border-radius: 2px; color: black; } \
+ QGroupBox { background-color: #919191; margin: 0px; border-radius: 4px; border: 2px dashed #6C8CD5;}"
+);
+static QString style_selectedTutor(
+ "QLabel{ background-color: #6C8CD5; border-radius: 2px; color: black;} \
+ QGroupBox { background-color: #70C670; margin: 0px; border-radius: 4px; border: 2px dashed #6C8CD5;}"
+);
+static QString style_disconnected(
+ "QLabel{ background-color: #919191; color: black; } \
+ QGroupBox { background-color: #7F7F7F; margin: 1px; border-radius: 4px}"
+);
-static QString backgroundStyle("background-color: %1; margin: 1px; border: 1px solid black; border-radius: 6px");
+static QIcon *term = NULL, *cam = NULL, *eye = NULL;
/**
* Initialize frame for connected client.
@@ -49,18 +68,16 @@ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) :
_mainLayout->setSpacing(1);
_mainLayout->setMargin(3);
_mainLayout->setAlignment(Qt::AlignHCenter);
+ this->setStyleSheet(style_student);
_iconLayout = new QBoxLayout(QBoxLayout::RightToLeft, NULL);
_iconLayout->setSpacing(1);
_iconLayout->setMargin(3);
_lblUserName = new QLabel("Test", this);
- _lblUserName->setStyleSheet(QString::fromUtf8("background-color: white; color: black;"));
_lblUserName->setAlignment(Qt::AlignHCenter);
- //_lblUsername->resize(_lblUsername->width(), _lblUsername->font().pixelSize());
_lblHostName = new QLabel("PC", this);
- _lblHostName->setStyleSheet(QString::fromUtf8("background-color: white; color: black;"));
_lblHostName->setAlignment(Qt::AlignHCenter);
_icoCam = addIcon(cam);
@@ -131,6 +148,7 @@ void ConnectionFrame::assignClient(Client* client)
_lblHostName->setText(client->ip());
_lblHostName->setToolTip(client->host());
_lblUserName->setText(client->name());
+ _lblUserName->show();
showDefaultThumb();
if (_timerId == 0)
_timerId = startTimer(1000 + qrand() % 150);
@@ -304,9 +322,9 @@ void ConnectionFrame::updateAppearance()
{
// Unconnected Frame
if (_selected)
- this->setStyleSheet(backgroundStyle.arg("rgb(140, 140, 170)"));
+ this->setStyleSheet(style_selectedStudent);
else
- this->setStyleSheet(backgroundStyle.arg("rgb(140, 140, 140)"));
+ this->setStyleSheet(style_disconnected);
for (QList<QLabel*>::iterator it(_icons.begin()); it != _icons.end(); ++it)
(**it).hide();
return;
@@ -316,14 +334,20 @@ void ConnectionFrame::updateAppearance()
// Normal client, no special stuff active
- if (_selected && _isTutor)
- this->setStyleSheet(backgroundStyle.arg("rgb(255, 220, 180)"));
- else if (_isTutor)
- this->setStyleSheet(backgroundStyle.arg("rgb(255, 180, 180)"));
- else if (_selected)
- this->setStyleSheet(backgroundStyle.arg("rgb(180, 180, 210)"));
- else
- this->setStyleSheet(backgroundStyle.arg("rgb(180, 180, 180)"));
+ if (_selected && _isTutor){
+ this->setStyleSheet(style_selectedTutor);
+ }
+ else if (_isTutor){
+ this->setStyleSheet(style_tutor);
+ }
+ else if (_selected){
+ this->setStyleSheet(style_selectedStudent);
+
+ }
+ else{
+ this->setStyleSheet(style_student);
+
+ }
}
/*
@@ -343,6 +367,7 @@ void ConnectionFrame::onClientDisconnected()
}
_client = NULL;
_lblUserName->setText(QString());
+ _lblUserName->hide();
showDefaultThumb();
this->updateAppearance();
}