@@ -12,6 +12,7 @@ import GraphEditor 1.0
1212import MaterialIcons 2.2
1313import Utils 1.0
1414import Controls 1.0
15+ import Dialogs 1.0
1516
1617Page {
1718 id: root
@@ -129,49 +130,31 @@ Page {
129130 }
130131
131132 // File dialogs
132- Platform .FileDialog {
133- id: saveFileDialog
134-
135- property var _callback: undefined
136133
137- signal closed (var result)
134+ MrFileDialog {
135+ id: saveFileDialog
136+ saveMode: true
137+ nameFilters: [" *" ]
138+ property string fileToSave: " "
138139
139- title: " Save File"
140- nameFilters: [" Meshroom Graphs (*.mg)" ]
141- defaultSuffix: " .mg"
142- fileMode: Platform .FileDialog .SaveFile
140+ onFileSelected : (path ) => {
141+ fileToSave = path .toString ().replace (" file://" , " " )
142+ // Do something with the file path
143+ }
144+
143145 onAccepted: {
144- if (! validateFilepathForSave (currentFile , saveFileDialog))
146+ if (! validateFilepathForSave (fileToSave , saveFileDialog))
145147 {
146148 return ;
147149 }
148150
149151 // Only save a valid file
150- _reconstruction .saveAs (currentFile)
151- MeshroomApp .addRecentProjectFile (currentFile .toString ())
152- closed (Platform .Dialog .Accepted )
153- fireCallback (Platform .Dialog .Accepted )
154- }
155- onRejected: {
156- closed (Platform .Dialog .Rejected )
157- fireCallback (Platform .Dialog .Rejected )
158- }
159-
160- function fireCallback (rc )
161- {
162- // Call the callback and reset it
163- if (_callback)
164- _callback (rc)
165- _callback = undefined
166- }
167-
168- // Open the unsaved dialog warning with an optional
169- // callback to fire when the dialog is accepted/discarded
170- function prompt (callback )
171- {
172- _callback = callback
173- open ()
152+ _reconstruction .saveAs (" file://" + fileToSave)
153+ MeshroomApp .addRecentProjectFile (fileToSave .toString ())
174154 }
155+ // onRejected: {
156+ // console.log("File not saved")
157+ // }
175158 }
176159
177160 Platform .FileDialog {
0 commit comments