Before, QMetaObject::connectSlotsByName(this) was used to connect
the signals to the slots automagically. This is no longer feasible
for the MainBar as there are slots that can't be auto-assigned and
the MainWindow doesn't have any signals at the moment.
if (type == view::TraceView) {
connect(&session, SIGNAL(trigger_event(util::Timestamp)), v.get(),
SLOT(trigger_event(util::Timestamp)));
if (type == view::TraceView) {
connect(&session, SIGNAL(trigger_event(util::Timestamp)), v.get(),
SLOT(trigger_event(util::Timestamp)));
- connect(v.get(), SIGNAL(sticky_scrolling_changed(bool)), this,
- SLOT(sticky_scrolling_changed(bool)));
- connect(v.get(), SIGNAL(always_zoom_to_fit_changed(bool)), this,
- SLOT(always_zoom_to_fit_changed(bool)));
v->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
v->enable_coloured_bg(action_view_coloured_bg_->isChecked());
v->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
v->enable_coloured_bg(action_view_coloured_bg_->isChecked());
session.set_main_bar(main_bar);
}
main_bar->action_view_show_cursors()->setChecked(v->cursors_shown());
session.set_main_bar(main_bar);
}
main_bar->action_view_show_cursors()->setChecked(v->cursors_shown());
+
+ connect(v.get(), SIGNAL(always_zoom_to_fit_changed(bool)),
+ main_bar.get(), SLOT(on_always_zoom_to_fit_changed(bool)));
action_open_->setIcon(QIcon::fromTheme("document-open",
QIcon(":/icons/document-open.png")));
action_open_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
action_open_->setIcon(QIcon::fromTheme("document-open",
QIcon(":/icons/document-open.png")));
action_open_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
- action_open_->setObjectName(QString::fromUtf8("actionOpen"));
+ connect(action_open_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionOpen_triggered()));
action_save_as_->setText(tr("&Save As..."));
action_save_as_->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
action_save_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
action_save_as_->setText(tr("&Save As..."));
action_save_as_->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
action_save_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
- action_save_as_->setObjectName(QString::fromUtf8("actionSaveAs"));
+ connect(action_save_as_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionSaveAs_triggered()));
action_save_selection_as_->setText(tr("Save Selected &Range As..."));
action_save_selection_as_->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
action_save_selection_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
action_save_selection_as_->setText(tr("Save Selected &Range As..."));
action_save_selection_as_->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
action_save_selection_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
- action_save_selection_as_->setObjectName(QString::fromUtf8("actionSaveSelectionAs"));
+ connect(action_save_selection_as_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionSaveSelectionAs_triggered()));
widgets::ExportMenu *menu_file_export = new widgets::ExportMenu(this,
session.device_manager().context());
widgets::ExportMenu *menu_file_export = new widgets::ExportMenu(this,
session.device_manager().context());
this, SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
action_connect_->setText(tr("&Connect to Device..."));
this, SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
action_connect_->setText(tr("&Connect to Device..."));
- action_connect_->setObjectName(QString::fromUtf8("actionConnect"));
+ connect(action_connect_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionConnect_triggered()));
action_view_zoom_in_->setText(tr("Zoom &In"));
action_view_zoom_in_->setIcon(QIcon::fromTheme("zoom-in",
QIcon(":/icons/zoom-in.png")));
// simply using Qt::Key_Plus shows no + in the menu
action_view_zoom_in_->setShortcut(QKeySequence::ZoomIn);
action_view_zoom_in_->setText(tr("Zoom &In"));
action_view_zoom_in_->setIcon(QIcon::fromTheme("zoom-in",
QIcon(":/icons/zoom-in.png")));
// simply using Qt::Key_Plus shows no + in the menu
action_view_zoom_in_->setShortcut(QKeySequence::ZoomIn);
- action_view_zoom_in_->setObjectName(
- QString::fromUtf8("actionViewZoomIn"));
+ connect(action_view_zoom_in_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionViewZoomIn_triggered()));
action_view_zoom_out_->setText(tr("Zoom &Out"));
action_view_zoom_out_->setIcon(QIcon::fromTheme("zoom-out",
QIcon(":/icons/zoom-out.png")));
action_view_zoom_out_->setShortcut(QKeySequence::ZoomOut);
action_view_zoom_out_->setText(tr("Zoom &Out"));
action_view_zoom_out_->setIcon(QIcon::fromTheme("zoom-out",
QIcon(":/icons/zoom-out.png")));
action_view_zoom_out_->setShortcut(QKeySequence::ZoomOut);
- action_view_zoom_out_->setObjectName(
- QString::fromUtf8("actionViewZoomOut"));
+ connect(action_view_zoom_out_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionViewZoomOut_triggered()));
action_view_zoom_fit_->setCheckable(true);
action_view_zoom_fit_->setText(tr("Zoom to &Fit"));
action_view_zoom_fit_->setIcon(QIcon::fromTheme("zoom-fit",
QIcon(":/icons/zoom-fit.png")));
action_view_zoom_fit_->setShortcut(QKeySequence(Qt::Key_F));
action_view_zoom_fit_->setCheckable(true);
action_view_zoom_fit_->setText(tr("Zoom to &Fit"));
action_view_zoom_fit_->setIcon(QIcon::fromTheme("zoom-fit",
QIcon(":/icons/zoom-fit.png")));
action_view_zoom_fit_->setShortcut(QKeySequence(Qt::Key_F));
- action_view_zoom_fit_->setObjectName(
- QString::fromUtf8("actionViewZoomFit"));
+ connect(action_view_zoom_fit_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionViewZoomFit_triggered()));
action_view_zoom_one_to_one_->setText(tr("Zoom to O&ne-to-One"));
action_view_zoom_one_to_one_->setIcon(QIcon::fromTheme("zoom-original",
QIcon(":/icons/zoom-original.png")));
action_view_zoom_one_to_one_->setShortcut(QKeySequence(Qt::Key_O));
action_view_zoom_one_to_one_->setText(tr("Zoom to O&ne-to-One"));
action_view_zoom_one_to_one_->setIcon(QIcon::fromTheme("zoom-original",
QIcon(":/icons/zoom-original.png")));
action_view_zoom_one_to_one_->setShortcut(QKeySequence(Qt::Key_O));
- action_view_zoom_one_to_one_->setObjectName(
- QString::fromUtf8("actionViewZoomOneToOne"));
+ connect(action_view_zoom_one_to_one_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionViewZoomOneToOne_triggered()));
action_view_show_cursors_->setCheckable(true);
action_view_show_cursors_->setIcon(QIcon::fromTheme("show-cursors",
QIcon(":/icons/show-cursors.svg")));
action_view_show_cursors_->setShortcut(QKeySequence(Qt::Key_C));
action_view_show_cursors_->setCheckable(true);
action_view_show_cursors_->setIcon(QIcon::fromTheme("show-cursors",
QIcon(":/icons/show-cursors.svg")));
action_view_show_cursors_->setShortcut(QKeySequence(Qt::Key_C));
- action_view_show_cursors_->setObjectName(
- QString::fromUtf8("actionViewShowCursors"));
+ connect(action_view_show_cursors_, SIGNAL(triggered(bool)),
+ this, SLOT(on_actionViewShowCursors_triggered()));
action_view_show_cursors_->setText(tr("Show &Cursors"));
// Open button
action_view_show_cursors_->setText(tr("Show &Cursors"));
// Open button
session.device_manager().context(), action_open_);
connect(import_menu,
SIGNAL(format_selected(std::shared_ptr<sigrok::InputFormat>)),
session.device_manager().context(), action_open_);
connect(import_menu,
SIGNAL(format_selected(std::shared_ptr<sigrok::InputFormat>)),
SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
open_button->setMenu(import_menu);
SLOT(import_file(std::shared_ptr<sigrok::InputFormat>)));
open_button->setMenu(import_menu);
open_actions);
connect(export_menu,
SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
open_actions);
connect(export_menu,
SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
SLOT(export_file(std::shared_ptr<sigrok::OutputFormat>)));
save_button->setMenu(export_menu);
SLOT(export_file(std::shared_ptr<sigrok::OutputFormat>)));
save_button->setMenu(export_menu);
// Device selector menu
connect(&device_selector_, SIGNAL(device_selected()),
this, SLOT(on_device_selected()));
// Device selector menu
connect(&device_selector_, SIGNAL(device_selected()),
this, SLOT(on_device_selected()));
- connect(&session, SIGNAL(device_changed()),
- this, SLOT(on_device_changed()));
// Setup the decoder button
#ifdef ENABLE_DECODE
// Setup the decoder button
#ifdef ENABLE_DECODE
sample_rate_.installEventFilter(this);
// Setup session_ events
sample_rate_.installEventFilter(this);
// Setup session_ events
- connect(&session_, SIGNAL(capture_state_changed(int)), this,
- SLOT(capture_state_changed(int)));
- connect(&session_, SIGNAL(device_selected()), this,
- SLOT(device_selected()));
+ connect(&session_, SIGNAL(capture_state_changed(int)),
+ this, SLOT(capture_state_changed(int)));
+ connect(&session, SIGNAL(device_changed()),
+ this, SLOT(on_device_changed()));
session_.main_view()->show_cursors(show);
}
session_.main_view()->show_cursors(show);
}
+void MainBar::on_always_zoom_to_fit_changed(bool state)
+{
+ action_view_zoom_fit_->setChecked(state);
+}
+
bool MainBar::eventFilter(QObject *watched, QEvent *event)
{
if (sample_count_supported_ && (watched == &sample_count_ ||
bool MainBar::eventFilter(QObject *watched, QEvent *event)
{
if (sample_count_supported_ && (watched == &sample_count_ ||
void on_actionViewShowCursors_triggered();
void on_actionViewShowCursors_triggered();
+ void on_always_zoom_to_fit_changed(bool state);
+
protected:
bool eventFilter(QObject *watched, QEvent *event);
protected:
bool eventFilter(QObject *watched, QEvent *event);