projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not change session name when performing only a selective save
[pulseview.git]
/
pv
/
toolbars
/
mainbar.cpp
diff --git
a/pv/toolbars/mainbar.cpp
b/pv/toolbars/mainbar.cpp
index 483dd79ba413d99f1295dcb80c42cf8e29568308..c31d0d33860021fe11fb2eacb020c3535a3a8de9 100644
(file)
--- a/
pv/toolbars/mainbar.cpp
+++ b/
pv/toolbars/mainbar.cpp
@@
-89,7
+89,6
@@
const char *MainBar::SettingSaveDirectory = "MainWindow/SaveDirectory";
MainBar::MainBar(Session &session, MainWindow &main_window) :
QToolBar("Sampling Bar", &main_window),
MainBar::MainBar(Session &session, MainWindow &main_window) :
QToolBar("Sampling Bar", &main_window),
- action_new_session_(new QAction(this)),
action_new_view_(new QAction(this)),
action_open_(new QAction(this)),
action_save_as_(new QAction(this)),
action_new_view_(new QAction(this)),
action_open_(new QAction(this)),
action_save_as_(new QAction(this)),
@@
-111,13
+110,7
@@
MainBar::MainBar(Session &session, MainWindow &main_window) :
sample_rate_("Hz", this),
updating_sample_rate_(false),
updating_sample_count_(false),
sample_rate_("Hz", this),
updating_sample_rate_(false),
updating_sample_count_(false),
- sample_count_supported_(false),
- icon_red_(":/icons/status-red.svg"),
- icon_green_(":/icons/status-green.svg"),
- icon_grey_(":/icons/status-grey.svg"),
- run_stop_button_(this),
- run_stop_button_action_(nullptr),
- menu_button_(this)
+ sample_count_supported_(false)
#ifdef ENABLE_DECODE
, menu_decoders_add_(new pv::widgets::DecoderMenu(this, true))
#endif
#ifdef ENABLE_DECODE
, menu_decoders_add_(new pv::widgets::DecoderMenu(this, true))
#endif
@@
-129,12
+122,6
@@
MainBar::MainBar(Session &session, MainWindow &main_window) :
setContextMenuPolicy(Qt::PreventContextMenu);
// Actions
setContextMenuPolicy(Qt::PreventContextMenu);
// Actions
- action_new_session_->setText(tr("New &Session"));
- action_new_session_->setIcon(QIcon::fromTheme("document-new",
- QIcon(":/icons/document-new.png")));
- connect(action_new_session_, SIGNAL(triggered(bool)),
- this, SLOT(on_actionNewSession_triggered()));
-
action_new_view_->setText(tr("New &View"));
action_new_view_->setIcon(QIcon::fromTheme("window-new",
QIcon(":/icons/window-new.png")));
action_new_view_->setText(tr("New &View"));
action_new_view_->setIcon(QIcon::fromTheme("window-new",
QIcon(":/icons/window-new.png")));
@@
-269,7
+256,6
@@
MainBar::MainBar(Session &session, MainWindow &main_window) :
#endif
// Setup the toolbar
#endif
// Setup the toolbar
- addAction(action_new_session_);
addAction(action_new_view_);
addSeparator();
addWidget(open_button);
addAction(action_new_view_);
addSeparator();
addWidget(open_button);
@@
-283,8
+269,6
@@
MainBar::MainBar(Session &session, MainWindow &main_window) :
addAction(action_view_show_cursors_);
addSeparator();
addAction(action_view_show_cursors_);
addSeparator();
- connect(&run_stop_button_, SIGNAL(clicked()),
- this, SLOT(on_run_stop()));
connect(&sample_count_, SIGNAL(value_changed()),
this, SLOT(on_sample_count_changed()));
connect(&sample_rate_, SIGNAL(value_changed()),
connect(&sample_count_, SIGNAL(value_changed()),
this, SLOT(on_sample_count_changed()));
connect(&sample_rate_, SIGNAL(value_changed()),
@@
-300,25
+284,16
@@
MainBar::MainBar(Session &session, MainWindow &main_window) :
channels_button_.setIcon(QIcon::fromTheme("channels",
QIcon(":/icons/channels.svg")));
channels_button_.setIcon(QIcon::fromTheme("channels",
QIcon(":/icons/channels.svg")));
- run_stop_button_.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
-
addWidget(&device_selector_);
configure_button_action_ = addWidget(&configure_button_);
channels_button_action_ = addWidget(&channels_button_);
addWidget(&sample_count_);
addWidget(&sample_rate_);
addWidget(&device_selector_);
configure_button_action_ = addWidget(&configure_button_);
channels_button_action_ = addWidget(&channels_button_);
addWidget(&sample_count_);
addWidget(&sample_rate_);
- run_stop_button_action_ = addWidget(&run_stop_button_);
#ifdef ENABLE_DECODE
addSeparator();
addWidget(add_decoder_button);
#endif
#ifdef ENABLE_DECODE
addSeparator();
addWidget(add_decoder_button);
#endif
- QWidget *const spacer = new QWidget();
- spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- addWidget(spacer);
-
- addWidget(&menu_button_);
-
sample_count_.installEventFilter(this);
sample_rate_.installEventFilter(this);
sample_count_.installEventFilter(this);
sample_rate_.installEventFilter(this);
@@
-354,12
+329,6
@@
void MainBar::update_device_list()
void MainBar::set_capture_state(pv::Session::capture_state state)
{
void MainBar::set_capture_state(pv::Session::capture_state state)
{
- const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_};
- run_stop_button_.setIcon(*icons[state]);
- run_stop_button_.setText((state == pv::Session::Stopped) ?
- tr("Run") : tr("Stop"));
- run_stop_button_.setShortcut(QKeySequence(Qt::Key_Space));
-
bool ui_enabled = (state == pv::Session::Stopped) ? true : false;
device_selector_.setEnabled(ui_enabled);
bool ui_enabled = (state == pv::Session::Stopped) ? true : false;
device_selector_.setEnabled(ui_enabled);
@@
-460,20
+429,6
@@
QAction* MainBar::action_view_show_cursors() const
return action_view_show_cursors_;
}
return action_view_show_cursors_;
}
-void MainBar::run_stop()
-{
- switch (session_.get_capture_state()) {
- case Session::Stopped:
- session_.start_capture([&](QString message) {
- session_error("Capture failed", message); });
- break;
- case Session::AwaitingTrigger:
- case Session::Running:
- session_.stop_capture();
- break;
- }
-}
-
void MainBar::load_file(QString file_name,
std::shared_ptr<sigrok::InputFormat> format,
const std::map<std::string, Glib::VariantBase> &options)
void MainBar::load_file(QString file_name,
std::shared_ptr<sigrok::InputFormat> format,
const std::map<std::string, Glib::VariantBase> &options)
@@
-666,7
+621,6
@@
void MainBar::update_device_config_widgets()
// Hide the widgets if no device is selected
channels_button_action_->setVisible(!!device);
// Hide the widgets if no device is selected
channels_button_action_->setVisible(!!device);
- run_stop_button_action_->setVisible(!!device);
if (!device) {
configure_button_action_->setVisible(false);
sample_count_.show_none();
if (!device) {
configure_button_action_->setVisible(false);
sample_count_.show_none();
@@
-816,7
+770,10
@@
void MainBar::export_file(shared_ptr<OutputFormat> format,
// Selection only? Verify that the cursors are active and fetch their values
if (selection_only) {
// Selection only? Verify that the cursors are active and fetch their values
if (selection_only) {
- if (!session_.main_view()->cursors()->enabled()) {
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ if (!trace_view->cursors()->enabled()) {
show_session_error(tr("Missing Cursors"), tr("You need to set the " \
"cursors before you can save the data enclosed by them " \
"to a session file (e.g. using ALT-V - Show Cursors)."));
show_session_error(tr("Missing Cursors"), tr("You need to set the " \
"cursors before you can save the data enclosed by them " \
"to a session file (e.g. using ALT-V - Show Cursors)."));
@@
-825,8
+782,8
@@
void MainBar::export_file(shared_ptr<OutputFormat> format,
const double samplerate = session_.get_samplerate();
const double samplerate = session_.get_samplerate();
- const pv::util::Timestamp& start_time =
session_.main_view()
->cursors()->first()->time();
- const pv::util::Timestamp& end_time =
session_.main_view()
->cursors()->second()->time();
+ const pv::util::Timestamp& start_time =
trace_view
->cursors()->first()->time();
+ const pv::util::Timestamp& end_time =
trace_view
->cursors()->second()->time();
const uint64_t start_sample =
std::max((double)0, start_time.convert_to<double>() * samplerate);
const uint64_t start_sample =
std::max((double)0, start_time.convert_to<double>() * samplerate);
@@
-871,7
+828,8
@@
void MainBar::export_file(shared_ptr<OutputFormat> format,
options = dlg.options();
}
options = dlg.options();
}
- session_.set_name(QFileInfo(file_name).fileName());
+ if (!selection_only)
+ session_.set_name(QFileInfo(file_name).fileName());
StoreProgress *dlg = new StoreProgress(file_name, format, options,
sample_range, session_, this);
StoreProgress *dlg = new StoreProgress(file_name, format, options,
sample_range, session_, this);
@@
-948,24
+906,12
@@
void MainBar::on_sample_rate_changed()
commit_sample_rate();
}
commit_sample_rate();
}
-void MainBar::on_run_stop()
-{
- commit_sample_count();
- commit_sample_rate();
- run_stop();
-}
-
void MainBar::on_config_changed()
{
commit_sample_count();
commit_sample_rate();
}
void MainBar::on_config_changed()
{
commit_sample_count();
commit_sample_rate();
}
-void MainBar::on_actionNewSession_triggered()
-{
- new_session();
-}
-
void MainBar::on_actionNewView_triggered()
{
new_view(&session_);
void MainBar::on_actionNewView_triggered()
{
new_view(&session_);
@@
-1017,31
+963,46
@@
void MainBar::on_actionConnect_triggered()
void MainBar::on_actionViewZoomIn_triggered()
{
void MainBar::on_actionViewZoomIn_triggered()
{
- session_.main_view()->zoom(1);
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ trace_view->zoom(1);
}
void MainBar::on_actionViewZoomOut_triggered()
{
}
void MainBar::on_actionViewZoomOut_triggered()
{
- session_.main_view()->zoom(-1);
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ trace_view->zoom(-1);
}
void MainBar::on_actionViewZoomFit_triggered()
{
}
void MainBar::on_actionViewZoomFit_triggered()
{
- session_.main_view()->zoom_fit(action_view_zoom_fit_->isChecked());
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ trace_view->zoom_fit(action_view_zoom_fit_->isChecked());
}
void MainBar::on_actionViewZoomOneToOne_triggered()
{
}
void MainBar::on_actionViewZoomOneToOne_triggered()
{
- session_.main_view()->zoom_one_to_one();
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ trace_view->zoom_one_to_one();
}
void MainBar::on_actionViewShowCursors_triggered()
{
}
void MainBar::on_actionViewShowCursors_triggered()
{
- const bool show = !session_.main_view()->cursors_shown();
+ views::TraceView::View *trace_view =
+ qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+ const bool show = !trace_view->cursors_shown();
if (show)
if (show)
-
session_.main_view()
->centre_cursors();
+
trace_view
->centre_cursors();
-
session_.main_view()
->show_cursors(show);
+
trace_view
->show_cursors(show);
}
void MainBar::on_always_zoom_to_fit_changed(bool state)
}
void MainBar::on_always_zoom_to_fit_changed(bool state)