| 678 | } |
| 679 | |
| 680 | bool |
| 681 | AppManager::loadInternal(const CLArgs& cl) |
| 682 | { |
| 683 | assert(!_imp->_loaded); |
| 684 | |
| 685 | _imp->_binaryPath = QCoreApplication::applicationDirPath(); |
| 686 | assert(StrUtils::is_utf8(_imp->_binaryPath.toStdString().c_str())); |
| 687 | |
| 688 | registerEngineMetaTypes(); |
| 689 | registerGuiMetaTypes(); |
| 690 | |
| 691 | qApp->setOrganizationName( QString::fromUtf8(NATRON_ORGANIZATION_NAME) ); |
| 692 | qApp->setOrganizationDomain( QString::fromUtf8(NATRON_ORGANIZATION_DOMAIN) ); |
| 693 | qApp->setApplicationName( QString::fromUtf8(NATRON_APPLICATION_NAME) ); |
| 694 | |
| 695 | //Set it once setApplicationName is set since it relies on it |
| 696 | refreshDiskCacheLocation(); |
| 697 | |
| 698 | // Set the locale AGAIN, because Qt resets it in the QCoreApplication constructor and in Py_InitializeEx |
| 699 | // see http://doc.qt.io/qt-4.8/qcoreapplication.html#locale-settings |
| 700 | setApplicationLocale(); |
| 701 | |
| 702 | Log::instance(); //< enable logging |
| 703 | bool mustSetSignalsHandlers = true; |
| 704 | #ifdef NATRON_USE_BREAKPAD |
| 705 | //Enabled breakpad only if the process was spawned from the crash reporter |
| 706 | const QString& breakpadProcessExec = cl.getBreakpadProcessExecutableFilePath(); |
| 707 | if ( !breakpadProcessExec.isEmpty() && QFile::exists(breakpadProcessExec) ) { |
| 708 | _imp->breakpadProcessExecutableFilePath = breakpadProcessExec; |
| 709 | _imp->breakpadProcessPID = (Q_PID)cl.getBreakpadProcessPID(); |
| 710 | const QString& breakpadPipePath = cl.getBreakpadPipeFilePath(); |
| 711 | const QString& breakpadComPipePath = cl.getBreakpadComPipeFilePath(); |
| 712 | int breakpad_client_fd = cl.getBreakpadClientFD(); |
| 713 | _imp->initBreakpad(breakpadPipePath, breakpadComPipePath, breakpad_client_fd); |
| 714 | mustSetSignalsHandlers = false; |
| 715 | } |
| 716 | #endif |
| 717 | |
| 718 | |
| 719 | # ifdef __NATRON_UNIX__ |
| 720 | if (mustSetSignalsHandlers) { |
| 721 | setShutDownSignal(SIGINT); // shut down on ctrl-c |
| 722 | setShutDownSignal(SIGTERM); // shut down on killall |
| 723 | # if defined(__NATRON_LINUX__) && !defined(__FreeBSD__) |
| 724 | //Catch SIGSEGV only when google-breakpad is not active |
| 725 | setSigSegvSignal(); |
| 726 | # endif |
| 727 | } |
| 728 | # else |
| 729 | Q_UNUSED(mustSetSignalsHandlers); |
| 730 | # endif |
| 731 | |
| 732 | |
| 733 | _imp->_settings = std::make_shared<Settings>(); |
| 734 | _imp->_settings->initializeKnobsPublic(); |
| 735 | |
| 736 | bool hasGLForRendering = hasOpenGLForRequirements(eOpenGLRequirementsTypeRendering, 0); |
| 737 | if (_imp->hasInitializedOpenGLFunctions && hasGLForRendering) { |
nothing calls this directly
no test coverage detected