Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
Public Member Functions | Protected Slots | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MainWindow Class Reference

Initializing MainWindow. More...

#include "mainwindow.h"

+ Inheritance diagram for MainWindow:
+ Collaboration diagram for MainWindow:

Public Member Functions

 MainWindow (QWidget *parent=nullptr)
 Initialize MainWindow and ListenServer. More...
 
 ~MainWindow () override
 
QRect calcFrameGeometry (ConnectionFrame *frame) const
 

Protected Slots

void disableButtons ()
 DisableButtons. More...
 
void enableButtons ()
 EnableButtons. More...
 
void clientCountChanged ()
 this function determines if the number of clients in exam mode comprise more than 50%. More...
 
void onSessionNameClick ()
 Show session name, after it was clicked on. More...
 
void onSessionNameUpdate ()
 Update session name. More...
 
void onDeleteClient ()
 
void onButtonLock (bool checked)
 Handle button to lock or unlock screens of client(s). More...
 
void onButtonLockSingle ()
 
void onButtonStudentToTutor ()
 Handle projection from one student to tutor. More...
 
void onButtonStudentToTutorExclusive ()
 Handle projection from one student to tutor, lock everyone else. More...
 
void onButtonTutorToAll ()
 Handle projection from tutor to all. More...
 
void onButtonTutorToStudent ()
 Handle the projection from Tutor to specific student. More...
 
void onButtonStopProjection ()
 Handle Button StopProjection. More...
 
void onButtonSetAsTutor ()
 Handle button to set specific client as tutor. More...
 
void onButtonReloadRoomConfig ()
 
void onReloadRoomOk ()
 
void onReloadRoomCancel ()
 
void onButtonExit ()
 On button exit, close application. More...
 
void onButtonHelp ()
 Display popup which explains possible actions about the buttons. More...
 
void onFrameMoving (ConnectionFrame *frame)
 
void onFrameDropped (ConnectionFrame *frame)
 Place frame to from user specified position. More...
 
void onFrameClicked (ConnectionFrame *frame)
 Mark given frame after it was clicked on. More...
 
void onClientConnected (Client *client)
 Handle from ListenServer signaled new client connection. More...
 
void onClientAuthenticating (Client *client, ClientLogin *request)
 Authenticate new Client client. More...
 
void onClientAuthenticated (Client *client)
 New client was authenticated, make several checks. More...
 
void onVncServerStateChange (Client *client)
 Handle if VNC Server State has changed. More...
 
void onVncClientStateChange (Client *client)
 Handle VNC client state change. More...
 

Private Types

enum  Mode {
  Mode::Broadcast, Mode::Multicast, Mode::Unicast, Mode::LockedUnicast,
  Mode::None
}
 

Private Member Functions

QPoint closestFreeSlot (const QPoint &preferredPixels, const ConnectionFrame *toIgnore)
 : find the closest available frame. More...
 
void placeFrameInFreeSlot (ConnectionFrame *frame, QPoint preferred=QPoint(-1,-1))
 
ConnectionFramecreateFrame (const QString &computerId=QString(), const QPoint *gridPosition=nullptr, bool fromRoomplan=false)
 Create new Frame. More...
 
void startVncServerIfNecessary (int from)
 MainWindow::startVncServerIfNecessary. More...
 
void tellClientCurrentSituation (Client *client)
 Tells the new client the current situation in class room. More...
 
void reset (bool lock=false)
 reset More...
 
ClientgetClientFromId (int id)
 Returns connected client which belongs to given id. More...
 
ConnectionFramegetTutorFrame ()
 Return the Frame, which is currently beeing Tutor. More...
 
ConnectionFramegetSelectedFrame ()
 Return the Frame, which is currently selected by user. More...
 
void closeEvent (QCloseEvent *e) override
 Handle closeEvent. More...
 
void changeEvent (QEvent *e) override
 Change Event. More...
 
void resizeEvent (QResizeEvent *e) override
 Resize event. More...
 
