]> sigrok.org Git - pulseview.git/commitdiff
MainWindow: Include device/file name in window title
authorJoel Holdsworth <redacted>
Sat, 22 Nov 2014 10:15:56 +0000 (10:15 +0000)
committerJoel Holdsworth <redacted>
Sat, 22 Nov 2014 14:38:12 +0000 (14:38 +0000)
This fixes bug #244

pv/mainwindow.cpp
pv/mainwindow.hpp
pv/sigsession.cpp
pv/sigsession.hpp

index a43b575a989446ede299f6b56662c7369d4c33ce..142eb3f1c08960a8db7be4cbfe964574c5aa8d1c 100644 (file)
@@ -270,6 +270,8 @@ void MainWindow::setup_ui()
        // 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()));
 }
 
 void MainWindow::save_ui_settings()
@@ -559,4 +561,15 @@ void MainWindow::capture_state_changed(int state)
        sampling_bar_->set_capture_state((pv::SigSession::capture_state)state);
 }
 
+void MainWindow::device_selected()
+{
+       // Set the title to include the device/file name
+       const shared_ptr<sigrok::Device> device = session_.device();
+       if (!device)
+               return;
+
+       const string display_name = device_manager_.get_display_name(device);
+       setWindowTitle(tr("%1 - PulseView").arg(display_name.c_str()));
+}
+
 } // namespace pv
index 9a000c2a261f54e3123cdaf7c81d9bc0459e4c12..333eda2a0a75dfbc02f9c534444d389d42498efa 100644 (file)
@@ -103,6 +103,7 @@ private Q_SLOTS:
        void run_stop();
 
        void capture_state_changed(int state);
+       void device_selected();
 
 private:
        /**
index f3eb19460593141de7b33740bb94eb2d0e69f4a3..fb457f6dcd7599003cf0d0b9981e3c07424fc507 100644 (file)
@@ -153,6 +153,8 @@ void SigSession::set_device(shared_ptr<Device> device)
                        });
                update_signals(device);
        }
+
+       device_selected();
 }
 
 void SigSession::set_file(const string &name)
@@ -166,6 +168,7 @@ void SigSession::set_file(const string &name)
                });
        device_manager_.update_display_name(device_);
        update_signals(device_);
+       device_selected();
 }
 
 void SigSession::set_default_device()
index 513177be356a24ac5fe88e1acbe75702a58fa68e..5f613bf93af4fe5c6e87bef1509383e9c01be79b 100644 (file)
@@ -174,6 +174,7 @@ private:
 
 Q_SIGNALS:
        void capture_state_changed(int state);
+       void device_selected();
 
        void signals_changed();