summaryrefslogtreecommitdiffstats
path: root/src/gui/projectionDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/projectionDialog.cpp')
-rw-r--r--src/gui/projectionDialog.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/src/gui/projectionDialog.cpp b/src/gui/projectionDialog.cpp
new file mode 100644
index 0000000..c091f54
--- /dev/null
+++ b/src/gui/projectionDialog.cpp
@@ -0,0 +1,140 @@
+/*
+# 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/
+# -----------------------------------------------------------------------------
+# projectionDialog.cpp
+ Dialog to select client for the projection
+# -----------------------------------------------------------------------------
+*/
+
+#include "projectionDialog.h"
+#include "ui_projectionDialog.h"
+#include <src/gui/mainWindow.h>
+#include <QtGui>
+#include <iostream>
+
+ProjectionDialog::ProjectionDialog(QWidget *parent) :
+ QDialog(parent),
+ pui(new Ui::projectionDialog)
+{
+ pui->setupUi(this);
+ this->setWindowTitle(tr("Target for Projection"));
+
+ source = MainWindow::getConnectionList()->getSelectedClients()->front();
+ setupContent(MainWindow::getWindow()->getConnectionList()->getTargetToDisplay(source));
+
+ pui->send->setDisabled(true);
+
+ connect( pui->send, SIGNAL( clicked() ), this, SLOT( sendListToProject() ) );
+ connect( pui->cancel, SIGNAL( clicked() ), this, SLOT( cancelProject() ) );
+ connect( pui->checkBox, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
+}
+
+ProjectionDialog::~ProjectionDialog()
+{
+ delete pui;
+ QCheckBox* cbox;
+ foreach(cbox, checkList)
+ {
+ disconnect( cbox, SIGNAL( clicked() ), this, SLOT( sendState() ) );
+ }
+}
+
+void ProjectionDialog::setupContent(QList<QString> content)
+{
+ if (!content.isEmpty())
+ {
+ QString item;
+ foreach(item, content)
+ {
+ QCheckBox *checkbox = new QCheckBox(item,this);
+ pui->verticalLayout_2->addWidget(checkbox);
+ checkList.push_back(checkbox);
+ connect( checkbox, SIGNAL( clicked() ), this, SLOT( sendState() ) );
+ }
+ }
+ else
+ {
+ QLabel *textInfo = new QLabel(this);
+ textInfo->setText("No Target available");
+ pui->verticalLayout_2->addWidget(textInfo);
+ pui->checkBox->setDisabled(true);
+ }
+}
+
+void ProjectionDialog::sendListToProject()
+{
+ MainWindow::getConnectionList()->setProjectProporties(source);
+ QCheckBox* cbox;
+
+ foreach(cbox, checkList)
+ {
+ if (cbox->isChecked())
+ {
+ MainWindow::getConnectionList()->addTargetToProjectList(cbox->text());
+ }
+ }
+ emit accept();
+}
+
+void ProjectionDialog::cancelProject()
+{
+ emit reject();
+}
+
+void ProjectionDialog::sendState()
+{
+ QCheckBox* cbox;
+ bool set = false;
+
+ foreach(cbox, checkList)
+ {
+ if (cbox->isChecked())
+ {
+ pui->send->setDisabled(false);
+ set = true;
+ break;
+ }
+ }
+
+ if (!set)
+ pui->send->setDisabled(true);
+
+}
+
+void ProjectionDialog::selectAll()
+{
+ if(pui->checkBox->isChecked())
+ {
+ QCheckBox* cbox;
+ foreach(cbox, checkList)
+ cbox->setChecked(true);
+ pui->send->setDisabled(false);
+ }
+ else
+ {
+ QCheckBox* cbox;
+ foreach(cbox, checkList)
+ cbox->setChecked(false);
+ pui->send->setDisabled(true);
+ }
+}
+
+void ProjectionDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ pui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}