X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fview%2Fanalogsignal.cpp;h=41f46dfcc75b414e47fbf8dd6bf47d2d7ff8502a;hb=26a883ede0bcf68d087eda5dd2082890d36c7aef;hp=fbffb2ebb0061b7a05af272d5647fe45c37b229b;hpb=cbd2a2de848f957507096785d3be1cc97d30df9a;p=pulseview.git
diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp
index fbffb2e..41f46df 100644
--- a/pv/view/analogsignal.cpp
+++ b/pv/view/analogsignal.cpp
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
#include
@@ -48,7 +47,8 @@ using std::shared_ptr;
using std::deque;
namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
const QColor AnalogSignal::SignalColours[4] = {
QColor(0xC4, 0xA0, 0x00), // Yellow
@@ -88,6 +88,23 @@ shared_ptr AnalogSignal::data() const
return base_->analog_data();
}
+void AnalogSignal::save_settings(QSettings &settings) const
+{
+ settings.setValue("vdivs", vdivs_);
+ settings.setValue("scale_index", scale_index_);
+}
+
+void AnalogSignal::restore_settings(QSettings &settings)
+{
+ if (settings.contains("vdivs"))
+ vdivs_ = settings.value("vdivs").toInt();
+
+ if (settings.contains("scale_index")) {
+ scale_index_ = settings.value("scale_index").toInt();
+ update_scale();
+ }
+}
+
std::pair AnalogSignal::v_extents() const
{
const int h = vdivs_ * div_height_;
@@ -223,26 +240,25 @@ void AnalogSignal::paint_trace(QPainter &p,
int y, int left, const int64_t start, const int64_t end,
const double pixels_offset, const double samples_per_pixel)
{
- const int64_t sample_count = end - start;
-
- const float *const samples = segment->get_samples(start, end);
- assert(samples);
-
p.setPen(base_->colour());
- QPointF *points = new QPointF[sample_count];
+ QPointF *points = new QPointF[end - start];
QPointF *point = points;
+ pv::data::SegmentAnalogDataIterator* it =
+ segment->begin_sample_iteration(start);
+
for (int64_t sample = start; sample != end; sample++) {
const float x = (sample / samples_per_pixel -
pixels_offset) + left;
- *point++ = QPointF(x,
- y - samples[sample - start] * scale_);
+
+ *point++ = QPointF(x, y - *((float*)it->value) * scale_);
+ segment->continue_sample_iteration(it, 1);
}
+ segment->end_sample_iteration(it);
p.drawPolyline(points, point - points);
- delete[] samples;
delete[] points;
}
@@ -368,5 +384,6 @@ void AnalogSignal::on_resolution_changed(int index)
owner_->row_item_appearance_changed(false, true);
}
-} // namespace view
+} // namespace TraceView
+} // namespace views
} // namespace pv