projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c5f4733
)
Annotation: Use special type for the class, not plain int
author
Soeren Apel
<soeren@apelpie.net>
Wed, 18 Apr 2018 06:49:49 +0000
(08:49 +0200)
committer
Soeren Apel
<soeren@apelpie.net>
Thu, 19 Apr 2018 18:46:06 +0000
(20:46 +0200)
pv/data/decode/annotation.cpp
patch
|
blob
|
history
pv/data/decode/annotation.hpp
patch
|
blob
|
history
pv/views/trace/decodetrace.cpp
patch
|
blob
|
history
pv/views/trace/decodetrace.hpp
patch
|
blob
|
history
diff --git
a/pv/data/decode/annotation.cpp
b/pv/data/decode/annotation.cpp
index 7c720430e9d6cf7e6a688fd6c138cad2cd90589b..96a594c3c6ce57a07f621ce9ddf9cd439fed1acd 100644
(file)
--- a/
pv/data/decode/annotation.cpp
+++ b/
pv/data/decode/annotation.cpp
@@
-41,7
+41,7
@@
Annotation::Annotation(const srd_proto_data *const pdata) :
(const srd_proto_data_annotation*)pdata->data;
assert(pda);
(const srd_proto_data_annotation*)pdata->data;
assert(pda);
-
format_ = pda->ann_class
;
+
ann_class_ = (Class)(pda->ann_class)
;
const char *const *annotations = (char**)pda->ann_text;
while (*annotations) {
const char *const *annotations = (char**)pda->ann_text;
while (*annotations) {
@@
-60,9
+60,9
@@
uint64_t Annotation::end_sample() const
return end_sample_;
}
return end_sample_;
}
-
int Annotation::format
() const
+
Annotation::Class Annotation::ann_class
() const
{
{
- return
format
_;
+ return
ann_class
_;
}
const vector<QString>& Annotation::annotations() const
}
const vector<QString>& Annotation::annotations() const
diff --git
a/pv/data/decode/annotation.hpp
b/pv/data/decode/annotation.hpp
index 42a291a2134a5d7eb439b6a2c7dda7ffcac1238d..a107e0efeed7426584cbded2169ca639ffc47288 100644
(file)
--- a/
pv/data/decode/annotation.hpp
+++ b/
pv/data/decode/annotation.hpp
@@
-35,18
+35,21
@@
namespace decode {
class Annotation
{
class Annotation
{
+public:
+ typedef uint32_t Class;
+
public:
Annotation(const srd_proto_data *const pdata);
uint64_t start_sample() const;
uint64_t end_sample() const;
public:
Annotation(const srd_proto_data *const pdata);
uint64_t start_sample() const;
uint64_t end_sample() const;
-
int format
() const;
+
Class ann_class
() const;
const vector<QString>& annotations() const;
private:
uint64_t start_sample_;
uint64_t end_sample_;
const vector<QString>& annotations() const;
private:
uint64_t start_sample_;
uint64_t end_sample_;
-
int format
_;
+
Class ann_class
_;
vector<QString> annotations_;
};
vector<QString> annotations_;
};
diff --git
a/pv/views/trace/decodetrace.cpp
b/pv/views/trace/decodetrace.cpp
index 8dea88321a7c642cf25dc447843fad403856ab60..f4f243931bd6d27e94952afba35421a38d1ebf2e 100644
(file)
--- a/
pv/views/trace/decodetrace.cpp
+++ b/
pv/views/trace/decodetrace.cpp
@@
-406,7
+406,7
@@
void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a,
pixels_offset;
const double end = a.end_sample() / samples_per_pixel - pixels_offset;
pixels_offset;
const double end = a.end_sample() / samples_per_pixel - pixels_offset;
- QColor color = get_annotation_color(row_color, a.
format
());
+ QColor color = get_annotation_color(row_color, a.
ann_class
());
p.setPen(color.darker());
p.setBrush(color);
p.setPen(color.darker());
p.setBrush(color);
@@
-440,14
+440,14
@@
void DecodeTrace::draw_annotation_block(
const double top = y + .5 - h / 2;
const double bottom = y + .5 + h / 2;
const double top = y + .5 - h / 2;
const double bottom = y + .5 + h / 2;
- QColor color = get_annotation_color(row_color, annotations.front().
format
());
+ QColor color = get_annotation_color(row_color, annotations.front().
ann_class
());
// Check if all annotations are of the same type (i.e. we can use one color)
// or if we should use a neutral color (i.e. gray)
// Check if all annotations are of the same type (i.e. we can use one color)
// or if we should use a neutral color (i.e. gray)
- const
int format = annotations.front().format
();
- const bool single_
format
= all_of(
+ const
Annotation::Class ann_class = annotations.front().ann_class
();
+ const bool single_
class
= all_of(
annotations.begin(), annotations.end(),
annotations.begin(), annotations.end(),
- [&](const Annotation &a) { return a.
format() == format
; });
+ [&](const Annotation &a) { return a.
ann_class() == ann_class
; });
const QRectF rect(start, top, end - start, bottom - top);
const int r = h / 4;
const QRectF rect(start, top, end - start, bottom - top);
const int r = h / 4;
@@
-456,8
+456,8
@@
void DecodeTrace::draw_annotation_block(
p.setBrush(Qt::white);
p.drawRoundedRect(rect, r, r);
p.setBrush(Qt::white);
p.drawRoundedRect(rect, r, r);
- p.setPen((single_
format
? color.darker() : Qt::gray));
- p.setBrush(QBrush((single_
format
? color : Qt::gray), Qt::Dense4Pattern));
+ p.setPen((single_
class
? color.darker() : Qt::gray));
+ p.setBrush(QBrush((single_
class
? color : Qt::gray), Qt::Dense4Pattern));
p.drawRoundedRect(rect, r, r);
}
p.drawRoundedRect(rect, r, r);
}
diff --git
a/pv/views/trace/decodetrace.hpp
b/pv/views/trace/decodetrace.hpp
index 692a5f710a3f653adfa93c8ebe6ba95a4ccc7e6b..04a3b300b9caf8e9681353f1ce14f6109da04dc1 100644
(file)
--- a/
pv/views/trace/decodetrace.hpp
+++ b/
pv/views/trace/decodetrace.hpp
@@
-50,14
+50,11
@@
namespace pv {
class Session;
namespace data {
class Session;
namespace data {
-class SignalBase;
struct DecodeChannel;
class DecodeSignal;
namespace decode {
struct DecodeChannel;
class DecodeSignal;
namespace decode {
-class Annotation;
class Decoder;
class Decoder;
-class Row;
}
} // namespace data
}
} // namespace data