summaryrefslogtreecommitdiffstats
path: root/src/gui/processesDialog.cpp
blob: cda76ea400b313cb3215dda4444a977a4051a7b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# processesDialog.cpp
	Dialog where a tab with running processes for every client is shown
# -----------------------------------------------------------------------------
*/

#include "processesDialog.h"
#include "ui_processesDialog.h"
#include <src/gui/processWidget.h>
//#include <src/gui/mainWindow.h>

ProcessDialog::ProcessDialog(QDialog *parent) :
    QDialog(parent),
    procui(new Ui::ProcessesDialog)
{
    procui->setupUi(this);

    tWidget = new QTabWidget;
    procui->grLayout->addWidget(tWidget);

    connect( tWidget, SIGNAL( currentChanged(int)), this, SLOT( currChanged()));

	std::list<PVSClient*> listAll =
			PVSConnectionManager::getManager()->getConnections();
	for (std::list<PVSClient*>::iterator it = listAll.begin(); it
			!= listAll.end(); it++)
	{
		if (*it == NULL || (*it)->getConnectionFrame() == NULL) continue;
		if ((*it)->getConnectionFrame()->getFrame() &&
				/*!(*it)->getConnectionFrame()->getFrame()->isDozent() &&*/
				(*it)->getVNCConnection())
			tWidget->addTab(new ProcessWidget(0, *it), (*it)->getUserName());
		else if (!(*it)->getConnectionFrame()->getFrame())
			ConsoleLog writeError(QString("The Frame connection from client: ").
					append((*it)->getConnectionFrame()->getTaskbarTitle()).
					append(QString(" is corrupted. Reconnect the client it again.")));
	}
}

// if other Tab is activated we say our tab to refresh the processList
void ProcessDialog::currChanged()
{
	ProcessWidget *temp = static_cast<ProcessWidget*>(tWidget->currentWidget());
	temp->refrProcessList();
}

ProcessDialog::~ProcessDialog()
{
    delete procui;
}