projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MainBar: Make sure device and GUI are in sync on startup
[pulseview.git]
/
pv
/
toolbars
/
mainbar.cpp
diff --git
a/pv/toolbars/mainbar.cpp
b/pv/toolbars/mainbar.cpp
index e77f18bb4e7ec861f32c55ccc38377080d9e5724..9bebda80061c1d29a5216a4188f2a09c3a911ce2 100644
(file)
--- 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
* 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 <http://www.gnu.org/licenses/>.
*/
#include <extdef.h>
*/
#include <extdef.h>
@@
-214,9
+213,11
@@
MainBar::MainBar(Session &session, QWidget *parent,
set_capture_state(pv::Session::Stopped);
set_capture_state(pv::Session::Stopped);
+ configure_button_.setToolTip(tr("Configure Device"));
configure_button_.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/configure.png")));
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")));
channels_button_.setIcon(QIcon::fromTheme("channels",
QIcon(":/icons/channels.svg")));
@@
-227,7
+228,7
@@
MainBar::MainBar(Session &session, QWidget *parent,
// Setup session_ events
connect(&session_, SIGNAL(capture_state_changed(int)),
// Setup session_ events
connect(&session_, SIGNAL(capture_state_changed(int)),
- this, SLOT(capture_state_changed(int)));
+ this, SLOT(
on_
capture_state_changed(int)));
connect(&session, SIGNAL(device_changed()),
this, SLOT(on_device_changed()));
connect(&session, SIGNAL(device_changed()),
this, SLOT(on_device_changed()));
@@
-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;
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;
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);
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 (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;
sample_count = DefaultSampleCount;
+ default_count_set = true;
+ }
sample_count = min(max(sample_count, MinSampleCount),
max_sample_count);
}
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;
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()
}
void MainBar::update_device_config_widgets()
@@
-561,11
+571,6
@@
void MainBar::show_session_error(const QString text, const QString info_text)
msg.exec();
}
msg.exec();
}
-void MainBar::capture_state_changed(int state)
-{
- set_capture_state((pv::Session::capture_state)state);
-}
-
void MainBar::add_decoder(srd_decoder *decoder)
{
#ifdef ENABLE_DECODE
void MainBar::add_decoder(srd_decoder *decoder)
{
#ifdef ENABLE_DECODE
@@
-715,6
+720,11
@@
void MainBar::on_device_changed()
update_device_config_widgets();
}
update_device_config_widgets();
}
+void MainBar::on_capture_state_changed(int state)
+{
+ set_capture_state((pv::Session::capture_state)state);
+}
+
void MainBar::on_sample_count_changed()
{
if (!updating_sample_count_)
void MainBar::on_sample_count_changed()
{
if (!updating_sample_count_)