| [2c5765] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  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 |  * FilesQtQuery.cpp
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *  Created on: May 21, 2012
 | 
|---|
 | 12 |  *      Author: heber
 | 
|---|
 | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | // include config.h
 | 
|---|
 | 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 17 | #include <config.h>
 | 
|---|
 | 18 | #endif
 | 
|---|
 | 19 | 
 | 
|---|
| [324403] | 20 | #include <Qt/qpushbutton.h>
 | 
|---|
| [2c5765] | 21 | #include <Qt/qboxlayout.h>
 | 
|---|
 | 22 | #include <Qt/qlistwidget.h>
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
 | 25 | 
 | 
|---|
| [bd81f9] | 26 | 
 | 
|---|
| [2c5765] | 27 | #include "UIElements/Qt4/Query/QtQuery.hpp"
 | 
|---|
| [324403] | 28 | #include "UIElements/Qt4/Query/QtQueryList.hpp"
 | 
|---|
| [2c5765] | 29 | 
 | 
|---|
 | 30 | 
 | 
|---|
| [324403] | 31 | QtDialog::FilesQtQuery::FilesQtQuery(Parameter<std::vector<boost::filesystem::path> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
 | 
|---|
 | 32 |     Dialog::FilesQuery(_param, _title),
 | 
|---|
 | 33 |     QtQueryList<boost::filesystem::path>(_parent, _dialog, temp)
 | 
|---|
| [2c5765] | 34 | {
 | 
|---|
| [324403] | 35 |   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
 | 
|---|
 | 36 |   subQuery = new FileQtQuery(*subParam, _title, thisVLayout, subDialog);
 | 
|---|
 | 37 |   subDialog->setSubQuery(subQuery);
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 |   connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
 | 
|---|
 | 40 |   connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
 | 
|---|
 | 41 |   connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
 | 
|---|
| [2c5765] | 42 | }
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | QtDialog::FilesQtQuery::~FilesQtQuery()
 | 
|---|
 | 45 | {
 | 
|---|
| [324403] | 46 |   delete(subQuery);
 | 
|---|
 | 47 | }
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | void QtDialog::FilesQtQuery::onSubUpdate()
 | 
|---|
 | 50 | {
 | 
|---|
 | 51 |   addButton->setEnabled(subParam->isSet());
 | 
|---|
| [2c5765] | 52 | }
 | 
|---|
 | 53 | 
 | 
|---|
| [324403] | 54 | void QtDialog::FilesQtQuery::onElementSelected() {
 | 
|---|
 | 55 |   elementSelected();
 | 
|---|
| [7c9921] | 56 | }
 | 
|---|
 | 57 | 
 | 
|---|
| [324403] | 58 | void QtDialog::FilesQtQuery::onAddElement() {
 | 
|---|
 | 59 |   addElement();
 | 
|---|
 | 60 | }
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 | void QtDialog::FilesQtQuery::onRemoveElement() {
 | 
|---|
 | 63 |   removeElements();
 | 
|---|
 | 64 | }
 | 
|---|
 | 65 | 
 | 
|---|
 | 66 | bool QtDialog::FilesQtQuery::handle()
 | 
|---|
 | 67 | {
 | 
|---|
| [9d5531] | 68 |   if (param.isValid(temp)){
 | 
|---|
 | 69 |     param.set(temp);
 | 
|---|
 | 70 |     return true;
 | 
|---|
 | 71 |   }
 | 
|---|
| [324403] | 72 |   return false;
 | 
|---|
| [2c5765] | 73 | }
 | 
|---|
 | 74 | 
 | 
|---|
| [324403] | 75 | 
 | 
|---|