| 1822 | } |
| 1823 | |
| 1824 | void |
| 1825 | Settings::restorePluginSettings() |
| 1826 | { |
| 1827 | const PluginsMap& plugins = appPTR->getPluginsList(); |
| 1828 | QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) ); |
| 1829 | |
| 1830 | for (PluginsMap::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { |
| 1831 | if ( it->first.empty() ) { |
| 1832 | continue; |
| 1833 | } |
| 1834 | assert(it->second.size() > 0); |
| 1835 | |
| 1836 | for (PluginVersionsOrdered::const_reverse_iterator itver = it->second.rbegin(); itver != it->second.rend(); ++itver) { |
| 1837 | Plugin* plugin = *itver; |
| 1838 | assert(plugin); |
| 1839 | |
| 1840 | if ( plugin->getIsForInternalUseOnly() ) { |
| 1841 | continue; |
| 1842 | } |
| 1843 | |
| 1844 | |
| 1845 | { |
| 1846 | QString pluginIDKey = plugin->getPluginID() + QString::fromUtf8("_") + QString::number( plugin->getMajorVersion() ) + QString::fromUtf8("_") + QString::number( plugin->getMinorVersion() ); |
| 1847 | QString enabledKey = pluginIDKey + QString::fromUtf8("_enabled"); |
| 1848 | if ( settings.contains(enabledKey) ) { |
| 1849 | bool enabled = settings.value(enabledKey).toBool(); |
| 1850 | plugin->setActivated(enabled); |
| 1851 | } else { |
| 1852 | settings.setValue( enabledKey, plugin->isActivated() ); |
| 1853 | } |
| 1854 | |
| 1855 | QString rsKey = pluginIDKey + QString::fromUtf8("_rs"); |
| 1856 | if ( settings.contains(rsKey) ) { |
| 1857 | bool renderScaleEnabled = settings.value(rsKey).toBool(); |
| 1858 | plugin->setRenderScaleEnabled(renderScaleEnabled); |
| 1859 | } else { |
| 1860 | settings.setValue( rsKey, plugin->isRenderScaleEnabled() ); |
| 1861 | } |
| 1862 | |
| 1863 | QString mtKey = pluginIDKey + QString::fromUtf8("_mt"); |
| 1864 | if ( settings.contains(mtKey) ) { |
| 1865 | bool multiThreadingEnabled = settings.value(mtKey).toBool(); |
| 1866 | plugin->setMultiThreadingEnabled(multiThreadingEnabled); |
| 1867 | } else { |
| 1868 | settings.setValue( mtKey, plugin->isMultiThreadingEnabled() ); |
| 1869 | } |
| 1870 | |
| 1871 | QString glKey = pluginIDKey + QString::fromUtf8("_gl"); |
| 1872 | if (settings.contains(glKey)) { |
| 1873 | bool openglEnabled = settings.value(glKey).toBool(); |
| 1874 | plugin->setOpenGLEnabled(openglEnabled); |
| 1875 | } else { |
| 1876 | settings.setValue(glKey, plugin->isOpenGLEnabled()); |
| 1877 | } |
| 1878 | |
| 1879 | } |
| 1880 | } |
| 1881 | } |
no test coverage detected