Relacs Core Library
0.9.8
|
#include <metadata.h>
Public Slots | |
int | dialog (void) |
void | presetDialog (void) |
Public Member Functions | |
MetaData (RELACSWidget *rw) | |
~MetaData (void) | |
virtual void | notify (void) |
void | update (void) |
void | add (const string &title="", const Options &opts=Options()) |
void | remove (void) |
void | save (void) |
ostream & | saveXML (ostream &str, int level=0, const string &name="") |
void | clear (void) |
void | add (ConfigClass *opt) |
void | lock (void) const |
void | unlock (void) const |
QMutex * | mutex (void) |
void | addActions (QMenu *menu) |
int | saveFlags (void) const |
void | setSaveFlags (int flags) |
void | addSaveFlags (int flags) |
void | delSaveFlags (int flags) |
Static Public Member Functions | |
static int | dialogFlag (void) |
static int | presetDialogFlag (void) |
static int | configFlag (void) |
static int | standardFlag (void) |
Protected Slots | |
void | dialogClosed (int r) |
Protected Member Functions | |
virtual void | customEvent (QEvent *qe) |
void | setSectionName (Options *opt, const string &name) |
Manages meta data describing a recording session.
Meta data are loaded from both the relacs.cfg
and the relacsplugins.cfg
file (after Control::initialize() and before Control::initDevices() is called) via two instances of the MetaDataGroup class.
Never add options to MetaData within a Control constructor, since these get cleared right before the meta data are loaded from the configuration files!
With the dialogFlag() and the presetDialogFlag() meta data can be selected that are displayed in the dialog() or presetDialog(), respectively.
The "Recording" section is always created by MetaData and contains a few standard properties. A couple of predifined properties are defined in the Recording section:
The values of the standard options are set appropriately in save() right before they are saved to the info file of the session.
If you really want you can remove individual standard options in Control::config() by doing something like
MetaData | ( | RELACSWidget * | rw | ) |
References MetaData::clear().
~MetaData | ( | void | ) |
|
virtual |
React to changes in the meta data sections. This function calls notifyMetaData() in all RELACSPlugins.
References RELACSWidget::notifyMetaData().
void update | ( | void | ) |
Update the values of the standarad meta data. Should be called before save().
References Str::expandedPath(), MetaData::lock(), RELACSWidget::modeStr(), Str::name(), SaveFiles::path(), Session::sessionTime(), Session::startSessionTime(), and MetaData::unlock().
Referenced by RELACSWidget::stopSession().
Add the meta data opts with title title as a section to the meta data, if both of them are not empty.
References MetaData::lock(), MetaData::saveFlags(), and MetaData::unlock().
Referenced by MetaDataGroup::readConfig(), and RELACSWidget::stopSession().
void remove | ( | void | ) |
Remove an added section from the metadata.
References MetaData::lock(), and MetaData::unlock().
Referenced by RELACSWidget::stopSession().
void save | ( | void | ) |
Saves the meta data of all sections into the info file of the session.
References SaveFiles::addPath(), ConfigDialog::lock(), MetaData::lock(), MetaData::saveFlags(), ConfigClass::text(), ConfigDialog::unlock(), and MetaData::unlock().
Referenced by RELACSWidget::stopSession().
ostream & saveXML | ( | ostream & | str, |
int | level = 0 , |
||
const string & | name = "" |
||
) |
Write meta data that have saveFlags() set in their flags() in XML format to output stream.
[in] | str | the output stream |
[in] | level | the level of indentation |
[in] | name | the name prefix for the name tag of the section. |
References MetaData::lock(), MetaData::saveFlags(), MetaData::setSectionName(), and MetaData::unlock().
Referenced by SaveFiles::ODMLFiles::close().
void clear | ( | void | ) |
Clear the entire meta data.
References MetaDataGroup::clear(), MetaData::lock(), and MetaData::unlock().
Referenced by RELACSWidget::clearActivity(), RELACSWidget::init(), MetaData::MetaData(), and RELACSWidget::startIdle().
void add | ( | ConfigClass * | opt | ) |
Notify MetaData about loaded meta data opt.
References ConfigClass::configGroup(), RELACSPlugin::Core, ConfigClass::name(), and ConfigClass::sectionsSize().
void lock | ( | void | ) | const |
Lock the meta data.
Referenced by MetaData::add(), SaveFiles::addFile(), MetaData::clear(), MetaDataGroup::configSize(), RELACSPlugin::lockMetaData(), MetaDataGroup::readConfig(), MetaData::remove(), MetaData::save(), MetaDataGroup::saveConfig(), MetaData::saveXML(), and MetaData::update().
void unlock | ( | void | ) | const |
Unlock the meta data.
Referenced by MetaData::add(), SaveFiles::addFile(), MetaData::clear(), MetaDataGroup::configSize(), MetaData::dialog(), MetaData::presetDialog(), MetaDataGroup::readConfig(), MetaData::remove(), MetaData::save(), MetaDataGroup::saveConfig(), MetaData::saveXML(), RELACSPlugin::unlockMetaData(), and MetaData::update().
QMutex * mutex | ( | void | ) |
The mutex of the meta data.
Referenced by RELACSPlugin::metaDataMutex().
void addActions | ( | QMenu * | menu | ) |
Add actions to the RELACS menu.
References MetaData::presetDialog().
Referenced by RELACSWidget::RELACSWidget().
|
static |
The flag that is used to mark meta data options for the dialog.
Referenced by MetaData::dialog(), MetaData::presetDialog(), and MetaDataGroup::readConfig().
|
static |
The flag that is used to mark meta data options for the preset dialog.
Referenced by MetaData::presetDialog().
|
static |
The flag that is used by MetaDataGroup::readConfig() to mark meta data options loaded from the config file.
Referenced by MetaDataGroup::configSize(), MetaDataGroup::MetaDataGroup(), MetaDataGroup::readConfig(), and MetaDataGroup::saveConfig().
|
static |
The flag that is used to mark the standard options.
Referenced by SaveFiles::addFile(), and MetaDataGroup::addRecordingOptions().
int saveFlags | ( | void | ) | const |
The flags that are used to select meta-data Options to be saved in the info file of the session (default (=0) selects all).
Referenced by MetaData::add(), MetaData::save(), and MetaData::saveXML().
void setSaveFlags | ( | int | flags | ) |
Set the flags that are used to select meta-data Options to be saved in the info file of the session to flags. Setting flags to 0 selects all (default).
void addSaveFlags | ( | int | flags | ) |
Add flags to the flags that are used to select meta-data Options to be saved in the info file of the session.
void delSaveFlags | ( | int | flags | ) |
Delete the bits set in flags from the flags that are used to select meta-data Options to be saved in the info file of the session.
|
slot |
Launches a dialog at stopTheSession(). It should return 1 to stop and safe the data, 0 to stop and discard the data, and -1 to continue the session. If -1000 is returned, then the dialog() functions should be called again at a later time, because the MetaData are currently locked.
References OptDialog::Accept, OptDialog::addButton(), OptDialog::addOptions(), OptWidget::BoldSectionsStyle, OptDialog::Defaults, MetaData::dialogClosed(), MetaData::dialogFlag(), OptDialog::exec(), OptDialog::NoAction, OptDialog::setCaption(), OptDialog::setRejectCode(), and MetaData::unlock().
Referenced by Session::doStopTheSession().
|
slot |
Launches a dialog from the menu. It is used to preset values of the dialog().
References OptDialog::Accept, OptDialog::addButton(), OptDialog::addOptions(), OptWidget::BoldSectionsStyle, OptDialog::Defaults, MetaData::dialogClosed(), MetaData::dialogFlag(), OptDialog::exec(), MetaData::presetDialogFlag(), OptDialog::setCaption(), OptDialog::setRejectCode(), and MetaData::unlock().
Referenced by MetaData::addActions(), and MetaData::customEvent().
|
protectedslot |
Informs MetaData that the dialog window is closed.
Referenced by MetaData::dialog(), and MetaData::presetDialog().
|
protectedvirtual |
References MetaData::presetDialog().
|
protected |
Referenced by MetaData::saveXML().