A tree view panel for browsing and editing generated files.
More...
#include <file_menu.h>
|
| void | fileSaved (const QString &path) |
| | Emitted when a file has been successfully saved.
|
| void | openExternallyRequested (QPlainTextEdit *textEditor) |
| | Emitted when the user requests to open the current file externally.
|
|
| void | openPathInEditor (const QString &filePath) |
| | Opens a file in the internal editor.
|
| bool | maybeSaveCurrent () |
| | Prompts the user to save changes if the current file is modified.
|
| bool | saveCurrent () |
| | Saves the current file to disk.
|
| void | setCurrentFile (const QString &filePath) |
| | Sets the currently active file in the editor.
|
| bool | isLikelyTextFile (const QString &filePath) const |
| | Heuristically determines whether a file is likely a text file.
|
| bool | loadFileUtf8 (const QString &filePath, QString &outText, QString *outError) const |
| | Loads a file as UTF-8 text.
|
|
|
QString | mRootDir |
| | Root directory containing generated files.
|
|
QString | mCurrentFile |
| | Path of the currently opened file.
|
|
QFileSystemModel * | mModel = nullptr |
| | File system model backing the tree view.
|
|
FileTypeProxyModel * | mProxy = nullptr |
| | Proxy model used for filtering/sorting file types.
|
|
QPlainTextEdit * | mEditor = nullptr |
| | Text editor used to display and edit file contents.
|
|
QAction * | mSaveAction = nullptr |
| | Action for saving the current file.
|
|
QAction * | mRevertAction = nullptr |
| | Action for reverting changes to the current file.
|
|
QAction * | mOpenExternalAction = nullptr |
| | Action for opening the file in an external editor.
|
A tree view panel for browsing and editing generated files.
This widget provides:
- A file system view rooted at a generation directory
- An integrated text editor for viewing and editing files
- Save, revert, and open externally actions
It is typically used to inspect generated artefacts and optionally edit them.
◆ GeneratedFilesPanel()
| GeneratedFilesPanel::GeneratedFilesPanel |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs the generated files panel.
- Parameters
-
◆ fileSaved
| void GeneratedFilesPanel::fileSaved |
( |
const QString & | path | ) |
|
|
signal |
Emitted when a file has been successfully saved.
- Parameters
-
| path | The path of the saved file. |
◆ isLikelyTextFile()
| bool GeneratedFilesPanel::isLikelyTextFile |
( |
const QString & | filePath | ) |
const |
|
private |
Heuristically determines whether a file is likely a text file.
- Parameters
-
| filePath | The path of the file to check. |
- Returns
- True if the file is likely text, false otherwise.
◆ loadFileUtf8()
| bool GeneratedFilesPanel::loadFileUtf8 |
( |
const QString & | filePath, |
|
|
QString & | outText, |
|
|
QString * | outError ) const |
|
private |
Loads a file as UTF-8 text.
- Parameters
-
| filePath | The path of the file to load. |
| outText | Output parameter containing the file contents. |
| outError | Optional output parameter containing an error message. |
- Returns
- True if the file was successfully loaded, false otherwise.
◆ maybeSaveCurrent()
| bool GeneratedFilesPanel::maybeSaveCurrent |
( |
| ) |
|
|
private |
Prompts the user to save changes if the current file is modified.
- Returns
- True if it is safe to proceed (saved or discarded), false otherwise.
◆ openExternallyRequested
| void GeneratedFilesPanel::openExternallyRequested |
( |
QPlainTextEdit * | textEditor | ) |
|
|
signal |
Emitted when the user requests to open the current file externally.
- Parameters
-
| textEditor | The editor containing the file content. |
◆ openPathInEditor()
| void GeneratedFilesPanel::openPathInEditor |
( |
const QString & | filePath | ) |
|
|
private |
Opens a file in the internal editor.
- Parameters
-
| filePath | The path of the file to open. |
◆ saveCurrent()
| bool GeneratedFilesPanel::saveCurrent |
( |
| ) |
|
|
private |
Saves the current file to disk.
- Returns
- True if the file was successfully saved, false otherwise.
◆ setCurrentFile()
| void GeneratedFilesPanel::setCurrentFile |
( |
const QString & | filePath | ) |
|
|
private |
Sets the currently active file in the editor.
- Parameters
-
| filePath | The path of the file to set as current. |
◆ setGenerationRoot()
| void GeneratedFilesPanel::setGenerationRoot |
( |
const QString & | dir | ) |
|
Sets the root directory for generated files.
Updates the file system model and refreshes the view accordingly.
- Parameters
-
| dir | The directory path to use as root. |
The documentation for this class was generated from the following files:
- /__w/maki/maki/app/widgets/structure/file_menu.h
- /__w/maki/maki/app/widgets/structure/file_menu.cpp