X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fmainbar.cpp;h=188786f1f1691019499e402a0c2ce425774d1fba;hb=87a97d8aa169936ec2dcd229df88b8c5b4a1411c;hp=2c64867f89ca3f4d566814ec7be90262bf2bea05;hpb=f4ce3e772e3dad5b59f1ab27a6a3c01fdbfb8e1d;p=pulseview.git diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 2c64867..188786f 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include @@ -214,9 +213,11 @@ MainBar::MainBar(Session &session, QWidget *parent, set_capture_state(pv::Session::Stopped); + configure_button_.setToolTip(tr("Configure Device")); configure_button_.setIcon(QIcon::fromTheme("configure", QIcon(":/icons/configure.png"))); + channels_button_.setToolTip(tr("Configure Channels")); channels_button_.setIcon(QIcon::fromTheme("channels", QIcon(":/icons/channels.svg"))); @@ -402,9 +403,12 @@ void MainBar::update_sample_count_selector() uint64_t sample_count = sample_count_.value(); uint64_t min_sample_count = 0; uint64_t max_sample_count = MaxSampleCount; + bool default_count_set = false; - if (sample_count == 0) + if (sample_count == 0) { sample_count = DefaultSampleCount; + default_count_set = true; + } if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::LIST)) { auto gvar = sr_dev->config_list(ConfigKey::LIMIT_SAMPLES); @@ -422,8 +426,10 @@ void MainBar::update_sample_count_selector() if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::GET)) { auto gvar = sr_dev->config_get(ConfigKey::LIMIT_SAMPLES); sample_count = g_variant_get_uint64(gvar.gobj()); - if (sample_count == 0) + if (sample_count == 0) { sample_count = DefaultSampleCount; + default_count_set = true; + } sample_count = min(max(sample_count, MinSampleCount), max_sample_count); } @@ -431,6 +437,10 @@ void MainBar::update_sample_count_selector() sample_count_.set_value(sample_count); updating_sample_count_ = false; + + // If we show the default rate then make sure the device uses the same + if (default_count_set) + commit_sample_count(); } void MainBar::update_device_config_widgets() @@ -601,9 +611,10 @@ void MainBar::export_file(shared_ptr format, const pv::util::Timestamp& start_time = trace_view->cursors()->first()->time(); const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time(); - const uint64_t start_sample = - std::max((double)0, start_time.convert_to() * samplerate); - const uint64_t end_sample = end_time.convert_to() * samplerate; + const uint64_t start_sample = (uint64_t)std::max( + (double)0, start_time.convert_to() * samplerate); + const uint64_t end_sample = (uint64_t)std::max( + (double)0, end_time.convert_to() * samplerate); sample_range = std::make_pair(start_sample, end_sample); } else {