MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / openInternal

Method openInternal

src/Gui/FileHandler.cpp:115–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115bool 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
166void FileHandler::openInternal(const char* type, const char* prop)
167{

Callers

nothing calls this directly

Calls 9

cmdAppDocumentArgsFunction · 0.85
cmdAppDocumentFunction · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
constDataMethod · 0.80
hasExtensionFunction · 0.50
transformFunction · 0.50
setFileMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected