Loading...
Searching...
No Matches

Whether the default library package is installed, and up to date. More...

Inheritance diagram for score::DefaultLibrary:

Detailed Description

Whether the default library package is installed, and up to date.

The default library is the package installed in <library>/packages/default: it holds the templates, and the presets and media that many examples use. Its installed version comes from its package.json.

The package manager lives in a plug-in: it tells this object which version is available online once it has fetched the package list, gives it the function that installs that version, and reports the progress of every install of the package, wherever it was started from. The start screen shows the state and calls install().

Public Types

enum class  State {
  Current , Missing , UpdateAvailable , Installing ,
  Failed
}
 

Public Member Functions

State state () const
 
int availableVersion () const noexcept
 -1 until the package list has been fetched.
 
qint64 downloadSize () const noexcept
 In bytes, 0 when unknown.
 
double progress () const noexcept
 Between 0 and 1 while installing, negative when the total is unknown.
 
const QString & error () const noexcept
 
void setAvailable (int version, qint64 bytes)
 From the package manager: the version of the package list.
 
void setInstaller (std::function< void()> installer)
 From the package manager: what install() calls.
 
bool canInstall () const noexcept
 
void install ()
 Installs or updates the package with the package manager's installer.
 
void setProgress (qint64 received, qint64 total)
 From the package manager, for any install of the package.
 
void setFinished (bool ok, const QString &error={})
 
bool offeredInView () const noexcept
 
void addView () noexcept
 
void removeView () noexcept
 
bool reportedInView () const noexcept
 
void changed ()
 

Static Public Member Functions

static DefaultLibrary & instance ()
 
static QUuid key ()
 The key of the package, as its package.json and the package list have it.
 
static QString folder ()
 Where the package is installed, empty if there is no user library.
 
static int installedVersion ()
 The version in its package.json; -1 when it is not installed.
 

Member Enumeration Documentation

◆ State

enum class score::DefaultLibrary::State
strong
Enumerator
Current 

Installed, and no newer version is known.

Missing 

Not installed.

UpdateAvailable 

Installed, and a newer version is available online.

Installing 

A download or an extraction is under way.

Failed 

The last install failed; error() says why.

Member Function Documentation

◆ offeredInView()

bool score::DefaultLibrary::offeredInView ( ) const
inlinenoexcept

True while a view offers the install itself: the package manager then does not ask with a dialog of its own.

◆ reportedInView()

bool score::DefaultLibrary::reportedInView ( ) const
inlinenoexcept

The install under way was started from a view which still shows: it reports the result, the package manager does not with a dialog of its own.


The documentation for this class was generated from the following files: