Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
GeneratedFilesPanel Class Reference

A tree view panel for browsing and editing generated files. More...

#include <file_menu.h>

Inheritance diagram for GeneratedFilesPanel:

Signals

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.

Public Member Functions

 GeneratedFilesPanel (QWidget *parent=nullptr)
 Constructs the generated files panel.
void setGenerationRoot (const QString &dir)
 Sets the root directory for generated files.

Private Member Functions

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.

Private Attributes

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ GeneratedFilesPanel()

GeneratedFilesPanel::GeneratedFilesPanel ( QWidget * parent = nullptr)
explicit

Constructs the generated files panel.

Parameters
parentThe parent widget.

Member Function Documentation

◆ fileSaved

void GeneratedFilesPanel::fileSaved ( const QString & path)
signal

Emitted when a file has been successfully saved.

Parameters
pathThe 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
filePathThe 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
filePathThe path of the file to load.
outTextOutput parameter containing the file contents.
outErrorOptional 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
textEditorThe editor containing the file content.

◆ openPathInEditor()

void GeneratedFilesPanel::openPathInEditor ( const QString & filePath)
private

Opens a file in the internal editor.

Parameters
filePathThe 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
filePathThe 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
dirThe 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