X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=33ebdd648e84e09fd6c6614eeb6a6511ce413047;hp=500d2a435625cd20cde87f66f87c906c73cfa50a;hb=9eae6de4dd0a3c628026eca6ca55cef8b70bfa86;hpb=7b254679cb45fc4d032fe68c0797642a237f0fa6 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 500d2a43..33ebdd64 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -74,8 +74,6 @@ MainWindow::MainWindow(DeviceManager &device_manager, device_manager_(device_manager), session_selector_(this), session_state_mapper_(this), - action_view_sticky_scrolling_(new QAction(this)), - action_view_coloured_bg_(new QAction(this)), action_about_(new QAction(this)), icon_red_(":/icons/status-red.svg"), icon_green_(":/icons/status-green.svg"), @@ -119,16 +117,6 @@ MainWindow::~MainWindow() remove_session(sessions_.front()); } -QAction* MainWindow::action_view_sticky_scrolling() const -{ - return action_view_sticky_scrolling_; -} - -QAction* MainWindow::action_view_coloured_bg() const -{ - return action_view_coloured_bg_; -} - QAction* MainWindow::action_about() const { return action_about_; @@ -201,8 +189,8 @@ shared_ptr MainWindow::add_view(const QString &title, qobject_cast(v.get()), SLOT(trigger_event(util::Timestamp))); - v->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked()); - v->enable_coloured_bg(action_view_coloured_bg_->isChecked()); + v->enable_sticky_scrolling(true); + v->enable_coloured_bg(true); shared_ptr main_bar = session.main_bar(); if (!main_bar) { @@ -344,19 +332,11 @@ void MainWindow::setup_ui() icon.addFile(QString(":/icons/sigrok-logo-notext.png")); setWindowIcon(icon); - action_view_sticky_scrolling_->setCheckable(true); - action_view_sticky_scrolling_->setChecked(true); - action_view_sticky_scrolling_->setShortcut(QKeySequence(Qt::Key_S)); - action_view_sticky_scrolling_->setObjectName( - QString::fromUtf8("actionViewStickyScrolling")); - action_view_sticky_scrolling_->setText(tr("&Sticky Scrolling")); + view_sticky_scrolling_shortcut_ = new QShortcut(QKeySequence(Qt::Key_S), this, SLOT(on_view_sticky_scrolling_shortcut())); + view_sticky_scrolling_shortcut_->setAutoRepeat(false); - action_view_coloured_bg_->setCheckable(true); - action_view_coloured_bg_->setChecked(true); - action_view_coloured_bg_->setShortcut(QKeySequence(Qt::Key_B)); - action_view_coloured_bg_->setObjectName( - QString::fromUtf8("actionViewColouredBg")); - action_view_coloured_bg_->setText(tr("Use &Coloured Backgrounds")); + view_coloured_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_coloured_bg_shortcut())); + view_coloured_bg_shortcut_->setAutoRepeat(false); action_about_->setObjectName(QString::fromUtf8("actionAbout")); action_about_->setToolTip(tr("&About...")); @@ -723,22 +703,22 @@ void MainWindow::on_tab_close_requested(int index) remove_session(session); } -void MainWindow::on_actionViewStickyScrolling_triggered() +void MainWindow::on_view_sticky_scrolling_shortcut() { shared_ptr viewbase = get_active_view(); views::TraceView::View* view = qobject_cast(viewbase.get()); if (view) - view->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked()); + view->toggle_sticky_scrolling(); } -void MainWindow::on_actionViewColouredBg_triggered() +void MainWindow::on_view_coloured_bg_shortcut() { shared_ptr viewbase = get_active_view(); views::TraceView::View* view = qobject_cast(viewbase.get()); if (view) - view->enable_coloured_bg(action_view_coloured_bg_->isChecked()); + view->toggle_coloured_bg(); } void MainWindow::on_actionAbout_triggered()