ACMX 2.139.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
metadata-viewer.hpp
Go to the documentation of this file.
1#ifndef __METADATA_VIEWER_H_
2#define __METADATA_VIEWER_H_
3
4/**
5 * @file metadata-viewer.hpp
6 * @brief Media metadata viewer dialog. Runs ffprobe on a user-selected file,
7 * parses the JSON output, and presents the result in a tree along with
8 * copy-friendly Markdown / HTML / plain-text summaries suitable for
9 * pasting into a README, web page, or chat message.
10 */
11
12#include <QDialog>
13#include <QJsonObject>
14#include <QString>
15
16class QLineEdit;
17class QPushButton;
18class QTreeWidget;
19class QTreeWidgetItem;
20class QPlainTextEdit;
21class QTabWidget;
22class QProcess;
23
24class MetadataViewer : public QDialog {
25 Q_OBJECT
26 public:
27 explicit MetadataViewer(QWidget *parent = nullptr);
28
29 private slots:
30 /// @brief Open a file picker and store the chosen path in the path field.
31 void browseFile();
32 /// @brief Launch ffprobe against the current file and refresh the tree.
33 void analyzeFile();
34 /// @brief Copy the currently selected tab's text (Markdown/HTML/Text)
35 /// to the system clipboard.
36 void copyCurrentTab();
37
38 private:
39 /// @brief Populate the tree widget from a parsed ffprobe JSON object.
40 void populateTree(const QJsonObject &root);
41 /// @brief Render a Markdown-formatted summary of the metadata.
42 QString buildMarkdown(const QJsonObject &root) const;
43 /// @brief Render an HTML-formatted summary of the metadata.
44 QString buildHtml(const QJsonObject &root) const;
45 /// @brief Render a plain-text summary of the metadata.
46 QString buildPlainText(const QJsonObject &root) const;
47 /// @brief Recursively add a JSON value as a tree item.
48 void addJsonValue(QTreeWidgetItem *parent, const QString &key, const QJsonValue &value);
49 /// @brief Refresh the copy button label based on the active tab.
51
52 QLineEdit *pathEdit = nullptr;
53 QPushButton *browseButton = nullptr;
54 QPushButton *analyzeButton = nullptr;
55 QPushButton *copyButton = nullptr;
56 QPushButton *closeButton = nullptr;
57 QTreeWidget *tree = nullptr;
58 QTabWidget *tabs = nullptr;
59 QPlainTextEdit *markdownPreview = nullptr;
60 QPlainTextEdit *htmlPreview = nullptr;
61 QPlainTextEdit *textPreview = nullptr;
63 int htmlTabIndex = -1;
64 int textTabIndex = -1;
65};
66
67#endif
void browseFile()
Open a file picker and store the chosen path in the path field.
QString buildMarkdown(const QJsonObject &root) const
Render a Markdown-formatted summary of the metadata.
void addJsonValue(QTreeWidgetItem *parent, const QString &key, const QJsonValue &value)
Recursively add a JSON value as a tree item.
QPlainTextEdit * textPreview
QString buildPlainText(const QJsonObject &root) const
Render a plain-text summary of the metadata.
MetadataViewer(QWidget *parent=nullptr)
QTabWidget * tabs
QPlainTextEdit * markdownPreview
QTreeWidget * tree
void updateCopyButtonLabel()
Refresh the copy button label based on the active tab.
QLineEdit * pathEdit
QString buildHtml(const QJsonObject &root) const
Render an HTML-formatted summary of the metadata.
QPlainTextEdit * htmlPreview
void copyCurrentTab()
Copy the currently selected tab's text (Markdown/HTML/Text) to the system clipboard.
QPushButton * analyzeButton
QPushButton * copyButton
QPushButton * closeButton
void populateTree(const QJsonObject &root)
Populate the tree widget from a parsed ffprobe JSON object.
QPushButton * browseButton
void analyzeFile()
Launch ffprobe against the current file and refresh the tree.