Skip to content

Conversation

@legend-df
Copy link
Owner

Summary

  • add FlowchartPage helpers to set file paths and skip dialogs once a project folder is selected
  • let FlowchartManager prompt for a project directory, auto-generate unique .flow files, and maintain a shared flowcharts.flowproj manifest
  • support loading .flowproj bundles and refresh the project manifest when tabs are added, saved, or closed

Testing

  • cmake -S . -B build (fails: missing Qt package configuration and Catch2 download in the environment)

https://chatgpt.com/codex/tasks/task_e_68edb5fb39ec832d8fffe84e1c68846f

@legend-df legend-df merged commit 53e3d1c into codex/create-flowchart-manager Oct 14, 2025
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 287 to 343
void FlowchartManager::saveAllFlowcharts()
{
if (_tabWidget->count() == 0)
return;

if (_projectDirectory.isEmpty() && !promptForProjectDirectory()) {
updateActionsState();
return;
}

if (!ensureProjectLocation()) {
QMessageBox::warning(this,
tr("Save Flowchart"),
tr("Unable to access the selected project folder."));
updateActionsState();
return;
}

QSet<QString> usedNames = collectProjectFileNames();

bool anySaved = false;
bool encounteredError = false;

for (int i = 0; i < _tabWidget->count(); ++i) {
FlowchartPage *page = pageAt(i);
if (!page)
continue;

bool const requiresPath = page->filePath().isEmpty();
QString const path = ensureProjectPathFor(page, &usedNames);
if (path.isEmpty()) {
encounteredError = true;
break;
}

if (!requiresPath && !page->isModified())
QFileInfo const info(path);
if (!page->isModified() && info.exists())
continue;

bool const saved = saveFlowchart(page, requiresPath, !requiresPath);

if (!saved) {
if (requiresPath)
break;

continue;
if (!page->save()) {
encounteredError = true;
break;
}

anySaved = true;
}

if (encounteredError) {
QMessageBox::warning(this,
tr("Save Flowchart"),
tr("Failed to save one or more flowcharts."));
}

if (anySaved)
updateWindowModifiedFlag();

writeProjectManifest();
updateActionsState();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid writing project manifest after failed Save All

The Save All loop assigns each tab a path via ensureProjectPathFor before attempting page->save(). When any save fails, _filePath remains set even though no file was written, but the code still calls writeProjectManifest() unconditionally. The manifest therefore contains entries for flowcharts that were not saved and whose files do not exist, so re-opening the project later will try to load missing files. Consider skipping the manifest update (or rolling back the assigned file paths) when encounteredError is true.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants