void ExportProjectDialogController::accept(){ QString dirPath = exportFolderEdit->text(); projectFile = fixProjectFile(projectFileEdit->text()); U2OpStatus2Log os; exportDir = GUrlUtils::prepareDirLocation(dirPath, os); if (exportDir.isEmpty()) { assert(os.hasError()); QMessageBox::critical(this, this->windowTitle(), os.getError()); return; } QDialog::accept(); }
bool CreatePhyTreeDialogController::checkFileName() { const QString fileName = saveController->getSaveFileName(); if (fileName.isEmpty()) { QMessageBox::warning(this, tr("Warning"), tr("Please, input the file name.")); ui->fileNameEdit->setFocus(); return false; } settings.fileUrl = fileName; U2OpStatus2Log os; GUrlUtils::validateLocalFileUrl(GUrl(fileName), os); if (os.hasError()) { QMessageBox::warning(this, tr("Error"), tr("Please, change the output file.") + "\n" + os.getError()); ui->fileNameEdit->setFocus(Qt::MouseFocusReason); return false; } return true; }
void ADVClipboard::copySequenceSelection(bool complement, bool amino) { ADVSequenceObjectContext* seqCtx = getSequenceContext(); if (seqCtx == NULL) { QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), "No sequence selected!"); return; } QString res; QVector<U2Region> regions = seqCtx->getSequenceSelection()->getSelectedRegions(); #ifdef UGENE_X86 int totalLen = 0; foreach (const U2Region& r, regions) { totalLen += r.length; } if (totalLen > MAX_COPY_SIZE_FOR_X86) { QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), COPY_FAILED_MESSAGE); return; } #endif if (!regions.isEmpty()) { U2SequenceObject* seqObj = seqCtx->getSequenceObject(); DNATranslation* complTT = complement ? seqCtx->getComplementTT() : NULL; DNATranslation* aminoTT = amino ? seqCtx->getAminoTT() : NULL; U2OpStatus2Log os; QList<QByteArray> seqParts = U2SequenceUtils::extractRegions(seqObj->getSequenceRef(), regions, complTT, aminoTT, false, os); if (os.hasError()) { QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), tr("An error occurred during getting sequence data: %1").arg(os.getError())); return; } if (seqParts.size() == 1) { putIntoClipboard(seqParts.first()); return; } res = U1SequenceUtils::joinRegions(seqParts); } putIntoClipboard(res); }
Task *ConservationPlotWorker::tick() { U2OpStatus2Log os; while (inChannel->hasMessage()) { Message m = getMessageAndSetupScriptValues(inChannel); QVariantMap data = m.getData().toMap(); if (!data.contains(ANNOT_SLOT_ID)) { os.setError("Annotations slot is empty"); return new FailTask(os.getError()); } plotData = StorageUtils::getAnnotationTableHandlers(data[ANNOT_SLOT_ID]); } if (!inChannel->isEnded()) { return NULL; } ConservationPlotSettings settings = createConservationPlotSettings(os); if (os.hasError()) { return new FailTask(os.getError()); } ConservationPlotTask* t = new ConservationPlotTask(settings, context->getDataStorage(), plotData); t->addListeners(createLogListeners()); connect(t, SIGNAL(si_stateChanged()), SLOT(sl_taskFinished())); return t; if (inChannel->isEnded()) { setDone(); } return NULL; }
bool StreamShortReadWriter::writeNextSequence(const U2SequenceObject *seq) { U2OpStatus2Log os; fastaFormat->storeSequence(seq, io, os); return !os.hasError(); }