| 957 | } |
| 958 | |
| 959 | bool |
| 960 | AppManager::loadInternalAfterInitGui(const CLArgs& cl) |
| 961 | { |
| 962 | try { |
| 963 | size_t maxCacheRAM = _imp->_settings->getRamMaximumPercent() * getSystemTotalRAM(); |
| 964 | U64 viewerCacheSize = _imp->_settings->getMaximumViewerDiskCacheSize(); |
| 965 | U64 maxDiskCacheNode = _imp->_settings->getMaximumDiskCacheNodeSize(); |
| 966 | |
| 967 | _imp->_nodeCache = std::make_shared<Cache<Image> >("NodeCache", NATRON_CACHE_VERSION, maxCacheRAM, 1.); |
| 968 | _imp->_diskCache = std::make_shared<Cache<Image> >("DiskCache", NATRON_CACHE_VERSION, maxDiskCacheNode, 0.); |
| 969 | _imp->_viewerCache = std::make_shared<Cache<FrameEntry> >("ViewerCache", NATRON_CACHE_VERSION, viewerCacheSize, 0.); |
| 970 | _imp->setViewerCacheTileSize(); |
| 971 | } catch (std::logic_error&) { |
| 972 | // ignore |
| 973 | } |
| 974 | |
| 975 | int oldCacheVersion = 0; |
| 976 | { |
| 977 | QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) ); |
| 978 | |
| 979 | if ( settings.contains( QString::fromUtf8(kNatronCacheVersionSettingsKey) ) ) { |
| 980 | oldCacheVersion = settings.value( QString::fromUtf8(kNatronCacheVersionSettingsKey) ).toInt(); |
| 981 | } |
| 982 | settings.setValue(QString::fromUtf8(kNatronCacheVersionSettingsKey), NATRON_CACHE_VERSION); |
| 983 | } |
| 984 | |
| 985 | if (oldCacheVersion != NATRON_CACHE_VERSION || cl.isCacheClearRequestedOnLaunch()) { |
| 986 | setLoadingStatus( tr("Clearing the image cache...") ); |
| 987 | wipeAndCreateDiskCacheStructure(); |
| 988 | } else { |
| 989 | setLoadingStatus( tr("Restoring the image cache...") ); |
| 990 | _imp->restoreCaches(); |
| 991 | } |
| 992 | |
| 993 | if (cl.isOpenFXCacheClearRequestedOnLaunch()) { |
| 994 | setLoadingStatus( tr("Clearing the OpenFX Plugins cache...") ); |
| 995 | clearPluginsLoadedCache(); |
| 996 | } else { |
| 997 | setLoadingStatus( tr("Loading plugin cache...") ); |
| 998 | } |
| 999 | |
| 1000 | |
| 1001 | ///Set host properties after restoring settings since it depends on the host name. |
| 1002 | try { |
| 1003 | _imp->ofxHost->setProperties(); |
| 1004 | } catch (std::logic_error&) { |
| 1005 | // ignore |
| 1006 | } |
| 1007 | |
| 1008 | /*loading all plugins*/ |
| 1009 | try { |
| 1010 | loadAllPlugins(); |
| 1011 | _imp->loadBuiltinFormats(); |
| 1012 | } catch (std::logic_error&) { |
| 1013 | // ignore |
| 1014 | } |
| 1015 | |
| 1016 | if ( isBackground() && !cl.getIPCPipeName().isEmpty() ) { |
nothing calls this directly
no test coverage detected