/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * FileQtQueryPipe.cpp * * Created on: Oct 25, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "CodePatterns/MemDebug.hpp" #include #include #include "UIElements/Qt4/Pipe/FileQtQueryPipe.hpp" #include "UIElements/Qt4/QtDialog.hpp" FileQtQueryPipe::FileQtQueryPipe(Parameter &_content, QtDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) : content(_content), dialog(_dialog), filenameLineEdit(_filenameLineEdit), filedialogButton(_filedialogButton) { theFileDialog = NULL; } FileQtQueryPipe::~FileQtQueryPipe() { if (theFileDialog != NULL) delete theFileDialog; } void FileQtQueryPipe::update() { QStringList ListOfFilenames = theFileDialog->selectedFiles(); std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl; content.set(ListOfFilenames.at(0).toStdString()); filenameLineEdit->setText(QString::fromStdString(content.get().string())); dialog->update(); } void FileQtQueryPipe::showFileDialog() { filedialogButton->setFlat(true); if (theFileDialog == NULL) { theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)")); theFileDialog->setAcceptMode(QFileDialog::AcceptOpen); theFileDialog->setFileMode(QFileDialog::AnyFile); theFileDialog->setViewMode(QFileDialog::List); } theFileDialog->exec(); update(); filedialogButton->setFlat(false); }