GCodeWidget Improvements
ClosedPublic

Authored by rizzitello on May 4 2018, 12:28 AM.

Details

Summary
  • Do not add open files to m_openFiles
  • Reload openfiles instead of opening a new copy
    • Do not start with "new File" . User can't save it and can not print it unless saved
    • Allow for closing of files in the gcode editor
    • track the tab / documents to keep view current (needs more work ?)
Test Plan

Open Documents, Close documents.
Try to open the same document hopefully get pushed to its tab..

Diff Detail

Repository
R231 Atelier
Branch
loadone
Lint
No Linters Available
Unit
No Unit Test Coverage
rizzitello requested review of this revision.May 4 2018, 12:28 AM
rizzitello created this revision.
rizzitello edited the summary of this revision. (Show Details)May 4 2018, 12:31 AM
rizzitello edited the test plan for this revision. (Show Details)
patrickelectric added inline comments.May 4 2018, 2:28 AM
src/widgets/gcodeeditorwidget.cpp
48

This will bring the file with same URL to the front ?

rizzitello marked an inline comment as done.May 4 2018, 11:48 AM
rizzitello added inline comments.
src/widgets/gcodeeditorwidget.cpp
48

It only reloads the document, (save prompt shown if file has changed in the editor )

This does not change the tab. I will lookin to adding that as I think its expected behavior.

rizzitello edited the test plan for this revision. (Show Details)May 4 2018, 11:49 AM
rizzitello updated this revision to Diff 33664.May 4 2018, 9:46 PM
rizzitello marked an inline comment as done.
rizzitello edited the summary of this revision. (Show Details)
  • Reloaded file tab set as current
rizzitello marked an inline comment as done.May 4 2018, 9:46 PM
patrickelectric requested changes to this revision.May 5 2018, 12:21 PM
patrickelectric added inline comments.
src/widgets/gcodeeditorwidget.cpp
52

You can use documents inside a foreach loop. ref: link
This will make the code cleaner.

This revision now requires changes to proceed.May 5 2018, 12:21 PM
rizzitello updated this revision to Diff 33691.May 5 2018, 7:55 PM
  • C++11 for
  • Mapping to better track open files.
  • Remove creation of "New File". (this will confuse user can't save until you open a file in our set

up and cant print unless written to disk. We can redo this later in a better way when those are
solved)

rizzitello updated this revision to Diff 33692.May 5 2018, 7:59 PM
  • GCodeEditor::fileClosed emited when a file is closed in the view. This is then removed from the
  • Close the files delete the document
  • Merge branch 'loadone' into LOADCLOSE
rizzitello updated this revision to Diff 33693.May 5 2018, 10:18 PM
  • Reload openfiles instead of opening a new copy
  • Add file close. Works well under most cases
rizzitello retitled this revision from Do not allow user to open the same file twice. to GCodeWidget Improvements.May 5 2018, 10:20 PM
rizzitello edited the summary of this revision. (Show Details)
rizzitello edited the test plan for this revision. (Show Details)
laysrodrigues requested changes to this revision.May 6 2018, 6:08 PM
laysrodrigues added inline comments.
src/mainwindow.cpp
220

you can remove the first this.
connect(gcodeEditor, &GCodeEditorWidget::fileClosed, [this] (const QUrl& file) {

This revision now requires changes to proceed.May 6 2018, 6:08 PM
rizzitello updated this revision to Diff 33722.May 6 2018, 6:46 PM
rizzitello edited the summary of this revision. (Show Details)
rizzitello edited the test plan for this revision. (Show Details)
  • Add file close. Works well under most cases
rizzitello marked an inline comment as done.May 6 2018, 6:46 PM

Looks sane and works. Approve now or you will add the push_to_front thing?

rizzitello added a comment.EditedMay 6 2018, 8:49 PM

You will be pushed to the tab on open. This needs some more testing from us all. I have found abug in this that im not quite sure I see whats wrong yet.
Open three files close the second one the view for item 1 or 3 may be empty. Maybe @cullmann or @tcanabrava can help with that ?

patrickelectric requested changes to this revision.May 11 2018, 11:41 AM
patrickelectric added inline comments.
src/mainwindow.cpp
214

Lost code

src/widgets/gcodeeditorwidget.cpp
55

Space after comma

This revision now requires changes to proceed.May 11 2018, 11:41 AM
  • Patrick's suggestions
rizzitello marked 2 inline comments as done.May 12 2018, 12:32 PM
  • Fix issues with closing files
  • Also seams to fix crash on close with multi files
rizzitello planned changes to this revision.May 15 2018, 11:21 AM
  • Clean up reload.
  • Use QMAP[Key] = value; to put items in the map
  • Try to see why if a bunch of files are open sometimes when closing one a view is then empty (first or last)
rizzitello updated this revision to Diff 34225.May 15 2018, 7:54 PM
  • planned changes
patrickelectric accepted this revision.May 16 2018, 12:27 AM
tcanabrava accepted this revision.May 17 2018, 2:33 PM
tcanabrava added inline comments.
src/widgets/gcodeeditorwidget.h
51

QUrl&

rizzitello updated this revision to Diff 34369.May 17 2018, 2:45 PM
  • Add file close. Works well under most cases
rizzitello marked an inline comment as done.May 20 2018, 1:00 AM
rizzitello updated this revision to Diff 34498.May 20 2018, 1:03 AM
  • Rebase / style adjust
laysrodrigues accepted this revision.May 23 2018, 1:42 AM
This revision is now accepted and ready to land.May 23 2018, 1:42 AM
rizzitello closed this revision.May 23 2018, 12:59 PM