kwave
18.07.70
Label.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
Label.cpp - representation of a label within a signal
3
-------------------
4
begin : Mon Jul 31 2006
5
copyright : (C) 2006 by Thomas Eschenbacher
6
email : Thomas.Eschenbacher@gmx.de
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#include "config.h"
19
#include "
libkwave/Label.h
"
20
21
//***************************************************************************
22
Kwave::Label::Label
()
23
:
Kwave
::
MetaData
()
// must be empty, isNull() should return true
24
{
25
}
26
27
//***************************************************************************
28
Kwave::Label::Label
(
const
Kwave::MetaData
&meta_data)
29
:
Kwave
::
MetaData
(meta_data)
30
{
31
}
32
33
//***************************************************************************
34
Kwave::Label::Label
(
sample_index_t
position,
const
QString &
name
)
35
:
Kwave
::
MetaData
(
Kwave
::
MetaData
::
Position
)
36
{
37
setProperty
(
Kwave::MetaData::STDPROP_TYPE
,
metaDataType
());
38
setProperty
(
Kwave::MetaData::STDPROP_POS
, position);
39
if
(name.length())
40
setProperty
(
Kwave::MetaData::STDPROP_DESCRIPTION
, name);
41
}
42
43
//***************************************************************************
44
Kwave::Label::~Label
()
45
{
46
}
47
48
//***************************************************************************
49
void
Kwave::Label::moveTo
(
sample_index_t
position)
50
{
51
if
(
isNull
())
setProperty
(
Kwave::MetaData::STDPROP_TYPE
,
metaDataType
());
52
setProperty
(
Kwave::MetaData::STDPROP_POS
, position);
53
}
54
55
//***************************************************************************
56
sample_index_t
Kwave::Label::pos
()
const
57
{
58
return
static_cast<
sample_index_t
>
(
59
property
(
Kwave::MetaData::STDPROP_POS
).toULongLong()
60
);
61
}
62
63
//***************************************************************************
64
void
Kwave::Label::rename
(
const
QString &
name
)
65
{
66
if
(
isNull
())
setProperty
(
Kwave::MetaData::STDPROP_TYPE
,
metaDataType
());
67
if
(name.length())
68
setProperty
(
Kwave::MetaData::STDPROP_DESCRIPTION
, name);
69
else
70
setProperty
(
Kwave::MetaData::STDPROP_DESCRIPTION
, QVariant());
71
}
72
73
//***************************************************************************
74
QString
Kwave::Label::name
()
const
75
{
76
return
property
(
Kwave::MetaData::STDPROP_DESCRIPTION
).toString();
77
}
78
79
//***************************************************************************
80
//***************************************************************************
Kwave::MetaData::STDPROP_POS
static const QString STDPROP_POS
Definition:
MetaData.h:53
Kwave
Definition:
App.h:33
Kwave::Label::Label
Label()
Definition:
Label.cpp:22
Kwave::MetaData
Definition:
MetaData.h:37
Kwave::Label::moveTo
virtual void moveTo(sample_index_t position)
Definition:
Label.cpp:49
Kwave::Label::pos
virtual sample_index_t pos() const
Definition:
Label.cpp:56
sample_index_t
quint64 sample_index_t
Definition:
Sample.h:28
Kwave::Label::metaDataType
static QString metaDataType()
Definition:
Label.h:59
Kwave::MetaData::STDPROP_TYPE
static const QString STDPROP_TYPE
Definition:
MetaData.h:41
Kwave::MetaData::isNull
virtual bool isNull() const
Definition:
MetaData.cpp:69
Kwave::Label::name
virtual QString name() const
Definition:
Label.cpp:74
Kwave::MetaData::Position
Definition:
MetaData.h:84
Kwave::Label::rename
virtual void rename(const QString &name)
Definition:
Label.cpp:64
Kwave::MetaData::setProperty
void setProperty(const QString &p, const QVariant &value)
Definition:
MetaData.cpp:93
Label.h
Kwave::MetaData::property
QVariant property(const QString &p) const
Definition:
MetaData.cpp:110
Kwave::Label::~Label
virtual ~Label()
Definition:
Label.cpp:44
Kwave::MetaData::STDPROP_DESCRIPTION
static const QString STDPROP_DESCRIPTION
Definition:
MetaData.h:56
libkwave
Label.cpp
Generated on Sat Mar 24 2018 09:10:25 for kwave by
1.8.13