1 /**
2 * UGENE - Integrated Bioinformatics Tools.
3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4 * http://ugene.net
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 <QCoreApplication>
23 #include <QTranslator>
24
25 #include <U2Algorithm/AlignmentAlgorithmsRegistry.h>
26 #include <U2Algorithm/AssemblyConsensusAlgorithmRegistry.h>
27 #include <U2Algorithm/CDSearchTaskFactoryRegistry.h>
28 #include <U2Algorithm/CudaGpuRegistry.h>
29 #include <U2Algorithm/DnaAssemblyAlgRegistry.h>
30 #include <U2Algorithm/GenomeAssemblyRegistry.h>
31 #include <U2Algorithm/MSAConsensusAlgorithmRegistry.h>
32 #include <U2Algorithm/MSADistanceAlgorithmRegistry.h>
33 #include <U2Algorithm/MolecularSurfaceFactoryRegistry.h>
34 #ifdef OPENCL_SUPPORT
35 # include <U2Algorithm/OpenCLGpuRegistry.h>
36 #endif
37 #include <U2Algorithm/PWMConversionAlgorithmRegistry.h>
38 #include <U2Algorithm/PhyTreeGeneratorRegistry.h>
39 #include <U2Algorithm/RepeatFinderTaskFactoryRegistry.h>
40 #include <U2Algorithm/SWResultFilterRegistry.h>
41 #include <U2Algorithm/SecStructPredictAlgRegistry.h>
42 #include <U2Algorithm/SmithWatermanTaskFactoryRegistry.h>
43 #include <U2Algorithm/SplicedAlignmentTaskRegistry.h>
44 #include <U2Algorithm/StructuralAlignmentAlgorithmRegistry.h>
45 #include <U2Algorithm/SubstMatrixRegistry.h>
46
47 #include <U2Core/AnnotationSettings.h>
48 #include <U2Core/AppFileStorage.h>
49 #include <U2Core/CMDLineCoreOptions.h>
50 #include <U2Core/CMDLineRegistry.h>
51 #include <U2Core/CMDLineUtils.h>
52 #include <U2Core/ConsoleShutdownTask.h>
53 #include <U2Core/Counter.h>
54 #include <U2Core/DBXRefRegistry.h>
55 #include <U2Core/DNAAlphabetRegistryImpl.h>
56 #include <U2Core/DNATranslation.h>
57 #include <U2Core/DataBaseRegistry.h>
58 #include <U2Core/DataPathRegistry.h>
59 #include <U2Core/ExternalToolRegistry.h>
60 #include <U2Core/FileAndDirectoryUtils.h>
61 #include <U2Core/LoadRemoteDocumentTask.h>
62 #include <U2Core/Log.h>
63 #include <U2Core/PasswordStorage.h>
64 #include <U2Core/ResourceTracker.h>
65 #include <U2Core/ScriptingToolRegistry.h>
66 #include <U2Core/TaskStarter.h>
67 #include <U2Core/Timer.h>
68 #include <U2Core/TmpDirChecker.h>
69 #include <U2Core/U2DbiRegistry.h>
70 #include <U2Core/U2OpStatusUtils.h>
71 #include <U2Core/UdrSchemaRegistry.h>
72 #include <U2Core/UserApplicationsSettings.h>
73 #include <U2Core/Version.h>
74 #include <U2Core/VirtualFileSystem.h>
75
76 #include <U2Designer/DashboardInfoRegistry.h>
77
78 #include <U2Formats/ConvertFileTask.h>
79 #include <U2Formats/DocumentFormatUtils.h>
80
81 #include <U2Lang/LocalDomain.h>
82 #include <U2Lang/QueryDesignerRegistry.h>
83 #include <U2Lang/WorkflowEnvImpl.h>
84
85 #include <U2Test/GTestFrameworkComponents.h>
86 #include <U2Test/TestRunnerTask.h>
87
88 // U2Private
89 #include <AppContextImpl.h>
90 #include <AppSettingsImpl.h>
91 #include <ConsoleLogDriver.h>
92 #include <CredentialsAskerCli.h>
93 #include <DocumentFormatRegistryImpl.h>
94 #include <IOAdapterRegistryImpl.h>
95 #include <PluginSupportImpl.h>
96 #include <ServiceRegistryImpl.h>
97 #include <SettingsImpl.h>
98 #include <TaskSchedulerImpl.h>
99 //#include <crash_handler/CrashHandler.h>
100
101 #include <U2Core/BundleInfo.h>
102
103 // local project imports
104 #include "DumpHelpTask.h"
105 #include "DumpLicenseTask.h"
106 #include "DumpVersionTask.h"
107 #include "TaskStatusBar.h"
108 #include "TestStarter.h"
109
110 #define TR_SETTINGS_ROOT QString("test_runner/")
111
112 using namespace U2;
113
registerCoreServices()114 static void registerCoreServices() {
115 ServiceRegistry *sr = AppContext::getServiceRegistry();
116 TaskScheduler *ts = AppContext::getTaskScheduler();
117 Q_UNUSED(sr);
118 Q_UNUSED(ts);
119 // unlike ugene's UI Main.cpp we don't create PluginViewerImpl, ProjectViewImpl
120 }
121
openDocs()122 static bool openDocs() {
123 bool ret = false;
124 QStringList suiteUrls = CMDLineRegistryUtils::getParameterValuesByWords(CMDLineCoreOptions::SUITE_URLS);
125 if (suiteUrls.size() > 0) {
126 TestStarter *ts = new TestStarter(suiteUrls);
127
128 GTestEnvironment *envs = ts->getEnv();
129 envs->setVar(TIME_OUT_VAR, AppContext::getSettings()->getValue(TR_SETTINGS_ROOT + TIME_OUT_VAR, QString("0")).toString());
130 envs->setVar(NUM_THREADS_VAR, AppContext::getSettings()->getValue(TR_SETTINGS_ROOT + NUM_THREADS_VAR, QString("5")).toString());
131
132 QObject::connect(AppContext::getPluginSupport(), SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(ts), SLOT(registerTask()));
133 ret = true;
134 }
135 return ret;
136 }
137
setScriptsSearchPath()138 static void setScriptsSearchPath() {
139 QStringList scriptsSearchPath;
140 const static char *RELATIVE_SCRIPTS_DIR = "/scripts";
141 const static char *RELATIVE_DEV_SCRIPTS_DIR = "/../../scripts";
142
143 QString appDirPath = AppContext::getWorkingDirectoryPath();
144 if (QDir(appDirPath + RELATIVE_SCRIPTS_DIR).exists()) {
145 scriptsSearchPath.push_back(appDirPath + RELATIVE_SCRIPTS_DIR);
146 } else if (QDir(appDirPath + RELATIVE_DEV_SCRIPTS_DIR).exists()) {
147 scriptsSearchPath.push_back(appDirPath + RELATIVE_DEV_SCRIPTS_DIR);
148 }
149 if (scriptsSearchPath.empty()) {
150 scriptsSearchPath.push_back("/");
151 }
152 QDir::setSearchPaths(PATH_PREFIX_SCRIPTS, scriptsSearchPath);
153 }
154
setDataSearchPaths()155 static void setDataSearchPaths() {
156 // set search paths for data files
157 QStringList dataSearchPaths;
158 const static char *RELATIVE_DATA_DIR = "/data";
159 const static char *RELATIVE_DEV_DATA_DIR = "/../../data";
160 // on windows data is normally located in the application folder
161 QString appDirPath = AppContext::getWorkingDirectoryPath();
162
163 if (QDir(appDirPath + RELATIVE_DATA_DIR).exists()) {
164 dataSearchPaths.push_back(appDirPath + RELATIVE_DATA_DIR);
165 } else if (QDir(appDirPath + RELATIVE_DEV_DATA_DIR).exists()) { // data location for developers
166 dataSearchPaths.push_back(appDirPath + RELATIVE_DEV_DATA_DIR);
167 #ifdef Q_OS_DARWIN
168 } else {
169 QString dir = BundleInfo::getDataSearchPath();
170 if (!dir.isEmpty()) {
171 dataSearchPaths.push_back(dir);
172 }
173 #endif
174 }
175
176 #if (defined(Q_OS_UNIX)) && defined(UGENE_DATA_DIR)
177 // using folder which is set during installation process on linux
178 QString ugene_data_dir(UGENE_DATA_DIR);
179 if (QDir(ugene_data_dir).exists()) {
180 dataSearchPaths.push_back(QString(UGENE_DATA_DIR));
181 }
182 #endif
183
184 if (dataSearchPaths.empty()) {
185 dataSearchPaths.push_back("/");
186 }
187
188 QDir::setSearchPaths(PATH_PREFIX_DATA, dataSearchPaths);
189 // now data files may be opened using QFile( "data:some_data_file" )
190 }
191
setSearchPaths()192 static void setSearchPaths() {
193 setDataSearchPaths();
194 setScriptsSearchPath();
195 }
196
main(int argc,char ** argv)197 int main(int argc, char **argv) {
198 #if 0
199 if (CrashHandler::isEnabled()) {
200 CrashHandler::setupHandler();
201 }
202
203 if (qgetenv(ENV_SEND_CRASH_REPORTS) == "0") {
204 CrashHandler::setSendCrashReports(false);
205 }
206 #endif
207
208 if (!Version::checkBuildAndRuntimeVersions()) {
209 return -1;
210 }
211
212 if (argc == 1) {
213 Version version = Version::appVersion();
214 fprintf(stderr, "Console interface for Unipro UGENE v%s\n"
215 #ifdef Q_OS_WIN
216 "Hint: Use 'ugeneui.exe' command to run GUI version of UGENE\n"
217 "Hint: Run 'ugene --usage', 'ugene.exe --help' or 'ugene.exe --help=<sectionName>' for more information\n"
218 #else
219 "Hint: Use 'ugene -ui' command to run GUI version of UGENE\n"
220 "Hint: Run 'ugene --usage', 'ugene --help' or 'ugene --help=<sectionName>' for more information\n"
221 #endif
222 ,
223 version.text.toLatin1().constData());
224 return -1;
225 }
226
227 GTIMER(c1, t1, "main()->QApp::exec");
228
229 QCoreApplication app(argc, argv);
230
231 AppContextImpl *appContext = AppContextImpl::getApplicationContext();
232 appContext->setWorkingDirectoryPath(QCoreApplication::applicationDirPath());
233
234 QCoreApplication::addLibraryPath(AppContext::getWorkingDirectoryPath());
235 setSearchPaths();
236
237 // parse all cmdline arguments
238 CMDLineRegistry *cmdLineRegistry = new CMDLineRegistry(app.arguments());
239 appContext->setCMDLineRegistry(cmdLineRegistry);
240
241 // 1 create settings
242 SettingsImpl *globalSettings = new SettingsImpl(QSettings::SystemScope);
243 appContext->setGlobalSettings(globalSettings);
244
245 SettingsImpl *settings = new SettingsImpl(QSettings::UserScope);
246 appContext->setSettings(settings);
247
248 AppSettings *appSettings = new AppSettingsImpl();
249 appContext->setAppSettings(appSettings);
250
251 UserAppsSettings *userAppSettings = AppContext::getAppSettings()->getUserAppsSettings();
252
253 // Set translations if needed: use value in the settings or cmd-line parameter override.
254 // The default case 'en' does not need any files: the values for this locale are hardcoded in the code.
255 QTranslator translator;
256 QStringList failedToLoadTranslatorFiles; // List of translators file names tried but failed to load/not found.
257 QStringList translationFileList = {
258 "transl_" + cmdLineRegistry->getParameterValue(CMDLineCoreOptions::TRANSLATION),
259 userAppSettings->getTranslationFile(),
260 "transl_" + QLocale::system().name().left(2).toLower(),
261 BundleInfo::getExtraTranslationSearchPath(cmdLineRegistry)};
262 // Keep only valid entries.
263 translationFileList.removeAll("");
264 translationFileList.removeAll("transl_");
265 translationFileList.removeDuplicates();
266 // Use the first translation from the list that works.
267 for (const QString &translationFile : qAsConst(translationFileList)) {
268 if (translationFile == "transl_en" || translator.load(translationFile, AppContext::getWorkingDirectoryPath())) {
269 break;
270 }
271 failedToLoadTranslatorFiles << translationFile;
272 }
273 if (!translator.isEmpty()) {
274 QCoreApplication::installTranslator(&translator);
275 GObjectTypes::initTypeTranslations();
276 }
277
278 // 2 create functional components of congene
279 ConsoleLogDriver logs;
280 Q_UNUSED(logs);
281 coreLog.details(AppContextImpl::tr("UGENE initialization started"));
282 for (const QString &fileName : failedToLoadTranslatorFiles) {
283 coreLog.trace(QObject::tr("Translation file not found: %1").arg(fileName));
284 }
285
286 ResourceTracker *resTrack = new ResourceTracker();
287 appContext->setResourceTracker(resTrack);
288
289 TaskSchedulerImpl *ts = new TaskSchedulerImpl(appSettings->getAppResourcePool());
290 appContext->setTaskScheduler(ts);
291
292 AnnotationSettingsRegistry *asr = new AnnotationSettingsRegistry(DocumentFormatUtils::predefinedSettings());
293 appContext->setAnnotationSettingsRegistry(asr);
294
295 TestFramework *tf = new TestFramework();
296 appContext->setTestFramework(tf);
297
298 RepeatFinderTaskFactoryRegistry *rfr = new RepeatFinderTaskFactoryRegistry();
299 appContext->setRepeatFinderTaskFactoryRegistry(rfr);
300
301 QDActorPrototypeRegistry *qpr = new QDActorPrototypeRegistry();
302 appContext->setQDActorFactoryRegistry(qpr);
303
304 CMDLineUtils::init();
305 DumpLicenseTask::initHelp();
306 DumpVersionTask::initHelp();
307
308 PhyTreeGeneratorRegistry *phyreg = new PhyTreeGeneratorRegistry();
309 appContext->setPhyTreeGeneratorRegistry(phyreg);
310
311 // unlike ugene's main.cpp we don't create MainWindowImpl, AppSettingsGUI and GObjectViewFactoryRegistry
312
313 ScriptingToolRegistry *str = new ScriptingToolRegistry();
314 appContext->setScriptingToolRegistry(str);
315
316 ExternalToolRegistry *etr = new ExternalToolRegistry();
317 appContext->setExternalToolRegistry(etr);
318
319 UdrSchemaRegistry *schemaRegistry = new UdrSchemaRegistry();
320 appContext->setUdrSchemaRegistry(schemaRegistry);
321
322 U2DbiRegistry *dbiRegistry = new U2DbiRegistry();
323 appContext->setDbiRegistry(dbiRegistry);
324
325 DocumentFormatRegistryImpl *dfr = new DocumentFormatRegistryImpl();
326 appContext->setDocumentFormatRegistry(dfr);
327
328 PluginSupportImpl *psp = new PluginSupportImpl();
329 appContext->setPluginSupport(psp);
330
331 ServiceRegistryImpl *sreg = new ServiceRegistryImpl();
332 appContext->setServiceRegistry(sreg);
333
334 IOAdapterRegistryImpl *io = new IOAdapterRegistryImpl();
335 appContext->setIOAdapterRegistry(io);
336
337 DNATranslationRegistry *dtr = new DNATranslationRegistry();
338 appContext->setDNATranslationRegistry(dtr);
339
340 DNAAlphabetRegistry *dal = new DNAAlphabetRegistryImpl(dtr);
341 appContext->setDNAAlphabetRegistry(dal);
342
343 // unlike ugene's main.cpp we don't create ScriptManagerView, MsaColorSchemeRegistry
344 DBXRefRegistry *dbxrr = new DBXRefRegistry();
345 appContext->setDBXRefRegistry(dbxrr);
346
347 MSAConsensusAlgorithmRegistry *msaConsReg = new MSAConsensusAlgorithmRegistry();
348 appContext->setMSAConsensusAlgorithmRegistry(msaConsReg);
349
350 MSADistanceAlgorithmRegistry *msaDistReg = new MSADistanceAlgorithmRegistry();
351 appContext->setMSADistanceAlgorithmRegistry(msaDistReg);
352
353 AssemblyConsensusAlgorithmRegistry *assemblyConsReg = new AssemblyConsensusAlgorithmRegistry();
354 appContext->setAssemblyConsensusAlgorithmRegistry(assemblyConsReg);
355
356 PWMConversionAlgorithmRegistry *pwmConvReg = new PWMConversionAlgorithmRegistry();
357 appContext->setPWMConversionAlgorithmRegistry(pwmConvReg);
358
359 SubstMatrixRegistry *smr = new SubstMatrixRegistry();
360 appContext->setSubstMatrixRegistry(smr);
361
362 SmithWatermanTaskFactoryRegistry *swar = new SmithWatermanTaskFactoryRegistry();
363 appContext->setSmithWatermanTaskFactoryRegistry(swar);
364
365 MolecularSurfaceFactoryRegistry *msfr = new MolecularSurfaceFactoryRegistry();
366 appContext->setMolecularSurfaceFactoryRegistry(msfr);
367
368 SWResultFilterRegistry *swrfr = new SWResultFilterRegistry();
369 appContext->setSWResultFilterRegistry(swrfr);
370
371 SecStructPredictAlgRegistry *sspar = new SecStructPredictAlgRegistry();
372 appContext->setSecStructPedictAlgRegistry(sspar);
373
374 CudaGpuRegistry *cgr = new CudaGpuRegistry();
375 appContext->setCudaGpuRegistry(cgr);
376
377 AlignmentAlgorithmsRegistry *pwr = new AlignmentAlgorithmsRegistry();
378 appContext->setAlignmentAlgorithmsRegistry(pwr);
379
380 #ifdef OPENCL_SUPPORT
381 OpenCLGpuRegistry *oclgr = new OpenCLGpuRegistry();
382 appContext->setOpenCLGpuRegistry(oclgr);
383 #endif
384
385 RecentlyDownloadedCache *rdc = new RecentlyDownloadedCache();
386 appContext->setRecentlyDownloadedCache(rdc);
387
388 VirtualFileSystemRegistry *vfsReg = new VirtualFileSystemRegistry();
389 appContext->setVirtualFileSystemRegistry(vfsReg);
390
391 DashboardInfoRegistry *dashboardInfoRegistry = new DashboardInfoRegistry;
392 appContext->setDashboardInfoRegistry(dashboardInfoRegistry);
393
394 Workflow::WorkflowEnv::init(new Workflow::WorkflowEnvImpl());
395 Workflow::WorkflowEnv::getDomainRegistry()->registerEntry(new LocalWorkflow::LocalDomainFactory());
396
397 DnaAssemblyAlgRegistry *assemblyReg = new DnaAssemblyAlgRegistry();
398 appContext->setDnaAssemblyAlgRegistry(assemblyReg);
399
400 GenomeAssemblyAlgRegistry *genomeAssemblyReg = new GenomeAssemblyAlgRegistry();
401 appContext->setGenomeAssemblyAlgRegistry(genomeAssemblyReg);
402
403 DataBaseRegistry *dbr = new DataBaseRegistry();
404 appContext->setDataBaseRegistry(dbr);
405
406 CDSearchFactoryRegistry *cdsfr = new CDSearchFactoryRegistry();
407 appContext->setCDSearchFactoryRegistry(cdsfr);
408
409 StructuralAlignmentAlgorithmRegistry *saar = new StructuralAlignmentAlgorithmRegistry();
410 appContext->setStructuralAlignmentAlgorithmRegistry(saar);
411
412 ConvertFactoryRegistry *convertFactoryRegistry = new ConvertFactoryRegistry();
413 appContext->setConvertFactoryRegistry(convertFactoryRegistry);
414
415 SplicedAlignmentTaskRegistry *splicedAlignmentTaskRegistry = new SplicedAlignmentTaskRegistry();
416 appContext->setSplicedAlignmentTaskRegistry(splicedAlignmentTaskRegistry);
417
418 WorkflowScriptRegistry *workflowScriptRegistry = new WorkflowScriptRegistry();
419 appContext->setWorkflowScriptRegistry(workflowScriptRegistry);
420
421 PasswordStorage *passwordStorage = new PasswordStorage();
422 appContext->setPasswordStorage(passwordStorage);
423 AppSettingsImpl::addPublicDbCredentials2Settings();
424
425 CredentialsAsker *credentialsAsker = new CredentialsAskerCli();
426 appContext->setCredentialsAsker(credentialsAsker);
427
428 AppFileStorage *appFileStorage = new AppFileStorage();
429 U2OpStatusImpl os;
430 appFileStorage->init(os);
431 if (os.hasError()) {
432 coreLog.error(os.getError());
433 delete appFileStorage;
434 } else {
435 appContext->setAppFileStorage(appFileStorage);
436 }
437
438 U2DataPathRegistry *dpr = new U2DataPathRegistry();
439 appContext->setDataPathRegistry(dpr);
440
441 TaskStatusBarCon *tsbc = new TaskStatusBarCon();
442
443 // show help if need
444 bool showHelp = cmdLineRegistry->hasParameter(CMDLineCoreOptions::HELP) ||
445 cmdLineRegistry->hasParameter(CMDLineCoreOptions::USAGE) ||
446 cmdLineRegistry->hasParameter(CMDLineCoreOptions::HELP_SHORT);
447
448 if (showHelp) {
449 QObject::connect(psp, SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(new DumpHelpTask()), SLOT(registerTask()));
450 }
451
452 bool showLicense = cmdLineRegistry->hasParameter(DumpLicenseTask::LICENSE_CMDLINE_OPTION);
453 if (showLicense) {
454 QObject::connect(psp, SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(new DumpLicenseTask()), SLOT(registerTask()));
455 }
456
457 bool showVersion = cmdLineRegistry->hasParameter(DumpVersionTask::VERSION_CMDLINE_OPTION);
458 showVersion = showVersion || cmdLineRegistry->hasParameter(DumpVersionTask::VERSION_CMDLINE_OPTION_SHORT);
459 if (showVersion) {
460 QObject::connect(psp, SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(new DumpVersionTask()), SLOT(registerTask()));
461 }
462
463 if (cmdLineRegistry->hasParameter(CMDLineCoreOptions::DOWNLOAD_DIR)) {
464 userAppSettings->setDownloadDirPath(FileAndDirectoryUtils::getAbsolutePath(cmdLineRegistry->getParameterValue(CMDLineCoreOptions::DOWNLOAD_DIR)));
465 }
466 if (cmdLineRegistry->hasParameter(CMDLineCoreOptions::CUSTOM_TOOLS_CONFIG_DIR)) {
467 userAppSettings->setCustomToolsConfigsDirPath(FileAndDirectoryUtils::getAbsolutePath(cmdLineRegistry->getParameterValue(CMDLineCoreOptions::CUSTOM_TOOLS_CONFIG_DIR)));
468 }
469 if (cmdLineRegistry->hasParameter(CMDLineCoreOptions::TMP_DIR)) {
470 userAppSettings->setUserTemporaryDirPath(FileAndDirectoryUtils::getAbsolutePath(cmdLineRegistry->getParameterValue(CMDLineCoreOptions::TMP_DIR)));
471 }
472 if (cmdLineRegistry->hasParameter(CMDLineCoreOptions::DEFAULT_DATA_DIR)) {
473 userAppSettings->setDefaultDataDirPath(FileAndDirectoryUtils::getAbsolutePath(cmdLineRegistry->getParameterValue(CMDLineCoreOptions::DEFAULT_DATA_DIR)));
474 }
475 if (cmdLineRegistry->hasParameter(CMDLineCoreOptions::FILE_STORAGE_DIR)) {
476 userAppSettings->setFileStorageDir(FileAndDirectoryUtils::getAbsolutePath(cmdLineRegistry->getParameterValue(CMDLineCoreOptions::FILE_STORAGE_DIR)));
477 }
478
479 if (!showHelp && !showLicense && !showVersion) {
480 QObject::connect(psp, SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(new TmpDirChecker()), SLOT(registerTask()));
481 }
482
483 openDocs();
484 registerCoreServices();
485
486 GCOUNTER(cvar, "ugenecl launch");
487
488 // 3 run QT
489 t1.stop();
490 coreLog.info(AppContextImpl::tr("%1-bit version of UGENE started").arg(Version::appArchitecture));
491 ConsoleShutdownTask watchQuit(&app);
492 Q_UNUSED(watchQuit);
493 int rc = app.exec();
494
495 // 4 deallocate resources
496 Workflow::WorkflowEnv::shutdown();
497
498 delete tsbc;
499
500 appContext->setCredentialsAsker(nullptr);
501 delete credentialsAsker;
502
503 appContext->setPasswordStorage(nullptr);
504 delete passwordStorage;
505
506 appContext->setDataPathRegistry(nullptr);
507 delete dpr;
508
509 appContext->setDashboardInfoRegistry(nullptr);
510 delete dashboardInfoRegistry;
511
512 appContext->setVirtualFileSystemRegistry(nullptr);
513 delete vfsReg;
514
515 appContext->setRecentlyDownloadedCache(nullptr);
516 delete rdc;
517
518 delete swrfr;
519 appContext->setSWResultFilterRegistry(nullptr);
520
521 delete swar;
522 appContext->setSmithWatermanTaskFactoryRegistry(nullptr);
523
524 delete msfr;
525 appContext->setMolecularSurfaceFactoryRegistry(nullptr);
526
527 delete smr;
528 appContext->setSubstMatrixRegistry(nullptr);
529
530 delete sreg;
531 appContext->setServiceRegistry(nullptr);
532
533 delete psp;
534 appContext->setPluginSupport(nullptr);
535
536 delete tf;
537 appContext->setTestFramework(0);
538
539 delete dal;
540 appContext->setDNAAlphabetRegistry(nullptr);
541
542 delete dbxrr;
543 appContext->setDBXRefRegistry(0);
544
545 delete dtr;
546 appContext->setDNATranslationRegistry(nullptr);
547
548 delete io;
549 appContext->setIOAdapterRegistry(nullptr);
550
551 delete dfr;
552 appContext->setDocumentFormatRegistry(nullptr);
553
554 delete dbiRegistry;
555 appContext->setDbiRegistry(nullptr);
556
557 delete schemaRegistry;
558 appContext->setUdrSchemaRegistry(nullptr);
559
560 delete ts;
561 appContext->setTaskScheduler(nullptr);
562
563 delete asr;
564 appContext->setAnnotationSettingsRegistry(nullptr);
565
566 delete resTrack;
567 appContext->setResourceTracker(nullptr);
568
569 delete cgr;
570 appContext->setCudaGpuRegistry(nullptr);
571
572 #ifdef OPENCL_SUPPORT
573 delete oclgr;
574 #endif
575 appContext->setOpenCLGpuRegistry(nullptr);
576
577 appContext->setAppSettings(nullptr);
578 delete appSettings;
579
580 delete settings;
581 appContext->setSettings(nullptr);
582
583 delete globalSettings;
584 appContext->setGlobalSettings(nullptr);
585
586 delete cmdLineRegistry;
587 appContext->setCMDLineRegistry(nullptr);
588
589 delete sspar;
590 appContext->setSecStructPedictAlgRegistry(nullptr);
591
592 appContext->setExternalToolRegistry(nullptr);
593 delete etr;
594
595 appContext->setScriptingToolRegistry(nullptr);
596 delete str;
597
598 delete msaConsReg;
599 appContext->setMSAConsensusAlgorithmRegistry(nullptr);
600
601 delete msaDistReg;
602 appContext->setMSADistanceAlgorithmRegistry(nullptr);
603
604 delete assemblyConsReg;
605 appContext->setAssemblyConsensusAlgorithmRegistry(nullptr);
606
607 appContext->setPWMConversionAlgorithmRegistry(nullptr);
608 delete pwmConvReg;
609
610 delete dbr;
611 appContext->setDataBaseRegistry(nullptr);
612
613 appContext->setQDActorFactoryRegistry(nullptr);
614 delete qpr;
615
616 delete cdsfr;
617 appContext->setCDSearchFactoryRegistry(nullptr);
618
619 appContext->setStructuralAlignmentAlgorithmRegistry(nullptr);
620 delete saar;
621
622 appContext->setConvertFactoryRegistry(nullptr);
623 delete convertFactoryRegistry;
624
625 delete splicedAlignmentTaskRegistry;
626 appContext->setSplicedAlignmentTaskRegistry(nullptr);
627
628 delete pwr;
629 appContext->setAlignmentAlgorithmsRegistry(nullptr);
630
631 //CrashHandler::shutdown();
632
633 return rc;
634 }
635