OpenCurves  0.9
bookmarks Namespace Reference

Utility functions dealing with the bookmarking system. More...

Functions

void setBookmark (QSettings &settings, unsigned id, const QString &name, OCurvesUI *ui, bool includeInactiveSources=false)
 Bookmark the current OCurvesUI state. More...
 
void setBookmark (QSettings &settings, unsigned id, OCurvesUI *ui, bool includeInactiveSources=false)
 
bool restoreBookmak (QSettings &settings, unsigned id, OCurvesUI *ui, VariantMap *curveDataMap=nullptr)
 Attempts to restore a bookmark. More...
 
bool clearBookmark (QSettings &settings, unsigned id)
 Clears a bookmark. More...
 
bool exists (QSettings &settings, unsigned id)
 Check if bookmark with the given ID exists and is set. More...
 
bool name (QString &name, QSettings &settings, unsigned id)
 Fetch the name of a bookmark if it exists. More...
 
void migrate (QSettings &to, QSettings &from, int bookmarkCount)
 Migrate bookmark settings from from to to. More...
 

Detailed Description

Utility functions dealing with the bookmarking system.

Function Documentation

bool bookmarks::clearBookmark ( QSettings &  settings,
unsigned  id 
)

Clears a bookmark.

Parameters
settingsThe settings object to restore the bookmark from.
idThe ID of the bookmark of interest.
Returns
True if the bookmark ID was valid.
bool bookmarks::exists ( QSettings &  settings,
unsigned  id 
)

Check if bookmark with the given ID exists and is set.

Parameters
settingsThe settings object to restore the bookmark from.
idThe ID of the bookmark of interest.
void bookmarks::migrate ( QSettings &  to,
QSettings &  from,
int  bookmarkCount 
)

Migrate bookmark settings from from to to.

For import/export.

bool bookmarks::name ( QString &  name,
QSettings &  settings,
unsigned  id 
)

Fetch the name of a bookmark if it exists.

Parameters
[out]nameSet to the bookmark name. May be empty even if the bookmark exists. Set to an empty string if the bookmark does not exist.
settingsThe settings object to restore the bookmark from.
idThe ID of the bookmark of interest.
Returns
True if the bookmark exists.
bool bookmarks::restoreBookmak ( QSettings &  settings,
unsigned  id,
OCurvesUI ui,
VariantMap *  curveDataMap = nullptr 
)

Attempts to restore a bookmark.

This restores all settings stored in the bookmark. Any file sources which aren't currently loaded are queued for loading.

The bookmark may also contain settings which relate to specific PlotInstance curves. These are not loaded directly as there is no guarantee that the curve exists yet. Restoring the bookmark may queue loading of such curves. To this end, such PlotInstance data are instead loaded into the curveDataMap (if provided). Settings are keyed as follows:

  • {source-name}|{curve-name}|{property}

The following PlotInstance properties may be retrieved from curveDataMap:

Parameters
settingsThe settings object to restore the bookmark from.
idThe ID of the bookmark to restore.
uiThe application.
curveDataMapOptional map for PlotInstance curve data. See description.
Returns
True if the bookmark ID is valid and is being restored.
void bookmarks::setBookmark ( QSettings &  settings,
unsigned  id,
const QString &  name,
OCurvesUI ui,
bool  includeInactiveSources = false 
)

Bookmark the current OCurvesUI state.

The bookmark is stored in settings under the given id and name. The bookmark is essentially a snapshot of the current state, with limited exclusions on the currently loaded sources.

In general terms, the bookmark stores the following settings:

  • The UI state and layout, including split views and zoom levels.
  • The current expressions.
  • The currently selected sources and plots.

The bookmark also stores the list of selected file sources to ensure they are loaded when the bookmark is restored. This may optionally include all sources, not just selected ones, when includeInactiveSources is true.

Parameters
settingsThe settings object to store the bookmark in.
idThe bookmark ID. The number is arbitrary, though low, sequential numbers are expected and zero is generally used for the last session.
nameThe name of the bookmark, used in the UI display.
uiThe application.
includeInactiveSourcesTrue to include unselected file sources when restoring.
void bookmarks::setBookmark ( QSettings &  settings,
unsigned  id,
OCurvesUI ui,
bool  includeInactiveSources = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.