From ce3329047d378a14006ce74ec273ac59e3375303 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 12 May 2010 19:42:27 +0200 Subject: initial import of latest svn version --- src/gui/projectionDialog.cpp | 140 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 src/gui/projectionDialog.cpp (limited to 'src/gui/projectionDialog.cpp') 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 +#include +#include + +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 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; + } +} -- cgit v1.2.3-55-g7522