| 110 | } |
| 111 | |
| 112 | void |
| 113 | DocumentationManager::handler(QHttpRequest *req, |
| 114 | QHttpResponse *resp) |
| 115 | { |
| 116 | Q_UNUSED(req) |
| 117 | |
| 118 | QString docDir = appPTR->getApplicationBinaryPath() + QString::fromUtf8("/../Resources/docs/html/"); |
| 119 | QString page = req->url().toString(); |
| 120 | QByteArray body; |
| 121 | |
| 122 | #ifdef DEBUG |
| 123 | qDebug() << "www client requested" << page; |
| 124 | #endif |
| 125 | |
| 126 | // override static docs |
| 127 | // plugin pages are generated only if they don't exist |
| 128 | QString staticPage, dynamicPage, pluginID; |
| 129 | bool isStatic = false; |
| 130 | if ( page.startsWith( QString::fromUtf8("/plugins/") ) ) { |
| 131 | isStatic = true; |
| 132 | pluginID = page; |
| 133 | pluginID.replace( QString::fromUtf8(".html"), QString() ).replace( QString::fromUtf8("/plugins/"), QString() ); |
| 134 | staticPage = page; |
| 135 | dynamicPage = page; |
| 136 | dynamicPage.replace( QString::fromUtf8(".html"), QString() ).replace( QString::fromUtf8("/plugins/"), QString::fromUtf8("/_plugin.html?id=") ); |
| 137 | } |
| 138 | if ( page.startsWith( QString::fromUtf8("/_plugin.html?id=") ) ) { |
| 139 | isStatic = false; |
| 140 | pluginID = page; |
| 141 | pluginID.replace( QString::fromUtf8("/_plugin.html?id="), QString() ); |
| 142 | staticPage = page; |
| 143 | staticPage.replace( QString::fromUtf8("/_plugin.html?id="), QString::fromUtf8("/plugins/") ); |
| 144 | staticPage += QString::fromUtf8(".html"); |
| 145 | dynamicPage = page; |
| 146 | } |
| 147 | if ( page == QString::fromUtf8("/_prefs.html") ) { |
| 148 | isStatic = true; |
| 149 | staticPage = page; |
| 150 | dynamicPage = QString::fromUtf8("/_prefsLive.html"); |
| 151 | } |
| 152 | if ( page == QString::fromUtf8("/_prefsLive.html") ) { |
| 153 | isStatic = false; |
| 154 | staticPage = QString::fromUtf8("/_prefs.html"); |
| 155 | dynamicPage = page; |
| 156 | } |
| 157 | // if this is one of the plugins that depend on the ocioConfigFile, the static page should not be used. |
| 158 | // to get the list of plugins: |
| 159 | // (cd Documentation/source/plugins; fgrep -l ocioConfigFile *.rst) |
| 160 | // as of Natron 2.2: |
| 161 | /* |
| 162 | fr.inria.built-in.Read.rst |
| 163 | fr.inria.built-in.Write.rst |
| 164 | fr.inria.openfx.OCIOColorSpace.rst |
| 165 | fr.inria.openfx.OCIODisplay.rst |
| 166 | fr.inria.openfx.OCIOLogConvert.rst |
| 167 | fr.inria.openfx.OCIOLookTransform.rst |
| 168 | fr.inria.openfx.OpenRaster.rst |
| 169 | fr.inria.openfx.ReadCDR.rst |
nothing calls this directly
no test coverage detected