MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updateImagePreview

Method updateImagePreview

source/json_tool/editor_gui.cpp:177–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void JsonEditor::updateImagePreview() {
178 String file = m_files.get(m_fileIndex);
179 for (JsonPath::PathPtr const& imagePath : m_options.editorImages) {
180 try {
181 String image = imagePath->get(m_currentJson).toJson().toString();
182 image = File::relativeTo(File::dirName(file), image.extract(":"));
183
184 QPixmap pixmap = QPixmap(image.utf8Ptr()).scaledToWidth(ImagePreviewWidth);
185 if (pixmap.height() > ImagePreviewHeight)
186 pixmap = pixmap.scaledToHeight(ImagePreviewHeight);
187 m_imageLabel->setPixmap(pixmap);
188 break;
189 } catch (JsonPath::TraversalException const&) {
190 }
191 }
192}
193
194int Star::edit(int argc, char* argv[], JsonPath::PathPtr const& path, Options const& options, List<Input> const& inputs) {
195 QApplication app(argc, argv);

Callers

nothing calls this directly

Calls 6

extractMethod · 0.80
getMethod · 0.45
toStringMethod · 0.45
toJsonMethod · 0.45
utf8PtrMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected