const QString GlobalSettings::Key_View_CursorFillColor = "View_CursorFillColor";
const QString GlobalSettings::Key_View_CursorShowFrequency = "View_CursorShowFrequency";
const QString GlobalSettings::Key_View_CursorShowInterval = "View_CursorShowInterval";
+const QString GlobalSettings::Key_View_CursorShowSamples = "View_CursorShowSamples";
const QString GlobalSettings::Key_Dec_InitialStateConfigurable = "Dec_InitialStateConfigurable";
const QString GlobalSettings::Key_Dec_ExportFormat = "Dec_ExportFormat";
const QString GlobalSettings::Key_Dec_AlwaysShowAllRows = "Dec_AlwaysShowAllRows";
static const QString Key_View_CursorFillColor;
static const QString Key_View_CursorShowInterval;
static const QString Key_View_CursorShowFrequency;
+ static const QString Key_View_CursorShowSamples;
static const QString Key_Dec_InitialStateConfigurable;
static const QString Key_Dec_ExportFormat;
static const QString Key_Dec_AlwaysShowAllRows;
GlobalSettings::Key_View_CursorShowFrequency).value<bool>();
show_interval_ = settings.value(
GlobalSettings::Key_View_CursorShowInterval).value<bool>();
+ show_samples_ = settings.value(
+ GlobalSettings::Key_View_CursorShowSamples).value<bool>();
connect(&view_, SIGNAL(hover_point_changed(const QWidget*, QPoint)),
this, SLOT(on_hover_point_changed(const QWidget*, QPoint)));
!settings.value(GlobalSettings::Key_View_CursorShowFrequency).value<bool>());
});
+ QAction *displaySamplesAction = new QAction(tr("Display samples"));
+ displaySamplesAction->setCheckable(true);
+ displaySamplesAction->setChecked(show_samples_);
+ menu->addAction(displaySamplesAction);
+
+ connect(displaySamplesAction, &QAction::toggled, [=]{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_CursorShowSamples,
+ !settings.value(GlobalSettings::Key_View_CursorShowSamples).value<bool>());
+ });
+
return menu;
}
if (key == GlobalSettings::Key_View_CursorShowInterval)
show_interval_ = value.value<bool>();
+
+ if (key == GlobalSettings::Key_View_CursorShowSamples)
+ show_samples_ = value.value<bool>();
}
void CursorPair::on_hover_point_changed(const QWidget* widget, const QPoint& hp)
s = QString("%1").arg(time);
items++;
}
+
+ if (show_samples_) {
+ const QString samples = QString::number(
+ (diff * view_.session().get_samplerate()).convert_to<uint64_t>());
+ if (items > 0)
+ s = QString("%1 / %2").arg(s, samples);
+ else
+ s = QString("%1").arg(samples);
+ }
} else
// In this case, we return the number of samples, really
s = time;