| 1 | /*
|
|---|
| 2 | * Project: MoleCuilder
|
|---|
| 3 | * Description: creates and alters molecular systems
|
|---|
| 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
|---|
| 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 |
|
|---|
| 30 | #include "Atom/atom.hpp"
|
|---|
| 31 | #include "World.hpp"
|
|---|
| 32 |
|
|---|
| 33 | QtDialog::RandomNumberDistribution_ParametersQtQuery::RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
|
|---|
| 34 | Dialog::RandomNumberDistribution_ParametersQuery(_param, _title),
|
|---|
| 35 | parent(_parent),
|
|---|
| 36 | dialog(_dialog)
|
|---|
| 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 |
|
|---|
| 53 | connect(okButton,SIGNAL(clicked()),this,SLOT(onUpdate()));
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | QtDialog::RandomNumberDistribution_ParametersQtQuery::~RandomNumberDistribution_ParametersQtQuery()
|
|---|
| 57 | {
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | void QtDialog::RandomNumberDistribution_ParametersQtQuery::onUpdate() {
|
|---|
| 61 | QString data = inputBox->toPlainText();
|
|---|
| 62 | std::stringstream text(data.toStdString());
|
|---|
| 63 | // TODO: check error
|
|---|
| 64 | //text >> temp;
|
|---|
| 65 | dialog->update();
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | bool QtDialog::RandomNumberDistribution_ParametersQtQuery::handle() {
|
|---|
| 69 | if (param.isValid(temp)){
|
|---|
| 70 | param.set(temp);
|
|---|
| 71 | return true;
|
|---|
| 72 | }
|
|---|
| 73 | return false;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|