mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
FileChoosers: Added a file-chooser save mode where the caller already supplies a temporary file which should be saved. JUCE will automatically move the temporary file to the location selected by the user
This commit is contained in:
parent
fd6b7de444
commit
df8fc9b910
8 changed files with 86 additions and 37 deletions
|
|
@ -317,8 +317,16 @@ private:
|
|||
}
|
||||
else if (type == saveChooser)
|
||||
{
|
||||
File fileToSave = File::createTempFile ("saveChooserDemo");
|
||||
|
||||
if (fileToSave.createDirectory().wasOk())
|
||||
{
|
||||
fileToSave = fileToSave.getChildFile ("JUCE.png");
|
||||
fileToSave.replaceWithData (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize);
|
||||
}
|
||||
|
||||
fc = new FileChooser ("Choose a file to save...",
|
||||
File::getCurrentWorkingDirectory(),
|
||||
File::getCurrentWorkingDirectory().getChildFile (fileToSave.getFileName()),
|
||||
"*",
|
||||
useNativeVersion);
|
||||
|
||||
|
|
@ -333,7 +341,7 @@ private:
|
|||
AlertWindow::showMessageBoxAsync (AlertWindow::InfoIcon,
|
||||
"File Chooser...",
|
||||
"You picked: " + name);
|
||||
});
|
||||
}, nullptr, fileToSave);
|
||||
}
|
||||
else if (type == directoryChooser)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue