@@ -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
@@ -135,49 +136,32 @@ Page {
135136 }
136137
137138 // File dialogs
138- Platform .FileDialog {
139- id: saveFileDialog
140-
141- property var _callback: undefined
142139
143- signal closed (var result)
140+ MrFileDialog {
141+ id: saveFileDialog
142+ saveMode: true
143+ nameFilters: [" *" ]
144+ property string fileToSave: " "
144145
145- title: " Save File"
146- nameFilters: [" Meshroom Graphs (*.mg)" ]
147- defaultSuffix: " .mg"
148- fileMode: Platform .FileDialog .SaveFile
146+ onFileSelected : (path ) => {
147+ fileToSave = path .toString ().replace (" file://" , " " )
148+ // Do something with the file path
149+ }
150+
149151 onAccepted: {
150- if (! validateFilepathForSave (currentFile , saveFileDialog))
152+ if (! validateFilepathForSave (fileToSave , saveFileDialog))
151153 {
152154 return ;
153155 }
154156
155157 // Only save a valid file
156- _currentScene .saveAs (currentFile)
157- MeshroomApp .addRecentProjectFile (currentFile .toString ())
158- closed (Platform .Dialog .Accepted )
159- fireCallback (Platform .Dialog .Accepted )
160- }
161- onRejected: {
162- closed (Platform .Dialog .Rejected )
163- fireCallback (Platform .Dialog .Rejected )
164- }
165-
166- function fireCallback (rc )
167- {
168- // Call the callback and reset it
169- if (_callback)
170- _callback (rc)
171- _callback = undefined
172- }
173-
174- // Open the unsaved dialog warning with an optional
175- // callback to fire when the dialog is accepted/discarded
176- function prompt (callback )
177- {
178- _callback = callback
179- open ()
158+ _currentScene .saveAs (" file://" + fileToSave)
159+ MeshroomApp .addRecentProjectFile (fileToSave .toString ())
180160 }
161+
162+ // onRejected: {
163+ // console.log("File not saved")
164+ // }
181165 }
182166
183167 Platform .FileDialog {
0 commit comments