Esempio n. 1
0
DNAFlexDialog::DNAFlexDialog(ADVSequenceObjectContext* _ctx)
  : QDialog(_ctx->getAnnotatedDNAView()->getWidget())
{
    setupUi(this);
    new HelpButton(this, buttonBox, "23331160");
    buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Search"));
    buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));

    ctx = _ctx;

    // Get the sequence length
    int sequenceLength = ctx->getSequenceObject()->getSequenceLength();

    // Creating and initializing the annotation model
    CreateAnnotationModel annotModel;
    annotModel.hideAnnotationType = true;
    annotModel.hideLocation = true;  // hides location field and does not check it in validate()
    annotModel.data->name = "dna_flex";
    annotModel.sequenceObjectRef = ctx->getSequenceObject();
    annotModel.sequenceLen = sequenceLength;

    // Initializing and adding the annotations widget
    annotController = new CreateAnnotationWidgetController(annotModel, this);
    QWidget* annotWidget = annotController->getWidget();
    tabOutput->layout()->addWidget(annotWidget);

    // Setting the dialog icon to the standard UGENE icon
    setWindowIcon(QIcon(":/ugene/images/ugene_16.png"));

    // Setting the bounds for the parameters
    spinBoxWindowSize->setMaximum(sequenceLength);
    spinBoxWindowStep->setMaximum(sequenceLength - 2); // Approximate value. In real life the step should be 1 or small enough.

    // "-2" is added as the first window should be at least 2 nucleotides.
    if(settings.windowSize >  sequenceLength){
        settings.windowSize = sequenceLength;
    }

    // Setting the values
    updateHighFlexValues();

    // Connecting the GUI settings
    connect(spinBoxWindowSize, SIGNAL(valueChanged(int)), SLOT(sl_spinWindowSizeChanged(int)));
    connect(spinBoxWindowStep, SIGNAL(valueChanged(int)), SLOT(sl_spinWindowStepChanged(int)));
    connect(doubleSpinBoxThreshold, SIGNAL(valueChanged(double)), SLOT(sl_spinThresholdChanged(double)));
    connect(btnRemember, SIGNAL(clicked()), SLOT(sl_rememberSettings()));
    connect(btnDefaults, SIGNAL(clicked()), SLOT(sl_defaultSettings()));
    connect(tabWidget,SIGNAL(currentChanged(int)),this, SLOT(sl_updateSizes(int)));

    sl_updateSizes(0);
}
Esempio n. 2
0
void DNAFlexDialog::sl_defaultSettings()
{
    settings.restoreDefaults();
    updateHighFlexValues();
}