#include <boost/algorithm/string/join.hpp>
+#include <pv/data/decodesignal.hpp>
#include <pv/devicemanager.hpp>
#include <pv/devices/hardwaredevice.hpp>
#include <pv/devices/inputfile.hpp>
const char *MainBar::SettingSaveDirectory = "MainWindow/SaveDirectory";
MainBar::MainBar(Session &session, QWidget *parent,
- pv::views::TraceView::View *view) :
+ pv::views::trace::View *view) :
StandardBar(session, parent, view, false),
action_new_view_(new QAction(this)),
action_open_(new QAction(this)),
if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::SET))
sample_count_supported_ = true;
- if (sr_dev->config_check(ConfigKey::LIMIT_FRAMES, Capability::SET)) {
- sr_dev->config_set(ConfigKey::LIMIT_FRAMES,
- Glib::Variant<guint64>::create(1));
- on_config_changed();
- }
-
// Add notification of reconfigure events
disconnect(this, SLOT(on_config_changed()));
connect(&opts->binding(), SIGNAL(config_changed()),
{
#ifdef ENABLE_DECODE
assert(decoder);
- session_.add_decoder(decoder);
+ shared_ptr<data::DecodeSignal> signal = session_.add_decode_signal();
+ if (signal)
+ signal->stack_decoder(decoder);
#else
(void)decoder;
#endif
// Selection only? Verify that the cursors are active and fetch their values
if (selection_only) {
- views::TraceView::View *trace_view =
- qobject_cast<views::TraceView::View*>(session_.main_view().get());
+ views::trace::View *trace_view =
+ qobject_cast<views::trace::View*>(session_.main_view().get());
if (!trace_view->cursors()->enabled()) {
show_session_error(tr("Missing Cursors"), tr("You need to set the " \
const uint64_t end_sample = (uint64_t)max(
(double)0, end_time.convert_to<double>() * samplerate);
+ if ((start_sample == 0) && (end_sample == 0)) {
+ // Both cursors are negative and were clamped to 0
+ show_session_error(tr("Invalid Range"), tr("The cursors don't " \
+ "define a valid range of samples."));
+ return;
+ }
+
sample_range = make_pair(start_sample, end_sample);
} else {
sample_range = make_pair(0, 0);
// Construct the filter
const vector<string> exts = format->extensions();
- const QString filter = exts.empty() ? "" :
- tr("%1 files (*.%2)").arg(
- QString::fromStdString(format->description()),
- QString::fromStdString(join(exts, ", *.")));
+ const QString filter_exts = exts.empty() ? "" : QString::fromStdString("%1 (%2)").arg(
+ tr("%1 files").arg(QString::fromStdString(format->description())),
+ QString::fromStdString("*.%1").arg(QString::fromStdString(join(exts, " *."))));
+ const QString filter_all = QString::fromStdString("%1 (%2)").arg(
+ tr("All Files"), QString::fromStdString("*"));
+ const QString filter = QString::fromStdString("%1%2%3").arg(
+ exts.empty() ? "" : filter_exts,
+ exts.empty() ? "" : ";;",
+ filter_all);
// Show the file dialog
const QString file_name = QFileDialog::getOpenFileName(
- this, tr("Import File"), dir, tr(
- "%1 files (*);;All Files (*)").arg(
- QString::fromStdString(format->description())));
+ this, tr("Import File"), dir, filter);
if (file_name.isEmpty())
return;