1
/*****************************************************************
2
* Unipro UGENE - Integrated Bioinformatics Suite
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
6
* This source code is distributed under the terms of the
7
* GNU General Public License. See the files COPYING and LICENSE
9
*****************************************************************/
11
#include "ExportDialogController.h"
13
#include <core_api/AppContext.h>
14
#include <core_api/Settings.h>
15
#include <util_gui/DialogUtils.h>
16
#include <util_gui/GUIUtils.h>
18
#include <QtGui/QMessageBox>
19
#include <QtGui/QFileDialog>
21
#define SETTINGS_ROOT QString("dna_export/")
25
ExportDialogController::ExportDialogController(bool m, bool allowComplement, bool allowTranslation, const DocumentFormatId& id) {
29
strand = TriState_Yes;
31
translateAllFrames = false;
33
if (!allowComplement) {
34
directStrandButton->setEnabled(false);
35
complementStrandButton->setEnabled(false);
36
bothStrandsButton->setEnabled(false);
38
directStrandButton->setHidden(true);
39
complementStrandButton->setHidden(true);
40
bothStrandsButton->setHidden(true);
43
if (!allowTranslation) {
44
translateButton->setEnabled(false);
45
translateButton->setHidden(true);
46
allTFramesButton->setHidden(true);
49
if (!allowTranslation && !allowComplement) {
50
translationBox->setHidden(true);
54
saveModeBox->setEnabled(false);
55
//saveModeBox->setHidden(true);
58
connect(exportButton, SIGNAL(clicked()), SLOT(sl_exportClicked()));
59
connect(fileButton, SIGNAL(clicked()), SLOT(sl_fileClicked()));
61
int height = layout()->minimumSize().height();
62
setMaximumHeight(height);
66
void ExportDialogController::updateModel() {
67
strand = directStrandButton->isChecked() ? TriState_Yes : complementStrandButton->isChecked() ? TriState_No : TriState_Unknown;
68
translate = translateButton->isChecked();
69
translateAllFrames = allTFramesButton->isChecked();
71
merge = mergeButton->isChecked();
72
mergeGap = merge ? mergeSpinBox->value() : 0;
73
file = fileNameEdit->text();
77
void ExportDialogController::sl_exportClicked() {
78
if (fileNameEdit->text().isEmpty()) {
79
QMessageBox::warning(this, tr("warning"), tr("file_is_empty"));
80
fileNameEdit->setFocus();
87
void ExportDialogController::sl_fileClicked() {
88
QString filter = DialogUtils::prepareDocumentsFileFilter(formatId, false);
89
LastOpenDirHelper lod;
90
lod.url = QFileDialog::getSaveFileName(this, tr("select_file_title"), lod, filter);
91
if (lod.url.isEmpty()) {
94
fileNameEdit->setText(lod.url);
1
/*****************************************************************
2
* Unipro UGENE - Integrated Bioinformatics Suite
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
6
* This source code is distributed under the terms of the
7
* GNU General Public License. See the files COPYING and LICENSE
9
*****************************************************************/
11
#include "ExportDialogController.h"
13
#include <core_api/AppContext.h>
14
#include <core_api/Settings.h>
15
#include <util_gui/DialogUtils.h>
16
#include <util_gui/GUIUtils.h>
18
#include <QtGui/QMessageBox>
19
#include <QtGui/QFileDialog>
21
#define SETTINGS_ROOT QString("dna_export/")
25
ExportDialogController::ExportDialogController(bool m, bool allowComplement, bool allowTranslation, const DocumentFormatId& id) {
29
strand = TriState_Yes;
31
translateAllFrames = false;
33
if (!allowComplement) {
34
directStrandButton->setEnabled(false);
35
complementStrandButton->setEnabled(false);
36
bothStrandsButton->setEnabled(false);
38
directStrandButton->setHidden(true);
39
complementStrandButton->setHidden(true);
40
bothStrandsButton->setHidden(true);
43
if (!allowTranslation) {
44
translateButton->setEnabled(false);
45
translateButton->setHidden(true);
46
allTFramesButton->setHidden(true);
49
if (!allowTranslation && !allowComplement) {
50
translationBox->setHidden(true);
54
saveModeBox->setEnabled(false);
55
//saveModeBox->setHidden(true);
58
connect(exportButton, SIGNAL(clicked()), SLOT(sl_exportClicked()));
59
connect(fileButton, SIGNAL(clicked()), SLOT(sl_fileClicked()));
61
int height = layout()->minimumSize().height();
62
setMaximumHeight(height);
66
void ExportDialogController::updateModel() {
67
strand = directStrandButton->isChecked() ? TriState_Yes : complementStrandButton->isChecked() ? TriState_No : TriState_Unknown;
68
translate = translateButton->isChecked();
69
translateAllFrames = allTFramesButton->isChecked();
71
merge = mergeButton->isChecked();
72
mergeGap = merge ? mergeSpinBox->value() : 0;
73
file = fileNameEdit->text();
77
void ExportDialogController::sl_exportClicked() {
78
if (fileNameEdit->text().isEmpty()) {
79
QMessageBox::warning(this, tr("warning"), tr("file_is_empty"));
80
fileNameEdit->setFocus();
87
void ExportDialogController::sl_fileClicked() {
88
QString filter = DialogUtils::prepareDocumentsFileFilter(formatId, false);
89
LastOpenDirHelper lod;
90
lod.url = QFileDialog::getSaveFileName(this, tr("select_file_title"), lod, filter);
91
if (lod.url.isEmpty()) {
94
fileNameEdit->setText(lod.url);