| 1 | /* |
| 2 | Copyright (C) 2010 Andres Cabrera |
| 3 | [email protected] |
| 4 | |
| 5 | This file is part of CsoundQt. |
| 6 | |
| 7 | CsoundQt is free software; you can redistribute it |
| 8 | and/or modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2.1 of the License, or (at your option) any later version. |
| 11 | |
| 12 | CsoundQt is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with Csound; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 20 | 02111-1307 USA |
| 21 | */ |
| 22 | #include "additionalfilespage.h" |
| 23 | #include "ui_additionalfilespage.h" |
| 24 | |
| 25 | #include <QFile> |
| 26 | #include <QDir> |
| 27 | |
| 28 | AdditionalFilesPage::AdditionalFilesPage(QWidget *parent) : |
| 29 | QWizardPage(parent), |
| 30 | ui(new Ui::AdditionalFilesPage) |
| 31 | { |
| 32 | ui->setupUi(this); |
| 33 | connect(ui->additionalListWidget, SIGNAL(itemSelectionChanged () ), this, SLOT(selectionChanged())); |
| 34 | registerField("dataFiles", ui->additionalListWidget); |
| 35 | } |
| 36 | |
| 37 | AdditionalFilesPage::~AdditionalFilesPage() |
| 38 | { |
| 39 | delete ui; |
| 40 | } |
| 41 | |
| 42 | void AdditionalFilesPage::setFiles(QStringList files) |
| 43 | { |
| 44 | foreach (QString file, files) { |
| 45 | ui->additionalListWidget->addItem(file); |
| 46 | } |
| 47 | ui->additionalListWidget->selectAll(); |
| 48 | } |
| 49 | |
| 50 | void AdditionalFilesPage::setSearchDirectories(QStringList directories) |
| 51 | { |
| 52 | m_searchDirectories = directories; |
| 53 | } |
| 54 | |
| 55 | void AdditionalFilesPage::changeEvent(QEvent *e) |
| 56 | { |
| 57 | QWizardPage::changeEvent(e); |
| 58 | switch (e->type()) { |
| 59 | case QEvent::LanguageChange: |
| 60 | ui->retranslateUi(this); |
| 61 | break; |
| 62 | default: |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void AdditionalFilesPage::selectionChanged() |
| 68 | { |
| 69 | QList<QListWidgetItem *> selected = ui->additionalListWidget->selectedItems(); |
| 70 | QStringList files; |
| 71 | foreach (QListWidgetItem *item, selected) { |
| 72 | QString name = item->text(); |
| 73 | files << name; |
| 74 | } |
| 75 | setProperty("dataFiles", files); |
| 76 | } |