upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -111,9 +111,7 @@ private:
|
||||
|
||||
if (tempFile.create().wasOk())
|
||||
{
|
||||
std::unique_ptr<FileOutputStream> outputStream (tempFile.createOutputStream());
|
||||
|
||||
if (outputStream != nullptr)
|
||||
if (auto outputStream = std::unique_ptr<FileOutputStream> (tempFile.createOutputStream()))
|
||||
{
|
||||
size_t pos = 0;
|
||||
size_t totalSize = data.getSize();
|
||||
@ -185,7 +183,7 @@ void ContentSharer::startNewShare (std::function<void (bool, const String&)> cal
|
||||
|
||||
// You need to pass a valid callback.
|
||||
jassert (callbackToUse);
|
||||
callback = static_cast<std::function<void (bool, const String&)>&&> (callbackToUse);
|
||||
callback = std::move (callbackToUse);
|
||||
|
||||
pimpl.reset (createPimpl());
|
||||
}
|
||||
|
@ -139,13 +139,6 @@ private:
|
||||
|
||||
void deleteTemporaryFiles();
|
||||
void sharingFinished (bool, const String&);
|
||||
|
||||
#if JUCE_ANDROID
|
||||
friend void* juce_contentSharerOpenFile (void*, void*, void*);
|
||||
friend void* juce_contentSharerQuery (void*, void*, void*, void*, void*, void*);
|
||||
friend void* juce_contentSharerGetStreamTypes (void*, void*);
|
||||
friend void juce_contentSharingCompleted (int);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
@ -28,9 +28,7 @@ namespace juce
|
||||
{
|
||||
|
||||
DirectoryContentsList::DirectoryContentsList (const FileFilter* f, TimeSliceThread& t)
|
||||
: fileFilter (f), thread (t),
|
||||
fileTypeFlags (File::ignoreHiddenFiles | File::findFiles),
|
||||
shouldStop (true)
|
||||
: fileFilter (f), thread (t)
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,7 +53,7 @@ void DirectoryContentsList::setDirectory (const File& directory,
|
||||
const bool includeDirectories,
|
||||
const bool includeFiles)
|
||||
{
|
||||
jassert (includeDirectories || includeFiles); // you have to speciify at least one of these!
|
||||
jassert (includeDirectories || includeFiles); // you have to specify at least one of these!
|
||||
|
||||
if (directory != root)
|
||||
{
|
||||
@ -67,9 +65,13 @@ void DirectoryContentsList::setDirectory (const File& directory,
|
||||
fileTypeFlags &= ~(File::findDirectories | File::findFiles);
|
||||
}
|
||||
|
||||
int newFlags = fileTypeFlags;
|
||||
if (includeDirectories) newFlags |= File::findDirectories; else newFlags &= ~File::findDirectories;
|
||||
if (includeFiles) newFlags |= File::findFiles; else newFlags &= ~File::findFiles;
|
||||
auto newFlags = fileTypeFlags;
|
||||
|
||||
if (includeDirectories) newFlags |= File::findDirectories;
|
||||
else newFlags &= ~File::findDirectories;
|
||||
|
||||
if (includeFiles) newFlags |= File::findFiles;
|
||||
else newFlags &= ~File::findFiles;
|
||||
|
||||
setTypeFlags (newFlags);
|
||||
}
|
||||
@ -103,7 +105,9 @@ void DirectoryContentsList::clear()
|
||||
|
||||
void DirectoryContentsList::refresh()
|
||||
{
|
||||
clear();
|
||||
stopSearching();
|
||||
wasEmpty = files.isEmpty();
|
||||
files.clear();
|
||||
|
||||
if (root.isDirectory())
|
||||
{
|
||||
@ -123,7 +127,6 @@ void DirectoryContentsList::setFileFilter (const FileFilter* newFileFilter)
|
||||
int DirectoryContentsList::getNumFiles() const noexcept
|
||||
{
|
||||
const ScopedLock sl (fileListLock);
|
||||
|
||||
return files.size();
|
||||
}
|
||||
|
||||
@ -174,7 +177,7 @@ void DirectoryContentsList::changed()
|
||||
//==============================================================================
|
||||
int DirectoryContentsList::useTimeSlice()
|
||||
{
|
||||
const uint32 startTime = Time::getApproximateMillisecondCounter();
|
||||
auto startTime = Time::getApproximateMillisecondCounter();
|
||||
bool hasChanged = false;
|
||||
|
||||
for (int i = 100; --i >= 0;)
|
||||
@ -218,6 +221,9 @@ bool DirectoryContentsList::checkNextFile (bool& hasChanged)
|
||||
}
|
||||
|
||||
fileFindHandle.reset();
|
||||
|
||||
if (! wasEmpty && files.isEmpty())
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -234,14 +240,14 @@ bool DirectoryContentsList::addFile (const File& file, const bool isDir,
|
||||
|| ((! isDir) && fileFilter->isFileSuitable (file))
|
||||
|| (isDir && fileFilter->isDirectorySuitable (file)))
|
||||
{
|
||||
std::unique_ptr<FileInfo> info (new FileInfo());
|
||||
auto info = std::make_unique<FileInfo>();
|
||||
|
||||
info->filename = file.getFileName();
|
||||
info->fileSize = fileSize;
|
||||
info->filename = file.getFileName();
|
||||
info->fileSize = fileSize;
|
||||
info->modificationTime = modTime;
|
||||
info->creationTime = creationTime;
|
||||
info->isDirectory = isDir;
|
||||
info->isReadOnly = isReadOnly;
|
||||
info->creationTime = creationTime;
|
||||
info->isDirectory = isDir;
|
||||
info->isReadOnly = isReadOnly;
|
||||
|
||||
for (int i = files.size(); --i >= 0;)
|
||||
if (files.getUnchecked(i)->filename == info->filename)
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
TimeSliceThread& threadToUse);
|
||||
|
||||
/** Destructor. */
|
||||
~DirectoryContentsList();
|
||||
~DirectoryContentsList() override;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
@ -201,15 +201,17 @@ public:
|
||||
|
||||
private:
|
||||
File root;
|
||||
const FileFilter* fileFilter;
|
||||
const FileFilter* fileFilter = nullptr;
|
||||
TimeSliceThread& thread;
|
||||
int fileTypeFlags;
|
||||
int fileTypeFlags = File::ignoreHiddenFiles | File::findFiles;
|
||||
|
||||
CriticalSection fileListLock;
|
||||
OwnedArray<FileInfo> files;
|
||||
|
||||
std::unique_ptr<DirectoryIterator> fileFindHandle;
|
||||
bool volatile shouldStop;
|
||||
std::atomic<bool> shouldStop { true };
|
||||
|
||||
bool wasEmpty = true;
|
||||
|
||||
int useTimeSlice() override;
|
||||
void stopSearching();
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
FilePreviewComponent* previewComp);
|
||||
|
||||
/** Destructor. */
|
||||
~FileBrowserComponent();
|
||||
~FileBrowserComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the number of files that the user has got selected.
|
||||
@ -183,7 +183,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
// These return a pointer to an internally cached drawable - make sure you don't keep
|
||||
// a copy of this pointer anywhere, as it may become invalid in the future.
|
||||
|
@ -39,10 +39,11 @@ public:
|
||||
|
||||
filter (selectsFiles ? owner.filters : String(), selectsDirectories ? "*" : String(), {}),
|
||||
browserComponent (flags, owner.startingFile, &filter, preview),
|
||||
dialogBox (owner.title, {}, browserComponent, warnAboutOverwrite, browserComponent.findColour (AlertWindow::backgroundColourId))
|
||||
dialogBox (owner.title, {}, browserComponent, warnAboutOverwrite,
|
||||
browserComponent.findColour (AlertWindow::backgroundColourId), owner.parent)
|
||||
{}
|
||||
|
||||
~NonNative()
|
||||
~NonNative() override
|
||||
{
|
||||
dialogBox.exitModalState (0);
|
||||
}
|
||||
@ -92,10 +93,12 @@ FileChooser::FileChooser (const String& chooserBoxTitle,
|
||||
const File& currentFileOrDirectory,
|
||||
const String& fileFilters,
|
||||
const bool useNativeBox,
|
||||
const bool treatFilePackagesAsDirectories)
|
||||
const bool treatFilePackagesAsDirectories,
|
||||
Component* parentComponentToUse)
|
||||
: title (chooserBoxTitle),
|
||||
filters (fileFilters),
|
||||
startingFile (currentFileOrDirectory),
|
||||
parent (parentComponentToUse),
|
||||
useNativeDialogBox (useNativeBox && isPlatformDialogAvailable()),
|
||||
treatFilePackagesAsDirs (treatFilePackagesAsDirectories)
|
||||
{
|
||||
@ -175,7 +178,7 @@ void FileChooser::launchAsync (int flags, std::function<void (const FileChooser&
|
||||
// you cannot run two file chooser dialog boxes at the same time
|
||||
jassert (asyncCallback == nullptr);
|
||||
|
||||
asyncCallback = static_cast<std::function<void (const FileChooser&)>&&> (callback);
|
||||
asyncCallback = std::move (callback);
|
||||
|
||||
pimpl.reset (createPimpl (flags, previewComp));
|
||||
pimpl->launch();
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
initialFileOrDirectory will be used as the initial
|
||||
directory of the native file chooser.
|
||||
|
||||
Note: on iOS when saving a file, a user will not
|
||||
Note: On iOS when saving a file, a user will not
|
||||
be able to change a file name, so it may be a good
|
||||
idea to include at least a valid file name in
|
||||
initialFileOrDirectory. When no filename is found,
|
||||
@ -107,6 +107,11 @@ public:
|
||||
selection of files inside packages when
|
||||
invoked on OS X and when using native dialog
|
||||
boxes.
|
||||
@param parentComponent An optional component which should be the parent
|
||||
for the file chooser. If this is a nullptr then the
|
||||
FileChooser will be a top-level window. AUv3s on iOS
|
||||
must specify this parameter as opening a top-level window
|
||||
in an AUv3 is forbidden due to sandbox restrictions.
|
||||
|
||||
@see browseForFileToOpen, browseForFileToSave, browseForDirectory
|
||||
*/
|
||||
@ -114,7 +119,8 @@ public:
|
||||
const File& initialFileOrDirectory = File(),
|
||||
const String& filePatternsAllowed = String(),
|
||||
bool useOSNativeDialogBox = true,
|
||||
bool treatFilePackagesAsDirectories = false);
|
||||
bool treatFilePackagesAsDirectories = false,
|
||||
Component* parentComponent = nullptr);
|
||||
|
||||
/** Destructor. */
|
||||
~FileChooser();
|
||||
@ -245,7 +251,7 @@ public:
|
||||
may return a URL to a remote document. If a local file is chosen then you can
|
||||
convert this file to a JUCE File class via the URL::getLocalFile method.
|
||||
|
||||
Note: on iOS you must use the returned URL object directly (you are also
|
||||
Note: On iOS you must use the returned URL object directly (you are also
|
||||
allowed to copy- or move-construct another URL from the returned URL), rather
|
||||
than just storing the path as a String and then creating a new URL from that
|
||||
String. This is because the returned URL contains internally a security
|
||||
@ -268,7 +274,7 @@ public:
|
||||
This array may be empty if no files were chosen, or can contain multiple entries
|
||||
if multiple files were chosen.
|
||||
|
||||
Note: on iOS you must use the returned URL object directly (you are also
|
||||
Note: On iOS you must use the returned URL object directly (you are also
|
||||
allowed to copy- or move-construct another URL from the returned URL), rather
|
||||
than just storing the path as a String and then creating a new URL from that
|
||||
String. This is because the returned URL contains internally a security
|
||||
@ -300,6 +306,7 @@ private:
|
||||
//==============================================================================
|
||||
String title, filters;
|
||||
File startingFile;
|
||||
Component* parent;
|
||||
Array<URL> results;
|
||||
const bool useNativeDialogBox;
|
||||
const bool treatFilePackagesAsDirs;
|
||||
@ -311,7 +318,7 @@ private:
|
||||
//==============================================================================
|
||||
struct Pimpl
|
||||
{
|
||||
virtual ~Pimpl() {}
|
||||
virtual ~Pimpl() = default;
|
||||
|
||||
virtual void launch() = 0;
|
||||
virtual void runModally() = 0;
|
||||
|
@ -94,8 +94,9 @@ FileChooserDialogBox::FileChooserDialogBox (const String& name,
|
||||
const String& instructions,
|
||||
FileBrowserComponent& chooserComponent,
|
||||
bool shouldWarn,
|
||||
Colour backgroundColour)
|
||||
: ResizableWindow (name, backgroundColour, true),
|
||||
Colour backgroundColour,
|
||||
Component* parentComponent)
|
||||
: ResizableWindow (name, backgroundColour, parentComponent == nullptr),
|
||||
warnAboutOverwritingExistingFiles (shouldWarn)
|
||||
{
|
||||
content = new ContentComponent (name, instructions, chooserComponent);
|
||||
@ -111,6 +112,9 @@ FileChooserDialogBox::FileChooserDialogBox (const String& name,
|
||||
content->chooserComponent.addListener (this);
|
||||
|
||||
FileChooserDialogBox::selectionChanged();
|
||||
|
||||
if (parentComponent != nullptr)
|
||||
parentComponent->addAndMakeVisible (this);
|
||||
}
|
||||
|
||||
FileChooserDialogBox::~FileChooserDialogBox()
|
||||
|
@ -81,6 +81,11 @@ public:
|
||||
if they try to select a file that already exists. (This
|
||||
flag is only used when saving files)
|
||||
@param backgroundColour the background colour for the top level window
|
||||
@param parentComponent an optional component which should be the parent
|
||||
for the file chooser. If this is a nullptr then the
|
||||
dialog box will be a top-level window. AUv3s on iOS
|
||||
must specify this parameter as opening a top-level window
|
||||
in an AUv3 is forbidden due to sandbox restrictions.
|
||||
|
||||
@see FileBrowserComponent, FilePreviewComponent
|
||||
*/
|
||||
@ -88,10 +93,11 @@ public:
|
||||
const String& instructions,
|
||||
FileBrowserComponent& browserComponent,
|
||||
bool warnAboutOverwritingExistingFiles,
|
||||
Colour backgroundColour);
|
||||
Colour backgroundColour,
|
||||
Component* parentComponent = nullptr);
|
||||
|
||||
/** Destructor. */
|
||||
~FileChooserDialogBox();
|
||||
~FileChooserDialogBox() override;
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_MODAL_LOOPS_PERMITTED
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~ItemComponent()
|
||||
~ItemComponent() override
|
||||
{
|
||||
thread.removeTimeSliceClient (this);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
FileListComponent (DirectoryContentsList& listToShow);
|
||||
|
||||
/** Destructor. */
|
||||
~FileListComponent();
|
||||
~FileListComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the number of files the user has got selected.
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
FilePreviewComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~FilePreviewComponent();
|
||||
~FilePreviewComponent() override;
|
||||
|
||||
/** Called to indicate that the user's currently selected file has changed.
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
FileSearchPathListComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~FileSearchPathListComponent();
|
||||
~FileSearchPathListComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the path as it is currently shown. */
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~FileListTreeItem()
|
||||
~FileListTreeItem() override
|
||||
{
|
||||
thread.removeTimeSliceClient (this);
|
||||
clearSubItems();
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
FileTreeComponent (DirectoryContentsList& listToShow);
|
||||
|
||||
/** Destructor. */
|
||||
~FileTreeComponent();
|
||||
~FileTreeComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the number of files the user has got selected.
|
||||
|
@ -42,7 +42,7 @@ class JUCE_API FilenameComponentListener
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~FilenameComponentListener() {}
|
||||
virtual ~FilenameComponentListener() = default;
|
||||
|
||||
/** This method is called after the FilenameComponent's file has been changed. */
|
||||
virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
|
||||
@ -100,7 +100,7 @@ public:
|
||||
const String& textWhenNothingSelected);
|
||||
|
||||
/** Destructor. */
|
||||
~FilenameComponent();
|
||||
~FilenameComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the currently displayed filename. */
|
||||
@ -191,7 +191,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual Button* createFilenameComponentBrowseButton (const String& text) = 0;
|
||||
virtual void layoutFilenameComponent (FilenameComponent&, ComboBox* filenameBox, Button* browseButton) = 0;
|
||||
|
@ -38,12 +38,12 @@ ImagePreviewComponent::~ImagePreviewComponent()
|
||||
//==============================================================================
|
||||
void ImagePreviewComponent::getThumbSize (int& w, int& h) const
|
||||
{
|
||||
const int availableW = proportionOfWidth (0.97f);
|
||||
const int availableH = getHeight() - 13 * 4;
|
||||
auto availableW = proportionOfWidth (0.97f);
|
||||
auto availableH = getHeight() - 13 * 4;
|
||||
|
||||
const double scale = jmin (1.0,
|
||||
availableW / (double) w,
|
||||
availableH / (double) h);
|
||||
auto scale = jmin (1.0,
|
||||
availableW / (double) w,
|
||||
availableH / (double) h);
|
||||
|
||||
w = roundToInt (scale * w);
|
||||
h = roundToInt (scale * h);
|
||||
@ -66,18 +66,18 @@ void ImagePreviewComponent::timerCallback()
|
||||
currentDetails.clear();
|
||||
repaint();
|
||||
|
||||
std::unique_ptr<FileInputStream> in (fileToLoad.createInputStream());
|
||||
FileInputStream in (fileToLoad);
|
||||
|
||||
if (in != nullptr && in->getFile().existsAsFile())
|
||||
if (in.openedOk() && fileToLoad.existsAsFile())
|
||||
{
|
||||
if (ImageFileFormat* const format = ImageFileFormat::findImageFormatForStream (*in))
|
||||
if (auto format = ImageFileFormat::findImageFormatForStream (in))
|
||||
{
|
||||
currentThumbnail = format->decodeImage (*in);
|
||||
currentThumbnail = format->decodeImage (in);
|
||||
|
||||
if (currentThumbnail.isValid())
|
||||
{
|
||||
int w = currentThumbnail.getWidth();
|
||||
int h = currentThumbnail.getHeight();
|
||||
auto w = currentThumbnail.getWidth();
|
||||
auto h = currentThumbnail.getHeight();
|
||||
|
||||
currentDetails
|
||||
<< fileToLoad.getFileName() << "\n"
|
||||
@ -99,13 +99,13 @@ void ImagePreviewComponent::paint (Graphics& g)
|
||||
{
|
||||
g.setFont (13.0f);
|
||||
|
||||
int w = currentThumbnail.getWidth();
|
||||
int h = currentThumbnail.getHeight();
|
||||
auto w = currentThumbnail.getWidth();
|
||||
auto h = currentThumbnail.getHeight();
|
||||
getThumbSize (w, h);
|
||||
|
||||
const int numLines = 4;
|
||||
const int totalH = 13 * numLines + h + 4;
|
||||
const int y = (getHeight() - totalH) / 2;
|
||||
auto totalH = 13 * numLines + h + 4;
|
||||
auto y = (getHeight() - totalH) / 2;
|
||||
|
||||
g.drawImageWithin (currentThumbnail,
|
||||
(getWidth() - w) / 2, y, w, h,
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
ImagePreviewComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~ImagePreviewComponent();
|
||||
~ImagePreviewComponent() override;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
Reference in New Issue
Block a user