X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=dfabc9a06797f0a080ae16069b16de70f0929280;hp=4fe483ef3abafda58104052dc9f6d3a581eb74ac;hb=b571a8e7e0dc3e3b6daa58f27050e76466f006dd;hpb=641574bcc118be0b6dc3a65039ab3497f9d7241a diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 4fe483ef..dfabc9a0 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; @@ -171,8 +172,8 @@ shared_ptr MainWindow::add_view(const QString &title, QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable); QAbstractButton *close_btn = - dock->findChildren - ("qt_dockwidget_closebutton").front(); + dock->findChildren("qt_dockwidget_closebutton") + .front(); // clazy:exclude=detaching-temporary connect(close_btn, SIGNAL(clicked(bool)), this, SLOT(on_view_close_clicked())); @@ -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); @@ -313,7 +314,7 @@ void MainWindow::remove_session(shared_ptr session) // drops to zero. We must prevent this to keep the static // widgets visible for (QWidget *w : static_tab_widget_->findChildren()) - w->setMinimumHeight(h); + w->setMinimumHeight(h); // clazy:exclude=range-loop int margin = static_tab_widget_->layout()->contentsMargins().bottom(); static_tab_widget_->setMinimumHeight(h + 2 * margin); @@ -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 = @@ -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; @@ -798,7 +799,7 @@ 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 @@ -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