Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

camerasDialog.cpp 1.45 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
#include "dialogs/camerasDialog.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
2
3
4

#include "window.h"
#include "camera.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
5

Pierre Kraemer's avatar
Pierre Kraemer committed
6
7
8
#include <QMessageBox>
#include <QMouseEvent>

Pierre Kraemer's avatar
Pierre Kraemer committed
9
10
11
12
13
14
namespace CGoGN
{

namespace SCHNApps
{

Pierre Kraemer's avatar
Pierre Kraemer committed
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
61
62
63
64
65
66
CamerasDialog::CamerasDialog(Window* window) :
	QDialog(window),
	m_window(window)
{
	this->setupUi(this);
	this->setModal(false);

	connect(addCameraButton, SIGNAL(clicked()), this, SLOT(cb_addCamera()));
	connect(removeCamerasButton, SIGNAL(clicked()), this, SLOT(cb_removeCameras()));

	connect(m_window, SIGNAL(cameraAdded(Camera*)), this, SLOT(cb_addCameraToList(Camera*)));
	connect(m_window, SIGNAL(cameraRemoved(Camera*)), this, SLOT(cb_removeCameraFromList(Camera*)));
}

CamerasDialog::~CamerasDialog()
{}

void CamerasDialog::cb_addCamera()
{
	m_window->addCamera();
}

void CamerasDialog::cb_removeCameras()
{
	QList<QListWidgetItem*> currentItems = cameraList->selectedItems();
	foreach(QListWidgetItem* item, currentItems)
	{
		const QString& cname = item->text();
		Camera* c = m_window->getCamera(cname);
		if(!c->isUsed())
			m_window->removeCamera(cname);
		else
			QMessageBox::warning(this, tr("Warning"), "Camera " + cname + " is currently used");
	}
}

void CamerasDialog::cb_addCameraToList(Camera* c)
{
	cameraList->addItem(c->getName());
}

void CamerasDialog::cb_removeCameraFromList(Camera* c)
{
	for(int i = 0; i < cameraList->count(); ++i)
	{
		if(cameraList->item(i)->text() == c->getName())
		{
			delete cameraList->item(i);
			return;
		}
	}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
67
68
69
70

} // namespace SCHNApps

} // namespace CGoGN