| [0275ad] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
| [0aa122] | 4 |  * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
 | 
|---|
| [0275ad] | 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | /*
 | 
|---|
 | 9 |  * RandomNumberDistribution_ParametersQtQuery.cpp
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *  Created on: Jan 06, 2011
 | 
|---|
 | 12 |  *      Author: heber
 | 
|---|
 | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | // include config.h
 | 
|---|
 | 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 17 | #include <config.h>
 | 
|---|
 | 18 | #endif
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | #include <Qt/qboxlayout.h>
 | 
|---|
 | 21 | #include <Qt/qpushbutton.h>
 | 
|---|
 | 22 | #include <Qt/qtextedit.h>
 | 
|---|
 | 23 | #include <Qt/qlabel.h>
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
 | 26 | 
 | 
|---|
 | 27 | #include "UIElements/Qt4/Query/QtQuery.hpp"
 | 
|---|
 | 28 | 
 | 
|---|
| [6f0841] | 29 | #include "Atom/atom.hpp"
 | 
|---|
| [0275ad] | 30 | #include "World.hpp"
 | 
|---|
 | 31 | 
 | 
|---|
| [7dfd07] | 32 | QtDialog::RandomNumberDistribution_ParametersQtQuery::RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
 | 
|---|
| [b3a54d] | 33 |     Dialog::RandomNumberDistribution_ParametersQuery(_param, _title),
 | 
|---|
| [7c9921] | 34 |     parent(_parent),
 | 
|---|
 | 35 |     dialog(_dialog)
 | 
|---|
| [0275ad] | 36 | {
 | 
|---|
 | 37 |   thisLayout = new QHBoxLayout();
 | 
|---|
 | 38 |   titleLabel = new QLabel(QString(getTitle().c_str()));
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | //  inputBox->insertItem(-1, QString("no distribution"));
 | 
|---|
 | 41 | //  for (std::vector<distribution *>::const_iterator iter = distribution(); iter != distribution.end(); ++iter)
 | 
|---|
 | 42 | //    inputBox->insertItem((*iter)->getNr(),QString::fromStdString((*iter)->getName()));
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 |   inputBox = new QTextEdit();
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 |   parent->addLayout(thisLayout);
 | 
|---|
 | 47 |   thisLayout->addWidget(titleLabel);
 | 
|---|
 | 48 |   thisLayout->addWidget(inputBox);
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 |   okButton = new QPushButton(tr("Ok"));
 | 
|---|
 | 51 | 
 | 
|---|
| [7c9921] | 52 |   connect(okButton,SIGNAL(clicked()),this,SLOT(onUpdate()));
 | 
|---|
| [0275ad] | 53 | }
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | QtDialog::RandomNumberDistribution_ParametersQtQuery::~RandomNumberDistribution_ParametersQtQuery()
 | 
|---|
 | 56 | {
 | 
|---|
 | 57 | }
 | 
|---|
 | 58 | 
 | 
|---|
| [7c9921] | 59 | void QtDialog::RandomNumberDistribution_ParametersQtQuery::onUpdate() {
 | 
|---|
 | 60 |   QString data = inputBox->toPlainText();
 | 
|---|
 | 61 |   std::stringstream text(data.toStdString());
 | 
|---|
 | 62 |   // TODO: check error
 | 
|---|
 | 63 |   //text >> temp;
 | 
|---|
 | 64 |   dialog->update();
 | 
|---|
 | 65 | }
 | 
|---|
 | 66 | 
 | 
|---|
| [0275ad] | 67 | bool QtDialog::RandomNumberDistribution_ParametersQtQuery::handle() {
 | 
|---|
| [9d5531] | 68 |   if (param.isValid(temp)){
 | 
|---|
 | 69 |     param.set(temp);
 | 
|---|
 | 70 |     return true;
 | 
|---|
 | 71 |   }
 | 
|---|
 | 72 |   return false;
 | 
|---|
| [0275ad] | 73 | }
 | 
|---|
 | 74 | 
 | 
|---|
 | 75 | 
 | 
|---|