~ubuntu-branches/debian/jessie/ugene/jessie

« back to all changes in this revision

Viewing changes to src/plugins/external_tool_support/src/tcoffee/TCoffeeSupportRunDialog.cpp

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-11-02 13:29:07 UTC
  • mfrom: (1.2.1) (3.1.11 natty)
  • Revision ID: package-import@ubuntu.com-20111102132907-o34gwnt0uj5g6hen
Tags: 1.9.8+repack-1
* First release to Debian
  - added README.Debian
  - increased policy version to 3.9.2
  - added URLs for version control system
* Added debug package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * UGENE - Integrated Bioinformatics Tools.
 
3
 * Copyright (C) 2008-2011 UniPro <ugene@unipro.ru>
 
4
 * http://ugene.unipro.ru
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
19
 * MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
#include "TCoffeeSupportRunDialog.h"
 
23
 
 
24
#include <U2Misc/DialogUtils.h>
 
25
#include <QtGui/QFileDialog>
 
26
#include <QtGui/QToolButton>
 
27
 
 
28
namespace U2 {
 
29
 
 
30
////////////////////////////////////////
 
31
//TCoffeeSupportRunDialog
 
32
TCoffeeSupportRunDialog::TCoffeeSupportRunDialog(TCoffeeSupportTaskSettings& _settings, QWidget* _parent) :
 
33
        QDialog(_parent), settings(_settings)
 
34
{
 
35
    setupUi(this);
 
36
    connect(this->cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
 
37
    connect(this->alignButton,SIGNAL(clicked()),this,SLOT(sl_align()));
 
38
}
 
39
 
 
40
void TCoffeeSupportRunDialog::sl_align(){
 
41
    if(gapOpenCheckBox->isChecked()) {
 
42
        settings.gapOpenPenalty = gapOpenSpinBox->value();
 
43
    }
 
44
    if(gapExtCheckBox->isChecked()) {
 
45
        settings.gapExtenstionPenalty = gapExtSpinBox->value();
 
46
    }
 
47
    if(maxNumberIterRefinementCheckBox->isChecked()){
 
48
        settings.numIterations = maxNumberIterRefinementSpinBox->value();
 
49
    }
 
50
    accept();
 
51
}
 
52
////////////////////////////////////////
 
53
//TCoffeeWithExtFileSpecifySupportRunDialog
 
54
TCoffeeWithExtFileSpecifySupportRunDialog::TCoffeeWithExtFileSpecifySupportRunDialog(TCoffeeSupportTaskSettings& _settings, QWidget* _parent) :
 
55
        QDialog(_parent), settings(_settings)
 
56
{
 
57
    setupUi(this);
 
58
    QWidget * widget = new QWidget(_parent);
 
59
    inputFileLineEdit= new FileLineEdit(DialogUtils::prepareDocumentsFileFilterByObjType(GObjectTypes::MULTIPLE_ALIGNMENT, true),
 
60
        "", false, widget);
 
61
    inputFileLineEdit->setText("");
 
62
    QToolButton * selectToolPathButton = new QToolButton(widget);
 
63
    selectToolPathButton->setVisible(true);
 
64
    selectToolPathButton->setText("...");
 
65
    connect(selectToolPathButton, SIGNAL(clicked()), inputFileLineEdit, SLOT(sl_onBrowse()));
 
66
    connect(inputFileLineEdit,SIGNAL(textChanged(QString)),this, SLOT(sl_inputFileLineEditChanged(QString)));
 
67
 
 
68
    QHBoxLayout* layout = new QHBoxLayout(widget);
 
69
    layout->addWidget(inputFileLineEdit);
 
70
    layout->addWidget(selectToolPathButton);
 
71
 
 
72
    QGroupBox* inputFileGroupBox=new QGroupBox(tr("Select input file"),widget);
 
73
    inputFileGroupBox->setLayout(layout);
 
74
    QBoxLayout* parentLayout = qobject_cast<QBoxLayout*>(this->layout());
 
75
    assert(parentLayout);
 
76
    parentLayout->insertWidget(0, inputFileGroupBox);
 
77
    alignButton->setEnabled(false);
 
78
    connect(this->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
 
79
    connect(this->alignButton, SIGNAL(clicked()), this, SLOT(sl_align()));
 
80
}
 
81
 
 
82
void TCoffeeWithExtFileSpecifySupportRunDialog::sl_inputFileLineEditChanged(const QString& str){
 
83
    alignButton->setEnabled(!str.isEmpty());
 
84
}
 
85
 
 
86
void TCoffeeWithExtFileSpecifySupportRunDialog::sl_align(){
 
87
    if(gapOpenCheckBox->isChecked()) {
 
88
        settings.gapOpenPenalty = gapOpenSpinBox->value();
 
89
    }
 
90
    if(gapExtCheckBox->isChecked()) {
 
91
        settings.gapExtenstionPenalty = gapExtSpinBox->value();
 
92
    }
 
93
    if(maxNumberIterRefinementCheckBox->isChecked()){
 
94
        settings.numIterations = maxNumberIterRefinementSpinBox->value();
 
95
    }
 
96
    if(!inputFileLineEdit->text().isEmpty()){
 
97
        settings.inputFilePath=inputFileLineEdit->text();
 
98
    }else{
 
99
        assert(NULL);
 
100
        reject();
 
101
    }
 
102
    accept();
 
103
}
 
104
 
 
105
}//namespace