Browse Source

Added a PropertiesFile::reload() method.

tags/2021-05-28
jules 13 years ago
parent
commit
8a3298ebb8
4 changed files with 11 additions and 14 deletions
  1. +5
    -4
      modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp
  2. +3
    -1
      modules/juce_data_structures/app_properties/juce_PropertiesFile.h
  3. +1
    -3
      modules/juce_graphics/native/juce_RenderingHelpers.h
  4. +2
    -6
      modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm

+ 5
- 4
modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp View File

@@ -108,7 +108,7 @@ PropertiesFile::PropertiesFile (const File& f, const Options& o)
file (f), options (o),
loadedOk (false), needsWriting (false)
{
initialise();
reload();
}
PropertiesFile::PropertiesFile (const Options& o)
@@ -116,17 +116,18 @@ PropertiesFile::PropertiesFile (const Options& o)
file (o.getDefaultFile()), options (o),
loadedOk (false), needsWriting (false)
{
initialise();
reload();
}
void PropertiesFile::initialise()
bool PropertiesFile::reload()
{
ProcessScopedLock pl (createProcessLock());
if (pl != nullptr && ! pl->isLocked())
return; // locking failure..
return false; // locking failure..
loadedOk = (! file.exists()) || loadAsBinary() || loadAsXml();
return loadedOk;
}
PropertiesFile::~PropertiesFile()


+ 3
- 1
modules/juce_data_structures/app_properties/juce_PropertiesFile.h View File

@@ -210,6 +210,9 @@ public:
*/
void setNeedsToBeSaved (bool needsToBeSaved);
/** Attempts to reload the settings from the file. */
bool reload();
//==============================================================================
/** Returns the file that's being used. */
const File& getFile() const noexcept { return file; }
@@ -229,7 +232,6 @@ private:
InterProcessLock::ScopedLockType* createProcessLock() const;
void timerCallback();
void initialise();
bool saveAsXml();
bool saveAsBinary();
bool loadAsXml();


+ 1
- 3
modules/juce_graphics/native/juce_RenderingHelpers.h View File

@@ -2506,9 +2506,7 @@ public:
void restore()
{
StateObjectType* const top = stack.getLast();
if (top != nullptr)
if (StateObjectType* const top = stack.getLast())
{
currentState = top;
stack.removeLast (1, false);


+ 2
- 6
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm View File

@@ -877,9 +877,7 @@ void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target)
BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, const String& text)
{
TextInputTarget* const target = findCurrentTextInputTarget();
if (target != nullptr)
if (TextInputTarget* const target = findCurrentTextInputTarget())
{
const Range<int> currentSelection (target->getHighlightedRegion());
@@ -900,9 +898,7 @@ BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, co
void UIViewComponentPeer::globalFocusChanged (Component*)
{
TextInputTarget* const target = findCurrentTextInputTarget();
if (target != nullptr)
if (TextInputTarget* const target = findCurrentTextInputTarget())
{
Component* comp = dynamic_cast<Component*> (target);


Loading…
Cancel
Save