| 113 | } |
| 114 | |
| 115 | bool FileHandler::openInternal() |
| 116 | { |
| 117 | if (activateEditor()) { |
| 118 | return true; |
| 119 | } |
| 120 | |
| 121 | QFileInfo fi; |
| 122 | fi.setFile(filename); |
| 123 | QString ext = fi.suffix().toLower(); |
| 124 | |
| 125 | auto hasExtension = [ext](const QStringList& suffixes) { |
| 126 | return suffixes.contains(ext); |
| 127 | }; |
| 128 | |
| 129 | if (hasExtension(QStringList() << QLatin1String("iv"))) { |
| 130 | openInventor(); |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | if (hasExtension( |
| 135 | QStringList() << QLatin1String("wrl") << QLatin1String("wrz") << QLatin1String("vrml") |
| 136 | )) { |
| 137 | openVRML(); |
| 138 | return true; |
| 139 | } |
| 140 | |
| 141 | if (hasExtension( |
| 142 | QStringList() << QLatin1String("py") << QLatin1String("fcmacro") |
| 143 | << QLatin1String("fcscript") |
| 144 | )) { |
| 145 | openPython(); |
| 146 | return true; |
| 147 | } |
| 148 | |
| 149 | QStringList supportedFormats; |
| 150 | auto imageFormats = QImageReader::supportedImageFormats(); |
| 151 | std::transform( |
| 152 | imageFormats.cbegin(), |
| 153 | imageFormats.cend(), |
| 154 | std::back_inserter(supportedFormats), |
| 155 | [](const QByteArray& format) { return QString::fromLatin1(format); } |
| 156 | ); |
| 157 | |
| 158 | if (hasExtension(supportedFormats)) { |
| 159 | openImage(); |
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | return false; |
| 164 | } |
| 165 | |
| 166 | void FileHandler::openInternal(const char* type, const char* prop) |
| 167 | { |
nothing calls this directly
no test coverage detected