[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 | #include "UIElements/Qt4/Pipe/RandomNumberDistribution_ParametersQtQueryPipe.hpp"
|
---|
| 29 |
|
---|
[6f0841] | 30 | #include "Atom/atom.hpp"
|
---|
[0275ad] | 31 | #include "World.hpp"
|
---|
| 32 |
|
---|
[b3a54d] | 33 | QtDialog::RandomNumberDistribution_ParametersQtQuery::RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &_param, std::string _title,QBoxLayout *_parent,QtDialog *_dialog) :
|
---|
| 34 | Dialog::RandomNumberDistribution_ParametersQuery(_param, _title),
|
---|
[7c9921] | 35 | parent(_parent),
|
---|
| 36 | dialog(_dialog)
|
---|
[0275ad] | 37 | {
|
---|
| 38 | thisLayout = new QHBoxLayout();
|
---|
| 39 | titleLabel = new QLabel(QString(getTitle().c_str()));
|
---|
| 40 |
|
---|
| 41 | // inputBox->insertItem(-1, QString("no distribution"));
|
---|
| 42 | // for (std::vector<distribution *>::const_iterator iter = distribution(); iter != distribution.end(); ++iter)
|
---|
| 43 | // inputBox->insertItem((*iter)->getNr(),QString::fromStdString((*iter)->getName()));
|
---|
| 44 |
|
---|
| 45 | inputBox = new QTextEdit();
|
---|
| 46 |
|
---|
| 47 | parent->addLayout(thisLayout);
|
---|
| 48 | thisLayout->addWidget(titleLabel);
|
---|
| 49 | thisLayout->addWidget(inputBox);
|
---|
| 50 |
|
---|
| 51 | okButton = new QPushButton(tr("Ok"));
|
---|
| 52 |
|
---|
[9d5531] | 53 | pipe = new RandomNumberDistribution_ParametersQtQueryPipe(temp,_dialog, inputBox);
|
---|
[7c9921] | 54 | connect(okButton,SIGNAL(clicked()),this,SLOT(onUpdate()));
|
---|
[0275ad] | 55 | }
|
---|
| 56 |
|
---|
| 57 | QtDialog::RandomNumberDistribution_ParametersQtQuery::~RandomNumberDistribution_ParametersQtQuery()
|
---|
| 58 | {
|
---|
| 59 | delete pipe;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
[7c9921] | 62 | void QtDialog::RandomNumberDistribution_ParametersQtQuery::onUpdate() {
|
---|
| 63 | QString data = inputBox->toPlainText();
|
---|
| 64 | std::stringstream text(data.toStdString());
|
---|
| 65 | // TODO: check error
|
---|
| 66 | //text >> temp;
|
---|
| 67 | dialog->update();
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[0275ad] | 70 | bool QtDialog::RandomNumberDistribution_ParametersQtQuery::handle() {
|
---|
[9d5531] | 71 | if (param.isValid(temp)){
|
---|
| 72 | param.set(temp);
|
---|
| 73 | return true;
|
---|
| 74 | }
|
---|
| 75 | return false;
|
---|
[0275ad] | 76 | }
|
---|
| 77 |
|
---|
| 78 |
|
---|