| 175 | } |
| 176 | |
| 177 | void 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 | |
| 194 | int Star::edit(int argc, char* argv[], JsonPath::PathPtr const& path, Options const& options, List<Input> const& inputs) { |
| 195 | QApplication app(argc, argv); |