void mouseReleaseEvent (QMouseEvent *e) override
 Handle Mouse Release Event. More...
 
int getTileWidthPx () const
 
int getTileHeightPx () const
 
void updateContextButtonStates ()
 
void reloadCurrentRoom ()
 
void vncOneOnOne (bool exclusive)
 

Private Attributes

Ui::MainWindow * ui
 
SessionNameWindow_sessionNameWindow
 
HelpWindow_helpWindow
 
ReloadRoomWindow_reloadWindow
 
ClickLabel_sessionNameLabel
 
int _tilesX
 
int _tilesY
 
QImage * _backgroundImage = nullptr
 
QLabel_examModeLabel = nullptr
 
QTimer * _buttonLockTimer
 
QList< QAction * > _lockingButtons
 
enum MainWindow::Mode _mode
 
int _streamingSource {}
 
QList< ConnectionFrame * > _clientFrames
 
QWidget_dropMarker
 
int _lastClientCount {}
 

Static Private Attributes

static const qint64 BUTTON_BLOCK_TIME = 2000
 

Detailed Description

Initializing MainWindow.

Handle ButtonEvents and initialize ListenServer.

Definition at line 27 of file mainwindow.h.

Member Enumeration Documentation

enum MainWindow::Mode
strongprivate
Enumerator
Broadcast 
Multicast 
Unicast 
LockedUnicast 
None 

Definition at line 57 of file mainwindow.h.

Constructor & Destructor Documentation

MainWindow::MainWindow ( QWidget parent = nullptr)
explicit

Initialize MainWindow and ListenServer.

Parameters
ipListUrl
parent

Definition at line 57 of file mainwindow.cpp.

+ Here is the call graph for this function:

MainWindow::~MainWindow ( )
override

Definition at line 204 of file mainwindow.cpp.

Member Function Documentation

QRect MainWindow::calcFrameGeometry ( ConnectionFrame frame) const

Definition at line 814 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::changeEvent ( QEvent *  e)
overrideprivate

Change Event.

Parameters
e

Definition at line 419 of file mainwindow.cpp.

void MainWindow::clientCountChanged ( )
protectedslot

this function determines if the number of clients in exam mode comprise more than 50%.

In that case the whole manager switches to exam mode, disabling many features in the toolbar

Definition at line 160 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::closeEvent ( QCloseEvent *  e)
overrideprivate

Handle closeEvent.

If user calls closing MainWindow, close, else ignore.

Parameters
e

Definition at line 404 of file mainwindow.cpp.

QPoint MainWindow::closestFreeSlot ( const QPoint &  preferredPixels,
const ConnectionFrame toIgnore 
)
private

: find the closest available frame.

Closest: smallest Euclidean distance from center to center

'Algorithm': ideally, go in circles around the preferred point until you find a free spot. Lazy way: store all free positions in an array and find later there the closest (<- that's what I do)

Parameters
preferredin Pixels!
toIgnore,ignorethis connectionframe when considering free slots
Returns
the free slot

Definition at line 232 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ConnectionFrame * MainWindow::createFrame ( const QString &  computerId = QString(),
const QPoint *  gridPosition = nullptr,
bool  fromRoomplan = false 
)
private

Create new Frame.

Create new frame and add to current available frame list. Also connect signals frameMoved() and clicked() with slots.

Returns
ConnectionFrame*

Definition at line 312 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::disableButtons ( )
protectedslot

DisableButtons.

Definition at line 1260 of file mainwindow.cpp.

+ Here is the caller graph for this function:

void MainWindow::enableButtons ( )
protectedslot

EnableButtons.

Definition at line 1271 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Client * MainWindow::getClientFromId ( int  id)
private

Returns connected client which belongs to given id.

Iterating over ConnectionFrames and comparing id to given id.

Parameters
id
Returns
Client with given id, if not nullptr.

Definition at line 354 of file mainwindow.cpp.

+ Here is the caller graph for this function:

ConnectionFrame * MainWindow::getSelectedFrame ( )
private

Return the Frame, which is currently selected by user.

Iterating over all ConnectionFrame and looking for flag _isSelected.

Returns
Frame with flag _isSelected = true, else nullptr if no frame is selected.

Definition at line 386 of file mainwindow.cpp.

+ Here is the caller graph for this function:

int MainWindow::getTileHeightPx ( ) const
private

Definition at line 809 of file mainwindow.cpp.

+ Here is the caller graph for this function:

int MainWindow::getTileWidthPx ( ) const
private

Definition at line 803 of file mainwindow.cpp.

+ Here is the caller graph for this function:

ConnectionFrame * MainWindow::getTutorFrame ( )
private

Return the Frame, which is currently beeing Tutor.

Iterating over all ConnectionFrames, and looking for flag _isTutor.

Returns
Frame with flag _isTutor = true, else nullptr if no Tutor is available.

Definition at line 371 of file mainwindow.cpp.

+ Here is the caller graph for this function:

void MainWindow::mouseReleaseEvent ( QMouseEvent *  e)
overrideprivate

Handle Mouse Release Event.

Check if click was inside the frame and if that is the case, set the selection of each connected client to false.

Parameters
e

Definition at line 542 of file mainwindow.cpp.

+ Here is the call graph for this function:

void MainWindow::onButtonExit ( )
protectedslot

On button exit, close application.

Definition at line 1039 of file mainwindow.cpp.

+ Here is the caller graph for this function:

void MainWindow::onButtonHelp ( )
protectedslot

Display popup which explains possible actions about the buttons.

Definition at line 826 of file mainwindow.cpp.

+ Here is the caller graph for this function:

void MainWindow::onButtonLock ( bool  checked)
protectedslot

Handle button to lock or unlock screens of client(s).

If already locked, do nothing, else lock or unlock the clients, except the tutor and the manager running machine.

Parameters
checked

Definition at line 1001 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonLockSingle ( )
protectedslot

Definition at line 1007 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonReloadRoomConfig ( )
protectedslot

Definition at line 698 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonSetAsTutor ( )
protectedslot

Handle button to set specific client as tutor.

Unset active tutor and set selected client, if not inactive, as new tutor.

Definition at line 1048 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonStopProjection ( )
protectedslot

Handle Button StopProjection.

Set ProjectionSource of each client to false, stop the active VNC Server and the active VNC Client(s) and unlock all screens.

Definition at line 989 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonStudentToTutor ( )
protectedslot

Handle projection from one student to tutor.

Definition at line 921 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonStudentToTutorExclusive ( )
protectedslot

Handle projection from one student to tutor, lock everyone else.

Definition at line 930 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonTutorToAll ( )
protectedslot

Handle projection from tutor to all.

Get the client who is tutor and set the projectionSource of all clients, except the tutor ones, to false.

Definition at line 836 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onButtonTutorToStudent ( )
protectedslot

Handle the projection from Tutor to specific student.

Set the client who is tutor as from and the selected client as to.

Definition at line 868 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onClientAuthenticated ( Client client)
protectedslot

New client was authenticated, make several checks.

Check if new clients ip already exists, if yes –> not necessary to create new clientFrame. if not –> create a new one and adapt this one to current situation in class room(projection / lock screen). Check if avctiv tutor is available, if not –> check if new client is possible tutor.

Parameters
client

Definition at line 1140 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onClientAuthenticating ( Client client,
ClientLogin request 
)
protectedslot

Authenticate new Client client.

Check if incoming client ip already exists, if yes –> return. Check if same name of client already exist, if yes –> name new client as name(x). x = number of clients with the same name.

Parameters
client
request

Definition at line 1093 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onClientConnected ( Client client)
protectedslot

Handle from ListenServer signaled new client connection.

Parameters
client

Definition at line 1077 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onDeleteClient ( )
protectedslot

Definition at line 1281 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onFrameClicked ( ConnectionFrame frame)
protectedslot

Mark given frame after it was clicked on.

Parameters
frame

Definition at line 612 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onFrameDropped ( ConnectionFrame connectionFrame)
protectedslot

Place frame to from user specified position.

Should be called when a connectionFrame is dropped during the "drag-n-drop".

Definition at line 601 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onFrameMoving ( ConnectionFrame frame)
protectedslot

Definition at line 585 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onReloadRoomCancel ( )
protectedslot

Definition at line 709 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onReloadRoomOk ( )
protectedslot

Definition at line 772 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onSessionNameClick ( )
protectedslot

Show session name, after it was clicked on.

Definition at line 632 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onSessionNameUpdate ( )
protectedslot

Update session name.

Definition at line 640 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onVncClientStateChange ( Client client)
protectedslot

Handle VNC client state change.

Check if any vnc client is in use, and if that is not the case, stop VNC Server.

Parameters
client
lastProjectionSource

Definition at line 1222 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::onVncServerStateChange ( Client client)
protectedslot

Handle if VNC Server State has changed.

Check if VNC server has been started/stopped on some client and start VNC server/reset pending VNC projection information.

Parameters
client

Definition at line 1172 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::placeFrameInFreeSlot ( ConnectionFrame frame,
QPoint  preferred = QPoint(-1, -1) 
)
private

Definition at line 300 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::reloadCurrentRoom ( )
private

Definition at line 717 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::reset ( bool  lock = false)
private

reset

Definition at line 562 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::resizeEvent ( QResizeEvent *  e)
overrideprivate

Resize event.

Parameters
e

Definition at line 450 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::startVncServerIfNecessary ( int  from)
private

MainWindow::startVncServerIfNecessary.

Parameters
from

Definition at line 675 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::tellClientCurrentSituation ( Client client)
private

Tells the new client the current situation in class room.

Set the specific parameters like projection source or lock screen.

Parameters
client

Definition at line 334 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::updateContextButtonStates ( )
private

Definition at line 515 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MainWindow::vncOneOnOne ( bool  exclusive)
private

Definition at line 935 of file mainwindow.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

QImage* MainWindow::_backgroundImage = nullptr
private

Definition at line 48 of file mainwindow.h.

QTimer* MainWindow::_buttonLockTimer
private

Definition at line 52 of file mainwindow.h.

QList<ConnectionFrame*> MainWindow::_clientFrames
private

Definition at line 67 of file mainwindow.h.

QWidget* MainWindow::_dropMarker
private

Definition at line 68 of file mainwindow.h.

QLabel* MainWindow::_examModeLabel = nullptr
private

Definition at line 49 of file mainwindow.h.

HelpWindow* MainWindow::_helpWindow
private

Definition at line 43 of file mainwindow.h.

int MainWindow::_lastClientCount {}
private

Definition at line 70 of file mainwindow.h.

QList<QAction*> MainWindow::_lockingButtons
private

Definition at line 53 of file mainwindow.h.

enum MainWindow::Mode MainWindow::_mode
private
ReloadRoomWindow* MainWindow::_reloadWindow
private

Definition at line 44 of file mainwindow.h.

ClickLabel* MainWindow::_sessionNameLabel
private

Definition at line 45 of file mainwindow.h.

SessionNameWindow* MainWindow::_sessionNameWindow
private

Definition at line 42 of file mainwindow.h.

int MainWindow::_streamingSource {}
private

Definition at line 65 of file mainwindow.h.

int MainWindow::_tilesX
private

Definition at line 46 of file mainwindow.h.

int MainWindow::_tilesY
private

Definition at line 47 of file mainwindow.h.

const qint64 MainWindow::BUTTON_BLOCK_TIME = 2000
staticprivate

Definition at line 54 of file mainwindow.h.

Ui::MainWindow* MainWindow::ui
private

Definition at line 41 of file mainwindow.h.


The documentation for this class was generated from the following files: