X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=6b3319bed152f993e76eb0bf7dc51e63dbccbc17;hp=c08576caff7a7bb18beaf5af10d32c81df0322a9;hb=f4ab4b5c657e5613caba82feaa81a8a400e4f331;hpb=5e685656d6686eb66a39450d1b324f6382fc60c5 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index c08576c..6b3319b 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -94,7 +94,8 @@ MainWindow::~MainWindow() void MainWindow::show_session_error(const QString text, const QString info_text) { - qDebug().noquote() << "Notifying user of session error:" << info_text; + // TODO Emulate noquote() + qDebug() << "Notifying user of session error:" << info_text; QMessageBox msg; msg.setText(text); @@ -122,7 +123,7 @@ shared_ptr MainWindow::get_active_view() const } // Get the view contained in the dock widget - for (auto entry : view_docks_) + for (auto& entry : view_docks_) if (entry.first == dock) return entry.second; @@ -136,7 +137,7 @@ shared_ptr MainWindow::add_view(const QString &title, shared_ptr v; QMainWindow *main_window = nullptr; - for (auto entry : session_windows_) + for (auto& entry : session_windows_) if (entry.first.get() == &session) main_window = entry.second; @@ -185,7 +186,7 @@ shared_ptr MainWindow::add_view(const QString &title, views::trace::View *tv = qobject_cast(v.get()); - tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool()); + tv->enable_colored_bg(settings.value(GlobalSettings::Key_View_ColoredBG).toBool()); tv->enable_show_sampling_points(settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool()); tv->enable_show_analog_minor_grid(settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool()); @@ -225,7 +226,7 @@ void MainWindow::remove_view(shared_ptr view) continue; // Find the dock the view is contained in and remove it - for (auto entry : view_docks_) + for (auto& entry : view_docks_) if (entry.second == view) { // Remove the view from the session session->deregister_view(view); @@ -293,7 +294,7 @@ void MainWindow::remove_session(shared_ptr session) session->stop_capture(); QApplication::processEvents(); - for (shared_ptr view : session->views()) + for (const shared_ptr& view : session->views()) remove_view(view); QMainWindow *window = session_windows_.at(session); @@ -345,7 +346,7 @@ void MainWindow::add_default_session() // one of the auto detected devices that are not the demo device. // Pick demo in the absence of "genuine" hardware devices. shared_ptr user_device, other_device, demo_device; - for (shared_ptr dev : device_manager_.devices()) { + for (const shared_ptr& dev : device_manager_.devices()) { if (dev == device_manager_.user_spec_device()) { user_device = dev; } else if (dev->hardware_device()->driver()->name() == "demo") { @@ -367,7 +368,7 @@ void MainWindow::save_sessions() QSettings settings; int id = 0; - for (shared_ptr session : sessions_) { + for (shared_ptr& session : sessions_) { // Ignore sessions using the demo device or no device at all if (session->device()) { shared_ptr device = @@ -405,8 +406,8 @@ void MainWindow::restore_sessions() void MainWindow::on_setting_changed(const QString &key, const QVariant &value) { - if (key == GlobalSettings::Key_View_ColouredBG) - on_settingViewColouredBg_changed(value); + if (key == GlobalSettings::Key_View_ColoredBG) + on_settingViewColoredBg_changed(value); if (key == GlobalSettings::Key_View_ShowSamplingPoints) on_settingViewShowSamplingPoints_changed(value); @@ -435,8 +436,8 @@ void MainWindow::setup_ui() view_show_analog_minor_grid_shortcut_ = new QShortcut(QKeySequence(Qt::Key_G), this, SLOT(on_view_show_analog_minor_grid_shortcut())); view_show_analog_minor_grid_shortcut_->setAutoRepeat(false); - view_coloured_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_coloured_bg_shortcut())); - view_coloured_bg_shortcut_->setAutoRepeat(false); + view_colored_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_colored_bg_shortcut())); + view_colored_bg_shortcut_->setAutoRepeat(false); // Set up the tab area new_session_button_ = new QToolButton(); @@ -531,7 +532,7 @@ void MainWindow::restore_ui_settings() shared_ptr MainWindow::get_tab_session(int index) const { // Find the session that belongs to the tab's main window - for (auto entry : session_windows_) + for (auto& entry : session_windows_) if (entry.second == session_selector_.widget(index)) return entry.first; @@ -542,7 +543,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { bool data_saved = true; - for (auto entry : session_windows_) + for (auto& entry : session_windows_) if (!entry.first->data_saved()) data_saved = false; @@ -577,7 +578,7 @@ void MainWindow::on_add_view(const QString &title, views::ViewType type, Session *session) { // We get a pointer and need a reference - for (shared_ptr s : sessions_) + for (shared_ptr& s : sessions_) if (s.get() == session) add_view(title, type, *s); } @@ -655,9 +656,9 @@ void MainWindow::on_session_name_changed() Session *session = qobject_cast(QObject::sender()); assert(session); - for (shared_ptr view : session->views()) { + for (const shared_ptr& view : session->views()) { // Get the dock that contains the view - for (auto entry : view_docks_) + for (auto& entry : view_docks_) if (entry.second == view) { entry.first->setObjectName(session->name()); entry.first->setWindowTitle(session->name()); @@ -665,7 +666,7 @@ void MainWindow::on_session_name_changed() } // Update the tab widget by finding the main window and the tab from that - for (auto entry : session_windows_) + for (auto& entry : session_windows_) if (entry.first.get() == session) { QMainWindow *window = entry.second; const int index = session_selector_.indexOf(window); @@ -697,7 +698,7 @@ void MainWindow::on_capture_state_changed(QObject *obj) void MainWindow::on_new_view(Session *session) { // We get a pointer and need a reference - for (shared_ptr s : sessions_) + for (shared_ptr& s : sessions_) if (s.get() == session) add_view(session->name(), views::ViewTypeTrace, *s); } @@ -718,7 +719,7 @@ void MainWindow::on_view_close_clicked() // Get the view contained in the dock widget shared_ptr view; - for (auto entry : view_docks_) + for (auto& entry : view_docks_) if (entry.first == dock) view = entry.second; @@ -762,12 +763,12 @@ void MainWindow::on_tab_close_requested(int index) remove_session(session); } -void MainWindow::on_view_coloured_bg_shortcut() +void MainWindow::on_view_colored_bg_shortcut() { GlobalSettings settings; - bool state = settings.value(GlobalSettings::Key_View_ColouredBG).toBool(); - settings.setValue(GlobalSettings::Key_View_ColouredBG, !state); + bool state = settings.value(GlobalSettings::Key_View_ColoredBG).toBool(); + settings.setValue(GlobalSettings::Key_View_ColoredBG, !state); } void MainWindow::on_view_sticky_scrolling_shortcut() @@ -794,18 +795,18 @@ void MainWindow::on_view_show_analog_minor_grid_shortcut() settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, !state); } -void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value) +void MainWindow::on_settingViewColoredBg_changed(const QVariant new_value) { bool state = new_value.toBool(); - for (auto entry : view_docks_) { + for (auto& entry : view_docks_) { shared_ptr viewbase = entry.second; // Only trace views have this setting views::trace::View* view = qobject_cast(viewbase.get()); if (view) - view->enable_coloured_bg(state); + view->enable_colored_bg(state); } } @@ -813,7 +814,7 @@ void MainWindow::on_settingViewShowSamplingPoints_changed(const QVariant new_val { bool state = new_value.toBool(); - for (auto entry : view_docks_) { + for (auto& entry : view_docks_) { shared_ptr viewbase = entry.second; // Only trace views have this setting @@ -828,7 +829,7 @@ void MainWindow::on_settingViewShowAnalogMinorGrid_changed(const QVariant new_va { bool state = new_value.toBool(); - for (auto entry : view_docks_) { + for (auto& entry : view_docks_) { shared_ptr viewbase = entry.second; // Only trace views have this setting