OpenCurves
0.9
|
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... | |
Utility functions dealing with the bookmarking system.
bool bookmarks::clearBookmark | ( | QSettings & | settings, |
unsigned | id | ||
) |
Clears a bookmark.
settings | The settings object to restore the bookmark from. |
id | The ID of the bookmark of interest. |
bool bookmarks::exists | ( | QSettings & | settings, |
unsigned | id | ||
) |
Check if bookmark with the given ID exists and is set.
settings | The settings object to restore the bookmark from. |
id | The 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.
[out] | name | Set to the bookmark name. May be empty even if the bookmark exists. Set to an empty string if the bookmark does not exist. |
settings | The settings object to restore the bookmark from. | |
id | The ID of the bookmark of interest. |
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:
The following PlotInstance
properties may be retrieved from curveDataMap:
QRgb
integer presenting the curve colour. Only present if it requires an explicit colour.PlotInstance::style()
PlotInstance::width()
PlotInstance::symbol()
PlotInstance::symbolSize()
PlotInstance::filterInf()
PlotInstance::filterNaN()
settings | The settings object to restore the bookmark from. |
id | The ID of the bookmark to restore. |
ui | The application. |
curveDataMap | Optional map for PlotInstance curve data. See description. |
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 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.
settings | The settings object to store the bookmark in. |
id | The bookmark ID. The number is arbitrary, though low, sequential numbers are expected and zero is generally used for the last session. |
name | The name of the bookmark, used in the UI display. |
ui | The application. |
includeInactiveSources | True 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.